Skip to content

chore(ci): add a Windows build job and run the runtime-dir host tests - #2652

Merged
inureyes merged 9 commits into
mainfrom
feature/issue-2642-windows-ci
Oct 26, 2026
Merged

inureyes merged 9 commits into
mainfrom
feature/issue-2642-windows-ci

Conversation

@inureyes

@inureyes inureyes commented Oct 26, 2026 •

Copy link
Copy Markdown
Member

Summary

  • overlay-host-tests (ubuntu-latest, about 20 s) runs make verify-rocm-overlay verify-cuda-runtime-dir: the ROCm overlay record checks and the host tests of both overlays' runtime and include directory choice (feat(windows): load the ROCm runtime from a relocatable directory and ship a runtime bundle #2606/feat(windows): load the ROCm runtime from a relocatable directory #2607, feat: Run Windows CUDA builds from a relocatable runtime bundle #2640). The record checks read only the checkout and a synthetic git history they build, so the whole target passes on a shallow clone. It runs unconditionally, like python-tooling, because several files it runs (rocm_overlay.py, allocator_ownership_test.*, the Makefile targets) are in no path filter.
  • windows-build (windows-latest, compile-only, no GPU) runs the mlxcel-mlx-pin lib tests (adds the #[cfg(windows)] test), the tests/ Python suites, and cargo check -p mlxcel-core --features rocm against the ROCm 10.1.0 gfx1151 TheRock tarball, then asserts mlx_rocm_kernels.lib exists so a skipped HIP build cannot pass. Hosted runners only. It is gated on a new windows_build filter: build.rs, src/lib/mlxcel-core/build.rs and build_support/**, src/lib/mlxcel-mlx-pin/**, the ROCm and CUDA overlays' delayload.cpp/runtime_dir.h/jit_module.cpp, the MLX pin (src/lib/mlxcelverse/CMakeLists.txt), both runtime-dir test scripts, scripts/package_windows_*.py and their Python tests, and tests/test_rocm_arch_validation.py. The tarball is pinned by sha256 (AMD publishes no checksum), cached per version, family and digest, saved right after verification, and verified again after every restore.
  • The bash-driven classes of the five suites named in the issue skip on win32; their pure-Python classes still run there. Two other Windows failures were encoding bugs (locale-code-page reads, emoji prints in insert_apache_header.py crashing on cp1252/cp949 consoles) and are fixed instead of skipped.
  • docs/installation.md replaces "no Windows CI job" with what the job covers; CONTRIBUTING.md and docs/mlxcelverse/rocm-overlay.md name the new jobs.

Windows ROCm check: measured, full check kept

Measured on windows-latest (4 vCPU, image windows-2025-vs2026), first on a scratch branch before opening this PR (run 40403292712; the cache-miss download and save timings come from run 40402876890), then on this PR:

TheRock tarball (gfx1151, 10.1.0) 1,649,447,497 bytes
Cache entry (gh cache list) 1,625,900,605 bytes
Job, cache hit 14.5 min (scratch), about 20 min three times on this PR (PR run); restore 22-24 s, verify 5-7 s, extract 54-57 s, cargo check 12-17.5 min
Job, cache miss 14 min (PR run); download 4-6 s, save 10-11 s
Extracted SDK after excludes 3.8 GB of 8.4 GB
CARGO_TARGET_DIR after the check 2.2 GB, HIP kernel archive 190.1 MiB

All within the bounds set for this issue (under 45 min on a hit, under 4 GB of cache, one download per key), so the full rocm check runs rather than a subset. The CUDA variant is not added: it is optional in the issue and was not measured. Repository cache usage was already about 10.5 GB before this entry, so GitHub's LRU eviction applies across all of them.

Test plan

  • Windows 11 host: python -m unittest discover -s tests -p 'test_*.py' (188 tests, 76 skipped), cargo test -p mlxcel-mlx-pin --lib (49 passed), both host tests with ROCm's clang++, actionlint 1.7.7 clean on ci.yml.
  • Deliberately broken order (78f4552 swaps the HIP_PATH and bundle branches of choose_rocm_include_dir()): run 40406365843 fails overlay runtime-dir host tests with FAIL: include: bundle beats HIP_PATH and one more check (job). Reverted in 9ab81fc.
  • Final tree: run 40415050086 passes overlay runtime-dir host tests (21 s) and Windows build (compile-only) (19 min 50 s, cache hit). The squash commit touches gated paths, so windows-build also runs on main after merge, which creates the main-scoped cache entry later PRs restore.

Changes during review

  • overlay-host-tests became unconditional; it was gated on filters that missed several of the files it tests.
  • The MLX pin joined the windows_build filter, so a pin bump that breaks the Windows build fails on its own PR.
  • The docs say the ci:full label referenced by ci.yml is not defined in the repository yet. Until a maintainer creates it, a PR that edits only the windows-build definition (for example a tarball digest bump) cannot run that job before merge.

Closes #2642

Five tests/ suites drive bash scripts or make and fail on a Windows host. Their bash-driven classes now carry unittest.skipIf(sys.platform == "win32"); the pure-Python classes in the same files still run there, and the Linux python-tooling job still runs all of them.

Two more failures were encoding bugs, not missing tools: test_bench_serving_concurrency read metrics.rs and test_makefile_dev_test_stack read the Makefile with the locale code page, and insert_apache_header.py printed emoji that a cp1252 or cp949 console cannot encode, so its --check crashed instead of passing. The reads now name UTF-8 and the script prints through a helper that replaces unencodable characters.

python -m unittest discover -s tests -p 'test_*.py' passes on Windows 11 (188 tests, 76 skipped).

Refs #2642
Nothing in CI ran on Windows, and the host tests of the overlays' runtime-directory choice (rocm_runtime_dir_test.sh, and since #2651 cuda_runtime_dir_test.sh) ran only from a developer's make verify.

overlay-host-tests runs make verify-rocm-overlay verify-cuda-runtime-dir on ubuntu-latest: the ROCm overlay record checks plus both host tests. The record checks read only the checkout and a synthetic history they build, so a shallow clone is enough. It gates on the rocm filter or the new windows_build filter (build scripts, build_support, the overlays' delayload.cpp, runtime_dir.h and jit_module.cpp for ROCm and CUDA, the bundle packagers and their tests), or ci:full.

windows-build runs on windows-latest, gated on windows_build or ci:full and never on a self-hosted pool: the mlxcel-mlx-pin lib tests (adds the cfg(windows) test), the tests/ Python suites, and cargo check -p mlxcel-core --features rocm against the ROCm 10.1.0 gfx1151 TheRock tarball, then asserts the HIP kernel archive exists. The tarball is pinned by sha256 (AMD publishes none), cached per version, family and digest, saved right after verification, and verified again after restore. Measured on a scratch branch: 14.5 min per run on a cache hit, 12 min of it the cargo check; the cache entry is 1.6 GB. The CUDA variant is not added.

docs/installation.md replaces "no Windows CI job" with what the job covers; CONTRIBUTING.md and docs/mlxcelverse/rocm-overlay.md name the new jobs.

Refs #2642
@inureyes inureyes added status:review Under review type:chore Maintenance tasks (build, CI, etc.) priority:medium Medium priority area:core mlxcel-core: MLX FFI, primitives, KV cache, layers platform:windows Windows (native) specific labels Oct 26, 2026
Swaps the HIP_PATH and runtime-bundle branches of choose_rocm_include_dir() so the new overlay-host-tests job must fail on this push. The next commit reverts it.

Refs #2642
Reverts 78f4552 and restores the include-directory order. The reverted commit made overlay-host-tests fail in run 40406365843, as intended.

Refs #2642
Both host test scripts now say that overlay-host-tests runs them on PRs that can change the directory choice, besides their make targets. Touching them also puts the scripts in this PR's diff, so the path-gated overlay-host-tests and windows-build jobs run on the final tree here and on the merge commit on main (the repository has no ci:full label to force them).

Refs #2642
The PR runs took 14 and 20 minutes against the 14.5 measured on the scratch branch (the cargo check alone varied from 12 to 17.5 minutes), so the job comment and CONTRIBUTING.md state the range instead of one figure.

Refs #2642
overlay-host-tests ran `make verify-rocm-overlay verify-cuda-runtime-dir` only when the rocm or windows_build filters matched, and neither filter covers rocm_overlay.py, rocm_overlay_test.sh, allocator_ownership_test.{sh,cpp} or the Makefile targets. An edit to those could merge without the job running. The job takes about 16 seconds on a hosted runner and needs no Rust toolchain, so it now runs unconditionally, like python-tooling, which also covers edits to its own definition and every push to main.

windows_build now includes src/lib/mlxcelverse/CMakeLists.txt: a pin bump changes the MLX and HIP sources the Windows rocm check compiles, and rocm-build is parked, so without it a pin bump that breaks the Windows build would merge green and fail the next unrelated PR.

Validated locally: both host tests with ROCm clang++ and the tests/ suites pass. actionlint runs in workflow-lint.

Refs #2642
@inureyes

Copy link
Copy Markdown
Member Author

Implementation Review Summary

Intent

Run the Windows build glue and both overlays' runtime-dir host tests in CI on hosted runners (#2642), folding in #2645, #2648 and #2651.

Findings Addressed

  • overlay-host-tests was gated on the rocm/windows_build filters, which do not match rocm_overlay.py, rocm_overlay_test.sh, allocator_ownership_test.{sh,cpp} or the Makefile targets it runs, so an edit to the test itself could merge untested. It takes about 16 s and needs no Rust toolchain, so it now runs unconditionally like python-tooling (HIGH, 1558459)
  • windows_build did not include the MLX pin (src/lib/mlxcelverse/CMakeLists.txt). A pin bump changes what the Windows rocm check compiles and rocm-build is parked, so a breaking bump would merge green and redden the next unrelated PR (MEDIUM, 1558459)

Remaining Items

  • windows-build does not run when only its own definition in ci.yml changes, and the ci:full label it documents does not exist in the repository. This follows the fix(ci): skip self-hosted jobs for pull requests from forks #2645 convention; a maintainer needs to create the label (MEDIUM)
  • The Windows run of the tests/ Python suites is gated on windows_build, so a tests/ change that breaks on Windows surfaces later on an unrelated PR. A small ungated Windows job for the Python suites would close it (MEDIUM)
  • windows_build covers three files of overlays/rocm, while the check compiles the whole HIP overlay. Widening it costs a 15-20 min hosted run on every ROCm overlay PR; left as a cost decision (MEDIUM)
  • Three pure-text/pure-Python tests are skipped on Windows along with the bash ones (test_makefile_dev_test_stack text checks, HardwareTagTests.test_python_harness_tags_the_host_identically); Linux still runs them (LOW)

Verification

  • All stated requirements implemented
  • No placeholder/mock code remaining
  • Integrated into project code flow
  • Project conventions followed
  • Existing modules reused where applicable
  • No unintended structural changes
  • Tests pass (local: tests/ suites 188 run, 76 skipped; both host tests with ROCm clang++. CI on 1558459: overlay host tests and workflow lint green)

@inureyes

Copy link
Copy Markdown
Member Author

Security and performance review of the two new jobs (overlay-host-tests, windows-build). No CRITICAL or HIGH findings, so no commits were pushed.

Checked and clean:

  • Workflow injection: no github.event value reaches a run: script. The ci:full label lookup is only in if:, and THEROCK_* reach the shell as env vars, not template expansion. The trigger is pull_request, not pull_request_target, so a fork PR runs with a read-only token and no secrets.
  • Permissions: both jobs set contents: read and check out with persist-credentials: false. No secrets are referenced.
  • Action pinning: actions/checkout@v7, actions/cache/{restore,save}@v6 and dtolnay/[email protected] match the tag pinning used elsewhere in ci.yml.
  • Archive integrity and cache poisoning: the sha256 is pinned, the check runs after a cache restore as well as after a download, and the save runs only after the check passes. A PR (fork or not) can write only to its own refs/pull/N/merge scope, which main and other PRs never restore from, and the key contains the digest.
  • Tar extraction: the input is the digest-pinned AMD tarball, GNU tar strips leading / and rejects .. members by default, and the target is a fresh directory on an ephemeral runner.

LOW, left as is:

  • Cache pressure: the repository already holds about 10.4 GB of caches (three PR-scoped cargo-pp-ci entries at 2.5 GB each), and this PR adds a 1.6 GB entry in its PR scope. After merge, the main push saves the entry in main scope (this PR touches gated scripts/mlxcelverse/*_runtime_dir_test.sh), and later PRs restore it from there. If LRU eviction ever drops the main entry, every gated PR saves its own 1.6 GB copy until a main push matches the filter again. Restricting the save to refs/heads/main would prevent that, but every PR before the first main save would then download the tarball, which the issue rules out. Worth watching, not worth changing now.
  • Fork cost: a fork PR that touches a gated path such as build.rs runs the 15 to 20 minute Windows job without a label. The repository is public, so hosted minutes are free, and first-time contributors already need approval before workflows run.
  • The advisory warning says the label "applies to same-repository PRs only", but for windows-build it applies to fork PRs too, as the YAML comment above self-hosted-gate-advisory says. This is wording only.

The windows-build docs say the job also runs when a PR carries ci:full, but the repository defines no such label, so only the path filter starts the job today. State that in CONTRIBUTING.md and the CI row of docs/installation.md. Neither file is in the windows_build filter, so this push does not start the Windows job.

Refs #2642
@inureyes inureyes added status:done Completed and removed status:review Under review labels Oct 26, 2026
@inureyes
inureyes merged commit cbe7919 into main Oct 26, 2026
31 checks passed
@inureyes
inureyes deleted the feature/issue-2642-windows-ci branch October 26, 2026 23:35
@inureyes inureyes added this to the 0.8 milestone Nov 30, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area:core mlxcel-core: MLX FFI, primitives, KV cache, layers platform:windows Windows (native) specific priority:medium Medium priority status:done Completed type:chore Maintenance tasks (build, CI, etc.)

Projects

None yet

Development

Successfully merging this pull request may close these issues.

chore: Add Windows build CI and run the ROCm runtime-dir host test

1 participant