Skip to content

Commit

Permalink
Update the name of the variables
Browse files Browse the repository at this point in the history
Signed-off-by: Bogdan Pereanu <[email protected]>
  • Loading branch information
pereanub committed Jan 27, 2025
1 parent 4ec3dde commit 21a6985
Show file tree
Hide file tree
Showing 3 changed files with 29 additions and 29 deletions.
8 changes: 4 additions & 4 deletions src/plugins/intel_npu/src/backend/src/zero_pipeline.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -32,8 +32,8 @@ Pipeline::Pipeline(const Config& config,
_id(_graph->get_unique_id()),
_number_of_command_lists(_graph->get_batch_size().has_value() ? *_graph->get_batch_size() : 1),
_event_pool{
std::make_shared<EventPool>(init_structs->getDevice(),
init_structs->getContext(),
std::make_shared<EventPool>(_init_structs->getDevice(),
_init_structs->getContext(),
_number_of_command_lists ? static_cast<uint32_t>(_number_of_command_lists) : 1)},
_npu_profiling(npu_profiling),
_logger("Pipeline", _config.get<LOG_LEVEL>()),
Expand All @@ -57,9 +57,9 @@ Pipeline::Pipeline(const Config& config,
_logger.debug("Pipeline - emplace_back _event_pool and _command_queue");
for (size_t i = 0; i < _number_of_command_lists; i++) {
_command_lists.emplace_back(
std::make_unique<CommandList>(init_structs,
std::make_unique<CommandList>(_init_structs,
group_ordinal,
init_structs->getMutableCommandListVersion() ? true : false));
_init_structs->getMutableCommandListVersion() ? true : false));
_events.emplace_back(std::make_shared<Event>(_event_pool, static_cast<uint32_t>(i)));
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ class CommandList {
public:
friend class CommandQueue;
CommandList() = delete;
CommandList(const std::shared_ptr<ZeroInitStructsHolder>& initStructs,
CommandList(const std::shared_ptr<ZeroInitStructsHolder>& init_structs,
const uint32_t& group_ordinal,
bool mtci_is_supported = false);
CommandList(const CommandList&) = delete;
Expand All @@ -85,7 +85,7 @@ class CommandList {
}

private:
std::shared_ptr<ZeroInitStructsHolder> _initStructs;
std::shared_ptr<ZeroInitStructsHolder> _init_structs;

Logger _log;

Expand Down Expand Up @@ -158,12 +158,12 @@ class CommandQueueFactory {
const std::shared_ptr<CommandQueue>& getCommandQueue(
const std::shared_ptr<ZeroInitStructsHolder>& init_structs,
const ze_command_queue_priority_t& priority,
const std::optional<ze_command_queue_workload_type_t>& workloadType,
const std::optional<ze_command_queue_workload_type_t>& workload_type,
const uint32_t& group_ordinal,
bool turbo);

void freeCommandQueue(const ze_command_queue_priority_t& priority,
const std::optional<ze_command_queue_workload_type_t>& workloadType,
const std::optional<ze_command_queue_workload_type_t>& workload_type,
bool turbo);

private:
Expand Down
42 changes: 21 additions & 21 deletions src/plugins/intel_npu/src/utils/src/zero/zero_wrappers.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -59,16 +59,16 @@ Event::~Event() {
_handle = nullptr;
}

CommandList::CommandList(const std::shared_ptr<ZeroInitStructsHolder>& initStructs,
CommandList::CommandList(const std::shared_ptr<ZeroInitStructsHolder>& init_structs,
const uint32_t& group_ordinal,
bool mtci_is_supported)
: _initStructs(initStructs),
: _init_structs(init_structs),
_log("CommandList", Logger::global().level()) {
ze_mutable_command_list_exp_desc_t mutable_desc = {ZE_STRUCTURE_TYPE_MUTABLE_COMMAND_LIST_EXP_DESC, nullptr, 0};
ze_command_list_desc_t desc = {ZE_STRUCTURE_TYPE_COMMAND_LIST_DESC, &mutable_desc, group_ordinal, 0};
THROW_ON_FAIL_FOR_LEVELZERO(
"zeCommandListCreate",
zeCommandListCreate(_initStructs->getContext(), _initStructs->getDevice(), &desc, &_handle));
zeCommandListCreate(_init_structs->getContext(), _init_structs->getDevice(), &desc, &_handle));

if (mtci_is_supported) {
ze_mutable_command_id_exp_desc_t mutableCmdIdDesc = {ZE_STRUCTURE_TYPE_MUTABLE_COMMAND_ID_EXP_DESC,
Expand All @@ -87,14 +87,14 @@ void CommandList::appendMemoryCopy(void* dst, const void* src, const std::size_t
}
void CommandList::appendGraphInitialize(const ze_graph_handle_t& graph_handle) const {
ze_result_t result =
_initStructs->getGraphDdiTable().pfnAppendGraphInitialize(_handle, graph_handle, nullptr, 0, nullptr);
THROW_ON_FAIL_FOR_LEVELZERO_EXT("pfnAppendGraphInitialize", result, _initStructs->getGraphDdiTable());
_init_structs->getGraphDdiTable().pfnAppendGraphInitialize(_handle, graph_handle, nullptr, 0, nullptr);
THROW_ON_FAIL_FOR_LEVELZERO_EXT("pfnAppendGraphInitialize", result, _init_structs->getGraphDdiTable());
}
void CommandList::appendGraphExecute(const ze_graph_handle_t& graph_handle,
const ze_graph_profiling_query_handle_t& profiling_query_handle) const {
ze_result_t result = _initStructs->getGraphDdiTable()
ze_result_t result = _init_structs->getGraphDdiTable()
.pfnAppendGraphExecute(_handle, graph_handle, profiling_query_handle, nullptr, 0, nullptr);
THROW_ON_FAIL_FOR_LEVELZERO_EXT("pfnAppendGraphExecute", result, _initStructs->getGraphDdiTable());
THROW_ON_FAIL_FOR_LEVELZERO_EXT("pfnAppendGraphExecute", result, _init_structs->getGraphDdiTable());
}
void CommandList::appendNpuTimestamp(uint64_t* timestamp_buff) const {
THROW_ON_FAIL_FOR_LEVELZERO("zeCommandListAppendWriteGlobalTimestamp",
Expand All @@ -116,9 +116,9 @@ CommandList::~CommandList() {
}
void CommandList::updateMutableCommandList(uint32_t arg_index, const void* arg_value) const {
ze_mutable_graph_argument_exp_desc_t desc = {
(ZE_MAJOR_VERSION(_initStructs->getZeDrvApiVersion()) > 1 ||
(ZE_MAJOR_VERSION(_initStructs->getZeDrvApiVersion()) == 1 &&
ZE_MINOR_VERSION(_initStructs->getZeDrvApiVersion()) >= 11))
(ZE_MAJOR_VERSION(_init_structs->getZeDrvApiVersion()) > 1 ||
(ZE_MAJOR_VERSION(_init_structs->getZeDrvApiVersion()) == 1 &&
ZE_MINOR_VERSION(_init_structs->getZeDrvApiVersion()) >= 11))
? ZE_STRUCTURE_TYPE_MUTABLE_GRAPH_ARGUMENT_EXP_DESC
: static_cast<ze_structure_type_t>(ZE_STRUCTURE_TYPE_MUTABLE_GRAPH_ARGUMENT_EXP_DESC_DEPRECATED),
nullptr,
Expand Down Expand Up @@ -207,45 +207,45 @@ CommandQueueFactory::CommandQueueFactory() : _log("CommandQueue", Logger::global
const std::shared_ptr<CommandQueue>& CommandQueueFactory::getCommandQueue(
const std::shared_ptr<ZeroInitStructsHolder>& init_structs,
const ze_command_queue_priority_t& priority,
const std::optional<ze_command_queue_workload_type_t>& workloadType,
const std::optional<ze_command_queue_workload_type_t>& workload_type,
const uint32_t& group_ordinal,
bool turbo) {
if (_gloabal_command_queues[zeroUtils::toPriorityEnum(priority)][zeroUtils::toTurboEnum(turbo)]
[zeroUtils::toWorkloadEnum(workloadType)] == nullptr) {
[zeroUtils::toWorkloadEnum(workload_type)] == nullptr) {
_log.debug("Create new command queue");
_gloabal_command_queues[zeroUtils::toPriorityEnum(priority)][zeroUtils::toTurboEnum(turbo)]
[zeroUtils::toWorkloadEnum(workloadType)] =
[zeroUtils::toWorkloadEnum(workload_type)] =
std::make_shared<CommandQueue>(init_structs, priority, group_ordinal, turbo);

if (zeroUtils::toWorkloadEnum(workloadType) != workload::NOT_SET) {
if (zeroUtils::toWorkloadEnum(workload_type) != workload::NOT_SET) {
try {
_log.debug("Set workload type");
_gloabal_command_queues[zeroUtils::toPriorityEnum(priority)][zeroUtils::toTurboEnum(turbo)]
[zeroUtils::toWorkloadEnum(workloadType)]
->setWorkloadType(*workloadType);
[zeroUtils::toWorkloadEnum(workload_type)]
->setWorkloadType(*workload_type);
} catch (const std::exception& ex) {
_log.debug("Destroy pipeline if workload type is not supported!");
_gloabal_command_queues[zeroUtils::toPriorityEnum(priority)][zeroUtils::toTurboEnum(turbo)]
[zeroUtils::toWorkloadEnum(workloadType)]
[zeroUtils::toWorkloadEnum(workload_type)]
.reset();
OPENVINO_THROW(ex.what());
}
}
}

return _gloabal_command_queues[zeroUtils::toPriorityEnum(priority)][zeroUtils::toTurboEnum(turbo)]
[zeroUtils::toWorkloadEnum(workloadType)];
[zeroUtils::toWorkloadEnum(workload_type)];
}
void CommandQueueFactory::freeCommandQueue(const ze_command_queue_priority_t& priority,
const std::optional<ze_command_queue_workload_type_t>& workloadType,
const std::optional<ze_command_queue_workload_type_t>& workload_type,
bool turbo) {
if (_gloabal_command_queues[zeroUtils::toPriorityEnum(priority)][zeroUtils::toTurboEnum(turbo)]
[zeroUtils::toWorkloadEnum(workloadType)]
[zeroUtils::toWorkloadEnum(workload_type)]
.use_count() == 1) {
_log.debug("Destroy command queue");

_gloabal_command_queues[zeroUtils::toPriorityEnum(priority)][zeroUtils::toTurboEnum(turbo)]
[zeroUtils::toWorkloadEnum(workloadType)]
[zeroUtils::toWorkloadEnum(workload_type)]
.reset();
}
}
Expand Down

0 comments on commit 21a6985

Please sign in to comment.