From 4b31bed9830caae394411c9fd9be39f3080c19b9 Mon Sep 17 00:00:00 2001 From: Gaetan Lepage Date: Thu, 28 May 2026 21:56:19 +0000 Subject: [PATCH] cudaPackages.cuda_cccl: fix cpp syntax error on CUDA 13.2 https://github.com/NVIDIA/cccl/pull/8771 Fixes onnxruntime: https://github.com/microsoft/onnxruntime/issues/28023 --- .../cuda-modules/packages/cuda_cccl.nix | 34 +++++++++++++------ 1 file changed, 23 insertions(+), 11 deletions(-) diff --git a/pkgs/development/cuda-modules/packages/cuda_cccl.nix b/pkgs/development/cuda-modules/packages/cuda_cccl.nix index e49e0aa8427c..a10f165f2543 100644 --- a/pkgs/development/cuda-modules/packages/cuda_cccl.nix +++ b/pkgs/development/cuda-modules/packages/cuda_cccl.nix @@ -25,17 +25,29 @@ buildRedist { rmdir -v "$PWD/include/cccl" ''; - patches = lib.optionals (cudaAtLeast "12.9" && cudaOlder "13.0") [ - # Fix missing _CCCL_PP_SPLICE_WITH_IMPL20 in preprocessor.h - # https://github.com/NVIDIA/cccl/issues/4967 - # https://github.com/NVIDIA/cccl/pull/4972 - (fetchpatch { - name = "fix-missing-_CCCL_PP_SPLICE_WITH_IMPL20"; - url = "https://github.com/NVIDIA/cccl/commit/2c2276d8b19d737cb16811ce2eb761030f472e60.patch"; - stripLen = 1; - hash = "sha256-hYfMFsd7Y8CwuNGaPYG6uEB+lg1TmWSIIU5ToVMULKY="; - }) - ]; + patches = + lib.optionals (cudaAtLeast "12.9" && cudaOlder "13.0") [ + # Fix missing _CCCL_PP_SPLICE_WITH_IMPL20 in preprocessor.h + # https://github.com/NVIDIA/cccl/issues/4967 + # https://github.com/NVIDIA/cccl/pull/4972 + (fetchpatch { + name = "fix-missing-_CCCL_PP_SPLICE_WITH_IMPL20"; + url = "https://github.com/NVIDIA/cccl/commit/2c2276d8b19d737cb16811ce2eb761030f472e60.patch"; + stripLen = 1; + hash = "sha256-hYfMFsd7Y8CwuNGaPYG6uEB+lg1TmWSIIU5ToVMULKY="; + }) + ] + ++ lib.optionals (cudaAtLeast "13.2") [ + # Fix onnxruntime compilation error: https://github.com/microsoft/onnxruntime/issues/28023 + # Backport: https://github.com/NVIDIA/cccl/pull/8771 + (fetchpatch { + name = "fix-invalid-cpp-syntax"; + url = "https://github.com/NVIDIA/cccl/commit/8e41eeabe54ab9ae48ad5640cfa7153b0a1071af.patch"; + stripLen = 2; + extraPrefix = "include/"; + hash = "sha256-eko1GSD2NPSLtbQ3diwgKMbuS6wU9lHDOajLJy5lBwM="; + }) + ]; # NVIDIA, in their wisdom, expect CCCL to be a directory inside include. # https://github.com/NVIDIA/cutlass/blob/087c84df83d254b5fb295a7a408f1a1d554085cf/CMakeLists.txt#L773