feat(gemma4/rocm): FP8 resident MoE + SharedK-WMMA (split from #228) - #317
Conversation
b73018c to
72e734f
Compare
b7a0622 to
2f58e58
Compare
2f58e58 to
606e894
Compare
localai-org-maint-bot
left a comment
There was a problem hiding this comment.
@bakon11 This is not reviewable/mergeable with the PR body itself listing tests/spec as honest follow-ups. The ~5k-line production change needs the project-required spike/spec, focused automated parity/regression coverage for the new resident MoE/peer/SharedK/decode paths, and the same-change STATUS/BENCHMARKS/matrix/state evidence anchors required by AGENTS.md. Please land those in this PR (or split the stack further) before asking for merge.
|
@localai-org-maint-bot Addressed the mergeability blockers you named:
Local: |
Maint-bot mudler#317: land the project-required spike/spec and a focused automated CPU gate for the portable fused_ops FP8 ExpertGeGLU seams (no AMD runner). Lab RDNA4 quality/speed remains recipe evidence; CUDA SACRED gates unchanged. FOLLOWING_AGENTS_PROTOCOL Following-Agents-Protocol: true AI-Assisted: true Assisted-by: Hermes:grok-4.5 [Hermes]
…estructure) Rebuild of mudler#317 on current origin/main. Keeps ROCm FP8 ExpertGeGLU, SharedK-WMMA prefill, fused_ops seams, expert LRU/prewarm, and CPU seam test. Deferred (localai-bot hold): ForwardGemma4Layers extract, Gemma4DecodeGraph, and any unguarded gemma4.cpp layer-loop restructure that would require a GB10 token-exact golden. Those remain lab-only until a separate CUDA-gated PR. FOLLOWING_AGENTS_PROTOCOL Following-Agents-Protocol: true AI-Assisted: true Assisted-by: Hermes:grok-4.5 [Hermes]
17df82f to
a5bd7ad
Compare
Rebuilt on current
|
| Deferred (lab-only / later PR) | Still in #317 |
|---|---|
ForwardGemma4Layers extract |
ROCm FP8 ExpertGeGLU + channel GEMV |
Gemma4DecodeGraph / decode hipGraph |
SharedK + SharedK-WMMA prefill |
| MLP∥MoE side-stream wiring | vt::fused_ops portable seams |
| Any CUDA-path layer-loop rewrite | Expert LRU / host cache / prewarm |
| GB10 token-exact requirement for this tip | DeviceMemoryInfo backend seam |
CPU seam test test_gemma4_rocm_fp8_seams |
|
| Spec + ENVIRONMENT/FEATURES/USAGE |
gemma4.cpp / gemma4.h are unchanged vs main in this tip. Registry only adds ExpertGeGLU prewarm after resident upload (no graph hook).
Bot checklist
- Token-exact GB10 — N/A for this tip (no forward restructure). Happy to land graph/extract later with golden.
- TLS vs graph capture — N/A (no Gemma4 decode graph in PR).
- thread_local lifetime — only existing main layer TLS remains; no new capture driver.
Local gates (green)
check-device-leakagecheck-env-doccheck-doc-checkpointcheck-agent-recordcheck-pr-size(feat(gemma4/rocm): FP8 resident MoE + SharedK-WMMA (split from #228) #317)
Sanitize-cpu ASan/TSan ambient noise may still red; not specific to this payload.
Please re-review when CI settles on a5bd7ad0.
a5bd7ad to
d1c4a65
Compare
…estructure) Rebuild of mudler#317 on current origin/main. Keeps ROCm FP8 ExpertGeGLU, SharedK-WMMA prefill, fused_ops seams, expert LRU/prewarm, and CPU seam test. Deferred (localai-bot hold): ForwardGemma4Layers extract, Gemma4DecodeGraph, and any unguarded gemma4.cpp layer-loop restructure that would require a GB10 token-exact golden. Those remain lab-only until a separate CUDA-gated PR. FOLLOWING_AGENTS_PROTOCOL Following-Agents-Protocol: true AI-Assisted: true Assisted-by: Hermes:grok-4.5 [Hermes]
Rebased on current main (post-#377 gate fix)Tip: Thanks for the GB10 hardware check — confirmed:
What CUDA / non-ROCm builds do with this tip
ROCm lab evidence (this box — not GB10)
Default-on ROCm knobs (explicit)These change ROCm default behavior when unset (documented in ENVIRONMENT); non-ROCm unaffected:
KV cache dtype (separate from weight FP8)Serve selection is env today (llama.cpp-style intent, different surface):
Local gates on
|
…estructure) Rebuild of mudler#317 on current origin/main. Keeps ROCm FP8 ExpertGeGLU, SharedK-WMMA prefill, fused_ops seams, expert LRU/prewarm, and CPU seam test. Deferred (localai-bot hold): ForwardGemma4Layers extract, Gemma4DecodeGraph, and any unguarded gemma4.cpp layer-loop restructure that would require a GB10 token-exact golden. Those remain lab-only until a separate CUDA-gated PR. FOLLOWING_AGENTS_PROTOCOL Following-Agents-Protocol: true AI-Assisted: true Assisted-by: Hermes:grok-4.5 [Hermes]
FOLLOWING_AGENTS_PROTOCOL Following-Agents-Protocol: true AI-Assisted: true Assisted-by: Hermes:grok-4.5 [Hermes]
984f0c1 to
c03304d
Compare
…estructure) Rebuild of mudler#317 on current origin/main. Keeps ROCm FP8 ExpertGeGLU, SharedK-WMMA prefill, fused_ops seams, expert LRU/prewarm, and CPU seam test. Deferred (localai-bot hold): ForwardGemma4Layers extract, Gemma4DecodeGraph, and any unguarded gemma4.cpp layer-loop restructure that would require a GB10 token-exact golden. Those remain lab-only until a separate CUDA-gated PR. FOLLOWING_AGENTS_PROTOCOL Following-Agents-Protocol: true AI-Assisted: true Assisted-by: AGENT:deepseek-v4-flash [edit bash]
…dK-WMMA (mudler#41) Lands bakon11's work from PR mudler#317, split out of mudler#228. Merged --no-ff so the contributor commits keep their authorship rather than being re-authored to whoever pressed the button. FP8 resident MoE experts and a SharedK-WMMA prefill path for Gemma-4 on RDNA4 ROCm, plus a CPU seam test that pins the portable vt::ExpertGeGLUFp8* symbols link and the recipe env knobs parse inertly. The concern this PR was originally held on is CLOSED BY MEASUREMENT, not by reading the diff. It was held because ~1,600 added lines sat in gemma4.cpp and gemma4_moe.cpp and Gemma-4 is a gate model. bakon11 rebuilt it to drop the CUDA forward restructure entirely, and both arms were then gated on dgx GB10 in one flock window: `gmain` (main) and `g317` (main + this PR) each returned gemma4-E4B STRICT 32/32 token-exact vs the vLLM 0.25.0 golden. gemma4.cpp is byte-identical to main. Its cuda-fat-build red was never its own: the gencode audit failed on seven files, every one of them Marlin, while this branch touches ROCm and gemma4_moe.cpp and no Marlin gencode at all. That was the drift mudler#407 fixed and the branch predated it -- the same stale-base class that also explained mudler#383 and mudler#393 tonight. ACCEPTED WITH A NAMED RESIDUAL, recorded because it is a product decision and not a gate result. This flips four knobs DEFAULT-ON for ROCm: VT_GEMMA4_PREFILL_PEER_ACT, VT_ATTN_PREFILL_FLASH_SHAREDK, VT_ATTN_PREFILL_SHAREDK_WMMA and VT_ROCM_GRAPH. Non-ROCm builds are unaffected -- every new lever is env-gated off or behind moe.enabled / ROCm ExpertGeGLU dispatch -- and each knob is individually reversible by env. But there is NO AMD CI runner, so those defaults rest entirely on the contributor's lab evidence (2x AMD Radeon AI PRO R9700 gfx1201 / RDNA4, ROCm 7.x, gemma-4-26B-A4B-it-fp8; prefill ~2k @11k, short decode ~45-52 t/s). Feature correctness is unprovable on GB10 and honestly so: all nine cached Gemma checkpoints there are dense bf16 with enable_moe_block false, so RunGemma4Moe, EnsureGemma4Fp8* and ExpertGeGLU* are simply unreachable. The GB10 gate proves NON-REGRESSION, never the feature. Gate: scripts/agent-preflight.sh rc=0 on the merged tree; check-agent-record, check-doc-checkpoint, check-public-doc-tables, check-now-current, check-env-doc and check-commit-trailers all green. CI is queue-blocked (mudler#274), so the operator's own gate run is the authority, as AGENTS.md prescribes. FOLLOWING_AGENTS_PROTOCOL Following-Agents-Protocol: true AI-Assisted: true Assisted-by: AGENT:deepseek-v4-flash [edit bash]
Summary
ROCm / Gemma4 half of the #228 split. #228 is closed — land this instead.
In
Dual-GPU FP8 resident MoE, peer mix, SharedK-WMMA prefill, decode KV-split, fused_ops seam, ENVIRONMENT
VT_GEMMA4_*/VT_ATTN_*.Out
SSE/serving (#316),
rocm_sample(#234),support_static_graph_modeflip.Review fixes in this tip
#if VT_ROCWMMA_OKaround SharedK-WMMA launchesHonest follow-ups
HIP guards in
models/gemma4.cpp, MoE policy guards, peer weight_id/hscale, tests/spec. Large diff (~5k prod lines) — may need another slice or maintainer path like #154 if review asks.Lab: dual R9700 gfx1201 /
start-gemma4-fp8-8010.sh.Land order