2137a20004e2b5658aedd0bdfdafc99e043606ce
1530
Commits
| Author | SHA1 | Message | Date | |
|---|---|---|---|---|
|
|
8e0bc77252 |
Add the HostRam window bench: 256 heaps over fresh RAM, upward, downward and scattered
What: tests/host_ram_window_bench.rs, an ignored release bench (cfg m2v_gpu or m2v_cpu_icd). On fresh RAM of its own for each order (a memfd advised for huge pages on Linux, anonymous shared memory elsewhere) and the device as the product makes it, it makes 256 no-copy heaps of 2 MiB over the RAM a device uses: upward (two bursts of 128 consecutive heaps, 1 s apart), downward (the same runs from the top, each heap the one below the last) and scattered (256 distinct runs over 32 chunks, 10 ms apart). It prints the makings of 5 ms or more, the slowest and the median, the chunks imported ahead and by the makings, and the heaps bound in a chunk (HOST-RAM-WINDOW). The device tests' fresh_ram, ahead_device, resolver, itself and gate are now pub(super) for it. Why: reims-vgpu's guest makes its heaps over RAM that goes down the address space or jumps; the window ahead follows only upward runs, so each chunk's first heap of such an order imports the whole chunk on the making thread. The bench uses only API present before the fix, so the same file measures before and after. Verified: cargo fmt; built and run through potluck jobs after this commit. (cherry picked from commit 472d6a912cc8e52e89842289d4047a5f2c0fca8c) |
||
|
|
d5329d1398 |
Record beside place() that a failing device-local try past a full heap is cheap
Measured on the RTX 5080 Laptop GPU (b5080 entry fresh-vram-time2-011808, kind t, the test's pageable-off build at 722bbd5faa). The heap was full after 56 x 256 MiB and topped up with 48 MiB buffers. Past it, 8 bare device-local allocations of 48 MiB answered VK_ERROR_OUT_OF_DEVICE_MEMORY within 4 us (median under 1 us). The whole make of each block-sized resource past it, every one of the 16 overflowing: - 48 MiB Private buffers: median 6.9 ms, longest 7.2 ms. Before the fill, in device-local memory: median 0.47 ms, longest 10.4 ms (the first). - 4096 x 4096 RGBA8Unorm textures: median 9.2 ms, longest 9.5 ms. Before the fill: median 0.65 ms, longest 1.2 ms. So the failing try is under 0.1% of an overflowing make, and place() keeps no record of a full heap: no budget query, no skip, no counter. What the rest of an overflowing make costs was not split apart. Everything still read back correctly, 12 placements past the fill overflowed, and the notice was announced once. Verified: the run above; fmt only for this comment. (cherry picked from commit 84182dc006eba552c3f2e16d1a0d9a058cc1fdba) |
||
|
|
a25eaf15bf |
Time block-sized makes past a full heap, topped up first, with the allocations' answers
The first timing run did not answer the question. Its 1 MiB buffers and 256 x 256 textures pooled into blocks made before the fill, so most makes past the full point needed no new block. The fill also stopped at its first overflow with up to 256 MiB still free: 2 of 4 64 MiB buffers past it were placed device-local. The 8 bare allocations all failed at a median under 1 us, longest 40 us, but their result codes were not printed. The timed resources are now one block each: 8 Private buffers of 48 MiB and 8 textures of 4096 x 4096 RGBA8Unorm. Past the fill, the heap is topped up with such buffers until one overflows, and the test prints how many of the timed placements overflowed and each bare allocation's vk::Result. Verified: nothing yet (cargo fmt only); the 5080 run follows. (cherry picked from commit 722bbd5faa28a4db2aaefee53eed87f5721e7331) |
||
|
|
9dca9144cd |
Time small Private makes before and past a full device-local heap
Past a full heap every Private placement that overflows first fails to make a new device-local block, and on NVIDIA a failing vkAllocateMemory may be slow if the driver tries eviction. The device test now times the makes of 32 small Private buffers (1 MiB) and 32 textures (256 x 256 RGBA8Unorm) before the fill and again past the full heap, and also times 8 bare allocations of a block in the device-local type there. It prints the median and the longest of each (VRAM-OVERFLOW) and asserts no time. Verified: nothing yet (cargo fmt only); the 5080 run follows. (cherry picked from commit 12a16b062902258c5a86cfc4d44ddd456a554461) |
||
|
|
040a382d03 |
Record the RTX 5080's overflow types and its driver's paging
What the overflow device test measured on the RTX 5080 Laptop GPU (Linux) now stands in the docs it backs. Its memory types are flags 0x0@heap1, 0x1@0, 0x6@1, 0xe@1, 0x7@0, and its heaps are 17.09 GB and 75.66 GB. A placed buffer takes types 0b11111 and an optimal color image takes 0b11, so Private buffers overflow into types 0, 2 and 3 and images into type 0. Images therefore take the overflow route and need no refusal or known gap; depth images were not probed. With VK_EXT_pageable_device_local_memory the driver paged: 72 Private buffers of 256 MiB were made without one overflowing. Without it, the 60th overflowed. Verified on the 5080 (b5080 entry fresh-fresh-vram-003651-003652, kind t, workspace at 18cf0ae4e8): - as committed: pass, pageable true, 72 buffers filled with nothing overflowed, 0 announced, max RSS 4.87 GB; - pageable sabotaged off: pass, the heap was full, every buffer (Private and Managed) and texture past the fill lies in system memory, 15 placements overflowed, announced once, every byte read back, and a buffer made after the frees lies in device-local memory again; - pageable off and overflow_candidates sabotaged empty in place(): fail, the fill's new_buffer refused with OutOfMemory(Device). This is the negative control. (cherry picked from commit 7f74f3c75b766f45b2aa239d4224333e4ab30d75) |
||
|
|
3cab7e4460 |
Bless the API table for the overflow counter and notice
WorkCounts.device_memory_overflows and Degradation::DeviceMemoryOverflow (python3 scripts/api-signatures/signatures.py --bless). REFUSALS.md regenerated with no change. Verified on the M3 (potluck m3-max-566, at 18cf0ae4e8): clippy --workspace --all-targets --all-features, clippy --cfg m2v_gpu of the runtime, validation and conformance, and clippy of the runtime with --cfg m2v_gpu_hazards too, all -D warnings clean; 54/54 runtime CPU tests (tests::memory, tests::device, tests::degradation*, the catalogue and the lane-site closure) pass. (cherry picked from commit d4199a09615c1acfce28ac6608ea996dd6cd870a) |
||
|
|
20b8d869fe |
Print memory types by their raw flags in the overflow device test
ash is built without its Debug impls here, so neither vk::MemoryType nor
MemoryPropertyFlags formats with {:?}: the test's TypeView derives no Debug
and the test prints each type's flags as raw bits.
Verified: the msi build at 586f2d0b5c failed on exactly these two errors
(E0277); the rebuild follows.
(cherry picked from commit 18cf0ae4e8561fd66a6147887a964439d28c5ace)
|
||
|
|
749daae1d9 |
Say a texture's image of any storage mode may overflow past device-local memory
Every texture's image is placed in Private memory (image_plan.rs), so a Shared or Managed texture's image overflows as a Private one does; the notice's declaration, the catalogue entry, the runtime README and the lane's site note now say so. Verified: nothing (docs and comments only). (cherry picked from commit ec5b5a70fdea000eb9a7d5ab84e5aaad02fffed4) |
||
|
|
a720be9cf5 |
Read an overflowed buffer's placement only where it lies in the runtime's own pages
own_pages_overflowed went through OwnBytes::with, which for a buffer over host pages reads them for ReadApart::Binding and keeps the import for good; every program buffer is now asked, so that would be a side effect on each. It now reads Lie::Fixed pages only, as in_fresh_pages does: host pages are imported and never overflow. Verified: nothing yet (cargo fmt only). (cherry picked from commit 77702ceef4f18d30cfe32499fd3be25729e49bcb) |
||
|
|
8ccb2934c9 |
Place resources past a full device-local heap in system memory
Placement refused a resource once device-local memory was full: memory.rs gives the Private class only DEVICE_LOCAL types, every texture's image is Private, and a Managed buffer's own bytes on a device without unified memory are Private, so place() returned OutOfMemory(Device). On the RTX 5080, 96 of 5090 1-MiB Managed GPU copies were refused at about 5 GB held, where Metal on a 4 GiB Radeon Pro 5300M made, used and read back 12 GiB of Managed buffers, six 1 GiB Private buffers and a 17 GB Private heap. - memory.rs: overflow_candidates, the types a Private or Memoryless resource overflows into where none of its own has room (allowed, allocatable, neither device-local nor lazily allocated; those the host does not map first). place() tries them after the class's own types; such a placement is marked (Placement::overflowed) and counted (Memory::overflows, WorkCounts::device_memory_overflows). Metal's own refusals (max_buffer_length, texture limits) stay where they are. - Driver paging first: VK_EXT_pageable_device_local_memory with VK_EXT_memory_priority, enabled where the device lists both and has pageableDeviceLocalMemory (enables.rs, create.rs); the spec lets such a driver page memory out rather than fail an allocation. Every allocation keeps the default priority. - Degradation::DeviceMemoryOverflow (performance), announced once for a program's buffer or heap (degrade_system_memory, which now names the storage mode) and texture (Texture::overflowed) that overflowed. - Tests: tests::memory::device_local_classes_overflow_into_system_memory, tests::device::pageable_device_local_memory_is_enabled_where_the_device_has_it, and the device test tests::device_memory_overflow (a GPU hazard, under m2v_gpu_hazards on a GPU, in the shape of 7b57d9a87a; check-cfg added), which fills device-local memory where it can overflow and makes, uses and reads back Private buffers, a Private heap with a buffer and a texture, Private textures and Managed buffers past it. The lane names the kind's site as the runtime's test (degrade_notices OVERFLOWED). - Docs: API.md (runtime-own extensions, catalogue entry), runtime README memory model. Verified: nothing yet (cargo fmt only); builds and runs follow as potluck jobs. (cherry picked from commit 586f2d0b5c6708016d9a255c0934f9727569125c) |
||
|
|
f8ae28043e |
Show the adopted device's declared Mac class in its Debug
RawDevice's Debug named the new mac_class field in its destructuring but wrote no field for it, which clippy -D warnings refuses (unused variable): m3-max-380 at f3d6f24ca4, clippy plain and --cfg m2v_gpu both exit 101 on it alone. It now writes it, as DeviceOptions' Debug does. Verified: cargo fmt --all; clippy reruns as a potluck job on the M3. (cherry picked from commit c3a6caa26f677d41f7050518af1196a72dba9db2) |
||
|
|
504d01b759 |
Present the Mac class the consumer declares, by default its GPU's, as the fresh-texture key
The fresh-texture key (DeviceProperties::lossless_compression) was
has_unified_memory. That is wrong for every integrated GPU that is not
Apple's. The consumer's oracle shows an Intel UHD 630 Mac reports unified
memory and reads zero or a released texture's texels from a new Private
texture, as the AMD 5300M does, and never Apple's pattern. The owner's
choice (option B): the consumer declares the Mac class the device presents,
and the default follows the GPU family.
What:
- MacClass { AppleSilicon, IntelOrAmd } (public, capabilities.rs), with
MacClass::of_vendor: an Apple GPU (vendorID 0x106b, MoltenVK on Apple
silicon) is AppleSilicon, every other GPU IntelOrAmd.
- DeviceOptions::mac_class and RawDevice::mac_class (Option, None by default:
the GPU's class) feed presents_lossless_compression, still the one place
the key is decided. lossless_compression is class == AppleSilicon. The
options' equality and Debug list the field.
- A new Private texture under IntelOrAmd on a GPU that is not Apple's holds
what its memory held, as before (private_textures_unfilled). On an Apple
GPU, whose own image of such a texture is compressed and reads Apple's
pattern, it is filled with zeros as it is made, which is what such a Mac
reads where its memory held nothing. Counted by the new
WorkCounts::private_textures_zero_filled. The pattern path now runs only
where the device presents compression.
- AppleSilicon keeps the runtime's pattern and zeros on any GPU. The device's
own contents are not Metal's pattern on the M3: in the negative control
(m3-max-88) leaving Private textures unfilled failed 16 of the 28 lanes.
No PrecisionNote: the fill is capability (the declared Mac's contract),
not arithmetic. An Apple-class pattern that no clear or copy writes
exactly still announces fresh-pattern-zeroed.
- Defaults change only where unified memory and GPU family disagree: Intel
and AMD integrated GPUs and lavapipe now present no compression (their new
Private textures are unfilled). The M3 (Apple) and the discrete GPUs
answer as before.
- Docs: docs/API.md (the accepted difference and the fresh-pattern-zeroed
entry), the runtime README, the degradation declaration, the work-count
docs. api_signatures blessed. REFUSALS.md regenerated with no change. No
FAST-PATHS row: no speed-for-accuracy choice.
Tests:
- tests::capabilities::lossless_compression_is_the_presented_mac_class
(no device): every vendor kind (Apple, Intel, AMD integrated and
discrete, NVIDIA, Mesa CPU) under no declaration and both declarations.
- tests::mac_class (device, both settings):
the_default_class_is_the_gpu_s and
a_declared_class_other_than_the_gpu_s_is_presented. Each reads a new
Private RGBA8Unorm target and checks the counters: AppleSilicon reads
Metal's magenta pattern; IntelOrAmd on an Apple GPU reads zero
(zero_filled +1); IntelOrAmd elsewhere is unfilled (+1).
Verified: cargo fmt --all. Build, clippy and tests run as potluck jobs
after this commit (results in the next commit or report).
(cherry picked from commit f3d6f24ca447fbcadc8df56e63e598cbc92e09b7)
|
||
|
|
9fe1b0175f |
Key the compressed shape's clear route in the extended-range and bfloat clear checks
A clear takes Metal's straight route only where nan_clear::keeps_nan_sign holds (render.rs),
which the fresh-texture key now makes false on a device that presents a Mac keeping no texture
compressed: there a 16 x 16 plain target is not compressed, so it clears through half, as
Metal's uncompressed targets do (expected, not measured on such a Mac). Three checks still
expected the straight route there and failed on the RTX 5080 Laptop at fd34a10316:
- conformance xr-clear-routes-{bgra10xr,bgra10xr-srgb,bgr10xr,bgr10xr-srgb}: divergent at
case/plain-16/texels/0..3 alone (15 sites), unlisted, in the replay of job m3-max-120; the
baseline replay at
|
||
|
|
2b8df8a36b |
Give the recycle tests and the BC fresh-blocks lane their arm for an unfilled device
On a device that presents a Mac keeping no texture compressed a new Private texture holds what its memory held, written by no command (the fresh-texture key, DeviceProperties:: lossless_compression). Three tests still asserted the old fill there and failed on the RTX 5080 Laptop at fd34a10316 (potluck job m3-max-124, full runtime + validation suite, --cfg m2v_gpu): - runtime tests::recycle::a_recycled_texture_reads_what_a_new_one_reads and a_burst_of_one_off_makings_keeps_the_proven_image: the recycled Private BGRA8Unorm texture read the parked image's clear colour (191,127,64,255) in all 4096 texels where the test wanted what a new texture read (zero). That is the contract now (docs/API.md: as the consumer's AMD 5300M and Intel 630 read a released texture's colour). On such a device each now asserts the recycled making counted as unfilled (WorkCounts::private_textures_unfilled moved by one) and that it reads the parked image's texels or what a new one read, and prints which (RECYCLE-UNFILLED); with compression, the count stays 0 and the old assertion holds. - validation runtime_lane::compressed_decode::new_bc_textures_read_zero_blocks: 28 cases (the 14 BC formats x 2 rounds, Private alone) read other than zero blocks. A Private one on such a device now asserts its making counted as unfilled and prints what it read (BCFRESH-UNFILLED); the Shared ones still must read zero blocks, and with compression nothing changes. Verified on the M3 Max, no device: cargo clippy -D warnings on the runtime and validation crates (all targets, all features, --cfg m2v_gpu). UNVERIFIED: the three tests have not run on the 5080 or the M3 with this commit yet. (cherry picked from commit f73c71cce747fd6eddcdb1d84198d9b8038ac266) |
||
|
|
17337510f4 |
Declare the venue difference at every compressed-blits format's seven blit sites
The previous commit declared the without-compression accepted difference only for the BGRA10_XR rows, on the reasoning that the other two formats' blits write no canonical encoding of the runtime's own. That was wrong about what the recording holds: the M3 Max recording of compressed-blits-rg11b10f and -rgb9e5f carries Metal's compressor's canonical encoding (the quiet NaN; the least shared exponent) at the seven sites a blit reaches through the compressed texture, and on a venue presenting no compression the runtime now announces no device-nan-encoding or shared-exponent-kept note there, so nothing justified those sites. Measured on the RTX 5080 Laptop (potluck job m3-max-120, conformance replay --gpu at fd34a10316): compressed-blits-rg11b10f and compressed-blits-rgb9e5f each diverge at exactly case/tall, level-3-padded, cpu-in-blit-out, blit-in-cpu-out, out-of-compressed, into-compressed and over-a-buffer, unlisted in known-gaps.tsv. A Mac without the compression keeps the bytes through every blit (docs/API.md's entry already says "any texture"), so each format now declares replay::without_compression at those sites, and the family's test expects the seven for every format. Verified on the M3 Max, no device: cargo clippy -D warnings on metal2vulkan-conformance (all targets, all features); nextest of the conformance compressed_blits, fresh_contents, allowance and replay tests 29/29; docs/CONFORMANCE-COVERAGE.md re-derives unchanged. UNVERIFIED: the 5080 replay with this commit has not run yet. (cherry picked from commit e105b274c6f410876117dbdfd50872052ab0acd6) |
||
|
|
64bea51c0c |
Put the fresh-texture key behind one presented fact, and give every lane and case its arm
The key that decides whether the Mac a device presents keeps textures losslessly compressed is now one public fact, DeviceProperties::lossless_compression, decided in one private function, capabilities.rs presents_lossless_compression. Today it is has_unified_memory, as the approved proposal said; the owner's open question (unified memory, a consumer-declared Mac class, or a family split) changes that one function. Everything that differs because Apple silicon compresses reads only that field: Device::metal_compresses_textures() (a new Private texture's fill, compressed_blit::compressed(), nan_clear::keeps_nan_sign), the validation lanes (fresh_contents::unfilled, patterns_of) and the conformance venue (Venue::lossless_compression; the Metal side answers supportsFamily(MTLGPUFamily::Apple1)). This finishes what the parked commit before it listed as open: - docs/API.md: a new accepted-differences group, "The Mac a device presents", whose entry (slug a-device-that-presents-a-mac-without-texture-compression-answers-as-that-mac) gives reims's measured AMD 5300M and Intel UHD 630 rows for fresh Private contents and marks the blit encodings, fills and NaN clear sign as expected, and states the Intel-iGPU limit. The fresh-pattern-zeroed catalogue entry and its rustdoc say the key; so does the runtime README's "New resources" bullet. - Conformance: Justification::WithoutUnifiedMemory became WithoutCompression (and Unjustified::VenueCompresses, Offered::lossless_compression, replay::without_compression / WITHOUT_COMPRESSION). The fresh family's Private rows declare it at their fresh site; the compressed-blits-* rows of the BGRA10_XR formats (the only ones whose canonical encoding the runtime writes) declare it at the seven sites a blit reaches through the compressed texture. The fresh test now asserts the new shape (renamed a_row_loosens_the_notices_site_and_a_private_texture_s_fresh_site); the compressed-blits test asserts the venue declarations site by site. - Lane arms on an unfilled device: fresh_costs (the counter moves by count x runs per Private shape; no readback), fresh_writes (patterns_of in both controls and the scratch test; the forced single-sample note only where the device fills), parallel_encodes (no expected pattern), depth_denormals (no draw/store check of unwritten texels, no sign, no zeroed note), compressed_blits (the notes and the Canonical rewrite only where the device compresses). degrade_notices needs none (FRESH_PATTERNS is only its catalogue list); the tile-store lanes (rotated_textures, snorm_tile_store, padded_loads, extended_range_blends) read draw notes, which are not keyed. - api_signatures.tsv blessed for DeviceProperties.lossless_compression and WorkCounts.private_textures_unfilled. docs/CONFORMANCE-COVERAGE.md regenerated (the Metal leg now calls supportsFamily:, and WithoutCompression is a justification it names). No RUNTIME_VERSION or runtime-sources pin change here: left to the orchestrator. Verified on the M3 Max, no device: cargo clippy -D warnings over the runtime, validation and conformance (all targets, all features) plain and with --cfg m2v_gpu; nextest metal2vulkan-conformance 1011/1011, metal2vulkan-runtime 1234/1234 (2 skipped), metal2vulkan api_signatures + api_surface 15/15; the refusal-surface and metal-coverage checks pass. UNVERIFIED: no device run yet (the lanes, the nan_signs test and the conformance replays, on the M3 and the 5080), and no negative control yet. (cherry picked from commit fd34a1031602645e87e4cb192d1044790f79a88f) |
||
|
|
8df325f336 |
Key a new Private texture's fresh contents on unified memory (work in progress, parked, unverified)
Parked mid-task on the owner's order. UNVERIFIED: nothing here has run on any device, and the tree is known not to pass its own tests yet (listed below). Do not land it as it stands. What it does so far: - Runtime: Device::metal_compresses_textures() is DeviceProperties::has_unified_memory. On a device presented without it, Device::new_texture_image starts a program's new Private texture as Start::Held: no pattern, no zero fill, its first move the layout move alone. Shared and Managed keep their zeros; Memoryless is unchanged; heap answers and copy_exact_usage are not keyed. New WorkCounts::private_textures_unfilled counts each such texture. - The compressor's artifacts follow the same key: compressed_blit::compressed() (the extended-range-bits-kept, device-nan-encoding and shared-exponent-kept blit notes, the fill note, and ExtendedRangeBlitPolicy::Canonical's rewrite) and nan_clear::keeps_nan_sign. Both are EXPECTED, not measured, on a Mac with a discrete GPU; only the fresh Private contents rest on measurements (the consumer's AMD 5300M and Intel 630 rows). - Runtime test nan_signs: keeps_nan_sign expected false everywhere without unified memory. - Validation lane fresh_contents: arms for a device without unified memory (counter moved by one per Private texture, no fresh-pattern-zeroed, texels not Metal's whole pattern, FRESH-UNFILLED printed), and the counter held at zero with unified memory. - Conformance: Venue::unified_memory (runtime side from has_unified_memory, Metal side from hasUnifiedMemory); Offered::unified_memory with on_venue(); Justification::WithoutUnifiedMemory (slug) holding only on a venue without unified memory and only where docs/API.md's accepted difference exists; Unjustified::UnifiedMemory, exempt from compare_run's up-front check; replay::without_unified_memory(site) and WITHOUT_UNIFIED_MEMORY beside shared_memory_notice; the fresh family's Private texture rows and pattern rows declare it at their `fresh` site. Known open before this can pass (not done): - docs/API.md has no accepted-difference entry with the slug a-device-presented-without-unified-memory-keeps-no-texture-compressed yet, so every fresh row naming it fails its up-front check (NoSuchAcceptedDifference) on every venue. - conformance cases::fresh_contents::tests::a_row_loosens_the_notices_site_alone still asserts the old shape (notices site only, one allowance per texture row). - crates/metal2vulkan/tests/api_signatures.tsv is not re-blessed for the new WorkCounts field. - Lanes not yet given arms: fresh_costs, fresh_writes, parallel_encodes, depth_denormals, degrade_notices, compressed_blits, rotated_textures, snorm_tile_store, padded_loads, extended_range_blends; and any other lane or conformance case that reads unwritten texels of a new Private texture on the 5080 (to be found by a whole-suite run there). - Conformance cases whose values move on a venue without unified memory once the compressor's answers are keyed (compressed-blits-* under the suite's exact policy at least) need the same declaration at their value sites. - Docs: the runtime README, the FreshPatternZeroed rustdoc and API.md entry, and the plain note that an integrated non-Apple GPU keeps the pattern. The consumer's later rows say the Intel 630 reports unified memory yet reads zero like the AMD, so has_unified_memory misclassifies it; an Apple-family against Mac2-family split was suggested as the key instead. Revisit the key before finishing. - No negative control and no M3 or 5080 lane run yet; RUNTIME_VERSION and the runtime-sources pin untouched. Checked only: cargo check of metal2vulkan-runtime (all features) and of metal2vulkan-conformance (all features, tests) on the M3 Max, before the last edits to the conformance fresh cases. (cherry picked from commit b9faa4fc9c6c50751eb08b060ab56bf5a496d9e9) |
||
|
|
5a1e1748eb |
Time the subnormal and in-place gather cases on the M3
`conformance times --runs 8 --write` over the eight new cases (job m3-max-697, Apple M3 Max, macOS 27.0.1, both legs). That job reported "8 case(s) carry their timing", and times::every_case_is_timed requires it. Four cases are within 10x of Metal. The four pixel-samplers-subnormal-* cases are recorded as unmeasured: our leg announced argument-pixel-sampler-scaling and set-past-layout-support, so it did a different amount of work. Times are reported, never gated. The same job's replay of the eight cases passed, the known-gaps rows held. docs/CONFORMANCE-COVERAGE.md still matches the recordings (--check). (cherry picked from commit 851f740714908684a72dc68b57717ab978b9519c) |
||
|
|
2be3e497a7 |
Move pixel_samplers' test-only items into its tests module
With the subnormal cases, a case reads its cells through coordinates_of and layout_of. SAMPLES, SUBNORMAL_SAMPLES, coordinates() and layout() were then used only by tests, which the conformance lib build denies as dead code (clippy on all features, plain and gpucfg, job m3-max-670). The two constants move into the tests module, and the two wrappers go: the tests call coordinates_of(&grid, ..) and layout_of(SAMPLES) directly. No behaviour change. (cherry picked from commit 9ed4da444d4acc7fef4cca42ac6821836ccb48af) |
||
|
|
d98098e8c0 |
Bring three translator tests in line with the denormal clause and the unary deviation
The CPU job m3-max-670 found three tests that the two denormal commits left stale. Those commits' own CPU job had been cancelled, so this is the first time the tests ran. - lower::arith::tests::unary_denormals_follow_their_deviation paired the unary deviation with KHR facts. A profile that takes MetalUnaryDenormals (MoltenVK on an Apple9 GPU) also takes MetalFloatFunctions, so its fabs is one of Metal's functions, and the facts now say so. Off Metal's functions the device's fabs still records its denormals as a maths function. - tests::engine_arith::float_denormals_are_the_devices_and_noted_off_the_device_fact expected floor and ceil noted on every profile. On moltenvk-m3, which takes MetalUnaryDenormals, they now record no DeviceDenormals and require VkProperty::MetalUnaryDenormals instead. The test asserts both, and its doc says so. - tests::engine_sampler::runtime_pixel_accesses_hand_the_device_the_scaled_coordinate expected the texel centre's DeviceDenormals held under the NearestPixelSampler test alone. It now carries one clause per axis, each adding SpecKey::BoundSamplerWord tests that the axis's mode is none of clamp to edge, mirror clamp to edge and mirrored repeat. The test checks that shape. Test-only change. Partly written while m3-max-670 ran; that job's later steps (validation's gpucfg build) do not compile these tests. The next CPU job runs them. (cherry picked from commit ced56fc61f763d8261ed529692601795c0a73e3c) |
||
|
|
b513a597cb |
Fix clippy on the texel-centre clauses and the colour NaN rule
clippy (plain, all features) on the branch tip (job m3-max-609) found three errors: - two `indexing_slicing` errors (denied in lower/) in sampler::select's per-axis texel-centre clauses, from the address-mode clause commit. They indexed SamplerWord::ADDRESS_SHIFT and ADDRESS by axis; they now zip the two arrays and take the s and t axes. The clauses are unchanged. - one `needless_borrows_for_generic_args` error in stage_io::returns_no_nan. The closure is Copy, so it is passed by value. No behaviour change. The CPU job that follows reruns clippy and the touched suites. (cherry picked from commit dc74ec8dd15ef95eeb76a96c45452c4716e44fc2) |
||
|
|
9a8a874e0e |
Record the subnormal and in-place gather cases on the M3 and list the native denormal rows
Recordings, taken on Metal on the Apple M3 Max (macOS 27.0.1) by
`conformance record`, with costs from `conformance cost --write` over
the selection (8 runs), for:
- pixel-samplers-subnormal-{edge,zero,border,mirror};
- ycbcr-gathers-{edge,zero,white,repeat}.
Replayed on MoltenVK on the same M3 (job m3-max-557):
- ycbcr-gathers-*: all four exact. The in-place 2D gathers answer
Metal's taps.
- pixel-samplers-subnormal-edge and -mirror: announced only
argument-pixel-sampler-scaling, outputs exact. Clamp to edge and
mirror clamp to edge read texel -1 as texel 0, so the narrowed
device-denormals clause leaves them unnoted, rightly.
- pixel-samplers-subnormal-zero and -border: divergent at
case/output/slot and case/output/arg. Metal's sampler reads a
negative subnormal pixel coordinate as texel -1 (the border, (1, 1,
1, 1) in the recording), where the module's texel centre
floor(x) + 0.5 meets MoltenVK's floor, which reads it as the zero of
its sign. That is the device's native answer, recorded and announced
as device-denormals, whose documentation states this shape. Four
known-gaps.tsv rows, scoped to the Apple M3 Max, name it. The const
and norm sources answer Metal's bytes.
The same job's lanes passed, 14 of 14:
- pixel_samplers: the texel-centre test shows none under clamp to edge
or mirror clamp to edge, and DeviceDenormals once under clamp to
zero;
- float_denormals and owned_float_fixtures, with the MetalUnaryDenormals
rows;
- ycbcr_in_place, with sample and gather together;
- heap_extended_reads x3: the raw-texture notice names "BGRA10XR
texture at resource ID 2", and nothing with only RGBA8Unorm live.
docs/CONFORMANCE-COVERAGE.md regenerated (python3 -I
scripts/conformance-coverage/coverage.py; --check passes). The rows'
replay follows in the next GPU job.
(cherry picked from commit 0b071ba97c01e19cbdd01a1ebd0ea2e5c91ab2eb)
|
||
|
|
61e6e1f9ac |
Announce device-pack-conversion where a heap set holds a texture by its raw texels
A heap holds a texture of a form ExtendedRange::HEAP_READ names
(BGR10_XR, BGRA10_XR, R10Unorm_X6, RG10Unorm_X12 and the bfloat
formats) by its raw texels alone, its raw view in the unsigned integer
class. A function's float read, sample or gather of it through an
argument buffer decodes the raw texels itself, by the device's
arithmetic, within the bounds PrecisionNote::DevicePackConversion
states. That is the same conversion a slot's read records statically,
but nothing announced it for a heap read: the stage cannot know which
textures an argument buffer names, and recording the note on every heap
float read would announce it for argument buffers that never hold such
a texture.
Scope it through the run-time mechanism a decoded twin already uses.
heap_sets now notes, per set, the textures whose raw view a set's
unsigned integer array holds (SetEntry.raws, detected in texture_info
by the class and bind::heap_raw_form). It announces
Degradation::DevicePackConversion, naming the texture ("BGRA10XR
texture at resource ID n"), at the first command that binds a set
holding one, and once (degrade_once) as one is placed in a set a
pending command buffer may read through. This matches TwinRead's
twin_read and twin_placed. A command whose sets hold no such texture
announces nothing. A command that binds a set holding one announces it
whether or not its function reads that texture, because the runtime
does not see which textures an argument buffer names. The twin
bookkeeping shares the new noted and pending_read helpers.
The runtime's DevicePackConversion doc, docs/API.md's
device-pack-conversion entry and heap_sets' module docs say so.
New lane test
runtime_lane::heap_extended_reads::a_heap_set_holding_a_raw_texture_announces_its_decode.
It dispatches a heap float-read kernel with only an RGBA8Unorm texture
live (no device-pack-conversion announced), then with a BGRA10XR
texture made (the notice names that texture's resource ID). It prints
the stage's own notes beside the notices.
No RUNTIME_VERSION bump (not asked for on this branch).
Verification: the branch's next CPU job (clippy, runtime suites) and
GPU job (the heap_extended_reads lane on MoltenVK on the M3).
(cherry picked from commit f5c2127ebee39d3fcf221e1930e287d26c7f9e68)
|
||
|
|
75228b052b |
Record no device-nan-encoding for a color output that only ever returns NaN-free constants
A fragment function's color output to a half-float attachment recorded PrecisionNote::DeviceNanEncoding wherever the device's conversion stores a NaN otherwise than Metal, even when every value the function returns there is a constant with no NaN lane, which stores no NaN. Texture writes already skip the note for such a constant texel (texture::holds_no_nan); color outputs now apply the same structural rule. stage_io::returns_no_nan follows each `ret` of the function to the output's member (through insertvalue chains and aggregate constants), and color_write::plan, called from the output-variable path and from the storage-form path, leaves the note out when every return holds such a constant. Any computed, undef, argument or partly unknown member keeps the note. Per-site audit of the device-nan-encoding notes on MoltenVK on the M3 (the reims strict Mac tests), with the translator CLI over each site's stages: - (a) undefined tests x3 (xr_constant_fragment and the other constant-colour fragments): their outputs are NaN-free constants, so the note was wrong there. Fixed here. - (c) encode_render x2 (sweep_fragment, sweep_half_fragment): computed outputs that sweep through NaN values. The device stores its own NaN encoding, so the note stays. - (c) rgbx x3 (rgbx_write_half, store_half, read_write_half, and the NaN clears and half NaN writes): deliberate NaN texel writes. The note stays. - (c) slice_write_repro x1 (slice_write, slice_write_l0): computed texel writes. The note stays. New public fixture ncw_constant_colors (our own MSL, compiled by scripts/regen-air-fixtures). It covers a half and a float constant colour, a constant NaN colour, a computed colour, and a two-member struct whose member 0 is a constant and member 1 computed. The new test engine_link::constant_colors_without_a_nan_record_no_nan_encoding checks, on the lavapipe and moltenvk-m3 profiles, that the note is recorded exactly for the NaN constant, the computed colour and the pair's computed member, and that each stage links and validates. docs/API.md's device-nan-encoding entry states the rule. SEMANTICS_VERSION goes to 1963 because the recorded notes change. The golden tables need the new fixture's rows, re-blessed on development. Verification: the new test and the touched suites run in the branch's next CPU job. (cherry picked from commit 2d436ebc2963f1aac1854b850ff1808e654c61f3) |
||
|
|
ca5fecf79c |
State the extended-range conversions' bounds in device-pack-conversion's runtime doc
The runtime's Degradation::DevicePackConversion doc stated only the normalized pack and unpack bounds, though the kind is also announced for every conversion of an extended-range, padded 10-bit or bfloat texel. It now states those bounds too, as the translator's PrecisionNote doc and docs/API.md's catalogue already did: a linear value within one f32 ulp of Metal's, an encoded code within one (R10Unorm_X6_sRGB's and RGB10A2Unorm_sRGB's colour within two below 0.0031308), and a half result within one half ulp. device-rounded-resolve's text already states its bound (one code, an sRGB channel two), and the M3 measures within one, so it is unchanged. Doc-comment only. (cherry picked from commit 192b37ed75b28c0a12e07987ca98768bb264f31d) |
||
|
|
ef2a4e9da8 |
Check in-place YCbCr gathers against Metal's rows and the lane's model
Evidence for the in-place gather: a fixture, four conformance cases and a
device lane test.
- fixtures/public/engine/ycg_sample_gather.metal (ours, compiled by
scripts/regen-air-fixtures): `ycg_float` and `ycg_half` sample, gather
red or gather blue as lane `i % 3` asks, through one runtime sampler, the
shape whose gather used to keep the slot off the in-place form.
- conformance ycbcr_gathers: `ycbcr-gathers-{edge,zero,white,repeat}`, one
linear sampler state each, over a 420v and an x420 surface of 12 x 6
noise texels, float and half, at positions a third of a texel apart from
a texel before the texture to one past it (texel centres included, where
a gather's footprint turns). Recorded on Metal and replayed on the
runtime in a following commit.
- runtime_lane::ycbcr_in_place: on a device whose memory is the host's, a
dispatch of `ycg_float` binds the planes and converts nothing, its
samples are Metal's filter and its gathers Metal's texels at the four
taps (the lane's model), and no filter notice is announced.
The golden tables and the compile census gain the fixture's rows when
they are re-blessed on development.
(cherry picked from commit a561a4b56456c0d1d4dc4ca419dc9cb6cfe1f3f7)
|
||
|
|
6eb2a66d6e |
Gather a two-plane YCbCr texture's planes in place
A function that samples a YCBCR8_420_2P or YCBCR10_420_2P texture and also gathers it (a probe asking each lane for a sample or a gather of red or blue) lost the in-place form for the whole slot: `in_place_sample` built no gather, so the gather set `in_place.blocked`, the slot bound the converted image, and on MoltenVK its linear samples went through Metal's sampler of RGBA16F-like texels: `ycbcr-filter-not-exact` (Half/FloatSampleFilter), and through a pixel sampler `pixel-sampler-scaling`. Those notes killed three of a consumer's strict Mac tests. What: the in-place form now builds a 2D gather of a component without comparison, constant offset or none, through a constexpr sampler (either filter: a gather follows none) or a runtime one. The gather is the extended-range emulation's `gathered` over `Decode::InPlace` taps: the four taps of the linear footprint, each the texel Metal reads there (the border texel past a border axis), in Vulkan's order, a runtime sampler's word mapped as a 4:2:0 texture addresses. A gathered slot stays off the device's own Y'CbCr conversion (`device: false`): VUID-RuntimeSpirv-OpTypeSampledImage-12206 admits only samples through it. No Quad routine for a gather. SEMANTICS_VERSION 1962 (facts and modules of gathered slots change). Tests (engine_ycbcr_in_place): every gather of each component of random 8- and 10-bit planes under three conversions, constexpr and runtime samplers, float and half, on the lavapipe and moltenvk-m3 profiles, equals Metal's model taps on the interpreter; a gather states the in-place fact with `device: false`; a function that samples and gathers through one runtime sampler notes FloatSampleFilter/HalfSampleFilter on its image compile and states the fact, and its in-place compile builds both forms and notes neither those nor PixelSamplerScaling. Device evidence against Metal's rows follows with the fixture and conformance cases. Docs: API.md and FAST-PATHS (in-place reads and the planes-image row), RuntimeFact::YCbCrInPlace, InPlaceReads, the runtime README. (cherry picked from commit b95b95a355f9a8ff4c1bfacbf329a728c4896db9) |
||
|
|
2e2c1ec056 |
Leave fneg, fabs, floor and ceil unnoted where the M3's Metal keeps their denormals
MoltenVK on the Apple M3 Max runs a SPIR-V `OpFNegate`, `FAbs`, `Floor` and `Ceil` through Metal's own compiler, which keeps a denormal operand of negation and absolute value and reads it as the zero of its sign in floor and ceil, as plain Metal does. The translator noted `DeviceDenormals` on every such operation, so a strict consumer died on a kernel that negates a float though the answer is Metal's. What: a new APPLE9-only `DriverDeviation::MetalUnaryDenormals` (and its `VkProperty`) on the moltenvk-m3 profile. A function whose float negation, fabs, floor or ceil the deviation covers records no `DeviceDenormals` for them and requires the property instead; fabs keeps its Metal-own exemption on every other profile, and trunc, round, rint, fract, sign and the rest stay noted (the lane does not check them). `ARTIFACT_FORMAT_VERSION` 486 (the property's tag), `SEMANTICS_VERSION` 1961 (notes and requirements change). Evidence: the committed MoltenVK M3 observations of the four denormal cases (nan_denormals, nan_denormals_fast, dfl, dfl_fast) hash equal to Metal's on the same M3. The float_denormals gate lane now checks probe rows -a, 0-a, -(a*b), fabs(a), floor and ceil where the deviation is taken, and asserts the module requires the property exactly then; the arith unit test covers each op under each fast and unary setting. Device runs follow on the GPU job for this stack. Docs: FAST-PATHS row on device denormals, API.md degrade catalogue, driver_facts' measurement paragraph, api_signatures.tsv; refusal surface and signatures checks pass. (cherry picked from commit f3f65903a395b46b3a8001c4259bb1e4bb7bc203) |
||
|
|
a139f39c89 |
Note a texel centre's denormal only under an address mode that parts texel -1 from texel 0
What: a nearest pixel-coordinate sample at its texel's centre, floor(x) + 0.5, records
DeviceDenormals for that floor: Metal's sampler reads a negative subnormal x as texel -1, where a
floor that flushes it (MoltenVK's) makes texel 0. Clamp to edge, mirror clamp to edge and mirrored
repeat read texel -1 as texel 0, so the note now holds only where the s or t mode is repeat, clamp
to zero or clamp to the border:
- a constexpr sampler decides it from its (mapped) s and t modes at compile (centre_parts);
- a runtime sampler slot's clauses add, per axis, a test of the bound sampler's word that the
axis's mode is none of the three. The word is read through a new note-only key,
SpecKey::BoundSamplerWord(slot): no constant declares it and no pipeline's key carries it, so
the mode adds no VkPipeline variant (the alternative, the ADDRESS bits in SamplerState's fields,
would split every runtime pixel sampler slot's pipelines by mode on every device). The plan
records its value beside the pushed specialized values (slots::record_noted, given by
BindingPlan::specialized_value), SpecClause::tests_bound_values counts it, and the runtime's
degrade_bound_values announces such a clause at each draw or dispatch, as it does for a pushed
format class. The runtime's notice reads "under the formats and samplers it binds".
- NoteOn::BoundSampler is the lowering's name for the key.
Why: reims-vgpu's strict Mac tests died on device-denormals from a nearest clamp-to-edge pixel
sampler, under which the device's texel is Metal's.
Tests: tests::engine_sample_coordinates::a_texel_centre_notes_denormals_only_where_its_mode_
parts_texel_minus_one (constexpr array samples per mode on every committed profile; the runtime
slot's clauses evaluated over every s/t mode pair, and never under a normalized state);
cache::tests::the_version_485_member_round_trips;
runtime_lane::pixel_samplers::a_texel_centre_s_denormals_wait_for_a_mode_that_parts_texel_minus_one
(device: nothing at making, nor under clamp to edge and mirror clamp to edge, once under clamp to
zero). Conformance: four cases pixel-samplers-subnormal-{edge,zero,border,mirror}, the RGBA8Unorm
texture through a nearest filter at sixteen coordinates of subnormals, zeros and -2^-126 on each
axis, recorded on Metal in a following commit.
Versions: ARTIFACT_FORMAT_VERSION 485 (the SpecKey variant), SEMANTICS_VERSION 1960 (the clauses).
api_signatures gains the variant. Docs: API.md and FAST-PATHS.md (device-denormals), the
DeviceDenormals, SpecKey, SpecClause and plan rustdoc.
(cherry picked from commit 624008697abfab1dbb3039a926902373b84e1268)
|
||
|
|
308e0728b8 |
Record the M3's heap half reads in the MetalHalfConversion measurement
What: the MetalHalfConversion paragraph of the driver-facts record now states the gate lane's result on the M3 Max: a heap's `half` read of every code of the five forms it holds by raw texels (BGRA10_XR, BGR10_XR, R16Bfloat, RG16Bfloat, RGBA16Bfloat) is the nearest even half of the same read as float, and the slot's half read, in all 262,144 channels of each. Why: the previous commit counts a decoded texel's half rounding as the measured conversion; this is the run that measures it. Verified (potluck m3-max-438, --gpu m3max, MoltenVK 1.4.2, at 020e8fd919): runtime_lane::(heap_extended_reads|half_conversions|alpha_in_red)::, 17 tests, 17 passed; HEAP-HALF-ROUNDING lines: 0 of 262144 channels for each form, note false. CPU job m3-max-352 (same commit): clippy --all-targets --all-features -D warnings plain and --cfg m2v_gpu, the touched core tests (99 passed) and the gpucfg validation build. (cherry picked from commit f8e0383243bdfbc80d4dae0c98a53d123ff6c95a) |
||
|
|
5e87ad8325 |
Bump SEMANTICS_VERSION to 1959: a texel's half rounding counts as measured on MetalHalfConversion profiles
A cached artifact of an unchanged module and profile now carries other precision notes and requirements on moltenvk-m3's identity (NativeHalfConversion dropped, VkProperty::MetalHalfConversion required) though its SPIR-V is the same, so the key moves. Verified: the bump alone. (cherry picked from commit 020e8fd919063865be6537f5b09e74968f25f8c6) |
||
|
|
6e63f015b5 |
Count a texel's half rounding as the measured conversion on MetalHalfConversion profiles
What: narrow::round_texel rounds through round_measured, so in QuantizeForm::Converted the conversion pair's narrowing is recorded as measured. On a profile that takes DriverDeviation::MetalHalfConversion (MoltenVK on the Apple M3 Max's macOS 27 identity) a texel's half rounding no longer records PrecisionNote::NativeHalfConversion. That covers a texel the module decodes itself (extended_range::decode) and a merge of texels (a heap read's phi of its fetched texel and its decode routine's), as well as an image instruction's. The module requires VkProperty::MetalHalfConversion instead. The note stays for roundings by narrow::round: half operations and functions computed in float, filter sums, packs and the rest. Other profiles never read the measured set, so they are unchanged by construction. The SPIR-V is unchanged too: round_measured emits the same pair. Why: reims-vgpu's strict Mac tests die on native-half-conversion at a kernel that reads an argument buffer's texture as half (their ycbcr_probe.metal read_held). Every heap half read carries the decode routine of the seven extended-range/padded/bfloat forms, and its merge, so it recorded the note even for a BGRA8Unorm texture. The note states that the device's conversion may differ from Metal's half(float), and MetalHalfConversion measured that conversion as Metal's half(float) for loaded and computed floats. Where Metal's half texel is not the nearest even half of the texel's value, the access's own note states it: HalfTexelConversion (outright for a heap element, by the bound class at a slot) or DevicePackConversion (a decoded texel). Verified: - New core tests heap_half_texels_round_by_the_measured_conversion (heap half read, nearest sample and gather on moltenvk-m3: no note and the property with the deviation, the note without it, HalfTexelConversion kept; a linear sample's filter sum keeps the note on both) and decoded_half_texels_round_by_the_measured_conversion (a slot's half read of each extended-range form: the same, DevicePackConversion kept). Both fail with round_texel's old rounding and pass with the change; half_conversions_are_metals_where_measured still passes. - Notes of every public fixture subject on moltenvk-m3, lavapipe and nvidia-rtx5080-laptop before and after (a temporary dump over the golden-hash subjects, 2,915 per profile): 7 change, all on moltenvk-m3, each losing NativeHalfConversion alone and keeping HalfTexelConversion (a8r_buffer_read_half, hlf_half_buffer, selected_member_texture and kernel_texture_variant_leftovers, the .ll and .air.ll forms). - reims's ycbcr_probe read_held on moltenvk-m3 through the CLI: [DeviceNanEncoding, HalfTexelConversion, NativeHalfConversion] before. - Pending: the M3 lane heap_half_reads_of_every_code_round_their_float (new) and the lanes that read the note (alpha_in_red now requires a8r_buffer_read_half to be Metal's there). Docs: the PrecisionNote, DriverDeviation and VkProperty rustdoc, API.md's native-half-conversion exemption, the driver-facts record, narrow's docs. (cherry picked from commit 384734851de7b2f1a3106355a6c941080f097be4) |
||
|
|
537667dfcf |
Share kept resident uses between plans that list the same uses
A pipeline state's draws of different primitive types may take plans of their own. The replayed textured page's point draws take another plan than its other four types, so 2 of every 5 replayed draws switch plan. The uses of what the encoder made resident were kept for one plan only, so each switch: - worked all of them out again (resident_uses_made 10,009,006 a frame for 5001 draws over 5002 resident textures, about 2001 draws' worth); - gave them a new identity, so every per-draw walk memo keyed on it (gathered, noted, unordered writes, indirect reads, geometry writes, attachments, pass reads) walked them again. Those uses are a function of the plan's uses (BindingPlan::uses) and the residency alone (binding::resident_uses_into). So the kept ones now serve any plan whose uses equal those of the plan they were made for. A plan is compared once, and the answer kept for the last five plans compared (ResidentOf::compared). Measured, release, the replayed textured page, interleaved with the commit before over two rounds (3 frames each): - Apple M3 Max, MoltenVK 1.4.2: - host_step_ms 1489-1621 a frame before, 407-468 after; - resident_uses_made 10,009,006 a frame before, 5006 after; - test time 5.1-5.3 s before, 1.8-2.1 s after; - pixels e3306dc52a1c9e86 in both. - RTX 5080 Laptop (b5080 entry resident-x-heap-part-004402, kind t): - host_step_ms 1309-1359 before, 481-525 after; - resident_uses_made 10,009,006 before, 5006 after; - pixels 8e977e2bb4582473 in both. - Against the commit before the heap part: the M3 goes from 10363-10491 to 407-468 ms, the 5080 from 8800-8931 to 481-525. The page's counters are this change's control: the commit before is this one without the sharing. Verified: the checks of the commit before, on this tree, with the same results. The new test passes. On the M3 it passes with the sharing taken out too: the fixture's vertex function writes no point size, so its points and triangles take one plan there. (cherry picked from commit 5ab66c0e6b185cbc2ee0dfb59048bf945bbdd217) |
||
|
|
493178c82e |
Keep a draw's heap part while what it is made of holds
A replayed page's host step costs about 400 ns per replayed draw per
resident texture (reims: 14 s a frame). Each draw works its heap part
out again for every texture its encoder made resident, though the
residency did not change and the command rebinds only a buffer:
- the handle tables, at every heap member (bind::heap::member_id,
table_bytes);
- where the heap writes go (heap_elements, member_id again);
- each heap entry's view check (bound_view, view_reading,
binding_view, Image::view);
- for every member, a neutral image descriptor in each heap image
array whose class it does not fit (neutral_view, border_texel,
BicubicTexels::with_border). heap_sets::bind then dropped every one
of those.
Now:
- The translator splits the heap part from the rest of a draw's
commands:
- BindingPlan::instantiate_draw_apart_into writes every command but
the heap tables;
- heap_tables_into writes the heap tables alone (handle tables,
sampler tables, function-table directories);
- heap_slots names the texture slots they read besides the used
resources.
instantiate_draw_into is unchanged. A consumer breaks nowhere: all
three are additions. docs/API.md says when the tables may be kept.
- The runtime keeps each draw's heap part in its encoder's LiveBind
(render/heap_part.rs): the heap tables, where the heap writes go
(Arc<HeapElements>), and the writes past the heap's entries
(binding::PastHeap). The first draw that checks every entry's view
lists those writes, and meets no notice the device announces at each
occurrence (EachWatch) while it does.
- What a part is made of:
- the plan, by address;
- the variant's heap capacity;
- the residency's generation;
- the argument samplers: the count of sampler-ID slot changes they
were listed at, else compared state by state;
- the function tables, compared;
- what the plan's heap slots bind, compared;
- the heap placement and the token order.
- Parts are kept for the last 8 plans, so pipeline states drawn in
turn and the plans a draw's primitive type picks each keep their
own. They go as the encoder ends.
- Builds with debug assertions check every kept part against one
worked out whole, and every listing of writes past the heap against
one listed again.
- bind_into writes no heap image element at all, whatever the plan
reads: the device's heap set holds each one. One predicate,
heap_sets::holds_element, now says this for bind_into and
heap_sets::bind.
- WorkCounts::draw_heap_parts_made counts the parts worked out. The
replayed-frames lanes print it, and the resident uses' walk counters.
Builds with debug assertions check a kept listing against the writes
listed again in place, allocating nothing.
Measured, release, the replayed textured page
(runtime_lane::replayed_textured, 3 frames, interleaved with the
commit before over two rounds):
- Apple M3 Max, MoltenVK 1.4.2:
- host_step_ms 10363-10491 a frame before, 1489-1621 after;
- test time 31.7-32.5 s before, 5.1-5.3 s after;
- pixels e3306dc52a1c9e86 in both;
- peak RSS 306-317 MiB in both.
- RTX 5080 Laptop (b5080 entry resident-x-heap-part-004402, kind t):
- host_step_ms 8800-8931 before, 1309-1359 after;
- pixels 8e977e2bb4582473 in both.
- After, in both: draw_heap_parts_made 2 a frame (the point draws'
plan and the other draws'). resident_uses_made stays 10,009,006 a
frame; the next commit addresses it.
The 5080 binaries came from build-only commits. Their release code
equals this tree's but for the Deferred Send and Sync below this
commit and the lane's extra counter print.
Verified:
- On the M3 (potluck), clippy, plain and --cfg m2v_gpu, all targets,
of the translator, the runtime and the validation crate; Rustdoc
-D warnings; scripts/api-docs.
- The translator's heap, binder, instantiate and api tests, 143 of
143. Among them, graphics tests check that instantiate_draw_apart_into
plus heap_tables_into equals instantiate_draw_into wherever the
latter succeeds.
- The runtime's suite, debug, --cfg m2v_gpu, hazard filter: 1626 of
1627. The one failure, exit_guard's
only_the_listed_modules_keep_the_device_s_functions, fails on the
base too: a547d0ce33's command_buffer Parts shares a name with the
device's Parts.
- The validation lanes over residency, draws and notices, debug,
--cfg m2v_gpu, hazard filter: 246 of 247. The one failure is
runtime_lane::frame_costs::a_frame_s_draws_and_pass_ends_allocate_
within_their_bounds: 21.50 allocations a draw on the M3 against
DRAW_ALLOCATIONS_DEBUG, 20. Whether that comes from this change or
from its base is not yet measured. The release bound
(DRAW_ALLOCATIONS) was not run.
- Negative control: with the kept part never kept, the new test fails
at draw 1 (heap_parts 1, expected 0).
(cherry picked from commit 12f8301c62ffbbc149c04792007895649b8fe9ed)
|
||
|
|
6be8045e7c |
Add a draw's resident geometry writes once per identity
GeometryWrites::add holds what an instance's draws wrote before their fragments, which a later draw's fragments touching it wait for. It walked every use of every draw, the uses of what the encoder made resident included. As with UnorderedWrites (de4b3e9984) and IndirectReads, those come first and are the same for every draw of one identity (binding::ResidentPrefix). - The new GeometryWrites::add_draw((uses, prefix)) adds the uses after them at every draw. - It adds theirs only where the last add_draw of the instance began with another identity. Otherwise they are held already, merged or not, and adding them again changes nothing barrier_before() reads. - The writes, and the identity with them, begin anew with each instance (GeometryWrites::new). - Builds with debug assertions check that every skipped write is held, by range and by its access in the stages before the fragments. The count, WorkCounts::resident_uses_geometry_writes, moves onto the walk's branch. Verified (CPU job, debug): - tests::tracker::draws_add_the_geometry_writes_of_what_their_encoder_ made_resident_once_by_identity: walked once past ENTRIES_PER_KEY draws; a later fragment read waits for the writes; another identity walks its own, and the first walks again after it; a new instance holds none. - Clippy, with and without --cfg m2v_gpu: clean. - Negative control, the identity compare dropped: that test fails. - tests::resident_uses checks the count with the others. It runs in the device suite at this stack's tip. Numbers (M3 Max, release, measured on 8de5619780 + this change, the same diff as here; base M2 = 8de5619780): - resident_draws N5000, marginal instructions a draw (30 frames less 10): entry own encoder 171,618 -> 141,699; entry own write 212,559 -> 182,658. Frame median 58.6 -> 47.1 ms and 76.8 -> 66.9 ms. - The walk's count over 2 frames: resident_uses_geometry_writes 50,020,000 -> 10,004 (encoder) and 50,030,000 -> 10,006 (write); the other walks' counts unchanged. - draws.10k runtime leg: 8355.1 / 8355.3 -> 8348.5 / 8354.1 instructions a draw. (cherry picked from commit 6f52bc5a6d8798a85cdbde94c0844783f9569390) |
||
|
|
5a86608e82 |
Add a draw's resident indirect reads once per identity
IndirectReads::add, the reads an instance's draws made as indirect arguments (which a later draw of the instance writing them waits for), walked every use of every draw, the uses of what the encoder made resident included. As with UnorderedWrites (de4b3e9984), those come first and are the same for every draw of one identity (binding::ResidentPrefix). - The new IndirectReads::add_draw((uses, prefix)) adds the uses after them at every draw. - It adds theirs only where the last add_draw of the instance began with another identity. Otherwise they are held already, merged or not, and adding them again changes nothing written_in() reads. - An instance's reads begin anew with it (IndirectReads::new at each instance), the identity with them. - Builds with debug assertions check that every skipped read is held, by range and access (KeptUses::holds). The count, WorkCounts::resident_uses_indirect_reads, moves onto the walk's branch. Verified (CPU job, debug): - tests::tracker::draws_add_the_indirect_reads_of_what_their_encoder_ made_resident_once_by_identity: walked once past ENTRIES_PER_KEY draws; a later write meets the reads; another identity walks its own, and the first walks again after it; a new instance holds none. - Clippy, with and without --cfg m2v_gpu: clean. - Negative control, the identity compare dropped (any identity taken as held): that test fails. - tests::resident_uses checks the count with the others. It runs in the device suite at this stack's tip. Measured, M3 Max, release, resident_draws lane at N 5000 (job m3-max-518; the parent de4b3e9984 in job m3-max-348), marginal over 100,000 draws: | | parent | this commit | |---|---|---| | own encoder, instructions a draw | 196,489 | 171,618 (-12.7%) | | own encoder, cycles a draw | 51,823 | 40,937 | | own write, instructions a draw | 237,561 | 212,559 (-10.5%) | | resident_uses_indirect_reads, 2 frames | 50,020,000 | 10,004 | The count is now one walk of the 5,002 uses a frame, where they are made. draws.10k runtime leg: 8355.1 / 8355.3 instructions a draw, against 8375.7 / 8375.7 at the parent. (cherry picked from commit 8de5619780059340abb26da82d670e84581521d5) (cherry picked from commit ac61b6de79f929614f143c166d411df7606138aa) |
||
|
|
1181ebe77f |
Add a draw's resident writes to the unordered writes once per identity
UnorderedWrites::add walked every use of every draw, the uses of what
the encoder made resident included. Those come first and are the same
for every draw of one identity (binding::ResidentPrefix): one key,
range, stages and access types each, a function of the plan and the
residency's generation alone (command_uses_into). The new
UnorderedWrites::add_draw((uses, prefix)) adds the uses after the
prefix at every draw. It adds the prefix's writes only where the last
add_draw since the last clear began with another identity. Otherwise
they are held already, merged or not, and adding them again changes
nothing written() reads.
- clear() (a memory barrier) forgets the identity, so the next draw
adds them again.
- A draw of another identity adds its own, and becomes the identity
held.
- Builds with debug assertions check that every skipped write is held,
covered by range and access.
render.rs and render/draw_again/rebound.rs call add_draw where the draw
has a prefix and count the resident uses only where it walked them
(WorkCounts::resident_uses_unordered_writes). Tile dispatches keep
add.
Verified:
- tests::tracker::draws_add_the_writes_of_what_their_encoder_made_
resident_once_until_a_barrier: walked once past ENTRIES_PER_KEY
draws; the writes are read; after a clear they are walked again and
read again; another identity walks its own, and the first walks
again after it. 65/65 tracker tests pass, CPU, debug.
- Negative control, the reset in clear() removed: that test fails at
the debug check ("an encoder added a draw's writes by their identity
less than its uses").
- tests::resident_uses checks the new count with the others: 0 for a
draw that keeps its uses, more where they were made again. It runs
in the device suite at this stack's tip.
Measured, M3 Max, release, resident_draws lane at N 5000 (job
m3-max-348; the parent 8e4e904fb6 in job m3-max-273), marginal over
100,000 draws:
| | parent | this commit |
|---|---|---|
| own encoder, instructions a draw | 236,696 | 196,489 (-17.0%) |
| own encoder, cycles a draw | 65,573 | 51,823 |
| own write, instructions a draw | 277,582 | 237,561 (-14.4%) |
| resident_uses_unordered_writes, 2 frames | 50,020,000 | 10,004 |
The count is now one walk of the 5,002 uses a frame, where they are
made.
draws.10k runtime leg: 8375.7 / 8375.7 instructions a draw, against
8387.6 / 8395.8 at the parent.
(cherry picked from commit de4b3e99842757dbfd023b2e55b7b11d6158f6b5)
(cherry picked from commit cd699661642fbb21444d09e48dc3d5be6218f5ba)
|
||
|
|
23f8b141a1 |
Count the resident uses each per-draw tracker walk walks
A render draw walks every one of its uses in four trackers: - UnorderedWrites::add (the writes no memory barrier orders yet); - IndirectReads::add (what the instance's draws read as indirect arguments); - GeometryWrites::add (what they wrote before their fragments); - GeometryWrites::barrier_before (the check against those). That includes the uses of what the encoder made resident, which come first and are the same for every draw of one identity (binding::ResidentPrefix). At N resident resources each walk is N uses a draw. Four WorkCounts fields count the resident uses each walk walked, so the memos that follow can show what they remove: - resident_uses_unordered_writes; - resident_uses_indirect_reads; - resident_uses_geometry_writes; - resident_uses_geometry_checked (a rebound draw's check whether it may rebind included). They are counted at the call sites in render.rs and render/draw_again/rebound.rs, and nothing is counted where a draw has no such uses. The public surface grows by the four fields (api_signatures.tsv blessed); nothing breaks for a consumer. Measured, M3 Max, release, resident_draws lane, N 5000, 2 frames with the counter dump (job m3-max-273): - entry own encoder: 50,020,000 a walk, 5,000 a draw for each of the four (resident_uses_made 10,004); - entry own write: 50,030,000 a walk. Marginal cost (30 frames less 10, over 100,000 draws), unchanged by this commit's count: - own encoder: 236,696 instructions a draw; - own write: 277,582 instructions a draw. A Time Profiler run of the same lane (x3's tip with UnorderedWrites::add kept out of line, job m3-max-215) put the four walks at about 56% of the encoding thread at N 5000 own encoder: UnorderedWrites::add 17.2%, IndirectReads::add 15.9%, GeometryWrites::add 14.4%, barrier_before 8.9%. On draws.10k they are 0.5%, 0.4%, 0.6% and 0.3%. draws.10k runtime leg: 8387.6 / 8395.8 instructions a draw, against 8334 to 8337 at the parent. The 4 counts, the guard and the prefix look-ups cost about 55 instructions a draw on that path. The memos that follow move each count onto its walk's own branch. (cherry picked from commit 8e4e904fb6143f6a71ac6a5cda8422ae8adcb889) (cherry picked from commit 84e6d9d6a40c6fe3ddee07c3171df52e95b4aad5) |
||
|
|
c52d0e8d48 |
End the auto-trait walk of an object's fields at the device's resource IDs
A program's crate proves Send and Sync of the runtime's objects at rustc's default recursion limit of 128 (tests/consumer_auto_traits.rs). Checked one object a crate at each limit (-Zcrate-attr=recursion_limit, M3 m3-max-827 at cd7b2a7e74), a Mutex<Option<ComputeCommandEncoder>> needed 124, four levels from failing; VisibleFunctionTable 115, a blit encoder 114, the pipeline states 113 and 111, Library and Function 109, Device 92, most other handles 95. The reported walks run through ResourceIds: a function's holds, a pipeline state's numbered samplers and every ID's hold reach the device's ID table, and from it, through its holders' weak references to textures, samplers, pipeline states, libraries and functions, nearly every other object. ResourceIds's Send and Sync are now written out. A constant proves each field Send and Sync in this crate (at its limit of 256), its pattern naming every field, so a field added fails it until it is proved too, and the impls claim nothing it does not check. A consumer's walk ends at the table. Verified: nothing yet; the M3 clippy and the per-object limits follow. (cherry picked from commit 12ef2e3078114a240233c0375df7f7e3173f1a76) |
||
|
|
8fcff2117f |
Put a host step's copy of a chunk's records off where they changed at two steps in a row
On the 5080, a page whose GPU-written records change at every frame (replayed_frames at K=0, 5000 records, CHANGE_EACH) paid about 0.9 ms more a host step than the baseline: base 19.15 ms, the tip 20.05, means of 3 interleaved runs of 22 warm frames each (b5080 entry icb-p-010218). The same tip with the host step's keeping cut off (no comparison, no copy) ran 19.31. perf of the steps thread put the difference in memmove: each step copied every chunk's records, 11 MB, into the copy the next step compares with, 575 KB a chunk, past the caches (h 501 Mcycles of memmove against 416 with no keeping). The comparison itself is a few hundred microseconds less than that and the single read (ff4610cd46) already left one read a record. A host step that records inline now copies a chunk's records only where it needs them (kept_commands::StepCopy, held in each chunk's state beside the bytes it last read): - where the records hold the bytes the last step read, it records from those bytes and copies nothing (ReadFrom::Held); - where they changed since, it copies them again, as before; - where they changed at the step before too, it reads them in place, record by record, as an execution that keeps nothing does (ReadFrom::InPlace, RecordSource::Storage), and copies them at one step in eight only (COPY_EVERY), each chunk at a step of its own among the eight, until a comparison finds them as the step before read them. A CPU write to the chunk, or a recording of it kept or forgotten, starts it over. So records that change at each step are copied for an eighth of their chunks a step, and a chunk whose records stop changing is copied again within eight steps and compared at the next. What a step keeps is unchanged: a chunk is kept only where its records compared equal, byte for byte. WorkCounts::host_step_chunk_copies_put_off counts the chunks read in place. Tests: kept_commands::tests::records_that_change_at_each_step_are_copied_at_one_step_in_eight_a_chunk (the schedule: chunk 0 copied at steps 0, 1, 10, 18, 26, chunk 7 at 0, 1, 3, 11, 19, 27, one chunk in eight a step from step 3, a held comparison and a write start it over). The kept-steps lane's changing case asserts each chunk's copy put off from the records' second change on, each record still read once (indirect_record_bytes_copied), the pixels a fresh page's, and that once the records hold again a step within ten records apart and keeps every chunk, the next running them kept. replayed_frames' split prints host_step_chunk_copies_put_off and indirect_record_bytes_copied. Verified: nothing yet; the M3 clippy, units and lanes, the negative control (always copy) and the 5080 timings follow. (cherry picked from commit cd7b2a7e74f2a6aeef4e8080689bb4bab50c0a2f) |
||
|
|
2e04276d2b |
End the auto-trait walk of a segment's work at Deferred, in place of the command buffer's state
The command buffer's StateLock (65d9d241fe) did not bring tests/consumer_auto_traits.rs back under rustc's default recursion limit (M3 job m3-max-712: clippy plain and --cfg m2v_gpu still fail, recursion_depth_exceeding_limit on Send of a Mutex<Option<ComputeCommandEncoder>>). The walk it reports runs from the compute encoder's core through its segments into their work and round it: EncoderCore, Vec<Segment>, Segment, Deferred, Arc<LoopCheck>, LoopCheck, Vec<Piece>, Piece, Deferred, and on. The state is one way into that work among several, so StateLock goes. Deferred's Send and Sync are now written out: each variant holds one Arc of its work, which is Send and Sync for every work that is both, and a constant proves that of each variant's work in this crate (at its limit of 256), its match naming every variant, so a variant added fails it until its work is proved too. A consumer's walk of any segment's work, from an encoder, a command buffer's recordings or a loop check's pieces, ends there. Verified: nothing yet; the M3 clippy (workspace, plain and --cfg m2v_gpu), rustdoc and the test crate's margin at lower recursion limits follow. (cherry picked from commit 56620f6a71edac26850357a386e4cec98bb0173d) |
||
|
|
7e9e6a1485 |
End the auto-trait walk of a command buffer at its state, at the default recursion limit
A program's crate proves Send and Sync of the runtime's objects at rustc's default recursion limit of 128 (tests/consumer_auto_traits.rs). Since the batch footprints kept apart from the state (the recordings and batches behind a Revised revision), the walk from a compute encoder held in a Mutex<Option<_>> runs past it, through its command buffer's state and down the recordings: consumer_auto_traits fails to build (recursion_depth_exceeding_limit, denied by -D warnings) under clippy plain and under --cfg m2v_gpu. CommandBufferShared::state is now a StateLock, a Mutex<State> whose Send and Sync are written out: a Mutex<State> is both for every State: Send, and a constant makes the compiler prove State: Send from its fields inside this crate (at its own limit of 256), so the impls claim nothing it does not check, and a field added to State is checked by the same proof. A consumer's walk ends there. StateLock derefs to the Mutex, so every lock site is unchanged. Verified: nothing yet; the M3 clippy (plain, workspace, all targets; and --cfg m2v_gpu), rustdoc and unit job follows. (cherry picked from commit 65d9d241fe731a39767fc3cbde95cfc189735a42) |
||
|
|
2d5e958cd0 |
Hold a footprint's segment probes behind a trait object
Clippy at ae5b372e7a (m3-max-622): consumers' proofs that the runtime's types are Send overflowed the recursion limit (examples/queue_share.rs's spawn, tests/consumer_auto_traits.rs's Mutex<Option<ComputeCommandEncoder>>): c1557efe2b made each command buffer's kept footprints hold their segments' work (Deferred) and step inputs, a second path to those types from every command buffer. A probe now holds a boxed Fn + Send + Sync that asks them, which ends the auto-trait proof there. (cherry picked from commit bcf80bd496254457f154aed8e587bf2d84176e36) |
||
|
|
40e884bd85 |
Box the kept arm of Keeps and read a step's copies as fixed-size records
Clippy (m3-max-586 at ff4610cd46): Keeps::Kept was 784 bytes against 24 for Inline (large_enum_variant), and chunks_exact of a constant length is as_chunks. Behaviour is unchanged. (cherry picked from commit ae5b372e7a66aac5ea762ae4c020abd915e0ee24) |
||
|
|
3ab5303945 |
Have a host step that records inline read its records once, into the copy it keeps
A step whose records change at each frame copied every chunk's records for the next step's comparison (written_bytes_into) and then read each record again to decode it (record_now): 11 MB copied twice a frame on a page of 5000 commands. On the 5080, three interleaved runs at K=0 with records changing every frame stepped 19.6 ms on average against 19.0 ms at 04115e977f, with libc's copy at 13.4% of the steps thread's cycles against 11.2%. steady now hands such a step StepReads, what it reads its records into, chunk by chunk: the bytes the last step read where it has them, else a fresh copy, and a chunk whose kept recording's records hold reads those. The inline recording decodes its records from those copies (IndirectCommandBuffer::written_records_in), and keeps them for the next comparison once it recorded. keeping answers Keeps: kept, or inline with or without reads. WorkCounts::indirect_record_bytes_copied counts the bytes copied out of a buffer's record storage. The kept_steps lane's changing frames now expect each record copied once (DRAWS x COMMAND_BYTES); copying them again besides fails it. Not built or run yet. (cherry picked from commit ff4610cd4660b94835af7841e24114d6ee89fae2) |
||
|
|
cda1d778de |
Read a batch's kept footprint without its command buffer's state lock
On the textured page (5001 GPU-written commands, 5001 resident textures) the M3 sample shows the scheduler thread waiting in CommandBufferShared::footprint for a command buffer's state lock in 1761 of its 6836 samples (26%): each pass's ask of a kept footprint took the lock to check what it was built from, while a host step's draws and commits' work take it. The recordings and the batches, which every footprint is built from, are now Revised parts of the state: every mutable access moves one revision they share, an atomic the command buffer's Footprints hold apart from the state with the kept footprints. A kept footprint stands where the revision is the one it was built at and each of its segments' probes gives the answers it gave then (the work's gpu_written, rewritten, outgrown and holds, and whether a rerecord is due): those, with the segment's fields that the revision covers, are everything the share a segment takes turns on, so the check is exact. A build still gathers under the lock and keeps its result only where the revision did not move meanwhile; an ask that finds the lock taken counts WorkCounts::footprint_lock_waits. The device test footprint_locks asks for a kept footprint while the state is locked and expects the same footprint back at once, with no build and no wait, then a build after another encoder ends into the batch. The lane split prints footprint_lock_waits. Not built or run yet: a CPU job (clippy, api_signatures) and a GPU job (the test, its negative control, the textured page's samples) follow. (cherry picked from commit c1557efe2b25a739a4947ddf2d42c57da2cc79b2) |
||
|
|
251bede077 |
Print the bind and residency counters in each replayed frame's split
root_table_ranges_noted, resident_uses_made and _gathered, resident_address_indexes_made, stage_tables_read, draws_rebound, draws_as_before, heap_tables_worked_out, host_range_lookups and argument_samplers_taken, beside the step's own: the textured page's step is to be split by what each command's binding does. (cherry picked from commit e3fc1bccb4834ff7ad7a30fb82454f21fa74d1e3) |
||
|
|
bce2855116 |
Say which draws indirect_draws_recorded counts and which it does not
It counts vkCmdDrawIndirect and vkCmdDrawIndexedIndirect only; a command a host step or a commit replays from an indirect command buffer's record is a direct draw. A consumer read its 0 beside 5001 records read as records resolving to nothing. (cherry picked from commit 517d2d270dd9a167b9aaf916cb4ea7bd8af085a6) |
||
|
|
2ddd9a8c7a |
Bring the textured page's library trait into scope and pass its instances as u32
The first build of replayed_textured.rs (m3-max-530) failed: new_library_with_air is AirLibrary's, and draw_primitives takes a u32 base instance. (cherry picked from commit 742498ebd6a30c8f87f6feb2921ad5ed9e2d4c60) |
||
|
|
3550112c29 |
Time a replayed page whose commands each bind their own argument buffer and texture
The host-replayed step a consumer measured costs about 14 s a frame on a page of 5001 GPU-written commands, each drawing with a texture of its own, under a residency of 15018 buffers and 5001 textures; replayed_frames' page binds no buffer per command and keeps one kind of resident. The owned fixture icb_vertex_encode_textured has each command set its fragment buffer to an argument buffer of its own (through a slot table of addresses), whose entry names its texture, and replayed_textured_frames times that page's frames as replayed_frames does, with REPLAYED_TEXTURED_DRAWS and REPLAYED_TEXTURED_BUFFERS setting the counts. replayed_frames' timing loop is now time_frames, which both use. Ignored measurement; not run yet (built and run on the M3 next). (cherry picked from commit 71890e856e34894733ef68fe61526a2ea2ffd177) |