MLIR 22.0.0git
mlir::sparse_tensor::Merger Class Reference

A class to handle all iteration lattice operations. More...

#include "mlir/Dialect/SparseTensor/Utils/Merger.h"

Public Types

using ForeachTensorLoopIdCallback

Public Member Functions

 Merger (unsigned numInputOutputTensors, unsigned numLoops, unsigned maxLvlRank)
 Constructs a merger for the given number of tensors and loops.
constexpr TensorId makeTensorId (unsigned t) const
 Safely converts the argument to a tensor identifier.
constexpr LoopId makeLoopId (unsigned i) const
 Safely converts the argument to a loop identifier.
constexpr TensorLoopId makeTensorLoopId (unsigned t, unsigned i) const
 Safely converts the arguments to a pair of (tensor,loop) identifiers.
ExprId addTensorExp (TensorId t)
 Constructs a new tensor expression, and returns its identifier.
ExprId addLoopVarExp (LoopId i)
 Constructs a new loop-variable expression, and returns its identifier.
ExprId addInvariantExp (Value v)
 Constructs a new invariant expression, and returns its identifier.
ExprId addSynZeroExp ()
 Constructs a new synthetic zero expression.
ExprId addExp (TensorExp::Kind k, ExprId e0, ExprId e1=detail::kInvalidId, Operation *op=nullptr, Attribute attr=nullptr)
 Constructs a new unary or binary expression, and returns its identifier.
ExprId addExp (TensorExp::Kind k, ExprId e, Value v, Operation *op=nullptr, Attribute attr=nullptr)
 Constructs a new sesquinary expression, and returns its identifier.
LatPointId addLat (TensorId t, LoopId i, ExprId e)
 Constructs a new iteration lattice point, and returns its identifier.
LatPointId addLat (const BitVector &bits, ExprId e)
LatSetId addSet ()
 Constructs a new (initially empty) set, and returns its identifier.
LatPointId conjLat (ExprId e, LatPointId p0, LatPointId p1, Operation *op=nullptr)
 Computes a single conjunction of two lattice points by taking the "union" of LoopId (effectively constructing a larger "intersection" of those loops) with a newly constructed tensor (sub)expression of given kind.
LatSetId conjSet (ExprId e, LatSetId s0, LatSetId s1, Operation *op=nullptr)
 Conjunctive merge of two lattice sets: (s0 /\_op s1).
LatSetId disjSet (ExprId e, LatSetId s0, LatSetId s1, Operation *op=nullptr)
 Disjunctive merge of two lattice sets: (s0 /\_op s1, s0, s1).
LatSetId disjSetWithZero (ExprId e, LatSetId s0, LatSetId s1)
 Disjunctive merge of two lattice sets and also set one of the operand to zero: (s0 /\_op s1 (e0 op e1), s0 (0 op e0), s1 (e1 op 0)).
LatSetId combiSet (ExprId e, LatSetId s0, LatSetId s1, Operation *orig, bool includeLeft, TensorExp::Kind ltrans, Operation *opleft, bool includeRight, TensorExp::Kind rtrans, Operation *opright)
 Disjunctive merge of two lattice sets with custom handling of the overlap, left, and right regions.
LatSetId mapSet (TensorExp::Kind kind, LatSetId s, Value v=Value(), Operation *op=nullptr, Attribute attr=nullptr)
 Maps the unary operator over the lattice set of the operand, i.e.
LatSetId mapBinWithSynZeroSet (ExprId e, LatSetId s, bool lhsZero)
 Maps the binary operator to the same operation but with one of its operand set to zero, i.e.
LatSetId optimizeSet (LatSetId s)
 Optimizes the iteration lattice points in the given set.
BitVector simplifyCond (LatSetId s, LatPointId p)
 Simplifies the conditions in a conjunction of a given lattice point within the given set using just two basic rules: (1) multiple dense conditions are reduced to single dense, and (2) a singleton sparse/dense is reduced to sparse/random access.
bool latGT (LatPointId p0, LatPointId p1) const
 Returns true if p0 > p1.
bool onlyDenseDiff (LatPointId p0, LatPointId p1) const
 Returns true if p0 and p1 only differ in dense.
constexpr TensorId tensor (TensorLoopId b) const
 Gets the tensor-identifier of the TensorLoopId.
constexpr LoopId loop (TensorLoopId b) const
 Gets the loop-identifier of the TensorLoopId.
constexpr unsigned getNumTensors () const
 Gets the total number of tensors (including the output-tensor and synthetic-tensor).
constexpr unsigned getNumLoops () const
 Gets the total number of loops (native loops + filter loops).
constexpr bool isOutTensor (TensorLoopId b, LoopId i) const
 Returns true if b is the ith loop of the output tensor.
constexpr TensorId getOutTensorID () const
 Gets the output tensor's identifier.
constexpr TensorId getSynTensorID () const
 Gets the synthetic tensor's identifier (used for all invariant tensor expressions).
bool expIsTensor (ExprId e, TensorId t) const
 Returns true if the expression is (kTensor t).
bool expContainsTensor (ExprId e, TensorId t) const
 Returns true if the expression contains the tensor as an operand.
bool hasNegateOnOut (ExprId e) const
 Returns true if the expression contains a negation on output tensor.
bool isSingleCondition (TensorId t, ExprId e) const
 Returns true if given tensor iterates only in the given tensor expression.
bool hasAnySparse (const BitVector &bits) const
 Returns true if any TensorLoopId in the bitvector corresponds to sparse level-type.
bool hasSparseIdxReduction (const BitVector &bits) const
 Returns true if bits contains a dependent index reduction condition on sparse levels.
LevelType getLvlType (TensorId t, LoopId i) const
 Gets the level-type of the tth tensor on ith loop.
LevelType getLvlType (TensorLoopId b) const
 Gets the level-type of the TensorLoopId.
std::optional< LoopIdgetLoopId (TensorId t, Level lvl) const
 Gets the loop identifier for the lvlth level of the tth tensor.
std::optional< LevelgetLvl (TensorId t, LoopId i) const
 Gets the level number of the the tth tensor on ith loop.
std::optional< LevelgetLvl (TensorLoopId b) const
void setLevelAndType (TensorId t, LoopId i, Level lvl, LevelType lt)
 Sets the level number and level-type of the tth tensor on ith loop.
void foreachTensorLoopId (LatPointId p, ForeachTensorLoopIdCallback callback) const
 Iterates over a set of TensorLoopIds, invoking the callback for each TensorLoopId and passing it the corresponding tensor identifier, level, and level-type, following with a boolean value indicating whether it is a dependent index reduction loop condition.
