mirror of
https://github.com/intel/compute-runtime.git
synced 2026-01-06 10:26:29 +08:00
fix: Check if provided CCS number is correct
Check if `ZEX_NUMBER_OF_CCS` env variable provided by the user is correct. If it isn't then return false and print debug message. After this change if `zeInit` is called with invalid `ZEX_NUMBER_OF_CCS`, then it fails with `ZE_RESULT_ERROR_UNINITIALIZED`. Related-To: NEO-15230, GSD-11251 Signed-off-by: Kindracki, Jakub Tomasz <jakub.tomasz.kindracki@intel.com>
This commit is contained in:
committed by
Compute-Runtime-Automation
parent
f31341fe01
commit
67963bed4b
@@ -354,8 +354,10 @@ void ExecutionEnvironment::adjustCcsCountImpl(RootDeviceEnvironment *rootDeviceE
|
|||||||
productHelper.adjustNumberOfCcs(*hwInfo);
|
productHelper.adjustNumberOfCcs(*hwInfo);
|
||||||
}
|
}
|
||||||
|
|
||||||
void ExecutionEnvironment::adjustCcsCount() {
|
bool ExecutionEnvironment::adjustCcsCount() {
|
||||||
parseCcsCountLimitations();
|
if (!parseCcsCountLimitations()) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
for (auto rootDeviceIndex = 0u; rootDeviceIndex < rootDeviceEnvironments.size(); rootDeviceIndex++) {
|
for (auto rootDeviceIndex = 0u; rootDeviceIndex < rootDeviceEnvironments.size(); rootDeviceIndex++) {
|
||||||
auto &rootDeviceEnvironment = rootDeviceEnvironments[rootDeviceIndex];
|
auto &rootDeviceEnvironment = rootDeviceEnvironments[rootDeviceIndex];
|
||||||
@@ -364,32 +366,42 @@ void ExecutionEnvironment::adjustCcsCount() {
|
|||||||
adjustCcsCountImpl(rootDeviceEnvironment.get());
|
adjustCcsCountImpl(rootDeviceEnvironment.get());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
void ExecutionEnvironment::adjustCcsCount(const uint32_t rootDeviceIndex) const {
|
bool ExecutionEnvironment::adjustCcsCount(const uint32_t rootDeviceIndex) const {
|
||||||
auto &rootDeviceEnvironment = rootDeviceEnvironments[rootDeviceIndex];
|
auto &rootDeviceEnvironment = rootDeviceEnvironments[rootDeviceIndex];
|
||||||
UNRECOVERABLE_IF(!rootDeviceEnvironment);
|
UNRECOVERABLE_IF(!rootDeviceEnvironment);
|
||||||
if (rootDeviceNumCcsMap.find(rootDeviceIndex) != rootDeviceNumCcsMap.end()) {
|
if (rootDeviceNumCcsMap.find(rootDeviceIndex) != rootDeviceNumCcsMap.end()) {
|
||||||
rootDeviceEnvironment->setNumberOfCcs(rootDeviceNumCcsMap.at(rootDeviceIndex));
|
if (!rootDeviceEnvironment->setNumberOfCcs(rootDeviceNumCcsMap.at(rootDeviceIndex))) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
adjustCcsCountImpl(rootDeviceEnvironment.get());
|
adjustCcsCountImpl(rootDeviceEnvironment.get());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
void ExecutionEnvironment::parseCcsCountLimitations() {
|
bool ExecutionEnvironment::parseCcsCountLimitations() {
|
||||||
const auto &numberOfCcsString = debugManager.flags.ZEX_NUMBER_OF_CCS.get();
|
const auto &numberOfCcsString = debugManager.flags.ZEX_NUMBER_OF_CCS.get();
|
||||||
|
|
||||||
if (numberOfCcsString.compare("default") == 0 ||
|
if (numberOfCcsString.compare("default") == 0 ||
|
||||||
numberOfCcsString.empty()) {
|
numberOfCcsString.empty()) {
|
||||||
return;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
for (auto rootDeviceIndex = 0u; rootDeviceIndex < rootDeviceEnvironments.size(); rootDeviceIndex++) {
|
for (auto rootDeviceIndex = 0u; rootDeviceIndex < rootDeviceEnvironments.size(); rootDeviceIndex++) {
|
||||||
auto &rootDeviceEnvironment = rootDeviceEnvironments[rootDeviceIndex];
|
auto &rootDeviceEnvironment = rootDeviceEnvironments[rootDeviceIndex];
|
||||||
UNRECOVERABLE_IF(!rootDeviceEnvironment);
|
UNRECOVERABLE_IF(!rootDeviceEnvironment);
|
||||||
auto &productHelper = rootDeviceEnvironment->getHelper<ProductHelper>();
|
auto &productHelper = rootDeviceEnvironment->getHelper<ProductHelper>();
|
||||||
productHelper.parseCcsMode(numberOfCcsString, rootDeviceNumCcsMap, rootDeviceIndex, rootDeviceEnvironment.get());
|
if (!productHelper.parseCcsMode(numberOfCcsString, rootDeviceNumCcsMap, rootDeviceIndex, rootDeviceEnvironment.get())) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
void ExecutionEnvironment::configureNeoEnvironment() {
|
void ExecutionEnvironment::configureNeoEnvironment() {
|
||||||
|
|||||||
@@ -37,8 +37,8 @@ class ExecutionEnvironment : public ReferenceTrackedObject<ExecutionEnvironment>
|
|||||||
virtual void prepareRootDeviceEnvironments(uint32_t numRootDevices);
|
virtual void prepareRootDeviceEnvironments(uint32_t numRootDevices);
|
||||||
void prepareRootDeviceEnvironment(const uint32_t rootDeviceIndexForReInit);
|
void prepareRootDeviceEnvironment(const uint32_t rootDeviceIndexForReInit);
|
||||||
void parseAffinityMask();
|
void parseAffinityMask();
|
||||||
void adjustCcsCount();
|
bool adjustCcsCount();
|
||||||
void adjustCcsCount(const uint32_t rootDeviceIndex) const;
|
bool adjustCcsCount(const uint32_t rootDeviceIndex) const;
|
||||||
void sortNeoDevices();
|
void sortNeoDevices();
|
||||||
void setDeviceHierarchyMode(const GfxCoreHelper &gfxCoreHelper);
|
void setDeviceHierarchyMode(const GfxCoreHelper &gfxCoreHelper);
|
||||||
void setDeviceHierarchyMode(const DeviceHierarchyMode deviceHierarchyMode) {
|
void setDeviceHierarchyMode(const DeviceHierarchyMode deviceHierarchyMode) {
|
||||||
@@ -47,7 +47,7 @@ class ExecutionEnvironment : public ReferenceTrackedObject<ExecutionEnvironment>
|
|||||||
DeviceHierarchyMode getDeviceHierarchyMode() const { return deviceHierarchyMode; }
|
DeviceHierarchyMode getDeviceHierarchyMode() const { return deviceHierarchyMode; }
|
||||||
void adjustRootDeviceEnvironments();
|
void adjustRootDeviceEnvironments();
|
||||||
void prepareForCleanup() const;
|
void prepareForCleanup() const;
|
||||||
void configureCcsMode();
|
MOCKABLE_VIRTUAL void configureCcsMode();
|
||||||
void setDebuggingMode(DebuggingMode debuggingMode) {
|
void setDebuggingMode(DebuggingMode debuggingMode) {
|
||||||
debuggingEnabledMode = debuggingMode;
|
debuggingEnabledMode = debuggingMode;
|
||||||
}
|
}
|
||||||
@@ -97,7 +97,7 @@ class ExecutionEnvironment : public ReferenceTrackedObject<ExecutionEnvironment>
|
|||||||
|
|
||||||
protected:
|
protected:
|
||||||
static bool comparePciIdBusNumber(std::unique_ptr<RootDeviceEnvironment> &rootDeviceEnvironment1, std::unique_ptr<RootDeviceEnvironment> &rootDeviceEnvironment2);
|
static bool comparePciIdBusNumber(std::unique_ptr<RootDeviceEnvironment> &rootDeviceEnvironment1, std::unique_ptr<RootDeviceEnvironment> &rootDeviceEnvironment2);
|
||||||
void parseCcsCountLimitations();
|
bool parseCcsCountLimitations();
|
||||||
void adjustCcsCountImpl(RootDeviceEnvironment *rootDeviceEnvironment) const;
|
void adjustCcsCountImpl(RootDeviceEnvironment *rootDeviceEnvironment) const;
|
||||||
void configureNeoEnvironment();
|
void configureNeoEnvironment();
|
||||||
void restoreCcsMode();
|
void restoreCcsMode();
|
||||||
|
|||||||
@@ -246,12 +246,19 @@ BuiltIns *RootDeviceEnvironment::getBuiltIns() {
|
|||||||
return this->builtins.get();
|
return this->builtins.get();
|
||||||
}
|
}
|
||||||
|
|
||||||
void RootDeviceEnvironment::setNumberOfCcs(uint32_t numberOfCcs) {
|
bool RootDeviceEnvironment::setNumberOfCcs(uint32_t numberOfCcs) {
|
||||||
hwInfo->gtSystemInfo.CCSInfo.NumberOfCCSEnabled = std::min(hwInfo->gtSystemInfo.CCSInfo.NumberOfCCSEnabled, numberOfCcs);
|
if (hwInfo->gtSystemInfo.CCSInfo.NumberOfCCSEnabled < numberOfCcs || numberOfCcs == 0) {
|
||||||
|
NEO::printDebugString(NEO::debugManager.flags.PrintDebugMessages.get(), stderr, "Error: Invalid number of CCS - %u (max: %u)\n", numberOfCcs, hwInfo->gtSystemInfo.CCSInfo.NumberOfCCSEnabled);
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
hwInfo->gtSystemInfo.CCSInfo.NumberOfCCSEnabled = numberOfCcs;
|
||||||
limitedNumberOfCcs = true;
|
limitedNumberOfCcs = true;
|
||||||
if (aubCenter) {
|
if (aubCenter) {
|
||||||
aubCenter->getAubManager()->setCCSMode(hwInfo->gtSystemInfo.CCSInfo.NumberOfCCSEnabled);
|
aubCenter->getAubManager()->setCCSMode(hwInfo->gtSystemInfo.CCSInfo.NumberOfCCSEnabled);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
uint32_t RootDeviceEnvironment::getNumberOfCcs() const {
|
uint32_t RootDeviceEnvironment::getNumberOfCcs() const {
|
||||||
|
|||||||
@@ -81,7 +81,7 @@ struct RootDeviceEnvironment : NonCopyableClass {
|
|||||||
BindlessHeapsHelper *getBindlessHeapsHelper() const;
|
BindlessHeapsHelper *getBindlessHeapsHelper() const;
|
||||||
AssertHandler *getAssertHandler(Device *neoDevice);
|
AssertHandler *getAssertHandler(Device *neoDevice);
|
||||||
void createBindlessHeapsHelper(Device *rootDevice, bool availableDevices);
|
void createBindlessHeapsHelper(Device *rootDevice, bool availableDevices);
|
||||||
void setNumberOfCcs(uint32_t numberOfCcs);
|
bool setNumberOfCcs(uint32_t numberOfCcs);
|
||||||
uint32_t getNumberOfCcs() const;
|
uint32_t getNumberOfCcs() const;
|
||||||
bool isNumberOfCcsLimited() const;
|
bool isNumberOfCcsLimited() const;
|
||||||
void setRcsExposure();
|
void setRcsExposure();
|
||||||
|
|||||||
@@ -164,7 +164,9 @@ bool DeviceFactory::prepareDeviceEnvironmentsForProductFamilyOverride(ExecutionE
|
|||||||
|
|
||||||
executionEnvironment.setDeviceHierarchyMode(executionEnvironment.rootDeviceEnvironments[0]->getHelper<GfxCoreHelper>());
|
executionEnvironment.setDeviceHierarchyMode(executionEnvironment.rootDeviceEnvironments[0]->getHelper<GfxCoreHelper>());
|
||||||
executionEnvironment.parseAffinityMask();
|
executionEnvironment.parseAffinityMask();
|
||||||
executionEnvironment.adjustCcsCount();
|
if (!executionEnvironment.adjustCcsCount()) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
executionEnvironment.calculateMaxOsContextCount();
|
executionEnvironment.calculateMaxOsContextCount();
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
@@ -272,7 +274,9 @@ bool DeviceFactory::prepareDeviceEnvironments(ExecutionEnvironment &executionEnv
|
|||||||
executionEnvironment.sortNeoDevices();
|
executionEnvironment.sortNeoDevices();
|
||||||
executionEnvironment.parseAffinityMask();
|
executionEnvironment.parseAffinityMask();
|
||||||
executionEnvironment.adjustRootDeviceEnvironments();
|
executionEnvironment.adjustRootDeviceEnvironments();
|
||||||
executionEnvironment.adjustCcsCount();
|
if (!executionEnvironment.adjustCcsCount()) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
executionEnvironment.calculateMaxOsContextCount();
|
executionEnvironment.calculateMaxOsContextCount();
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
@@ -294,7 +298,9 @@ bool DeviceFactory::prepareDeviceEnvironment(ExecutionEnvironment &executionEnvi
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
executionEnvironment.adjustCcsCount(rootDeviceIndex);
|
if (!executionEnvironment.adjustCcsCount(rootDeviceIndex)) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -228,7 +228,7 @@ class ProductHelper {
|
|||||||
virtual void fillPipelineSelectPropertiesSupportStructure(PipelineSelectPropertiesSupport &propertiesSupport, const HardwareInfo &hwInfo) const = 0;
|
virtual void fillPipelineSelectPropertiesSupportStructure(PipelineSelectPropertiesSupport &propertiesSupport, const HardwareInfo &hwInfo) const = 0;
|
||||||
virtual void fillStateBaseAddressPropertiesSupportStructure(StateBaseAddressPropertiesSupport &propertiesSupport) const = 0;
|
virtual void fillStateBaseAddressPropertiesSupportStructure(StateBaseAddressPropertiesSupport &propertiesSupport) const = 0;
|
||||||
|
|
||||||
virtual void parseCcsMode(std::string ccsModeString, std::unordered_map<uint32_t, uint32_t> &rootDeviceNumCcsMap, uint32_t rootDeviceIndex, RootDeviceEnvironment *rootDeviceEnvironment) const = 0;
|
virtual bool parseCcsMode(std::string ccsModeString, std::unordered_map<uint32_t, uint32_t> &rootDeviceNumCcsMap, uint32_t rootDeviceIndex, RootDeviceEnvironment *rootDeviceEnvironment) const = 0;
|
||||||
|
|
||||||
virtual bool isFusedEuDisabledForDpas(bool kernelHasDpasInstructions, const uint32_t *lws, const uint32_t *groupCount, const HardwareInfo &hwInfo) const = 0;
|
virtual bool isFusedEuDisabledForDpas(bool kernelHasDpasInstructions, const uint32_t *lws, const uint32_t *groupCount, const HardwareInfo &hwInfo) const = 0;
|
||||||
virtual bool isCalculationForDisablingEuFusionWithDpasNeeded(const HardwareInfo &hwInfo) const = 0;
|
virtual bool isCalculationForDisablingEuFusionWithDpasNeeded(const HardwareInfo &hwInfo) const = 0;
|
||||||
|
|||||||
@@ -720,12 +720,20 @@ void ProductHelperHw<gfxProduct>::fillStateBaseAddressPropertiesSupportStructure
|
|||||||
}
|
}
|
||||||
|
|
||||||
template <PRODUCT_FAMILY gfxProduct>
|
template <PRODUCT_FAMILY gfxProduct>
|
||||||
void ProductHelperHw<gfxProduct>::parseCcsMode(std::string ccsModeString, std::unordered_map<uint32_t, uint32_t> &rootDeviceNumCcsMap, uint32_t rootDeviceIndex, RootDeviceEnvironment *rootDeviceEnvironment) const {
|
bool ProductHelperHw<gfxProduct>::parseCcsMode(std::string ccsModeString, std::unordered_map<uint32_t, uint32_t> &rootDeviceNumCcsMap, uint32_t rootDeviceIndex, RootDeviceEnvironment *rootDeviceEnvironment) const {
|
||||||
|
if (!std::all_of(ccsModeString.begin(), ccsModeString.end(), ::isdigit)) {
|
||||||
|
NEO::printDebugString(NEO::debugManager.flags.PrintDebugMessages.get(), stderr, "Error: Invalid ZEX_NUMBER_OF_CCS format - %s\n", ccsModeString.c_str());
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
auto ccsCount = StringHelpers::toUint32t(ccsModeString);
|
auto ccsCount = StringHelpers::toUint32t(ccsModeString);
|
||||||
|
|
||||||
rootDeviceNumCcsMap.insert({rootDeviceIndex, ccsCount});
|
rootDeviceNumCcsMap.insert({rootDeviceIndex, ccsCount});
|
||||||
rootDeviceEnvironment->setNumberOfCcs(ccsCount);
|
if (!rootDeviceEnvironment->setNumberOfCcs(ccsCount)) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
template <PRODUCT_FAMILY gfxProduct>
|
template <PRODUCT_FAMILY gfxProduct>
|
||||||
|
|||||||
@@ -166,7 +166,7 @@ class ProductHelperHw : public ProductHelper {
|
|||||||
void fillFrontEndPropertiesSupportStructure(FrontEndPropertiesSupport &propertiesSupport, const HardwareInfo &hwInfo) const override;
|
void fillFrontEndPropertiesSupportStructure(FrontEndPropertiesSupport &propertiesSupport, const HardwareInfo &hwInfo) const override;
|
||||||
void fillPipelineSelectPropertiesSupportStructure(PipelineSelectPropertiesSupport &propertiesSupport, const HardwareInfo &hwInfo) const override;
|
void fillPipelineSelectPropertiesSupportStructure(PipelineSelectPropertiesSupport &propertiesSupport, const HardwareInfo &hwInfo) const override;
|
||||||
void fillStateBaseAddressPropertiesSupportStructure(StateBaseAddressPropertiesSupport &propertiesSupport) const override;
|
void fillStateBaseAddressPropertiesSupportStructure(StateBaseAddressPropertiesSupport &propertiesSupport) const override;
|
||||||
void parseCcsMode(std::string ccsModeString, std::unordered_map<uint32_t, uint32_t> &rootDeviceNumCcsMap, uint32_t rootDeviceIndex, RootDeviceEnvironment *rootDeviceEnvironment) const override;
|
bool parseCcsMode(std::string ccsModeString, std::unordered_map<uint32_t, uint32_t> &rootDeviceNumCcsMap, uint32_t rootDeviceIndex, RootDeviceEnvironment *rootDeviceEnvironment) const override;
|
||||||
|
|
||||||
bool isFusedEuDisabledForDpas(bool kernelHasDpasInstructions, const uint32_t *lws, const uint32_t *groupCount, const HardwareInfo &hwInfo) const override;
|
bool isFusedEuDisabledForDpas(bool kernelHasDpasInstructions, const uint32_t *lws, const uint32_t *groupCount, const HardwareInfo &hwInfo) const override;
|
||||||
bool isCalculationForDisablingEuFusionWithDpasNeeded(const HardwareInfo &hwInfo) const override;
|
bool isCalculationForDisablingEuFusionWithDpasNeeded(const HardwareInfo &hwInfo) const override;
|
||||||
|
|||||||
@@ -153,21 +153,28 @@ bool ProductHelperHw<gfxProduct>::isBlitCopyRequiredForLocalMemory(const RootDev
|
|||||||
}
|
}
|
||||||
|
|
||||||
template <>
|
template <>
|
||||||
void ProductHelperHw<gfxProduct>::parseCcsMode(std::string ccsModeString, std::unordered_map<uint32_t, uint32_t> &rootDeviceNumCcsMap, uint32_t rootDeviceIndex, RootDeviceEnvironment *rootDeviceEnvironment) const {
|
bool ProductHelperHw<gfxProduct>::parseCcsMode(std::string ccsModeString, std::unordered_map<uint32_t, uint32_t> &rootDeviceNumCcsMap, uint32_t rootDeviceIndex, RootDeviceEnvironment *rootDeviceEnvironment) const {
|
||||||
auto numberOfCcsEntries = StringHelpers::split(ccsModeString, ",");
|
auto numberOfCcsEntries = StringHelpers::split(ccsModeString, ",");
|
||||||
|
|
||||||
for (const auto &entry : numberOfCcsEntries) {
|
for (const auto &entry : numberOfCcsEntries) {
|
||||||
auto subEntries = StringHelpers::split(entry, ":");
|
auto subEntries = StringHelpers::split(entry, ":");
|
||||||
|
if (subEntries.size() < 2) {
|
||||||
|
NEO::printDebugString(NEO::debugManager.flags.PrintDebugMessages.get(), stderr, "Error: Invalid ZEX_NUMBER_OF_CCS format - %s\n", ccsModeString.c_str());
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
uint32_t rootDeviceIndexParsed = StringHelpers::toUint32t(subEntries[0]);
|
uint32_t rootDeviceIndexParsed = StringHelpers::toUint32t(subEntries[0]);
|
||||||
|
|
||||||
if (rootDeviceIndexParsed == rootDeviceIndex) {
|
if (rootDeviceIndexParsed == rootDeviceIndex) {
|
||||||
if (subEntries.size() > 1) {
|
uint32_t maxCcsCount = StringHelpers::toUint32t(subEntries[1]);
|
||||||
uint32_t maxCcsCount = StringHelpers::toUint32t(subEntries[1]);
|
rootDeviceNumCcsMap.insert({rootDeviceIndex, maxCcsCount});
|
||||||
rootDeviceNumCcsMap.insert({rootDeviceIndex, maxCcsCount});
|
if (!rootDeviceEnvironment->setNumberOfCcs(maxCcsCount)) {
|
||||||
rootDeviceEnvironment->setNumberOfCcs(maxCcsCount);
|
return false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
template <>
|
template <>
|
||||||
|
|||||||
@@ -91,4 +91,8 @@ void MockExecutionEnvironment::initGmm() {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void MockExecutionEnvironment::addToRootDeviceNumCcsMap(uint32_t rootDeviceIndex, uint32_t numCcs) {
|
||||||
|
this->rootDeviceNumCcsMap.insert({rootDeviceIndex, numCcs});
|
||||||
|
}
|
||||||
|
|
||||||
} // namespace NEO
|
} // namespace NEO
|
||||||
|
|||||||
@@ -52,6 +52,7 @@ struct MockExecutionEnvironment : ExecutionEnvironment {
|
|||||||
MockExecutionEnvironment(const HardwareInfo *hwInfo);
|
MockExecutionEnvironment(const HardwareInfo *hwInfo);
|
||||||
MockExecutionEnvironment(const HardwareInfo *hwInfo, bool useMockAubCenter, uint32_t numRootDevices);
|
MockExecutionEnvironment(const HardwareInfo *hwInfo, bool useMockAubCenter, uint32_t numRootDevices);
|
||||||
void initGmm();
|
void initGmm();
|
||||||
|
void addToRootDeviceNumCcsMap(uint32_t rootDeviceIndex, uint32_t numCcs);
|
||||||
};
|
};
|
||||||
|
|
||||||
} // namespace NEO
|
} // namespace NEO
|
||||||
|
|||||||
@@ -780,6 +780,72 @@ TEST(ExecutionEnvironment, givenExecutionEnvironmentWhenSetDevicePermissionError
|
|||||||
EXPECT_FALSE(executionEnvironment.isDevicePermissionError());
|
EXPECT_FALSE(executionEnvironment.isDevicePermissionError());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
TEST(ExecutionEnvironment, givenExecutionEnvironmentWhenCcsNumberIsValidThenAdjustCcsCountReturnsTrue) {
|
||||||
|
{
|
||||||
|
MockExecutionEnvironment executionEnvironment;
|
||||||
|
auto hwInfo = executionEnvironment.rootDeviceEnvironments[0]->getMutableHardwareInfo();
|
||||||
|
hwInfo->gtSystemInfo.CCSInfo.NumberOfCCSEnabled = 4;
|
||||||
|
executionEnvironment.addToRootDeviceNumCcsMap(0, 1);
|
||||||
|
|
||||||
|
EXPECT_TRUE(executionEnvironment.adjustCcsCount(0));
|
||||||
|
}
|
||||||
|
{
|
||||||
|
MockExecutionEnvironment executionEnvironment;
|
||||||
|
auto hwInfo = executionEnvironment.rootDeviceEnvironments[0]->getMutableHardwareInfo();
|
||||||
|
hwInfo->gtSystemInfo.CCSInfo.NumberOfCCSEnabled = 1;
|
||||||
|
executionEnvironment.addToRootDeviceNumCcsMap(0, 1);
|
||||||
|
|
||||||
|
EXPECT_TRUE(executionEnvironment.adjustCcsCount(0));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
TEST(ExecutionEnvironment, givenExecutionEnvironmentWhenCcsNumberIsInvalidThenAdjustCcsCountReturnsFalse) {
|
||||||
|
{
|
||||||
|
DebugManagerStateRestore restorer;
|
||||||
|
MockExecutionEnvironment executionEnvironment;
|
||||||
|
debugManager.flags.ZEX_NUMBER_OF_CCS.set("0");
|
||||||
|
|
||||||
|
EXPECT_FALSE(executionEnvironment.adjustCcsCount());
|
||||||
|
}
|
||||||
|
{
|
||||||
|
DebugManagerStateRestore restorer;
|
||||||
|
MockExecutionEnvironment executionEnvironment;
|
||||||
|
debugManager.flags.ZEX_NUMBER_OF_CCS.set("0:0");
|
||||||
|
|
||||||
|
EXPECT_FALSE(executionEnvironment.adjustCcsCount());
|
||||||
|
}
|
||||||
|
{
|
||||||
|
DebugManagerStateRestore restorer;
|
||||||
|
MockExecutionEnvironment executionEnvironment;
|
||||||
|
debugManager.flags.ZEX_NUMBER_OF_CCS.set("100");
|
||||||
|
|
||||||
|
EXPECT_FALSE(executionEnvironment.adjustCcsCount());
|
||||||
|
}
|
||||||
|
{
|
||||||
|
DebugManagerStateRestore restorer;
|
||||||
|
MockExecutionEnvironment executionEnvironment;
|
||||||
|
debugManager.flags.ZEX_NUMBER_OF_CCS.set("0:100");
|
||||||
|
|
||||||
|
EXPECT_FALSE(executionEnvironment.adjustCcsCount());
|
||||||
|
}
|
||||||
|
{
|
||||||
|
MockExecutionEnvironment executionEnvironment;
|
||||||
|
auto hwInfo = executionEnvironment.rootDeviceEnvironments[0]->getMutableHardwareInfo();
|
||||||
|
hwInfo->gtSystemInfo.CCSInfo.NumberOfCCSEnabled = 1;
|
||||||
|
executionEnvironment.addToRootDeviceNumCcsMap(0, 0);
|
||||||
|
|
||||||
|
EXPECT_FALSE(executionEnvironment.adjustCcsCount(0));
|
||||||
|
}
|
||||||
|
{
|
||||||
|
MockExecutionEnvironment executionEnvironment;
|
||||||
|
auto hwInfo = executionEnvironment.rootDeviceEnvironments[0]->getMutableHardwareInfo();
|
||||||
|
hwInfo->gtSystemInfo.CCSInfo.NumberOfCCSEnabled = 1;
|
||||||
|
executionEnvironment.addToRootDeviceNumCcsMap(0, 100);
|
||||||
|
|
||||||
|
EXPECT_FALSE(executionEnvironment.adjustCcsCount(0));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
void ExecutionEnvironmentSortTests::SetUp() {
|
void ExecutionEnvironmentSortTests::SetUp() {
|
||||||
executionEnvironment.prepareRootDeviceEnvironments(numRootDevices);
|
executionEnvironment.prepareRootDeviceEnvironments(numRootDevices);
|
||||||
for (uint32_t rootDeviceIndex = 0; rootDeviceIndex < numRootDevices; rootDeviceIndex++) {
|
for (uint32_t rootDeviceIndex = 0; rootDeviceIndex < numRootDevices; rootDeviceIndex++) {
|
||||||
|
|||||||
@@ -8,12 +8,14 @@
|
|||||||
#include "shared/source/helpers/constants.h"
|
#include "shared/source/helpers/constants.h"
|
||||||
#include "shared/source/helpers/product_config_helper.h"
|
#include "shared/source/helpers/product_config_helper.h"
|
||||||
#include "shared/source/os_interface/device_factory.h"
|
#include "shared/source/os_interface/device_factory.h"
|
||||||
|
#include "shared/source/os_interface/os_interface.h"
|
||||||
#include "shared/source/release_helper/release_helper.h"
|
#include "shared/source/release_helper/release_helper.h"
|
||||||
#include "shared/test/common/helpers/debug_manager_state_restore.h"
|
#include "shared/test/common/helpers/debug_manager_state_restore.h"
|
||||||
#include "shared/test/common/helpers/default_hw_info.h"
|
#include "shared/test/common/helpers/default_hw_info.h"
|
||||||
#include "shared/test/common/helpers/device_caps_reader_test_helper.h"
|
#include "shared/test/common/helpers/device_caps_reader_test_helper.h"
|
||||||
#include "shared/test/common/helpers/gtest_helpers.h"
|
#include "shared/test/common/helpers/gtest_helpers.h"
|
||||||
#include "shared/test/common/helpers/stream_capture.h"
|
#include "shared/test/common/helpers/stream_capture.h"
|
||||||
|
#include "shared/test/common/mocks/mock_driver_model.h"
|
||||||
#include "shared/test/common/mocks/mock_execution_environment.h"
|
#include "shared/test/common/mocks/mock_execution_environment.h"
|
||||||
#include "shared/test/common/mocks/mock_product_helper.h"
|
#include "shared/test/common/mocks/mock_product_helper.h"
|
||||||
#include "shared/test/common/test_macros/hw_test.h"
|
#include "shared/test/common/test_macros/hw_test.h"
|
||||||
@@ -54,6 +56,30 @@ TEST_F(DeviceFactoryTests, givenHwIpVersionOverrideWhenPrepareDeviceEnvironments
|
|||||||
EXPECT_NE(0u, executionEnvironment.rootDeviceEnvironments[0]->getHardwareInfo()->platform.usDeviceID);
|
EXPECT_NE(0u, executionEnvironment.rootDeviceEnvironments[0]->getHardwareInfo()->platform.usDeviceID);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
TEST_F(DeviceFactoryTests, givenHwIpVersionOverrideWhenPrepareDeviceEnvironmentsForProductFamilyOverrideIsCalledWithNumberOfCcsSetToZeroThenFalseIsReturned) {
|
||||||
|
ExecutionEnvironment executionEnvironment{};
|
||||||
|
auto config = defaultHwInfo.get()->ipVersion.value;
|
||||||
|
debugManager.flags.OverrideHwIpVersion.set(config);
|
||||||
|
debugManager.flags.ZEX_NUMBER_OF_CCS.set("0");
|
||||||
|
|
||||||
|
bool success = DeviceFactory::prepareDeviceEnvironmentsForProductFamilyOverride(executionEnvironment);
|
||||||
|
EXPECT_FALSE(success);
|
||||||
|
EXPECT_EQ(config, executionEnvironment.rootDeviceEnvironments[0]->getHardwareInfo()->ipVersion.value);
|
||||||
|
EXPECT_NE(0u, executionEnvironment.rootDeviceEnvironments[0]->getHardwareInfo()->platform.usDeviceID);
|
||||||
|
}
|
||||||
|
|
||||||
|
TEST_F(DeviceFactoryTests, givenHwIpVersionOverrideWhenPrepareDeviceEnvironmentsForProductFamilyOverrideIsCalledWithNumberOfCcsSetToZeroColonZeroThenFalseIsReturned) {
|
||||||
|
ExecutionEnvironment executionEnvironment{};
|
||||||
|
auto config = defaultHwInfo.get()->ipVersion.value;
|
||||||
|
debugManager.flags.OverrideHwIpVersion.set(config);
|
||||||
|
debugManager.flags.ZEX_NUMBER_OF_CCS.set("0:0");
|
||||||
|
|
||||||
|
bool success = DeviceFactory::prepareDeviceEnvironmentsForProductFamilyOverride(executionEnvironment);
|
||||||
|
EXPECT_FALSE(success);
|
||||||
|
EXPECT_EQ(config, executionEnvironment.rootDeviceEnvironments[0]->getHardwareInfo()->ipVersion.value);
|
||||||
|
EXPECT_NE(0u, executionEnvironment.rootDeviceEnvironments[0]->getHardwareInfo()->platform.usDeviceID);
|
||||||
|
}
|
||||||
|
|
||||||
TEST_F(DeviceFactoryTests, givenHwIpVersionOverrideWhenPrepareDeviceEnvironmentsForProductFamilyOverrideIsCalledThenReleaseHelperContainsCorrectIpVersion) {
|
TEST_F(DeviceFactoryTests, givenHwIpVersionOverrideWhenPrepareDeviceEnvironmentsForProductFamilyOverrideIsCalledThenReleaseHelperContainsCorrectIpVersion) {
|
||||||
ExecutionEnvironment executionEnvironment{};
|
ExecutionEnvironment executionEnvironment{};
|
||||||
auto config = defaultHwInfo.get()->ipVersion.value;
|
auto config = defaultHwInfo.get()->ipVersion.value;
|
||||||
@@ -156,6 +182,44 @@ TEST_F(DeviceFactoryTests, givenMultipleDevicesWhenInitializeResourcesSucceedsFo
|
|||||||
EXPECT_EQ(2u, rootDeviceEnvironment1->initOsInterfaceCalled);
|
EXPECT_EQ(2u, rootDeviceEnvironment1->initOsInterfaceCalled);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
class MockExecutionEnvironmentConfigureCssMode : public MockExecutionEnvironment {
|
||||||
|
public:
|
||||||
|
using MockExecutionEnvironment::MockExecutionEnvironment;
|
||||||
|
using MockExecutionEnvironment::rootDeviceEnvironments;
|
||||||
|
|
||||||
|
void configureCcsMode() override {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
TEST_F(DeviceFactoryTests, givenDeviceWhenInitializeResourcesSucceedsButCcsNumberIsZeroThenFalseIsReturned) {
|
||||||
|
debugManager.flags.CreateMultipleRootDevices.set(1);
|
||||||
|
debugManager.flags.ZEX_NUMBER_OF_CCS.set("0");
|
||||||
|
MockExecutionEnvironmentConfigureCssMode executionEnvironment(defaultHwInfo.get(), true, 1u);
|
||||||
|
|
||||||
|
EXPECT_EQ(1u, executionEnvironment.rootDeviceEnvironments.size());
|
||||||
|
auto rootDeviceEnvironment = static_cast<MockRootDeviceEnvironment *>(executionEnvironment.rootDeviceEnvironments[0].get());
|
||||||
|
|
||||||
|
rootDeviceEnvironment->initOsInterfaceResults.push_back(true);
|
||||||
|
|
||||||
|
bool success = DeviceFactory::prepareDeviceEnvironments(executionEnvironment);
|
||||||
|
EXPECT_FALSE(success);
|
||||||
|
}
|
||||||
|
|
||||||
|
TEST_F(DeviceFactoryTests, givenDeviceWhenInitializeResourcesSucceedsButCcsNumberIsZeroColonZeroThenFalseIsReturned) {
|
||||||
|
debugManager.flags.CreateMultipleRootDevices.set(1);
|
||||||
|
debugManager.flags.ZEX_NUMBER_OF_CCS.set("0:0");
|
||||||
|
MockExecutionEnvironmentConfigureCssMode executionEnvironment(defaultHwInfo.get(), true, 1u);
|
||||||
|
|
||||||
|
EXPECT_EQ(1u, executionEnvironment.rootDeviceEnvironments.size());
|
||||||
|
auto rootDeviceEnvironment = static_cast<MockRootDeviceEnvironment *>(executionEnvironment.rootDeviceEnvironments[0].get());
|
||||||
|
|
||||||
|
rootDeviceEnvironment->initOsInterfaceResults.push_back(true);
|
||||||
|
|
||||||
|
bool success = DeviceFactory::prepareDeviceEnvironments(executionEnvironment);
|
||||||
|
EXPECT_FALSE(success);
|
||||||
|
}
|
||||||
|
|
||||||
TEST_F(DeviceFactoryTests, givenMultipleDevicesWhenInitializeResourcesFailsForAllDevicesThenFailureIsReturned) {
|
TEST_F(DeviceFactoryTests, givenMultipleDevicesWhenInitializeResourcesFailsForAllDevicesThenFailureIsReturned) {
|
||||||
DebugManagerStateRestore restorer;
|
DebugManagerStateRestore restorer;
|
||||||
debugManager.flags.CreateMultipleRootDevices.set(3);
|
debugManager.flags.CreateMultipleRootDevices.set(3);
|
||||||
@@ -387,4 +451,4 @@ HWTEST_F(DeviceFactoryOverrideTest, GivenAubModeAndDeviceCapsReaderSupportDisabl
|
|||||||
EXPECT_FALSE(hasSubstr(capturedStderr, expectedMissingProductFamilyStderrSubstr));
|
EXPECT_FALSE(hasSubstr(capturedStderr, expectedMissingProductFamilyStderrSubstr));
|
||||||
EXPECT_FALSE(hasSubstr(capturedStderr, expectedMissingHardwareInfoStderrSubstr));
|
EXPECT_FALSE(hasSubstr(capturedStderr, expectedMissingHardwareInfoStderrSubstr));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user