Add end-to-end MXFP4 GGUF support to the Metal backend #79
Reference in New Issue
Block a user
Delete Branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Goal
Add end-to-end MXFP4 GGUF support to DS4Server's Rust model loader and Metal execution path.
This is an enhancement rather than a blocker for #78. The current repository already contains DS4's portable and optimized MXFP4 Metal kernels, but Rust rejects GGUF tensor type 39 and therefore cannot use them.
Upstream source of truth
Use current DS4 as the behavioral and format oracle, including the work introduced around:
Recheck the current DS4 commit before implementation and record the exact source revision. Do not infer the block layout, scale encoding, tensor-size formula, or dispatch guards from kernel names alone.
Phase 1: port the exact GGUF format contract
Phase 2: integrate model loading and placement
Phase 3: route the existing Metal implementation
The current native Metal snapshot already contains the MXFP4 kernels and wrapper entry points. Wire the Rust execution graph to them under the same tensor, model-shape, device, quality, prefill/decode, and SSD/resident conditions as current DS4.
Reuse the capability and M5/pre-M5 policy implemented by #78. MXFP4 exact fast paths must activate automatically only on supported hardware and shapes. Unsupported combinations must either use DS4's exact portable path or fail clearly if DS4 itself does not provide a valid fallback.
Do not duplicate general Q2 decode-fusion work from #78. Keep MXFP4-specific scheduling in this issue and share only the already-established Rust FFI and device-policy helpers.
Phase 4: numerical and behavioral validation
Phase 5: performance characterization
Benchmark MXFP4 against current DS4 on the same machine and against DS4Server's closest supported quantization using the same methodology as #78:
The purpose is to verify that DS4Server receives the native MXFP4 gains and does not merely parse the format. Do not make MXFP4 the default artifact solely because it loads; default selection requires measured quality, memory, and speed evidence.
Acceptance criteria
Non-goals
Implemented and verified in commit
28231e1(Add end-to-end MXFP4 Metal support).Oracle and artifact
Implementation
Parity and validation
Performance and root cause
Verification gates
The final review against issue #79 and DS4 found no unimplemented acceptance item beyond the explicitly documented lack of enough RAM for a real full-resident 156 GB run.