Repository navigation
[Engine] AMD on Windows: no prompt-buffer lending (fixes a crash) - #334
Closed
okada-shogo wants to merge 1 commit into
Closed
okada-shogo wants to merge 1 commit into
okada-shogo wants to merge 1 commit into
Conversation
… build Between prompts the expert cache takes the VRAM of the buffers only a prompt uses (lend_prompt()), and the next long prompt maps them again (take_prompt()). Under WSL2 (ROCm 7.2.4 with librocdxg, the Windows driver underneath, RX 9070 XT, some experts in RAM) that crashed in 15 of 16 runs inside the HIP runtime's kernel launch: a SIGSEGV in libamdhip64 under the dequantize launch of a dense product into the lent work memory. simplexai-labs#217 turned the lending off for HIP outside Windows only, under STRATA_VMM_RELEASE_WITH_ADDRESSES. Native Windows HIP has VMM too, so it kept lending. Issue 305 has an access violation in amdhip64_7.dll that fits the same path: on the first long prompt of every start, while a 20-token chat works (RX 7600 XT, Qwen3.6 UD-Q3_K_M, 5,332 of 10,496 experts in VRAM; the pre-poly.10 engine, which had no lending, runs the same workload). Not yet run on that card with the lending off. STRATA_VMM_NO_PROMPT_LEND, defined in hip_compat/cuda.h for every HIP build, now turns the lending off (Engine::alloc()) and keeps Inkling 2's scratch in one layout (Inkling2::scores_apart()). HIP on Linux is unchanged; CUDA and Metal are unchanged (the macro is only in the HIP header). On Windows HIP the prompt's buffers (about 300 MB of Qwen3.6's at a prompt batch of 2,048) now stay out of the expert cache, as on Linux HIP. The lending is VecSzn's (c48d16f, 631bbe4). Class: placement only. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Contributor
Author
|
Closing for now: the reporter's test in #305 showed that turning prompt-buffer lending off does not fix the Windows crash, so the lending theory did not hold. The branch stays on our fork in case it is useful later. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Problem and result
On Windows HIP, strata-poly crashes on the first long prompt of every start. The crash is an access violation inside
amdhip64_7.dll(#305: RX 7600 XT, Qwen3.6 UD-Q3_K_M, 5,332 of 10,496 experts in VRAM). A short chat works.Between prompts the engine lends the prompt-only buffers to the expert cache (
lend_prompt()/take_prompt()).Under WSL2 (ROCm 7.2.4 with librocdxg, the Windows driver underneath) this crashed in 15 of 16 runs: a SIGSEGV
inside
libamdhip64, under the dequantize launch of a dense product into the lent work memory. #217 turned lendingoff for HIP outside Windows only (
STRATA_VMM_RELEASE_WITH_ADDRESSES). Native Windows HIP has VMM too, so it keptlending. #305's crash fits the same path; it is not yet run with lending off.
This PR turns lending off on every HIP build. A new macro,
STRATA_VMM_NO_PROMPT_LEND, is defined inhip_compat/cuda.h. HIP on Linux is unchanged. CUDA and Metal are unchanged: the macro exists only in the HIP header.Cost on Windows HIP: the prompt buffers (about 300 MB for Qwen3.6 at a prompt batch of 2,048) stay out of the expert
cache between prompts, as they do on Linux HIP.
Related discussion
c48d16f83,631bbe4bf).Approach
hip_compat/cuda.h:#define STRATA_VMM_NO_PROMPT_LEND 1for all HIP builds, with a comment on the two crashes.Engine::alloc():lendsis false underSTRATA_VMM_NO_PROMPT_LEND(it was false underSTRATA_VMM_RELEASE_WITH_ADDRESSES). Withlendsfalse,two_scratch_is false too, as on Linux HIP.Inkling2::scores_apart(): same switch, so Inkling 2 keeps one scratch layout on Windows HIP, as on Linux HIP.docs/AMD_HIP.md: one bullet in the strata-poly section.workload without crashing.
Why lending is the likely cause of #305
libamdhip64.so.7, inside a kernel launchamdhip64_7.dll, offset0x2d874alibamdhip64.so.7, the crash offset0x2b931freads0x38(%rax)right after a call returns.The returned pointer is null. That fits a missing memory object for a kernel argument.
7a6c09836), which the reporter runs without crashes.mind_vram()at the start of the request. The cachegrowth itself is older than pre-poly.10.
Validation
Passed: CUDA build of the changed files (
engine.cpp,inkling2.cpp, sm_75, nvcc 12.9).HIP build of
strata-poly, ROCm 7.2.4 container,gfx1102.Failed: none.
Not run: no Windows HIP run. No gfx1102 card. The reporter in #305 is asked to test this branch.
HIP on Linux runs the same code as before (the switch was already off there).
Limits
If the crash stays with this branch, an
AMD_LOG_LEVEL=4log or a minidump from the reporter is the next step.🤖 Generated with Claude Code