Skip to content

Commit f637ea7

Browse files
Updated README.md to show the steps for overriding kernel's IR (#5239)
1 parent c6da81a commit f637ea7

File tree

1 file changed

+19
-0
lines changed

1 file changed

+19
-0
lines changed

README.md

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -211,6 +211,25 @@ For detailed instructions on how to debug Triton's frontend, please refer to thi
211211
- `LLVM_ENABLE_TIMING` dumps the timing information for each LLVM pass.
212212
- `TRITON_DEFAULT_FP_FUSION` overrides the default behavior of allowing fp fusion (mul+add->fma).
213213
- `MLIR_ENABLE_REMARK` enables the performance warnings that are emitted as remarks.
214+
- `TRITON_KERNEL_DUMP` enables the dumping of the IR from each compilation stage and the final ptx.
215+
- `TRITON_DUMP_DIR` specifies the directory to save the dumped IR and ptx when `TRITON_KERNEL_DUMP` is set to 1.
216+
- `TRITON_KERNEL_OVERRIDE` enables the override of the compiled kernel with a user-specified IR/ptx at the beginning of each compilation stage.
217+
- `TRITON_OVERRIDE_DIR` specifies the directory from which to load the IR/ptx files when `TRITON_KERNEL_OVERRIDE` is set to 1.
218+
219+
**Kernel Override Steps**
220+
221+
```bash
222+
export TRITON_ALWAYS_COMPILE=1
223+
export TRITON_KERNEL_DUMP=1
224+
export TRITON_DUMP_DIR=<dump_dir>
225+
export TRITON_KERNEL_OVERRIDE=1
226+
export TRITON_OVERRIDE_DIR=<override_dir>
227+
# Step 1: Run the kernel once to dump kernel's IRs and ptx in $TRITON_DUMP_DIR
228+
# Step 2: Copy $TRITON_DUMP_DIR/<kernel_hash> to $TRITON_OVERRIDE_DIR
229+
# Step 3: Delete the stages that you do not want to override and modify the stage you do want to override
230+
# Step 4: Run the kernel again to see the overridden result
231+
```
232+
214233

215234
# Changelog
216235

0 commit comments

Comments
 (0)