agentleFS
intelintel/torch-xpu-ops/.claude/skills/extract-asm-syclkernel-aot/SKILL.md

extract-asm-syclkernel-aot

Skill121 starsChanged 5 months agoApache-2.0View on GitHub

Extract GPU ISA from AOT-compiled SYCL binaries using NEO driver runtime dump. Use when the kernel is a SYCL symbol (_ZTS...) from an AOT binary such as libtorch_xpu.so, SYCL-TLA FMHA, or any DPC++ binary compiled with -fsycl-targets=spir64_gen -Xs "-device <gpu>".

The file

We split this skill into the rules it gives an agent

1 rule. About 0 are common, 1 is distinctive, and 0 are very specific to this project.

  • ≈0

    Common · estimate

    Many files like this have a rule of this kind.

  • ≈1

    Distinctive · estimate

    This author's own choices. Worth a look.

  • 0

    Very specific

    Tied to their project's names, files or tools. Probably skip.

  • Common
  • Distinctive
  • Very specific
  1. Distinctive:

    Run the workload with NEO debug keys.

    line 46

≈ “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.

Keep what fits and drop the rest. Your version, ready for your agents.
Files
SKILL.md

Extract ASM from AOT-Compiled SYCL Binaries

Key facts

  • GPU ISA (zebin) was already compiled at build time by IGC and embedded in the host binary.
  • IGC_ShaderDumpEnable does NOT work — IGC is never invoked at runtime.
  • Extraction uses NEO driver debug keys to dump the zebin ELF at runtime, then ocloc disasm to produce readable ASM.

When to use

  • Kernel is a mangled SYCL symbol (_ZTS…) from an AOT-compiled binary whose AOT target matches the current device:
    • libtorch_xpu.so / libtorch_xpu_ops.so (default PyTorch XPU build)
    • SYCL-TLA FMHA .so
    • Standalone DPC++ executable built with -fsycl-targets=spir64_gen

When NOT to use

  • AOT target does not match current device (e.g. binary built for PVC, running on BMG) → runtime falls back to JIT → use extract-asm-syclkernel-jit
  • Binary has no AOT code at all → use extract-asm-syclkernel-jit
  • Kernel is oneDNN ngen (gemm_kernel, gen_conv_kernel) → use extract-asm-onednn
  • Kernel is Triton (triton_*) → use extract-asm-triton

Steps

Step 1: Verify tools

command -v ocloc >/dev/null || { echo "ocloc not found; source oneapi-vars.sh"; exit 1; }

Step 2: Dump zebin ELFs via NEO driver

Run the workload with NEO debug keys. Only kernels actually dispatched to the GPU will be dumped — no unused kernels appear.

OUT="<workdir>/aot_$(date +%Y%m%d_%H%M%S)"
mkdir -p "$OUT" && cd "$OUT"

DumpZEBin=1 NEOReadDebugKeys=1 <repro_cmd>
ls *.elf

Step 3: Disassemble

# Detect device name (bmg, dg2, pvc, etc.)
DEVICE=$(sycl-ls 2>/dev/null | grep -oP '(?<=\[)[^]]+' | head -1 | awk '{print tolower($NF)}')
DEVICE=${DEVICE:-bmg}  # fallback

for elf in *.elf; do
  name=$(basename "$elf" .elf)
  ocloc disasm -file "$elf" -dump "${name}_dump" -device "$DEVICE"
done

Step 4: Identify the target kernel

ASM files are at <name>_dump/.text._ZTSxxxx.asm. Demangle to find yours:

for f in *_dump/.text._ZTS*.asm; do
  mangled=$(basename "$f" .asm | sed 's/^\.text\.//')
  echo "$f  →  $(c++filt "$mangled")"
done

Match the demangled name to the kernel you are analyzing.

Download now (ZIP)

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
What did you use it for? e.g. Reviewing pull requests in a Rails app

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.