mirror of
https://github.com/Niko1221/Strata.git
synced 2026-12-03 19:03:30 +07:00
[PR #376] [CLOSED] HIP: a failed first configure no longer leaves the kernels at -O0 #2605
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#2605
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/Niko1221/Strata/pull/376
Author: @BlueKingMuch
Created: 10/1/2026
Status: ❌ Closed
Base:
main← Head:win-o3📝 Commits (10+)
2575cb1C-3: the prompt path's GDN short conv tiled over tokensdf6980dE-2: prefetch the i-quant expert rows ahead of the AVX-512 decode; an opt-in gather decodecf68b00D-5: the prompt path's expert stream is issued by its own host threadcb91f2aserve: keep image parts in tool/assistant messages456011eLayer split limits: docs/MULTI_GPU.md and bench/results/2026-09-29-layer-split-limitsf0bbe97E-4 (prompt side): the draft layer's pass over a prompt chunk without a host sync per groupefddd74E-6: a verify layer whose routed experts are all in VRAM needs nothing from the host66f4341D-2: the prompt path's GDN recurrence split over value columns, the output norm in its own kernel0abcd5bE-6: the device plan opt-in (STRATA_VERIFY_DEVICE_PLAN=1)57fa1fdserve: routing traces from the live server (--dump-routing under --serve)📊 Changes
2 files changed (+13 additions, -1 deletions)
View changed files
📝
cmake/hip_backend.cmake(+12 -0)📝
setup.py(+1 -1)📄 Description
When a configure fails because the HIP compiler cannot compile at all, the build folder keeps empty per-configuration HIP flags, and every build in that folder afterwards compiles all kernels at -O0, while C and C++ still get -O3. setup configures
build-hipevery time, so one failed attempt is enough. On Windows two things here do it: Visual Studio 2026's<cmath>(#373), and #356's setup.py with the HIP SDK in its default folder (below). On an RX 6800 the engine built afterwards decoded at 0.24-0.27 tok/s instead of 28.CMake caches
CMAKE_HIP_FLAGS_<CONFIG>while it enables HIP, from the values its platform files set once the compiler is identified (CMAKE_HIP_FLAGS_<CONFIG>_INIT). When the identification compile fails, those values are empty: the configure caches them and stops. The next configure of the same folder identifies the compiler but keeps the cached values, as CMake does with any cached setting. The HIP sources then compile without-O(clang's default is -O0) and without-DNDEBUG.What changes
enable_language(HIP),cmake/hip_backend.cmakegives each empty per-configuration HIP flag the value CMake computed for the compiler (CMAKE_HIP_FLAGS_<CONFIG>_INIT), which is what a fresh build folder gets. Flags with a value, from CMake or the command line, are left alone, so a folder whose configure never failed is unchanged. (A flag set empty on purpose with-Dis filled too.)setup.py's engine fingerprint (ENGINE_SOURCES) now coverscmake/as well, so a change there alone, like this one, recompiles a locally built engine on its next start. That includes NVIDIA engines compiled locally, whenevercmake/changes.An alternative would be for setup to delete
build-hip/CMakeCache.txtafter a failed configure. This way also covers manual builds and folders that are already in that state.How it happened here
RX 6800, Windows 11, HIP SDK 7.2, CMake 4.0.1, Visual Studio 2026 Build Tools. The first setup run failed on VS 2026's
<cmath>(#373); CMake's configure log inbuild-hipshows the HIP compiler's identification failing there. The next run passed with the<cmath>fix, and the HIP sources compiled without-O(that folder'sCMakeCache.txtstill hasCMAKE_HIP_FLAGS_DEBUGempty;_RELEASEwas empty until a first version of this fix filled it). The engine was 0.1.30 with #247's Windows build,--expert-cache 2048:STRATA_VERIFY_PROFILEat -O0 put the time in the GPU's own stages (per window: q8+qkv GEMVs 1468 ms and out-proj 849 ms in the DeltaNet layers, the LM head 540 ms); the waits for flags the CPU raises were 41 ms of its 8.4 s per window.Reproduced
Configure only, gfx1100, the Release flags CMake cached and the
FLAGSofnative_mmvq.cuinbuild.ninja.Windows 11, HIP SDK 7.2, CMake 4.0.1, VS 2026 Build Tools; 0.1.31 with #356 and #373, without and with this PR. The failing first configure is #356's setup.py as it is: it passes
-DCMAKE_HIP_FLAGS=--rocm-path=C:/Program Files/AMD/ROCm/7.2 --rocm-device-lib-path=..., the space splits the flag (clang++: error: no such file or directory: 'Files/AMD/ROCm/7.2') and "The HIP compiler identification is unknown". The second configure, in the same folder, leaves those flags out (the SDK's clang finds its installation by itself):-O3 -DNDEBUGCMAKE_HIP_FLAGS_RELEASEempty,native_mmvq.cucompiles without-O-O3 -DNDEBUG(_DEBUG:-O0 -g -Xclang -gcodeview, as in a fresh folder)Linux, CMake 3.28, TheRock's ROCm 7.10 clang, configured the way setup does it:
-O3 -DNDEBUG-O3 -DNDEBUG--rocm-device-lib-paththat does not exist (fails: "The HIP compiler identification is unknown"), then the right flags in the same folderCMAKE_HIP_FLAGS_RELEASEempty,native_mmvq.cucompiles without-O-O3 -DNDEBUGTo reproduce: configure with
-DCMAKE_HIP_FLAGS="--rocm-path=<root> --rocm-device-lib-path=/nowhere", then again with the right device-library path, and look atCMAKE_HIP_FLAGS_RELEASEinCMakeCache.txtor at theFLAGSof a.cuobject inbuild.ninja.The kernels themselves do not change; this only gives them the flags a fresh build folder gives them.
🤖 Generated with Claude Code
https://claude.ai/code/session_015Ld5YDzuKW1hgMVwwgRZDP
🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.