mirror of
https://github.com/Niko1221/Strata.git
synced 2026-12-03 19:03:30 +07:00
[PR #426] [CLOSED] Windows AMD: the HIP backend detects, builds and runs (RX 9070 XT / gfx1201) #2635
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#2635
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/426
Author: @RenZekta
Created: 10/1/2026
Status: ❌ Closed
Base:
main← Head:main📝 Commits (2)
15c8f73Added Windows HIP support9fba116Merge branch 'Niko1221:main' into main📊 Changes
8 files changed (+312 additions, -55 deletions)
View changed files
📝
.gitignore(+1 -0)📝
README.md(+9 -6)📝
START-HERE.bat(+2 -1)📝
docs/AMD_HIP.md(+38 -3)📝
setup.py(+202 -44)📝
src/core/session.cpp(+9 -1)📝
tests/hip/handoff.cpp(+10 -0)📝
tools/test_setup_amd.py(+41 -0)📄 Description
Summary
SETUP.bat/START-HERE.batstopped on any PC without an NVIDIA GPU ("no NVIDIA GPU found"), and--backend hiprefused Windows outright ("runs on Linux only"). The AMD backend now works on Windows the way it works on Linux:
setup detects the card, finds a HIP SDK, compiles the engine with it and starts the server.
live model session — plus the unit tests below.
if WIN-guarded. Linux behaviour, paths and messages are unchanged, and the Linux testspass without edits.
What changed
setup.py— the bulk of the change:amd_gpus_win()reads the HIP SDK'sbin\hipInfo.exe— the runtime's owndevice#,Name,totalGlobalMem,gcnArchName, in the orderHIP_VISIBLE_DEVICESindexes — and falls back to the display driver's registry (HardwareInformation.qwMemorySize; WMI'sAdapterRAMstops at 4 GB) when no SDK is installed yet. The parsing is a purehip_info(text)with tests;amd_arch_from_name()places a card from the driver name (RX 6600…6900 → gfx1032…gfx1030, RX 7600…9070, R9700 → gfx1102…gfx1201).hip_sdk_root():STRATA_HIP_ROOT→HIP_PATH/ROCM_PATH→%ProgramFiles%\AMD\ROCm\*→ atherock-dist-*unpacked next to the checkout → AMD's piprocm-sdk. Valid only whenbin\hipcc.exeand the ROCm clang exist.rocm_root()build_engine_hip()HIP_PATH/ROCM_PATHare removed from the environment, every-Dpath is forward-slashed,find_vcvars()is required and the configure runs through a generatedbuild-hip.bat(vcvars64.batfirst). Missing VS C++ tools and a missing SDK are explicit failures with install instructions.build_vision_cpu()find_vcvars()+build-vision.baton Windows (the new--vision cpupath otherwise raisesIsADirectoryErrorwriting to the repo root); the CUDA vision build already did this.get_prebuilt()Nonefor a hip stamp —int("gfx1201")used to raise when a CUDA backend was requested on a PC whoseengine/holds an AMD build.main()amd_problem();cfg["gpu"]is written forhipon Windows (the server turns it intoHIP_VISIBLE_DEVICES);--gpus allworks;--backendhelp, the step-1 table and the rebuild hints use the OS's own launcher (START-HERE.bat).src/core/session.cpp: the token-graph flush interval is0underSTRATA_USE_HIP && _WIN32. On Windows amapped-pinned write becomes CPU-visible only once the HIP driver is entered; polling with the default 2 ms/layer
interval stalls the GPU instead of overlapping with it.
tests/hip/handoff.cpp: the handoff test's two spin loops callhipStreamQueryunder_WIN32for the samereason — without it the test waits on writes the CPU cannot see yet.
Docs, tests, other
docs/AMD_HIP.md: a new## Windows (experimental)section (requirements, detection, the configure rules, DLL/PATHhandling, limits), and Windows is no longer listed as out of scope.
README.mdand theSTART-HERE.batheader: AMD works on Windows, with aSTART-HERE.bat --backend hipexample.tools/test_setup_amd.py: three new tests (hip_infoparsing,amd_arch_from_nameincl. RDNA2, an unsupportediGPU) and
WIN=Falsepinned inGpuListsso the Linux-path tests stay Linux-path tests..gitignore: the generatedbuild-hip.bat.Why these choices
MSVC ... for all of C, C++, and/or HIP"), so the SDK's clang compiles all three, with
vcvars64.batsupplying theMSVC and Windows SDK headers.
HIP_PATH/ROCM_PATHare removed for the configure. clang adoptsHIP_PATHas--rocm-pathand then cannotfind this layout's device bitcode ("cannot find ROCm device library").
-Dpath is forward-slashed. CMake writes some of them verbatim, where a backslash is an invalid escape(
Invalid character escape '\a').hipInfo, not WMI. It is the runtime's own device ordering (exactly whatHIP_VISIBLE_DEVICESindexes) and it carries
gcnArchName; the registry path covers the first run, before an SDK exists.serve/server.pyalready prependscfg["lib_dirs"]toPATHon Windows and setsHIP_VISIBLE_DEVICESforbackend == "hip"— the config'sgpuis simply made to be thehipInfonumber.Testing
Machine: Windows 11 Pro (build 28000) · Ryzen 9 5900X, 32 GB RAM · Radeon RX 9070 XT 16 GB (gfx1201, wave32) ·
Visual Studio 2022 (MSVC 14.44) · CMake 4.3.2 + Ninja · TheRock Windows dist 7.14.0a20260612 (hipBLASLt 1.4.0).
START-HERE.bat --check→ exit 0:GPU 0: AMD Radeon RX 9070 XT, 16 GB VRAM - can be used,[ok] HIP SDK: …— no "no NVIDIA GPU found", no "runs on Linux only".build-hip.bat→ configure + 127 Ninja steps →engine/strata.exe, withBUILD.json={"source": "local-hip", "backend": "hip", "version": "0.1.32", "archs": ["gfx1201"], "lib_dirs": ["…\\therock-dist…\\bin"], "hip_root": …}. A second run reports[ok] engine already built for this PC.build-hip\strata-device.exe --selftest→HIP arch gfx1201 wave32 (compiled for gfx1201), memory planFITS,strata-device selftest OK.engine\strata-vision.exe(the--vision cpuencoder) builds on Windows with thebuild-vision.batfix.coderfamily(Qwen3.8-Flash-Next-Coder), verified on this machine.
Limitations
--vision cpu); no GPU image encoder, no calibration.answers, a little slower); the
gfx1201-hipblaslt-100500.txttable intools/hipapplies to hipBLASLt 1.5.0.equivalent wired up); cards of one family work,
--gpus allincluded.Notes
mainhas moved to 0.1.33 since this branch;git merge-tree upstream/main HEADreports no conflicts.Checklist
Linux behaviour untouched (the existing tests pass as-is;
GpuLists/KfdDetectionstill run withWIN=False)New parsing/detection logic covered by tests (
hip_info,amd_arch_from_name)Docs updated:
docs/AMD_HIP.md,README.md,START-HERE.batVerified on hardware, end to end
Later will test with more RAM
AI assistance: Code and PR assisted by MiMo-V2.6-Flash
🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.