RUNTIME 2336: Lay no more of a predicated loop's copies than keep its waiting host steps within 16
On RADV, runtime_lane::predication::every_dispatch_form_runs_in_each_pass_past_the_copies ran 40-77 s alone and passed its 60 s wait for one command buffer under the suite. The cost is the runtime's, not the test's breadth: each piece of work a host step records after the GPU's work before it (an indirect dispatch of a kernel that observes its partition, an indirect command buffer's execution inside a block) is its own batch, a round trip to the host (submit, wait for the GPU, record, submit) in every run of a loop's laying, whether its copy's pass runs or skips. A loop was laid down as 64 copies (16 inside another), bounded only by its commands (LAID_BUDGET), so the test's inner DoWhile of 20 + 1 passes inside a DoWhile of two laid 1024 copies of its body: measured on lavapipe at the base (msi job m3-max-31287, a timing probe), its command buffer's first run recorded 4097 host steps and made 8195 submissions (6145 and 12291 on the device without device addresses, whose step form records six such pieces a pass), where its 21 passes ran 84 (126); the DoWhile of 100 passes 257 (385). That command buffer was 94% of the test's 21,772 submissions, and each costs a GPU round trip, a few milliseconds on RADV. copies_of now bounds a loop's copies by a second budget too: the work apart whose host step waits for the GPU (Deferred::gpu_written) that its copies lay down, at most WAITED_BUDGET (16), counted as LAID_BUDGET counts commands, from the first copy's, inner loops' copies included (Predication::waited, Looping::waited_at). A loop of no such work keeps its 64 or 16 copies. A loop that ends before its copies pays at most 16 round trips for the copies it skips, and one that runs past them one more round trip, its check, per 16. The run-again path, unchanged, takes any count of copies down to one. Tests: every_dispatch_form_runs_in_each_pass and the failing test assert each loop's first run records at most 16 host steps and the check (257 and 4097 at the base: the negative control); the 100 passes no longer run again exactly once. docs/API.md and docs/RUNTIME-PORTING.md name the new bound. With abd0662e9f: the budget trades nothing for accuracy, so it has no FAST-PATHS row.
This commit is contained in:
1 parent
e9a9a53e55
commit
7b1725eb34
5 files changed
+65
-26
No files matched your search
+5
-3
@@ -5389,9 +5389,11 @@ each item named states the rule in full.
|
||||
its live blocks left open where a unit ends failing the command buffer as Metal's GPU recovery
|
||||
does (`PredicationOpenAtUnitEnd`). Loops nest to any depth and run as many passes as Metal's.
|
||||
A loop is laid down as 64 copies (16 inside another loop, fewer where they would lay down more
|
||||
than 16384 steps and gated dispatches, and at least one); where it runs past them, a check
|
||||
submits its copies again, from where it stopped, until it ends, each time a round trip to the
|
||||
host, holding the batches after it on its queue (and those on other queues that use what the
|
||||
than 16384 steps and gated dispatches, or more than 16 pieces of work a host step records after
|
||||
the GPU's work before it, an indirect dispatch's or an execution's, each a round trip to the
|
||||
host in every run whether its pass runs or not, and at least one); where it runs past them, a
|
||||
check submits its copies again, from where it stopped, until it ends, each time a round trip to
|
||||
the host, holding the batches after it on its queue (and those on other queues that use what the
|
||||
loop uses), and nothing encoded before the loop runs again. A loop without bound runs on, as
|
||||
Metal's does, after the program let go of its queue and device too, until the process ends or
|
||||
the device is lost. A loop running again stops, as Metal's does, at the GPU's recovery from a
|
||||
|
||||
Reference in new issue
Block a user