Repository navigation
Description
Note: Included are all the patches I have made. some are only for my use case , since I live in a hot area and my card has bad thermal so it crashes or restart the PC if I did not throttle it.
also base bench and with my local batches
The failed patches are attached in case the implementation is the problem (by Grok Bot)
one of the reason I Had bad throughput in this issue is because I had Firefox running with the engine and it caused evictions of some expert to the system ram.
Note2: I can not program to save my life. so I'm sorry if I could not answer your questions, and my weekly tokens have run out, so next week is probably the nearest I can assist further.
gfx1010 (RX 5700 XT) experiment report
For the PR #285 gfx1010-bench request.
Hardware and model
- GPU: RX 5700 XT, gfx1010 (RDNA1, 20 CUs, 8 GB). Core clock capped at −12% for thermals.
- Host: Ryzen 7 3700X, 32 GB RAM, Windows, HIP 7.x (TheRock), PCIe 4.
- Model: Inkling-2-Mini UD-Q3_K_XL. In the short bench the expert cache held 957 of 3,072 experts (about 3.5 GiB).
All speeds below are --bench-report figures (random tokens, greedy). Quality was not re-measured.
Baseline: quick tier
8,192-token prompt:
| Part | Time | Notes |
|---|---|---|
| Total prefill | 55.7 s | |
| Experts on the GPU | 30 s | about 1% of the probed read bandwidth |
| Dense products | 8.6 s | |
| Attention | 6.9 s | |
| Host round trips | 432 |
Decode (one token a call) was about 37 ms/token against an 8.9 ms read-bandwidth roofline (roughly 27 tok/s):
| Family | ms / token | Share of probed bandwidth |
|---|---|---|
| Attention | 8.5 | 7% |
| Experts on the GPU | 9.9 | 36% |
| Dense products | 8.4 | 56% |
| Norms, mixes | 6 | |
| Routing | 6.5 | 48 host round trips a token |
About 1,293 kernel launches a token.
Baseline: long tier
The same settings with --max-context 131072 --long. Decode fell to 5.7 tok/s, against about 26 tok/s in the short run.
| Family | Long | Short |
|---|---|---|
| Dense products | 124 ms/token (16 GB/s, 4% of bandwidth) | 8.4 ms/token |
| Norms | 20 ms/token | 6 ms/token |
| Other families | only 10–25% slower |
The expert cache held 1,052 experts (3.9 GiB) against 957 (3.5 GiB) in the quick run. Dense products at 16 GB/s are being read at roughly PCIe speed, not VRAM speed.
Why the prompt path is slow
On gfx1010 the fast prompt tiles are not used:
- In
engine/src/poly/mmq_own.cu,grouped()is true only whencard().sharedis set. On HIP that happens only for gfx11 / gfx12 WMMA (hip_grouped()). gfx1010 has no WMMA. gemm_iq_i8_*is a stub on HIP (engine/src/kernels/cuda/iq_kernels.cu), soint8_rows()is never taken.- Each expert is therefore dequantized whole to fp16 and multiplied by its own rocBLAS
gemm_ex(fp16 → fp32) in a host loop overhost_bounds(mmq_own.cu). Dense projections take the same path (engine/src/poly/engine.cpp). - gfx1010 has no dot instructions. The portable int8 dp4a path is a SDWA sequence of about 1.5 instructions per MAC, against 1 for fp32 /
v_fma_mix_f32and 0.5 for packed fp16. An int8 MMQ-style kernel is not the right answer on this card. - HIP rejects wave64 on gfx10.
Prefill attention (ink_attend_batch) uses WMMA only on gfx12 and otherwise falls to rocBLAS. Decode attention is four launches (score → softmax → value → join) with scores going through global memory.
Why the long run collapsed: WDDM spill
This matches a failure the engine already documents.
Engine::fill_expert_cache()inengine/src/poly/engine.cppsizes the cache fromcudaMemGetInfo. On Windows HIP that ishipMemGetInfominus the larger of the DXGI budget shortfall and other processes’ dedicated VRAM plusSTRATA_WDDM_MARGIN_MIB(default 1,024 MiB); seeengine/src/core/device.cu. A reserve (--vram-reserve-mib, default a 32nd of the card: 256 MiB on 8 GB, and only half of that after the first request unless the flag is set) is left for later allocations (KV growth, prompt buffers, recorded launches, library workspace).- The weights are allocated in device memory, not host or managed memory. A kernel that suddenly runs at PCIe speed means Windows demoted that memory to the shared / system pool.
- The comment on
Engine::vpool_claim_to_budget()already records an 8 GB card that went 150 MiB over the WDDM budget: “2.4 GB moved, decode at 6 tokens/s.” That matches this 5.7 tok/s run. - A possible further contributor, not proven on this machine: between prompts the engine unmaps the prompt buffers and lends that VRAM to the expert cache (
lend_prompt()/take_prompt()). Linux ROCm only returns a released piece’s VRAM when its addresses are freed (STRATA_VMM_RELEASE_WITH_ADDRESSESinengine/include/strata/hip_compat/cuda.h, Linux only). The header notes that Windows still uses the plain release, unmeasured. If Windows holds released pieces the same way, each prompt or KV-growth round can add VRAM the engine no longer counts, until the process is over budget. That would also fit a larger cache in the long run (1,052 vs 957). - Ruled out as the main cause: a different dense kernel at M=1 (decode uses the same MMVQ path), and rocBLAS workspace (prompt only, and it comes out of the reserve).
--vram-pool claims VRAM once up to the budget and never gives it back to the card, so that release/remap churn does not occur. It requires growing attention caches (pool_on_ = vram_pool && vmm_ && kv_grow in engine.cpp). --kv-whole turns kv_grow off, and the engine then prints “--vram-pool needs VMM and growing attention caches: off.” poly_kv_whole() in terminal/setup.py already skips --kv-whole when --vram-pool is in the args.
Measured A/B
On the same machine, after the long-tier collapse, we ran the official --bench-report again under one change at a time (and, for the memory cases, with --long out to a 24K conversation). During each run, Windows GPU process counters were sampled for that process’s dedicated and shared memory.
| Change | Prompt (tok/s) | Long decode (tok/s) | Peak shared GPU memory | Notes |
|---|---|---|---|---|
| Baseline (no extra flags) | about 60–100 | short decode stayed in the usual ~20–26 range; a long run fell to 5.34 tok/s, dense products 37.8 ms/token | 1.5–3 GB | Reproduced the spill |
--vram-pool |
about 155 | about 20 | about 536 MiB | Clear win: faster prompt, much less shared memory, long decode held |
| Disable prompt-buffer lending on HIP/Windows (opt-in; see below) | 166 | 17.9 | 1.5 GB | Helps prompt and long decode; shared memory still high |
STRATA_EXP_MODE=8 |
— | +1–2 vs base | — | Within the run-to-run noise |
STRATA_Q6K_RDNA1=1 |
possibly lower | +1 | — | Small; prompt may be a little worse |
--prompt-batch 4096 |
— | — | — | Not useful on this 8 GB card with this file: only 537 experts cached |
--vram-pool was the decisive fix for the long-run spill.
Two other small HIP/Windows experiments (now settled):
- Prompt-buffer lending (
STRATA_PROMPT_LEND=0). Disabling lending so the prompt buffers stay mapped (as they already do on Linux HIP) improved the spilled long run and, in the later sweep, gave a prompt of about 165 tok/s with a stable greedy output. Keep it for Inkling on Windows HIP.--vram-poolremains the stronger spill fix. - DPP reductions. On gfx1010, HIP compiles
__shfl_xor_synctods_bpermute. Replacing the constant-mask cases with DPProw_xmask/v_permlanex16compiled cleanly and showed no measurable speed gain. Dead end; do not spend more time on it.
Follow-up A/B (grouped GEMM, batched rocBLAS, throttle)
Same machine and model, official --bench-report. Prompt rates are tok/s at 2K / 8K.
| Change | Prompt 2K / 8K (tok/s) | Notes | Verdict |
|---|---|---|---|
| Baseline (no extra flags) | 78.3 / 86.2 | ||
STRATA_RDNA1_GROUPED=1 (non-WMMA grouped fp16 expert GEMM) |
150.8 / 175.9 | About 2× prompt; decode unchanged. A rocBLAS CHECK run logged no MISMATCH. | Successful — worth upstreaming as a gfx1010 / non-WMMA grouped path (env-gated; falls back for unsupported quants). |
STRATA_ROCBLAS_BATCHED=1 (batched / strided gemm_ex) |
69.4 / 109.3 | Slower than the per-expert rocBLAS loop. | Dead end on gfx1010. rocBLAS is not tuned for this card; do not revise and retest as a speed patch. |
STRATA_THROTTLE_TPS=12 |
(decode cap) | Measured 10.6 tok/s (a little under the cap). | Usability only (thermal / duty-cycle). Not a speed patch; keep opt-in, off by default. |
STRATA_THROTTLE_PREFILL=70 |
60.9 / 111.1 | Works as designed (prompt duty cycle). | Same: keep available, off by default. |
STRATA_PROMPT_LEND=0 |
about 165 | Deterministic vs its own baseline. | Helpful on Inkling / Windows HIP. |
STRATA_EXP_MODE=8, STRATA_Q6K_RDNA1=1 |
marginal | No evidence of harm. | Keep for Inkling only. |
--vram-pool |
(see earlier table) | Spill fix. | Keep on for every model. |
Output-match harness caveat. The greedy match test is not reliable on this setup as written: the no-flag baseline did not reproduce itself (D0 FAIL; a second baseline run diverged at token 14), and nearly every variant diverged at that same token 14. Those UNSAFE verdicts are noise, not real failures. STRATA_PROMPT_LEND=0 matched 64/64 tokens and --vram-pool matched 58/64. A later harness should run several baseline trials and treat a divergence also seen between baseline runs as noise. That fix is not in this drop.
Recommendations
- On an 8 GB RDNA1 card under Windows, run with
--vram-pooland without--kv-whole. That is the change that stopped the WDDM spill here. - Upstream the non-WMMA grouped fp16 expert GEMM (
STRATA_RDNA1_GROUPED=1) as a gfx1010 / non-WMMA path. It about doubled prompt throughput here (150.8 / 175.9 vs 78.3 / 86.2 tok/s) with unchanged decode. - Do not pursue batched rocBLAS on gfx1010 (slower; the library is not tuned here) or the DPP
__shfl_xorreplacement (no gain). - An engine-side throttle (prompt duty cycle / decode tok/s cap) is a useful thermal control, not a speed win; leave it off unless the user wants it.
- Do not use
--prompt-batch 4096for this model on 8 GB (too few experts stay in VRAM). STRATA_EXP_MODE=8,STRATA_Q6K_RDNA1=1andSTRATA_PROMPT_LEND=0are reasonable Inkling defaults; the first two are small, the third helped prompt and was stable.- Consider making the VMM pool the default on Windows WDDM upstream, or otherwise treating “free VRAM” more conservatively before filling the expert cache. The default reserve (256 MiB, then 128 after the first request on 8 GB) is tight once a long context and prompt buffers land.
Speculative ideas (not measured, or already settled)
A non-WMMA grouped fp16 GEMM for RDNA1.Done and successful — see the follow-up table. Worth upstreaming.Batch the existing rocBLAS path.Measured; dead end on gfx1010 (slower than the per-expert loop). Not worth revising for this card.- Fuse dequant into the decode GEMV for gfx1010, with fp16 activations rather than int8, if the MMVQ/slots kernels stay compute-bound (36% of bandwidth today).
- Budget-aware cache sizing even without the pool: treat free VRAM as min(
hipMemGetInfo, budget − usage) minus a larger reserve before filling experts, and account for first-request recordings and workspace if those are predictable. - Fewer host routing trips. 48 round trips and ~1,293 launches a token still dominate decode. Recorded graphs help; the HIP doorbell path was not effective here (
bell_onis false on HIP in this tree). - The Linux “release with addresses” VMM path on Windows only after measuring it. The engine aborts if the addresses cannot be reserved again; that is not a small change.
Microbenchmarks of the card (instruction rates, launch cost, small-N GEMM vs rocBLAS) and the A/B harness we used, plus the patches in successful-patches.txt.
2026-11-25-1050-inkling-2-mini-ud-q3-k-xl.json
2026-11-25-1050-inkling-2-mini-ud-q3-k-xl.md
2026-11-25-1056-inkling-2-mini-ud-q3-k-xl-long.json
2026-11-25-1056-inkling-2-mini-ud-q3-k-xl-long.md
2026-11-25-1534-inkling-2-mini-ud-q3-k-xl.json
2026-11-25-1534-inkling-2-mini-ud-q3-k-xl.md
10-gfx1010-sdot4.patch
20-inkling-loop-kv-last.patch
30-inkling-kv-q4-hadamard.patch
50-pr313-inkling-tool-start.patch
51-pr293-hip-decode-no-bf16.patch
52-pr294-hip-attn-projections.patch
53-pr299-expert-cache-follow.patch
54-pr306-hip-doorbell.patch
55-pr298-pinned-prompt-checkpoints.patch
56-pr290-full-expert-mirror.patch
60-navi10-dpp-xor.patch
61-hip-no-prompt-lend.patch
62-rdna1-grouped-gemm.patch
63-rocblas-batched.patch
64-engine-throttle.patch
Activity