mirror of
https://github.com/mw00/project-maya.git
synced 2026-12-03 19:04:50 +07:00
[PR #39] [MERGED] Fix tier/lending races and invalid-route indexing behind 'illegal memory access' crashes (long prompts, RAM-resident) #294
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#294
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/39
Author: @boxwrench
Created: 10/9/2026
Status: ✅ Merged
Merged: 10/9/2026
Merged by: @mw00
Base:
main← Head:fix/tier-lending-races📝 Commits (2)
f0163b3HIP: map the device-query names #44 uses (v1.0.21 does not build on HIP without them)6b6d520Fix GLM tier lending races and reject invalid routes📊 Changes
10 files changed (+323 additions, -91 deletions)
View changed files
📝
include/strata/core/glm_model.hpp(+4 -4)📝
include/strata/hip_compat/cuda_runtime.h(+3 -0)📝
include/strata/kernels/glm_fast.hpp(+2 -0)📝
src/core/glm_fast_path.cu(+72 -32)📝
src/core/glm_fast_state.hpp(+19 -1)📝
src/core/glm_model.cu(+2 -1)📝
src/core/glm_prefill.cu(+89 -46)📝
src/kernels/cuda/glm_batch.cu(+15 -2)📝
src/kernels/cuda/glm_fast.cu(+45 -4)📝
tests/hip/glm_handoff.cpp(+72 -1)📄 Description
Fixes an intermittent GPU crash ("an illegal memory access was encountered") on v1.0.15/16. It is generic engine code, so CUDA is exposed to the same races; it shows most often on AMD with long prompts and the RAM-heavy tier modes. Tracking: #6. Related: #15 (on hold because of this).
Symptoms (before)
STRATA_GLM_RAM_GB=90,RAM_RESIDENT=1+PROMOTE_MIN=6(#25/#26): crashed by the 2nd request, at the prompt -> first-token handoff right after a conversation was set aside. Shadows (#15) crashed the same way.Causes
fast_boundaryqueues the H2D copies ofupd_key_h/upd_val_hon the nonblockingF->csand returns (the final flush has no wait).lend_tailruns another boundary and then writes its lending updates into the same host buffers after waiting only onF->copy. A table entry can then receive a half-overwritten key/value - e.g. a pointer into the borrowed activation region or a stale spare - and decode reads garbage weights.bg_holdwas released before lending's second boundary, so a RAM->VRAM move could target a tail slot that is then lent; retiring that move later gave the slot two owners. Waiting for the bytes alone doesn't retire the ownership metadata.INT_MAX; with all-NaN scores it survives and is used to index probabilities and expert tables (predicted IDs were not validated either). That is where the illegal access itself happened once tables were corrupted.Fix (9 files, +316 / -87)
Verified (HIP, ROCm 7.2.1; build for gfx1100/gfx1201/gfx1151)
glm_layer_parity,glm_model_test,hip_glm_prefill_attention,hip_glm_handoffpass on RX 7900 XT and R9700 (8/8); the handoff check also injects all/partial NaN and Inf into primary, predicted, lookahead and prompt routing.Not tested: CUDA (no NVIDIA toolchain here). Since the races are in shared code, a CUDA build and a long-prompt run on your side would be appreciated.
🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.