-
Notifications
You must be signed in to change notification settings - Fork 29
Open
Description
The current spec provides the following flags when creating a command list:
ZE_COMMAND_LIST_FLAG_RELAXED_ORDERING
: commands in the list may be reordered within certain limits by the driver before executing.ZE_COMMAND_LIST_FLAG_IN_ORDER
: commands in the list must be executed in the given order.
Interestingly, while the spec points out that it is not allowed to set both flags on the same list, it does allow to set neither of the flags. I don't think a command list with none of the two flags set is explicitly named anywhere in the spec, so I'll just call it a "default command list" here.
Let's say I'm working with a device that has one compute engine and one copy engine, exposed via one command queue group of type COMPUTE | COPY
. So internally, this device is able to execute a copy command in parallel to a compute command.
Let's assume I have the following code (where E
is an event):
cmdList.appendMemoryCopy(..., signal=None, wait=[]) // Command A
cmdList.appendLaunchKernel(..., signal=E, wait=[]) // Command B
cmdList.appendLaunchKernel(..., signal=None, wait=[E]) // Command C
cmdList.appendMemoryCopy(..., signal=None, wait=[]) // Command D
cmdQueue.executeCommandLists([cmdList])
Are the following statements true?
- If
cmdList
was created withZE_COMMAND_LIST_FLAG_IN_ORDER
:- The only allowed execution order is
A, B, C, D
. - Each command must finish execution before the next one starts execution.
- The only allowed execution order is
- If
cmdList
was created withZE_COMMAND_LIST_FLAG_RELAXED_ORDERING
:- The only restriction is that
B
must finish beforeC
starts execution, all other orderings are legal. - Legal execution:
D, A, B, C
. - Legal execution:
D, B, C, A
. - Some commands may also execute in parallel but there is no guarantee that they do, e.g.,
A
may execute in parallel toB
. And ifB
takes some time butA
is quick is quick to finish, bothA
andD
may execute in parallel toB
.
- The only restriction is that
- If
cmdList
was created with neither of the flags (a "default command list"):- The order in which commands start execution is always
A, B, C, D
, but some commands may execute in parallel. - Legal execution:
A
executes in parallel toB
, thenC
executes onceB
finishes, thenD
executes in parallel toC
. - Illegal execution:
D, A, B, C
- Illegal execution:
B, C, D, A
- The order in which commands start execution is always
Metadata
Metadata
Assignees
Labels
No labels