A dispatch of a kernel that writes no memory records nothing
The translator states on a pipeline's interface whether some stage writes memory another invocation or a later command can read (PipelineInterface::writes_memory, the union of the stages' StageInterface::writes_memory: a store to a buffer or through a device address, a texture write or an atomic update, in the entry or any function it calls; the ExecutionStatus words are the product's and do not count). The cache's artifact format and semantics versions move with the new field. rt reads it into the compute state's interface. A dispatch of a kernel without it, direct or indirect, is checked as Metal checks it and then records nothing: no bind, no push, no vkCmdDispatch, and the indirect buffer is not kept or read. Metrics gains dispatches_without_effects, which counts them. Such a kernel has no effect a program can observe, so the only difference is less GPU and encode time than Metal's. Tests: the translator's a_compute_pipeline_states_whether_its_kernel_writes_memory (a kernel that returns at once, one that only reads, one that writes only its own thread's array: no; a store behind a branch, a noinline callee's store: yes, on the function and the linked pipeline, each validated), and rt's every_device_records_nothing_for_a_dispatch_of_a_kernel_without_effects (a direct, an indirect and an unbound dispatch of a kernel the interface says writes nothing leave the buffer unchanged and count three).
This commit is contained in:
1 parent
be3426c673
commit
f1c73d60bc
13 files changed
+175
-5
No files matched your search
@@ -1675,6 +1675,10 @@ for dependency in &pipeline.dependencies {
|
||||
records they reach: the indirect-command operations they may call, and the primitive types
|
||||
their draws may pass (a draw's constant type, or all five where it is not a constant). A clear
|
||||
bit is proven.
|
||||
- `interface.writes_memory` says, provably, whether a pipeline's functions write memory another
|
||||
invocation or a later command can read: a store to a buffer or through a device address, a
|
||||
texture write, or an atomic update. A compute pipeline without it has no effect a program can
|
||||
observe, so a runtime may run nothing for its dispatches.
|
||||
- `interface.reads_unbound_resources` and `interface.writes_unbound_resources` say, provably,
|
||||
whether a pipeline's functions may read or write a resource through anything but their bound
|
||||
slots: through a pointer or texture they load from memory or make from an integer (an argument
|
||||
|
||||
Reference in new issue
Block a user