void foreachTensorLoopId (LatPointId p, bool simple, ForeachTensorLoopIdCallback callback) const
void setHasSparseOut (bool s)
 Sets whether the output tensor is sparse or not.
void setLoopDependentTensorLevel (LoopId i, TensorId t, Level lvl, LevelType lt, unsigned coefficient)
 Establishes the two-way map that i <-> <t, lvl, lt>.
bool hasDependentLvl (LoopId i, TensorId t)
 Whether the loop has dependent slice.
std::vector< LoopCoeffPair > & getDependentLoops (TensorId t, Level lvl)
 Returns the list of loop indices which appear in the non-trivial index expression on t_l, e.g., A[i+j] => {i, j}.
std::pair< TensorId, LevelgetLoopDefiningLvl (LoopId i) const
 Returns the defining [tid, lvl] for the loop.
bool isLvlWithNonTrivialIdxExp (TensorLoopId b) const
 Checks whether the TensorLoopId represents a tensor level contains non-trivial index expression.
bool isSparseLvlWithNonTrivialIdxExp (TensorLoopId b) const
 Checks whether the TensorLoopId represents a sparse tensor level contains non-trivial index expression.
Level getLoopDependentLevel (TensorLoopId b) const
LevelType getLoopDependentLevelType (TensorLoopId b) const
const TensorExpexp (ExprId e) const
 Convenience getters to immediately access the stored nodes.
const LatPointlat (LatPointId p) const
ArrayRef< LatPointIdset (LatSetId s) const
bool hasExprValue (ExprId e) const
 Checks whether the given expression has an associated value.
void setExprValue (ExprId e, Value v)
 Sets the expression to have the associated value.
void clearExprValue (ExprId e)
 Clears the value associated with the expression.
void dumpExp (ExprId e) const
 Print methods (for debugging).
void dumpLat (LatPointId p) const
void dumpSet (LatSetId s) const
void dumpBits (const BitVector &bits) const
LatSetId buildLattices (ExprId e, LoopId i)
 Builds the iteration lattices in a bottom-up traversal given the remaining tensor (sub)expression and the next loop in the iteration graph.
std::optional< ExprIdbuildTensorExpFromLinalg (linalg::GenericOp op)
 Builds a tensor expression from the given Linalg operation.
Value buildExp (RewriterBase &rewriter, Location loc, ExprId e, Value v0, Value v1) const
 Rebuilds SSA format from a tensor expression.

Detailed Description

A class to handle all iteration lattice operations.

This class abstracts away from some implementation details of storing iteration lattices and tensor expressions. This allows for fine-tuning performance characteristics independently from the basic algorithm if bottlenecks are identified.

Definition at line 225 of file Merger.h.

Member Typedef Documentation

◆ ForeachTensorLoopIdCallback

Initial value:
TensorLoopId, TensorId, std::optional<Level>, LevelType, bool)>
unsigned TensorId
Tensor identifiers, chosen to be the BlockArgument::getArgNumber of the value passed to Merger::build...
Definition Merger.h:35
unsigned TensorLoopId
A compressed representation of std::pair<TensorId, LoopId>.
Definition Merger.h:44
llvm::function_ref< Fn > function_ref
Definition LLVM.h:152
This enum defines all the sparse representations supportable by the SparseTensor dialect.
Definition Enums.h:238

Definition at line 435 of file Merger.h.

Constructor & Destructor Documentation

◆ Merger()

mlir::sparse_tensor::Merger::Merger ( unsigned numInputOutputTensors,
unsigned numLoops,
unsigned maxLvlRank )

Constructs a merger for the given number of tensors and loops.

The user supplies the number of tensors involved in the kernel, with the last tensor in this set denoting the output tensor. The merger adds an additional synthetic tensor at the end of this set to represent all invariant expressions in the kernel.

The maxLvlRank specifies the max level rank of all inputs/output tensors. It is used to pre-allocate sufficient memory for internal storage.

Definition at line 224 of file Merger.cpp.

References false, and mlir::sparse_tensor::Undef.

Member Function Documentation

◆ addExp() [1/2]

ExprId mlir::sparse_tensor::Merger::addExp ( TensorExp::Kind k,
ExprId e,
Value v,
Operation * op = nullptr,
Attribute attr = nullptr )

Constructs a new sesquinary expression, and returns its identifier.

Currently no sesquinary Kind allows specifying the op, but we allow it anyways because mapSet is designed to allow it.

Definition at line 285 of file Merger.cpp.

References mlir::sparse_tensor::detail::kInvalidId, and mlir::sparse_tensor::TensorExp::kLoopVar.

◆ addExp() [2/2]

ExprId mlir::sparse_tensor::Merger::addExp ( TensorExp::Kind k,
ExprId e0,
ExprId e1 = detail::kInvalidId,
Operation * op = nullptr,
Attribute attr = nullptr )

Constructs a new unary or binary expression, and returns its identifier.

Definition at line 277 of file Merger.cpp.

References mlir::sparse_tensor::TensorExp::kLoopVar.

Referenced by conjLat(), mapBinWithSynZeroSet(), and mapSet().

◆ addInvariantExp()

ExprId mlir::sparse_tensor::Merger::addInvariantExp ( Value v)

Constructs a new invariant expression, and returns its identifier.

Definition at line 263 of file Merger.cpp.

References mlir::sparse_tensor::detail::kInvalidId, and mlir::sparse_tensor::TensorExp::kInvariant.

Referenced by buildLattices().

◆ addLat() [1/2]

LatPointId mlir::sparse_tensor::Merger::addLat ( const BitVector & bits,
ExprId e )

Definition at line 302 of file Merger.cpp.

◆ addLat() [2/2]

LatPointId mlir::sparse_tensor::Merger::addLat ( TensorId t,
LoopId i,
ExprId e )

Constructs a new iteration lattice point, and returns its identifier.

Definition at line 293 of file Merger.cpp.

References b, and makeTensorLoopId().

Referenced by buildLattices(), mapBinWithSynZeroSet(), and mapSet().

◆ addLoopVarExp()

ExprId mlir::sparse_tensor::Merger::addLoopVarExp ( LoopId i)

Constructs a new loop-variable expression, and returns its identifier.

Definition at line 255 of file Merger.cpp.

References mlir::sparse_tensor::detail::kInvalidId, and mlir::sparse_tensor::TensorExp::kLoopVar.

◆ addSet()

LatSetId mlir::sparse_tensor::Merger::addSet ( )

Constructs a new (initially empty) set, and returns its identifier.

