Extract ASM from JIT-Compiled SYCL Kernels
Same compilation stack as AOT (SYCL → LLVM IR → SPIR-V → IGC → zebin), but
execution happens at first kernel launch. The zebin only exists transiently in
memory — you MUST re-run with IGC_ShaderDumpEnable=1 to capture it to disk.
How this fits the compilation stack
Build time:
SYCL source → LLVM IR → SPIR-V
↓
embedded in binary (no native code yet)
First launch (runtime):
SPIR-V → IGC (JIT) → zebin (in memory only!)
↓
IGC_ShaderDumpEnable=1 → dumps to disk ← this is what we capture
↓
.asm file (with // file:line comments from IGC)
Why IGC_ShaderDumpEnable=1 is required: Unlike AOT where the zebin is
statically extractable from the binary, JIT zebin only exists in GPU driver
memory. Without the dump flag, it's never written to disk.
Bonus: JIT dump produces .asm files with inline // file:line comments
(IGC's EmitPass annotates them directly).
When to use
- Kernel is
_ZTS…AND one of:- Binary has NO
__CLANG_OFFLOAD_BUNDLE(pure JIT build) - Binary has AOT bundle but target does not match current device (e.g. built for PVC, running on BMG — runtime falls back to JIT via SPIR-V)
- Binary has NO
- Common cases:
torch-xpu-opsbuilt withTORCH_XPU_ARCH_LIST=none- Standalone DPC++ without
-fsycl-targets=spir64_gen - Device not in the AOT target list (e.g.
TORCH_XPU_ARCH_LIST=pvcon BMG)
When NOT to use
- Binary has AOT code matching current device → use
extract-asm-syclkernel-aot - Kernel is oneDNN ngen → use
extract-asm-onednn(different stack) - Kernel is Triton → use
extract-asm-triton
Steps
Prerequisite: The router (extract-xpu-kernel-asm) has already confirmed
that the JIT path is active for the current device. This skill assumes IGC will
be invoked at runtime.
Pin the actually-launched kernel.
Use unitrace (preferred) or SYCL_UR_TRACE (fallback):
unitrace -d <repro_cmd> # Or fallback: SYCL_UR_TRACE=-1 <repro_cmd> 2>&1 | grep -oP 'pKernelName = 0x[0-9a-f]+ \(\K[^)]+' | sort -uPick the hot kernel name (
<KERNEL>).Re-run with IGC dump (cold cache).
OUT="<workdir>/$(basename "$BIN")_$(date +%Y%m%d_%H%M%S)" mkdir -p "$OUT/igc" NEO_CACHE_PERSISTENT=0 \ IGC_ShaderDumpEnable=1 \ IGC_DumpToCustomDir="$OUT/igc" \ \ <repro_cmd> 2>&1 | tee "$OUT/run.log" ls "$OUT/igc"/*.asm | wc -lMatch kernel name to
.asmfile.MATCH=$(grep -l "$KERNEL" "$OUT/igc"/OCL_asm*_simd*_entry_*.asm | head -1) test -n "$MATCH" || { echo "no asm matches $KERNEL"; exit 1; } echo "asm-file: $MATCH"