Skip to content

Commit e197941

Browse files
authored
Merge pull request #1037 from al42and/fix-cuda-11-8-compat
[UR][CUDA] Fix compatibility with CUDA 11.x
2 parents 1cc70f2 + 807434f commit e197941

File tree

1 file changed

+12
-1
lines changed

1 file changed

+12
-1
lines changed

source/adapters/cuda/command_buffer.cpp

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -140,8 +140,19 @@ urCommandBufferReleaseExp(ur_exp_command_buffer_handle_t hCommandBuffer) {
140140
UR_APIEXPORT ur_result_t UR_APICALL
141141
urCommandBufferFinalizeExp(ur_exp_command_buffer_handle_t hCommandBuffer) {
142142
try {
143+
const unsigned long long flags = 0;
144+
#if CUDA_VERSION >= 12000
143145
UR_CHECK_ERROR(cuGraphInstantiate(&hCommandBuffer->CudaGraphExec,
144-
hCommandBuffer->CudaGraph, 0));
146+
hCommandBuffer->CudaGraph, flags));
147+
#elif CUDA_VERSION >= 11040
148+
UR_CHECK_ERROR(cuGraphInstantiateWithFlags(
149+
&hCommandBuffer->CudaGraphExec, hCommandBuffer->CudaGraph, flags));
150+
#else
151+
// Cannot use flags
152+
UR_CHECK_ERROR(cuGraphInstantiate(&hCommandBuffer->CudaGraphExec,
153+
hCommandBuffer->CudaGraph, nullptr,
154+
nullptr, 0));
155+
#endif
145156
} catch (...) {
146157
return UR_RESULT_ERROR_UNKNOWN;
147158
}

0 commit comments

Comments
 (0)