13 #ifndef MLIR_EXECUTIONENGINE_SPARSETENSOR_MAPREF_H
14 #define MLIR_EXECUTIONENGINE_SPARSETENSOR_MAPREF_H
22 namespace sparse_tensor {
35 MapRef(uint64_t d, uint64_t l,
const uint64_t *d2l,
const uint64_t *l2d);
45 for (uint64_t l = 0; l < lvlRank; l++) {
46 out[l] = in[dim2lvl[l]];
50 for (uint64_t l = 0; l < lvlRank; l++)
51 if (isFloor(l, i, c)) {
53 }
else if (isMod(l, i, c)) {
56 out[l] = in[dim2lvl[l]];
69 for (uint64_t d = 0; d < dimRank; d++)
70 out[d] = in[lvl2dim[d]];
73 for (uint64_t d = 0; d < dimRank; d++)
74 if (isMul(d, i, c, ii)) {
75 out[d] = in[i] + c * in[ii];
77 out[d] = in[lvl2dim[d]];
86 bool isPermutationMap()
const;
88 bool isFloor(uint64_t l, uint64_t &i, uint64_t &c)
const;
89 bool isMod(uint64_t l, uint64_t &i, uint64_t &c)
const;
90 bool isMul(uint64_t d, uint64_t &i, uint64_t &c, uint64_t &ii)
const;
92 const uint64_t dimRank;
93 const uint64_t lvlRank;
94 const uint64_t *
const dim2lvl;
95 const uint64_t *
const lvl2dim;
96 const bool isPermutation;
A class for capturing the sparse tensor type map with a compact encoding.
void pushforward(const T *in, T *out) const
uint64_t getLvlRank() const
MapRef(uint64_t d, uint64_t l, const uint64_t *d2l, const uint64_t *l2d)
void pushbackward(const T *in, T *out) const
uint64_t getDimRank() const
Include the generated interface declarations.