Commit Graph
3067 Commits
Author SHA1 Message Date
Anees Iqbal 557652bd4a RUNTIME_VERSION 1964 and the runtime-sources pin for libraries of shaders reporting what their driver found
ownpixel's 037983e7a0: the pre-rasterization and fragment-shader libraries chain
VK_EXT_pipeline_creation_feedback and go through make_pipelines_reported, so a library the driver
found in its loaded record reads nothing back and writes nothing. RADV's data for such a library
could come back the same length with a byte changed, so the read-back compare saw a new hash and
wrote the record again (tests::warm's 'counts only what it writes' red, 2 in 20 on the 780M). The
runtime changed, so RUNTIME_VERSION 1964.

Verified (ownpixel), 780M RADV PHOENIX ('1002:15bf!'), Mesa 26.2.6, release, --cfg m2v_gpu, job
11466: without the fix the warm test failed 1 of 100 and the new
a_library_of_shaders_reports_what_its_driver_found reads 0 reports; with it, the new test x21 (2
hits, 0 written), the warm test x101, warm/shader_cache/driver_pipeline_compile 31, the runtime
suite x3 1964 each, pipeline_records and cache lanes 10; clippy plain and m2v_gpu clean (msi
11471). Pending: lavapipe 11484, the 5080 entry. Here: the API-signature check, REFUSALS.md and
CONFORMANCE-COVERAGE.md regenerate unchanged, cargo fmt clean.
2026-11-09 02:52:48 -08:00
Anees Iqbal 5cd5f93c9e Libraries of shaders report what their driver found, so a found one's record is not written again
What: where the device links its render pipelines from graphics pipeline libraries, the
pre-rasterization and fragment shader libraries were made through the shader cache with no
VK_EXT_pipeline_creation_feedback, so every such making read the driver's data back and compared
its SHA-256 with what the cache was loaded with. They now chain the feedback as a whole
pipeline's making does (VariantObjects::library_of_shaders). A library that the driver reports
found in the cache its record loaded reads nothing back and writes nothing (driver_data_found).
The reports count in driver_pipeline_hits and misses, as the pipeline_records and cache lanes
already count a linked device's makings.

Why: tests::warm::a_pass_over_its_records_own_directory_counts_only_what_it_writes failed in 1 of
3 full runtime suites on PHOENIX. The cause is the device, not another test or the load. I probed
the driver's data before and after each making on gem10's Radeon 780M (RADV PHOENIX, Mesa
26.2.6, release, --cfg m2v_gpu): the test failed in 2 of 20 runs alone. In both, the state's two
libraries were found in their loaded records, and each left data of the record's length with
one byte different (of 1352 and 1092 bytes, at offsets 708 and 796). keep() took the new
SHA-256 for new data and wrote both records again, while counting no growth: "2 records' data
written, pipeline_bytes 0". Whole pipelines report found and read nothing back, so the same drift
on them wrote nothing. The data's format is the driver's own, so no comparison here reads its
entries; the driver's report decides.

The negative: tests::driver_pipeline_compile::a_library_of_shaders_reports_what_its_driver_found.
A second device, over the directory where a first device's creation of a state wrote, must count
one report per library of shaders (2), with found == hits, and where both are found it writes no
record. Without the fix it reads 0 hits and 0 misses and fails.

Verified on gem10's 780M (RADV PHOENIX via MESA_VK_DEVICE_SELECT=1002:15bf!, Mesa 26.2.6,
release, --cfg m2v_gpu), in one job over the test alone and then the fix:
- The test alone (the negative) fails: 0 reports, 2 records loaded. The warm test x100 without
  the fix: 99 passed and 1 failed (2 records' data written, 2 found, 0 unchanged).
- With the fix:
  - The new test passed x21: 2 hits, 0 misses, 2 found, 0 written.
  - The warm test passed x101: 0 bytes, 0 written, 4 found.
  - tests::warm, shader_cache and driver_pipeline_compile: 31 passed.
  - The runtime suite (the GPU-hazard filter, the GPU-time tests left out) passed in 3 runs,
    1964 tests each.
  - runtime_lane::pipeline_records and runtime_lane::cache: 10 passed. Their second device
    read loads 2, saves 0, found 2, hits 2.
- cargo clippy -p metal2vulkan-runtime --all-targets --all-features -D warnings is clean, plain
  and with --cfg m2v_gpu.

(cherry picked from commit 037983e7a04af9346bcad1e4d4b61af864627fe0)
2026-11-09 02:51:59 -08:00
Anees Iqbal afe01b6093 in_place_textures lane: FdBlocks reads Unchecked where the device makes no exportable block, not as a failed check
The VERDICTS doc said a class the device cannot check reads Unchecked; it now says why FdBlocks
does on discrete devices: they have no unified memory, so memory.rs's fd_buffer_types refuses
and the device makes no block of its buffers exportable for the check to cover. Doc only.

(cherry picked from commit 3920fc9b0877dbb66d986c51c7dfa6fa4ff5a35e)
2026-11-09 02:36:12 -08:00
Anees Iqbal 1cf6d5b246 in_place_textures lane: the check's verdicts count the opaque-fd blocks class
runtime_lane::in_place_textures::a_failed_check_keeps_the_shadow_and_no_record failed on the
RX 7900 XTX at 92202c5eaf: 98 verdicts where it held the report to 84. The opaque-fd block
split added PagesClass::FdBlocks, and the check's report gives every class of PagesClass::ALL
on every device (in_place.rs's VERDICTS: row ends x classes x accesses), a class the device
cannot check reading Unchecked, as FdBlocks does where the device allocates no block of its
buffers exportable (every discrete device). So the lane counts seven classes: 98.

Verification: the in_place_textures lane on the XTX and the 780M follows.
(cherry picked from commit e55bd8200c5ecbd44878e5cab96d93eefe844c51)
2026-11-09 02:36:12 -08:00
Anees Iqbal 3cec9c05e6 Re-pin the runtime sources for completion_order's held pauses
d34f25a74b changes contexts/mod.rs, a pinned runtime source, in test-cfg code only (the pause
after a queue context's items held until the test lets it go), so the pin moves while the
runtime's behavior does not: no RUNTIME_VERSION change.

Verified (radvruns): um790 RADV PHOENIX release gpucfg: beside a full runtime suite the old test
failed 1 of 90 with "7 pauses" (completion_order.rs:313) and the fixed one passed 105 of 105;
20 full suites at d34f25a74b passed the test 20/20 (18 fully green, the other two only the
known warm red); M3 clippy plain/m2v_gpu/m2v_cpu_icd and rustdoc clean, runtime 1368/1368.
2026-11-09 02:32:41 -08:00
Anees Iqbal 4011032f3a completion_order: a paused handler thread stays away until the round after its own ended
a_handler_thread_held_off_the_cpu_after_a_wait_returned_keeps_the_order failed 1 in 5 full
runtime suites on RADV PHOENIX ("7 pauses", completion_order.rs:313) and passed 20 of 20 alone.
Its stand-in for a thread the host takes the CPU from was a 100 ms sleep counted after the
thread let go of the transition's hold, and the hold's going is what lets A's waiters return:
the test read the count as its last round's wait returned, before a thread the host had not
yet run again counted that round's pause. The 100 ms also made "the thread is still away as the
next round begins" a matter of time.

Contexts::pause_after_items now pauses a thread until the test lets the pause go
(Contexts::release_pauses; the pool's stop lets every pause go), and Contexts::await_pauses
waits for pauses to begin. Each round waits until one pause a round at least began, then lets
the round before's pauses go, so each round runs with the round before's thread away, and the
count is read once every round's pause began.

Verification: the old and the new test under a CPU hog pinned to the test's cores, and full
runtime suites, on RADV PHOENIX follow.

(cherry picked from commit d34f25a74b53d5495aded8055979fda7b1cdeff4)
2026-11-09 02:32:23 -08:00
Anees Iqbal b3c5a7d169 draw_again: warm returns once the device's own checks ended
A device's queue-switch check (queue_switch_check.rs, started by its first command queue) and
its submission checks (submit_check.rs, started as it is made) record command buffers on threads
of their own, which WorkCounts::commands_recorded counts as it counts a test run's. Under twelve
processes' load on the RTX 5080, draws_after_a_state_set_or_a_barrier_set_what_every_step_sets
read 32 cmd_reset_query_pool, 64 cmd_write_timestamp and 32 end_command_buffer more in one run
than in the other: the queue-switch check recorded inside that run's window.

warm(), which every test comparing runs' counts calls before its windows (draw_again,
command_counts, carried_draws, set_zero_at_offsets, shared_draw_locks), now also waits until
both checks settled (Device::settle_queue_switch_check, Device::settle_submit_checks), as
merge_scratch::settled waits for the in-place check.

warm_returns_once_the_device_s_own_checks_ended holds the queue-switch check between two of its
rounds (QueueSwitch::held) and lets it go only once a call waits for its verdict: without the
wait in warm, warm returns with the verdict pending and the test fails; a device that runs no
such check is skipped.

(cherry picked from commit ed93063389d03e930ba674d6100f31c8913cd2fc)
2026-11-09 02:11:18 -08:00
Anees Iqbal 92202c5eaf RUNTIME_VERSION 1963, the runtime-sources pin and REFUSALS.md for the opaque-fd block split
radvruns' split (43 commits, its fd-blocks-2 branch at dd5e698bff): on a unified device's system
heap, runtime buffers lie in blocks exportable as opaque fds once the device's in-place check
takes them, and buffers that declare their padding unobserved stay in plain blocks. On the 780M
this removes the submit stall behind the kernel's lock (0 turnarounds of 8 ms or more against
11-12; the lock wait 305 -> 2.6 ms). A buffer's making no longer starts the in-place check
(289b04fae4); kept room serves the runtime's own pools first (916073fc37); blocks made ahead stop
at the allocation margin left to the objects (dd5e698bff). REFUSALS.md: BufferLength gains the
pooled_check_buffer site. The runtime changed, so RUNTIME_VERSION 1963.

Verified (radvruns) at dd5e698bff: PHOENIX (um790, release, gpucfg) host_ram_device 22/22, the
seven earlier-red modules 47/47, the full runtime suite 1963/1963 and 1962/1963 (completion_order's
timing test once; base comparison 11395 against tip 11394 running); M3 clippy plain/m2v_gpu/
m2v_cpu_icd and rustdoc clean, runtime 1367/1367, m2v_gpu set 168/168. Open: Iris
in_place_check::the_in_place_check_takes_no_range_of_the_metal_space failed at dccbb9d3d7 (base
vs tip 11363/11364 pending). Here: the API-signature check, REFUSALS.md and
CONFORMANCE-COVERAGE.md regenerated, cargo fmt clean.
2026-11-09 01:45:34 -08:00
Anees Iqbal fc60379c1f Blocks made ahead stop at the allocation margin the runtime's work ahead leaves to the objects
With the runtime's buffers in exportable blocks, keep_room on the 780M kept a pool of the
program's Private buffers and one of its Shared ones; on a device held to a small
maxMemoryAllocationCount those two blocks and the host copies' block made ahead took every
allocation left, and the zero source a new Private buffer's first clear places (first_move.rs's
Zeros, a plain Shared buffer) was refused: the_ahead_thread_leaves_the_allocation_limit_to_the_objects
made no buffer (probe at dccbb9d3d7: three takes to the limit of 5, then Zeros::new refused).

allocations.rs already says the allocations the runtime makes ahead of any object stop while
fewer than a quarter of the limit are left, so the objects have those; only host_ram.rs's
import thread held to it. keep_room's own makings and memory/ready.rs's makings that no call
waits for now ask allocations::room_ahead before they allocate. A call that waits for a
making still has it made.

Verification: the failing test, the host_ram_device module and the runtime gpucfg suite on
RADV PHOENIX follow.

(cherry picked from commit dd5e698bff9bad8b780e6b1b2ff68e4d12cd617e)
2026-11-09 01:44:42 -08:00
Anees Iqbal 97afeae593 Kept room: the runtime's own buffers' pools first, the exportable ones only while they lie there
keep_room kept room in every kept pool in the order Buffers, FdBuffers, Images, whatever kind
of block the runtime's own buffers took. On a device near its count of allocations the plain
Buffers pool's block spent the last allocation the program's buffer, placed in the FdBuffers
pool once the device's in-place verdicts were known, then needed:
tests::host_ram_device::the_ahead_thread_leaves_the_allocation_limit_to_the_objects made no
buffer (Vulkan -10) on RADV PHOENIX at 97f92139dd, where the base made one.

Device::keep_room now asks which kind the runtime's own buffers take (Memory::own_buffers of
Device::fd_blocks_taken, the verdicts as fd_blocks_checked reads them, counting nothing and
starting no check), and keep_room keeps that kind's pools first and the FdBuffers pools only
when that kind is FdBuffers. The FAST-PATHS row on exportable blocks says so.