Definition at line 309 of file Merger.cpp.

Referenced by buildLattices(), conjSet(), mapBinWithSynZeroSet(), mapSet(), and optimizeSet().

◆ addSynZeroExp()

ExprId mlir::sparse_tensor::Merger::addSynZeroExp ( )

Constructs a new synthetic zero expression.

Definition at line 270 of file Merger.cpp.

References mlir::sparse_tensor::detail::kInvalidId, and mlir::sparse_tensor::TensorExp::kSynZero.

Referenced by mapBinWithSynZeroSet().

◆ addTensorExp()

ExprId mlir::sparse_tensor::Merger::addTensorExp ( TensorId t)

Constructs a new tensor expression, and returns its identifier.

Definition at line 247 of file Merger.cpp.

References mlir::sparse_tensor::detail::kInvalidId, and mlir::sparse_tensor::TensorExp::kTensor.

◆ buildExp()

Value mlir::sparse_tensor::Merger::buildExp ( RewriterBase & rewriter,
Location loc,
ExprId e,
Value v0,
Value v1 ) const

Rebuilds SSA format from a tensor expression.

Definition at line 1618 of file Merger.cpp.

References mlir::sparse_tensor::buildBinaryOverlap(), mlir::sparse_tensor::buildRelu(), mlir::sparse_tensor::buildUnaryPresent(), mlir::OpBuilder::clone(), exp(), mlir::Operation::getNumOperands(), mlir::Operation::getOperand(), mlir::Operation::getResult(), mlir::Value::getType(), mlir::Builder::getZeroAttr(), mlir::sparse_tensor::insertYieldOp(), mlir::sparse_tensor::TensorExp::kAbsC, mlir::sparse_tensor::TensorExp::kAbsF, mlir::sparse_tensor::TensorExp::kAbsI, mlir::sparse_tensor::TensorExp::kAddC, mlir::sparse_tensor::TensorExp::kAddF, mlir::sparse_tensor::TensorExp::kAddI, mlir::sparse_tensor::TensorExp::kAndI, mlir::sparse_tensor::TensorExp::kBinary, mlir::sparse_tensor::TensorExp::kBinaryBranch, mlir::sparse_tensor::TensorExp::kBitCast, mlir::sparse_tensor::TensorExp::kCastFS, mlir::sparse_tensor::TensorExp::kCastFU, mlir::sparse_tensor::TensorExp::kCastIdx, mlir::sparse_tensor::TensorExp::kCastS, mlir::sparse_tensor::TensorExp::kCastSF, mlir::sparse_tensor::TensorExp::kCastU, mlir::sparse_tensor::TensorExp::kCastUF, mlir::sparse_tensor::TensorExp::kCeilF, mlir::sparse_tensor::TensorExp::kCIm, mlir::sparse_tensor::TensorExp::kCmpF, mlir::sparse_tensor::TensorExp::kCmpI, mlir::sparse_tensor::TensorExp::kCRe, mlir::sparse_tensor::TensorExp::kDenseOp, mlir::sparse_tensor::TensorExp::kDivC, mlir::sparse_tensor::TensorExp::kDivF, mlir::sparse_tensor::TensorExp::kDivS, mlir::sparse_tensor::TensorExp::kDivU, mlir::sparse_tensor::TensorExp::kExpm1C, mlir::sparse_tensor::TensorExp::kExpm1F, mlir::sparse_tensor::TensorExp::kExtF, mlir::sparse_tensor::TensorExp::kFloorF, mlir::sparse_tensor::TensorExp::kInvariant, mlir::sparse_tensor::TensorExp::kLog1pC, mlir::sparse_tensor::TensorExp::kLog1pF, mlir::sparse_tensor::TensorExp::kLoopVar, mlir::sparse_tensor::TensorExp::kMulC, mlir::sparse_tensor::TensorExp::kMulF, mlir::sparse_tensor::TensorExp::kMulI, mlir::sparse_tensor::TensorExp::kNegC, mlir::sparse_tensor::TensorExp::kNegF, mlir::sparse_tensor::TensorExp::kNegI, mlir::sparse_tensor::TensorExp::kOrI, mlir::sparse_tensor::TensorExp::kReduce, mlir::sparse_tensor::TensorExp::kRelu, mlir::sparse_tensor::TensorExp::kSelect, mlir::sparse_tensor::TensorExp::kShlI, mlir::sparse_tensor::TensorExp::kShrS, mlir::sparse_tensor::TensorExp::kShrU, mlir::sparse_tensor::TensorExp::kSinC, mlir::sparse_tensor::TensorExp::kSinF, mlir::sparse_tensor::TensorExp::kSqrtC, mlir::sparse_tensor::TensorExp::kSqrtF, mlir::sparse_tensor::TensorExp::kSubC, mlir::sparse_tensor::TensorExp::kSubF, mlir::sparse_tensor::TensorExp::kSubI, mlir::sparse_tensor::TensorExp::kSynZero, mlir::sparse_tensor::TensorExp::kTanhC, mlir::sparse_tensor::TensorExp::kTanhF, mlir::sparse_tensor::TensorExp::kTensor, mlir::sparse_tensor::TensorExp::kTruncF, mlir::sparse_tensor::TensorExp::kTruncI, mlir::sparse_tensor::TensorExp::kUnary, mlir::sparse_tensor::TensorExp::kXorI, and mlir::IRMapping::map().

Referenced by genExp().

◆ buildLattices()

LatSetId mlir::sparse_tensor::Merger::buildLattices ( ExprId e,
LoopId i )

Builds the iteration lattices in a bottom-up traversal given the remaining tensor (sub)expression and the next loop in the iteration graph.

Returns the identifier of the root set.

Definition at line 940 of file Merger.cpp.

