feature: Support for concurrent groups

Related-To: NEO-10306

Signed-off-by: Joshua Santosh Ranjan <joshua.santosh.ranjan@intel.com>
This commit is contained in:
Joshua Santosh Ranjan
2024-04-12 10:23:36 +00:00
committed by Compute-Runtime-Automation
parent 15a049cf9c
commit e0a580fce7
16 changed files with 488 additions and 2 deletions

View File

@@ -20,4 +20,6 @@ target_sources(${L0_STATIC_LIB_NAME}
${CMAKE_CURRENT_SOURCE_DIR}/zex_memory.h
${CMAKE_CURRENT_SOURCE_DIR}/zex_module.cpp
${CMAKE_CURRENT_SOURCE_DIR}/zex_module.h
${CMAKE_CURRENT_SOURCE_DIR}/zex_metric.h
${CMAKE_CURRENT_SOURCE_DIR}/zex_metric.cpp
)

View File

@@ -22,6 +22,7 @@
#include "zex_driver.h"
#include "zex_event.h"
#include "zex_memory.h"
#include "zex_metric.h"
#include "zex_module.h"
#endif // _ZEX_API_H

View File

@@ -0,0 +1,43 @@
/*
* Copyright (C) 2024 Intel Corporation
*
* SPDX-License-Identifier: MIT
*
*/
#include "level_zero/api/driver_experimental/public/zex_metric.h"
#include "level_zero/core/source/device/device.h"
#include "level_zero/tools/source/metrics/metric.h"
namespace L0 {
ze_result_t ZE_APICALL
zexDeviceGetConcurrentMetricGroups(
zet_device_handle_t hDevice,
uint32_t metricGroupCount,
zet_metric_group_handle_t *phMetricGroups,
uint32_t *pConcurrentGroupCount,
uint32_t *pCountPerConcurrentGroup) {
auto device = Device::fromHandle(hDevice);
return static_cast<MetricDeviceContext &>(device->getMetricDeviceContext()).getConcurrentMetricGroups(metricGroupCount, phMetricGroups, pConcurrentGroupCount, pCountPerConcurrentGroup);
}
} // namespace L0
extern "C" {
ZE_APIEXPORT ze_result_t ZE_APICALL
zexDeviceGetConcurrentMetricGroups(
zet_device_handle_t hDevice,
uint32_t metricGroupCount,
zet_metric_group_handle_t *phMetricGroups,
uint32_t *pConcurrentGroupCount,
uint32_t *pCountPerConcurrentGroup) {
return L0::zexDeviceGetConcurrentMetricGroups(
hDevice, metricGroupCount, phMetricGroups,
pConcurrentGroupCount, pCountPerConcurrentGroup);
}
} // extern "C"

View File

@@ -0,0 +1,40 @@
/*
* Copyright (C) 2024 Intel Corporation
*
* SPDX-License-Identifier: MIT
*
*/
#ifndef _ZEX_METRIC_H
#define _ZEX_METRIC_H
#if defined(__cplusplus)
#pragma once
#endif
#include <level_zero/ze_api.h>
#include <level_zero/zet_api.h>
namespace L0 {
///////////////////////////////////////////////////////////////////////////////
/// @brief Get sets of metric groups which could be collected concurrently.
///
/// @details
/// - Re-arrange the input metric groups to provide sets of concurrent metric groups.
/// - The application may call this function from simultaneous threads.
/// - The implementation of this function must be thread-safe.
///
/// @returns
/// - ::ZE_RESULT_SUCCESS
/// - ::ZE_RESULT_ERROR_INVALID_ARGUMENT
/// + `pConcurrentGroupCount` is not same as was returned by L0 using zexDeviceGetConcurrentMetricGroups
ZE_APIEXPORT ze_result_t ZE_APICALL
zexDeviceGetConcurrentMetricGroups(
zet_device_handle_t hDevice, // [in] handle of the device
uint32_t metricGroupCount, // [in] metric group count
zet_metric_group_handle_t *phMetricGroups, // [in, out] metrics groups to be re-arranged to be sets of concurrent groups
uint32_t *pConcurrentGroupCount, // [out] number of concurrent groups.
uint32_t *pCountPerConcurrentGroup); // [in,out][optional][*pConcurrentGroupCount] count of metric groups per concurrent group.
} // namespace L0
#endif // _ZEX_METRIC_H