Verification: the failing test and the runtime gpucfg suite on RADV PHOENIX follow.
(cherry picked from commit 916073fc374888e44f203e7f1c00abbf55497af5)
2026-11-09 01:44:42 -08:00
Anees Iqbal 33f1fecac1 fd blocks: a buffer's making starts no in-place check
The full runtime gpucfg suite on PHOENIX at e03275c440 (job 11224, release) had 16 failures in
completion_here, draw_again, host_residency, teardown_threads, waiter_submits and
pointer_residency. The fd set itself passed 3/3. The failing tests count device-wide state
(recorded commands, host-import residency, threads at teardown, completions).

With this branch the first buffer a device made asked fd_blocks_checked, which went through
in_place_verdict and started the in-place check in the background wherever its verdicts were
pending: on every program's first run on a driver, and in every test with a fresh shader cache.
The check's own buffers, imports and command buffers then ran among the program's, as
tests::recycle showed exactly (472 vs 490-505 recycled under load).

fd_blocks_checked now reads the verdicts without starting the check. The runtime's own buffers
lie in exportable blocks once the verdicts are known: from the check's record as the device is
made, or once a check that a texture over host pages or Device::settle_in_place_checks started
has answered. Until then they lie in plain blocks, counted fd_blocks_awaited, as before.

