b4a3e4e91c671c2a1ca30535b264393bb576c3f9
1225
Commits
| Author | SHA1 | Message | Date | |
|---|---|---|---|---|
|
|
082fd229aa |
The fan-out row states the frame with wide triangles, drawn in parts
docs/FAST-PATHS.md row 50 gains the pieces lane's frame with wide triangles (rate_mapped_pieces_host_step_wide), warm, at ed46f36fba's change (built at its pre-rebase commit 22b6697ba0) against the lane-only commit (8bd88bf0ac's pre-rebase 8da477a56c), each one run: - RTX 2080 (NVIDIA 620.70.06): 30.9 ms in parts, 39.6 ms with flagged draws region by region whole, 68.5 ms under Exact. - Radeon 780M (Mesa 26.2.6): 223, 373 and 566 ms, on a machine running other jobs. 23 of the 64 draws are flagged; 106,519 of their triangles lie between the first and the last flagged one and are drawn region by region. |
||
|
|
dad0470c2e |
A flagged fan-out draw is drawn in parts: only its flagged range region by region
Under DevicePolicy's RateMapRegionPolicy::FanOut the probe flags a draw that has a triangle crossing w = 0 or reaching more regions than the geometry stage's copies. The whole draw was then recorded region by region, once per region of the map (2074 for a 61 by 34 map), however few of its triangles were flagged. The probe now also records each flagged draw's first and last flagged triangle. A flagged list of triangles of one instance, whose pipeline reads no [[primitive_id]] and writes no memory (the conditions under which a draw is already cut into index ranges), is drawn in up to three parts in its place: the triangles before the first flagged one fanned out, those from it to the last region by region, and those after fanned out. Each part is a range of the draw's vertices or indices, so each triangle keeps its vertices, vertex_id and order. Parts of a 16-bit index list begin at even triangles, so their ranges start 4-byte aligned as the draw does. Any other flagged draw is drawn region by region whole, as before. The probe words grow from 1 + 2*32 to 1 + 4*32 per draw (bind::fan_out::PROBE_DRAW_WORDS). For a flagged triangle the probe raises one of 32 words to u32::MAX - PrimitiveId and one to PrimitiveId + 1, picked by PrimitiveId as the counts are, so no single word takes every atomic. The wide marks that choose the variant of four copies now come only from triangles the probe does not flag, so the fanned-out parts can take that variant. Also: WorkCounts::rate_map_probe_wait_nanos sums the host's wall time from each probe's submission until it saw it complete, so a walk can split host_step_nanos into the probe's round trip and the host's own recording. rate_map_parted_draws and rate_map_parted_region_triangles count the draws in parts and their triangles drawn region by region. An earlier attempt drew a flagged draw through a geometry stage of 32 invocations, each taking a block of up to 16 regions, in 5 passes over the map. On the pieces lane's frame with wide triangles it made no GPU gain on an RTX 2080 (41.0 against 42.9 ms warm). On a Radeon 780M (RADV) it went from 182 to 1900 ms, with one piece of 1.1 s. That attempt is not in this change. Tests: render::fan_out's unit tests check that the parts take each triangle once, in order, with no flagged triangle in a fanned-out part, and that the probe's words decode to the first and last flagged triangle. The link test checks the probe's two atomic raises. The runtime's rate_mapped_fan_out test adds two commands that draw the grid with one triangle over half the target, one indexed and one without indices, and a triangle across w = 0 over the whole target. Under FanOut all four flagged draws are drawn in parts and the frame is compared pixel for pixel with the encoder's region-by-region frame. The pieces lane's wide frame checks that every flagged draw is drawn in parts. |
||
|
|
2d98657ca8 |
A Managed buffer's pages that a guest RAM's chunk imports hold are copied in by the GPU from them
What: a Managed no-copy buffer on a device without unified memory can have
a host copy that is its pages alone, because its own import would map pages
a live import holds or the device refused it. Where a guest RAM's chunk
imports hold all of those pages, it now keeps the pieces of those imports
(host_ram.rs RamOnDevice::pieces_of, ChunkPiece). The caller's resolver is
still asked once: its answer is kept for the pieces.
- Its copies in (as it is made, at a rebind, and each range
did_modify_range names under AtSubmission) are GPU copies from those
imports' VkBuffers, one per piece. They are held as a host copy
(Keeps::HostCopy): nothing is staged, no bound applies, no submission is
made. AtCommit still stages a named range on the CPU at the commit.
- New public WorkCounts, so a pass can tell the paths apart:
- managed_bytes_staged_in, the bytes the CPU staged for copies in;
- managed_bytes_copied_in_from_ram;
- managed_pages_alone_refused, managed_pages_alone_over_imports and
managed_pages_alone_unwritable, why a host copy is its pages alone;
- managed_pages_in_ram_chunks.
- Tests: tests/host_ram_managed.rs, a buffer across a chunk's end with
both chunks imported, under both policies. It checks the counts (pages
alone over imports, held by the chunks, nothing imported, gate unasked),
the bytes the GPU reads as the buffer is made and after a named CPU
write across the end, and which path copied them.
- Docs: managed_copy.rs, managed.rs, buffer.rs, HostMemory::with_runs,
docs/API.md, and FAST-PATHS row 51. Signatures blessed.
Why: such pages were staged by the CPU at every commit that took a named
range. That is a CPU copy and staging memory, on the commit's thread, for
bytes the device already maps through the chunk imports. Zero copy first.
Verified: not run at this commit. The 2080 equality tests and the bench
(before at the bench commit, after here) and lint follow on the rebased
branch.
|
||
|
|
3b3739ce45 |
The idle sweep hands glibc's free heap back, not only a large making
glibc keeps what the process's threads free as free heap, its pages resident, until malloc_trim hands it back, and only a large pipeline making's return called it. The memory log of one Iris Xe cold boot at pin 66 (reims's 24852) shows the cost: 1.4 GiB of glibc's 4.0 GiB of arenas free at its end, after 3 trims in all, all from large makings. Now each device's idle sweep thread also looks at glibc's heap every 5 s (HEAP_EVERY), whether or not a sweep is due, and trims once the heap holds more than the floor (FREE_FLOOR, 256 MiB) free above the least free a look read since the last trim, at two looks in a row (idle_sweep::HeapLook). The least-free rule, not the bytes free alone, because glibc still counts a trimmed chunk free: a plain fordblks rule would trim again at every look. A trim counts in WorkCounts::heap_trims, as a large making's does. compile_memory gains heap_bytes() and trim(), which return_free_heap now uses. Only on Linux with glibc; elsewhere the thread makes no look and waits as before. Docs: idle_sweep.rs and compile_memory.rs module docs, WorkCounts::heap_trims, the memory log's paragraph in docs/API.md. Tests: tests::idle_heap_look (the look's rule: trimmed at the second look, not again for what a trim left, again for what was freed after it); tests::idle_heap_trim (device test, m2v_gpu or m2v_cpu_icd, Linux gnu): 768 MiB of written 64 KiB chunks, all but one in 16 and the last freed, then idle; the device's thread trims and the resident set falls by 512 MiB or more. The lavapipe run and its negative control (no heap look: the test must fail) follow this commit. |
||
|
|
10f2539a71 |
8-bit floats widen through the device's own type where it has one
Owner rule 1: where a device has a native 8-bit float type, its conversion is the only form.
VK_EXT_shader_float8's shaderFloat8 (the SPIR-V capability Float8EXT, SPV_EXT_float8) is now a
VkFeature the device enables and the profile reads (leaf.float8); the SPIR-V IR has
Type::Float8 { encoding } (OpTypeFloat 8 with its FPEncoding, from the regenerated grammar items),
and the interpreter reads OCP's E4M3 and E5M2.
The shared decode, narrow::fp8_to_f32, widens through the device's type where the layout names
one (Fp8Layout::on): each u32 lane bitcast to four 8-bit floats, the low byte's widened by
OpFConvert, so no 8-bit integer type is needed. f8e4m3fn and a tensor's e4m3 take Float8E4M3EXT,
f8e5m2 and a tensor's e5m2 Float8E5M2EXT; the IEEE-like f8e4m3 has no device encoding and keeps
the integer decode. Every site takes it: air.convert's 8-bit float sources, simdgroup-matrix fp8
cells, and matmul2d, whose expansion now widens each element by an air.convert of the tensor's
format (Fp8::TensorE4M3, Fp8::TensorE5M2: Metal's reading, qualified on the M3 Max, e4m3 with no
specials, e5m2's NaNs 0x7FC00000; never parsed from a name, built by Out::air_call). A device
without shaderFloat8 decodes with integers, as before.
Where a tensor's element widens natively the stage records PrecisionNote::NativeFloat8
(native-float8): the device's e4m3 reads 0x7F and 0xFF as NaN where Metal reads 480 and -480,
and an e5m2 NaN's bits are the device's. Validation classes it Unbounded; the conformance suite
lists it among the native notes; FAST-PATHS.md has its device-gap row and API.md its catalogue
entry. The other formats record none: Metal on Apple M3 does not compile them.
The refusal of a matmul2d of 8-bit floats on such a device (Entry::float8_products, the select
check) goes. REFUSALS.md and api_signatures.tsv regenerated.
Tests: matmul2d's fp8 fused sums on the RTX 50 profile (Float8EXT declared, the note recorded,
e4m3 NaN sums) beside MoltenVK, RADV and lavapipe (neither); air.convert widenings on the RTX 50
profile and lavapipe; simdgroup-matrix fp8 cells on the RTX 50 profile too. Not yet built here:
the build and these tests run next on the cluster.
|
||
|
|
72562e193a |
The pre-import placement's docs, and its test compares refusals too
What: Buffer::texture_placement, TexturePlacement::InPlace, InPlaceRefusal and route.rs say what the query answers before it makes images and what host_pages_texture_placement answers before the buffer; docs/API.md, docs/HOWTO.md and the runtime README name the new query. The test compares both calls' results, refusals included (a plane past the buffer's length is refused as PastBuffer by both, not answered PastLength), and asks rows of 8 bytes too. Why: lavapipe m3-max-24732: every shape both queries decide answered alike (CheckFailed by pointer, Unchecked over dma-bufs, InPlace elsewhere), but the past-length shape is a refusal of both calls, which the test unwrapped. Verified: pending the lavapipe run. |
||
|
|
1ace4b5c46 |
The pre-import placement test counts the asking thread's images; signatures and refusals
What: tests/host_pages_placement.rs reads ObjectChurn::vk_images_made_this_thread (the WorkCounts field it named does not exist); api_signatures.tsv blessed for Device::host_pages_texture_placement and Problem::HostPagesBacking; docs/REFUSALS.md regenerated. Why: the test did not compile (m3-max-24729); the public surface changed. Verified: pending the lavapipe run. |
||
|
|
2c21b3e6f1 |
A recovery carries indirect command buffers, visible function tables and argument encoders; one test over every kind
What: a device's recovery now carries the three kinds a program makes that it left the lost generation's, so each is the same object on the new VkDevice, as Metal keeps its objects: - An indirect command buffer (`indirect_command_buffer/carry.rs`). Its records' storage and its slots past them are buffers of the runtime's own whose `contents` pointer no program holds, carried as such (`Buffer::carry_runtime`): in the runtime's own pages, the same pages and the records as they are; in pooled host-visible memory, new memory, the records lost with the VkDevice (vkspec 5.2.3), written again as a new buffer's: its header, every command reset. The program each command's state runs is the state's program there (made by the state's carry, after it), or a released state's made again there, as are the programs it keeps for GPU-written records (`released_programs.rs`); its kept chunk recordings go; the new generation's keepers list it where the GPU may write it. Its records ID, address, gpuResourceID, uniqueIdentifier and label are the line's and stay. - A visible function table (`function_table/carry.rs`), after its pipeline state: its words buffer carried the same way; where it went to new memory, the words written again from a host copy the table now keeps of what the CPU wrote (`TableShared::writes`), so its entries call what they called; listed among the new generation's tables. A table whose state stays the lost generation's stays with it. - An argument encoder: it holds no Vulkan object, so its device becomes a `LineDevice`, the handle carried; `ArgumentEncoder::device` answers the generation handle by value (it answered a borrow). The registry keeps both buffer kinds weakly (`Carry::indirect_command_buffer`, `Carry::function_table`), the recovery carries them after the pipeline states, and its notice counts them (`", and N indirect command buffers, M of them whose records were lost (every command reset)"`, `", and N visible function tables with their entries"`). The docs of what a recovery carries and leaves say so: `RuntimeGap::MadeBeforeRecovery`, `Degradation::DeviceRecovered`, docs/API.md, the runtime's README, `device/carry.rs`. Why: after a 3090 recovery, `resetCommandsInBuffer:withRange:` on an indirect command buffer made before it was refused (`MadeBeforeRecovery`) thousands of times and every later command buffer of the pass failed, where Metal's buffer goes on. The whole class at once: every kind a program can make, each with its carry status, was listed for the change (none other was left uncarried that holds only what the program could make again; sparse heaps and textures and pooled `Shared` buffers stay left, as documented). Test: `device_recovery_every_kind::every_kind_of_object_made_before_a_recovery_serves_after_it` makes one of each kind (a queue, a `Private` buffer, a heap and a placed buffer, a texture, an event, a shared event, a fence, a sampler state, a depth/stencil state, a library and function, a compute and a drawing state, an address pool, a rasterization rate map, a binary archive, a dynamic library, an indirect command buffer of dispatches executed before and one of draws, an argument encoder, a visible function table called before), recovers, uses each on the next generation by command buffers that complete (the indirect buffers reset by a blit and encoded again, the table called and set, the encoder writing), and ends with the lost VkDevice gone while all live. Helpers made `pub(super)` in the pipelines and states recovery tests. Verified, at the change on |
||
|
|
b6131002df |
A compute pipeline's making names itself and dumps its module before the driver's call
With METAL2VULKAN_LOG_PIPELINES on, a compute VkPipeline's making now logs a line as it starts, before vkCreateComputePipelines: the kernel, its SPIR-V hash and words and its specialization. With METAL2VULKAN_DUMP_PIPELINES set, its module is written then, not after. A making that never returns (a driver compile that runs for tens of minutes) is the start line without its made line, and its module is on disk, where before neither the line nor the module appeared until the driver returned. Default-off diagnostics; no product path changes. The made line no longer writes the module (the start did). The compute log test checks that the start line, with the same module hash, comes before the made line. |
||
|
|
03c587b9ee |
A large kernel's whole grids run on its partial-threadgroups variant
A kernel that observes its threadgroup partition runs its ragged dispatchThreads grids on its partial-threadgroups variant, one VkPipeline of the call's threadgroup size (MultiRegion 1), while its whole grids took the plain pipeline (MultiRegion 0): two driver compiles of the same module. On a guest's run on an RX 7900 XTX the plain one, for a kernel of 2,415,531 words, was 26.9 s of a 39.8 s warm pass. Now a kernel whose base module holds compile_memory::COUNTED_WORDS (65,536) SPIR-V words or more runs every direct dispatch of a threadgroup size on that variant, every thread live, where its ragged grids of the same form run there (it observes its partition, and for a one-row grid in one-row threadgroups otherwise than through its simdgroups alone, whose such grids run flat). Where the variant is refused it falls back to the plain pipeline as before. Smaller kernels keep the plain pipeline. Both forms give the same answers, so there is no switch and no FAST-PATHS row. - Binder: on a partial-threadgroups plan, a whole Threads grid takes the same L-sized regions per group-count chunk, unflagged (no NONUNIFORM), and a Threadgroups dispatch's regions have MultiRegion 1, so one specialization of a threadgroup size runs all of them. - Translator API: CompiledFunction::observes_threadgroup_partition and observes_partition_through_simdgroups_alone state the two partition facts the compile already decides, so the runtime can decide at creation which form a kernel's ragged grids take. - Runtime: compute::partial_direct takes whole grids and dispatchThreadgroups of such a kernel (ComputePipelineState::whole_on_partial). WorkCounts::whole_dispatches_on_partial_variants counts each such dispatch. A creation's predicted region is not made for such a kernel's predicted dispatch, which would run on the variant, not the base. - GPU cost, measured once on the XTX (RADV) with the probe on steelbrain/uniform-partial-probe: 1,048,576 threads in 64, partial/plain 0.997 to 1.020 over four straight-line kernels, words equal. Stated at partial_direct and in docs/API.md's dispatch-regions paragraph. Tests: engine_partial_threadgroups's whole_grids_run_on_the_partial_plan_with_every_thread_live (whole Threads and Threadgroups dispatches on the partial plan give the split's and Metal's words, and every grid of a threadgroup size takes one specialization, on the CPU interpreter); the runtime's a_large_kernel_s_whole_grids_run_on_its_partial_variant (a large kernel makes one VkPipeline over whole grids of both forms and a ragged one, counting 3 whole dispatches, with the plain pipeline's words; a small kernel makes the plain pipeline's and the variant's, counting 0). heap_trimmed makes its two large makings at two threadgroup sizes, since its whole and ragged grids now share one. |
||
|
|
a0e7b75ad6 |
The copy-in ledger row states the measured cost of AtCommit
What: docs/FAST-PATHS.md's managed_copy_in row gives the copy-in bench's medians on the RTX 3090 (eGPU) and the RX 7900 XTX: the commit call and the wall time to completion of 32 MiB commits under both values. Why: a ledger row states the cost of its accurate form. Verified: jobs 24627 (3090) and 24636 (XTX), two rounds each, both values. |
||
|
|
9f3dc79994 |
A Managed buffer's named range is copied in by the GPU as the submission runs, by default
What: DevicePolicy gains managed_copy_in (ManagedCopyInPolicy, a runtime choice no profile carries). Under the default, AtSubmission, a commit that takes a did_modify_range's range has the GPU copy it from the host copy (the import of the caller's pages, or the runtime's own host-cached memory) into the device copy as the submission runs (Buffer::upload), with no CPU copy and no staging. Pages no import maps are still staged by the CPU at the commit. Under AtCommit, which exact_answers() selects, the commit copies the range on the CPU as the host copy holds it then (the RV2145 snapshot, Buffer::upload_now, now upload_at_commit). Staging buffers of both directions are now Shared in the default CPU cache mode, host-cached system memory, never the device-local (BAR) memory a write-combined buffer prefers without unified memory, and of power-of-two lengths (64 KiB at least), so a like-sized later copy takes a buffer the recycler parked rather than new memory. The ledger gets its row (the bound: a CPU write after the commit, before the GPU runs the command buffer, may be read), and managed.rs, managed_copy.rs, API.md's accepted difference, the runtime README, FAST-PATHS' costs bullet and the conformance crate's Policy::Exact say so. tests::fast_paths names the choice and checks it keys no profile and that exact_answers() takes AtCommit. The named-rounds race tests take the policy: by default each round reads, in each byte, its own byte or one the CPU wrote to its buffer after its commit (0xee, a later round's), never an earlier round's; under AtCommit only its own; three AtCommit tests join the three default ones. The lane test's step 4 reads either oracle's answer by default and the 5300M's under AtCommit (exact_answers_take_a_did_modify_range_at_the_commit). Why: a compute benchmark's commits spent most of their time in this copy on a discrete GPU (a CPU memcpy into write-combined staging in BAR across an eGPU link, fresh 32 MiB chunks each time). The oracles differ on the bytes after the commit (5300M A,B,B,A,B; UHD 630 A,B,B,B,B), so the cheaper answer is the default and the snapshot stays behind the switch (AGENTS.md rule 1). Verified: jobs in the report (lint both cfgs, the translator's fast_paths, the runtime suite on lavapipe, managed_copy_device and the lane test on the RTX 3090 and the RX 7900 XTX, and the copy-in bench there before and after). |
||
|
|
7b77851a95 |
Runtime attachment images start at zero where an unstored DontCare load stays DONT_CARE
What: Device::new_planned_texture, which makes the runtime's own images (the scratch image of separate depth and stencil textures, stand-ins, backings, colour twins), starts an image with color or depth/stencil attachment usage that a clear writes at zero (Start::ZeroUnpatterned) on a device whose unstored DontCare loads stay the driver's DONT_CARE (clear_reach::UnstoredLoads::DontCare: UnstoredDontCarePolicy::Driver on a driver without DriverFact::UnstoredClearNoSlower). Elsewhere it starts as its memory lies, as before. FAST-PATHS' unstored DontCare row and API.md say so. Why: such a load reads what the image holds (a depth or stencil test, a blend, a fetch). A Private runtime image started as its memory lay, and a recycled one may hold a released texture's texels, of another process of a consumer whose processes share the device. Devices that clear such loads read nothing of it, so they pay no clear. Verified: tests::unwritten_parts on lavapipe and Iris Xe (jobs in the report). |
||
|
|
ae413fd7e9 |
Half sqrt at 16 bits: its bound belongs to NativeTranscendentals, which it records
On a device whose float functions are not Metal's, a half sqrt is the device's instruction for Metal's function and records NativeTranscendentals (function_notes), not DeviceArithmetic. The 16-bit Sqrt's bound moves to that note's doc and its catalogue entry; the division test asserts NativeDivision and NativeTranscendentals, as the Iris Xe profile records (job 24519: [NativeTranscendentals, NativeDivision, NativeNanEncoding]). |
||
|
|
ab56a1c88e |
Half division and square root at 16 bits under the 16-bit float controls
Rule 1: where the module computes half in 16 bits under the 16-bit float controls (QuantizeForm::Controlled), the device's native form of a half division and square root is its 16-bit OpFDiv and Sqrt, so those are the only form there; elsewhere the float instruction rounded to half stays. - divide::native: a half quotient under the controls narrows its operands (exact, they are halves), scales a divisor past 2^14 by 2^-2 and a denormal one by 2^10 into Vulkan's range for the 16-bit OpFDiv ([2^-14, 2^14], 2.5 half ulp), divides at 16 bits and widens. The scaling is exact but where the quotient rounds to zero or overflows anyway. - math::float_fn: a half sqrt under the controls is the 16-bit Sqrt between exact conversions (Vulkan: inherited from 1 / InverseSqrt). - narrow::computes_in_16_bits counts 16-bit FDiv and Sqrt, so the entry declares the controls (denormals kept, IEEE zeros, infinities, NaNs). - ops: float_ty and f16_splat, shared with f16_binary. - NativeDivision and DeviceArithmetic state the 16-bit bounds; docs/API.md, docs/FAST-PATHS.md, the narrow and half_hold module docs follow. - Test: engine_half_hold's half_division_and_sqrt_are_16_bit_under_the_ float_controls (Iris Xe and RADV: 16-bit FDiv x2 and Sqrt, none at 32, no exact narrowing, the exact answers on the interpreter, L3, the notes; lavapipe: the float forms, the same answers). Verification: in the following potluck runs (FConvert count on hnq, the half engine tests, spirv-val, clippy, the suite). |
||
|
|
b8257d9c10 |
Runtime images whose parts no copy writes start at zero, never as their memory lies
What: - Device::storage_over_buffer: a surface depth or stencil texture's shadow whose copies leave an aspect out starts ZeroUnpatterned in every storage mode (Metal reads 0 there); a tiled texture of more than one level starts Start::Zero, as a new texture of its storage mode does. Before, both went through new_image, which starts a Private image held. - surface_depth.rs pass_image (the twin and an X32_Stencil8 view's private image) starts ZeroUnpatterned: no copy writes its stencil. - Docs: storage_over_buffer's comment, surface_depth.rs module docs and FAST-PATHS.md's tiled later levels gap say what they now read. Why: a Private image's memory may hold a released texture's texels, of another process sharing the device (a recycled image). A kernel reads the shadow's stencil through an X32_Stencil8 view, blits and samples read a tiled texture's kept later levels, and a pass's DontCare stencil load the driver leaves reads the twin's. Verified: tests/unwritten_parts.rs (previous commit) fails without this and passes with it; runs follow. |
||
|
|
41b5430f6a |
A completed command buffer's release posts the host imports it frees last to the free thread
On NVIDIA each vkFreeMemory holds the device's other vkQueueSubmits while it runs, and a completed command buffer that let go of no-copy buffers' imports last freed them on the thread that runs the next completed handlers, back to back and unpaced. Now, inside a completed command buffer's release (free_thread::AtCompletion), an import whose free a deallocator or a keep-alive waits for is posted to the device's free thread, which paces it as it paces a block's free; the deallocator and keep-alive run there after the free, possibly after the command buffer's waiters returned. The queue stays bounded at 64: a post that finds it full, the teardown begun or no thread frees in place. An import nothing waits for is freed in place, before the waiters return, as the caller may unmap its pages once they did. A program's own release still frees in the release. No switch, nothing by vendor. The paths: HostImport::drop (a pin's last hold at completion), and rebind's Retained, a command buffer's hold of a releasable import's objects (Imported::let_go_at_completion). The posted objects hold the device through holder handles (device/holds.rs), so the program's last drop on a program thread waits for them, and the thread frees them unpaced once the holds stopped. Where the program's last drop ran on a runtime thread, a posted import can hold the device's last share: the teardown then runs on the free thread, which frees what is still queued in place of waiting for itself and ends unjoined. Counted: WorkCounts::host_import_frees_posted; memory_frees_paced counts their pacing. docs/FAST-PATHS.md's known gap on NVIDIA's frees is updated, and the Deallocator doc names the free thread. Verified: tests::completion_import_frees (posted with a deallocator, in place with none, and the teardown on the free thread), the runtime suite and lavapipe device tests in the check job, and the 2080 bench before and after. |
||
|
|
bbf86acd0e |
The encoder trail names each execution's GPU form, and its line reads the form's scratch while pending
The 3090 hang's rerun (its trail line, read in place) named a pass whose two executions of indirect commands, both through ranges a buffer holds, carried no host-step note: commit recorded them for good in their merged GPU form (render/executions/gpu.rs), where the trail noted nothing, so the line could not tell what the GPU read. encoder_trail.rs: - GpuForm: an execution's GPU form, its shape (recorded at commit or by its host step, merged or a draw per command, indexed, primitive type, the commands its preprocess runs over and from where, and the range buffer's offset), with its scratch region, layout and the command buffer's status words. - Named: a part's (and a batch's) trail text with the GPU forms its executions took; the line's front batch is described with each form's scratch read now: the range the GPU copied, the merged draw's two VkDrawIndirectCommands, the commands whose arguments draw, their vertices or indices times instances and the most of them (its index entry where indexed), and the status words. The last-completed batch keeps its text alone. - Step carries forms through a host step; commit's recording of each segment runs under a Step of its own (CommandBuffer::noting_forms), whose forms alone it keeps, joined to the part that holds the segment (State::trail_forms). upload.rs: Upload::glimpse, volatile u32 reads of a region of the host-coherent chunk mapping, read-only, no lock, no wait. completion.rs: the line's names are taken under the pending lock and formatted (and the scratch read) after it. Off, nothing changes: no note is made. Test: tests::trail_gpu_forms (device): four CPU-written triangle commands through a range buffer of [1, 2], recorded at commit merged; after completion the form reads the range 1+2, the merged draws [2147483646 x 0; 48 x 1 from vertex 2^31], 2 drawing arguments (7x2, 12x3), the most command 2's, no fault. |
||
|
|
9689f5934b |
matmul2d of 8-bit floats: refused where the device has its own 8-bit float type
Owner rule 1: where a device has a native 8-bit float type, its conversion is the only
form. VK_EXT_shader_float8 (whose shaderFloat8, the SPIR-V capability Float8EXT, Vulkan
requires of every device that lists it) is the vocabulary's ExtShaderFloat8, enabled where
the device lists it. The matmul2d expansion records whether a lowered run reads 8-bit float
elements (Entry::float8_products, from the run's operand types), and selection refuses such
an entry, Unsupported{Tensors, NotImplemented}, where the extension is enabled: the
conversion through the device's type is not built yet. Elsewhere the integer decode stays
the form. Of the committed profiles, nvidia-rtx50-linux and nvidia-rtx5080-laptop list it;
their 8 opened validation contexts each enable it (opened_chains.txt blessed). REFUSALS.md
and api_signatures.tsv regenerated.
Verified on msi (m3-max-24411, m3-max-24435): 261 of 261 touched tests (matmul2d, tensor
ops, the device vocabulary and enables, requirements, the codec, ash interop, the signature
table) pass, among them fp8_products_are_refused_where_the_device_has_its_own_8_bit_floats
(both RTX 50 profiles refuse e4m3 and e5m2; RADV and lavapipe translate and validate) and
the fused-sum tests on MoltenVK, RADV and lavapipe.
|
||
|
|
158f9788b5 |
Half holding: the dot and mix bounds are NativeDot's and NativeMix's, a test, the docs
A half dot or mix already records NativeDot or NativeMix on every device, so the DeviceArithmetic scan the previous commit added in compile.rs is removed, and those two notes' docs (artifact.rs, docs/API.md's catalogue) and docs/FAST-PATHS.md's device-gap row now state the 16-bit form and its bound: a 16-bit dot of n lanes within (3n - 1) * 2^-11 * sum |a_i b_i| + (3n - 1) * 2^-25 of Metal's chain (2n - 1 correctly rounded 16-bit roundings beside Metal's n), a 16-bit mix within 2^-8 of its two terms plus 2^-22. narrow.rs's module docs, lower/arith's dot and mix comment, and docs/ARCHITECTURE.md (the tidy stage and the spirv/ map) name the pass. tests::engine_half_hold: a kernel of half min, max, clamp, dot, mix, a loop-carried half and a thread array of half; on the Iris Xe and RADV profiles it narrows no exact half, its four input roundings are its only narrowings and its result's its only widening, its dot, mix and bounds are 16-bit instructions, no float variable stays 32-bit, it answers 33.25 on the interpreter, passes L3 and records NativeDot and NativeMix; on lavapipe (Converted) nothing is held and it answers the same. Verification: not yet run (the build and tests follow). |
||
|
|
c35df96940 |
The memory log's lines state glibc's heap and the process's heap trims
A default-off diagnostic (METAL2VULKAN_LOG_MEMORY). Where the process's allocator is glibc's (Linux, the GNU environment), each line of the memory log now ends with glibc's heap at that moment, every arena's, as mallinfo2 states it (bytes in use, bytes free, what its arenas hold, what it mapped apart) and the malloc_trim calls the process's large makings made so far (a process-wide count beside WorkCounts::heap_trims). A resident set that grows and stays then reads, in one run, as free heap glibc keeps, heap in use, or memory malloc did not map. Elsewhere the lines are unchanged. Test: the_memory_log_states_glibcs_heap_where_it_is_the_allocator. |
||
|
|
47ee9f4806 |
Fan a rate-mapped draw out through four copies where its triangles reach at most four regions
A host step's fanned-out draw went through one geometry-stage variant that
declares the output of the most copies (up to 16) for every triangle, though
most draws' triangles touch only a few regions. The declared output size is
what the 780M's geometry stage pays for.
- The translator: RegionFanOut::DrawFew, the draw variant whose loop emits
at most FEW_COPIES (4) copies and whose geometry stage declares 3 x 4
output vertices; its codec name and compile-key word (" region_fan_out
few"); the link and engine tests cover the three modes.
- The probe: each draw's words grow to 1 + 2 x PROBE_COUNT_WORDS (65): its
flag, the 32 count lanes, and 32 wide lanes, where a triangle whose
widened pair count exceeds FEW_COPIES stores 1 (picked by PrimitiveId
mod 32, as the counts are). The host reduces them to (flag, copies, wide).
- The runtime: a fanned-out draw no triangle of which is wide draws
through DrawFew, else through Draw; commit's settle begins the three
variants (probe, few, most). Counted:
WorkCounts::rate_map_fanned_few_draws.
- The pieces lane prints the count. The runtime test's 8 commands add one
whose triangle covers four tiles a side (more regions than four, no more
than the most copies), drawn through the most copies, and assert the
other 6 fanned-out draws took four; the pixels are still the encoder's
region-by-region draws'.
- docs/FAST-PATHS.md: the fan-out row names the variant and its count, and
its cost cell carries the numbers below. bind/fan_out.rs: FEW_COPIES's
numbers.
Verified, release binaries, runtime_lane::rate_mapped_pieces and
tests::rate_mapped_fan_out, the command buffer's GPU time, cold then warm:
- Radeon 780M (Mesa 26.2.6), m3-max-24369, this change plus a scratch
switch (never landed) drawing every fanned draw through the most copies,
interleaved in one job: 4 copies 40.2/29.7 and 43.9/30.8 ms; the most
copies 61.9/36.8 and 62.7/34.5 ms. Warm about 5.4 ms (15%) less.
64 of 64 draws of four copies.
- Iris Xe (Mesa 26.2.6), m3-max-24317: 47.7 ms cold, 40.0 ms warm (40.5
warm through the most copies in an earlier run); 64 of 64 of four copies.
- RTX 3090 (NVIDIA 620.70.06), m3-max-24316: 28.6 ms cold, 6.1 ms warm
(6.2 ms before); 64 of 64 of four copies.
- tests::rate_mapped_fan_out on all three: 3 passed, 6 drawn of few
copies, the fan-out's pipelines 3 ready plus waited, 0 made at the step.
The Iris and 3090 runs are of the same change at base 9c30ffd263; the
780M's at
|
||
|
|
5523293ab8 |
Partial threadgroups: the runtime's tests, the round-trip fields, the surface tables
The runtime's partial_threadgroups test dispatches five ragged grids of a kernel with a threadgroup barrier (with and without a simdgroup sum) on the variant and on the same kernel made to split (split_ragged_grids, test-only), comparing both with Metal's model and counting VkPipelines; under m2v_gpu a heavy kernel times the creations. flat_simdgroups' two-row grid and barrier kernel now take the variant's one VkPipeline. api_signatures.tsv and REFUSALS.md regenerated. |
||
|
|
1b58b69953 |
A kernel's partial-threadgroups variant: a ragged dispatchThreads at the call's threadgroup size
A dispatchThreads grid that is not a whole number of threadgroups split into its interior and an edge region per axis, each edge a VkPipeline of its remainder's local size: a kernel dispatched at many remainders made one pipeline per remainder (Blender's Cycles on an RX 7900 XTX: 249 s of a 265 s warm render was 11 such creations). LoweringInputs::partial_threadgroups (VariantKey::partial_threadgroups, RuntimeFact::PartialThreadgroups) runs such a grid as the threadgroups its threads fill at the call's size, the region flagged NONUNIFORM, the last threadgroup along an axis answering Metal's partial threadgroup with the object functions' machinery: threads_per_threadgroup, positions and indices over the threads left, invocations past them returning before the body or walking it predicated to each barrier, every lane read balloting its live lanes. A tile function, a stage-in region, compute derivatives, emulated simdgroups, the flat/folded/replay forms and a vote word that does not fit are refused (GpuEncodedIndirectCommands, NotImplemented): they keep the split. The runtime takes the variant after the flat one (settle_partial, refusals remembered per state); the pipeline creation log names a probed variant's refusal declined. |
||
|
|
3a3c2fb3fd |
The encoder trail names each host-stepped draw's route, and the pipeline pool at a stall
For the 3090 hang, where a shadow pass's host step and a rate-mapped pass's fan-out ran in the same second: the trail now counts, per host step, the route each draw took (plain, the fan-out probe, fanned out, region by region) and the executions recorded in their GPU form, and its stall line names the device's pipeline pool's makings waiting and under way, so a driver compile running beside a hung batch shows. Default off. Verified: encoder_trail::tests and tests::stall (the line names the pool) in the check job. |
||
|
|
abacc1222e |
The encoder trail names what a host step drew: ranges read, draws, the largest, kept chunks
A stalled host-stepped render encoder's trail line named its states but not what its step recorded from the records and range buffers the GPU wrote, which is where a wrong count would come from. With the trail on, a host step now notes each range it read from a buffer (location and length as the bytes held them, and the commands it ran), its draws, their vertices or indices times instances summed, the draw of the most of those (primitive type, count, instances), and the kept chunks it ran again, whose draws it did not read. Default off: nothing is read or formatted with the trail off. Verified: the trail unit test (encoder_trail::tests) covers the line's new part. |
||
|
|
7093ca7911 |
A new Private texture whose first use writes every texel first takes no zeros
What: a new zero-filled Private texture's first move is marked overwritable (FirstMove::mark_overwritable). An encoder notes each such texture it writes whole before any of its commands reads it, decided from its own description, never a shader's (encoder::Overwrite, on its first part): - a render pass that loads every aspect of it Clear (as the descriptor set it, before DontCare loads take clears) and stores it, rendering it itself (no stand-in, sample planes or separate depth and stencil scratch) over its whole extent, the image of one level and one layer (PassLayout::overwrites); - a blit command whose box covers its whole extent in every aspect (BlitCommandEncoder::scrub). At a batch's take (command_buffer/submit.rs, first_overwrites), an overwrite counts where its part has no segment, only blit parts with no segment that name nothing of the image come before it (any other encoder may reach a texture through its resource ID, unnamed), and the part's own uses read nothing of the image but its attachment's own reads (a pass) or nothing at all (a blit). FirstMoves::take_holding then takes that move without its zeros (unzeroed, undone if the submission is given back): the layout move stays, and batches on other VkQueues wait for this batch as for any first work. A part that runs nothing drops its overwrites (fail_part). DontCare and Load first uses, and partial writes, keep the zeros. Counted: WorkCounts::private_textures_overwritten_unfilled (new public field, signatures re-blessed); the runtime README and docs/API.md say so. tests::first_overwrite checks both paths (whole pass, depth pass, whole copy, a recycled image's clear; DontCare, Load, a partial copy, a clear after another pass) and first_overwrite_costs (ignored) prints OVERWRITE-COST, for textures made together before the first commit (the first submission takes every waiting first move, so only its own texture goes unzeroed) and for textures each made just before its own command buffer (every one does). Why: the zeros are for isolation only (main's plan for pin 64): a first use that writes every texel before anything reads one never shows them, and they cost the Iris Xe up to 0.22 ms a 2048² depth texture (job 24088). Verified: before this replay onto development, at 9ab0b01426 (on a67e1e3d55): the validation lanes touching first moves, recycling, clear reach, resolves, blits and heaps on lavapipe (job 24205, 358 passed); on the Iris Xe (job 24218) tests::first_overwrite, memoryless_fresh and recycle (9 passed; FIRST-OVERWRITE whole: 1 each) and OVERWRITE-COST zeroed against skipped: made together, 8 RGBA8 1024² 2.136 against 2.100 ms median, 2 Depth32Float 2048² 1.693 against 1.487 ms, one texture a burst unzeroed. At this commit, tests::first_overwrite and the runtime suite on lavapipe, clippy (plain and m2v_gpu) and rustdoc, and the each-made-before cost on the Iris, reported with this sha. |
||
|
|
5877117603 |
A device's recovery carries its rasterization rate maps
A rate map held its device as the generation handle it was made on. After a recovery from the loss of the VkDevice, a render pass over a map made before it met that handle in its descriptor's check (rate_mapped_pass.rs check_descriptor: map.device().same(device)) and was refused, NotImplemented(MadeBeforeRecovery), at every encoder, as Metal's map goes on: a consumer's offscreen pass was refused every frame after a real recovery on an RTX 3090, the pass's 938 textures carried. A map holds no Vulkan object, so it now holds its device as a fence or a depth/stencil state does (LineDevice): the recovery carries the handle, a pass's and a copy's checks match its root handle by its line, and its reads (the zero-layer notice, a reset's registry of command buffers to encode again) take the generation it was carried to last. Its public device() answers that generation's handle, owned, as the other such objects' do (it answered a borrow). The recovery also carries the device's note that a map of layers was released, which a later map of no layers reads. The device test a_rasterization_rate_map_goes_on_past_a_recovery encodes a pass over a map made before a recovery, commits it and waits for it to complete, copies the map's parameter data into a buffer of the next generation and resets the map; an_objects_device_keeps_meaning_its_ generation_past_a_recovery takes the map's device among the others'. The recovery notice's, the refusal's, the README's and docs/API.md's lists of what a recovery carries name the maps. |
||
|
|
8bc2e7e1ac |
Keep the content directory's large records as content-defined chunks, each shared run once
NVIDIA's pipeline cache data (620.70.06, an RTX 3090) held one 1,851,552-byte section, the same bytes, in 3,565 of um790's records: its 11,853 NVIDIA records were 8,061 MB. A read-only measure of that node's 42,860 records (cut as below, averages of 16, 32 and 64 KiB) stores them in 296 MB at 32 KiB (NVIDIA's in 180 MB, 2.2%); 64 KiB keeps each shared run's end chunks apart (634 MB), 16 KiB doubles the files a read opens for 1.3x the bytes. shader_cache/chunks.rs (new), store.rs, driver.rs: - A content record of 256 KiB or more is cut by a gear rolling hash (FastCDC's normalized cut, 8 KiB to 128 KiB around 32 KiB): boundaries from the bytes alone, nothing of any driver's format read. Each chunk is kept once at <root>/chunks/<2 hex>/<SHA-256>, outside <root>/v1, so a build whose scans know nothing of chunks never removes one. The record's file is a manifest (M2VCHNK1, length, count, each chunk's SHA-256 and length, its own SHA-256); a read joins the chunks and the record's decoder checks it end to end as before (a driver record's checksum, a library's content hash). A missing or short chunk is a miss; the next write brings it back, and a chunk whose bytes are not its digest's is written again. Smaller records stay whole. - Crash-safe: every chunk (temporary + rename) before the manifest's rename. An advisory lock (std File::lock, <root>/chunks/lock): writers hold it shared from their first chunk look to their manifest's rename; the cleanup takes it exclusively with try_lock and removes only chunks no manifest names. Neither waits: a writer that meets a cleanup writes its record whole. - Bounded cleanup, in the scans the store makes already: the sweep at device creation where no cleanup ran yet or the chunks grew past 110% of what the last kept, and after a cap scan that freed chunks. It reads each content record's first 8 bytes (a manifest whole) and lists the chunks once. The chunks count against the cap; a removed manifest frees the chunks only it named. - Upgrade: driver::VERSION 3 -> 4, its frame's magic M2VPPLC -> M2VPPL4 (an older build names and frames otherwise, never misreads one). The old records are removed by Store::sweep -> Chunks::due (no state yet) -> Chunks::cleanup -> Chunks::manifests, which removes each content record whose magic is in driver::RETIRED. Each family pays one cold making after the upgrade. The validation lanes read the new magic. - Linux reads: every chunk opened first and posix_fadvise(WILLNEED) on each, so cold chunks are read together. Tests (tests::shader_cache_chunks, 8): round trip and the 256 KiB bound; a shared 1.5 MiB run kept once (the second record wrote 95,310 of 1,580,864 bytes); no manifest when its chunks cannot be written; a missing or damaged chunk; the sweep removing a synthetic v3 tree (four M2VPPLC records, one of 2 MiB), unnamed chunks and a dead writer's temporary; a writer's shared lock putting the cleanup off; a cleanup's lock making a writer write whole; the cap evicting the older record with its own chunks. Verified on msi (m3-max-24179, at this tree's code): clippy -D warnings all features, rustdoc, shader_cache tests 44 passed, the runtime suite 1512 passed. Load time, release mode on um790 (NVMe), a store load with a SHA-256 decode in both (m3-max-24178; the SHA-256 of 1.85 MB alone is 0.80 ms), median of 20 cold (every file dropped from the page cache) and 200 warm: - 1.7 MB, 40 chunks (NVIDIA p90): cold 1.56 ms whole, 1.47 ms chunked; warm 0.77 / 0.95 ms. - 2.5 MB, 67 chunks (worst): cold 2.07 / 2.62 ms (+0.55 ms; one of 20 at 12.1 ms); warm 1.12 / 1.44 ms (+0.32 ms). - 20 families sharing the section, all cold, in turn: per family median 0.86 ms whole, 1.13 ms chunked (first 0.94 / 1.65 ms); whole's slowest 138.6 ms, chunked's 1.18 ms. A family's later makings on the device use its live cache and read nothing. |
||
|
|
9e19371285 |
Pieces lane: default pipeline waits, the commit's time, the fan-out's makings taken
The lane's device ran under exact_answers(), whose PipelineWaitPolicy::Exact made every pipeline a commit settles on the program's thread: with the fan-out's begun at commit, the cold frame's commit took 86.9 ms on an RTX 3090 and 69.8 ms on an Iris Xe, a cost a consumer's device, under the default Bounded waits, hands to the pool. The lane's device now makes them under the default waits, as a consumer's does. Its line adds the program's time in commit (the host's clock) and the fan-out's makings the commit began that the step found made or waited for (WorkCounts::rate_map_fan_out_pipelines_ready, _waited). The lane's docs and the fan-out row's cost cell in docs/FAST-PATHS.md carry the three GPUs' numbers with the fan-out's pipelines begun at commit and the copy loop (m3-max-24007 RTX 3090, 24008 Iris Xe, 24009 Radeon 780M), command buffer GPU time FanOut against Exact, cold then warm: - Iris Xe: 47.3 and 40.6 ms against 514.3 and 496.8 ms; commit 2.1 ms. - Radeon 780M: 42.3 and 29.4 ms against 299.3 and 232.6 ms; commit 1.8 ms. - RTX 3090: 44.2 and 7.5 ms against 71.2 and 65.5 ms, the step waiting for the fan-out's makings in the cold frame; commit 7.4 ms. |
||
|
|
5eb107ac89 |
A new Private texture reads zero on every device: never the bytes its memory held
What: new_texture_image starts a Private texture zeroed (Start::Zero) on a device that presents an Intel or AMD Mac, as it did on an Apple GPU presenting one: its first move clears it, or copies zeros, or takes the driver's zeros where the block is fresh. Only a Memoryless texture starts held. private_textures_zero_filled counts each. WorkCounts::private_textures_unfilled goes, as nothing counts it now. - The recycled image a new texture takes (recycle.rs) and a recovery's remade texture (texture/carry.rs, Remake::Own through texture_as) go through the same making, so both read zero. - Tests: mac_class (an Intel or AMD Mac's new texture reads zero, counted as zero-filled); the parent's recycle test. - Lanes: fresh_contents and fresh_costs expect zeros there, counted. - Docs: API.md's accepted difference, the runtime README, MacClass::IntelOrAmd, conformance's without_compression. - api_signatures re-blessed (the field goes). Why: Start::Held matched a Mac with an Intel or AMD GPU, where a new Private texture can read a released texture's texels. On such a Mac those texels are the same process's. A consumer that serves several processes from one device showed one process another's pixels that way. The 780M read a released texture's colour through a recycled image (m3-max-23995). After a forced recovery on the RX 7900 XTX, a guest window read other windows' pixels. Zero is what those Macs read where their memory held nothing, and Metal leaves the contents undefined. Verified: the lane run reported with this sha (the recycle test of the commit before fails on lavapipe, the 780M and the XTX; this one passes). |
||
|
|
b95bd50ae6 |
The encoder trail's API.md paragraph: the stall probe and the watchdog count as without it
Rewrapped after the rebase onto the watchdog (
|
||
|
|
efcb6851ce |
The encoder trail: name the encoder a stalled GPU stopped in, and the last one that completed
A GPU hang (a CTX SWITCH TIMEOUT on an RTX 3090) left the runtime with no way to say which encoder never completed: encoders share batches and grouped submissions, and neither METAL2VULKAN_LOG_PASSES nor METAL2VULKAN_QUEUE_TIMES logs anything at a stall. METAL2VULKAN_ENCODER_TRAIL (env_vars.rs), or DeviceOptions::encoder_trail for one device, is a default-off diagnostic (encoder_trail.rs): - Each encoder, and each part of one a host step splits off, ends its batch (Batches::alone), and no batch waits in a group, so each goes in a vkQueueSubmit of its own that signals its queue's timeline. When work goes to the driver changes; what it computes does not. - Each encoder notes what it was: its kind, its command buffer's object ID, its place, a render pass's area, samples, attachments' formats and sizes, instances and rate map, its indirect command executions, and the label hash of each state it bound (the first 8 bytes of a SHA-256 of the state's label and its functions' names; no name, no shader text). A host step adds the states its indirect commands named, as the GPU and the CPU left the records. - Once no work of the device advanced for 2 s with some pending, completion.rs's stall path logs one Info line (id name metal2vulkan-encoder-trail) for each VkQueue whose oldest batch is pending: that batch's encoders and the last batch the queue completed, with how long before; once a stall. - A submission a host step makes and waits for itself (a rasterization-rate map's fan-out probe, a predicated loop's check run again) signals no timeline; once it ran 2 s, one line names it, the encoder whose step made it and the states its commands named. Off, a device reads the switch once and notes nothing. Verified on msi (lavapipe, --cfg m2v_cpu_icd), at the branch tip this commit's tree equals: - tests::stall::the_encoder_trail_names_the_stuck_encoder_and_the_last_one_completed: a cb stuck on an event wait before two blit fills; the line names the stuck cb's encoder 0 (not its encoder 1) and the earlier completed cb's encoder 0: "VkQueue 0's oldest pending batch: Blit encoder 0 of command buffer 3, states []; the last batch it completed: Blit encoder 0 of command buffer 2, states [] (2.106823047s before)". - tests::rate_mapped_fan_out::the_encoder_trail_fans_out_the_same_pixels: with the trail on, probes/flagged/fanned [1, 1, 6] as without, no texel differs from the encoder's own draws. - The host-step families (rate_mapped_fan_out, rate_mapped_pieces, indirect_command_buffer_device, host_step_neutrals, ycbcr_in_place_loop) with METAL2VULKAN_ENCODER_TRAIL=1: 11 passed. - encoder_trail's unit test (one state's hash pinned: a reader of the pipeline creation log computes it again); the runtime suite 1504 passed; api_ tests 16 passed; clippy all features and the runtime under m2v_gpu and m2v_cpu_icd; rustdoc of the runtime and metal2vulkan. The runtime-sources pin moves (not re-pinned here). |
||
|
|
d4ab197556 |
Metal's command-buffer watchdog: a front batch 20.2 s without its timeline advancing fails as Metal's timeout
reims's 3090 boot after an Xid 109 (CTX SWITCH TIMEOUT) had its graphics queue's batch never
complete while the copy engine ran on: the staging probe completed 23 times in under a
millisecond, so the stall rule found the GPU running and nothing failed. The probe stays; beside
it each queue's front batch now has its own clock (stall::Clock::front_held), which runs while
its waiter's waits run out with it pending and stops whenever its queue's timeline advances,
whatever the probe answers. Past stall::WATCHDOG (20.2 s, the x86 AMD Mac's measured bound and the
largest of Metal's) the front fails as Metal's timed-out command buffer (GpuHang, code 2, named
exactly: its queue is known, no inference), the rest in flight as GpuRecoveryVictim, and the
generation is marked stopped (Stop::Watchdog), parked and recovered from as a wedge; the notice
says the watchdog stopped it. Counted: WorkCounts::watchdog_timeouts (wedges_declared keeps the
unanswered probe's stops).
Measured on the M3 Max (macOS 27.0.1, a Swift probe): a command buffer waiting for an event no one
signalled, shared or plain, failed with MTLCommandBufferErrorTimeout ('Caused GPU Timeout Error
(00000002:kIOGPUCommandBufferCallbackErrorTimeout)') 5.00 s after its commit, nothing of it run;
two such on one queue revoked it (the next fill failed AccessRevoked 0.24 ms after its commit,
a new queue ran). So the clock counts event waits, as Metal's does, and the watchdog's GpuHang
counts against its queue as any timeout (revocation.rs says so; the count is QueueCommon's and
carries over a recovery, as Metal's queue keeps it).
Tests (tests::stall): the stuck front with an answered probe fails at the hooks' 1 s bound, no
sooner, as GpuHang, parks the generation and runs the next command buffer; the answered leg
whose front advances within the hooks' 3 s fails nothing. Docs: stall.rs, revocation.rs,
docs/FAST-PATHS.md known gap, docs/API.md, the runtime README, WorkCounts, api_signatures.
|
||
|
|
4906f145e3 |
Pieces lane: each frame cold, then warm; the fan-out row's cold and warm costs
The lane's one frame mixed two costs at the host step: the GPU work, and on the first frame of a state the driver making the fan-out's probe and draw pipelines inside the step (82.1 of the RTX 3090's 88.6 ms cold fanned-out window). The frame now runs twice on the same device, cold, then warm, each printed and checked, and the line adds the host step's time (WorkCounts::host_step_nanos), the pipelines it made (host_step_pipelines_made) and the time creating render pipelines (render_pipeline_create_nanos). The lane's docs and the fan-out row's cost cell in docs/FAST-PATHS.md carry the three GPUs' cold and warm numbers after the probe spread, from one run each (m3-max-23899 RTX 3090, 23900 Iris Xe, 23901 Radeon 780M), command buffer GPU time FanOut against Exact: - Iris Xe: 110.4 ms cold, 40.3 ms warm, against 514.6 and 499.1 ms. - Radeon 780M: 84.3 and 34.7 ms against 299.5 and 231.7 ms. - RTX 3090: 88.6 and 6.0 ms against 61.9 and 63.0 ms. The guest-scale fanned-out figure, measured before the spread, is dropped; its region-by-region one stands. |
||
|
|
c7362776d0 |
Let carried textures' and pipeline states' parts go at the lost generation's rest
What: a recovery's carried textures and pipeline states let go of their parts on the lost generation once it comes to rest, as buffers already did, so the lost VkDevice goes while they live. - device/carry.rs: LetGo<T>, the let-go cell MadeOn was (MadeOn is now LetGo<Device>), and PartsCalls/CallHold, one guard generalised from the buffer's calls and HeldParts: a call outside command buffers' work counts itself, and a release at rest waits for the last call to end. Buffers use it unchanged in behaviour (Buffer::held_parts, LostBuffer, LostPlaced, LostHost). - Pipeline states: StateShared.program and ProgramLink.program are LetGo cells. The carry hands the lost generation a LostProgram, which drops the state's program there in place at rest (its variants' objects, plans, makings and its Device). reached() skips programs let go of. The state keeps its own copy of its label, so label()'s borrow outlives the program. Holds: the public state methods that reach the program, program(), Debug, and the argument encoder's and indirect commands' set paths. - Textures: TextureShared's per-generation parts (storage, moved, pending_move, usage_shadow(_making), faces, snapshot, kept_backings, render_shadow, facts, planes_in_place) move into Parts in a LetGo cell, read through Deref. The carry hands the lost generation a LostTexture. At rest it leaves the texture's slot in the lost generation's table and heap sets, hands the caller's range token to the parts on the next generation, and drops the parts in place. Parts with a handed-out VkImage (Texture::vk_image) stay until the texture goes. Texture::s() skips parts let go of. Holds: the public texture methods that reach parts, and vk_image; a view's hold holds its root texture too. slot_keeper names a texture buffer's generation by its texel views, not by the buffer's serving generation. - WorkCounts::lost_programs_released and lost_textures_released, counted on the line. - Public signatures: ComputePipelineState::device, RenderPipelineState::device, FunctionHandle::device and VisibleFunctionTable::device now answer an owned Device. The last two also borrowed from the state's program. Command-buffer paths use the crate-private borrowing generation(). api_signatures is blessed. - Docs: the carry module docs (device, pipeline, texture), docs/API.md's recovery entry, the runtime README's recovery paragraph, vk_image's doc. - Tests: the four recovery tests in 99dbc69666 also assert the counters. Why: a carried texture kept its images on the lost generation, and a carried state its program there, until the object went, so the lost VkDevice lived as long as any of them. A long-lived program kept it for good. Verified: cargo check of the workspace, all targets and features, under no cfg, m2v_gpu and m2v_cpu_icd, clean but for one validation call site fixed here (jobs m3-max-23824, 23852). The lavapipe lane (the tests of 99dbc69666 before and after), the suite, lint and the 780M run follow. |
||
|
|
cbe64ff91b |
warm: a failed creation is announced once per kind, naming the kind and nothing of the shader
What: a record whose creation fails on Device::warm is still counted and dropped, and the first
failure of each kind a device meets is now announced through its message sink (else stderr) as
the warning metal2vulkan-warm-record-failed, as the first unread record is. The kind
(warm::pass::failure_kind) is the runtime error's variant and, for a translator refusal, its
feature and what it needs, e.g. Compile(Unsupported{Lowering(Access); NotImplemented}); for an
input error, its class. Never a symbol, location or message, which can name the record's
shaders. Past 32 kinds a device counts later ones alone.
Why: pin 62's warm pass failed 124 of ms01's records and 90 of um870's and said nothing: the pass
counted them and dropped them, so the walk's summary line was the only trace, and naming the
class took a replay with a temporary print (all 124 on ms01 were
Unsupported{Lowering(Access); NotImplemented}, fixed by SEMANTICS_VERSION 2070). The next such
regression names its kind in the consumer's log.
Tests: a_failure_kind_names_nothing_of_the_shader (a refusal with a symbol and a function
location renders as its variant, feature and needs only), and the device test
a_failed_creation_is_announced_once_by_its_kind_and_the_pass_goes_on (two records Metal refuses
alike around a render record: 2 failed, 1 warmed, the warning heard once, naming the kind the
program's own creation meets and not the kernel's name). The runtime README and docs/HOWTO.md
say so.
|
||
|
|
0c6d7cc1c8 |
Pieces lane at a guest frame's scale, a GPU hazard; the RTX 3090's numbers
rate_mapped_pieces_guest_scale (FanOut) and _guest_scale_exact run the host step's frame at six times the commands (384 commands, 5,508,648 indices, about the 126 pieces a guest frame was recorded in on an RTX 3090), compiled only under m2v_gpu_hazards and ignored by default. Measured once on an RTX 3090 (NVIDIA 620.70.06), um870, each test its own process: at 64 commands Exact 54.4 ms in 20 pieces (longest 2.63 ms), FanOut 98.4 ms with a 14.0 ms probe; at guest scale Exact 332.3 ms in 117 pieces (longest 2.67 ms, mean 2.00 ms), FanOut 174.3 ms with a 74.4 ms probe. The numbers go in the lane's docs and the fan-out row's cost cell in docs/FAST-PATHS.md, where FanOut is slower than Exact at the small size on that device. Verified: clippy with --cfg m2v_gpu --cfg m2v_gpu_hazards over the runtime, the translator and validation, 0 messages; the five lanes passed on the RTX 3090 (job m3-max-23744), built from the same lane source. |
||
|
|
41337099f5 |
Time a rate-mapped pass's pieces on a device asked for host-clock GPU times
A device made with DeviceOptions::gpu_times_from_host wrote no timestamps at all, so a pass recorded in pieces read no piece time there (rate_map_pieces_timed 0): a guest frame on an RTX 3090 cut into 126 pieces gave no hint which piece or draw was long. The option only spares command buffers' own two timestamps; the piece timer and the host step's probe now write theirs on such a device. They still skip where the driver's timestamps wait for every queue's (FromHost::Driver, MoltenVK), since there a timestamp would serialize the device's queues. The option's docs, the gpu_time module's, the degrade notice's, the API catalogue's and the work counts' say so. Verified: the new runtime test a_device_answering_gpu_times_from_the_host_times_its_pieces passes on lavapipe (12 pieces past the first, 13 timed) and on an RTX 3090 (NVIDIA 620.70.06, the same counts), built at the branch's earlier commit with the same runtime source. |
||
|
|
5039015420 |
An import several no-copy buffers over the same bytes lie in stays releasable
A no-copy buffer made over exactly the bytes a live one covers lies in that
buffer's import (host_aliases.rs, "One memory, one import"). Until now its
making read the import apart (ReadApart::SecondBuffer), which keeps a
releasable import imported for good. Such a buffer reads the import the way
the first one does, through the import: its blits take the import's objects,
imported again where released, and any other read of it exposes the import
just as a read of the first buffer would. So the import now stays releasable
while every read of each buffer in it was a blit's, or there was none. A
buffer that is never read, made only to keep the bytes imported, keeps the
import no more than a buffer read only by blits does.
Why: on the RX 7900 XTX (RADV), a guest's 3D benchmark kept 1,000 to 1,330
dma-buf imports live. RADV lists every one of them in every kernel submission,
at 0.43 to 0.44 us each (docs/FAST-PATHS.md, known gaps). Of those imports,
1,262 were held for good, and every held one had a second buffer lying in it.
The consumer keeps a holder for each view of guest pages: a no-copy buffer
over the whole view that nothing reads, with the block's buffer lying in its
import. The frames named about 0.6 imports per command buffer, while the
scheduler thread spent 0.63 to 0.90 s of each second in vkQueueSubmit, at
0.835 ms per call. Our own blocks on that device are plain VRAM, which RADV
makes local and lists in no submission.
What still keeps such an import imported for good:
- a no-copy heap's own bytes lying in it: the heap's placed buffers'
addresses are the heap's, handed out without any read of the import noted;
- a rebound buffer lying in it, as a rebind's own import is kept;
- a buffer bound inside its memory with a VkBuffer of its own;
- a buffer made to share its buffer's range (BufferDescriptor::range_of),
which is handed that buffer's address.
Counters: the gauge host_imports_read_apart_second_buffer is split into
host_imports_read_apart_inside, _shared_range, _heap and _rebound. The new
host_imports_joined_releasable counts the buffers that came to lie in a
releasable import beside another and left it releasable; a walk shows the
path ran when it is non-zero. host_residency.rs ("Several buffers in one
import"), host_aliases.rs, the WorkCounts docs, docs/HOWTO.md and the API
signature table say so.
Test: tests::host_residency::an_import_two_buffers_lie_in_is_released_while_idle_and_read_right_again.
It makes a never-read holder and a second buffer over the same 4 pages of a
udmabuf-backed memfd. Joining keeps the import releasable (nothing held for
good, no read apart) and imports nothing new. Read by a blit, the import is
released. The file's writes made while it is released are read by the next
blit through the second buffer, imported again from the kept descriptors. It
is released again. Then a kernel binds the second buffer, makes the holder
resident (useResource:, as Metal reaches a no-copy buffer through an address
only once a command buffer used it) and loads the holder's Metal address from
set_bytes; the binding imports the import again for good. The words the kernel
reads through the address, and the words it writes through it, are checked
against the pages. The source is called once, and the import leaves the gauges
once its buffers go.
host_import_counts now expects a second buffer over the same bytes to read
nothing apart.
Verified (the runtime's debug test binary, --cfg m2v_gpu, not a release build):
- m3-max-23710 (msi-laptop): cargo clippy --workspace --all-targets
--all-features -D warnings, the runtime's clippy under --cfg m2v_gpu, and
the runtime's rustdoc with -D warnings: clean.
- m3-max-23713 (msi-laptop): the API signature tests, 16 passed; the
runtime's suite, 1502 passed, 6 skipped; on lavapipe (--cfg m2v_cpu_icd)
the host_import_counts, host_residency, pointer_residency and host_aliases
tests, 39 passed.
- m3-max-23761 (Radeon 780M, RADV PHOENIX): the host_residency and
host_import_counts device tests, 15 passed, the new test among them ("1
chunks of two buffers released twice, imported again twice"). The negative
control, the same binary with a joining buffer reading the import apart as
before, fails the new test at "the second buffer kept the import for good"
(held for good 1, expected 0).
The lint and suite jobs ran one commit before the test's last change (the
holder made resident before the kernel reads through its address), a
test-only change that the 780M run's binary carries.
|
||
|
|
c3a002b71c |
stall test: the stopped test drains the parked queue before the process exits
On NVIDIA (620.70.06; um870's RTX 3090 and um790's RTX 2080) the stopped test passed and its process never exited: under gdb (job 23736) the test reported ok in 21.5 s, and the main thread then spun in exit(), in an exit handler of libEGL_nvidia that tears down every VkDevice left and waits for its work. The parked VkDevice's batch waits for the event's semaphore, which the test never signalled. The test now keeps the stopping generation's functions and semaphore and signals the reserved counter on the parked VkDevice once it has checked the recovery, so its queue drains. It prints when the stuck command buffer failed and when the next one ran. docs/FAST-PATHS.md's known gap and stall.rs's module docs say a driver may wait for a parked VkDevice's work at the process's exit (NVIDIA's did, for that stand-in wait); a GPU that truly stopped is not measured there. Verified: cargo fmt. The NVIDIA runs follow with this commit's archive. |
||
|
|
64982ac827 |
A GPU that stops with no loss from the driver fails its work and is parked
On NVIDIA after an Xid 109 the device's queues stopped: no batch completed and every completion wait answered VK_TIMEOUT, never VK_ERROR_DEVICE_LOST, so the program's command buffers waited without end. The completion's waiters now keep a device-wide stall clock (command_buffer/stall.rs): it runs while a wait ran out with its front batch pending and stops whenever any queue's timeline advances. Past 10 s one waiter probes the staging queue (NVIDIA's copy engine) with a submission of nothing that waits for nothing, and for up to 2 s reads the probe's answer and the stuck front's fence (a wait of no time) and timeline (vkGetSemaphoreCounterValue); a loss either read answers takes the failed wait's path at once. One informational message, metal2vulkan-stall-probe, names the stall, the probe's answer and each read's last VkResult. A probe answered, or a front that advanced, fails nothing and restarts the clock, so a device that still makes progress is never failed whatever its work's length. A probe unanswered in 2 s stops the generation: Device::mark_wedged marks it stopped and lost, the wait fails as a lost device's (the oldest command buffer as GpuHang, the rest GpuRecoveryVictim), and the line recovers; the DeviceRecovered notice says the VkDevice stopped and was parked. Parked: release.rs's door leaves every object of a parked VkDevice, the device itself included; DeviceShared::queues_idle waits for none of its queues, and its teardown returns before vkDeviceWaitIdle, keeping the instance. New public query Device::is_parked(vk::Device) -> bool (no Metal counterpart), for a consumer that holds the stopped generation's handles. Counters: WorkCounts::stall_probes_sent, wedges_declared, longest_stall_nanos. A device without a staging queue sends no probe (FAST-PATHS known gap, with the leak and Metal's bounds: about 5 s on the M3 Max, 20.2 s and 16.1 s on x86 Macs' AMD and Intel GPUs). Tests (tests::stall, through the line's hooks: the clock's bound 200 ms, and no probe seen answered): a command buffer waiting on its VkQueue for a reserved event signal is pending; with the probe answered nothing fails and it completes once the host signals; with none answered it fails as GpuHang, the old VkDevice is parked, the new one is not, and a command buffer runs after. Verification follows on this commit. |
||
|
|
a52c30aff2 |
A recovery carries no-copy heaps and the textures placed in heaps
What: a heap over the caller's memory (new_heap_with_bytes_no_copy) is
carried as a no-copy buffer is: its own buffer made again over the same
pages (Buffer::carry_no_copy, now for a heap's own buffer too, kept among
no program resources; its pages keep what they were made of, a heap's own
included), its identity kept, the buffers placed in it carried at their
offsets (Buffer::carry_placed), their bytes as they are. The textures
placed in a carried heap, Private or no-copy, are made again there after
the heaps (Remake::Heap, Device::heap_texture_again): as the runtime's own
texture over the same range of the heap's bytes, through the making that
placed them (a texture buffer's buffer carried with carry_placed), sharing
the range's makeAliasable flag (HeapPlace::aliasable is an Arc), the range
handed to the newest image (HeapPlace::again, hand_range_to), so it is
given back once. A Private heap's texture reads as a new one, a no-copy
heap's reads the pages. The heap keeps its textures numbered as they were
(no forget_held); one the recovery leaves is forgotten (Numbered::forget,
Heap::forget_texture). A texture over a carried heap buffer is made again
over it, as over any carried buffer. Heap::carry answers what its bytes'
carry did with their contents and None where it was carried already, so
the notice counts no-copy heaps apart (", and N no-copy heaps with the M
buffers placed in them, over the same pages") and textures placed in
no-copy heaps apart ("N textures placed in the no-copy heaps carried"),
a Private heap's textures by storage mode. Docs: heap.rs, texture/carry.rs,
device/carry.rs, MadeBeforeRecovery, the device-recovered cost (degradation.rs,
API.md), the runtime README, and FAST-PATHS's known gap on lost texture
contents, which now names a Private heap's textures.
Why: reims's forced recoveries (3090 m3-max-23482, XTX m3-max-23547) left
44 no-copy heaps and 929 heaps' textures refused: 3424 refused texture
binds in one compositor's command buffers, 82 placements in those heaps
refused, the desktop mostly black after. Metal keeps a heap and what is
placed in it. The owner's call: a Private heap's textures are carried with
their contents lost, as new_texture's are.
Verified: a check of the runtime's lib and tests under plain and
m2v_cpu_icd was clean (m3-max-23688, on a probe commit of this change);
the lane that follows runs the tests.
|
||
|
|
257b77bc21 |
Fan a host step's rate-mapped draws out to the regions in one draw
A rate-mapped pass drew every draw once per region of the map's plan: an executed command's
triangles ran their vertex function 2074 times on a 3648 by 1734 screen's plan, and the command
buffer of a guest frame's shape took 514 ms of an Iris Xe's GPU and 462 ms of a Radeon 780M's.
At a host step, where the default `RateMapRegionPolicy::FanOut` holds and the device enables
`geometryShader`, `shaderClipDistance` and `vertexPipelineStoresAndAtomics`, the pass is now
probed first: each execution's commands, read once, are replayed in probe mode into a segment of
their own (one middle render pass per instance, the fan-out variant's geometry stage writing a
flag and a copy count per command and emitting nothing), submitted and waited for. A command
whose flag is clear (no triangle crosses w = 0 or touches more regions than the copies) is drawn
once through the fan-out variant over the whole target, its geometry stage emitting a copy per
region it touches; a flagged command, and every command after a barrier, after a draw that writes
memory or at a mesh or patch draw, is drawn region by region as before. A fan-out variant the
compile refuses falls back to region by region at the settle.
`RateMapRegionPolicy::Exact` (`DevicePolicy::exact_answers()`) keeps every draw region by
region. The FAST-PATHS row, the API.md bullet and a known gap (the encoder's own draws and the
draws commit records stay region by region) describe it; `WorkCounts` counts the probes, the
flagged and fanned-out draws and the probes' GPU time. `CommandBuffer::submit_waited` is the
loop check's waited submission, shared with the probe.
Verified (release, `--cfg m2v_gpu`, e55e6ebd01 before the rebase onto
|
||
|
|
e6124818d9 |
A recovery carries Private exportable buffers over their own memory
What: Buffer::carry takes a Private buffer in exportable memory (no host copy) to the new generation over its block's payload imported again (Device::buffer_in_carried_export, memory::place_carried_export): the lost block is exported once from the lost VkDevice (memory::carried_payload, vkGetMemoryFdKHR, which the spec lets a lost device answer) and that descriptor is kept on the block (Block::payload); the new VkDevice imports a clone of it (Handed) once for every buffer carried from the block, as memory of the block's own type and allocation size with the device-address flag of the device's blocks, dedicated to the buffer where the lost block was a dma-buf's dedicated allocation, and binds each buffer at its offset. The buffer is not cleared: another API's import (VA-API) reaches the same memory and may be writing it, so it keeps whatever the memory holds, counted among the buffers carried with their contents. Its exports after the recovery answer a clone of the kept descriptor, and so does the dma-buf a texture's image over it imports (ExportedTexels::payload), so textures over it carry as over any carried buffer. Left refused: Shared and Managed exportable buffers (their contents pointer is the lost mapping), and an opaque descriptor's dedicated allocation, a new kind in the notice (Left::DedicatedOpaqueFd: VUID-VkMemoryDedicatedAllocateInfo-buffer-01879 names a buffer identical to the payload's, which Vulkan does not define across devices). Docs: exported_memory.rs, device/carry.rs, buffer.rs, MadeBeforeRecovery, the device-recovered cost (degradation.rs, API.md) and the runtime README, with the exception to the Private-reads-zero rule. Why: reims's NV12/P010 device caches are Private exportable buffers (STORAGE_PRIVATE in surface_cache.rs and vaapi.rs, read-only check) that VA-API decodes into; a recovery left them refused, failing a video session's frames, where Metal keeps the buffer. Verified: the lane that follows runs the test before and after on lavapipe; REFUSALS.md regenerated (no change). |
||
|
|
30ba489080 |
A recovery carries sampler states
What: a sampler state's device is a LineDevice the state's own carry links (LineDevice::unkept, link_unkept). The recovery takes the generation's live sampler states (Carry::sampler_state, Taken::samplers) and, first after the handles, carries each (SamplerState::carry) where both generations compile alike: its handle linked to the new generation's under its cache's lock, the VkSamplers it kept forgotten, the state kept in the new generation's map of live states (an equal request gets it) and placed in its heap sets and sampler tables, then kept there for a later recovery. Its placement on the lost generation is taken out at that generation's rest (LostPlacement). SamplerState::vk_sampler takes the generation the bind writes for and makes the sampler there, cached for the state's latest generation alone; for any other generation it answers None, and the heap set, slot and argument-buffer writes take the neutral sampler. The recovery's notice counts the states carried (and any left, where the generations compile otherwise). Docs: MadeBeforeRecovery, the device-recovered cost (degradation.rs and API.md), the runtime README, device/carry.rs and sampler.rs. As main asked, Device::recover_for_test's doc and line.rs's module doc now point at device/carry.rs for the kinds carried instead of a stale list. Why: a sampler state kept its lost generation, so every bind of it after a recovery was refused (MadeBeforeRecovery) where Metal's goes on; and the argument buffers' listing of live states is line-wide, so a draw or dispatch of the new VkDevice made the listed state's VkSampler on the lost VkDevice and wrote it into a descriptor set of the new one, a handle of another device, which Vulkan does not allow. Verified: the lane that follows runs the test before and after on lavapipe; REFUSALS.md regenerated (no change). |
||
|
|
c4376d1042 |
canon::generic: a struct's generic pointers read through its address another thread object holds
What: canon::generic's cells (canon/generic/cells.rs) follow thread pointers through thread
memory. A slot of an alloca into which only the address of one alloca at one offset is stored
(a null among them or not), that no other write, copy, atomic or load at another offset or width
meets, of an alloca whose address no use but an access and address arithmetic takes, is
followed: a thread pointer loaded from it places what it addresses, and storing that address into
it is no escape. Places also derive through casts between the thread and the generic space, so
an object reached through a generic `this` is a cell too. The slots followed and the places they
lead to are found together, in rounds; a slot followed once and not after is never followed
again, and past the rounds' bound none is.
Why: macOS 27's MPS matmul and quantized matmul kernels keep their array_refs' generic pointers in
a thread struct and read them through a lambda that captures the struct by reference: the
lambda's object holds the struct's address, and its call operator, inlined, loads that address
and then the struct's fields. The fields' loads were from no place a cell knew, and the struct
was open because its address was stored into the lambda's object, so each was
GenericPointer(Memory).
The owned fixture generic_pointers gains generic_captured (a lambda capturing a `refs` by
reference, its call operator taking its object as a thread pointer) and generic_functor (a
functor holding `&r`, its out-of-line call operator taking the functor as a generic pointer), and
its Metal probe the same kernels. docs/FAST-PATHS.md's generic pointer gap says so.
Verified, one run each:
- Before, at development with the fixture: engine_generic_pointers refuses generic_captured
with GenericPointer(Memory) (m3-max-23363).
- The M3 Max (macOS 27.0.1) answers both new kernels as generic_slots: 100+t, 201+t, 1 for t<4
then 4, and t (m3-max-23383).
- engine_generic_pointers and the metal2vulkan-air suite pass, 561 tests (m3-max-23381).
- The metal2vulkan and metal2vulkan-air suites (m3-max-23401): 4060 of 4063 pass; the three
that fail are the golden tables, which development re-blesses: golden_hashes, the engine
inventory's two new rows (generic_captured and generic_functor, ok in every cell), and the
engine printout of generic_pointers.ll (tests/air_input/generic_pointers.txt, recorded under
LLVM 21).
- runtime_lane::generic_pointers on lavapipe, both tests, the five struct kernels among them
(m3-max-23413).
- fmt, clippy with all features and rustdoc (m3-max-23436, the same patch on development
|
||
|
|
56a8aa5283 |
did_modify_range: a commit takes the ranges of the buffers its command buffer uses, copied in on its queue
What: Modified::take_at_commit takes, at a commit, only the noted ranges of the buffers the
command buffer may use (CommandBuffer::may_use: its encoders' uses name the buffer or made it
resident, a command may reach memory no use names, its last encoder's end is still with the
lowering thread, or nothing owns the buffer's key); the rest stay noted, in their order, for a
commit that uses them (managed.rs's Noted). Their copies in, and every other upload into a
buffer the program may have read (Buffer::upload, copy_in_from), register as uploads
(FirstMoves::register_upload, FirstFill::reached_only): a batch takes one only where its
commands may reach the buffer, on a device with a fill queue or without one, never because it
takes every other fill; an internal submission takes it too, and a batch that needs no GPU work
leaves it waiting. FillTake::Owned carries the batch's reach for that. So the copy lands on the
user's queue, after the command buffers before it there, before the commands of the first that
uses it: Metal's shape. Docs: managed.rs, managed_copy.rs (the 'as on Metal' line now says what
holds: only two queues' unordered uses of the buffer race the copy), first_move.rs, API.md, the
runtime README and FAST-PATHS.md's managed row.
Why: any queue's commit took every noted range, and any queue's next submission took its copy in
(before
|
||
|
|
6b79a77730 |
A recovery carries drawing and mesh pipeline states
What: a drawing state (a mesh one, and a twin of a color group, a single-sample or a factor-scaling state among them) keeps a chain of programs per generation as a compute state does (pipeline/carry.rs): its StateShared Deref reaches the program of the generation whose command buffer's work the thread does, else the last; its ID, uniqueIdentifier, label and sampler numbers stay. Each state is kept by its generation's carry registry (GraphicsState::kept at the end of a render or mesh creation, with its color groups' twins); the recovery carries them after the compute states (pipeline/render/carry.rs): its base variant, and its large-buffer form's, made again from the pipelines its creation compiled or the live variants of them the new generation holds, no translation; then, under the new generation's reach (NoticesFor::of_generation), its neutrals, its predicted first draw's VkPipeline handed to the pool with nothing waiting for it (make_at_creation(false)), and its depth stand-in copies. Its descriptors, keys, label and twins are kept; its other variants, plans, settles and routings are made as its draws need them. A failed making is counted and refused where bound (RemadeAfterRecoveryFailed) through RenderPipelineState::bound_device, at set_render_pipeline_state (encoder, call checks, indirect command buffer) and an argument encoder's render word; a tile state's bind now answers its kernel's failed making the same way. A state is made again only where both generations compile alike (compiles_alike, the profile fingerprint the memo carry checked already); else its making is refused as failed. Docs: device/carry.rs, pipeline/carry.rs, MadeBeforeRecovery (render states no longer listed refused) and RemadeAfterRecoveryFailed, the DeviceRecovered cost (degradation.rs and API.md, equal), API.md's recovery entry, the runtime README; REFUSALS.md regenerated. Why: drawing states made before a recovery were refused where bound after it; Metal's go on. Verified: see the lane run reported with this sha (the test commit before it fails, this one passes), with the recovery's wall time for 0, 200 compute and 200 drawing states. |
||
|
|
11d87dec93 |
Make the region table a public submodule of bind, and pin the fan-out surface
bind::fan_out moves out of the rate map's module so the surface scan reads it; the surface table, the signatures and docs/REFUSALS.md name the fan-out's items and refusals. |