Repository navigation
Closed
Labels
0.kind: build failureA package fails to build
Description
Nixpkgs version
- Unstable (26.11)
Steps to reproduce
nixpkgs.config.rocmSupport = true; and build torch.
Can Hydra reproduce this build failure?
Yes, Hydra can reproduce this build failure.
Link to Hydra build job
Relevant log output
-- Generating CK kernel instances...
bash: /build/pytorch/aten/src/ATen/native/transformers/hip/flash_attn/ck/add_make_kernel_pt.sh: /bin/bash: bad interpreter: No such file or directory
CMake Error at aten/src/ATen/native/transformers/hip/flash_attn/ck/CMakeLists.txt:85 (message):
CK Tile FMHA FAILED to change make_kernel to make_kernel_pt for the fwd
passAdditional context
Patching the shebang fixes the obvious issue. It's unclear why that particular file is now broken as file and make invocation to call it are ~year old. Something in the build? configuration shifted from 2.12 -> 2.13 to invoke it.
Result of #533426
diff --git a/pkgs/development/python-modules/torch/source/default.nix b/pkgs/development/python-modules/torch/source/default.nix
index 13a39f523951..ba66325c0006 100644
--- a/pkgs/development/python-modules/torch/source/default.nix
+++ b/pkgs/development/python-modules/torch/source/default.nix
@@ -413,6 +413,9 @@ buildPythonPackage.override { inherit stdenv; } (finalAttrs: {
--replace-fail \
"#include <omp.h>" \
'#include "${lib.getInclude llvmPackages.openmp}/include/omp.h"'
+ ''
+ + ''
+ patchShebangs aten/src/ATen/native/transformers/hip/flash_attn/ck/add_make_kernel_pt.sh
'';
# NOTE(@connorbaker): Though we do not disable Gloo or MPI when building with CUDA support, caution should be taken
System metadata
- system:
"x86_64-linux" - host os:
Linux 6.18.45, NixOS, 26.11 (Zokor), 26.11pre1067334.801bef6abd86 - multi-user?:
yes - sandbox:
yes - version:
nix-env (Nix) 2.34.8 - channels(root):
"home-manager, nixos, nixos-hardware" - nixpkgs:
/nix/store/6xj2vv19x702f7fvmyjizckwlw6i1fdd-nixos/nixos
Notify maintainers
Note for maintainers: Please tag this issue in your pull request description. (i.e. Resolves #ISSUE.)
I assert that this issue is relevant for Nixpkgs
- I assert that this is a bug and not a support request.
- I assert that this is not a duplicate of an existing issue.
- I assert that I have read the NixOS Code of Conduct and agree to abide by it.
- I assert that I have read the automation/AI policy and that this issue report complies with it.
Is this issue important to you?
Add a 👍 reaction to issues you find important.
Reacted by anund, Michael Bednarek, Dan McArdle, Pixel, ccicnce113424, Antonis Kotronakis, Giovanni Bassi, Austin Horstman, Nikolas Kilian, Alastor Tenebris and 4 more
Metadata
Metadata
Assignees
Labels
0.kind: build failureA package fails to build
Activity
anund commentedon Sep 5, 2026
Just patching the shebang doesn't appear to be enough to fix the build. Limiting the rocm arch to
gfx1150to skip the 2 hour build results in the following errors:and after printing out several more completed steps this error state:
anund commentedon Sep 6, 2026
https://github.com/pytorch/pytorch/blob/07bd5cb6a00c0b220d2a144ae4c6d2b914abed35/aten/src/ATen/native/transformers/hip/aotriton_adapter.h#L140-L144 suggests torch should support 0.11b release of
aotritionwhich is older than the 0.11.1b release currently packaged, curious.Wenceslaw commentedon Sep 10, 2026
That
#elsearm is dead code upstream, and it does not compile.cmake/External/aotriton.cmakeat v2.13.0 hardcodes__AOTRITON_VER "0.12b", so anyone using the vendored download never builds the< 0.12path. nixpkgs setsAOTRITON_INSTALLED_PREFIXto a 0.11.1b build, so we are essentially the only consumer that reaches it.Two things are wrong with it. The first is the plain typo you found — the parameter was renamed
cookie→selffor the 0.12 API but the pre-0.12 arm still dereferences the old name (introduced by pytorch#184288). Fixing that identifier letsattention.hipcompile, and then it fails again further on, because 0.11.1b genuinely lacks three members that the same arm uses:attn_options::deterministicattention_backward.hip:634,mha_all_aot.hip:683,889attn_fwd_params::seq_strides_q/_kmha_all_aot.hip:498-499VarlenType::StridedVarlenmha_all_aot.hip:487(0.11 spells itstrided_varlen)So this is not patchable without forking torch's attention dispatch and silently dropping deterministic backward + strided varlen. torch 2.13.0 requires aotriton >= 0.12.
Bumping the source recipe to 0.12b does not work either: 0.12b adds a
v3srcthat clones AITER over the network at configure time (v3src/CMakeLists.txt,git clone --depth 1 --branch v0.1.11 https://github.com/ROCm/aiter.git), which the sandbox forbids, andAITER_DIRis a plainset()with no override hook. On the way there you also hit two smaller 0.12b-only requirements:AOTRITON_GIT_TREESHA1must be supplied (the recipe'spostFetchstrips.git) and it must be an environment variable, not a-Dflag, because the guard readsif(DEFINED ENV{...})and theelse()clobbers a cache value; plus a newfind_package(Git REQUIRED).What worked
Use upstream's prebuilt release tarballs — the same artifacts pytorch downloads by default. Their hashes match v2.13.0's
__AOTRITON_SHA256_LIST/__AOTRITON_IMAGE_SHA256_LIST:torch itself needs no change, since nixpkgs already points
AOTRITON_INSTALLED_PREFIXatrocmPackages.aotriton.Two gotchas worth knowing:
.aks2surfaces ashipErrorInvalidImageat the first SDPA call —packed_kernel_common.ccreturns a null image andon_device_kernel.ccturns that into an error. Torch selects the backend on arch/dtype without checking whether the blob exists, so there is no fallback to math/mem-efficient.lib/as the.so— they are located at runtime viadladdr()+/aotriton.images.The shebang fix is still needed independently:
patchShebangs --build aten/src/ATen/native/transformers/hip/flash_attn/ck/add_make_kernel_pt.shinpostPatch(it runs at configure time, sofixupPhaseis too late).Verified on gfx1201 (Radeon AI PRO R9700), ROCm 7.2.3, torch 2.13.0 from nixos-unstable: builds clean and serves correctly under vLLM — ~15k tokens generated across up to 32 concurrent streams with no aotriton-related errors.
I have this working locally but only for one image family and one ROCm version, so it is not a general nixpkgs patch as-is. Happy to open a PR bumping
rocmPackages.aotritonto the prebuilt 0.12b if maintainers prefer that over a source bump — the source route looks blocked on the AITER network fetch regardless.anund commentedon Sep 11, 2026
Given the the
postFetchsection is already doing git commandsaitercode be brought in like so:postFetch = '' cd $out git reset --hard HEAD for submodule in $(git config --file .gitmodules --get-regexp path | awk '{print $2}' | grep '^third_party/' | grep -v '^third_party/triton$'); do git submodule update --init --recursive "$submodule" done + cd third_party + git clone --depth 1 --branch "v0.1.11" -c advice.detachedHead=false https://github.com/ROCm/aiter.git find "$out" -name .git -print0 | xargs -0 rm -rf '';The hash supplied to and checked by
fetchFromGithubwill include those files in the calculation. Maybe that could be written as a bunch ofmvcommands in apostUnpackphase working on 3 separate source fetches.The
cmakereference togitinv3src/CMakeLists.txtcan be commented out wholesale. (v0.12b, lines change depending on the checkout). That would eventually need a patch with some refactoring and a new build flags upstream to make permanent. (removing.gitis needed to make thesrchash stable but also breaks thecmakelogic even if thegitbinary is available)For v0.12b you need:
AOTRITON_GIT_TREESHA1 = "35bfbd0ebe2fd774e97cdc12421592c23f59abfe"; #git rev-parse 'HEAD^{tree}'Some additional changes accumulated while hacking on a v0.13b checkout (needed for #559522)
AOTRITON_GIT_TREESHA1 = "0a9c220761603465c794bc6522564452d43ebc23"; #git rev-parse 'HEAD^{tree}'pipandvirtualenv--no-build-isolation(I'm unclear on why pip + virtualenv work the way they do)I can test multi-arch builds based on v0.12b source change given what you've written @Wenceslaw. Thank you.
anund commentedon Sep 11, 2026
Draft available. Building that diff and running tests overnight.
rocmPackages.aotriton: 0.11.1b -> 0.12b
rocmPackages.aotriton: 0.11.1b -> 0.12b
rocmPackages.aotriton: 0.11.1b -> 0.12b
rocmPackages.aotriton: 0.11.1b -> 0.12b
anund commentedon Sep 14, 2026
Currently working through checking the mass rebuilds caused by this change against staging. While that spins here's the pr as an overlay.
rocmPackages.aotriton: 0.11.1b -> 0.12b
jys1670 commentedon Sep 19, 2026
It’s probably worth informing @LunNova about the
torchWithRocmfailureshttps://hydra.nixos.org/job/nixos/unstable/nixpkgs.python314Packages.torchWithRocm.x86_64-linux
https://hydra.nixos.org/job/nixos/unstable/nixpkgs.python313Packages.torchWithRocm.x86_64-linux
rocmPackages.aotriton: 0.11.1b -> 0.12b
rocmPackages.aotriton: 0.11.1b -> 0.12b
rocmPackages.aotriton: 0.11.1b -> 0.12b
feat(khanelinix): re-enable comfyui