Skip to content

Build failure: python3Packages.torch #560210

Closed

Description

@anund

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

https://hydra.nixos.org/build/344311684

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
  pass

Additional 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

cc @GaetanLepage


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

Is this issue important to you?

Add a 👍 reaction to issues you find important.

Activity

  1. added
    0.kind: build failure
    on Sep 5, 2026
  2. anund commented on Sep 5, 2026

    @anund
    ContributorAuthor

    Just patching the shebang doesn't appear to be enough to fix the build. Limiting the rocm arch to gfx1150 to skip the 2 hour build results in the following errors:

    [3028/3312] Building HIP object caffe2/CMakeFiles/torch_hip.dir/__/aten/src/ATen/native/transformers/hip/attention.hip.o
    FAILED: [code=1] caffe2/CMakeFiles/torch_hip.dir/__/aten/src/ATen/native/transformers/hip/attention.hip.o
    /nix/store/1pj1dnrgl4by640jj6s6rkk0mpvdcanm-hipClang/bin/clang++  -DAT_PER_OPERATOR_HEADERS -DFLASHATTENTION_DISABLE_ALIBI -DFLASHATTENTION_DISABLE_SOFTCAP -DFLASH_NAMESPACE=pytorch_flash -DFMT_HEADER_ONLY=1 -DFMT_NO_UNIQUE_ADDRESS=[[no_unique_address]] -DHAVE_MALLOC_USABLE_SIZE=1 -DHAVE_MMAP=1 -DHAVE_POSIX_FALLOCATE=1 -DHAVE_SHM_OPEN=1 -DHAVE_SHM_UNLINK=1 -DMINIZ_DISABLE_ZIP_READER_CRC32_CHECKS -DONNXIFI_ENABLE_EXT=1 -DONNX_ML=1 -DONNX_NAMESPACE=onnx_torch -DROCM_VERSION=70203 -DTORCH_CUDA_BUILD_MAIN_LIB -DTORCH_HIP_VERSION=702 -DUNFUSE_FMA -DUSE_C10D_GLOO -DUSE_C10D_NCCL -DUSE_DISTRIBUTED -DUSE_EXTERNAL_MZCRC -DUSE_FLASH_ATTENTION -DUSE_LAYERNORM_FAST_RECIPROCAL -DUSE_MEM_EFF_ATTENTION -DUSE_NCCL -DUSE_PROF_API=1 -DUSE_ROCM -DUSE_RPC -DUSE_TENSORPIPE -D_FILE_OFFSET_BITS=64 -D__HIP_PLATFORM_AMD__ -D__HIP_PLATFORM_AMD__=1 -D__HIP_ROCclr__=1 -Dtorch_hip_EXPORTS -I/build/pytorch/build/aten/src -I/build/pytorch/aten/src -I/build/pytorch/build -I/build/pytorch -I/build/pytorch/nlohmann -I/build/pytorch/moodycamel -I/build/pytorch/aten/src/THH -I/build/pytorch/aten/src/ATen/hip -I/build/pytorch/aten/src/ATen/../../../third_party/composable_kernel/example/ck_tile/01_fmha -I/build/pytorch/build/caffe2/aten/src/ATen/composable_kernel -I/build/pytorch/aten/src/ATen/../../../third_party/aiter/csrc/include -I/build/pytorch/third_party/fmt/include -I/build/pytorch/build/caffe2/aten/src -I/build/pytorch/aten/src/ATen/.. -I/nix/store/y0cchz81mq4kx79jlixzwznlfx3z9spl-aotriton-0.11.1b/include -I/build/pytorch/c10/hip/../.. -I/build/pytorch/c10/.. -I/build/pytorch/torch/csrc/api -I/build/pytorch/torch/csrc/api/include -I/build/pytorch/build/third_party/gloo/hip -isystem /nix/store/sfymy8rgcylkpbab8wybb43wk4wkipyj-miopen-7.2.3/include -isystem /build/pytorch/build/third_party/gloo -isystem /build/pytorch/cmake/../third_party/gloo -isystem /build/pytorch/cmake/../third_party/tensorpipe/third_party/libuv/include -isystem /build/pytorch/third_party/protobuf/src -isystem /build/pytorch/third_party/ittapi/include -isystem /build/pytorch/cmake/../third_party/eigen -isystem /nix/store/vkisi23b1m1h7pba5wmy0l9zi25wbglj-rocm-merged/include -isystem /nix/store/5ncaz6gdg01f81ngghxq1fzkax2hpms5-rocrand-7.2.3/include -isystem /nix/store/nbgprqj8h363kl101l36yz2qdk1kk0f9-hiprand-7.2.3/include -isystem /nix/store/fy4r5qq0pqcaqvdsx4b5kxdwmiy83qnx-rocblas-7.2.3/include -isystem /nix/store/zbvqfpvvmcg7gmb53g5ib7yqnzaxbqg2-hipblas-7.2.3/include -isystem /nix/store/rlz0pzy6y3ngs7impb6igs1k1p4wzazi-hipfft-7.2.3/include -isystem /nix/store/d4a9c8sb75423k6lbxrk8v7l82d870vp-hipsparse-7.2.3/include -isystem /nix/store/gjz93g88fm3rkkkk9iplsl8ak38bcarg-rocprim-7.2.3/include -isystem /nix/store/qkd8b0pclwmblj5qa0bqqnrfvrx1m4wj-hipcub-7.2.3/include -isystem /nix/store/k5y2pjssv1qpcx6ndzxv51iz9jnidgpx-rocthrust-7.2.3/include -isystem /nix/store/sgiq793fvicynz2cm2amgvbpws1lwsra-hipsolver-7.2.3/include -isystem /nix/store/dvgl4wf4sf94xrvwiqn8qrhhyn8a1kx0-rocsolver-7.2.3/include -isystem /nix/store/j6rr4lavr62sarmc1hji2nmwz1jv9d8z-rccl-7.2.3/include -isystem /build/pytorch/third_party/ideep/mkl-dnn/include/oneapi/dnnl -isystem /build/pytorch/third_party/ideep/include -isystem /build/pytorch/INTERFACE -isystem /build/pytorch/third_party/nlohmann/include -isystem /build/pytorch/third_party/concurrentqueue -isystem /nix/store/5ns59wyp09g355fivxbmd51n96rxnx9g-hipblas-common-7.2.3/include -isystem /nix/store/nbgprqj8h363kl101l36yz2qdk1kk0f9-hiprand-7.2.3/include/hiprand -isystem /nix/store/5ncaz6gdg01f81ngghxq1fzkax2hpms5-rocrand-7.2.3/include/rocrand -isystem /nix/store/p3s3wkz0s0xkgxnrn7x99w1bl6hd8283-libdrm-2.4.134-dev/include -isystem /nix/store/p3s3wkz0s0xkgxnrn7x99w1bl6hd8283-libdrm-2.4.134-dev/include/libdrm -isystem /nix/store/3bh0v5bliqfizccfb0izpk25lxj07rw9-magma-2.9.0/include -fPIC --offload-compress -std=c++20 --rocm-device-lib-path=/nix/store/69nb9mi2lkqspy7p1h0zfwspnsqm0bdf-rocm-device-libs-22.0.0-rocm/amdgcn/bitcode -fclang-abi-compat=17 -fno-gpu-rdc -DHAVE_AVX512_CPU_DEFINITION -DHAVE_AVX2_CPU_DEFINITION -O3 -DNDEBUG -std=gnu++20 --offload-arch=gfx1150 -fPIC -fcolor-diagnostics -DTORCH_USE_LIBUV -DCAFFE2_USE_GLOO -D__HIP_PLATFORM_AMD__=1 -DCUDA_HAS_FP16=1 -DUSE_ROCM -D__HIP_NO_HALF_OPERATORS__=1 -D__HIP_NO_HALF_CONVERSIONS__=1 -DTORCH_HIP_VERSION=702 -Wno-shift-count-negative -Wno-shift-count-overflow -DCAFFE2_USE_MIOPEN -DTHRUST_DEVICE_SYSTEM=THRUST_DEVICE_SYSTEM_HIP -DHIPBLAS_V2 -DHIP_ENABLE_WARP_SYNC_BUILTINS -DHIPBLASLT_OUTER_VEC -DUSE_ROCM_CK_GEMM -MD -MT caffe2/CMakeFiles/torch_hip.dir/__/aten/src/ATen/native/transformers/hip/attention.hip.o -MF caffe2/CMakeFiles/torch_hip.dir/__/aten/src/ATen/native/transformers/hip/attention.hip.o.d -o caffe2/CMakeFiles/torch_hip.dir/__/aten/src/ATen/native/transformers/hip/attention.hip.o -x hip -c /build/pytorch/aten/src/ATen/native/transformers/hip/attention.hip
    In file included from /build/pytorch/aten/src/ATen/native/transformers/hip/attention.hip:94:
    /build/pytorch/aten/src/ATen/native/transformers/hip/aotriton_adapter.h:143:36: error: use of undeclared identifier 'cookie'
      143 |     auto ctx = (LazyTensorContext*)cookie;
          |                                    ^~~~~~
    1 error generated when compiling for gfx1150.
    [3029/3312] Building HIP object caffe2/CMakeFiles/torch_hip.dir/__/aten/src/ATen/native/transformers/hip/attention_backward.hip.o
    FAILED: [code=1] caffe2/CMakeFiles/torch_hip.dir/__/aten/src/ATen/native/transformers/hip/attention_backward.hip.o
    /nix/store/1pj1dnrgl4by640jj6s6rkk0mpvdcanm-hipClang/bin/clang++  -DAT_PER_OPERATOR_HEADERS -DFLASHATTENTION_DISABLE_ALIBI -DFLASHATTENTION_DISABLE_SOFTCAP -DFLASH_NAMESPACE=pytorch_flash -DFMT_HEADER_ONLY=1 -DFMT_NO_UNIQUE_ADDRESS=[[no_unique_address]] -DHAVE_MALLOC_USABLE_SIZE=1 -DHAVE_MMAP=1 -DHAVE_POSIX_FALLOCATE=1 -DHAVE_SHM_OPEN=1 -DHAVE_SHM_UNLINK=1 -DMINIZ_DISABLE_ZIP_READER_CRC32_CHECKS -DONNXIFI_ENABLE_EXT=1 -DONNX_ML=1 -DONNX_NAMESPACE=onnx_torch -DROCM_VERSION=70203 -DTORCH_CUDA_BUILD_MAIN_LIB -DTORCH_HIP_VERSION=702 -DUNFUSE_FMA -DUSE_C10D_GLOO -DUSE_C10D_NCCL -DUSE_DISTRIBUTED -DUSE_EXTERNAL_MZCRC -DUSE_FLASH_ATTENTION -DUSE_LAYERNORM_FAST_RECIPROCAL -DUSE_MEM_EFF_ATTENTION -DUSE_NCCL -DUSE_PROF_API=1 -DUSE_ROCM -DUSE_RPC -DUSE_TENSORPIPE -D_FILE_OFFSET_BITS=64 -D__HIP_PLATFORM_AMD__ -D__HIP_PLATFORM_AMD__=1 -D__HIP_ROCclr__=1 -Dtorch_hip_EXPORTS -I/build/pytorch/build/aten/src -I/build/pytorch/aten/src -I/build/pytorch/build -I/build/pytorch -I/build/pytorch/nlohmann -I/build/pytorch/moodycamel -I/build/pytorch/aten/src/THH -I/build/pytorch/aten/src/ATen/hip -I/build/pytorch/aten/src/ATen/../../../third_party/composable_kernel/example/ck_tile/01_fmha -I/build/pytorch/build/caffe2/aten/src/ATen/composable_kernel -I/build/pytorch/aten/src/ATen/../../../third_party/aiter/csrc/include -I/build/pytorch/third_party/fmt/include -I/build/pytorch/build/caffe2/aten/src -I/build/pytorch/aten/src/ATen/.. -I/nix/store/y0cchz81mq4kx79jlixzwznlfx3z9spl-aotriton-0.11.1b/include -I/build/pytorch/c10/hip/../.. -I/build/pytorch/c10/.. -I/build/pytorch/torch/csrc/api -I/build/pytorch/torch/csrc/api/include -I/build/pytorch/build/third_party/gloo/hip -isystem /nix/store/sfymy8rgcylkpbab8wybb43wk4wkipyj-miopen-7.2.3/include -isystem /build/pytorch/build/third_party/gloo -isystem /build/pytorch/cmake/../third_party/gloo -isystem /build/pytorch/cmake/../third_party/tensorpipe/third_party/libuv/include -isystem /build/pytorch/third_party/protobuf/src -isystem /build/pytorch/third_party/ittapi/include -isystem /build/pytorch/cmake/../third_party/eigen -isystem /nix/store/vkisi23b1m1h7pba5wmy0l9zi25wbglj-rocm-merged/include -isystem /nix/store/5ncaz6gdg01f81ngghxq1fzkax2hpms5-rocrand-7.2.3/include -isystem /nix/store/nbgprqj8h363kl101l36yz2qdk1kk0f9-hiprand-7.2.3/include -isystem /nix/store/fy4r5qq0pqcaqvdsx4b5kxdwmiy83qnx-rocblas-7.2.3/include -isystem /nix/store/zbvqfpvvmcg7gmb53g5ib7yqnzaxbqg2-hipblas-7.2.3/include -isystem /nix/store/rlz0pzy6y3ngs7impb6igs1k1p4wzazi-hipfft-7.2.3/include -isystem /nix/store/d4a9c8sb75423k6lbxrk8v7l82d870vp-hipsparse-7.2.3/include -isystem /nix/store/gjz93g88fm3rkkkk9iplsl8ak38bcarg-rocprim-7.2.3/include -isystem /nix/store/qkd8b0pclwmblj5qa0bqqnrfvrx1m4wj-hipcub-7.2.3/include -isystem /nix/store/k5y2pjssv1qpcx6ndzxv51iz9jnidgpx-rocthrust-7.2.3/include -isystem /nix/store/sgiq793fvicynz2cm2amgvbpws1lwsra-hipsolver-7.2.3/include -isystem /nix/store/dvgl4wf4sf94xrvwiqn8qrhhyn8a1kx0-rocsolver-7.2.3/include -isystem /nix/store/j6rr4lavr62sarmc1hji2nmwz1jv9d8z-rccl-7.2.3/include -isystem /build/pytorch/third_party/ideep/mkl-dnn/include/oneapi/dnnl -isystem /build/pytorch/third_party/ideep/include -isystem /build/pytorch/INTERFACE -isystem /build/pytorch/third_party/nlohmann/include -isystem /build/pytorch/third_party/concurrentqueue -isystem /nix/store/5ns59wyp09g355fivxbmd51n96rxnx9g-hipblas-common-7.2.3/include -isystem /nix/store/nbgprqj8h363kl101l36yz2qdk1kk0f9-hiprand-7.2.3/include/hiprand -isystem /nix/store/5ncaz6gdg01f81ngghxq1fzkax2hpms5-rocrand-7.2.3/include/rocrand -isystem /nix/store/p3s3wkz0s0xkgxnrn7x99w1bl6hd8283-libdrm-2.4.134-dev/include -isystem /nix/store/p3s3wkz0s0xkgxnrn7x99w1bl6hd8283-libdrm-2.4.134-dev/include/libdrm -isystem /nix/store/3bh0v5bliqfizccfb0izpk25lxj07rw9-magma-2.9.0/include -fPIC --offload-compress -std=c++20 --rocm-device-lib-path=/nix/store/69nb9mi2lkqspy7p1h0zfwspnsqm0bdf-rocm-device-libs-22.0.0-rocm/amdgcn/bitcode -fclang-abi-compat=17 -fno-gpu-rdc -DHAVE_AVX512_CPU_DEFINITION -DHAVE_AVX2_CPU_DEFINITION -O3 -DNDEBUG -std=gnu++20 --offload-arch=gfx1150 -fPIC -fcolor-diagnostics -DTORCH_USE_LIBUV -DCAFFE2_USE_GLOO -D__HIP_PLATFORM_AMD__=1 -DCUDA_HAS_FP16=1 -DUSE_ROCM -D__HIP_NO_HALF_OPERATORS__=1 -D__HIP_NO_HALF_CONVERSIONS__=1 -DTORCH_HIP_VERSION=702 -Wno-shift-count-negative -Wno-shift-count-overflow -DCAFFE2_USE_MIOPEN -DTHRUST_DEVICE_SYSTEM=THRUST_DEVICE_SYSTEM_HIP -DHIPBLAS_V2 -DHIP_ENABLE_WARP_SYNC_BUILTINS -DHIPBLASLT_OUTER_VEC -DUSE_ROCM_CK_GEMM -MD -MT caffe2/CMakeFiles/torch_hip.dir/__/aten/src/ATen/native/transformers/hip/attention_backward.hip.o -MF caffe2/CMakeFiles/torch_hip.dir/__/aten/src/ATen/native/transformers/hip/attention_backward.hip.o.d -o caffe2/CMakeFiles/torch_hip.dir/__/aten/src/ATen/native/transformers/hip/attention_backward.hip.o -x hip -c /build/pytorch/aten/src/ATen/native/transformers/hip/attention_backward.hip
    In file included from /build/pytorch/aten/src/ATen/native/transformers/hip/attention_backward.hip:56:
    /build/pytorch/aten/src/ATen/native/transformers/hip/aotriton_adapter.h:143:36: error: use of undeclared identifier 'cookie'
      143 |     auto ctx = (LazyTensorContext*)cookie;
          |                                    ^~~~~~
    /build/pytorch/aten/src/ATen/native/transformers/hip/attention_backward.hip:634:10: error: no member named 'deterministic' in 'aotriton::v3::flash::attn_options'
      634 |     opts.deterministic = deterministic;
          |     ~~~~ ^
    2 errors generated when compiling for gfx1150.
    [3030/3312] Building HIP object caffe2/CMakeFiles/torch_hip.dir/__/aten/src/ATen/native/transformers/hip/flash_attn/aot/mha_all_aot.hip.o
    FAILED: [code=1] caffe2/CMakeFiles/torch_hip.dir/__/aten/src/ATen/native/transformers/hip/flash_attn/aot/mha_all_aot.hip.o
    /nix/store/1pj1dnrgl4by640jj6s6rkk0mpvdcanm-hipClang/bin/clang++  -DAT_PER_OPERATOR_HEADERS -DFLASHATTENTION_DISABLE_ALIBI -DFLASHATTENTION_DISABLE_SOFTCAP -DFLASH_NAMESPACE=pytorch_flash -DFMT_HEADER_ONLY=1 -DFMT_NO_UNIQUE_ADDRESS=[[no_unique_address]] -DHAVE_MALLOC_USABLE_SIZE=1 -DHAVE_MMAP=1 -DHAVE_POSIX_FALLOCATE=1 -DHAVE_SHM_OPEN=1 -DHAVE_SHM_UNLINK=1 -DMINIZ_DISABLE_ZIP_READER_CRC32_CHECKS -DONNXIFI_ENABLE_EXT=1 -DONNX_ML=1 -DONNX_NAMESPACE=onnx_torch -DROCM_VERSION=70203 -DTORCH_CUDA_BUILD_MAIN_LIB -DTORCH_HIP_VERSION=702 -DUNFUSE_FMA -DUSE_C10D_GLOO -DUSE_C10D_NCCL -DUSE_DISTRIBUTED -DUSE_EXTERNAL_MZCRC -DUSE_FLASH_ATTENTION -DUSE_LAYERNORM_FAST_RECIPROCAL -DUSE_MEM_EFF_ATTENTION -DUSE_NCCL -DUSE_PROF_API=1 -DUSE_ROCM -DUSE_RPC -DUSE_TENSORPIPE -D_FILE_OFFSET_BITS=64 -D__HIP_PLATFORM_AMD__ -D__HIP_PLATFORM_AMD__=1 -D__HIP_ROCclr__=1 -Dtorch_hip_EXPORTS -I/build/pytorch/build/aten/src -I/build/pytorch/aten/src -I/build/pytorch/build -I/build/pytorch -I/build/pytorch/nlohmann -I/build/pytorch/moodycamel -I/build/pytorch/aten/src/THH -I/build/pytorch/aten/src/ATen/hip -I/build/pytorch/aten/src/ATen/../../../third_party/composable_kernel/example/ck_tile/01_fmha -I/build/pytorch/build/caffe2/aten/src/ATen/composable_kernel -I/build/pytorch/aten/src/ATen/../../../third_party/aiter/csrc/include -I/build/pytorch/third_party/fmt/include -I/build/pytorch/build/caffe2/aten/src -I/build/pytorch/aten/src/ATen/.. -I/nix/store/y0cchz81mq4kx79jlixzwznlfx3z9spl-aotriton-0.11.1b/include -I/build/pytorch/c10/hip/../.. -I/build/pytorch/c10/.. -I/build/pytorch/torch/csrc/api -I/build/pytorch/torch/csrc/api/include -I/build/pytorch/build/third_party/gloo/hip -isystem /nix/store/sfymy8rgcylkpbab8wybb43wk4wkipyj-miopen-7.2.3/include -isystem /build/pytorch/build/third_party/gloo -isystem /build/pytorch/cmake/../third_party/gloo -isystem /build/pytorch/cmake/../third_party/tensorpipe/third_party/libuv/include -isystem /build/pytorch/third_party/protobuf/src -isystem /build/pytorch/third_party/ittapi/include -isystem /build/pytorch/cmake/../third_party/eigen -isystem /nix/store/vkisi23b1m1h7pba5wmy0l9zi25wbglj-rocm-merged/include -isystem /nix/store/5ncaz6gdg01f81ngghxq1fzkax2hpms5-rocrand-7.2.3/include -isystem /nix/store/nbgprqj8h363kl101l36yz2qdk1kk0f9-hiprand-7.2.3/include -isystem /nix/store/fy4r5qq0pqcaqvdsx4b5kxdwmiy83qnx-rocblas-7.2.3/include -isystem /nix/store/zbvqfpvvmcg7gmb53g5ib7yqnzaxbqg2-hipblas-7.2.3/include -isystem /nix/store/rlz0pzy6y3ngs7impb6igs1k1p4wzazi-hipfft-7.2.3/include -isystem /nix/store/d4a9c8sb75423k6lbxrk8v7l82d870vp-hipsparse-7.2.3/include -isystem /nix/store/gjz93g88fm3rkkkk9iplsl8ak38bcarg-rocprim-7.2.3/include -isystem /nix/store/qkd8b0pclwmblj5qa0bqqnrfvrx1m4wj-hipcub-7.2.3/include -isystem /nix/store/k5y2pjssv1qpcx6ndzxv51iz9jnidgpx-rocthrust-7.2.3/include -isystem /nix/store/sgiq793fvicynz2cm2amgvbpws1lwsra-hipsolver-7.2.3/include -isystem /nix/store/dvgl4wf4sf94xrvwiqn8qrhhyn8a1kx0-rocsolver-7.2.3/include -isystem /nix/store/j6rr4lavr62sarmc1hji2nmwz1jv9d8z-rccl-7.2.3/include -isystem /build/pytorch/third_party/ideep/mkl-dnn/include/oneapi/dnnl -isystem /build/pytorch/third_party/ideep/include -isystem /build/pytorch/INTERFACE -isystem /build/pytorch/third_party/nlohmann/include -isystem /build/pytorch/third_party/concurrentqueue -isystem /nix/store/5ns59wyp09g355fivxbmd51n96rxnx9g-hipblas-common-7.2.3/include -isystem /nix/store/nbgprqj8h363kl101l36yz2qdk1kk0f9-hiprand-7.2.3/include/hiprand -isystem /nix/store/5ncaz6gdg01f81ngghxq1fzkax2hpms5-rocrand-7.2.3/include/rocrand -isystem /nix/store/p3s3wkz0s0xkgxnrn7x99w1bl6hd8283-libdrm-2.4.134-dev/include -isystem /nix/store/p3s3wkz0s0xkgxnrn7x99w1bl6hd8283-libdrm-2.4.134-dev/include/libdrm -isystem /nix/store/3bh0v5bliqfizccfb0izpk25lxj07rw9-magma-2.9.0/include -fPIC --offload-compress -std=c++20 --rocm-device-lib-path=/nix/store/69nb9mi2lkqspy7p1h0zfwspnsqm0bdf-rocm-device-libs-22.0.0-rocm/amdgcn/bitcode -fclang-abi-compat=17 -fno-gpu-rdc -DHAVE_AVX512_CPU_DEFINITION -DHAVE_AVX2_CPU_DEFINITION -O3 -DNDEBUG -std=gnu++20 --offload-arch=gfx1150 -fPIC -fcolor-diagnostics -DTORCH_USE_LIBUV -DCAFFE2_USE_GLOO -D__HIP_PLATFORM_AMD__=1 -DCUDA_HAS_FP16=1 -DUSE_ROCM -D__HIP_NO_HALF_OPERATORS__=1 -D__HIP_NO_HALF_CONVERSIONS__=1 -DTORCH_HIP_VERSION=702 -Wno-shift-count-negative -Wno-shift-count-overflow -DCAFFE2_USE_MIOPEN -DTHRUST_DEVICE_SYSTEM=THRUST_DEVICE_SYSTEM_HIP -DHIPBLAS_V2 -DHIP_ENABLE_WARP_SYNC_BUILTINS -DHIPBLASLT_OUTER_VEC -DUSE_ROCM_CK_GEMM -MD -MT caffe2/CMakeFiles/torch_hip.dir/__/aten/src/ATen/native/transformers/hip/flash_attn/aot/mha_all_aot.hip.o -MF caffe2/CMakeFiles/torch_hip.dir/__/aten/src/ATen/native/transformers/hip/flash_attn/aot/mha_all_aot.hip.o.d -o caffe2/CMakeFiles/torch_hip.dir/__/aten/src/ATen/native/transformers/hip/flash_attn/aot/mha_all_aot.hip.o -x hip -c /build/pytorch/aten/src/ATen/native/transformers/hip/flash_attn/aot/mha_all_aot.hip
    In file included from /build/pytorch/aten/src/ATen/native/transformers/hip/flash_attn/aot/mha_all_aot.hip:56:
    /build/pytorch/aten/src/ATen/native/transformers/hip/aotriton_adapter.h:143:36: error: use of undeclared identifier 'cookie'
      143 |     auto ctx = (LazyTensorContext*)cookie;
          |                                    ^~~~~~
    /build/pytorch/aten/src/ATen/native/transformers/hip/flash_attn/aot/mha_all_aot.hip:487:43: error: no member named 'StridedVarlen' in 'aotriton::v3::flash::VarlenType'; did you mean 'strided_varlen'?
      487 |     params.varlen_type = strided_varlen ? VarlenType::StridedVarlen : VarlenType::CompactVarlen;
          |                                           ^~~~~~~~~~~~~~~~~~~~~~~~~
          |                                           strided_varlen
    /build/pytorch/aten/src/ATen/native/transformers/hip/flash_attn/aot/mha_all_aot.hip:330:8: note: 'strided_varlen' declared here
      330 |   bool strided_varlen = seqused_k.has_value();
          |        ^
    /build/pytorch/aten/src/ATen/native/transformers/hip/flash_attn/aot/mha_all_aot.hip:498:14: error: no member named 'seq_strides_q' in 'aotriton::v3::flash::attn_fwd_params'
      498 |       params.seq_strides_q = mk_aotensor<1>(cu_seqlens_q, "seq_strides_q");
          |       ~~~~~~ ^
    /build/pytorch/aten/src/ATen/native/transformers/hip/flash_attn/aot/mha_all_aot.hip:499:14: error: no member named 'seq_strides_k' in 'aotriton::v3::flash::attn_fwd_params'
      499 |       params.seq_strides_k = mk_aotensor<1>(cu_seqlens_k, "seq_strides_k");
          |       ~~~~~~ ^
    /build/pytorch/aten/src/ATen/native/transformers/hip/flash_attn/aot/mha_all_aot.hip:683:11: error: no member named 'deterministic' in 'aotriton::v3::flash::attn_options'
      683 |   options.deterministic = deterministic;
          |   ~~~~~~~ ^
    /build/pytorch/aten/src/ATen/native/transformers/hip/flash_attn/aot/mha_all_aot.hip:889:13: error: no member named 'deterministic' in 'aotriton::v3::flash::attn_options'
      889 |     options.deterministic = deterministic;
          |     ~~~~~~~ ^
    6 errors generated when compiling for gfx1150.
    
    ....
    

    and after printing out several more completed steps this error state:

    [3059/3312] Building HIP object caffe2/CMakeFiles/torch_hip.dir/__/aten/src/ATen/native/hip/TensorTopK.hip.o
    In file included from /build/pytorch/aten/src/ATen/native/hip/TensorTopK.hip:16:
    In file included from /build/pytorch/aten/src/ATen/native/hip/SortingRadixSelect.cuh:6:
    /build/pytorch/aten/src/ATen/hip/Atomic.cuh:353:12: warning: 'atomicAddNoRet' is deprecated: use atomicAdd instead [-Wdeprecated-declarations]
      353 |     return atomicAddNoRet(address, val);
          |            ^
    /nix/store/vkisi23b1m1h7pba5wmy0l9zi25wbglj-rocm-merged/include/hip/amd_detail/amd_hip_atomic.h:276:1: note: 'atomicAddNoRet' has been explicitly marked deprecated here
      276 | HIP_DEPRECATED("use atomicAdd instead")
          | ^
    /nix/store/vkisi23b1m1h7pba5wmy0l9zi25wbglj-rocm-merged/include/hip/hip_runtime_api.h:643:44: note: expanded from macro 'HIP_DEPRECATED'
      643 | #define HIP_DEPRECATED(msg) __attribute__((deprecated(msg)))
          |                                            ^
    1 warning generated when compiling for gfx1150.
    Job completed: /build/TensorTopK-gfx1150-02cb70.o
    In file included from /build/pytorch/aten/src/ATen/native/hip/TensorTopK.hip:16:
    In file included from /build/pytorch/aten/src/ATen/native/hip/SortingRadixSelect.cuh:6:
    /build/pytorch/aten/src/ATen/hip/Atomic.cuh:353:12: warning: 'atomicAddNoRet' is deprecated: use atomicAdd instead [-Wdeprecated-declarations]
      353 |     return atomicAddNoRet(address, val);
          |            ^
    /nix/store/vkisi23b1m1h7pba5wmy0l9zi25wbglj-rocm-merged/include/hip/amd_detail/amd_hip_atomic.h:276:1: note: 'atomicAddNoRet' has been explicitly marked deprecated here
      276 | HIP_DEPRECATED("use atomicAdd instead")
          | ^
    /nix/store/vkisi23b1m1h7pba5wmy0l9zi25wbglj-rocm-merged/include/hip/hip_runtime_api.h:643:44: note: expanded from macro 'HIP_DEPRECATED'
      643 | #define HIP_DEPRECATED(msg) __attribute__((deprecated(msg)))
          |                                            ^
    1 warning generated when compiling for host.
    Job completed: caffe2/CMakeFiles/torch_hip.dir/__/aten/src/ATen/native/hip/TensorTopK.hip.o
    ninja: build stopped: subcommand failed.
    
    TIP pass --env-dir and --sdist-extract-dir to keep the build environment and sources, then see https://build.pypa.io/en/stable/how-to/troubleshooting.html#debug-a-failed-build for help debugging a failed build
    ERROR Backend subprocess exited when trying to invoke build_wheel
    
  3. anund commented on Sep 6, 2026

    @anund
    ContributorAuthor
  4. Wenceslaw commented on Sep 10, 2026

    @Wenceslaw
    Contributor

    suggests torch should support 0.11b release of aotriton which is older than the 0.11.1b release currently packaged, curious.

    That #else arm is dead code upstream, and it does not compile. cmake/External/aotriton.cmake at v2.13.0 hardcodes __AOTRITON_VER "0.12b", so anyone using the vendored download never builds the < 0.12 path. nixpkgs sets AOTRITON_INSTALLED_PREFIX to 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 → self for the 0.12 API but the pre-0.12 arm still dereferences the old name (introduced by pytorch#184288). Fixing that identifier lets attention.hip compile, and then it fails again further on, because 0.11.1b genuinely lacks three members that the same arm uses:

    member used at
    attn_options::deterministic attention_backward.hip:634, mha_all_aot.hip:683,889
    attn_fwd_params::seq_strides_q / _k mha_all_aot.hip:498-499
    VarlenType::StridedVarlen mha_all_aot.hip:487 (0.11 spells it strided_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 v3src that 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, and AITER_DIR is a plain set() with no override hook. On the way there you also hit two smaller 0.12b-only requirements: AOTRITON_GIT_TREESHA1 must be supplied (the recipe's postFetch strips .git) and it must be an environment variable, not a -D flag, because the guard reads if(DEFINED ENV{...}) and the else() clobbers a cache value; plus a new find_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:

    stdenv.mkDerivation {
      pname = "aotriton"; version = "0.12b";
      srcs = [
        (fetchurl {
          url = "https://github.com/ROCm/aotriton/releases/download/0.12b/aotriton-0.12b-manylinux_2_28_x86_64-rocm7.2-shared.tar.gz";
          hash = "sha256-W5fo0EGxYMhAhZYfPTvXuYkGQrFGussEyZGqmtao3Kg=";
        })
        # image family must match your target GPU; gfx120x = RDNA4
        (fetchurl {
          url = "https://github.com/ROCm/aotriton/releases/download/0.12b/aotriton-0.12b-images-amd-gfx120x.tar.gz";
          hash = "sha256-aFclEc5kh6g/kBS9JVvWnIlD+H0Mk71XstqsX7xsecE=";
        })
      ];
      unpackPhase = ''
        runHook preUnpack
        for s in $srcs; do tar xzf "$s"; done
        cd aotriton
        runHook postUnpack
      '';
      nativeBuildInputs = [ autoPatchelfHook ];
      buildInputs = [ rocmPackages.clr xz stdenv.cc.cc.lib ];
      dontConfigure = true; dontBuild = true;
      installPhase = ''
        runHook preInstall
        mkdir -p $out && cp -r lib include $out/
        runHook postInstall
      '';
    }

    torch itself needs no change, since nixpkgs already points AOTRITON_INSTALLED_PREFIX at rocmPackages.aotriton.

    Two gotchas worth knowing:

    • Do fetch the image tarball, not just the runtime. A no-image build still links and compiles, but a missing .aks2 surfaces as hipErrorInvalidImage at the first SDPA call — packed_kernel_common.cc returns a null image and on_device_kernel.cc turns 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.
    • Keep the images in the same lib/ as the .so — they are located at runtime via dladdr() + /aotriton.images.

    The shebang fix is still needed independently: patchShebangs --build aten/src/ATen/native/transformers/hip/flash_attn/ck/add_make_kernel_pt.sh in postPatch (it runs at configure time, so fixupPhase is 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.aotriton to the prebuilt 0.12b if maintainers prefer that over a source bump — the source route looks blocked on the AITER network fetch regardless.

  5. anund commented on Sep 11, 2026

    @anund
    ContributorAuthor

    Given the the postFetch section is already doing git commands aiter code 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 fetchFromGithub will include those files in the calculation. Maybe that could be written as a bunch of mv commands in a postUnpack phase working on 3 separate source fetches.

    The cmake reference to git in v3src/CMakeLists.txt can 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 the src hash stable but also breaks the cmake logic even if the gitbinary is available)

    For v0.12b you need:

    Some additional changes accumulated while hacking on a v0.13b checkout (needed for #559522)

    • env + AOTRITON_GIT_TREESHA1 = "0a9c220761603465c794bc6522564452d43ebc23"; #git rev-parse 'HEAD^{tree}'
    • adding pip and virtualenv
    • patching a pip invocation to use --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.

  6. anund commented on Sep 11, 2026

    @anund
    ContributorAuthor

    Draft available. Building that diff and running tests overnight.

  7. added 4 commits that reference this issue on Sep 11, 2026
    afb8bbc
    edc4714
    1bc7f3d
    35ca37f
  8. anund commented on Sep 14, 2026

    @anund
    ContributorAuthor

    Currently working through checking the mass rebuilds caused by this change against staging. While that spins here's the pr as an overlay.

  9. added a commit that references this issue on Sep 16, 2026
    ff4dbef
  10. added 2 commits that reference this issue on Sep 28, 2026
    07e08b0
    51a988f
  11. added a commit that references this issue on Oct 3, 2026
    50b8a9f
  12. added a commit that references this issue on Nov 10, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    0.kind: build failure

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions