## Phase 169: Neith GPU Compute Shader Framework — Vulkan Compute / Metal Compute / DirectX 12 Compute / WebGPU Compute / CUDA / HIP / OpenCL / SYCL Unified Runtime

Closes the compute-shader sovereignty gap. Phase 40.2 briefly mentions compute
passes. Phase 95 covers GPU training clusters (ML side). Phase 157 + 161 rely
heavily on GPU compute but assume the primitive exists. No phase delivers a
**first-class cross-backend compute-shader framework** with wave intrinsics,
shared memory, async compute, cooperative matrix ops, indirect dispatch, and
language / reflection tooling that every modern engine, simulation, ML inference
path, and procedural asset pipeline depends on.

Sovereign replacement for Vulkan / Metal / D3D12 / WebGPU compute runtimes,
NVIDIA CUDA, AMD HIP, Khronos OpenCL, Intel oneAPI / SYCL, Apple Metal
Performance Shaders, Microsoft DirectML (runtime portion), and shader-reflection
tooling (SPIRV-Cross, DXC).

---

### 169.1 @neith/compute-abstraction — Backend Abstraction

- [x] **169.1.1** Single API (C / C++ / Rust bindings) over all backends
- [ ] **169.1.2** Vulkan compute backend — the provider contract, SPIR-V
      dispatch protocol and validation are complete; the residual is the live
      device capture, and the Linux server HAS a live Vulkan device (Mesa
      lavapipe, software). Install `mesa-vulkan-drivers`/`vulkan-tools` and
      confirm `vulkaninfo --summary` lists `llvmpipe`; park only with a named
      failed install attempt. Wire the real Vulkan provider in
      `libs/neith/compute-abstraction/crates/neith-compute-abstraction` and
      capture a dispatch. Verify: a spec dispatches a known compute kernel (e.g.
      a prefix-sum) on lavapipe and the read-back result matches the CPU
      reference.
