12fa641450324519de4a64d0da9fc53d760e2ee0
268
Commits
| Author | SHA1 | Message | Date | |
|---|---|---|---|---|
|
|
76855fc0ba |
SEMANTICS_VERSION 2106, ARTIFACT_FORMAT_VERSION 522, RUNTIME_VERSION 2256: GPU-written indirect command buffers that inherit the encoder's buffers run on the GPU; write routes reach the indirect command buffers of their own command kind
A GPU-encoded indirect command buffer whose records inherit the encoder's buffers took the host step: the render GPU form refused inherit_buffers (DrawReplayRule::InheritedBuffers) and the compute GPU form had no inherited-bytes path, so every frame read the records back and replayed them on the host (gameload's icb: 8,192 indexed draws, ~44 ms of host step a frame on the Iris against 0.29 ms natively). - Render (da75a4602f..f3745fd69c): a draw replay's variant takes the encoder's vertex and fragment buffers by index as its parent buffers, resolved to device addresses past the parent's record; inline bytes (set*Bytes) are planned at their slots; an unaddressed inherited buffer keeps the host step with its cause named (parent_entries refuses it rather than writing a zero entry). The executor's draw preprocess binds the encoder's vertex buffers. - Compute (7c148c3995..0a68ac5f15): a GPU-written buffer of dispatches that inherits the encoder's kernel buffers runs on the GPU the same way; the new fixture icb_inherited_dispatches (our MSL) and its golden. - Route kinds (2d9f4ac597..2e206952c2): every route of a command buffer joined every indirect command buffer it made resident for writing, so a compute ICB's writer (DISPATCH|RESET) refused the render ICB's GPU form in the same command buffer (DrawReplayRule::Operations): gameload -b's render ICB host-stepped although nothing refused its own shape. A write route now reaches only the ICBs of its command kind (render or compute); CommandWrites carries the kinds (ARTIFACT_FORMAT 522). - host-replayed-indirect-commands is announced once per cause instead of once per device (a660b2fe8d), naming the rule that keeps a pass from the GPU form, as copied-host-pages announces per reason; no new Degradation kind or WorkCounts field. Verified on the branch (steelbrain/icbinherit2 at a660b2fe8d): clippy plain, m2v_gpu and m2v_cpu_icd and rustdoc exit 0 (27886); runtime suite 1538/1539, the one failure the catalogue text RUNTIME 2253 already fixed on development (27884); lavapipe ICB and notice lanes 214/219 with render_inherited_buffers, compute_inherited_buffers, write_routes, written_commands and the beside test (inherited and own buffers: cold (8,8,0), warm (8,8,0,0), pixels as alone) passing, the 5 failures failing the same at the branch's base (27926, 27927); before route kinds the beside test fails as designed, (0,0,8) against (8,8,0) (27764); XTX 90/101 at 60c85035e3 (27853), the 11 failures fixture paths under msi's compile-time path only, all 11 passing on lavapipe (27807). |
||
|
|
1cf0e1910d |
RUNTIME 2255: cubes and BC rows over an IOSurface plane are made where the x86 Macs make them
reims's oracle_surftex found the Radeon Pro 5300M and the UHD 630 making three IOSurface-plane
shapes that the runtime refused:
- a Cube and a CubeArray over a plane of a surface with planes (cases 119, 188-191). These were
refused as Metal's own Invalid; the M3 Max asserts "carriesComplexTexture || numFaces == 1", the
arm64 envelope.
- BC1 64x64 over a 420v luma plane, whose rows of blocks are wider than the plane's row (case 187).
This was refused as NotImplemented(SurfacePlaneShape); the M3 answers nil.
An x86 guest was answered "made" while the host held no object for it. The x86 envelope is the x86
Macs', and they agree, so the runtime now makes them as those Macs lay them out. Measured with
surface_texture_envelope on both x86 GPUs (m3-max-27621, -27622).
Cubes: face k lies at the plane's offset + k x rows x bytesPerRow, rows bytesPerRow apart. The
planner (linear_plan.rs, faces_at_pitch) lays a colour cube or cube array over a plane, at an offset
and bytesPerRow that are multiples of 16, as a 2D array of its faces at that pitch, for the GPU
and the CPU alike. Faces past the buffer go in the texture's tail, announced as SurfaceTexelsTail,
as a 2D array's texels past it do. The image is cube-compatible, as every cube's is. Every other
cube over such a plane (another format, off 16, several levels, rows wider than the plane's) is
NotImplemented(SurfacePlaneShape) instead of Invalid. Over a surface without planes it stays
BufferTextureProblem::TextureType. The CPUs differ: the 5300M's getBytes and replaceRegion take
every face at the first's bytes, and the 630's take them one image on from the surface's byte 0.
The runtime's CPU calls take the GPUs' layout.
BC rows of 8-byte blocks wider than the plane's row keep to it, as the x86 Macs' blits do: the
blocks in the plane's row lie in place; the blocks past it read zero and their writes are dropped.
There is no tail storage: the shadow zeroes them at its first move, and blits, replace_region and
get_bytes clip to the kept columns. InPlaceRefusal::Rows's doc now also covers rows that hold fewer
of a BC texture's blocks than its row. No Degradation kind and no public item were added. docs/API.md
records two accepted differences: the CPU calls follow the GPUs' layout, and a cube's faces past
the plane's rows lie at the plane's pitch. linear_plan.rs, the RuntimeGap and BufferTextureProblem
docs, FAST-PATHS known gaps and REFUSALS.md (regenerated) are updated.
Verified (planerows, 97de630b9f on
|
||
|
|
2bd067d6c7 |
RUNTIME 2254: a command buffer's completion exports as a SYNC_FD sync file
A consumer that composites one GPU's frames on another vendor's GPU has to order the second
device's work after a runtime command buffer. The only semaphore export was
SharedEvent::export_semaphore_fd: a timeline semaphore as OPAQUE_FD, which Vulkan imports only on a
device with the same deviceUUID and driverUUID, so it cannot cross from NVIDIA to RADV. The consumer
waited on the CPU instead, about 3.5 ms a present on its window thread. A cross-driver handle needs
SYNC_FD, which only binary semaphores export.
New (unix only, no Metal counterpart):
- CommandBuffer::add_completion_sync_file(), before the commit: the command buffer's last batch
also signals a binary semaphore exportable as SYNC_FD, after its to-host barrier. That batch never
joins a submission group. A command buffer with no GPU work submits the signal alone, after its
queue's earlier work.
- CommandBuffer::export_completion_sync_file() -> Result<Option<OwnedFd>, Error>, after the
commit. It blocks only until the signalling batch's vkQueueSubmit has returned, never on the GPU.
None means the work already ended, or the driver answered -1; the importer imports -1 or skips
the wait.
- Spec: the export follows the signal's submission (VUID-03254), with copy transference. One export
per command buffer. Event::reserve_vk_signal's doc carries the contract for a reserved signal
that the batch waits on.
- The semaphore goes back to an idle pool of up to 8 per device once the command buffer completes
with its fd exported, and is released otherwise.
Where the host writes the caller's pages after the GPU work (a copied host buffer's merge back, or a
managed two-copy buffer's copy-out), no GPU signal can come after those writes. There the export
waits for completion and answers None, announced by a NEW Degradation: SyncFileAfterHostCopies
(sync-file-after-host-copies, performance). Also new: WorkCounts::sync_files_exported and
sync_files_after_host_copies; RuntimeGap::SyncFileExport, for a device without
VK_KHR_external_semaphore_fd or without binary SYNC_FD export (MoltenVK, an adopted device without
the extension); Problem::SyncFile(SyncFileProblem { Committed, NotCommitted, Exported }).
docs/API.md (catalogue entry), the runtime README, REFUSALS.md (regenerated), the reach table and
api_signatures are updated.
Verified (syncfile, 8f9caba0ae on
|
||
|
|
7e827c1b5e |
RUNTIME 2251: a two-plane YCbCr texture over IOSurface rows of codes that overlap is made, as Metal makes it
A two-plane YCbCr texture can sit over a plane of a surface with planes whose rows of codes are
wider than the planes' bytesPerRow (a texture wider than its plane, or a 10-bit format over 8-bit
rows). Metal makes it. The runtime refused it at creation: linear_plan's overlap_held answered
NotImplemented(OverlappingSurfaceRows), and the guest got nil. An arm64 guest's oracle run met
one: YCBCR8_420_2P 66x64 over plane 0 of a 64x64 '420v' (luma rows of 64 bytes).
Such a texture's texels are its conversion of the planes' bytes (ycbcr.rs), which reads every code
at the planes' rows, so rows that share bytes need no row rule. The refusal was written for a
plain plane's two-region shadow copies, which a converted texture never uses. overlap_held now
holds a two-plane YCbCr texture over a plane of a surface with planes, whatever its usage.
Still refused, now at use and with the precise gap NotImplemented(OverlappingSurfaceRows) (was
NotImplemented(Format)):
- a blit from a buffer into such a texture: Metal leaves no single row's bytes there (the
earlier row's at every shared byte of the 8-bit shape; 2047, then 1919, of 4032 for the 10-bit
one);
- a 4:4:4 texture's stored writes;
- a render pass whose rows of codes overlap (unmeasured).
Over a surface without planes it stays refused at creation (unmeasured). docs/FAST-PATHS.md's
known gaps, the RuntimeGap doc and REFUSALS.md (regenerated) say so. No Degradation kind, no public
item.
Metal's answer (probes/ycbcr_wide_code_rows.m, m3-max-27270, macOS 27.0.1, two processes a shape),
for the 66x64 8-bit shape and a 64x64 10-bit one:
- read() and the nearest sample of every texel equal the same texture over the same bytes laid
apart, bit for bit (0 of 4224 and 0 of 4096 texels differ);
- getBytes reads the luma rows at the pitch;
- replaceRegion writes them in order, the later row standing.
Verified (planerows, 5fdbf147d5 on
|
||
|
|
977c9da12f |
RUNTIME 2246: setTriangleFillMode: 2 (MTLTriangleFillModePoints, Apple-private) draws a triangle's vertices as points
Apple's GL renderer sends setTriangleFillMode:2 for glPolygonMode(GL_POINT) under its Intel and
Apple-silicon caps tables. The value is not in the public headers. Our TriangleFillMode had only
Fill and Lines, so the consumer's raw-value conversion failed and its host died. Measured on
Metal: an M3 Max and an Intel UHD 630 draw only a triangle's 3 vertex pixels (a Radeon Pro 5300M
fills it); our own probe on the M3 (m3-max-26811) draws 1-px points whether point_size is 4, 1 or
unwritten, culls them with CullMode Front, and draws them with Back.
Now TriangleFillMode::Points (2) exists. The generator (scripts/regen-metal-enums) takes a
PRIVATE line for it, with its evidence, and a PRIVATE_DOCS doc comment (metal_enum! accepts
variant attributes); generated.rs stays generated and `--check` passes. The runtime draws it as
VK_POLYGON_MODE_POINT. It needs fillModeNonSolid (refused otherwise:
Feature::TriangleFillPoints) and, on a portability-subset device, pointPolygons
(VkFeature::PointPolygons; MoltenVK withholds it, so it refuses Points). New degradation
TrianglePointSize ("triangle-point-size"): Vulkan sizes the points by the PointSize the vertex
function writes, where Metal draws 1 px. An ICB command still refuses set_triangle_fill_mode, as
before. New lane module runtime_lane::triangle_points.
Verified (fillpoints, 6b9927c402 on
|
||
|
|
b741f93b9e |
SEMANTICS 2098 / RUNTIME 2244: a rate-mapped pass's region-by-region draws copy each region in the vertex function, scissored, so Equal depth matches the fanned-out route
Under RateMapRegionPolicy::FanOut a draw was drawn two ways: fanned out (a geometry stage's copy of each triangle per region, window position a*x + b*w through one viewport), or region by region (each region through its own Vulkan viewport). The two rounded a vertex's window position differently, so a pass testing depth Equal against depth the other route stored failed along whole surfaces: the consumer's black blotches on lit surfaces in Apple's Modern Rendering sample on the RTX 3090. The depth-Equal repro left 44,666 of 89,483 pixels red on lavapipe whenever the prepass and the Equal pass took different routes; 0 under Exact or on one route. Now on a fanning device the region-by-region draws take a region-copy variant (RegionFanOut::RegionCopies), with no geometry stage. Its vertex function computes region RegionFirst + DrawIndex of the table, stores its position through the region's line and four clip distances by the one emitter the fan-out stage's copies use (pipeline::link::fan_out::region_copy: NoContraction arithmetic, Position and ClipDistance Invariant), and its draw index as ViewportIndex. Each recording sets as many viewports as one multi-draw takes, every one the fan-out's over the render area, with each region's scissor at its index (bind::fan_out::scissors), so off-region triangles are scissored, not clipped. The settle keys the pipeline with the same viewport count (fan_out::copy_viewports). The variant replaces the regions variant, so no pipeline is added per state. A device without multiViewport, shaderOutputViewportIndex and shaderDrawParameters keeps the per-region-viewport route (FAST-PATHS known gap). Exact is untouched. New: bind::fan_out::scissors, WorkCounts::rate_map_region_copy_draws and rate_map_region_copy_recordings, PushField::RegionFirst; cache codec variants (artifact format). Verified (blotch, steelbrain/blotch 1fd68a45c0..16d5c2404f): - lavapipe at 16d5c2404f: rate_mapped_depth_equal + rate_mapped_fan_out 4/4, 0 red in all 10 depth-Equal lines (mixed pairs included), 0 pipelines made at the host step; clippy CPUICD, GPU and plain 0; rustdoc 0. Translator suite at 8ad673ffba 3562/3563, the one failure golden_hashes (re-blessed on development). - 780M and XTX at 8ad673ffba (differs from the tip by the settle fix only): 0 red in all 10 lines. E->E GPU cold/warm: 780M 4.99/4.97 ms against Exact 1.68/1.65; XTX 1.14 ms/650 us against 569/265 us. Creation (shader cache off): 780M 1.32 ms/state (Exact 0.92), XTX 1.30 (Exact 0.68). - Owed: the same numbers at development's tip without this change (the GS fan-out), the clip-distance probe, and the 780M/XTX runs at 16d5c2404f. SEMANTICS_VERSION 2097 -> 2098, ARTIFACT_FORMAT_VERSION 518 -> 519, RUNTIME_VERSION 2243 -> 2244. |
||
|
|
20d04dbd5e |
RUNTIME 2242: an ICB's setters write through one batch, mostly without the lock; set_render_command and set_compute_command
An indirect command buffer's CPU setters, after RUNTIME 2238's dense table and one hold: every setter write now goes through one per-command batch (one storage pointer, one count of the writes made without the lock), written into in place rather than handing back a ~180-byte plan (which made a first form slower than before). The written flag (SEMANTICS 2097) is set in the one write helper, write_field, by the rule unchanged: every setter write sets it, a write of the reset record clears it. A draw, a dispatch, a set barrier and a cleared barrier the edits' summary already holds, like a buffer slot before, take no lock where the GPU may not have written the buffer, checked against an atomic mirror of the summary set under the lock; a pipeline state the command already names is set again with no lock and no CallHold (an atomic (id, serial, kind) mirror per command; a recovery's carry forgets it, so the next set redoes every check). New public calls IndirectCommandBuffer::set_render_command / set_compute_command (an index and a list of sets, no handle and no Arc clone; index and kind refusals at place 0) and the handle's set_each; borrowed RenderAt/ComputeAt views. docs/API.md says which setter writes take no lock; the carry docs say a write made without the lock does not wait for a carry (as buffer slots' did; a set racing a device recovery may write through the old mapping). Verified (icbset, f403b6e922 on |
||
|
|
4383b55aed |
SEMANTICS 2096: ANV: a stage heavier than the largest measured to compile in host-sized memory is refused, or keeps the widest pin
ANV's compiler takes memory that grows faster than the stage it compiles, inside the process that
creates the pipeline, well below the 2^20-object bound the serialized stage already keeps under.
Measured on the Iris Xe of RPL-P (Mesa 26.2.6), compute modules created cold through
vkCreateComputePipelines, the resident set sampled every second (job m3-max-26147): entry weights
73,814, 75,886 and 99,109 were created in 45 s, 47 s and 132 s at peaks of 1.76, 2.24 and
3.65 GiB; a module of entry weight 532,213 passed 16 GiB at 358 s without finishing. Job
m3-max-26086: a module of entry weight 796,525, its heap raw-texture arms dead, passed 20 GiB in
under two minutes. Both under the old bound (786,432) would have been handed to the driver: one
pipeline creation that can take a host's memory.
- DriverWorkaround::CompilerMemoryGrowsWithStageSize, keyed on ANV whatever its GPU and release
(device::derive), documented with those points.
- stage_bound: StageBounds holds both bounds (SERIALIZED_STAGE_WEIGHT 786,432;
COMPILED_STAGE_WEIGHT 99,109, the largest measured to compile, no margin below it as nothing
above it is measured to compile). emit keeps a module under every bound its profile's defects
set, with the same widest-pin retry; a refusal (StageSize, DriverDefect) names the serialized
stage's defect past 786,432 and the compiler's memory below it. The bound rises when a larger
compile is measured within host-sized memory.
- The test hooks (compile_bitcode_bounded, compile_stage_bounded) take StageBounds.
Docs: stage_bound's module docs and FAST-PATHS' known-gaps entry state both bounds with the
measured points only (weights, never names), and restate the serialized bound's figures in
entry_weight's units: the faulting stage 1,603,989 (0.683 objects per unit, was 1,565,083 and
0.70 by a count 2.4% lower), the other 21 stages' ratios as counted by that count, which ran 1.9
to 2.7% below entry_weight on the five modules both counted; the shader-object figure likewise
1,603,989. Feature::StageSize's docs and its reach line cover the memory bound; REFUSALS.md
regenerated. api_signatures.tsv blessed with the new variant (the bless also moves
scheduler_slice_rescues to the script's own order).
For a consumer on ANV: a module of entry weight past 99,109 and up to 786,432 that was handed to
the driver is now refused (Unsupported, Feature::StageSize,
Needs::DriverDefect(CompilerMemoryGrowsWithStageSize)) unless its pinned plan fits. Other drivers
are unchanged.
Tests:
- engine_simd_lockstep::a_kernel_past_the_stage_bound_keeps_the_widest_pin_or_is_refused covers
both defects: for each, under a bound the emulated module passes the kernel is planned again
pinned (exact at 32 lanes), under one its pinned module passes too it is refused naming that
defect, and past both the serialized stage's defect is named; RADV emits under every bound.
- engine_simd_lockstep::a_kernel_past_the_stage_bound_gets_one_answer_through_either_path on the
serialized bound through StageBounds.
- device::tests::profile::large_module_defects_are_keyed_on_anv includes the new workaround.
Verified, on msi, read from inside each job:
- m3-max-26184 (this change on
|
||
|
|
a2ac4433ca |
SEMANTICS 2094: One input, one answer: a compile past the stage bound is charged once, by either path
A kernel planned again past the stage bound (stage_bound::emit, WidestPin::Kept) ran plan_one a second time: decode, specialization, lockstep order, lowering inputs and memory analysis, all charged to the meter again. And Device::compile_function_from_entries charged nothing for an entry a creation had already specialized (StageEntries handed out an uncharged copy). So one input got two answers under one budget: compiled alone, a large kernel past the bound on the Iris Xe was refused LimitExceeded(WorkUnits); compiled from a creation's entries, Unsupported(StageSize). - stage_bound::emit analyzes the entry once (analyze_one, the part of plan_one before selection, kept as Analyzed) and only selects, emits and rolls again. What the dropped plan and module hold of the ledger is released, measured from before the selection. - Meter::measured runs work and states what it charged (Spent: work units, its ledger peak above where it began, the bytes it still holds); Meter::spend charges that to another meter, work units first, then the peak, keeping the held bytes. - StageEntries keeps each entry's, decode's and plain answer's Spent and charges it to every ask that finds them, so a found entry costs what making it cost. The object spares time, never budget: compile_function_from_entries charges what compile_function charges, unit for unit. For a consumer: Spent, Meter::measured and Meter::spend are new public items of metal2vulkan-air's budget module (api_signatures.tsv blessed); nothing was removed. A creation that shares a StageEntries is now charged its found entries' work units against each compile's budget, as a compile that shares nothing always was. Tests: - budget: spent_work_charges_another_meter_as_the_work_did (work, ledger and peak equal to the work itself; refused alike one unit under either cap). - engine_simd_lockstep: a_kernel_past_the_stage_bound_gets_one_answer_through_either_path. The pressured kernel under a bound its emulated module passes (planned again, Direct) and under one its pinned module passes too (StageSize): alone, from entries that make the entry and from entries that find it, the same answer and the same work units W; at exactly W both paths answer the bound's way, at W - 1 both are refused WorkUnits; the negative control, a meter also charged one more plan of the entry (what the plan made again used to charge), is refused WorkUnits at W. - library_entries_decode_once, stage_input_siblings: the work units through a shared decode or entry now equal the unshared compile's (they asserted fewer before); the decode counts still show the sharing. Also in this commit: crates/metal2vulkan-air/tests/api_surface.txt gains the four rate-map items |
||
|
|
c53ea4164e |
SEMANTICS 2091: on ANV, a stage past the serialized-object bound keeps the widest pin or is refused
Mesa's common pipeline runtime (vk_pipeline.c) serializes every compute stage into a precompiled shader and reads it back before compiling it. nir_serialize names each object by a 20-bit index (MAX_OBJECT_IDS 1<<20) checked only by an assert, so a release build wraps past 2^20 objects and the driver faults inside vkCreateComputePipelines. On Intel Iris this took a consumer's host process down on a large compute kernel (its translated stage: idx_table_len 1,096,128). DriverWorkaround::SerializedStageWrapsLargeModules (keyed on ANV) bounds the stage's weight at SERIALIZED_STAGE_WEIGHT = 786,432 instructions, every call counted as its callee's body. A module over the bound is never handed to the driver: a kernel that emulated its simdgroups only in place of the widest mode's pin compiles pinned to 32 lanes again (lower::simd::WidestPin::Kept), and any other is refused as Unsupported::driver_defect(Feature::StageSize, ..), where Metal compiles it. The gap is recorded in docs/FAST-PATHS.md's known gaps; REFUSALS regenerated, reach.tsv marks StageSize rare, api_signatures carries the two new variants. The bound's basis: 22 stages measured at 0.14-0.99 serialized objects per weight unit; 786,432 is 3/4 of 2^20 at the worst measured ratio of about 1. Verified: the crash reproduced live on ms01's Iris (job 25723) with both the consumer kernel and a synthetic 360k-FMA chain; test a_kernel_past_the_stage_bound_keeps_the_widest_pin_or_is_refused; checks job 25736 (msi): clippy on the workspace, rustdoc, the full metal2vulkan suite, green. Not yet verified: the consumer's Iris run at the next pin. SEMANTICS_VERSION 2090 -> 2091: translator output and refusals change on ANV. |
||
|
|
b31ce16c85 |
The uint2 rasterization-rate map overloads compile to Metal's decoder
A fragment shader's map_screen_to_physical_coordinates and
map_physical_to_screen_coordinates with uint2 arguments were refused
(Unsupported{RasterizationRateMap, NotImplemented} at the lowering of
Fragment::MapCoordinates). Canon now expands them beside the float2
overloads, reusing the float2 decoder:
- screen to physical: the float2 decoder at the pixel's centre (c + 1/2),
converted to uint saturating (a NaN to 0), the conversion the float2
index path already uses;
- physical to screen: the bits of the float (0 - offset) * reciprocal of
the entry of granule c >> 5 on the axis's to-screen table; the
coordinate's value within the granule is not read.
Both are Metal's answers as our probe rate_map_integer_overloads measured
them on an Apple M3 Max under macOS 27.0.1: 20,114 coordinates over four
maps (one of two layers), at each map's layers and two past them, every
one equal to these formulas. The arithmetic is float and the device's own
(owner rule 1); where a device's denormals differ from Metal's flushed
ones the existing PrecisionNote::DeviceDenormals reading applies, as for
the float2 decoder. The boundary byte of a table entry is compared on its
low seven bits, as Metal's decoder does (the probe's maps hit an entry
with the high bit set).
The decoder's Rust models gain shader_screen_to_physical_integer and
shader_physical_to_screen_integer. Lowering's MapCoordinates arm is now an
invariant error: canon compiles every overload before lowering.
Tests:
- bind::rate_map::apple_tests::metals_integer_answers: 1,561 of the M3's
answers (apple_integer_vectors.txt: Metal's answers to our probe on our
maps, no Apple binary) against the Rust models, each map's bytes
checked by sha-256;
- tests::engine_rate_map::integer: the fixture rate_map_integer (kernel
and fragment) compiles on every tested profile, robust and not, passes
L3 with no RasterizationRateMap note; the interpreter's answers equal
the decoder's arithmetic at every layer and two past, and Metal's on a
map's own layers; and the translated kernel's answers equal the M3's
recorded ones at all 587 recorded points of the maps' own layers, bit
for bit;
- the fixture's four expectation rows go from the refusal to ok on all
profiles; integer_rasterization_rate_maps_are_refused is removed.
docs/REFUSALS.md regenerated: the fragment select site leaves the
RasterizationRateMap sites.
|
||
|
|
76f5b1b53f |
SEMANTICS_VERSION 2088: a loop's AIR unroll request reaches its OpLoopMerge
The two commits before this one carry a loop's llvm.loop unroll metadata from the AIR latch to its SPIR-V OpLoopMerge: unroll.full and unroll.enable ask Unroll (clang's enable: fully where the trip count is known, partly otherwise, SPIR-V's "to the degree possible"), unroll.count N asks PartialCount N (SPIRV_VERSION 1.5 has it, held by a const assertion), unroll.disable asks DontUnroll, and a count of 0 or no request asks nothing. Metal's compiler honours the same requests; until now every OpLoopMerge carried None. It changes no answer, so it is not a speed-for-accuracy choice. Translator output changes (SEMANTICS). docs/REFUSALS.md follows a renamed site (structure_loops). Verified by imgleak's runs: engine_loop_unrolling, one test per form (5/5 at ba2b803e57, 25358); negative control with e7ea80f1bb's lower/view.rs, so no request is read: the four form tests fail (unroll_count [[0]] where [[256, 4]] is expected), the no-request test passes (25376). Before the rebase, clippy -p metal2vulkan all targets and features clean and 585/586 touched tests, the one failure golden_hashes on kernel_threadgroup_float_bbox_atomics (unroll(disable)) and engine/hnq_half_layer_composite (#pragma unroll), re-blessed at the next pin (25343). Cold creation (driver caches off) and GPU time of the SR conv kernel 199ed, read in place on um790, base |
||
|
|
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.
|
||
|
|
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. |
||
|
|
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.
|
||
|
|
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. |
||
|
|
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. |
||
|
|
98db2b33e6 |
A recovery carries compute and tile pipeline states
What: a compute state (and so a tile state's kernel) keeps a chain of programs, one per generation (pipeline/carry.rs): the state object, its ID, uniqueIdentifier, label and sampler numbers stay, and its Deref reaches the program of the generation whose command buffer's work the thread does, else the last. Each state is kept by its generation's carry registry; the recovery, after the textures, makes its program again on the new generation: the base variant's objects from the pipeline its creation compiled (Variant::of with the compiled pipeline, or the live variant the new memo already holds), no translation, and the VkPipeline its creation predicted queued on the making pool with no wait (make_predicted with waited false). The lost generation's memo of compiled functions and pipelines is carried first where both generations' profile fingerprints match (PipelineMemo::carry_from), so later variants and creations translate nothing again. A state whose making there fails stays the lost generation's, is counted by the notice and refused where bound with the new RuntimeGap::RemadeAfterRecoveryFailed (compute encoder, argument encoder and indirect command buffer checks, through ComputePipelineState::bound_device). The notice says how many states were made again and how many failed. An indirect command buffer's depth/stencil check now matches the state by its line too, as the encoders' do since the regression fix. Docs: carry.rs, MadeBeforeRecovery, the new gap, the DeviceRecovered cost (degradation.rs and docs/API.md, equal), the runtime README; REFUSALS.md, reach.tsv and the API signature table regenerated. Why: compute and tile 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 and 200 live states. |
||
|
|
1fefc3d956 |
SEMANTICS_VERSION 2065, ARTIFACT_FORMAT_VERSION 510, RUNTIME_VERSION 2167: a one-row ragged dispatch of a simdgroup-only kernel runs flat in the call's threadgroups
The four commits before this one. A ragged dispatch of a kernel that uses simdgroups was split into a body and an edge variant, a second full compile of the same kernel (Blender's Cycles kernels on RADV: concurrent ~11 GiB compiles). The kernel partition now has three classes, decided from structure alone (barrier execution scope, fence and atomic scope, simd_/quad_ functions, is_uniform, the simdgroup size, the lane builtins): Oblivious, Simdgroups and Observed; air.all/any of a bool vector now counts as the thread's own (a BoolReduce false positive). New: KernelFacts::partition_simdgroups, LoweringInputs and VariantKey::call_threadgroups, RuntimeFact::CallThreadgroups (Variant mechanism, fact id 97). Under flat_grid + call_threadgroups invocations count by subgroup lane order in the flattened tiers, so workgroup w is Metal's threadgroup w with its simdgroups; the lane builtins are derived; lanes past the grid return before the body. The compile refuses the bit without flat_grid, with replay_bindings, or for a module that would hold a workgroup barrier. The runtime's flat_direct tries the plain flat variant first and, for a one-row grid in one-row threadgroups, then the call variant (its own refusal flag; None, unremembered, when the threadgroup size asks for emulated simdgroups). Indirect and replay paths still need an oblivious kernel; a kernel with a threadgroup barrier keeps the split. Verified (on the branch): m3-max-23184 (gem10, at 4c5d46f8d9) workspace clippy all features, clippy m2v_gpu on runtime and validation, rustdoc, 136/137 translator tests (the one a test's use of flat_rmw, fixed after), lavapipe 7/7 (FLAT-SIMDGROUPS VkPipelines [1, 2, 2, 2]; lavapipe's 8-lane subgroups emulate the sum, so it splits); m3-max-23193 (8a46347092) 10/10, a_flat_grid_of_the_call_s_threadgroups_admits_a_kernel_of_simdgroups over every committed profile; 780M RADV (m3-max-23200) 4/4, VkPipelines [1, 2, 2, 1]: the simdgroup barrier + simd_sum kernel runs flat in one VkPipeline, every thread's word matching Metal's partition, the partial last simdgroup's sum included; m3-max-23202 workspace and m2v_gpu runtime clippy clean. No guest kernel was dispatched through this path. |
||
|
|
b564fb7a91 |
A recovery carries textures, their views and those over carried buffers
What: a device's recovery now carries the program's textures made by a call it can make again (texture/carry.rs). That covers a texture of `Device::new_texture`, a texture over a buffer the recovery carried (`Buffer::new_texture` and its kin), and a view of either. - The call is made again on the new generation as the runtime's own texture, which takes no ID. That texture holds the program texture's parts there: `TextureShared::next`, with a `carried` flag. - `Texture::s` picks the parts the work at hand reaches. Inside a command buffer's work it answers that generation's parts (`NoticesFor::generation`); elsewhere, those of the generation the texture was carried to last. The buffer carry picks its parts the same way. - Every read of a per-generation field goes through it: `storage()` (the hub), facts, faces, usage shadows, storage forms, render shadows, snapshots, memoryless backings and planes in place. - The texture object keeps its `ObjectId`, resource ID, label, parent and handles, and its purgeable state is copied across. Its ID's slot in the new generation's texture table and heap sets names its parts there (`heap_sets::place`), and leaving the slot walks every generation's parts. - Each program texture is kept by its generation's carry registry as it is made (`Carry::texture`). The call that made it sets how to make it again (`Remake`) and carries it itself where the take came first (`Device::kept_texture`, `Carry::late_texture`). - The carry runs inside a `NoticesFor::of_generation` scope for the new generation, so the buffer it remakes a texture over and a view's parent answer their parts there. - Left refused, and counted by kind in the notice: a heap's texture or one over a heap's buffer, a texture over the caller's `VkImage`, a sparse or shareable texture, a texture over a buffer left, and their views. - The notice adds ", and N textures whose contents were lost too (they read as new ones), M textures over the buffers carried and V texture views". Known gap, documented in API.md, the README and device/carry.rs: a carried texture's images on the lost generation, and so the lost `VkDevice`, stay until the texture goes. Letting them go at the lost generation's rest needs a hold of the parts by each call outside command buffers' work, as `Buffer::held_parts` does for buffers. Why: render targets and display textures made before a recovery were refused (`MadeBeforeRecovery`) where they met the new `VkDevice`, while Metal's go on. Tests: device_recovery_carry's main test now leaves a `Shared` heap instead of a texture as the object that keeps the lost `VkDevice`. Its held-parts test now expects the texture made by a call that completed on the lost generation to be carried by its maker. Docs updated: `MadeBeforeRecovery`, the device-recovered cost (degradation.rs and docs/API.md, kept equal), the runtime README and the heap docs. docs/REFUSALS.md regenerated (`view` became `view_as`). Verified: the lane run of the test commit before and this one after is reported with its sha. |
||
|
|
7926fa6e66 |
SEMANTICS_VERSION 2062: the predicated walk's size estimate charges what the walk emits
The commit before this one. The emulated-simdgroup variant (a dispatch whose threadgroup leaves a partial simdgroup) took its size forecast from divergent::extra_words: 512 words per AIR block and 12 per operand use, about 15M words on a large kernel, so two kernels of a guest's path tracer (4.0M and 4.5M words emitted) were refused LimitExceeded(SpirvWords) before emission, where Metal makes them. The estimate now charges each construct the walk emits beyond the plain walk, from the structured tree (guards per segment, syncs and their guarded stores, reloads of demoted uses, flag and vote words per walked loop, arm sequencing per walked branch); each constant names the emitter code it bounds. Translation results change: modules that were refused now translate. Verified (on the branch): nextest -p metal2vulkan --all-features (m3-max-22642) 3500/3501, the one failure golden_hashes from SEMANTICS_VERSION 2061's pending re-bless (blessed since at pin 59; this commit changes no emitted word); the shared test helpers assert estimate >= emitted on every Emulated-tier or walked module the engine suites build; a_large_predicated_body_compiles_under_a_cap_it_fits (old forecast ~20x emitted). Lint m3-max-22643. Release translation, amd-780m-radv profile (m3-max-22644): the two kernels' emulated variants at 1.64 s / 256.6 MiB and 1.99 s / 287.4 MiB, within 20 s / 500 MiB. Census over the 3,781 simd/quad/barrier rows on vk12-floor (m3-max-22649) pending. |
||
|
|
62568021fd |
Region viewports: name the three features in the refusal; bless the API table and REFUSALS.md
The refusal under LoweringInputs::region_viewports lists its features literally, so the refusal surface names them (devices without shaderOutputViewportIndex, shaderDrawParameters or multiViewport). api_signatures.tsv takes the new fields and variants; REFUSALS.md the new sites. Verified: signatures.py --bless and refusal_surface.py ran locally (source-only). |
||
|
|
15866645a8 |
A generic pointer of no one space is refused as GenericPointer, naming how and where
canon::generic refused every generic pointer it could not give one address space as AddressSpace(8), with no location, so a caller could not tell a pointer of two spaces from one loaded from memory. Feature::GenericPointer (both crates) now names how the pointer gets a space only the run knows (TwoSpaces, Memory, Aggregate, Call, Integer) and the refusal locates the instruction where it does. AddressSpace's doc now lists 8 as defined; the planner treats a generic pointer that survived canonicalization as an invariant breach. FAST-PATHS records the gap, REFUSALS and the API signature table are regenerated, ARCHITECTURE names the pass. runtime_lane::generic_pointers compares generic_spaces and generic_null with the M3 Max's answers (run next on lavapipe). |
||
|
|
fbb1f7c6bb | docs/REFUSALS.md: regenerated after the heap texture beside a selected sampler compiles (one ArgumentBufferTextures site fewer) | ||
|
|
131887a2e1 |
Merged draw replays take indexed draws, and each fragment its own command's slot table
A render execution whose records a kernel writes ran on the host step wherever the buffer's command types held DRAW_INDEXED, and the merged form refused any fragment function that reads buffers, since one merged draw had one fragment slot table. Now both stay on the GPU. - Indexed draws (DrawReplay::indexed, from draw_replay_indexed over the decided writes). The preprocess holds an indexed record where the policy and the INDEXED flag allow it: its arguments are [index count, instances, base vertex, base instance], and it writes a 16-byte index entry per command (the device address of the first index, its offset rounded down to the index size; the whole indices to the buffer's end; the size, 2, 4 or 0 for a draw without indices). An index buffer of address 0 or a bad index type is a RECORD fault; an address no resident range holds draws nothing and counts a resident miss; a position past the buffer reads index 0, as the encoder's indexed draw reads it. The merged vertex reads its vertex as the index at its position plus the base vertex, a u16 from its aligned word. An indexed replay that does not merge is refused (ReplayRefusal::IndexedApart): the runtime host-steps it (HostStepCause::Rule). - Per-command fragment tables. The merged vertex writes its command to a flat uint varying (IoRole::MergedCommand, VaryingKey::merged_command). A merged fragment that reads buffers takes it as an input and MergedDrawAddress as its push field, and reads its RootTableAddress as the header's tables plus command times the stride plus the fragment table's offset (bind::merged_fragment_table). The header grows two words (H_INDICES_AT 48, H_FRAGMENT_TABLE 52; MERGED_HEADER_BYTES 56). A fragment that reads [[primitive_id]] keeps the merged variant refused, so its executions host-step, as before. - Runtime (render/executions/gpu.rs): indexed executions take the merged form alone, no per-command fallback; one whose type does not merge host-steps with the rule named. The host-replayed-indirect-commands notice text names indexed draws that do not merge. - The fixture icb_merged_indexed (ours: kernels writing indexed draws of 16-bit and 32-bit indices with per-command vertex marks and fragment tints), its AIR companions compiled by scripts/regen-air-fixtures on the M3, and its AIR input golden. Verified: - metal2vulkan's draw replay, merge, stage IO, varyings, link and API tests, among them the new interpreter test of seven indexed records (u16 and u32 offsets, base vertex -1 over two instances, indices past the buffer, a residency miss, a bad type, a null buffer): 354/354 (potluck m3-max-20787, msi). - Clippy in every configuration (all features, each feature alone, the runtime, --cfg m2v_gpu) (m3-max-20812, msi); Rustdoc of both crates and 379/379 tests of the replay, AIR goldens, stage IO, API tables, refusals and catalogue (m3-max-20824, msi). - The new lane test merged_indexed_draws_draw_what_the_host_step_draws (16-bit and 32-bit: six commands merged on the GPU with no record read, each fragment its own command's tint, the same pixels as the host step's) with the other merged and range-read lanes: lavapipe 12/12 (m3-max-20811, msi), RADV Radeon 780M 10/10 (m3-max-20814, um790). - The golden icb_merged_indexed.txt was blessed under the pinned llvm-as (m3-max-20792); no other golden moved. The semantics and artifact format bumps, the golden re-bless and the census stay with the landing. |
||
|
|
6d9bc9f096 |
RuntimeGap::IndirectRenderCommands names the rule that refused it (IndirectRule)
One gap stood for a dozen rules: an execution of the other encoder kind's commands, a range a draw of the encoder may write, a command's memoryless texture slot, a color in another format, the shader-side depth test, a shadowed texture the call did not gather, residency past the call meeting a shadow's truth, an emulated mesh command's ordering, a memoryless attachment read past the pass, and on an Apple10 device the render states the commands set themselves. A consumer's log said "IndirectRenderCommands" for all of them, so a report could not say which one a program met (a public GPU-culling sample's host step on an RX 550 did not). The variant now carries IndirectRule (public, non-exhaustive, Copy), one value per site, and the error's text prints it: "not implemented in the runtime yet: IndirectRenderCommands(UngatheredShadow)". A family row of indirect render commands names FamilyRow, the summary of the others. No behavior changes: every site refuses where it did, typed as before. Tests that expected the gap now expect its rule: the other encoder kind (render_executions, indirect_command_buffers), a range a draw wrote (render_executions), residency past the call (buffer_texture_renders), mesh ordering (mesh_commands) and the Apple10 states (state_ids, command_render_states, families). docs/REFUSALS.md and api_signatures.tsv regenerated. A consumer that names RuntimeGap::IndirectRenderCommands names a rule now, or matches IndirectRenderCommands(_). |
||
|
|
236340a171 |
A heap texture's observed residency is resident; a sparse member under it is refused at plan
A function that observes the residency of a read, sample or gather of a texture it reaches
through an argument buffer (sparse_sample, then sparse_color::resident()) was refused at
pipeline creation: lower::texture::residency answered Lowering(Texture), NotImplemented, for a
heap element's status word. A forward renderer that streams its material textures compiles
exactly that, so its pipeline never made and it drew nothing.
Metal reports a texture that is not sparse resident everywhere, which is the word 0 the module
already builds for a heap element's access (emit::with_word). So residency() now answers a heap
element's observed residency with no residency form, the word 0, and the stage states the new
RuntimeFact::HeapResidency { stage } (PlanTimeCheck). The planner (bind::heap::HeapPlanner::new)
refuses a sparse texture (TextureFacts::sparse) that such a stage's handle tables reach,
Unsupported { ArgumentBufferTextures, NotImplemented }: answering one would need the member's
tile map or sparse image per handle-table entry, which is not built. docs/FAST-PATHS.md records
it as a known gap; a slot's sparse texture stays answered (RuntimeFact::SparseTexture).
SEMANTICS_VERSION 2041 (refusals become modules); ARTIFACT_FORMAT_VERSION 504 (a RuntimeFact
variant). docs/REFUSALS.md and the API surface table regenerated.
Test: tests::engine_heap_residency over the new tail_argument_sparse_samples fixture: both
fragments compile behind its vertex function on every committed profile with what they use
(moltenvk-m3, lavapipe and amd-780m-radv named), state the fact and pass L3; their plan holds
a texture that is not sparse and refuses a sparse one. Before the change the base CLI refused
argument_sparse_fragment with Lowering(Texture), NotImplemented, at block 0 instruction 2, the
sparse sample (job m3-max-20327, gem10).
|
||
|
|
0d144ec0de |
Pooled memory: no bound on a texture's bytes; ShadowCause::LinearCost is gone
The owner, through reims: zero copy, in place where possible, shadow copies a fallback and never a first option. A tracked texture over a Private buffer of the runtime's pooled memory whose rows the device's own linear image lays out otherwise was a shadow past 48 KiB to its pitch (TextureShadowReason::LinearCost), a speed choice measured on an Iris Xe alone that shadowed 1001 of an RTX 2080 guest boot's 1366 textures. It now takes its DRM_FORMAT_MOD_LINEAR image at Metal's pitch at any size, wherever the device makes one and its check of the pooled memory passed, as a texture over a Shared buffer already did; it is a shadow only where the device makes no such image (its format, usage, pitch or limits), its policy is HostPageTexturePolicy::Shadow, or the check failed or is pending (a pending one still moves in place once it passes). Removed with the bound: in_place::POOLED_PITCHED_BYTES, ShadowCause::LinearCost and the public TextureShadowReason::LinearCost (a breaking change of metal2vulkan-runtime's surface: api_signatures.tsv loses its variant), texture_spans.rs (the runs of bytes textures were made over, which only the bound read) and the moves it fed (MoveAfter::Aliases, LoneShadow, the buffer's note and wait), Texels::only_commands_write (the bound's alone), the bench behind the bound (runtime_lane::pooled_draw_costs, its crossover additions included) and aliased_surfaces' cost bench. aliased_surfaces' first check now asserts every texture over one surface's bytes takes the image at Metal's pitch, the first included, and a read copies nothing; its one-after-another check, about the first texture's shadow, is gone. storage_over_buffer is one function again (REFUSALS.md regenerated for the name). API.md, HOWTO.md, FAST-PATHS.md (the in-place row) say "at any size". RUNTIME_VERSION is not bumped here: the landing bumps it and re-pins the runtime sources. |
||
|
|
9ec681c85c | REFUSALS: regenerated for the pooled bound's moved refusal sites | ||
|
|
cb8f4a0988 |
A compute state's required size past its kernel's own maximum is refused
A compute creation whose descriptor requires a threadgroup size of more threads than its kernel's own [[max_total_threads_per_threadgroup(n)]] is now refused, RequiredThreadsProblem::OverKernelMax, as Metal's first compile of the kernel refuses it. The runtime made such a state and answered the kernel's maximum. Measured on the M3 Max under macOS 27.0.1, compute_pipeline_limits.m with a salt (m3-max-17580), each case a first compile and the same again in its salt: required-128-attribute-64 is refused both times, code 3, "requested required threads per threadgroup 128,1,1 but 'count64' expects max threads per threadgroup 64"; required-32-attribute-64 is made answering 32. After a compile of the kernel with no size, Metal makes the 128 state and answers 64. The runtime answers as the first compile, every time, as it already does for the other history-dependent answers (docs/API.md, accepted differences). How: the check runs after the compile (additions::check_kernel_maximum, called from of_kernel), not in the translator's compile: the required size is no part of the compiled pipeline's key, so a pipeline of the kernel found in the memo, an archive or the disk cache would skip a check there. It reads the kernel's maximum through a new public accessor, CompiledFunction::max_total_threads_attribute. A tile function's own maximum beside a required size is unmeasured and not checked. Also: the probe header records the salted answers and the descriptor-validation stops of m3-max-17549; docs/API.md's accepted difference and the additions.rs module docs name the refusal; docs/REFUSALS.md regenerated; api_signatures.tsv blessed (two additions: the variant and the accessor). Test: runtime_lane::compute_threadgroups:: a_required_size_past_the_kernels_own_maximum_is_refused_every_time refuses 128x1x1 and 16x8x1 beside 64 before and after a state of the kernel is made (the second finds the pipeline compiled), makes 32x1x1 (32) and 8x8x1 (64), and makes 128x1x1 for the kernel without a maximum. Verified: nothing yet; the lavapipe run of the test and the lint follow. |
||
|
|
78835b832a |
Docs: REFUSALS and the API table for the function's logic operation; the probe's findings
docs/REFUSALS.md regenerated: PrivateRenderState's reach names the three features of the operation's refusal on a device that orders fetch in neither form. The signature table gains LoweringInputs::logic_operation and RuntimeInput::LogicOperation. The probe's header states what it measured on the M3 Max. |
||
|
|
9b5f3d224a | Bless the API signatures (HostBacking::DeviceCopy, the managed counts); regenerate REFUSALS.md | ||
|
|
395e5c3305 |
Runtime: a tiled texture's take makes every format's later levels, and its first level is the bytes to the CPU
A tiled texture of more than one level (Buffer::new_tiled_texture) is a copy of the buffer's bytes taken at use. Two leftovers from that change against what two x86 Macs answer: 1. Its take made the later levels only by the device's blit chain. A format generate_mipmaps makes by the compute filter (an extended-range one, an 8-bit sRGB one held as its UNORM twin, one without blits or linear filtering) or by the integer picks kept zeros past its first level, where Metal makes every level. Now the making keeps generate_mipmaps' own plan of the format (shadow::LaterLevels: the blit chain, the compute filter or the picks, announced as that call announces them; Kept for a format it leaves or refuses, or a scratch past the device's limits). The encoder makes a take's filter or picks run as it plans the copy (EncoderCore::later_runs, beside sample_moves: the scratch, the kernels and sets), held by the command buffer, and the copy in records it after its copy into the first level, behind a barrier, as it records the blit chain: transfers of the image and dispatches over the scratch alone, outside any render pass, before the first command that uses the texture. A filter take counts in WorkCounts::mipmaps_filtered. mipmap_filter.rs and mipmap_pick.rs split their recording into FilterRun and PickRun, which generate_mipmaps and the take share; what generate_mipmaps records is unchanged. A run that cannot be made (no room for the scratch) fails the command buffer, as a heap texture's sample moves do. 2. Its CPU calls reached every level in the image. On the Macs, getBytes and replaceRegion of level 0 address the buffer's bytes, and a replaceRegion there makes the next use take the copy again, as didModifyData does. Now level 0 reads and writes the bytes (Texture::level_in_image), a write there marks the copy stale, and while the bytes are detached level 0 is refused (NotImplemented(DetachedTexelAccess)) as a one-level texture's is. Levels 1 and up stay in the image (the GPU reads a replace_region there until the next take), where the Macs' GPU never sees such a write: an accepted difference in docs/API.md and the rustdoc. Blits are unchanged. Tests (tests/tiled_texture_device.rs), each failing before its fix: RGBA8Uint's later levels are plain Metal's picks exactly after a blit first use, and after a pass into level 1 as the first use (level 1 cleared over the picks, the rest picked); BGR10XR's later levels are within the compute filter's bound of the level above, the take counted once in mipmaps_filtered; level 0's get_bytes reads the bytes before the first use, after a GPU write into level 0 (which the GPU reads) and after a CPU write of them (which no level sees); a level-0 replace_region writes the bytes (the rows' padding kept) and the next use takes the copy again, every level made from it. The detached test now holds level 0 refused while detached and reads the new pages' bytes after a rebind. Docs: new_tiled_texture's, replace_region's, get_bytes's and did_modify_data's rustdoc, DetachedTexelAccess, WorkCounts::mipmaps_filtered, shadow.rs's Copies taken at use, the filter and pick modules, docs/API.md (the tiled texture and an accepted difference), docs/RUNTIME-PORTING.md, docs/FAST-PATHS.md's known gap narrowed to formats generate_mipmaps leaves or refuses, and docs/REFUSALS.md regenerated (the MipmapGeneration sites moved). RUNTIME_VERSION and the runtime-sources pin are left to the landing. Checked here: cargo fmt. Clippy in three configurations, rustdoc and the device tests run as cluster jobs on this commit. |
||
|
|
22a96f62d4 |
Docs: framebuffer fetch between draws, its note, REFUSALS and the API signatures
docs/API.md's framebuffer-fetch paragraph says what a device with neither ordered form does, and the degrade-notice catalogue gains unordered-fetch-within-draw. docs/FAST-PATHS.md's device-gap table gains its row. docs/REFUSALS.md regenerated (FramebufferFetch loses the unsupported_features and family-row sites). api_signatures.tsv blessed: the PrecisionNote and Degradation variants and WorkCounts::fetch_draw_barriers. Verified: refusal_surface.py (0 without reach mark or basis), signatures.py --bless (3 added). |
||
|
|
12a8a907bc |
No-copy buffers on a device without VK_EXT_external_memory_host take the dma-buf route
On a driver that lists no VK_EXT_external_memory_host but imports dma-bufs (Honeykrisp on Asahi, as the consumer reported: a macOS guest's newBufferWithDescriptor answered nil, "HostMemory needs ExtExternalMemoryHost", 704 times in one boot), every no-copy buffer, heap and guest RAM was refused: Importer::new refused before the dma-buf route was looked at, and the importer held the host-pointer extension's functions unconditionally. The importer now holds the pointer import as an option (host_memory.rs's PointerImport: its functions, page and minImportedHostPointerAlignment, and memory_types). Importer::new refuses only where the device imports neither pointers nor dma-bufs (the pointer's refusal, naming the extension, as before); a device with dma-bufs alone gets an importer whose pointer refusal stands for every pointer (Importer::pointer_import). Every pointer-import site takes a PointerImport, so a device without one never makes a host-allocation object: buffer_descriptor.rs (import_by_pointer, import_pointer, import_pointer_again, import_backing), host_shared_pointers.rs (false there), fresh_pages.rs and the page-buffer blocks (none there), the submission checks (unchecked there), host_ram.rs's chunk import by pointer. The unit an import's pages round out to is Importer::unit: the host page and the import alignment where the device imports pointers, the host page alone where it imports dma-bufs. Every device that imports pointers keeps the same calls. On a device that imports no pointer: - a no-copy buffer, heap or rebind over memory with a source is bound in imports of its dma-bufs; memory with none is refused, naming VK_EXT_external_memory_host (host_window), as it was; - memory of Metal's private option bit 24 that the runtime copies anyway (no read-only view on Linux) is no longer refused for lack of an import route, on any device; - a guest RAM with a source is taken and listed (its chunks its dma-bufs, imported on demand), the pointer never tried; one with no source is refused, naming the extension, as it was; - supportsResourceDetachBacking answers whether the device makes no-copy buffers (it has an importer), not whether it lists the extension. Docs: the runtime README, HOWTO section 6 and the RAM copies' refusal, RUNTIME-PORTING, the module docs of host_memory.rs, dma_buf.rs and host_ram.rs, HostBacking::ImportedAsDmaBuf, and the refusal lists of the no-copy buffer, heap, RAM and RAM copy calls. docs/REFUSALS.md regenerated (the HostMemory refusal's sites: PointerImport's and no_pointer_refusal). Verified: the next commit's device tests (RADV on the Radeon 780M, lavapipe), which fail at the base with the refusal; job ids in the branch's report. |
||
|
|
24025b3866 |
Argument-buffer textures read through a sampler: border texels from the handle-table entry
What: a Metal 4.1 read(sampler, ...) of a texture held in an argument buffer now hands back Metal's border texel of the resident texture, its pixel format's through its swizzle, for every sampler: a constexpr one of any border colour, a runtime [[sampler(n)]] and an argument buffer's sampler (the colour from the sampler's word). - The binder writes each texture's border texels (metal::sampler::border_texels of its format and swizzle, the layout of a slot's BorderTexels specialization) in its handle-table entry's flags, bits 3 to 14 (memory::handles::FLAG_BORDER_TEXELS); handle_entry_flags carries them, so a consumer's own table of every ID gets them too. - A module with such a read searches the table in a new indexed form (Lookup::Indexed): the handle is the element with the found entry's index in its top 16 bits (HANDLE_ENTRY). The read loads the entry's border texels by it (handles::border_texels); every use that reads another of the entry's flags (texel class, red-blue order, out-of-bounds alpha) loads them from the entry into the flagged handle's layout (handles::flagged_handle), through one typed value (texture::emit::HeapFlags) so no reader sees the entry index in those bits. - through::finish selects the border texel for slots and heap elements alike; a heap member read by its raw texels (an extended-range form) takes its border and its zero past the level or layer from its own image's addressing inside the raw arm, not the float array's neutral's. - The old heap path, which selected the out-of-bounds texel (transparent black, unswizzled) and refused every other border colour and runtime sampler NotImplemented(ArgumentBufferTextures), is gone, with ReadSampler::transparent and the forced alpha flag of such reads. Why: the M3 runs all three (conformance cases read-through-heap-border, read-through-heap-sampler, and read-through-rgba8-swizzled's rt_heap_zero, where (G, R, 1, 0) reads (0, 0, 1, 0) past the edge and we read (0, 0, 0, 0)). A 32-bit heap handle had no room for 12 border bits beside the element, class, red-blue and alpha fields; the entry does (bits 3 to 14 were unused). SEMANTICS_VERSION 2017 (translation output changes). ARTIFACT_FORMAT_VERSION unchanged: no encoded type changed. RUNTIME (for the orchestrator's bump): the runtime's handle tables (heap_sets.rs, through bind::handle_entry_flags) now carry the border-texel bits. Ledger: the three rows of these gaps go; llvmpipe's rt_heap_zero row of the swizzled case keeps only llvmpipe's 8-bit unorm conversion. FAST-PATHS known gap removed; REFUSALS.md, CONFORMANCE-COVERAGE.md regenerated (METAL-COVERAGE.md unchanged). Verified: not yet built (next: Linux build, clippy and the touched tests). (cherry picked from commit bc000fa475e572131248b908541dbe29f1f5996c) |
||
|
|
8ed67dfa17 |
Regenerate REFUSALS.md and CONFORMANCE-COVERAGE.md for the padded fetch and its cases
python3 scripts/refusal-surface/refusal_surface.py (the padded fetch's FramebufferFetch site gone) and python3 -I scripts/conformance-coverage/coverage.py (the padded-fetch cases); METAL-COVERAGE.md is current (coverage.py --check). (cherry picked from commit 0c8ad6c47d76ff7436835fa5377ff17700151c21) (cherry picked from commit f448ad63ca5d317526e923c2363c3f05a44a0068) (cherry picked from commit 4037ac989aa2942bdde46538b8b9856a9bfd3d78) |
||
|
|
17cf2bf636 |
Bfloat blend refusal: tests, docs, refusal surface; SEMANTICS 2012
The translator test of bfloat targets expects Metal's pipeline error for a blended bfloat attachment, in the translation and at link with no fragment function, with the unblended unwritten pipeline as its negative control. A new engine test (engine_padded_blends) checks the same on every committed profile through compile_render_pipeline, under a full mask and a mask of no channel, and without a fragment function, with the unblended pipeline made as its control. Docs: stage_io::extended_color, input_blend, ExtendedRangeColor::blended (any blend now, not factors one and zero), DescriptorError::ColorAttachment (a blended bfloat attachment). docs/REFUSALS.md regenerated. SEMANTICS_VERSION 2012 (a refusal's class changed, padded blends translate). A clippy literal in extended_range's tests grouped. (cherry picked from commit 8ef001f0a0eeed4c1b51a31df2ae093285dfbe9c) |
||
|
|
5b24698068 |
SEMANTICS 2012, ARTIFACT_FORMAT 499, REFUSALS.md and the API signatures for reads through a sampler
What: SEMANTICS_VERSION 2011 -> 2012: reads through a sampler other than constexpr clamp_to_edge now translate (they were refused), a clamp-to-edge read past its level or layer reads zero in every lane, and a texture buffer's index outside a constexpr clamp_to_edge reads its first texel. ARTIFACT_FORMAT_VERSION 498 -> 499: SpecKey::BorderTexels and RuntimeFact::BorderTexels are encoded variants. docs/REFUSALS.md regenerated (refusal_surface.py): select_through's two sites. api_signatures.tsv blessed: SpecKey::BorderTexels, RuntimeFact::BorderTexels and SamplerWord::READ_STATE are added; nothing is removed or changed. Why: the translation's output changed under unchanged keys, and the encoding gained two variants. Verified: refusal_surface.py wrote the doc with 0 unmarked variants; signatures.py --bless reported only those three additions; METAL-COVERAGE.md --check is current. (cherry picked from commit 26c37d74d6d2a4bb395ff64a539eb7fc617619bd) |
||
|
|
513d792675 |
REFUSALS: MadeBeforeRecovery's pooled buffers are those in memory the device allocated
A recovery now carries a pooled Shared or Managed buffer that lies in a block of the runtime's own pages, so the reach note names the pooled buffers left refused as those in memory the device allocated. docs/REFUSALS.md regenerated (scripts/refusal-surface/refusal_surface.py); no refusal changed. (cherry picked from commit b11909130479dbdb8c42c8d6c3950ffa1d9414ed) |
||
|
|
462934908e |
RUNTIME_VERSION 1974, the runtime-sources pin and the API table for recovery 1b
exitcrash 1571c220d7..4b9b7ed8b0 (11 commits): a device recovery carries the program's no-copy buffers (made again on the new VkDevice over the same pages, same contents pointer, Metal address and bytes: pointer imports, buffers in another's import, gate-refused copies, runs of guest RAM) and its uses of guest RAM (HostRamUse, carried before the buffers). The caller's deallocator still runs once, after every generation's import of the pages is freed; a detached no-copy buffer stays on the lost generation (MadeBeforeRecovery). Runtime behaviour changed: RUNTIME_VERSION 1973 -> 1974, pin recomputed, docs/REFUSALS.md regenerated (two refusal sites renamed: ram_use_on, buffer_over_host_parts). API table: HostRamUse is now a tuple struct over a private Arc<RamUseCell> and its own impl Drop is gone (the cell's use drops it). Nothing breaks for a consumer: dropping a HostRamUse still lets go of the RAM at once (the recovery's carry holds only a Weak, upgraded for the carry itself), and nothing could call the Drop impl directly. Verified by exitcrash: lavapipe 11782 at a5f0c3be37 runtime suite 1999/2000 (the one red a test bug, fixed), clippy plain/cpuicd/gpucfg, rustdoc, refusal check; lavapipe 11814 recovery/no-copy/event 30/30 with negative controls A (deallocator not handed on) and B (lost parts never let go) failing as designed; rebased tip 4b9b7ed8b0: Iris 11823 51/51 and 780M (RADV PHOENIX) 11824 51/51 over recovery, no-copy, host_ram_device, event_timeline, detach_lost, the new tests run on both. Not run at the tip: lavapipe whole suite, clippy, the 5080 (development's checks). |
||
|
|
742e320bee |
REFUSALS.md for what a recovery carries; the carry test's notification sends plainly
REFUSALS.md is regenerated by scripts/refusal-surface/refusal_surface.py in job m3-max-11457, and its --check passes. MadeBeforeRecovery's row now says what the recovery does not carry and lists the exportable-event carry site. The carry test's notification no longer drops a Copy Result, which the CPU-ICD clippy rejected. (cherry picked from commit ef076009e82d2bde7f29ff9a81608ec40e94cb6a) |
||
|
|
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. |
||
|
|
80b581bee2 |
Dma-buf export: README, HOWTO, the API table and REFUSALS.md
The runtime README lists exported_as, export_memory_dma_buf and external_write_done beside the opaque-fd export; HOWTO gains a section on memory another API writes (a decoder's DRM_PRIME_2 frame), the old section 7 now 8. The API signatures table is re-blessed for MemoryExport, BufferDescriptor::exported_as, with_exported_as, the two Buffer calls, Problem::ExportedNoCopy and RuntimeGap::DmaBufExport, and REFUSALS.md is regenerated with the new gap's reach (none: a runtime extension). (cherry picked from commit 3988f9ec5921e8962708ce7735937c44836361a1) |
||
|
|
97ba27de2d |
Regenerate docs/REFUSALS.md for the version-1 symbol table's refusal site
The module-level symbol table reader (bitcode/module.rs, Names::read) refuses a summary-index entry (VST_COMBINED_ENTRY) as Unsupported(BitcodeRecord), a new construction site of that variant. Generated with python3 scripts/refusal-surface/refusal_surface.py. (cherry picked from commit b500dc8717a4dd60f84eb775fa0a70446db44cd6) |
||
|
|
27eea49ec5 |
HostRam: a copy over a listed chunk not imported takes lists of its own pages, of an opt-in source
HostRam::with_dma_buf_of_runs(source, most_runs) gives a RAM a DmaBufRunsSource: one dma-buf of a list of runs of its pages, their pages one after another (udmabuf's UDMABUF_CREATE_LIST on Linux, at most list_limit runs a list). Only copies by runs call it, and only where the plan is Plan::listed (each held import costs every submission and the RAM's chunks are the device's dma-bufs of its source: RADV) and the device's barriers order blits through two imports of the same pages. There RamOnDevice::for_copy, for a chunk not imported, takes RamOnDevice::run_lists: the copy's ranges of the chunk by address, widened to whole host pages and joined where those share or touch a page (copy::page_runs), split into lists of at most most_runs runs and one dma-buf's bytes (copy::run_lists), each imported as one dma-buf of the source (Device::ram_runs_as_dma_buf, Imported::Runs), held by the command buffer until it completed and freed then. The chunk is neither imported nor asked for, so copies pin their own pages while they run and never a chunk's untouched pages, which udmabuf allocates for good. Without the source, a source that fails or answers a dma-buf of another length, the margin of the allocation limit, a run that is the whole chunk or passes one dma-buf, the copy takes the chunk as before. A list's VkBuffer holds each run from where the runs before it end: RamChunk keeps the runs and their offsets (RamChunk::offset_of, RamChunk::bytes), and the copy maps each piece through it; regions take their host bytes from the pieces, not the import's span. alone_ranges takes one chunk's sorted ranges (chunk_ranges with no cap) and joins them as before, so every other plan (ANV, NVIDIA, lavapipe, MoltenVK, RADV without the source) copies as before. Counted: WorkCounts::host_ram_run_list_imports (new), live in run_imports_live. Tests: copy.rs units for page_runs and run_lists; host_ram_dma_buf's tile tests over a RAM with a udmabuf list source (lists of at most 1,024 runs, no chunk, nothing asked, no untouched page resident) and, without it, the chunk; elsewhere the list source never asked. The bench takes the list source and prints first and repeated copies, sorted runs and lists per copy, over surface-shaped and scattered tiles. api_signatures blessed (three added: DmaBufRunsSource, with_dma_buf_of_runs, the counter; nothing removed); docs/REFUSALS.md regenerated (a DmaBuf site). Verified: cargo fmt and the signature and refusal scripts only; the 780M runs follow. (cherry picked from commit f2e5c143dd314835fd58cd6f8430c5c7c620e52a) |
||
|
|
6ba9ac779f |
BufferDescriptor::aligned_byte: lay a buffer's byte on a multiple of 256 bytes of its memory
A consumer that lands decoded frames in a buffer of the runtime's own memory makes plane textures at CoreVideo's offsets: the first plane 32 bytes into the surface, the second 32 bytes past a multiple of 256 after the first's rows. A linear image aliasing the buffer binds at the buffer's memory offset plus the texture's, which must meet the device's linear-image alignment (256 on RADV, 128 on NVIDIA, 64 on lavapipe), and the runtime starts each buffer on a multiple of 256, so those planes are shadows there (the 780M probe, um870 m3-max-8351: Shared and Private buffers, in place at 0 and 256, shadows at 32, 64 and 128). BufferDescriptor::aligned_byte (with_aligned_byte), a runtime extension for the runtime's own memory, names the byte to lay on a multiple of 256 (LINEAR_IMAGE_ALIGNMENT). placed_new_buffer then makes the VkBuffer that byte's shortfall longer, binds it where its placement starts, and starts the buffer's bytes that many bytes into both (BufferParts offset and base, the mechanism host imports use), so the byte lands on the multiple and textures there alias the memory. Such a buffer is never parked nor taken from the parked, and lies in no fresh pages. Its length and gpuAddress (the runtime's address space's) are unchanged; a Shared one's contents start the byte's remainder short of a multiple of 256, which the field's docs name against Metal's page-aligned contents. Refused with NoCopy contents (Problem::AlignedByteNoCopy). tests::aligned_byte: over Shared and Private buffers laying byte 0x20, the 8-bit and 10-bit frames' planes (R8/RG8 at rows 3840, R16/RG16 at rows 7680; the second plane at 0x20 + 0x7E9000 or 0xFD2000), sampled, written and rendered into, alias wherever the same texture at offset 0 of a plain buffer does, and are shadows at 0x20 of a plain buffer wherever the device's linear alignment is past 32; a blit of each sampled plane reads the bytes at its offset; length, gpuAddress and contents as above; the refusal over NoCopy. Docs: the field, HOWTO, API.md's shadowed-texture entry, the runtime README; api_signatures blessed and REFUSALS.md regenerated. New public items: BufferDescriptor::aligned_byte, BufferDescriptor::with_aligned_byte, Problem::AlignedByteNoCopy. Verified: cargo fmt; the 780M, lavapipe and Iris runs follow. (cherry picked from commit bef28766eee658ef30dfcc5d0492a1493171b34d) |
||
|
|
fe5f08a4b1 |
Host RAM copies take runs at word starts and any end, copied by regions
reims's laid-out device cache downloads hand copy_to_host_ram each texel row's bytes (encode_out): runs that start on the device's linear texture alignment, always a 4-byte word, and end at any byte, short of the row's padding, which the guest's CPU owns. merged() refused every such run (Problem::HostRam) and the consumer fell back to a view of the surface's pages: on ANV one mapping per 4 KiB page, 278 of 294 device caches in boot 8267. Now a run starts on a 4-byte word and ends at any byte past it. Copies whose runs are all whole 4 KiB pages keep the pages copy's one dispatch per chunk, unchanged. Any other copy records each run's bytes in a chunk as a region of vkCmdCopyBuffer between the import that holds them (whole pages, imported as before) and the buffer: byte offsets and sizes, so no other byte of the runs' pages is read or written. The regions of one import are one command, at most 1024 each (MOST_REGIONS). A scatter whose runs name a byte twice takes a round of commands per overlap, so no byte is written by two regions of one command (VUID-vkCmdCopyBuffer-pRegions-12482), the later run's bytes left; a buffer over host pages the runs overlap is refused (VUID-vkCmdCopyBuffer-pRegions-00117). Counted in the new WorkCounts::host_ram_copy_regions. Tests: copy.rs's unit tests (word starts, any ends, rows that touch merge, whole_pages, rounds); host_ram_copy_device's runs_inside_pages_move_their_bytes_alone_and_leave_the_rest_of_their_pages (2046-byte rows at a 2048 pitch from 16 bytes into a page, a run ending 2 bytes before a page's end, one across the first chunk's end, one of 3 bytes; pattern sentinels around them; gather into Shared and Private, scatter back; 10 regions, no dispatch; twice-named bytes; the overlapping buffer refused); the whole-page test now also asserts no regions; the refusal test's cases off a word. host_ram_copy_bench gains the laid-out download: a call a row, one call, and the view with a blit a row. Docs: copy.rs module and both calls' API docs, Problem::HostRam, docs/HOWTO.md, the runtime README; docs/REFUSALS.md regenerated and the API signatures re-blessed (the new WorkCounts field). (cherry picked from commit 1ba8aba84076208a1eccaf65dd4993058ed53431) |
||
|
|
b136c2531a |
Buffers: a declaration that the bytes between a texture's rows are unobserved
A consumer's cache buffer of the runtime's own memory (the 780M guest's 3662x2038 desktop
surface, more guest-page pieces than udmabuf takes) holds textures whose rows lie 14848 bytes
apart, 14648 bytes of texels each. linear_plan::holding shadows every such texture, since an image
at that pitch holds the bytes between rows and Vulkan lets its layout moves and a render pass's
load and store write them; the consumer's download copies each row's texels alone, so it never
reads those bytes, and the shadow's copies cost it about 1 G texels/s in a Finder drag.
BufferDescriptor::padding_unobserved (with_padding_unobserved) is the maker's declaration that
nothing reads the bytes between a texture's rows over the buffer (each row's bytes after its
texels to its pitch, the last row's included) nor between its slices. A runtime extension with
no Metal counterpart, only for the runtime's own memory: refused, Invalid
(PaddingUnobservedNoCopy), with NoCopy contents. The buffer keeps it (Buffer::padding_unobserved).
- The route (texture/route.rs) decides it for a buffer of the device's own memory:
Route::Device { holds } carries linear_plan::holding's answer, which with the declaration
holds rows and slices that lie apart (rows that share bytes stay refused). The making and the
placement query share it: the query answers NotHostPages where an image may hold the texels,
and the new TextureShadowReason::BytesBetweenRows where it may not (it answered NotHostPages
for both before).
- aliases takes the declaration: the image's subresources may then hold the padding
(linear_plan::within_padding: each subresource ends at its slice's last row's pitch or before,
slices at Metal's stride), never a byte past the last row's pitch, nor memory past the
buffer's. A byte of the image's memory past every subresource is reached by no operation on
it, the reading texels_alone already rests on, so no new check class is needed.
- WorkCounts::unobserved_padding_aliases counts the aliasing images that hold such bytes.
- A buffer the runtime lays in fresh pages (a long one where pointer imports cost submissions
nothing) keeps the in-place check's route: the declaration lets nothing more there (documented).
Docs: the field and builder, NotHostPages and BytesBetweenRows, HOWTO's paragraph on textures
over the runtime's own memory, API.md's shadow reasons and placement answers, the runtime
README; REFUSALS.md and api_signatures.tsv regenerated.
Tests: linear_plan's unit tests of the declared holding and aliasing (padding to the last row's
pitch held, past it or past the buffer refused, slices at Metal's stride alone, shared rows
refused); the route's placement test of both Route::Device answers; a device test
(tests/padding_unobserved.rs): a 101x48 BGRA8Unorm texture at 416, 448 and 512 bytes a row over
an undeclared buffer answers Shadow(BytesBetweenRows) and is a shadow, over a declared one answers
NotHostPages and is an aliasing image wherever the device lays one at the pitch (counted), at
least one pitch aliasing, its texels read back by a blit; and the declaration refused over the
caller's memory. The in-place lane's unobserved_padding_costs times a frame reading the
consumer's surface shape over a declared and an undeclared buffer.
Verified: pending (lavapipe and MoltenVK device tests, the 780M lane run next).
(cherry picked from commit 430523ce0e4dbd8433eb2b514f837d44ce1c5a9a)
|