Skip to content

Commit e2b8523

Browse files
committed
make kernel properties mutable; remove unused field
1 parent 26a1231 commit e2b8523

File tree

2 files changed

+3
-8
lines changed

2 files changed

+3
-8
lines changed

offload/plugins-nextgen/level_zero/include/L0Kernel.h

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -66,7 +66,6 @@ struct KernelPropertiesTy {
6666
ze_kernel_indirect_access_flags_t IndirectAccessFlags = UINT32_MAX;
6767
uint32_t GroupSizes[3] = {0, 0, 0};
6868
ze_group_count_t GroupCounts{0, 0, 0};
69-
bool AllowCooperative = false;
7069

7170
std::mutex Mtx;
7271

@@ -96,8 +95,7 @@ class L0KernelTy : public GenericKernelTy {
9695
// L0 Kernel Handle
9796
ze_kernel_handle_t zeKernel;
9897
// Kernel Properties
99-
KernelPropertiesTy Properties;
100-
KernelPropertiesTy &getProperties() { return Properties; }
98+
mutable KernelPropertiesTy Properties;
10199

102100
void decideKernelGroupArguments(L0DeviceTy &Device, uint32_t NumTeams,
103101
uint32_t ThreadLimit, uint32_t *GroupSizes,
@@ -119,7 +117,7 @@ class L0KernelTy : public GenericKernelTy {
119117
L0KernelTy &operator=(const L0KernelTy &) = delete;
120118
L0KernelTy &operator=(const L0KernelTy &&) = delete;
121119

122-
const KernelPropertiesTy &getProperties() const { return Properties; }
120+
KernelPropertiesTy &getProperties() const { return Properties; }
123121

124122
/// Initialize the L0 kernel.
125123
Error initImpl(GenericDeviceTy &GenericDevice, DeviceImageTy &Image) override;

offload/plugins-nextgen/level_zero/src/L0Kernel.cpp

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -434,10 +434,7 @@ Error L0KernelTy::launchImpl(GenericDeviceTy &GenericDevice,
434434
}
435435
auto *AsyncQueue =
436436
IsAsync ? static_cast<AsyncQueueTy *>(AsyncInfo->Queue) : NULL;
437-
438-
// We need to get a non-const version of the Properties structure in order to
439-
// use its lock and be able to cache the group params and indirect flags
440-
auto &KernelPR = const_cast<KernelPropertiesTy &>(getProperties());
437+
auto &KernelPR = getProperties();
441438

442439
L0LaunchEnvTy KEnv(IsAsync, AsyncQueue, KernelPR);
443440

0 commit comments

Comments
 (0)