A770 Kernel Optimization Skill
An agent skill providing hardware-verified methodology, dispatch rules, pitfalls, and production code guidance for SYCL, ESIMD, OpenCL C, and native Level Zero compute kernels on Intel Arc A770 (Xe-HPG / DG2).
Scope & Transferability: Measured numbers and [DISPATCH] rules in this skill are verified on Intel Arc A770 (DG2-G10, Windows 11, oneAPI 2026.2, driver 32.0.101.9150, Level Zero SDK 1.33.1, oneDNN 3.13.2). For other Intel GPUs, drivers, or compiler stacks, apply the workflow and re-measure hardware assumptions before shipping.
Installation
Option 1: Skills CLI (npx skills)
Install globally across detected coding agents (Antigravity, Codex, Claude Code, Cursor, Gemini CLI, OpenCode, etc.):
npx skills add Blackwood416/A770-Kernel-Optimization -g
Or install selectively for a specific agent:
npx skills add Blackwood416/A770-Kernel-Optimization --skill A770-Kernel-Optimization -a codex -g -y
Option 2: Claude Code Plugin Marketplace
/plugin marketplace add Blackwood416/A770-Kernel-Optimization
/plugin install a770-kernel-optimization@a770-kernel-optimization
Option 3: Manual Clone
git clone https://github.com/Blackwood416/A770-Kernel-Optimization.git
Copy or symlink skills/A770-Kernel-Optimization into your agent's global or project skill directory (for example ~/.agents/skills/A770-Kernel-Optimization or ~/.codex/skills/A770-Kernel-Optimization).
What This Skill Covers
The skill separates tuning into two architectural domains plus runtime & ISA verification:
- Domain II (XMX Matrix: BF16 / INT8 / 4-bit GEMM, SwiGLU, Prefill SDPA):
experimental::grf_size<256> + WG=32 + 4-buffer circular SLM (cab4, 48 KB, 2 WGs/Xe-core = 64/64 HW threads) + split_barrier decoupling.
0-Dummy dpasw<8,8> (2x8 / 3x4 macros), A64 bp_vec addressing, reverse-order pack_a, and the ESIMD VC -Xfinalizer 4-flag optimal set (-SBIDBundle -SWSBDepReduction -nopresched -twoSrcBundleBCR).
- Cache hints (L1-streaming
B st.ca, wb.wb vs st.uc C stores), 2D 8x8 serpentine scheduling + swizzle <= 4.
- Measured highlights (vs
oneDNN 3.13.2, errors=0): 92.5 TFLOPS on 4096^3 BF16 GEMM (1.10x), 33–35 WIN | 4–6 TIE | 0 LOSE across 39 shapes; fused SwiGLU 79.6 TFLOPS (1.08x–1.73x); INT8 129.6 TOPS (6/6 WIN); 4-bit (NF4/INT4Sym) online dequant 22.5–24.6 TFLOPS.
- Domain I (DRAM Stream-Through: GEMV, RMSNorm, LayerNorm, Softmax, Decode SDPA, DAG Fusion):
- Targets the
403.1 GB/s float4 DRAM read roof (464.6 GB/s write).
bf16 Decode GEMV up to 396.8 GB/s (98.4% roof, 1.04x–1.22x vs oneDNN), Softmax 1.58x–3.55x, Decode Q=1 SDPA (interleaved key-block streams) 386–391 GB/s.
- Three-tier row-reduction caching: GRF register-cached rows (
WG=256, SG=16, PER<=16 -> <=32 GRF, 0 spill) with exact two-pass variance for cols <= 4096 (249.5–257.8 us = 390.5–403.4 GB/s, 2.24x–2.79x vs oneDNN on 2048x4096 f32 Add[+GeluErf]+LayerNorm), SLM staging for 4096 < cols <= 8192, and streaming multi-pass fallback beyond 8192.
- Native Level Zero Runtime & WDDM Discipline:
UR_LOADER_USE_LEVEL_ZERO_V2=1 pitfall (7.93x slowdown on uncaptured chains), Regular Command List replay (0.484 us/edge), dedicated ordinal 1 (COPY-only) async Copy Engine (91.6%–99.95% overlap), static zeEventPool, pre-allocated device arena, TDR-calibrated UncachedHost GPU doorbells, and runtime-compiled .zebin native disk caching.
- Disassembly & Spill Verification Gate:
- Catches
ze_kernel_properties_t::spillMemSize == 0 false negatives by enforcing spillMemSize == 0 && privateMemSize == 0 alongside ocloc disasm main-loop send.dc0 == 0, dummy_dpasw == 1, sync.allrd == 0, and Short UGM waits (<120 ins) <= 1.
Repository Layout