Pass LSC policy to IGC in build options
Related-To: NEO-7003 Signed-off-by: Szymon Morek <szymon.morek@intel.com>
This commit is contained in:
parent
39dfaf64bc
commit
9a26e505a8
|
@ -137,6 +137,7 @@ std::string ModuleTranslationUnit::generateCompilerOptions(const char *buildOpti
|
|||
internalOptions = NEO::CompilerOptions::concatenate(internalOptions, NEO::CompilerOptions::greaterThan4gbBuffersRequired);
|
||||
}
|
||||
|
||||
NEO::CompilerOptions::concatenateAppend(internalOptions, compilerHwInfoConfig.getCachingPolicyOptions());
|
||||
return internalOptions;
|
||||
}
|
||||
|
||||
|
|
|
@ -2289,6 +2289,23 @@ HWTEST_F(ModuleTranslationUnitTest, WhenBuildOptionsAreNullThenReuseExistingOpti
|
|||
EXPECT_NE(pMockCompilerInterface->inputInternalOptions.find("cl-intel-greater-than-4GB-buffer-required"), std::string::npos);
|
||||
}
|
||||
|
||||
HWTEST_F(ModuleTranslationUnitTest, givenInternalOptionsThenLSCCachePolicyIsSet) {
|
||||
auto pMockCompilerInterface = new MockCompilerInterface;
|
||||
auto &rootDeviceEnvironment = this->neoDevice->executionEnvironment->rootDeviceEnvironments[this->neoDevice->getRootDeviceIndex()];
|
||||
rootDeviceEnvironment->compilerInterface.reset(pMockCompilerInterface);
|
||||
MockModuleTranslationUnit moduleTu(this->device);
|
||||
auto ret = moduleTu.buildFromSpirV("", 0U, nullptr, "", nullptr);
|
||||
const auto &compilerHwInfoConfig = *CompilerHwInfoConfig::get(defaultHwInfo->platform.eProductFamily);
|
||||
EXPECT_TRUE(ret);
|
||||
auto expectedPolicy = compilerHwInfoConfig.getCachingPolicyOptions();
|
||||
if (expectedPolicy != nullptr) {
|
||||
EXPECT_NE(pMockCompilerInterface->inputInternalOptions.find(expectedPolicy), std::string::npos);
|
||||
} else {
|
||||
EXPECT_EQ(pMockCompilerInterface->inputInternalOptions.find("-cl-store-cache-default"), std::string::npos);
|
||||
EXPECT_EQ(pMockCompilerInterface->inputInternalOptions.find("-cl-load-cache-default"), std::string::npos);
|
||||
}
|
||||
}
|
||||
|
||||
HWTEST_F(ModuleTranslationUnitTest, givenForceToStatelessRequiredWhenBuildingModuleThen4GbBuffersAreRequired) {
|
||||
auto mockCompilerInterface = new MockCompilerInterface;
|
||||
auto &rootDeviceEnvironment = neoDevice->executionEnvironment->rootDeviceEnvironments[neoDevice->getRootDeviceIndex()];
|
||||
|
|
|
@ -105,7 +105,7 @@ std::string Program::getInternalOptions() const {
|
|||
}
|
||||
|
||||
CompilerOptions::concatenateAppend(internalOptions, CompilerOptions::preserveVec3Type);
|
||||
|
||||
CompilerOptions::concatenateAppend(internalOptions, compilerHwInfoConfig.getCachingPolicyOptions());
|
||||
return internalOptions;
|
||||
}
|
||||
|
||||
|
|
|
@ -1739,6 +1739,19 @@ TEST_F(ProgramTests, GivenStatelessToStatefulIsDisabledWhenProgramIsCreatedThenG
|
|||
EXPECT_TRUE(CompilerOptions::contains(internalOptions, NEO::CompilerOptions::greaterThan4gbBuffersRequired));
|
||||
}
|
||||
|
||||
TEST_F(ProgramTests, whenGetInternalOptionsThenLSCPolicyIsSet) {
|
||||
MockProgram program(pContext, false, toClDeviceVector(*pClDevice));
|
||||
auto internalOptions = program.getInternalOptions();
|
||||
const auto &compilerHwInfoConfig = *CompilerHwInfoConfig::get(defaultHwInfo->platform.eProductFamily);
|
||||
auto expectedPolicy = compilerHwInfoConfig.getCachingPolicyOptions();
|
||||
if (expectedPolicy != nullptr) {
|
||||
EXPECT_TRUE(CompilerOptions::contains(internalOptions, expectedPolicy));
|
||||
} else {
|
||||
EXPECT_FALSE(CompilerOptions::contains(internalOptions, "-cl-store-cache-default"));
|
||||
EXPECT_FALSE(CompilerOptions::contains(internalOptions, "-cl-load-cache-default"));
|
||||
}
|
||||
}
|
||||
|
||||
TEST_F(ProgramTests, WhenCreatingProgramThenBindlessIsEnabledOnlyIfDebugFlagIsEnabled) {
|
||||
using namespace testing;
|
||||
DebugManagerStateRestore restorer;
|
||||
|
|
|
@ -692,6 +692,7 @@ void OfflineCompiler::appendExtraInternalOptions(std::string &internalOptions) {
|
|||
if (compilerHwInfoConfig.isForceEmuInt32DivRemSPRequired()) {
|
||||
CompilerOptions::concatenateAppend(internalOptions, CompilerOptions::forceEmuInt32DivRemSP);
|
||||
}
|
||||
CompilerOptions::concatenateAppend(internalOptions, compilerHwInfoConfig.getCachingPolicyOptions());
|
||||
}
|
||||
|
||||
void OfflineCompiler::parseDebugSettings() {
|
||||
|
|
|
@ -30,6 +30,7 @@ class CompilerHwInfoConfig {
|
|||
virtual bool isForceToStatelessRequired() const = 0;
|
||||
virtual void adjustHwInfoForIgc(HardwareInfo &hwInfo) const = 0;
|
||||
virtual void setProductConfigForHwInfo(HardwareInfo &hwInfo, AheadOfTimeConfig config) const = 0;
|
||||
virtual const char *getCachingPolicyOptions() const = 0;
|
||||
};
|
||||
|
||||
template <PRODUCT_FAMILY gfxProduct>
|
||||
|
@ -46,6 +47,7 @@ class CompilerHwInfoConfigHw : public CompilerHwInfoConfig {
|
|||
bool isForceToStatelessRequired() const override;
|
||||
void adjustHwInfoForIgc(HardwareInfo &hwInfo) const override;
|
||||
void setProductConfigForHwInfo(HardwareInfo &hwInfo, AheadOfTimeConfig config) const override;
|
||||
const char *getCachingPolicyOptions() const override;
|
||||
|
||||
protected:
|
||||
CompilerHwInfoConfigHw() = default;
|
||||
|
|
|
@ -24,4 +24,9 @@ template <PRODUCT_FAMILY gfxProduct>
|
|||
void CompilerHwInfoConfigHw<gfxProduct>::adjustHwInfoForIgc(HardwareInfo &hwInfo) const {
|
||||
}
|
||||
|
||||
template <PRODUCT_FAMILY gfxProduct>
|
||||
const char *CompilerHwInfoConfigHw<gfxProduct>::getCachingPolicyOptions() const {
|
||||
return nullptr;
|
||||
};
|
||||
|
||||
} // namespace NEO
|
||||
|
|
|
@ -0,0 +1,12 @@
|
|||
/*
|
||||
* Copyright (C) 2022 Intel Corporation
|
||||
*
|
||||
* SPDX-License-Identifier: MIT
|
||||
*
|
||||
*/
|
||||
|
||||
template <>
|
||||
const char *CompilerHwInfoConfigHw<IGFX_DG2>::getCachingPolicyOptions() const {
|
||||
static constexpr const char *cachingPolicy = "-cl-store-cache-default=7 -cl-load-cache-default=4";
|
||||
return cachingPolicy;
|
||||
};
|
|
@ -15,6 +15,8 @@
|
|||
namespace NEO {
|
||||
#ifdef SUPPORT_DG2
|
||||
static EnableGfxProductHw<IGFX_DG2> enableGfxProductHwDG2;
|
||||
|
||||
#include "shared/source/xe_hpg_core/compiler_hw_info_config_dg2.inl"
|
||||
static EnableCompilerHwInfoConfig<IGFX_DG2> enableCompilerHwInfoConfigDG2;
|
||||
#endif
|
||||
} // namespace NEO
|
||||
|
|
|
@ -5,6 +5,7 @@
|
|||
*
|
||||
*/
|
||||
|
||||
#include "shared/source/helpers/compiler_hw_info_config.h"
|
||||
#include "shared/source/os_interface/hw_info_config.h"
|
||||
#include "shared/test/common/fixtures/device_fixture.h"
|
||||
#include "shared/test/common/test_macros/test.h"
|
||||
|
@ -15,6 +16,7 @@ using TestDg2HwInfoConfig = Test<DeviceFixture>;
|
|||
|
||||
HWTEST_EXCLUDE_PRODUCT(HwInfoConfigTestWindows, givenHardwareInfoWhenCallingIsAdditionalStateBaseAddressWARequiredThenFalseIsReturned, IGFX_DG2);
|
||||
HWTEST_EXCLUDE_PRODUCT(HwInfoConfigTestWindows, givenHardwareInfoWhenCallingIsMaxThreadsForWorkgroupWARequiredThenFalseIsReturned, IGFX_DG2);
|
||||
HWTEST_EXCLUDE_PRODUCT(HwInfoConfigTest, givenCompilerHwInfoConfigWhengetCachingPolicyOptionsThenReturnNullptr, IGFX_DG2);
|
||||
|
||||
DG2TEST_F(TestDg2HwInfoConfig, givenDG2WithCSteppingThenAdditionalStateBaseAddressWAIsNotRequired) {
|
||||
const auto &hwInfoConfig = *HwInfoConfig::get(productFamily);
|
||||
|
@ -66,4 +68,11 @@ DG2TEST_F(TestDg2HwInfoConfig, givenDG2HwInfoConfigWhenCheckDirectSubmissionSupp
|
|||
auto hwInfo = *defaultHwInfo;
|
||||
const auto &hwInfoConfig = *HwInfoConfig::get(hwInfo.platform.eProductFamily);
|
||||
EXPECT_TRUE(hwInfoConfig.isDirectSubmissionSupported(hwInfo));
|
||||
}
|
||||
|
||||
DG2TEST_F(TestDg2HwInfoConfig, givenDG2CompilerHwInfoConfigWhengetCachingPolicyOptionsThenReturnCorrectPolicies) {
|
||||
auto hwInfo = *defaultHwInfo;
|
||||
auto compilerHwInfoConfig = CompilerHwInfoConfig::get(hwInfo.platform.eProductFamily);
|
||||
const char *expectedStr = "-cl-store-cache-default=7 -cl-load-cache-default=4";
|
||||
EXPECT_EQ(0, memcmp(compilerHwInfoConfig->getCachingPolicyOptions(), expectedStr, strlen(expectedStr)));
|
||||
}
|
|
@ -104,4 +104,9 @@ HWTEST2_F(HwInfoConfigTest, givenAotConfigWhenSetHwInfoRevisionIdThenCorrectValu
|
|||
HWTEST_F(HwInfoConfigTest, givenHwInfoConfigWhenIsAdjustWalkOrderAvailableCallThenFalseReturn) {
|
||||
const auto &hwInfoConfig = *HwInfoConfig::get(defaultHwInfo->platform.eProductFamily);
|
||||
EXPECT_FALSE(hwInfoConfig.isAdjustWalkOrderAvailable(*defaultHwInfo));
|
||||
}
|
||||
|
||||
HWTEST_F(HwInfoConfigTest, givenCompilerHwInfoConfigWhengetCachingPolicyOptionsThenReturnNullptr) {
|
||||
auto compilerHwInfoConfig = CompilerHwInfoConfig::get(defaultHwInfo->platform.eProductFamily);
|
||||
EXPECT_EQ(compilerHwInfoConfig->getCachingPolicyOptions(), nullptr);
|
||||
}
|
Loading…
Reference in New Issue