[GH-ISSUE #491] DeepSeek-V4.1-Flash Maya-XS on Strix Halo (gfx1151, Linux): ~0.1 tok/s decode, q8_mv_kernel and iq1 expert kernels ~100x too slow #196

Open
opened 2026-10-29 21:22:27 +07:00 by bsakaguchi · 1 comment
Owner

Originally created by @mdziemianko on GitHub (Oct 25, 2026).
Original GitHub issue: https://github.com/mw00/project-maya/issues/491

Hello,
First time trying Project Maya and was expecting about 25 tokens/sec. Instead run into the problem described below.
Various models I am running on llama.cpp have decent performance, but I can not figure out what is wrong here.
Any help appreciated.

Summary

Maya-XS loads and answers correctly on a 128 GB Ryzen AI Max+ 395, but decode runs at 0.1 tok/s (about 6-10 s of GPU time per token). The GPU is 100% busy at full clock. A plain HIP bandwidth test on the same machine reads at 237 GB/s, so the platform is healthy. A rocprofv3 kernel trace shows nearly all the time in the Q8_0 dense matvec kernel and the IQ1 expert kernels, each call taking tens to hundreds of milliseconds.

I have seen reports of 35-37 tok/s for this model on this class of hardware, so I'm looking for what differs on my setup.

Environment

  • Maya v1.1.27 (4615f34), ./setup.sh --backend hip --gpu 0 --model DeepSeek-V4.1-Flash-1017 --ds4-quant maya-xs
  • Machine: Corsair AI Workstation 300, Ryzen AI Max+ 395 (Radeon 8060S, gfx1151), 128 GB, BIOS AXB35-02 3.07
  • OS: Ubuntu 26.04, kernel 7.0.0-38-generic
  • ROCm 7.2.4 from AMD's apt repo (repo.radeon.com/rocm/apt/7.2.4 noble, installed on 26.04; Ubuntu's own ROCm 7.1.1 packages were not recognised by Maya's check)
  • Workaround needed to build: AMD's lld needs libxml2.so.2, 26.04 only ships .so.16; I symlinked it into a private LD_LIBRARY_PATH directory. Compile and link otherwise work.
  • Boot line: amd_iommu=off amdgpu.gttsize=131072 ttm.pages_limit=33554432 ttm.page_pool_size=33554432 amdgpu.gfxoff=0, no crashkernel, swap off
  • Main configuration: BIOS UMA frame buffer 1 GiB (mem_info_vram_total = 1 GiB, GTT 128 GiB); RAM 124 GiB usable. Also tested with a 96 GiB UMA carve-out (see below).

Memory

  • --vram-experts 1.0 fails: maya-ds4: cudaMalloc of layer 39's 356 experts on CUDA0 failed at about 112 GiB. A standalone hipMalloc loop (1 GiB chunks) also stops at 112 GiB while about 9 GB of free RAM remains, all of it shown as CMA free in the kernel's Mem-Info (free_cma is nearly all of free), so it is not usable for GPU buffers.
  • So I run with --vram-experts 0.88 (99.2 GB of experts on the GPU, 1047 experts on the CPU lane) and --max-context 32768. At 0.95 with swap off the kernel OOM killer fired and killed the desktop session.
  • Question: is the 9 GB of CMA something this kernel/BIOS creates, and is a smaller or no CMA expected for the 120.6 GB Maya-XS to fit in GPU memory on a 128 GB machine?

Symptoms

Engine's own statistics (DS4_PROF=1, --ids 1,2,3 --n 6):

GPU per token (DS4_PROF): 10200 ms - between layers 0.10, attention 6438, routing + shared expert 1595,
experts gate/up 1293, waiting for the CPU lane 0.36, down + post 874; 5 tokens
decode: 6 tokens in 53621 ms (0.09 tok/s); CPU lane 13 of 1200 experts; decode per token: head wait 10696 ms

Through the server (maya.sh, 32K context): a 32-token prompt takes 116 s to read (0.3 tok/s), decode is 0.1 tok/s, expert cache hit rate 99.8%. The answers are correct.

What I ruled out

  • Memory bandwidth: a HIP read kernel on a fresh 4 GiB hipMalloc buffer gets 237 GB/s; 239 GB/s after holding 90 GiB of other buffers; 241 GB/s on individual 1 GiB buffers. FP32 FMA test: 7.6 TFLOPS.
  • Swap and memory pressure (swap off, 120+ GB free before load), page-cache thrash (99.8% hit rate), CPU lane (under 1% of experts), disk and Engram reads (about 10 ms per token).
  • XNACK on or off, DS4_HIP_ATTN_SWIZZLE=1, and GTT versus dedicated VRAM (next section).

Further experiments (none changed the picture)

DS4_PROF GPU time per token, same prompt (--ids 1,2,3 --n 6), --max-context 32768, --dspark none:

run attention routing + shared experts gate/up down + post total
baseline (GTT memory, 1 GiB BIOS carve-out) 6438 ms 1595 1293 874 10200 ms
HIP_FORCE_DEV_KERNARG=1 HSA_ENABLE_SDMA=0 3654 904 785 519 5862
same + HSA_XNACK=0 / =1 3672 / 3693 908 / 908 793 / 796 523 / 526 5896 / 5924
same + DS4_HIP_ATTN_SWIZZLE=1 5154 1410 1035 694 8294
96 GiB dedicated VRAM (BIOS), 11 GB of experts on the GPU, rest on the CPU lane 4138 1216 395 439 6223
  • All stages scale together between runs (attention is always about 63%), which points to a global factor, not one bad kernel. Run-to-run variation is large (5.9 s to 10.2 s).
  • Dedicated VRAM does not help: with the dense weights (8.46 GB) in the 96 GiB VRAM carve-out, attention and shared-expert times are the same as with GTT memory. So this is not a GTT or TLB-mapping issue.
  • DS4_HIP_ATTN_SWIZZLE=1 made no measurable difference.
  • HIP_FORCE_DEV_KERNARG=1 HSA_ENABLE_SDMA=0 gave about a 1.7x gain, but still far from usable.

rocprofv3 kernel trace

rocprofv3 --kernel-trace, 4 decode tokens plus a 3-token prompt, 10,399 dispatches, 53.3 s of kernel time:

kernel calls total avg/call max
strata::ds4::gguf::q8_mv_kernel<1,true> 754 27.97 s 37.1 ms 675 ms
strata::ds4::gguf::q8_mv_kernel<4,true> 250 10.18 s 40.7 ms 187 ms
strata::ds4::gguf::iq1::gate_up_kernel<19,1,1,false,1> 120 4.15 s 34.6 ms 35.8 ms
strata::ds4::gguf::iq1::gate_up_kernel<19,4,1,false,1> 40 3.96 s 99.0 ms 113 ms
strata::ds4::gguf::iq1::down_kernel<19,1,1,false,2> 120 2.78 s 23.1 ms 24.0 ms
strata::ds4::gguf::iq1::down_kernel<19,4,1,false,2> 40 2.69 s 67.4 ms 75.1 ms

Everything else is under 0.2 s in total (for example finish_kernel 190 ms over 676 calls, index_score_kernel 153 ms over 32). I can attach the .db from rocprofv3 -d.

For scale: reading all 8.5 GB of dense weights once at 237 GB/s takes about 36 ms, but one q8_mv_kernel call averages 37 ms, and the trace has 1,004 of them over roughly 7 token passes (about 140 per pass). The 675 ms outlier calls look like stalls, not arithmetic.

Questions

  1. Is there a gfx1151-specific code path or tuning table for q8_mv_kernel and the iq1 expert kernels that setup should have selected, or an env var I should set? --dspark none is in my config only because the speed calibration crashed on the memory failure above; I assume that is unrelated.
  2. What kernel, ROCm and BIOS setup did the 35-37 tok/s reports use? Is the 7.0 kernel or the noble-built ROCm 7.2.4 on 26.04 a known problem?
  3. Is the 9 GB CMA region expected, and does it change how much of Maya-XS can live on the GPU?

I can run any diagnostic build or env setting you want and post the results.

Originally created by @mdziemianko on GitHub (Oct 25, 2026). Original GitHub issue: https://github.com/mw00/project-maya/issues/491 Hello, First time trying Project Maya and was expecting about 25 tokens/sec. Instead run into the problem described below. Various models I am running on llama.cpp have decent performance, but I can not figure out what is wrong here. Any help appreciated. ### Summary Maya-XS loads and answers correctly on a 128 GB Ryzen AI Max+ 395, but decode runs at **0.1 tok/s** (about 6-10 s of GPU time per token). The GPU is 100% busy at full clock. A plain HIP bandwidth test on the same machine reads at 237 GB/s, so the platform is healthy. A rocprofv3 kernel trace shows nearly all the time in the Q8_0 dense matvec kernel and the IQ1 expert kernels, each call taking tens to hundreds of milliseconds. I have seen reports of 35-37 tok/s for this model on this class of hardware, so I'm looking for what differs on my setup. ### Environment - Maya v1.1.27 (`4615f34`), `./setup.sh --backend hip --gpu 0 --model DeepSeek-V4.1-Flash-1017 --ds4-quant maya-xs` - Machine: Corsair AI Workstation 300, Ryzen AI Max+ 395 (Radeon 8060S, gfx1151), 128 GB, BIOS AXB35-02 3.07 - OS: Ubuntu 26.04, kernel 7.0.0-38-generic - ROCm 7.2.4 from AMD's apt repo (`repo.radeon.com/rocm/apt/7.2.4 noble`, installed on 26.04; Ubuntu's own ROCm 7.1.1 packages were not recognised by Maya's check) - Workaround needed to build: AMD's `lld` needs `libxml2.so.2`, 26.04 only ships `.so.16`; I symlinked it into a private `LD_LIBRARY_PATH` directory. Compile and link otherwise work. - Boot line: `amd_iommu=off amdgpu.gttsize=131072 ttm.pages_limit=33554432 ttm.page_pool_size=33554432 amdgpu.gfxoff=0`, no crashkernel, swap off - Main configuration: BIOS UMA frame buffer 1 GiB (`mem_info_vram_total` = 1 GiB, GTT 128 GiB); RAM 124 GiB usable. Also tested with a 96 GiB UMA carve-out (see below). ### Memory - `--vram-experts 1.0` fails: `maya-ds4: cudaMalloc of layer 39's 356 experts on CUDA0 failed` at about 112 GiB. A standalone `hipMalloc` loop (1 GiB chunks) also stops at 112 GiB while about 9 GB of free RAM remains, all of it shown as CMA free in the kernel's `Mem-Info` (`free_cma` is nearly all of `free`), so it is not usable for GPU buffers. - So I run with `--vram-experts 0.88` (99.2 GB of experts on the GPU, 1047 experts on the CPU lane) and `--max-context 32768`. At 0.95 with swap off the kernel OOM killer fired and killed the desktop session. - Question: is the 9 GB of CMA something this kernel/BIOS creates, and is a smaller or no CMA expected for the 120.6 GB Maya-XS to fit in GPU memory on a 128 GB machine? ### Symptoms Engine's own statistics (`DS4_PROF=1`, `--ids 1,2,3 --n 6`): ``` GPU per token (DS4_PROF): 10200 ms - between layers 0.10, attention 6438, routing + shared expert 1595, experts gate/up 1293, waiting for the CPU lane 0.36, down + post 874; 5 tokens decode: 6 tokens in 53621 ms (0.09 tok/s); CPU lane 13 of 1200 experts; decode per token: head wait 10696 ms ``` Through the server (`maya.sh`, 32K context): a 32-token prompt takes 116 s to read (0.3 tok/s), decode is 0.1 tok/s, expert cache hit rate 99.8%. The answers are correct. ### What I ruled out - Memory bandwidth: a HIP read kernel on a fresh 4 GiB `hipMalloc` buffer gets 237 GB/s; 239 GB/s after holding 90 GiB of other buffers; 241 GB/s on individual 1 GiB buffers. FP32 FMA test: 7.6 TFLOPS. - Swap and memory pressure (swap off, 120+ GB free before load), page-cache thrash (99.8% hit rate), CPU lane (under 1% of experts), disk and Engram reads (about 10 ms per token). - XNACK on or off, `DS4_HIP_ATTN_SWIZZLE=1`, and GTT versus dedicated VRAM (next section). ### Further experiments (none changed the picture) `DS4_PROF` GPU time per token, same prompt (`--ids 1,2,3 --n 6`), `--max-context 32768`, `--dspark none`: | run | attention | routing + shared | experts gate/up | down + post | total | |---|---|---|---|---|---| | baseline (GTT memory, 1 GiB BIOS carve-out) | 6438 ms | 1595 | 1293 | 874 | 10200 ms | | `HIP_FORCE_DEV_KERNARG=1 HSA_ENABLE_SDMA=0` | 3654 | 904 | 785 | 519 | 5862 | | same + `HSA_XNACK=0` / `=1` | 3672 / 3693 | 908 / 908 | 793 / 796 | 523 / 526 | 5896 / 5924 | | same + `DS4_HIP_ATTN_SWIZZLE=1` | 5154 | 1410 | 1035 | 694 | 8294 | | 96 GiB dedicated VRAM (BIOS), 11 GB of experts on the GPU, rest on the CPU lane | 4138 | 1216 | 395 | 439 | 6223 | - All stages scale together between runs (attention is always about 63%), which points to a global factor, not one bad kernel. Run-to-run variation is large (5.9 s to 10.2 s). - Dedicated VRAM does not help: with the dense weights (8.46 GB) in the 96 GiB VRAM carve-out, attention and shared-expert times are the same as with GTT memory. So this is not a GTT or TLB-mapping issue. - `DS4_HIP_ATTN_SWIZZLE=1` made no measurable difference. - `HIP_FORCE_DEV_KERNARG=1 HSA_ENABLE_SDMA=0` gave about a 1.7x gain, but still far from usable. ### rocprofv3 kernel trace `rocprofv3 --kernel-trace`, 4 decode tokens plus a 3-token prompt, 10,399 dispatches, 53.3 s of kernel time: | kernel | calls | total | avg/call | max | |---|---|---|---|---| | `strata::ds4::gguf::q8_mv_kernel<1,true>` | 754 | 27.97 s | 37.1 ms | 675 ms | | `strata::ds4::gguf::q8_mv_kernel<4,true>` | 250 | 10.18 s | 40.7 ms | 187 ms | | `strata::ds4::gguf::iq1::gate_up_kernel<19,1,1,false,1>` | 120 | 4.15 s | 34.6 ms | 35.8 ms | | `strata::ds4::gguf::iq1::gate_up_kernel<19,4,1,false,1>` | 40 | 3.96 s | 99.0 ms | 113 ms | | `strata::ds4::gguf::iq1::down_kernel<19,1,1,false,2>` | 120 | 2.78 s | 23.1 ms | 24.0 ms | | `strata::ds4::gguf::iq1::down_kernel<19,4,1,false,2>` | 40 | 2.69 s | 67.4 ms | 75.1 ms | Everything else is under 0.2 s in total (for example `finish_kernel` 190 ms over 676 calls, `index_score_kernel` 153 ms over 32). I can attach the `.db` from `rocprofv3 -d`. For scale: reading all 8.5 GB of dense weights once at 237 GB/s takes about 36 ms, but one `q8_mv_kernel` call averages 37 ms, and the trace has 1,004 of them over roughly 7 token passes (about 140 per pass). The 675 ms outlier calls look like stalls, not arithmetic. ### Questions 1. Is there a gfx1151-specific code path or tuning table for `q8_mv_kernel` and the `iq1` expert kernels that setup should have selected, or an env var I should set? `--dspark none` is in my config only because the speed calibration crashed on the memory failure above; I assume that is unrelated. 2. What kernel, ROCm and BIOS setup did the 35-37 tok/s reports use? Is the 7.0 kernel or the noble-built ROCm 7.2.4 on 26.04 a known problem? 3. Is the 9 GB CMA region expected, and does it change how much of Maya-XS can live on the GPU? I can run any diagnostic build or env setting you want and post the results.
Author
Owner

@mw00 commented on GitHub (Oct 27, 2026):

Thank you for the profile and the rocprof trace - they rule out a lot. Every kernel is slow by about the same factor, and a plain HIP bandwidth test is fine, so this looks like the platform rather than one Maya kernel. A setup close to yours does run at full speed: #510 / #541 use Ubuntu 26.04, kernel 7.0.0-38 and ROCm 7.2.4 with a Radeon 8060S working beside two RX 7900 XTX. The main difference we can see is how ROCm was installed there: AMD's runfile, installed in isolation, not the noble apt packages on 26.04.

Could you try these, and say which ones change the speed?

  1. llama.cpp's HIP (ROCm) backend, not Vulkan, on any model. If that is also ~100x slow, the ROCm install is the cause.
  2. rocm-smi --showclocks --showperflevel during decode.
  3. ROCm 7.2.4 from AMD's runfile in its own prefix, as in #510 (its first lines list the setup), instead of the apt packages.

On the 9 GB CMA: that is the kernel's own reservation and not something Maya sets. Maya-XS fits on a 128 GB machine with --vram-experts below 1.0, as you found.

<!-- gh-comment-id:6448810477 --> @mw00 commented on GitHub (Oct 27, 2026): Thank you for the profile and the rocprof trace - they rule out a lot. Every kernel is slow by about the same factor, and a plain HIP bandwidth test is fine, so this looks like the platform rather than one Maya kernel. A setup close to yours does run at full speed: #510 / #541 use Ubuntu 26.04, kernel 7.0.0-38 and ROCm 7.2.4 with a Radeon 8060S working beside two RX 7900 XTX. The main difference we can see is how ROCm was installed there: AMD's runfile, installed in isolation, not the noble apt packages on 26.04. Could you try these, and say which ones change the speed? 1. llama.cpp's **HIP** (ROCm) backend, not Vulkan, on any model. If that is also ~100x slow, the ROCm install is the cause. 2. `rocm-smi --showclocks --showperflevel` during decode. 3. ROCm 7.2.4 from AMD's runfile in its own prefix, as in #510 (its first lines list the setup), instead of the apt packages. On the 9 GB CMA: that is the kernel's own reservation and not something Maya sets. Maya-XS fits on a 128 GB machine with `--vram-experts` below 1.0, as you found.
Sign in to join this conversation.
No labels
pull-request
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
mw00/project-maya#196
No description provided.