Skip to content

Commit 686fd3c

Browse files
authored
Fix cuda 12.1 windows Build (#15614)
### Description Fix CUDA 12.1 Windows build error of cuda namespace ambiguous. Use a new namespace for attention softmax. Tested with VS 2019 and VS 2022 with the following settings: - OS: Microsoft Windows 11 Enterprise (Version 10.0.22621 Build 22621) - CUDA: cuda_12.1.0_531.14_windows - TensorRT: TensorRT-8.6.0.12.Windows10.x86_64.cuda-12.0 - CUDNN: 8.8.1.3 for cuda 12 - Visual Studio Enterprise 2019, version 16.11.26 (MSVC v142) or Visual Studio Enterprise 2022 (64-bit), version 17.5.4 - Python: 3.10 - CMake: 3.25.2 VS 2019: ``` build.bat --cmake_generator "Visual Studio 16 2019" --config Release --cmake_extra_defines "CMAKE_CUDA_ARCHITECTURES=52;60;61;70;75;80;86" --skip_submodule_sync --parallel --build_shared_lib --update --build --build_dir .\build\trt --use_cuda --cuda_version "12.1" --cuda_home "C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v12.1" --cudnn_home "C:\CuDNN\8.8.1.3_cuda12" --use_tensorrt --tensorrt_home "C:\TensorRT-8.6.0.12.Windows10.x86_64.cuda-12.0\TensorRT-8.6.0.12" ``` VS 2022: ``` build.bat --cmake_generator "Visual Studio 17 2022" --config Release --cmake_extra_defines "CMAKE_CUDA_ARCHITECTURES=52;60;61;70;75;80;86" --skip_submodule_sync --parallel --build_shared_lib --update --build --build_dir .\build\trt_2022 --use_cuda --cuda_version "12.1" --cuda_home "C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v12.1" --cudnn_home "C:\CuDNN\8.8.1.3_cuda12" --use_tensorrt --tensorrt_home "C:\TensorRT-8.6.0.12.Windows10.x86_64.cuda-12.0\TensorRT-8.6.0.12" ``` ### Motivation and Context <!-- - Why is this change required? What problem does it solve? - If it fixes an open issue, please link to the issue here. --> #15242
1 parent dc53dde commit 686fd3c

File tree

5 files changed

+1009
-853
lines changed

5 files changed

+1009
-853
lines changed

cmake/onnxruntime_rocm_hipify.cmake

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@ set(contrib_ops_excluded_files
99
"bert/attention.h"
1010
"bert/attention_impl.cu"
1111
"bert/attention_softmax.h"
12+
"bert/attention_softmax.cu"
1213
"bert/decoder_masked_multihead_attention.h"
1314
"bert/decoder_masked_multihead_attention.cc"
1415
"bert/decoder_masked_self_attention.h"

onnxruntime/contrib_ops/cuda/bert/attention_impl.cu

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@ limitations under the License.
4444
#include "contrib_ops/cuda/bert/cutlass_fmha/memory_efficient_attention.h"
4545

4646
using namespace onnxruntime::cuda;
47-
using namespace cub;
47+
using namespace onnxruntime::contrib::attention_softmax_cuda;
4848

4949
namespace onnxruntime {
5050
namespace contrib {

0 commit comments

Comments
 (0)