Skip to content

Commit a000354

Browse files
committed
Replace urEnqueueKernelLaunch property list with pNext chain property structs
1 parent cf176de commit a000354

40 files changed

+734
-662
lines changed

sycl/source/detail/scheduler/commands.cpp

Lines changed: 22 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -2514,39 +2514,42 @@ static ur_result_t SetKernelParamsAndLaunch(
25142514
NDRDesc.GlobalOffset[1] != 0 ||
25152515
NDRDesc.GlobalOffset[2] != 0;
25162516

2517-
std::vector<ur_kernel_launch_property_t> property_list;
2517+
ur_kernel_launch_ext_properties_t property_list = {
2518+
UR_STRUCTURE_TYPE_KERNEL_LAUNCH_EXT_PROPERTIES, nullptr, 0};
2519+
void **last_pNext = &property_list.pNext;
25182520

25192521
if (KernelUsesClusterLaunch) {
2520-
ur_kernel_launch_property_value_t launch_property_value_cluster_range;
2521-
launch_property_value_cluster_range.clusterDim[0] =
2522-
NDRDesc.ClusterDimensions[0];
2523-
launch_property_value_cluster_range.clusterDim[1] =
2524-
NDRDesc.ClusterDimensions[1];
2525-
launch_property_value_cluster_range.clusterDim[2] =
2526-
NDRDesc.ClusterDimensions[2];
2527-
2528-
property_list.push_back({UR_KERNEL_LAUNCH_PROPERTY_ID_CLUSTER_DIMENSION,
2529-
launch_property_value_cluster_range});
2522+
ur_kernel_launch_cluster_property_t launch_property_cluster_range;
2523+
launch_property_cluster_range.stype =
2524+
UR_STRUCTURE_TYPE_KERNEL_LAUNCH_CLUSTER_PROPERTY;
2525+
launch_property_cluster_range.pNext = nullptr;
2526+
launch_property_cluster_range.clusterDim[0] = NDRDesc.ClusterDimensions[0];
2527+
launch_property_cluster_range.clusterDim[1] = NDRDesc.ClusterDimensions[1];
2528+
launch_property_cluster_range.clusterDim[2] = NDRDesc.ClusterDimensions[2];
2529+
*last_pNext = &launch_property_cluster_range;
2530+
last_pNext = &launch_property_cluster_range.pNext;
25302531
}
25312532
if (IsCooperative) {
2532-
ur_kernel_launch_property_value_t launch_property_value_cooperative;
2533-
launch_property_value_cooperative.cooperative = 1;
2534-
property_list.push_back({UR_KERNEL_LAUNCH_PROPERTY_ID_COOPERATIVE,
2535-
launch_property_value_cooperative});
2533+
property_list.flags |= UR_KERNEL_LAUNCH_FLAG_COOPERATIVE;
25362534
}
25372535
// If there is no implicit arg, let the driver handle it via a property
25382536
if (WorkGroupMemorySize && !ImplicitLocalArg.has_value()) {
2539-
property_list.push_back({UR_KERNEL_LAUNCH_PROPERTY_ID_WORK_GROUP_MEMORY,
2540-
{{WorkGroupMemorySize}}});
2537+
ur_kernel_launch_workgroup_property_t workgroup_property;
2538+
workgroup_property.stype =
2539+
UR_STRUCTURE_TYPE_KERNEL_LAUNCH_WORKGROUP_PROPERTY;
2540+
workgroup_property.pNext = nullptr;
2541+
workgroup_property.workGroupMemSize = WorkGroupMemorySize;
2542+
*last_pNext = &workgroup_property;
2543+
last_pNext = &workgroup_property.pNext;
25412544
}
25422545
ur_event_handle_t UREvent = nullptr;
25432546
ur_result_t Error =
25442547
Adapter.call_nocheck<UrApiKind::urEnqueueKernelLaunchWithArgsExp>(
25452548
Queue.getHandleRef(), Kernel, NDRDesc.Dims,
25462549
HasOffset ? &NDRDesc.GlobalOffset[0] : nullptr,
25472550
&NDRDesc.GlobalSize[0], LocalSize, UrArgs.size(), UrArgs.data(),
2548-
property_list.size(),
2549-
property_list.empty() ? nullptr : property_list.data(),
2551+
(property_list.flags || property_list.pNext) ? &property_list
2552+
: nullptr,
25502553
RawEvents.size(), RawEvents.empty() ? nullptr : &RawEvents[0],
25512554
OutEventImpl ? &UREvent : nullptr);
25522555
if (Error == UR_RESULT_SUCCESS && OutEventImpl) {

unified-runtime/examples/codegen/codegen.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -150,7 +150,7 @@ int main() {
150150
const size_t lWorkSize[] = {1, 1, 1};
151151
ur_event_handle_t event;
152152
ur_check(urEnqueueKernelLaunch(queue, hKernel, 3, gWorkOffset, gWorkSize,
153-
lWorkSize, 0, nullptr, &event));
153+
lWorkSize, nullptr, &event));
154154

155155
ur_check(urEnqueueMemBufferRead(queue, dB, true, 0, a_size * sizeof(int),
156156
b.data, 1, &event, nullptr));

unified-runtime/include/ur_api.h

Lines changed: 71 additions & 55 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

unified-runtime/include/ur_ddi.h

Lines changed: 5 additions & 6 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

unified-runtime/include/ur_print.h

Lines changed: 26 additions & 6 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)