Skip to content

Commit 5ff3f69

Browse files
committed
Add dynamic shared memory arg for olLaunchKernel
1 parent c42c62a commit 5ff3f69

File tree

5 files changed

+16
-8
lines changed

5 files changed

+16
-8
lines changed

offload/liboffload/API/Kernel.td

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,8 @@ def : Struct {
3434
StructMember<"size_t", "NumGroupsZ", "Number of work groups on the Z dimension">,
3535
StructMember<"size_t", "GroupSizeX", "Size of a work group on the X dimension.">,
3636
StructMember<"size_t", "GroupSizeY", "Size of a work group on the Y dimension.">,
37-
StructMember<"size_t", "GroupSizeZ", "Size of a work group on the Z dimension.">
37+
StructMember<"size_t", "GroupSizeZ", "Size of a work group on the Z dimension.">,
38+
StructMember<"size_t", "DynSharedMemory", "Size of dynamic shared memory in bytes.">
3839
];
3940
}
4041

offload/liboffload/include/generated/OffloadAPI.h

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -736,13 +736,14 @@ OL_APIEXPORT ol_result_t OL_APICALL olGetKernel(
736736
///////////////////////////////////////////////////////////////////////////////
737737
/// @brief Size-related arguments for a kernel launch.
738738
typedef struct ol_kernel_launch_size_args_t {
739-
size_t Dimensions; /// Number of work dimensions
740-
size_t NumGroupsX; /// Number of work groups on the X dimension
741-
size_t NumGroupsY; /// Number of work groups on the Y dimension
742-
size_t NumGroupsZ; /// Number of work groups on the Z dimension
743-
size_t GroupSizeX; /// Size of a work group on the X dimension.
744-
size_t GroupSizeY; /// Size of a work group on the Y dimension.
745-
size_t GroupSizeZ; /// Size of a work group on the Z dimension.
739+
size_t Dimensions; /// Number of work dimensions
740+
size_t NumGroupsX; /// Number of work groups on the X dimension
741+
size_t NumGroupsY; /// Number of work groups on the Y dimension
742+
size_t NumGroupsZ; /// Number of work groups on the Z dimension
743+
size_t GroupSizeX; /// Size of a work group on the X dimension.
744+
size_t GroupSizeY; /// Size of a work group on the Y dimension.
745+
size_t GroupSizeZ; /// Size of a work group on the Z dimension.
746+
size_t DynSharedMemory; /// Size of dynamic shared memory in bytes.
746747
} ol_kernel_launch_size_args_t;
747748

748749
///////////////////////////////////////////////////////////////////////////////

offload/liboffload/include/generated/OffloadPrint.hpp

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -362,6 +362,9 @@ operator<<(llvm::raw_ostream &os,
362362
os << ", ";
363363
os << ".GroupSizeZ = ";
364364
os << params.GroupSizeZ;
365+
os << ", ";
366+
os << ".DynSharedMemory = ";
367+
os << params.DynSharedMemory;
365368
os << "}";
366369
return os;
367370
}

offload/liboffload/src/OffloadImpl.cpp

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -524,6 +524,7 @@ olLaunchKernel_impl(ol_queue_handle_t Queue, ol_device_handle_t Device,
524524
LaunchArgs.ThreadLimit[0] = LaunchSizeArgs->GroupSizeX;
525525
LaunchArgs.ThreadLimit[1] = LaunchSizeArgs->GroupSizeY;
526526
LaunchArgs.ThreadLimit[2] = LaunchSizeArgs->GroupSizeZ;
527+
LaunchArgs.DynCGroupMem = LaunchSizeArgs->DynSharedMemory;
527528

528529
KernelLaunchParamsTy Params;
529530
Params.Data = const_cast<void *>(ArgumentsData);

offload/unittests/OffloadAPI/kernel/olLaunchKernel.cpp

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,8 @@ struct olLaunchKernelTest : OffloadQueueTest {
2626
LaunchArgs.NumGroupsX = 1;
2727
LaunchArgs.NumGroupsY = 1;
2828
LaunchArgs.NumGroupsZ = 1;
29+
30+
LaunchArgs.DynSharedMemory = 0;
2931
}
3032

3133
void TearDown() override {

0 commit comments

Comments
 (0)