The recycle tests' settle (3297613ce2's) is removed: it would now start a check the tests have
no use for.

Docs:
- in_place.rs, memory.rs, WorkCounts::fd_blocks_awaited and the bench's arm doc say who starts
  the check.
- The FAST-PATHS Private row drops the unsettled-runtime numbers (taken while a buffer started
  the check): until the verdicts are known the blocks are plain, as the base's. The settled
  numbers stand.

Verification is pending: the full suite at this tip and at development, side by side on
PHOENIX.

(cherry picked from commit 289b04fae4ce20bed3b2ebe92e6b693e7d4a8e0b)
2026-11-09 01:44:42 -08:00
Anees Iqbal 23be585d37 exported_textures: one bullet list in the module doc after the rebase
The rebase onto development put development's dma-buf bullets and this branch's own-blocks
bullet on either side of a blank doc line, which splits the list in two. Doc only.

(cherry picked from commit bea33f59a3855e62b8fefbcf1814a46837b31fde)
2026-11-09 01:44:42 -08:00
Anees Iqbal db278a5170 recycle tests: the device's in-place check settled before a test counts
tests::recycle::each_frames_buffers_take_parked_buffers failed on the 780M (RADV PHOENIX,
Mesa 26.2.6) whenever it ran beside the rest of the suite, and passed when run alone. Under the
suite it recycled 490, 492 and 505 buffers (expected 472) and parked 500, 502 and 523 (480).

The cause: with this branch, the first buffer a device makes asks fd_blocks_checked. Where the
verdicts are pending (a fresh shader cache directory, as each test has), that starts the
device's in-place check in the background. The check makes kernel buffers each round
(new_buffer_placed, shared, outside the address space), releases them, and they park and are
recycled like any buffer. The test counts the device's churn exactly. A per-frame probe
(11184) showed the counts exact through frame 44 and growing from frame 45 on, the check still
running (in_place_check_took None, fd_blocks_awaited 8 per frame).

The recycle tests' device now settles the check (settle_in_place_checks, up to WAIT) before a
test counts. The runtime's behaviour is unchanged.