References addInvariantExp(), addLat(), addSet(), buildLattices(), combiSet(), conjSet(), disjSet(), disjSetWithZero(), mlir::Region::empty(), exp(), mlir::Region::front(), mlir::Block::getTerminator(), mlir::sparse_tensor::TensorExp::kAbsC, mlir::sparse_tensor::TensorExp::kAbsF, mlir::sparse_tensor::TensorExp::kAbsI, mlir::sparse_tensor::TensorExp::kAddC, mlir::sparse_tensor::TensorExp::kAddF, mlir::sparse_tensor::TensorExp::kAddI, mlir::sparse_tensor::TensorExp::kAndI, mlir::sparse_tensor::TensorExp::kBinary, mlir::sparse_tensor::TensorExp::kBinaryBranch, mlir::sparse_tensor::TensorExp::kBitCast, mlir::sparse_tensor::TensorExp::kCastFS, mlir::sparse_tensor::TensorExp::kCastFU, mlir::sparse_tensor::TensorExp::kCastIdx, mlir::sparse_tensor::TensorExp::kCastS, mlir::sparse_tensor::TensorExp::kCastSF, mlir::sparse_tensor::TensorExp::kCastU, mlir::sparse_tensor::TensorExp::kCastUF, mlir::sparse_tensor::TensorExp::kCeilF, mlir::sparse_tensor::TensorExp::kCIm, mlir::sparse_tensor::TensorExp::kCmpF, mlir::sparse_tensor::TensorExp::kCmpI, mlir::sparse_tensor::TensorExp::kCRe, mlir::sparse_tensor::TensorExp::kDenseOp, mlir::sparse_tensor::TensorExp::kDivC, mlir::sparse_tensor::TensorExp::kDivF, mlir::sparse_tensor::TensorExp::kDivS, mlir::sparse_tensor::TensorExp::kDivU, mlir::sparse_tensor::TensorExp::kExpm1C, mlir::sparse_tensor::TensorExp::kExpm1F, mlir::sparse_tensor::TensorExp::kExtF, mlir::sparse_tensor::TensorExp::kFloorF, mlir::sparse_tensor::detail::kInvalidId, mlir::sparse_tensor::TensorExp::kInvariant, mlir::sparse_tensor::TensorExp::kLog1pC, mlir::sparse_tensor::TensorExp::kLog1pF, mlir::sparse_tensor::TensorExp::kLoopVar, mlir::sparse_tensor::TensorExp::kMulC, mlir::sparse_tensor::TensorExp::kMulF, mlir::sparse_tensor::TensorExp::kMulI, mlir::sparse_tensor::TensorExp::kNegC, mlir::sparse_tensor::TensorExp::kNegF, mlir::sparse_tensor::TensorExp::kNegI, mlir::sparse_tensor::TensorExp::kOrI, mlir::sparse_tensor::TensorExp::kReduce, mlir::sparse_tensor::TensorExp::kRelu, mlir::sparse_tensor::TensorExp::kSelect, mlir::sparse_tensor::TensorExp::kShlI, mlir::sparse_tensor::TensorExp::kShrS, mlir::sparse_tensor::TensorExp::kShrU, mlir::sparse_tensor::TensorExp::kSinC, mlir::sparse_tensor::TensorExp::kSinF, mlir::sparse_tensor::TensorExp::kSqrtC, mlir::sparse_tensor::TensorExp::kSqrtF, mlir::sparse_tensor::TensorExp::kSubC, mlir::sparse_tensor::TensorExp::kSubF, mlir::sparse_tensor::TensorExp::kSubI, mlir::sparse_tensor::TensorExp::kSynZero, mlir::sparse_tensor::TensorExp::kTanhC, mlir::sparse_tensor::TensorExp::kTanhF, mlir::sparse_tensor::TensorExp::kTensor, mlir::sparse_tensor::TensorExp::kTruncF, mlir::sparse_tensor::TensorExp::kTruncI, mlir::sparse_tensor::TensorExp::kUnary, mlir::sparse_tensor::TensorExp::kXorI, mapSet(), and rhs.

Referenced by buildLattices(), and genStmt().

◆ buildTensorExpFromLinalg()

std::optional< ExprId > mlir::sparse_tensor::Merger::buildTensorExpFromLinalg ( linalg::GenericOp op)

Builds a tensor expression from the given Linalg operation.

On success, returns the identifier of the root expression.

Definition at line 1193 of file Merger.cpp.

References mlir::Region::front(), mlir::Operation::getOperand(), mlir::Operation::getRegion(), and mlir::Block::getTerminator().

◆ clearExprValue()

void mlir::sparse_tensor::Merger::clearExprValue ( ExprId e)
inline

Clears the value associated with the expression.

Asserts that the expression does indeed have an associated value before clearing it.

Definition at line 567 of file Merger.h.

References exp().

Referenced by genInvariants(), and genTensorStore().

◆ combiSet()

LatSetId mlir::sparse_tensor::Merger::combiSet ( ExprId e,
LatSetId s0,
LatSetId s1,
Operation * orig,
bool includeLeft,
TensorExp::Kind ltrans,
Operation * opleft,
bool includeRight,
TensorExp::Kind rtrans,
Operation * opright )

Disjunctive merge of two lattice sets with custom handling of the overlap, left, and right regions.

Any region may be left missing in the output. Returns the identifier of the new set.

Definition at line 380 of file Merger.cpp.

References mlir::sparse_tensor::TensorExp::attr, conjSet(), exp(), and mapSet().

Referenced by buildLattices().

◆ conjLat()

LatPointId mlir::sparse_tensor::Merger::conjLat ( ExprId e,
LatPointId p0,
LatPointId p1,
Operation * op = nullptr )

Computes a single conjunction of two lattice points by taking the "union" of LoopId (effectively constructing a larger "intersection" of those loops) with a newly constructed tensor (sub)expression of given kind.

Returns the identifier of the new lattice point.

Definition at line 315 of file Merger.cpp.

References addExp(), mlir::sparse_tensor::TensorExp::attr, exp(), mlir::sparse_tensor::TensorExp::kind, and lat().

Referenced by conjSet().

◆ conjSet()

LatSetId mlir::sparse_tensor::Merger::conjSet ( ExprId e,
LatSetId s0,
LatSetId s1,
Operation * op = nullptr )

Conjunctive merge of two lattice sets: (s0 /\_op s1).

Returns the identifier of the new set.

Definition at line 329 of file Merger.cpp.

References addSet(), conjLat(), and set().

Referenced by buildLattices(), combiSet(), disjSet(), and disjSetWithZero().

◆ disjSet()

LatSetId mlir::sparse_tensor::Merger::disjSet ( ExprId e,
LatSetId s0,
LatSetId s1,
Operation * op = nullptr )

◆ disjSetWithZero()

LatSetId mlir::sparse_tensor::Merger::disjSetWithZero ( ExprId e,
LatSetId s0,
LatSetId s1 )

Disjunctive merge of two lattice sets and also set one of the operand to zero: (s0 /\_op s1 (e0 op e1), s0 (0 op e0), s1 (e1 op 0)).

Returns the identifier of the new set.

Definition at line 356 of file Merger.cpp.

