Commit 2e33e33
Ewan Crawford
Redefine command-buffer simultaneous-use (KhronosGroup#1411)
* 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.
* Address editorial PR feedback
* Address QC editoral feedback
* Move simultaneous-use optional feature to mutable-dispatch
* Don't use phrase "simultaneous use usage"1 parent be29384 commit 2e33e33
6 files changed
Lines changed: 88 additions & 82 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
3 | 3 | | |
4 | 4 | | |
5 | 5 | | |
6 | | - | |
7 | | - | |
8 | 6 | | |
9 | 7 | | |
10 | 8 | | |
11 | 9 | | |
12 | 10 | | |
13 | 11 | | |
14 | 12 | | |
15 | | - | |
| 13 | + | |
16 | 14 | | |
17 | 15 | | |
18 | 16 | | |
| |||
124 | 122 | | |
125 | 123 | | |
126 | 124 | | |
127 | | - | |
128 | | - | |
129 | | - | |
130 | | - | |
131 | | - | |
132 | | - | |
133 | | - | |
134 | | - | |
135 | 125 | | |
136 | 126 | | |
137 | 127 | | |
| |||
242 | 232 | | |
243 | 233 | | |
244 | 234 | | |
245 | | - | |
246 | 235 | | |
247 | 236 | | |
248 | | - | |
249 | | - | |
250 | 237 | | |
251 | 238 | | |
252 | 239 | | |
| |||
257 | 244 | | |
258 | 245 | | |
259 | 246 | | |
260 | | - | |
261 | 247 | | |
262 | 248 | | |
263 | 249 | | |
| |||
470 | 456 | | |
471 | 457 | | |
472 | 458 | | |
| 459 | + | |
| 460 | + | |
| 461 | + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
6 | 6 | | |
7 | 7 | | |
8 | 8 | | |
9 | | - | |
| 9 | + | |
10 | 10 | | |
11 | 11 | | |
12 | 12 | | |
| |||
41 | 41 | | |
42 | 42 | | |
43 | 43 | | |
| 44 | + | |
| 45 | + | |
| 46 | + | |
| 47 | + | |
| 48 | + | |
| 49 | + | |
| 50 | + | |
| 51 | + | |
| 52 | + | |
44 | 53 | | |
45 | 54 | | |
46 | 55 | | |
| |||
72 | 81 | | |
73 | 82 | | |
74 | 83 | | |
| 84 | + | |
| 85 | + | |
75 | 86 | | |
76 | 87 | | |
77 | 88 | | |
| |||
95 | 106 | | |
96 | 107 | | |
97 | 108 | | |
| 109 | + | |
98 | 110 | | |
99 | 111 | | |
100 | 112 | | |
| |||
363 | 375 | | |
364 | 376 | | |
365 | 377 | | |
| 378 | + | |
| 379 | + | |
| 380 | + | |
| 381 | + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1790 | 1790 | | |
1791 | 1791 | | |
1792 | 1792 | | |
| 1793 | + | |
1793 | 1794 | | |
1794 | | - | |
1795 | | - | |
| 1795 | + | |
| 1796 | + | |
1796 | 1797 | | |
1797 | 1798 | | |
| 1799 | + | |
1798 | 1800 | | |
1799 | 1801 | | |
1800 | 1802 | | |
| |||
| 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 | + | |
| 14712 | + | |
| 14713 | + | |
| 14714 | + | |
| 14715 | + | |
| 14716 | + | |
| 14717 | + | |
| 14718 | + | |
| 14719 | + | |
14693 | 14720 | | |
14694 | 14721 | | |
14695 | 14722 | | |
| |||
14733 | 14760 | | |
14734 | 14761 | | |
14735 | 14762 | | |
14736 | | - | |
| 14763 | + | |
| 14764 | + | |
| 14765 | + | |
14737 | 14766 | | |
14738 | 14767 | | |
14739 | 14768 | | |
| |||
14743 | 14772 | | |
14744 | 14773 | | |
14745 | 14774 | | |
14746 | | - | |
14747 | | - | |
14748 | | - | |
14749 | | - | |
14750 | | - | |
14751 | 14775 | | |
14752 | 14776 | | |
14753 | 14777 | | |
| |||
14757 | 14781 | | |
14758 | 14782 | | |
14759 | 14783 | | |
14760 | | - | |
14761 | | - | |
14762 | 14784 | | |
14763 | 14785 | | |
14764 | 14786 | | |
14765 | 14787 | | |
14766 | | - | |
14767 | | - | |
14768 | | - | |
14769 | | - | |
14770 | | - | |
14771 | | - | |
14772 | | - | |
14773 | | - | |
14774 | | - | |
14775 | 14788 | | |
14776 | 14789 | | |
14777 | 14790 | | |
| |||
14812 | 14825 | | |
14813 | 14826 | | |
14814 | 14827 | | |
| 14828 | + | |
14815 | 14829 | | |
14816 | | - | |
14817 | | - | |
14818 | | - | |
| 14830 | + | |
| 14831 | + | |
| 14832 | + | |
14819 | 14833 | | |
14820 | 14834 | | |
14821 | 14835 | | |
| 14836 | + | |
14822 | 14837 | | |
14823 | 14838 | | |
14824 | 14839 | | |
| |||
14898 | 14913 | | |
14899 | 14914 | | |
14900 | 14915 | | |
14901 | | - | |
14902 | | - | |
14903 | | - | |
14904 | | - | |
14905 | | - | |
14906 | | - | |
14907 | | - | |
14908 | | - | |
14909 | | - | |
14910 | | - | |
14911 | 14916 | | |
14912 | 14917 | | |
14913 | 14918 | | |
| |||
15089 | 15094 | | |
15090 | 15095 | | |
15091 | 15096 | | |
15092 | | - | |
15093 | | - | |
15094 | | - | |
15095 | 15097 | | |
15096 | 15098 | | |
15097 | 15099 | | |
| |||
15125 | 15127 | | |
15126 | 15128 | | |
15127 | 15129 | | |
| 15130 | + | |
| 15131 | + | |
| 15132 | + | |
| 15133 | + | |
| 15134 | + | |
| 15135 | + | |
| 15136 | + | |
| 15137 | + | |
| 15138 | + | |
| 15139 | + | |
| 15140 | + | |
15128 | 15141 | | |
15129 | 15142 | | |
15130 | 15143 | | |
| |||
16553 | 16566 | | |
16554 | 16567 | | |
16555 | 16568 | | |
16556 | | - | |
16557 | | - | |
16558 | | - | |
| 16569 | + | |
16559 | 16570 | | |
16560 | 16571 | | |
16561 | 16572 | | |
| |||
16682 | 16693 | | |
16683 | 16694 | | |
16684 | 16695 | | |
16685 | | - | |
16686 | | - | |
16687 | | - | |
16688 | | - | |
16689 | 16696 | | |
16690 | 16697 | | |
16691 | 16698 | | |
| |||
16903 | 16910 | | |
16904 | 16911 | | |
16905 | 16912 | | |
16906 | | - | |
16907 | | - | |
16908 | | - | |
| 16913 | + | |
16909 | 16914 | | |
16910 | 16915 | | |
16911 | 16916 | | |
16912 | | - | |
16913 | | - | |
16914 | | - | |
16915 | | - | |
16916 | | - | |
16917 | | - | |
16918 | 16917 | | |
16919 | 16918 | | |
16920 | 16919 | | |
| |||
Loading
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1371 | 1371 | | |
1372 | 1372 | | |
1373 | 1373 | | |
1374 | | - | |
1375 | 1374 | | |
1376 | 1375 | | |
1377 | 1376 | | |
| |||
7366 | 7365 | | |
7367 | 7366 | | |
7368 | 7367 | | |
7369 | | - | |
| 7368 | + | |
7370 | 7369 | | |
7371 | 7370 | | |
7372 | 7371 | | |
| |||
7389 | 7388 | | |
7390 | 7389 | | |
7391 | 7390 | | |
7392 | | - | |
7393 | 7391 | | |
7394 | 7392 | | |
7395 | 7393 | | |
7396 | 7394 | | |
7397 | | - | |
7398 | | - | |
7399 | | - | |
7400 | 7395 | | |
7401 | 7396 | | |
7402 | 7397 | | |
| |||
7413 | 7408 | | |
7414 | 7409 | | |
7415 | 7410 | | |
7416 | | - | |
7417 | 7411 | | |
7418 | 7412 | | |
7419 | 7413 | | |
| |||
7513 | 7507 | | |
7514 | 7508 | | |
7515 | 7509 | | |
7516 | | - | |
| 7510 | + | |
7517 | 7511 | | |
7518 | 7512 | | |
7519 | 7513 | | |
| |||
7527 | 7521 | | |
7528 | 7522 | | |
7529 | 7523 | | |
| 7524 | + | |
7530 | 7525 | | |
7531 | 7526 | | |
| 7527 | + | |
| 7528 | + | |
| 7529 | + | |
| 7530 | + | |
| 7531 | + | |
7532 | 7532 | | |
7533 | 7533 | | |
7534 | 7534 | | |
| |||
0 commit comments