Keep the predicted plain half arm in a key's general form: a creation makes one pipeline, not two
What: on a device that samples through Metal's own texture unit (MoltenVK), a texture slot a
function converts to `half` declares SpecKey::PlainHalfTexels and SpecKey::UnmeasuredTexels.
The general form (render/residual.rs) zeroed both, so a state's creation made its predicted
key's general form (the class routine's arm, PlainHalfTexels 0) and handed the predicted key
itself (the plain arm, 1, as an unbound slot takes) to the pool right after. Every draw of a
plain class takes the predicted key, so the general form served a draw only while the
predicted key was still being made; the conformance cases render-then-sample-magnified-nearest
and -linear made it and no draw took it (cost.rs named it an open bug). PlainHalfTexels is no
longer a constant of the general form: a key keeps the plain arm its binding gives it. The
predicted key is now its own general form, and the creation makes that one pipeline.
What still takes a general form: a draw binding a class whose `half` conversion is not
measured (BC4 to BC7, the linear ASTC formats) keys UnmeasuredTexels 1, which no instruction
reads; its general form is the predicted key, made at creation, so it draws at once and runs
its own key's instructions while its own is made on the pool, as before. A draw binding a
YCbCr field on the grid 8192 (PlainHalfTexels 0) makes its own key at its draw, as any key the
creation did not predict; on a device whose memory is the host's such a slot reads its planes
in place in a variant of its own (VariantKey::ycbcr_in_place), which no creation predicts
either.
Tests: tests::general_form now expects the plain arm kept ([1,1,1,5,3] -> [0,1,0,5,3], an
unmeasured plain class's key -> the predicted key, a YCbCr class keeps the routine's arm); the
made_at_creation lane expects one making at creation on every device (it expected two on
Metal-sampler devices) and the unmeasured-class draw to take the predicted key as its general
form; ycbcr_textures' and runtime_lane's comments follow. Docs: residual.rs, predicted.rs,
WorkCounts::residual_form_draws, API.md's general-form bullet, and cost.rs's open-bug
paragraph (the recordings read 3 made until the rows' next measurement; WASTED_BY_CLASS's
draws ceiling can then drop by 2).
Verified on the M3 Max (MoltenVK 1.4.2), the same diff at 3e0db77c6f over 6f7bb169d2:
- conformance cost --runs 8 --show, each case, in order and alone (jobs m3-max-13511,
13518): render-then-sample-magnified-nearest and -linear read creation_pipelines_made 2,
creation_render_pipelines_made 2, variant_pipelines_made 2 (the record holds 3 of each),
creation_pipelines_drawn 2 (the record's 2): the pipeline no draw took is gone, every
pipeline made is drawn.
- conformance replay, the whole set (70 s): exit 0, "the 391 row(s) above are exactly the
open gaps known-gaps.tsv expects on this venue": no case's answers moved.
- 77 touched tests under --cfg m2v_gpu passed: made_at_creation, ycbcr_textures' creation-made
slot, pipeline_creation's pool draws, draw_work, general_form, uniform_bind_offsets,
draw_again, draw_shape_notices.
(cherry picked from commit 56ddedfc3498c9376384a3ad4b57e7607d78594a)
This commit is contained in:
1 parent
78bc51ad11
commit
6be4be9791
10 files changed
+124
-127
No files matched your search
+22
-23
@@ -4310,29 +4310,28 @@ each item named states the rule in full.
|
||||
form the pipeline takes, and the residual is 0 wherever the range starts at the bind offset. A
|
||||
slot bound to nothing is read at its residual too (0), so a draw that leaves such slots unbound
|
||||
takes the creation's pipeline itself. On MoltenVK a texture slot a function converts to `half`
|
||||
converts its texels by the class routine (`PlainHalfTexels` 0, the bound class read from push
|
||||
data), which rounds a plain class's `float` texel to nearest even as the plain arm does (the arm
|
||||
Metal's compiler can fold into the image instruction, which a slot bound to nothing or to a plain
|
||||
class takes: every class but a YCbCr field on the grid 8192), and its `UnmeasuredTexels`, which
|
||||
no instruction reads, is at 0 (a class whose `half` conversion is not measured, BC4 to BC7 and
|
||||
the linear ASTC formats among them, takes 1). Where the predicted key is not its own general form
|
||||
(a slot of the plain arm), the creation hands it to the pool right after, behind the makings
|
||||
something waits for, and a draw binding a plain, measured class takes it once made. A draw whose
|
||||
own pipeline (which reads such a buffer slot at the bind offset alone, converts by the plain arm,
|
||||
or names an unmeasured class) is not made, and whose key's general form's is, draws with that one
|
||||
at once; its own is made on the pool behind the makings something waits for, and later draws
|
||||
take it. So a draw binding a texture of an unmeasured class waits for no compile of its own.
|
||||
Only GPU time moves for the draws before it lands (`WorkCounts::residual_form_draws`,
|
||||
`residual_form_makings`): on ANV the residual form's reads are loads where the other form's are
|
||||
pushed constants; on MoltenVK the class routine converts each `half` read in place of the image
|
||||
instruction's own conversion. The creation of a state
|
||||
whose predicted key is not its general form makes two pipelines, the second on the pool, nothing
|
||||
waiting for it. On MoltenVK every key reads its buffer slots at their residual (the two forms
|
||||
measured alike there), so a draw's bind offsets choose no pipeline there. A constant with no arm
|
||||
that serves every binding stays a pipeline per value, made at the first draw of it: a sampler's
|
||||
state (`SamplerState`, each sampler word a sampling emulation of its own), whether a pixel
|
||||
sampler is a nearest one (`NearestPixelSampler`, whose sample reads its texel's centre) and how
|
||||
the bicubic filter treats the bound format's texels (`BicubicTexels`).
|
||||
has its `UnmeasuredTexels`, which no instruction reads, at 0 (a class whose `half` conversion is
|
||||
not measured, BC4 to BC7 and the linear ASTC formats among them, takes 1), and its
|
||||
`PlainHalfTexels` at 1, as a slot bound to nothing takes: the plain arm, which Metal's compiler
|
||||
can fold into the image instruction and which every plain class takes (every class but a YCbCr
|
||||
field on the grid 8192, which takes the class routine, `PlainHalfTexels` 0, and makes its own
|
||||
pipeline at its draw, as any key the creation did not predict). Where the predicted key is not
|
||||
its own general form (a buffer slot read at the bind offset, on a device that reads views
|
||||
there), the creation hands it to the pool right after, behind the makings something waits for.
|
||||
A draw whose own pipeline (which reads such a buffer slot at the bind offset alone, or names an
|
||||
unmeasured class) is not made, and whose key's general form's is, draws with that one at once;
|
||||
its own is made on the pool behind the makings something waits for, and later draws take it.
|
||||
So a draw binding a texture of an unmeasured class waits for no compile of its own, and runs
|
||||
the instructions its own key runs. Only GPU time moves for the draws before their own lands
|
||||
(`WorkCounts::residual_form_draws`, `residual_form_makings`): on ANV the residual form's reads
|
||||
are loads where the other form's are pushed constants. On MoltenVK every key reads its buffer
|
||||
slots at their residual (the two forms measured alike there), so a draw's bind offsets choose no
|
||||
pipeline there, and a creation makes one pipeline. A constant with no arm that serves every
|
||||
binding stays a pipeline per value, made at the first draw of it: the `half` conversion's arm
|
||||
(`PlainHalfTexels`, above), a sampler's state (`SamplerState`, each sampler word a sampling
|
||||
emulation of its own), whether a pixel sampler is a nearest one (`NearestPixelSampler`, whose
|
||||
sample reads its texel's centre) and how the bicubic filter treats the bound format's texels
|
||||
(`BicubicTexels`).
|
||||
- **A dispatch's `VkPipeline` is made while the dispatch goes on**, the same way: one pipeline per
|
||||
threadgroup size and edge region, made on the pool. A compute state whose descriptor states
|
||||
`requiredThreadsPerThreadgroup` -- the threadgroup every dispatch of the state must have -- makes
|
||||
|
||||
Reference in new issue
Block a user