References mlir::sparse_tensor::TensorExp::children, conjSet(), mlir::sparse_tensor::TensorExp::Children::e0, mlir::sparse_tensor::TensorExp::Children::e1, exp(), mlir::sparse_tensor::TensorExp::kCmpF, mlir::sparse_tensor::TensorExp::kCmpI, mlir::sparse_tensor::TensorExp::kSynZero, and mapBinWithSynZeroSet().

Referenced by buildLattices().

◆ dumpBits()

void mlir::sparse_tensor::Merger::dumpBits ( const BitVector & bits) const

Definition at line 920 of file Merger.cpp.

References b, isLvlWithNonTrivialIdxExp(), loop(), tensor(), and mlir::sparse_tensor::toMLIRString().

Referenced by dumpLat().

◆ dumpExp()

void mlir::sparse_tensor::Merger::dumpExp ( ExprId e) const

Print methods (for debugging).

Definition at line 799 of file Merger.cpp.

References dumpExp(), exp(), mlir::sparse_tensor::TensorExp::kAbsC, mlir::sparse_tensor::TensorExp::kAbsF, mlir::sparse_tensor::TensorExp::kAbsI, mlir::sparse_tensor::TensorExp::kAddC, mlir::sparse_tensor::TensorExp::kAddF, mlir::sparse_tensor::TensorExp::kAddI, mlir::sparse_tensor::TensorExp::kAndI, mlir::sparse_tensor::TensorExp::kBinary, mlir::sparse_tensor::TensorExp::kBinaryBranch, mlir::sparse_tensor::TensorExp::kBitCast, mlir::sparse_tensor::TensorExp::kCastFS, mlir::sparse_tensor::TensorExp::kCastFU, mlir::sparse_tensor::TensorExp::kCastIdx, mlir::sparse_tensor::TensorExp::kCastS, mlir::sparse_tensor::TensorExp::kCastSF, mlir::sparse_tensor::TensorExp::kCastU, mlir::sparse_tensor::TensorExp::kCastUF, mlir::sparse_tensor::TensorExp::kCeilF, mlir::sparse_tensor::TensorExp::kCIm, mlir::sparse_tensor::TensorExp::kCmpF, mlir::sparse_tensor::TensorExp::kCmpI, mlir::sparse_tensor::TensorExp::kCRe, mlir::sparse_tensor::TensorExp::kDenseOp, mlir::sparse_tensor::TensorExp::kDivC, mlir::sparse_tensor::TensorExp::kDivF, mlir::sparse_tensor::TensorExp::kDivS, mlir::sparse_tensor::TensorExp::kDivU, mlir::sparse_tensor::TensorExp::kExpm1C, mlir::sparse_tensor::TensorExp::kExpm1F, mlir::sparse_tensor::TensorExp::kExtF, mlir::sparse_tensor::TensorExp::kFloorF, mlir::sparse_tensor::kindToOpSymbol(), mlir::sparse_tensor::detail::kInvalidId, mlir::sparse_tensor::TensorExp::kInvariant, mlir::sparse_tensor::TensorExp::kLog1pC, mlir::sparse_tensor::TensorExp::kLog1pF, mlir::sparse_tensor::TensorExp::kLoopVar, mlir::sparse_tensor::TensorExp::kMulC, mlir::sparse_tensor::TensorExp::kMulF, mlir::sparse_tensor::TensorExp::kMulI, mlir::sparse_tensor::TensorExp::kNegC, mlir::sparse_tensor::TensorExp::kNegF, mlir::sparse_tensor::TensorExp::kNegI, mlir::sparse_tensor::TensorExp::kOrI, mlir::sparse_tensor::TensorExp::kReduce, mlir::sparse_tensor::TensorExp::kRelu, mlir::sparse_tensor::TensorExp::kSelect, mlir::sparse_tensor::TensorExp::kShlI, mlir::sparse_tensor::TensorExp::kShrS, mlir::sparse_tensor::TensorExp::kShrU, mlir::sparse_tensor::TensorExp::kSinC, mlir::sparse_tensor::TensorExp::kSinF, mlir::sparse_tensor::TensorExp::kSqrtC, mlir::sparse_tensor::TensorExp::kSqrtF, mlir::sparse_tensor::TensorExp::kSubC, mlir::sparse_tensor::TensorExp::kSubF, mlir::sparse_tensor::TensorExp::kSubI, mlir::sparse_tensor::TensorExp::kSynZero, mlir::sparse_tensor::TensorExp::kTanhC, mlir::sparse_tensor::TensorExp::kTanhF, mlir::sparse_tensor::TensorExp::kTensor, mlir::sparse_tensor::TensorExp::kTruncF, mlir::sparse_tensor::TensorExp::kTruncI, mlir::sparse_tensor::TensorExp::kUnary, and mlir::sparse_tensor::TensorExp::kXorI.

Referenced by dumpExp(), and dumpLat().

◆ dumpLat()

void mlir::sparse_tensor::Merger::dumpLat ( LatPointId p) const

Definition at line 899 of file Merger.cpp.

References dumpBits(), dumpExp(), and lat().

Referenced by dumpSet().

◆ dumpSet()

void mlir::sparse_tensor::Merger::dumpSet ( LatSetId s) const

Definition at line 910 of file Merger.cpp.

References dumpLat(), and set().

◆ exp()

const TensorExp & mlir::sparse_tensor::Merger::exp ( ExprId e) const
inline

Convenience getters to immediately access the stored nodes.

These methods return const& because the underlying objects must not be mutated by client code. The only exception is for mutating the value associated with an expression, for which there are dedicated methods below.

NOTE: It is inadvisable to keep the reference alive for a long time (e.g., as in TensorExpr &te = merger.exp(e)), since insertions into the merger can cause data movement which will invalidate the underlying memory address. This isn't just a problem with the & references, but also applies to the ArrayRef. In particular, using for (LatPointId p : merger.set(s)) will run into the same dangling-reference problems if the loop body inserts new sets.

Definition at line 541 of file Merger.h.

Referenced by buildExp(), buildLattices(), clearExprValue(), combiSet(), conjLat(), disjSet(), disjSetWithZero(), dumpExp(), expContainsTensor(), expIsTensor(), hasExprValue(), hasNegateOnOut(), isSingleCondition(), mapBinWithSynZeroSet(), optimizeSet(), and setExprValue().

◆ expContainsTensor()

bool mlir::sparse_tensor::Merger::expContainsTensor ( ExprId e,
TensorId t ) const

◆ expIsTensor()

bool mlir::sparse_tensor::Merger::expIsTensor ( ExprId e,
TensorId t ) const
inline

Returns true if the expression is (kTensor t).

Definition at line 370 of file Merger.h.

