MLIR: lib/Dialect/SparseTensor/Transforms/Utils/SparseTensorIterator.cpp File Reference (original) (raw)

Go to the source code of this file.

Macros
#define CMPI(p, lhs, rhs)
#define C_FALSE (constantI1(b, l, false))
#define C_TRUE (constantI1(b, l, true))
#define C_IDX(v) (constantIndex(b, l, (v)))
#define YIELD(vs) (b.createscf::YieldOp(l, (vs)))
#define ADDI(lhs, rhs) (b.createarith::AddIOp(l, (lhs), (rhs)).getResult())
#define ORI(lhs, rhs) (b.createarith::OrIOp(l, (lhs), (rhs)).getResult())
#define ANDI(lhs, rhs) (b.createarith::AndIOp(l, (lhs), (rhs)).getResult())
#define SUBI(lhs, rhs) (b.createarith::SubIOp(l, (lhs), (rhs)).getResult())
#define MULI(lhs, rhs) (b.createarith::MulIOp(l, (lhs), (rhs)).getResult())
#define MINUI(lhs, rhs) (b.createarith::MinUIOp(l, (lhs), (rhs)).getResult())
#define REMUI(lhs, rhs) (b.createarith::RemUIOp(l, (lhs), (rhs)).getResult())
#define DIVUI(lhs, rhs) (b.createarith::DivUIOp(l, (lhs), (rhs)).getResult())
#define SELECT(c, lhs, rhs) (b.createarith::SelectOp(l, (c), (lhs), (rhs)).getResult())
Functions
static scf::ValueVector genWhenInBound (OpBuilder &b, Location l, SparseIterator &it, ValueRange elseRet, llvm::function_ref< scf::ValueVector(OpBuilder &, Location, Value)> builder)
static Value offsetFromMinCrd (OpBuilder &b, Location l, Value minCrd, Value size)
Generates code to compute the absolute offset of the slice based on the provide minimum coordinates in the slice. More...
static const SparseIterator * tryUnwrapFilter (const SparseIterator *it)

ADDI

| #define ADDI | ( | | lhs, | | ------------ | ------------------------------------------------------ | | ---- | | | rhs | | | | | ) | (b.createarith::AddIOp(l, (lhs), (rhs)).getResult()) | | |

ANDI

| #define ANDI | ( | | lhs, | | ------------ | ------------------------------------------------------ | | ---- | | | rhs | | | | | ) | (b.createarith::AndIOp(l, (lhs), (rhs)).getResult()) | | |

C_FALSE

#define C_FALSE (constantI1(b, l, false))

C_IDX

| #define C_IDX | ( | | v | ) | (constantIndex(b, l, (v))) | | -------------- | - | | - | - | -------------------------- |

C_TRUE

#define C_TRUE (constantI1(b, l, true))

CMPI

| #define CMPI | ( | | p, | | ------------ | - | | -- | | | lhs, | | | | | | rhs | | | | | ) | | | |

Value:

(b.createarith::CmpIOp(l, arith::CmpIPredicate::p, (lhs), (rhs)) \

.getResult())

Definition at line 24 of file SparseTensorIterator.cpp.

DIVUI

| #define DIVUI | ( | | lhs, | | ------------- | ------------------------------------------------------- | | ---- | | | rhs | | | | | ) | (b.createarith::DivUIOp(l, (lhs), (rhs)).getResult()) | | |

MINUI

| #define MINUI | ( | | lhs, | | ------------- | ------------------------------------------------------- | | ---- | | | rhs | | | | | ) | (b.createarith::MinUIOp(l, (lhs), (rhs)).getResult()) | | |

MULI

| #define MULI | ( | | lhs, | | ------------ | ------------------------------------------------------ | | ---- | | | rhs | | | | | ) | (b.createarith::MulIOp(l, (lhs), (rhs)).getResult()) | | |

ORI

| #define ORI | ( | | lhs, | | ----------- | ----------------------------------------------------- | | ---- | | | rhs | | | | | ) | (b.createarith::OrIOp(l, (lhs), (rhs)).getResult()) | | |

REMUI

| #define REMUI | ( | | lhs, | | ------------- | ------------------------------------------------------- | | ---- | | | rhs | | | | | ) | (b.createarith::RemUIOp(l, (lhs), (rhs)).getResult()) | | |

SELECT

| #define SELECT | ( | | c, | | -------------- | ------------------------------------------------------------- | | -- | | | lhs, | | | | | | rhs | | | | | ) | (b.createarith::SelectOp(l, (c), (lhs), (rhs)).getResult()) | | |

SUBI

| #define SUBI | ( | | lhs, | | ------------ | ------------------------------------------------------ | | ---- | | | rhs | | | | | ) | (b.createarith::SubIOp(l, (lhs), (rhs)).getResult()) | | |

YIELD

| #define YIELD | ( | | vs | ) | (b.createscf::YieldOp(l, (vs))) | | ------------- | - | | -- | - | --------------------------------- |

ValuePair

ValueTuple

genWhenInBound()

offsetFromMinCrd()

Generates code to compute the absolute offset of the slice based on the provide minimum coordinates in the slice.

E.g., when reducing d0 + d1 + d2, we need two slices to fully reduced the expression, i,e, s1 = slice(T, d0), s2 = slice(s1, d1). The absolute offset is the offset computed relative to the initial tensors T.

When isNonEmpty == true, the computed offset is meaningless and should not be used during runtime, the method generates code to return 0 currently in that case.

offset = minCrd >= size ? minCrd - size + 1 : 0;

Definition at line 276 of file SparseTensorIterator.cpp.

References ADDI, C_IDX, CMPI, SELECT, and SUBI.

tryUnwrapFilter()