(cherry picked from commit e47851ed18923489af978bc0350f0580ff2f72b9)
2026-11-09 01:44:41 -08:00
Anees Iqbal 617729cb62 buffer.rs: the recycler's fallback makings asked with bool::then_some, as clippy asks
clippy::unnecessary_filter... (Some(x).filter(|_| predicate)) on the fallback's two makings, under
plain and --cfg m2v_gpu (gem10, job 11041 at 8960f31a93).

(cherry picked from commit 78d0d8592a977123cb45eef1b55b26e8720477d7)
2026-11-09 01:44:41 -08:00
Anees Iqbal cd3676b4f3 FAST-PATHS: the Private row's runtime numbers at the split
From the bench at 73312dc63e on gem10 (RADV PHOENIX, '1002:15bf!', job 10985), two runs of
each runtime arm against the base binary: base 13/12 turnarounds of 8 ms or more quiet and
103/17 fragmented (slowest 40.4/49.0 ms, 350/311 ms of kernel-lock wait); tip fresh 1/1 quiet
(3 plain blocks made while the first check was pending) and 0/0 fragmented (21/24 ms waited);
tip settled 0/0 in both phases (4/10 ms waited).

Verified: docs only.
(cherry picked from commit e5816df55531a25ec0730d82e962f87e9cc17f52)
2026-11-09 01:44:41 -08:00
Anees Iqbal 2d71da75b5 fd blocks: a buffer bound for an exportable block takes a parked plain one
The device's buffers lie in plain blocks until its check answers, so a program's first
frames park plain buffers; with the block kind in the recycler's key, every later frame's
buffers made new ones in exportable blocks instead of taking them (gem10, RADV PHOENIX at
73312dc63e: tests::recycle::each_frames_buffers_take_parked_buffers failed). Any buffer may
lie in a plain block, so a making for an exportable block now asks for a parked plain buffer
of the same size and class where none of its own kind is parked, as a making that found no
fresh pages asks for a parked buffer of the device's memory. A buffer that declares its
padding unobserved still takes only plain ones.

Verified: cargo fmt only; the 780M rerun of the touched tests is dispatched next.
(cherry picked from commit af3bd029acebc54541688f10bf2cad5c502dcce0)
2026-11-09 01:44:41 -08:00
Anees Iqbal 829a68129b FAST-PATHS: the Private row names the split by padding, the first turnaround and what stays plain
The heading and body say buffers that declare their padding unobserved keep plain blocks
and why (a DRM_FORMAT_MOD_LINEAR image over exportable memory needs a dedicated allocation
on RADV); the made-before arm's 57.0 ms first turnaround against 2.4 to 8.1 ms with 64
exportable blocks held (reclaim-10514/10615); what still makes plain blocks
(WorkCounts::plain_buffer_blocks_made) and the second pool's held block; the planes over an
unobserved buffer take the conversion image as before. The RUNTIME_ARMS placeholder is gone;
the runtime arms' numbers follow once the bench at the split has run.

Verified: docs only.
(cherry picked from commit 3619d8e8783039e8568afc4c0e75fb9b943bfd76)
2026-11-09 01:44:41 -08:00
Anees Iqbal 5e020e43bd fd blocks: buffers that declare their padding unobserved stay in plain blocks
A texture over a buffer whose rows lie apart is in place only where the buffer declares
its padding unobserved, and there, over a plain block, it may take a DRM_FORMAT_MOD_LINEAR
image at Metal's pitch, which RADV makes for exportable memory only as a dedicated
allocation. The placement test at b48d8fae41 counted 15276 such textures lost over
exportable blocks for padding-unobserved buffers and 0 for padding-kept ones. So the split:

- BufferDescriptor's padding_unobserved reaches the placement (Made, buffer_of_length,
  NewBufferOf::Unobserved): such a buffer lies in a plain block (Holds::Buffers) wherever;
  every other buffer of the runtime's buffer path lies where the device's own buffers do.
- The recycler's BufferMaking keys on the block kind, so a parked buffer in an exportable
  block is never handed to a padding-unobserved one.
- fd_blocks_cover's second guard asks what a padding-kept texture can take: rows one after
  another at a multiple of 16 bytes where the device's own linear image lies otherwise, at
  every width of linear_alignment::WIDTHS, every backed format and usage; any
  DRM_FORMAT_MOD_LINEAR image of its own memory made there refuses the blocks. The linear
  layout comparison runs at every width too.
- WorkCounts::plain_buffer_blocks_made counts plain blocks of buffers, beside
  fd_buffer_blocks_made, so a lane can read the share of block makes on each side; the bench
  prints it.
- The placement test tries rows rounded to 16 too, makes the program's buffer through
  new_buffer_with_descriptor for each padding, asserts where it lies, and asserts 0 lost for
  both kinds. The nv12 test checks a padding-unobserved picture lies in a plain block while a
  parked exportable one of its making exists.
- Docs: memory.rs, in_place_check.rs, the FAST-PATHS in-place row, the descriptor field and
  the runtime README.

