Skip to content

feat(moe): add Volcanic-safe multi-workgroup quantized MoE Vulkan compute kernels (#5) - #15

Closed
saariuslystoned wants to merge 2 commits into
mainfrom
feat/5-volcanic-moe-compute-kernel
Closed

saariuslystoned wants to merge 2 commits into
mainfrom
feat/5-volcanic-moe-compute-kernel

Conversation

@saariuslystoned

Copy link
Copy Markdown
Contributor

Addresses #5 (clean-room GLSL 4.60 multi-workgroup routed MoE compute kernels for PowerVR Volcanic DXT-48-1536, C11/C++17 ABI & host harness, SPIR-V validation, and bit-exact CPU reference suite).

Summary

  • Volcanic-safe multi-workgroup MoE GLSL 4.60 kernels (local_size_x = 128):
    • Supports single-token top-K routed experts and batched DSpark union expert tables with per-expert deduplication and register-accumulated weighted sums (y[token, row] = sum_k route_w[k] * expert_k(x[token])).
    • Supports Q4_0 (18-byte block-32, 16-byte expert alignment) and group-64 INT4 affine (64-byte blocks, 64-byte alignment + 64-byte aligned atomic cursor).
    • Finite forward-progress guarantee: lock-free monotonic atomicAdd tile claiming capped at max_tiles_per_wg (default 32 tiles ≈ <8 ms slice), disjoint output-row ownership, and zero cross-workgroup spinlocks (enforced by static shader linter rejecting while, unbounded for, do, atomicCompSwap, atomicExchange, and spin).
    • Standard Vulkan 1.2/1.3 VkPhysicalDeviceFeatures2 → VkPhysicalDeviceVulkan12Features chain.
  • Host reference & ABI verification: Python + C++17 reference implementation, moe_abi.h (C11/C++17), SPIR-V layout offset assertions, and CI integration.

Verification

  • glslangValidator + spirv-val --target-env vulkan1.2: PASS (offsets & LocalSize 128 verified against moe_abi.h).
  • g++ -std=c++17 -Wall -Wextra -Werror -Werror=comment & C11 moe_abi.h compile: PASS.
  • python3 tools/moe/moe_reference.py --self-test & unittest discover: 13/13 + 25/25 PASS (bit-exact Python/C++ parity across Q4_0, group-64 affine, and 2-token DSpark union under both claim maps).
  • ./scripts/clean-room-audit.sh: PASS (70 files); git diff --check: clean.

Shader eval_tile now guards tile/token/slot/weight-range inputs before dereference; host pack rejects non-multiple rows; dot checks K multiples, activation width, and 64-bit offsets; arena/dispatch arithmetic is overflow-checked; fixture indices are bounds-checked before resize. Adds deterministic adversarial suite (21 tests): non-multiple dims, top-k limits, empty/skewed routing, N-dim tiles, nibble extremes, NaN/Inf/subnormal scales, shader guards, and a seeded finite fuzz sweep.
@saariuslystoned

Copy link
Copy Markdown
Contributor Author

Adversarial Hardening & Public-Roads Audit Receipt (cf0a3de6)

  • Prior PR head: 6687c33c → Hardened head: cf0a3de6
  • Fixes landed: Fixed quantized pack UB, fixture DoS bounds, dim/format parity, integer overflow, dot-product checks, and shader bounds guards.
  • Verification: spirv-val (vulkan1.2/1.3) PASS, host ASan+UBSan PASS, 34/34 unit tests OK, ./scripts/clean-room-audit.sh PASS (0 violations across 71 files; private-term diff scan clean).

@saariuslystoned

Copy link
Copy Markdown
Contributor Author

Closing: superseded — custom MoE runtime compute shaders sit outside freepvr's clean-room ISA/spec/validator/probe scope.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant