mirror of
https://github.com/intel/compute-runtime.git
synced 2026-01-23 03:33:13 +08:00
Metric Api: Return apprioprate error when dependencies not met
Change-Id: Ie47a69c4bf80004f7fbc1b91e2025d498e4bda6a Signed-off-by: Robert Krzemien <robert.krzemien@intel.com>
This commit is contained in:
committed by
sys_ocldev
parent
a0c22dec2d
commit
59ffe4ba4b
@@ -165,7 +165,7 @@ void MetricContext::enableMetricApi(ze_result_t &result) {
|
||||
}
|
||||
|
||||
if (!isMetricApiAvailable()) {
|
||||
result = ZE_RESULT_ERROR_UNKNOWN;
|
||||
result = static_cast<ze_result_t>(0x70020000);
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -188,7 +188,7 @@ void MetricContext::enableMetricApi(ze_result_t &result) {
|
||||
for (auto deviceHandle : devices) {
|
||||
Device *device = L0::Device::fromHandle(deviceHandle);
|
||||
if (!device->getMetricContext().loadDependencies()) {
|
||||
result = ZE_RESULT_ERROR_UNKNOWN;
|
||||
result = static_cast<ze_result_t>(0x70020000);
|
||||
return;
|
||||
}
|
||||
}
|
||||
@@ -207,12 +207,14 @@ bool MetricContext::isMetricApiAvailable() {
|
||||
// Check Metrics Discovery availability.
|
||||
library.reset(NEO::OsLibrary::load(MetricEnumeration::getMetricsDiscoveryFilename()));
|
||||
if (library == nullptr) {
|
||||
NEO::printDebugString(NEO::DebugManager.flags.PrintDebugMessages.get(), stderr, "Unable to find metrics discovery %s\n", MetricEnumeration::getMetricsDiscoveryFilename());
|
||||
return false;
|
||||
}
|
||||
|
||||
// Check Metrics Library availability.
|
||||
library.reset(NEO::OsLibrary::load(MetricsLibrary::getFilename()));
|
||||
if (library == nullptr) {
|
||||
NEO::printDebugString(NEO::DebugManager.flags.PrintDebugMessages.get(), stderr, "Unable to find metrics library %s\n", MetricsLibrary::getFilename());
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
@@ -84,6 +84,7 @@ ze_result_t MetricEnumeration::loadMetricsDiscovery() {
|
||||
|
||||
if (openMetricsDevice == nullptr || closeMetricsDevice == nullptr ||
|
||||
openMetricsDeviceFromFile == nullptr) {
|
||||
NEO::printDebugString(NEO::DebugManager.flags.PrintDebugMessages.get(), stderr, "cannot load %s exported functions\n", MetricEnumeration::getMetricsDiscoveryFilename());
|
||||
cleanupMetricsDiscovery();
|
||||
return ZE_RESULT_ERROR_UNKNOWN;
|
||||
}
|
||||
|
||||
@@ -191,10 +191,13 @@ bool MetricsLibrary::load() {
|
||||
handle->getProcAddress(METRICS_LIBRARY_CONTEXT_DELETE_1_0));
|
||||
}
|
||||
|
||||
if (contextCreateFunction == nullptr || contextDeleteFunction == nullptr) {
|
||||
NEO::printDebugString(NEO::DebugManager.flags.PrintDebugMessages.get(), stderr, "cannot load %s exported functions\n", MetricsLibrary::getFilename());
|
||||
return false;
|
||||
}
|
||||
|
||||
// Return success if exported functions have been loaded.
|
||||
const bool result = contextCreateFunction && contextDeleteFunction;
|
||||
DEBUG_BREAK_IF(!result);
|
||||
return result;
|
||||
return true;
|
||||
}
|
||||
|
||||
bool MetricsLibrary::createContext() {
|
||||
|
||||
Reference in New Issue
Block a user