refactor: improve extracting Queue properties

Signed-off-by: Bartosz Dunajski <bartosz.dunajski@intel.com>
This commit is contained in:
Bartosz Dunajski
2024-06-07 11:43:29 +00:00
committed by Compute-Runtime-Automation
parent 7c3fbc0664
commit 703fabdffd
4 changed files with 32 additions and 17 deletions

View File

@@ -28,6 +28,7 @@
#include "level_zero/core/source/device/device_imp.h"
#include "level_zero/core/source/driver/driver_handle_imp.h"
#include "level_zero/core/source/gfx_core_helpers/l0_gfx_core_helper.h"
#include "level_zero/core/source/helpers/properties_parser.h"
#include "level_zero/core/source/kernel/kernel.h"
#include "igfxfmid.h"
@@ -361,14 +362,24 @@ ze_result_t CommandQueueImp::getIndex(uint32_t *pIndex) {
return ZE_RESULT_SUCCESS;
}
bool CommandQueue::uniqueInterruptRequired(const ze_command_queue_desc_t &desc) {
auto properties = static_cast<const ze_base_properties_t *>(desc.pNext);
QueueProperties CommandQueue::extractQueueProperties(const ze_command_queue_desc_t &desc) {
QueueProperties queueProperties = {};
if (properties && (properties->stype == ZEX_INTEL_STRUCTURE_TYPE_QUEUE_ALLOCATE_MSIX_HINT_EXP_PROPERTIES)) {
return static_cast<const zex_intel_queue_allocate_msix_hint_exp_desc_t *>(desc.pNext)->uniqueMsix;
auto baseProperties = static_cast<const ze_base_desc_t *>(desc.pNext);
while (baseProperties) {
if (baseProperties->stype == ZEX_INTEL_STRUCTURE_TYPE_QUEUE_ALLOCATE_MSIX_HINT_EXP_PROPERTIES) {
queueProperties.interruptHint = static_cast<const zex_intel_queue_allocate_msix_hint_exp_desc_t *>(desc.pNext)->uniqueMsix;
} else if (auto syncDispatchMode = getSyncDispatchMode(baseProperties)) {
if (syncDispatchMode.has_value()) {
queueProperties.synchronizedDispatchMode = syncDispatchMode.value();
}
}
baseProperties = static_cast<const ze_base_desc_t *>(baseProperties->pNext);
}
return false;
return queueProperties;
}
} // namespace L0

View File

@@ -7,6 +7,7 @@
#pragma once
#include "shared/source/command_stream/task_count_helper.h"
#include "shared/source/helpers/common_types.h"
#include "shared/source/helpers/definitions/engine_group_types.h"
#include "shared/source/helpers/heap_base_address_model.h"
@@ -23,6 +24,7 @@ class CommandStreamReceiver;
class GraphicsAllocation;
class LinearStream;
using ResidencyContainer = std::vector<GraphicsAllocation *>;
} // namespace NEO
struct UnifiedMemoryControls;
@@ -30,6 +32,11 @@ struct UnifiedMemoryControls;
namespace L0 {
struct Device;
struct QueueProperties {
NEO::SynchronizedDispatchMode synchronizedDispatchMode = NEO::SynchronizedDispatchMode::disabled;
bool interruptHint = false;
};
struct CommandQueue : _ze_command_queue_handle_t {
template <typename Type>
struct Allocator {
@@ -60,7 +67,7 @@ struct CommandQueue : _ze_command_queue_handle_t {
return static_cast<CommandQueue *>(handle);
}
static bool uniqueInterruptRequired(const ze_command_queue_desc_t &desc);
static QueueProperties extractQueueProperties(const ze_command_queue_desc_t &desc);
virtual void handleIndirectAllocationResidency(UnifiedMemoryControls unifiedMemoryControls, std::unique_lock<std::mutex> &lockForIndirect, bool performMigration) = 0;
virtual void makeResidentAndMigrate(bool performMigration, const NEO::ResidencyContainer &residencyContainer) = 0;