Skip to content

feat: prefer aotrion from release#541

Merged
drbh merged 3 commits into
mainfrom
prefer-precompiled-aotriton
May 19, 2026
Merged

feat: prefer aotrion from release#541
drbh merged 3 commits into
mainfrom
prefer-precompiled-aotriton

Conversation

@drbh
Copy link
Copy Markdown
Collaborator

@drbh drbh commented May 12, 2026

This PR avoids compiling aotrion and prefers using the prebuilt libaotriton_v2.so from https://github.com/ROCm/aotriton/releases

example of contents from
https://github.com/ROCm/aotriton/releases/download/0.11b/aotriton-0.11b-manylinux_2_28_x86_64-rocm6.2-shared.tar.gz

├── include
│   └── aotriton
│       ├── _internal
│       │   ├── aiter_hip_common.h
│       │   ├── flash
│       │   │   └── aiter.h
│       │   ├── kernel_cluster.h
│       │   ├── lazy_tensor_internal.h
│       │   ├── packed_kernel.h
│       │   ├── triton_kernel.h
│       │   └── util.h
│       ├── config.h
│       ├── cpp_tune.h
│       ├── dtypes.h
│       ├── flash.h
│       ├── runtime.h
│       ├── util.h
│       └── v2
│           └── flash.h
└── lib
    ├── cmake
    │   └── aotriton
    │       ├── aotriton-config-version.cmake
    │       ├── aotriton-config.cmake
    │       ├── aotriton-targets-release.cmake
    │       └── aotriton-targets.cmake
    ├── libaotriton_v2.so -> libaotriton_v2.so.0.11.2
    └── libaotriton_v2.so.0.11.2

@drbh drbh marked this pull request as ready for review May 12, 2026 17:43
@drbh drbh force-pushed the prefer-precompiled-aotriton branch from f0680b9 to 6e03fa7 Compare May 13, 2026 16:09
Comment thread nix-builder/pkgs/aotriton/generic.nix Outdated
Comment on lines +57 to +73
installCheckPhase = ''
runHook preInstallCheck

cmakeFlags = [
# Disable building kernels if no supported targets are enabled
(lib.cmakeBool "AOTRITON_NOIMAGE_MODE" true)
# Use preinstalled triton from our python's site-packages
(lib.cmakeBool "AOTRITON_INHERIT_SYSTEM_SITE_TRITON" true)
# Avoid kernels being skipped if build host is overloaded
(lib.cmakeFeature "AOTRITON_GPU_BUILD_TIMEOUT" "0")
(lib.cmakeFeature "CMAKE_CXX_COMPILER" compiler)
# Manually define CMAKE_INSTALL_<DIR>
# See: https://github.com/NixOS/nixpkgs/pull/197838
(lib.cmakeFeature "CMAKE_INSTALL_BINDIR" "bin")
(lib.cmakeFeature "CMAKE_INSTALL_LIBDIR" "lib")
(lib.cmakeFeature "CMAKE_INSTALL_INCLUDEDIR" "include")
(lib.cmakeFeature "AOTRITON_TARGET_ARCH" gpuTargets')
(lib.cmakeBool "AOTRITON_USE_TORCH" false)
];
test -f "$out/lib/libaotriton_v2.so"
test -d "$out/lib/aotriton.images"
python - <<PY
import ctypes
import os

ctypes.CDLL(
"$out/lib/libaotriton_v2.so",
mode=os.RTLD_NOW | os.RTLD_LOCAL,
)
PY

runHook postInstallCheck
'';
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Hmmm, I don't think this adds much to all the fixup stuff that the build already does.

If we want to test this, it's probably best to make passthru tests, one to verify that Torch loads with aotrition. Second that actually does some computation that triggers aotriton use (but we'd need a ROCm GPU to actually run it).

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

thanks for the suggestion, removed the installCheckPhase in latest commit. do you think it makes sense to add the passthru tests somewhere?

Copy link
Copy Markdown
Member

@danieldk danieldk May 18, 2026

Choose a reason for hiding this comment

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

As long as we cannot run it on the GPU, it does not seem that useful to have the passthru test, since loadability is already checked when ROCm Torch gets built:

❯ ldd result/torch210-cxx11-rocm71-x86_64-linux/torch-out/lib/python3.13/site-packages/torch/_C.cpython-313-x86_64-linux-gnu.so | grep ao                                                                                            
        libaotriton_v2.so.0.11.1 => /nix/store/k85zxmmnjfyhji6b5q6y9yhs2i4f1ajq-rocm-merged/lib/libaotriton_v2.so.0.11.1 (0x00007260c4400000)
❯ grep "pythonImportsCheck" nix-builder/pkgs/python-modules/torch/binary/generic.nix                                                                                                                                                 
  pythonImportsCheck = [ "torch" ];

Copy link
Copy Markdown
Member

@danieldk danieldk left a comment

Choose a reason for hiding this comment

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

Looks great!

@drbh drbh merged commit 8465cee into main May 19, 2026
67 of 68 checks passed
sayakpaul pushed a commit that referenced this pull request May 19, 2026
* feat: prefer aotrion from release

* fix: resolve libamdhip

* fix: remove installCheckPhase
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants