Move ClCoreHelper ownership to RootDeviceEnvironment 4/n

Related-To: NEO-6853
Signed-off-by: Kamil Kopryk <kamil.kopryk@intel.com>

Use RootDeviceEnvironment getHelper<ClCoreHelper> for
- isSupportedKernelThreadArbitrationPolicy
- getSupportedThreadArbitrationPolicies
This commit is contained in:
Kamil Kopryk
2022-11-15 12:33:37 +00:00
committed by Compute-Runtime-Automation
parent 6648adef15
commit 0e47bcde1d
6 changed files with 36 additions and 38 deletions

View File

@ -381,8 +381,8 @@ void ClDevice::initializeCaps() {
getQueueFamilyName(properties.name, engineGroup.engineGroupType);
deviceInfo.queueFamilyProperties.push_back(properties);
}
auto &clHwHelper = NEO::ClHwHelper::get(hwInfo.platform.eRenderCoreFamily);
const std::vector<uint32_t> &supportedThreadArbitrationPolicies = clHwHelper.getSupportedThreadArbitrationPolicies();
auto &clCoreHelper = this->getRootDeviceEnvironment().getHelper<ClCoreHelper>();
const std::vector<uint32_t> &supportedThreadArbitrationPolicies = clCoreHelper.getSupportedThreadArbitrationPolicies();
deviceInfo.supportedThreadArbitrationPolicies.resize(supportedThreadArbitrationPolicies.size());
for (size_t policy = 0u; policy < supportedThreadArbitrationPolicies.size(); policy++) {
deviceInfo.supportedThreadArbitrationPolicies[policy] = supportedThreadArbitrationPolicies[policy];

View File

@ -2278,10 +2278,9 @@ void Kernel::updateAuxTranslationRequired() {
}
int Kernel::setKernelThreadArbitrationPolicy(uint32_t policy) {
auto &hwInfo = clDevice.getHardwareInfo();
auto &hwHelper = NEO::ClHwHelper::get(hwInfo.platform.eRenderCoreFamily);
auto &clCoreHelper = clDevice.getRootDeviceEnvironment().getHelper<ClCoreHelper>();
auto &threadArbitrationPolicy = const_cast<ThreadArbitrationPolicy &>(getDescriptor().kernelAttributes.threadArbitrationPolicy);
if (!hwHelper.isSupportedKernelThreadArbitrationPolicy()) {
if (!clCoreHelper.isSupportedKernelThreadArbitrationPolicy()) {
threadArbitrationPolicy = ThreadArbitrationPolicy::NotPresent;
return CL_INVALID_DEVICE;
} else if (policy == CL_KERNEL_EXEC_INFO_THREAD_ARBITRATION_POLICY_ROUND_ROBIN_INTEL) {

View File

@ -337,8 +337,8 @@ HWTEST2_F(clGetDeviceInfoTests, givenClDeviceSupportedThreadArbitrationPolicyInt
}
HWTEST_F(clGetDeviceInfoTests, givenClDeviceSupportedThreadArbitrationPolicyIntelWhenThreadArbitrationPolicyChangeNotSupportedAndCallClGetDeviceInfoThenParamRetSizeIsZero) {
auto &hwHelper = NEO::ClHwHelper::get(defaultHwInfo->platform.eRenderCoreFamily);
if (hwHelper.isSupportedKernelThreadArbitrationPolicy()) {
auto &clCoreHelper = this->pDevice->getRootDeviceEnvironment().getHelper<ClCoreHelper>();
if (clCoreHelper.isSupportedKernelThreadArbitrationPolicy()) {
GTEST_SKIP();
}
cl_device_info paramName = 0;

View File

@ -53,7 +53,7 @@ class KernelExecInfoFixture : public ApiFixture<> {
cl_device_svm_capabilities svmCapabilities = 0;
};
typedef Test<KernelExecInfoFixture> clSetKernelExecInfoTests;
using clSetKernelExecInfoTests = Test<KernelExecInfoFixture>;
namespace ULT {
@ -68,8 +68,8 @@ TEST_F(clSetKernelExecInfoTests, GivenNullKernelWhenSettingAdditionalKernelInfoT
}
TEST_F(clSetKernelExecInfoTests, GivenDeviceNotSupportingSvmWhenSettingKernelExecInfoThenErrorIsReturnedOnSvmRelatedParams) {
auto &hwHelper = NEO::ClHwHelper::get(pDevice->getHardwareInfo().platform.eRenderCoreFamily);
if (!hwHelper.isSupportedKernelThreadArbitrationPolicy()) {
auto &clCoreHelper = pDevice->getRootDeviceEnvironment().getHelper<ClCoreHelper>();
if (!clCoreHelper.isSupportedKernelThreadArbitrationPolicy()) {
GTEST_SKIP();
}
auto hwInfo = executionEnvironment->rootDeviceEnvironments[ApiFixture::testedRootDeviceIndex]->getMutableHardwareInfo();
@ -304,54 +304,51 @@ TEST_F(clSetKernelExecInfoTests, givenNonExistingParamNameWithValuesWhenSettingA
}
HWTEST_F(clSetKernelExecInfoTests, givenKernelExecInfoThreadArbitrationPolicyWhenSettingAdditionalKernelInfoThenSuccessIsReturned) {
auto &hwHelper = NEO::ClHwHelper::get(pDevice->getHardwareInfo().platform.eRenderCoreFamily);
if (!hwHelper.isSupportedKernelThreadArbitrationPolicy()) {
auto &clCoreHelper = pDevice->getRootDeviceEnvironment().getHelper<ClCoreHelper>();
if (!clCoreHelper.isSupportedKernelThreadArbitrationPolicy()) {
GTEST_SKIP();
}
uint32_t newThreadArbitrationPolicy = CL_KERNEL_EXEC_INFO_THREAD_ARBITRATION_POLICY_ROUND_ROBIN_INTEL;
size_t ptrSizeInBytes = sizeof(uint32_t *);
retVal = clSetKernelExecInfo(
pMockMultiDeviceKernel, // cl_kernel kernel
CL_KERNEL_EXEC_INFO_THREAD_ARBITRATION_POLICY_INTEL, // cl_kernel_exec_info param_name
ptrSizeInBytes, // size_t param_value_size
&newThreadArbitrationPolicy // const void *param_value
);
pMockMultiDeviceKernel,
CL_KERNEL_EXEC_INFO_THREAD_ARBITRATION_POLICY_INTEL,
ptrSizeInBytes,
&newThreadArbitrationPolicy);
EXPECT_EQ(CL_SUCCESS, retVal);
EXPECT_EQ(getNewKernelArbitrationPolicy(newThreadArbitrationPolicy), pMockKernel->getDescriptor().kernelAttributes.threadArbitrationPolicy);
}
HWTEST_F(clSetKernelExecInfoTests, givenKernelExecInfoThreadArbitrationPolicyWhenNotSupportedAndSettingAdditionalKernelInfoThenClInvalidDeviceIsReturned) {
auto &hwHelper = NEO::ClHwHelper::get(pDevice->getHardwareInfo().platform.eRenderCoreFamily);
if (hwHelper.isSupportedKernelThreadArbitrationPolicy()) {
auto &clCoreHelper = pDevice->getRootDeviceEnvironment().getHelper<ClCoreHelper>();
if (clCoreHelper.isSupportedKernelThreadArbitrationPolicy()) {
GTEST_SKIP();
}
uint32_t newThreadArbitrationPolicy = CL_KERNEL_EXEC_INFO_THREAD_ARBITRATION_POLICY_ROUND_ROBIN_INTEL;
size_t ptrSizeInBytes = sizeof(uint32_t *);
retVal = clSetKernelExecInfo(
pMockMultiDeviceKernel, // cl_kernel kernel
CL_KERNEL_EXEC_INFO_THREAD_ARBITRATION_POLICY_INTEL, // cl_kernel_exec_info param_name
ptrSizeInBytes, // size_t param_value_size
&newThreadArbitrationPolicy // const void *param_value
);
pMockMultiDeviceKernel,
CL_KERNEL_EXEC_INFO_THREAD_ARBITRATION_POLICY_INTEL,
ptrSizeInBytes,
&newThreadArbitrationPolicy);
EXPECT_EQ(CL_INVALID_DEVICE, retVal);
}
HWTEST_F(clSetKernelExecInfoTests, givenInvalidThreadArbitrationPolicyWhenSettingAdditionalKernelInfoThenClInvalidValueIsReturned) {
auto &hwHelper = NEO::ClHwHelper::get(pDevice->getHardwareInfo().platform.eRenderCoreFamily);
if (!hwHelper.isSupportedKernelThreadArbitrationPolicy()) {
auto &clCoreHelper = pDevice->getRootDeviceEnvironment().getHelper<ClCoreHelper>();
if (!clCoreHelper.isSupportedKernelThreadArbitrationPolicy()) {
GTEST_SKIP();
}
uint32_t invalidThreadArbitrationPolicy = 0;
size_t ptrSizeInBytes = 1 * sizeof(uint32_t *);
retVal = clSetKernelExecInfo(
pMockMultiDeviceKernel, // cl_kernel kernel
CL_KERNEL_EXEC_INFO_THREAD_ARBITRATION_POLICY_INTEL, // cl_kernel_exec_info param_name
ptrSizeInBytes, // size_t param_value_size
&invalidThreadArbitrationPolicy // const void *param_value
);
pMockMultiDeviceKernel,
CL_KERNEL_EXEC_INFO_THREAD_ARBITRATION_POLICY_INTEL,
ptrSizeInBytes,
&invalidThreadArbitrationPolicy);
EXPECT_EQ(CL_INVALID_VALUE, retVal);
}

View File

@ -586,8 +586,8 @@ HWTEST_F(EnqueueHandlerTest, givenEnqueueHandlerWhenSubCaptureIsOnThenActivateSu
HWTEST_F(EnqueueHandlerTest, givenEnqueueHandlerWhenClSetKernelExecInfoAlreadySetKernelThreadArbitrationPolicyThenRequiredThreadArbitrationPolicyIsSetProperly) {
REQUIRE_SVM_OR_SKIP(pClDevice);
auto &hwHelper = NEO::ClHwHelper::get(pClDevice->getHardwareInfo().platform.eRenderCoreFamily);
if (!hwHelper.isSupportedKernelThreadArbitrationPolicy()) {
auto &clCoreHelper = pClDevice->getRootDeviceEnvironment().getHelper<ClCoreHelper>();
if (!clCoreHelper.isSupportedKernelThreadArbitrationPolicy()) {
GTEST_SKIP();
}
DebugManagerStateRestore stateRestore;
@ -623,8 +623,8 @@ HWTEST_F(EnqueueHandlerTest, givenEnqueueHandlerWhenClSetKernelExecInfoAlreadySe
}
HWTEST_F(EnqueueHandlerTest, givenEnqueueHandlerWhenNotSupportedPolicyChangeThenRequiredThreadArbitrationPolicyNotChangedAndIsSetAsDefault) {
auto &hwHelper = NEO::ClHwHelper::get(pClDevice->getHardwareInfo().platform.eRenderCoreFamily);
if (hwHelper.isSupportedKernelThreadArbitrationPolicy()) {
auto &clCoreHelper = pClDevice->getRootDeviceEnvironment().getHelper<ClCoreHelper>();
if (clCoreHelper.isSupportedKernelThreadArbitrationPolicy()) {
GTEST_SKIP();
}
DebugManagerStateRestore stateRestore;

View File

@ -2834,11 +2834,13 @@ TEST(KernelTest, givenDefaultKernelWhenItIsCreatedThenItReportsStatelessWrites)
}
TEST(KernelTest, givenPolicyWhensetKernelThreadArbitrationPolicyThenExpectedClValueIsReturned) {
auto &hwHelper = NEO::ClHwHelper::get(defaultHwInfo->platform.eRenderCoreFamily);
if (!hwHelper.isSupportedKernelThreadArbitrationPolicy()) {
auto device = std::make_unique<MockClDevice>(MockDevice::createWithNewExecutionEnvironment<MockDevice>(defaultHwInfo.get()));
auto &clCoreHelper = device->getRootDeviceEnvironment().getHelper<ClCoreHelper>();
if (!clCoreHelper.isSupportedKernelThreadArbitrationPolicy()) {
GTEST_SKIP();
}
auto device = std::make_unique<MockClDevice>(MockDevice::createWithNewExecutionEnvironment<MockDevice>(defaultHwInfo.get()));
MockKernelWithInternals kernel(*device);
EXPECT_EQ(CL_SUCCESS, kernel.mockKernel->setKernelThreadArbitrationPolicy(CL_KERNEL_EXEC_INFO_THREAD_ARBITRATION_POLICY_ROUND_ROBIN_INTEL));
EXPECT_EQ(CL_SUCCESS, kernel.mockKernel->setKernelThreadArbitrationPolicy(CL_KERNEL_EXEC_INFO_THREAD_ARBITRATION_POLICY_OLDEST_FIRST_INTEL));