mirror of
https://github.com/intel/compute-runtime.git
synced 2026-01-03 14:55:24 +08:00
Passing drm file descriptor to Metrics Library
Change-Id: I16b566ba262e0eeff9cb62b2a6ecc48811cdee48 Signed-off-by: Robert Krzemien <robert.krzemien@intel.com>
This commit is contained in:
committed by
sys_ocldev
parent
5eed521fe1
commit
9b3dd97f81
@@ -5,6 +5,9 @@
|
||||
*
|
||||
*/
|
||||
|
||||
#include "shared/source/os_interface/linux/drm_neo.h"
|
||||
#include "shared/source/os_interface/linux/os_interface.h"
|
||||
|
||||
#include "level_zero/core/source/device/device.h"
|
||||
#include "level_zero/tools/source/metrics/metric_query_imp.h"
|
||||
|
||||
@@ -15,7 +18,16 @@ namespace L0 {
|
||||
const char *MetricsLibrary::getFilename() { return "libigdml.so"; }
|
||||
|
||||
bool MetricsLibrary::getContextData(Device &device, ContextCreateData_1_0 &contextData) {
|
||||
return true;
|
||||
|
||||
auto osInterface = device.getOsInterface().get();
|
||||
auto drm = osInterface->getDrm();
|
||||
auto drmFileDescriptor = drm->getFileDescriptor();
|
||||
auto &osData = contextData.ClientData->Linux;
|
||||
|
||||
osData.Adapter->Type = LinuxAdapterType::DrmFileDescriptor;
|
||||
osData.Adapter->DrmFileDescriptor = drmFileDescriptor;
|
||||
|
||||
return drmFileDescriptor != -1;
|
||||
}
|
||||
|
||||
bool MetricsLibrary::activateConfiguration(const ConfigurationHandle_1_0 configurationHandle) {
|
||||
|
||||
@@ -205,6 +205,7 @@ bool MetricsLibrary::createContext() {
|
||||
ClientOptionsData_1_0 clientOptions[1] = {};
|
||||
ClientData_1_0 clientData = {};
|
||||
ClientType_1_0 clientType = {};
|
||||
ClientDataLinuxAdapter_1_0 adapter = {};
|
||||
|
||||
// Check if compute command streamer is used.
|
||||
auto asyncComputeEngine = std::find_if(asyncComputeEngines.begin(), asyncComputeEngines.end(), [&](const auto &engine) {
|
||||
@@ -220,12 +221,13 @@ bool MetricsLibrary::createContext() {
|
||||
|
||||
// Create metrics library context.
|
||||
DEBUG_BREAK_IF(!contextCreateFunction);
|
||||
clientType.Api = ClientApi::OpenCL;
|
||||
clientType.Api = ClientApi::OneApi;
|
||||
clientType.Gen = getGenType(device.getPlatformInfo());
|
||||
|
||||
clientOptions[0].Type = ClientOptionsType::Compute;
|
||||
clientOptions[0].Compute.Asynchronous = asyncComputeEngine != asyncComputeEngines.end();
|
||||
|
||||
clientData.Linux.Adapter = &adapter;
|
||||
clientData.ClientOptions = clientOptions;
|
||||
clientData.ClientOptionsCount = sizeof(clientOptions) / sizeof(ClientOptionsData_1_0);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user