Skip to content

[ROCm][Windows] Install aotriton_v2.dll and liblzma.dll into scikit-build ROCm wheels - #200931

Closed
ethanwee1 wants to merge 3 commits into
pytorch:mainfrom
ROCm:ethanwee1-win-rocm-aotriton-liblzma
Closed

ethanwee1 wants to merge 3 commits into
pytorch:mainfrom
ROCm:ethanwee1-win-rocm-aotriton-liblzma

Conversation

@ethanwee1

@ethanwee1 ethanwee1 commented Oct 14, 2026 •

Copy link
Copy Markdown
Contributor

When Flash Attention is built on Windows, torch_hip.dll needs aotriton_v2.dll and its liblzma.dll dependency. aotriton's ExternalProject generates these into torch/lib/ during the build (after CMake configure) with no install rule, so scikit-build-core omits them from the wheel and import torch fails with WinError 126.

This adds CMake install rules for both DLLs with OPTIONAL, so the existence check runs at install time, after the build has produced them. A configure-time EXISTS guard would be false and silently drop them. Flash-Attention-off and non-ROCm builds are unaffected because the files won't exist at install time. It replaces the temporary force-include TheRock carries.

Validation: https://github.com/ROCm/TheRock/actions/runs/38930228545 built a Windows ROCm wheel (gfx1100, py3.12) from release/2.14 with this change cherry-picked (ROCm#3835, identical cmake) and with TheRock's aotriton/liblzma force-include removed (ROCm/TheRock#9058), so the DLLs could only ship via this rule. Build and the import torch sanity check passed. The earlier EXISTS-guarded revision failed that check with WinError 126 (https://github.com/ROCm/TheRock/actions/runs/38924233036).

Related PR:

Fixes ROCm/TheRock#6965
Supported by @jeffdaily

Tracked in AIPYTORCH-1516.

cc @jeffdaily @sunway513 @jithunnair-amd @pruthvistony @ROCmSupport @jataylo @hongxiayang @naromero77amd @pragupta @jerrymannil @xinyazhang

@pytorch-bot

pytorch-bot Bot commented Oct 14, 2026 •

Copy link
Copy Markdown

🔗 Helpful Links

🧪 See artifacts and rendered test results at hud.pytorch.org/pr/200931

Note: Links to docs will display an error until the docs builds have been completed.

✅ You can merge normally! (4 Unrelated Failures)

As of commit ca4d250 with merge base 09cc6ff (image):

FLAKY - The following jobs failed but were likely due to flakiness present on trunk:

BROKEN TRUNK - The following job failed but were present on the merge base:

👉 Rebase onto the `viable/strict` branch to avoid these failures

This comment was automatically generated by Dr. CI and updates every 15 minutes.

@pytorch-bot pytorch-bot Bot added the module: rocm AMD GPU support for Pytorch label Oct 14, 2026
@jithunnair-amd jithunnair-amd added ciflow/trunk Trigger trunk jobs on your pull request ciflow/binaries_wheel Trigger binary build and upload jobs for wheel on the PR keep-going Don't stop on first failure, keep running tests until the end labels Oct 14, 2026

@ScottTodd ScottTodd left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM from the perspective of ROCm on Windows

When Flash Attention is built on Windows, aotriton ExternalProject drops
aotriton_v2.dll and its liblzma.dll dependency into torch/lib/ with no
install() rule, so scikit-build-core omits them and torch_hip.dll fails
to load (WinError 126). Install both when present, mirroring the
libiomp5md.dll / uv.dll handling. EXISTS-guarded, so non-ROCm and
Flash-Attention-off builds are unaffected.

Fixes ROCm/TheRock#6965
@ethanwee1
ethanwee1 force-pushed the ethanwee1-win-rocm-aotriton-liblzma branch from a04603f to 3c30082 Compare October 15, 2026 16:09
@pytorch-bot

pytorch-bot Bot commented Oct 15, 2026 •

