[GH-ISSUE #937] [gfx1030] HSA_STATUS_ERROR_MEMORY_APERTURE_VIOLATION in gdn_step_commit_kernel after a few long fresh prefills #408

Closed
opened 2026-11-04 01:42:46 +07:00 by bsakaguchi · 3 comments
Owner

Originally created by @lucaravera-glitch on GitHub (Oct 5, 2026).
Original GitHub issue: https://github.com/Niko1221/Strata/issues/937

Summary

On an RX 6800 (gfx1030, Navi 21) the engine reliably dies after a small number of
long, fresh (non-KV-cached) prefills, with:

Queue error: HSA_STATUS_ERROR_MEMORY_APERTURE_VIOLATION: The agent attempted to access memory beyond the largest legal address.

The faulting kernel is always strata::kernels::gdn_step_commit_kernel, and the server
surfaces it as the engine stopped unexpectedly (exit code -13) followed by an automatic
engine restart.

Short/cached sessions are stable — a full 5/5 agent benchmark (~20 requests) runs clean.
The failure scales with fresh prefill volume per engine lifetime, not with
--max-context: prompts of 10k tokens fault just as readily as 34.5k, after 2-7 fresh
prefills.

Environment

Strata v0.1.39, commit 6f32ec0, engine built from source
GPU Radeon RX 6800, 16 GB, 1002:73BF, gfx1030 (Navi 21)
BAR0 16 GiB (Region 0 ... [size=16G]) — 256 MiB before enabling Above 4G Decoding
Driver amdgpu from kernel 7.2.5-3-omarchy (Omarchy/Arch)
Userspace ROCm 7.14.0a20260612 (community gfx103X wheel), matching the kernel vintage
Model Qwen3.8-Flash-Next-GSQ-RCO-IQ3_S, 2 shards, 83.6 GB, 46.84 GiB expert arena
RAM 94 GiB

Launch args:

--max-context 65536 --kv int8 --kv-resident 65536 --vram-reserve-mib 3072
--prefill 2048 --pcie-frac 0 --adapt-every 0 --spec 4 --mtp <dir>

Reproduction

  1. Start the server and let the engine load.
  2. Issue fresh prefills of ~10k-34.5k tokens (a probe that nonces both ends of the
    prompt guarantees no KV reuse).
  3. Repeat in a loop.

Expect a fault within 2-7 completed prefills. Prefill throughput before the fault is
normal (~330 tok/s); nothing degrades, it simply dies between requests.

Representative run (34,507-token fresh prefills, faulting lifetime marked):

engine life #1: [1:34507tok 34507 fresh] [2:34507tok fresh] [3:34507tok fresh] [4:34507tok fresh]  <<FAULT>>
engine life #2: [1:34507tok fresh] [2:34507tok fresh]                                            <<FAULT>>
engine life #3: [1:34507tok fresh] [2..7:10063tok fresh]                                       <<FAULT>>
engine life #4: [1:10063tok fresh] [2:10063tok fresh] [3:10063tok fresh]

Aggregate: 16 clean / 3 faults across 4 engine lifetimes.

Ruled out

Hypothesis Test Result
VRAM exhaustion --vram-reserve-mib 3072 (2990 MiB free at load) no change
Prefill chunk-boundary bug --prefill 2048 fixed a different, reproducible hang at the 8193 boundary; aperture fault unaffected
Small BAR (Region 0 = 256M) enabled Above 4G Decoding → 16 GiB BAR no change
Expert-arena mapping vm.nr_hugepages=24000, arena switches to hugetlb 2 MB pages no change
KV streaming / VRAM paging --kv-resident 65536, no streaming at startup no change
Host RAM exhaustion 35-50 GiB available throughout; free never near OOM no change
ROCm/driver vintage skew kernel and ROCm are contemporary; bare metal no change

Contrast case

With prompts that ride the KV cache (only the first turn prefills ~8k, later turns reuse),
a full agent benchmark ran 5/5 tasks, ~20 requests, 0 faults:

strata serve: prompt 8090 tokens = 32768 reused + 0 read ...

So the practical risk scales with how often fresh long contexts are started, not with
session length or --max-context.

On this same setup, before settling on --pcie-frac 0 --adapt-every 0, prefill stalled
indefinitely (said nothing for 600 s) in roughly 1 in 3 long requests — the
"verify hangs after a long prompt" signature in #884. Two of the three knobs named there
(adaptive expert swaps, PCIe sharing) being off does remove that hang, which is offered as
confirmation data for #884. The aperture fault reported here survives both flags, so it
looks like a separate defect.

Workarounds so far

  • Cached/short sessions: reliable (5/5 benchmark, 0 faults).
  • The server auto-restarts the engine, so the next request succeeds, but the ~160 s
    reload is disruptive mid-session.
  • No configuration of --max-context, BAR size, or hugepages removes the fault.

Happy to provide full logs (strata-iq3_s.log, strata-server.out) and a standalone
repro script if useful.

Originally created by @lucaravera-glitch on GitHub (Oct 5, 2026). Original GitHub issue: https://github.com/Niko1221/Strata/issues/937 ## Summary On an RX 6800 (gfx1030, Navi 21) the engine reliably dies after a small number of long, *fresh* (non-KV-cached) prefills, with: ``` Queue error: HSA_STATUS_ERROR_MEMORY_APERTURE_VIOLATION: The agent attempted to access memory beyond the largest legal address. ``` The faulting kernel is always `strata::kernels::gdn_step_commit_kernel`, and the server surfaces it as `the engine stopped unexpectedly (exit code -13)` followed by an automatic engine restart. Short/cached sessions are stable — a full 5/5 agent benchmark (~20 requests) runs clean. The failure scales with **fresh prefill volume per engine lifetime**, not with `--max-context`: prompts of 10k tokens fault just as readily as 34.5k, after 2-7 fresh prefills. ## Environment | | | |---|---| | Strata | `v0.1.39`, commit `6f32ec0`, engine built from source | | GPU | Radeon RX 6800, 16 GB, `1002:73BF`, gfx1030 (Navi 21) | | BAR0 | 16 GiB (`Region 0 ... [size=16G]`) — 256 MiB before enabling Above 4G Decoding | | Driver | `amdgpu` from kernel `7.2.5-3-omarchy` (Omarchy/Arch) | | Userspace | ROCm `7.14.0a20260612` (community gfx103X wheel), matching the kernel vintage | | Model | Qwen3.8-Flash-Next-GSQ-RCO-IQ3_S, 2 shards, 83.6 GB, 46.84 GiB expert arena | | RAM | 94 GiB | Launch args: ``` --max-context 65536 --kv int8 --kv-resident 65536 --vram-reserve-mib 3072 --prefill 2048 --pcie-frac 0 --adapt-every 0 --spec 4 --mtp <dir> ``` ## Reproduction 1. Start the server and let the engine load. 2. Issue **fresh** prefills of ~10k-34.5k tokens (a probe that nonces both ends of the prompt guarantees no KV reuse). 3. Repeat in a loop. Expect a fault within 2-7 completed prefills. Prefill throughput before the fault is normal (~330 tok/s); nothing degrades, it simply dies between requests. Representative run (34,507-token fresh prefills, faulting lifetime marked): ``` engine life #1: [1:34507tok 34507 fresh] [2:34507tok fresh] [3:34507tok fresh] [4:34507tok fresh] <<FAULT>> engine life #2: [1:34507tok fresh] [2:34507tok fresh] <<FAULT>> engine life #3: [1:34507tok fresh] [2..7:10063tok fresh] <<FAULT>> engine life #4: [1:10063tok fresh] [2:10063tok fresh] [3:10063tok fresh] ``` Aggregate: **16 clean / 3 faults across 4 engine lifetimes.** ## Ruled out | Hypothesis | Test | Result | |---|---|---| | VRAM exhaustion | `--vram-reserve-mib 3072` (2990 MiB free at load) | no change | | Prefill chunk-boundary bug | `--prefill 2048` | fixed a *different*, reproducible hang at the 8193 boundary; aperture fault unaffected | | Small BAR (`Region 0 = 256M`) | enabled Above 4G Decoding → 16 GiB BAR | no change | | Expert-arena mapping | `vm.nr_hugepages=24000`, arena switches to `hugetlb 2 MB pages` | no change | | KV streaming / VRAM paging | `--kv-resident 65536`, no streaming at startup | no change | | Host RAM exhaustion | 35-50 GiB available throughout; `free` never near OOM | no change | | ROCm/driver vintage skew | kernel and ROCm are contemporary; bare metal | no change | ## Contrast case With prompts that ride the KV cache (only the first turn prefills ~8k, later turns reuse), a full agent benchmark ran **5/5 tasks, ~20 requests, 0 faults**: ``` strata serve: prompt 8090 tokens = 32768 reused + 0 read ... ``` So the practical risk scales with how often fresh long contexts are started, not with session length or `--max-context`. ## Related: confirms #884 On this same setup, before settling on `--pcie-frac 0 --adapt-every 0`, prefill stalled indefinitely (`said nothing for 600 s`) in roughly 1 in 3 long requests — the "verify hangs after a long prompt" signature in #884. Two of the three knobs named there (adaptive expert swaps, PCIe sharing) being off does remove that hang, which is offered as confirmation data for #884. The aperture fault reported here survives both flags, so it looks like a separate defect. ## Workarounds so far - Cached/short sessions: reliable (5/5 benchmark, 0 faults). - The server auto-restarts the engine, so the next request succeeds, but the ~160 s reload is disruptive mid-session. - No configuration of `--max-context`, BAR size, or hugepages removes the fault. Happy to provide full logs (`strata-iq3_s.log`, `strata-server.out`) and a standalone repro script if useful.
Author
Owner

@Niko1221 commented on GitHub (Oct 7, 2026):

0.1.40.2 adds STRATA_DBG_GDN=1: gdn_step_commit_kernel then checks the window count it reads from device memory and prints a line instead of faulting if it is out of range. Could you run your loop of long fresh prefills once with STRATA_DBG_GDN=1 and post what the log says?

<!-- gh-comment-id:6037893800 --> @Niko1221 commented on GitHub (Oct 7, 2026): 0.1.40.2 adds STRATA_DBG_GDN=1: gdn_step_commit_kernel then checks the window count it reads from device memory and prints a line instead of faulting if it is out of range. Could you run your loop of long fresh prefills once with STRATA_DBG_GDN=1 and post what the log says?
Author
Owner

@lucaravera-glitch commented on GitHub (Oct 7, 2026):

Ran it, plus two controls that turned out to matter more than the main test.

0.1.40.2 + STRATA_DBG_GDN=1: 30 fresh 34,507-token prefills clean, one engine
lifetime, no restart. Same again with the expert arena on hugetlb 2 MB pages — another
30 clean. No strata DBG: line, no HSA_STATUS_ERROR_MEMORY_APERTURE_VIOLATION, no
Memory access fault. Version confirmed from the engine's own banner (session is up (engine 0.1.40.2)), the env var verified in the engine's /proc/environ, and the memory
path confirmed from the startup line (MAP_HUGETLB unavailable ... vm.nr_hugepages=0 for
the THP run, hugetlb 2 MB pages for the other), so both branches were exercised
deliberately.

run engine arena backing fresh 34,507-tok prefills outcome
A 0.1.39 THP 19 mul_mat_q<(ggml_type)20, 64, false>, Page not present, mid-prefill at 4,096 tok
B 0.1.39 hugetlb 18 2× aperture violation (1st after 14, 2nd immediately after restart)
C 0.1.40.2 + DBG hugetlb 30 clean
D 0.1.40.2 + DBG THP 30 clean

What I can and can't say:

  • The DBG branch never fired, because on 0.1.40.2 the fault didn't reproduce in 60
    fresh prefills total (C+D). So this neither confirms nor refutes the window-count
    hypothesis — it only shows 0.1.40.2 survived 60 where 0.1.39 died at 18-19 in both
    memory configurations.
  • Hugepages aren't the variable. A ≈ B and C ≈ D, so arena backing makes no
    difference on either version. I had 24,000 × 2 MiB reserved for the earlier runs and
    have since turned that off again — worth knowing since it costs 48 GiB and, here, ~6%
    of prefill throughput (355-358 tok/s with hugetlb vs ~379 on THP).
  • Both A and B are 0.1.39 controls rather than 0.1.40.2, so the "dies at 18-19" baseline
    is from the code where you originally saw the fault.

Still happy to do the A/B I offered: 0.1.39 with only dfc8f74 cherry-picked, same loop.
That is the only way to test the window-count hypothesis on the code where the fault
actually appeared — C and D can't distinguish "0.1.40.2 fixed it" from "it didn't
reproduce", with 0c86bbe fix(gdn) and 352cad8 F7: a one-token window commits itself
in between. Alternatively I can keep pushing past 30 on 0.1.40.2 until it either faults
under DBG or you'd call it fixed.

One unrelated observation while I was there: 0.1.39 returned exactly 2 generated tokens
on all 37 requests of the control runs, while 0.1.40.2 often generates all 32 the probe
asks for (24/30 in run D). Same prompt, temperature: 0, reasoning_effort: none. May
be expected; mentioning it in case it isn't.

Logs available on my side: strata-iq3_s.log (D), .hugetlb01402 (C),
.hugetlb0139 (B), .thp0139 (A).

<!-- gh-comment-id:6046197345 --> @lucaravera-glitch commented on GitHub (Oct 7, 2026): Ran it, plus two controls that turned out to matter more than the main test. **0.1.40.2 + `STRATA_DBG_GDN=1`: 30 fresh 34,507-token prefills clean**, one engine lifetime, no restart. Same again with the expert arena on `hugetlb 2 MB pages` — another 30 clean. No `strata DBG:` line, no `HSA_STATUS_ERROR_MEMORY_APERTURE_VIOLATION`, no `Memory access fault`. Version confirmed from the engine's own banner (`session is up (engine 0.1.40.2)`), the env var verified in the engine's `/proc/environ`, and the memory path confirmed from the startup line (`MAP_HUGETLB unavailable ... vm.nr_hugepages=0` for the THP run, `hugetlb 2 MB pages` for the other), so both branches were exercised deliberately. | run | engine | arena backing | fresh 34,507-tok prefills | outcome | |---|---|---|---|---| | A | 0.1.39 | THP | 19 | `mul_mat_q<(ggml_type)20, 64, false>`, `Page not present`, mid-prefill at 4,096 tok | | B | 0.1.39 | hugetlb | 18 | 2× aperture violation (1st after 14, 2nd immediately after restart) | | C | 0.1.40.2 + DBG | hugetlb | 30 | clean | | D | **0.1.40.2 + DBG** | **THP** | **30** | **clean** | What I can and can't say: - **The DBG branch never fired**, because on 0.1.40.2 the fault didn't reproduce in 60 fresh prefills total (C+D). So this neither confirms nor refutes the window-count hypothesis — it only shows 0.1.40.2 survived 60 where 0.1.39 died at 18-19 in both memory configurations. - **Hugepages aren't the variable.** A ≈ B and C ≈ D, so arena backing makes no difference on either version. I had 24,000 × 2 MiB reserved for the earlier runs and have since turned that off again — worth knowing since it costs 48 GiB and, here, ~6% of prefill throughput (355-358 tok/s with hugetlb vs ~379 on THP). - Both A and B are 0.1.39 controls rather than 0.1.40.2, so the "dies at 18-19" baseline is from the code where you originally saw the fault. Still happy to do the A/B I offered: 0.1.39 with only `dfc8f74` cherry-picked, same loop. That is the only way to test the window-count hypothesis on the code where the fault actually appeared — C and D can't distinguish "0.1.40.2 fixed it" from "it didn't reproduce", with `0c86bbe fix(gdn)` and `352cad8 F7: a one-token window commits itself` in between. Alternatively I can keep pushing past 30 on 0.1.40.2 until it either faults under DBG or you'd call it fixed. One unrelated observation while I was there: 0.1.39 returned exactly 2 generated tokens on all 37 requests of the control runs, while 0.1.40.2 often generates all 32 the probe asks for (24/30 in run D). Same prompt, `temperature: 0`, `reasoning_effort: none`. May be expected; mentioning it in case it isn't. Logs available on my side: `strata-iq3_s.log` (D), `.hugetlb01402` (C), `.hugetlb0139` (B), `.thp0139` (A).
Author
Owner

@Niko1221 commented on GitHub (Oct 13, 2026):

Thanks for the report. To keep the tracker current we are closing issues older than three days: 0.1.44 is out with a long list of fixes, and many older reports are covered by it or by 0.1.43.1.

If this still happens on 0.1.44, please leave a comment here with your engine log (and the version line it prints), and we will reopen it. A new issue that links this one works too.

<!-- gh-comment-id:6155991513 --> @Niko1221 commented on GitHub (Oct 13, 2026): Thanks for the report. To keep the tracker current we are closing issues older than three days: [0.1.44](https://github.com/Niko1221/Strata/releases/tag/v0.1.44) is out with a long list of fixes, and many older reports are covered by it or by 0.1.43.1. If this still happens on 0.1.44, please leave a comment here with your engine log (and the version line it prints), and we will reopen it. A new issue that links this one works too.
Sign in to join this conversation.
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
Niko1221/Strata#408
No description provided.