References exp(), and mlir::sparse_tensor::TensorExp::kTensor.

Referenced by optimizeSet().

◆ foreachTensorLoopId() [1/2]

void mlir::sparse_tensor::Merger::foreachTensorLoopId ( LatPointId p,
bool simple,
ForeachTensorLoopIdCallback callback ) const
inline

◆ foreachTensorLoopId() [2/2]

void mlir::sparse_tensor::Merger::foreachTensorLoopId ( LatPointId p,
ForeachTensorLoopIdCallback callback ) const
inline

Iterates over a set of TensorLoopIds, invoking the callback for each TensorLoopId and passing it the corresponding tensor identifier, level, and level-type, following with a boolean value indicating whether it is a dependent index reduction loop condition.

Definition at line 442 of file Merger.h.

References foreachTensorLoopId().

Referenced by foreachTensorLoopId(), genIf(), and getAllTidLvlsInLatPoints().

◆ getDependentLoops()

std::vector< LoopCoeffPair > & mlir::sparse_tensor::Merger::getDependentLoops ( TensorId t,
Level lvl )
inline

Returns the list of loop indices which appear in the non-trivial index expression on t_l, e.g., A[i+j] => {i, j}.

Definition at line 488 of file Merger.h.

Referenced by mlir::sparse_tensor::CodegenEnv::startEmit().

◆ getLoopDefiningLvl()

std::pair< TensorId, Level > mlir::sparse_tensor::Merger::getLoopDefiningLvl ( LoopId i) const
inline

Returns the defining [tid, lvl] for the loop.

Definition at line 494 of file Merger.h.

◆ getLoopDependentLevel()

Level mlir::sparse_tensor::Merger::getLoopDependentLevel ( TensorLoopId b) const
inline

Definition at line 518 of file Merger.h.

References b, isLvlWithNonTrivialIdxExp(), loop(), and tensor().

Referenced by foreachTensorLoopId().

◆ getLoopDependentLevelType()

LevelType mlir::sparse_tensor::Merger::getLoopDependentLevelType ( TensorLoopId b) const
inline

Definition at line 523 of file Merger.h.

References b, isLvlWithNonTrivialIdxExp(), loop(), and tensor().

Referenced by isSparseLvlWithNonTrivialIdxExp().

◆ getLoopId()

std::optional< LoopId > mlir::sparse_tensor::Merger::getLoopId ( TensorId t,
Level lvl ) const
inline

Gets the loop identifier for the lvlth level of the tth tensor.

Definition at line 410 of file Merger.h.

◆ getLvl() [1/2]

std::optional< Level > mlir::sparse_tensor::Merger::getLvl ( TensorId t,
LoopId i ) const
inline

Gets the level number of the the tth tensor on ith loop.

Definition at line 416 of file Merger.h.

Referenced by foreachTensorLoopId(), getAllTidLvlsInLatPoints(), and getLvl().

◆ getLvl() [2/2]

std::optional< Level > mlir::sparse_tensor::Merger::getLvl ( TensorLoopId b) const
inline

Definition at line 420 of file Merger.h.

References b, getLvl(), loop(), and tensor().

◆ getLvlType() [1/2]

LevelType mlir::sparse_tensor::Merger::getLvlType ( TensorId t,
LoopId i ) const
inline

Gets the level-type of the tth tensor on ith loop.

Definition at line 399 of file Merger.h.

Referenced by findAffine(), findDepIdxSet(), foreachTensorLoopId(), getLvlType(), hasAnySparse(), and simplifyCond().

◆ getLvlType() [2/2]

LevelType mlir::sparse_tensor::Merger::getLvlType ( TensorLoopId b) const
inline

Gets the level-type of the TensorLoopId.

Definition at line 405 of file Merger.h.

References b, getLvlType(), loop(), and tensor().

◆ getNumLoops()

unsigned mlir::sparse_tensor::Merger::getNumLoops ( ) const
inlineconstexpr

Gets the total number of loops (native loops + filter loops).

Definition at line 355 of file Merger.h.

◆ getNumTensors()

unsigned mlir::sparse_tensor::Merger::getNumTensors ( ) const
inlineconstexpr

Gets the total number of tensors (including the output-tensor and synthetic-tensor).

Definition at line 352 of file Merger.h.

◆ getOutTensorID()

TensorId mlir::sparse_tensor::Merger::getOutTensorID ( ) const
inlineconstexpr

Gets the output tensor's identifier.

Definition at line 363 of file Merger.h.

Referenced by genResult(), getAllTidLvlsInLatPoints(), and startLoop().

◆ getSynTensorID()

TensorId mlir::sparse_tensor::Merger::getSynTensorID ( ) const
inlineconstexpr

Gets the synthetic tensor's identifier (used for all invariant tensor expressions).

Definition at line 367 of file Merger.h.

Referenced by getAllTidLvlsInLatPoints(), and startLoop().

◆ hasAnySparse()

bool mlir::sparse_tensor::Merger::hasAnySparse ( const BitVector & bits) const

Returns true if any TensorLoopId in the bitvector corresponds to sparse level-type.

Definition at line 671 of file Merger.cpp.

References b, getLvlType(), and hasSparseIdxReduction().

Referenced by onlyDenseDiff(), simplifyCond(), and startLoopSeq().

◆ hasDependentLvl()

bool mlir::sparse_tensor::Merger::hasDependentLvl ( LoopId i,
TensorId t )
inline

Whether the loop has dependent slice.

Definition at line 481 of file Merger.h.

Referenced by findDepIdxSet().

◆ hasExprValue()

bool mlir::sparse_tensor::Merger::hasExprValue ( ExprId e) const
inline

Checks whether the given expression has an associated value.

Definition at line 555 of file Merger.h.

References exp(), and mlir::sparse_tensor::TensorExp::val.

◆ hasNegateOnOut()

bool mlir::sparse_tensor::Merger::hasNegateOnOut ( ExprId e) const

Returns true if the expression contains a negation on output tensor.

I.e., - outTensor or exp - outputTensor NOTE: this is an trivial tests in that it does not handle recursive negation, i.e., it returns true when the expression is -(-tensor).

Definition at line 544 of file Merger.cpp.

References exp(), expContainsTensor(), mlir::sparse_tensor::getExpArity(), hasNegateOnOut(), mlir::sparse_tensor::kBinary, mlir::sparse_tensor::TensorExp::kDenseOp, mlir::sparse_tensor::detail::kInvalidId, mlir::sparse_tensor::TensorExp::kNegC, mlir::sparse_tensor::TensorExp::kNegF, mlir::sparse_tensor::TensorExp::kNegI, mlir::sparse_tensor::kNullary, mlir::sparse_tensor::TensorExp::kSubC, mlir::sparse_tensor::TensorExp::kSubF, mlir::sparse_tensor::TensorExp::kSubI, and mlir::sparse_tensor::kUnary.

