fix: stop direct submission before oa configuration activation

Related-To: NEO-12778
Signed-off-by: Robert Krzemień <robert.krzemien@intel.com>
This commit is contained in:
Robert Krzemień
2024-10-22 12:56:08 +00:00
committed by Compute-Runtime-Automation
parent 01a0b8e7f7
commit fe1fd22371
13 changed files with 205 additions and 10 deletions

View File

@@ -1,5 +1,5 @@
/*
* Copyright (C) 2020-2022 Intel Corporation
* Copyright (C) 2020-2024 Intel Corporation
*
* SPDX-License-Identifier: MIT
*
@@ -27,6 +27,8 @@ bool MetricsLibrary::getContextData(Device &device, ContextCreateData_1_0 &conte
osData.Adapter->Type = LinuxAdapterType::DrmFileDescriptor;
osData.Adapter->DrmFileDescriptor = drmFileDescriptor;
callbacks.CommandBufferFlush = &flushCommandBufferCallback;
contextData.ClientData->Handle = reinterpret_cast<void *>(&device);
return drmFileDescriptor != -1;
}

View File

@@ -943,4 +943,13 @@ MetricQuery *MetricQuery::fromHandle(zet_metric_query_handle_t handle) {
zet_metric_query_handle_t MetricQuery::toHandle() { return this; }
StatusCode ML_STDCALL MetricsLibrary::flushCommandBufferCallback(ClientHandle_1_0 handle) {
Device *device = static_cast<Device *>(handle.data);
if (device) {
device->getNEODevice()->stopDirectSubmissionAndWaitForCompletion();
return StatusCode::Success;
}
return StatusCode::Failed;
}
} // namespace L0

View File

@@ -1,5 +1,5 @@
/*
* Copyright (C) 2020-2023 Intel Corporation
* Copyright (C) 2020-2024 Intel Corporation
*
* SPDX-License-Identifier: MIT
*
@@ -16,6 +16,7 @@
using MetricsLibraryApi::ClientCallbacks_1_0;
using MetricsLibraryApi::ClientGen;
using MetricsLibraryApi::ClientHandle_1_0;
using MetricsLibraryApi::ClientOptionsData_1_0;
using MetricsLibraryApi::CommandBufferData_1_0;
using MetricsLibraryApi::ConfigurationHandle_1_0;
@@ -25,6 +26,7 @@ using MetricsLibraryApi::ContextDeleteFunction_1_0;
using MetricsLibraryApi::ContextHandle_1_0;
using MetricsLibraryApi::Interface_1_0;
using MetricsLibraryApi::QueryHandle_1_0;
using MetricsLibraryApi::StatusCode;
namespace L0 {
struct Device;
@@ -73,6 +75,7 @@ struct MetricsLibrary {
bool getGpuCommands(CommandList &commandList, CommandBufferData_1_0 &commandBuffer);
bool getGpuCommands(CommandBufferData_1_0 &commandBuffer);
uint32_t getGpuCommandsSize(CommandBufferData_1_0 &commandBuffer);
static StatusCode ML_STDCALL flushCommandBufferCallback(ClientHandle_1_0 handle);
// Metric group configuration.
ConfigurationHandle_1_0 getConfiguration(const zet_metric_group_handle_t metricGroup);

View File

@@ -1,5 +1,5 @@
/*
* Copyright (C) 2020-2023 Intel Corporation
* Copyright (C) 2020-2024 Intel Corporation
*
* SPDX-License-Identifier: MIT
*
@@ -34,8 +34,9 @@ bool MetricsLibrary::getContextData(Device &device, ContextCreateData_1_0 &conte
osData.KmdInstrumentationEnabled = true;
osData.Device = reinterpret_cast<void *>(static_cast<UINT_PTR>(wddm->getDeviceHandle()));
osData.Escape = reinterpret_cast<void *>(wddm->getEscapeHandle());
osData.Adapter =
reinterpret_cast<void *>(static_cast<UINT_PTR>(wddm->getAdapter()));
osData.Adapter = reinterpret_cast<void *>(static_cast<UINT_PTR>(wddm->getAdapter()));
callbacks.CommandBufferFlush = &flushCommandBufferCallback;
contextData.ClientData->Handle = reinterpret_cast<void *>(&device);
return osData.Device && osData.Escape && osData.Adapter;
}