Skip to content

hip: build and load the runtime on Windows - #2178

Open
ElderOrb wants to merge 2 commits into
ashhart:mainfrom
ElderOrb:windows-native
Open

ElderOrb wants to merge 2 commits into
ashhart:mainfrom
ElderOrb:windows-native

Conversation

@ElderOrb

@ElderOrb ElderOrb commented Nov 4, 2026 •

Copy link
Copy Markdown

## What this changes

HIP builds, loads its runtime and launches its kernels on Windows, as it already did on Linux: hipcc.exe is preferred and hipcc.bat runs through cmd /c call (cmd ate the quotes of a path with spaces), the build options are declared on every host, the runtime is loaded by its Windows names, the admission budget comes from the driver, the optional libraries use their Windows names (cuBLAS had been looking for libcublas.so.13), HIP timing goes through platform.c, and the cooperative grid test runs plain where the driver reports no cooperative launch support (ROCm/hip#3640). The loader now continues past a missing library only, so a runtime that loads but fails hipInit reports that error, and the new TENSORFOLD_HIP override is documented in docs/WINDOWS.md. docs/WINDOWS.md also gains the HIP build and run notes; it said HIP was not built on Windows.

  • Issue: n/a - Windows support for the existing HIP backend; no new backend, family or arithmetic change.
  • Stacked on: main
  • atc overlap --json: 55 overlaps against main. The only merge conflict is CHANGELOG.md (every open pull request adds a bullet there); this branch is rebased on current main and keeps both sides' bullets. zig/build/hip.zig is shared with Clef-Flash: joint-schema decisions on /v1/systemone (HIP) #2048, and a local git merge --no-commit of that head auto-merges the file, so the two changes touch different regions. atc reported complete: false (pullFilesUnavailable, timeLimit).

Checks on this head

  • Head commit: 6372216 (rebased onto main fa4ea099f; the hip.zig hunk now sits beside the new clefExe line, and the CHANGELOG bullet moved under Unreleased as (hip: build and load the runtime on Windows #2178))
  • Lean checker, python3 tools/zig/lean_check.py: 425 findings on the base (upstream/main), 425 on this head, 0 new.
  • Tests run, with the command and counts:
    • Windows x86_64 host, Zig 0.17.0: zig build test -Dhip=true - 525/531 build steps, 0 test failures; the four failing steps are test-check-release-paths cases that spawn sh, which this Windows host lacks (CI runs that step on ubuntu and macos only).
    • zig build test-golden - 319/331 equal to the goldens, 0 unexpected differences.
    • zig build fuzz-cortheon - pass. zig build hip-host-test -Dhip=true - pass. zig build check-native-hip-host -Dhip=true - pass (the real HIP server with inert kernels). zig fmt --check build.zig zig - clean.
    • Windows on gfx1151 (Strix Halo), TheRock 10.0.0 hipcc: zig build native-hip -Dhip=true -Dhip-arch=gfx1151 - 19/19 steps, all 12 .hsaco groups; zig build hip-gpu-test -Dhip=true -Dhip-arch=gfx1151 - 38/38 on the device; tensorfold-native.exe capabilities --json - "chip": "rdna3", "backends": ["hip"], rocBLAS and MIOpen found.
    • Linux x86_64 (WSL2 Ubuntu, Zig 0.17.0, no GPU): zig build hip-host-test -Dhip=true - pass (the shared lines this change touches), zig build check-native-hip-host -Dhip=true - pass, zig build test -Dhip=true - pass with no failures, and zig build test-server-security test-pull-security - 24/24.
  • CI: no workflow has run. This pull request comes from a fork, so the checks above are the only ones.
  • Not run, and why:
    • zig build test-pull-security does not compile on Windows (zig/src/cli/pull_test.zig:39, std.posix bind); that file is unchanged here and the same command passes on Linux, so the failure is the platform's and predates this change.
    • check-release-paths needs sh.
    • No checkpoint was loaded on either platform, so the exactness and speed lines below are n/a. A Linux HIP device run also needs an AMD GPU; the Linux host used here has none.

Receipt

  • Environment: TensorFold e68832b, Zig 0.17.0. Device checks: Windows on gfx1151 (Strix Halo, 128 GB UMA) with TheRock 10.0.0 hipcc. Host checks: the same Windows machine, and Linux x86_64 in WSL2 Ubuntu with no GPU. Compile-only checks also passed on Windows x86_64 with TheRock gfx1151 10.1.0 and with HIP SDK 7.1, whose hipcc.exe and hipcc.bat both resolve.
  • Paths and platforms the change reaches: the Windows HIP build, runtime load, admission and kernel launches. Ran on Windows/gfx1151 (device and host tests) and on Linux x86_64 (host tests and the inert-kernel server build). The Linux runtime and device path is unchanged by this diff, and no Linux AMD GPU was available for a device run.
  • Exactness, from tools/bench_concurrent.py --alone --serial or token_sha against "draft": false: n/a - no checkpoint loaded.
  • Decode speed before and after, from tools/bench_openai.py: n/a - no checkpoint.
  • Prompt speed before and after: n/a - no checkpoint.
  • Licence of any new weights or drafter: n/a.

Checklist

  • The title and description match the head commit.
  • New tests fail before the change and pass after it: the cooperative grid test failed on Windows before this change, and the NCCL soname assertions now follow optional_libraries' platform names.
  • Comments and docstrings are one line. No measurements or history in the source.
  • No personal data, machine names, internal hosts or local paths in the diff or its commits. No AI attribution lines.

@ashhart

ashhart commented Nov 4, 2026

Copy link
Copy Markdown
Owner

Thanks @ElderOrb, this is a tidy port, and the device tests on gfx1151 are what we'd want for a new platform. Two
small things on the Linux side. First, for (names) |name| return openPath(name) catch continue; now turns every load
error into DriverUnavailable, so on Linux a runtime that loads but fails hipInit, or lacks a symbol, reports a
missing driver instead. Could it continue only on error.DriverUnavailable and return any other error at once?
Second, TENSORFOLD_HIP is a new override read on every platform: please name it in the description and the HIP docs,
or keep it to Windows. After that, if you have a Linux HIP host, zig build hip-host-test -Dhip=true on this head
would cover the shared lines. If not, say so.

@ElderOrb

ElderOrb commented Nov 5, 2026

Copy link
Copy Markdown
Author

Both points are in, at e90d3ce.

@ashhart

ashhart commented Nov 5, 2026

Copy link
Copy Markdown
Owner

Thanks @ElderOrb, both are in, and saying plainly that Linux HIP wasn't run on this head is what we wanted. Main has moved under zig/build/hip.zig since, so it needs one more rebase. Then it can land after the cut.

@ElderOrb

ElderOrb commented Nov 5, 2026

Copy link
Copy Markdown
Author

Rebased onto current main, head e68832b52. hip.zig merged cleanly this time, no conflicts, and the CHANGELOG bullet still applies as is. Re-ran the host checks on the new base: zig build hip-host-test -Dhip=true and zig build check-native-hip-host -Dhip=true pass, zig fmt --check build.zig zig is clean, and the lean checker finds 0 new problems. The gfx1151 device run still stands from the earlier head; nothing in the two files changed in behaviour since.

@ElderOrb

ElderOrb commented Nov 5, 2026

Copy link
Copy Markdown
Author

I found a Linux host: WSL2 Ubuntu on x86_64, Zig 0.17.0, no GPU. On e68832b52: zig build hip-host-test -Dhip=true passes, zig build check-native-hip-host -Dhip=true passes, zig build test -Dhip=true passes with no failures, and zig build test-server-security test-pull-security passes (24/24). That covers the shared lines on Linux; only a device run would need an AMD GPU, which this box does not have. I also left the WSL setup out of the tree, so nothing in the diff depends on it.

@ashhart

ashhart commented Nov 5, 2026

Copy link
Copy Markdown
Owner

Thanks @ElderOrb, a clean rebase with the HIP host checks passing on the new base is all that was left. It is in the landing queue now.

@ashhart

ashhart commented Nov 6, 2026

Copy link
Copy Markdown
Owner

/atc exchange 26e305efc91a1ed700a29c477885bdb1008555626cae6896abb3e76ba78fa347

@ElderOrb

ElderOrb commented Nov 6, 2026

Copy link
Copy Markdown
Author

/atc exchange d499a81e400da1ba7490e9ded9d7a83d4bacb871cca3abe8e7271b4b0bc9f0f3

@ashhart

ashhart commented Nov 6, 2026

Copy link
Copy Markdown
Owner

Thanks @ElderOrb. This was queued before the 1.2.3 cut, and main has moved since. Two small things before it lands:

  1. A rebase onto main. One hunk in zig/build/hip.zig no longer applies, because main added a clefExe line next to check_target. The change itself still fits.
  2. On today's main the CHANGELOG line falls under ## 1.2.3. Please move it under ## Unreleased, ending "(hip: build and load the runtime on Windows #2178). Thanks to @ElderOrb."

Please paste the HIP host checks on the new base, as last time.

Windows HIP: prefer `hipcc.exe`, run `hipcc.bat` through `cmd /c call`, declare the build options for every host, load `amdhip64*.dll`, take the admission budget from the driver, use the Windows optional-library names (cuBLAS looked for `libcublas.so.13`), route HIP timing through `platform.c`, keep the host tests compiling, and run the cooperative grid plain where the driver reports no support.
@ElderOrb

ElderOrb commented Nov 6, 2026

Copy link
Copy Markdown
Author

Rebased onto current main (fa4ea099f), head 63722160f. The zig/build/hip.zig hunk now sits next to the new clefExe line and keeps its Windows branch on check_target, and the CHANGELOG bullet moved under ## Unreleased, ending "(#2178). Thanks to @ElderOrb."

HIP host checks on the new base:

  • Windows x86_64, Zig 0.17.0: zig build hip-host-test -Dhip=true passes; zig build check-native-hip-host -Dhip=true passes (the real server with inert kernels); zig fmt --check build.zig zig clean; the lean checker finds nothing new.
  • Linux x86_64, WSL2 Ubuntu, Zig 0.17.0, no GPU: zig build hip-host-test -Dhip=true passes, and zig build check-native-hip-host -Dhip=true passes.

The gfx1151 device run (hip-gpu-test 38/38 through TheRock's Windows 10.0.0 hipcc) is from the earlier head and I have not re-run it after this rebase; nothing in the two commits' behaviour changed, but say the word if you want the device checks repeated on 63722160f and I will run them on the Strix Halo box.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants