mirror of
https://github.com/mw00/project-maya.git
synced 2026-12-03 21:08:26 +07:00
[PR #643] [CLOSED] DeepSeek on gfx1151: the prompt's routed experts through the fused int8 experts (prefill +9-10% on Strix Halo) #646
Labels
No labels
pull-request
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference
mw00/project-maya#646
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
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?
📋 Pull Request Information
Original PR: https://github.com/mw00/project-maya/pull/643
Author: @mrsirg97-rgb
Created: 10/28/2026
Status: ❌ Closed
Base:
main← Head:ds4-expert-pipeline📝 Commits (1)
9d1a34cDeepSeek on gfx1151: the prompt's routed experts through GLM's fused int8 experts📊 Changes
10 files changed (+540 additions, -40 deletions)
View changed files
📝
CMakeLists.txt(+4 -0)📝
docs/SETTINGS.md(+1 -0)📝
include/strata/prefill/moe_fused_rdna4.hpp(+10 -0)📝
src/ds4/ds4_iq.cu(+122 -0)📝
src/ds4/ds4_iq.cuh(+12 -0)📝
src/ds4/ds4_model.cu(+1 -0)📝
src/prefill/moe_fused_rdna4.cu(+122 -28)📝
tests/ds4_gguf_test.cu(+75 -0)➕
tests/hip/prefill_fused_bench.cpp(+130 -0)📝
tests/hip/prefill_fused_parity.cpp(+63 -12)📄 Description
On gfx1151 (Strix / Gorgon Halo), maya-ds4's prompt now runs its routed experts through GLM's fused int8 prompt experts (
moe_fused_rdna4.cu,MAYA_GLM_PREFILL_FUSED's kernels), ported to DeepSeek-V4.1's shape. This is about +9–10% prompt reading on a Radeon 8060S, with perplexity essentially unchanged.Why. DeepSeek's prompt experts run
set_tc_kernel: FP16 rocWMMA tiles that dequantize each 32-value K chunk into shared memory. On this APU that kernel reaches 12–16 TFLOP/s, and the experts are ~38% of a prompt's GPU time. GLM's fused kernel (int8 decode in the WMMA tiles, int8 activations) reaches 18–21 TOPS at DeepSeek's shape. Bit-identical attempts onset_tc_kernelitself (larger K steps per barrier, register prefetch of the next chunk) were mixed or slower, because the kernel is occupancy-bound. So this PR reuses the faster kernel instead.Changes
moe_fused_rdna4.cu/.hpphip_prefill_fused_bench's output hash is identical) and DeepSeek's 5120 / 2304.8 g ± 1from DeepSeek's owniq1_decode, from the nibble-packediq1s_grid_gpu(8 KB in LDS, like IQ2_S's grid), with scales per 16 values.experts_gate_up/experts_downrun separately;experts()still runs both. Rows can be gathered and rounded in their own order (quantize_rows, nosrc), and H can be written at a caller's row stride (Geometry::h_ld).ds4_iq.cu:fused_wanted,fused_gate_up,fused_downc.y, unused until the down writes it), passed through aFusedScratchScopefromrun_setnext toMmqRowsScope. H goes into the set's FP16 rows at their stride. Only a small tile list is allocated per device.MAYA_DS4_PREFILL_FUSED. Unset means on for gfx1151;0turns it off;1turns it on for gfx1100 and RDNA4 as well, which I haven't measured.hip_prefill_fused_parity:ds4_gguf_test --bench-set [rows]: times the FP16 tiles' IQ1_M / IQ2_XXS / IQ2_XS sets, with an output hash.hip_prefill_fused_bench [tokens] [reps] [gu] [down] [ds4]: the bench from #634, plus a DeepSeek mode.Measured. Radeon 8060S (Ryzen AI MAX+ 395, 128 GB with 108 GB GTT, ROCm 7.15). The GSQ-RCO IQ2_XXS GGUF of DeepSeek-V4.1-Flash-1017 (IQ1_M / IQ2_XXS / IQ2_XS experts; 11,705 of 15,744 in VRAM, the rest streamed from the SSD), 512K context, v1.1.36.
./maya.sh --benchwith the same binary and the switch off / on, two runs each, alternating:DS4_PROF): 8.95 → 7.35 s. The rest of the expert stage is the streamed experts' arrival, which the GPU's pace sets at ~1.4 GB/s from the SSD.maya-ds4 --ppl, 8 sequences from Maya's docs, 7,699 tokens): 8.4907 off (identical on two runs) vs 8.4937 on (+0.035%). Per sequence the difference is ±1% in both directions.--bench-set, 128 rows per expert): 4.9–5.5 µship_prefill_fused_parityPASS (196 runs, the split passes bit for bit),ds4_gguf_testALL OK,tools/check_hip_compat.pypasses.With #634.
tests/hip/prefill_fused_bench.cpp; this version is #634's plus theds4mode.🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.