diff --git a/opencl/test/unit_test/api/cl_build_program_tests.inl b/opencl/test/unit_test/api/cl_build_program_tests.inl index 81bb326806..47ca7fc95f 100644 --- a/opencl/test/unit_test/api/cl_build_program_tests.inl +++ b/opencl/test/unit_test/api/cl_build_program_tests.inl @@ -100,9 +100,8 @@ TEST_F(ClBuildProgramTests, GivenBinaryAsInputWhenCreatingProgramWithSourceThenP EXPECT_EQ(CL_SUCCESS, retVal); } -HWTEST_F(ClBuildProgramTests, GivenFailBuildProgramIsDisabledAndStatelessDisabledAndBinaryAsInputWhenCreatingProgramWithSourceThenProgramBuildSuccesses) { - debugManager.flags.FailBuildProgramWithStatefulAccess.set(0); - debugManager.flags.DisableForceToStateless.set(1); +HWTEST2_F(ClBuildProgramTests, GivenFailBuildProgramAndBinaryAsInputWhenCreatingProgramWithSourceThenProgramBuildFails, IsAtLeastXeHpcCore) { + debugManager.flags.FailBuildProgramWithStatefulAccess.set(1); cl_program pProgram = nullptr; cl_int binaryStatus = CL_SUCCESS; MockZebinWrapper zebin{pDevice->getHardwareInfo()}; @@ -127,7 +126,7 @@ HWTEST_F(ClBuildProgramTests, GivenFailBuildProgramIsDisabledAndStatelessDisable nullptr, nullptr); - EXPECT_EQ(CL_SUCCESS, retVal); + EXPECT_EQ(CL_BUILD_PROGRAM_FAILURE, retVal); retVal = clReleaseProgram(pProgram); EXPECT_EQ(CL_SUCCESS, retVal); diff --git a/opencl/test/unit_test/api/cl_create_program_with_binary_tests.inl b/opencl/test/unit_test/api/cl_create_program_with_binary_tests.inl index c67779306c..6f2f22c83c 100644 --- a/opencl/test/unit_test/api/cl_create_program_with_binary_tests.inl +++ b/opencl/test/unit_test/api/cl_create_program_with_binary_tests.inl @@ -88,7 +88,7 @@ TEST_F(ClCreateProgramWithBinaryTests, GivenInvalidInputWhenCreatingProgramWithB EXPECT_EQ(CL_INVALID_VALUE, retVal); EXPECT_EQ(nullptr, pProgram); - zebin.binarySizes[1] = zebin.data->storage.size(); + zebin.binarySizes[1] = zebin.data.storage.size(); pProgram = clCreateProgramWithBinary( pContext, diff --git a/opencl/test/unit_test/api/cl_get_program_info_tests.inl b/opencl/test/unit_test/api/cl_get_program_info_tests.inl index 88bada3429..40426e2c95 100644 --- a/opencl/test/unit_test/api/cl_get_program_info_tests.inl +++ b/opencl/test/unit_test/api/cl_get_program_info_tests.inl @@ -318,7 +318,7 @@ TEST(clGetProgramInfoTest, GivenMultiDeviceBuiltInProgramCreatedWithGenBinaryWhe cl_program pProgram = nullptr; cl_int retVal = CL_INVALID_PROGRAM; - pProgram = Program::createBuiltInFromGenBinary(&context, context.getDevices(), zebin.data->storage.data(), zebin.data->storage.size(), &retVal); + pProgram = Program::createBuiltInFromGenBinary(&context, context.getDevices(), zebin.data.storage.data(), zebin.data.storage.size(), &retVal); EXPECT_NE(nullptr, pProgram); EXPECT_EQ(CL_SUCCESS, retVal); @@ -346,8 +346,8 @@ TEST(clGetProgramInfoTest, GivenMultiDeviceBuiltInProgramCreatedWithGenBinaryWhe cl_int retVal = CL_INVALID_PROGRAM; - unsigned char *pBinary = zebin.data->storage.data(); - const size_t binarySize = zebin.data->storage.size(); + unsigned char *pBinary = zebin.data.storage.data(); + const size_t binarySize = zebin.data.storage.size(); pProgram = Program::createBuiltInFromGenBinary(&context, context.getDevices(), pBinary, binarySize, &retVal); EXPECT_NE(nullptr, pProgram); diff --git a/opencl/test/unit_test/command_queue/enqueue_kernel_1_tests.cpp b/opencl/test/unit_test/command_queue/enqueue_kernel_1_tests.cpp index a2b9a7fe91..17bd193e41 100644 --- a/opencl/test/unit_test/command_queue/enqueue_kernel_1_tests.cpp +++ b/opencl/test/unit_test/command_queue/enqueue_kernel_1_tests.cpp @@ -129,7 +129,6 @@ HWTEST2_F(EnqueueKernelTest, GivenIndirectAccessBufferVersion1WhenExecutingKerne ZebinTestData::ZebinCopyBufferModule::Descriptor desc{}; desc.execEnv["simd_size"] = std::to_string(simd); desc.execEnv["require_iab"] = "true"; - desc.isStateless = pDevice->getCompilerProductHelper().isForceToStatelessRequired(); auto zebinData = std::make_unique>(pDevice->getHardwareInfo(), desc); const auto src = zebinData->storage.data(); const auto binarySize = zebinData->storage.size(); diff --git a/shared/source/helpers/compiler_product_helper_base.inl b/shared/source/helpers/compiler_product_helper_base.inl index 627e429a4e..953db93f7b 100644 --- a/shared/source/helpers/compiler_product_helper_base.inl +++ b/shared/source/helpers/compiler_product_helper_base.inl @@ -44,6 +44,11 @@ const char *CompilerProductHelperHw::getCachingPolicyOptions(bool is return L1CachePolicyHelper::getCachingPolicyOptions(isDebuggerActive); } +template +bool CompilerProductHelperHw::failBuildProgramWithStatefulAccessPreference() const { + return false; +} + template bool CompilerProductHelperHw::oclocEnforceZebinFormat() const { return false; diff --git a/shared/source/helpers/compiler_product_helper_before_xe_hpc.inl b/shared/source/helpers/compiler_product_helper_before_xe_hpc.inl index 77e71a4378..d3970c5398 100644 --- a/shared/source/helpers/compiler_product_helper_before_xe_hpc.inl +++ b/shared/source/helpers/compiler_product_helper_before_xe_hpc.inl @@ -39,9 +39,4 @@ bool CompilerProductHelperHw::isSubgroupBufferPrefetchSupported() co return false; } -template -bool CompilerProductHelperHw::failBuildProgramWithStatefulAccessPreference() const { - return false; -} - } // namespace NEO diff --git a/shared/source/helpers/compiler_product_helper_xe_hpc_and_later.inl b/shared/source/helpers/compiler_product_helper_xe_hpc_and_later.inl index cc522a3661..de40e49502 100644 --- a/shared/source/helpers/compiler_product_helper_xe_hpc_and_later.inl +++ b/shared/source/helpers/compiler_product_helper_xe_hpc_and_later.inl @@ -43,9 +43,4 @@ bool CompilerProductHelperHw::isSubgroupBufferPrefetchSupported() co return true; } -template -bool CompilerProductHelperHw::failBuildProgramWithStatefulAccessPreference() const { - return true; -} - } // namespace NEO diff --git a/shared/source/xe_hpc_core/enable_compiler_product_helper_pvc.cpp b/shared/source/xe_hpc_core/enable_compiler_product_helper_pvc.cpp index ac49891e78..eda0213859 100644 --- a/shared/source/xe_hpc_core/enable_compiler_product_helper_pvc.cpp +++ b/shared/source/xe_hpc_core/enable_compiler_product_helper_pvc.cpp @@ -64,6 +64,11 @@ uint32_t CompilerProductHelperHw::matchRevisionIdWithProductConfig(Har return pvcConfig.value; } +template <> +bool CompilerProductHelperHw::failBuildProgramWithStatefulAccessPreference() const { + return false; +} + template <> bool CompilerProductHelperHw::isMatrixMultiplyAccumulateSupported(const ReleaseHelper *releaseHelper) const { if (releaseHelper) { diff --git a/shared/test/common/mocks/mock_zebin_wrapper.h b/shared/test/common/mocks/mock_zebin_wrapper.h index 5c55b98db2..63924125ea 100644 --- a/shared/test/common/mocks/mock_zebin_wrapper.h +++ b/shared/test/common/mocks/mock_zebin_wrapper.h @@ -7,7 +7,6 @@ #pragma once -#include "shared/source/helpers/compiler_product_helper.h" #include "shared/test/common/libult/global_environment.h" #include "shared/test/common/mocks/mock_modules_zebin.h" @@ -20,18 +19,16 @@ template ::Descriptor; - MockZebinWrapper(const HardwareInfo &hwInfo, Descriptor desc = {}) { - auto productHelper = NEO::CompilerProductHelper::create(defaultHwInfo->platform.eProductFamily); - desc.isStateless = productHelper->isForceToStatelessRequired(); - - data = std::make_unique>(hwInfo, desc); - - std::fill_n(binaries.begin(), binariesCount, reinterpret_cast(this->data->storage.data())); - std::fill_n(binarySizes.begin(), binariesCount, this->data->storage.size()); + MockZebinWrapper(const HardwareInfo &hwInfo, Descriptor desc) + : data(hwInfo, desc) { + std::fill_n(binaries.begin(), binariesCount, reinterpret_cast(this->data.storage.data())); + std::fill_n(binarySizes.begin(), binariesCount, this->data.storage.size()); } + MockZebinWrapper(const HardwareInfo &hwInfo) : MockZebinWrapper(hwInfo, Descriptor{}) {} + auto &getFlags() { - return reinterpret_cast(this->data->elfHeader->flags); + return reinterpret_cast(this->data.elfHeader->flags); } void setAsMockCompilerReturnedBinary() { @@ -60,7 +57,7 @@ struct MockZebinWrapper { }}; } - std::unique_ptr> data; + ZebinTestData::ZebinCopyBufferModule data; std::array binaries; std::array binarySizes; std::unique_ptr debugVarsRestore{nullptr, nullptr}; diff --git a/shared/test/unit_test/helpers/compiler_product_helper_tests.cpp b/shared/test/unit_test/helpers/compiler_product_helper_tests.cpp index 73a8302ce7..7cc5bf0503 100644 --- a/shared/test/unit_test/helpers/compiler_product_helper_tests.cpp +++ b/shared/test/unit_test/helpers/compiler_product_helper_tests.cpp @@ -14,7 +14,6 @@ #include "shared/test/common/helpers/gtest_helpers.h" #include "shared/test/common/helpers/unit_test_helper.h" #include "shared/test/common/mocks/mock_device.h" -#include "shared/test/common/mocks/mock_execution_environment.h" #include "shared/test/common/mocks/mock_release_helper.h" #include "shared/test/common/test_macros/hw_test.h" @@ -546,17 +545,3 @@ HWTEST_F(CompilerProductHelperFixture, GivenRequestForExtraKernelCapabilitiesThe EXPECT_EQ(0u, extraCaps); } } - -HWTEST2_F(CompilerProductHelperFixture, givenStatefulPlatformWhenFailBuildProgramWithStatefulAccessPreferenceThenFalseIsReturned, IsStatefulBufferPreferredForProduct) { - MockExecutionEnvironment executionEnvironment{}; - auto &rootDeviceEnvironment = *executionEnvironment.rootDeviceEnvironments[0]; - auto &compilerProductHelper = rootDeviceEnvironment.getHelper(); - EXPECT_FALSE(compilerProductHelper.failBuildProgramWithStatefulAccessPreference()); -} - -HWTEST2_F(CompilerProductHelperFixture, givenNotStatefulPlatformWhenFailBuildProgramWithStatefulAccessPreferenceThenTrueIsReturned, IsStatelessBufferPreferredForProduct) { - MockExecutionEnvironment executionEnvironment{}; - auto &rootDeviceEnvironment = *executionEnvironment.rootDeviceEnvironments[0]; - auto &compilerProductHelper = rootDeviceEnvironment.getHelper(); - EXPECT_TRUE(compilerProductHelper.failBuildProgramWithStatefulAccessPreference()); -} \ No newline at end of file diff --git a/shared/test/unit_test/xe_hpc_core/pvc/compiler_product_helper_tests_pvc.cpp b/shared/test/unit_test/xe_hpc_core/pvc/compiler_product_helper_tests_pvc.cpp index 5bc52215fa..5a950c4ecb 100644 --- a/shared/test/unit_test/xe_hpc_core/pvc/compiler_product_helper_tests_pvc.cpp +++ b/shared/test/unit_test/xe_hpc_core/pvc/compiler_product_helper_tests_pvc.cpp @@ -38,6 +38,13 @@ PVCTEST_F(CompilerProductHelperPvcTest, givenPvcConfigsWhenMatchConfigWithRevIdT EXPECT_EQ(compilerProductHelper.matchRevisionIdWithProductConfig(AOT::PVC_XT_C0_VG, 0x2f), AOT::PVC_XT_C0_VG); } +PVCTEST_F(CompilerProductHelperPvcTest, givenPvcWhenFailBuildProgramWithStatefulAccessPreferenceThenFalseIsReturned) { + MockExecutionEnvironment executionEnvironment{}; + auto &rootDeviceEnvironment = *executionEnvironment.rootDeviceEnvironments[0]; + auto &compilerProductHelper = rootDeviceEnvironment.getHelper(); + EXPECT_FALSE(compilerProductHelper.failBuildProgramWithStatefulAccessPreference()); +} + PVCTEST_F(CompilerProductHelperPvcTest, givenPvcB0AndLaterThenMatrixMultiplyAccumulateTF32IsSupported) { MockExecutionEnvironment executionEnvironment{}; auto &rootDeviceEnvironment = *executionEnvironment.rootDeviceEnvironments[0];