mirror of
https://github.com/mw00/project-maya.git
synced 2026-12-03 19:04:50 +07:00
[GH-ISSUE #6] AMD (HIP) support: status, measurements and planned PRs #2
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#2
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?
Originally created by @boxwrench on GitHub (Oct 8, 2026).
Original GitHub issue: https://github.com/mw00/project-maya/issues/6
Tracking issue for running Maya on AMD GPUs through the HIP backend: what works, what's measured, and the planned PRs. Thanks for the welcome!
Pull requests
hip_glm_handofftest. It also fixesglm_kda_parity: the fixture assumed a zeroed arena that was never zeroed.maya.py(separatebuild-hip/, configs namedmaya-<quant>-hip.json). Follow-up: stop forcingSTRATA_GLM_PREFILL_CHUNK=256(see the prompt table).hipMemGetInforeports the GTT pool as VRAM. The plan: cap the expert pool atMemAvailableminus headroom, and skip the pinned RAM tier entirely when every expert fits in the pool. Setup detection for Strix comes with it.kSub, currently a compile-time 256), a K-scaled tolerance in the hipBLASLt tuner, and a tuning table for each card. Opt-in: nothing changes withoutSTRATA_HIPBLASLT_TUNING.mla_attn_tc_kernelported to rocWMMA, with an accuracy check against the F32 kernel.Nothing has been compile-checked for CUDA here (no NVIDIA toolchain). A CUDA build on your side before merging would be much appreciated.
The full model runs on AMD
GLM-5.3-Flash Maya-S-v2 IQ2_XXS, 8K context, text only.
On the Strix Halo, decode reads about 9.4 GB of weights per token. The chip measures 240 GB/s of read bandwidth, so one-token decode tops out around 25 tok/s.
Prompt speed
kSub256 -> 1024,STRATA_GLM_PREFILL_MB=4096mla_attn_tc_kernelported to rocWMMAHow each step works:
hgemm_qgoes through the existingstrata::prefill::Gemm::f16. Measured per-GEMM speedup: 3-7.5x overhipblasGemmExon gfx1151. On the 7900 XT, 13,400 tuned launches ran with zero fallbacks.The last two rows come from a local evaluation tree and aren't in a PR yet.
Findings that may matter beyond AMD
docs/DETAILS.mddescribes MTP drafts checked in one batched pass, which is Strata's verify window. Maya'sspec_ready()requires a two-GPU layer split; on one GPU,STRATA_GLM_MTP=1loads the NextN block but never uses it. Strata'sVerifiermaps closely onto GLM (KDA for GDN, DSA for QSA, the same hyper-connections, NextN for MTP). It's the main route past the one-token bandwidth ceiling on every single-GPU setup, NVIDIA included. The same multi-token kernels would also let several requests decode together. Would you be open to a port?kSubis a compile-time 256. 1024 roughly doubled AMD prompt speed when memory allows. A runtime setting sized from the prompt budget seems right; we haven't measured NVIDIA.STRATA_BUILD_TESTS=ONfails to configure:qsa_prompt_attn_paritylinksCUDA::cudart(CMakeLists.txt~248).max_absof 0.01 rejects valid long-K solutions.0.01 * sqrt(max(1, K/4096))with relative L2 kept at 1e-4 calibrates cleanly.hip_compatinclude: the HIP bf16/fp8 headers rocWMMA pulls in define the__shfl_*_syncnames thathip_compatremaps with macros.hip_compatshould include those headers before defining the macros.Later
moe_fused_iq.cualready covers IQ2_XXS / IQ3_XXS / IQ2_S.How would you like the PRs split or ordered?
@boxwrench commented on GitHub (Oct 8, 2026):
Update: the prompt-speed PR is up as #7, stacked on #2 and #4. RX 7900 XT ~198 -> ~413 tok/s on prompts; R9700 ~490-560; Strix Halo ~217 with the same change. All 16 GPU checks pass on both the 7900 XT and the R9700, and the full model passes smoke and back-to-back request tests on the 7900 XT.
R9700 (gfx1201) now runs the full model: decode ~20 tok/s, prompts ~490-560 tok/s, with a pinned RAM tier sized for every expert the VRAM pool doesn't hold.
The experimental all-experts-in-RAM mode (
STRATA_GLM_RAM_ALL, not in any PR) hits an intermittent GPU memory fault after a few requests, with or without the CPU lane or prefetching. Serializing the kernels hides it, so it's a race; still investigating.@mw00 commented on GitHub (Oct 8, 2026):
Update: #2 and #7 are merged, and AMD (experimental) is out in v1.0.11 - RX 7900 XT / XTX and R9700 / RX 9070 on Linux, one GPU, text only: https://github.com/mw00/project-maya/releases/tag/v1.0.11. Thank you! The follow-ups you listed (unified memory for Strix Halo, the second prefill PR,
--bench/--reporton HIP) are welcome as separate PRs.@jerem91150 commented on GitHub (Oct 8, 2026):
Windows report, in case it helps the AMD work: native Windows 11, RX 7900 XTX (gfx1100, 24 GB), Ryzen 9 7900X3D, 64 GB RAM, TheRock ROCm 10.2.0a20260930 (the wheels Strata's
build_windows.batpins), Unsloth UD-IQ2_XXS through--gguf-dir. Built from main + #7.Builds and runs. Only three things were missing on Windows: the peer-copy names for
peer_probe.cu(built with the tests),glm_cpu_benchis Linux only (pread), and a build script along the lines of Strata's. glm_hc/kda/ffn/dsa parity, glm_model_test, sampler_parity, hip_glm_prefill_attention, hip_intrinsics, hip_native_qsa_score and hip_prefill_native_batch all pass on the card.On Windows these don't, though the engine itself runs and answers correctly:
hip_handoff: "separate copy/ring timeout"hip_glm_handoff: hangs (killed after several minutes)hip_prefill_mmq_parity: "synthetic-Q2_0-GU-pass0: non-finite or unwritten MMQ output"A sampling bug I chased down. With temperature > 0, about 1 reply in 15 lost the prompt right after its first token ("La comarca de Granada..." for "capital of Italy?"), reproducibly per prompt and seed. Greedy was fine. What I measured:
cudaDeviceSynchronize()(or a sync of the null stream) between tokens breaks the same waycs,copyorpsalone doesn't, and neither does a host sleepAMD_SERIALIZE_KERNEL=3 AMD_SERIALIZE_COPY=3gives correct outputGlm5Model::sample_tokenlaunched the draw on the legacy stream (sample_tokens(..., nullptr), which ends in a device-wide sync) and read the token with a blockingcudaMemcpy. Drawing on the fast path's own stream instead (sample_tokens(..., F->tok, F->cs), async copy totok_h, thencudaStreamSynchronize(cs)) fixed it: 30/30 sampled answers right at T=0.3 and 1.0. The real cause may be the same coherence issue as the handoff tests above (a device-wide sync changing what the host or the tiers see), sincedecode_specalready waits onev_doneand wasn't affected. But I couldn't prove it.A crash tied to the prompt budget. With
STRATA_GLM_PREFILL_MB=4096(sub-batch 1024) or 8192, the engine dies with an access violation (0xC0000005 inside strata.exe) on the 2nd or 3rd request of a session. That happens with and without conversation slots (STRATA_GLM_SLOTS=0). With the default budget, the same series of requests runs clean.hipBLASLt table. The gfx1100 table in #7 is for hipBLASLt 100202 and this ROCm ships 100500, so I re-ran
tune_hipblaslton the same 60 cases (22 s) and the engine accepted it.Numbers (64 GB RAM, so a lot comes from the SSD: 23-35% VRAM hits on long prompts):
I'm happy to open a PR with the Windows bits (build script, peer names, the sampling change, the 100500 table) if they're wanted, either here or on top of #7.
@mw00 commented on GitHub (Oct 8, 2026):
@jerem91150 thank you for the Windows report, it moved several things.
sample_tokendrew on the legacy stream, which ends in a device-wide sync. v1.0.15 draws on the fast path's own stream and reads the token through the pinned word (your change, written for every backend). On NVIDIA it also stops every sampled token from waiting for the tier copies in flight: 2x V100 at temperature 1.0 went 26.7 / 26.6 -> 26.8 / 27.6 tok/s. Credited to you in the release notes.main(see CONTRIBUTING.md): the build script, the peer-copy names forpeer_probe.cu,glm_cpu_benchas Linux-only, and the hipBLASLt table for 100500. Keep the NVIDIA path unchanged, and we'll build and test it on V100s before merging.STRATA_GLM_PREFILL_MB=4096/8192on the 2nd-3rd request: could you open a separate issue for it, with the end of the engine log? Also say whether it still happens on v1.0.15. A lot changed in the prompt path since #7 (#12's dynamic sub-batches and budgets).@Talos77 commented on GitHub (Oct 9, 2026):
Hi! I saw your reply on X and wanted to follow up here.
Would it be possible to consider Windows AMD support for the Radeon RX 6750 XT (gfx1031) in Project Maya?
My system is:
I'm particularly interested in running GLM-5.3-Flash locally using Maya's VRAM, RAM and NVMe expert tiers. I understand that gfx1031 isn't currently listed among the supported AMD GPUs, and I'm happy to help test if an experimental build becomes available.
Thanks for taking a look at the possibility!
@jerem91150 commented on GitHub (Oct 9, 2026):
Thanks for the fix, and for the credit!
Quick update from the Windows / 7900 XTX side, on 1.0.16 and 1.0.20. For context I'm working on Strata and Maya together here (some of my Maya build comes from Strata, like the build script and the peer-copy names, and things go back the other way too).
The numbers fix (#27) works here as well. I had a 240 in a 27K prompt coming back as 2400, and line numbers in a code review as 2001 instead of 201. Both are right now, with or without thinking.
Speed on an idle card: the 27K prompt reads in 46 to 59 s with DISK_QD=16 and READ_CHUNKS=1 (75 s with the defaults), and decode is around 5.5 tok/s (3.5 to 8). A second pass on the same prompts is a lot faster thanks to the conversation slots, 27K in 31 s. With about 4.5 GB of the card used by something else, the same set goes from 345 s to 606 s.
About the access violation: it's still there and I was wrong about RAM. It also crashes with plenty of free RAM, and it happens with your default settings too, not only with my higher disk queue depth. I put the details in #53.
@vincalkr commented on GitHub (Oct 10, 2026):
hipBLASLt tables on a 7900 XTX with ROCm 7.14: nothing matches 100401, and a table that loads can be inert
Machine: 2x RX 7900 XTX (gfx1100, 24 GB), Ryzen 9 9900X, 122 GB RAM, Linux, ROCm 7.14 (
/opt/rocm),hipBLASLt 1.4.1 = version 100401, Maya v1.0.30 built from source (
build-hip,gfx1100;gfx1201;gfx1151), Maya-S24 at 262,144-token context on a two-GPU split.Three states in one engine log (both GPUs each time)
STRATA_HIPBLASLT_TUNINGpointed atgfx1100-glm-hipblaslt-100202.txt(shipped, #7)hipBLASLt version mismatch: file=100202, library=100401...-100401.txt, emptytuning file has no header; using hipBLASExhipBLASLt tuning enabled (62 rows, gfx1100, version 100401)For gfx1100 the repo ships
100202(#7) and100500(#54). Nothing for 100401, which is what acurrent ROCm 7.14 install carries - so the GLM prompt projections run on plain hipBLAS. And when the
config has no
STRATA_HIPBLASLT_TUNINGat all, the engine says nothing: no line, no hint that a tableexists or that one can be built in half a minute.
What a table tuned here is worth
Two engine starts, byte-identical prompts (three distinct ~16,384-token prompts, each sent once
with
max_tokens=1, so the KV cache is not what is measured), identical geometry in both runs(pool 16.15 GB / 116 slots per layer, chunks of 8192, 4.77 GB before the pool):
+51% prompt throughput, -34% prompt time: a 16,384-token prompt from 30.6 s to 20.2 s. Decode is
unchanged (26-34 tok/s in both), as expected; end-to-end 1.52x rather than the per-GEMM numbers
because a prompt also spends time in attention, expert I/O and the mixer.
Building the table took 22 s on an idle card: 62 cases, per-GEMM speedup over
hipblasGemmExmin 2.42x, median 5.60x, max 10.46x,
required_workspace_bytes0 for every case, andhip_prefill_hipblaslt_gemmagainst it reportslaunches=4 fallbacks=0.Why shipping more version numbers will not close this
A solution ID is scoped to the pair (hipBLASLt build, architecture); the version number does not
identify the build. Strata has the same loader and the same version guard, and there the published
gfx1100-hipblaslt-100401.txt- matching this machine's library version exactly - has 43 of 43shapes with a different solution ID here (603/604 published vs 1035/1036 measured). That table passes
the version guard, the engine prints
tuning enabled (43 rows, ...), and every GEMM falls back. Thefallbacks are visible only with
STRATA_HIPBLASLT_VERBOSE=1, and thelaunches=N fallbacks=Msummaryis verbose-only too.
Supporting detail: the two published gfx1100 GLM tables (
100202and100500) contain the same 60shapes - the shapes come from the model, only the IDs move with the build. So a table can be
structurally perfect and completely inert.
Three things that would help
launches/fallbackssummaryafter the first prompt unconditionally, not only with verbose on. One line does the job:
hipBLASLt tuning: 0 of 13,400 prompt GEMMs used the table - these IDs do not match this hipBLASLt build, re-tune with tools/hip/tune_hipblaslt.maya.py:no hipBLASLt table for gfx1100 / 100401: the prompt projections run on hipBLAS (tools/hip/tune_hipblaslt builds one in ~20 s). Today the absence is silent, so nobody looks.tests/hip/prefill_hipblaslt_gemm.cpplooks up
bf16 n=48 k=2560 ldy=96andf16 n=512 k=2560 ldy=512throughTuningTable::closest(),which matches n/k/ldy exactly. No published GLM table contains either row, so
hip_prefill_hipblaslt_gemmskips (77) against every table intools/hip/. Adding those two rowsto the tables - two extra tuner cases - would let the test check them, numerically as well
(
relative_l2 <= 1e-4,max_abs <= 5e-3, untouched guard bytes).Small papercuts found while re-tuning:
tune_hipblaslthas no--gpu(onlyHIP_VISIBLE_DEVICES),and
--casewantsdtype,T,N,K,ldywhile a table row isdtype N K ldy T- easy to get wrong whenre-tuning from a published table, and the failure mode is a silent zero-row table.
How it was measured
The table lives outside the repo and is pointed at from the config's
env, so agit pullor a./setup.shcannot carry it away - though a full./setup.sh --setupdoes rewriteenvback to apublished table, which on this machine is either refused or inert. A
--checkagainst the configscatches that in about two seconds.
One more thing:
tools/hip/bench_prefill.pyparsesprompt N tokens = X reused + Y read in Z ms (T tok/s), which Strata'sgenerate.cppprints. Maya'sGLM path never writes that line, so the tool cannot measure Maya; the numbers above come from the
promptcolumn ofglm stat, read on the windows where decode is ~0 (only a prompt ran there).@vincalkr commented on GitHub (Oct 10, 2026):
Same A/B on Maya-M: +50%, so the gain does not depend on the quantization
Same method as above, same three byte-identical prompts, two engine starts, this time Maya-M
(IQ2_S) at 262,144-token context on the same two 7900 XTX:
+50% prompt throughput, -33% prompt time: 16,384 tokens from 32.8 s to 21.8 s. Geometry identical
in both runs (pool 15.20 GB / 84 slots per layer, chunks of 8192, sub-batch 1024, 2,033 MB borrowed).
One table serves both models. The two packs have identical geometry - 1257 tensor lines, 0
differences, only the source GGUF name in the header changes - and hipBLASLt only covers the dense
projections (
attn_q/k/v4096x8192,ffn_up4096x12288,ffn_down12288x4096), never the experts.So the +51% on S24 and the +50% on M are the same 62 rows.
I expected a smaller gain on M, since its experts are bigger and the prompt spends more time on expert
I/O; it is the same, so the dense projections weigh more in prompt time than I assumed. End-to-end
~1.5x rather than the 5.6x per-GEMM median, for the reason above.
And the silence, confirmed: the no-table run's engine log contains zero
prefill gemmlines. Nocomplaint, no hint that a table exists or that
tools/hip/tune_hipblasltwould have built one in 22seconds - which is what point 2 of the previous comment is about.
@vincalkr commented on GitHub (Oct 10, 2026):
The prefetch (#84) costs 13-18% on 2x RX 7900 XTX, and the reason is the CPU lane
Same machine as my previous comments (2x RX 7900 XTX, ROCm 7.14, v1.0.31). Maya-M at 262,144-token
context on the two-GPU split, two engine starts, the same three byte-identical prompts (~3,544 tokens,
300-token answers). Arm B uses the PR's own values:
STRATA_GLM_PREFETCH_N=1 AT=fetch BLOCKS=4 RANK=2.Client side, decode with the caches warm (median of 3 prompts):
-18%, and the ranges do not overlap (30.5-33.1 against 26.8-28.6). The engine log agrees: last
session per arm, 6 real decode windows each, decode 29.10 → 25.34 tok/s (-12.9%).
What is interesting is that the prefetch does what the PR says it does:
It still loses, and the reason is specific to AMD's CPU lane being fast here. The engine's own
calibration on this box says
an expert 0.210 ms on the CPU vs 0.289 ms over PCIe -> of 0..8 RAM-tier experts the CPU takes 0 1 1 2 2 3 3 4 5: computing a RAM-tier expert on the CPU is cheaper thanbringing it into VRAM. Pre-copying the predicted ones into the spares spends 4 GPU blocks and PCIe
bandwidth to do earlier something the CPU lane already did faster, and the decode ends up paying both.
On NVIDIA that ratio is the other way round, which is presumably why the same settings win there.
Two small notes from measuring it:
getenvandnever reported - so the only way to tell it is working is the
ram fetches/promotions/cpu lanecolumns ofglm stat. A one-line startup echo would save the next person an A/B.STRATA_GLM_PREFETCH_Nis clamped tokSpares - 1(kSpares = 3), soN=1andN=2are bothallowed; a value of 3 or more silently becomes 2. Worth a sentence in the README row.
Left off here. Happy to re-run it with different
AT/BLOCKS/RANKif you think a different corner ofthe space suits a CPU-lane-heavy split - the harness is already built (same prompts, two starts).
@mw00 commented on GitHub (Oct 11, 2026):
@vincalkr thank you for the careful A/B. Your reading matches the engine's own calibration: where the CPU lane computes a RAM-tier expert faster than PCIe brings it in (0.210 against 0.289 ms here), pre-copying the predicted ones only spends link bandwidth and GPU blocks on work the CPU already does faster. The prefetch stays off by default, so nobody gets it by accident.
Both of your notes are in #99 (next release):
prefetch on: up to N of the next layer's predicted experts a layer, the copy at <route|fetch|cpu>, <n> blocks, <ranks>.STRATA_GLM_PREFETCH_Nabove 2 was read as 2, and the README row says so.No need to re-run other corners for now. A CPU-lane-heavy split is the case where the prefetch shouldn't run, and the default already doesn't.
@mw00 commented on GitHub (Oct 11, 2026):
@vincalkr the prefetch's start-up line is out in v1.0.33.
@Angular-Angel commented on GitHub (Oct 13, 2026):
Have some reports for you from an AMD machine - see #150 and #151. If you want further debugging from me, I'm willing to help, just let me know what you need.
@Angular-Angel commented on GitHub (Oct 14, 2026):
Okay, ran the AMD_MAYA route, attached reports are from GLM 5.3-Flash. I reviewed them, but not in great detail.
maya-report.txt
MAYA-S24-gfx1100-report.md
@izabera commented on GitHub (Oct 14, 2026):
just wanted to say hi, i've been running maya-m on 4 7900xtx, most things seem to work ok out of the box or are easy to work around. i have a few minor patches that are mostly just configuration changes, such as supporting more than 2 cards, or compiling the exl3 stuff on hip too (making it fast is very much wip)