Verified: cargo fmt only; builds and device tests are dispatched next.
(cherry picked from commit 6e5c80ac3caaa2ad26c0456ecfc0801bca4ccd42)
2026-11-09 01:44:41 -08:00
Anees Iqbal ced7920e3a exported_textures: wrap the placement test's lines
(cherry picked from commit b0711c9c1d00438cfdcc2d5fbca000d8fc407a32)
2026-11-09 01:44:41 -08:00
Anees Iqbal 5c1f2295ac exported_textures: the placement test over buffers that declare their padding unobserved too
(cherry picked from commit f0068b7ce6e13108f6368a5f18c4f5d05999e44a)
2026-11-09 01:44:41 -08:00
Anees Iqbal a40b22160f exported_textures: the placement test tries four-row textures and prints why pitched ones are shadows over a plain block
(cherry picked from commit 80229ccbd2eef15134504e43c7d33291d2fee0d7)
2026-11-09 01:44:41 -08:00
Anees Iqbal 005a54ea8d fd blocks: opaque fd only, every image there the device's linear image, behind a cover check
RADV PHOENIX asks a dedicated allocation of a DRM_FORMAT_MOD_LINEAR
image made for an opaque fd or a dma-buf (requiresDedicatedAllocation=1
for formats 9/16/37/44/64/97, m3-max-10880), and its image format query
takes a dma-buf for no linear-tiling image: the dma-buf blocks of
6798cf39a2 held no texture at all (all 1824 in-place layouts of the
placement test lost, m3-max-10884), and the FdBlocks check made nothing.
The one image such a block can hold there is the device's linear image
made for an opaque fd, and over a plain block's buffer no texture took a
DRM_FORMAT_MOD_LINEAR image at Metal's pitch (0 of 1824 over 20736
layouts): the driver takes no explicit pitch but its own.

So the blocks are exportable as an opaque fd again (FD_BLOCKS_HANDLE),
every texture over such a buffer the linear image made for it, gated on
the FdBlocks first-move verdict, and no pitched image there.

Guards, from documented queries and made-and-released images, never a
driver name:
- memory::fd_image_types, at device assembly: per memory type of the
  system heap, kept where a 64x4 linear image made for an opaque fd
  (R8, RG8, RGBA8, RGBA16F; format query exportable and not
  dedicated-only first) takes it wherever the plain linear image does,
  and not asking a dedicated allocation; the memory log names the kept
  types and why the others stay plain.
- Device::fd_blocks_cover (texture/fd_blocks_cover.rs), in the check's
  FdBlocks class: for every backed pixel format and the read, write and
  render usages, the opaque-fd linear image wherever the plain one is
  made, laid out the same (pitch, offset, size, alignment, types); and
  no DRM_FORMAT_MOD_LINEAR image of the device's own memory at a pitch
  other than its linear image's (probed at +256 and twice it). Else the
  class is unmade (lasting, so recorded), fd_blocks_take refuses, and
  the memory log says why.

Removed: the dma-buf block path, Device::modifier_takes_linear, the
probe-then-DRM linear slot, pooled_pitched_image's class parameter.
CHECK_VERSION 16.

Verified: nothing yet.
(cherry picked from commit 0b59a1700f0911b1024f83ed3be30f99fb5e23d8)
2026-11-09 01:44:40 -08:00
Anees Iqbal 4521956b6f exported_textures: the placement test tries rows past the device's own pitch too
(cherry picked from commit dc5fe976873159cf6350fcfc958e3d912338810e)
2026-11-09 01:44:40 -08:00
Anees Iqbal cd331095c8 reclaim bench: the dedicated requirement of each image kind for each handle type
(cherry picked from commit 3cff58bf437c3cb9b065255cceae0b2254c9effd)
2026-11-09 01:44:40 -08:00
Anees Iqbal 730de86375 exported_textures: the placement test leaves out formats of no whole texel
(cherry picked from commit 6e82cb2f21be2bfb668036a8bc8825ddc638df28)
2026-11-09 01:44:40 -08:00
Anees Iqbal 30cc8c9c0b exported_textures: count the plain block's textures that take an image at Metal's pitch
(cherry picked from commit 9122419f4025ce5007a5d98c9c00cd8b740a935d)
2026-11-09 01:44:40 -08:00
Anees Iqbal c93bf81ec9 fd blocks: the DRM_FORMAT_MOD_LINEAR tiling must take what the linear one takes; a placement test over plain and exportable blocks
Every image in a dma-buf-exportable block is DRM_FORMAT_MOD_LINEAR, so
a format whose modifier tiling lacks a usage feature its linear and
optimal tilings both have would turn a texture over a program buffer
from in place into a shadow. Device::modifier_takes_linear checks every
color format the runtime views a texture of any pixel format as, once
per device; where one lacks a feature, the buffers stay in plain blocks
(counted as fd_blocks_refused).

every_texture_in_place_over_a_plain_block_is_in_place_over_an_exportable_one
compares Buffer::texture_placement over a plain block's buffer and an
exportable block's for every backed pixel format, the probe's widths,
two pitches, two offsets and three usages; it fails where the device
takes such blocks and any texture loses its place, and prints the
losses (and those the images alone make, asked as the check asks)
elsewhere.

copied_device's device settles the in-place check first where the
device may take such blocks: the first buffer now starts the check,
whose own pointer imports raced the counts host_backing_answers_... compared
(m3-max-10820: [0,0,0,0,2] for [0,0,0,0,1]).

Verified: nothing yet.
(cherry picked from commit c89bc5b81021cb237a2a65237bf9a8511c1ca348)
2026-11-09 01:44:40 -08:00
Anees Iqbal cb6c971456 fd blocks: dma-buf only, every image there a DRM_FORMAT_MOD_LINEAR one
The validation layer on RADV PHOENIX reported
VUID-VkExportMemoryAllocateInfo-handleTypes-09860 at every bind of a
linear-tiling image into a block allocated exportable as opaque fd and
dma-buf (32 reports over three exported_textures tests, m3-max-10768):
the handle types of an allocation must be supported for the resources
in it, and RADV's image format query takes a dma-buf for no image of
linear tiling (ERROR_FORMAT_NOT_SUPPORTED for formats 9, 16, 37, 44,
64, 97), while it takes an opaque fd for a DRM_FORMAT_MOD_LINEAR image
only from a dedicated allocation (VUID-VkMemoryAllocateInfo-pNext-00639).
No dual-handle block holds either image kind validly.

