Skip to content

Commit 80b520b

Browse files
Change ThreadArbitrationPolicy enum type to int32_t
Change ThreadArbitrationPolicy::NotPresent value to -1 Update initial values to ThreadArbitrationPolicy::NotPresent Related-To: NEO-6728 Signed-off-by: Filip Hazubski <[email protected]>
1 parent c612480 commit 80b520b

File tree

46 files changed

+109
-108
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

46 files changed

+109
-108
lines changed

level_zero/core/source/cmdlist/cmdlist.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -188,7 +188,7 @@ struct CommandList : _ze_command_list_handle_t {
188188
return commandListPreemptionMode;
189189
}
190190

191-
uint32_t getThreadArbitrationPolicy() const {
191+
int32_t getThreadArbitrationPolicy() const {
192192
return threadArbitrationPolicy;
193193
}
194194

@@ -256,7 +256,7 @@ struct CommandList : _ze_command_list_handle_t {
256256
uint32_t cmdListType = CommandListType::TYPE_REGULAR;
257257
uint32_t commandListPerThreadScratchSize = 0u;
258258
uint32_t commandListPerThreadPrivateScratchSize = 0u;
259-
uint32_t threadArbitrationPolicy = NEO::ThreadArbitrationPolicy::RoundRobin;
259+
int32_t threadArbitrationPolicy = NEO::ThreadArbitrationPolicy::NotPresent;
260260
uint32_t partitionCount = 1;
261261
bool isFlushTaskSubmissionEnabled = false;
262262
bool isSyncModeQueue = false;

level_zero/core/source/cmdlist/cmdlist_hw_xehp_and_later.inl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -211,7 +211,7 @@ ze_result_t CommandListCoreFamily<gfxCoreFamily>::appendLaunchKernelWithParams(z
211211
}
212212

213213
KernelImp *kernelImp = static_cast<KernelImp *>(kernel);
214-
if (kernelImp->getSchedulingHintExp() != std::numeric_limits<uint32_t>::max()) {
214+
if (kernelImp->getSchedulingHintExp() != NEO::ThreadArbitrationPolicy::NotPresent) {
215215
this->threadArbitrationPolicy = kernelImp->getSchedulingHintExp();
216216
}
217217

level_zero/core/source/device/device_imp.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -456,7 +456,7 @@ ze_result_t DeviceImp::getKernelProperties(ze_device_module_properties_t *pKerne
456456
reinterpret_cast<ze_scheduling_hint_exp_properties_t *>(extendedProperties);
457457
auto supportedThreadArbitrationPolicies = hwInfoConfig.getKernelSupportedThreadArbitrationPolicies();
458458
hintProperties->schedulingHintFlags = 0;
459-
for (uint32_t &p : supportedThreadArbitrationPolicies) {
459+
for (auto &p : supportedThreadArbitrationPolicies) {
460460
switch (p) {
461461
case NEO::ThreadArbitrationPolicy::AgeBased:
462462
hintProperties->schedulingHintFlags |= ZE_SCHEDULING_HINT_EXP_FLAG_OLDEST_FIRST;

level_zero/core/source/kernel/kernel_imp.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1013,7 +1013,7 @@ ze_result_t KernelImp::setSchedulingHintExp(ze_scheduling_hint_exp_desc_t *pHint
10131013
return ZE_RESULT_SUCCESS;
10141014
}
10151015

1016-
uint32_t KernelImp::getSchedulingHintExp() {
1016+
int32_t KernelImp::getSchedulingHintExp() {
10171017
if (NEO::DebugManager.flags.OverrideThreadArbitrationPolicy.get() != -1) {
10181018
this->schedulingHintExpFlag = static_cast<uint32_t>(NEO::DebugManager.flags.OverrideThreadArbitrationPolicy.get());
10191019
}

level_zero/core/source/kernel/kernel_imp.h

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@
77

88
#pragma once
99

10+
#include "shared/source/command_stream/thread_arbitration_policy.h"
1011
#include "shared/source/kernel/dispatch_kernel_encoder_interface.h"
1112
#include "shared/source/unified_memory/unified_memory.h"
1213

@@ -151,7 +152,7 @@ struct KernelImp : Kernel {
151152
}
152153

153154
ze_result_t setSchedulingHintExp(ze_scheduling_hint_exp_desc_t *pHint) override;
154-
uint32_t getSchedulingHintExp();
155+
int32_t getSchedulingHintExp();
155156

156157
NEO::ImplicitArgs *getImplicitArgs() const override { return pImplicitArgs.get(); }
157158

@@ -210,7 +211,7 @@ struct KernelImp : Kernel {
210211

211212
bool kernelHasIndirectAccess = true;
212213

213-
uint32_t schedulingHintExpFlag = std::numeric_limits<uint32_t>::max();
214+
int32_t schedulingHintExpFlag = NEO::ThreadArbitrationPolicy::NotPresent;
214215
std::unique_ptr<NEO::ImplicitArgs> pImplicitArgs;
215216
};
216217

level_zero/core/test/unit_tests/sources/cmdlist/test_cmdlist_append_launch_kernel_1.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -114,7 +114,7 @@ HWTEST_F(CommandListAppendLaunchKernel, givenKernelWithThreadArbitrationPolicySe
114114
auto result = commandList->appendLaunchKernel(kernel->toHandle(), &groupCount, nullptr, 0, nullptr);
115115

116116
ASSERT_EQ(ZE_RESULT_SUCCESS, result);
117-
ASSERT_EQ(commandList->threadArbitrationPolicy, 0u);
117+
ASSERT_EQ(0, commandList->threadArbitrationPolicy);
118118
delete (pHint);
119119
}
120120

level_zero/core/test/unit_tests/sources/device/test_device.cpp

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -785,7 +785,7 @@ HWTEST_F(DeviceTest, whenPassingSchedulingHintExpStructToGetPropertiesThenProper
785785

786786
EXPECT_NE(ZE_SCHEDULING_HINT_EXP_FLAG_FORCE_UINT32, schedulingHintProperties.schedulingHintFlags);
787787
auto supportedThreadArbitrationPolicies = NEO::PreambleHelper<FamilyType>::getSupportedThreadArbitrationPolicies();
788-
for (uint32_t &p : supportedThreadArbitrationPolicies) {
788+
for (auto &p : supportedThreadArbitrationPolicies) {
789789
switch (p) {
790790
case ThreadArbitrationPolicy::AgeBased:
791791
EXPECT_NE(0u, (schedulingHintProperties.schedulingHintFlags &
@@ -807,10 +807,10 @@ HWTEST_F(DeviceTest, whenPassingSchedulingHintExpStructToGetPropertiesThenProper
807807

808808
HWTEST2_F(DeviceTest, givenAllThreadArbitrationPoliciesWhenPassingSchedulingHintExpStructToGetPropertiesThenPropertiesWithAllFlagsAreReturned, MatchAny) {
809809
struct MockHwInfoConfig : NEO::HwInfoConfigHw<productFamily> {
810-
std::vector<uint32_t> getKernelSupportedThreadArbitrationPolicies() override {
810+
std::vector<int32_t> getKernelSupportedThreadArbitrationPolicies() override {
811811
return threadArbPolicies;
812812
}
813-
std::vector<uint32_t> threadArbPolicies;
813+
std::vector<int32_t> threadArbPolicies;
814814
};
815815

816816
const uint32_t rootDeviceIndex = 0u;
@@ -847,10 +847,10 @@ HWTEST2_F(DeviceTest, givenAllThreadArbitrationPoliciesWhenPassingSchedulingHint
847847

848848
HWTEST2_F(DeviceTest, givenIncorrectThreadArbitrationPolicyWhenPassingSchedulingHintExpStructToGetPropertiesThenNoneIsReturned, MatchAny) {
849849
struct MockHwInfoConfig : NEO::HwInfoConfigHw<productFamily> {
850-
std::vector<uint32_t> getKernelSupportedThreadArbitrationPolicies() override {
850+
std::vector<int32_t> getKernelSupportedThreadArbitrationPolicies() override {
851851
return threadArbPolicies;
852852
}
853-
std::vector<uint32_t> threadArbPolicies;
853+
std::vector<int32_t> threadArbPolicies;
854854
};
855855

856856
const uint32_t rootDeviceIndex = 0u;

opencl/source/kernel/kernel.h

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -309,7 +309,7 @@ class Kernel : public ReferenceTrackedObject<Kernel> {
309309

310310
bool isBuiltIn = false;
311311

312-
uint32_t getThreadArbitrationPolicy() const {
312+
int32_t getThreadArbitrationPolicy() const {
313313
return threadArbitrationPolicy;
314314
}
315315
KernelExecutionType getExecutionType() const {
@@ -352,7 +352,7 @@ class Kernel : public ReferenceTrackedObject<Kernel> {
352352
bool areStatelessWritesUsed() { return containsStatelessWrites; }
353353
int setKernelThreadArbitrationPolicy(uint32_t propertyValue);
354354
cl_int setKernelExecutionType(cl_execution_info_kernel_type_intel executionType);
355-
void setThreadArbitrationPolicy(uint32_t policy) {
355+
void setThreadArbitrationPolicy(int32_t policy) {
356356
this->threadArbitrationPolicy = policy;
357357
}
358358
void getSuggestedLocalWorkSize(const cl_uint workDim, const size_t *globalWorkSize, const size_t *globalWorkOffset,
@@ -455,7 +455,7 @@ class Kernel : public ReferenceTrackedObject<Kernel> {
455455
uint32_t patchedArgumentsNum = 0;
456456
uint32_t startOffset = 0;
457457
uint32_t statelessUncacheableArgsCount = 0;
458-
uint32_t threadArbitrationPolicy = ThreadArbitrationPolicy::NotPresent;
458+
int32_t threadArbitrationPolicy = ThreadArbitrationPolicy::NotPresent;
459459
KernelExecutionType executionType = KernelExecutionType::Default;
460460

461461
std::vector<PatchInfoData> patchInfoDataList;

opencl/source/xe_hp_core/cl_hw_helper_xe_hp_core.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright (C) 2021 Intel Corporation
2+
* Copyright (C) 2021-2022 Intel Corporation
33
*
44
* SPDX-License-Identifier: MIT
55
*
@@ -59,7 +59,7 @@ bool ClHwHelperHw<Family>::isSupportedKernelThreadArbitrationPolicy() const { re
5959

6060
template <>
6161
std::vector<uint32_t> ClHwHelperHw<Family>::getSupportedThreadArbitrationPolicies() const {
62-
return std::vector<uint32_t>{};
62+
return {};
6363
}
6464

6565
template <>

opencl/source/xe_hpg_core/cl_hw_helper_xe_hpg_core.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright (C) 2021 Intel Corporation
2+
* Copyright (C) 2021-2022 Intel Corporation
33
*
44
* SPDX-License-Identifier: MIT
55
*
@@ -46,7 +46,7 @@ bool ClHwHelperHw<Family>::requiresAuxResolves(const KernelInfo &kernelInfo, con
4646

4747
template <>
4848
std::vector<uint32_t> ClHwHelperHw<Family>::getSupportedThreadArbitrationPolicies() const {
49-
return std::vector<uint32_t>{};
49+
return {};
5050
}
5151

5252
template <>

0 commit comments

Comments
 (0)