StmtMutator that mutates the statements.
More...
#include <stmt_functor.h>
StmtMutator that mutates the statements.
◆ CopyOnWrite()
template<typename TNode >
| ObjectPtr<TNode> tvm::tirx::StmtMutator::CopyOnWrite |
( |
const TNode * |
node | ) |
|
|
inlineprotected |
Perform copy on write on node.
If CopyOnWrite is allowed, directly return a strong reference to the node container. Otherwise, return a copy of the node.
- Returns
- The result object pointer.
◆ operator()()
| Stmt tvm::tirx::StmtMutator::operator() |
( |
Stmt |
stmt | ) |
|
|
inline |
Mutate stmt.
- Parameters
-
| stmt | The input statement to be mutated. |
- Returns
- The result of the call
- Note
- It is important that stmt is passed by value. so copy on write can be triggered correctly. do mutator(std::move(stmt)) or when copy elison is triggered.
◆ VisitBufferDef()
| virtual Buffer tvm::tirx::StmtMutator::VisitBufferDef |
( |
const Buffer & |
buffer, |
|
|
bool |
alloc_data |
|
) |
| |
|
protectedvirtual |
Visit buffer at definition site. Visits shape/strides/elem_offset via VisitExpr. If any field changes, creates a new buffer and records it in buffer_remap_.
- Parameters
-
| buffer | The buffer being defined. |
| alloc_data | If true, the buffer's data pointer is a new allocation (AllocBuffer); if false, data references an existing variable (DeclBuffer). |
- Returns
- The (possibly new) buffer.
◆ VisitBufferUse()
| virtual Buffer tvm::tirx::StmtMutator::VisitBufferUse |
( |
const Buffer & |
buffer | ) |
|
|
protectedvirtual |
Visit buffer at use site (BufferStore, BufferLoad, SBlock reads/writes). By default, returns the remapped buffer from buffer_remap_ if exists, otherwise returns the original buffer. Buffer fields are visited at their definition site.
- Returns
- The (possibly remapped) buffer.
◆ VisitExpr()
◆ VisitSeqStmt_()
| Stmt tvm::tirx::StmtMutator::VisitSeqStmt_ |
( |
const SeqStmtNode * |
op, |
|
|
bool |
flatten_before_visit, |
|
|
std::function< Stmt(const Stmt &)> |
fmutate = nullptr |
|
) |
| |
|
protected |
Alternative advance method for SeqStmtNode.
This function can be called when a child class override VisitStmt_(const SeqStmtNode*) to introduce the special behavior to visit
- Parameters
-
| op | The sequence. |
| flatten_before_visit | Whether to flatten the sequence before visit. |
| fmutate | The mutate function, can be nullptr, which defaults to Visit. |
- Returns
- The mutated result.
◆ VisitStmt()
| Stmt tvm::tirx::StmtMutator::VisitStmt |
( |
const Stmt & |
stmt | ) |
|
|
inlineoverrideprotected |
Internal mutator that everyone calls.
- Note
- To override mutate's behavior, override VisitExpr instead.
- Parameters
-
- Returns
- The mutated results.
◆ VisitStmt_() [1/13]
◆ VisitStmt_() [2/13]
◆ VisitStmt_() [3/13]
◆ VisitStmt_() [4/13]
| Stmt tvm::tirx::StmtMutator::VisitStmt_ |
( |
const BindNode * |
op | ) |
|
|
overrideprotected |
◆ VisitStmt_() [5/13]
◆ VisitStmt_() [6/13]
◆ VisitStmt_() [7/13]
◆ VisitStmt_() [8/13]
| Stmt tvm::tirx::StmtMutator::VisitStmt_ |
( |
const ForNode * |
op | ) |
|
|
overrideprotected |
◆ VisitStmt_() [9/13]
◆ VisitStmt_() [10/13]
◆ VisitStmt_() [11/13]
◆ VisitStmt_() [12/13]
◆ VisitStmt_() [13/13]
◆ allow_copy_on_write_
| bool tvm::tirx::StmtMutator::allow_copy_on_write_ {false} |
|
protected |
Internal state to indicate whether copy on write is enabled. COW is enabled iff all the parents of the node are unique.
◆ buffer_remap_
| ffi::Map<Buffer, Buffer> tvm::tirx::StmtMutator::buffer_remap_ |
|
protected |
Map from old buffer to new buffer, populated by VisitBufferDef.
The documentation for this class was generated from the following file: