summaryrefslogtreecommitdiff
path: root/.nix
diff options
context:
space:
mode:
authorClaudius "keldu" Holeksa <mail@keldu.de>2026-11-09 22:32:31 +0100
committerClaudius "keldu" Holeksa <mail@keldu.de>2026-11-09 22:32:31 +0100
commit2e63c4a31f946a8bafa92c49c1a0a116c0eb6dae (patch)
tree9d9b1022350a21d106a954513cc9567fd974e781 /.nix
parent5c708bb3a0c9faec82a0deb32478370f9d780ea8 (diff)
downloadlibs-lbm-2e63c4a31f946a8bafa92c49c1a0a116c0eb6dae.tar.gz
Fixing rocm up
Diffstat (limited to '.nix')
-rw-r--r--.nix/adaptive-cpp.nix31
1 files changed, 29 insertions, 2 deletions
diff --git a/.nix/adaptive-cpp.nix b/.nix/adaptive-cpp.nix
index b8a7688..2e631e1 100644
--- a/.nix/adaptive-cpp.nix
+++ b/.nix/adaptive-cpp.nix
@@ -20,7 +20,7 @@
let
version = "25.02.0";
-in stdenv.mkDerivation {
+in stdenv.mkDerivation ({
pname = "adaptive-cpp-kel-custom";
inherit version;
@@ -54,8 +54,26 @@ in stdenv.mkDerivation {
cmakeFlags = [
"-DCLANG_INCLUDE_PATH=${llvmPackages.libclang.dev}/include"
+ ] ++ lib.optionals config.rocm [
+ "-DWITH_ROCM_BACKEND=ON"
+
+ # Keep OpenCL and Level Zero off. src/CMakeLists.txt turns WITH_LLVM_TO_SPIRV
+ # on for either of them, and that target FetchContent-clones
+ # SPIRV-LLVM-Translator at configure time, which a nix build cannot do --
+ # it has neither git nor network. ROCm is the backend we want here and it
+ # does not go through SPIR-V.
+ #
+ # This only bites when rocm = true: rocmPackages.clr brings OpenCL in, so
+ # the backend autodetects on, where in the base build it stays off.
+ "-DWITH_OPENCL_BACKEND=OFF"
+ "-DWITH_LEVEL_ZERO_BACKEND=OFF"
];
+ # nixpkgs 26.05 turns the zerocallusedregs hardening flag on by default, and
+ # clang rejects -fzero-call-used-regs for the amdgcn-amd-amdhsa target, so
+ # every device bitcode object under src/libkernel/sscp/amdgpu fails to build.
+ # Not an AdaptiveCpp problem -- the same source built fine on 25.11.
+
postInstall = ''
if [ -d "$out/include/AdaptiveCpp" ]; then
mv $out/include/AdaptiveCpp .hidden-fake
@@ -76,4 +94,13 @@ in stdenv.mkDerivation {
postPatch = ''
patchShebangs .
'';
-}
+} // lib.optionalAttrs config.rocm {
+ # nixpkgs 26.05 turns the zerocallusedregs hardening flag on by default, and
+ # clang rejects -fzero-call-used-regs for the amdgcn-amd-amdhsa target, so
+ # every device bitcode object under src/libkernel/sscp/amdgpu fails to build.
+ # Not an AdaptiveCpp problem -- the same source built fine on 25.11.
+ #
+ # Set via optionalAttrs rather than lib.optionals so the attribute is absent
+ # (not just empty) without rocm, which keeps the base derivation hash stable.
+ hardeningDisable = [ "zerocallusedregs" ];
+})