Commit b61190b
Ewan Crawford
Redefine command-buffer simultaneous-use
As discussed in KhronosGroup#891
the current definition of [simultaneous
use](https://registry.khronos.org/OpenCL/specs/3.0-unified/html/OpenCL_API.html#_command_buffers)
is hard for users to reason about.
Instead a better model is one simultaneous-use isn't a contraint of the
command-buffer submission, but it's execution. That is simultaneous-use
occurs when a command-buffer is enqueued for execution while any
previous submission of the command-buffer is still in-flight, and there
any no scheduling dependencies expressed to serialize execution.
This means that pipelined submissions of a command-buffer, where there
is an in-order queue, barrier, or cl_events to serialize execution, is
always valid usage without this optional simultaneous-use device
feature.
To avoid the runtime having to incur overheads from monitoring when
simultaneous-use occurs so it can throw an error, violating this
valid usage for non simultaneous-use command-buffers is UB.
Following from this related to KhronosGroup#1311
the pending state has also been removed from the command-buffer
lifecycle, and there is only the binary states of recording and
executable. This is because a user can use the existing OpenCL
mechanisms of host waits and event queries to inspect the state
of individual command-buffer enqueues to avoid simultaneous-use,
and having this stored as a command-buffer state incurs the runtime
overhead of tracking a previous submissions. The pending count
concept also now makes less sense.
The implications for updating a command-buffer is that the error
behavior is removed from update, so simultaneous-use is a property of
execution rather than enqueue. See CTS test ideas for how this could
work.
I think the CTS changes that are required for this as follows, but I could
create a separate CTS issue to track work once/if this PR merge. Or we
could try prototype the CTS changes to give confidence in the spec
change.
* Remove test for pending state query
* Either rework existing simulataneous use tests so that it tests the new definition,
or delete them and create new more suitable tests without tech-debt
from old definition.
* Add tests for pipelined submission of a command-buffer not created
with simultaneous-use. Ideally stressing indriect dependencies as well as direct
ones:
** in-order queue to express depdencies
** out-of-order queue with event dependencies to express depenencies
** barrier to express for dependencies
* Add cl_khr_command_buffer_mutable_dispatch tests for updating and
enqueueing pipelined submissions of a non-simultaneous use command-buffer with depdencies between each
enqueue, and only do a blocking wait at the end.
* Add cl_khr_command_buffer_mutable_dispatch tests for a
simultaneous-use command-buffer, where two invocations are scheduled
such that they can run concurrently, but the second invocation is
updated such that it uses different inputs/outputs to avoid race
conditions in the kernel.1 parent 3d598ab commit b61190b
4 files changed
Lines changed: 54 additions & 66 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
4 | 4 | | |
5 | 5 | | |
6 | 6 | | |
7 | | - | |
| 7 | + | |
8 | 8 | | |
9 | 9 | | |
10 | 10 | | |
11 | 11 | | |
12 | 12 | | |
13 | 13 | | |
14 | 14 | | |
15 | | - | |
| 15 | + | |
16 | 16 | | |
17 | 17 | | |
18 | 18 | | |
| |||
126 | 126 | | |
127 | 127 | | |
128 | 128 | | |
129 | | - | |
130 | | - | |
131 | | - | |
132 | | - | |
133 | | - | |
| 129 | + | |
| 130 | + | |
| 131 | + | |
| 132 | + | |
| 133 | + | |
| 134 | + | |
| 135 | + | |
| 136 | + | |
| 137 | + | |
| 138 | + | |
134 | 139 | | |
135 | 140 | | |
136 | 141 | | |
| |||
257 | 262 | | |
258 | 263 | | |
259 | 264 | | |
260 | | - | |
261 | 265 | | |
262 | 266 | | |
263 | 267 | | |
| |||
470 | 474 | | |
471 | 475 | | |
472 | 476 | | |
| 477 | + | |
| 478 | + | |
| 479 | + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
14618 | 14618 | | |
14619 | 14619 | | |
14620 | 14620 | | |
14621 | | - | |
14622 | | - | |
14623 | | - | |
14624 | | - | |
14625 | | - | |
14626 | | - | |
14627 | | - | |
| 14621 | + | |
| 14622 | + | |
| 14623 | + | |
| 14624 | + | |
| 14625 | + | |
| 14626 | + | |
| 14627 | + | |
| 14628 | + | |
14628 | 14629 | | |
14629 | 14630 | | |
14630 | 14631 | | |
| |||
14690 | 14691 | | |
14691 | 14692 | | |
14692 | 14693 | | |
| 14694 | + | |
| 14695 | + | |
| 14696 | + | |
| 14697 | + | |
| 14698 | + | |
| 14699 | + | |
| 14700 | + | |
| 14701 | + | |
| 14702 | + | |
| 14703 | + | |
| 14704 | + | |
| 14705 | + | |
| 14706 | + | |
| 14707 | + | |
| 14708 | + | |
| 14709 | + | |
| 14710 | + | |
| 14711 | + | |
14693 | 14712 | | |
14694 | 14713 | | |
14695 | 14714 | | |
| |||
14733 | 14752 | | |
14734 | 14753 | | |
14735 | 14754 | | |
14736 | | - | |
| 14755 | + | |
| 14756 | + | |
| 14757 | + | |
14737 | 14758 | | |
14738 | 14759 | | |
14739 | 14760 | | |
| |||
14743 | 14764 | | |
14744 | 14765 | | |
14745 | 14766 | | |
14746 | | - | |
14747 | | - | |
14748 | | - | |
14749 | | - | |
14750 | | - | |
14751 | 14767 | | |
14752 | 14768 | | |
14753 | 14769 | | |
| |||
14757 | 14773 | | |
14758 | 14774 | | |
14759 | 14775 | | |
14760 | | - | |
14761 | | - | |
14762 | 14776 | | |
14763 | 14777 | | |
14764 | 14778 | | |
14765 | 14779 | | |
14766 | | - | |
14767 | | - | |
14768 | | - | |
14769 | | - | |
14770 | | - | |
14771 | | - | |
14772 | | - | |
14773 | | - | |
14774 | | - | |
14775 | 14780 | | |
14776 | 14781 | | |
14777 | 14782 | | |
| |||
14813 | 14818 | | |
14814 | 14819 | | |
14815 | 14820 | | |
14816 | | - | |
14817 | | - | |
14818 | | - | |
| 14821 | + | |
| 14822 | + | |
| 14823 | + | |
14819 | 14824 | | |
14820 | 14825 | | |
14821 | 14826 | | |
| |||
14898 | 14903 | | |
14899 | 14904 | | |
14900 | 14905 | | |
14901 | | - | |
14902 | | - | |
14903 | | - | |
14904 | | - | |
14905 | | - | |
14906 | | - | |
14907 | | - | |
14908 | | - | |
14909 | | - | |
14910 | | - | |
14911 | 14906 | | |
14912 | 14907 | | |
14913 | 14908 | | |
| |||
15089 | 15084 | | |
15090 | 15085 | | |
15091 | 15086 | | |
15092 | | - | |
15093 | | - | |
15094 | | - | |
15095 | 15087 | | |
15096 | 15088 | | |
15097 | 15089 | | |
| |||
15125 | 15117 | | |
15126 | 15118 | | |
15127 | 15119 | | |
| 15120 | + | |
| 15121 | + | |
| 15122 | + | |
| 15123 | + | |
15128 | 15124 | | |
15129 | 15125 | | |
15130 | 15126 | | |
| |||
16553 | 16549 | | |
16554 | 16550 | | |
16555 | 16551 | | |
16556 | | - | |
16557 | | - | |
| 16552 | + | |
16558 | 16553 | | |
16559 | 16554 | | |
16560 | 16555 | | |
| |||
16682 | 16677 | | |
16683 | 16678 | | |
16684 | 16679 | | |
16685 | | - | |
16686 | | - | |
16687 | | - | |
16688 | | - | |
16689 | 16680 | | |
16690 | 16681 | | |
16691 | 16682 | | |
| |||
16903 | 16894 | | |
16904 | 16895 | | |
16905 | 16896 | | |
16906 | | - | |
16907 | | - | |
16908 | | - | |
| 16897 | + | |
16909 | 16898 | | |
16910 | 16899 | | |
16911 | 16900 | | |
16912 | | - | |
16913 | | - | |
16914 | | - | |
16915 | | - | |
16916 | | - | |
16917 | | - | |
16918 | 16901 | | |
16919 | 16902 | | |
16920 | 16903 | | |
| |||
Loading
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1371 | 1371 | | |
1372 | 1372 | | |
1373 | 1373 | | |
1374 | | - | |
1375 | 1374 | | |
1376 | 1375 | | |
1377 | 1376 | | |
| |||
7324 | 7323 | | |
7325 | 7324 | | |
7326 | 7325 | | |
7327 | | - | |
| 7326 | + | |
7328 | 7327 | | |
7329 | 7328 | | |
7330 | 7329 | | |
| |||
7371 | 7370 | | |
7372 | 7371 | | |
7373 | 7372 | | |
7374 | | - | |
7375 | 7373 | | |
7376 | 7374 | | |
7377 | 7375 | | |
| |||
0 commit comments