mirror of
https://github.com/intel/compute-runtime.git
synced 2025-12-24 12:23:05 +08:00
refactor: add patchtokens fallback AIL
Related-To: HSD-14023878700 Signed-off-by: Jaroslaw Warchulski <jaroslaw.warchulski@intel.com>
This commit is contained in:
committed by
Compute-Runtime-Automation
parent
26346af8ed
commit
051cada78b
@@ -78,6 +78,9 @@ T *Program::create(
|
|||||||
}
|
}
|
||||||
|
|
||||||
program = new T(pContext, false, pContext->getDevices());
|
program = new T(pContext, false, pContext->getDevices());
|
||||||
|
if (ail && ail->isFallbackToPatchtokensRequired()) {
|
||||||
|
pContext->setContextAsNonZebin();
|
||||||
|
}
|
||||||
program->sourceCode.swap(combinedString);
|
program->sourceCode.swap(combinedString);
|
||||||
program->createdFrom = CreatedFrom::source;
|
program->createdFrom = CreatedFrom::source;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -681,7 +681,7 @@ void MinimumProgramFixture::TearDown() {
|
|||||||
NEO::PlatformFixture::tearDown();
|
NEO::PlatformFixture::tearDown();
|
||||||
}
|
}
|
||||||
|
|
||||||
HWTEST2_F(MinimumProgramFixture, givenEmptyAilWhenCreateProgramWithSourcesThenSourcesDoNotChange, IsDG2) {
|
TEST_F(MinimumProgramFixture, givenEmptyAilWhenCreateProgramWithSourcesThenSourcesDoNotChange) {
|
||||||
auto pDevice = pContext->getDevice(0);
|
auto pDevice = pContext->getDevice(0);
|
||||||
auto rootDeviceEnvironment = pDevice->getExecutionEnvironment()->rootDeviceEnvironments[rootDeviceIndex].get();
|
auto rootDeviceEnvironment = pDevice->getExecutionEnvironment()->rootDeviceEnvironments[rootDeviceIndex].get();
|
||||||
rootDeviceEnvironment->ailConfiguration.reset(nullptr);
|
rootDeviceEnvironment->ailConfiguration.reset(nullptr);
|
||||||
@@ -702,6 +702,38 @@ HWTEST2_F(MinimumProgramFixture, givenEmptyAilWhenCreateProgramWithSourcesThenSo
|
|||||||
pProgram->release();
|
pProgram->release();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
TEST_F(MinimumProgramFixture, givenAILReturningTrueForFallbackRequirementWhenBuildingProgramThenMarkContextAsNonZebin) {
|
||||||
|
class MockAIL : public MockAILConfiguration {
|
||||||
|
public:
|
||||||
|
bool isFallbackToPatchtokensRequired() override {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
};
|
||||||
|
auto pDevice = pContext->getDevice(0);
|
||||||
|
auto rootDeviceEnvironment = pDevice->getExecutionEnvironment()->rootDeviceEnvironments[rootDeviceIndex].get();
|
||||||
|
rootDeviceEnvironment->ailConfiguration.reset(new MockAIL());
|
||||||
|
|
||||||
|
ASSERT_FALSE(pContext->checkIfContextIsNonZebin());
|
||||||
|
|
||||||
|
const char *kernelSources[] = {"some source code"};
|
||||||
|
size_t knownSourceSize = strlen(kernelSources[0]);
|
||||||
|
MockProgram *pProgram = nullptr;
|
||||||
|
pProgram = Program::create<SucceedingGenBinaryProgram>(
|
||||||
|
pContext,
|
||||||
|
1,
|
||||||
|
kernelSources,
|
||||||
|
&knownSourceSize,
|
||||||
|
retVal);
|
||||||
|
|
||||||
|
ASSERT_NE(nullptr, pProgram);
|
||||||
|
ASSERT_EQ(CL_SUCCESS, retVal);
|
||||||
|
|
||||||
|
retVal = pProgram->build(pProgram->getDevices(), "");
|
||||||
|
EXPECT_EQ(CL_SUCCESS, retVal);
|
||||||
|
EXPECT_TRUE(pContext->checkIfContextIsNonZebin());
|
||||||
|
pProgram->release();
|
||||||
|
}
|
||||||
|
|
||||||
TEST_F(MinimumProgramFixture, givenApplicationContextMarkedAsNonZebinWhenBuildingProgramThenInternalOptionsShouldContainDisableZebinOption) {
|
TEST_F(MinimumProgramFixture, givenApplicationContextMarkedAsNonZebinWhenBuildingProgramThenInternalOptionsShouldContainDisableZebinOption) {
|
||||||
const char *kernelSources[] = {"some source code"};
|
const char *kernelSources[] = {"some source code"};
|
||||||
size_t knownSourceSize = strlen(kernelSources[0]);
|
size_t knownSourceSize = strlen(kernelSources[0]);
|
||||||
|
|||||||
@@ -88,6 +88,8 @@ class AILConfiguration {
|
|||||||
|
|
||||||
virtual bool isRunAloneContextRequired() = 0;
|
virtual bool isRunAloneContextRequired() = 0;
|
||||||
|
|
||||||
|
virtual bool isFallbackToPatchtokensRequired() = 0;
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
virtual void applyExt(RuntimeCapabilityTable &runtimeCapabilityTable) = 0;
|
virtual void applyExt(RuntimeCapabilityTable &runtimeCapabilityTable) = 0;
|
||||||
std::string processName;
|
std::string processName;
|
||||||
@@ -105,6 +107,7 @@ extern const std::set<std::string_view> applicationsBufferPoolDisabledDg2;
|
|||||||
extern const std::set<std::string_view> applicationsOverfetchDisabled;
|
extern const std::set<std::string_view> applicationsOverfetchDisabled;
|
||||||
extern const std::set<std::string_view> applicationsDrainHostptrsDisabled;
|
extern const std::set<std::string_view> applicationsDrainHostptrsDisabled;
|
||||||
extern const std::set<std::string_view> applicationsDeviceUSMRecyclingLimited;
|
extern const std::set<std::string_view> applicationsDeviceUSMRecyclingLimited;
|
||||||
|
extern const std::set<std::string_view> applicationsFallbackToPatchtokensRequiredDg2;
|
||||||
|
|
||||||
template <PRODUCT_FAMILY product>
|
template <PRODUCT_FAMILY product>
|
||||||
class AILConfigurationHw : public AILConfiguration {
|
class AILConfigurationHw : public AILConfiguration {
|
||||||
@@ -127,6 +130,7 @@ class AILConfigurationHw : public AILConfiguration {
|
|||||||
bool disableBindlessAddressing() override;
|
bool disableBindlessAddressing() override;
|
||||||
bool limitAmountOfDeviceMemoryForRecycling() override;
|
bool limitAmountOfDeviceMemoryForRecycling() override;
|
||||||
bool isRunAloneContextRequired() override;
|
bool isRunAloneContextRequired() override;
|
||||||
|
bool isFallbackToPatchtokensRequired() override;
|
||||||
|
|
||||||
bool shouldForceRcs = false;
|
bool shouldForceRcs = false;
|
||||||
bool shouldHandleDivergentBarriers = false;
|
bool shouldHandleDivergentBarriers = false;
|
||||||
|
|||||||
@@ -76,4 +76,9 @@ inline bool AILConfigurationHw<product>::limitAmountOfDeviceMemoryForRecycling()
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
template <PRODUCT_FAMILY product>
|
||||||
|
inline bool AILConfigurationHw<product>::isFallbackToPatchtokensRequired() {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
} // namespace NEO
|
} // namespace NEO
|
||||||
|
|||||||
@@ -42,6 +42,8 @@ const std::set<std::string_view> applicationsDrainHostptrsDisabled = {};
|
|||||||
|
|
||||||
const std::set<std::string_view> applicationsDeviceUSMRecyclingLimited = {};
|
const std::set<std::string_view> applicationsDeviceUSMRecyclingLimited = {};
|
||||||
|
|
||||||
|
const std::set<std::string_view> applicationsFallbackToPatchtokensRequiredDg2 = {};
|
||||||
|
|
||||||
AILConfigurationCreateFunctionType ailConfigurationFactory[IGFX_MAX_PRODUCT];
|
AILConfigurationCreateFunctionType ailConfigurationFactory[IGFX_MAX_PRODUCT];
|
||||||
|
|
||||||
void AILConfiguration::apply(RuntimeCapabilityTable &runtimeCapabilityTable) {
|
void AILConfiguration::apply(RuntimeCapabilityTable &runtimeCapabilityTable) {
|
||||||
|
|||||||
@@ -70,6 +70,12 @@ bool AILConfigurationHw<IGFX_DG2>::isBufferPoolEnabled() {
|
|||||||
return iterator == applicationsBufferPoolDisabledDg2.end();
|
return iterator == applicationsBufferPoolDisabledDg2.end();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
template <>
|
||||||
|
inline bool AILConfigurationHw<IGFX_DG2>::isFallbackToPatchtokensRequired() {
|
||||||
|
auto iterator = applicationsFallbackToPatchtokensRequiredDg2.find(processName);
|
||||||
|
return iterator != applicationsFallbackToPatchtokensRequiredDg2.end();
|
||||||
|
}
|
||||||
|
|
||||||
template class AILConfigurationHw<IGFX_DG2>;
|
template class AILConfigurationHw<IGFX_DG2>;
|
||||||
|
|
||||||
} // namespace NEO
|
} // namespace NEO
|
||||||
|
|||||||
@@ -72,6 +72,10 @@ class MockAILConfiguration : public AILConfiguration {
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool isFallbackToPatchtokensRequired() override {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
void applyExt(RuntimeCapabilityTable &runtimeCapabilityTable) override {}
|
void applyExt(RuntimeCapabilityTable &runtimeCapabilityTable) override {}
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -112,22 +112,28 @@ HWTEST2_F(AILTests, whenModifyKernelIfRequiredIsCalledThenDontChangeKernelSource
|
|||||||
EXPECT_STREQ(copyKernel.c_str(), kernelSources.c_str());
|
EXPECT_STREQ(copyKernel.c_str(), kernelSources.c_str());
|
||||||
}
|
}
|
||||||
|
|
||||||
HWTEST2_F(AILTests, GivenAilWhenCheckingContextSyncFlagRequiredThenExpectFalse, MatchAny) {
|
HWTEST2_F(AILTests, givenAilWhenCheckingContextSyncFlagRequiredThenExpectFalse, MatchAny) {
|
||||||
AILWhitebox<productFamily> ail;
|
AILWhitebox<productFamily> ail;
|
||||||
ail.processName = "other";
|
ail.processName = "other";
|
||||||
EXPECT_FALSE(ail.isContextSyncFlagRequired());
|
EXPECT_FALSE(ail.isContextSyncFlagRequired());
|
||||||
}
|
}
|
||||||
|
|
||||||
HWTEST2_F(AILTests, GivenAilWhenCheckingOverfetchDisableRequiredThenExpectFalse, MatchAny) {
|
HWTEST2_F(AILTests, givenAilWhenCheckingOverfetchDisableRequiredThenExpectFalse, MatchAny) {
|
||||||
AILWhitebox<productFamily> ail;
|
AILWhitebox<productFamily> ail;
|
||||||
ail.processName = "other";
|
ail.processName = "other";
|
||||||
EXPECT_FALSE(ail.is256BPrefetchDisableRequired());
|
EXPECT_FALSE(ail.is256BPrefetchDisableRequired());
|
||||||
}
|
}
|
||||||
|
|
||||||
HWTEST2_F(AILTests, GivenAilWhenCheckingDrainHostptrsRequiredThenExpectTrue, MatchAny) {
|
HWTEST2_F(AILTests, givenAilWhenCheckingDrainHostptrsRequiredThenExpectTrue, MatchAny) {
|
||||||
AILWhitebox<productFamily> ail;
|
AILWhitebox<productFamily> ail;
|
||||||
ail.processName = "other";
|
ail.processName = "other";
|
||||||
EXPECT_TRUE(ail.drainHostptrs());
|
EXPECT_TRUE(ail.drainHostptrs());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
HWTEST2_F(AILTests, givenAilWhenCheckingIfPatchtokenFallbackIsRequiredThenExpectFalse, MatchAny) {
|
||||||
|
AILWhitebox<productFamily> ail;
|
||||||
|
ail.processName = "other";
|
||||||
|
EXPECT_FALSE(ail.isFallbackToPatchtokensRequired());
|
||||||
|
}
|
||||||
|
|
||||||
} // namespace NEO
|
} // namespace NEO
|
||||||
|
|||||||
@@ -1,27 +0,0 @@
|
|||||||
/*
|
|
||||||
* Copyright (C) 2023-2024 Intel Corporation
|
|
||||||
*
|
|
||||||
* SPDX-License-Identifier: MIT
|
|
||||||
*
|
|
||||||
*/
|
|
||||||
|
|
||||||
#include "shared/source/ail/ail_configuration.h"
|
|
||||||
#include "shared/test/common/test_macros/hw_test.h"
|
|
||||||
|
|
||||||
namespace NEO {
|
|
||||||
|
|
||||||
using AILBaseTests = ::testing::Test;
|
|
||||||
|
|
||||||
HWTEST2_F(AILBaseTests, whenKernelSourceIsANGenDummyKernelThenDoEnforcePatchtokensFormat, MatchAny) {
|
|
||||||
std::string dummyKernelSource{"kernel void _(){}"};
|
|
||||||
AILConfigurationHw<productFamily> ail;
|
|
||||||
EXPECT_TRUE(ail.isFallbackToPatchtokensRequired(dummyKernelSource));
|
|
||||||
}
|
|
||||||
|
|
||||||
HWTEST2_F(AILBaseTests, whenKernelSourceIsNotANGenDummyKernelThenDoNotEnforcePatchtokensFormat, MatchAny) {
|
|
||||||
std::string dummyKernelSource{"kernel void copybuffer(__global int* a, __global int* b){ //some code }"};
|
|
||||||
AILConfigurationHw<productFamily> ail;
|
|
||||||
EXPECT_FALSE(ail.isFallbackToPatchtokensRequired(dummyKernelSource));
|
|
||||||
}
|
|
||||||
|
|
||||||
} // namespace NEO
|
|
||||||
Reference in New Issue
Block a user