b10839e2b2205111eb4dbfe8a0870afcae5dedbd
247
Commits
| Author | SHA1 | Message | Date | |
|---|---|---|---|---|
|
|
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)
|
||
|
|
7205978cfa |
Make a tiled texture of more than one level over a buffer's bytes
The x86 macOS guests' WindowServer asks for a texture over a buffer with several mipmap levels through Metal's private newTiledTextureWithDescriptor:offset: bytesPerRow: (BGRA8Unorm 54x54 of 6 levels, 64x60 of 7, ShaderRead, over a new 16384-byte Shared buffer at 256 bytes a row). The runtime had no such entry, so the guest's bundle answered nil and the x86 featureProfile could not be turned on. Buffer::new_tiled_texture makes what new_texture makes, and a 2D texture of more levels (BufferTextureCall::Tiled lets linear_plan take them; a texture buffer of more levels stays MipmapLevelCount, and its offset keeps the validated 16-byte rule as the linear SPI's does). No Vulkan image lays level 0 over the buffer's rows and the other levels elsewhere, so the shared route sends it to a shadow over any buffer (Route::Levels, answered TextureShadowReason::Mipmapped): one image of every level, made zero in a Shared or Managed texture, whose existing shadow copies move level 0's texels alone (their range was already level 0), so the bytes reach level 0 before the GPU reads it and level 0's writes reach the bytes by the end of the encoder. Announced as shadowed-texture, naming the levels; counted in shadowed_textures and shadows_zeroed. The paths that assumed every texture over a buffer has one level: - blits: such a texture is an image to a blit, as a heap shadow is (Texture::blit_texels; BlitCommandEncoder::see notes it), so every level is a blit source and destination, generate_mipmaps included; - get_bytes and replace_region reach level 0 in the bytes and the other levels in the image; - a reinterpreting view shadow and a usage shadow, whose truth would be the bytes alone, are refused for it. Buffer::tiled_texture_placement answers the placement for the new call. Docs: the item's rustdoc (Metal's selector and what differs), docs/API.md, the degrade catalogue, RUNTIME-PORTING, the runtime README; api_signatures blessed (three additions, no breakage), REFUSALS regenerated (MipmapLevelCount's text). Verified: api-signatures, refusal-surface and metal-coverage checks locally; the builds, lint and device runs are the potluck jobs that follow. (cherry picked from commit b040d815059b99a20426234239aa756b282b25b9) |
||
|
|
e038e8b5fa |
Tell a loss refusal apart by lost_refusal's own answer, and regenerate the refusal surface
Device::lost_under named RuntimeGap::MadeBeforeRecovery in a match, which the refusal surface script counts as a refusal site of the gap (a third one, lost_under, which refuses nothing). It now compares the answer with DeviceLost and with lost_refusal's own answer for the generation, which is MadeBeforeRecovery wherever the line recovers past it, as the check already requires: the same calls go to the serving generation. docs/REFUSALS.md regenerated: the gap keeps its two sites; five refusal sites read their _now function's name now that the public forwarders run through Device::at_serving (the refusals are unchanged). (cherry picked from commit 0eea4c413fdcddf56a39f7f12b89c8ca23f9ff01) |
||
|
|
1aeff532b6 |
Answer where a texture over a buffer's bytes lies before it is made
A consumer that routes each surface either to textures over its pages in place or to a cache of its own had to parse the doc-hidden in_place_check_report() strings and re-derive row ends to learn the runtime's verdict. Now it asks: - Buffer::texture_placement(descriptor, offset, bytes_per_row) and Buffer::texture_placement_with_iosurface_plane(descriptor, plane) answer a TexturePlacement: InPlace, Pending (a shadow made before its verdict, which moves in place where it passes), Shadow(TextureShadowReason) (policy, store width, check failed or unchecked with its InPlaceAccess and InPlaceRowEnds, Refused(InPlaceRefusal), texels past the length, a device copy), NotHostPages, or OtherShape. - The answer is the making's own decision: the route a texture over a buffer takes (past its length, no host pages, a device copy, bytes detached or copied, and the in-place decision against the verdicts) moves out of storage_over_buffer into Device::route_over_buffer (texture/route.rs), which the making and the query both call. make_texture_over takes a goal, make or ask, so the query runs every check the making runs before it makes anything and refuses the same arguments with the same errors; the IOSurface client direction refusal is one function both use. - Device::settle_in_place_checks is public, documented: it starts the check, says when the verdicts are known (a zero timeout waits for nothing), and how a recovery's new VkDevice reads them again or checks anew. Tests: tests/texture_placement.rs maps every route and shadow cause to its answer; tests/texture_placement_device.rs (m2v_gpu, m2v_cpu_icd) asks and makes over host pages: pending then known after the settle, the pending texture moving to the answer at the next quiet commit, a store width, a render target, an IOSurface plane, a long buffer, texels past the length, no host pages, a texture buffer, detached bytes, the Shadow policy and a forced failed check, comparing each answer with the counts the making moved, and the errors of refused arguments. docs/API.md and the runtime README describe the query; api_signatures re-blessed; docs/REFUSALS.md regenerated. (cherry picked from commit bef6ce09f56d8a7c1ad5ee7ef934a06a39b58c7a) |
||
|
|
5aa31f836c |
Rebind a draw's slots by rebinds the plan works out once for them
A rebound draw that moved buffer offsets spent about 470 instructions a draw (lavapipe, draws.10k shape) in rebind_slots, and 13% of the M3's time, writing one 4-byte push word: each draw walked the template's stages, fields, buffers and vertex buffers again to find what the changed slots decide, though that depends on the plan and the slots alone. BindingPlan::slot_rebinds now works that out once for a list of slots (a public, opaque SlotRebinds: each changed buffer slot's place among the descriptor ranges and its push fields, the loose fields, the vertex buffer places; None where rebind_draw_slots_into answers Ok(false) whatever the state), and rebind_draw_slots_with rebinds by it, looking at the state and the commands alone and writing each word as a fixed-size store. rebind_draw_slots_into is the two in turn, so there is one implementation; builds with debug assertions check that the rebinds given are the plan's own for their slots. The runtime keeps the rebinds with the settled draw (SettledHere), made at the first draw rebound that changes a list of slots and kept while the next draws change the same slots; a new settle drops them. The rebind test now also rebinds each case by rebinds made once per plan and slot list and holds them to the whole rebind's answer and commands. docs/API.md describes the two calls; the surface table, the signature table and docs/REFUSALS.md (a renamed site) follow. (cherry picked from commit 0397cbb254eb9402d5955d2ed2edab1ea0b2b6dd) |
||
|
|
b8f7b5a7f9 |
Answer minimumLinearTextureAlignmentForPixelFormat: from the device's images, per format
The query answered 16 for every format on every device, Metal's answer on an Apple GPU. On RADV a texture at 16 never goes in place over host pages: its linear images lay rows at multiples of 256 and align their memory to 256, and DRM explicit layouts take only multiples of 256. A guest that lays its buffers out by the answer then gets shadows where 256 would have given images in place. The answer is now the device's, worked out lazily at a format's first query. The runtime makes the images a 2D ShaderRead texture over host pages takes in place (in_place_unbound, the product's own maker: the driver's linear image made for host allocations at the texture's pitch, else the DRM_FORMAT_MOD_LINEAR one). It tries each power of two P from 16 to 4096, at widths of 1 to 1920 texels and 3 rows. The answer is the first P at which every width's image lies at roundup(width * texel, P) and its memory alignment divides P. Each image is released and never bound. - The first answer is kept for the device's life. - Each answer is recorded per driver, runtime and format in the shader cache's content directory. - A device that imports no host pages, a format no P brings in place, and a failed probe all answer Metal's 16. - New counts: WorkCounts::linear_alignments_probed and linear_alignments_recalled. Nothing new is refused. LINEAR_ALIGNMENT (16) stays the acceptance rule, and a texture under the answer is made as before: an image in place where the device takes its layout, else the announced shadow. The query moves from DeviceProperties to Device (Device::minimum_linear_texture_alignment_for_pixel_format), since it needs the device's images. DeviceProperties::minimum_linear_texture_alignment_for_pixel_format is removed. The private properties change as follows: - deviceLinearTextureAlignmentBytes and linearTextureAlignmentBytes are the largest per-format answer. - The iosurface pair stays 16. Supporting changes: - texture/in_place_image.rs's in_place_unbound becomes pub(super). - buffer_texture.rs's texel_bytes becomes pub(super). - The unit tests now hold Metal's rule (capabilities::linear_alignment_rule). Tests: - A record test. - runtime_lane::linear_alignments: - Every format's answer is printed. - A texture at the answer over host pages is in place wherever the check passed for reads. - A 64-byte-row texture is made, as a shadow, where the answer is larger. - A second device of the same driver reads the record and probes nothing. Regenerated: api_signatures, docs/REFUSALS.md, docs/METAL-COVERAGE.md (coverage.tsv mapping). Updated: RUNTIME-PORTING.md and the conformance device-queries docs. Verified: python generators only, so far. The builds, unit tests and the lanes on the M3, RADV, lavapipe and NVIDIA run next, and their results go with the tip. (cherry picked from commit d1510f5588e9e5c3ace5acb1622dcd6570408040) |
||
|
|
ec9706e6e3 |
Survive the loss of the VkDevice: the device is a line of generations
Metal's MTLDevice survives a GPU recovery; the runtime's device refused every call with DeviceLost from the first loss on, and the consumer ends its VM at the first refusal. Now a device the runtime made is a line of generations (device/line.rs), each a DeviceShared over its own VkDevice, and the first call that needs the device after a loss makes a new VkDevice of the same physical device, options, queue families and extensions. - Two kinds of handle. The program's device (and its clones) is a root handle: it holds the line, pins no generation, and every public Device call goes to the generation that serves (each public method forwards to its *_now body). Objects hold generation handles, so their Vulkan calls, drops included, reach their own VkDevice alone. A generation handle's check is one relaxed load of the line's generation (Device::generation_serves). - A draw pays nothing for it. A command buffer takes its generation once, as it is made (CommandBuffer::generation); its encoders' per-draw reaches (work counts, fresh-unwritten and alias records, sampler-slot changes, attachment read notices) read it there, not through a device handle's kind. A bind's device check is one compare of the cells the two handles hold, inlined, its refusal (Device::foreign) out of line. - The state machine (Live, Lost, Failed): the claiming call recovers, every other call waits (a notice past 10 s, waiting on); threads command buffers' completion depends on never wait. Recovery: the lost generation's command buffers in flight fail through its completion path, its queues drain under their locks, create_on makes the next VkDevice, the queues are retired. - Command-buffer answers, as a real loss is one more hang: the oldest incomplete batch's command buffer fails GpuHang (exact on one VkQueue; on two or more the queue whose oldest incomplete batch was submitted first, said so in the notice), counted against its queue so the second revokes it (AccessRevoked); the others GpuRecoveryVictim; one committed on the hang's queue before the recovery runs nothing and completes with no error; one made before and committed after fails GpuRecoveryVictim. One loss names one hang: a batch that went to the driver just before the loss and reached the lost device's completion after the loss took the pending batches fails with it, as a victim (its own wait need not fail: the test hook's VkDevice runs it), and no later failure of the lost device names a second hang. - Command queues survive: a queue is a root handle and a cell of its place on one generation (VkQueue, slots, pools, hangs), which a recovery retires and the next command buffer re-makes; label and GPU-error count go on. - Objects made before a recovery are refused where they meet the new VkDevice or need their lost one: RuntimeGap::MadeBeforeRecovery, at the 38 lost-device checks (Device::lost_refusal) and at every foreign-object check of one line (Device::foreign). DeviceLost stays for a device the consumer made. - Carried across generations: the address space, resource IDs and the passing holds a making waits out before it takes one, unique identifiers, counters and the announced notice kinds. - A device handle is an enum of the two kinds (24 bytes, was 16): the shadow merge's copy-back dispatch, which holds handles, is boxed (clippy's large_enum_variant). - Device::recover_for_test (public, documented) runs the whole path with no GPU fault; RuntimeGap::AdoptedDeviceRecovery on an adopted device. - Degradation::DeviceRecovered (device-recovered), announced at each recovery with the culprit and its time. WorkCounts::vk_devices_live, vk_devices_made, device_recoveries: two VkDevices while objects of the lost one live, one after. Docs: docs/API.md catalogue entry, the runtime README's device-loss section, FAST-PATHS known gap (a make whose own submission first meets the loss is refused DeviceLost), docs/REFUSALS.md regenerated (refusal_surface.py names a forwarded body's sites by its public method), api_signatures blessed. Tests: runtime_lane::device_recovery (hang and victims, command buffers on their way to the driver at a recovery, MadeBeforeRecovery and the VkDevice bound, revocation at the second hang, a command buffer made before fails as victim, all under the validation layer; a recovery that finds nothing of the queue scheduled names no hang, its command buffers victims), tests::device_recovery (the hold of the hang's queue between a loss and the recovery), detach_lost and the MoltenVK lost-device lanes updated to the recovery's answers. Verified: - lavapipe: runtime suite and touched validation tests 1850/1850, surface 19/19 (m3-max-5695, gem10, before the rebase onto |
||
|
|
02562d2a1e |
Make a shared event whose timeline semaphore another API imports, exported as an opaque fd
reims's ask 2: CUDA signals the event's semaphore on the GPU after a decode (cuSignalExternalSemaphoresAsync), and waits on it, where it now orders through the host. Device::new_exportable_shared_event() makes a shared event as new_shared_event does, its timeline semaphore made with VkExportSemaphoreCreateInfo naming VK_EXTERNAL_SEMAPHORE_HANDLE_TYPE_OPAQUE_FD_BIT; SharedEvent::export_semaphore_fd() answers a new OwnedFd each call (vkGetSemaphoreFdKHR), the caller's to close. An event not made exportable is refused Invalid(Problem::NotExportable). The counter stays the signal index the interop hooks name: the importer waits for vk_wait's counter and signals only one reserve_vk_signal reserved; that call's contract now names an importer's signal beside the device's queues. The device decides structurally, once: it enables VK_KHR_external_semaphore_fd wherever listed (adopted: where its consumer enabled it), and asks vkGetPhysicalDeviceExternalSemaphoreProperties for a timeline semaphore: OPAQUE_FD exportable and among the compatible types. Lacking either, the making is refused NotImplemented(RuntimeGap::ExportableSemaphore), with its REFUSALS row. Lifetime (the event outlives every import and every signal and wait an importer submitted) and device loss (state lost for the imports; a device made again exports new semaphores) are in the call and module docs, interop.rs and the README. api_signatures blessed; exit_guard's KEEPERS lists exported_semaphore.rs. Test (device, src/tests/exported_semaphore.rs): the semaphore imported into a second VkDevice; a command buffer's signal of 5 reaches vk_wait(5)'s counter there; the second device's host signal of the counter reserved for 9 raises the event to 9 and releases a command buffer that waited for 9 and then filled a buffer. Unverified at this commit. (cherry picked from commit 525580c12be28e6efa0a06ab09cde1f736ebace7) |
||
|
|
ff631aada9 |
Bump RUNTIME_VERSION to 1839: the in-place check's fresh-pages class lies in fresh pages wherever the device takes them
amdperf-22 (the six picked commits before this): Device::fresh_pages_check_buffer makes the check's fresh pages whatever the import tax, so RADV checks the class (Passed x3 on the 780M, m3-max-5640; Unchecked x3 at the parent, 5648), and a copied rebind under an image in place takes fresh pages where they passed (copied_device 29/29 780M, 33/33 lavapipe, 5667). CHECK_VERSION 4. Re-pinned; signatures and REFUSALS unchanged. Clippy plain and m2v_gpu (5701), fast_paths 21/21 (5687). |
||
|
|
ae0c6c7023 |
Make a buffer whose memory another API imports, exported as an opaque fd
reims's NVIDIA video lane writes each decoded picture into a runtime buffer with cuMemcpy2DAsync, so CUDA must import the buffer's memory (cuImportExternalMemory, cuExternalMemoryGetMappedBuffer); without it the pictures take a host-pages route of about 2.7 ms a 4K picture. Device::new_exportable_buffer(length, options) makes a buffer as new_buffer does, but in an allocation of its own made exportable as VK_EXTERNAL_MEMORY_HANDLE_TYPE_OPAQUE_FD_BIT: the VkBuffer names the handle type (VkExternalMemoryBufferCreateInfo) and has the device-address usage of its own; its memory (VkExportMemoryAllocateInfo) is a block of its own of the memory type its storage mode takes, the buffer's dedicated allocation where the device exports only so (DEDICATED_ONLY) or the driver prefers or requires it (VkMemoryDedicatedRequirements). It is never parked for reuse. Every other buffer keeps the pooled blocks and pays nothing. Buffer::export_memory_fd() answers ExportedMemory: a new OwnedFd each call (vkGetMemoryFdKHR), the caller's to close, the allocation's size, the buffer's offset and length in it, whether it is dedicated (CUDA's cudaExternalMemoryDedicated) and its memory type (a Vulkan import names it). A buffer not made exportable is refused Invalid(Problem::NotExportable). The device decides structurally, once, as it is made: it enables VK_KHR_external_memory_fd wherever listed (outside the vocabulary, as the dma-buf route's names, which enable it too; an adopted device where its consumer enabled it), and asks vkGetPhysicalDeviceExternalBufferProperties for a buffer of the runtime's usage: OPAQUE_FD exportable and among the compatible handle types. Lacking either, the making is refused NotImplemented(RuntimeGap::ExportableMemory), with its REFUSALS row. Docs: the module docs, the call docs, interop.rs and the runtime README state the lifetime rule (the buffer outlives every import) and the device-loss rule (contents lost for every import; a device made again exports new allocations, new descriptors). api_signatures blessed (new method x2, struct and fields, two variants). Test (device, src/tests/exported_memory.rs): a Shared buffer of a 4K NV12 picture's bytes, written by the host and a GPU fill, exported and imported into a second VkDevice of the same physical device (dedicated where exported so), read there; that device's writes read back by the runtime's blit. A refusal must come from a device that lists no extension or export. It prints the make cost of Shared and Private exportable buffers beside plain ones (medians of 8). Unverified at this commit. (cherry picked from commit fd6d775ef63e350ae1f550d6b2e7ef6af763d21f) |
||
|
|
be0a50f1a1 |
Test and document the blits at a pitch below the row for depth, stencil, buffer-backed and two-plane textures
Unit tests: Depth16Unorm and Stencil8 at a pitch below the row place each row at y x bytesPerRow both ways, Depth16Unorm on the aligned path too, a pitch off the unit or of 0 refused; a texture over a buffer's row copy at such a pitch reads overlapping buffer rows and writes them out in turn, each row but the last its first bytesPerRow bytes, a last row past the buffer refused. Device test (src/tests/short_row_kinds.rs): Depth16Unorm, Stencil8, both aspects of Depth32Float_Stencil8, an RGBA8Unorm texture over a buffer and RGB10A8_2P_XR10, 32 x 4, at half the row and half plus a texel: in, each row read whole from y x bytesPerRow; out into a buffer of 0xcc, the rows in turn, the later row's bytes standing, nothing past the span written. Docs: CopyProblem::BytesPerRow no longer names depth/stencil or buffer-backed textures at a pitch below the row (only off the unit or 0); two_planes.rs and API.md's accepted difference state the probe's answers, the multisampled copy out staying refused because every probe copy between a buffer and a multisampled texture, at the packed row too, ended its process in Metal's blit (SIGABRT). The probe's header records what it answered. REFUSALS.md regenerated (a new BufferRange site in plan_rows_copy). (cherry picked from commit e54ac4e63f4e9be0f1451ea2e7cccf8f74b66f34) |
||
|
|
8f652b31f1 |
Write a blit's rows out of a texture below their row in turn, the later row's bytes standing
A copy out of a texture at a bytesPerRow below the region's row was refused Invalid(Copy(BytesPerRow)), as Metal writes such overlapping rows in no one order. Metal runs the copy, though, so under rule 2 it may not fail: on the Apple M3 Max under macOS 27.0.1 (probes/short_row_blits.m, jobs m3-max-5158 and 5170) every such copy returned, rows lay y x bytesPerRow apart with nothing past their span written, and of 300 shapes of 12 formats at half the row about a fifth left the later rows' bytes standing. The later row's bytes are one of Metal's own answers. placed_rows no longer refuses the copy out at a pitch below a row; the rows are placed as a copy out at any other pitch off Metal's rules is, and plan_placed_copy's later_rows_win writes them in turn: the texture goes to a packed staging buffer in one region, and the staging rows go to the buffer in one vkCmdCopyBuffer whose destination regions are each row's bytes no later row writes, disjoint as VUID-vkCmdCopyBuffer- pRegions-12482 asks, one region a row. No buffer-image region states a row length below the width (VUID-VkBufferImageCopy-bufferRowLength-09101). Still refused: a multisampled texture's copy out at such a pitch (where Metal places its rows there is not measured), a texture over a buffer, and depth and stencil formats but Depth32Float, as before. docs/API.md's accepted differences say so; CopyProblem::BytesPerRow's doc and basis lose the case and REFUSALS.md is regenerated. Tests: blit_plan's layouts test takes the copies out at a pitch below the row (rows at y x bytesPerRow); a_copy_out_at_a_pitch_below_the_row_leaves _the_later_rows (blit_plan, no device) checks the unstaged bytes for a one-plane YCbCr texture at its described row, RGBA8 at half, RGBA32Float at three quarters and R8 at a pitch of 0, nothing past the span written and at most one region a row; described_row_copies' new device test copies 501, 504 and RGBA8Unorm out at a pitch below the row into a buffer of 0xcc and reads the later rows' bytes standing. (cherry picked from commit 73554a28ae7c83ccdcb01d5ebb95787b74928c21) |
||
|
|
c6e1d5a9fd |
Make a BC1 or BC4 texture over a surface's plane at an offset or pitch off 16
The runtime refused a BC texture over a plane of a surface with planes whose offset or bytesPerRow is off 16 bytes, as NotImplemented(SurfacePlaneShape). The M3 Max answers nil for every BC texture over a surface, so the x86 Macs are the reference (job m3-max-4779 on macbook-pro-2019: an AMD Radeon Pro 5300M and an Intel UHD 630 under macOS 26.7.1, surface_texture_envelope.m's bgraat8.bc1 at offset 8 and bgrarow264.bc1 at 264 bytes a row). Both GPUs' blits and samples take block row j at the plane's offset + j x bytesPerRow, with no rounding to 16. linear_plan::blocks_off_sixteen makes a BC texture of 8-byte blocks (BC1, BC4) at an offset and bytesPerRow that 8 divides, at least 16 bytes a row. Every BC plane now lies at the CPU's layout on the GPU too (plan_iosurface_plane's blocks flag): at multiples of 16 the two were already equal. The CPU calls take the plane's own offset, as the 5300M's getBytes does, while the UHD 630's getBytes and replaceRegion take a plane at offset 8 from byte 0. That difference is recorded in docs/API.md's accepted differences. BC4 was not measured off 16; it takes BC1's 8-byte block rows. BC textures of 16-byte blocks (BC2, BC3, BC5, BC6H, BC7) off 16, and 8-byte ones off 8 or under 16 bytes a row, stay refused. SurfacePlaneShape's doc names them, and so does its reach mark in REFUSALS.md. Tests: tests::linear_plan makes bgraat8.bc1, bgrarow264.bc1, BC4 at (8, 264) and BC1 at offset 40, with the GPU layout equal to the CPU's. It refuses BC3, BC5 and BC7 off 16, BC1 at offset 4 and at 260 bytes a row, and BC4 at 8 bytes a row. tests::surface_shapes (a device test) gains bgraat8.bc1, bgrarow264.bc1 and bgraat8.bc4 on every path. docs: linear_plan.rs's Block-compressed surfaces, the plane call, SurfacePlaneShape, BufferRefusal::PlaneShape, the FAST-PATHS known gaps and the API.md accepted differences. Regenerating REFUSALS.md changes only the reach mark. CONFORMANCE-COVERAGE.md and the API signatures are unchanged. (cherry picked from commit ff454bd8b269fff6abf590da85cd050862d539a9) |
||
|
|
6b6a7f522b |
Make mipmapped, 3D, multisample and sliced textures over a surface's plane
What. Buffer::new_texture_with_iosurface_plane over a plane of a surface
with planes makes three shapes it answered
NotImplemented(SurfacePlaneShape) for:
- a 2D texture of more than one level, a 3D texture and a 2D multisample
one, of a colour format (linear_plan::apart_from_plane: is_linear and
tail_held): a texture of the device's own memory
(Device::surface_texture_apart), zero when made in every storage mode,
a Private one's too (texture.rs's new Fresh::Zero start, which skips
Metal's fresh pattern and the uncounted held start), announced by the
new Degradation::SurfaceTexelsApart ("surface-texels-apart",
precision). A Memoryless one stays MemorylessSurfacePlane.
- a 2D array of more than one slice, of a colour format, over a plane
whose offset and bytesPerRow are multiples of 16
(linear_plan::slices_apart): its first slice over the plane as a 2D
texture's rows, its others in a tail of the texture's own. The planner
lays the slices one image apart and gives Placed::kept, the second
slice's first byte (or the buffer's length where that comes first);
Texels::kept cuts the tail there instead of at the buffer's length
(with_tail, past, staging), so the shadow's copies, blits and CPU
calls take slice 0 from the plane and the rest from the tail.
Announced by SurfaceTexelsTail, whose doc and cost now name both
cases.
Why. Metal makes these, and on the M3 Max under macOS 27.0.1
(probes/surface_texture_envelope.m, job m3-max-4776) it lays them out in
no one place: bgra1x2.mips2/mips7, 420v.p0.mips2, bgra1x2.3d.d2,
420v.p0.3d.d2 and bgra1x2.2dms4.private read level 0 or slice 0 by blit
and kernel from other bytes than its blits, replaceRegion and getBytes
put there; bgra1x2.2darray.a2 and .a2.64x64 keep slice 0 over the plane
on every path while slice 1 is read at the plane's offset by blits and
getBytes, one image on by kernels, and written at the plane's offset.
By the rule of
|
||
|
|
e2491fe2b7 |
Read a rasterizing state's void-vertex answer from its compile, not a question
2f44dda930's render creations asked whether the vertex function returns a value on every creation, so each plain creation counted one more linked-use question, one more specialized stage entry and one more shared one than its cost record (159 cases over bounds in the whole-set replay, all those counts). The question now runs only where the state turns on it before its compile: with rasterization disabled, and in OpenGL mode. A rasterizing state outside OpenGL mode takes the answer from the vertex entry its compile specializes anyway: the link refuses a rasterizing render pipeline whose vertex stage writes no position (new DescriptorError::RasterizedVoidVertex), and the runtime answers that refusal as Metal's error for a rasterizing void vertex function, as before. The linked-use answers cache treats the vertex answer as owed only where the creation asks it. Tests: a link test refuses a rasterizing void vertex function with and without a fragment, and makes it with rasterization disabled; a runtime test counts one plain render creation at two specialized stage entries and two linked-use questions. api_signatures and REFUSALS.md regenerated. Not yet verified: suites, clippy and the M3 cost records follow. (cherry picked from commit 7f8536158d856886ebedac8c0b6130ff32d22a31) |
||
|
|
2d3b673067 |
Take a blit into a texture at a pitch below the row on Metal's aligned path
A copy into a texture from offset 0, of one image, at a bytesPerRow that is a multiple of 16 below the row was refused Copy(BytesPerRow) as unmeasured. That is the row MTLPixelFormatGetInfoForDevice describes for the one-plane YCbCr formats (a byte a texel for YCBCR8_422_1P, two for YCBCR10_444_1P: half the row), which reims-vgpu's blits use (m3-max-4955 to 4985). Measured (probes/short_row_blits.m, M3 Max, macOS 27.0.1, m3-max-5158): every row of a 32 x 8 texture (64 x 8 for R8Unorm) read whole from its own row's offset at every pitch of the texel from 16 below the row, in eight formats of 1 to 16 bytes a texel, Private and Shared, 166 of 166. The aligned path now takes such a pitch, rows at y x pitch; a pitch of 0 and an offset of 16 or more stay refused. A copy out at such a pitch stays refused: Metal writes the overlapping rows in no one order (m3-max-5170: 900 copies out at half the row, 300 shapes of 12 formats in 3 processes, later-row bytes at some widths, even rows' at others, neither at most, 15 shapes differing between processes). The CPU copies already move nothing below the row, as Metal's. Tests: blit_plan's placed-rows test takes three such pitches; described_row_copies (device) copies in at the described row of both formats and reads each row from its offset, and holds the copy out refused. REFUSALS.md regenerated (the basis states the measurement). Not yet verified: the tests and clippy follow. (cherry picked from commit 3b174b367547b6f6187671d84f01797f9fe8f8ea) |
||
|
|
b06871f199 |
Refuse a cube or cube array over a surface's plane as Metal's own refusal
What. Buffer::new_texture_with_iosurface_plane over a plane of a surface with planes answers a Cube or CubeArray descriptor Invalid(BufferTextureProblem::TextureType), where it answered NotImplemented(SurfacePlaneShape). BufferTextureProblem::TextureType's doc and basis name the plane's case; SurfacePlaneShape's doc, the module's Beyond the plane's rows, FAST-PATHS.md's known gap and REFUSALS.md (regenerated) follow. Why. Plain Metal itself stops it on the M3 Max under macOS 27.0.1, the release the runtime imitates: with the API validation layer off it asserts "carriesComplexTexture || numFaces == 1" in -[IOGPUMetalTexture initWithDevice:descriptor:iosurface:plane:field:args:argsSize:] and ends the process, for a cube (bgra1x2.cube.16) and a cube array (bgra1x2.cubearray.16) alike (probes/surface_texture_envelope.m, run with --hazard so each shape runs in a child process, job m3-max-4776). What Metal refuses is a typed Invalid, never a runtime gap. Tests: linear_plan's a_surface_plane_s_other_shapes_follow_the_probe expects TextureType for a 64x64 cube and a 16x16 cube array over a planar surface; it fails without the check (both planned PlaneShape). Verified (same tree content on the previous base, replay-27 9a1a8abf1d): runtime unit 56/56 on msi-laptop (m3-max-4867), runtime lane 174/174 on lavapipe on homelab-gem10-1 (m3-max-4868). Re-checked on this base by the branch's check job. (cherry picked from commit 7ea41c39ea9f471fcb14776f9c2c551cb4827209) |
||
|
|
88ddbf4f90 |
Keep a colour plane's texels past its surface in a tail of the texture's own
What. A colour texture of a plane of an IOSurface with planes (Buffer::new_texture_with_iosurface_plane) whose GPU or CPU rows run past the buffer standing for the surface is made. Its texels inside the surface are the buffer's bytes, as every texture over a buffer's are; its texels past it lie in a tail of the texture's own (Texels::past, the form |
||
|
|
8de3a6023b |
Regenerate REFUSALS.md and the API signatures for RasterizedVoidVertex and open_gl_mode_enabled
(cherry picked from commit a479dc65fc8840b739a35c2e94b15dc4cdf81afa) |
||
|
|
93d2fc8b95 |
Link a kernel of OpenCL mode as Metal links it: hidden buffers and work-item reads
A compute pipeline Metal makes with openCLModeEnabled (Apple SPI) from a kernel of Apple's
OpenCL compiler (`__entry_<name>` of a library of sourceLanguage 1) binds three hidden buffers
ahead of the kernel's own and reads OpenCL C's work-item functions from the dispatch. Metal
refuses a plain pipeline of such a kernel ("Internal compiler error"). Measured on the M3 Max
(macOS 27.0.1, jobs m3-max-4483 and m3-max-4504): its reflection lists the kernel's arguments,
each buffer 3 past its index and __local memory at its own, then __global_offset_and_num_dims
(index 0, read-only uint), __printf_buffer (1, read-write char) and
__image_order_data_type_table (2, read-only uint), all used; get_global_id adds buffer 0's offset
to the grid position, get_global_offset and get_work_dim read buffer 0, and the other work-item
functions are the global built-ins of their names.
- ComputePipelineDescriptor::open_cl_mode_enabled, carried into LoweringInputs::open_cl_mode
(part of the key) and SpecRequest::open_cl_mode; the stage-entry cache keys on it.
- air.get_global_offset.i32 and air.get_work_dim.i32 decode as AirIntrinsic::WorkItem.
- canon::opencl, after SCCP and before the global built-ins: appends the three buffers, makes
get_global_id(c) the lane plus the offset word, the offset and dimension count loads from
buffer 0, a dimension past 2 OpenCL's 0 or 1, and a dimension the kernel reads from its data a
select over the three lanes; canon::opencl::entry moves the buffer-indexed arguments 3 on and
adds the buffers' bindings, which the reflection's unspecialized path uses too.
- Without the mode the kernel compiles as Metal AIR and lowering refuses a WorkItem read
(Unsupported, Lowering(Dispatch)).
- RuntimeFact::OpenClMode records the mode; a Compiled kernel of the other mode is
InvalidDescriptor(OpenClMode). The runtime compiles its variants under the descriptor's mode,
and its warm record carries the field (RECORD_FORMAT 5).
- SEMANTICS_VERSION 1991, ARTIFACT_FORMAT_VERSION 493 (a fact tag added).
Tests: canon::tests::opencl (indices, hidden buffers, the reads' rewrite), the translator's
engine_opencl_mode (the M3's reflection, slot writes, key, the mode check), and the runtime's
opencl_mode device tests (add, lsum, cmul and every work-item function against the M3's values).
(cherry picked from commit e2fdc7b4309c2c239cf1227d0a4c6c54552c1be0)
|
||
|
|
803648acd8 |
Make a texture buffer over a buffer whose texels run past its length, those texels in a tail
What. Buffer::new_texture of a texture buffer whose texels run past
the buffer's length (inside Metal's allocation rule) is made instead
of returning NotImplemented(TexelsPastBufferLength), as a 2D texture
or array already is. Its texels inside the length are the buffer's
bytes; those past it lie in a tail of its own, a zeroed Shared buffer
the runtime owns, laid out from the functions' first byte (the offset
rounded down to 16, as Metal's kernels read a texture buffer).
- GPU: the texture buffer takes the staged form (StagedTextureBuffer,
announced): its bindings view the tail as their staging buffer. The
copy in takes the bytes inside the length from the buffer (none
where the texels lie wholly past it), the copy back gives only those
bytes back, and a Shared buffer's merge copies the current part from
and to the buffer and the tail apart (staged_bytes, which now names
a texture buffer's staging buffer as well as an image's, and
record_out, which copies the staging buffer's every byte).
- CPU and blits: as for 2D, each row split at the length
(Texels::past, whose rebase is now the tail's base, tail_base).
Only an IOSurface plane past its surface stays
NotImplemented(TexelsPastBufferLength); the gap's doc, its reach in
scripts/refusal-surface/reach.tsv, the StagedTextureBuffer catalogue
entry and docs/API.md's accepted difference say so.
Why. Plain Metal makes these: reims-vgpu's tbprobe on both x86 oracle
Macs (jobs m3-max-4019, 4046, 4152) and the M3 Max probe
(probes/texture_buffer_past_length.m, job m3-max-4617), whose paths
read and write the bytes past the length as one memory, as a 2D
texture's. The tail gives the 20000-byte buffer's answer for every
shape, as the 2D tail does.
Tests.
- tests/buffer_tail_device.rs: a texture buffer of 64 R32Uint texels
from 3968 of a 4096-byte buffer (32 past) and from 4096 (all past):
as made, after a kernel's write across the length (ob1_texel_buffer)
and after replace_region past it, a kernel, get_bytes and a blit
read alike; the buffer's words inside the length are written, every
other word and 16 buffers around it keep theirs.
- linear_plan unit rows: texture buffers past the length made.
- runtime_lane::buffer_textures: the texture buffer at 3968 is made.
- Conformance: buffer-tails-texture-buffer, 1024 R32Uint texels from
16384 of a 20000-byte buffer (904 inside): ob1_texel_buffer reads
and writes, getBytes, replaceRegion, blits from and into it, the
buffer's bytes; recorded on the M3 Max (3 runs, one outcome, every
site the model's answer).
Verified:
- M3 Max, macOS 27.0.1: the probe (m3-max-4617) and the recording
(m3-max-4640): buffer-tails-texture-buffer is made, announcing only
the staged-texture-buffer notice, and the 2D tail cases still are.
- gem10 (m3-max-4635): clippy of the runtime (all targets, all
features) and of runtime and validation under --cfg m2v_cpu_icd;
the runtime's unit tests (70 of 70); the runtime lane on lavapipe
(172 of 172, the new texture-buffer test among them); the
buffer_textures, texel_swizzles and degrade_notices validation lanes
(27 of 27).
- gem10 (m3-max-4662): rustdoc of runtime and conformance; the
conformance unit tests over the tails, refusal, catalogue and
accepted-difference rows (20 of 20); a lavapipe replay of the six
buffer-texture cases, all six announced as the ledger expects.
Clippy there named the shape test's two constant assertions, now
const blocks; clippy of runtime and conformance and those unit
tests again on this tree: m3-max-4688.
- Negative control (m3-max-4662): the runtime's sources at
|
||
|
|
9ee7323e76 |
Make a 2D texture over a buffer whose texels run past its length, those texels in a tail
What. Buffer::new_texture and new_linear_texture of a 2D texture or a
2D array whose texels run past the buffer's length (inside Metal's
allocation rule, past which Metal answers nil and so does the plan)
are made instead of returning NotImplemented(TexelsPastBufferLength).
The texels inside the length are the buffer's bytes, exactly as
before; those past it lie in a tail of the texture's own: a zeroed
Shared buffer the runtime owns (Texels::tail), laid out from the
texels' first byte, and no other allocation's memory.
- GPU: such a texture is kept as a shadow image (ShadowedTexture is
announced). The tail is the shadow's staging buffer; its copy in
takes the bytes inside the length from the buffer, its copy back
(staging rows clipped by inside_rows) writes only those bytes back
to the buffer, and a Shared buffer's merge copies the current part
from and to the buffer and the tail apart (shadow_merge.rs).
- CPU: getBytes and replaceRegion split each row at the length
(past_runs, write_past).
- Blits: copies that name the texture's bytes split their rows at
each side's length (RowsCopy::split) and copy the part past it
from or to the tail; a copy with an ordinary texture goes through a
scratch buffer of the encoder; synchronizeResource covers the bytes
inside the length; the extended-range rewrite announces its note
rather than binding the buffer's words past the length.
Texture buffers and IOSurface planes past the length stay
NotImplemented(TexelsPastBufferLength), whose doc now says so.
Why. Plain Metal makes these textures: reims-vgpu's oracle on the
AMD 5300M and the UHD 630 (4096-byte buffer, 64x16 and 64x17 at rows
of 256, offsets 0, 256 and 2048) and the M3 Max probe
(probes/texels_past_buffer_length.m, job m3-max-4337) for the same
shapes. Under Policy::Dies the refusal ended the consumer's host. The
M3 Max's paths agree that the bytes past the length are one memory:
the next allocation's over a 4096-byte buffer, the allocation's own
zeros over a 20000-byte one, read and written alike by every path.
The tail is the second answer for every shape; docs/API.md's accepted
differences records that the runtime never reads or writes another
allocation there.
Tests.
- tests/buffer_tail_device.rs (m2v_gpu / m2v_cpu_icd): 64x17 over
4096 bytes, 64x16 at 2048, 64x80 over 20000 bytes (row 78 across
the length), 64x1 wholly past, a Private buffer's, and a 2D array
whose second slice is past the length; each path (kernel, blit,
CPU) reads what each other path wrote, the buffer keeps its bytes,
and 16 buffers around it keep theirs.
- Unit tests: linear_plan expectations (2D and array past the length
made, texture buffers refused), RowsCopy::split, inside_rows.
- Conformance: buffer-tails-kernels (scout_read_u / scout_write_u,
getBytes, replaceRegion, the buffer's bytes) and buffer-tails-blits
(blits from a buffer across the length and from a texture past it,
a copy out into a texture, blit and getBytes reads), RGBA8Uint
16x256 at offset 4096 over 20000 bytes, recorded on the M3 Max
(3 runs, one outcome, every value the model's).
- The runtime_lane assertion that a 2D array past the length is
refused now asserts it is made.
REFUSALS.md and CONFORMANCE-COVERAGE.md regenerated.
Verified:
- M3 Max, macOS 27.0.1: probe m3-max-4337 (the shapes above); record
m3-max-4492 (both cases, 3 runs, one outcome each, every site the
model's answer); replay on MoltenVK m3-max-4508: buffer-tails-* and
the four buffer-texture(s)-* cases announced (every value exact).
- gem10, lavapipe (LLVM 23.1.4, 256 bits), m3-max-4509: unit 71/71
(linear_plan, buffer_texture, blit_plan, tail); device tests under
m2v_cpu_icd 139/139 (the four buffer_tail_device tests and every
buffer_texture, shadow and blit test); runtime_lane::buffer_textures
7/7; conformance replay of the same six cases: all announced.
- Negative control, same job: the runtime's sources at
|