diff --git a/opencl/test/unit_test/offline_compiler/offline_compiler_tests.cpp b/opencl/test/unit_test/offline_compiler/offline_compiler_tests.cpp index 1f7da955f2..0b2963ea83 100644 --- a/opencl/test/unit_test/offline_compiler/offline_compiler_tests.cpp +++ b/opencl/test/unit_test/offline_compiler/offline_compiler_tests.cpp @@ -4291,7 +4291,7 @@ TEST(OclocCompile, givenFormatFlagWithKnownFormatPassedThenEnforceSpecifiedForma EXPECT_TRUE(hasSubstr(ocloc.internalOptions, std::string{CompilerOptions::disableZebin})); } -TEST(OclocCompile, givenNoFormatFlagSpecifiedWhenOclocInitializeThenZebinFormatIsEnforcedByDefault) { +HWTEST2_F(MockOfflineCompilerTests, givenNoFormatFlagSpecifiedWhenOclocInitializeThenZebinFormatIsEnforcedByDefault, HasOclocZebinFormatEnforced) { MockOfflineCompiler ocloc; std::vector argvNoFormatFlag = { @@ -4299,7 +4299,9 @@ TEST(OclocCompile, givenNoFormatFlagSpecifiedWhenOclocInitializeThenZebinFormatI "-q", "-file", clFiles + "copybuffer.cl", - "-spv_only"}; + "-spv_only", + "-device", + gEnvironment->devicePrefix.c_str()}; int retVal = ocloc.initialize(argvNoFormatFlag.size(), argvNoFormatFlag); ASSERT_EQ(0, retVal); diff --git a/shared/offline_compiler/source/offline_compiler.cpp b/shared/offline_compiler/source/offline_compiler.cpp index 105c5129c1..4fd65ab451 100644 --- a/shared/offline_compiler/source/offline_compiler.cpp +++ b/shared/offline_compiler/source/offline_compiler.cpp @@ -619,6 +619,12 @@ int OfflineCompiler::initialize(size_t numArgs, const std::vector & return retVal; } + if (formatToEnforce.empty() && + compilerProductHelper && + compilerProductHelper->oclocEnforceZebinFormat()) { + formatToEnforce = "zebin"; + } + if (!formatToEnforce.empty()) { enforceFormat(formatToEnforce); } @@ -1096,7 +1102,6 @@ Usage: ocloc [compile] -file -device [-output ::getDefaultHwIpVersion() const return AOT::ICL; } +template <> +bool CompilerProductHelperHw::oclocEnforceZebinFormat() const { + return true; +} + static EnableCompilerProductHelper enableCompilerProductHelperICLLP; } // namespace NEO diff --git a/shared/source/gen12lp/enable_compiler_product_helper_adln.cpp b/shared/source/gen12lp/enable_compiler_product_helper_adln.cpp index 9e1994070f..8f11c5df27 100644 --- a/shared/source/gen12lp/enable_compiler_product_helper_adln.cpp +++ b/shared/source/gen12lp/enable_compiler_product_helper_adln.cpp @@ -24,6 +24,11 @@ uint32_t CompilerProductHelperHw::getDefaultHwIpVersion() cons return AOT::ADL_N; } +template <> +bool CompilerProductHelperHw::oclocEnforceZebinFormat() const { + return true; +} + static EnableCompilerProductHelper enableCompilerProductHelperADLN; } // namespace NEO diff --git a/shared/source/gen12lp/enable_compiler_product_helper_adlp.cpp b/shared/source/gen12lp/enable_compiler_product_helper_adlp.cpp index 27fdd9719c..b9b6ad46be 100644 --- a/shared/source/gen12lp/enable_compiler_product_helper_adlp.cpp +++ b/shared/source/gen12lp/enable_compiler_product_helper_adlp.cpp @@ -24,6 +24,11 @@ uint32_t CompilerProductHelperHw::getDefaultHwIpVersion() cons return AOT::ADL_P; } +template <> +bool CompilerProductHelperHw::oclocEnforceZebinFormat() const { + return true; +} + static EnableCompilerProductHelper enableCompilerProductHelperADLP; } // namespace NEO diff --git a/shared/source/gen12lp/enable_compiler_product_helper_adls.cpp b/shared/source/gen12lp/enable_compiler_product_helper_adls.cpp index c2ee3aad1d..1dad8c47e6 100644 --- a/shared/source/gen12lp/enable_compiler_product_helper_adls.cpp +++ b/shared/source/gen12lp/enable_compiler_product_helper_adls.cpp @@ -28,6 +28,11 @@ uint32_t CompilerProductHelperHw::getDefaultHwIpVersion() cons return AOT::ADL_S; } +template <> +bool CompilerProductHelperHw::oclocEnforceZebinFormat() const { + return true; +} + static EnableCompilerProductHelper enableCompilerProductHelperADLS; } // namespace NEO diff --git a/shared/source/gen12lp/enable_compiler_product_helper_rkl.cpp b/shared/source/gen12lp/enable_compiler_product_helper_rkl.cpp index e67f2a1e1e..4e76ac43f8 100644 --- a/shared/source/gen12lp/enable_compiler_product_helper_rkl.cpp +++ b/shared/source/gen12lp/enable_compiler_product_helper_rkl.cpp @@ -33,6 +33,11 @@ uint32_t CompilerProductHelperHw::getDefaultHwIpVersion() const return AOT::RKL; } +template <> +bool CompilerProductHelperHw::oclocEnforceZebinFormat() const { + return true; +} + static EnableCompilerProductHelper enableCompilerProductHelperRKL; } // namespace NEO diff --git a/shared/source/gen12lp/enable_compiler_product_helper_tgllp.cpp b/shared/source/gen12lp/enable_compiler_product_helper_tgllp.cpp index 68ff0274d7..a2079812ab 100644 --- a/shared/source/gen12lp/enable_compiler_product_helper_tgllp.cpp +++ b/shared/source/gen12lp/enable_compiler_product_helper_tgllp.cpp @@ -28,6 +28,11 @@ uint32_t CompilerProductHelperHw::getDefaultHwIpVersion() con return AOT::TGL; } +template <> +bool CompilerProductHelperHw::oclocEnforceZebinFormat() const { + return true; +} + static EnableCompilerProductHelper enableCompilerProductHelperTGLLP; } // namespace NEO diff --git a/shared/source/helpers/compiler_product_helper.h b/shared/source/helpers/compiler_product_helper.h index 48271736f2..06c357c236 100644 --- a/shared/source/helpers/compiler_product_helper.h +++ b/shared/source/helpers/compiler_product_helper.h @@ -48,6 +48,7 @@ class CompilerProductHelper { virtual bool isForceToStatelessRequired() const = 0; virtual bool failBuildProgramWithStatefulAccessPreference() const = 0; virtual bool isDotIntegerProductExtensionSupported() const = 0; + virtual bool oclocEnforceZebinFormat() const = 0; virtual void setProductConfigForHwInfo(HardwareInfo &hwInfo, HardwareIpVersion config) const = 0; virtual const char *getCachingPolicyOptions(bool isDebuggerActive) const = 0; virtual uint64_t getHwInfoConfig(const HardwareInfo &hwInfo) const = 0; @@ -87,6 +88,7 @@ class CompilerProductHelperHw : public CompilerProductHelper { bool isForceToStatelessRequired() const override; bool failBuildProgramWithStatefulAccessPreference() const override; bool isDotIntegerProductExtensionSupported() const override; + bool oclocEnforceZebinFormat() const override; void setProductConfigForHwInfo(HardwareInfo &hwInfo, HardwareIpVersion config) const override; const char *getCachingPolicyOptions(bool isDebuggerActive) const override; uint64_t getHwInfoConfig(const HardwareInfo &hwInfo) const override; diff --git a/shared/source/helpers/compiler_product_helper_base.inl b/shared/source/helpers/compiler_product_helper_base.inl index a3853d455e..8b7ea97fd3 100644 --- a/shared/source/helpers/compiler_product_helper_base.inl +++ b/shared/source/helpers/compiler_product_helper_base.inl @@ -40,6 +40,11 @@ bool CompilerProductHelperHw::failBuildProgramWithStatefulAccessPref return false; } +template +bool CompilerProductHelperHw::oclocEnforceZebinFormat() const { + return false; +} + template std::string CompilerProductHelperHw::getDeviceExtensions(const HardwareInfo &hwInfo, const ReleaseHelper *releaseHelper) const { std::string extensions = "cl_khr_byte_addressable_store " diff --git a/shared/test/common/test_macros/header/common_matchers.h b/shared/test/common/test_macros/header/common_matchers.h index 7f39e008c1..4bf31eb626 100644 --- a/shared/test/common/test_macros/header/common_matchers.h +++ b/shared/test/common/test_macros/header/common_matchers.h @@ -87,6 +87,13 @@ using HasStatefulSupport = IsNotAnyGfxCores; using HasNoStatefulSupport = IsAnyGfxCores; +using HasOclocZebinFormatEnforced = IsAnyProducts; + struct IsXeLpg { template static constexpr bool isMatched() { diff --git a/shared/test/unit_test/gen11/icllp/test_product_helper_icllp.cpp b/shared/test/unit_test/gen11/icllp/test_product_helper_icllp.cpp index d12f41504a..db06d2f428 100644 --- a/shared/test/unit_test/gen11/icllp/test_product_helper_icllp.cpp +++ b/shared/test/unit_test/gen11/icllp/test_product_helper_icllp.cpp @@ -102,6 +102,10 @@ ICLLPTEST_F(IcllpProductHelper, givenCompilerProductHelperWhenGetProductConfigTh EXPECT_EQ(compilerProductHelper->getHwIpVersion(*defaultHwInfo), AOT::ICL); } +ICLLPTEST_F(IcllpProductHelper, givenCompilerProductHelperWhenGettingOclocEnforceZebinFormatThenExpectTrue) { + EXPECT_TRUE(compilerProductHelper->oclocEnforceZebinFormat()); +} + ICLLPTEST_F(IcllpProductHelper, givenProductHelperWhenGettingEvictIfNecessaryFlagSupportedThenExpectTrue) { EXPECT_TRUE(productHelper->isEvictionIfNecessaryFlagSupported()); diff --git a/shared/test/unit_test/gen12lp/adln/test_product_helper_adln.cpp b/shared/test/unit_test/gen12lp/adln/test_product_helper_adln.cpp index 7e8f7e98c0..dd9bf5975e 100644 --- a/shared/test/unit_test/gen12lp/adln/test_product_helper_adln.cpp +++ b/shared/test/unit_test/gen12lp/adln/test_product_helper_adln.cpp @@ -80,6 +80,10 @@ ADLNTEST_F(AdlnProductHelper, givenCompilerProductHelperWhenGetProductConfigThen EXPECT_EQ(compilerProductHelper->getHwIpVersion(pInHwInfo), AOT::ADL_N); } +ADLNTEST_F(AdlnProductHelper, givenCompilerProductHelperWhenGettingOclocEnforceZebinFormatThenExpectTrue) { + EXPECT_TRUE(compilerProductHelper->oclocEnforceZebinFormat()); +} + ADLNTEST_F(AdlnProductHelper, givenProductHelperWhenGettingEvictIfNecessaryFlagSupportedThenExpectTrue) { EXPECT_TRUE(productHelper->isEvictionIfNecessaryFlagSupported()); } diff --git a/shared/test/unit_test/gen12lp/adlp/test_product_helper_adlp.cpp b/shared/test/unit_test/gen12lp/adlp/test_product_helper_adlp.cpp index dd95ec0657..6e569c83b3 100644 --- a/shared/test/unit_test/gen12lp/adlp/test_product_helper_adlp.cpp +++ b/shared/test/unit_test/gen12lp/adlp/test_product_helper_adlp.cpp @@ -80,6 +80,11 @@ ADLPTEST_F(AdlpProductHelper, givenCompilerProductHelperWhenGetProductConfigThen EXPECT_EQ(compilerProductHelper->getHwIpVersion(pInHwInfo), AOT::ADL_P); } +ADLPTEST_F(AdlpProductHelper, givenCompilerProductHelperWhenGettingOclocEnforceZebinFormatThenExpectTrue) { + + EXPECT_TRUE(compilerProductHelper->oclocEnforceZebinFormat()); +} + ADLPTEST_F(AdlpProductHelper, givenProductHelperWhenGettingEvictIfNecessaryFlagSupportedThenExpectTrue) { EXPECT_TRUE(productHelper->isEvictionIfNecessaryFlagSupported()); diff --git a/shared/test/unit_test/gen12lp/adls/test_product_helper_adls.cpp b/shared/test/unit_test/gen12lp/adls/test_product_helper_adls.cpp index 0cb67cc88c..03b1f70bb5 100644 --- a/shared/test/unit_test/gen12lp/adls/test_product_helper_adls.cpp +++ b/shared/test/unit_test/gen12lp/adls/test_product_helper_adls.cpp @@ -80,6 +80,11 @@ ADLSTEST_F(AdlsProductHelper, givenCompilerProductHelperWhenGetProductConfigThen EXPECT_EQ(compilerProductHelper->getHwIpVersion(pInHwInfo), AOT::ADL_S); } +ADLSTEST_F(AdlsProductHelper, givenCompilerProductHelperWhenGettingOclocEnforceZebinFormatThenExpectTrue) { + + EXPECT_TRUE(compilerProductHelper->oclocEnforceZebinFormat()); +} + ADLSTEST_F(AdlsProductHelper, givenProductHelperWhenGettingEvictIfNecessaryFlagSupportedThenExpectTrue) { EXPECT_TRUE(productHelper->isEvictionIfNecessaryFlagSupported()); diff --git a/shared/test/unit_test/gen12lp/rkl/test_product_helper_rkl.cpp b/shared/test/unit_test/gen12lp/rkl/test_product_helper_rkl.cpp index 227f02fef6..776aa62c5b 100644 --- a/shared/test/unit_test/gen12lp/rkl/test_product_helper_rkl.cpp +++ b/shared/test/unit_test/gen12lp/rkl/test_product_helper_rkl.cpp @@ -85,6 +85,10 @@ RKLTEST_F(RklProductHelper, givenCompilerProductHelperWhenGetProductConfigThenCo EXPECT_EQ(compilerProductHelper->getHwIpVersion(pInHwInfo), AOT::RKL); } +RKLTEST_F(RklProductHelper, givenCompilerProductHelperWhenGettingOclocEnforceZebinFormatThenExpectTrue) { + EXPECT_TRUE(compilerProductHelper->oclocEnforceZebinFormat()); +} + RKLTEST_F(RklProductHelper, givenProductHelperWhenGettingEvictIfNecessaryFlagSupportedThenExpectTrue) { EXPECT_TRUE(productHelper->isEvictionIfNecessaryFlagSupported()); } diff --git a/shared/test/unit_test/gen12lp/tgllp/product_helper_tests_tgllp.cpp b/shared/test/unit_test/gen12lp/tgllp/product_helper_tests_tgllp.cpp index 8fe9db7ecf..3ab423ad18 100644 --- a/shared/test/unit_test/gen12lp/tgllp/product_helper_tests_tgllp.cpp +++ b/shared/test/unit_test/gen12lp/tgllp/product_helper_tests_tgllp.cpp @@ -239,3 +239,7 @@ TGLLPTEST_F(TgllpProductHelper, givenTgllpWhenObtainingBlitterPreferenceThenRetu TGLLPTEST_F(TgllpProductHelper, givenCompilerProductHelperWhenGetProductConfigThenCorrectMatchIsFound) { EXPECT_EQ(compilerProductHelper->getHwIpVersion(pInHwInfo), AOT::TGL); } + +TGLLPTEST_F(TgllpProductHelper, givenCompilerProductHelperWhenGettingOclocEnforceZebinFormatThenExpectTrue) { + EXPECT_TRUE(compilerProductHelper->oclocEnforceZebinFormat()); +}