From c3365965af50d5572864499dffe8b781f17366c1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Dani=C3=ABl=20de=20Kok?= Date: Tue, 13 Oct 2026 11:14:16 +0200 Subject: [PATCH 1/2] nix-builder: always pass `GPU_LANG` to CMake So far, we have relied on detection. However this turns out to be flaky for macOS, since the same Torch build can be used for CPU and Metal builds. It seems that since Torch 2.15, `mps.is_available()` starts reporting `False` on our CI machines (presumably due to not having visible Metal GPUs). The language detection is really more for non-Nix development builds. So, let's be explicit for Nix builds to avoid detection mistakes. --- nix-builder/lib/extension/torch/arch.nix | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/nix-builder/lib/extension/torch/arch.nix b/nix-builder/lib/extension/torch/arch.nix index e9fbb322..e37ef6a8 100644 --- a/nix-builder/lib/extension/torch/arch.nix +++ b/nix-builder/lib/extension/torch/arch.nix @@ -123,6 +123,8 @@ let metalSupport = buildConfig.metal or false; + cpuSupport = buildConfig.cpu or false; + provenanceFlags = import ../provenance-flags.nix { inherit lib kernelProvenance; }; in @@ -281,17 +283,26 @@ stdenv.mkDerivation (prevAttrs: { ] ++ lib.optionals cudaSupport [ (lib.cmakeFeature "CMAKE_CUDA_HOST_COMPILER" "${stdenv.cc}/bin/g++") + (lib.cmakeFeature "GPU_LANG" "CUDA") ] ++ lib.optionals rocmSupport [ # Ensure sure that we use HIP from our CLR override and not HIP from # the symlink-joined ROCm toolkit. (lib.cmakeFeature "CMAKE_HIP_COMPILER_ROCM_ROOT" "${clr}") (lib.cmakeFeature "HIP_ROOT_DIR" "${clr}") + (lib.cmakeFeature "GPU_LANG" "HIP") ] ++ lib.optionals metalSupport [ # Use host compiler for Metal. Not included in the redistributable SDK. # Re-enable when the issue mentioned in preConfigure is solved. #(lib.cmakeFeature "METAL_COMPILER" "${xcrunHost}/bin/xcrunHost") + (lib.cmakeFeature "GPU_LANG" "METAL") + ] + ++ lib.optionals xpuSupport [ + (lib.cmakeFeature "GPU_LANG" "SYCL") + ] + ++ lib.optionals cpuSupport [ + (lib.cmakeFeature "GPU_LANG" "CPU") ]; postInstall = '' From ecabdc2e6dadfe0d2f6a3ded542d70295f960fde Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Dani=C3=ABl=20de=20Kok?= Date: Tue, 13 Oct 2026 12:36:01 +0200 Subject: [PATCH 2/2] CI: reduce chance of transient errors by disabling unneeded DNF repo --- nix-builder/tests/Dockerfile.test-kernel | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/nix-builder/tests/Dockerfile.test-kernel b/nix-builder/tests/Dockerfile.test-kernel index d53c8668..1ce2a5bd 100644 --- a/nix-builder/tests/Dockerfile.test-kernel +++ b/nix-builder/tests/Dockerfile.test-kernel @@ -15,8 +15,10 @@ ENV DEBIAN_FRONTEND=noninteractive \ NVIDIA_DRIVER_CAPABILITIES=compute,utility # Install uv and Rust toolchain (Rust is needed to build kernels from source, which -# bundles a maturin/pyo3 extension module). -RUN dnf install -y --allowerasing curl && \ +# bundles a maturin/pyo3 extension module). We disable the CUDA repo, because we +# don't need it for curl and it reduces the chance of transient errors when +# installing. +RUN dnf install -y --allowerasing --disablerepo=cuda curl && \ curl -LsSf https://astral.sh/uv/install.sh | sh && \ curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh -s -- -y && \ dnf clean all