Generate error when an explicit stream argument is not provided in the <<<...>>> kernel launch syntax (#6599)

* Generate error when an explicit stream argument is not provided in the <<<...>>> kernel launch syntax

Co-authored-by: Weixing Zhang <wezhan@microsoft.com>
This commit is contained in:
Weixing Zhang 2021-02-06 15:54:29 -08:00 committed by GitHub
parent d18aa45b46
commit c86c21e002
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 5 additions and 2 deletions

View file

@ -1199,6 +1199,9 @@ if (onnxruntime_USE_CUDA)
endif()
endif()
set(CMAKE_CUDA_FLAGS "${CMAKE_CUDA_FLAGS} --expt-relaxed-constexpr")
if (CMAKE_CUDA_COMPILER_VERSION VERSION_GREATER_EQUAL 11)
set(CMAKE_CUDA_FLAGS "${CMAKE_CUDA_FLAGS} --Werror default-stream-launch")
endif()
if (NOT WIN32)
set(CUDA_NVCC_FLAGS "${CUDA_NVCC_FLAGS} --compiler-options -fPIC")
endif()

View file

@ -15,7 +15,7 @@ __global__ void cuda_add_impl(int64_t N, float* O, const float* X, const float*
}
void cuda_add(int64_t N, float* O, const float* X, const float* Y) {
cuda_add_impl<<<1, 256>>>(N, O, X, Y);
cuda_add_impl<<<1, 256, 0, 0>>>(N, O, X, Y);
}
template<typename T>
@ -28,7 +28,7 @@ __global__ void cuda_slice_impl(const T* X , int64_t from, int64_t to, T* Y) {
template<typename T>
void cuda_slice(const T* X, int64_t from, int64_t to, T* Y) {
cuda_slice_impl<T><<<1, 256>>>(X, from, to, Y);
cuda_slice_impl<T><<<1, 256, 0, 0>>>(X, from, to, Y);
}
template void cuda_slice(const float*, int64_t, int64_t, float*);