7edbf84c8fb61ba297139335d934209dda6641a0
736
Commits
| Author | SHA1 | Message | Date | |
|---|---|---|---|---|
|
|
100b92d608 |
identity: constexpr samplers by a pushed index into set 1's sampler arrays
Under the identity domains a texture slot sampled through a constexpr sampler takes the sampler
from the set-1 sampler array of its use (binding 2 plain, 3 compare, 4 integer texture) at an
index the consumer pushes: PushField::ConstexprSampler(CombinedSampler), one u32. The consumer
makes the device sampler that the new public CombinedSampler::constexpr_sampler(profile)
describes, places it at an index of that array, and pushes the index. The index is a push word,
not a specialization constant: an index allocated at run time would key the driver's and the
pipeline cache's entries. Link's immutable sampler for the default domains now goes through the
same method, with the same result.
Under the identity domains every device sampler is normalized: a constexpr pixel sampler's
coordinate is scaled in the shader, as a runtime sampler's is, never handed to the device's
unnormalized sampler. A linear sample or gather through it records
PrecisionNote::PixelSamplerScaling, which is static. No address-mode-map variant applies there
(no binder picks a variant), so the sampler keeps its own modes and the slot records no
ConstexprSampled fact.
Still refused as Unsupported{IdentityDomains}: an argument buffer's sampler, arrays of samplers,
bicubic and anisotropy emulation. The refusal test now uses engine/a2_bicubic_weights.
Translation output changes only under the identity domains (Device::from_queries). Device::new
output is unchanged: golden_hashes_match_the_table passes at this tip (job m3-max-42192), with no
"changed under an unchanged key" and no "profile changed:" line.
Public surface: PushField::ConstexprSampler and CombinedSampler::constexpr_sampler are added
(api_signatures blessed); nothing is removed or changed.
SEMANTICS_VERSION 2162: identity-domain modules of constexpr-sampling kernels change.
ARTIFACT_FORMAT_VERSION 531: PushField gains a variant.
Verified:
- m3-max-42097 (msi), this change on
|
||
|
|
445b720f78 |
identity: texture slots sampled through runtime sampler slots from set 1's sampler arrays
Under the identity domains a kernel samples a texture slot through a runtime sampler slot. The
texture is its class's set-1 element at the index of its pushed gpuResourceID, as a read's is.
The sampler is the element of a set-1 sampler array at the index of the sampler slot's pushed
gpuResourceID (SlotGuestBase of the sampler slot), joined to the texture by OpSampledImage. The
array is picked by the use: binding 2 for a plain sample, 3 for a depth comparison, 4 for a
texture of an integer format; 4,000 SAMPLER descriptors each, PARTIALLY_BOUND |
UPDATE_AFTER_BIND | UPDATE_UNUSED_WHILE_PENDING, every stage, the same set 1 for every pipeline.
The sampler's word (pixel coordinates, a nearest pixel sampler) is read from the ID's high word,
so no specialization constant and no SamplerReduction, SamplerCoordinates, CubicSampler or
ConstantLanes fact remains; every precision note is static. An integer write to a storage slot
without a format saturates to the channel widths the consumer pushes
(PushField::TextureIntegerChannels, a u32), with no fact.
Still refused as Unsupported{IdentityDomains}: constexpr samplers (next change: a pushed index),
an argument buffer's sampler, arrays of samplers, bicubic and anisotropy emulation, a slot's
minimum level.
Translation output changes only under the identity domains (Device::from_queries). Device::new
output is unchanged: golden_hashes_match_the_table passes at this tip (job m3-max-42189), with no
"changed under an unchanged key" and no "profile changed:" line.
For the runtime's side (the planner's three facts):
a. The runtime must dedupe device samplers by create info across the three arrays' uses.
Exhausting maxSamplerAllocationCount (4,000 on the 2080, 3090 and UHD 630; 32,768 on
lavapipe; 65,536 on the others) must be a typed refusal, with a fill-past-capacity test.
b. The update-after-bind limits for 65,536 sampled images, 4,096 storage images and 12,000
samplers hold on all nine profiles (the smallest is lavapipe's 1,015,808); the floor must
check them by query.
c. The count of cubic sampler descriptors is asked of the replay lane; if any exist it goes back
to the planner before step 5 closes.
SEMANTICS_VERSION 2161: identity-domain modules of sampling kernels and integer writes change.
Verified:
- m3-max-42094 (msi), this change on
|
||
|
|
da5fd7da0b |
push window: 256 bytes on from_queries' profile, the new runtime's floor
A kernel's push window held 128 bytes, what Vulkan guarantees: a dispatch region and 12 buffer
addresses. A kernel of more buffers put the rest in a parameter block that the new runtime writes
into its ring on every dispatch, and whose address the window holds.
The translator: a new profile fact, PushWindow. Device::new keeps Guaranteed (a 128-byte kernel
window, the value ROWS renders as nothing, so every Device::new fingerprint and module is
unchanged); Device::from_queries takes Floor, a 256-byte kernel window: a dispatch region and 28
buffer addresses. lower::push::{window, place, spills} take it; the render windows are the same on
both. The push range is still the function's own need, and a module whose block passes 128 bytes
requires maxPushConstantsSize to cover it, as before.
The new runtime: the floor requires maxPushConstantsSize >= 256 (every captured device reports
256), a typed refusal below it; its pipeline layout declares 256 bytes, and a dispatch pushes the
kernel's own bytes. A new metric, Metrics::ring_writes, counts each parameter block and each
set_bytes copy written into the ring. README: the floor's limit row and the parameters paragraph.
The harness gains wide_bindings: 256 small dispatches of a kernel that binds 24 buffers.
Tests: push.rs places a region and 28 addresses in the floor window and spills a 29th, with the
first 12 placed as the guaranteed window places them; engine_identity's many-buffer kernel on
from_queries pushes all 21 addresses with no block, and one of 33 slots spills 2, both answering
on the interpreter; the floor tests move to 256; the profile facts test covers the new fact; an rt
device test dispatches a 24-buffer kernel with no ring write and a 30-buffer one with one a
dispatch. The signatures table gains Metrics::ring_writes.
|
||
|
|
c1b123813f | docs: under the identity domains unwritten and constant arguments are read-only memory | ||
|
|
8ec8cbbc20 |
old-runtime regression fix: a half color output is 16-bit again under Device::new
|
||
|
|
aa8d6ac6f5 |
old-runtime regression fix: a stage's reconvergence note only on from_queries' profile; the old runtime's extra kind goes
|
||
|
|
e0f567a8bc |
old-runtime regression fix: the two half rows return to Device::new; from_queries' profile notes every controlled pair
|
||
|
|
d5a475f1a0 |
old-runtime regression fix: the stage bounds return to Device::new's ANV rows; the bound on every device is a fact of from_queries' profile
|
||
|
|
75b422338a |
identity: argument-buffer textures are the set-1 elements their resource IDs name
Under the identity domains an argument buffer's texture handle is the gpuResourceID its member
holds: the handle is the ID's index, the element of the class's set-1 array (0 is nil, the null
descriptor), with no handle table, no search and no descriptor. Where the shader checks a read
itself (no robustImageAccess2) the handle carries the word's missing-alpha bit (word bit 12) at
HANDLE_ALPHA_ONE, so the handle form is Lookup::Element or Lookup::Flagged{alpha} only.
The handle tables' variant forms are off under these domains (`texture::tabled`): reads of a
member of another numeric class, raw-texel decodes, storage conversions (red-blue, sRGB alias),
A8 alpha-in-red, unreadable-storage nulls, YCbCr write marks, and the HeapCrossClassNeutral,
HeapStorageReads and HeapResidency facts. A slot and a member of one class index one array, so
the class's volatility now merges the slots' uses with the groups'. The admission takes heap
groups whose declaration is their identity class with no plain, raw or cross classes; anything
else stays Unsupported{IdentityDomains}.
Translation output changes only under the identity domains: the default domains plan and emit
as before (no golden re-bless needed). SEMANTICS_VERSION 2153.
The test kernel `tex` gains an argument-buffer form (`texture_kernel(true)`), checked on
lavapipe, moltenvk-m3 and moltenvk-m3 without robustImageAccess2: same answers at the same
elements, set 0 empty, and the handle form Element or Flagged{alpha} as the profile checks reads.
Verified (this commit's tree, as 657e2245c2 on
|
||
|
|
576a7348bc |
translator: one stage bound on every device; the two stage-size workarounds go
A module whose entry weighs more than COMPILED_STAGE_WEIGHT (99,109, the heaviest stage measured to compile within host-sized memory, on ANV) is now handed to no driver, whatever its identity. A kernel that emulated its simdgroups only in place of the widest mode's pin (the subgroup size range decides it) is planned again keeping the pin, as before; every other module past the bound is refused with Feature::StageSize and a new Needs::StageBound, its symbol naming the weight and the bound. The refusal is permanent for the input on the device (its plan decides the weight), so it is not NotImplemented; validation reads it as the translator's own gap. DriverWorkaround::SerializedStageWrapsLargeModules and CompilerMemoryGrowsWithStageSize go, with ANV's identity entries for them and the serialized bound (786,432), which the single bound sits far below. Why: the workaround ladder takes one form for every device, the slowest compiler's; a device whose compiler would take a heavier stage is refused it, recorded in FAST-PATHS' known gaps. Measured before this change, with a scratch build that applied the bounds and the re-plan to every profile: the corpus on the Iris Xe's description without its identity refused nothing (largest planned module 91,399, job m3-max-41496), and RADV and NVIDIA nothing either; without maximal reconvergence 12 rows were refused, 6 distinct simdgroup-matrix modules of 198 to 285 products whose lockstep pairs force emulated simdgroups (jobs m3-max-41474, m3-max-41523). The owned fixture stage_bound/stage_bound_matrix (512 simdgroup matrix products beside a lockstep pair in divergent flow, our own MSL) has their structure: on the Iris Xe its emulated module weighs 123,307 and its pinned one 37,646; without maximal reconvergence it is refused at 123,308 (scratch weighing, job m3-max-41602). The new test the_stage_bound_fixture_keeps_the_pin_or_is_refused asserts both paths and that the re-planned kernel is under the bound. The old runtime's heap-trim test loses its long chain, now refused on every device; it asks for a trim where the making left more than the floor free (NVIDIA's compile never does under the bound, 189 MB at most measured). SEMANTICS_VERSION 2150; REFUSALS.md regenerated; the API table loses the two variants and gains Needs::StageBound. |
||
|
|
fa52012831 |
identity: texture slots are the set-1 elements their pushed resource IDs name
Under the identity domains a kernel's texture slots now lower. A slot's gpuResourceID is pushed as its PushField::SlotGuestBase (the index in the low word, the word in the high one). Its texture is the element at that index of one of set 1's two fixed arrays: binding 0, SAMPLED_IMAGE x 65,536, and binding 1, STORAGE_IMAGE x 4,096. Each is partially bound, updated after binding and while unused elements are pending, and seen by every stage, with the same layout for every pipeline (BindingSource::IdentityArray). Each image class the kernel declares (shape, numeric type and depth comparison, sampled, or storage without a format) is a variable of its descriptor type's binding. The slot binds no descriptor and declares no specialization constant: - is_null_texture answers whether the index is 0. Nil needs nothing else in the shader, since element 0 of each array is a null descriptor (the device test of |
||
|
|
07e62aa306 |
translator: a controlled half pair is noted on every device; the two half workarounds go
What: a half rounded through the device's conversion and its widening under the 16-bit float controls (QuantizeForm::Controlled) now records PrecisionNote::NativeHalfConversion on every device, as a static note of the operation. Every profile with shaderFloat16 and those controls takes that form, NVIDIA's included. DriverWorkaround::HalfConversionPairFolded (NVIDIA, identity) and DriverWorkaround::HalfConversionFusedWithArithmetic (RADV, identity) are deleted, with narrow::rounds_arithmetic, which only the second read. Why: rule 2 of the owner's rules (one path for every device, no identity-keyed branch) and the planner's ruling on these two rows of the workaround ladder. The pair is Metal's half(float) by the Vulkan spec, but a driver's compiler may fold it (NVIDIA's) or fuse the float operation into the narrowing (RADV's). Recording the note statically on every device covers both drivers with no identity check, and it never refuses. NVIDIA's modules move from the Converted form to the Controlled one (NoContraction on the pair, the entry declaring the 16-bit modes), so its golden cells move. ANV's and RADV's modules gain only the note, which is not hashed. SEMANTICS_VERSION goes to 2149. Tests: engine_native_half, device::tests::profile (half_rounding_follows_the_queries_alone replaces the two identity tests), engine_float_call_notes, and the native_maths and half_conversions lanes, updated to expect the note on every controlled profile. Docs: API.md's NativeHalfConversion entry and HOWTO.md. api_signatures.tsv loses the two variants, and REFUSALS.md is regenerated unchanged. |
||
|
|
6e08f5aaef |
metal2vulkan: PrecisionNote::DeviceReconvergence, a stage's implementation-defined reconvergence as a static note
A stage whose reconvergence is ImplementationDefined (a tangled instruction in its entry on a device without maximal reconvergence) records PrecisionNote::DeviceReconvergence, static per stage and as coarse as the field. metal2vulkan-rt forwards it through ComputePipelineState::precision_notes and adds none of its own; metal2vulkan-runtime announces its note kind beside its existing ImplementationDefinedReconvergence kind. The note is in API.md's degrade-notice catalogue, the fast-paths ledger's Elsewhere class, the cache codec (ARTIFACT_FORMAT_VERSION 528) and validation's Unbounded allowance. SEMANTICS_VERSION 2149: a stage's notes change on devices without maximal reconvergence; the golden tables are re-blessed on development. Tests: engine_simd reconvergence_follows_the_profile and the uniform-control-flow case assert the note exactly where the field is ImplementationDefined. |
||
|
|
159154d5a9 |
PrecisionNote::CappedLodBias: a sampler state's capped or withheld lodBias carries a static note
Where the presented GPU adds a sampler descriptor's lodBias to every sample's level (SamplerUse::lod_bias), vk_sampler hands the device device_lod_bias's answer: past the device's maxSamplerLodBias it adds that limit, and a NaN, or any bias where a portability subset withholds samplerMipLodBias, adds none. Only the old runtime said so (Degradation::CappedLodBias, announced as it makes the state); the translator's vocabulary had no note for it, so a runtime built on the translator alone could not report it. The lab's own reports put the limit at 15 on the 2080 and both 3090s and 16 on the other target devices. The translator now states it as PrecisionNote::CappedLodBias, which DeviceLodBias::note gives for every variant but Exact. It is fixed by the state's bias and the device's limit; no pipeline stage records it, so translation output does not change (no SEMANTICS_VERSION bump). Classed where every note is: the artifact codec, tests::fast_paths (Elsewhere: docs/API.md section 9 states it), validation's comparison allowance (unbounded). The old runtime's degradations! macro maps the note to its existing runtime kind CappedLodBias with one hand-written from_precision_note arm. That change is mechanical, with no behaviour change: the kind keeps its code, category, cost and announcement site, and its precision_note() stays None, so the site tests' rule (a kind with a note is a stage's) still holds. docs/API.md: section 9's intro, the capped-lod-bias catalogue entry and the accepted difference name the note. api_signatures.tsv re-blessed; refusal_surface.py --check passes, REFUSALS unchanged. Test: metal::sampler::tests::the_device_lod_bias_carries_its_note_where_it_is_not_the_bias, over every committed device: no note for 0, -0 or a bias within the limit, the note past it, at the infinities and for a NaN, and for every nonzero bias where samplerMipLodBias is withheld. Verified: cargo fmt; signatures.py --bless; refusal_surface.py --check. Lints and tests follow as potluck jobs. |
||
|
|
50c5bd0fe1 |
identity: every dispatch reads Metal's grid from its pushed region
Under the identity domains a kernel that reads a grid builtin no longer declares the MultiRegion
specialization constant. It tells a region from an indirect dispatch by the region's grid
(RegionSelect::Grid in lower::dispatch):
- Every dispatch the host knows (dispatchThreads, dispatchThreadgroups, and each piece of a split
of either) pushes DispatchRegion with Metal's threads_per_grid in region[1].xyz and its piece's
first threadgroup in region[0].xyz. So the pieces of a split read Metal's whole grid, and every
compute pipeline takes the base offset.
- An indirect dispatch pushes a zero grid. Its kernel then takes the single-region form, its grid
NumWorkgroups times L, which needs its workgroup size to be Metal's threadgroup size.
- One pipeline runs every dispatch of a threadgroup size, with no constant to specialize.
A flat variant (LoweringInputs::flat_grid), bound as any other kernel, reads its grid from the same
pushed field rather than from a record at ReplayRegionAddress (plan_replay, EmitCx::push_field).
The consumer runs non-observing kernels in a fixed shape with it, and invocations past the grid
return before the body. A replay or folded variant keeps its record and stays refused under the
identity domains.
The runtime lane takes this ABI as agreed: the zero grid marks an indirect dispatch, which runs
the per-size pipeline.
SEMANTICS_VERSION 2148: modules under the identity domains change.
Tests (src/tests/engine_identity.rs), on lavapipe and moltenvk-m3:
- every_dispatch_reads_metals_grid_from_its_pushed_region. A generated kernel reads
thread_position_in_grid, threads_per_grid and threadgroups_per_grid. It declares no MultiRegion
constant and passes L3. On the CPU interpreter, with L = (4, 2, 1) over an 8x6 grid, it stores
the same answer at every position in three forms: one whole dispatch, a split into two pieces at
region base (0, 1, 0), and an indirect dispatch with a zero grid.
- a_flat_variant_reads_its_grid_from_its_pushed_region. Its flat variant reads a 7x5 grid from
the pushed region in three workgroups of 16. The 13 invocations past the grid store nothing.
- The buffer-kernel test runs once, with its region pushed.
Verified:
- m3-max-41225 (msi, check commit 7fe9bc780c: this tree's metal2vulkan files, which equal those
here on
|
||
|
|
227b118bd9 |
identity: fields past the push window go to a parameter block at a pushed address
Under the identity domains the stage's ArgumentTable is not a uniform buffer. It is a parameter
block in memory that the consumer writes for the call, and its device address is the new push
field PushField::ArgumentTableAddress, a u64.
How it works:
- The placement is the one the translator already makes. Fields fill the 128-byte window in kind
order; the first that does not fit, and every field after it, go to the block at
PushLoc::ArgumentTable offsets, and argument_table_size is the block's size.
- ArgumentTableAddress sorts first among the kinds. A kernel whose fields spill inserts it, so the
window always holds it, at offset 0 under the identity domains, where RootTableAddress never
appears.
- The function reads each spilled field through the address (table::read_block): a
PhysicalStorageBuffer load at the field's offset, aligned to its shape.
- No descriptor is declared or counted, and maxUniformBufferRange does not bound the block.
- Selection now admits a kernel whose slot addresses or region spill, with the address in the
window.
The variant goes at the codec's end, since tags are by name. The api_signatures table gains it,
and the kind-order and status-address placement tests name it. SEMANTICS_VERSION 2147: a refusal
under the identity domains became a module.
The new test, slot_addresses_past_the_window_are_read_from_the_pushed_parameter_block, uses a
generated kernel with 20 read buffers and an output. On lavapipe and moltenvk-m3:
- ArgumentTableAddress is at Push{0}, 15 slot addresses fill the rest of the window, and 6 go to a
48-byte block;
- there is no descriptor;
- it passes L3;
- on the CPU interpreter, with the block and every buffer above 4 GiB, it stores the ordered fold
of the 20 words, which a swapped address would change.
Docs: docs/API.md's identity-domain bullet names the parameter block (added after the check
runs; no code differs from what they built).
Verified:
- m3-max-41196 (msi, check commit 9c6102b5ad on step 1's tree: this commit's metal2vulkan tree, with
the same translator files as here on
|
||
|
|
46e3215e55 |
identity: kernels over buffers lower under the identity domains
Under PointerDomain::Identity with HandleDomain::Identity every buffer slot of a kernel is its
device address used directly. Each slot is the Psb form, its address read from its own push
field, PushField::SlotGuestBase(slot): gpuAddress plus the bind offset, which under the identity
domains is the Vulkan device address. No root table is read, and no access is contained, as Metal
contains no device-address access (psb::prepare_at). Selection admits, under the identity domains,
only the plans lowered so far (select::identity_admits): a kernel whose push fields are its slot
addresses and its dispatch region, all in the push window, with no descriptor and every slot
addressed. Anything else is still Unsupported{IdentityDomains}, not implemented, now refused there
rather than for every function at analysis. SEMANTICS_VERSION 2146: a refusal under the identity
domains became a module.
The new tests (src/tests/engine_identity.rs):
- a1_bool_from_float under the identity domains on lavapipe and moltenvk-m3 has no descriptor,
no root table and three SlotGuestBase fields. It passes L3, and it computes the program's
answer on the CPU interpreter, with its buffers above 4 GiB at bind offsets 32, 16 and 4. It
writes nothing past its output, with its region pushed.
- a2_dynamic_texel_offset, which samples a texture, compiles under the default domains and is
refused under the identity ones.
Verified:
- m3-max-41149 (msi, check commit eeecc4492b, the same tree but for the test's region bytes):
clippy -p metal2vulkan --all-targets --all-features, rustdoc -D warnings, and nextest -p
metal2vulkan --all-features, 3664 of 3665. The one failure was this test, which met the kernel's
DispatchRegion field and did not fill it.
- m3-max-41195 (msi, a5dbfd408f, this tree): clippy and rustdoc; tests::engine_identity and the
domain pair test, 3 of 3.
- m3-max-41150 (msi, eeecc4492b): clippy under --cfg m2v_gpu and --cfg m2v_cpu_icd.
|
||
|
|
94071f82a2 |
device: the identity pointer and handle domains, taken as a pair
The new runtime's form: pointers are device addresses used directly and a texture's or sampler's
handle is its gpuResourceID (docs/RESOURCE-ID.md). The variants come beside the old domains,
which stay until the cutover; nothing lowers under them yet.
- PointerDomain::Identity and HandleDomain::Identity.
- Device::new refuses one identity domain without the other (InvalidDescriptor) and the identity
domains on a device without bufferDeviceAddress and shaderInt64 (Unsupported{IdentityDomains},
naming both features as one alternative).
- A compile under the identity domains is Unsupported{IdentityDomains}, not implemented, at the
start of analysis, so no old form is ever emitted under them. Later steps lift it as the
lowering lands.
- The profile fingerprint covers the domains (tested).
- docs/API.md's policy section names the domains; docs/REFUSALS.md and the reach table carry the
new refusal; api_signatures regenerated.
Verified (this commit's tree, rebased with the ledger commit before it onto
|
||
|
|
6f5bd20321 |
stage io: one 32-bit form for every stage output
The translator declared a `half` color output with 16-bit float lanes where the device enabled storageInputOutput16 and shaderFloat16: a second form chosen by a query that is not one of the four the owner's rule 2 allows (the 3090, 2080, RX 550 and lavapipe lack it; MoltenVK, RADV and ANV have it). Every interface variable is now 32-bit on every device: a `half` output is widened to `float`, which holds every `half` exactly, and no module needs StorageInputOutput16. - lower::stage_io: plan::half_variable, IoObject::User::half and the 16-bit store are gone, and io_elem takes no width. StageIo::half_outputs and the profile's input_output_16bit are gone; the link contract checks 32-bit float lanes only. - SEMANTICS_VERSION 2145 and ARTIFACT_FORMAT_VERSION 527 (the artifact codec lost a field). The golden table needs its re-bless on development: every profile's key moved with the profile's lost field. - The HalfOutputPrecision and HalfOutputFastMathBlend notes, docs/API.md's degrade catalogue, docs/FAST-PATHS.md and the half-output-blends conformance case say what the device receives now; their statements about the 16-bit form are gone. - known-gaps.tsv: 52 rows for MoltenVK on the Apple M3 Max. With the 16-bit output MoltenVK stored Metal's codes at every word of half-output-blends-*; with the `float` output its blend is the device's own (half-output-fast-math-blend) at 17, 17 and 18 sites of the R16Float, RG16Float and RGBA16Float cases, largest differences 1 to 1,582 codes at the stored value (the blend-colour sites the largest). Its 32-bit float cases still store Metal's codes. Verified (code at c55bc28e43, ledger rows added at 2754676210, this commit's tree): - msi 40877: clippy -p metal2vulkan --all-targets --all-features -D warnings, rustdoc -D warnings, nextest -p metal2vulkan in full: 3,661 of 3,662 pass; the one failure is golden_hashes_match_the_table (every profile's key moved), for the re-bless on development. - msi 40827: clippy under --cfg m2v_gpu and --cfg m2v_cpu_icd. - XTX (RADV NAVI31) 40843: runtime_lane color_writes (every `half`, NaN and infinity included), half_output_blends and extended_range_blends, 16 of 16 pass; the conformance replay of the six half-output-blends cases exits 0 against the RADV rows, so every row's count and largest difference held. - RTX 3090 (ms01) 40844: the same 16 lanes pass; the replay's 59 divergent sites are exactly the RTX 5080's 59 rows (the ledger holds no 3090 rows; NVIDIA never had the 16-bit form). - M3 Max on MoltenVK: 40833 before the rows (52 new gaps, all in the 16-bit float cases), 40862 with them (exit 0, every count held on the second run). - msi 40875: the conformance crate's ledger tests, 7 of 7. |
||
|
|
ec40b7de6d |
Interface: what a function reads and writes beyond its bound slots
Each stage interface, and a pipeline's together, states whether its function may read or write a resource through anything but its bound slots: a pointer or texture it loads from memory or makes from an integer (an argument buffer's resources, an address stored in a buffer, a resource ID), an indirect command buffer, ray tracing, or a call it cannot see into. Decided from the specialized entry's memory plan: an access whose pointer or texture handle may have a dynamic or call root. With each slot's access, these are the two static facts the new runtime's compute encoder needs to place a barrier only on a hazard. SEMANTICS_VERSION 2144 (interface facts), ARTIFACT_FORMAT_VERSION 526 (two fields in StageInterface and PipelineInterface). |
||
|
|
94e3f50b3e |
RUNTIME 2524: name and count each reader's snapshot image
What: a reader's snapshot (render/snapshot.rs, Texture::snapshot_texels) is a storage image of
the read texture's level-0 extent beside the texture's own image, which no log line named and no
count counted as an image. Each snapshot a draw takes is now counted
(WorkCounts::reading_snapshots_taken; reading_snapshots_recycled for those whose image was the
recycler's parked one, which placed no memory) and named in the shadow log
(METAL2VULKAN_LOG_SHADOWS): the draw's call, the texture it binds (format, size, levels, usage,
object ID, the texture it is a view of), the snapshot's format and extent, and whether its image
is the recycler's or one placed for it. Image records whether the recycler handed its VkImage
back (Device::recycled_image now says so).
Why: a consumer's Iris walk (RUNTIME 2485) showed a second Private image of each image cache's
size placed about 1 ms after the cache and returned with it, 109 of them, named by nothing: the
snapshot of a draw that samples the cache's view at its own pixels while its own pass renders the
view and writes that color. RUNTIME 2508 already releases it with its command buffers; it stayed
unnamed and uncounted.
Test: tests::snapshot_goes turns the shadow log on and checks one line per snapshot taken, the
recycler's named so, each naming the view, its texture and the snapshot's extent; the second
pass takes 1 snapshot, the recycler's. On a device without the path: none taken or named, and
the reader's copy is the usage shadow the log names for the attached read.
Verified (twinplace lane, tip 2e160c176e on
|
||
|
|
4114585b2a |
SEMANTICS 2143 / RUNTIME 2517: a selection on an own-pixel read keeps its snapshot slot
A fragment function that reads its own pixel of a colour attachment and branches on the value
was refused its snapshot read (SnapshotRefusal::Branch), so each such draw split its render pass
and copied the texture. On the consumer's desktop walks that was 614 draws/s on the XTX and the
Radeon 780M (510 render-pass splits/s, 20.8 M texels/s of split copies) and 107 draws/s on the
Iris Xe. In a pipeline dump of the 780M walk, 30 of the 33 readers refused for Branch branch
through selections whose arms hold no derivative, implicit-level sample, group op, kill or loop;
their values leave the arms through Function variables, not phis.
The rule (spirv/requirements/snapshot.rs, new snapshot/arms.rs): a branch or switch on a fetched
value keeps the slot when it is a selection whose arms leave only through its merge (no break,
continue, return, OpKill, OpTerminateInvocation or unreachable end), hold no tangled instruction
(Inst::is_tangled: a derivative, an implicit-level sample or LOD query, a subgroup or quad op),
hold no loop and no non-constant integer divisor or dynamic index, and call no function that
holds any of these. The merge's phis and the Function, Private and Output variables the arms (or
their callees) store to take the condition's reach, so a merged value that reaches a derivative
still refuses the slot (Derivative). A helper invocation may then take either arm: its stores to
Function, Private and Output memory have no effect beyond it ("Helper Invocations"), and nothing
in the arms observes its neighbours. The loop form stays Branch. demote_guard goes: the rule
covers it (demote arms are clean arms).
The facts a module states change (snapshot_textures, snapshot_refusals): SEMANTICS bump. A new
owned fixture, engine/snapshot_select.metal (scripts/regen-air-fixtures). No new Degradation
kind, WorkCounts field or public signature. Docs: SnapshotRefusal::Branch, docs/API.md (Snapshot
reads).
Tests: snapshot::tests (kept: empty arm, demote arms, Private store, callee and pointer forms;
refused for Branch: an arm with a derivative, a call to one, a kill, a loop, a non-constant
divisor, the loop exit; refused for Derivative: an arm's store or a merge phi reaching a
derivative); compile::tests::a_selection_on_the_texel_keeps_the_slot_where_a_helper_may_take_
either_arm (ss_read_selecting states no refusal on the 780M and lavapipe profiles;
ss_read_selecting_dfdx and wlk_read_branch state Branch); runtime_lane::snapshot_reads 12/12 on
lavapipe with two new lanes.
Verified (snapbranch lane): clippy -D warnings on the three crates (m3-max-39324), touched tests
6/6, lavapipe snapshot_reads 12/12 (m3-max-39334). The fixture's inventory, air_input printout
and golden hashes re-bless on development; clippy under the GPU cfgs, rustdoc, the release
translation timings and the PHOENIX lane run follow there.
|
||
|
|
594c792b66 |
RUNTIME 2506: An upload's trailing barrier names its batch's own uses of the buffer
A batch's first work of Managed uploads alone ended with a barrier TRANSFER/TRANSFER_WRITE -> ALL_COMMANDS/MEMORY_READ|MEMORY_WRITE. On a device that orders its batches by their ends, where the first work already takes no leading barrier (first_move::Earlier::Ended), its second scope is now the union of the stages and access types the batch's encoders' uses of those buffers name (first_move::Later::Batch, from the parts' tracker summaries). Every later batch on the VkQueue is ordered by the batch's end, Barrier::to_all, whose first scope includes all earlier commands at ALL_COMMANDS/MEMORY_WRITE (the uploads among them) and whose second includes every later command; another VkQueue's command buffers wait for the batch's signal, whose first access scope includes all memory access performed by the device. The barrier keeps ALL_COMMANDS under the exact batch order, and wherever the batch's use is unknown: a command may reach memory no use names, a heap's set is bound, the work may write through its residency, an upload names no key, or the batch's uses name none of a buffer. Probe (64 B inline, GPU p50; probe-only branches, never landed): the global barrier narrowed to COMPUTE_SHADER/SHADER_READ|SHADER_WRITE took the RTX 2080 from 23.85 to 18.25 us (none 12.4) and the RTX 3090 from 32.25 to 25.05 us (none 21.8); a buffer-range barrier measured the same; on the RX 7900 XTX the trailing barrier costs nothing (9.7 us either way). New counter WorkCounts::managed_upload_barriers_narrowed; device tests: the WAR test counts it, a later batch reads the upload at a stage the upload's batch never used, and the barrier's scope names both stages of a batch whose kernel and blit both use the buffer (a test-only record of the scopes). The second commit (263b155a4a) prints vk flags as raw words; Later derives no Debug. Verified: m3-max-38590 (m2v_gpu and release archives, clippy --cfg m2v_gpu) and m3-max-38591 (clippy plain and --cfg m2v_cpu_icd, rustdoc -D warnings) clean; device tests managed_inline, host_ram_managed and managed_copy_device 49/49 on the RX 7900 XTX (m3-max-38597) and the RTX 2080 (m3-max-38600): the WAR test counts the barrier narrowed (0 under the exact order and in its negative control), the later-batch test reads the upload at TRANSFER, and the scope test finds COMPUTE_SHADER|TRANSFER and SHADER_READ|TRANSFER_READ. The base-vs-tip benches on the 2080 (m3-max-38610) and 3090 (m3-max-38612) follow the merge. |
||
|
|
3e39f3b9b1 |
RUNTIME 2502: Uploads alone after a batch's end take no barrier from the commands before
A batch whose first work is only Managed uploads (copies or inline vkCmdUpdateBuffers into device copies) recorded, in its first-work command buffer, an execution barrier ALL->ALL before its GPU start and a lead barrier ALL_COMMANDS/MEMORY_WRITE -> TRANSFER before the uploads. On a device that orders its batches by their ends (batch_order::by_ends: RADV, NVIDIA, ANV) both are redundant: every earlier command on the batch's VkQueue is a batch's, followed in submission order by its end Barrier::to_all (ALL_COMMANDS/MEMORY_WRITE -> ALL_COMMANDS/ MEMORY_READ|MEMORY_WRITE), whose first synchronization scope "includes all commands that occur earlier in submission order" and second "all commands that occur later in submission order" (vkCmdPipelineBarrier), the uploads among them. Earlier reads of the device copy run before them (WAR needs only an execution dependency), earlier writes are available and visible to their writes (WAW), and the start timestamp at the top of the pipe is held there as a first encoder's prefix start already is. The one other kind of submission on a batch VkQueue, an internal one (device/submit.rs), ends with no such barrier: the batch skips both only where no internal submission the host has not seen complete was made, read while it holds its place in the first work's order, which an internal submission takes before it is made. Another VkQueue's command buffers stay ordered by the batch's semaphore waits. Under the exact batch order (to_host ends) both barriers stay; the trailing barrier stays everywhere. New counter WorkCounts::managed_uploads_unbarriered. New device tests in tests::managed_inline: an upload behind a batch whose kernel still spins on the device copy's word lands after its reads (default order, counted unbarriered on a by_ends device; exact order, kept), and an ignored negative control forcing it unbarriered under the exact order. The bench prints the counter. The write-after-read test's buffers take their first work before its steps (e54dbd08b3) and its doc says where it can fail (5cbadadeef). Verified: clippy in three configurations and rustdoc passed (m3-max-38492, m3-max-38530); the managed_inline device tests on the XTX 47/47 (m3-max-38511); the write-after-read legs on the 2080 passed (m3-max-38527). Measured (release, inlinemanaged bench, 64 B inline): the XTX's GPU gap over no upload fell from +5.6 us to +3.5 us (m3-max-38521; 2.1-2.9 us across sizes); the 3090 showed no measurable change (m3-max-38522). The 2080 rerun follows the merge. |
||
|
|
f2367d8956 |
SEMANTICS 2142 / RUNTIME 2495: View facts from the device's own check: the runtime's view check, measured workarounds in the description
What: the two constant-window view cost facts no longer come from a GPU identity. - metal2vulkan: DeviceDescription::measured (a set of DriverWorkaround, serde default) is a profile input: the profile takes those workarounds beside its identity's, so the fingerprint and every cache key follow it. The identity rows of UniformBufferPerLaneReadsSerialize (RTX 3090, RTX 2080, RTX 5080 Laptop) and ExternalUniformReadsSkipACache (ANV on the Iris Xe RPL-P) are gone, and NVIDIA_RTX_2080 with them (nothing else used it). - The texel form now applies only to a slot with an indexed read (SlotPlan::indexed_read, from Provenance::indexed_constant_reads, marked on a profile with the texel fact): a slot read at constant offsets alone keeps its uniform buffer, whose ranges ANV pushes into registers (Mesa's brw_nir_analyze_ubo_ranges; read, not measured), as reims's Iris Geekbench pair 2 suggested. With both facts, view_kind gives a per-lane slot storage, an indexed-uniform slot the texel view, a constant-offset slot the uniform buffer: no conflict. - bind::view_check_module (CheckView x CheckReads): the check's kernels, built and verified like any crate module (push-constant window mask, uvec4 reads, uniform / per-lane / fields). - metal2vulkan-runtime: view_check.rs, a device check on its own thread, started as the device is made, once per driver + release + runtime, its medians kept in the shader cache's directory: 8 kernels x 1 KiB / 4 KiB windows in device memory, and UBO / texel uniform reads over imported host pages; 7 interleaved rounds after a warm-up, medians of timestamps x timestampPeriod. Facts: per-lane where storage/UBO per-lane < 0.3 at both windows (NVIDIA 0.011-0.107, RADV 0.96-1.00); texel where texel/UBO uniform over imported pages < 0.7 at both (Iris 0.40-0.49). Unchecked (no fact) without timestamps or on any refusal. Device::settle_view_check, view_costs (ViewCosts, ViewVerdict), view_check_report. - Timing: creation never waits. Device::compile_device returns the description's compile device until the check answers with a fact, then the one with the facts measured (made before the answer is published, held in the line's Invariant); a recorded answer applies from the first pipeline. pipeline::Sources reads the compile device once per creation or variant, so one compile and its link never straddle the answer. The runtime's own tests fix the facts (DeviceOptions::view_facts, cfg(test), default none) unless a test runs the check; it replaces compile_as. Tests: device::tests::profile view_facts_come_from_the_measured_set_alone (no committed profile nor the 3090/2080 IDs carries either fact by identity; each measured set its own fingerprint); engine_lane_reads (the fact from the measured set on NVIDIA's and RADV's captures; NVIDIA identities without it keep UniformWords; both facts compose: Storage / UniformTexel / UniformWords); engine_access (the texel form for an indexed read, a constant offset keeps the uniform buffer, nothing measured keeps it); bind::view_check validity on every committed profile; runtime view_check::tests (facts on both sides of each bound, the measured GPUs' ratios, the record round trip, the measured compile device and its fingerprint); view_check_device (lavapipe: settles Measured with its medians, the compile device carries exactly its facts, a later device reads the record); uniform_texels on indexed inline kernels under fixed facts. Docs: API.md (DeviceDescription::measured, the texel form's indexed-read rule), runtime README (the check, its cost, its verdicts, when translation takes them), FAST-PATHS known gap, api signatures blessed, api_surface entries, REFUSALS regenerated (unchanged). Verified so far: msi job m3-max-38239 at 5d493d44f7: clippy -p metal2vulkan -p metal2vulkan-runtime --all-targets --all-features -D warnings CLIPPY=0. With it (folded): View check: the inline kernels' module metadata llvm-as takes; the windows' descriptor alignment checked The engine_access and uniform_texels inline kernels named llvm.module.flags and air.version with the version tuples of air.version and air.language_version, which llvm-as rejects (msi job m3-max-38254: engine_access's texel test panicked in assemble_text). The view check refuses a window or out buffer whose VkBuffer offset lies off 256 bytes, the most any descriptor offset alignment Vulkan bounds may ask, rather than write such a descriptor. Verified: m3-max-38239 (msi) at 5d493d44f7: clippy -p metal2vulkan -p metal2vulkan-runtime --all-targets --all-features 0. m3-max-38262 at f941e38fab: clippy --cfg m2v_cpu_icd (runtime) 0; lavapipe 21/21 (uniform_texels, uniform_bind_offsets, view_check_device, view_check unit tests); lavapipe verdict Measured, no facts (per-lane storage/UBO 1.17-1.44, texel/UBO over imported pages 1.99-2.30, fields texel/UBO 1.99-2.09; the check took 267-487 ms; a second device read the record). m3-max-38254 at 46e4aaab03: translator 146/147 (engine_access's inline IR, fixed in the second commit). clippy --cfg m2v_gpu, rustdoc, the translator rerun and the device verdicts (2080, 780M, XTX, 3090, Iris) run after the merge. |
||
|
|
2911334351 |
RUNTIME 2491: A discrete host's small Managed ranges go to the GPU inline in the command stream
WIP: the mechanism, the counter, tests and bench; the bound and docs follow. Measured bound (managed::INLINE_BYTES = 16 KiB; release managed_inline_bench, 200 one-dispatch command buffers, p50 GPU us, copy against inline): RX 7900 XTX (m3-max-38126) 64 B 11.7-11.8 vs 10.2-10.3, 4 KiB 12.2-12.3 vs 11.0, 16 KiB 13.8-13.9 vs 11.0-11.1, 64 KiB 20.8-20.9 vs 11.2; RTX 2080 (m3-max-38161) 64 B 36.4-37.0 vs 31.1-31.6, 4 KiB 38.5-39.1 vs 31.7-32.3, 16 KiB 44.7-45.4 vs 39.4-39.9, 64 KiB 69.5-70.0 vs 70.5-71.0 (inline loses). Unaligned ranges keep the copy: widening them would put the host copy's bytes over GPU writes beside the range. New WorkCounts::managed_ranges_inlined. RUNTIME_VERSION 2491. Verified: msi m3-max-38118 at 7094cdbcd3: clippy -p metal2vulkan-runtime --all-targets --all-features -D warnings plain 0 and --cfg m2v_gpu 0; 5f78fe489a compiled in m3-max-38132. managed_inline (bytes at 4 B, B, B+4, 65540, unaligned ranges, a range named twice, GPU-filled neighbours kept, bound 0 the negative control with 0 inlined) plus the Managed, host-RAM and copy suites: 61/61 on the XTX (m3-max-38126) and 61/61 on the 2080 (m3-max-38161). Lavapipe has unified memory, so it never takes this path. The 3090 bench and --cfg m2v_cpu_icd clippy and rustdoc follow. |
||
|
|
8f1e4157d8 |
RUNTIME 2490: Command queues sharing a VkQueue take fair turns: a queue's own work in flight there is bounded
What: a new DevicePolicy field, queue_turns. Under QueueTurnPolicy::Fair (the
default), on a VkQueue that two or more command queues hold, a batch of a queue
not made unshared goes only while less than 2 ms of its own queue's expected GPU
work is in flight there (16 ms while no other command queue took a batch there
within 50 ms); else the scheduler holds it in its place (HeldFor::QueueTurn) and
a later commit of another queue that shares nothing with it goes first.
QueueTurnPolicy::CommitOrder keeps the old behaviour: every ready batch at once,
in commit order. exact_answers() keeps Fair.
Why: on a device with one graphics VkQueue (RADV, ANV, lavapipe, Intel's Windows
driver) every ready batch went to the VkQueue at commit, so a command buffer a
second queue committed after one queue's burst (a long command buffer cut into
parts, a backlog of frames) waited for the whole burst. The unshared hold
protected only queues made unshared, and released the other queues' held
batches in commit order, so a later plain queue still waited behind the whole
burst, only paced. Metal ran a second queue's small command buffer beside a
first queue's 200 ms one (the consumer's oracles, UHD 630 and 5300M).
How: the VkQueue's flight (unshared_hold.rs) now counts each plain queue's
batches in flight and the latest two submitting queues; Flight::own_ahead
prices each of a queue's batches at its expected run now (a longer run prices
the rest of a burst at once), credits the running oldest only where it is the
queue's own, and holds a queue with no run seen to one batch. Under Fair every
batch enters the flight. The scheduler's look holds a head for its turn beside
the unshared hold (same gate and timer wake, await_room); a committing or
waiting thread's pass leaves such a head to the scheduler's thread
(LeftAtCommit::Turn). New counters: heads_held_for_queue_turns,
heads_let_go_turn_idle, scheduler_at_commit_left_turns. Unshared queues are
never held for a turn. FAST-PATHS gets the row; its known gap now says what
remains (a submitted batch runs to its end).
Tests: tests::queue_turns (the flight's turn math: two budgets, a later queue
not held by another's burst, repricing against the unshared bound, no run seen,
the oldest's credit, published completions); the existing unshared_hold unit
tests on the new flight API; queue_share_device::
a_later_queue_s_command_buffer_takes_its_turn_ahead_of_another_queue_s_burst on
a device under both values (Fair: the small one before the burst's fourth, heads
held; CommitOrder, the negative control: after the twelfth, none held);
fast_paths' ledger choice, keys-no-profile and exact_answers tests. API
signatures blessed; REFUSALS.md unchanged.
Also: the queue_share example's --turns fair|commit-order; the conformance probe
cross_queue_burst_turns.m (not yet run); the queue-sharing and unshared-hold device tests pin
CommitOrder so they keep testing their own mechanism. Public: QueueTurnPolicy::{Fair, CommitOrder},
DevicePolicy::queue_turns, WorkCounts::heads_held_for_queue_turns / heads_let_go_turn_idle /
scheduler_at_commit_left_turns. Default Fair per the owner's 11-03 decision (isolation outranks peak
rate); CommitOrder is today's behaviour. RUNTIME_VERSION 2490.
Verified: m3-max-38127 (msi, 37143cedda): clippy -p metal2vulkan -p metal2vulkan-runtime 0; fast_paths,
api_surface, api_signatures 51/51; queue_turns, unshared_hold, queue_share unit tests 32/32. At
079c3b7635: m3-max-38140 workspace clippy 0, rustdoc 0; m3-max-38142 --cfg m2v_gpu clippy 0;
m3-max-38141 (lavapipe) --cfg m2v_cpu_icd clippy 0, queue_share_device + queue_turns + unshared_hold +
scheduler_held_wakes 47/47: a_later_queue_s_command_buffer_takes_its_turn_ahead_of_another_queue_s_burst
passes under both values (Fair: the small CB starts before the burst's 4th, held > 0; CommitOrder, the
negative control: after the 12th ends, held 0). The 780M numbers for the row follow.
|
||
|
|
d8b39b12d1 |
SEMANTICS 2141 / RUNTIME 2481: Read short constant windows through uniform texel buffers on the Iris Xe
What: on a device whose profile takes the new cost fact DriverWorkaround::ExternalUniformReadsSkipACache (ANV on the Iris Xe of RPL-P alone), a buffer slot's uniform view whose window the translation bounded to at most TEXEL_WINDOW_BYTES (4 KiB) is declared as a uniform texel buffer (UniformConstant image, Dim Buffer, Sampled 1, u32 texels) and read with OpImageFetch; the plan's form is DescriptorView::UniformTexel, its descriptor UNIFORM_TEXEL_BUFFER, its use class Sampled, its range the uniform view's own under minTexelBufferOffsetAlignment and maxTexelBufferElements. Every other uniform view stays a uniform buffer exactly as before. The runtime makes an R32G32B32A32_UINT view of the planned range for each write, with no cache, holds it until the command buffer completed (State::retain_own, which also keeps an indirect chunk that made one from being kept), and binds whole a draw rebound or carried at such a slot. The zero buffer takes the uniform texel usage, and upload regions align to the texel offset alignment too. ARTIFACT_FORMAT_VERSION 525 (DescriptorView gains a variant); SEMANTICS_VERSION 2141, RUNTIME_VERSION 2481. WorkCounts: uniform_texels_bound; uniform_buffers_bound_to_16k (a bound buffer's uniform view written as a uniform buffer, window at most 16 KiB: on the Iris the 4-16 KiB ones); uniform_buffers_bound_past_16k (longer, or not bounded). Why: ANV gives external memory MOCS 61 on Gen12.0, which loses the HDC L1 that uniform buffer reads go through; the sampler path keeps its cache. On the Iris, a UBO over imported memory ran 2.0-2.5x (and 5.2-5.5x for a divergent index) the time of device memory, a uniform texel buffer 0.98-1.04x (jobs m3-max-37703, 37729). The window sweep (37753, 37780) set B: at 1 and 4 KiB texel-set was no slower than ubo-set on device memory in every pattern; at 16 KiB one row was 3.1% slower; from 32 KiB per-lane patterns 2.8-4.2x. B = 4 KiB covers the consumer's binds only where the kernel's window (its struct size or accessed hull) is at most 4 KiB. The counting walk counted buffer sizes, not windows, so the new counter will tell. The cost of a view per write: vkCreateBufferView+vkDestroyBufferView 0.082 us on the Iris (mean of 4000), vkUpdateDescriptorSets 0.007 us against a uniform buffer's 0.024. A set 0 naming a fresh view is found again by no later command, so such commands lose set-0 reuse. Tests: engine_access (the texel form's module, its interpretation at residuals 0, 4, 16 and 256, the window bound, the slot's plan), the profile fact's carriers, and a lavapipe test whose compile device takes the Iris's identity (cfg(test) DeviceOptions::compile_as): offsets 0, 4, 16, 256, 260, set*Bytes data, bytes written before encoding, after it and by a blit, and a 4100-byte window kept as a uniform buffer, with the counts as evidence. Also: the fixture uniform_texel_windows's AIR companions (job m3-max-37901); a texel form's loop-invariant fetches move out of their loops as a uniform block's loads do (spirv::hoist, with its test); the texel form documented (ARCHITECTURE, FAST-PATHS, view docs, runtime README); the API signatures blessed. Verified: msi job m3-max-37946 at 00121399e7: fmt check 0, clippy (plain, --cfg m2v_gpu, --cfg m2v_cpu_icd; --all-targets --all-features -D warnings) 0, rustdoc -D warnings 0. Touched suites running in the same job. Golden table and engine fixture inventory re-bless on development. |
||
|
|
8bcaf69f1d |
RUNTIME 2475: Compute dispatches instantiate over the commands their bind state kept
What: BindingPlan::instantiate_dispatch_into writes a dispatch's commands over a kept DispatchCommands, every field set as instantiate_dispatch sets it, the vectors keeping their storage: each region's specialization (spec_key_into, region_specialization_into) and push write's bytes, the argument table's bytes, the ranges, extents, holes and uses. instantiate_dispatch is that method over no commands. The regions a dispatch plans take no list of each axis's pieces (`Pieces`, numbers alone). In the runtime, compute::Instantiated keeps its commands as storage when a value they may read moves, and a direct dispatch that instantiates writes over them where nothing else holds them (the memo entry they were taken into is replaced first: a dispatch that instantiates settled anew); builds with debug assertions instantiate afresh and compare. WorkCounts::dispatches_instantiated_in_place counts them. Why: a guest's compute encoders bind their buffers at moving offsets, one dispatch an encoder, so their kept commands never serve again (reims's Iris walk: 96.6% of dispatches instantiated anew). Profile (msi lavapipe, dispatch_chain --host 400 --only encoders --dispatches 5 --groups 64 --states 3 --binds tex-moved, calling thread): instantiate_dispatch 5.6% of its CPU, about 600 ns a dispatch, of it translator instantiate 3.4%, regions 1.6%, region_specialization 1.1%; about fifteen allocations each instantiation. The commands read the buffer bindings that move, so no memo of them is exact for this shape: the cut is the work of making them. Verified: tests::bind::dispatch's instantiating_over_kept_commands_gives_a_fresh_instantiation (more regions, fewer, none, another state, the key's storage kept); compute_instantiated's encoders_of_moving_offsets_instantiate_over_the_kept_commands (five encoders of one command buffer: 5 instantiated, 4 in place, each writing at its own offset), on lavapipe. Checks at the lane tip d52118ce95 (msi): clippy -D warnings --all-targets --all-features for metal2vulkan and the runtime, plain (m3-max-37686), m2v_cpu_icd (37688) and m2v_gpu (37689), all 0; rustdoc -D warnings 0 (37689); the translator bind::dispatch, plan::compute and graphics tests 42/42 (37686); the runtime compute, dispatch and encoder tests on lavapipe in a debug build, so every in-place instantiation was compared with a fresh one, 244/244 (37688). gem10 lavapipe m3-max-37685: dispatches_instantiated_in_place 0.80 a dispatch on the tex-moved row, every instantiation; that run's timing was unusable (rows the change does not touch moved more than the cut); one interleaved timing run follows. With: dispatch_chain: an encoder's dispatch binds as its command buffer's dispatch index says (aac8651f23): at development the encoders shape never moved offsets or swapped textures. |
||
|
|
3a3d31c374 |
RUNTIME 2470: Rebinds: a rebind before the submission of an encoder no rebind encodes again is refused
A rebind between a command buffer's commit and the submission of its last event group, of a buffer an encoder of it named that keeps no log (a compute encoder its unit of command predication reaches past, a loop's laying, a render encoder opened while no buffer over host pages existed), failed that submission EncodedUseRebound: the commit let go of its holds, and nothing encodes the encoder again. The consumer's answer table ends the VM on that kind. Now the rebind is refused instead (EncodedUses), and the command buffer runs over the pages it was encoded over. - State::keep_replays also answers whether an encoder that keeps no log (not one its commit fails, which runs nothing) named a buffer over host pages, by its own commands or by work it left for later not recorded on the GPU alone (State::unlogged_names_a_pin). - Where so, the commit keeps the command buffer's holds (State::held_to_submission) instead of letting them go: Holds::hold_to_submission moves each from Entry::pending to a new Entry::unsubmitted under one lock of `buffers`, so no rebind falls between. They go as the last event group's first batch is submitted (State::first_submission, State::later_group), or at completion; a rebind after that keeps the old pages for the submitted work, as before. - replace and the rebind's first check refuse while `unsubmitted > 0`, counted as their own reason: WorkCounts::rebinds_refused_unsubmitted. - Cost: nothing new for a command buffer whose encoders a rebind encodes again (one pass over its ended encoders' flags at the commit, inside keep_replays). A host-step command buffer keeps holding to completion (steps_hold), unchanged. Deadlock audit, by lock: - Commit: hold_to_submission takes `buffers` under the command buffer's `state` lock: state -> buffers, the order encode_moved's Submitting and the commit's own clear of its holds already take. - Submission: the holds go under the scheduler's lock and `state`, after the `Submitting` guard (`buffers`) was dropped; each Holds' drop takes `buffers` alone: scheduler -> state -> buffers, the order the submission's judging already takes. Never under `buffers` itself. - Completion: moved out of `state` and dropped after its lock, with the submitted holds. - Nothing waits on them: a rebind finds `unsubmitted` and is refused; no wait is added anywhere, so no cycle can form. Tests (lavapipe): rebind_races gains a control (the predicated family committed behind an unsignaled shared-event wait, rebound before the signal: refused, completes over the old page, refused-unsubmitted 1), and the threaded run asserts no command buffer fails EncodedUseRebound. Tests that asserted the old outcome of such a rebind now assert the refusal and a completion over the old pages: pending_rebind, rebind_loop_check's rebind before the laying's submission, tile_rebind_making_wait's unlogged tile pass, and validation's rebind_reach test of a unit's encoder that laid its first step. The validation lane no longer has a test that announces encoded-use-rebound (degrade_notices says so). Docs: rebind.rs module docs (ordering rule, a predicated loop's laying), Buffer::rebind_bytes_no_copy, RebindProblem::EncodedUses, the encoded-use-rebound catalogue entry and its declaration, runtime README; api_signatures blessed. Follow-ups in the same landing: Rebinds: a state's reset takes held_to_submission fresh too; Rebinds: clippy (append, take) in the hold-to-submission moves. Checks (lane rebindsafe2): clippy plain (runtime, validation) 0 at 5bfab2beaa in m3-max-37364; lavapipe runtime tests 356/356 at a0fc57f283 (m3-max-37354: rebind, detach, host_page, host_step, indirect, predication, pending, holds, encoder_fold, deferred_calls), the new control refused with refused-unsubmitted 1 and the threaded run asserting 0 EncodedUseRebound. Validation lavapipe (m3-max-37365), rustdoc and the cfg clippy runs follow on development. |
||
|
|
5acd27cd0d |
RUNTIME 2468: Rebinds: a call of an encoder the runtime cannot encode again never races a rebind
After RUNTIME 2465 a rebind racing an encoder call on another thread is detected and the encoder encoded again; one the runtime cannot encode again (a compute encoder its predication unit reaches past, one that left a GPU-written indirect dispatch to its host step, a render encoder that keeps no log) failed EncodedUseRebound at submission instead, which a consumer's answer table treats as fatal. The protocol: those encoders' calls are gated, so no publish overlaps one. - Rebinds gains `calls` (gated calls under way). A gated call begins (`Holds::begin_call` -> `CallGate::enter`): calls += 1, then reads `open`; where a publish is open it backs off and waits for it to close (`wait_published`), before it reads anything of a buffer over host pages. - A rebind's publish now opens before its replace (`Rebinds::quiet_calls`): open += 1, then reads `calls`; where a call is under way it waits for the calls to end (`drain`/`drained`), up to CALLS_DRAIN (2 ms), and is refused past it (EncodedUses, Unreplaced::Calls), never failing the encoder later. The four accesses are SeqCst (a store-buffering handshake: of a rebind and a call that meet, at least one reads the other's rise), so each gated call reads the buffer wholly before the publish (holding it, which refuses a rebind until its commit) or wholly after its close. Chosen over the registry lock: the call side costs two atomics and takes no lock. - Which encoders: every compute encoder, and a render encoder that opened with no log. A compute encoder can become unreplayable mid-encoding (the call that records predication, a loop's record, an unbalanced record that leaves work out, a later encoder of its unit that lays a loop, a dispatch left to its host step), after earlier calls ran: a gate that started at that transition would leave those earlier calls racing. So the gate covers a compute encoder from its open. Blit encoders always log, and render encoders with a log, stay re-encodable and pay nothing new. A device with no buffer over host pages pays one Relaxed load per gated call (`any`). - Nesting: a thread-local depth, so a call an encoder's call makes of its own public calls (a blit's unlogged calls, a loop's copies) never waits. - WorkCounts: rebinds_refused_calls_in_flight (the retry rate), encoder_calls_held_by_rebind, and encoders_raced_unreplayable (raced encoders committed with no log: each fails EncodedUseRebound; zero now). Deadlock audit, extending 2465's, by lock: - `drain`: taken by a rebind waiting for the calls (no other runtime lock held: rebind_host_pages holds no lock across replace) and by a gated call's end, which holds none of the runtime's at its end. Nothing is taken under it. - `buffers`: `unopen` takes it alone to lower `open` and notify `closed` (so a waiter between its check and its wait cannot miss it); a gated call's back-off waits on `closed` under it, holding at most its render deferral's `lowerer` lock (lowerer -> buffers is the order holds already take). No publish step takes `lowerer`; the rebind's `lower_all` runs before the publish opens. - The rebind's wait for calls is bounded (2 ms), so a gated call under way that waits on a thread held at a gated begin (a render end waiting for its lowering) ends in a refusal, not a deadlock. A gated call waits only as it begins, never under way, and the publish waits for nothing an encoder holds (2465's audit), so every begin's wait ends when the open publishes close. Docs: the Safety text of Buffer::rebind_bytes_no_copy and Heap::rebind_bytes_no_copy, the rebind.rs **Other threads** bullet and RebindProblem::EncodedUses state the new outcome: refused, never failed later, for the gated kinds. api_signatures.tsv gains the three fields. Tests (src/tests/rebind_races.rs): a pause-point control (a predicated dispatch, Unlogged::Predicated, held at its hold while the main thread rebinds: the rebind refused, the command buffer completes over the old page, refused-for-calls 1); the threaded run gains a predicated family and a host-step family (an indirect stage-in region, Unlogged::Segments), and asserts encoders_raced_unreplayable == 0. Follow-up in the same landing (cc0b4592a3): Rebinds: the refusal reason carries no pages (clippy: field never read). Unreplaced::Held and Unreplaced::Calls no longer give the new pages back: replace drops them once the registry's lock went (unopen drops the guard first), as the caller's map_err dropped them before. Also the docs of the encoded-use-rebound notice (degradation.rs, docs/API.md) and the runtime README say which encoders still fail it after a race (a blit or logged render encoder whose commit failed it, or whose encoding again a call that answers otherwise refused) and that gated calls never race. Verified: m3-max-37298 (msi) clippy at ec3cbb49c7 failed on exactly these two fields; the next job checks this commit. Checks (lane rebindsafe2): clippy plain (runtime, all targets, all features) 0 at cc0b4592a3 in m3-max-37302; lavapipe rebind/detach/host-page/host-step/indirect/predication/pending/holds suites with the gated control and the six-family threaded run in m3-max-37299 (ec3cbb49c7, same library code), the gate-off negative control, clippy GPU/CPU-ICD cfgs and rustdoc follow on development. |
||
|
|
2bafb6537a |
SEMANTICS 2138: Fragment simdgroup lane: run it on Cluster32 tiers, refuse it only below 32 lanes
What: a fragment function that reads [[thread_index_in_simdgroup]] on a profile
without DriverDeviation::MetalFragmentSimdgroups was refused Unsupported{SimdWidth}
on every tier but Direct. It is now refused only on Tier::PartialFragment (fragment
subgroups narrower than 32). On Tier::Cluster32 (a 64- or 128-lane fragment stage,
e.g. RADV on Polaris, wave64 only) the lane is the subgroup lane's low five bits.
Why: the guest is told an Apple GPU's width, 32 (threadExecutionWidth 32,
[[threads_per_simdgroup]] the constant 32), and its shaders are built for 32-lane
simdgroups. On Cluster32 each aligned 32 lanes of the device's subgroup is one
simdgroup. The function's simdgroup operations already ran there, and the emitter
already gave the lane as L & 31 (group::Lane::metal), the same cluster the shuffles
and ballot words use. So the device lacked nothing; the refusal was ours. The lane
is the device's grouping, which Metal allows, and records the existing
PrecisionNote::FragmentSimdgroupGrouping as before.
Tests: engine_simd's fragment-lane test also runs on wave64() (the committed RDNA3
description narrowed to 64 lanes) and requires every lane form to compile there on
Cluster32 with the note, the low-bits mask and L3. Without the fix it is refused and
the test panics. Device test fragment_simdgroup_lanes_are_metal_s accepts the
SimdWidth refusal only where the fragment stage's sizes are all below 32, so on a
wave64-only device it fails without the fix; it also prints the stage's sizes.
Docs: the note's text in docs/API.md and PrecisionNote, the doc comments in
lower::simd. SEMANTICS_VERSION 2137 -> 2138. REFUSALS.md regenerated, unchanged.
Checks (lane simd64): msi m3-max-37237 clippy plain 0, tests 88/88 (engine_simd, public_fixtures_engine, fast_paths, device::tests::subgroup); m3-max-37255 clippy GPU and CPU-ICD cfgs 0, rustdoc 0. The RX 550 run (m3-max-37259) follows on development.
|
||
|
|
372cf95641 |
RUNTIME 2465: Rebinds: an encoder call that races a rebind on another thread is encoded again
rebind_bytes_no_copy (Buffer and Heap) may now run while other threads encode and
commit command buffers that use the buffer or heap. Before, the Safety contract
excluded that; this lifts it.
The windows found:
- W1: an encoder call reads a buffer's pages before it holds the buffer. A
dispatch builds its bind state, a draw its tables, and a blit reads the
VkBuffer for a copy run that records in a later call. A rebind can land
between that read and the hold. The hold then pins the new pages while the
commands name the old ones.
- W2: what lies over the bytes (aliasing images and their views, texel views,
the heap sets' elements) is made over the new pages only after `replace` has
let go of the registry's lock. A hold in that gap pins the new pages over
half-made state.
- W3: the render lowering thread does the same reads, later.
- W4: an encoding again (`replay.rs`) can run under a concurrent rebind of
another thread. This one is a live defect under today's contract: a commit's
rate-map or split re-encode, and one rebind's turn racing another buffer's
rebind.
- W5: a texture made over the bytes during the call stays excluded.
The change: detect, then encode again. Nothing waits on the encode path.
- Each rebind's publish runs from `Rebinds::replace` to a new
`Rebinds::published`. `published` is the close, after `renew_over`. It is
tracked by a per-device count of closed publishes (`published`), a count of
open ones (`open`), and `Entry::publishing` / `Entry::published`.
- Every encoder call loads that count as it begins (`Holds::begin_call`: one
Acquire load of an AtomicU64). The sites: compute and blit `logged`,
`end_encoding`, the five predication calls, render `Lowering::logged`, the
deferral's `at_call_unit`, the replay dispatcher and `open_render`, which
reads the count before it reads the attachments.
- A hold or pin finds the call raced when the entry's publish is open, or
closed after the call began. A raced Taken counts as rebound
(`Submitting::rebound`), so the commit encodes its encoders again before the
first submission (`State::raced_again`), as for a rate-map reset.
- `reencode` loops: when an encoding again itself raced, it waits until no
publish is open (`Rebinds::wait_published`, a condvar on `buffers`) and
encodes again.
- The close marks again the command buffers committed while the publish was
open, so their raced encoders are encoded again over finished state.
- An encoder the runtime cannot encode again whose call raced fails
EncodedUseRebound at its submission. These are the existing list: a compute
encoder its predication unit reaches past, one that left a GPU-written
indirect dispatch to its host step, a blit or render encoder opened while no
buffer over host pages existed, one whose commit fails it, and one with a
call that answers otherwise. A rebind that no encode overlaps changes
nothing for them.
- New WorkCounts::encoders_raced_rebind counts the encoders marked stale this
way.
- `blit_at` holds the buffer before it reads its VkBuffer, because a copy run
records in a later call.
- `replace` refuses a second rebind of a key whose publish is open
(EncodedUses).
What the publish window covers:
- Inside it: `live_buffers.rebound`, the alias leave/hold/place, the image
swaps and parking, the texel views, `forget_stale` and `renew_over`.
- Moved after the close: dropping the read twins (`drop(twins)`), dropping
the old pages (`drop(old)`, which reaches vkDestroyBuffer/vkFreeMemory and
the deallocator), `release_held_back`, `heap_sets::retire` and the
encodings again.
- What a later pin judges against: the old pages' twins and the stand-ins.
- Not covered: the import of the new pages and the images made again over
them before `replace`. These are the rebind's own and are invisible to
other threads until `replace`.
Deadlock audit, by lock:
- `rebinds.buffers`:
- `hold` and `pin` take `buffers`, then the cell's `pages` (`lying`), and
hold nothing across them.
- `replace` takes `buffers` -> `waiting` (`mark_waiting`) and `buffers` ->
`pages` (`cell.replace`).
- `published` takes `buffers` -> `waiting`. `mark_reencode` is an atomic.
- No thread holds `waiting` or `pages` and then takes `buffers`.
- The existing `state` -> `buffers` order (`encode_moved`'s `submitting`)
is unchanged. Neither publish step takes a command buffer's state lock.
- `wait_published`: its callers hold only the command buffer's `reencoding`
turn. These are the commit (after its state and slot locks are gone) and a
rebind's or commit's `reencode`. No publish step takes a `reencoding` lock
or waits for one. A publish waits for nothing: these take no lock an
encoder holds across a hold:
- `live_buffers.inner`;
- `aliases`;
- the image swap and view locks (`Image::swap_in`);
- HostPages `parked`;
- `rebinds.stale`;
- the texel views;
- `heap_sets`: `passing_hold` and `heaps`, whose writes are deferred while
`heaps.holds > 0`, with no wait.
So every wait ends as soon as the open publishes close.
- The test pause points (`rebind::pause`, cfg test) stop at the hold, with
no runtime lock held, and in the publish after `replace` has let go of
`buffers`.
Docs:
- The Safety text of Buffer::rebind_bytes_no_copy and
Heap::rebind_bytes_no_copy states the new contract and outcomes. Still
excluded: another rebind or a detach of the same buffer or heap, a texture
made over its bytes, and a resource placed in the heap, during the call.
- The rebind.rs module docs gain an **Other threads** bullet.
- Also updated: the EncodedUseRebound declaration and its docs/API.md
catalogue entry (the cost text is unchanged), the `renew_over` doc and the
runtime README.
- api_signatures.tsv gains the new field.
Tests (src/tests/rebind_races.rs, device tests):
- A pause-point control at the hold: a dispatch that read the bound buffer
before its hold, with a second buffer keeping the old import. Expected: the
new page's output and one raced encoder.
- A pause-point control in the publish: a dispatch reading a texture over the
buffer.
- A threaded run: four families (a dispatch of a texture over K, a draw with
K as a vertex buffer, a blit copy from K, and a dispatch bound a call
before) against a rebinding thread. Each output must be wholly one page of
those K lay in meanwhile, or EncodedUseRebound.
Hot path: one Acquire load per encoder call (begin_call) plus one compare
under the lock the hold already takes. Per-call numbers follow in the bench
commit or report.
Also folded: the threaded run reports the pages its outputs read and each wrong output's reason
(060e8219f0); and a publish's close counts as a move (buffer::host_cells_settled), so a binding read
during the publish (a texel view for one) is not kept under the post-replace count and reused
by a later encoder that did not race; debug checks (check_reading, compute check_whole,
KeptSpaces::of) hold off where a call may have raced (rebind::call_may_have_raced, debug only)
(0c7a7a5c98).
Verified (lavapipe, msi): m3-max-37154 at 0c7a7a5c98: clippy plain and --cfg m2v_cpu_icd 0;
rebind*, pending_rebind, degradation*, argument_table, live_bind 41 passed; the hold and publish
controls raced 1 and completed; the threaded run (4 threads x 25 command buffers: a dispatch over
a texture over the buffer, a draw with it as vertex buffer 1, a blit from it, a dispatch bound a
call before) read every output wholly from one page, 0 EncodedUseRebound, 63 rebinds made, 1,537
refused (EncodedUses), 5 encoders raced, 11 encoded again. Negative control m3-max-37156 with
Entry::raced forced false: the hold control fails (the dispatch read the pages the buffer left).
|
||
|
|
ba311896eb |
SEMANTICS 2137: Iris: a loop-uniform read-only slot stays a storage view (undo SEMANTICS 2136)
What: reverts |
||
|
|
3de483d86f |
RUNTIME 2459: Joined completions: a command buffer marked to join the next groups under Exact
CommandBuffer::set_completion_joins_next marks a command buffer, before its commit, as one whose completion may be seen with the next one's. Under CompletionPolicy::Exact, on a device whose merge check holds and whose queues are not relayed, a marked command buffer's batches wait in the scheduler's group as every batch does under Grouped. The first batch of the VkQueue behind them that is not marked goes last in that group, which then goes at once (GroupEnd::Closed, WorkCounts::group_ends_closed), so it is seen complete at its own end and never held back. Its submission check runs with the marked ones' (check_heads), so they are found ready together. No group is kept past its pass under Exact (Alone::Unkept, WorkCounts::batches_held_alone_unkept): a kept group can reach the GPU after the work ahead of it ended, which would delay the unmarked one behind it. Everywhere else (Grouped, no merge, relayed queues, the encoder trail, batches that never group) the mark changes nothing. Why: on the Iris Xe, ANV on i915 lists every VkDeviceMemory in each execbuffer, about 170-190 us of driver time a vkQueueSubmit at the consumer's import count, and the consumer cuts each guest command buffer into about 12 parts committed under Exact, one kernel submission each. In its walk the GPU sat idle about 1.5 ms per waited guest buffer between parts already committed, behind a backlog of those calls. The consumer will mark every part but the last of a cut whose completion nothing observes. Grouped-completion's notice, docs/API.md's catalogue, FAST-PATHS row 38, the runtime README, CompletionPolicy::Exact's doc, api_signatures and REFUSALS say so. Tests: runtime_lane::joined_completions (marked parts group and a group is closed by the last; checked parts too; a no-op where the device's own check finds no merge; unmarked parts go alone; an unmarked command buffer is seen complete while the long one behind it still runs, the marked one before it complete by then), on lavapipe with the merge assumed. Joined completions: the cost table's length, and the order test's first work done before The conformance cost table's SHARED list holds 36 rows with batches_held_alone_unkept. In the order test the marked command buffer took the new buffers' first work, which no batch in a group takes, so it went alone and nothing grouped: the buffers' first work now runs before it. Verified: clippy and lavapipe lane job m3-max-36769 showed the failure (grouped 0 with grouping true); the rerun is the next job. Verified at 8e6c37c263: m3-max-36784 (msi) clippy --workspace --all-targets --all-features 0; m3-max-36785 (msi, lavapipe, --cfg m2v_cpu_icd) joined_completions + grouped_submissions + alone_batches 21/21 (marked parts under Exact with the merge: 7 command buffers in 2 submissions; unmarked: 7 submissions, 0 grouped; lavapipe's own merge check, not Holds: 0 grouped; an unmarked buffer is seen complete at its own end). The Iris merge check answers Holds (m3-max-36725: 9.6 us in one call of 4 against 26.4 us apart). Release-mode lavapipe, clippy --cfg m2v_gpu and m2v_cpu_icd and rustdoc run after the merge. |
||
|
|
a552a55d1f |
SEMANTICS 2136: Iris: a kernel's loop-uniform read-only slot is a uniform view
What: a new cost fact, DriverWorkaround::UniformAddressStorageReadsSlow, derived for ANV on the Iris Xe RPL-P alone. On a profile that takes it, with robust descriptors: - the memory plan finds a kernel's read-only slots read in a loop at a per-instance uniform offset (SlotPlan::uniform_loop_reads); the loop forest and the per-instance uniformity run only there (memory::plan::marks_uniform_loop_reads), nowhere else; - lowering (lower::access::loop_uniform_views) reads such a slot through a uniform view in place of its storage view when the slot is also one unwritten_slots admits: an argument the AIR declares unaliased (air-buffer-no-alias) that no store, atomic, volatile or coherent access reaches, so no write of the dispatch lands on it and the view reads the bytes the storage view would. No aliasing fact, no bind-time check, no runtime change; - the view is sized as Profile F's fallback sizes its views (fallback_view): its window's range, or maxUniformBufferRange where the window does not bound it. Then the slot states RuntimeFact::UniformViewRange as Viewed and no BufferRangeLimit, so a plan whose shape binds a buffer whose length class does not fit asks for the existing storage_view_slots variant, whose compile keeps the slot a storage view and states it Kept (a fixed point). That variant is made only for such a shape. Every other profile and stage is unchanged. Why: Iris job m3-max-36137 measured a convolution's weights, read in its tap loop at the loop counter, at 316.3 us per tap through the storage view and 249.0 us per tap through a uniform view of the same bytes (4896.8 and 4042.4 us a dispatch at 15 taps, 10589.8 and 8523.5 at 33). The uniform view is the one form A's walk and that arm measured fast; ftreg's twin removal ( |
||
|
|
8933378831 |
SEMANTICS 2135 / RUNTIME 2458: No storage twins: a kernel's constant buffer on the Iris reads its uniform view alone
What: the Iris Xe RPL-P profile (DriverWorkaround::PushReadsLengthenThreadPayload) declares no storage twin. A kernel's constant slot keeps its plain uniform view, read at its residual as on every device without ConstantOffsetUniformReadsPreloaded; its set-0 layout binds the uniform view alone. Deleted with it, everything only the twin used: - translator: DescriptorView::UniformWithStorageTwin, BufferForm::storage_twin, ResourceKind::StorageTwin, BindingSource::StorageTwin, AccessPlan/Declared twins and the census's twin count, storage_twins, views::declare_twin/twin_symbol, emit's TwinMem, the twin's NonWritable statement (unwritten_buffer keeps its unaliased-argument use), PlannedBuffer::twin, the second DescriptorRange, buffer_uses back to buffer_use, range_at_bind_offset's unbound twin arm, planned_range's twin exclusion, rebinds_into's twin arm, the interpreter's twin binding, the codec's variants, and BindingPlan::read_only_buffer (its only reason was the twin); - runtime: uniform_residual_form_of and reads_other_words (keyed_regions takes no flat_grid), the neutral zero buffer's STORAGE_BUFFER usage and plan-based read-only check (back to the descriptor type alone, binding::read_only_buffer); - validation: out_of_bounds's twin arms; - docs: API.md section 5's twin bullet, the workaround's profile doc, residual.rs, views.rs, ModuleBuilder::unwritten_buffer, non_writable.rs, neutral.rs, neutral_zeros_shared's docs; api_signatures.tsv drops the five items. Kept: storage views' RangeAtBindOffset at offset 0 on that profile and its creation of both forms (RUNTIME 2410), set-0 counting tests, the dispatch_chain example's arms. Why: the twins are the confirmed cause of the Iris regression. Walk A (the tip with no twins) took 137.4 s of GPU time against 145.8 to 150.2 s for three walks with twins; Face Tracking 13.50 s against 18.1 to 21.1, Super Resolution 25.78 against 28.2 to 28.4, Background Blur 4.93 against 5.7 to 6.4; Horizon Detection gives up about 1.3 s (17.78 against 16.2 to 16.8). No structural rule separates where a twin pays (ftreg's report to main). SEMANTICS and RUNTIME are bumped at landing; golden tables and the compile census are re-blessed on development. Test: engine_access::a_kernel_constant_slot_binds_its_uniform_view_alone. On intel-irisxe-rplp-anv, with and without uniformBufferStandardLayout, buffer_end_byte_load_constant's slot 0 is UniformWords/UniformVec4, its RangeAtBindOffset key is read, and set 0 links exactly slot 0 at (0,0) and slot 1 at (0,1). A plan of nothing bound writes those two alone in set 0 (UNIFORM_BUFFER, STORAGE_BUFFER), and only them on four other profiles. At development the slot is UniformWithStorageTwin and set 0 holds a third binding, so it fails. ARTIFACT_FORMAT_VERSION 524: the codec drops the twin variants. Verified: m3-max-36704 (msi) at 2b88dec3f1 clippy --all-targets --all-features 0; m3-max-36706 clippy --cfg m2v_gpu 0. Rustdoc, the translator suites, clippy --cfg m2v_cpu_icd with the lavapipe runtime tests, and the negative control (the new test at development fails) run after the merge; golden tables and the compile census are re-blessed on development. |
||
|
|
8562b28fe4 |
RUNTIME 2446: Shadows: a split merge on the host copies no piece; its kernel skips their columns
A merge on the host past shadow_merge::HOST_WHOLE_BYTES split: its host step stored the pieces of each row in lines beside the texels, and its kernel the rest. To keep the kernel off those lines, the GPU copied the pieces' kept bytes into an arena region and their changed bytes over them in the kept part: two vkCmdCopyBuffer calls of one region per piece. On the Iris Xe (ANV) that work cost about 7 to 9 us a region, growing with the rows, not the bytes: about 0.6 ms for 34 rows (m3-max-35898) and about 15 ms for 1024 (m3-max-36118: a BGRA8 1023x1024 render target over host pages drew in 17.57 ms a command buffer as a shadow against 1.26 ms in place, its host step 0.28 ms of it). Now the kernel takes a column window (bind::ShadowMergeModule: two more push words, PUSH_BYTES 24; shape_within, shape the whole row): a word outside the columns is neither read nor written in either store form, and counts as unchanged in its block. A split merge pushes the words between each row's pieces where every row's pieces lie at the same places in it (shadow_merge::columns: whole words, the same head and tail each row; rows whose pitch is no multiple of the line differ, and those merges go on the host whole). It records the changed copy and its dispatches alone, with no save, no mask, two fewer barriers and no arena region; the host step reads each piece's kept and changed bytes in the scratch's two parts, which nothing writes after the changed copy. Removed: HostMerge::saved, ShadowMerge::saves, ShadowCopy::merge_saves, the merge's region in EncoderCore::merge_on_host, MergeDrain::_region, and the split's copy uses of the kept part. The bound stays 1 MiB; its doc comment states the measured costs. Linear merges push the whole row. Tests: - bind::shadow_merge's a_region_merged_within_columns_leaves_the_words_outside_them: 70 rows of 6 words, columns 1 to 4, every word changed; words outside the columns keep the current buffer's, in both store forms, and a window of every column equals shape. - shadow_runs' merges_on_the_host_go_whole_up_to_the_bound_and_split_past_it also asserts shadow_merge_words_examined: every word of the whole merge's rows; for the split, the words between each row's pieces alone (height * (row bytes - line) / 4). - shadow_write_lines' cost test gains a 4K shape: 3839 RGBA16Float texels a row, 2160 rows 30720 bytes apart. The merge module is under no golden table (golden_hashes covers the fixtures' translations). api_signatures: PUSH_BYTES, shape, and the new shape_within. Degradation kinds added: none. Landing note: msi m3-max-36189 at 4b09425f2d (same tree): clippy metal2vulkan + runtime, all targets and features, CLIPPY=0. The API tables, the module tests, rustdoc, clippy m2v_gpu / m2v_cpu_icd, the lavapipe control (development's whole-row kernel fails the split test's words-examined count) and the touched suites, PHOENIX and the Iris re-time follow on development. |
||
|
|
c602b94223 |
RUNTIME 2444: Host pages: remove the lend of free padding to the copies; such render targets are shadows
What: a texture that renders over host pages whose rows end inside a line, with
free padding, whose renders failed, no longer takes its image in place when the
class's copies failed too. Removed: in_place::lent_to_copies and lends, the lend
branch in in_place() (it now asks each access's own verdict and nothing else),
unlent_words and the shadowed-texture notice words it added,
degrade_line_write_back and line_write_back_reason, the storage form move's lend
count and notice, Degradation::LineWriteBack ("line-write-back") with its
docs/API.md catalogue entry, the device test lent_dma_buf_targets, and the
validation lane's LINE_WRITE_BACK list. copies_verdict stays: through
InPlaceChecks::decided it now decides only whether a shadow's copies back and
merges into such pages are spliced (shadow_splice::splices). FAST-PATHS's
host-pages row and the Iris known gap are edited in place.
Why: the lend loses CPU writes Metal keeps. Both Macs kept render padding over
buffer rows (m3-max-35486 and 35487: clear-and-store and draw changed 0 bytes;
only the UHD 630's kernel changed any), and the lend's render passes write the
rows' last lines back whole on the Iris. Its stated reason was that the shadow
lost the same bytes. That no longer holds: the shadow splices its copies back
and merges on the host on such devices, and on the Iris (m3-max-35898) its
clears and draws put back 0 bytes against the copy control's 5,941 in 300
rounds. Under the user's contract rule a form that loses writes Metal keeps is
deleted, not kept behind a switch.
Guest cost, bounded by counts: the guest's Iris Forward+ boot (reims run 35408
at
|
||
|
|
c2aedcd64c |
Diagnostics: encoder times count draws again; the pass log watches states by label hash
METAL2VULKAN_ENCODER_TIMES counted a render encoder's draws only where a draw took every step: a draw drawn again as before (render/draw_again.rs) or rebound (render/draw_again/rebound.rs) bumped the encoder's draw calls but not its timed work, so a row named a fraction of its draws (a measured guest run: rows of about 2300 draws/s against about 36k indexed Vulkan draws/s). Both paths now count as the program's draws, as every step's do. METAL2VULKAN_LOG_PASSES watched only textures by format and size, and its 256-line bound was spent before the pass of interest ran: in that run every 2768x1570 pass before the measured step printed (256 lines distinct even with object IDs left out, 171 by attachments and states alone), so the pass the encoder times ranked first never printed. A `state:HASH` entry now watches a render pipeline state by the label hash the encoder times name their rows by (encoder_trail::label_hash), so a run can name exactly the pass it needs; each state in a line carries its hash, so a line maps encoder-time rows to states. The hashes are worked out only where the log watches a state or prints a line. The bound and the once-per-pass rule are as before. Both are default-off diagnostics and change no work while off. Tests: tests::encoder_times::an_encoder_s_draws_again_count_among_its_draws (draws again as before and rebound, each counted, in a line of all its draws; fails without the fix: the line names only the draws that took every step); tests::pass_log state-entry parsing, refusals and matching. |
||
|
|
528379dad5 |
RUNTIME 2439: Merge on the host whole up to 1 MiB of rows; count host steps
On the Iris Xe (RPL-P, ANV) the split merge's own GPU work (two buffer copies of the pieces beside the texels, three barriers and the kernel's dispatch) cost about 0.6 ms a command buffer for the guest's 34x34 RGBA16Float target (m3-max-35898: draw minus clear 0.69 ms, against 0.10 ms when the merge went on the host whole), while the host step's word loop costs about 0.30 ns a byte (4.97 ms for a 1920x1080 target's 16.6 MB, half its texels changed). So the split pays only past about 2 MB of rows. A merge on the host whose cut rows hold at most HOST_WHOLE_BYTES (1 MiB, half the break-even) now goes on the host whole again; larger ones split. A merge none of whose rows' lines holds a byte beside its texels still goes by its kernel alone, as on any device. The whole merge is also the exact form for the unmeasured case (a CPU write to a texel the commands left in a line whose other bytes they changed), so the known gap now applies only where the kernel stores: past the bound, and where no row's line holds a byte beside the texels. Both forms keep the measured padding contract, so there is no switch and no FAST-PATHS row. WorkCounts::shadow_host_steps counts the host steps that ran for encoders' copies back spliced and merges on the host: against command_buffers_submitted, the GPU-to-CPU round trips a command buffer pays, for a walk to read before any deferral of them. Tests: - shadow_runs::merges_on_the_host_go_whole_up_to_the_bound_and_split_past_it: over pages 16 bytes into a page, a 512x512 BGRA8Unorm target (1 MiB of rows) compares every byte of its rows on the host, and a 512x513 one each row's first and last lines alone; each one host step. - shadow_write_lines: the contract test's draw merges now compare every byte of their rows; the cost test alternates its verdict arms round by round, so clock drift and order weigh on both alike (the 1080p gap 35898 showed, equal in Clear and Draw, with the same work recorded in both arms by every count); a new test prints, for a render target whose rows end a texel short of a 4096-byte page (1023x256 and 1023x1024 BGRA8Unorm), under the device's own check and default policy, over pages imported by pointer and as dma-bufs: every host-page class's renders and copies verdicts for those row ends and its memory flags, the form the texture takes with its notices, and the median per command buffer of a clear-and-store and of a draw. Degradation kinds added: none. Verified: msi m3-max-35933 at f763e15338 (same tree): CLIPPY=0, CLIPPY_GPU=0, API=0 (15/15), release archive built. PHOENIX, lavapipe and the Iris run follow on development. |
||
|
|
438fdd4eee |
RUNTIME 2438: Merge on the host only the lines beside a texture's texels
A shadow's merge in place into host pages, on a device whose stores write back the lines they end in (the Iris Xe under ANV) or whose check has not answered, went on the host whole: the host step compared and stored every byte of the merge's rows. On the Iris that cost 12.7 ms a merge for a 1920x1080 RGBA16Float draw (17.7 ms a command buffer against 3.7 ms by the GPU kernel), and the guest's scene has about 73 such shadows. The merge now splits as the splice of a copy back does: - Its kernel stores the changed words of each row's bytes in the lines that hold the texture's texels alone (ShadowMergeStores::Words, never whole blocks). - The host step merges only each row's bytes in the lines that also hold a byte of no row of the texture's: the bytes between the rows and around them (shadow_splice::beside_texels; at most a row's first and last line). - Before the kernel the GPU copies those pieces' kept bytes into a region of the command buffer's arena, then their changed bytes over them in the kept part, so the kernel finds them unchanged and stores none of them; the host step compares the region's bytes with the changed part's. - The host step compares 4-byte words and stores a changed word with one AtomicU32 store (the changed word where all four bytes differ, else the word as it holds it with those bytes changed, as the kernel's Words form does); bytes outside whole words go one by one. - A merge none of whose rows' lines holds such a byte (rows that start and end on lines, as the 1920x1080 plane's 15360-byte rows do) goes by its kernel alone, with its fetch view and kept image where it has them. A merge not cut to its texels' rows stays on the host whole. The measured contract is the padding: row_padding_writes found the M3 Max, the 5300M and the UHD 630 keeping CPU writes to the bytes between and around a texture's rows under clears, stores and draws, and over IOSurfaces under kernels. No probe measured a CPU write to a texel the commands left inside a line whose other bytes they changed, while the command buffer runs; the kernel now stores into such lines, so that write may be put back on the Iris. FAST-PATHS's known gaps record it, beside the measured contract. WorkCounts::shadow_merge_bytes_on_host counts the bytes the host steps compared. Buffer::own_pages_flags gives a buffer's memory type flags, which the cost test prints for a buffer made as the host scratch is, beside the host loop's time over plain heap memory and over that memory (1920x1080, half the texels' red and blue changed). Tests: - tests::shadow_splice (pure): the pieces equal the rows' bytes in lines beside the texels, found byte by byte, over 9 shapes and 6 page phases (wrapping among them); the host loop stores the differing bytes alone at every alignment. - tests::shadow_write_lines: each draw merge's host step compares 16 bytes a row (the row's last texels, in its padding's line); the cost test's 1920x1080 draw no longer merges on the host. - tests::shadow_runs: the rebind test of host merges puts its pages 16 bytes into a page, so every row's first and last lines hold bytes beside its texels, and asserts the bytes compared (a line a row). Degradation kinds added: none. Also (65db6f5b40): the old device-local query, left with no callers, is gone; the probe prints the scratch's memory flags by name. Verified (fplend): msi m3-max-35872 at a5289d8132 (same tree as 65db6f5b40): clippy 0, clippy --cfg m2v_gpu 0, api_signatures + api_surface 15/15, debug and release archives built; 35850: tests::shadow_splice 5/5 (host pieces against a byte-by-byte answer over 9 shapes x 6 page offsets; the CPU word loop at every alignment). PHOENIX, lavapipe, rustdoc and the Iris run follow. |
||
|
|
2824464479 |
Storage twin docs: NonWritable states read-only memory, nothing more
What: views::declare_twin, DriverWorkaround::PushReadsLengthenThreadPayload and docs/API.md section 5 no longer say that the twin's NonWritable decoration lets ANV fold or merge its loads, or that the twin without it read more than the uniform view. They keep the fact: the twin binds the uniform view's own range of a constant buffer, which the dispatch only reads, so its views are decorated NonWritable. The decoration and its test stay. Why: |
||
|
|
518d6d8443 |
RUNTIME 2432: Shadows: merge on the host over host pages on devices that write lines back
What: a shadow's merge in place into a no-copy buffer's host pages, on a device whose check of those pages failed, or has not answered, the copies or the shader writes of texels whose rows end inside a line (the same rule as the copy back's splice), now goes on the host. Its keep and the copy of the texels the commands left go into two parts of a Shared scratch (ScratchKind::ShadowHost; the fetch view is not used, so the changed texels are always copied). The encoder records only that copy, and a host step of a batch of its own (Deferred::ShadowSplice, now carrying HostWrite::Splice or ::Merge) compares the parts eight bytes at a time and stores each byte that differs into the pages with atomic byte stores. Such a texture joins no run of passes (render.rs), so each pass merges as its encoder ends. Devices where both checks passed keep the kernel merge. Why: the Iris probe (m3-max-35510) showed the merge kernel's stores losing CPU writes to padding bytes in the line that holds each row's last texels, as the copy back did. A CPU store changes only the bytes it stores, so the bytes the commands left, and every byte the CPU writes meanwhile, stay. Metal keeps those bytes (conformance probe row_padding_writes.m). Where the merge stays on the GPU (FAST-PATHS known gaps): merges recorded between a pass's instances, before a tile dispatch, into a held command buffer, at a segment's end, merges through a copy, and the runtime's own Shared memory. New WorkCounts fields: shadow_merges_on_host, shadow_merge_host_nanos. Tests: shadow_write_lines now asserts the Draw rounds (keep + merge) put back no byte and go on the host under unanswered verdicts, and follow the measured verdicts in the second test. A new test, costs_of_a_write_back_spliced_or_not, prints the median command-buffer time of a copy back and a merge for 34x34 and 1920x1080 RGBA16Float, with verdicts unanswered and passed. Degradation kinds added: none. Verified (fplend): msi m3-max-35675 at bdb1e2cbae clippy (runtime, all targets/features, -D warnings) 0, touched unit tests 3/3, api_signatures + fast_paths 34/34; msi 35689 clippy --cfg m2v_gpu 0. PHOENIX suites (35711), lavapipe, rustdoc and the Iris cost run follow. |
||
|
|
9ea0a9c1f6 |
RUNTIME 2431: Shadows: splice a copy back into host pages on devices that write lines back
What: a shadow's copy back (Step::Back) of a 2D texture's image, or of a texture buffer's staging buffer, into a no-copy buffer's host pages is spliced where the device's check of those pages (DmaBuf or Pointer) failed, or has not answered, the copies or shader writes of texels whose rows end inside a line (Access::Copies or Access::Writes of RowEnds::InLines, Failed or Pending). The GPU copies only the columns that fill whole lines of memory (nonCoherentAtomSize): one region a slice where its rows are a multiple of a line apart, else one a row. Each row's head and tail columns go by the GPU into a line-aligned region of the command buffer's arena, and a host step of a batch of its own (Deferred::ShadowSplice, after the work before it completed) copies them into the pages a byte at a time, as the CPU's stores go. The encoder notes the truth's writes after the step. A copy whose texels fill whole lines alone copies back as before; a device where both verdicts passed copies back as before. New count WorkCounts::shadow_copies_back_spliced. Why: on the Iris Xe (ANV) a copy of texels into a buffer's rows writes back the 64-byte line holding each row's last texels whole, putting back older values over the CPU's writes beside them. The lane's probe (m3-max-35510) lost 3,539 to 14,319 bytes a kind in 300 command buffers through a shadow's copy back and merge, where Metal keeps every such byte (row_padding_writes.m). This breaks Metal's contract on the guest's bytes; the merge is the next change. Where the copy stays (docs/FAST-PATHS.md, known gaps): a copy back between a render pass's instances or before its tile dispatch, into a held pass's command buffer, at a segment's end recorded at a commit or a host step, of rotated, two-plane, tiled or heap depth/stencil textures, and into the runtime's own memory. Tests: tests::shadow_splice (the cut run as GPU and CPU over a map of host bytes: every texel once, no GPU byte in a shared line, every shape of texel, width, pitch and phase); tests::shadow_write_lines (the probe made a device test: the guest's 34x34 RGBA16Float target over dma-buf pages, buffer and plane forms, a clear's copies back put back no byte the CPU wrote beside them and are spliced; and a copy back spliced exactly as the device's measured verdicts say). Degradation kinds added: none. Verified (fplend): msi m3-max-35614 clippy 0, tests 0, signatures 0; 35623 clippy m2v_gpu 0; lavapipe 35625 clippy m2v_cpu_icd 0, 216 passed, rustdoc 0; PHOENIX 35632 (um790) in-place + shadow suites 287/287, shadow_write_lines 2/2: under the measured verdicts (Copies and Writes Passed) 0 spliced; under HostPageTexturePolicy::Shadow (no check, verdicts Pending) every copy back splices (+300 in 300 rounds, 0 bytes put back). The Iris run follows. |
||
|
|
a585a74686 |
SEMANTICS 2134 / RUNTIME 2427: A uniform view's storage twin is decorated NonWritable
What: memory::views::declare_twin states the twin's binding unwritten (ModuleBuilder::unwritten_buffer). The serializer then decorates the twin's variables NonWritable, its word view and its uvec4 view, where its own walk finds no store reaching them. No store goes through a twin: TwinMem's write, write_bits, write_unit and write_vec all refuse. Why: on the Iris profile (DriverWorkaround::PushReadsLengthenThreadPayload, ANV, Mesa 26.2.6) RUNTIME 2413 reads a kernel's constant slot through its storage twin where the slot's RangeAtBindOffset holds. The twin was not decorated NonWritable, because serialize::non_writable only takes the bindings the lowering states unwritten. ANV runs nir_opt_access (anv_shader_compile.c), which marks a storage buffer's loads reorderable only where the variable is NonWritable or the shader writes no buffer. A kernel that writes its output therefore kept every twin load apart, wherever it stood: no CSE, no hoisting, no merging. The uniform view's loads, a uniform buffer's, are always reorderable, and the driver folded them. Metal's compiler leaves a constant buffer's repeated loads for its own backend to fold. One guest depthwise convolution kernel loads its params.srcSize (<4 x i32>) four times in every iteration of its tap loop and its dstSize about ten times, and every inlined sample reads its ndArrayParams again. Read through the twin, each of those loads ran per thread. A benchmark's Iris walk rose from 754 to 1120 us a dispatch on that workload between pins |
||
|
|
59fc85ea83 |
SEMANTICS 2133 / RUNTIME 2425: OpenCL mode: a 1D image bound to a real 1D texture reads it, through a variant
An OpenCL-mode kernel declares each image1d_t / image1d_array_t slot as the 2D texture of
height 1 Apple's OpenCL binds (canon::opencl::entry, canon::opencl_1d). A real 1D or 1D array
texture is a VK_IMAGE_TYPE_1D image, which takes only 1D views (Table 18,
VUID-VkImageViewCreateInfo-subResourceRange-01021), and a 1D view cannot sit in the slot's
Dim 2D descriptor (VUID-vkCmdDispatch-viewType-07752). So the binder wrote the declared 2D
type's neutral (PlanDiagnostic::IncompatibleBinding) and every read answered zero, outside
both measured answers (Radeon Pro 5300M: the 1D values; UHD 630: layer 0 of the array).
Now a per-slot variant keyed by the bound texture's type:
- air: Entry::open_cl_1d_images records the texture indices of an OpenCL-mode kernel's 1D
images; SpecRequest::open_cl_lines names those a 1D texture is bound for, whose parameter
keeps its texture1d type (opencl::entry) and whose operations stay 1D (opencl_1d::expand
skips a call whose texture operand is that parameter).
- The kernel states RuntimeFact::OpenClLineTexture { slot } (Mechanism::Variant) per 1D image,
in the base and the variant alike; nothing else states it.
- The compute plan puts such a slot in VariantKey::open_cl_lines where the shape binds a
Type1D (Type1DArray) texture at a 1D (array) image read by the kernel
(bind::plan::slots::open_cl_line_variant). VariantKey::lowering_inputs carries it to
LoweringInputs::open_cl_lines, the specialized-entry cache key and SpecRequest. The variant's
interface states the slot Type1D / Type1DArray, so its plan binds the 1D view and states the
same key. The answer is the 5300M's.
With the set empty (Apple's 2D bindings) canon, the SPIR-V and the VariantKey are as before;
the base artifact gains only the OpenClLineTexture facts. The reflection still states the 2D
types. No runtime source changes.
Tests: canon::tests::opencl::opencl_1d_images_bound_to_1d_textures_keep_their_1d_operations,
engine_opencl_mode::an_opencl_mode_kernel_reads_real_1d_textures_through_its_variant and
a_plain_2d_texture_slot_given_a_1d_texture_binds_the_neutral; the runtime's
opencl_mode_1d_images_read_real_1d_textures (the repro).
SEMANTICS_VERSION 2133. api_signatures blessed (5 records); REFUSALS unchanged; docs/API.md's
OpenCL images paragraph.
Also e1aba1ad67 (the repro test), 9f3b309b65 and 8f2677c0ae (compile fixes: an Idx import; every SpecRequest literal names open_cl_lines).
Verified in the lane at 8f2677c0ae: lavapipe (m3-max-35393) OpenCL-mode runtime tests 19/19, the
new opencl_mode_1d_images_read_real_1d_textures among them (it failed at e1aba1ad67, m3-max-35348:
[0,0,0,0] for [10,11,12,13]); the 2D height-1 read and write tests pass at both. air OpenCL tests
9/9 (m3-max-35386). Still running when landed: the translator's engine_opencl_mode and api tests,
clippy x3, rustdoc, executor parity (runtime_lane::executions, runtime_run), the probe comparing
the guest 2D path's SPIR-V, facts and plan at base and tip, the PHOENIX run.
RUNTIME 2425 because the runtime's variant choice moves (bind::plan::slots); no runtime source
changed. New Degradation kinds: none.
|
||
|
|
662460fe5e |
RUNTIME 2424: Storage twins take 0 where their kernel reads any other word the binder writes for it
What: the runtime's uniform_residual_form sets every twin's RangeAtBindOffset to 0, as it does beside a residual read, also where the twin's stage reads under the key another word the binder writes for it (residual::reads_other_words, from the interface's PushPlacements): a field placed in its push range or its ArgumentTable, but a slot's SlotBindOffset residual where the key sets its RangeAtBindOffset, and the DispatchRegion words where the key leaves the stage's MultiRegion 0 on a variant that does not run a flat grid (a flat grid's one region reads them whatever MultiRegion says). A root table's or execution status's address, a replay's region record, a slot's guest base, a texture's levels and every other placed field count wherever placed. keyed_regions passes the variant's flat_grid; the render callers pass false (render stages have no twins). Why: RUNTIME 2419 kept a twin's key wherever no other RangeAtBindOffset of the key was 0, so a kernel with a twinned constant view that also reads a root table's address (a pointer through an argument buffer, dispatch_chain --binds ptr), or a multi-region region (dispatchThreads' edge regions and group-count splits, tile and partial-threadgroup plans), or a flat grid's region kept reading the twin at its bind offset while its thread payload stays long: the 2419 mechanism (ANV, Mesa 26.2.6, Iris Xe RPL-P: moved arm 154.0 us through the twin against 143.1 us through the uniform view, job m3-max-34864), whose cost is the stage's push reads (job m3-max-34063). dispatch_chain --binds 4 reads thread_position_in_grid but dispatches threadgroups with MultiRegion 0, so its measured twin gain (102.1 against 142.8 us) is kept. Runtime only: no translation output, plan or artifact moves (the executor and the execution record's plan check compare plans and artifacts, which the runtime's region keys are not), and no creation key. Only dispatch keys of a kernel with a twin and such a word move, on the Iris profile alone. Docs: residual.rs's module docs and functions, keyed_regions, the workaround's profile doc and docs/API.md section 5. Tests: general_form's a_twin_takes_0_where_its_stage_reads_another_word (the twin zeroed where its kernel reads another word, kept where it reads none, another stage's word ignored) and a_stage_reads_its_region_under_multi_region_and_every_other_word_it_places (reads_other_words' cases: MultiRegion 0 and 1, a flat grid, a residual held or not, an unkeyed residual, a root table's address, another stage's field). Verified in the lane (m3-max-35286, msi, at def6a68f94; each step's own exit code): clippy -p metal2vulkan-runtime --all-targets --all-features -D warnings 0; tests::general_form 6/6; lavapipe runtime_lane::executions + candidate::engine::runtime_run 34/34 (executor parity). Still running when landed: clippy m2v_gpu and m2v_cpu_icd, rustdoc, the Iris A/B (a twinned constant view beside a root table address / multi-region region, --binds 4 as control). New Degradation kinds: none. |
||
|
|
92a77c7025 |
RUNTIME 2421: Continued passes on a device that splits at aliases, where no buffer write meets their images
What: on a device whose driver has DriverFact::ImageUsesMissBufferWritesInOneCommandBuffer (NVIDIA's 620.70.06 on the RTX 3090), an inline pass's last instance may now stay open, and the next render encoder may continue it, as on every other device. Before it continues, EncoderCore::continue_pass checks the group's byte writes (FoldOrder::byte_writes, the leader's summary or the group's order) against every image the continuing pass uses: its draws' images (AliasWrites' images noted apart), its attachments, and the uses of the copies and steps before its later instances (render/inline_splits.rs, waiting_uses), all of which record into the tail after what the group wrote there. Where one meets, the pass begins its own instance in its own VkCommandBuffer, the measured form, counted in WorkCounts::command_buffers_split_at_aliases. Where none meets, it continues and takes the group's writes as its own (AliasWrites::continues), so what it records into the tail after its pass is checked as a joining encoder's is. Why: continuation cut the glass-panel frame's GPU time 11-26% on the 780M and Iris but was off on the 3090. The open instance itself never holds a buffer write: its draws touch only attachments, and anything else that records into the tail ends it first. The tail before it can hold one, though (the leader's earlier inline instances and what records between them), so the check is what the fact needs. Also: render_fold's Lane::continuing (622368ab37) goes, since its lanes continue on every device now. A test-only DeviceShared::aliases_split_forced lets lavapipe take the 3090's path. New tests: tests::alias_split's continues unit test; tests::alias_split_device's count case, a copy out of a texture after a continuation, a later instance of one pass reading an earlier one's buffer write, and a texture over another buffer of the same host pages (the last two are byte cases for two possible gaps on the 3090). Also e818e7b442: Continued passes: a pass's uses of bytes count in the alias check, as an aliasing texture's are. What: AliasWrites notes the bytes of buffers that the commands noted apart use (bytes_apart). AliasWrites::continues now refuses a continuation where those bytes, or a Bytes use among the pass's other uses, meet the group's byte writes, besides its images. Why: a texture whose linear image aliases a buffer's bytes (Storage::Alias) names them as the buffer's bytes (Texture::image_use), not as an image range. The lavapipe run with the split forced (m3-max-35002) showed a pass sampling such a texture over bytes the leader had just written continuing anyway: (1, 1, 1, 2, 0) where (2, 1, 0, 3, 1) was expected. A continuation is refused rather than guessed at: a draw that reads, through a buffer, bytes the group wrote also begins its own instance on such a device. Tests: the count case now reads the written bytes through a texture over a buffer and And dae7c2cad8: alias_split_device: the counted and copy-after cases read a texture over a buffer alone. Verified in the lane (m3-max-35085, msi, at dae7c2cad8): clippy -p metal2vulkan-runtime --all-targets --all-features -D warnings exit 0; lavapipe (m2v_cpu_icd) alias_split and render_fold 36/36; the count test forced: written read (2,1,0,3,1), quiet read (1,1,1,2,0), unforced (1,1,1,2,0), texels right. Still running when landed: the 3090 correctness job (alias_split, render_fold; F1-F3 byte cases), PHOENIX render suites, clippy m2v_gpu and m2v_cpu_icd, rustdoc, the 3090 glass A/B. New Degradation kinds: none. |
||
|
|
cceefacfa7 |
RUNTIME 2420: A storage twin's neutral shares the device's zero buffer: the plan says which buffer writes are read-only
What: a new public BindingPlan::read_only_buffer(&DescriptorWrite): true for a uniform buffer and for a uniform view's storage twin (DescriptorView::UniformWithStorageTwin, PlannedBuffer::twin), which no function stores through. The runtime asks it where it used to read the descriptor type alone (binding::descriptor's neutral arm, make_neutrals, binds_own_zeros), and makes the device's zero buffer a storage buffer too, so a twin bound to nothing binds it. Why: on the Iris Xe RPL-P profile (DriverWorkaround::PushReadsLengthenThreadPayload) RUNTIME 2413 gave a kernel's constant slot a storage twin. Left unbound, the plan writes the twin from the ZeroBuffer neutral at a STORAGE_BUFFER binding, which the runtime took for a writable binding: every dispatch took a fresh 64 KiB upload region, a dedicated VkBuffer allocated and zeroed, held until its command buffer completed. Round 5974320352's Iris leg: neutral_zeros_shared::dispatches_share_the_devices_one_zero_buffer, 8 dispatches made 8 VkBuffers and 16 made 16. Translation output and plans are unchanged (no SEMANTICS bump); the API addition is blessed in api_signatures.tsv, and docs/API.md section 5 says it. Test: engine_access::an_unbound_constant_slot_s_storage_twin_is_a_read_only_write plans buffer_end_byte_load_constant with nothing bound on intel-irisxe-rplp-anv (the twin's STORAGE_BUFFER write read-only, the written slot's not) and, as the negative control, on four other profiles (no twin; read-only exactly at uniform buffers). The device check is the neutral test itself on the Iris, which fails at the base. Also, test premises on the Iris profile (round 5974320352's iris:runtime reds): - a20c0a26d8: the compute creation test counts the forms its profile makes (1 + keyed storage views since RUNTIME 2410) and holds the pool only where completion is bounded (under Exact the second form runs on the pool). - 88b8d31a32: set 0 at offsets counts the pipeline binds (draws past offset 0 take the residual form) and the push after each where the driver forgets pushed descriptors after a pipeline bind. Verified in the lane (msi): m3-max-35051 clippy -D warnings -p metal2vulkan -p metal2vulkan-runtime --all-targets --all-features exit 0, translator tests 71/71 (api_signatures 3/3); m3-max-35053 lavapipe (cpuicd) deferred_calls, neutral_zeros_shared, set_zero_at_offsets, uniform_bind_offsets 43/43. Still to run: clippy gpucfg and cpuicd, rustdoc, ONE Iris run of the three tests. New Degradation kinds: none. |