- [ ] **169.1.3** Metal 3+ compute backend — the AIR provider contract is
      complete; the residual is a live Metal device capture, and the MacBook Air
      IS a Metal 3 device. Wire the real Metal provider in
      `libs/neith/compute-abstraction/crates/neith-compute-abstraction` and
      capture a dispatch on the Mac (the earlier "requires a live
      provider/device" note is satisfied by the Mac). Verify: the same known
      kernel dispatches on the Mac's GPU and matches the CPU reference.
- [ ] **169.1.4** D3D12 compute backend — DXIL provider contract complete; the
      residual is a live D3D12 device capture. No Windows host in the fleet;
      attempt it on a GitHub-hosted `windows-latest` runner using the WARP
      software D3D12 adapter (record the workflow/run URL), which can dispatch a
      DXIL compute kernel; park only with a named failed attempt. Verify: the
      known compute kernel dispatches through WARP D3D12 on the runner and the
      read-back result matches the CPU reference.
- [ ] **169.1.5** WebGPU compute (Dawn / wgpu-class) backend — the WGSL provider
      contract is complete; the residual is a live device capture, attemptable
      with `wgpu` on lavapipe (Linux) or Metal (Mac). Wire the real WebGPU
      provider in
      `libs/neith/compute-abstraction/crates/neith-compute-abstraction`. Verify:
      the known kernel dispatches through wgpu on lavapipe and matches the CPU
      reference.
- [ ] **169.1.6** CUDA backend (NVIDIA path) — PTX provider contract complete;
      the residual is a live CUDA device capture. Needs an NVIDIA GPU; the fleet
      has none (stated 2026-09-18). `blocked:hardware`
- [ ] **169.1.7** HIP backend (AMD path) — AMDGPU code-object provider contract
      complete; the residual is a live ROCm/HIP device capture. Needs an AMD
      ROCm GPU; the fleet has none (stated 2026-09-18). `blocked:hardware`
- [ ] **169.1.8** SYCL / oneAPI backend (Intel path) — SPIR-V/Level-Zero
      provider contract complete; the residual is a live SYCL/oneAPI device
      capture. Needs an Intel GPU with the Level Zero runtime; the fleet has
      none (the Vulkan/WebGPU/Metal backends already give software/CPU and Mac
      coverage) (stated 2026-09-18). `blocked:hardware`
- [x] **169.1.9** CPU reference backend
- [x] **169.1.10** Capability flags (FP16 / FP64 / wave ops / subgroup /
      coop-matrix)
- [x] **169.1.11** Device enumeration + best-device heuristic
- [x] **169.1.12** Multi-GPU context
- [x] **169.1.13** Feature negotiation with graceful fall-back
- [x] **169.1.14** Driver-version allowlist
- [x] **169.1.15** Diagnostic logging of chosen path

---

### 169.2 @neith/compute-lang — Shader Language & Compiler

- [x] **169.2.1** Sovereign shader IR (stable format)
- [x] **169.2.2** WGSL front-end
- [x] **169.2.3** HLSL / SM 6.x front-end
- [x] **169.2.4** GLSL 4.6 / Vulkan-GLSL front-end
- [x] **169.2.5** MSL / Slang transcompile
- [x] **169.2.6** Rust-GPU compute kernels
- [x] **169.2.7** SPIR-V target
- [x] **169.2.8** DXIL target
- [x] **169.2.9** AIR (Apple) target
- [x] **169.2.10** WGSL target
- [x] **169.2.11** PTX / SASS target (CUDA)
- [x] **169.2.12** GCN / RDNA / GCN2 ISA diagnostic
- [x] **169.2.13** Optimisation passes (SSA, DCE, loop unroll, vectorise)
- [x] **169.2.14** Reflection (bindings / resources / constants)
- [x] **169.2.15** Shader-hash caching + PSO pre-build

---

### 169.3 @neith/compute-resources — Buffers, Textures & Bindings

- [x] **169.3.1** Typed / untyped storage buffer
- [x] **169.3.2** Structured buffer with stride
- [x] **169.3.3** Append / counter buffer
- [x] **169.3.4** Storage texture 1D / 2D / 3D / array / cube
- [x] **169.3.5** Sampler (linear / nearest / filtering)
- [x] **169.3.6** Descriptor heap / bindless resources
- [x] **169.3.7** Push constants / root constants
- [x] **169.3.8** Uniform / constant buffer
- [x] **169.3.9** Indirect dispatch buffer
- [x] **169.3.10** Raytracing acceleration structures
- [x] **169.3.11** Shared memory (groupshared / threadgroup)
- [x] **169.3.12** Cooperative matrix (WMMA / MFMA) types
- [x] **169.3.13** Half / double / int8 / int16 types
- [x] **169.3.14** Persistent mapping
- [x] **169.3.15** Sparse / tiled resource support

---

### 169.4 @neith/compute-dispatch — Dispatch Model

- [x] **169.4.1** Synchronous `dispatch(x, y, z)`
- [x] **169.4.2** Indirect dispatch from buffer
- [x] **169.4.3** Mesh-shader compute (when supported)
- [x] **169.4.4** Ray-tracing dispatch
- [x] **169.4.5** Async compute queue
- [x] **169.4.6** Copy queue separation
- [x] **169.4.7** Pipeline barriers with fine-grained stage masks
- [x] **169.4.8** Fence / event cross-queue sync
- [x] **169.4.9** Multi-queue topology (compute + graphics + copy)
- [x] **169.4.10** Timeline semaphores
- [x] **169.4.11** Query pool (timestamp / occlusion)
- [x] **169.4.12** Transient resource aliasing
- [x] **169.4.13** Workload-priority hints
- [x] **169.4.14** Per-dispatch profiling capture
- [x] **169.4.15** Automatic batching of small dispatches

---

### 169.5 @neith/compute-wave — Wave / Subgroup / Cooperative Operations

- [x] **169.5.1** Wave vote (all / any / ballot)
- [x] **169.5.2** Wave broadcast
- [x] **169.5.3** Wave reduction (sum / min / max / and / or / xor)
- [x] **169.5.4** Wave prefix-scan
- [x] **169.5.5** Shuffle / swizzle / rotate
- [x] **169.5.6** Cooperative matrix multiply-accumulate
- [x] **169.5.7** FP8 / FP16 / BF16 cooperative-matrix support
- [x] **169.5.8** Tile / work-group cooperative intrinsics
- [x] **169.5.9** Barrier (memory / control)
- [x] **169.5.10** Fence semantics (acquire / release)
- [x] **169.5.11** Atomic ops (add / cmpxchg / float atomics)
- [x] **169.5.12** Ballot → compaction helper
- [x] **169.5.13** Warp / wave helper macros per backend
- [x] **169.5.14** Wait / yield instructions
- [x] **169.5.15** Feature-detect portable fallback

---

### 169.6 @neith/compute-memory — Memory Model & Allocators

- [x] **169.6.1** Device-local / host-visible / uncached writeable regions
- [x] **169.6.2** Staging buffer ring
- [x] **169.6.3** Paged virtual memory for large buffers
- [x] **169.6.4** Bump allocator for transient
- [x] **169.6.5** Pool allocator per-size class
- [x] **169.6.6** VMA-class integration (AMD-VMA / D3D12MA)
- [x] **169.6.7** Cross-queue resource aliasing
- [x] **169.6.8** Pinned / pageable host memory
- [x] **169.6.9** Unified memory (UMA) path
- [x] **169.6.10** Memory leak detector
- [x] **169.6.11** Budget alarm
- [x] **169.6.12** Defragmentation pass
- [x] **169.6.13** Memory priority hints (GPU)
- [x] **169.6.14** Lazy allocation (on-first-use)
- [x] **169.6.15** Sparse-residency management

---

### 169.7 @neith/compute-ml — ML Inference & Tensor Ops

- [x] **169.7.1** Tensor primitive (rank / dtype / layout)
- [x] **169.7.2** Gemm / Conv2D / DepthwiseConv / Attention kernels
- [x] **169.7.3** Fused activations (ReLU / GELU / SiLU / tanh)
- [x] **169.7.4** LayerNorm / RMSNorm / BatchNorm
- [x] **169.7.5** Softmax / LogSumExp
- [x] **169.7.6** Flash-attention-class kernel
- [x] **169.7.7** Quantisation (INT8 / INT4 / FP8) kernels
- [x] **169.7.8** ONNX / GGUF runtime importer (Phase 93 reuse)
- [x] **169.7.9** Graph optimiser (fusion / folding)
- [x] **169.7.10** Profiling (op-level)
- [x] **169.7.11** Auto-schedule / auto-tune
- [x] **169.7.12** Determinism toggle
- [x] **169.7.13** Training gradient kernels (for on-device)
- [x] **169.7.14** Distributed (ring-allreduce / NCCL / sovereign RCCL)
- [x] **169.7.15** Bridge to Phase 47 Nous runtime

---

### 169.8 @neith/compute-sim — Simulation Kernels Library

- [x] **169.8.1** N-body (direct + tree-code)
- [x] **169.8.2** SPH / FLIP / APIC solver building blocks
- [x] **169.8.3** PCG / multigrid pressure solver
- [x] **169.8.4** XPBD constraint solver
- [x] **169.8.5** FFT (real / complex, 1D / 2D / 3D)
- [x] **169.8.6** Radix / merge sort
- [x] **169.8.7** Prefix sum / scan primitives
- [x] **169.8.8** Hash grid + spatial partition
- [x] **169.8.9** BVH build + refit
- [x] **169.8.10** Raymarch SDF
- [x] **169.8.11** Marching cubes / dual contour
- [x] **169.8.12** Voxelisation
- [x] **169.8.13** Mesh boolean CSG
- [x] **169.8.14** Procedural noise (Perlin / Simplex / curl / worley)
- [x] **169.8.15** Cross-backend performance conformance

---

### 169.9 @neith/compute-render — Render Helpers

- [x] **169.9.1** GPU-driven culling (frustum + occlusion)
- [x] **169.9.2** Hierarchical z-buffer
- [x] **169.9.3** Mesh / vertex fetch compute path
- [x] **169.9.4** GPU light list / cluster build
- [x] **169.9.5** GPU bone palette skinning
- [x] **169.9.6** GPU morph target blend
- [x] **169.9.7** GPU particles (Phase 161) runtime
- [x] **169.9.8** Post-process kernels (bloom / DOF / TAA / CAS)
- [x] **169.9.9** Compute-based rasterisation (software)
- [x] **169.9.10** GPU virtual texture

---

### 169.10 @neith/compute-debug — Debug & Validation

- [x] **169.10.1** Resource-validation layer
- [x] **169.10.2** Race-condition detector
- [x] **169.10.3** Out-of-bounds access check
- [x] **169.10.4** NaN / Inf hunter
- [x] **169.10.5** Shader assert() runtime
- [x] **169.10.6** Printf from shader to debug console
- [x] **169.10.7** Step-debug in Phase 160 profiler
- [x] **169.10.8** Memory sanitizer
- [x] **169.10.9** Determinism test harness
- [x] **169.10.10** Bindless resource leak tracker

---

### 169.11 @neith/compute-sdk — Developer SDK

- [x] **169.11.1** C / C++ / Rust / Swift bindings
- [x] **169.11.2** Python bindings for offline scripts
- [x] **169.11.3** JavaScript / TypeScript WebGPU wrapper
- [x] **169.11.4** Kernel-authoring DSL macros
- [x] **169.11.5** Examples (matmul / raymarch / fluid / FFT)
- [x] **169.11.6** Benchmark harness
- [x] **169.11.7** Stress-test suite
- [x] **169.11.8** Version compat tests
- [x] **169.11.9** Profiler integration (Phase 160)
- [x] **169.11.10** Documentation + tutorials

---

### 169.12 Testing & Validation

- [x] **169.12.1** Cross-backend correctness (bit-reproducible for FP16)
- [ ] **169.12.2** Performance vs a CUDA reference ≥ 85% — the paired-median
      benchmark grader is complete; certification needs a live NVIDIA/CUDA
      capture. Needs an NVIDIA GPU to produce the CUDA reference; the fleet has
      none (stated 2026-09-18). `blocked:hardware`
- [ ] **169.12.3** Performance vs a HIP reference ≥ 85% — the grader is
      complete; certification needs a live AMD/HIP capture. Needs an AMD GPU to
      produce the HIP reference; the fleet has none (stated 2026-09-18).
      `blocked:hardware`
- [ ] **169.12.4** WebGPU browser conformance — the physical-adapter no-skip
      evidence grader is complete; the residual is a live browser capture, which
      headless Chromium provides (its Dawn WebGPU backend runs in the repo's
      Playwright harness; enable WebGPU with the appropriate flags). Verify: the
      conformance suite runs the compute kernels in headless Chromium and the
      grader records a physical-adapter, no-skip pass.
- [ ] **169.12.5** 24-hour soak (no driver crash) — the
      monotonic-duration/dispatch/crash/device-loss grader is complete; the
      residual is a live 24-hour run, attemptable on lavapipe (Linux) or the
      Mac. Verify: a 24-hour continuous-dispatch soak on lavapipe completes with
      zero device-loss or validation errors and the grader accepts the captured
      duration.
- [ ] **169.12.6** Multi-GPU scaling ≥ 80% efficiency — the scaling grader is
      complete; certification needs two or more live peer GPUs. Needs two or
      more peer GPUs on one host; the fleet has a single-GPU Mac and a GPU-less
      Linux server (stated 2026-09-18). `blocked:hardware`
- [x] **169.12.7** Memory-leak burn-in
- [x] **169.12.8** Determinism mode regression
- [ ] **169.12.9** Dogfood: run the compute kernels of the Phase 42 engine, the
      Phase 157 sim and the Phase 47 inference path through this framework on
      the software/CPU devices (lavapipe on Linux, Metal on the Mac). Verify: a
      spec drives one representative kernel from each of the three subsystems
      through the abstraction and asserts each result matches its CPU reference,
      with the durations recorded.
- [ ] **169.12.10** Console platform (Phase 137) validation — the devkit grader
      is complete; certification needs a live console devkit capture. Needs a
      console devkit under NDA; the fleet has none (stated 2026-09-18).
      `blocked:hardware`
