extract-asm-triton
Skill121 starsChanged 5 months agoApache-2.0View on GitHub
Extract GPU ISA from Triton kernels on XPU. Triton compiles through the same IGC backend as SYCL (Triton IR → SPIR-V → IGC → zebin). Extraction is identical to sycl-jit: IGC_ShaderDumpEnable=1 captures the zebin at runtime. Use when extracting ASM from torch.compile fusions (triton_per_fused, triton_poi, triton_red), standalone @triton.jit kernels, or Inductor-generated XPU kernels.
- Deletes or force-pushes
In this repository28 other files it gives its agents.
- CLAUDE.mdCLAUDE.md
- .github/copilot-instructions.mdCopilot instructions
- asm-source-mappingSkill
- at-dispatch-v2Skill
- auto-labelSkill
- extract-asm-onednnSkill
- extract-asm-syclkernel-aotSkill
- extract-asm-syclkernel-jitSkill
- extract-xpu-kernel-asmSkill
- fix-implementSkill
- fix-reproduceSkill
- fix-root-causeSkill
- fix-verifySkill
- issue-handlerSkill
- issue-triageSkill
- label-issueSkill
- oob-perf-analysisSkill
- pr-reviewSkill
- release-branchingSkill
- skill-writerSkill
- ut-checkSkill
- ut-issue-authoringSkill
- ut-refactor-reviewSkill
- xpu-alignmentSkill
- xpu-build-pytorchSkill
- xpu-ci-health-checkSkill
- xpu-ops-pr-creationSkill
- xpu-release-notesSkill
The file
We split this skill into the rules it gives an agent
1 rule. About 0 are common, 0 are distinctive, and 1 is very specific to this project.
≈0
Common · estimate
Many files like this have a rule of this kind.
≈0
Distinctive · estimate
This author's own choices. Worth a look.
1
Very specific
Tied to their project's names, files or tools. Probably skip.
- Common
- Distinctive
- Very specific
- Very specific: line 63
Standalone
@triton.jit: use unitrace to pin the kernel:
≈ “Common” is an estimate: at least 1 in 5 of the 350,495 skill files we read have a rule of the same kind, not the same words. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.
Files
Extract ASM from Triton Kernels on XPU
Triton on XPU uses the same IGC backend as SYCL JIT. The path is:
Triton IR → ttgir → SPIR-V → IGC → zebin. Extraction is mechanically
identical to extract-asm-syclkernel-jit — both use IGC_ShaderDumpEnable=1
to capture the runtime-compiled zebin. The only difference is how the kernel
enters the pipeline (Triton Python compiler vs DPC++ clang frontend).
How this fits the compilation stack
Triton path:
@triton.jit Python → Triton IR (ttir) → Triton GPU IR (ttgir)
↓
SPIR-V (via triton-xpu backend)
↓
IGC (JIT) → zebin
↓
IGC_ShaderDumpEnable=1 → .asm
Compare with SYCL JIT:
SYCL C++ → LLVM IR → SPIR-V → IGC (JIT) → zebin → .asm
The back half (SPIR-V → IGC → zebin) is IDENTICAL.When to use
- Hot kernel is
triton_per_fused_*/triton_poi_*/triton_red_*(fromtorch.compile/ Inductor) - Or: standalone
@triton.jitkernel in a Python script - You need the actual GPU ISA (not Triton IR)
When NOT to use
- Kernel is
_ZTS…(SYCL) → useextract-asm-syclkernel-{aot,jit} - Kernel is oneDNN ngen → use
extract-asm-onednn(different stack) - You only need Triton IR → read
${TRITON_CACHE_DIR:-~/.triton/cache}/directly
Steps
Identify the kernel name.
Inductor fusion (from
torch.compile):TRITON_CACHE="${TRITON_CACHE_DIR:-$HOME/.triton/cache}" rm -rf "$TRITON_CACHE" /tmp/torchinductor_$USER TORCH_LOGS=output_code python <repro.py> 2>&1 \ | grep -oE 'triton_(poi|per|red)_fused_[A-Za-z0-9_]+' | sort -uStandalone
@triton.jit: use unitrace to pin the kernel:unitrace -d python <repro.py> # Or fallback: SYCL_UR_TRACE=-1 python <repro.py> 2>&1 \ | grep -oP 'pKernelName = 0x[0-9a-f]+ \(\K[^)]+' | sort -uRe-run with IGC dump (cold cache).
TRITON_CACHE="${TRITON_CACHE_DIR:-$HOME/.triton/cache}" rm -rf "$TRITON_CACHE" /tmp/torchinductor_$USER OUT="<workdir>/triton_$(date +%Y%m%d_%H%M%S)" mkdir -p "$OUT/igc" IGC_ShaderDumpEnable=1 \ IGC_DumpToCustomDir="$OUT/igc" \ ONEAPI_DEVICE_SELECTOR=level_zero:0 \ python <repro.py> 2>&1 | tee "$OUT/run.log"Match kernel name to
.asm.NAME="<fusion-or-kernel-name>" MATCH=$(grep -l "$NAME" "$OUT/igc"/OCL_asm*_simd*_entry_*.asm | head -1) echo "asm-file: $MATCH"Cross-check:
.zeinforeportssimd_size— confirm it matchesnum_warps * 32.
Does it work?
Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.
No reviews yet
People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.
- It worked
- Partly
- It didn't
Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.
Your trail
Files you open will collect here, so you can find them again.
Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.
Now do this for your own.
Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.

