StmtMutator that mutates the statements.
More...
#include <stmt_functor.h>
StmtMutator that mutates the statements.
◆ CopyOnWrite()
| ffi::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()
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()
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. BufferVar fields are visited at their definition site.
- Returns
- The (possibly remapped) buffer.
◆ VisitExpr()
◆ VisitPrimExpr()
Mutate a primitive expression and verify that it remains primitive.
◆ VisitSeqStmt_()
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()
Internal mutator that everyone calls.
- Note
- To override mutate's behavior, override VisitExpr instead.
- Parameters
-
- Returns
- The mutated results.
◆ VisitStmt_() [1/18]
◆ VisitStmt_() [2/18]
◆ VisitStmt_() [3/18]
◆ VisitStmt_() [4/18]
◆ VisitStmt_() [5/18]
◆ VisitStmt_() [6/18]
◆ VisitStmt_() [7/18]
◆ VisitStmt_() [8/18]
◆ VisitStmt_() [9/18]
◆ VisitStmt_() [10/18]
◆ VisitStmt_() [11/18]
◆ VisitStmt_() [12/18]
◆ VisitStmt_() [13/18]
◆ VisitStmt_() [14/18]
◆ VisitStmt_() [15/18]
◆ VisitStmt_() [16/18]
◆ VisitStmt_() [17/18]
◆ VisitStmt_() [18/18]
◆ 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_
Map from old buffer to new buffer, populated by VisitBufferDef.
The documentation for this class was generated from the following file: