diff --git a/level_zero/tools/source/sysman/frequency/linux/os_frequency_imp.cpp b/level_zero/tools/source/sysman/frequency/linux/os_frequency_imp.cpp index 4247b53c6b..5bb35ecd43 100644 --- a/level_zero/tools/source/sysman/frequency/linux/os_frequency_imp.cpp +++ b/level_zero/tools/source/sysman/frequency/linux/os_frequency_imp.cpp @@ -1,5 +1,5 @@ /* - * Copyright (C) 2020-2022 Intel Corporation + * Copyright (C) 2020-2023 Intel Corporation * * SPDX-License-Identifier: MIT * @@ -7,6 +7,8 @@ #include "level_zero/tools/source/sysman/frequency/linux/os_frequency_imp.h" +#include "shared/source/debug_settings/debug_settings_manager.h" + #include "sysman/linux/os_sysman_imp.h" #include @@ -23,6 +25,8 @@ ze_result_t LinuxFrequencyImp::osFrequencyGetProperties(zes_freq_properties_t &p ze_result_t result2 = getMaxVal(properties.max); // If can't figure out the valid range, then can't control it. if (ZE_RESULT_SUCCESS != result1 || ZE_RESULT_SUCCESS != result2) { + NEO::printDebugString(NEO::DebugManager.flags.PrintDebugMessages.get(), stderr, + "error@<%s> \n", __func__, result1, result2); properties.canControl = false; properties.min = 0.0; properties.max = 0.0; @@ -40,11 +44,15 @@ double LinuxFrequencyImp::osFrequencyGetStepSize() { ze_result_t LinuxFrequencyImp::osFrequencyGetRange(zes_freq_range_t *pLimits) { ze_result_t result = getMax(pLimits->max); if (ZE_RESULT_SUCCESS != result) { + NEO::printDebugString(NEO::DebugManager.flags.PrintDebugMessages.get(), stderr, + "error@<%s> \n", __func__, result); pLimits->max = -1; } result = getMin(pLimits->min); if (ZE_RESULT_SUCCESS != result) { + NEO::printDebugString(NEO::DebugManager.flags.PrintDebugMessages.get(), stderr, + "error@<%s> \n", __func__, result); pLimits->min = -1; } return ZE_RESULT_SUCCESS; @@ -61,6 +69,8 @@ ze_result_t LinuxFrequencyImp::osFrequencySetRange(const zes_freq_range_t *pLimi if (result1 == ZE_RESULT_SUCCESS && result2 == ZE_RESULT_SUCCESS) { result = setMax(maxDefault); if (ZE_RESULT_SUCCESS != result) { + NEO::printDebugString(NEO::DebugManager.flags.PrintDebugMessages.get(), stderr, + "error@<%s> \n", __func__, result); return result; } return setMin(minDefault); @@ -69,12 +79,16 @@ ze_result_t LinuxFrequencyImp::osFrequencySetRange(const zes_freq_range_t *pLimi double currentMax = 0.0; ze_result_t result = getMax(currentMax); if (ZE_RESULT_SUCCESS != result) { + NEO::printDebugString(NEO::DebugManager.flags.PrintDebugMessages.get(), stderr, + "error@<%s> \n", __func__, result); return result; } if (newMin > currentMax) { // set the max first ze_result_t result = setMax(newMax); if (ZE_RESULT_SUCCESS != result) { + NEO::printDebugString(NEO::DebugManager.flags.PrintDebugMessages.get(), stderr, + "error@<%s> \n", __func__, result); return result; } return setMin(newMin); @@ -83,6 +97,8 @@ ze_result_t LinuxFrequencyImp::osFrequencySetRange(const zes_freq_range_t *pLimi // set the min first result = setMin(newMin); if (ZE_RESULT_SUCCESS != result) { + NEO::printDebugString(NEO::DebugManager.flags.PrintDebugMessages.get(), stderr, + "error@<%s> \n", __func__, result); return result; } return setMax(newMax); @@ -94,6 +110,8 @@ bool LinuxFrequencyImp::getThrottleReasonStatus(void) { if (ZE_RESULT_SUCCESS == result) { return (val == 0 ? false : true); } else { + NEO::printDebugString(NEO::DebugManager.flags.PrintDebugMessages.get(), stderr, + "error@<%s> \n", __func__, throttleReasonStatusFile.c_str(), result); return false; } } @@ -103,21 +121,29 @@ ze_result_t LinuxFrequencyImp::osFrequencyGetState(zes_freq_state_t *pState) { result = getRequest(pState->request); if (ZE_RESULT_SUCCESS != result) { + NEO::printDebugString(NEO::DebugManager.flags.PrintDebugMessages.get(), stderr, + "error@<%s> \n", __func__, result); pState->request = -1; } result = getTdp(pState->tdp); if (ZE_RESULT_SUCCESS != result) { + NEO::printDebugString(NEO::DebugManager.flags.PrintDebugMessages.get(), stderr, + "error@<%s> \n", __func__, result); pState->tdp = -1; } result = getEfficient(pState->efficient); if (ZE_RESULT_SUCCESS != result) { + NEO::printDebugString(NEO::DebugManager.flags.PrintDebugMessages.get(), stderr, + "error@<%s> \n", __func__, result); pState->efficient = -1; } result = getActual(pState->actual); if (ZE_RESULT_SUCCESS != result) { + NEO::printDebugString(NEO::DebugManager.flags.PrintDebugMessages.get(), stderr, + "error@<%s> \n", __func__, result); pState->actual = -1; } @@ -203,6 +229,8 @@ ze_result_t LinuxFrequencyImp::getMin(double &min) { if (result == ZE_RESULT_ERROR_NOT_AVAILABLE) { result = ZE_RESULT_ERROR_UNSUPPORTED_FEATURE; } + NEO::printDebugString(NEO::DebugManager.flags.PrintDebugMessages.get(), stderr, + "error@<%s> \n", __func__, minFreqFile.c_str(), result); return result; } min = intval; @@ -215,6 +243,8 @@ ze_result_t LinuxFrequencyImp::setMin(double min) { if (result == ZE_RESULT_ERROR_NOT_AVAILABLE) { result = ZE_RESULT_ERROR_UNSUPPORTED_FEATURE; } + NEO::printDebugString(NEO::DebugManager.flags.PrintDebugMessages.get(), stderr, + "error@<%s> \n", __func__, minFreqFile.c_str(), result); return result; } return ZE_RESULT_SUCCESS; @@ -228,6 +258,8 @@ ze_result_t LinuxFrequencyImp::getMax(double &max) { if (result == ZE_RESULT_ERROR_NOT_AVAILABLE) { result = ZE_RESULT_ERROR_UNSUPPORTED_FEATURE; } + NEO::printDebugString(NEO::DebugManager.flags.PrintDebugMessages.get(), stderr, + "error@<%s> \n", __func__, maxFreqFile.c_str(), result); return result; } max = intval; @@ -240,6 +272,8 @@ ze_result_t LinuxFrequencyImp::setMax(double max) { if (result == ZE_RESULT_ERROR_NOT_AVAILABLE) { result = ZE_RESULT_ERROR_UNSUPPORTED_FEATURE; } + NEO::printDebugString(NEO::DebugManager.flags.PrintDebugMessages.get(), stderr, + "error@<%s> \n", __func__, maxFreqFile.c_str(), result); return result; } return pSysfsAccess->write(boostFreqFile, max); @@ -253,6 +287,8 @@ ze_result_t LinuxFrequencyImp::getRequest(double &request) { if (result == ZE_RESULT_ERROR_NOT_AVAILABLE) { result = ZE_RESULT_ERROR_UNSUPPORTED_FEATURE; } + NEO::printDebugString(NEO::DebugManager.flags.PrintDebugMessages.get(), stderr, + "error@<%s> \n", __func__, requestFreqFile.c_str(), result); return result; } request = intval; @@ -267,6 +303,8 @@ ze_result_t LinuxFrequencyImp::getTdp(double &tdp) { if (result == ZE_RESULT_ERROR_NOT_AVAILABLE) { result = ZE_RESULT_ERROR_UNSUPPORTED_FEATURE; } + NEO::printDebugString(NEO::DebugManager.flags.PrintDebugMessages.get(), stderr, + "error@<%s> \n", __func__, tdpFreqFile.c_str(), result); return result; } tdp = intval; @@ -281,6 +319,8 @@ ze_result_t LinuxFrequencyImp::getActual(double &actual) { if (result == ZE_RESULT_ERROR_NOT_AVAILABLE) { result = ZE_RESULT_ERROR_UNSUPPORTED_FEATURE; } + NEO::printDebugString(NEO::DebugManager.flags.PrintDebugMessages.get(), stderr, + "error@<%s> \n", __func__, actualFreqFile.c_str(), result); return result; } actual = intval; @@ -295,6 +335,8 @@ ze_result_t LinuxFrequencyImp::getEfficient(double &efficient) { if (result == ZE_RESULT_ERROR_NOT_AVAILABLE) { result = ZE_RESULT_ERROR_UNSUPPORTED_FEATURE; } + NEO::printDebugString(NEO::DebugManager.flags.PrintDebugMessages.get(), stderr, + "error@<%s> \n", __func__, efficientFreqFile.c_str(), result); return result; } efficient = intval; @@ -309,6 +351,8 @@ ze_result_t LinuxFrequencyImp::getMaxVal(double &maxVal) { if (result == ZE_RESULT_ERROR_NOT_AVAILABLE) { result = ZE_RESULT_ERROR_UNSUPPORTED_FEATURE; } + NEO::printDebugString(NEO::DebugManager.flags.PrintDebugMessages.get(), stderr, + "error@<%s> \n", __func__, maxValFreqFile.c_str(), result); return result; } maxVal = intval; @@ -323,6 +367,8 @@ ze_result_t LinuxFrequencyImp::getMinVal(double &minVal) { if (result == ZE_RESULT_ERROR_NOT_AVAILABLE) { result = ZE_RESULT_ERROR_UNSUPPORTED_FEATURE; } + NEO::printDebugString(NEO::DebugManager.flags.PrintDebugMessages.get(), stderr, + "error@<%s> \n", __func__, minValFreqFile.c_str(), result); return result; } minVal = intval; diff --git a/level_zero/tools/source/sysman/frequency/linux/os_frequency_imp_prelim.cpp b/level_zero/tools/source/sysman/frequency/linux/os_frequency_imp_prelim.cpp index 245615b2cb..5726ff638a 100644 --- a/level_zero/tools/source/sysman/frequency/linux/os_frequency_imp_prelim.cpp +++ b/level_zero/tools/source/sysman/frequency/linux/os_frequency_imp_prelim.cpp @@ -1,5 +1,5 @@ /* - * Copyright (C) 2022 Intel Corporation + * Copyright (C) 2022-2023 Intel Corporation * * SPDX-License-Identifier: MIT * @@ -7,6 +7,8 @@ #include "level_zero/tools/source/sysman/frequency/linux/os_frequency_imp_prelim.h" +#include "shared/source/debug_settings/debug_settings_manager.h" + #include "igfxfmid.h" #include "sysman/linux/os_sysman_imp.h" @@ -24,6 +26,8 @@ ze_result_t LinuxFrequencyImp::osFrequencyGetProperties(zes_freq_properties_t &p ze_result_t result2 = getMaxVal(properties.max); // If can't figure out the valid range, then can't control it. if (ZE_RESULT_SUCCESS != result1 || ZE_RESULT_SUCCESS != result2) { + NEO::printDebugString(NEO::DebugManager.flags.PrintDebugMessages.get(), stderr, + "error@<%s> \n", __func__, result1, result2); properties.canControl = false; properties.min = 0.0; properties.max = 0.0; @@ -48,11 +52,15 @@ double LinuxFrequencyImp::osFrequencyGetStepSize() { ze_result_t LinuxFrequencyImp::osFrequencyGetRange(zes_freq_range_t *pLimits) { ze_result_t result = getMax(pLimits->max); if (ZE_RESULT_SUCCESS != result) { + NEO::printDebugString(NEO::DebugManager.flags.PrintDebugMessages.get(), stderr, + "error@<%s> \n", __func__, result); pLimits->max = -1; } result = getMin(pLimits->min); if (ZE_RESULT_SUCCESS != result) { + NEO::printDebugString(NEO::DebugManager.flags.PrintDebugMessages.get(), stderr, + "error@<%s> \n", __func__, result); pLimits->min = -1; } return ZE_RESULT_SUCCESS; @@ -69,6 +77,8 @@ ze_result_t LinuxFrequencyImp::osFrequencySetRange(const zes_freq_range_t *pLimi if (result1 == ZE_RESULT_SUCCESS && result2 == ZE_RESULT_SUCCESS) { result = setMax(maxDefault); if (ZE_RESULT_SUCCESS != result) { + NEO::printDebugString(NEO::DebugManager.flags.PrintDebugMessages.get(), stderr, + "error@<%s> \n", __func__, result); return result; } return setMin(minDefault); @@ -77,12 +87,16 @@ ze_result_t LinuxFrequencyImp::osFrequencySetRange(const zes_freq_range_t *pLimi double currentMax = 0.0; ze_result_t result = getMax(currentMax); if (ZE_RESULT_SUCCESS != result) { + NEO::printDebugString(NEO::DebugManager.flags.PrintDebugMessages.get(), stderr, + "error@<%s> \n", __func__, result); return result; } if (newMin > currentMax) { // set the max first ze_result_t result = setMax(newMax); if (ZE_RESULT_SUCCESS != result) { + NEO::printDebugString(NEO::DebugManager.flags.PrintDebugMessages.get(), stderr, + "error@<%s> \n", __func__, result); return result; } return setMin(newMin); @@ -91,6 +105,8 @@ ze_result_t LinuxFrequencyImp::osFrequencySetRange(const zes_freq_range_t *pLimi // set the min first result = setMin(newMin); if (ZE_RESULT_SUCCESS != result) { + NEO::printDebugString(NEO::DebugManager.flags.PrintDebugMessages.get(), stderr, + "error@<%s> \n", __func__, result); return result; } return setMax(newMax); @@ -101,6 +117,8 @@ bool LinuxFrequencyImp::getThrottleReasonStatus(void) { if (ZE_RESULT_SUCCESS == result) { return (val == 0 ? false : true); } else { + NEO::printDebugString(NEO::DebugManager.flags.PrintDebugMessages.get(), stderr, + "error@<%s> \n", __func__, throttleReasonStatusFile.c_str(), result); return false; } } @@ -110,21 +128,29 @@ ze_result_t LinuxFrequencyImp::osFrequencyGetState(zes_freq_state_t *pState) { result = getRequest(pState->request); if (ZE_RESULT_SUCCESS != result) { + NEO::printDebugString(NEO::DebugManager.flags.PrintDebugMessages.get(), stderr, + "error@<%s> \n", __func__, result); pState->request = -1; } result = getTdp(pState->tdp); if (ZE_RESULT_SUCCESS != result) { + NEO::printDebugString(NEO::DebugManager.flags.PrintDebugMessages.get(), stderr, + "error@<%s> \n", __func__, result); pState->tdp = -1; } result = getEfficient(pState->efficient); if (ZE_RESULT_SUCCESS != result) { + NEO::printDebugString(NEO::DebugManager.flags.PrintDebugMessages.get(), stderr, + "error@<%s> \n", __func__, result); pState->efficient = -1; } result = getActual(pState->actual); if (ZE_RESULT_SUCCESS != result) { + NEO::printDebugString(NEO::DebugManager.flags.PrintDebugMessages.get(), stderr, + "error@<%s> \n", __func__, result); pState->actual = -1; } @@ -209,6 +235,8 @@ ze_result_t LinuxFrequencyImp::getMin(double &min) { if (result == ZE_RESULT_ERROR_NOT_AVAILABLE) { result = ZE_RESULT_ERROR_UNSUPPORTED_FEATURE; } + NEO::printDebugString(NEO::DebugManager.flags.PrintDebugMessages.get(), stderr, + "error@<%s> \n", __func__, minFreqFile.c_str(), result); return result; } min = intval; @@ -221,6 +249,8 @@ ze_result_t LinuxFrequencyImp::setMin(double min) { if (result == ZE_RESULT_ERROR_NOT_AVAILABLE) { result = ZE_RESULT_ERROR_UNSUPPORTED_FEATURE; } + NEO::printDebugString(NEO::DebugManager.flags.PrintDebugMessages.get(), stderr, + "error@<%s> \n", __func__, minFreqFile.c_str(), result); return result; } return ZE_RESULT_SUCCESS; @@ -233,6 +263,8 @@ ze_result_t LinuxFrequencyImp::getMax(double &max) { if (result == ZE_RESULT_ERROR_NOT_AVAILABLE) { result = ZE_RESULT_ERROR_UNSUPPORTED_FEATURE; } + NEO::printDebugString(NEO::DebugManager.flags.PrintDebugMessages.get(), stderr, + "error@<%s> \n", __func__, maxFreqFile.c_str(), result); return result; } max = intval; @@ -245,6 +277,8 @@ ze_result_t LinuxFrequencyImp::setMax(double max) { if (result == ZE_RESULT_ERROR_NOT_AVAILABLE) { result = ZE_RESULT_ERROR_UNSUPPORTED_FEATURE; } + NEO::printDebugString(NEO::DebugManager.flags.PrintDebugMessages.get(), stderr, + "error@<%s> \n", __func__, maxFreqFile.c_str(), result); return result; } return pSysfsAccess->write(boostFreqFile, max); @@ -258,6 +292,8 @@ ze_result_t LinuxFrequencyImp::getRequest(double &request) { if (result == ZE_RESULT_ERROR_NOT_AVAILABLE) { result = ZE_RESULT_ERROR_UNSUPPORTED_FEATURE; } + NEO::printDebugString(NEO::DebugManager.flags.PrintDebugMessages.get(), stderr, + "error@<%s> \n", __func__, requestFreqFile.c_str(), result); return result; } request = intval; @@ -272,6 +308,8 @@ ze_result_t LinuxFrequencyImp::getTdp(double &tdp) { if (result == ZE_RESULT_ERROR_NOT_AVAILABLE) { result = ZE_RESULT_ERROR_UNSUPPORTED_FEATURE; } + NEO::printDebugString(NEO::DebugManager.flags.PrintDebugMessages.get(), stderr, + "error@<%s> \n", __func__, tdpFreqFile.c_str(), result); return result; } tdp = intval; @@ -286,6 +324,8 @@ ze_result_t LinuxFrequencyImp::getActual(double &actual) { if (result == ZE_RESULT_ERROR_NOT_AVAILABLE) { result = ZE_RESULT_ERROR_UNSUPPORTED_FEATURE; } + NEO::printDebugString(NEO::DebugManager.flags.PrintDebugMessages.get(), stderr, + "error@<%s> \n", __func__, actualFreqFile.c_str(), result); return result; } actual = intval; @@ -300,6 +340,8 @@ ze_result_t LinuxFrequencyImp::getEfficient(double &efficient) { if (result == ZE_RESULT_ERROR_NOT_AVAILABLE) { result = ZE_RESULT_ERROR_UNSUPPORTED_FEATURE; } + NEO::printDebugString(NEO::DebugManager.flags.PrintDebugMessages.get(), stderr, + "error@<%s> \n", __func__, efficientFreqFile.c_str(), result); return result; } efficient = intval; @@ -314,6 +356,8 @@ ze_result_t LinuxFrequencyImp::getMaxVal(double &maxVal) { if (result == ZE_RESULT_ERROR_NOT_AVAILABLE) { result = ZE_RESULT_ERROR_UNSUPPORTED_FEATURE; } + NEO::printDebugString(NEO::DebugManager.flags.PrintDebugMessages.get(), stderr, + "error@<%s> \n", __func__, maxValFreqFile.c_str(), result); return result; } maxVal = intval; @@ -328,6 +372,8 @@ ze_result_t LinuxFrequencyImp::getMinVal(double &minVal) { if (result == ZE_RESULT_ERROR_NOT_AVAILABLE) { result = ZE_RESULT_ERROR_UNSUPPORTED_FEATURE; } + NEO::printDebugString(NEO::DebugManager.flags.PrintDebugMessages.get(), stderr, + "error@<%s> \n", __func__, minValFreqFile.c_str(), result); return result; } minVal = intval;