So the blocks are dma-buf only (FD_BLOCKS_HANDLE), taken where the
device exports a pooled dma-buf for both buffer usages and enables
VK_EXT_image_drm_format_modifier. Every image there is a
DRM_FORMAT_MOD_LINEAR one naming that handle type: where the device's
linear image (made to be measured, never bound) lies on Metal's
layout, one of that layout, gated as before on the FdBlocks first-move
verdict for the texture's row ends and free of the pitched cost bound,
as base's linear form is; else the pitched path at Metal's pitch under
the FdBlocks verdicts. Both count as pooled pitched images.
fd_blocks_take is unchanged. CHECK_VERSION 15, as the class's images
changed. FdExport::compatible and Memory::fd_handles are gone.

Verified: nothing yet; built on gem10 next.
(cherry picked from commit 2b4919bd9e54635c7192b425bb740d9a77f57ec7)
2026-11-09 01:44:40 -08:00
Anees Iqbal ecfe8dc225 reclaim bench: a 16 MiB system-heap arm, for the image pools' growth blocks
Verified: not yet built.
(cherry picked from commit 5a97a25ce536f91d5d95840dd1d1afef1a66111c)
2026-11-09 01:44:40 -08:00
Anees Iqbal 62b8c145e1 fd blocks: module docs for the exportable blocks and their check class
Verified: docs only.
(cherry picked from commit 60ba71488b1895fd01c616be46928908e72c0151)
2026-11-09 01:44:40 -08:00
Anees Iqbal 8c440871cc fd blocks: bless the signature table; a warm-record device test; the bench's settled runtime arm and fd counts
The table gains WorkCounts::fd_blocks_awaited, fd_blocks_refused and
ycbcr_planes_images_kept_exportable_block. exported_textures gains a second device over the
first's shader cache, which must know the verdicts at once and lay its first buffer where they
say. The reclaim bench's runtime arm gains a settled twin (the check settled before the phases,
as a warm record gives) and prints the exportable/plain block makes and the buffers that waited
for the check or were refused.

Verified: m3-max-10741 (a410e3f1a6): clippy plain and m2v_gpu clean on macOS; runtime suite
1355/1355; api_signatures failed only on the three new fields, now blessed.