Referenced by hasNegateOnOut().

◆ hasSparseIdxReduction()

bool mlir::sparse_tensor::Merger::hasSparseIdxReduction ( const BitVector & bits) const

Returns true if bits contains a dependent index reduction condition on sparse levels.

Definition at line 680 of file Merger.cpp.

References b, and isSparseLvlWithNonTrivialIdxExp().

Referenced by hasAnySparse().

◆ isLvlWithNonTrivialIdxExp()

bool mlir::sparse_tensor::Merger::isLvlWithNonTrivialIdxExp ( TensorLoopId b) const
inline

Checks whether the TensorLoopId represents a tensor level contains non-trivial index expression.

Definition at line 501 of file Merger.h.

References b, loop(), and tensor().

Referenced by dumpBits(), foreachTensorLoopId(), getLoopDependentLevel(), getLoopDependentLevelType(), and isSparseLvlWithNonTrivialIdxExp().

◆ isOutTensor()

bool mlir::sparse_tensor::Merger::isOutTensor ( TensorLoopId b,
LoopId i ) const
inlineconstexpr

Returns true if b is the ith loop of the output tensor.

Definition at line 358 of file Merger.h.

References b, and makeTensorLoopId().

◆ isSingleCondition()

bool mlir::sparse_tensor::Merger::isSingleCondition ( TensorId t,
ExprId e ) const

Returns true if given tensor iterates only in the given tensor expression.

For the output tensor, this defines a "simply dynamic" operation [Bik96]. For instance: a(i) *= 2.0 or a(i) += a(i) for sparse vector a.

Definition at line 577 of file Merger.cpp.

References exp(), isSingleCondition(), mlir::sparse_tensor::TensorExp::kAbsC, mlir::sparse_tensor::TensorExp::kAbsF, mlir::sparse_tensor::TensorExp::kAbsI, mlir::sparse_tensor::TensorExp::kAddC, mlir::sparse_tensor::TensorExp::kAddF, mlir::sparse_tensor::TensorExp::kAddI, mlir::sparse_tensor::TensorExp::kAndI, mlir::sparse_tensor::TensorExp::kBinary, mlir::sparse_tensor::TensorExp::kBinaryBranch, mlir::sparse_tensor::TensorExp::kBitCast, mlir::sparse_tensor::TensorExp::kCastFS, mlir::sparse_tensor::TensorExp::kCastFU, mlir::sparse_tensor::TensorExp::kCastIdx, mlir::sparse_tensor::TensorExp::kCastS, mlir::sparse_tensor::TensorExp::kCastSF, mlir::sparse_tensor::TensorExp::kCastU, mlir::sparse_tensor::TensorExp::kCastUF, mlir::sparse_tensor::TensorExp::kCeilF, mlir::sparse_tensor::TensorExp::kCIm, mlir::sparse_tensor::TensorExp::kCmpF, mlir::sparse_tensor::TensorExp::kCmpI, mlir::sparse_tensor::TensorExp::kCRe, mlir::sparse_tensor::TensorExp::kDenseOp, mlir::sparse_tensor::TensorExp::kDivC, mlir::sparse_tensor::TensorExp::kDivF, mlir::sparse_tensor::TensorExp::kDivS, mlir::sparse_tensor::TensorExp::kDivU, mlir::sparse_tensor::TensorExp::kExpm1C, mlir::sparse_tensor::TensorExp::kExpm1F, mlir::sparse_tensor::TensorExp::kExtF, mlir::sparse_tensor::TensorExp::kFloorF, mlir::sparse_tensor::TensorExp::kInvariant, mlir::sparse_tensor::TensorExp::kLog1pC, mlir::sparse_tensor::TensorExp::kLog1pF, mlir::sparse_tensor::TensorExp::kLoopVar, mlir::sparse_tensor::TensorExp::kMulC, mlir::sparse_tensor::TensorExp::kMulF, mlir::sparse_tensor::TensorExp::kMulI, mlir::sparse_tensor::TensorExp::kNegC, mlir::sparse_tensor::TensorExp::kNegF, mlir::sparse_tensor::TensorExp::kNegI, mlir::sparse_tensor::TensorExp::kOrI, mlir::sparse_tensor::TensorExp::kReduce, mlir::sparse_tensor::TensorExp::kRelu, mlir::sparse_tensor::TensorExp::kSelect, mlir::sparse_tensor::TensorExp::kShlI, mlir::sparse_tensor::TensorExp::kShrS, mlir::sparse_tensor::TensorExp::kShrU, mlir::sparse_tensor::TensorExp::kSinC, mlir::sparse_tensor::TensorExp::kSinF, mlir::sparse_tensor::TensorExp::kSqrtC, mlir::sparse_tensor::TensorExp::kSqrtF, mlir::sparse_tensor::TensorExp::kSubC, mlir::sparse_tensor::TensorExp::kSubF, mlir::sparse_tensor::TensorExp::kSubI, mlir::sparse_tensor::TensorExp::kSynZero, mlir::sparse_tensor::TensorExp::kTanhC, mlir::sparse_tensor::TensorExp::kTanhF, mlir::sparse_tensor::TensorExp::kTensor, mlir::sparse_tensor::TensorExp::kTruncF, mlir::sparse_tensor::TensorExp::kTruncI, mlir::sparse_tensor::TensorExp::kUnary, and mlir::sparse_tensor::TensorExp::kXorI.

Referenced by isSingleCondition().

◆ isSparseLvlWithNonTrivialIdxExp()

bool mlir::sparse_tensor::Merger::isSparseLvlWithNonTrivialIdxExp ( TensorLoopId b) const
inline

Checks whether the TensorLoopId represents a sparse tensor level contains non-trivial index expression.

Definition at line 510 of file Merger.h.

References b, getLoopDependentLevelType(), and isLvlWithNonTrivialIdxExp().

Referenced by hasSparseIdxReduction(), and simplifyCond().

◆ lat()

const LatPoint & mlir::sparse_tensor::Merger::lat ( LatPointId p) const
inline

Definition at line 545 of file Merger.h.

Referenced by conjLat(), dumpLat(), foreachTensorLoopId(), genCoIterationCase(), and latGT().

◆ latGT()

bool mlir::sparse_tensor::Merger::latGT ( LatPointId p0,
LatPointId p1 ) const

