9cb90de8cc9915ce4e462f736137f632a750eb82
1489
Commits
| Author | SHA1 | Message | Date | |
|---|---|---|---|---|
|
|
9cb90de8cc |
replay: a group that held a Private-range split reports its executed counts apart
Leaving out what the runtime counted while the player's own calls ran did not keep the split out of the executed counts: the old runtime records the barriers a split needs at the program's next command and at the commit. Device legs at 0b882f337c (jobs m3-max-41605, m3-max-41608) counted 8 barriers on the RX 7900 XTX, RX 550, 780M and lavapipe and 10 on the RTX 2080 for the test stream, against 5 for the same stream without the records. A background pipeline that landed inside an uncounted window also left pipelines_made out (RX 550, 780M, lavapipe). The runtime's work for a split cannot be told apart from the program's, so a group whose command buffers held a split now reports no executed counts. Those counts are added up apart, in Report::split_executed and on the `split N executed COUNTS` line, and the total leaves them out with the readbacks. The player's own calls around the dispatch are no longer measured on their own. |
||
|
|
4862a521e0 |
replay: the player's encoder splits are in no count; the report counts them
The encoders, blits, buffer and fence the player adds around a dispatch an m2v.privateBytes record names are its own work: what the runtime counts while those calls run is left out of the group and total executed counts, as its readbacks are, and the report counts the splits (split N). The comparison takes its completed snapshots from a queue. |
||
|
|
68789f62a5 |
replay: the player puts a Private range's bytes in before its dispatch and compares them after
The host records m2v.privateBytes for each dispatch of a pipeline with linked functions: each bound Private buffer range's bytes before and after the dispatch, which no CPU can read and no other record holds. The player played these records as nothing. It now reads the stream ahead once (a second reader of the same segments) and indexes the records by the dispatch each names, since they come after it, at the command buffer's completion. At that dispatch it puts each range's bytes before (relocated as a write's are) in a Shared buffer of its own, ends the guest's compute encoder, copies them into the ranges in a blit encoder, makes the compute encoder again by the call that made it with every set.../use... call the program made on it, dispatches, then ends it, copies the ranges out in a second blit encoder and makes it again. A fence of the player's own orders each piece after the one before, so untracked resources are ordered too. Once the command buffer completed it reads the bytes after back, counts the 4-byte words of each range that differ from the recording's, and reports a `private ID DISPATCH LOCATION+LENGTH match|differs N/WORDS` line; the play goes on. The readback helper check() and the comparison share now shifts the group baseline by the readback's own growth rather than setting it to the counters after it, so work recorded since the last group stays in the next group's executed counts. REPLAY-STREAM.md sections 8 and 10 state the read-ahead, the split, the report line and what the counts include. |
||
|
|
31c1161940 |
rt: SIMD groups at Metal's width, and robustImageAccess, at the floor
The floor requires Vulkan 1.3's subgroupSizeControl, computeFullSubgroups and robustImageAccess, enabled on every device; the translator's profile takes them through the enable set. Where a device lists compute in requiredSubgroupSizeStages with 32 between its sizes, the translator pins a kernel's SIMD groups to subgroups of 32 (the Direct tier); the compute pipeline state now takes such a kernel: each VkPipeline chains VkPipelineShaderStageRequiredSubgroupSizeCreateInfo where the tier pins a size (the translator pins only a stage the device lists, VUID-...-pNext-02755) and carries the stage's REQUIRE_FULL_SUBGROUPS. "A stage that pins a subgroup size" leaves Gap::KernelInput. A flattened tier's LocalSizeConstraint is supplied: a dispatch whose threadgroup is not whole SIMD groups is refused at the dispatch as the new Gap::PartialSimdgroups, since the emulated-SIMD-group variant is not built. With robustImageAccess on, the translator drops its image write and atomic guards on every device; robustImageAccess2, robustBufferAccess, robustBufferAccess2 and nullDescriptor stay off. Tests: the floor names each new missing feature; the translator's enable set holds robustImageAccess and none of a reported geometryShader, samplerMirrorClampToEdge or VK_EXT_robustness2 (host); every device's translator profile has robustImageAccess and none of robustImageAccess2, robustBufferAccess, robustBufferAccess2, nullDescriptor (device); and simd_float_products runs Direct, pinned at 32, wherever compute can pin 32, refusing a 16-thread threadgroup and answering Metal's products (device). REFUSALS.md and the API signatures regenerated. Verified: cargo fmt; the lint and the device legs follow. |
||
|
|
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 |
||
|
|
1ceaea8eec |
replay: the player plays m2v.privateBytes records as nothing
The host now records m2v.privateBytes: a Private buffer range's bytes before and after one dispatch of a pipeline with linked functions, written at the command buffer's completion (so after the dispatch, possibly after the buffer's release), with blobs in the blob directory alone. The player sent the unknown selector to the backend, which refused it on a buffer receiver and stopped the play. It now joins the records the player plays none of; REPLAY-STREAM.md section 8 states the record's receiver, arguments and order. Verified: private_bytes_records_play_nothing, a synthetic stream with the record on a released buffer and absent blobs, plays to the end with no backend call for it. |
||
|
|
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. |
||
|
|
35fbfb4f2e |
matrix: the old runtime's time outliers are parked like its gauges
The UHD 630's harness-old/frame time swung to 1.58x its base at |
||
|
|
ac4b2370f5 |
rt: the consumer names the core Vulkan features its own work needs
DeviceOptions::features takes ConsumerFeature values (SamplerYcbcrConversion for now). Device::new enables each one the device reports, once, in the consumer's order, and Device::features lists those enabled, so the consumer can refuse its own path. The runtime's own work and the translator read only the floor's features. No Metal counterpart. The floor test's device creation chains the maximal-reconvergence and subgroup-uniform-control-flow structures where their extensions are listed, as Device::new does (the device cfgs failed to compile without the fields). The consumer-extensions device test also expects the optional extensions the device lists, and asks for the feature twice. REFUSALS.md takes the renamed site of VulkanVersion (derive.rs derived). API signatures blessed. Verified: cargo fmt. Lint and device legs follow. |
||
|
|
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. |
||
|
|
136fb66907 |
metal2vulkan-rt: map the identity ABI's parameter block and grid region; translated-kernel device test
Identity steps 2 and 3 are on development: ArgumentTableAddress is the ring block's address in the window, fields placed in the ArgumentTable go to the block, and every dispatch reads Metal's grid from its pushed region (a zero grid for an indirect dispatch), with no MultiRegion constant to specialize. The README gains the pipeline states' section and its known gaps; REFUSALS.md and the API signature table are regenerated. |
||
|
|
5617449350 |
metal2vulkan-rt: the encoder's refusals in REFUSALS.md and its API in the surface table
Generated by refusal_surface.py and signatures.py --bless. Verified: the generators ran clean (0 variants without a reach mark or a basis). |
||
|
|
001cc5ae8a |
matrix: a lint leg runs the gate's fmt check, clippy in three configurations and Rustdoc
The matrix ran the suites but none of the gate's lints, so a public doc linking private items
(
|
||
|
|
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. |
||
|
|
eaac55bd36 |
replay: the recorder's commitPart cut, object 0, copied contents and gpuResourceID
The recorder now writes four things a player must read:
- m2v.commitPart answers `cut`: "Cut" where the host committed the command
buffer as a part, "Fails" or {Whole: reason} where it committed nothing. The
player commits only at "Cut", or where the answer is absent, as before.
- The pass descriptor's setters write object 0 for an object property set to
nil (visibilityResultBuffer, rasterizationRateMap, texture, resolveTexture);
nil still means left as it was. The old runtime's backend clears the
property at object 0.
- newBufferWithDescriptor: of a buffer copied from host memory carries its
starting bytes as the descriptor's `contents` (a blob or inline bytes). The
player makes the buffer with the contents nil, then puts the bytes at its
first byte as a write's: relocated where it answered a gpuAddress, counted
in written_bytes.
- `gpuResourceID` records carry the ID the program saw of a texture, sampler,
depth-stencil state, pipeline, ICB or function table. The player compares
each object's first answer with its runtime's ID (Backend::resource_id) and
reports each object where they differ as `id #OBJ RECORDED PLAYED`.
docs/REPLAY-STREAM.md carries the spellings. Each addition has a synthetic
stream test on the player's mock backend, and the old runtime's backend has
two device tests (an attachment set to nil left untouched by its pass; a
copied buffer reading back its contents, with a placed texture's ID matching
and an unplaced one's reported).
|
||
|
|
a68d520bee |
matrix: times compare under one harness; the old runtime's met failures are parked
At |
||
|
|
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.
|
||
|
|
6769c2eaaf |
known-gaps: the RTX 3090's and the Iris Xe's half-output blend rows
The six half-output blend cases differ from Metal on the RTX 3090 (59 sites) and on the Iris Xe under ANV (62 sites). The ledger had no rows for either venue, so the conformance replay failed there. Every site is the device's own blend, which the native-arithmetic contract makes the answer, so each gets a row: 59 scoped `NVIDIA GeForce RTX 3090`, with answers equal to the RTX 5080 Laptop's rows (no venue pattern covers those two without the RTX 2080, which no run here measured), and 62 scoped `Iris(R) Xe`. docs/CONFORMANCE-COVERAGE.md is re-derived for them. How the sites were shown to be the device's blend, by a measurement build (not committed) that read every stored code back and set it beside plain float models of the blend: - The `one-zero`, `min` and `max` sites store the source or the destination through the attachment alone, and store Metal's codes on both devices, so both operands reach the blend exact. - RTX 3090 (NVIDIA 620.70.06): the exact blend rounded once to the attachment's precision gives 98.0% of the 16-bit words and 98.7% of the 32-bit ones. Into a 16-bit target the blend colour is truncated to `half`; the runtime hands vkCmdSetBlendConstants Metal's float colour unchanged, so the truncation is the device's. Every word that differs from Metal's is within 1.01 ulps of that model at the largest operand's magnitude. A -0 + +0 sum stores -0, which is the 32768 and 2147483648 of the zero-1msa and sas-1msa rows. - Iris Xe (Mesa 26.2.6): the float blend truncated toward zero into a 16-bit target gives 97.6% of those words. The exact blend rounded to nearest gives every 32-bit word. - On both devices every differing word is within two ulps of Metal's at the largest operand's magnitude. That is inside the bound of the `half-output-fast-math-blend` precision note (three half ulps, two float ulps). The note is announced on both devices: the cases' allowance for it fired on all six cases (3090: 12 of 12 allowances fired; Iris: 6 of 12, the six silent ones are shared-in-system-memory, which an integrated GPU does not announce). Verified: - conformance replay of the six cases exits 0, each run holding one GPU: ms01 RTX 3090 m3-max-41210, ms01 Iris Xe m3-max-41211, um870 RTX 3090 m3-max-41218. - cargo nextest run -p metal2vulkan-conformance --all-features: 1043 passed (m3-max-41208). The first run, before the document was re-derived, failed only the_conformance_coverage_document_is_what_the_sources_derive (m3-max-41199). - Measurements: m3-max-41151, 41171 and 41176 (um870 3090), 41174 (ms01 3090), 41175 (Iris). These ran at tree 9326ca7fd8, which this commit's tree equals. |
||
|
|
b415aae947 |
Re-derive the generated documents at the landing tip
They are generated from the whole case set, and the set grew on `development` while this branch was in flight, so the copy committed here counted a smaller one. Verified: regenerating at this tip leaves no change beyond the `Generated at` stamp. |
||
|
|
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
|
||
|
|
b6077a933a |
docs: REPLAY-STREAM.md says how much the old runtime's executed counts move
A play of one recorded stream on a 780M with an empty translation cache and an empty Mesa cache (m3-max-41100, at a8ad095897) recorded 2523 dispatches, 71967 draws, 28321 render passes and 8503 submissions; the two warm plays after it recorded 2079, 71742, 27871 and 7036. The stream's counts were equal in all three, every group and frame line (0 of 7932 differ); the executed counts differ in 285 lines cold against warm and in 11 between the two warm plays. So cold caches change the totals, not only where a few draws land, and the spec now says so. |
||
|
|
c97dbd66ea |
validation: the replay report keeps what the stream fixes apart from what the runtime executed
Each report line (completed group, frame, total) now holds two sets of counts. `stream`: the calls played, the command buffers committed, the encoders made, the draws and dispatches their calls issued, and the player's own relocated, misaligned and written counts, all fixed by the stream, so equal on every play on any runtime. `executed`: the runtime's counters (for the old runtime, the Vulkan commands it recorded and the pipelines it made). The separate `calls N` line goes: the total's stream calls are the calls played. Why: the old runtime's executed counts are not repeatable at one tip. Seven plays of one recorded stream on a 780M at one tip gave equal totals, but in some plays a few draws (with their barriers) moved from one group to a group 15 later, and once from one frame to the next. The moving groups are the ones that make a pipeline, and they differ in `draws_unkept_making` (2 against 1): draws recorded through a pipeline's general form while its own was still being made on the runtime's pool, which keep nothing to draw again (metal2vulkan-runtime's pipeline/render/residual.rs). Where a background making lands is timing. The commits, submissions per group and the player's waits did not differ. The matrix compares the stream's counts only. |
||
|
|
077c9722e3 |
metal2vulkan-rt: command queues, command buffers and events on the submit and completion threads
Step (c) of the new runtime's compute core.
What:
- CommandQueue (newCommandQueueWithMaxCommandBufferCount:, its bound on uncompleted command
buffers), CommandBuffer (enqueue, commit, handlers, waits, status, error), Event and
SharedEvent (signaled_value, set_signaled_value, wait_until_signaled_value,
notify_listener).
- A command buffer records at once into segments split at event waits and signals. The submit
thread holds a segment whose waits are not met, and its queue behind it, while the segments
before it run (reims F1). A wait the host's value meets submits no semaphore wait; a GPU
signal not above the highest value submitted or set is left out, so the semaphore only rises.
- The completion thread retires by a progress semaphore, follows submitted event signals (a
listener runs at a mid-buffer signal, reims F2), runs handlers with no lock held, and is
woken through a host-signalled timeline semaphore only when a wait needs it.
- A command buffer keeps each block it uses until it retires. A zeroed Private buffer's fill is
an upload submitted ahead of every later commit, whose segments start with a barrier; each
segment ends with a barrier to the host.
- Device::quiesce(timeout) (F9), with every wait bounded, no join of a thread still running, no
thread-local that exit() tears down, idempotent, freeing nothing; unmap runs on the caller for
every block handed out, once (a handed set replaces the per-idle flag).
- The last handle dropped in a handler: the completion thread finishes the teardown itself (F8).
- CommandQueue::abandon (F14); a loss ends held work, in-flight work once the device is idle,
host waits on pending signals, and later commits, with DeviceLost { in_flight } (F13).
- Refusals Committed, OtherDevice, NoCommandBuffers with their basis; Error::Quiesced;
docs/REFUSALS.md and the API signature table regenerated; the README's contract.
Verified: cargo fmt; refusal_surface --check. The compile and device jobs follow.
|
||
|
|
4e8784ad14 |
refusal surface: the new runtime's own refusal enums, one section each
What: refusal_surface.py reads the new runtime's Error and makes a section of docs/REFUSALS.md for each variant whose payload is one enum the runtime declares: today Refused(Refusal) and Limit(Limit), and any family added later (a Gap included) without a list of names to keep. Each of their variants declares its basis, as Problem's do, and --check fails on one that does not. The translator's Limit section no longer counts rt's Limit sites. A rustdoc link [text](path) in a summary reads as its text; three existing rows lose a link the file could not follow. Why: AGENTS.md wants every new refusal in REFUSALS.md, and the scan of rt read the floor's Missing only, so EmptyBuffer, BufferPastBlock, BlockLen and BlockIds were missing. Their basis lines cite the M3 Max measurements the old runtime records for the same answers (newBufferWithLength:0 and a placement past the heap's end answer nil), the device's limits, and our 32-bit numbers. How verified: the script regenerates, --check and --selftest pass locally; the refusal_surface test runs in the compile job. |
||
|
|
d3b0f2f580 |
validation: a played no-copy buffer drops the read-only option
A no-copy buffer plays as a buffer of its length (its host memory is not in the stream), and the runtime refuses option bit 24 on such a buffer, as Metal ends the process there; b2 stopped at its 354th call on one. The bit is dropped for a no-copy buffer alone, so the replay keeps the GPU writes Metal drops from that memory; the spec says so. A heap keeps the bit, which the runtime takes. Found by the b2 play on gem10's 780M (job m3-max-40908). |
||
|
|
2dda92f5e0 |
validation: a buffer in a block is the block's call, as the recorder writes it
The recorder renames a placement on a block (newBufferWithLength:options:offset:) and keeps its receiver, the block; the backend took it on the device, and b2 stopped at its 88th call. A no-copy buffer, [nil, length, options, nil], plays as a buffer of that length. Found by the b2 play on gem10's 780M (job m3-max-40905). |
||
|
|
a28aca8889 |
validation: the replay report counts the calls played, so a stop names its call
The stopping call is the one after the count: on a long stream the selector alone does not say where the play stopped. Verified by the unit test of a refused selector (the count stops before it). |
||
|
|
e99ec291b5 |
validation: the replay player plays the recorder's format, renders included
The spec and the player follow what the recorder writes (reims-vgpu bec103226; b2 was recorded at 50fc14009, the same format but for refused guest-RAM copies): structs and descriptors are maps keyed by the recorder's camelCase field names, nil for an unset optional field; f32 values are f64; descriptors Metal makes as objects (texture and render pass descriptors) are platform records changed by setter records; a drawable never seen made is a texture of its descriptor; the host's plumbing (padded, exportable and dma-buf buffers, an unshared queue) plays as the plain Metal call it stands for; the host's scheduling records play as nothing; no call answers a resource ID, and a descriptor's resource index places its object. The guest-RAM copies are [buffer, [[byte, data], ...]] in and [buffer, [[byte, [start, end]], ...]] out. m2v.copyBytes:toBuffer:offset: and m2v.copyToHost: are gone: the host has no such methods. The gpuResourceID answer check and PlayError::ResourceId are gone with the answers. The old runtime's backend becomes a module: argument and map readers (args), descriptors (texture, render pass setters, render and compute pipelines, depth-stencil, sampler, buffer and heap descriptors, function constants and descriptors, surface planes), and the command buffer, compute, blit and render encoders' calls. Each mapping follows how the host's platform applies the recorded value to the runtime. |
||
|
|
21082c0094 |
Re-derive the generated documents at the landing tip
They are generated from the whole case set, and the set grew on `development` while this branch was in flight, so the copy committed here counted a smaller one. Verified: regenerating at this tip leaves no change beyond the `Generated at` stamp. |
||
|
|
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. |
||
|
|
737ccbf81a |
metal: the resource ID word, its spec and test vectors
Under the identity binding domains a guest computes a texture's or sampler's gpuResourceID itself, with no round trip: the index the consumer grants in the low 32 bits and a word in the high 32 bits that is a pure function of the Metal descriptor. The guest's port needs the word specified and a file of vectors both sides check. - metal::resource_word::TextureWord::of(pixel_format, swizzle): bits 0-11 Metal's border texels after the swizzle (the existing border_texels rule), bit 12 the out-of-bounds alpha of a format without alpha, bits 16-31 the MTLPixelFormat raw value, so a texture's word is never 0. None for the placeholders and the formats the translator holds no texture of or only copies. - The sampler word is the existing SamplerWord, unchanged. - docs/RESOURCE-ID.md: the ID's layout, the index classes (0 nil; storage-capable textures 1 to 4,095, valid in both arrays; other textures 4,096 to 65,535; samplers 1 to 3,999), both words' bits and the level rule, and the vectors file. README's documentation table lists it. - crates/metal2vulkan/tests/resource_words.tsv: 392 vectors (every pixel format with a word under the default swizzle, each channel of seven formats from each other source, every sampler field through its values, the level clamps around the points the nearest level turns at, and one descriptor with every field changed). tests/resource_words.rs recomputes every line through the public API and holds the file equal to what the generator writes; an ignored test blesses it. - api_surface lists the new module; api_signatures regenerated. Verified: - msi job 40810 at the same tree: clippy -p metal2vulkan --all-targets --all-features -D warnings, rustdoc -D warnings, nextest 18 of 18 (resource_words, the TextureWord unit test, api_surface, api_signatures). - msi job 40811 at the same tree: clippy under --cfg m2v_gpu and --cfg m2v_cpu_icd. - msi job 40809: the bless test wrote the vectors; the combined sampler line (0x58f6ab53) and the A8Unorm and R8Unorm texture lines checked by hand against the bit tables. |
||
|
|
4406486e8c | docs: the matrix's harness suite and time records | ||
|
|
b4b22c7b2c | matrix: the per-commit matrix runner and the user-space instruction counter (WIP) | ||
|
|
84fc9a95fc |
validation: replay streams name the guest RAM copies; a present reads nothing
The recorder writes the host's copies between the guest's RAM and a buffer as blit-encoder records: m2v.copyFromGuestRam ([runs, buffer, offset, data]), m2v.copyFromGuestRamAt ([placed runs, buffer, data]) and m2v.copyToGuestRam ([buffer, placed runs]), a run being [start, end] host addresses of which only the length counts. docs/REPLAY-STREAM.md names them, with the data the next recording carries. The player relocates the data of every upload (these two and m2v.copyBytes:toBuffer:offset:) by one rule, where its buffer answered a gpuAddress, and counts its bytes as written; the old runtime's backend copies them through a staging buffer, piece by piece, and copies m2v.copyToGuestRam into host memory nothing reads. m2v.present is now recorded wherever the device's display shows a guest present, a nil texture where the stream never made it, so frames are counted once: the player closes the frame and reads nothing (a readback per frame would add a copy Metal does not make). Tests: a unit test plays the three copy-ins into a block and an addressless buffer (relocated, counted apart 4 past 8, untouched) and refuses data of another length than its runs; a device test lays a buffer out with a fill, both guest RAM copies, a fill copy and a copy back, and reads it back as expected. |
||
|
|
964ae2c241 |
validation: replay streams v2, their player and the old runtime's backend
What: docs/REPLAY-STREAM.md specifies the binary replay stream (version 2): segments of records (names, blobs by SHA-256 of the exact bytes, calls), tagged values, the address and resource-ID model, CPU writes, surfaces before the platform cutover, commits, events and frames. The new `replay` module of the validation crate holds its reader and writer, the address map, the player (relocation of 8-byte-aligned address words in live recorded ranges, counting rewritten words and the 4-mod-8 values it leaves; exact resource IDs; waits only for command buffers that can complete, so one held on an event never stops another queue; counters per waited group, per frame and in total, readbacks excluded; SHA-256 checks), and a backend over the old runtime's public API (compute and blit encoders, blocks as placement heaps, textures at recorded IDs, events). A selector it does not play is a typed refusal naming it. `command-replay` now plays and dumps v2 streams; the v1 JSON manifest runner is deleted (nothing in the tree or the lanes used it). Tests: unit tests write their own streams (round trip, segments and a cut tail, refused kinds and versions, the blob directory and its hash check, nested ranges, relocation counts, event-held command buffers, frames, releases and host splits). Device tests (`runtime_lane::replay_streams`, under m2v_gpu or m2v_cpu_icd) play written streams on the old runtime: a device pointer written at a recorded block address is relocated and the kernel's output is the case's Metal output, on two devices alike; a command buffer held on a CPU-set shared event does not stop another queue's; textures are made at recorded resource IDs 77 and 5 and read back as written. |
||
|
|
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). |
||
|
|
374e29a988 |
metal2vulkan-rt: the floor's shader features, queue family, timestamps and memory types
The floor now also requires what the translator's shaders and the runtime's core need of every device: - shaderInt16, shaderInt8, storageBuffer16BitAccess (Vulkan 1.1 features, now read and enabled through Features::vulkan11), storageBuffer8BitAccess, scalarBlockLayout, vulkanMemoryModel and vulkanMemoryModelDeviceScope. The translator emits 8- and 16-bit access only in storage and physical storage buffers in practice (uniform views are u32 or uvec4, push fields are 32- or 64-bit), so the uniform and push-constant 8/16-bit features stay out; it does use device scope. - timestampComputeAndGraphics, and timestampValidBits of at least 36 on the first queue family with graphics and compute, which Capabilities names (queue_family). A device with no such family is Missing::QueueFamily. - a host-visible, host-coherent, host-cached memory type (Shared storage) and a device-local, host-visible, host-coherent one (the parameter ring), each usable by a buffer of BUFFER_USAGE: every Vulkan 1.3 buffer usage plus device addresses. Vulkan answers buffer memory types only for a created device, so check() finds a type with each set of flags and carries the memory properties, and memory_types(device, &capabilities) chooses the first usable type of each with vkGetDeviceBufferMemoryRequirements. Missing::MemoryType names the flags. Each shortfall is named in BelowFloor, with a unit case; the README's Floor section states every item and tests::floor holds it to the code. The device test now also creates each device with the floor's features and extensions and chooses its memory types on it. CI's lavapipe step (ci.yml and scripts/linux-gate-ci) runs the rt crate's device tests too. refusal_surface.py reads metal2vulkan-rt and writes the floor's Missing as section 10 of docs/REFUSALS.md; signatures.py pins metal2vulkan-rt's public surface in api_signatures.tsv. Verified: see the lane report (compile job, device legs on every lab GPU, lavapipe and the Windows UHD 630). |
||
|
|
017ff31e2f | wip harness crate | ||
|
|
28b6b0b9df |
metal2vulkan-rt: the new runtime's crate, and AGENTS.md's rules for one path on every device
What: a new, unpublished workspace crate, crates/metal2vulkan-rt, that will replace metal2vulkan-runtime and take its name at the cutover. It has no public API yet. Its first test, tests::one_path, reads the crate's product sources (line comments removed) and fails on: - a vendor, device or driver identity name (vendor_id, deviceID, DriverId, driver_name ...); - a GPU vendor's ID as a hex literal (0x1002, 0x10de, 0x8086 ...); - an environment read (env::var, option_env!); - a struct or enum named as a policy. Two more tests prove the scan finds each form and passes prose and unrelated numbers. AGENTS.md takes the owner's new rules, in priority order: 1. correct for documented Metal, with the device's arithmetic and static notes per operation; 2. one path for every device; 3. native-like speed; 4. small. It also takes: - the workaround ladder, the never-list and the thresholds; - the matrix rules: every check fans out one leg per GPU at once, and the replay matrix runs on development after each merge with deterministic metrics and leak gauges; - the freeze: the old runtime, DevicePolicy switches, driver-fact tables, device checks and docs/FAST-PATHS.md get regression fixes only until the cutover deletes them, and nothing new of those kinds is added; - the scope rule: below the floor is a typed refusal, and a Metal feature no replay stream uses is a typed refusal until a stream needs it. The crate table, the doc table, CI's crate lists and the gate commands in AGENTS.md, CONTRIBUTING.md and docs/VALIDATION.md name the new crate. Why: the owner's plan replaces the runtime with one that has no per-device code paths. These are the rules every lane of that work follows from its first commit. Verified: cargo fmt. Build, clippy and the crate's tests run on development after this lands. |
||
|
|
96e1041dbf |
RUNTIME 2538: submission checks: an answer that load could have made stands only for now
What: a merge or import tax answer now stands as far as it earned
(`Stands`). A merge `Holds` clear of the load and repeated, an import tax
`Holds` past its margin and repeated, and an `Unchecked` of a refused call
or a device with no pointer import are recorded. A `Fails` clear of the
load whose every try ran quiet stands for the device's life and is never
recorded. Every other answer stands for now: the checks' thread keeps its
command buffers and fence and checks it again 1, 2, 4 ... 64 s after the
first answers, then each minute, until none stands for now. A check again
replaces the verdict (tries that all split keep it), so a device whose
first merge answer was a loaded `Fails` groups once a check again answers
`Holds`. A record's `Fails` is a hint and no answer: a device that reads
one checks that check again at its making. Before each round and each
submission of a phase the checks stand by, at most 20 ms, until the
device's work is quiet (`DeviceShared::work_quiet_for`, shared with the
checks' thread through `WorkShare`).
The stop rule's thresholds (`Load::ran_quiet`): every stand-by found the
device's work quiet, no round or submission took past QUIET_ROUND_MOST
(2 ms, from its first call to its fence's reset), and all of them no more
than QUIET_TRY_MOST (30 ms). A merge `Fails` must also be clear
(MERGE_FAILS_CLEAR, 0.75 of the calls apart) and repeated
(MERGE_REPEATS); an import tax `Fails` must agree in its halves with a
held import adding at most half its bound (TAX_FAILS_CLEAR).
Why: on the Radeon 780M beside other jobs (m3-max-39740, load average
18-24 on 16 threads), two of four devices answered merge `Fails` at 0.72
and 0.745, both forms lifted by about the same 58-80 us, short of the
record but held for the device's life, so those processes grouped no
batch at all. At 0.75 and up with its repeats, the same load would have
written a `Fails` record that every later device of that release read
without checking. Threads of the process's own spinning or touching fresh
pages (m3-max-39786, 2x the host's threads) lifted every call alike and
left all eight devices at `Holds` (0.23-0.64), so the device test injects
the observed shape instead (`lift_next_merge_tries`: 70 us on the first
call of every round, its stand-bys not quiet).
Costs: a driver that does not merge or whose imports cost nothing pays
that check at every device's making, as before any record, and once more
at least where no try of its first answer ran quiet. An answer for now
costs a check again at each step of the schedule. The import tax is
included: a loaded tax `Fails` placed the device's long buffers in fresh
pages for its life on a driver whose imports do cost (39740's
b202c-bench run: 148.6 against 121.5 us, short of its margin).
CHECK_VERSION 9 (a record may hold no answer of a check, and a `Fails` in
one is no answer). Tests: unit tests of what each answer earns, the
schedule, the quiet bounds and the record; device tests that a recorded
`Fails` is checked again and that a lifted merge answer is checked again
and comes to the answer of a device beside it, with no `Fails` recorded.
in_place_check takes its answers through `answer_next_device`, since a
record can no longer hold a `Fails` as an answer. Forced verdicts
(`SubmitChecks::force`) stand for the device's life.
With it: the drag bench reports the submission checks' answers before and after its measurements
(test only); a lifted try's count goes down by AtomicU32::try_update (fetch_update's new name).
Verified (launchreg lane, tip 942672e8cb = these three commits on development
|
||
|
|
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
|
||
|
|
7dcde89ddb |
RUNTIME 2522: a head whose line signals what another queue's head awaits takes no turn
Under the default Fair queue turns, a later command buffer of a queue sharing a
VkQueue is held for its turn while its queue's earlier one is in flight. Where
that later one signals a value another queue's held head waits for, and the
earlier one waits on the GPU for a signal the program gives only once that
waiter is scheduled (a caller's reserved signal, Event::reserve_vk_signal), the
program waited for the watchdog, where Metal schedules them all at once.
Each look now first gathers the values the line heads wait for that no
submitted signal or host set reaches (EventShared::landing), and, only where
there are any, marks each turn-taking line's head by whether a batch of its
line signals such a value for another line (one read per command buffer).
Such a head takes no turn (scheduler/mod.rs mark_awaited_signals; Held
signals_awaited); once the signal went, its line takes turns again. The
awaited values live in State and are emptied after each look, so a look
allocates nothing. queue_turns.rs gains the "Awaited signals" rule and the
FAST-PATHS queue-turns row says it.
The lane test runtime_lane::events::a_signal_another_queue_waits_for_takes_no_turn_behind_a_gpu_wait
(queue B's first command buffer waits on the GPU for a reserved gate, its second signals W=1,
queue A's waiter waits for W=1; the gate opens once A's waiter left Committed) comes with it.
Verified (evwait lane, tip b77e692259 on
|
||
|
|
d0714ec9a6 |
RUNTIME 2518: queue turns hold only a command buffer's first batch; its later batches follow
What: under QueueTurnPolicy::Fair, CommandBufferShared::held_for_turn now holds only a
command buffer's first batch (index 0). Once that one went, each later batch of it (a
command buffer splits at an event wait after its work or at a signal before more) goes as
it is ready, as Metal schedules a command buffer whole. queue_turns.rs gets a "Whole
command buffers" bullet and loses the claim that the turns add no wait that can close a
cycle; the FAST-PATHS queue turns row says it.
Why: a REGRESSION of RUNTIME 2490 (Fair, the default). A queue with no run seen keeps one
batch in flight, so a command buffer whose first batch waits on the GPU for a signal not
yet given (the caller's reserved signal, Event::reserve_vk_signal, or another VkQueue's)
had its later batch held for the turn until that first batch completed: it read
Scheduled only then, and another queue's command buffer waiting for its later signal was
held for EventValue meanwhile. A program that gives the signal once that waiter is
scheduled (Metal schedules both at once) waited for the runtime's 20.2 s watchdog, which
failed the signaller (GpuHang / victim) and recovered the device: the XTX lane's
runtime_lane::submission_checks reds. Every device whose command queues share a VkQueue
(RADV, ANV, lavapipe) takes Fair.
Verified before the fix (carried --lib gpucfg archives, alone, --test-threads 1):
development
|
||
|
|
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. |
||
|
|
5bd1c466c8 |
RUNTIME 2500: A texture's copies with a guest RAM take one region per run of rows on an import
What: BlitCommandEncoder::copy_texture_from_host_ram / copy_texture_to_host_ram made one VkBufferImageCopy per row piece (bufferRowLength 0), and laid_over never joined runs that continue one another in host memory, so a surface given as one run per page was cut at every page end. Now host-contiguous runs merge within a row (as the buffer forms already do), and joined_rows makes pieces that share an import, a first texel and a texel count, in rows one after another with each row's import offset one pitch past the row before, into ONE region: bufferRowLength = pitch / texel bytes, imageExtent.height = its rows. Rows join only within a round, so a copy out whose pieces name a host byte twice keeps its order. A pitch over 2^31-1 bytes joins nothing (VUID-VkBufferImageCopy-bufferRowLength-09108). Rows that cross a chunk boundary keep their pieces. Why: the consumer measured first fills of ~16 MiB surfaces from guest RAM on the Radeon 780M at 0.137 ms/MiB into images against 0.038 ms/MiB through copy_from_host_ram into a buffer (3.6x; +1.9 ms x 349 presents in one scene), and copies out over a walk with ~1000 downloads at Iris 75 -> 415 ms, 780M 56 -> 198 ms. Measured (release, median of 10, a 2560x1600 BGRA8 surface given as 4000 page runs in 2 MiB blocks; regions per copy 4800 -> 20): 780M (m3-max-38432) fill 2.330 -> 0.510 ms, copy out 2.737 -> 0.494 ms, beside the buffer gather 0.488 and scatter 0.49 ms; XTX (m3-max-38429) fill 3.097 -> 2.452 ms, copy out 2.496 -> 2.484 ms (PCIe-bound), buffer gather 2.291 ms. Tests: rows_over_host_bytes_in_a_row_are_one_region_on_their_import_both_ways (exactly 4 regions each way for 200 rows across a chunk end; bytes exact at a padded pitch, a tight pitch and a sub-rectangle; at the parent it makes at least one region per row); the scattered-pages test's count from a model of the rule; the bench host_ram_texture_bench (ignored by default). Docs: HOWTO, the runtime README, WorkCounts::host_ram_copy_regions. Verified (msi, at ef7383646f): m3-max-38440 clippy -p metal2vulkan-runtime --all-targets --all-features 0, host_ram_texture_rows 2/2; m3-max-38441 lavapipe host_ram 129/129. clippy --cfg m2v_gpu / m2v_cpu_icd, rustdoc and the Iris bench (m3-max-38434) run after the merge. |
||
|
|
db341427bf |
RUNTIME 2499: Queue turns: a held head waits for the completion that lets it go, and its bound's wake is no slice
pinreds' lavapipe counts (m3-max-38335) under Fair: submission_turns' committing-pass check had 0 completion wakes, 1 sleep slice and 1 slice rescue; grouped_submissions 4-5 completion wakes for 6-7 turn holds and 1-2 rescues. Read, not a missed completion wake: - A sleep the scheduler's thread ended at a held head's bound (await_room's wake_by: the time the oldest batch's run brings its queue's work under the budget, the turns' designed wake) was counted as a sleep slice and its pass as a slice rescue, though WorkCounts calls a slice the thread's longest wait with nothing having woken it. A bound shorter than the slice now ends the sleep as no slice does (short, as the idle's length before a driver's stall), on the condition variable and on the GPU. - A turn-held head was gated on the oldest batch in flight, so every completion before the one that lets it go woke the thread to hold it again. Flight::own_ahead now gates it on the batch whose completion lets it go, or makes the batch of its queue whose run does so the oldest (turn_through), so the timer can be set then; a queue of unknown run on its first batch. Flight::turn adds the time another queue's last batch is 50 ms old where 2 ms holds the head and 16 ms would not, which the oldest's completion caught before. Tests: queue_turns::a_held_batch_waits_for_the_completion_that_lets_it_go (the gate is the fifth's predecessor, not each completion); the two turn unit tests' holds now carry the gate and the quiet timer; queue_share_device's turns test asserts 0 slice rescues, at most a completion wake per burst command buffer, and each submitted within 20 ms of the GPU end before it. Verified (msi, at d4074ffeaa): m3-max-38421 runtime clippy --all-targets --all-features 0, unshared_hold|queue_turns 25/25, rustdoc 0, fast_paths 36/36; m3-max-38422 clippy --cfg m2v_gpu 0; m3-max-38423 lavapipe clippy --cfg m2v_cpu_icd 0, unshared_hold|queue_turns|submission_turns|scheduler_held_wakes|queue_share_device 64/64 (the turns test under Fair: 14 looks held, 0 slice rescues, 7 completion wakes for 12 command buffers, each submitted by the previous one's end). Open: validation grouped_submissions 14/15 in m3-max-38424 (a_shared_event_wait_for_a_kept_group_s_signal_ends_at_the_next_completion_turn, "Y completed before X"); its A/B against the parent (m3-max-38439, 38442) runs after the merge. |