-
Notifications
You must be signed in to change notification settings - Fork 2.4k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[DO NOT MERGE] [NPU] Using global command queue #28745
base: master
Are you sure you want to change the base?
[DO NOT MERGE] [NPU] Using global command queue #28745
Conversation
Signed-off-by: Bogdan Pereanu <[email protected]>
Signed-off-by: Bogdan Pereanu <[email protected]>
Signed-off-by: Bogdan Pereanu <[email protected]>
Signed-off-by: Bogdan Pereanu <[email protected]>
Signed-off-by: Bogdan Pereanu <[email protected]>
…nd free methods Signed-off-by: Bogdan Pereanu <[email protected]>
Signed-off-by: Bogdan Pereanu <[email protected]>
Signed-off-by: Bogdan Pereanu <[email protected]>
Signed-off-by: Bogdan Pereanu <[email protected]>
Signed-off-by: Bogdan Pereanu <[email protected]>
Signed-off-by: Bogdan Pereanu <[email protected]>
Signed-off-by: Bogdan Pereanu <[email protected]>
Signed-off-by: Bogdan Pereanu <[email protected]>
Signed-off-by: Bogdan Pereanu <[email protected]>
e0df99b
to
6d4ab81
Compare
Signed-off-by: Bogdan Pereanu <[email protected]>
81f15a6
to
acb0b4f
Compare
Signed-off-by: Bogdan Pereanu <[email protected]>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Haven't found any major issue regarding the design nor the code, but please don't rely on my review alone - I don't have much experience with the driver API.
|
||
CommandQueuePool::CommandQueuePool() : _log("CommandQueue", Logger::global().level()) {} | ||
int CommandQueuePool::computeHash(CommandQueueDesc desc) { | ||
return (static_cast<size_t>(desc.priority) & 0xFF) | (static_cast<size_t>(desc.workload) & 0xFF) << 8 | |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Several things to note here:
- Both priority and workload type can take the value of "0x7fffffff" (
ZE_WORKLOAD_TYPE_FORCE_UINT32
) which exceeds the 1 byte range. So we might have an issue if another value > 255 is defined in any of those enums. Perhaps not a problem since this scenario is unlikely, but worth taking into consideration. int
doesn't have a stable byte size and it seems you're using only 3 bytes so maybe we should useuint32_t
.- C++ has a dedicated hash functionality, you may consider overriding its
operator()
instead. Example here, OV also has several in its implementation.
} | ||
std::shared_ptr<CommandQueue> CommandQueuePool::getCommandQueue( | ||
const std::shared_ptr<ZeroInitStructsHolder>& init_structs, | ||
const ze_command_queue_priority_t& priority, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
const ze_command_queue_priority_t& priority, | |
const ze_command_queue_priority_t priority, |
Primitive type, cheaper to pass by value.
const ze_command_queue_workload_type_t& workload_type, | ||
const uint32_t& group_ordinal, | ||
bool turbo) { | ||
CommandQueueDesc desc = {priority, workload_type, turbo}; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Worth asking: are we certain these three are all attributes that should be used for determining command queue sharing? Just making sure, I don't know how to answer that. I see there's also some group_ordinal
(whatever that is) and multiple fields inside init_structs
.
@@ -50,6 +52,34 @@ namespace zeroUtils { | |||
ze_result_to_description(result)); \ | |||
} | |||
|
|||
static inline size_t toPriorityVal(const ze_command_queue_priority_t& val) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Not used? Same about toWorkloadVal
.
} | ||
} | ||
|
||
void PluginGraph::create_new_command_queue() { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Name a bit misleading since we're not always creating a new one depending on whether or not we find one using the same stats in the pool.
if (config.has<TURBO>()) { | ||
turbo = config.get<TURBO>(); | ||
_turbo = config.get<TURBO>(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nit: Will Config::get()
return the default value if no value was explicitly set? If so, you could allow the default value to do its job by not setting _turbo
to false (in the header file) and not checking config.has<TURBO>()
.
@@ -147,9 +180,30 @@ Pipeline::Pipeline(const Config& config, | |||
_logger.debug("Pipeline - initialize completed"); | |||
} | |||
|
|||
void Pipeline::getCommandQueue() { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nit: a bit weird to call a function a "getter" without returning anything.
@@ -206,6 +208,60 @@ TEST_P(OVCompileAndInferRequest, CompiledModelWorkloadTypeUpdateAfterCompilation | |||
} | |||
} | |||
|
|||
TEST_P(OVCompileAndInferRequest, CompiledModelWorkloadTypeUpdateAfterCompilationWithMultipleInfers) { | |||
if (isCommandQueueExtSupported()) { | |||
OV_ASSERT_NO_THROW(execNet = core->compile_model(function, target_device, configuration)); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We should also change execNet
old API naming with the new compiledModel
.
Details:
Tickets: