|
MLIR 22.0.0git
|
The code generation environment class aggregates a number of data structures that are needed during the code generation phase of sparsification. More...
#include "Dialect/SparseTensor/Transforms/Utils/CodegenEnv.h"
The code generation environment class aggregates a number of data structures that are needed during the code generation phase of sparsification.
This environment simplifies passing around such data during sparsification (rather than passing around all the individual compoments where needed). Furthermore, it provides convience methods that keep implementation details transparent to sparsification while asserting on internal consistency.
Definition at line 35 of file CodegenEnv.h.
| CodegenEnv::CodegenEnv | ( | linalg::GenericOp | linop, |
| SparsificationOptions | opts, | ||
| unsigned | numTensors, | ||
| unsigned | numLoops, | ||
| unsigned | maxRank ) |
Constructs a code generation environment which can be passed around during sparsification for bookkeeping together with some consistency asserts.
Definition at line 43 of file CodegenEnv.cpp.
References nullptr.
Definition at line 199 of file CodegenEnv.cpp.
Referenced by genExpand().
|
inline |
Definition at line 57 of file CodegenEnv.h.
Referenced by endLoop(), endLoopSeq(), genBuffers(), genCoIteration(), genCoIterationCase(), genConstantDenseAddressFromLevel(), genExpand(), genIf(), genInsertionStore(), genResult(), genSubscript(), startLoop(), and startLoopSeq().
| void CodegenEnv::endCustomReduc | ( | ) |
Definition at line 275 of file CodegenEnv.cpp.
References isCustomReduc(), and mlir::sparse_tensor::detail::kInvalidId.
Referenced by genExp(), and genInvariants().
| void CodegenEnv::endExpand | ( | ) |
Definition at line 218 of file CodegenEnv.cpp.
Referenced by genExpand().
| Value CodegenEnv::endReduc | ( | ) |
Definition at line 241 of file CodegenEnv.cpp.
References isReduc(), and mlir::sparse_tensor::detail::kInvalidId.
Referenced by genInvariants().
| void CodegenEnv::endValidLexInsert | ( | ) |
Definition at line 260 of file CodegenEnv.cpp.
References isReduc(), and isValidLexInsert().
Referenced by genInvariants().
Definition at line 81 of file CodegenEnv.h.
Referenced by genExp(), genInvariants(), genInvariantValue(), genTensorLoad(), genTensorStore(), getCustomRedId(), isAdmissibleTensorExp(), startCustomReduc(), and startReduc().
|
inline |
Definition at line 52 of file CodegenEnv.h.
References mlir::kSparseIterator.
Referenced by genStmt().
| std::optional< Operation * > CodegenEnv::genLoopBoundary | ( | function_ref< std::optional< Operation * >(MutableArrayRef< Value > parameters)> | callback | ) |
Generates loop boundary statements (entering/exiting loops).
The function passes and updates the passed-in parameters.
Definition at line 102 of file CodegenEnv.cpp.
References isExpand(), isReduc(), isValidLexInsert(), updateExpandCount(), updateInsertionChain(), updateReduc(), and updateValidLexInsert().
Referenced by endLoop(), genCoIteration(), and genStmt().
|
inline |
Definition at line 115 of file CodegenEnv.h.
Referenced by genInsertionStore(), genStmt(), and getAllTidLvlsInLatPoints().
| Value CodegenEnv::getCustomRedId | ( | ) | const |
Definition at line 270 of file CodegenEnv.cpp.
References exp(), isCustomReduc(), and op().
Referenced by genInsertionLoadReduce(), and genInvariants().
|
inline |
Definition at line 144 of file CodegenEnv.h.
Referenced by genExpand(), and genInsertionStore().
|
inline |
Definition at line 145 of file CodegenEnv.h.
Referenced by endIf(), finalizeWhileOp(), genExpand(), genInsertionStore(), and genStmt().
|
inline |
Definition at line 143 of file CodegenEnv.h.
Referenced by genExpand(), genInsertionLoadReduce(), and genInsertionStore().
|
inline |
Definition at line 142 of file CodegenEnv.h.
Referenced by genExpand(), genInsertionLoad(), genInsertionLoadReduce(), and genInsertionStore().
|
inline |
Definition at line 48 of file CodegenEnv.h.
|
inline |
Definition at line 135 of file CodegenEnv.h.
Referenced by endIf(), finalizeWhileOp(), genExpand(), genIf(), genInsertionStore(), genResult(), genStmt(), and genTensorStore().
|
inline |
Definition at line 89 of file CodegenEnv.h.
Referenced by genStmt(), isAdmissibleTensorExp(), and startEmit().
Returns the induction-variable for the given loop.
Definition at line 186 of file CodegenEnv.cpp.
Referenced by endLoopSeq(), genExp(), genIf(), genIndex(), relinkBranch(), and startLoopSeq().
|
inline |
Definition at line 155 of file CodegenEnv.h.
Referenced by endIf(), finalizeWhileOp(), genIf(), and genStmt().
|
inline |
Definition at line 161 of file CodegenEnv.h.
Referenced by finalizeWhileOp(), genIf(), genInsertionStore(), and genStmt().
|
inline |
Definition at line 132 of file CodegenEnv.h.
Referenced by genInvariants(), and isParallelFor().
| LogicalResult CodegenEnv::initTensorExp | ( | ) |
Definition at line 51 of file CodegenEnv.cpp.
References isAdmissibleTensorExp(), op(), and success().
Whether the tensor expression is admissible for codegen.
It also sets the sparseOut if the output tensor is sparse.
Definition at line 135 of file CodegenEnv.cpp.
References exp(), getLoopNum(), mlir::sparse_tensor::getSparseTensorType(), mlir::sparse_tensor::SparseTensorType::isAllDense(), isMaterializing(), mlir::linalg::isReductionIterator(), lhs, and makeTensorId().
Referenced by initTensorExp().
|
inline |
Definition at line 165 of file CodegenEnv.h.
References mlir::sparse_tensor::detail::kInvalidId.
Referenced by endCustomReduc(), genInvariants(), genTensorLoad(), getCustomRedId(), and startCustomReduc().
|
inline |
Definition at line 140 of file CodegenEnv.h.
Referenced by endIf(), finalizeWhileOp(), genIf(), genInsertionLoad(), genInsertionLoadReduce(), genInsertionStore(), genLoopBoundary(), and isParallelFor().
|
inline |
Definition at line 153 of file CodegenEnv.h.
References mlir::sparse_tensor::detail::kInvalidId.
Referenced by endIf(), endLoop(), endReduc(), endValidLexInsert(), finalizeWhileOp(), genExpand(), genIf(), genInvariants(), genLoopBoundary(), genTensorStore(), startReduc(), startValidLexInsert(), updateReduc(), and updateValidLexInsert().
Definition at line 133 of file CodegenEnv.h.
Referenced by genTensorLoad(), and genTensorStore().
|
inline |
Definition at line 159 of file CodegenEnv.h.
Referenced by endIf(), endLoop(), endValidLexInsert(), finalizeWhileOp(), genIf(), genInsertionStore(), genLoopBoundary(), and startValidLexInsert().
|
inline |
Definition at line 82 of file CodegenEnv.h.
Referenced by genStmt(), getAllTidLvlsInLatPoints(), and startLoopSeq().
Definition at line 84 of file CodegenEnv.h.
Referenced by getAllTidLvlsInLatPoints(), and shouldTryParallize().
|
inline |
Definition at line 87 of file CodegenEnv.h.
References b.
Definition at line 75 of file CodegenEnv.h.
Referenced by genIndex(), and relinkBranch().
Definition at line 72 of file CodegenEnv.h.
Referenced by findSparseAnnotations(), genConstantDenseAddressFromLevel(), genSubscript(), isAdmissibleTensorExp(), relinkBranch(), and startEmit().
|
inline |
Definition at line 104 of file CodegenEnv.h.
References makeTensorLevel().
|
inline |
Definition at line 95 of file CodegenEnv.h.
Referenced by genConstantDenseAddressFromLevel(), getAllTidLvlsInLatPoints(), and makeTensorLevel().
|
inlineconstexpr |
Definition at line 78 of file CodegenEnv.h.
|
inline |
Definition at line 56 of file CodegenEnv.h.
Referenced by findSparseAnnotations(), genCoIterationCase(), genExp(), genIf(), genInvariants(), genResult(), genStmt(), genTensorStore(), getAllTidLvlsInLatPoints(), startEmit(), startLoop(), and startLoopSeq().
|
inline |
Definition at line 50 of file CodegenEnv.h.
Referenced by endIf(), endLoop(), endLoopSeq(), finalizeWhileOp(), findSparseAnnotations(), genBuffers(), genCoIteration(), genCoIterationCase(), genConstantDenseAddressFromLevel(), genExp(), genExpand(), genIf(), genIndex(), genInitConstantDenseAddress(), genInsertionLoad(), genInsertionLoadReduce(), genInsertionStore(), genInvariants(), genResult(), genStmt(), genSubscript(), genTensorLoad(), genTensorStore(), getAllTidLvlsInLatPoints(), getCustomRedId(), initTensorExp(), relinkBranch(), shouldTryParallize(), startLoop(), and startLoopSeq().
|
inline |
Definition at line 51 of file CodegenEnv.h.
Referenced by genSubscript(), genTensorLoad(), getAllTidLvlsInLatPoints(), and isParallelFor().
|
inline |
Definition at line 83 of file CodegenEnv.h.
Referenced by genStmt(), and startLoopSeq().
Definition at line 265 of file CodegenEnv.cpp.
References exp(), isCustomReduc(), and mlir::sparse_tensor::detail::kInvalidId.
Referenced by genExp(), and genInvariants().
| void CodegenEnv::startEmit | ( | SparseEmitStrategy | emitStrategy | ) |
Definition at line 61 of file CodegenEnv.cpp.
References mlir::sparse_tensor::Merger::getDependentLoops(), getLoopNum(), mlir::sparse_tensor::getSparseTensorEncoding(), makeTensorId(), merger(), and sortDependentLoops().
Definition at line 204 of file CodegenEnv.cpp.
Referenced by genExpand().
Definition at line 227 of file CodegenEnv.cpp.
References exp(), isReduc(), and mlir::sparse_tensor::detail::kInvalidId.
Referenced by genInvariants().
Definition at line 250 of file CodegenEnv.cpp.
References isReduc(), and isValidLexInsert().
Referenced by genInvariants().
|
inline |
Definition at line 107 of file CodegenEnv.h.
Referenced by shouldTryParallize().
|
inline |
Definition at line 111 of file CodegenEnv.h.
Referenced by startLoop().
Definition at line 213 of file CodegenEnv.cpp.
Referenced by endIf(), finalizeWhileOp(), genInsertionStore(), and genLoopBoundary().
Definition at line 194 of file CodegenEnv.cpp.
Referenced by endIf(), finalizeWhileOp(), genExpand(), genInsertionStore(), genLoopBoundary(), and genTensorStore().
Definition at line 234 of file CodegenEnv.cpp.
References isReduc().
Referenced by endIf(), finalizeWhileOp(), genLoopBoundary(), and genTensorStore().
Definition at line 255 of file CodegenEnv.cpp.
References isReduc().
Referenced by endIf(), endLoop(), finalizeWhileOp(), and genLoopBoundary().