Repository navigation
[Feature] Add DumpIR PassConfig in TileLang side - #1903
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! 🚀 |
|
Caution Review failedPull request was closed or merged during review No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: defaults Review profile: CHILL Plan: Pro Run ID: 📒 Files selected for processing (1)
📝 WalkthroughWalkthroughAdds TileLang IR dumping controls: two new pass config keys and constants (enable flag and dump path) in C++ and Python, and optionally attaches a DumpIR instrument to the PassContext during kernel JIT compilation when enabled. Changes
Sequence Diagram(s)sequenceDiagram
participant Caller
participant KernelJIT
participant PassContext
participant DumpIR
participant TVMCompiler
Caller->>KernelJIT: request kernel compile (pass_configs)
KernelJIT->>PassContext: create with opt_level=3, config=pass_configs
alt TL_ENABLE_DUMP_IR set
KernelJIT->>DumpIR: instantiate DumpIR(dump_dir)
KernelJIT->>PassContext: attach DumpIR instrument
end
KernelJIT->>TVMCompiler: run compilation with PassContext
TVMCompiler->>DumpIR: Dump intermediate IR files (if instrument attached)
TVMCompiler-->>KernelJIT: return compiled kernel
KernelJIT-->>Caller: return result
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~20 minutes Possibly related PRs
Suggested reviewers
Poem
🚥 Pre-merge checks | ✅ 2 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (2 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
There was a problem hiding this comment.
Actionable comments posted: 2
🧹 Nitpick comments (1)
src/op/builtin.h (1)
136-138: Consider documentingkDumpIRDirexplicitly.
kEnableDumpIRhas dedicated API docs, butkDumpIRDiris introduced without a matching brief. Adding a short comment keeps this header consistent and easier to scan.🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed. In `@src/op/builtin.h` around lines 136 - 138, Add a short API doc comment for kDumpIRDir to match kEnableDumpIR’s style: immediately above the static constexpr const char *kDumpIRDir declaration, add a brief one-line comment indicating that this option specifies the directory/path where the IR dump files are written (e.g., "Directory/path to write dumped IR files") so the header is consistent and easier to scan; ensure formatting and phrasing follow nearby kEnableDumpIR comments.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.
Inline comments:
In `@tilelang/jit/kernel.py`:
- Around line 241-247: The wrapper path in parse_source_information constructs a
tvm.transform.PassContext without passing instruments, so DumpIR (activated via
PassConfigKey.TL_ENABLE_DUMP_IR) is not applied there; update
parse_source_information in tilelang/jit/adapter/wrapper.py to mirror kernel.py
by building a pass_instruments list (respecting PassConfigKey.TL_ENABLE_DUMP_IR
and TL_DUMP_IR_DIR default) and pass it into tvm.transform.PassContext via
instruments=pass_instruments when creating the context around compilation so
DumpIR is consistently injected across both paths.
In `@tilelang/transform/pass_config.py`:
- Around line 236-237: The docstring for TL_DUMP_IR_DIR ("TL_DUMP_IR_DIR") is
inconsistent with the runtime default used in the JIT (tilelang.jit.kernel);
update the TL_DUMP_IR_DIR docstring to state "Default: ./dump_ir" to match
runtime behavior, and while here verify the JIT code reads/uses TL_DUMP_IR_DIR
(not a hardcoded "./dump_ir") so both the constant and runtime default remain
consistent.
---
Nitpick comments:
In `@src/op/builtin.h`:
- Around line 136-138: Add a short API doc comment for kDumpIRDir to match
kEnableDumpIR’s style: immediately above the static constexpr const char
*kDumpIRDir declaration, add a brief one-line comment indicating that this
option specifies the directory/path where the IR dump files are written (e.g.,
"Directory/path to write dumped IR files") so the header is consistent and
easier to scan; ensure formatting and phrasing follow nearby kEnableDumpIR
comments.
ℹ️ Review info
⚙️ Run configuration
Configuration used: defaults
Review profile: CHILL
Plan: Pro
Run ID: 189e2ece-e810-4cea-90fa-126f544d98a0
📒 Files selected for processing (4)
src/op/builtin.ccsrc/op/builtin.htilelang/jit/kernel.pytilelang/transform/pass_config.py
Feat: #1896
Previously TVM has a pass instrument to dump all IRs between passes, but it's not exposed in TileLang side and it's hard for new users to find this option. This PR explictly adds this feature as a pass config in TileLang.
Summary by CodeRabbit