fix: enforce zebin format by default in Ocloc for ICL/TGL/RKL/ADL

Products for which zebin has been set as default format in OCLOC:
- ICELAKE_LP
- TIGERLAKE_LP
- ROCKETLAKE
- ALDERLAKE_S
- ALDERLAKE_P
- ALDERLAKE_N

The default format does not override `--format` parameter.

Related-To: NEO-8334
Signed-off-by: Fabian Zwolinski <fabian.zwolinski@intel.com>
This commit is contained in:
Fabian Zwolinski 2023-09-07 13:31:57 +00:00 committed by Compute-Runtime-Automation
parent 2f43ff28c3
commit b2ba1fbecf
18 changed files with 81 additions and 4 deletions

View File

@ -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<std::string> 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);

View File

@ -619,6 +619,12 @@ int OfflineCompiler::initialize(size_t numArgs, const std::vector<std::string> &
return retVal;
}
if (formatToEnforce.empty() &&
compilerProductHelper &&
compilerProductHelper->oclocEnforceZebinFormat()) {
formatToEnforce = "zebin";
}
if (!formatToEnforce.empty()) {
enforceFormat(formatToEnforce);
}
@ -1096,7 +1102,6 @@ Usage: ocloc [compile] -file <filename> -device <device_type> [-output <filename
--format Enforce given binary format. The possible values are:
--format zebin - Enforce generating zebin binary
--format patchtokens - Enforce generating patchtokens (legacy) binary.
Zebin format is enforced by default.
-config Target hardware info config for a single device,
e.g 1x4x8.

View File

@ -150,7 +150,7 @@ All supported acronyms: %s.
std::string buildLog;
std::string optionsReadFromFile = "";
std::string internalOptionsReadFromFile = "";
std::string formatToEnforce = "zebin";
std::string formatToEnforce = "";
std::string irHash, genHash, dbgHash, elfHash;
std::string cacheDir;

View File

@ -28,6 +28,11 @@ uint32_t CompilerProductHelperHw<IGFX_ICELAKE_LP>::getDefaultHwIpVersion() const
return AOT::ICL;
}
template <>
bool CompilerProductHelperHw<IGFX_ICELAKE_LP>::oclocEnforceZebinFormat() const {
return true;
}
static EnableCompilerProductHelper<IGFX_ICELAKE_LP> enableCompilerProductHelperICLLP;
} // namespace NEO

View File

@ -24,6 +24,11 @@ uint32_t CompilerProductHelperHw<IGFX_ALDERLAKE_N>::getDefaultHwIpVersion() cons
return AOT::ADL_N;
}
template <>
bool CompilerProductHelperHw<IGFX_ALDERLAKE_N>::oclocEnforceZebinFormat() const {
return true;
}
static EnableCompilerProductHelper<IGFX_ALDERLAKE_N> enableCompilerProductHelperADLN;
} // namespace NEO

View File

@ -24,6 +24,11 @@ uint32_t CompilerProductHelperHw<IGFX_ALDERLAKE_P>::getDefaultHwIpVersion() cons
return AOT::ADL_P;
}
template <>
bool CompilerProductHelperHw<IGFX_ALDERLAKE_P>::oclocEnforceZebinFormat() const {
return true;
}
static EnableCompilerProductHelper<IGFX_ALDERLAKE_P> enableCompilerProductHelperADLP;
} // namespace NEO

View File

@ -28,6 +28,11 @@ uint32_t CompilerProductHelperHw<IGFX_ALDERLAKE_S>::getDefaultHwIpVersion() cons
return AOT::ADL_S;
}
template <>
bool CompilerProductHelperHw<IGFX_ALDERLAKE_S>::oclocEnforceZebinFormat() const {
return true;
}
static EnableCompilerProductHelper<IGFX_ALDERLAKE_S> enableCompilerProductHelperADLS;
} // namespace NEO

View File

@ -33,6 +33,11 @@ uint32_t CompilerProductHelperHw<IGFX_ROCKETLAKE>::getDefaultHwIpVersion() const
return AOT::RKL;
}
template <>
bool CompilerProductHelperHw<IGFX_ROCKETLAKE>::oclocEnforceZebinFormat() const {
return true;
}
static EnableCompilerProductHelper<IGFX_ROCKETLAKE> enableCompilerProductHelperRKL;
} // namespace NEO

View File

@ -28,6 +28,11 @@ uint32_t CompilerProductHelperHw<IGFX_TIGERLAKE_LP>::getDefaultHwIpVersion() con
return AOT::TGL;
}
template <>
bool CompilerProductHelperHw<IGFX_TIGERLAKE_LP>::oclocEnforceZebinFormat() const {
return true;
}
static EnableCompilerProductHelper<IGFX_TIGERLAKE_LP> enableCompilerProductHelperTGLLP;
} // namespace NEO

View File

@ -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;

View File

@ -40,6 +40,11 @@ bool CompilerProductHelperHw<gfxProduct>::failBuildProgramWithStatefulAccessPref
return false;
}
template <PRODUCT_FAMILY gfxProduct>
bool CompilerProductHelperHw<gfxProduct>::oclocEnforceZebinFormat() const {
return false;
}
template <PRODUCT_FAMILY gfxProduct>
std::string CompilerProductHelperHw<gfxProduct>::getDeviceExtensions(const HardwareInfo &hwInfo, const ReleaseHelper *releaseHelper) const {
std::string extensions = "cl_khr_byte_addressable_store "

View File

@ -87,6 +87,13 @@ using HasStatefulSupport = IsNotAnyGfxCores<IGFX_XE_HPC_CORE>;
using HasNoStatefulSupport = IsAnyGfxCores<IGFX_XE_HPC_CORE>;
using HasOclocZebinFormatEnforced = IsAnyProducts<IGFX_ICELAKE_LP,
IGFX_TIGERLAKE_LP,
IGFX_ROCKETLAKE,
IGFX_ALDERLAKE_S,
IGFX_ALDERLAKE_P,
IGFX_ALDERLAKE_N>;
struct IsXeLpg {
template <PRODUCT_FAMILY productFamily>
static constexpr bool isMatched() {

View File

@ -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());

View File

@ -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());
}

View File

@ -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());

View File

@ -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());

View File

@ -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());
}

View File

@ -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());
}