mirror of
https://github.com/Niko1221/Strata.git
synced 2026-12-03 19:03:30 +07:00
[GH-ISSUE #461] Windows AMD (RX 7900 XTX / gfx1100): prefill GEMM crashes with hipErrorInvalidDeviceFunction #215
Labels
No labels
needs-format
pull-request
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference
Niko1221/Strata#215
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?
Originally created by @kopug on GitHub (Oct 2, 2026).
Original GitHub issue: https://github.com/Niko1221/Strata/issues/461
Summary
On Windows 11 with an AMD Radeon RX 7900 XTX (gfx1100), Strata 0.1.34 starts successfully, loads the IQ2_XS model, passes
strata-device --selftest, and can generate responses for short prompts.However, slightly larger prompts reproducibly crash the engine during prefill with:
The API then returns HTTP 503:
This does not appear to be specific to long-context / 32K prompts. I originally encountered it while testing a ~32K workload, but was able to reproduce the same crash with much shorter prompts.
Environment
1678de333d0e0711bc414ad992b640e1a37dd8140.1.34gfx1100, wave3232.0.31041.10042026-08-1710.2.0a20260930Qwen3.8-Flash-Next-GSQ-RCO-IQ2_XS32768There is also an integrated AMD GPU in the system:
Strata setup correctly selects the RX 7900 XTX as HIP device 1.
Device self-test
I explicitly selected the RX 7900 XTX:
Result:
So basic HIP device detection and the Strata device self-test succeed.
Successful short inference
A normal short request succeeds:
I also tested exact input-token counts using
/v1/messages/count_tokens.Independent short prompts succeeded at approximately 60-62 input tokens:
Reproduction
I generated independent prompts with different prefixes to avoid prefix-cache reuse.
Observed results:
The 72-token request causes the engine to terminate.
Earlier tests with larger prompts, including a ~32K workload, fail with the same error.
This suggests the issue is not limited to a full 32K context. It can happen during a relatively short prefill as well.
I did not continue narrowing the exact token boundary because the crash was already reproducible enough to report.
Engine log at failure
Immediately before the failure:
The same two error lines appear consistently after the failing requests.
I did not see an out-of-memory error in the engine log.
Additional observation
The PCIe probe also reports values that appear implausibly high:
I do not know whether this is related to the prefill failure, but I included it in case it is useful for debugging.
Related issues checked
I searched the existing issues before filing this.
The closest one I found is #273:
unspecified launch failure)This report is different:
strata-device --selftestsucceedhipErrorInvalidDeviceFunctionI also found #161, which has a somewhat similar high-level symptom where short prompts succeed and batched prefill fails, but that report is on NVIDIA/CUDA with a different cuBLAS status.
So I do not think this is a duplicate of either issue.
Expected behavior
Prefill should complete successfully on the RX 7900 XTX / gfx1100 rather than terminating the engine.
Actual behavior
The engine exits with:
and the API responds with HTTP 503.
I can provide the full
strata-iq2_xs.logor run additional targeted diagnostics if useful.@Niko1221 commented on GitHub (Oct 2, 2026):
Thanks for the detailed log. This is very likely the same cause as #468. Windows finds an AMD driver's own
amdhip64_7.dllin System32 before the zip'sengine\rocm\bin(which is only on PATH), so the bundled rocBLAS runs on your driver's HIP runtime. The small GEMMs work, and the larger shapes that use rocBLAS's packed kernels fail withhipErrorInvalidDeviceFunction. The next release puts the bundled runtime next tostrata.exe.To try it now, from the Strata folder:
then send the 72-token prompt again. If it still fails, please post:
(Get-Item C:\Windows\System32\amdhip64_7.dll).VersionInfo.FileVersion(PowerShell);Get-Process strata | % Modules | ? ModuleName -like 'amdhip*' | select FileName;"AMD_LOG_LEVEL": "3"in the config'senv.Your driver (32.0.31041) is also fairly old for ROCm 10.2, so a current AMD Software is worth a try too.
@kopug commented on GitHub (Oct 2, 2026):
Thanks, that fixed it.
After copying:
@Niko1221 commented on GitHub (Oct 2, 2026):
0.1.35 puts the bundled HIP runtime next to
strata.exe, so a driver's System32 copy is no longer picked up. The engine log now names the runtime it loaded (strata generate: HIP runtime ...). RunSTART-HERE.bat(Linux:./setup.sh) once to update. If the GEMM error is still there with the bundled runtime, please reopen with that line and theAMD_LOG_LEVEL=3output, since then your driver version is the next suspect.@maraa081 commented on GitHub (Oct 7, 2026):
Follow-up: still on the System32 runtime on gfx1101 — and a self-built engine behaves identically
Building on your reply. Everything below is reproduced on AMD RX 7800 XT (gfx1101), Windows 11,
driver 32.0.31041.1004, engine 0.1.40.
1. The bundled
amdhip64_7.dllcannot load next tostrata.exe—rocm_kpack.dllis not shippedstrata.exestatically importsamdhip64_7.dll(first entry in its import table), thenhipblas.dll,libhipblaslt.dll,MSVCP140.dll,VCRUNTIME140.dll,VCRUNTIME140_1.dll.The bundled
amdhip64_7.dllimportsrocm_kpack.dll(plus SETUPAPI/KERNEL32/USER32/GDI32/ADVAPI32),and
rocm_kpack.dllimportsMSVCP140.dll,VCRUNTIME140.dll,VCRUNTIME140_1.dll— all of whichlive in
engine\rocm\bin, never next tostrata.exe. Setup copies onlyamdhip64_7.dllandamd_comgr.dllthere (HIP_RUNTIME_DLLS), so the chain is incomplete.Measured with
LoadLibraryW("D:\Strata\engine\amdhip64_7.dll"), one fresh process per row:rocm_kpack.dllresolvableD:\Strata\engineC:\2. A self-built engine is not different
Built here with
tools\hip\build_windows.bat(VS 2022 Build Tools, ROCm 10.2.0a20260930 from theTheRock wheels, gfx1101 in the arch list; build and packaging finished cleanly) and installed over the
ready-made one, it prints the same line and fails the same way:
So this is not specific to the prebuilt zip.
3. A delayed import (
/DELAYLOAD) does not fix it eitherFollowing your reply, the engine was patched and rebuilt here:
LINKER:/DELAYLOAD:amdhip64_7.dllon thestrataandstrata-devicetargets, plusdelayimp;__pfnDliNotifyHook2hook (src/platform/hip_runtime_win.cpp) that, ondliNotePreLoadLibraryfor
amdhip64_7.dll, callsLoadLibraryExA(<exe dir>\amdhip64_7.dll, NULL, LOAD_WITH_ALTERED_SEARCH_PATH).The build succeeded and the patched engine is installed — it still binds the driver's copy. The
likely reason is (1): the full-path load fails because
rocm_kpack.dllis not beside the exe, so thedelay-load helper falls back to the normal search and gets System32 again. Copying
rocm_kpack.dll,msvcp140.dll,vcruntime140.dll,vcruntime140_1.dllandorigami.dllnext to the exe, with thepatched engine, did not change it either.
Also ruled out here:
STRATA_DENSE_MMQ=1(takes effect, still crashes),--prefill 512(accepted,same crash),
lib_dirs/PATH order, clean restarts, no AMD entry inKnownDLLs,strata-device --list-devicesand--selftestboth pass.Net result: on this card and driver, every route tried ends on the System32 runtime, and any
sizeable prefill kills the engine (short prompts answer fine — 43.9 tok/s measured).
Still available: a working HIP build environment now exists on this machine, so any patch can be
built and tested here in ~10 minutes. Happy to run experiments, take
AMD_LOG_LEVEL=3traces, or trya manifest / dot-local redirection if you want to see whether the loader can be steered at all.
Second, separate issue: the low-RAM resident mode never fits — available commit ~2.3-3.5 GiB vs the
~15.7 GiB complement (page file 6.5 GB, system-managed). Falls back to
--mmap-experts;files 102912.8 MB readafter four short requests.@Niko1221 commented on GitHub (Oct 7, 2026):
Thank you, this is an excellent analysis and it was exactly the missing piece. You are right:
amdhip64_7.dllimportsrocm_kpack.dll, which imports the MSVC runtime, and setup copied onlyamdhip64_7.dllandamd_comgr.dllnext tostrata.exe. A full-path load of the bundled runtime then fails with error 126 and Windows falls back to System32. That also explains why your delay-load hook still ended on System32.What 0.1.40.3 changes:
amdhip64_7.dll,amd_comgr.dll,rocm_kpack.dll,msvcp140.dll,vcruntime140.dll,vcruntime140_1.dll.hipblas.dll,rocblas.dlland the rest stay inrocm\bin. Running START-HERE.bat on an existing install adds the missing ones.GetLastError(126 means a dependency is missing), so a log shows the reason.Please be aware that we have no Windows AMD card, so none of this was run on AMD hardware: the closure was checked against the real zip with a second PE parser, the copy logic with a fake engine folder, and the engine change is diagnostic only.
Would you test the 0.1.40.3 HIP zip and paste the new
strata generate: HIP runtime ...line (it should name the engine's own folder), and say whether the large prompt now works? If it still says System32, please also paste the new line that beginsthe bundled runtime beside the engine. Your offer to run experiments is very welcome. We will look at the resident-mode commit problem separately.