MLIR  19.0.0git
Classes | Public Types | Public Member Functions | Public Attributes | List of all members
mlir::sparse_tensor::TensorExp Struct Referencefinal

Tensor expression. Represents an MLIR expression in tensor index notation. More...

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

Classes

struct  Children
 Child subexpressions for non-leaf expressions. More...
 

Public Types

enum class  Kind {
  kTensor = 0 , kSynZero , kInvariant , kLoopVar ,
  kAbsF , kAbsC , kAbsI , kCeilF ,
  kFloorF , kSqrtF , kSqrtC , kExpm1F ,
  kExpm1C , kLog1pF , kLog1pC , kSinF ,
  kSinC , kTanhF , kTanhC , kNegF ,
  kNegC , kNegI , kTruncF , kExtF ,
  kCastFS , kCastFU , kCastSF , kCastUF ,
  kCastS , kCastU , kCastIdx , kTruncI ,
  kCIm , kCRe , kBitCast , kBinaryBranch ,
  kUnary , kSelect , kMulF , kMulC ,
  kMulI , kDivF , kDivC , kDivS ,
  kDivU , kAddF , kAddC , kAddI ,
  kSubF , kSubC , kSubI , kAndI ,
  kOrI , kXorI , kCmpI , kCmpF ,
  kShrS , kShrU , kShlI , kBinary ,
  kReduce , kDenseOp
}
 Tensor expression kind. More...
 

Public Member Functions

 TensorExp (Kind k, unsigned x, ExprId y, Value v, Operation *op, Attribute a)
 The x parameter has different types depending on the value of the k parameter. More...
 

Public Attributes

Kind kind
 Tensor expression kind. More...
 
union {
   TensorId   tensor
 kTensor expressions simply have a tensor identifier. More...
 
   LoopId   loop
 kLoopVar expressions simply have a loop identifier. More...
 
   Children   children
 All other expressions hold the ExprIds of their children. More...
 
}; 
 
Value val
 Direct link to IR for an invariant or the destination value (to infer destination type) of a cast operation During code generation, this field may be used to cache "hoisted" loop invariant tensor loads. More...
 
Operationop
 Code blocks used by semirings. More...
 
Attribute attr
 An optional attribute that is required to determine the semantics of the operations. More...
 

Detailed Description

Tensor expression. Represents an MLIR expression in tensor index notation.

Definition at line 67 of file Merger.h.

Member Enumeration Documentation

◆ Kind

Tensor expression kind.

The kLoopVar leaf kind is for representing linalg::IndexOp. That is, its argument is a LoopId identifying the loop-variable in question, and its value will be the current iteration's value. The kSynZero leaf kind is for representing a synthetic zero value, which can be introduced when sparsifying operations like arith::cmp to generate arith::cmp lhs, syn_zero when the rhs operand is absent.

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

Definition at line 129 of file Merger.h.

Constructor & Destructor Documentation

◆ TensorExp()

mlir::sparse_tensor::TensorExp::TensorExp ( TensorExp::Kind  k,
unsigned  x,
ExprId  y,
Value  v,
Operation op,
Attribute  a 
)

The x parameter has different types depending on the value of the k parameter.

The correspondences are:

  • kTensor -> TensorId
  • kInvariant -> kInvalidId
  • kLoopVar -> LoopId
  • else -> ExprId

The y, v, and op parameters either must or must not be kInvalidId/nullptr, depending on the value of the k parameter; however, they have uniform C++ types regardless of the value of k.

Definition at line 105 of file Merger.cpp.

Member Data Documentation

◆ 

union { ... }

◆ attr

Attribute mlir::sparse_tensor::TensorExp::attr

An optional attribute that is required to determine the semantics of the operations.

E.g., CmpPredicateAttr for CmpI/CmpF operations.

Definition at line 118 of file Merger.h.

◆ children

Children mlir::sparse_tensor::TensorExp::children

All other expressions hold the ExprIds of their children.

Definition at line 99 of file Merger.h.

◆ kind

Kind mlir::sparse_tensor::TensorExp::kind

Tensor expression kind.

Definition at line 89 of file Merger.h.

Referenced by genInvariants(), and genTensorStore().

◆ loop

LoopId mlir::sparse_tensor::TensorExp::loop

kLoopVar expressions simply have a loop identifier.

Definition at line 96 of file Merger.h.

◆ op

Operation* mlir::sparse_tensor::TensorExp::op

Code blocks used by semirings.

For the case of kUnary, kBinary, kReduce, and kSelect, this holds the original operation with all regions. For kBinaryBranch, this holds the YieldOp for the left or right half to be merged into a nested scf loop.

Or the actual operation that we can not sparsify but having all dense operands for kDenseOp.

Definition at line 114 of file Merger.h.

◆ tensor

TensorId mlir::sparse_tensor::TensorExp::tensor

kTensor expressions simply have a tensor identifier.

Definition at line 93 of file Merger.h.

◆ val

Value mlir::sparse_tensor::TensorExp::val

Direct link to IR for an invariant or the destination value (to infer destination type) of a cast operation During code generation, this field may be used to cache "hoisted" loop invariant tensor loads.

Definition at line 105 of file Merger.h.

Referenced by genInvariantValue(), genTensorLoad(), and mlir::sparse_tensor::Merger::hasExprValue().


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