diff --git a/level_zero/sysman/source/scheduler/linux/sysman_os_scheduler_imp.cpp b/level_zero/sysman/source/scheduler/linux/sysman_os_scheduler_imp.cpp index e29cca76cb..a08aa2120e 100644 --- a/level_zero/sysman/source/scheduler/linux/sysman_os_scheduler_imp.cpp +++ b/level_zero/sysman/source/scheduler/linux/sysman_os_scheduler_imp.cpp @@ -7,6 +7,8 @@ #include "level_zero/sysman/source/scheduler/linux/sysman_os_scheduler_imp.h" +#include "shared/source/debug_settings/debug_settings_manager.h" + #include "level_zero/sysman/source/linux/sysman_fs_access.h" #include "level_zero/sysman/source/linux/zes_os_sysman_imp.h" #include "level_zero/sysman/source/sysman_const.h" @@ -44,14 +46,17 @@ ze_result_t LinuxSchedulerImp::getCurrentMode(zes_sched_mode_t *pMode) { uint64_t heartbeat = 0; ze_result_t result = getPreemptTimeout(timeout, false); if (result != ZE_RESULT_SUCCESS) { + NEO::printDebugString(NEO::DebugManager.flags.PrintDebugMessages.get(), stderr, "Error@ %s(): Failed to get preempt timeout and returning error:0x%x \n", __FUNCTION__, result); return result; } result = getTimesliceDuration(timeslice, false); if (result != ZE_RESULT_SUCCESS) { + NEO::printDebugString(NEO::DebugManager.flags.PrintDebugMessages.get(), stderr, "Error@ %s(): Failed to get timeslice duration and returning error:0x%x \n", __FUNCTION__, result); return result; } result = getHeartbeatInterval(heartbeat, false); if (result != ZE_RESULT_SUCCESS) { + NEO::printDebugString(NEO::DebugManager.flags.PrintDebugMessages.get(), stderr, "Error@ %s(): Failed to get heartbeat interval and returning error:0x%x \n", __FUNCTION__, result); return result; } @@ -83,10 +88,12 @@ ze_result_t LinuxSchedulerImp::setExclusiveModeImp() { uint64_t timeslice = 0, timeout = 0, heartbeat = 0; ze_result_t result = setPreemptTimeout(timeout); if (result != ZE_RESULT_SUCCESS) { + NEO::printDebugString(NEO::DebugManager.flags.PrintDebugMessages.get(), stderr, "Error@ %s(): Failed to set preempt timeout and returning error:0x%x \n", __FUNCTION__, result); return result; } result = setTimesliceDuration(timeslice); if (result != ZE_RESULT_SUCCESS) { + 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; } result = setHeartbeatInterval(heartbeat); @@ -99,6 +106,7 @@ ze_result_t LinuxSchedulerImp::setExclusiveMode(ze_bool_t *pNeedReload) { zes_sched_mode_t currMode; ze_result_t result = getCurrentMode(&currMode); if (result != ZE_RESULT_SUCCESS) { + NEO::printDebugString(NEO::DebugManager.flags.PrintDebugMessages.get(), stderr, "Error@ %s(): Failed to get current mode and returning error:0x%x \n", __FUNCTION__, result); return result; } @@ -106,6 +114,7 @@ ze_result_t LinuxSchedulerImp::setExclusiveMode(ze_bool_t *pNeedReload) { // Unset this mode result = disableComputeUnitDebugMode(pNeedReload); if (result != ZE_RESULT_SUCCESS) { + NEO::printDebugString(NEO::DebugManager.flags.PrintDebugMessages.get(), stderr, "Error@ %s(): Failed to diasble COMPUTE_UNIT_DEBUG mode and returning error:0x%x \n", __FUNCTION__, result); return result; } } @@ -117,6 +126,7 @@ ze_result_t LinuxSchedulerImp::getTimeoutModeProperties(ze_bool_t getDefaults, z uint64_t heartbeat = 0; ze_result_t result = getHeartbeatInterval(heartbeat, getDefaults); if (result != ZE_RESULT_SUCCESS) { + NEO::printDebugString(NEO::DebugManager.flags.PrintDebugMessages.get(), stderr, "Error@ %s(): Failed to get heart beat interval and returning error:0x%x \n", __FUNCTION__, result); return result; } pConfig->watchdogTimeout = heartbeat; @@ -128,10 +138,12 @@ ze_result_t LinuxSchedulerImp::getTimesliceModeProperties(ze_bool_t getDefaults, uint64_t timeout = 0, timeslice = 0; ze_result_t result = getPreemptTimeout(timeout, getDefaults); if (result != ZE_RESULT_SUCCESS) { + NEO::printDebugString(NEO::DebugManager.flags.PrintDebugMessages.get(), stderr, "Error@ %s(): Failed to get preempt timeout and returning error:0x%x \n", __FUNCTION__, result); return result; } result = getTimesliceDuration(timeslice, getDefaults); if (result != ZE_RESULT_SUCCESS) { + NEO::printDebugString(NEO::DebugManager.flags.PrintDebugMessages.get(), stderr, "Error@ %s(): Failed to get timeslice duration and returning error:0x%x \n", __FUNCTION__, result); return result; } pConfig->interval = timeslice; @@ -144,6 +156,7 @@ ze_result_t LinuxSchedulerImp::setTimeoutMode(zes_sched_timeout_properties_t *pP zes_sched_mode_t currMode; ze_result_t result = getCurrentMode(&currMode); if (result != ZE_RESULT_SUCCESS) { + NEO::printDebugString(NEO::DebugManager.flags.PrintDebugMessages.get(), stderr, "Error@ %s(): Failed to get current mode and returning error:0x%x \n", __FUNCTION__, result); return result; } @@ -158,24 +171,28 @@ ze_result_t LinuxSchedulerImp::setTimeoutMode(zes_sched_timeout_properties_t *pP // Unset this mode result = disableComputeUnitDebugMode(pNeedReload); if (result != ZE_RESULT_SUCCESS) { + NEO::printDebugString(NEO::DebugManager.flags.PrintDebugMessages.get(), stderr, "Error@ %s(): Failed to diasble COMPUTE_UNIT_DEBUG mode and returning error:0x%x \n", __FUNCTION__, result); return result; } } result = setHeartbeatInterval(pProperties->watchdogTimeout); if (result != ZE_RESULT_SUCCESS) { + NEO::printDebugString(NEO::DebugManager.flags.PrintDebugMessages.get(), stderr, "Error@ %s(): Failed to set heartbeat interval and returning error:0x%x \n", __FUNCTION__, result); return result; } uint64_t timeout = (pProperties->watchdogTimeout) / 5; result = setPreemptTimeout(timeout); if (result != ZE_RESULT_SUCCESS) { + NEO::printDebugString(NEO::DebugManager.flags.PrintDebugMessages.get(), stderr, "Error@ %s(): Failed to set preempt timeout and returning error:0x%x \n", __FUNCTION__, result); return result; } uint64_t timeslice = 0; result = setTimesliceDuration(timeslice); if (result != ZE_RESULT_SUCCESS) { + 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; } return result; @@ -192,6 +209,7 @@ ze_result_t LinuxSchedulerImp::setTimesliceMode(zes_sched_timeslice_properties_t zes_sched_mode_t currMode; ze_result_t result = getCurrentMode(&currMode); if (result != ZE_RESULT_SUCCESS) { + NEO::printDebugString(NEO::DebugManager.flags.PrintDebugMessages.get(), stderr, "Error@ %s(): Failed to get current mode and returning error:0x%x \n", __FUNCTION__, result); return result; } @@ -199,16 +217,19 @@ ze_result_t LinuxSchedulerImp::setTimesliceMode(zes_sched_timeslice_properties_t // Unset this mode result = disableComputeUnitDebugMode(pNeedReload); if (result != ZE_RESULT_SUCCESS) { + NEO::printDebugString(NEO::DebugManager.flags.PrintDebugMessages.get(), stderr, "Error@ %s(): Failed to diasble COMPUTE_UNIT_DEBUG mode and returning error:0x%x \n", __FUNCTION__, result); return result; } } result = setPreemptTimeout(pProperties->yieldTimeout); if (result != ZE_RESULT_SUCCESS) { + NEO::printDebugString(NEO::DebugManager.flags.PrintDebugMessages.get(), stderr, "Error@ %s(): Failed to set preempt timeout and returning error:0x%x \n", __FUNCTION__, result); return result; } result = setTimesliceDuration(pProperties->interval); if (result != ZE_RESULT_SUCCESS) { + 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; } uint64_t heartbeat = 2500 * (pProperties->interval); @@ -219,12 +240,15 @@ ze_result_t LinuxSchedulerImp::getPreemptTimeout(uint64_t &timeout, ze_bool_t ge ze_result_t result = ZE_RESULT_ERROR_UNKNOWN; uint32_t i = 0; std::vector timeoutVec = {}; + std::string path = ""; timeoutVec.resize(listOfEngines.size()); for (const auto &engineName : listOfEngines) { if (getDefault) { - result = pSysfsAccess->read(engineDir + "/" + engineName + "/" + defaultPreemptTimeouttMilliSecs, timeout); + path = engineDir + "/" + engineName + "/" + defaultPreemptTimeouttMilliSecs; + result = pSysfsAccess->read(path, timeout); } else { - result = pSysfsAccess->read(engineDir + "/" + engineName + "/" + preemptTimeoutMilliSecs, timeout); + path = engineDir + "/" + engineName + "/" + preemptTimeoutMilliSecs; + result = pSysfsAccess->read(path, timeout); } if (result == ZE_RESULT_SUCCESS) { timeout = timeout * milliSecsToMicroSecs; @@ -234,6 +258,7 @@ ze_result_t LinuxSchedulerImp::getPreemptTimeout(uint64_t &timeout, ze_bool_t ge if (result == ZE_RESULT_ERROR_NOT_AVAILABLE) { result = ZE_RESULT_ERROR_UNSUPPORTED_FEATURE; } + NEO::printDebugString(NEO::DebugManager.flags.PrintDebugMessages.get(), stderr, "Error@ %s(): Failed to read preempt timeout from %s and returning error:0x%x \n", __FUNCTION__, path.c_str(), result); return result; } } @@ -250,12 +275,15 @@ ze_result_t LinuxSchedulerImp::getTimesliceDuration(uint64_t ×lice, ze_bool ze_result_t result = ZE_RESULT_ERROR_UNKNOWN; uint32_t i = 0; std::vector timesliceVec = {}; + std::string path = ""; timesliceVec.resize(listOfEngines.size()); for (const auto &engineName : listOfEngines) { if (getDefault) { - result = pSysfsAccess->read(engineDir + "/" + engineName + "/" + defaultTimesliceDurationMilliSecs, timeslice); + path = engineDir + "/" + engineName + "/" + defaultTimesliceDurationMilliSecs; + result = pSysfsAccess->read(path, timeslice); } else { - result = pSysfsAccess->read(engineDir + "/" + engineName + "/" + timesliceDurationMilliSecs, timeslice); + path = engineDir + "/" + engineName + "/" + timesliceDurationMilliSecs; + result = pSysfsAccess->read(path, timeslice); } if (result == ZE_RESULT_SUCCESS) { timeslice = timeslice * milliSecsToMicroSecs; @@ -265,6 +293,7 @@ ze_result_t LinuxSchedulerImp::getTimesliceDuration(uint64_t ×lice, ze_bool if (result == ZE_RESULT_ERROR_NOT_AVAILABLE) { result = ZE_RESULT_ERROR_UNSUPPORTED_FEATURE; } + NEO::printDebugString(NEO::DebugManager.flags.PrintDebugMessages.get(), stderr, "Error@ %s(): Failed to read timeslice duration from %s and returning error:0x%x \n", __FUNCTION__, path.c_str(), result); return result; } } @@ -281,12 +310,15 @@ ze_result_t LinuxSchedulerImp::getHeartbeatInterval(uint64_t &heartbeat, ze_bool ze_result_t result = ZE_RESULT_ERROR_UNKNOWN; uint32_t i = 0; std::vector heartbeatVec = {}; + std::string path = ""; heartbeatVec.resize(listOfEngines.size()); for (const auto &engineName : listOfEngines) { if (getDefault) { - result = pSysfsAccess->read(engineDir + "/" + engineName + "/" + defaultHeartbeatIntervalMilliSecs, heartbeat); + path = engineDir + "/" + engineName + "/" + defaultHeartbeatIntervalMilliSecs; + result = pSysfsAccess->read(path, heartbeat); } else { - result = pSysfsAccess->read(engineDir + "/" + engineName + "/" + heartbeatIntervalMilliSecs, heartbeat); + path = engineDir + "/" + engineName + "/" + heartbeatIntervalMilliSecs; + result = pSysfsAccess->read(path, heartbeat); } if (result == ZE_RESULT_SUCCESS) { heartbeat = heartbeat * milliSecsToMicroSecs; @@ -296,6 +328,7 @@ ze_result_t LinuxSchedulerImp::getHeartbeatInterval(uint64_t &heartbeat, ze_bool if (result == ZE_RESULT_ERROR_NOT_AVAILABLE) { result = ZE_RESULT_ERROR_UNSUPPORTED_FEATURE; } + NEO::printDebugString(NEO::DebugManager.flags.PrintDebugMessages.get(), stderr, "Error@ %s(): Failed to read heartbeat interval from %s and returning error:0x%x \n", __FUNCTION__, path.c_str(), result); return result; } } @@ -317,6 +350,7 @@ ze_result_t LinuxSchedulerImp::setPreemptTimeout(uint64_t timeout) { if (result == ZE_RESULT_ERROR_NOT_AVAILABLE) { result = ZE_RESULT_ERROR_UNSUPPORTED_FEATURE; } + NEO::printDebugString(NEO::DebugManager.flags.PrintDebugMessages.get(), stderr, "Error@ %s(): Failed to write Preempt timeout into engineDir/%s/preemptTimeoutMilliSecs and returning error:0x%x \n", __FUNCTION__, engineName.c_str(), result); return result; } } @@ -332,6 +366,7 @@ ze_result_t LinuxSchedulerImp::setTimesliceDuration(uint64_t timeslice) { if (result == ZE_RESULT_ERROR_NOT_AVAILABLE) { result = ZE_RESULT_ERROR_UNSUPPORTED_FEATURE; } + NEO::printDebugString(NEO::DebugManager.flags.PrintDebugMessages.get(), stderr, "Error@ %s(): Failed to write Timeslice duration into engineDir/%s/timesliceDurationMilliSecs and returning error:0x%x \n", __FUNCTION__, engineName.c_str(), result); return result; } } @@ -347,6 +382,7 @@ ze_result_t LinuxSchedulerImp::setHeartbeatInterval(uint64_t heartbeat) { if (result == ZE_RESULT_ERROR_NOT_AVAILABLE) { result = ZE_RESULT_ERROR_UNSUPPORTED_FEATURE; } + NEO::printDebugString(NEO::DebugManager.flags.PrintDebugMessages.get(), stderr, "Error@ %s(): Failed to write Heartbeat interval into engineDir/%s/heartbeatIntervalMilliSecs and returning error:0x%x \n", __FUNCTION__, engineName.c_str(), result); return result; } } @@ -378,6 +414,7 @@ static ze_result_t getNumEngineTypeAndInstancesForDevice(std::mapwatchdogTimeout = heartbeat; @@ -145,10 +153,12 @@ ze_result_t LinuxSchedulerImp::getTimesliceModeProperties(ze_bool_t getDefaults, uint64_t timeout = 0, timeslice = 0; ze_result_t result = getPreemptTimeout(timeout, getDefaults); if (result != ZE_RESULT_SUCCESS) { + NEO::printDebugString(NEO::DebugManager.flags.PrintDebugMessages.get(), stderr, "Error@ %s(): Failed to get preempt timeout and returning error:0x%x \n", __FUNCTION__, result); return result; } result = getTimesliceDuration(timeslice, getDefaults); if (result != ZE_RESULT_SUCCESS) { + NEO::printDebugString(NEO::DebugManager.flags.PrintDebugMessages.get(), stderr, "Error@ %s(): Failed to get timeslice duration and returning error:0x%x \n", __FUNCTION__, result); return result; } pConfig->interval = timeslice; @@ -161,6 +171,7 @@ ze_result_t LinuxSchedulerImp::setTimeoutMode(zes_sched_timeout_properties_t *pP zes_sched_mode_t currMode; ze_result_t result = getCurrentMode(&currMode); if (result != ZE_RESULT_SUCCESS) { + NEO::printDebugString(NEO::DebugManager.flags.PrintDebugMessages.get(), stderr, "Error@ %s(): Failed to get current mode and returning error:0x%x \n", __FUNCTION__, result); return result; } @@ -175,24 +186,29 @@ ze_result_t LinuxSchedulerImp::setTimeoutMode(zes_sched_timeout_properties_t *pP // Unset this mode result = disableComputeUnitDebugMode(pNeedReload); if (result != ZE_RESULT_SUCCESS) { + // failed to disable compute unit debug mode + NEO::printDebugString(NEO::DebugManager.flags.PrintDebugMessages.get(), stderr, "Error@ %s(): Failed to diasble COMPUTE_UNIT_DEBUG mode and returning error:0x%x \n", __FUNCTION__, result); return result; } } result = setHeartbeatInterval(pProperties->watchdogTimeout); if (result != ZE_RESULT_SUCCESS) { + NEO::printDebugString(NEO::DebugManager.flags.PrintDebugMessages.get(), stderr, "Error@ %s(): Failed to set heartbeat interval and returning error:0x%x \n", __FUNCTION__, result); return result; } uint64_t timeout = (pProperties->watchdogTimeout) / 5; result = setPreemptTimeout(timeout); if (result != ZE_RESULT_SUCCESS) { + NEO::printDebugString(NEO::DebugManager.flags.PrintDebugMessages.get(), stderr, "Error@ %s(): Failed to set preempt timeout and returning error:0x%x \n", __FUNCTION__, result); return result; } uint64_t timeslice = 0; result = setTimesliceDuration(timeslice); if (result != ZE_RESULT_SUCCESS) { + 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; } return result; @@ -209,6 +225,7 @@ ze_result_t LinuxSchedulerImp::setTimesliceMode(zes_sched_timeslice_properties_t zes_sched_mode_t currMode; ze_result_t result = getCurrentMode(&currMode); if (result != ZE_RESULT_SUCCESS) { + NEO::printDebugString(NEO::DebugManager.flags.PrintDebugMessages.get(), stderr, "Error@ %s(): Failed to get current mode and returning error:0x%x \n", __FUNCTION__, result); return result; } @@ -216,16 +233,19 @@ ze_result_t LinuxSchedulerImp::setTimesliceMode(zes_sched_timeslice_properties_t // Unset this mode result = disableComputeUnitDebugMode(pNeedReload); if (result != ZE_RESULT_SUCCESS) { + NEO::printDebugString(NEO::DebugManager.flags.PrintDebugMessages.get(), stderr, "Error@ %s(): Failed to diasble COMPUTE_UNIT_DEBUG mode and returning error:0x%x \n", __FUNCTION__, result); return result; } } result = setPreemptTimeout(pProperties->yieldTimeout); if (result != ZE_RESULT_SUCCESS) { + NEO::printDebugString(NEO::DebugManager.flags.PrintDebugMessages.get(), stderr, "Error@ %s(): Failed to set preempt timeout and returning error:0x%x \n", __FUNCTION__, result); return result; } result = setTimesliceDuration(pProperties->interval); if (result != ZE_RESULT_SUCCESS) { + 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; } uint64_t heartbeat = 2500 * (pProperties->interval); @@ -245,12 +265,15 @@ ze_result_t LinuxSchedulerImp::getPreemptTimeout(uint64_t &timeout, ze_bool_t ge ze_result_t result = ZE_RESULT_ERROR_UNKNOWN; uint32_t i = 0; std::vector timeoutVec = {}; + std::string path = ""; timeoutVec.resize(listOfEngines.size()); for (const auto &engineName : listOfEngines) { if (getDefault) { - result = pSysfsAccess->read(engineDir + "/" + engineName + "/" + defaultPreemptTimeouttMilliSecs, timeout); + path = engineDir + "/" + engineName + "/" + defaultPreemptTimeouttMilliSecs; + result = pSysfsAccess->read(path, timeout); } else { - result = pSysfsAccess->read(engineDir + "/" + engineName + "/" + preemptTimeoutMilliSecs, timeout); + path = engineDir + "/" + engineName + "/" + preemptTimeoutMilliSecs; + result = pSysfsAccess->read(path, timeout); } if (result == ZE_RESULT_SUCCESS) { timeout = timeout * milliSecsToMicroSecs; @@ -260,6 +283,7 @@ ze_result_t LinuxSchedulerImp::getPreemptTimeout(uint64_t &timeout, ze_bool_t ge if (result == ZE_RESULT_ERROR_NOT_AVAILABLE) { result = ZE_RESULT_ERROR_UNSUPPORTED_FEATURE; } + NEO::printDebugString(NEO::DebugManager.flags.PrintDebugMessages.get(), stderr, "Error@ %s(): Failed to read preempt timeout from %s and returning error:0x%x \n", __FUNCTION__, path.c_str(), result); return result; } } @@ -282,12 +306,15 @@ ze_result_t LinuxSchedulerImp::getTimesliceDuration(uint64_t ×lice, ze_bool ze_result_t result = ZE_RESULT_ERROR_UNKNOWN; uint32_t i = 0; std::vector timesliceVec = {}; + std::string path = ""; timesliceVec.resize(listOfEngines.size()); for (const auto &engineName : listOfEngines) { if (getDefault) { - result = pSysfsAccess->read(engineDir + "/" + engineName + "/" + defaultTimesliceDurationMilliSecs, timeslice); + path = engineDir + "/" + engineName + "/" + defaultTimesliceDurationMilliSecs; + result = pSysfsAccess->read(path, timeslice); } else { - result = pSysfsAccess->read(engineDir + "/" + engineName + "/" + timesliceDurationMilliSecs, timeslice); + path = engineDir + "/" + engineName + "/" + timesliceDurationMilliSecs; + result = pSysfsAccess->read(path, timeslice); } if (result == ZE_RESULT_SUCCESS) { timeslice = timeslice * milliSecsToMicroSecs; @@ -297,6 +324,7 @@ ze_result_t LinuxSchedulerImp::getTimesliceDuration(uint64_t ×lice, ze_bool if (result == ZE_RESULT_ERROR_NOT_AVAILABLE) { result = ZE_RESULT_ERROR_UNSUPPORTED_FEATURE; } + NEO::printDebugString(NEO::DebugManager.flags.PrintDebugMessages.get(), stderr, "Error@ %s(): Failed to read timeslice duration from %s and returning error:0x%x \n", __FUNCTION__, path.c_str(), result); return result; } } @@ -313,12 +341,15 @@ ze_result_t LinuxSchedulerImp::getHeartbeatInterval(uint64_t &heartbeat, ze_bool ze_result_t result = ZE_RESULT_ERROR_UNKNOWN; uint32_t i = 0; std::vector heartbeatVec = {}; + std::string path = ""; heartbeatVec.resize(listOfEngines.size()); for (const auto &engineName : listOfEngines) { if (getDefault) { - result = pSysfsAccess->read(engineDir + "/" + engineName + "/" + defaultHeartbeatIntervalMilliSecs, heartbeat); + path = engineDir + "/" + engineName + "/" + defaultHeartbeatIntervalMilliSecs; + result = pSysfsAccess->read(path, heartbeat); } else { - result = pSysfsAccess->read(engineDir + "/" + engineName + "/" + heartbeatIntervalMilliSecs, heartbeat); + path = engineDir + "/" + engineName + "/" + heartbeatIntervalMilliSecs; + result = pSysfsAccess->read(path, heartbeat); } if (result == ZE_RESULT_SUCCESS) { heartbeat = heartbeat * milliSecsToMicroSecs; @@ -328,6 +359,7 @@ ze_result_t LinuxSchedulerImp::getHeartbeatInterval(uint64_t &heartbeat, ze_bool if (result == ZE_RESULT_ERROR_NOT_AVAILABLE) { result = ZE_RESULT_ERROR_UNSUPPORTED_FEATURE; } + NEO::printDebugString(NEO::DebugManager.flags.PrintDebugMessages.get(), stderr, "Error@ %s(): Failed to read heartbeat interval from %s and returning error:0x%x \n", __FUNCTION__, path.c_str(), result); return result; } } @@ -349,6 +381,7 @@ ze_result_t LinuxSchedulerImp::setPreemptTimeout(uint64_t timeout) { if (result == ZE_RESULT_ERROR_NOT_AVAILABLE) { result = ZE_RESULT_ERROR_UNSUPPORTED_FEATURE; } + NEO::printDebugString(NEO::DebugManager.flags.PrintDebugMessages.get(), stderr, "Error@ %s(): Failed to write Preempt timeout into engineDir/%s/preemptTimeoutMilliSecs and returning error:0x%x \n", __FUNCTION__, engineName.c_str(), result); return result; } } @@ -364,6 +397,7 @@ ze_result_t LinuxSchedulerImp::setTimesliceDuration(uint64_t timeslice) { if (result == ZE_RESULT_ERROR_NOT_AVAILABLE) { result = ZE_RESULT_ERROR_UNSUPPORTED_FEATURE; } + NEO::printDebugString(NEO::DebugManager.flags.PrintDebugMessages.get(), stderr, "Error@ %s(): Failed to write Timeslice duration into engineDir/%s/timesliceDurationMilliSecs and returning error:0x%x \n", __FUNCTION__, engineName.c_str(), result); return result; } } @@ -379,6 +413,7 @@ ze_result_t LinuxSchedulerImp::setHeartbeatInterval(uint64_t heartbeat) { if (result == ZE_RESULT_ERROR_NOT_AVAILABLE) { result = ZE_RESULT_ERROR_UNSUPPORTED_FEATURE; } + NEO::printDebugString(NEO::DebugManager.flags.PrintDebugMessages.get(), stderr, "Error@ %s(): Failed to write Heartbeat interval into engineDir/%s/heartbeatIntervalMilliSecs and returning error:0x%x \n", __FUNCTION__, engineName.c_str(), result); return result; } } @@ -390,7 +425,22 @@ ze_bool_t LinuxSchedulerImp::canControlScheduler() { } ze_result_t LinuxSchedulerImp::updateComputeUnitDebugNode(uint64_t val) { - return ZE_RESULT_ERROR_UNSUPPORTED_FEATURE; + // I915 will be reloaded if we toggle value of enableEuDebug + // Hence for gracefull handling close all i915 clients before toggling enableEuDebug + pLinuxSysmanImp->releaseSysmanDeviceResources(); + ze_result_t result = pLinuxSysmanImp->gpuProcessCleanup(); + if (ZE_RESULT_SUCCESS != result) { + NEO::printDebugString(NEO::DebugManager.flags.PrintDebugMessages.get(), stderr, + "updateComputeUnitDebugNode: gpuProcessCleanup() failed with error code: %ld\n", result); + return result; + } + result = pSysfsAccess->write(enableEuDebug, val); + if (result != ZE_RESULT_SUCCESS) { + NEO::printDebugString(NEO::DebugManager.flags.PrintDebugMessages.get(), stderr, + "updateComputeUnitDebugNode: Write to sysfs node %s failed with error code: %ld\n", enableEuDebug.c_str(), result); + } + pLinuxSysmanImp->reInitSysmanDeviceResources(); + return result; } ze_result_t LinuxSchedulerImp::setComputeUnitDebugMode(ze_bool_t *pNeedReload) { @@ -468,6 +518,7 @@ static ze_result_t getNumEngineTypeAndInstancesForDevice(std::map backup(&pLinuxSysmanImp->pProcfsAccess); auto pMockSchedulerProcfsAccess = new MockSchedulerProcfsAccess; pLinuxSysmanImp->pProcfsAccess = pMockSchedulerProcfsAccess; @@ -365,7 +365,7 @@ TEST_F(SysmanDeviceSchedulerFixture, DISABLED_GivenCurrentModeIsDebugModeWhenCal delete pMockSchedulerProcfsAccess; } -TEST_F(SysmanDeviceSchedulerFixture, DISABLED_GivenCurrentModeIsDebugModeWhenSettingTimeoutModeAndDebugModeCantBeChangedThenVerifyCallFails) { +TEST_F(SysmanDeviceSchedulerFixture, GivenCurrentModeIsDebugModeWhenSettingTimeoutModeAndDebugModeCantBeChangedThenVerifyCallFails) { VariableBackup backup(&pLinuxSysmanImp->pProcfsAccess); auto pMockSchedulerProcfsAccess = new MockSchedulerProcfsAccess; pLinuxSysmanImp->pProcfsAccess = pMockSchedulerProcfsAccess; @@ -488,7 +488,7 @@ TEST_F(SysmanDeviceSchedulerFixture, GivenValidDeviceHandleWhenCallingzesSchedul } } -TEST_F(SysmanDeviceSchedulerFixture, DISABLED_GivenCurrentModeIsDebugModeWhenCallingzesSchedulerSetTimesliceModeThenVerifyCallSucceeds) { +TEST_F(SysmanDeviceSchedulerFixture, GivenCurrentModeIsDebugModeWhenCallingzesSchedulerSetTimesliceModeThenVerifyCallSucceeds) { VariableBackup backup(&pLinuxSysmanImp->pProcfsAccess); auto pMockSchedulerProcfsAccess = new MockSchedulerProcfsAccess; pLinuxSysmanImp->pProcfsAccess = pMockSchedulerProcfsAccess; @@ -513,7 +513,7 @@ TEST_F(SysmanDeviceSchedulerFixture, DISABLED_GivenCurrentModeIsDebugModeWhenCal delete pMockSchedulerProcfsAccess; } -TEST_F(SysmanDeviceSchedulerFixture, DISABLED_GivenCurrentModeIsDebugModeWhenSettingTimesliceModeAndDebugModeCantBeChangedThenVerifyCallFails) { +TEST_F(SysmanDeviceSchedulerFixture, GivenCurrentModeIsDebugModeWhenSettingTimesliceModeAndDebugModeCantBeChangedThenVerifyCallFails) { VariableBackup backup(&pLinuxSysmanImp->pProcfsAccess); auto pMockSchedulerProcfsAccess = new MockSchedulerProcfsAccess; pLinuxSysmanImp->pProcfsAccess = pMockSchedulerProcfsAccess; @@ -619,7 +619,7 @@ TEST_F(SysmanDeviceSchedulerFixture, GivenValidDeviceHandleWhenCallingzesSchedul } } -TEST_F(SysmanDeviceSchedulerFixture, DISABLED_GivenCurrentModeIsDebugModeWhenCallingzesSchedulerSetExclusiveModeThenVerifyCallSucceeds) { +TEST_F(SysmanDeviceSchedulerFixture, GivenCurrentModeIsDebugModeWhenCallingzesSchedulerSetExclusiveModeThenVerifyCallSucceeds) { VariableBackup backup(&pLinuxSysmanImp->pProcfsAccess); auto pMockSchedulerProcfsAccess = new MockSchedulerProcfsAccess; pLinuxSysmanImp->pProcfsAccess = pMockSchedulerProcfsAccess; @@ -637,7 +637,7 @@ TEST_F(SysmanDeviceSchedulerFixture, DISABLED_GivenCurrentModeIsDebugModeWhenCal delete pMockSchedulerProcfsAccess; } -TEST_F(SysmanDeviceSchedulerFixture, DISABLED_GivenCurrentModeIsDebugModeWhenSettingExclusiveModeAndDebugModeCantBeChangedThenVerifyCallFails) { +TEST_F(SysmanDeviceSchedulerFixture, GivenCurrentModeIsDebugModeWhenSettingExclusiveModeAndDebugModeCantBeChangedThenVerifyCallFails) { VariableBackup backup(&pLinuxSysmanImp->pProcfsAccess); auto pMockSchedulerProcfsAccess = new MockSchedulerProcfsAccess; pLinuxSysmanImp->pProcfsAccess = pMockSchedulerProcfsAccess; @@ -747,7 +747,7 @@ TEST_F(SysmanDeviceSchedulerFixture, GivenValidDeviceHandleWhenCallingzesSchedul } } -TEST_F(SysmanDeviceSchedulerFixture, DISABLED_GivenValidDeviceHandleWhenCallingzesSchedulerSetComputeUnitDebugModeThenSuccessIsReturned) { +TEST_F(SysmanDeviceSchedulerFixture, GivenValidDeviceHandleWhenCallingzesSchedulerSetComputeUnitDebugModeThenSuccessIsReturned) { VariableBackup backup(&pLinuxSysmanImp->pProcfsAccess); auto pMockSchedulerProcfsAccess = new MockSchedulerProcfsAccess; pLinuxSysmanImp->pProcfsAccess = pMockSchedulerProcfsAccess; @@ -767,7 +767,7 @@ TEST_F(SysmanDeviceSchedulerFixture, DISABLED_GivenValidDeviceHandleWhenCallingz delete pMockSchedulerProcfsAccess; } -TEST_F(SysmanDeviceSchedulerFixture, DISABLED_GivenGpuProcessCleanupFailedWhenCallingzesSchedulerSetComputeUnitDebugModeThenErrorIsReturned) { +TEST_F(SysmanDeviceSchedulerFixture, GivenGpuProcessCleanupFailedWhenCallingzesSchedulerSetComputeUnitDebugModeThenErrorIsReturned) { VariableBackup backup(&pLinuxSysmanImp->pProcfsAccess); auto pMockSchedulerProcfsAccess = new MockSchedulerProcfsAccess; pLinuxSysmanImp->pProcfsAccess = pMockSchedulerProcfsAccess; @@ -788,7 +788,7 @@ TEST_F(SysmanDeviceSchedulerFixture, DISABLED_GivenGpuProcessCleanupFailedWhenCa delete pMockSchedulerProcfsAccess; } -TEST_F(SysmanDeviceSchedulerFixture, DISABLED_GivenEuDebugNodeWriteFailsWhenCallingzesSchedulerSetComputeUnitDebugModeThenErrorIsReturned) { +TEST_F(SysmanDeviceSchedulerFixture, GivenEuDebugNodeWriteFailsWhenCallingzesSchedulerSetComputeUnitDebugModeThenErrorIsReturned) { VariableBackup backup(&pLinuxSysmanImp->pProcfsAccess); auto pMockSchedulerProcfsAccess = new MockSchedulerProcfsAccess; pLinuxSysmanImp->pProcfsAccess = pMockSchedulerProcfsAccess; diff --git a/level_zero/tools/test/unit_tests/sources/sysman/scheduler/linux/mock_sysfs_scheduler_prelim.h b/level_zero/tools/test/unit_tests/sources/sysman/scheduler/linux/mock_sysfs_scheduler_prelim.h index 4895e5ab2a..42d8735346 100644 --- a/level_zero/tools/test/unit_tests/sources/sysman/scheduler/linux/mock_sysfs_scheduler_prelim.h +++ b/level_zero/tools/test/unit_tests/sources/sysman/scheduler/linux/mock_sysfs_scheduler_prelim.h @@ -241,8 +241,6 @@ class MockSchedulerProcfsAccess : public ProcfsAccess { ADDMETHOD_NOBASE_VOIDRETURN(kill, (const ::pid_t pid)); }; -// class SchedulerSysfsAccess : public SysfsAccess {}; - typedef struct SchedulerConfigValues { uint64_t defaultVal; uint64_t actualVal;