Configure env variables when CAL enabled

Signed-off-by: Lukasz Jobczyk <lukasz.jobczyk@intel.com>
This commit is contained in:
Lukasz Jobczyk
2022-10-26 12:41:36 +00:00
committed by Compute-Runtime-Automation
parent a7c480b19b
commit 1f9a5b878f
6 changed files with 90 additions and 1 deletions

View File

@ -190,6 +190,72 @@ TEST(ExecutionEnvironment, givenEnableDirectSubmissionControllerSetZeroWhenIniti
EXPECT_EQ(controller, nullptr);
}
TEST(ExecutionEnvironment, givenNeoCalEnabledWhenCreateExecutionEnvironmentThenSetDebugVariables) {
const std::unordered_map<std::string, int32_t> config = {
{"UseDrmVirtualEnginesForCcs", 0},
{"UseDrmVirtualEnginesForBcs", 0},
{"EnableCmdQRoundRobindBcsEngineAssignLimit", 6},
{"EnableCmdQRoundRobindBcsEngineAssign", 1},
{"ForceBCSForInternalCopyEngine", 7},
{"AssignBCSAtEnqueue", 0},
{"EnableCopyEngineSelector", 1},
{"SplitBcsCopy", 0},
};
#undef DECLARE_DEBUG_VARIABLE
#define DECLARE_DEBUG_VARIABLE(dataType, variableName, defaultValue, description) \
EXPECT_EQ(defaultValue, DebugManager.flags.variableName.getRef());
#include "shared/source/debug_settings/release_variables.inl"
#include "debug_variables.inl"
#undef DECLARE_DEBUG_VARIABLE
DebugManagerStateRestore restorer;
DebugManager.flags.NEO_CAL_ENABLED.set(1);
ExecutionEnvironment exeEnv;
#undef DECLARE_DEBUG_VARIABLE
#define DECLARE_DEBUG_VARIABLE(dataType, variableName, defaultValue, description) \
{ \
if constexpr (std::is_same_v<bool, dataType>) { \
if (strcmp(#variableName, "NEO_CAL_ENABLED") == 0) { \
EXPECT_TRUE(DebugManager.flags.variableName.getRef()); \
} else { \
EXPECT_EQ(defaultValue, DebugManager.flags.variableName.getRef()); \
} \
} else { \
if constexpr (std::is_same_v<int32_t, dataType>) { \
auto it = config.find(#variableName); \
if (it != config.end()) { \
EXPECT_EQ(it->second, DebugManager.flags.variableName.getRef()); \
} else { \
EXPECT_EQ(defaultValue, DebugManager.flags.variableName.getRef()); \
} \
} else { \
EXPECT_EQ(defaultValue, DebugManager.flags.variableName.getRef()); \
} \
} \
}
#include "shared/source/debug_settings/release_variables.inl"
#include "debug_variables.inl"
#undef DECLARE_DEBUG_VARIABLE
}
TEST(ExecutionEnvironment, givenEnvVarUsedInCalConfigAlsoSetByAppWhenCreateExecutionEnvironmentThenRespectAppSetting) {
constexpr int32_t appCommandBufferAlignment = 12345;
DebugManagerStateRestore restorer;
DebugManager.flags.NEO_CAL_ENABLED.set(1);
DebugManager.flags.ForceCommandBufferAlignment.set(appCommandBufferAlignment);
ExecutionEnvironment exeEnv;
EXPECT_EQ(DebugManager.flags.ForceCommandBufferAlignment.get(), appCommandBufferAlignment);
}
TEST(ExecutionEnvironment, givenExecutionEnvironmentWhenInitializeMemoryManagerIsCalledThenItIsInitalized) {
ExecutionEnvironment *executionEnvironment = platform()->peekExecutionEnvironment();
executionEnvironment->initializeMemoryManager();

View File

@ -54,7 +54,7 @@ class SettingsReader;
template <typename T>
struct DebugVarBase {
DebugVarBase(const T &defaultValue) : value(defaultValue) {}
DebugVarBase(const T &defaultValue) : value(defaultValue), defaultValue(defaultValue) {}
T get() const {
return value;
}
@ -64,9 +64,15 @@ struct DebugVarBase {
T &getRef() {
return value;
}
void setIfDefault(T data) {
if (value == defaultValue) {
this->set(data);
}
}
private:
T value;
T defaultValue;
};
struct DebugVariables { // NOLINT(clang-analyzer-optin.performance.Padding)

View File

@ -11,6 +11,7 @@
DECLARE_DEBUG_VARIABLE(bool, MakeAllBuffersResident, false, "Make all buffers resident after creation")
DECLARE_DEBUG_VARIABLE(int32_t, OverrideDefaultFP64Settings, -1, "-1: dont override, 0: disable, 1: enable.")
DECLARE_DEBUG_VARIABLE(bool, NEO_CAL_ENABLED, false, "Set by the Compute Aggregation Layer.")
DECLARE_DEBUG_VARIABLE(std::string, ZE_AFFINITY_MASK, std::string("default"), "Refer to the Level Zero Specification for a description")
DECLARE_DEBUG_VARIABLE(std::string, ZEX_NUMBER_OF_CCS, std::string("default"), "Define number of CCS engines per root device, e.g. setting Root Device Index 0 to 4 CCS, and Root Device Index 1 To 1 CCS: ZEX_NUMBER_OF_CCS=0:4,1:1")
DECLARE_DEBUG_VARIABLE(bool, ZE_ENABLE_PCI_ID_DEVICE_ORDER, true, "Refer to the Level Zero Specification for a description")

View File

@ -23,6 +23,7 @@
namespace NEO {
ExecutionEnvironment::ExecutionEnvironment() {
WaitUtils::init();
this->configureNeoEnvironment();
}
void ExecutionEnvironment::releaseRootDeviceEnvironmentResources(RootDeviceEnvironment *rootDeviceEnvironment) {
@ -253,4 +254,17 @@ void ExecutionEnvironment::parseCcsCountLimitations() {
}
}
}
void ExecutionEnvironment::configureNeoEnvironment() {
if (DebugManager.flags.NEO_CAL_ENABLED.get()) {
DebugManager.flags.UseDrmVirtualEnginesForCcs.setIfDefault(0);
DebugManager.flags.UseDrmVirtualEnginesForBcs.setIfDefault(0);
DebugManager.flags.EnableCmdQRoundRobindBcsEngineAssignLimit.setIfDefault(6);
DebugManager.flags.EnableCmdQRoundRobindBcsEngineAssign.setIfDefault(1);
DebugManager.flags.ForceBCSForInternalCopyEngine.setIfDefault(7);
DebugManager.flags.AssignBCSAtEnqueue.setIfDefault(0);
DebugManager.flags.EnableCopyEngineSelector.setIfDefault(1);
DebugManager.flags.SplitBcsCopy.setIfDefault(0);
}
}
} // namespace NEO

View File

@ -49,6 +49,7 @@ class ExecutionEnvironment : public ReferenceTrackedObject<ExecutionEnvironment>
protected:
void parseCcsCountLimitations();
void adjustCcsCountImpl(RootDeviceEnvironment *rootDeviceEnvironment) const;
void configureNeoEnvironment();
bool debuggingEnabled = false;
std::unordered_map<uint32_t, uint32_t> rootDeviceNumCcsMap;
};

View File

@ -12,6 +12,7 @@ AubDumpAddMmioRegistersList = unk
ZE_AFFINITY_MASK = default
ZEX_NUMBER_OF_CCS = default
ZE_ENABLE_PCI_ID_DEVICE_ORDER = 1
NEO_CAL_ENABLED = 0
AUBDumpFilterNamedKernelStartIdx = 0
AUBDumpFilterNamedKernelEndIdx = -1
AUBDumpSubCaptureMode = 0