mirror of
https://github.com/intel/compute-runtime.git
synced 2026-01-05 09:09:04 +08:00
Initial support for oneAPI Level Zero
Change-Id: I221df8427b1844237a4d9d900c58512706b0be0f
This commit is contained in:
22
level_zero/tools/source/metrics/linux/CMakeLists.txt
Normal file
22
level_zero/tools/source/metrics/linux/CMakeLists.txt
Normal file
@@ -0,0 +1,22 @@
|
||||
#
|
||||
# Copyright (C) 2019-2020 Intel Corporation
|
||||
#
|
||||
# SPDX-License-Identifier: MIT
|
||||
#
|
||||
|
||||
if(HAVE_INSTRUMENTATION)
|
||||
set(L0_SRCS_TOOLS_LINUX
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/CMakeLists.txt
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/os_metric_query_imp_linux.cpp
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/os_metric_enumeration_imp_linux.cpp)
|
||||
|
||||
if(UNIX)
|
||||
target_sources(${TARGET_NAME_L0}
|
||||
PRIVATE
|
||||
${L0_SRCS_TOOLS_LINUX}
|
||||
)
|
||||
endif()
|
||||
|
||||
# Make our source files visible to parent
|
||||
set_property(GLOBAL PROPERTY L0_SRCS_TOOLS_LINUX ${L0_SRCS_TOOLS_LINUX})
|
||||
endif()
|
||||
@@ -0,0 +1,16 @@
|
||||
/*
|
||||
* Copyright (C) 2019-2020 Intel Corporation
|
||||
*
|
||||
* SPDX-License-Identifier: MIT
|
||||
*
|
||||
*/
|
||||
|
||||
#include "level_zero/tools/source/metrics/metric_enumeration_imp.h"
|
||||
|
||||
namespace L0 {
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
/// @brief Returns Metrics Discovery library file name.
|
||||
const char *MetricEnumeration::getMetricsDiscoveryFilename() { return "libmd.so"; }
|
||||
|
||||
} // namespace L0
|
||||
@@ -0,0 +1,56 @@
|
||||
/*
|
||||
* Copyright (C) 2019-2020 Intel Corporation
|
||||
*
|
||||
* SPDX-License-Identifier: MIT
|
||||
*
|
||||
*/
|
||||
|
||||
#include "level_zero/core/source/device.h"
|
||||
#include "level_zero/tools/source/metrics/metric_query_imp.h"
|
||||
|
||||
using namespace MetricsLibraryApi;
|
||||
|
||||
namespace L0 {
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
/// @brief Returns metrics library file name.
|
||||
const char *MetricsLibrary::getFilename() { return "libigdml64.so"; }
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
/// @brief Returns os specific data required to initialize metrics library.
|
||||
bool MetricsLibrary::getContextData(Device &device, ContextCreateData_1_0 &contextData) {
|
||||
return true;
|
||||
}
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
/// @brief Writes metric group configuration to gpu.
|
||||
bool MetricsLibrary::activateConfiguration(const ConfigurationHandle_1_0 configurationHandle) {
|
||||
UNRECOVERABLE_IF(!configurationHandle.IsValid());
|
||||
|
||||
ConfigurationActivateData_1_0 activateData = {};
|
||||
activateData.Type = GpuConfigurationActivationType::Tbs;
|
||||
|
||||
const bool validMetricsLibrary = isInitialized();
|
||||
const bool validConfiguration = configurationHandle.IsValid();
|
||||
const bool result =
|
||||
validMetricsLibrary && validConfiguration &&
|
||||
(api.ConfigurationActivate(configurationHandle, &activateData) == StatusCode::Success);
|
||||
|
||||
UNRECOVERABLE_IF(!result);
|
||||
return result;
|
||||
}
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
/// @brief Disables activated metric group configuration.
|
||||
bool MetricsLibrary::deactivateConfiguration(const ConfigurationHandle_1_0 configurationHandle) {
|
||||
|
||||
const bool validMetricsLibrary = isInitialized();
|
||||
const bool validConfiguration = configurationHandle.IsValid();
|
||||
const bool result = validMetricsLibrary && validConfiguration &&
|
||||
(api.ConfigurationDeactivate(configurationHandle) == StatusCode::Success);
|
||||
|
||||
UNRECOVERABLE_IF(!result);
|
||||
return result;
|
||||
}
|
||||
|
||||
} // namespace L0
|
||||
Reference in New Issue
Block a user