From 9f064c20c0380c3e076e3e5b427e125e7396717e Mon Sep 17 00:00:00 2001 From: Tianlei Wu Date: Thu, 25 Jun 2026 14:15:38 -0700 Subject: [PATCH 1/4] fix wndows cuda 13.3 build --- cmake/onnxruntime_providers_cuda.cmake | 7 +++++++ cmake/onnxruntime_providers_cuda_plugin.cmake | 16 ++++++++++++++++ 2 files changed, 23 insertions(+) diff --git a/cmake/onnxruntime_providers_cuda.cmake b/cmake/onnxruntime_providers_cuda.cmake index f692f1f5e0a57..bf27f0120241e 100644 --- a/cmake/onnxruntime_providers_cuda.cmake +++ b/cmake/onnxruntime_providers_cuda.cmake @@ -306,6 +306,13 @@ endif() endif() + if (CMAKE_CUDA_COMPILER_VERSION VERSION_GREATER_EQUAL 13.3) + if (MSVC) + # CCCL cub/config.cuh has a #pragma warning(pop) without matching push. + target_compile_options(${target} PRIVATE "$<$:SHELL:-Xcompiler /wd4193>") + endif() + endif() + if (UNIX) target_compile_options(${target} PRIVATE "$<$:SHELL:-Xcompiler -Wno-reorder>" "$<$>:-Wno-reorder>") diff --git a/cmake/onnxruntime_providers_cuda_plugin.cmake b/cmake/onnxruntime_providers_cuda_plugin.cmake index 86e5579eb6761..8030f6ac35e8c 100644 --- a/cmake/onnxruntime_providers_cuda_plugin.cmake +++ b/cmake/onnxruntime_providers_cuda_plugin.cmake @@ -177,6 +177,13 @@ if (MSVC) "$<$:SHELL:-Xcompiler /bigobj>" ) + if (CMAKE_CUDA_COMPILER_VERSION VERSION_GREATER_EQUAL 13.3) + # CCCL cub/config.cuh has a #pragma warning(pop) without matching push. + target_compile_options(onnxruntime_providers_cuda_plugin PRIVATE + "$<$:SHELL:-Xcompiler /wd4193>" + ) + endif() + target_compile_options(onnxruntime_providers_cuda_plugin PRIVATE "$<$:/Zc:preprocessor>" # /permissive is required for CUTLASS cute headers (cute::stride.hpp, cute::Layout etc.) @@ -224,6 +231,15 @@ if (CMAKE_CUDA_COMPILER_VERSION VERSION_GREATER_EQUAL 12.8) endif() endif() +if (CMAKE_CUDA_COMPILER_VERSION VERSION_GREATER_EQUAL 13.0) + if (MSVC) + # CCCL cub/config.cuh has a #pragma warning(pop) without matching push. + list(APPEND _cuda_plugin_shared_compile_options + "$<$:SHELL:-Xcompiler /wd4193>" + ) + endif() +endif() + if (MSVC) list(APPEND _cuda_plugin_shared_compile_options "$<$:SHELL:-Xcompiler /permissive>" From d137dabc398e7533dd4eb36499d9d6047a951389 Mon Sep 17 00:00:00 2001 From: Tianlei Wu Date: Thu, 25 Jun 2026 14:29:08 -0700 Subject: [PATCH 2/4] fix build warnings for cuda 13.3 --- cmake/onnxruntime_providers_cuda.cmake | 7 +++++++ cmake/onnxruntime_providers_cuda_plugin.cmake | 16 ++++++++++++++++ 2 files changed, 23 insertions(+) diff --git a/cmake/onnxruntime_providers_cuda.cmake b/cmake/onnxruntime_providers_cuda.cmake index f692f1f5e0a57..bf27f0120241e 100644 --- a/cmake/onnxruntime_providers_cuda.cmake +++ b/cmake/onnxruntime_providers_cuda.cmake @@ -306,6 +306,13 @@ endif() endif() + if (CMAKE_CUDA_COMPILER_VERSION VERSION_GREATER_EQUAL 13.3) + if (MSVC) + # CCCL cub/config.cuh has a #pragma warning(pop) without matching push. + target_compile_options(${target} PRIVATE "$<$:SHELL:-Xcompiler /wd4193>") + endif() + endif() + if (UNIX) target_compile_options(${target} PRIVATE "$<$:SHELL:-Xcompiler -Wno-reorder>" "$<$>:-Wno-reorder>") diff --git a/cmake/onnxruntime_providers_cuda_plugin.cmake b/cmake/onnxruntime_providers_cuda_plugin.cmake index 86e5579eb6761..1a3cac9800a79 100644 --- a/cmake/onnxruntime_providers_cuda_plugin.cmake +++ b/cmake/onnxruntime_providers_cuda_plugin.cmake @@ -177,6 +177,13 @@ if (MSVC) "$<$:SHELL:-Xcompiler /bigobj>" ) + if (CMAKE_CUDA_COMPILER_VERSION VERSION_GREATER_EQUAL 13.3) + # CCCL cub/config.cuh has a #pragma warning(pop) without matching push. + target_compile_options(onnxruntime_providers_cuda_plugin PRIVATE + "$<$:SHELL:-Xcompiler /wd4193>" + ) + endif() + target_compile_options(onnxruntime_providers_cuda_plugin PRIVATE "$<$:/Zc:preprocessor>" # /permissive is required for CUTLASS cute headers (cute::stride.hpp, cute::Layout etc.) @@ -224,6 +231,15 @@ if (CMAKE_CUDA_COMPILER_VERSION VERSION_GREATER_EQUAL 12.8) endif() endif() +if (CMAKE_CUDA_COMPILER_VERSION VERSION_GREATER_EQUAL 13.3) + if (MSVC) + # CCCL cub/config.cuh has a #pragma warning(pop) without matching push. + list(APPEND _cuda_plugin_shared_compile_options + "$<$:SHELL:-Xcompiler /wd4193>" + ) + endif() +endif() + if (MSVC) list(APPEND _cuda_plugin_shared_compile_options "$<$:SHELL:-Xcompiler /permissive>" From 140679544a6f085a139f900643feaa3a309e29b0 Mon Sep 17 00:00:00 2001 From: Tianlei Wu Date: Sun, 28 Jun 2026 13:53:07 -0700 Subject: [PATCH 3/4] address feedbacks --- cmake/onnxruntime_providers_cuda.cmake | 7 ------- cmake/onnxruntime_providers_cuda_plugin.cmake | 16 ---------------- .../cuda/transformers/generation_cuda_impl.cu | 2 +- onnxruntime/core/providers/cuda/cu_inc/cub.cuh | 4 ++++ 4 files changed, 5 insertions(+), 24 deletions(-) diff --git a/cmake/onnxruntime_providers_cuda.cmake b/cmake/onnxruntime_providers_cuda.cmake index bf27f0120241e..f692f1f5e0a57 100644 --- a/cmake/onnxruntime_providers_cuda.cmake +++ b/cmake/onnxruntime_providers_cuda.cmake @@ -306,13 +306,6 @@ endif() endif() - if (CMAKE_CUDA_COMPILER_VERSION VERSION_GREATER_EQUAL 13.3) - if (MSVC) - # CCCL cub/config.cuh has a #pragma warning(pop) without matching push. - target_compile_options(${target} PRIVATE "$<$:SHELL:-Xcompiler /wd4193>") - endif() - endif() - if (UNIX) target_compile_options(${target} PRIVATE "$<$:SHELL:-Xcompiler -Wno-reorder>" "$<$>:-Wno-reorder>") diff --git a/cmake/onnxruntime_providers_cuda_plugin.cmake b/cmake/onnxruntime_providers_cuda_plugin.cmake index 8030f6ac35e8c..86e5579eb6761 100644 --- a/cmake/onnxruntime_providers_cuda_plugin.cmake +++ b/cmake/onnxruntime_providers_cuda_plugin.cmake @@ -177,13 +177,6 @@ if (MSVC) "$<$:SHELL:-Xcompiler /bigobj>" ) - if (CMAKE_CUDA_COMPILER_VERSION VERSION_GREATER_EQUAL 13.3) - # CCCL cub/config.cuh has a #pragma warning(pop) without matching push. - target_compile_options(onnxruntime_providers_cuda_plugin PRIVATE - "$<$:SHELL:-Xcompiler /wd4193>" - ) - endif() - target_compile_options(onnxruntime_providers_cuda_plugin PRIVATE "$<$:/Zc:preprocessor>" # /permissive is required for CUTLASS cute headers (cute::stride.hpp, cute::Layout etc.) @@ -231,15 +224,6 @@ if (CMAKE_CUDA_COMPILER_VERSION VERSION_GREATER_EQUAL 12.8) endif() endif() -if (CMAKE_CUDA_COMPILER_VERSION VERSION_GREATER_EQUAL 13.0) - if (MSVC) - # CCCL cub/config.cuh has a #pragma warning(pop) without matching push. - list(APPEND _cuda_plugin_shared_compile_options - "$<$:SHELL:-Xcompiler /wd4193>" - ) - endif() -endif() - if (MSVC) list(APPEND _cuda_plugin_shared_compile_options "$<$:SHELL:-Xcompiler /permissive>" diff --git a/onnxruntime/contrib_ops/cuda/transformers/generation_cuda_impl.cu b/onnxruntime/contrib_ops/cuda/transformers/generation_cuda_impl.cu index faf09a6eac1e6..ae595ea1b410e 100644 --- a/onnxruntime/contrib_ops/cuda/transformers/generation_cuda_impl.cu +++ b/onnxruntime/contrib_ops/cuda/transformers/generation_cuda_impl.cu @@ -1,7 +1,7 @@ // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. -#include +#include "core/providers/cuda/cu_inc/cub.cuh" #include "core/providers/cuda/cuda_common.h" #include "core/providers/cuda/cu_inc/common.cuh" diff --git a/onnxruntime/core/providers/cuda/cu_inc/cub.cuh b/onnxruntime/core/providers/cuda/cu_inc/cub.cuh index fe36ff71da33b..e88f780fd30b9 100644 --- a/onnxruntime/core/providers/cuda/cu_inc/cub.cuh +++ b/onnxruntime/core/providers/cuda/cu_inc/cub.cuh @@ -11,10 +11,14 @@ #if defined(_MSC_VER) #pragma push_macro("__out") #undef __out +// CCCL cub/config.cuh has a #pragma warning(pop) without matching push in CUDA v13.3. +#pragma warning(push) +#pragma warning(disable : 4193) #endif #include #if defined(_MSC_VER) +#pragma warning(pop) #pragma pop_macro("__out") #endif From 46bad85c18011e6bc55116b3984708164cb4b216 Mon Sep 17 00:00:00 2001 From: Tianlei Wu Date: Sun, 28 Jun 2026 14:01:56 -0700 Subject: [PATCH 4/4] Revert "fix build warnings for cuda 13.3" This reverts commit d137dabc398e7533dd4eb36499d9d6047a951389. --- cmake/onnxruntime_providers_cuda.cmake | 7 ------- cmake/onnxruntime_providers_cuda_plugin.cmake | 16 ---------------- 2 files changed, 23 deletions(-) diff --git a/cmake/onnxruntime_providers_cuda.cmake b/cmake/onnxruntime_providers_cuda.cmake index 01cb948901f38..2aa31276cc395 100644 --- a/cmake/onnxruntime_providers_cuda.cmake +++ b/cmake/onnxruntime_providers_cuda.cmake @@ -306,13 +306,6 @@ endif() endif() - if (CMAKE_CUDA_COMPILER_VERSION VERSION_GREATER_EQUAL 13.3) - if (MSVC) - # CCCL cub/config.cuh has a #pragma warning(pop) without matching push. - target_compile_options(${target} PRIVATE "$<$:SHELL:-Xcompiler /wd4193>") - endif() - endif() - if (UNIX) target_compile_options(${target} PRIVATE "$<$:SHELL:-Xcompiler -Wno-reorder>" "$<$>:-Wno-reorder>") diff --git a/cmake/onnxruntime_providers_cuda_plugin.cmake b/cmake/onnxruntime_providers_cuda_plugin.cmake index 1a3cac9800a79..86e5579eb6761 100644 --- a/cmake/onnxruntime_providers_cuda_plugin.cmake +++ b/cmake/onnxruntime_providers_cuda_plugin.cmake @@ -177,13 +177,6 @@ if (MSVC) "$<$:SHELL:-Xcompiler /bigobj>" ) - if (CMAKE_CUDA_COMPILER_VERSION VERSION_GREATER_EQUAL 13.3) - # CCCL cub/config.cuh has a #pragma warning(pop) without matching push. - target_compile_options(onnxruntime_providers_cuda_plugin PRIVATE - "$<$:SHELL:-Xcompiler /wd4193>" - ) - endif() - target_compile_options(onnxruntime_providers_cuda_plugin PRIVATE "$<$:/Zc:preprocessor>" # /permissive is required for CUTLASS cute headers (cute::stride.hpp, cute::Layout etc.) @@ -231,15 +224,6 @@ if (CMAKE_CUDA_COMPILER_VERSION VERSION_GREATER_EQUAL 12.8) endif() endif() -if (CMAKE_CUDA_COMPILER_VERSION VERSION_GREATER_EQUAL 13.3) - if (MSVC) - # CCCL cub/config.cuh has a #pragma warning(pop) without matching push. - list(APPEND _cuda_plugin_shared_compile_options - "$<$:SHELL:-Xcompiler /wd4193>" - ) - endif() -endif() - if (MSVC) list(APPEND _cuda_plugin_shared_compile_options "$<$:SHELL:-Xcompiler /permissive>"