[Add] pass generate skill#945
Conversation
|
👋 Hi! Thank you for contributing to the TileLang project. Please remember to run We appreciate you taking this step! Our team will review your contribution, and we look forward to your awesome work! 🚀 |
There was a problem hiding this comment.
Code Review
This pull request introduces the tilelang-pass-generate skill, which automates the generation of TileLang-Ascend Pass implementation code, including C++ source, Python wrappers, and pipeline integration. It establishes a structured workflow that moves from an implementation skeleton to final code and smoke testing, while explicitly delegating unit and system testing to a separate future skill. The review feedback correctly identifies several technical inaccuracies in the provided C++ templates regarding TVM's internal APIs, specifically noting that arith::IRMutatorWithAnalyzer requires an analyzer pointer in its constructor and that PrimFunc objects are immutable, requiring a specific reconstruction pattern rather than a MutateFunc method.
|
|
||
| | 场景 | 默认做法 | | ||
| |------|----------| | ||
| | 父类是 `IRMutatorWithAnalyzer` | 在 `Substitute` 中执行 `mutator.MutateFunc(f)`,构造函数传 `f->body` | |
There was a problem hiding this comment.
在 TVM 的标准实现中,arith::IRMutatorWithAnalyzer 的构造函数通常接收一个 arith::Analyzer* 指针,而不是 f->body。此外,该类及其基类 StmtExprMutator 并没有 MutateFunc 方法,通常是直接调用 operator()(stmt)。为了确保 AI Agent 生成的代码能够编译通过,建议修正此处的描述。
| | 父类是 `IRMutatorWithAnalyzer` | 在 `Substitute` 中执行 `mutator.MutateFunc(f)`,构造函数传 `f->body` | | |
| | 父类是 `IRMutatorWithAnalyzer` | 在 `Substitute` 中构造 `analyzer` 并传给 `mutator`,执行 `mutator(f->body)` | |
|
|
||
| private: | ||
| // 构造函数 | ||
| {PassName}(PrimFunc f, PassContext ctx, {输入 attrs 参数}); |
| PrimFunc new_f = mutator.MutateFunc(f); # IRMutatorWithAnalyzer | ||
| // 或 mutator.VisitStmt(f->body); # StmtExprVisitor |
There was a problem hiding this comment.
在 TVM 中,PrimFunc 是不可变的。变换 PrimFunc 的标准做法是变换其 body,然后构造一个新的 PrimFunc。MutateFunc 并非标准 API。建议更新伪代码以反映真实的 IR 变换流程。
| PrimFunc new_f = mutator.MutateFunc(f); # IRMutatorWithAnalyzer | |
| // 或 mutator.VisitStmt(f->body); # StmtExprVisitor | |
| 4. 执行变换 | |
| auto new_body = mutator(f->body); | |
| PrimFunc new_f = PrimFunc(f->params, new_body, f->ret_type, f->buffer_map, f->attrs); |
No description provided.