Returns true if p0 > p1.

Definition at line 503 of file Merger.cpp.

References b, mlir::sparse_tensor::LatPoint::bits, and lat().

Referenced by genCoIterationCase(), genStmt(), optimizeSet(), and simplifyCond().

◆ loop()

LoopId mlir::sparse_tensor::Merger::loop ( TensorLoopId b) const
inlineconstexpr

Gets the loop-identifier of the TensorLoopId.

Definition at line 348 of file Merger.h.

References b.

Referenced by dumpBits(), genIf(), getLoopDependentLevel(), getLoopDependentLevelType(), getLvl(), getLvlType(), and isLvlWithNonTrivialIdxExp().

◆ makeLoopId()

LoopId mlir::sparse_tensor::Merger::makeLoopId ( unsigned i) const
inlineconstexpr

Safely converts the argument to a loop identifier.

Definition at line 249 of file Merger.h.

Referenced by findAffine(), and findDepIdxSet().

◆ makeTensorId()

TensorId mlir::sparse_tensor::Merger::makeTensorId ( unsigned t) const
inlineconstexpr

Safely converts the argument to a tensor identifier.

Definition at line 243 of file Merger.h.

◆ makeTensorLoopId()

TensorLoopId mlir::sparse_tensor::Merger::makeTensorLoopId ( unsigned t,
unsigned i ) const
inlineconstexpr

Safely converts the arguments to a pair of (tensor,loop) identifiers.

Definition at line 255 of file Merger.h.

Referenced by addLat(), and isOutTensor().

◆ mapBinWithSynZeroSet()

LatSetId mlir::sparse_tensor::Merger::mapBinWithSynZeroSet ( ExprId e,
LatSetId s,
bool lhsZero )

Maps the binary operator to the same operation but with one of its operand set to zero, i.e.

each lattice point on an expression E is simply copied over, but with OP 0 E (if lhsZero == true) or OP E 0 (if lhsZero == false) as new expression. Returns the identifier of the new set.

Definition at line 414 of file Merger.cpp.

References addExp(), addLat(), addSet(), addSynZeroExp(), mlir::sparse_tensor::TensorExp::attr, exp(), mlir::sparse_tensor::TensorExp::kind, mlir::sparse_tensor::TensorExp::kMulF, mlir::sparse_tensor::TensorExp::kShlI, and set().

Referenced by disjSetWithZero().

◆ mapSet()

LatSetId mlir::sparse_tensor::Merger::mapSet ( TensorExp::Kind kind,
LatSetId s,
Value v = Value(),
Operation * op = nullptr,
Attribute attr = nullptr )

Maps the unary operator over the lattice set of the operand, i.e.

each lattice point on an expression E is simply copied over, but with OP E as new expression. Returns the identifier of the new set.

Definition at line 401 of file Merger.cpp.

References addExp(), addLat(), addSet(), mlir::sparse_tensor::TensorExp::kAbsF, mlir::sparse_tensor::TensorExp::kDenseOp, mlir::sparse_tensor::TensorExp::kSelect, and set().

Referenced by buildLattices(), combiSet(), and disjSet().

◆ onlyDenseDiff()

bool mlir::sparse_tensor::Merger::onlyDenseDiff ( LatPointId p0,
LatPointId p1 ) const

Returns true if p0 and p1 only differ in dense.

Definition at line 516 of file Merger.cpp.

References hasAnySparse().

Referenced by optimizeSet().

◆ optimizeSet()

LatSetId mlir::sparse_tensor::Merger::optimizeSet ( LatSetId s)

Optimizes the iteration lattice points in the given set.

This method should be called right before code generation to avoid generating redundant loops and conditions.

Definition at line 431 of file Merger.cpp.

References add, addSet(), exp(), expIsTensor(), latGT(), onlyDenseDiff(), set(), and simplifyCond().

Referenced by genStmt().

◆ set()

ArrayRef< LatPointId > mlir::sparse_tensor::Merger::set ( LatSetId s) const
inline

Definition at line 549 of file Merger.h.

Referenced by conjSet(), dumpSet(), mapBinWithSynZeroSet(), mapSet(), optimizeSet(), and simplifyCond().

◆ setExprValue()

void mlir::sparse_tensor::Merger::setExprValue ( ExprId e,
Value v )
inline

Sets the expression to have the associated value.

Asserts that the new value is defined, and that the expression does not already have a value.

Definition at line 559 of file Merger.h.

References exp().

Referenced by genExp(), and genInvariants().

◆ setHasSparseOut()

void mlir::sparse_tensor::Merger::setHasSparseOut ( bool s)
inline

Sets whether the output tensor is sparse or not.

Definition at line 469 of file Merger.h.

◆ setLevelAndType()

void mlir::sparse_tensor::Merger::setLevelAndType ( TensorId t,
LoopId i,
Level lvl,
LevelType lt )
inline

Sets the level number and level-type of the tth tensor on ith loop.

Definition at line 426 of file Merger.h.

References mlir::sparse_tensor::isValidLT().

Referenced by findAffine(), and findDepIdxSet().

◆ setLoopDependentTensorLevel()

void mlir::sparse_tensor::Merger::setLoopDependentTensorLevel ( LoopId i,
TensorId t,
Level lvl,
LevelType lt,
unsigned coefficient )
inline

Establishes the two-way map that i <-> <t, lvl, lt>.

Definition at line 472 of file Merger.h.

Referenced by findDepIdxSet().

◆ simplifyCond()

BitVector mlir::sparse_tensor::Merger::simplifyCond ( LatSetId s,
LatPointId p )

Simplifies the conditions in a conjunction of a given lattice point within the given set using just two basic rules: (1) multiple dense conditions are reduced to single dense, and (2) a singleton sparse/dense is reduced to sparse/random access.

Definition at line 461 of file Merger.cpp.

References b, getLvlType(), hasAnySparse(), mlir::sparse_tensor::LevelType::hasDenseSemantic(), isSparseLvlWithNonTrivialIdxExp(), latGT(), and set().

Referenced by optimizeSet().

◆ tensor()

TensorId mlir::sparse_tensor::Merger::tensor ( TensorLoopId b) const
inlineconstexpr

Gets the tensor-identifier of the TensorLoopId.

Definition at line 346 of file Merger.h.

References b.

Referenced by dumpBits(), foreachTensorLoopId(), getLoopDependentLevel(), getLoopDependentLevelType(), getLvl(), getLvlType(), and isLvlWithNonTrivialIdxExp().


The documentation for this class was generated from the following files: