Skip to content

[HIP] [JIT] Add Windows support - #2699

Merged
gyohuangxin merged 3 commits into
ROCm:mainfrom
0xDELUXA:initial-windows-support
Oct 8, 2026
Merged

gyohuangxin merged 3 commits into
ROCm:mainfrom
0xDELUXA:initial-windows-support

Conversation

@0xDELUXA

@0xDELUXA 0xDELUXA commented Apr 11, 2026 •

Copy link
Copy Markdown
Contributor

Motivation

aiter has no Windows support: __init__.py force-enables AITER_TRITON_ONLY on win32, and the JIT layer assumes Linux-only tooling (rocminfo, libamdhip64.so, /dev/null, rm -rf, ELF linker flags). This wires the JIT and Python layers up to the Windows ROCm stack so CK- and HIP-based ops compile and run there.

Technical Details

Toolchain discovery - ROCm tools ship as .exe/.bat wrappers on Windows, so executable lookup goes through a suffix-aware _find_executable, and _find_rocm_home falls back to HIP_PATH. get_cxx_compiler returns hipcc, the only compiler on Windows that can build both the .cpp and .hip sources.

GPU info - chip_info uses hipinfo in place of rocminfo, with a parser per output format, and loads the version-suffixed amdhip64*.dll. --offload-arch=native shells out to offload-arch, which cannot detect the GPU on Windows, so native resolves via _detect_native() instead.

Build system - ELF/GNU-ld-only flags (-fPIC, -mcmodel=large, --gc-sections, -fvisibility=*, _GLIBCXX_USE_CXX11_ABI) are excluded on Windows; _ninja_path escapes drive-letter colons, which ninja otherwise reads as rule separators; PE links against pythonXYZ.lib; -D_USE_MATH_DEFINES is added since the UCRT only declares M_SQRT2 & friends under it. compile_lib drives hipcc with ninja instead of make.

Stale-lock fix - FileBaton._pid_alive no longer probes with os.kill(pid, 0) on Windows: CPython maps that onto TerminateProcess, so the liveness check would kill the very builder it was checking on.

Several shell idioms are also replaced with portable equivalents that are more robust on Linux too: os.system("rm -rf"), os.popen("cat /proc/sys/kernel/numa_balancing"), echo ... | hipcc -, and the shelled-out hipcc and hipconfig calls in csrc/cpp_itfs/utils.py.

check_LLVM_MAIN_REVISION needed more than the shell change. Its probe relies on CTAD, and at hipcc's default standard on Windows it failed on a template-argument error rather than on the __host__ __device__ rule it is meant to measure, so the function returned the same value whatever the toolchain did. The probe is now pinned to -std=c++20, the standard the modules are built with. On Linux clang already defaults to gnu++17, so the answer there is unchanged.

arch_info.get_arch() now probes Triton on first call instead of at import. Since #5590 the flash-attention Triton backend imports tuned_config_utils, which imports arch_info, so importing it on a host with no GPU driver raised and then fell through to the jax fallback. This is what fails the Windows Smoke Test on main.

Test Plan

Windows 11, RDNA4, TheRock ROCm 7, Python 3.12. Each op runs in its own subprocess against a torch reference, both from the repo and from a pip install .'d wheel.

Test Result

Op Result
rms_norm OK
rmsnorm2d_fwd OK
silu_and_mul OK
topk_softmax OK
rotary_embedding_fwd OK

import aiter builds and loads the full CK/HIP path - previously Windows exited before any op was loaded.

Not covered: ops whose modules run a CK-tile blob generator (layernorm2d, the CK GEMMs, flash-attn). Those generators emit hundreds of specializations and dominate build time on Linux equally, so this is not a Windows-specific gap, but that path is untested here.

Submission Checklist

@github-actions

Copy link
Copy Markdown
Contributor

🏷️ CI Guide

Runs automatically on every PR:

  • ✅ Pre-checks (submodule verification, code formatting)
  • ✅ Aiter op tests (gfx942 + gfx950)
  • ✅ Triton tests (only when aiter/ops/triton/** or related paths are changed)

Extended tests (opt-in via labels):

Label Tests
ci:triton-355 Run Triton tests on MI355 in addition to MI325
ci:sglang SGLang integration tests
ci:atom ATOM benchmark (DeepSeek-R1 + GPT-OSS)
ci:vllm vLLM benchmark
ci:all All of the above

Add labels via the sidebar or gh pr edit 2699 --add-label <label>

@0xDELUXA
0xDELUXA force-pushed the initial-windows-support branch from bfa96cd to 6d207b9 Compare April 11, 2026 10:13
@brunomazzottiamd

Copy link
Copy Markdown
Contributor

Hello @0xDELUXA, thanks for your PR to AITER!

I think it's fair to say this is a big change and we should add other AITER maintainers to the discussion. Can you please file a new feature request issue? You can link this PR as an initial draft and we can proceed with the discussion in the issue. We need to get support from more people and at least have an implementation plan if the idea is approved by AITER technical leadership team.

FYI: @valarLip + @carlushuang

@zufayu
zufayu requested a review from valarLip June 26, 2026 08:58
@zufayu
zufayu removed the request for review from valarLip July 13, 2026 02:23
@astrelsky

Copy link
Copy Markdown

Hello @0xDELUXA, thanks for your PR to AITER!

I think it's fair to say this is a big change and we should add other AITER maintainers to the discussion. Can you please file a new feature request issue? You can link this PR as an initial draft and we can proceed with the discussion in the issue. We need to get support from more people and at least have an implementation plan if the idea is approved by AITER technical leadership team.

FYI: @valarLip + @carlushuang

This is not an idea, this is fundamental support for a package AMD is pushing to make a requirement for things like flash-attention. Not supporting an operating system that is currently fully supported by rocm is completely unacceptable.

Forgive me for being rude but @stellaraccident @ScottTodd is it time to start pushing AMD consumers of rocm for Windows support? I'm getting really tired of having to fight this everywhere. I can only speak for myself, but it's unimaginably frustrating as a consumer to not only have to put in so much work to get things functional, but then also to watch others put in the same or more effort just to have AMD turn around and refuse or stall the contributions enabling support.

@stellaraccident

stellaraccident commented Jul 26, 2026 •

Copy link
Copy Markdown

Hello @0xDELUXA, thanks for your PR to AITER!
I think it's fair to say this is a big change and we should add other AITER maintainers to the discussion. Can you please file a new feature request issue? You can link this PR as an initial draft and we can proceed with the discussion in the issue. We need to get support from more people and at least have an implementation plan if the idea is approved by AITER technical leadership team.
FYI: @valarLip + @carlushuang

This is not an idea, this is fundamental support for a package AMD is pushing to make a requirement for things like flash-attention. Not supporting an operating system that is currently fully supported by rocm is completely unacceptable.

Forgive me for being rude but @stellaraccident @ScottTodd is it time to start pushing AMD consumers of rocm for Windows support? I'm getting really tired of having to fight this everywhere. I can only speak for myself, but it's unimaginably frustrating as a consumer to not only have to put in so much work to get things functional, but then also to watch others put in the same or more effort just to have AMD turn around and refuse or stall the contributions enabling support.

No offense taken.

@brunomazzottiamd this isn't a very complicated change. Pretty bread and butter for windows support stuff. Please have the owners ping me internally to discuss. In general, we do not reject platform support PRs like this or subject them to this level of ceremony.

@ROCm/rocm-genies can you please do diligence on this and help me figure out the way to clear it to land and get at least a minimal ci job with it.

@0xDELUXA
0xDELUXA force-pushed the initial-windows-support branch from 989d35c to 4b15337 Compare July 27, 2026 13:33
@0xDELUXA
0xDELUXA marked this pull request as ready for review July 27, 2026 13:33
@0xDELUXA
0xDELUXA requested a review from a team July 27, 2026 13:33
@0xDELUXA

0xDELUXA commented Jul 27, 2026 •

Copy link
Copy Markdown
Contributor Author

No offense taken.

@brunomazzottiamd this isn't a very complicated change. Pretty bread and butter for windows support stuff. Please have the owners ping me internally to discuss. In general, we do not reject platform support PRs like this or subject them to this level of ceremony.

@ROCm/rocm-genies can you please do diligence on this and help me figure out the way to clear it to land and get at least a minimal ci job with it.

@stellaraccident Thank you very much!

I've pushed a rebase onto current main.

Worth noting how much smaller it got. In the ~3.5 months this sat, main independently converged on several things the original PR was introducing, so those became redundant and are now gone.

@0xDELUXA
0xDELUXA force-pushed the initial-windows-support branch 2 times, most recently from 8664211 to 18add7c Compare July 27, 2026 13:59
@0xDELUXA 0xDELUXA changed the title Add initial Windows support Add Windows support Jul 27, 2026
@astrelsky

Copy link
Copy Markdown

Hello @0xDELUXA, thanks for your PR to AITER!
I think it's fair to say this is a big change and we should add other AITER maintainers to the discussion. Can you please file a new feature request issue? You can link this PR as an initial draft and we can proceed with the discussion in the issue. We need to get support from more people and at least have an implementation plan if the idea is approved by AITER technical leadership team.
FYI: @valarLip + @carlushuang

This is not an idea, this is fundamental support for a package AMD is pushing to make a requirement for things like flash-attention. Not supporting an operating system that is currently fully supported by rocm is completely unacceptable.

Forgive me for being rude but @stellaraccident @ScottTodd is it time to start pushing AMD consumers of rocm for Windows support? I'm getting really tired of having to fight this everywhere. I can only speak for myself, but it's unimaginably frustrating as a consumer to not only have to put in so much work to get things functional, but then also to watch others put in the same or more effort just to have AMD turn around and refuse or stall the contributions enabling support.

No offense taken.

@brunomazzottiamd this isn't a very complicated change. Pretty bread and butter for windows support stuff. Please have the owners ping me internally to discuss. In general, we do not reject platform support PRs like this or subject them to this level of ceremony.

@ROCm/rocm-genies can you please do diligence on this and help me figure out the way to clear it to land and get at least a minimal ci job with it.

Thank you.

@zufayu
zufayu requested a review from valarLip July 28, 2026 01:44
@0xDELUXA

0xDELUXA commented Aug 9, 2026

Copy link
Copy Markdown
Contributor Author

@brunomazzottiamd @valarLip @schung-amd Could I ask if there have been any updates over the past two weeks? I just wanted to check in since I haven’t received any feedback yet. Thank you!

@schung-amd

Copy link
Copy Markdown

We intend to merge and provision hardware for Windows CI as well as ongoing support.

@valarLip

Copy link
Copy Markdown
Collaborator

this one still activite or not?

@0xDELUXA

0xDELUXA commented Aug 27, 2026 •

Copy link
Copy Markdown
Contributor Author

this one still activite or not?

It is. I just couldn't keep rebasing after every single commit upstream when this PR hasn't gotten a review comment in four months. I know the maintainers are really overwhelmed and that some users keep opening low-quality AI-generated PRs, but a single “this is bad, close it” comment would still be better than no comment at all.

@0xDELUXA
0xDELUXA force-pushed the initial-windows-support branch from 18add7c to 571dcd0 Compare August 27, 2026 12:04
@github-actions github-actions Bot changed the title Add Windows support [HIP] [JIT] [Build] Add Windows support Aug 27, 2026
@0xDELUXA
0xDELUXA force-pushed the initial-windows-support branch from 571dcd0 to 71182f9 Compare August 27, 2026 13:34
@0xDELUXA
0xDELUXA force-pushed the initial-windows-support branch from 71182f9 to 855cfcf Compare September 8, 2026 12:30
@0xDELUXA
0xDELUXA force-pushed the initial-windows-support branch from 855cfcf to 78264d4 Compare September 11, 2026 12:43
@0xDELUXA
0xDELUXA force-pushed the initial-windows-support branch from 628c98d to 9bd0ae3 Compare September 25, 2026 14:20
@Boss2002n Boss2002n changed the title [Triton/Gluon] [HIP] [JIT] Add Windows support [HIP] [JIT] Add Windows support Sep 28, 2026
@0xDELUXA

0xDELUXA commented Sep 29, 2026 •

Copy link
Copy Markdown
Contributor Author

The latest CI run on 9bd0ae3 confirms the torch.compile fix: test_fav3_sage_compile passes 17/17 on both MI35X and MI300X. The remaining red checks are unrelated to this PR.

@stellaraccident

Copy link
Copy Markdown

@ROCm/rocm-genies hey guys, can you all pop this to the top of your queue and work with @sunway513's team to get this landed. We're celebrating this PR's 6 month anniversary. Need to get this in.

@0xDELUXA

0xDELUXA commented Oct 7, 2026

Copy link
Copy Markdown
Contributor Author

@zufayu The failing jobs look unrelated. The Atom accuracy jobs fail on ImportError: cannot import name 'make_fp4_mqa_plan' from 'aiter.ops.flydsl' (and a missing aiter.ops.triton.fusions.mhc_fused_post_pre_delayed_rmsnorm), because the branch predates #6145 while ATOM main already imports those; the squash merge onto current main has them. Flash Attention - Triton / MI35X hits the same memory access fault at [235/380] glm47fp8-tp4 ... d=53 bwd_varlen as other open PRs (e.g. runs 37551524904 and 37512893419). Triton Tests (MI35X) / Shard 3 failed on Artifact not found for name: triton_shards before running any tests. Happy to rebase if a fresh CI run is wanted.

@gyohuangxin
gyohuangxin merged commit b1cdc19 into ROCm:main Oct 8, 2026
52 checks passed
@zufayu

zufayu commented Oct 8, 2026

Copy link
Copy Markdown
Contributor

@0xDELUXA — thanks for seeing this through; six months is a long time to keep a PR alive, and the final version is a careful piece of work. It's merged as b1cdc19eb.

We're now standing up Windows CI for aiter, and there's one gap where you're by far the best-placed person to help.

Your test plan was TheRock ROCm 7 + Python 3.12. The CI runners we've been allocated (windows-gfx1201-gpu-rocm, validated in #6242) have no ROCm toolchain preinstalled, so we plan to install it from the ROCm pip index instead — which means the combination CI will actually run is ROCm 10.1 + Python 3.13, not the one you validated.

I've checked the pieces statically and they look right: the rocm-sdk-devel 10.1.0 win_amd64 wheel ships the full toolchain (hipcc.exe, amdclang++.exe, amdlld.exe, amdhip64_7.dll, the import libs), and _find_rocm_home() already prefers site-packages/_rocm_sdk_devel/ since #3264, so no HIP_PATH should be needed. But nobody has actually compiled aiter on that combination.

If you still have the RDNA4 machine set up, would you be willing to re-run your five ops against it? In a fresh venv:

pip install --index-url https://stable.repo.amd.com/rocm/whl-next/ `
            --extra-index-url https://pypi.org/simple `
            "torch[device-gfx1201]==2.14.0+rocm10.1.0" "rocm[devel]==10.1.0"

then rms_norm, rmsnorm2d_fwd, silu_and_mul, topk_softmax, rotary_embedding_fwd as before.

What would help most is knowing whether it works at all, and if not, where it breaks — ROCm 10.1 vs 7 is a large jump in HIP version, and a toolchain discovered from site-packages is a different shape from a TheRock install tree. Either answer is useful; a failure found on your machine is much cheaper than one found in CI.

No obligation, and no rush — if you'd rather not, we'll find it ourselves on the runners. Also happy to hear if you think ROCm 7 via TheRock is the safer target for CI to start with; you've spent more time on this stack than we have.

One small thing I noticed while reading through, unrelated to the above: chip_info.py:570 does a bare from cpp_extension import _find_rocm_home, which only resolves because jit/core.py:23 inserts jit/utils/ onto sys.path. It works today but is order-dependent. I'll send a small PR unless you'd prefer to.

@zufayu

zufayu commented Oct 8, 2026

Copy link
Copy Markdown
Contributor

One more ask, and this one may be easier than the last.

Your test plan says each op runs in its own subprocess against a torch reference, both from the repo and from a pip install .'d wheel. Would you be willing to contribute that harness to the repo?

We need exactly that for CI. Right now there is no committed test covering any of the five ops — #2699 touched op_tests/ only to add a single line to test_jit_cache_transaction.py — so a future change could break the Windows path silently and nothing would catch it. Having your harness, rather than something we rewrite from scratch, means the CI check matches what you actually validated rather than our reconstruction of it.

It would also fold neatly into the ROCm 10.1 request above: same script, new toolchain, and we'd get both the harness and the answer in one go.

If the script is rough, that's fine — we can clean it up on our side. Happy to review it as a PR, or to take it as a gist and open the PR ourselves with you credited.

@0xDELUXA

0xDELUXA commented Oct 8, 2026 •

Copy link
Copy Markdown
Contributor Author

@zufayu Both done, in #6273.

ROCm 10.1 + Python 3.13 works, with one bug and one setup step found along the way.

The bug: ops using ffi_type="ctypes" could not load on Windows, because visibility("default") exports nothing from a PE DLL. That hits every ctypes op, rmsnorm2d_fwd among them; the PR fixes the four export sites.

The setup step: the rocm-sdk-devel wheel ships the toolchain as _devel.tar, and _rocm_sdk_devel/ only exists after rocm-sdk init. Without it aiter falls back to Triton-only with a warning that points at HIP_PATH. The PR makes it point at rocm-sdk init instead.

With that, all five ops pass on torch 2.14.0+rocm10.1.0 / rocm[devel] 10.1.0 / Python 3.13, both from the repo and from a pip install .'d wheel, with no HIP_PATH. The toolchain is found from site-packages as expected. The card here is gfx1200, so it ran with torch[device-gfx1200]; the toolchain is identical.

The harness is op_tests/test_jit_ops_smoke.py in the same PR, rewritten as pytest. A CI job on the new runner would need roughly:

pip install --index-url https://stable.repo.amd.com/rocm/whl-next/ --extra-index-url https://pypi.org/simple "torch[device-gfx1201]==2.14.0+rocm10.1.0" "rocm[devel]==10.1.0"
rocm-sdk init
pip install triton-windows numpy pandas pytest einops pybind11 ninja
git submodule update --init --depth 1 3rdparty/composable_kernel
pytest op_tests/test_jit_ops_smoke.py

flydsl has no Windows wheel, so requirements.txt cannot be installed as is. The first run takes about 6 minutes for the JIT builds; with the build cached it is under a minute.

The pip route seems like the right CI target to me: nothing to preinstall on the runner, and it is how ROCm torch is distributed on Windows now.

On chip_info.py:570: hoisting it would not change anything. chip_info.py:16 already imports cpp_extension the same way at module level, so the module only imports at all with jit/utils on sys.path. The csrc/*/gen_instances.py codegen scripts depend on those bare imports, since they run with jit/utils on the path rather than as part of the package. Switching to package imports would need to cover all of jit/utils and those scripts together. That seems better as its own change than as a one-line fix.

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

Projects

None yet

Development

Successfully merging this pull request may close these issues.

10 participants