mirror of
https://github.com/intel/compute-runtime.git
synced 2025-12-19 06:24:51 +08:00
refactor(sysman): Changes in the scheduler module w.r.t Xe driver
While setting the Scheduler Timeout and Exclusive Modes with the xe driver, the unsupported feature error is returned. Related-To: NEO-10112 Signed-off-by: Bari, Pratik <pratik.bari@intel.com>
This commit is contained in:
committed by
Compute-Runtime-Automation
parent
1d74279757
commit
77beaac80c
@@ -121,36 +121,11 @@ ze_result_t LinuxSchedulerImp::getCurrentMode(zes_sched_mode_t *pMode) {
|
||||
if (timeout > 0) {
|
||||
*pMode = ZES_SCHED_MODE_TIMEOUT;
|
||||
} else {
|
||||
auto pSysmanKmdInterface = pLinuxSysmanImp->getSysmanKmdInterface();
|
||||
if (pSysmanKmdInterface->useDefaultMaximumWatchdogTimeoutForExclusiveMode()) {
|
||||
|
||||
uint64_t defaultHeartbeatInterval = 0;
|
||||
result = readSchedulerValueFromSysfs(SysfsName::sysfsNameSchedulerWatchDogTimeoutMaximum,
|
||||
pLinuxSysmanImp, subdeviceId, true,
|
||||
listOfEngines, engineType, defaultHeartbeatInterval);
|
||||
if (result != ZE_RESULT_SUCCESS) {
|
||||
NEO::printDebugString(NEO::debugManager.flags.PrintDebugMessages.get(), stderr, "Error@ %s(): Failed to get default heartbeat interval and returning error:0x%x \n", __FUNCTION__, result);
|
||||
return result;
|
||||
}
|
||||
|
||||
// If default maximum value is used, then heartbeat is expected to be
|
||||
// set to the default maximum
|
||||
if (heartbeat == defaultHeartbeatInterval) {
|
||||
*pMode = ZES_SCHED_MODE_EXCLUSIVE;
|
||||
} else {
|
||||
*pMode = ZES_SCHED_MODE_FORCE_UINT32;
|
||||
result = ZE_RESULT_ERROR_UNKNOWN;
|
||||
}
|
||||
if (heartbeat == 0) {
|
||||
*pMode = ZES_SCHED_MODE_EXCLUSIVE;
|
||||
} else {
|
||||
if (heartbeat == 0) {
|
||||
// If we are here, it means heartbeat = 0, timeout = 0, timeslice = 0.
|
||||
*pMode = ZES_SCHED_MODE_EXCLUSIVE;
|
||||
} else {
|
||||
// If we are here it means heartbeat > 0, timeout = 0, timeslice = 0.
|
||||
// And we dont know what that mode is.
|
||||
*pMode = ZES_SCHED_MODE_FORCE_UINT32;
|
||||
result = ZE_RESULT_ERROR_UNKNOWN;
|
||||
}
|
||||
*pMode = ZES_SCHED_MODE_FORCE_UINT32;
|
||||
result = ZE_RESULT_ERROR_UNKNOWN;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -169,23 +144,20 @@ ze_result_t LinuxSchedulerImp::setExclusiveModeImp() {
|
||||
NEO::printDebugString(NEO::debugManager.flags.PrintDebugMessages.get(), stderr, "Error@ %s(): Failed to set timeslice duration and returning error:0x%x \n", __FUNCTION__, result);
|
||||
return result;
|
||||
}
|
||||
|
||||
auto pSysmanKmdInterface = pLinuxSysmanImp->getSysmanKmdInterface();
|
||||
if (pSysmanKmdInterface->useDefaultMaximumWatchdogTimeoutForExclusiveMode()) {
|
||||
|
||||
result = readSchedulerValueFromSysfs(SysfsName::sysfsNameSchedulerWatchDogTimeoutMaximum,
|
||||
pLinuxSysmanImp, subdeviceId, true,
|
||||
listOfEngines, engineType, heartbeat);
|
||||
if (result != ZE_RESULT_SUCCESS) {
|
||||
NEO::printDebugString(NEO::debugManager.flags.PrintDebugMessages.get(), stderr, "Error@ %s(): Failed to get default heartbeat interval and returning error:0x%x \n", __FUNCTION__, result);
|
||||
return result;
|
||||
}
|
||||
}
|
||||
result = setHeartbeatInterval(heartbeat);
|
||||
if (result != ZE_RESULT_SUCCESS) {
|
||||
return result;
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
ze_result_t LinuxSchedulerImp::setExclusiveMode(ze_bool_t *pNeedReload) {
|
||||
|
||||
auto pSysmanKmdInterface = pLinuxSysmanImp->getSysmanKmdInterface();
|
||||
if (pSysmanKmdInterface->isSettingExclusiveModeSupported() == false) {
|
||||
return ZE_RESULT_ERROR_UNSUPPORTED_FEATURE;
|
||||
}
|
||||
|
||||
*pNeedReload = false;
|
||||
|
||||
zes_sched_mode_t currMode;
|
||||
@@ -237,6 +209,12 @@ ze_result_t LinuxSchedulerImp::getTimesliceModeProperties(ze_bool_t getDefaults,
|
||||
}
|
||||
|
||||
ze_result_t LinuxSchedulerImp::setTimeoutMode(zes_sched_timeout_properties_t *pProperties, ze_bool_t *pNeedReload) {
|
||||
|
||||
auto pSysmanKmdInterface = pLinuxSysmanImp->getSysmanKmdInterface();
|
||||
if (pSysmanKmdInterface->isSettingTimeoutModeSupported() == false) {
|
||||
return ZE_RESULT_ERROR_UNSUPPORTED_FEATURE;
|
||||
}
|
||||
|
||||
*pNeedReload = false;
|
||||
zes_sched_mode_t currMode;
|
||||
ze_result_t result = getCurrentMode(&currMode);
|
||||
|
||||
@@ -121,7 +121,6 @@ class SysmanKmdInterface {
|
||||
ProcFsAccessInterface *getProcFsAccess();
|
||||
SysFsAccessInterface *getSysFsAccess();
|
||||
virtual std::string getEngineBasePath(uint32_t subDeviceId) const = 0;
|
||||
virtual bool useDefaultMaximumWatchdogTimeoutForExclusiveMode() = 0;
|
||||
virtual ze_result_t getNumEngineTypeAndInstances(std::map<zes_engine_type_flag_t, std::vector<std::string>> &mapOfEngines,
|
||||
LinuxSysmanImp *pLinuxSysmanImp,
|
||||
SysFsAccessInterface *pSysfsAccess,
|
||||
@@ -142,6 +141,8 @@ class SysmanKmdInterface {
|
||||
virtual bool isTdpFrequencyAvailable() const = 0;
|
||||
virtual bool isPhysicalMemorySizeSupported() const = 0;
|
||||
virtual void getWedgedStatus(LinuxSysmanImp *pLinuxSysmanImp, zes_device_state_t *pState) = 0;
|
||||
virtual bool isSettingTimeoutModeSupported() const = 0;
|
||||
virtual bool isSettingExclusiveModeSupported() const = 0;
|
||||
|
||||
protected:
|
||||
std::unique_ptr<FsAccessInterface> pFsAccess;
|
||||
@@ -176,7 +177,6 @@ class SysmanKmdInterfaceI915Upstream : public SysmanKmdInterface, SysmanKmdInter
|
||||
bool clientInfoAvailableInFdInfo() const override { return false; }
|
||||
bool isGroupEngineInterfaceAvailable() const override { return false; }
|
||||
std::string getEngineBasePath(uint32_t subDeviceId) const override;
|
||||
bool useDefaultMaximumWatchdogTimeoutForExclusiveMode() override { return false; };
|
||||
ze_result_t getNumEngineTypeAndInstances(std::map<zes_engine_type_flag_t, std::vector<std::string>> &mapOfEngines,
|
||||
LinuxSysmanImp *pLinuxSysmanImp,
|
||||
SysFsAccessInterface *pSysfsAccess,
|
||||
@@ -192,6 +192,8 @@ class SysmanKmdInterfaceI915Upstream : public SysmanKmdInterface, SysmanKmdInter
|
||||
bool isTdpFrequencyAvailable() const override { return true; }
|
||||
bool isPhysicalMemorySizeSupported() const override { return false; }
|
||||
void getWedgedStatus(LinuxSysmanImp *pLinuxSysmanImp, zes_device_state_t *pState) override;
|
||||
bool isSettingTimeoutModeSupported() const override { return true; }
|
||||
bool isSettingExclusiveModeSupported() const override { return true; }
|
||||
|
||||
protected:
|
||||
std::map<SysfsName, valuePair> sysfsNameToFileMap;
|
||||
@@ -223,7 +225,6 @@ class SysmanKmdInterfaceI915Prelim : public SysmanKmdInterface, SysmanKmdInterfa
|
||||
bool clientInfoAvailableInFdInfo() const override { return false; }
|
||||
bool isGroupEngineInterfaceAvailable() const override { return true; }
|
||||
std::string getEngineBasePath(uint32_t subDeviceId) const override;
|
||||
bool useDefaultMaximumWatchdogTimeoutForExclusiveMode() override { return false; };
|
||||
ze_result_t getNumEngineTypeAndInstances(std::map<zes_engine_type_flag_t, std::vector<std::string>> &mapOfEngines,
|
||||
LinuxSysmanImp *pLinuxSysmanImp,
|
||||
SysFsAccessInterface *pSysfsAccess,
|
||||
@@ -239,6 +240,8 @@ class SysmanKmdInterfaceI915Prelim : public SysmanKmdInterface, SysmanKmdInterfa
|
||||
bool isTdpFrequencyAvailable() const override { return true; }
|
||||
bool isPhysicalMemorySizeSupported() const override { return true; }
|
||||
void getWedgedStatus(LinuxSysmanImp *pLinuxSysmanImp, zes_device_state_t *pState) override;
|
||||
bool isSettingTimeoutModeSupported() const override { return true; }
|
||||
bool isSettingExclusiveModeSupported() const override { return true; }
|
||||
|
||||
protected:
|
||||
std::map<SysfsName, valuePair> sysfsNameToFileMap;
|
||||
@@ -270,7 +273,6 @@ class SysmanKmdInterfaceXe : public SysmanKmdInterface {
|
||||
bool isStandbyModeControlAvailable() const override { return false; }
|
||||
bool clientInfoAvailableInFdInfo() const override { return true; }
|
||||
bool isGroupEngineInterfaceAvailable() const override { return true; }
|
||||
bool useDefaultMaximumWatchdogTimeoutForExclusiveMode() override { return true; };
|
||||
ze_result_t getNumEngineTypeAndInstances(std::map<zes_engine_type_flag_t, std::vector<std::string>> &mapOfEngines,
|
||||
LinuxSysmanImp *pLinuxSysmanImp,
|
||||
SysFsAccessInterface *pSysfsAccess,
|
||||
@@ -288,6 +290,8 @@ class SysmanKmdInterfaceXe : public SysmanKmdInterface {
|
||||
|
||||
// Wedged state is not supported in XE.
|
||||
void getWedgedStatus(LinuxSysmanImp *pLinuxSysmanImp, zes_device_state_t *pState) override{};
|
||||
bool isSettingTimeoutModeSupported() const override { return false; }
|
||||
bool isSettingExclusiveModeSupported() const override { return false; }
|
||||
|
||||
protected:
|
||||
std::map<SysfsName, valuePair> sysfsNameToFileMap;
|
||||
|
||||
@@ -805,33 +805,14 @@ TEST_F(SysmanDeviceSchedulerFixtureXe, GivenValidDeviceHandleWhenCallingzesSched
|
||||
}
|
||||
}
|
||||
|
||||
TEST_F(SysmanDeviceSchedulerFixtureXe, GivenValidDeviceHandleWhenCallingzesSchedulerSetTimeoutModeThenVerifyzesSchedulerSetTimeoutModeCallSucceeds) {
|
||||
TEST_F(SysmanDeviceSchedulerFixtureXe, GivenValidDeviceHandleWhenCallingzesSchedulerSetTimeoutModeThenVerifyzesSchedulerSetTimeoutModeCallReturnsError) {
|
||||
auto handles = getSchedHandles(handleComponentCount);
|
||||
for (auto handle : handles) {
|
||||
ze_bool_t needReboot;
|
||||
zes_sched_timeout_properties_t setConfig;
|
||||
setConfig.watchdogTimeout = 10000u;
|
||||
ze_result_t result = zesSchedulerSetTimeoutMode(handle, &setConfig, &needReboot);
|
||||
EXPECT_EQ(ZE_RESULT_SUCCESS, result);
|
||||
EXPECT_FALSE(needReboot);
|
||||
auto getConfig = fixtureGetTimeoutModeProperties(handle, false);
|
||||
EXPECT_EQ(getConfig.watchdogTimeout, setConfig.watchdogTimeout);
|
||||
auto mode = fixtureGetCurrentMode(handle);
|
||||
EXPECT_EQ(mode, ZES_SCHED_MODE_TIMEOUT);
|
||||
}
|
||||
}
|
||||
|
||||
TEST_F(SysmanDeviceSchedulerFixtureXe, GivenValidDeviceHandleWhenCallingzesSchedulerSetTimeoutModeWhenCurrentModeIsTimeoutModeThenVerifyzesSchedulerSetTimeoutModeCallSucceeds) {
|
||||
auto handles = getSchedHandles(handleComponentCount);
|
||||
for (auto handle : handles) {
|
||||
ze_bool_t needReboot;
|
||||
zes_sched_timeout_properties_t setTimeOutConfig;
|
||||
setTimeOutConfig.watchdogTimeout = 10000u;
|
||||
ze_result_t result = zesSchedulerSetTimeoutMode(handle, &setTimeOutConfig, &needReboot);
|
||||
EXPECT_EQ(ZE_RESULT_SUCCESS, result);
|
||||
|
||||
result = zesSchedulerSetTimeoutMode(handle, &setTimeOutConfig, &needReboot);
|
||||
EXPECT_EQ(ZE_RESULT_SUCCESS, result);
|
||||
EXPECT_EQ(ZE_RESULT_ERROR_UNSUPPORTED_FEATURE, result);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -853,15 +834,12 @@ TEST_F(SysmanDeviceSchedulerFixtureXe, GivenValidDeviceHandleWhenCallingzesSched
|
||||
}
|
||||
}
|
||||
|
||||
TEST_F(SysmanDeviceSchedulerFixtureXe, GivenValidDeviceHandleWhenCallingzesSchedulerSetExclusiveModeThenVerifyzesSchedulerSetExclusiveModeCallSucceeds) {
|
||||
TEST_F(SysmanDeviceSchedulerFixtureXe, GivenValidDeviceHandleWhenCallingzesSchedulerSetExclusiveModeThenVerifyzesSchedulerSetExclusiveModeCallReturnsError) {
|
||||
auto handles = getSchedHandles(handleComponentCount);
|
||||
for (auto handle : handles) {
|
||||
ze_bool_t needReboot;
|
||||
ze_result_t result = zesSchedulerSetExclusiveMode(handle, &needReboot);
|
||||
EXPECT_EQ(ZE_RESULT_SUCCESS, result);
|
||||
EXPECT_FALSE(needReboot);
|
||||
auto mode = fixtureGetCurrentMode(handle);
|
||||
EXPECT_EQ(mode, ZES_SCHED_MODE_EXCLUSIVE);
|
||||
EXPECT_EQ(ZE_RESULT_ERROR_UNSUPPORTED_FEATURE, result);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -127,7 +127,6 @@ TEST_F(SysmanFixtureDeviceI915Prelim, GivenSysmanKmdInterfaceInstanceWhenCheckin
|
||||
auto pSysmanKmdInterface = pLinuxSysmanImp->getSysmanKmdInterface();
|
||||
EXPECT_FALSE(pSysmanKmdInterface->clientInfoAvailableInFdInfo());
|
||||
EXPECT_TRUE(pSysmanKmdInterface->isGroupEngineInterfaceAvailable());
|
||||
EXPECT_FALSE(pSysmanKmdInterface->useDefaultMaximumWatchdogTimeoutForExclusiveMode());
|
||||
}
|
||||
|
||||
TEST_F(SysmanFixtureDeviceI915Prelim, GivenSysmanKmdInterfaceInstanceWhenCheckingSupportForStandbyModeThenProperStatusIsReturned) {
|
||||
@@ -222,6 +221,12 @@ TEST_F(SysmanFixtureDeviceI915Prelim, GivenSysmanKmdInterfaceInstanceWhenCalling
|
||||
EXPECT_EQ(0u, deviceState.reset & ZES_RESET_REASON_FLAG_WEDGED);
|
||||
}
|
||||
|
||||
TEST_F(SysmanFixtureDeviceI915Prelim, GivenSysmanKmdInterfaceInstanceWhenCheckingSupportForSettingSchedulerModesThenTrueValueIsReturned) {
|
||||
auto pSysmanKmdInterface = pLinuxSysmanImp->pSysmanKmdInterface.get();
|
||||
EXPECT_TRUE(pSysmanKmdInterface->isSettingExclusiveModeSupported());
|
||||
EXPECT_TRUE(pSysmanKmdInterface->isSettingTimeoutModeSupported());
|
||||
}
|
||||
|
||||
} // namespace ult
|
||||
} // namespace Sysman
|
||||
} // namespace L0
|
||||
|
||||
@@ -227,6 +227,12 @@ TEST_F(SysmanFixtureDeviceI915Upstream, GivenSysmanKmdInterfaceInstanceAndIsNotI
|
||||
EXPECT_EQ(0u, pSysmanKmdInterface->getEventType(isIntegratedDevice));
|
||||
}
|
||||
|
||||
TEST_F(SysmanFixtureDeviceI915Upstream, GivenSysmanKmdInterfaceInstanceWhenCheckingSupportForSettingSchedulerModesThenTrueValueIsReturned) {
|
||||
auto pSysmanKmdInterface = pLinuxSysmanImp->pSysmanKmdInterface.get();
|
||||
EXPECT_TRUE(pSysmanKmdInterface->isSettingExclusiveModeSupported());
|
||||
EXPECT_TRUE(pSysmanKmdInterface->isSettingTimeoutModeSupported());
|
||||
}
|
||||
|
||||
} // namespace ult
|
||||
} // namespace Sysman
|
||||
} // namespace L0
|
||||
@@ -207,6 +207,12 @@ TEST_F(SysmanFixtureDeviceXe, GivenSysmanKmdInterfaceInstanceAndIsNotIntegratedD
|
||||
EXPECT_EQ(0u, pSysmanKmdInterface->getEventType(isIntegratedDevice));
|
||||
}
|
||||
|
||||
TEST_F(SysmanFixtureDeviceXe, GivenSysmanKmdInterfaceInstanceWhenCheckingSupportForSettingSchedulerModesThenFalseValueIsReturned) {
|
||||
auto pSysmanKmdInterface = pLinuxSysmanImp->pSysmanKmdInterface.get();
|
||||
EXPECT_FALSE(pSysmanKmdInterface->isSettingExclusiveModeSupported());
|
||||
EXPECT_FALSE(pSysmanKmdInterface->isSettingTimeoutModeSupported());
|
||||
}
|
||||
|
||||
} // namespace ult
|
||||
} // namespace Sysman
|
||||
} // namespace L0
|
||||
Reference in New Issue
Block a user