/a770-kernel-optimization:A770-Kernel-Optimizationfrom a770-kernel-optimization
Provides methodology and production code guidance for optimizing SYCL, ESIMD, and Level Zero compute kernels on Intel Arc A770 (Xe-HPG/DG2, Windows). Covers streaming kernels, XMX matrix kernels, ISA/SWSB/SLM/cache rules, compiler knobs, and VTune spill auditing.
Ships in a770-kernel-optimization. Installing the plugin adds it to Claude Code.
What the skill costs in Claude's context, stage by stage
Name and description: Claude knows it exists.
SKILL.md joins the conversation and stays.
Read when SKILL.md points to them.
Use this skill as a methodology and selective code-guidance layer for optimizing SYCL, ESIMD, and Level Zero kernels on Intel Arc A770 (Xe-HPG / DG2, Windows 11, oneAPI 2026.2, driver 32.0.101.9150, Level Zero SDK 1.33.1, oneDNN 3.13.2).
Transfer discipline: Measured numbers and [DISPATCH] rules apply only inside their stated A770 validity domain. For any other Intel GPU, driver, or compiler stack, transfer the methodology only and re-measure all hardware-specific assumptions before shipping.
[MEASURED] [ARCH]XMX = 0%, DRAM/L3 pass-through 79%–99.5%. Target the 403.1 GB/s float4 read roof (464.6 GB/s write) using vec16 coalesced loads, GRF register-cached rows (WG=256, SG=16, PER<=16 -> <=32 GRF, 0 spill) for fused row reductions up to cols <= 4096 (249.5–257.8 us = 391–403 GB/s on 2048x4096 f32 Add[+GeluErf]+LayerNorm), SLM staging for 4096 < cols <= 8192, interleaved key-block streams (386–391 GB/s), and runtime-compiled .zebin DAG fusion (399.6 GB/s = 99.1% roof, 2.73x vs unfused).DRAM/L3 10%–19% (81%–89% L3 hit). Unlock GRF=256 (experimental::grf_size<256>) + WG=32 + cab4 (4 x 12 KB = 48 KB SLM -> 2 WGs/Xe-core = 64/64 HW threads) + split_barrier + 0-Dummy dpasw<8,8> (2x8/3x4 -> dummy=1) + bp_vec (-94 ins) + ESIMD VC -Xfinalizer -SBIDBundle -SWSBDepReduction -nopresched -twoSrcBundleBCR: reaches 92.5 TFLOPS (4096^3, 1.10x vs oneDNN 3.13.2) and 33–35 WIN | 4–6 TIE | 0 LOSE across 39 shapes (incl. SwiGLU 79.6 TFLOPS, INT8 129.6 TOPS, 4-bit BK=gs=64 online dequant 22.5–24.6 TFLOPS).gid & gid+32 share L1). Use swizzle=1 + B ca.ca for single-wave grids (total_wgs <= 64); use 2D 8x8 N-inner snake + L1-streaming B (st.ca) + swizzle <= 4 (K >= 4096) for multi-wave grids.C store: wb.wb for standard / Bias / SiLU (-42 us on LM-Head vs st.uc); st.uc for ResidualAdd / BiasResidualAdd.UR_LOADER_USE_LEVEL_ZERO_V2=1 globally on uncaptured loops (7.93x slowdown vs v1; dual-SYCL Copy overlap collapses 99.95% -> <= 0%).zeCommandListAppendBarrier + a user-defined fixed-address GraphControl struct, 0.484 us/edge, 1-replay break-even) + explicit ordinal 1 (COPY-only) Copy Engine (91.6%–99.95% overlap) + pre-allocated Device Arena (avoids UMF >= 16 MB cliff) + static zeEventPool (zeEventHostReset 0.10–0.20 us).numQueues=1 on ordinal 0) means 0.00% multi-queue compute concurrency -- horizontally fuse small compute ops (SwiGLU, DAGs) instead.ZE_HOST_MEM_ALLOC_FLAG_BIAS_UNCACHED (10/10, 6.00 us RTT) with TDR-calibrated spin caps (~1.12 us/spin).ze_kernel_properties_t::spillMemSize == 0 (from zeKernelGetProperties) has false negatives. Always verify spillMemSize == 0 && privateMemSize == 0 AND ocloc disasm main-loop send.dc0 == 0, dummy_dpasw == 1, sync.allrd == 0, and Short UGM waits (<120 ins) <= 1.Before writing or tuning a kernel:
A*x vs x*W, row-major vs VNNI, NCHW vs NHWC), dtype, shape, and target metric (device_time, wall_time, or pipeline_time).errors: 0/<total>) and verify any library baseline against it before timing.[HYPOTHESIS].| Task | Primary Reference | Next Reference |
|---|---|---|
Dense GEMM (bf16/int8/f32), SwiGLU, GEMV-N1, RMSNorm, Softmax | techniques.md | code-snippets.md |
Weight-only INT4 / NF4 GEMM & Decode GEMV (x*W) | weight-only-gemv.md | api-usage.md |
Attention / SDPA (Decode Q=1 & Prefill Q>1) | sdpa-a770.md | code-snippets.md |
| Reduction or work-group scan | reductions-scan.md | numerics.md |
| Odd/unaligned shapes, sparse GEMM, or direct convolution | irregular-shapes.md | techniques.md |
| Precision, accumulators, math ops, or verification tolerances | numerics.md | pitfalls.md |
| Situation | Open |
|---|---|
Hardware topology, 128-GRF vs 256-GRF residency matrix, XMX saturation, SLM banking | hardware.md |
Empirical bandwidth roofs (403.1 GB/s), Domain I/II taxonomy, stride/width penalties | bandwidth.md |
Cache latency ladder, gid & gid+32 co-residency, swizzle rules, LSC cache hints | cache-geometry.md |
dpas / dpasw<8,8> legality, 0-Dummy grouping theorem (2x8/3x4) | dpas.md |
SWSB 16-SBID saturation, Short UGM waits, split_barrier, fences, GRF banks | swsb.md |
LSC 256 B cap, A64 bp_vec, load_2d/prefetch bans, send.dc0, atomics | lsc-messages.md |
SYCL/ESIMD -Xfinalizer 4-flag optimum, blacklist, -O2/unroll, OpenCL flags | knobs.md |
Level Zero queues, ordinal 1 Copy Engine, graphs, doorbells, UMF pools, .zebin fusion | execution.md |
| Symptom -> ISA -> action playbook & DG2 ISA capability matrix | performance-playbook.md |
| Known API/hardware gates, codegen spills, WDDM/L0 traps, and negative results | pitfalls.md |
Profiling (VTune 0.05 ms OA), ocloc disasm spill audit, methodology, TDR safety | instruments.md |
Modern SYCL/ESIMD/L0 APIs, oneDNN baselines, and build/VTune commands | api-usage.md |
| Curated production kernel & runtime code snippets | code-snippets.md |
Complete directory map: references/index.md.
| Label | Meaning |
|---|---|
[ARCH] | Xe-HPG / DG2 architectural constraint |
[ISA] | Instruction encoding or hardware legality fact |
[MEASURED] | Verified on A770 (errors == 0) inside stated validity domain |
[DISPATCH] | Validated production selection rule within stated shape/stack domain |
[HEURISTIC] | Starting point derived from measurements; re-measure on new shapes |
[TOOLCHAIN] | Compiler/runtime/API capability or gate; re-probe after upgrades |
[BUG] | Version-specific driver/compiler defect or silent hazard |
[CORRECTNESS] | Layout, alignment, precision, or synchronization correctness requirement |
[HYPOTHESIS] | Unverified proposal; test before recommending |
15–20 us cold-GPU downclocking; take >= 20 samples, report median + p10/p90 (or MAD), flag high CV, and separate device_time, wall_time, and pipeline_time. Use paired interleaved A/B/B/A testing for < 5% margins.oneDNN baseline contract: Run with ONEDNN_VERBOSE=profile,dispatch, record implementation string (jit:gemm:any vs ocl:ref:any), tags, dtypes, fpmath_mode, and verify against the CPU reference. Never report a speedup against a baseline that fails numerical tolerance.RPT, new WG, UncachedHost polling) one process at a time under a watchdog, require zero spills before launch, and never use ESIMD WG >= 256 (WG=256 is valid and optimal in standard SYCL / OpenCL C at SG=16, using 16 HW threads), load_2d, or named_barrier on DG2.agents/openai.yaml (opens in a new tab)references/api/api-usage.md (opens in a new tab)references/api/code-snippets.md (opens in a new tab)references/codegen/knobs.md (opens in a new tab)references/hardware/bandwidth.md (opens in a new tab)references/hardware/cache-geometry.md (opens in a new tab)references/hardware/hardware.md (opens in a new tab)references/index.md (opens in a new tab)references/isa/dpas.md (opens in a new tab)references/isa/lsc-messages.md (opens in a new tab)references/isa/swsb.md (opens in a new tab)references/techniques/irregular-shapes.md (opens in a new tab)references/techniques/numerics.md (opens in a new tab)references/techniques/reductions-scan.md (opens in a new tab)references/techniques/sdpa-a770.md (opens in a new tab)references/techniques/techniques.md (opens in a new tab)references/weight-only-gemv.md (opens in a new tab)references/workflow/execution.md (opens in a new tab)references/workflow/instruments.md (opens in a new tab)references/workflow/performance-playbook.md (opens in a new tab)What SKILL.md sets; muted values are Claude Code's defaults
Three short reads, in order
intel-arc, gpu-optimization, sycl, esimd, level-zero, kernel-tuning
npx claudepluginhub blackwood416/a770-kernel-optimization --plugin a770-kernel-optimizationOther plugins' skills for the same job