Skip to content

Commit 08e481b

Browse files
committed
Enable coop kernel launch, when offset nullptr.
offset is always nullptr in practice, this is a future proof api. globaloffset is deprecated. Signed-off-by: JackAKirk <[email protected]>
1 parent 0354659 commit 08e481b

File tree

1 file changed

+12
-3
lines changed

1 file changed

+12
-3
lines changed

source/adapters/cuda/enqueue.cpp

Lines changed: 12 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -535,9 +535,18 @@ UR_APIEXPORT ur_result_t UR_APICALL urEnqueueCooperativeKernelLaunchExp(
535535
const size_t *pGlobalWorkOffset, const size_t *pGlobalWorkSize,
536536
const size_t *pLocalWorkSize, uint32_t numEventsInWaitList,
537537
const ur_event_handle_t *phEventWaitList, ur_event_handle_t *phEvent) {
538-
return urEnqueueKernelLaunch(hQueue, hKernel, workDim, pGlobalWorkOffset,
539-
pGlobalWorkSize, pLocalWorkSize,
540-
numEventsInWaitList, phEventWaitList, phEvent);
538+
if (pGlobalWorkOffset == nullptr) {
539+
ur_exp_launch_property_t coop_prop;
540+
coop_prop.id = UR_EXP_LAUNCH_PROPERTY_ID_COOPERATIVE;
541+
coop_prop.value.cooperative = 1;
542+
return urEnqueueKernelLaunchCustomExp(
543+
hQueue, hKernel, workDim, pGlobalWorkSize, pLocalWorkSize, 1,
544+
&coop_prop, numEventsInWaitList, phEventWaitList, phEvent);
545+
} else {
546+
return urEnqueueKernelLaunch(hQueue, hKernel, workDim, pGlobalWorkOffset,
547+
pGlobalWorkSize, pLocalWorkSize,
548+
numEventsInWaitList, phEventWaitList, phEvent);
549+
}
541550
}
542551

543552
UR_APIEXPORT ur_result_t UR_APICALL urEnqueueKernelLaunchCustomExp(

0 commit comments

Comments
 (0)