(cherry picked from commit c49b8084b54e3e2a8bf9bbd19a64db95918020ca)
2026-11-09 01:44:39 -08:00
Anees Iqbal c87d480870 fd blocks: the new class in the remaining matches; Exportable without Debug
Verified: m3-max-10740's clippy (E0004, E0277).
(cherry picked from commit bc6f47f6bfe44eb01f29abe94a0ec9badb55b7c0)
2026-11-09 01:44:39 -08:00
Anees Iqbal d479913bb4 fd blocks: name the in-place access by its module (texture.rs imports tracker's Access)
Verified: m3-max-10737's clippy failed on it (E0252).
(cherry picked from commit 1ac8cbfb383796cd903eb429ffb2a5acf41a3fc9)
2026-11-09 01:44:39 -08:00
Anees Iqbal 473a43312e reclaim bench: the dual handle set from raw bits (ash flags have no const union)
Verified: m3-max-10704's build failed on it (E0599).
(cherry picked from commit 5a9aa2f4210be21aceb00540407bd5e59093234a)
2026-11-09 01:44:39 -08:00
Anees Iqbal ca596ef36e fd blocks: exportable as an opaque fd and a dma-buf where compatible, behind a check class of their own
Main decided (11-08): keep every texture over the runtime's buffers in place. Buffers in the
exportable blocks name OPAQUE_FD; the blocks are allocated exportable as OPAQUE_FD | DMA_BUF
where both buffer queries export pooled memory of the runtime's usages and list each other in
compatibleHandleTypes (VUID-VkExportMemoryAllocateInfo-handleTypes-00656), else OPAQUE_FD. A
texture over such a buffer (BoundMemory::Blocks) makes its linear image for the first handle
type the device's image format query takes non-dedicated (fd, then dma-buf) and its
DRM_FORMAT_MOD_LINEAR image likewise (dma-buf, then fd): on RADV, opaque-fd modifier images are
dedicated-only, dma-buf ones are not (m3-max-10614).

A new in-place check class, PagesClass::FdBlocks (CHECK_VERSION 14), measures a buffer in such
a block with the product's own textures. fd_blocks_take decides from the verdicts whether the
device's buffers lie there at all: the class's first move (Reads) must pass for both row ends,
since a linear image there starts UNDEFINED where over a plain block it starts PREINITIALIZED,
and the class must pass wherever plain pooled memory (Pooled) passed. Until the verdicts are
known (a driver's first run) the buffers lie in plain blocks, counted (fd_blocks_awaited); where
refused, counted too (fd_blocks_refused). YCbCr planes over such a buffer keep the texel-buffer
read, counted apart (ycbcr_planes_images_kept_exportable_block): the check covers single-plane
images alone.

Verified: not yet built.
(cherry picked from commit dca721d4f28452885f71a9449162d0e19a8b16f1)
2026-11-09 01:44:39 -08:00
Anees Iqbal 62b0d98e2d fd blocks: only where the device's policy takes textures over exported memory in place
Every texture over a buffer in an exportable block names the handle type and starts
UNDEFINED (VUID-VkImageCreateInfo-pNext-01443), so it is in place only by the device's
in-place check. Under a policy that shadows textures over such memory (exact_answers),
a texture over a plain block's buffer is still in place (its linear image starts
PREINITIALIZED), so the runtime's buffers stay in plain blocks there.

Verified: not yet built.
(cherry picked from commit 80ca0f0721b3032021515e39f282e5baba154cb0)
2026-11-09 01:44:39 -08:00
Anees Iqbal 0c166a0d09 fd blocks: clippy fixes; reclaim bench: dual-handle arms, compatible types, plane formats and the check's verdicts
Clippy (m3-max-10619) found an unused accessor (the test now reads Memory's field), a closure
for bool::then, and a test variable that shadowed the descriptor helper.

The bench gains arms whose memory is exportable as both an opaque fd and a dma-buf (make, held
64, two queues), the external facts print compatibleHandleTypes and cover the two-plane 4:2:0
formats the YCbCr planes image takes, and print the in-place check's verdicts once settled.

Verified: not yet built.
(cherry picked from commit acca6b48661251f20f9625d74f86cb2e5ce0e2cf)
2026-11-09 01:44:39 -08:00
Anees Iqbal fbda3e55a9 reclaim bench: the two-queue arms take an extra compute queue where none is reserved
On the Radeon 780M the graphics family has one queue, which the round robin takes, so
reserved_queues gave none and the arms printed 'not run' (job 10614). The arms now ask for
an extra COMPUTE queue too, and use it where no queue is reserved; their buffers are the
caller's, each used by one family alone.

Verified: not yet built.
(cherry picked from commit 8f557ad8e7ac8b2d909d75fe858fd90e04948cf4)
2026-11-09 01:44:39 -08:00
Anees Iqbal aa111e32d0 Runtime buffers lie in blocks exportable as opaque fds on a unified device's system heap
On RADV (Radeon 780M) a vkAllocateMemory of always-valid GTT memory holds the VM root
reservation while the kernel populates the pages, and every vkQueueSubmit takes that
reservation: a 64 MiB block of the system heap held the scheduler's submissions 9 ms on a
quiet host and up to 22-34 ms on a fragmented one (reclaim_submit_bench). Memory allocated
exportable is a BO with its own reservation, and its making holds no submission.

Where the device has unified memory and exports an opaque fd of a pooled buffer's memory for
the runtime's buffer usages (vkGetPhysicalDeviceExternalBufferProperties: EXPORTABLE, not
DEDICATED_ONLY), the buffers of placed_new_buffer (the program's, buffer descriptors', the
runtime's own) are made with VkExternalMemoryBufferCreateInfo(OPAQUE_FD) and lie in pools of
their own (Holds::FdBuffers) in the memory types of heaps without DEVICE_LOCAL, whose blocks are
allocated with VkExportMemoryAllocateInfo and never exported. Their buffers of addresses carry
the handle type (VUID-vkBindBufferMemory-memory-02726); a texture over such a buffer names it
(VUID-vkBindImageMemory-memory-02728) through bound_memory's External(OPAQUE_FD), taking the
in-place check's ExportedFd class. Heap buffers, preprocess buffers and the in-place check's
Pooled buffer (pooled_check_buffer) stay in plain blocks, so the Pooled verdict's image
creation is unchanged. WorkCounts gains fd_buffer_blocks_made and fd_buffer_blocks_plain.

Verified: not yet built; tests added (own_buffer_blocks_are_exportable_in_a_unified_device_s_
system_heap, and the device test over a buffer of the runtime's own in exported_textures).

(cherry picked from commit 065bcac9bd6f1a6f0b09beb514acb57447144094)
2026-11-09 01:44:39 -08:00
Anees Iqbal 0e761b0ada reclaim bench: the export facts print raw formats and usages
ash is built without its debug feature, so vk::Format and vk::ImageUsageFlags have no Debug;
the facts test printed them with {:?} and the test target did not compile (job 10566).

Verified: not yet built; the next facts job builds it.
(cherry picked from commit 79e283b7e77338a752f63167b9f387b8c4e20c36)
2026-11-09 01:44:38 -08:00
Anees Iqbal d34723e62e reclaim_submit_bench: opaque-fd arms and the device's export facts
On the 780M a texture over memory the runtime exports as a dma-buf is a
shadow (the in-place check made no image of that class: Unchecked),
where one over memory exported as an opaque file descriptor goes in
place (tests::exported_textures, gem10 job 10554). So the arms that
measure exportable memory take the handle type: the 64 MiB system-heap
making, 64 held blocks and the two-queue arm each run for an opaque
file descriptor too. Export facts prints what the device answers for
both handle types: vkGetPhysicalDeviceExternalBufferProperties for the
runtime's buffer usage with and without the device-address usage, and
vkGetPhysicalDeviceImageFormatProperties2 with an external image format
query for linear and DRM_FORMAT_MOD_LINEAR images of six formats,
sampled and copied, and rendered to.

Tests only; cargo fmt --all run. Verified: nothing yet (gem10 runs
follow as potluck jobs).

(cherry picked from commit 4a1d73a2f0c98e2f5d1503de4ae442aba2c88431)
2026-11-09 01:44:38 -08:00
Anees Iqbal b05f8cefbf reclaim_submit_bench: two-queue arms, private and exportable memory
Whether memory allocated exportable as a dma-buf holds one queue's
work behind another's, as memory that synchronizes implicitly would:
each arm allocates 128 MiB of the system heap, plain or exportable,
binds three buffers in it (each made for the handle type where the
memory has one, VUID-vkBindBufferMemory-memory-02726), and for 100
rounds a queue reserved for the caller fills the first 96 MiB buffer
eight times while, a millisecond later, a command queue's lent VkQueue
copies 64 KiB between the other two. Printed: the fills' and copies'
times to their fences and the rounds whose copy completed while the
fills ran.

Tests only; cargo fmt --all run. Verified: nothing yet (the gem10 run
follows as a potluck job).

(cherry picked from commit 4caa8b1ef1195be46b4e65ba4d12f44b115b6e05)
2026-11-09 01:44:38 -08:00
Anees Iqbal 0f69672d54 reclaim_submit_bench: fragment within the job's cgroup, time turnarounds, hold exportable blocks
The v3 run (gem10, job 10472) left about 970 order-10 blocks free after
the fragmenting: a memory cgroup is charged for the page cache it
reads, so the bench's heat file and its checkerboard together passed
the job's 18 GiB limit, and the kernel reclaimed the heat in long runs
(pgscan_direct about 30M a phase, MemAvailable 16.7 GiB). The heat is
gone; the checkerboard covers the host's free memory but 1 GiB as far
as the cgroup and its ancestors have room but 2 GiB (memory.high or
memory.max less memory.current), and the pressing thread maps its huge
pieces only while that room lasts. What the fragmenting took, the free
memory and the room are printed.

commit_and_submit leaves its batch to the scheduler's thread when that
thread is submitting, so it does not see a vkQueueSubmit held back
there: each commit's turnaround to completion is timed too, with
command_buffers_submitted, batches_submitted_at_commit and
batch_submit_nanos over the phase. The making thread is named
reclaim-make so a lock trace tells it from the submitting thread. Two
arms hold 32 and 64 exportable 64 MiB system-heap allocations made
before the phases: what memory that is not private to the process
costs each submission.

Tests only; cargo fmt --all run. Verified: nothing yet (the build and
the gem10 run follow as potluck jobs).

(cherry picked from commit ac35216c2ce0303441d0dcbb2d62172aca267874)
2026-11-09 01:44:38 -08:00
Anees Iqbal d08273a0d9 reclaim_submit_bench: rewrap the module doc to 100 columns
The pressing and printed paragraphs had three lines past 100 columns
after the last edit. Doc text only; cargo fmt --all run.

(cherry picked from commit 9cf31a4a9f03cc8faf66c3bb6a918fcf3899af96)
2026-11-09 01:44:38 -08:00
Anees Iqbal 25ad0e0994 reclaim_submit_bench: the free blocks by order printed after the pressed phase too
(cherry picked from commit eb700b8e605afc207fd504760a7dcf3fe6dee766)
2026-11-09 01:44:38 -08:00
Anees Iqbal 2c16ca47a5 reclaim_submit_bench: the fragmenting mapping takes all the free memory but 1 GiB, so no high order is left
With 6 GiB the fragmenting took the free blocks of the lower orders and left every order-10 block
(1109 of them, 4.3 GiB, potluck 10420's buddyinfo), so a 64 MiB block's pages came without
compaction (compact_stall 0). The mapping now takes all of MemFree but 1 GiB, at most 14 GiB.

(cherry picked from commit 2b8744b3264ff66a96368ab0a97ca5d0aba10ed9)
2026-11-09 01:44:38 -08:00
Anees Iqbal 8890d6504c reclaim_submit_bench: the free blocks by order printed before and after the fragmenting
(cherry picked from commit d2b18a17775afcdefd228e084df85ca79506a713)
2026-11-09 01:44:38 -08:00
Anees Iqbal 35acbf538f reclaim_submit_bench: the fragmenting mapping in single pages, so each page given back is freed
Under transparent huge pages always, the 6 GiB fragmenting mapping took 2 MiB pages, and giving
back every other 4 KiB of one frees nothing until its deferred split: potluck 10398's pressed
phase had no compaction stall (compact_stall 0). The mapping is now advised MADV_NOHUGEPAGE.

(cherry picked from commit 07a127e58812270c56c6c1d7cacf77216a2d85e7)
2026-11-09 01:44:38 -08:00
Anees Iqbal 197eaf89f2 reclaim_submit_bench: memory blocks made beside the submissions, on a fragmented host
The first form held idle blocks while the host reclaimed and no submission stalled in any arm
(potluck 10374, gem10's 780M: slowest commit_and_submit 0.08-0.24 ms pressed, 7-12 M pages
scanned by direct reclaim, kswapd none). A consumer's capture named the holder of its long
submissions: the runtime's own block making, a 64 MiB GTT buffer object's creation in direct
compaction under the VM root's reservation. So each arm now makes memory beside the submissions
in both phases, and the pressed phase first fragments the host's memory as a desktop's is: half
of it in the page cache from a sparse file, and 6 GiB of anonymous memory with every other page
given back, MemAvailable staying high.

Arms: the runtime's Private buffers (its blocks made ahead), raw 64 MiB and 4 MiB allocations of
the system heap's type, 64 MiB exportable as dma-bufs, 64 MiB of the carve-out, blocks made
before the phases, and nothing made. Each prints the submissions' and the makings' spread and
the host's reclaim.

(cherry picked from commit 0def7f69b78e2f4308d0d931cd65306bcf1acf10)
2026-11-09 01:44:38 -08:00
Anees Iqbal 06f8ab1398 reclaim_submit_bench: the slowest submissions sorted by key
(cherry picked from commit 3e94ec18c994498e57d2e7e16e1787df24a34e7c)
2026-11-09 01:44:37 -08:00