extract-asm-onednn
Skill121 starsChanged 5 months agoApache-2.0View on GitHub
Extract GPU ISA from oneDNN ngen-JIT kernels. This is the ONLY codegen path that bypasses the standard SYCL/SPIR-V/IGC stack. oneDNN uses its own native code generator (ngen) that directly emits GPU ISA bytes — no SPIR-V, no IGC, no zebin ELF, no .debug_line. Use when extracting ASM from oneDNN kernels (gemm_kernel, gen_conv_kernel), matmul, linear, conv, or SDPA-graph ops dispatched via mkldnn.
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-syclkernel-aotSkill
- extract-asm-syclkernel-jitSkill
- extract-asm-tritonSkill
- 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 110
If iga_disassemble returns 0 bytes, the platform ID likely doesn't match.
≈ “Common” is an estimate: at least 1 in 5 of the 364,980 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 oneDNN ngen-JIT Kernels
This is the ONLY path that does NOT use the standard compilation stack. All
other scenarios (SYCL AOT/JIT, Triton) go through SPIR-V → IGC → zebin.
oneDNN ngen bypasses all of that.
How this differs from the standard stack
Standard stack (SYCL/Triton):
Source → LLVM IR → SPIR-V → IGC → zebin ELF (.text + .debug_line)
↓
ocloc disasm → .asm
oneDNN ngen (THIS skill):
oneDNN C++ templates → ngen JIT → RAW ISA BYTES (no ELF, no DWARF)
↓
IGA ctypes → .asmKey consequences:
- No zebin — output is raw bytes, not ELF
- No
.debug_line— source mapping can only use pattern recognition - No IGC —
IGC_ShaderDumpEnableis useless - No SPIR-V — ngen directly emits machine instructions
- Dump mechanism:
ONEDNN_JIT_DUMP=1(writes.binfiles) - Disassembly: IGA library via ctypes (not
ocloc disasm)
When to use
- Op dispatched through oneDNN (
mkldnn::*):linear/matmul/mm/bmm/conv*/_scaled_dot_product_attention(oneDNN-graph)
When NOT to use
- Kernel is
triton_*→ useextract-asm-triton - Kernel is
_ZTS…(SYCL) → useextract-asm-syclkernel-{aot,jit} - You only need primitive-level timing → use
benchdnndirectly
Steps
Step 0: Locate tools
# libiga64.so: shipped with oneAPI debugger component
# Detect oneAPI root: check env vars first, then common install locations
ONEAPI=${ONEAPI_ROOT:-${CMPLR_ROOT:+${CMPLR_ROOT%/*}}}
if [ -z "$ONEAPI" ]; then
for d in /opt/intel/oneapi ~/intel/oneapi /usr/local/oneapi; do
[ -d "$d" ] && ONEAPI="$d" && break
done
fi
IGA_LIB=$(find ${ONEAPI:?"oneAPI not found; set ONEAPI_ROOT"} -name 'libiga64.so' 2>/dev/null | head -1)
test -n "$IGA_LIB" || { echo "libiga64.so not found under $ONEAPI; install oneAPI debugger"; exit 1; }
export IGA_LIBDump raw ISA via
ONEDNN_JIT_DUMP.OUT="<workdir>/onednn_$(date +%Y%m%d_%H%M%S)" mkdir -p "$OUT" && cd "$OUT" ONEDNN_JIT_DUMP=1 \ ONEAPI_DEVICE_SELECTOR=level_zero:0 \ <repro_cmd> 2>&1 | tee run.log ls dnnl_dump_gpu_*.binThese are raw ISA bytes (not zebin ELF).
ocloc disasmcannot read them.Disassemble with IGA ctypes.
oneDNN
.binfiles are raw ISA bytes (not ELF). Uselibiga64.sovia Python ctypes to disassemble. No separate script needed — run inline:for bin in dnnl_dump_gpu_*.bin; do name=$(basename "$bin" .bin) python3 -c "
import ctypes, sys, pathlib iga = ctypes.CDLL('$IGA_LIB') raw = pathlib.Path('$bin').read_bytes() buf = ctypes.create_string_buffer(1 << 20) # 1MB output buffer
Platform IDs: BMG/Xe2=0x2000000, PVC=0x30000, DG2=0x30004
iga.iga_disassemble(0x2000000, raw, len(raw), buf, len(buf)) sys.stdout.write(buf.value.decode()) " > "${name}.asm" done
**Platform ID selection:**
- BMG / Xe2 / LNL: `0x2000000`
- PVC (Ponte Vecchio): `0x30000`
- DG2 (Alchemist): `0x30004`
If `iga_disassemble` returns 0 bytes, the platform ID likely doesn't
match. Try the next one in the list above.
3. **Pin the actually-invoked kernel.**
```bash
ONEDNN_VERBOSE=1 <repro_cmd> 2>&1 | grep -E '^onednn_verbose.*exec' \
| nl -ba | tee dnnl_verbose.log
# Nth (1-indexed) exec line → dnnl_dump_gpu_*_kernel.<N-1>.binThe largest .bin by size is typically the GEMM kernel.
Cross-check with grep -c dpas <asm> (GEMM has high dpas density).
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.

