mirror of
https://github.com/intel/compute-runtime.git
synced 2026-01-03 14:55:24 +08:00
feature: Make priority level in priority extension truly optional
Related-To: NEO-16102 Signed-off-by: Slawomir Milczarek <slawomir.milczarek@intel.com>
This commit is contained in:
committed by
Compute-Runtime-Automation
parent
60d5484e6b
commit
a5f08b5f42
@@ -16,6 +16,7 @@
|
||||
|
||||
#include <atomic>
|
||||
#include <mutex>
|
||||
#include <optional>
|
||||
#include <vector>
|
||||
|
||||
struct _ze_command_queue_handle_t : BaseHandleWithLoaderTranslation<ZEL_HANDLE_COMMAND_QUEUE> {};
|
||||
@@ -38,7 +39,7 @@ struct QueueProperties {
|
||||
NEO::SynchronizedDispatchMode synchronizedDispatchMode = NEO::SynchronizedDispatchMode::disabled;
|
||||
bool interruptHint = false;
|
||||
bool copyOffloadHint = false;
|
||||
int priorityLevel = 0;
|
||||
std::optional<int> priorityLevel = std::nullopt;
|
||||
};
|
||||
|
||||
struct CommandQueue : _ze_command_queue_handle_t {
|
||||
|
||||
@@ -143,7 +143,7 @@ struct Device : _ze_device_handle_t {
|
||||
virtual NEO::GraphicsAllocation *allocateMemoryFromHostPtr(const void *buffer, size_t size, bool hostCopyAllowed) = 0;
|
||||
virtual void setSysmanHandle(SysmanDevice *pSysmanDevice) = 0;
|
||||
virtual SysmanDevice *getSysmanHandle() = 0;
|
||||
virtual ze_result_t getCsrForOrdinalAndIndex(NEO::CommandStreamReceiver **csr, uint32_t ordinal, uint32_t index, ze_command_queue_priority_t priority, int priorityLevel, bool allocateInterrupt) = 0;
|
||||
virtual ze_result_t getCsrForOrdinalAndIndex(NEO::CommandStreamReceiver **csr, uint32_t ordinal, uint32_t index, ze_command_queue_priority_t priority, std::optional<int> priorityLevel, bool allocateInterrupt) = 0;
|
||||
virtual ze_result_t getCsrForLowPriority(NEO::CommandStreamReceiver **csr, bool copyOnly) = 0;
|
||||
virtual NEO::GraphicsAllocation *obtainReusableAllocation(size_t requiredSize, NEO::AllocationType type) = 0;
|
||||
virtual void storeReusableAllocation(NEO::GraphicsAllocation &alloc) = 0;
|
||||
|
||||
@@ -1896,7 +1896,7 @@ bool DeviceImp::isQueueGroupOrdinalValid(uint32_t ordinal) {
|
||||
return true;
|
||||
}
|
||||
|
||||
ze_result_t DeviceImp::getCsrForOrdinalAndIndex(NEO::CommandStreamReceiver **csr, uint32_t ordinal, uint32_t index, ze_command_queue_priority_t priority, int priorityLevel, bool allocateInterrupt) {
|
||||
ze_result_t DeviceImp::getCsrForOrdinalAndIndex(NEO::CommandStreamReceiver **csr, uint32_t ordinal, uint32_t index, ze_command_queue_priority_t priority, std::optional<int> priorityLevel, bool allocateInterrupt) {
|
||||
auto &engineGroups = getActiveDevice()->getRegularEngineGroups();
|
||||
uint32_t numEngineGroups = static_cast<uint32_t>(engineGroups.size());
|
||||
|
||||
@@ -1946,13 +1946,15 @@ ze_result_t DeviceImp::getCsrForOrdinalAndIndex(NEO::CommandStreamReceiver **csr
|
||||
auto engineGroupType = getEngineGroupTypeForOrdinal(ordinal);
|
||||
bool copyOnly = NEO::EngineHelper::isCopyOnlyEngineType(engineGroupType);
|
||||
|
||||
if (priorityLevel < 0) {
|
||||
priority = ZE_COMMAND_QUEUE_PRIORITY_PRIORITY_HIGH;
|
||||
} else if (priorityLevel == this->queuePriorityLow) {
|
||||
DEBUG_BREAK_IF(this->queuePriorityLow == 0);
|
||||
priority = ZE_COMMAND_QUEUE_PRIORITY_PRIORITY_LOW;
|
||||
} else if (priorityLevel > 0) {
|
||||
priority = ZE_COMMAND_QUEUE_PRIORITY_NORMAL;
|
||||
if (priorityLevel.has_value()) {
|
||||
if (priorityLevel.value() < 0) {
|
||||
priority = ZE_COMMAND_QUEUE_PRIORITY_PRIORITY_HIGH;
|
||||
} else if (priorityLevel.value() == this->queuePriorityLow) {
|
||||
DEBUG_BREAK_IF(this->queuePriorityLow == 0);
|
||||
priority = ZE_COMMAND_QUEUE_PRIORITY_PRIORITY_LOW;
|
||||
} else if (priorityLevel.value() > 0) {
|
||||
priority = ZE_COMMAND_QUEUE_PRIORITY_NORMAL;
|
||||
}
|
||||
}
|
||||
|
||||
if (priority == ZE_COMMAND_QUEUE_PRIORITY_PRIORITY_HIGH) {
|
||||
@@ -2005,7 +2007,7 @@ ze_result_t DeviceImp::getCsrForOrdinalAndIndex(NEO::CommandStreamReceiver **csr
|
||||
return ZE_RESULT_SUCCESS;
|
||||
}
|
||||
|
||||
bool DeviceImp::tryAssignSecondaryContext(aub_stream::EngineType engineType, NEO::EngineUsage engineUsage, int priorityLevel, NEO::CommandStreamReceiver **csr, bool allocateInterrupt) {
|
||||
bool DeviceImp::tryAssignSecondaryContext(aub_stream::EngineType engineType, NEO::EngineUsage engineUsage, std::optional<int> priorityLevel, NEO::CommandStreamReceiver **csr, bool allocateInterrupt) {
|
||||
if (neoDevice->isSecondaryContextEngineType(engineType)) {
|
||||
NEO::EngineTypeUsage engineTypeUsage;
|
||||
engineTypeUsage.first = engineType;
|
||||
|
||||
@@ -118,7 +118,7 @@ struct DeviceImp : public Device, NEO::NonCopyableAndNonMovableClass {
|
||||
NEO::GraphicsAllocation *allocateMemoryFromHostPtr(const void *buffer, size_t size, bool hostCopyAllowed) override;
|
||||
void setSysmanHandle(SysmanDevice *pSysman) override;
|
||||
SysmanDevice *getSysmanHandle() override;
|
||||
ze_result_t getCsrForOrdinalAndIndex(NEO::CommandStreamReceiver **csr, uint32_t ordinal, uint32_t index, ze_command_queue_priority_t priority, int priorityLevel, bool allocateInterrupt) override;
|
||||
ze_result_t getCsrForOrdinalAndIndex(NEO::CommandStreamReceiver **csr, uint32_t ordinal, uint32_t index, ze_command_queue_priority_t priority, std::optional<int> priorityLevel, bool allocateInterrupt) override;
|
||||
ze_result_t getCsrForLowPriority(NEO::CommandStreamReceiver **csr, bool copyOnly) override;
|
||||
ze_result_t getCsrForHighPriority(NEO::CommandStreamReceiver **csr, bool copyOnly);
|
||||
bool isSuitableForLowPriority(ze_command_queue_priority_t priority, bool copyOnly);
|
||||
@@ -193,7 +193,7 @@ struct DeviceImp : public Device, NEO::NonCopyableAndNonMovableClass {
|
||||
NEO::EngineGroupType getEngineGroupTypeForOrdinal(uint32_t ordinal) const;
|
||||
void getP2PPropertiesDirectFabricConnection(DeviceImp *peerDeviceImp,
|
||||
ze_device_p2p_bandwidth_exp_properties_t *bandwidthPropertiesDesc);
|
||||
bool tryAssignSecondaryContext(aub_stream::EngineType engineType, NEO::EngineUsage engineUsage, int priorityLevel, NEO::CommandStreamReceiver **csr, bool allocateInterrupt);
|
||||
bool tryAssignSecondaryContext(aub_stream::EngineType engineType, NEO::EngineUsage engineUsage, std::optional<int> priorityLevel, NEO::CommandStreamReceiver **csr, bool allocateInterrupt);
|
||||
NEO::EngineGroupsT subDeviceCopyEngineGroups{};
|
||||
|
||||
SysmanDevice *pSysmanDevice = nullptr;
|
||||
|
||||
Reference in New Issue
Block a user