MLIR 22.0.0git
SparseTensorIterator.cpp File Reference

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)
#define YIELD(vs)
#define ADDI(lhs, rhs)
#define ORI(lhs, rhs)
#define ANDI(lhs, rhs)
#define SUBI(lhs, rhs)
#define MULI(lhs, rhs)
#define MINUI(lhs, rhs)
#define REMUI(lhs, rhs)
#define DIVUI(lhs, rhs)
#define SELECT(c, lhs, rhs)

Typedefs

using ValuePair = std::pair<Value, Value>
using ValueTuple = std::tuple<Value, Value, Value>

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.
static const SparseIteratortryUnwrapFilter (const SparseIterator *it)

Macro Definition Documentation

◆ ADDI

#define ADDI ( lhs,
rhs )
Value:
(arith::AddIOp::create(b, l, (lhs), (rhs)).getResult())
lhs
b
Return true if permutation is a valid permutation of the outer_dims_perm (case OuterOrInnerPerm::Oute...

Definition at line 32 of file SparseTensorIterator.cpp.

Referenced by offsetFromMinCrd().

◆ ANDI

#define ANDI ( lhs,
rhs )
Value:
(arith::AndIOp::create(b, l, (lhs), (rhs)).getResult())

Definition at line 34 of file SparseTensorIterator.cpp.

◆ C_FALSE

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

Definition at line 28 of file SparseTensorIterator.cpp.

◆ C_IDX

#define C_IDX ( v)
Value:
(constantIndex(b, l, (v)))
Value constantIndex(OpBuilder &builder, Location loc, int64_t i)
Generates a constant of index type.

Definition at line 30 of file SparseTensorIterator.cpp.

Referenced by offsetFromMinCrd().

◆ C_TRUE

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

Definition at line 29 of file SparseTensorIterator.cpp.

◆ CMPI

#define CMPI ( p,
lhs,
rhs )
Value:
(arith::CmpIOp::create(b, l, arith::CmpIPredicate::p, (lhs), (rhs)) \
.getResult())

Definition at line 24 of file SparseTensorIterator.cpp.

Referenced by offsetFromMinCrd().

◆ DIVUI

#define DIVUI ( lhs,
rhs )
Value:
(arith::DivUIOp::create(b, l, (lhs), (rhs)).getResult())

Definition at line 39 of file SparseTensorIterator.cpp.

◆ MINUI

#define MINUI ( lhs,
rhs )
Value:
(arith::MinUIOp::create(b, l, (lhs), (rhs)).getResult())

Definition at line 37 of file SparseTensorIterator.cpp.

Referenced by mlir::gpu::convertReductionKind().

◆ MULI

#define MULI ( lhs,
rhs )
Value:
(arith::MulIOp::create(b, l, (lhs), (rhs)).getResult())

Definition at line 36 of file SparseTensorIterator.cpp.

◆ ORI

#define ORI ( lhs,
rhs )
Value:
(arith::OrIOp::create(b, l, (lhs), (rhs)).getResult())

Definition at line 33 of file SparseTensorIterator.cpp.

◆ REMUI

#define REMUI ( lhs,
rhs )
Value:
(arith::RemUIOp::create(b, l, (lhs), (rhs)).getResult())

Definition at line 38 of file SparseTensorIterator.cpp.

◆ SELECT

#define SELECT ( c,
lhs,
rhs )
Value:
(arith::SelectOp::create(b, l, (c), (lhs), (rhs)).getResult())

Definition at line 40 of file SparseTensorIterator.cpp.

Referenced by offsetFromMinCrd().

◆ SUBI

#define SUBI ( lhs,
rhs )
Value:
(arith::SubIOp::create(b, l, (lhs), (rhs)).getResult())

Definition at line 35 of file SparseTensorIterator.cpp.

Referenced by offsetFromMinCrd().

◆ YIELD

#define YIELD ( vs)
Value:
(scf::YieldOp::create(b, l, (vs)))

Definition at line 31 of file SparseTensorIterator.cpp.

Referenced by genWhenInBound().

Typedef Documentation

◆ ValuePair

using ValuePair = std::pair<Value, Value>

Definition at line 18 of file SparseTensorIterator.cpp.

◆ ValueTuple

using ValueTuple = std::tuple<Value, Value, Value>

Definition at line 19 of file SparseTensorIterator.cpp.

Function Documentation

◆ genWhenInBound()

◆ offsetFromMinCrd()

Value offsetFromMinCrd ( OpBuilder & b,
Location l,
Value minCrd,
Value size )
static

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, b, C_IDX, CMPI, SELECT, and SUBI.

◆ tryUnwrapFilter()