Copy link
Copy Markdown

Workflows were awaiting approval. CI has now been triggered for the ciflow labels on this PR.

…packaged

aotriton's ExternalProject produces aotriton_v2.dll/liblzma.dll in torch/lib
during the build, after configure. The configure-time EXISTS guard was false,
so the install rules never registered and the DLLs were dropped from the wheel
(WinError 126 loading torch_hip.dll). OPTIONAL defers the existence check to
install time, after the build has generated them.
@jeffdaily

Copy link
Copy Markdown
Collaborator

My agent came up with this analysis, but I've read and approved it.

Switching to install(FILES ... OPTIONAL) looks like the right fix for the WinError 126 from the earlier EXISTS version, since the DLLs only appear after configure. Two things before merge: please update the PR body (it still describes an EXISTS guard), and link a TheRock Windows wheel run built from this head with the aotriton/liblzma force-includes removed, showing import torch succeeds. The runs currently linked predate this change and still had the force-includes, so they don't exercise the new install rule.

pytorchmergebot pushed a commit that referenced this pull request Oct 16, 2026
…heels (#191629)

After the scikit-build-core wheel migration, the Windows ROCm wheel drops `torch/lib/libomp140.x86_64.dll`, which TheRock stages for MSVC OpenMP. This installs it via CMake when present, mirroring the existing `libiomp5md.dll` / `uv.dll` handling. TheRock copies the DLL into `torch/lib/` before CMake configure, so the `EXISTS` guard sees it, and non-ROCm builds are unaffected. It replaces the temporary force-include TheRock carries.

Validation: https://github.com/ROCm/TheRock/actions/runs/38930228545 built a Windows ROCm wheel (gfx1100, py3.12) from release/2.14 with this change cherry-picked (ROCm#3835, `268bf8ed4be`); build and the `import torch` sanity check passed. TheRock still force-includes libomp140 in that build, so it confirms no regression rather than exercising this rule in isolation.

Related PR:
- #191629: install `libomp140.x86_64.dll` via CMake (this PR)
- #200931: install `aotriton_v2.dll` + `liblzma.dll` via CMake
- ROCm/TheRock#9055: drop the `_rocm_init.py` wheel force-include
- ROCm/TheRock#9058: drop the `aotriton_v2.dll` + `liblzma.dll` wheel force-includes
- ROCm#3835: release/2.14 cherry-pick of #191629 + #200931
- ROCm#3836: release/2.15 cherry-pick of #191629 + #200931
- Issue: ROCm/TheRock#6965

Fixes ROCm/TheRock#6965
Supported by @jeffdaily

Tracked in AIPYTORCH-1516.

Pull Request resolved: #191629
Approved by: https://github.com/jithunnair-amd, https://github.com/ScottTodd, https://github.com/jeffdaily
@jeffdaily jeffdaily added the release notes: rocm mandatorylabel label Oct 16, 2026
@jeffdaily

Copy link
Copy Markdown
Collaborator

@pytorchbot merge -i

@pytorchmergebot

Copy link
Copy Markdown
Collaborator

Merge started

Your change will be merged while ignoring the following 5 checks: pull / linux-jammy-aarch64-py3.11-clang21 / build, trunk / macos-py3-arm64 / test (default, 1, 3, macos-m1-stable), linux-aarch64-binary-manywheel / manywheel-cuda-aarch64-cu134-build, linux-aarch64-binary-manywheel / manywheel-cuda-aarch64-cu132-build, linux-aarch64-binary-manywheel / manywheel-cuda-aarch64-cu130-build

Learn more about merging in the wiki.

Questions? Feedback? Please reach out to the PyTorch DevX Team

Advanced Debugging
Check the merge workflow status
here

Both PRs add a Windows DLL install block at the same spot in cmake/PostBuildSteps.cmake. Keep both: the aotriton_v2/liblzma OPTIONAL install from this PR, then the libomp140 install from pytorch#191629, the same order as the release/2.14 cherry-pick (#3835).

Test Plan: a standalone CMake project that includes the resolved if(WIN32 AND BUILD_PYTHON) block, with the FA DLLs generated at build time by a custom target, configured, built and installed with Ninja: all three DLLs installed when present; only the FA DLLs when libomp140 is absent; nothing and no error when none exist.

Authored with Claude.
@jeffdaily

Copy link
Copy Markdown
Collaborator

@pytorchbot merge -i

@pytorchmergebot

Copy link
Copy Markdown
Collaborator

Merge failed

Reason: New commits were pushed while merging. Please rerun the merge command.

Details for Dev Infra team

Raised by workflow job

@pytorchmergebot

Copy link
Copy Markdown
Collaborator

Merge started

Your change will be merged while ignoring the following 0 checks:

Learn more about merging in the wiki.

Questions? Feedback? Please reach out to the PyTorch DevX Team

Advanced Debugging
Check the merge workflow status
here

@pytorchmergebot

Copy link
Copy Markdown
Collaborator

Merge failed

Reason: 1 jobs have failed, first few of them are: trunk / linux-noble-rocm-py3.11-mi350 / test (default, 8, 8, linux.rocm.gpu.mi350.dpx.1)

Details for Dev Infra team

Raised by workflow job

ethanwee1 added a commit to ROCm/TheRock that referenced this pull request Oct 19, 2026
…w upstream) (#9058)

## Problem
TheRock force-includes `aotriton_v2.dll` and its `liblzma.dll`
dependency into the Windows ROCm wheel as a scikit-build-core
workaround. pytorch/pytorch#200931 installs them via CMake instead, so
the force-include becomes redundant.

## Changes
Remove the `aotriton_v2.dll` + `liblzma.dll` force-includes from
`build_prod_wheels.py`. The `libomp140.x86_64.dll` force-include stays
until its own follow-up.

## Validation
https://github.com/ROCm/TheRock/actions/runs/38930228545 ran this PR's
head (`429936c345`) against release/2.14 with the install rule
cherry-picked (ROCm/pytorch#3835). With the force-include gone, the DLLs
could only ship via the CMake rule; build and the `import torch` sanity
check passed.

Merge only after pytorch/pytorch#200931 is on main and ROCm/pytorch#3835
/ ROCm/pytorch#3836 are on release/2.14 / release/2.15; any
scikit-build-core branch without the install rule would lose the DLLs
(WinError 126). release/2.13 uses setuptools and is unaffected. Merges
cleanly alongside #9055.

Related PR:
- pytorch/pytorch#191629: install `libomp140.x86_64.dll` via CMake
- pytorch/pytorch#200931: install `aotriton_v2.dll` + `liblzma.dll` via
CMake
- #9055: drop the `_rocm_init.py` wheel force-include
- #9058: drop the `aotriton_v2.dll` + `liblzma.dll` wheel
force-includes (this PR)
- ROCm/pytorch#3835: release/2.14 cherry-pick of pytorch/pytorch#191629
+ pytorch/pytorch#200931
- ROCm/pytorch#3836: release/2.15 cherry-pick of pytorch/pytorch#191629
+ pytorch/pytorch#200931
- Issue: #6965

Tracked in AIPYTORCH-1516.
@ethanwee1

Copy link
Copy Markdown
Contributor Author

Failed trunk job ran no tests. The MI350 runner pod never came online ("Pending: backoff timeout") and every step errored out. It passed on rerun (job 117284075918).

@ethanwee1

Copy link
Copy Markdown
Contributor Author

@pytorchbot merge

@pytorchmergebot

Copy link
Copy Markdown
Collaborator

Merge started

Your change will be merged once all checks pass (ETA 0-4 Hours).

Learn more about merging in the wiki.

Questions? Feedback? Please reach out to the PyTorch DevX Team

Advanced Debugging
Check the merge workflow status
here

jeffdaily pushed a commit to ROCm/pytorch that referenced this pull request Oct 20, 2026
… libomp140 (#3835)

Cherry-picks the two upstream Windows ROCm wheel DLL install fixes onto
`release/2.14` (scikit-build-core backend): `aotriton_v2.dll` +
`liblzma.dll` (pytorch#200931) and `libomp140.x86_64.dll`
(pytorch#191629). Without them, once TheRock's temporary
force-includes are removed the DLLs drop out of the wheel and `import
torch` fails with WinError 126.

The aotriton/liblzma install uses `OPTIONAL` so the existence check runs
at install time, because aotriton's ExternalProject only generates those
DLLs during the build.

### Validation
https://github.com/ROCm/TheRock/actions/runs/38930228545 built this
branch's head (`268bf8ed4be`) with ROCm/TheRock#9058 (aotriton/liblzma
force-include removed), so those DLLs could only ship via the install
rule. Build and the `import torch` sanity check passed.

Related PR:
- pytorch#191629: install `libomp140.x86_64.dll` via CMake
- pytorch#200931: install `aotriton_v2.dll` + `liblzma.dll` via
CMake
- ROCm/TheRock#9055: drop the `_rocm_init.py` wheel force-include
- ROCm/TheRock#9058: drop the `aotriton_v2.dll` + `liblzma.dll` wheel
force-includes
- ROCm/TheRock#9360: drop the `libomp140.x86_64.dll` wheel force-include
- #3835: release/2.14 cherry-pick of pytorch#191629
+ pytorch#200931 (this PR)
- #3836: release/2.15 cherry-pick of pytorch#191629
+ pytorch#200931
- Issue: ROCm/TheRock#6965

Tracked in AIPYTORCH-1516.
jeffdaily pushed a commit to ROCm/pytorch that referenced this pull request Oct 20, 2026
… libomp140 (#3836)

Cherry-picks the two upstream Windows ROCm wheel DLL install fixes onto
`release/2.15` (scikit-build-core backend): `aotriton_v2.dll` +
`liblzma.dll` (pytorch#200931) and `libomp140.x86_64.dll`
(pytorch#191629). Without them, once TheRock's temporary
force-includes are removed the DLLs drop out of the wheel and `import
torch` fails with WinError 126.

The aotriton/liblzma install uses `OPTIONAL` so the existence check runs
at install time, because aotriton's ExternalProject only generates those
DLLs during the build.

### Validation
Branch merged with current `release/2.15` (now includes
`related_commits` from #3816). Windows ROCm wheel build
(gfx1100, py3.12) on this head (`a119523c5bc`) with ROCm/TheRock#9360,
which passes no force-include flags, so every DLL can only ship via
CMake install: https://github.com/ROCm/TheRock/actions/runs/39287495719.
Build and the `import torch` sanity check passed.

Related PR:
- pytorch#191629: install `libomp140.x86_64.dll` via CMake
- pytorch#200931: install `aotriton_v2.dll` + `liblzma.dll` via
CMake
- ROCm/TheRock#9055: drop the `_rocm_init.py` wheel force-include
- ROCm/TheRock#9058: drop the `aotriton_v2.dll` + `liblzma.dll` wheel
force-includes
- ROCm/TheRock#9360: drop the `libomp140.x86_64.dll` wheel force-include
- #3835: release/2.14 cherry-pick of pytorch#191629
+ pytorch#200931
- #3836: release/2.15 cherry-pick of pytorch#191629
+ pytorch#200931 (this PR)
- Issue: ROCm/TheRock#6965

Tracked in AIPYTORCH-1516.
jithunnair-amd pushed a commit to ROCm/pytorch that referenced this pull request Nov 4, 2026
… libomp140 (#3836)

Cherry-picks the two upstream Windows ROCm wheel DLL install fixes onto
`release/2.15` (scikit-build-core backend): `aotriton_v2.dll` +
`liblzma.dll` (pytorch#200931) and `libomp140.x86_64.dll`
(pytorch#191629). Without them, once TheRock's temporary
force-includes are removed the DLLs drop out of the wheel and `import
torch` fails with WinError 126.

The aotriton/liblzma install uses `OPTIONAL` so the existence check runs
at install time, because aotriton's ExternalProject only generates those
DLLs during the build.

### Validation
Branch merged with current `release/2.15` (now includes
`related_commits` from #3816). Windows ROCm wheel build
(gfx1100, py3.12) on this head (`a119523c5bc`) with ROCm/TheRock#9360,
which passes no force-include flags, so every DLL can only ship via
CMake install: https://github.com/ROCm/TheRock/actions/runs/39287495719.
Build and the `import torch` sanity check passed.

Related PR:
- pytorch#191629: install `libomp140.x86_64.dll` via CMake
- pytorch#200931: install `aotriton_v2.dll` + `liblzma.dll` via
CMake
- ROCm/TheRock#9055: drop the `_rocm_init.py` wheel force-include
- ROCm/TheRock#9058: drop the `aotriton_v2.dll` + `liblzma.dll` wheel
force-includes
- ROCm/TheRock#9360: drop the `libomp140.x86_64.dll` wheel force-include
- #3835: release/2.14 cherry-pick of pytorch#191629
+ pytorch#200931
- #3836: release/2.15 cherry-pick of pytorch#191629
+ pytorch#200931 (this PR)
- Issue: ROCm/TheRock#6965

Tracked in AIPYTORCH-1516.
majing921201 pushed a commit to majing921201/pytorch that referenced this pull request Nov 16, 2026
…heels (pytorch#191629)

After the scikit-build-core wheel migration, the Windows ROCm wheel drops `torch/lib/libomp140.x86_64.dll`, which TheRock stages for MSVC OpenMP. This installs it via CMake when present, mirroring the existing `libiomp5md.dll` / `uv.dll` handling. TheRock copies the DLL into `torch/lib/` before CMake configure, so the `EXISTS` guard sees it, and non-ROCm builds are unaffected. It replaces the temporary force-include TheRock carries.

Validation: https://github.com/ROCm/TheRock/actions/runs/38930228545 built a Windows ROCm wheel (gfx1100, py3.12) from release/2.14 with this change cherry-picked (ROCm#3835, `268bf8ed4be`); build and the `import torch` sanity check passed. TheRock still force-includes libomp140 in that build, so it confirms no regression rather than exercising this rule in isolation.

Related PR:
- pytorch#191629: install `libomp140.x86_64.dll` via CMake (this PR)
- pytorch#200931: install `aotriton_v2.dll` + `liblzma.dll` via CMake
- ROCm/TheRock#9055: drop the `_rocm_init.py` wheel force-include
- ROCm/TheRock#9058: drop the `aotriton_v2.dll` + `liblzma.dll` wheel force-includes
- ROCm#3835: release/2.14 cherry-pick of pytorch#191629 + pytorch#200931
- ROCm#3836: release/2.15 cherry-pick of pytorch#191629 + pytorch#200931
- Issue: ROCm/TheRock#6965

Fixes ROCm/TheRock#6965
Supported by @jeffdaily

Tracked in AIPYTORCH-1516.

Pull Request resolved: pytorch#191629
Approved by: https://github.com/jithunnair-amd, https://github.com/ScottTodd, https://github.com/jeffdaily
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bot-triaged This is a label only to be used by the auto triage bot ciflow/binaries_wheel Trigger binary build and upload jobs for wheel on the PR ciflow/trunk Trigger trunk jobs on your pull request keep-going Don't stop on first failure, keep running tests until the end Merged module: rocm AMD GPU support for Pytorch open source release notes: rocm mandatorylabel triaged This issue has been looked at a team member, and triaged and prioritized into an appropriate module

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Issue] PyTorch nightly builds are missing _rocm_init.py. Windows fails to load c10_hip.dll, Linux fails to load libMIOpen.so.1

6 participants