rocmPackages.clr: don't use rocm-merged-llvm

This commit is contained in:
Luna Nova
2025-09-24 07:58:06 -07:00
parent d0194e29e9
commit f08fc581c3

View File

@@ -18,6 +18,7 @@
roctracer, roctracer,
rocminfo, rocminfo,
rocm-smi, rocm-smi,
symlinkJoin,
numactl, numactl,
libffi, libffi,
zstd, zstd,
@@ -26,7 +27,7 @@
libxml2, libxml2,
libX11, libX11,
python3Packages, python3Packages,
rocm-merged-llvm, llvm,
khronos-ocl-icd-loader, khronos-ocl-icd-loader,
gcc-unwrapped, gcc-unwrapped,
writeShellScriptBin, writeShellScriptBin,
@@ -35,7 +36,20 @@
let let
inherit (rocm-core) ROCM_LIBPATCH_VERSION; inherit (rocm-core) ROCM_LIBPATCH_VERSION;
hipClang = rocm-merged-llvm; # HIP_CLANG_PATH or ROCM_PATH/llvm
# Note: relying on ROCM_PATH/llvm is bad for cross
hipClang = symlinkJoin {
name = "hipClang";
paths = [
# FIXME: if we don't put this first aotriton build fails with ld.lld: -flavor gnu
# Probably wrapper jank
llvm.bintools.bintools
llvm.rocm-toolchain
];
postBuild = ''
rm -rf $out/{include,lib,share,etc,nix-support,usr}
'';
};
hipClangPath = "${hipClang}/bin"; hipClangPath = "${hipClang}/bin";
wrapperArgs = [ wrapperArgs = [
"--prefix PATH : $out/bin" "--prefix PATH : $out/bin"
@@ -84,6 +98,7 @@ stdenv.mkDerivation (finalAttrs: {
]; ];
buildInputs = [ buildInputs = [
llvm.llvm
numactl numactl
libGL libGL
libxml2 libxml2
@@ -101,6 +116,7 @@ stdenv.mkDerivation (finalAttrs: {
rocm-comgr rocm-comgr
rocm-runtime rocm-runtime
rocminfo rocminfo
hipClangPath
]; ];
cmakeBuildType = "RelWithDebInfo"; cmakeBuildType = "RelWithDebInfo";
@@ -163,7 +179,8 @@ stdenv.mkDerivation (finalAttrs: {
--replace-fail "install(PROGRAMS \''${HIPCC_BIN_DIR}/hipconfig.bat DESTINATION bin)" "" --replace-fail "install(PROGRAMS \''${HIPCC_BIN_DIR}/hipconfig.bat DESTINATION bin)" ""
substituteInPlace hipamd/src/hip_embed_pch.sh \ substituteInPlace hipamd/src/hip_embed_pch.sh \
--replace-fail "\''$LLVM_DIR/bin/clang" "${hipClangPath}/clang" --replace-fail "\''$LLVM_DIR/bin/clang" "${hipClangPath}/clang" \
--replace-fail "\''$LLVM_DIR/bin/llvm-mc" "${lib.getExe' llvm.bintools.bintools "llvm-mc"}"
substituteInPlace opencl/khronos/icd/loader/icd_platform.h \ substituteInPlace opencl/khronos/icd/loader/icd_platform.h \
--replace-fail '#define ICD_VENDOR_PATH "/etc/OpenCL/vendors/";' \ --replace-fail '#define ICD_VENDOR_PATH "/etc/OpenCL/vendors/";' \
@@ -207,7 +224,6 @@ stdenv.mkDerivation (finalAttrs: {
ln -s ${rocm-core}/.info/ $out/.info ln -s ${rocm-core}/.info/ $out/.info
ln -s ${hipClang} $out/llvm ln -s ${hipClang} $out/llvm
ln -s ${hipClang}/bin/{ld.lld,lld,clang-offload-bundler,llvm-objcopy,clang,clang++} $out/bin/
''; '';
disallowedRequisites = [ disallowedRequisites = [