Allow a dispatch to dispatch
@r-potter ci sta già lavorando.
Dal 21/10/2026.
Valutazione
- Difficoltà
- 5/5
- Tempo stimato
- Più di una settimana
- Idoneità per principianti
- 25/100
- Tipo di issue
- Funzionalità
- Chiarezza
- Abbastanza chiara
- Stato di attività
- Attiva
- Stack tecnologico
- javascript
- Ambito
- api
Direzione di ricerca
Start by reading the Vulkan specification’s task and mesh shader sections and the linked VK_EXT_device_generated_commands proposal to understand the existing dispatch model and constraints. The issue proposes new compute shader dispatch functionality but leaves key design choices open, including per-workgroup versus per-invocation emission and how dispatches are identified. Done would require a settled API and shader semantics that address those choices and the stated GPU-driven rendering use cases.
Scritto dal modello di indicizzazione a partire dal testo della issue.
Descrizione
I would like to see a compute shader (or maybe then a new shader type) to dispatch other compute shaders. Mesh shaders seem to be evidence that this feature could be supported on compatible devices as this is what a task -> mesh shader does. This would then be an even better version of #2496 (but maybe only able to be supported on mesh shader capable devices).
VK_EXT_device_generated_commands is not a good alternative, as not all mesh shader capable devices support DGC (and maybe non-mesh shader capable devices could support it too), DGC requires a preprocessing buffer, a lot of setup, and has overhead which task -> mesh shaders do not seem to have (or at least not as bad). And also, just as #2496 mentioned, DGC can result in very bad performance in some cases. Also, the preprocess buffer is only valid if everything stays the same after preprocessing, that includes amount of dispatches and even the push constant values. This can make preprocessing reuse impractical for workloads where the generated dispatch count or relevant inputs change every frame, which is most GPU-driven rendering techniques: VUID-vkCmdExecuteGeneratedCommandsEXT-isPreprocessed-11046
The VK_EXT_device_generated_commands proposal actually mentions functionality (somewhat) in line with this feature:
Support for Multi-dispatch (needs something like gl_drawID for compute shaders).
For this, the second dispatch (in the task -> mesh pipeline, the mesh shader equivalent for this feature) not being able to change pipeline or push constant is not needed. Just like with task shaders, some shared memory can be given to the second dispatches. The same payload semantics as task shaders would then count, so the payload is shared in a workgroup, and all the dispatches that workgroup launches.
For distinguishing between dispatches there are 2 ways (and maybe both could be supported):
- have the same as task shaders: 1 dispatch emit per workgroup, although this could be sub-optimal for some cases.
- When you have a workgroup that sets up data. then over that data the second dispatch is done (similar to task -> mesh) then it is optimal,
- but if the second dispatch is more of: see how many elements to dispatch over, then emit, it needing an entire workgroup would be not ideal (although still a lot better than hundreds of empty
vkCmdDispatchIndirects from the CPU)
- 1 dispatch per invocation, not workgroup, although since this is different to task shaders, this may not be widely supported
For distinguishing between dispatches coming from the same "task" shader workgroup, if 1 emit per invocation would be supported: a "task" shader-local gl_DispatchID could be available, where the global index could be computed from the shared memory, or the emit call for the second dispatch could have an uint parameter which the second dispatch could access like gl_DispatchParameterNameEXT, or maybe gl_DispatchID could contain the gl_GlobalInvocationID.x of the "task" shader that emitted it, as every invocation can only emit 1 dispatch task.
If it stays at 1 emit per workgroup, then the shared memory is already enough to distinguish the different dispatch tasks.
This prevents a lot of empty vkCmdDispatchIndirects. An example use case where this could be very useful is rendering of strand-based hair like in frostbite/Indiana Jones and the Great Circle. A lot of indirect dispatches per hair instance/model is needed, which means lots of empty dispatches when it is not on screen or culled.
This also prevents all the memory needed for the indirect parameters.
This would have real world use, for example, I have seen a AAA game that has ~500 empty vkCmdDispatchIndirects in a row, all using the same descriptor sets, no pipeline barrier in between and only a single incrementing index change in the push constants. All these ~500 dispatches could have been 1 dispatch, which gives the index to the second dispatch, but since the situation has all of them empty, in the end no second dispatch would be made, instead of ~500 empty ones.
So as a compute shader only has a single shader stage parameter, maybe an extending struct that contains the second dispatch shader. As an entirely new pipeline type seems like a lot to add. And dynamically setting the pipeline as the second dispatch may cause the feature to have less supported devices, or miss a lot of optimizations.
An example of how emitting would work, similarly to task shaders:
EmitDispatchTasksEXT(x, y, z);
or maybe a base version too:
EmitDispatchBaseTasksEXT(x_base, y_base, z_base, x, y, z);
or for the extra parameter version with something like gl_DispatchParameterNameEXT is used (with 1 dispatch task per invocation):
EmitDispatchTasksEXT(x, y, z, uint_parameter_here);
EmitDispatchBaseTasksEXT(x_base, y_base, z_base, x, y, z, uint_parameter_here);
- Lingua principale
- JavaScript
- Stelle
- 3.4k
- Fork
- 555
- Merge medio
- 3g 10h
- PR unite (30g)
- 5
Preparare l'ambiente
- Nessun Dockerfile né file Docker Compose
- Nessun modello di pull request
- Leggi la guida per i contributori
Come iniziare
- Leggi tutta la issue e poi la guida ai contributi del progetto.
- Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
- Fai un fork del repository e lavora su un branch.
- Apri una pull request che faccia riferimento al numero della issue.
Altre issue di KhronosGroup/Vulkan-Docs
-
Difficoltà 1/5 Meno di un'ora Idoneità per principianti 88/100
KhronosGroup/Vulkan-Docs#2823 ·
-
Difficoltà 4/5 3-5 giorni Idoneità per principianti 44/100
KhronosGroup/Vulkan-Docs#2863 ·
-
Difficoltà 4/5 3-5 giorni Idoneità per principianti 30/100
KhronosGroup/Vulkan-Docs#2861 ·
-
Difficoltà 3/5 1-2 giorni Idoneità per principianti 45/100
KhronosGroup/Vulkan-Docs#2860 · 1 commento ·
-
VUID-vkCmdBindResourceHeapEXT-pBindInfo-12558Forse già presa @spencer-lunarg l’ha presa 2 giorni fa. Aperta
Difficoltà 5/5 Più di una settimana Idoneità per principianti 12/100
KhronosGroup/Vulkan-Docs#2857 · 4 commenti · 1 assegnatario ·
Tutte le issue di KhronosGroup/Vulkan-Docs
Issue simili
-
[ordering-review] workshop order graph: 1 confirmed ordering issue, cycles are false positivesAperta
Difficoltà 2/5 1-3 ore Idoneità per principianti 72/100
githubnext/gh-aw-workshop#6247 ·
I maintainer di solito rispondono entro 1 giorno
-
good first issue type/ci
Difficoltà 2/5 1-3 ore Idoneità per principianti 81/100
c-w-z/commit-decision-record#20 ·
I maintainer di solito rispondono entro 1 giorno
-
Add: China en Vivo (CN)Apertachannels:add check:passed
Difficoltà 2/5 1-3 ore Idoneità per principianti 62/100
I maintainer di solito rispondono entro 1 giorno
-
Difficoltà 1/5 Meno di un'ora Idoneità per principianti 88/100
web-platform-tests/wpt#65844 ·
I maintainer di solito rispondono entro 1 giorno
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 72/100
JuliusBrussee/caveman#1606 ·
I maintainer di solito rispondono entro 1 giorno