bbc7866fa02caefd16d6c6ead0d79ed61ddb73dd
1013
Commits
| Author | SHA1 | Message | Date | |
|---|---|---|---|---|
|
|
bbc7866fa0 |
Read nonStrictWideLinesUseParallelogram from the maintenance5 properties
The profile reader took VkPhysicalDeviceMaintenance5Properties' members only through VkPhysicalDeviceVulkan14Properties, so a capture of a Vulkan 1.3 device exposing VK_KHR_maintenance5, which carries only the extension's structure, read nonStrictWideLinesUseParallelogram as false, and the runtime would announce or band wide lines its device draws as Metal's parallelogram. PROPERTY_STRUCTS now lists VkPhysicalDeviceMaintenance5Properties and its KHR name; the member is still read only where maintenance5 is exposed (the extension or 1.4). The profile generator's EXTENSION_PROPERTIES states the member at the value the reader takes when a requirements document lists the extension and omits it (false). Nothing moves: every committed capture that carries the extension structure also carries the Vulkan 1.4 one, with the same value (golden_hashes passes unblessed). The runtime-sources pin, which hashes this file, is rewritten in the next commit. Verified: nextest device::tests::description (23 pass), among them the new wide_line_parallelograms_read_the_maintenance5_structure (a 1.3 document with the extension and either structure name reads true, without the extension false, a 1.4 document's Vulkan 1.4 block true); negative control: with the two names left out of PROPERTY_STRUCTS the test fails; golden_hashes and fast_paths pass; scripts/regen-device- profiles test_device_profiles.py and check_device_profiles.py clean. (Carried to development from steelbrain/reims-graphics-kext 5651992284.) |
||
|
|
eb41a55e82 |
Draw every width Apple's setLineWidth: takes, as Metal draws it
RenderCommandEncoder::set_line_width refused every width but 1 (AppleOnly::LineWidth). Measured on the Apple M3 Max under macOS 27.0.1 (probes/line_widths.m): each encoder starts at 1 and the width holds across draws and pipeline states; Metal draws w' = floor(16 w) / 16 clamped to [0, 16] (NaN and negatives as 0, infinity as 16); at w' = 1 its ordinary diamond-exit lines; at every other w' Vulkan's non-strict parallelogram (major axis the larger extent, x on a tie; minor-axis edges through the endpoints, w' long and centred; ends not extended; centres inside, top-left ties; the width not rounded); at 0 exactly the pixel centres on the segment; one parallelogram per strip segment with no joins; triangles in fill mode Lines draw their edges so; at 4 samples every width is the parallelogram at the sample positions. The runtime (render/line_width.rs) keeps the quantized width in the encoder state and routes each draw at w' != 1: - the device's own lines (lineWidth w', no Bresenham mode) where it enables wideLines and w' lies in lineWidthRange above 0: exact where strictLines is unset, nonStrictWideLinesUseParallelogram set, w' > 1 and on lineWidthGranularity; elsewhere announced device-wide-lines under the default DevicePolicy::wide_lines = WideLinePolicy::Device, and the band under WideLinePolicy::Exact (exact_answers() selects it); - the pipeline's band variant otherwise (no wideLines, MoltenVK among them; w' outside the range; w' = 0 at half a width of 2^-subPixelPrecisionBits): cull none, the band's front face, fill mode, a PATCH_LIST of two points, viewport 0's half extent pushed with the half width; strips and loops listed as their segments (ListGap::WideLines), flat inputs under the last provoking vertex read from the list led by the last vertex, which covers the same pixels. Refused: Unsupported(WideLines) needing tessellationShader where neither route draws a line; NotImplemented(RuntimeGap::WideLines) for a triangle's edges or a mesh draw's lines the device's lines do not draw, an amplified band, a rate-mapped pass and an execution's commands. Counted: WorkCounts::device_wide_line_draws, line_band_draws. The lane test runtime_lane::line_widths draws the probe's cases through owned fixtures and compares every pixel with Metal's answers (line_widths_m3_max.txt, the probe's output), checks each wide draw took a route, and that every fragment is front-facing; its site WIDE_LINES holds the new kind in the lane's degrade-notice closure. Docs: FAST-PATHS.md's row for wide_lines and a known-gap bullet (edges and mesh lines on devices without wideLines, near-plane cuts, band fragments' inputs uncompared, width 1 on multisampled targets off MoltenVK); API.md's policy bullet and degrade catalogue; the runtime README's Line widths; RUNTIME-PORTING's row; REFUSALS.md regenerated (reach rows for feature and gap WideLines, apple LineWidth gone). Validation: the line limits the device description gained describe execution and are not compared in a profile's subset check; the generator's CORE_PROPERTIES and roadmap-2022's m2v_layer_presentation state them at the reader's absent values; opened_chains reblessed (one member more, wide_lines, on every device with it); golden_hashes' profile fingerprints reblessed (no output cell moved); api_signatures and api_surface name WideLinePolicy and LineBandState. RUNTIME_VERSION 1712; the runtime-sources pin rewritten. Verified on the M3 Max under MoltenVK 1.4.2 through maclock with the validation layer: runtime_lane::line_widths, 4 tests pass. Default and exact policies each: 102 cases, 100 matched pixel for pixel, 2 refused (the two fill-mode Lines cases at width 4, NotImplemented(WideLines)), 0 announced; 46 draws took the band, 0 the device's lines (MoltenVK has no wideLines). a_band_needs_tessellation (tessellationShader withheld: width 0 refused needing it, width 2 refused, width 1 matches) and the_lane_s_maps_tell_the_widths_apart pass. Negative control: the band widened by 1/16 of a pixel fails both runs at LANE lines 0.5. Also cargo clippy --workspace --all-targets --all-features -D warnings, plain and with --cfg m2v_gpu; nextest of metal2vulkan, -air, -runtime and -devtools (4954 run, the one failure the missing lane site, now declared), of metal2vulkan-validation (the failures the profile rules, chains and pin fixed here, rerun green) and of metal2vulkan-conformance (1007 pass). Not run: lavapipe, RADV, ANV and NVIDIA lanes, which take the device route. (Carried to development from steelbrain/reims-graphics-kext b16d03150c.) |
||
|
|
fe22294b09 |
Carry every vertex output through a line band's control stage
On MoltenVK the band drew every line from its first endpoint to the target's right edge: the second control point's position read the bytes after the first vertex's. MoltenVK runs a vertex stage followed by tessellation as a compute kernel that writes its outputs into one record per vertex, the location outputs, Position and PointSize (which the translator's MoltenVK vertex stages always write), and lays the control stage's input record out from what that stage declares. A control stage that declared only Position read records of 32 bytes from records of 48. The band's stages now carry the vertex stage's outputs entire: every varying, read or not by the fragment stage, and PointSize where the vertex function writes one and the device enables shaderTessellationAndGeometryPointSize (TessellationPointSize, now a requirement rule for tessellation entries beside GeometryPointSize). A corner takes the first control point's point size, as it does a flat varying. The input arrays are gl_MaxPatchVertices long again. The binder also plans a band variant: its synthesized control and evaluation stages run no Metal function and bind nothing, as link's geometry stages (bind::graphics::metal_stages, with a plan test). Two match expressions become matches! (clippy). SEMANTICS_VERSION 1936: the band variant's control and evaluation modules change under the same key. Verified: nextest tests::engine_line_band, 4 tests pass, among them the new the_control_stage_takes_every_value_the_vertex_stage_writes (the control stage's per-vertex inputs and outputs and the evaluation stage's inputs equal the vertex stage's outputs on every committed profile with tessellationShader, PointSize included where the device takes it). Negative control: with the point size left out it fails (left [BuiltIn(0), Location(0), Location(1)], right adds BuiltIn(1)), and the MoltenVK lane runtime_lane::line_widths draws LANE lines 0.5 otherwise than Metal. With the fix the lane matches Metal's maps on the M3 Max under MoltenVK (the runtime commit that follows). (Carried to development from steelbrain/reims-graphics-kext 8b865a057d.) |
||
|
|
14dc4c5f2e |
Draw a line wider than the device's lines as a band of two triangles
Metal draws a line under Apple's setLineWidth: at a width other than 1 as the parallelogram Vulkan's non-strict wide lines may be (major axis the larger framebuffer extent, minor-axis edges through the endpoints, centred, w long). Devices without wideLines (MoltenVK among them) or whose wide lines are strict or not parallelograms cannot draw it with their own lines. A render pipeline's band variant (VariantKey::line_band) adds two synthesized stages after the vertex stage (pipeline::link::band): a tessellation control stage that copies each of a line's two vertices and writes every level 1 in the quad domain, and an evaluation stage that places each corner at its endpoint moved across the segment by half the width in framebuffer pixels along the minor axis, taken to clip space through Vulkan viewport 0's half extent, which the draw pushes (PushField::LineBand, BindState::line_band, its own 16-byte aligned push range). Ends behind w = 2^-20 are clipped first; smooth varyings and clip distances follow their endpoint, flat and integer ones take the first control point's. GraphicsState::line_band (LineBandState) states the consumer's contract: PATCH_LIST of two control points, no culling, its front face, the push offset. The device description gains what chooses the route: VkFeature::WideLines, and the limits lineWidthRange, lineWidthGranularity, strictLines, nonStrictWideLinesUseParallelogram (VK_KHR_maintenance5) and subPixelPrecisionBits, read from Khronos profile JSON and from ash. The verifier and requirement rules take the per-vertex arrays of tessellation control inputs and outputs and evaluation inputs, and TessLevelOuter and TessLevelInner as arrays. ARTIFACT_FORMAT_VERSION 480 for the new encoded fields (VariantKey, GraphicsState, LineBandState, PushField, VkFeature). Verified: cargo build --workspace --all-features --all-targets; nextest tests::engine_line_band (the band variant on every committed profile with tessellationShader validates in spirv-val and requirements, draws PATCH_LIST with its own push range; flat varyings take the first control point; without tessellationShader it is refused needing it; barycentric reads are not implemented) and the tessellation push_offset tests pass. (Carried to development from steelbrain/reims-graphics-kext 19814d7bb3.) |
||
|
|
8ef82fffa5 |
SEMANTICS_VERSION 1935; bless the stitched caller's rows
Translation output changes: a pipeline that links a function from a module carrying a stitching signature (or a linked-constants signature on a module that declares no constant) now compiles instead of refusing, so SEMANTICS_VERSION moves from 1933 to 1935 (1934 is reserved). The golden tables gain the new fixture's rows and nothing else moved: golden_hashes.tsv and public_fixture_expectations_engine.tsv each add stitched_caller's two kernels in its two forms (.ll and .air.ll), every profile NeedsInput(LinkedFunction) for `fused` and `fused4`, which no module defines there; tests/air_input/stitched_caller.txt is the new fixture's decode golden. Blessed with bless_golden_hashes, bless_engine_inventory and bless_engine_goldens (llvm-as 21); git diff shows only these additions. (Carried to development from steelbrain/reims-graphics-kext 4ba981e668.) |
||
|
|
1146929b09 |
Lane test: a stitched function computes its graph on the device
The consumer's path end to end through the runtime: the stitched library made from its bytes (Device::new_library_with_data, the form it takes when a guest hands it over), its functions linked into the caller's kernels in privateFunctions and in functions, one thread on 2, 3, 4 and 5. runtime_lane::stitched_functions checks Metal's measured words, 20 for `fused` and 25 for `fused4`, read back from the device. The runtime README says that a stitched function links as any linked function does and that the runtime makes no stitched library itself. The runtime's sources are unchanged. Verified on the M3 Max through MoltenVK under the validation layer (RUSTFLAGS='--cfg m2v_gpu', through the Mac GPU lock): runtime_lane::stitched_functions::a_stitched_function_computes_its_graph passes, beside runtime_lane::linked_functions' two tests; with the translator's old signature gate restored it fails, the pipeline state refused with the consumer's error. (Carried to development from steelbrain/reims-graphics-kext 199df8d7b3.) |
||
|
|
43ba8cf525 |
Test stitched functions linked into their caller
Metal's stitcher writes its library only at run time, so the tests get its structure from a writer of our own: metal2vulkan_devtools::stitched writes, as LLVM text, the module the probe stitched_function_linked.m read back from Metal for a graph of float stitchable functions (the stitched function with its nodes inlined, its air.visible entry and air.stitching_info naming internal helpers kept by llvm.compiler.used, and an !air.signature of kind air.stitching_modules_signature listing the graph in post-order and a digest per stitchable function), and the executable metallib holding one visible (TYPE 4) module per function. PROBE_GRAPHS are the probe's `fused` and `fused4`. No Apple-produced bytes are committed. The owned fixture engine/stitched_caller (regen-air-fixtures, macOS 27.0 target, as the probe compiled) holds the stitchable sum2 and product2 and the kernels stitch_caller and stitch_caller4 that call `fused` and `fused4`. tests::engine_stitched checks Metal's answers: through the public API the stitched library's functions are visible and each kernel's compute pipeline links its function in privateFunctions and in functions; on the SPIR-V interpreter the kernels store the probe's 20 and 25 (and the graph's value on two other input sets); and each link passes L3 on every committed profile. Verified: the three tests pass; with the previous commit's gate restored all three fail, the link refused with exactly the consumer's error (Linking, NotImplemented, stitch_caller block 0 instruction 5, symbol "fused"). regen-air-fixtures --check: up to date. (Carried to development from steelbrain/reims-graphics-kext 88a6b651a7.) |
||
|
|
59209afdf7 |
Link stitched functions: read a linked module's signature as the entry's
A pipeline linking a function Metal's stitcher made was refused,
`Unsupported { feature: Linking, needs: NotImplemented }` at the call
(stitch_caller, block 0, instruction 5, symbol "fused"), because
link::plan refused every linked module that carries an !air.signature.
Each module of a stitched library carries one, of kind
air.stitching_modules_signature: it records the graph the function was
made from and the stitchable modules' digests, while the module's own
code (the graph's nodes inlined into the stitched function) is what
runs. The entry side already read a signature that way and refused only
a linked-constants module that still declares function constants, which
has no reading.
The rule is now one function, canon::unread_signature, which both the
entry's specialization and the linked module's plan use: a stitched
module and a linked-constants module that declares no constant link like
any other module; a linked-constants module that still declares one is
refused at the surviving call as before. The dynamic-library export
check, which blocks any signature, is unchanged: a stitched library is
an executable library and cannot be a dynamic one.
Verified: link_tests::a_linked_module_s_signature_is_read_as_the_entry_s
(replacing the test that held the old refusal) passes, and fails with
the old gate restored. Against the stitched library the probe dumped on
the M3 (not committed), the old gate reproduces the consumer's refusal
exactly, and with this change both stitched functions link, privately
or not, and compute 20 and 25 on the SPIR-V interpreter.
(Carried to development from steelbrain/reims-graphics-kext 3ebc1a708a.)
|
||
|
|
1083e38ecf |
Probe a stitched function linked into a compute pipeline
A consumer's guest makes a stitched library with Metal's own stitcher (newLibraryWithStitchedDescriptor:) and links its function `fused` into a kernel as a private linked function; the translator refused that pipeline. This probe measures Metal's answer from our own stitchable source: `fused(a, b, c) = product2(sum2(a, b), c)` linked into `stitch_caller` in privateFunctions or in functions, and the three-node `fused4`, each run on 2, 3, 4 and 5, and it writes the stitched library's bytes (its libraryDataContents) for inspection. Measured on the M3 Max under macOS 27.0.1, each case in its own process through the Mac GPU lock, MTL_DEBUG_LAYER unset: private 20, functions 20, deep 25, every command buffer status 4. The dumped library (11484 bytes, byte-identical across runs) is an executable metallib with one visible (TYPE 4) function per module, each module carrying an !air.signature of kind air.stitching_modules_signature. (Carried to development from steelbrain/reims-graphics-kext 453a4a2b23.) |
||
|
|
4180cb2edb |
RUNTIME_VERSION 1710 for linking under specialized names
The branch changes what a runtime run does: linked functions resolve under their specialized names, function-table handle keys carry the link name and specialization, linked modules with function constants link instead of refusing, and a pipeline of an unspecialized function that declares constants is refused. The runtime-sources guard asks for a RUNTIME_VERSION bump with such a change; 1710 is unused on every branch. The pin (4fc5e9992a...) does not move with it. (Carried to development from steelbrain/reims-graphics-kext 37280bc223.) |
||
|
|
45380bd58f |
Re-pin the runtime sources at the branch tip
The branch changes runtime-sources inputs: metal2vulkan-runtime's
error.rs, library.rs, pipeline/{additions,mod,render,tile,
unspecialized}.rs and warm/codec.rs, and metal2vulkan's
pipeline/table.rs. Recomputed over the same inputs, as
the_runtime_sources_are_the_committed_ones computes it.
These edits can change what a run does: a linked function links under
its specialized name, a visible-function handle's key holds the
specialized name and flag, a linked module with function constants is
specialized instead of refused, and a stage function made by name whose
function declares constants is refused. The guard's rule asks for a
RUNTIME_VERSION bump with such edits; RUNTIME_VERSION stays 1709 here
because its number is the orchestrator's to give, and the bump is left
for that number.
Verified: the guard passes (1/1).
(Carried to development from steelbrain/reims-graphics-kext ce415fe9f6.)
|
||
|
|
468a91feab |
Size a copied constant's children with size_of_val
clippy's manual_slice_size_calculation (rust 1.98) stopped the workspace's clippy at copy_bytes, the linked-module copy's ledger estimate: size_of::<ConstId>() * children().len() over the slice children() returns. The same bytes, as size_of_val of that slice. Verified: cargo clippy --workspace --all-targets --all-features -D warnings, plain and under --cfg m2v_gpu (own target), clean; rustdoc -D warnings for the workspace, clean. (Carried to development from steelbrain/reims-graphics-kext d232492977.) |
||
|
|
e54a2c12aa |
Refuse a pipeline of an unspecialized function that declares constants
Since functions whose constants are left undefined compile (a2e34a9d2f),
the runtime made a pipeline state of a function made by
newFunctionWithName: whose function declares function constants. Plain
Metal ends its process there, at every creator's descriptor validation
(probes/undefined_function_constant_values.m, new cases <how>:<shape>,
on the M3 Max under macOS 27.0.1, MTL_DEBUG_LAYER unset, exit 134):
"Compute Pipeline Descriptor Validation / function ko cannot be used to
build a pipeline state. Use newFunctionWithName:constantValues:... to get
the specialized function"; the render and mesh creators name
vertexFunction, fragmentFunction, objectFunction and meshFunction, and
the tile creator says "without setting constant values first". It does
so for an optional constant read only where is_function_constant_defined
says (ko) and for a constant that only gates arguments (kg). Made: a
function made by name that declares none (kn, plain, tile-plain,
mesh-plain), and every shape made with constant values that hold none or
by newFunctionWithDescriptor: without them (each then answers an empty
functionConstantsDictionary; ko stored 7, kn 9).
- metal2vulkan: FunctionDescriptor gains `specialized` (false by default,
a function made by name; a descriptor with constant values is
specialized whatever it says) and with_specialized, and
needs_specialization(budget, entries) answers whether Metal makes no
state of the stage: not specialized and a non-empty
functionConstantsDictionary. A module function's constants are read
through the StageEntries' module decodes (constants_dictionary_with),
which the stage's compile copies, so the check decodes nothing the
compile does not. The compile itself is unchanged.
- metal2vulkan-runtime: Function::function_descriptor marks the stage
specialized where the function was made with constant values or by
descriptor. pipeline/unspecialized.rs refuses before anything is
compiled, Invalid with the new Problem::UnspecializedFunction { stage,
name }: compute and tile states (of_kernel), render states (vertex,
fragment) and mesh states (object, mesh, fragment). A linked function
keeps its own rule (LinkProblem::UnresolvedConstant).
- Pipeline records carry the stage's specialized flag, RECORD_FORMAT 3:
without it every specialized stage's record read back unspecialized
and went unrecorded.
- The owned fixture engine/unspecialized_stage_functions (the probe's
shapes at every stage); its golden rows, inventory and printout are
new rows only (11 functions by 2 forms in each table).
- docs/API.md ("Function constants"), the FunctionConstantValues and
creators' docs, the runtime README, docs/REFUSALS.md regenerated, the
signatures blessed (FunctionDescriptor.specialized, with_specialized,
needs_specialization, Problem::UnspecializedFunction).
Verified:
- metal2vulkan tests::engine_unspecialized 2/2 (every declaring function
of the fixture needs specialization made by name, no free one does,
and the eleven answers read one module decode, (1, 10); specialized or
valued, none does, decoding nothing).
- On MoltenVK (M3 Max) through maclock, --cfg m2v_gpu:
runtime_lane::unspecialized_functions 3/3 (by name: guarded and gate
kernels, vertex, fragment, tile, mesh and object refused; free kernel
stores 9; plain render state made; empty-valued and descriptor-made
guarded kernels store 7, gate kernels made, render states made; tile
and mesh states of them not refused as unspecialized) and
runtime_lane::linked_functions 2/2.
- metal2vulkan-runtime suite 1177/1177; tests::warm_record 4/4.
- metal2vulkan and metal2vulkan-air: 3748 of 3753 before blessing, the 5
failures the new fixture's table rows; after blessing they and the
signature and surface tests pass.
- Negative controls: needs_specialization answering false fails
engine_unspecialized's by-name test; function_descriptor without the
specialized flag fails all three lane tests (the empty-valued and
descriptor-made functions refused); the stage flag removed from the
record's writes and reads fails the four warm_record tests.
(Carried to development from steelbrain/reims-graphics-kext 116efd0dfe.)
|
||
|
|
c4523d1bdb |
Record a linked function's specialization and specialized name
A pipeline record wrote each linked function's function, constants and precompiled flag, but not the specialized name or the specialized flag the specializedName commits added to LinkedFunction. The record is read back at its making and kept only where it equals the creation's descriptor, so every creation linking a function by name (specialized false, where the reader's with_constants set it true) or under a specialized name went unrecorded. Each linked function now records its fields in declaration order: function, constants, specialized name (present flag, then its bytes), specialized, precompiled. RECORD_FORMAT 2; a record of format 1 is not read. Verified (final tree, with the next commit): metal2vulkan-runtime tests::warm_record 4/4 (the round trip now links one function under the specialized name custom_fn), and with the linked fields' writes and reads removed all four fail (negative control). (Carried to development from steelbrain/reims-graphics-kext 4f8730fa05.) |
||
|
|
6a41f826c8 |
Document linked-function names and constants; lane test on the device
docs/API.md section 3 states the rule: a reference resolves by LinkedFunction::name (the specialized name, else the function's own), a linked module with constants is specialized with the function's values, a specialized function reads an unvalued constant as undefined, and an unspecialized one (newFunctionWithName:) that reaches a constant is refused with LinkProblem::UnresolvedConstant. Section 10 adds the zero read of a linked function's unvalued constant to the accepted differences. The runtime README says how a stage links visible functions and by which name. The probe's header records its 19 cases as measured on the M3 Max under macOS 27.0.1 (26A434), MTL_DEBUG_LAYER unset, one case a process through maclock: the four of the brief (specialized 16, plain and other unresolved custom_fn, both 16) and the constant shapes (newFunctionWithName: reaching the constant, guarded or not, fails "cannot lower module with unresolved function constants"; plain_fn links; every specialized form links, unvalued reads storing nothing). runtime_lane::linked_functions runs both through the runtime: names answered, 16 at word 0 with every word 3x + 1, plain and another_fn needing custom_fn, both 16; derived 6x, guarded 3x and x - 1, plain_fn x + 2, base_fn unvalued 1; by name: base_fn and guarded_fn refused UnresolvedConstant, plain_fn 7, constantValues 3 16, empty values and a descriptor without values link. tests::pipeline gains the duplicate-name check by link name: one function under its own and a specialized name is no repeat, two under one specialized name are. Verified: on this M3 Max, MoltenVK, through maclock and memcap (6 GiB), RUSTFLAGS='--cfg m2v_gpu' cargo nextest run -p metal2vulkan-validation --all-features -E 'test(/runtime_lane::linked_functions::/)': 2/2 passed. cargo nextest run -p metal2vulkan-runtime --all-features -E 'test(/tests::pipeline::/)': 5/5 passed. (Carried to development from steelbrain/reims-graphics-kext 228cf1424c.) |
||
|
|
5a0f529a26 |
SEMANTICS_VERSION 1933; bless the signatures and the new fixtures' rows
SEMANTICS_VERSION 1933: a reference now resolves by a linked function's specialized name, and a linked module that declares function constants or has a static initializer is specialized and linked rather than refused (NotImplemented "air.function_constants" / "air.static_init"), an unspecialized function reaching a constant refused with LinkProblem::UnresolvedConstant instead. api_signatures.tsv (scripts/api-signatures/signatures.py --bless): 13 records added, none removed. They are LinkedName.function/.specialized, LinkedFunction.specialized_name/.specialized, name, with_specialized_name and with_specialized, LinkedSource::with_specialized_name/with_specialized, the runtime's FunctionDescriptor.specialized_name and with_specialized_name, and LinkProblem::UnresolvedConstant in both crates. No public type was added, so the api_surface table is unchanged. scripts/refusal-surface/refusal_surface.py leaves docs/REFUSALS.md unchanged (LinkProblem is not one of its families; the Linking sites are counted per function). Golden tables: bless_engine_goldens wrote the two new fixtures' printouts; bless_engine_inventory and bless_golden_hashes added 10 rows each, all engine/linked_specialized_* (the caller's four kernels need their linked function; the functions module's kernel is ok on every profile). No existing row or cell moved. Verified: the 17 fixture, inventory and golden-hash tests that failed before the bless (air_input, public_fixtures_engine::*, golden_hashes) pass. (Carried to development from steelbrain/reims-graphics-kext cd04514790.) |
||
|
|
cbd5ce6048 |
Test linking under a specialized name and linked modules with constants
engine_specialized_name runs the probe's shapes through the public API and the CPU interpreter, over the owned fixtures linked_specialized_caller (now with kernels that call base_fn, guarded_fn and plain_fn by their own names, as the probe's kb, kg and kp do) and linked_specialized_functions: - specialized resolves custom_fn; plain and another_fn need custom_fn; both links; a private function resolves by its specialized name; a reference to the function's own name is not resolved by its specialized copy; - the specialized name and the specialization are in the compile key, and a specialized name equal to the function's own is no other name; - computed values: base_fn with scale 3 stores the probe's 16 at word 0 and 3x + 1 throughout; derived_fn 6x (the static initializer's twice); guarded_fn 3x with the value and x - 1 without; plain_fn x + 2; base_fn specialized without a value reads scale as zero (1); - newFunctionWithName: reaching the constant is refused with LinkProblem::UnresolvedConstant, guarded or not, as Metal refuses byname and guarded-byname; plain_fn links; empty constant values, with_specialized(true) (a descriptor without values) and a value all link; - the specialized kernels pass L3 on every committed profile. A function made by newFunctionWithDescriptor: without constant values links as specialized, as Metal links it (the probe's descriptor-nil and descriptor-empty make the pipeline). The runtime's own `specialized` flag, which its MTLFunction property answers read, is left as it was: whether Metal's properties of such a function are the specialized ones is not measured. Verified: PATH with llvm@21 first, cargo nextest run -p metal2vulkan --all-features -E 'test(/engine_specialized_name/)' --no-capture: 5/5 passed, no SKIPPED line. (Carried to development from steelbrain/reims-graphics-kext d8efd9838c.) |
||
|
|
ae7b7b29ae |
WIP: link functions under their specialized name; specialize linked modules with constants
Parked mid-task at the coordinator's request (owner travelling). Not ready to merge.
What is done:
- Probe crates/metal2vulkan-conformance/probes/linked_function_specialized_name.m, extended
with function-constant shapes. Rerun on this M3 Max, macOS 27.0.1 (26A434), MTL_DEBUG_LAYER
unset, one case a process through maclock. specialized: name custom_fn, word 16. plain and
other: "unresolved visible function reference: custom_fn". both: 16. byname
(newFunctionWithName:, reads the constant): "cannot lower module with unresolved function
constants". guarded-byname (read only behind is_function_constant_defined): the same
refusal. constant-free-byname: 7. byname-empty, descriptor-nil, descriptor-empty, unvalued,
unvalued-empty and derived-empty: the pipeline is made and the word stays the 0xAB fill
(undefined read, store dropped). byname-valued 16, guarded 4, guarded-empty 4,
guarded-valued 15, derived 30, constant-free 7. The header does not record these answers yet.
- metal2vulkan-air: LinkedName gains `function` (the definition's name in its module; `name`
is the name it links under) and `specialized`. plan() no longer refuses a module that
declares function constants or has a static initializer. Such a module is copied,
constants bound (fc::check/bind) and its static initializer evaluated. A specialized
function then has SCCP run over each function it reaches, and unvalued constants read as
undefined. An unspecialized one folds nothing, and a constant (or a global derived from
one) that it reaches is refused with the new LinkProblem::UnresolvedConstant { index }.
reach() takes ModuleParts.
- metal2vulkan: LinkedFunction gains specialized_name (with_specialized_name, name()) and
specialized (with_specialized; with_constants and with_specialized_name set it).
LinkedKey, key hashing, table handles and linked_modules all use the link name and the
full identity. LinkedSource gains with_specialized_name and with_specialized.
- metal2vulkan-runtime: FunctionDescriptor.specialized_name (+ with_specialized_name).
Function answers it as name() and links under it. Functions made by descriptor link as
specialized. duplicate_linked_name and the additions identity compare the link name.
- Owned fixtures linked_specialized_caller/functions (.metal plus regen-air-fixtures
companions, TOOLCHAIN line).
Verified: cargo build --workspace --all-features; metal2vulkan-air suite 486/486 with the new
link_tests (specialized computes with its values; specialized without a value reads zero;
unspecialized reaching a constant is refused, guarded too; constant-free and dead calls
link; links under its name, not its function's; a static initializer without constants
runs).
Not done: translator tests over the new fixtures (specialized, plain, both, other, the
constant shapes); runtime lane test on MoltenVK; negative controls; clippy (plain and
--cfg m2v_gpu); the metal2vulkan suite; SEMANTICS_VERSION 1933; api-signatures bless and
api_surface; docs/REFUSALS.md regen; docs/API.md, the runtime README and the
FAST-PATHS/accepted-differences text; the probe header's measured answers.
Next step: write the engine_linking tests on the fixtures, run the metal2vulkan suite, bump
SEMANTICS_VERSION, bless the signatures, regenerate REFUSALS.md, update docs, run the
negative controls and the lane test, then commit.
(Carried to development from steelbrain/reims-graphics-kext fe07eff5e0.)
|
||
|
|
b4a3540c9d |
Keep a Core Image kernel library's HASH as read instead of verifying it
Core Image's own kernel libraries (ci_stdlib, ci_filters, ci_raw: file
type 1, extern functions over one module) were refused as
Container(HashMismatch), so Library::from_metallib, the runtime's
new_library_with_data and the command line ("FALLBACK (input not read)")
refused what Metal reads, in every process that uses Core Image. The
function table, metadata, extended header (HDYN, UUID) and shared module
were all in the shape the reader already takes; only the HASH check
failed.
What the HASH is, measured with libraries written from scratch under
Xcode 27.2's toolchain (metal -fcikernel, metallib -cikernel) on an M3
Max under macOS 27.0.1:
- metallib -cikernel writes one HASH for every function. For some modules
it is the SHA-256 of the module it writes (the two-kernel library the
file-type-1 support was first measured with, kernels with short
loops); for others it is not, e.g. one kernel with a three-iteration
loop of sin and cos. Not the digest of the input .air, of the stream
without the wrapper, of the module without its zero padding or with
other padding, or of the module round-tripped through metal-opt.
metallib is deterministic, and feeding the written module back through
it gives the same module and the same HASH. What it is a digest of is
not known, so it is not interpreted.
- Metal checks no HASH: the new probe
(crates/metal2vulkan-conformance/probes/metallib_function_hashes.m)
loads an executable library and a Core Image kernel library with one
bit of every HASH flipped exactly as written (the kernel's pipeline
stores 1,4,7,10 both ways), and the Core Image library whose HASH is
not its module's digest as well.
So a Core Image kernel library's HASH is read as 32 bytes, once, present
(as before), kept as read in LibraryFunction::raw_tags, and each
function's content key (LibraryFunction::hash, FunctionInfo::air_hash)
is its module's SHA-256, computed once for the shared range. Every other
library's HASH stays verified (HashMismatch), which is stricter than
Metal; docs/API.md says so.
The same probe found that Metal's externFunctionNames order is not the
reverse of the table's in general: a two-kernel library (tint, shift)
answers it, but a four-kernel library written from scratch, libraries of
10 to 200 kernels and Core Image's own answer the same names in an order
that is neither the table's, its reverse, nor sorted. The runtime keeps
the reverse; Library::extern_function_names' doc now says the order
differs from Metal's (doc only).
No cache version moves: a type-1 library whose HASH matched keeps the
same content key, and one whose HASH did not was refused before. No
translation output changes. The runtime-sources pin moves for the doc
comment in the runtime's library.rs (no behaviour): re-pinned to
d000eb23746160492052af4ff3e62bb81ab598b44fc8684b3cf36105d2c67026.
Verified (M3 Max, macOS 27.0.1):
- New test container::tests::a_core_image_library_hash_is_kept_as_read:
a synthetic type-1 library of three extern functions over one module
whose HASH is not the module's SHA-256 parses, each function's hash is
the module's digest and its HASH is kept raw; one whose HASH is the
digest reads the same; a missing, duplicate or 31-byte HASH is still
MissingTag, DuplicateTag, BadTag; the same table as a dynamic library
is HashMismatch. Negative control: with the exception disabled
(every library verified) the test fails (HashMismatch at parse), the
other 18 container tests pass.
- cargo nextest -p metal2vulkan-air --all-features: 482 passed.
- Locally only, nothing of it committed: Core Image's ci_stdlib,
ci_filters, ci_raw (and ci_stdlib_h) now read through the command line
and through the runtime on MoltenVK: each lists only extern functions
(as many as its table holds), function_names empty, every name made by
new_extern_function_with_name and new_function_with_name with
FunctionType::Extern, a sample of six per library refused as a compute
pipeline (Compile, EntryNotFound), as Metal answers; Metal's own answers
for the same files through the probe agree (type executable, no
function names, the same count of extern names, functionType 4 for
each).
- metal2vulkan core_image_libraries and api_signatures (3), the
validation runtime-sources guard after the re-pin: pass. clippy
--workspace --all-targets --all-features -D warnings, plain and under
--cfg m2v_gpu (own target): clean. rustdoc -D warnings for the three
published crates: clean.
- Not run: the other suites, the device tests, golden tables (no
translation output changes), a corpus census. Core Image's link of
these extern functions into ciKernelMain was not reached locally:
rendering ten built-in filters did not go through Metal's image-filter
link calls on this Mac.
(Carried to development from steelbrain/reims-graphics-kext 2d3259adbf.)
|
||
|
|
0192f03f68 |
Store the zero where a function writes a pass color its pipeline lacks
A fragment function that writes a color of the pass its render pipeline has no pixel format for was refused NotImplemented(Lowering(StageIo)) at that color: what Metal stores there was unmeasured. A consumer's guest hit it on 685 draws (a pass with color 1, a pipeline without it, a function writing [[color(1)]]). Measured with a probe written from scratch (committed as metal2vulkan-conformance/probes/written_color_the_pipeline_lacks.m), on the M3 Max under macOS 27.0.1 with MTL_DEBUG_LAYER unset: plain Metal stores exactly what it stores for a function that does not write the color, zero bytes at every covered texel and the clear or loaded bytes elsewhere. That holds over RGBA8Unorm, RGBA16Float, R32Uint and RGBA32Sint, written in their own numeric class and in another, cleared and loaded, and at 4x through the resolve. So the zeroed variant's fragment function now stores its own output at such a color nowhere, and the zero zeroed_output writes stands as that color's output. A function that reads such a color stays NotImplemented (unmeasured). SEMANTICS_VERSION 1930 -> 1931: a refusal became a module. Verified: - clippy -D warnings, plain and --cfg m2v_gpu (metal2vulkan, metal2vulkan-validation); - the metal2vulkan stage-io, zeroed-color and golden-hash tests (48/48, golden table unchanged); - runtime_lane::extra_colors on MoltenVK on the M3 (6/6), the new a_pass_color_the_pipeline_lacks_is_zeroed_where_the_function_writes_it among them. Without the plan.rs change it fails with the consumer's error, Lowering(StageIo) NotImplemented at Color(1); - the refusal surface and the runtime-sources pin unchanged. Not run: lavapipe, the full suites. On development this lands after the function-constant fix ( |
||
|
|
fbce5e0eeb |
Expect the command line to compile a kernel whose constant is undefined
llvm_text_is_assembled_by_llvm_as still expected the command line to ask for the kernel's function constant (exit 2, a --constant hint). Since undefined constants compile as Metal's do, the kernel compiles without the value; the test now checks that it writes its module, then compiles it again with the value. The test skips its llvm-as half when llvm-as is not on PATH, which is why the lane's suite runs passed it; development's post-merge checks, with Homebrew's LLVM on PATH, failed it. Verified: cargo nextest run -p metal2vulkan --all-features -E 'binary(cli)' with /opt/homebrew/opt/llvm/bin on PATH, 8/8, the llvm-as half running. |
||
|
|
9c80a4957b |
Compile functions whose function constants are left undefined
A function constant the request leaves unset no longer refuses the pipeline with NeedsInput(FunctionConstant). Metal makes that pipeline, optional or required: is_function_constant_defined is false, arguments gated on the constant (negated or not) are absent, and its reads vary from read to read (probes/undefined_function_constant_values.m on the M3 Max, macOS 27.0.1: u + 3 read 0, u * 7 + 1 read 1, u == 0 ? 111 : 222 read 222, b ? 5 : 6 read 5). WindowServer's QuartzCore pipelines leave optional constants unset (fixed_vert_lpf_gen without constant 53), so the desktop could not draw. SCCP's lattice is now flat, the undefined value one more value beside the constants: - a value computed from an undefined constant alone stays undefined, and a pure instruction computing one becomes its type's zero (an address keeps naming the constant's global); - a branch on one takes its false way (a rewrite only where no other way was opened), and a select its false arm; - an and with zero, an or with all ones and a mul by zero are that constant whatever the undefined operand holds, in SCCP and in the static initializer, so QuartzCore's generic || (...) is true with generic set; - an operation that also reads a run's value, and a PHI (an undefined entry merges as overdefined), keep what the run computes, so a defined way keeps its value and a loop counting from the constant still counts. The entry-block refusal and its inliner gate are gone. Entry gains undefined_reads, the undefined constants the specialized body reads, which validation's case checker uses where it used the refusal to prove an omitted constant unread. Removed: MissingInput::FunctionConstant (metal2vulkan-air), RuntimeInput::FunctionConstant (metal2vulkan), the command line's --constant hint. docs/API.md lists the reads under accepted differences. SEMANTICS_VERSION 1932. The golden tables and the engine inventory move only the 532 cells (28 rows by 19 profiles) that were the refusal; each is now ok. Verified: metal2vulkan-air 481/481, with negative controls (absorbing rule off: the two new and/or tests fail; the PHI mapping off: the loop test fails); the core suites; clippy (all features, --cfg m2v_gpu); the command line on the M3's QuartzCore library: fixed_vert_lpf_gen with reims's values (0 and 1 true, 3 = 0) and the whole pipeline with fixed_frag_lpf_cpf translate and pass spirv-val on moltenvk-m3, nvidia-rtx5080-laptop and intel-uhd770-rpls-anv, with generic true keeping the texture-matrix path (521 lines of SPIR-V against 290); every fixed_* pair and backdrop_capture_compute_tile_* with no constants translates but the _spc vertex functions, which ask for a vertex descriptor. |
||
|
|
bf3ce3813c |
Read Core Image kernel libraries and split whole aggregate accesses
A Core Image kernel library (metal -fcikernel, metallib -cikernel) is a
metallib of file type 1 whose kernels (!air.ci) are listed as function
TYPE 5 over one shared module. The container refused the file type
(Unsupported LibraryKind(1)), so newLibraryWithData: failed where Metal
succeeds; the consumer's graphics-kext lane hit it on Core Image's own
helper library in a macOS 26 guest, so every Core Image path stopped
there.
What Metal answers, measured with kernels written from scratch on an M3
Max under macOS 27.0.1 (probe programs over Metal's API and objc's message
log of a CIColorKernel render):
- newLibraryWithData: takes it as MTLLibraryTypeExecutable; functionNames
is empty; the private externFunctionNames lists the kernels in the
reverse of the table's order (libraries of two and four kernels);
- newFunctionWithName:, newFunctionWithDescriptor: and the private
newExternFunctionWithName: make each kernel with functionType 4 (no SDK
enumerator; its description prints "Unknown"); newExternFunctionWithName:
answers as newFunctionWithName: for any library, a kernel of an
executable one included, and nil for a missing name;
- a compute pipeline made from an extern function fails ("Function tint
was not found in the module");
- Core Image fetches each kernel and its own helpers with
newExternFunctionWithName: and links them on the CPU, in Metal.framework's
base device class, into an ordinary executable library holding one
kernel, ciKernelMain, of which it builds a plain compute pipeline.
So now:
- container: file type 1 is read (executable; its functions may share one
bitcode range, hashed once, as a dynamic library's); TYPE 5 is the new
FunctionStage::Extern, no stage: the ABI cross-check refuses it as a
mismatch, Library::Function compiles it as no entry (EntryNotFound,
available 0). Unobserved file types stay LibraryKind refusals.
- FunctionType gains the private enumerator Extern = 4
(regen-metal-enums PRIVATE); reflection maps Extern to it.
- runtime Library: function_names leaves extern functions out;
extern_function_names (reverse table order) and
new_extern_function_with_name are new.
ciKernelMain itself was refused next: Lowering(Arith) at its first
load, `load [4 x <4 x float>], ptr addrspace(2)`, a whole array loaded
from the constant buffer and passed by value to a helper. Lowering reads
and writes buffer and threadgroup memory a scalar or vector at a time.
The new canon pass `aggregates` (after SCCP, beside the other expansions)
replaces each non-volatile, non-atomic load or store of a pointer-free
array or struct in device, constant or threadgroup memory by its members'
accesses in layout order (a getelementptr i8 at the member's distance, the
access's alignment lowered to what the distance allows, joined by
insertvalue or split by extractvalue), at most 256 members, 8 deep.
Thread memory, pointer-holding aggregates (handles), volatile accesses
and larger types stay whole as before. The same-type pointer bitcast
beside the load was never the problem (verified alone).
Public surface: metal2vulkan-air FunctionStage::Extern; metal2vulkan
FunctionStage::Extern and FunctionType::Extern; runtime
Library::extern_function_names and new_extern_function_with_name
(api_signatures blessed: 5 added, none changed or removed). devtools
gains core_image_metallib. The metal-enum generation now records the
macOS 27.2 SDK (the host's Xcode); no SDK value changed, only Extern was
added. LibraryKind's doc and reach note name what it refuses now.
No cache version moves: file type 1 and aggregate accesses outside thread
memory were refused before, so no key reached them, and
golden_hashes_match_the_table passes unchanged (every public fixture
assembled: this Mac's Xcode 27.2 now has its Metal toolchain). The
runtime-sources pin moves (runtime library.rs): re-pinned here to
23766690fd75227c5333e976bfc1fdfafa6ff78f43e0c5ba8fa5183574cd9371.
Verified (M3 Max, macOS 27.0.1):
- Metal versus this tree's runtime on MoltenVK: Core Image's linked
ciKernelMain for a tint color kernel and for a sampler kernel (both
from-scratch CI kernels; the linked libraries captured from Metal in
scratch and deleted after), same constant buffer, source texture and
sampler, 4x4 RGBA32Float target: byte-identical texels, the early-out
column untouched on both. The parent tree answers FALLBACK (Lowering
Arith) for both. Release CLI: 0.01-0.03 s, 11 MiB each.
- Release CLI, parent vs this tree, largest public fixtures
(hfb_filter_bank render pair, tns_mm_flags), three runs each:
0.12-0.13 s vs 0.12-0.16 s and 0.05-0.06 s vs 0.04-0.05 s, 27 MiB both
(runs beside a test suite; the same within noise).
- New tests: canon aggregates (split loads, stores with nested arrays and
lowered alignments, threadgroup; volatile, pointer-holding and
300-element aggregates stay whole), an engine test running a
ciKernelMain-shaped kernel on the CPU interpreter on three profiles,
core_image_libraries (container types, stages, shared hash, functionType
4, EntryNotFound), and a runtime device test on MoltenVK (names, extern
names, both lookups, pipeline refusal, an executable library's kernel
through the extern lookup). Negative controls: the split and execution
tests fail with the pass disabled; the library tests fail with file
type 1 refused.
- cargo nextest -p metal2vulkan -p metal2vulkan-air -p metal2vulkan-runtime
-p metal2vulkan-devtools --all-features: 4927 passed (golden hashes and
the metal-as fixture parts included); -p metal2vulkan-validation
-p metal2vulkan-conformance: 2369, all passed after the re-pin; doctests
ok; clippy --workspace --all-targets --all-features -D warnings and the
runtime's under --cfg m2v_gpu: clean; rustdoc -D warnings and
scripts/api-docs: clean; REFUSALS, METAL-COVERAGE and
CONFORMANCE-COVERAGE re-derived (MTLFunctionTypeExtern is listed as not
yet compared by a conformance case). Not run: a corpus translation
census, and the device suites beyond the new runtime test.
|
||
|
|
cd511955f7 |
Re-pin the runtime sources at the landing tip
The landed packet changed a runtime-sources input, so the committed digest no longer described the sources and `the_runtime_sources_are_the_committed_ones` would fail. Recomputed over the same inputs and committed by land-pkt.sh. |
||
|
|
ec6b322bb5 |
Read the AIR slice of Mach-O universal metallibs
The container took a universal metallib only in Metal's own form (magic
0xCBFEBABE, what MTLDynamicLibrary's serializeToURL: writes). The system's
universal metallibs are Mach-O universal files instead: FAT_MAGIC
(0xCAFEBABE) with fat_arch records (five big-endian u32s), or FAT_MAGIC_64
(0xCAFEBABF) with fat_arch_64 records, whose offset and size are u64s.
Metal loads them; the parser refused them as BadMagic ("input not read").
The consumer's reims-graphics lane hit it on every Core Animation library
WindowServer made (QuartzCore's default.metallib, 19 slices on a macOS
26.6.1 x86-64 guest).
container::parse now dispatches on all three headers (UniversalForm) and
reads the slice of CPU type 0x01000017, the library's AIR; the GPU slices
stay unread. Metal's own form without an AIR slice is still NoAirSlice. The
Mach-O magic is shared with files that are no metallib (a CPU-only binary,
a Java class), so a Mach-O file whose records do not fit, or that holds no
AIR slice, is BadMagic, as before. An AIR slice that is no MTLB is
BadMagic at the slice; error offsets inside the slice are the slice's own.
Truncation offsets saturate rather than overflow on a hostile 64-bit
record.
The library is its AIR slice. container::Metallib gains `bytes` (the
metallib's own bytes: the input, or the slice), and Library::parse keeps
and hashes only that slice: Library::bytes, content_hash and the runtime's
serializeToURL: are the AIR slice's for a universal input. That keeps a
universal file inside the 500 MiB ceiling: QuartzCore's file is 187 MB,
and the first cut, which kept the whole file and copied it, peaked at
587 MB of resident memory in the command line. The command line also no
longer copies a .metallib input before parsing it.
Public surface (metal2vulkan-air): FAT_MAGIC and FAT_MAGIC_64 are new
public constants beside UNIVERSAL_MAGIC; container::Metallib gains the
public field `bytes`. Metallib is not #[non_exhaustive], so a consumer
that builds one with a struct literal must add the field; consumers that
only read a parsed Metallib are unaffected. The devtools metallib module
gains UniversalHeader and universal(), the builder both suites share.
No cache version moves: a function's translation key covers its own
bitcode, which is the same in a thin and a universal file, and a refused
file never reached a key. The content hash of a library loaded from
Metal's own universal form changes (it covers the AIR slice, not the
whole file), so such a key misses once; it never hits stale.
Verified (M3 Max, macOS 27.0.1):
- QuartzCore's default.metallib starts CA FE BA BE with 21 fat_arch
records, its AIR slice at offset 432 of 2,776,572 bytes (the layout
<mach-o/fat.h> gives). The release command line built from this tree
translates its kernel dynamic_system_ootf_decimate (profile
amd-rdna3-radv; spirv-val vulkan1.2: PASS) in 0.03-0.04 s wall at
192.4 MiB max RSS (185.9 MiB peak footprint, the input file itself),
three runs; from the extracted AIR slice, 0.01 s at 16.2 MiB, with
byte-identical SPIR-V (sha256 2dda4fe6...). Built from the parent it
answers FALLBACK (input not read). Nothing of the file is in the tree;
the scratch copy was deleted.
- Tests: a_universal_metallib_is_read_through_its_air_slice (each header;
missing slice, non-MTLB slice, truncations, Java-class-shaped inputs),
a_wide_universal_record_reads_64_bit_offsets_and_sizes (high words of
offset and size), and a_universal_file_is_the_dynamic_library_it_holds
(Library level: bytes, content hash, type, install name and a computed
result through the interpreter, run with llvm-as present, no SKIPPED).
The container tests fail on the parent's parser and pass here.
- cargo nextest -p metal2vulkan-air -p metal2vulkan-devtools: green;
api_signatures (blessed: 3 signatures and 2 constant values added, none
changed or removed) and api_surface: green; clippy --workspace
--all-targets --all-features -D warnings: clean; cargo doc --workspace
--all-features --no-deps with -D warnings and scripts/api-docs: clean;
REFUSALS.md re-derived with no drift.
- The full metal2vulkan suite: 3258 run, 10 failed before the signature
bless: api_signatures (fixed by the bless), golden_hashes (stale
"unassembled" cells) and 8 tests that need `xcrun metal-as`, which this
Xcode 27.2 lacks (its Metal Toolchain is not installed). Those 9 are
environmental and independent of this change. The validation and
conformance suites and a corpus translation census were not run.
|
||
|
|
510cb01c4c |
Accept modules built with Metal debug info
A library built with Xcode's MTL_ENABLE_DEBUG_INFO (YES, or INCLUDE_SOURCE, the
Debug configuration's default) was refused as `Abi(UnknownKey)`: the metadata
ABI's closed set of named lists and module flags did not name what
`-gline-tables-only` and `-frecord-sources` add (GitHub issue 10).
The decoder now reads them by their shapes, and nothing in them reaches the ABI:
- `!llvm.dbg.cu`: every operand a debug-info record (the bitcode reader already
keeps those as `Md::Debug` leaves); anything else is `BadValue`.
- the `Dwarf Version` and `Debug Info Version` module flags, beside LLVM's other
flags the translation does not read.
- in an unlinked `.air` only (the linker moves them out of a metallib):
`!llvm.commandline` and `!llvm_utils.workingdir`, lists of one-string nodes,
and `!llvm_utils.sources`, nodes of `!{!"<path>", !"<text>"}` pairs.
Per-instruction locations and function `!dbg` attachments were already dropped
in the bitcode reader. Full `-g`, which Xcode does not pass, still refuses at
the function-local metadata of its `llvm.dbg.value` calls.
SEMANTICS_VERSION 1929 -> 1930: these inputs compile now where they were
refused under the same key.
Verified (macOS, Xcode 27.1 toolchain, `metal2vulkan` CLI, amd-rdna3-radv
profile): a kernel built with `-gline-tables-only -frecord-sources` as a
driver-built metallib, as a `metallib`-linked one, linked the way Xcode links
(`metal -frecord-sources`), and as the bare `.air`, and a vertex/fragment
pipeline as `.air` and metallib, all translate and pass spirv-val. Their SPIR-V
is byte-identical to the same sources built without debug info. Before the
change each was FALLBACK. New tests: the ABI decodes the same with and without
the lists, and refuses their malformed shapes. A kernel spelled the way the
compiler writes it with these flags gives the same words as without them on
every committed profile. So do the linked visible-function fixtures with line
tables added to both modules. The runtime-sources pin is unchanged.
|
||
|
|
219f01365d |
Re-pin the runtime sources at the landing tip
The landed packet changed a runtime-sources input, so the committed digest no longer described the sources and `the_runtime_sources_are_the_committed_ones` would fail. Recomputed over the same inputs and committed by land-pkt.sh. |
||
|
|
ed8374409e |
Keep a held inline pass held as its gated copy in goes before it
Since 6c9d1f4551 a shadow's copy in over host pages a consumer logs is a
segment its batch's submission records (Deferred::GatedCopyIn), left by
EncoderCore::defer_copy_in, which called release_pass first. A pass whose
first instance records inline holds its command buffer (hold_pass), and
records that instance's copies in while still held, into the command
buffer that goes before it: at its end (render.rs's first-texel copies)
and at a split (inline_splits.rs's record_flushed). release_pass ended
the render pass instance there, and the segment went after the pass's
command buffer. So the draws that sampled the shadow ran before its copy
in and read what the image held before: zeros on a fresh image, another
texture's bytes on reused memory. The steps the end records before the
pass after that copy went after it too.
On a discrete GPU every sampled, read-only texture over logged pages is
such a shadow, a device copy (
|
||
|
|
962e2449fd |
Re-bless the golden hashes after the round's packets
The golden table re-blessed on development after the packets that move emitted modules: the native-answer packets, ldexp, the lockstep rules, fast atan2 and half fmod, the extended-range blend and conversion, the emulated filters, the carried root entry and the narrow device-address stores. This commit's tree is the old tip's (f4f88dad89) exactly. One work packet, landed as 5 commits on archive/development-linear-2026-10-29, in order: * Re-bless the golden hashes after the native-answer packets (abe66d8e7f) The packets that replaced Metal-exact emulation with the device's answers moved the final SPIR-V of the fixtures they reach: the storage-form conversions (tob_renders' snapshot), the maths special values and fast functions (trn_*, nan_*, fmx_*, pow/atan2/half-trig fixtures, kernel_fast_*), and the half encoding (every half store of a computed value). The deleted MetalFloatStorageNans fact changed the fingerprint of the profiles that held it. Blessed on development at 3b5b3b9b51 (SEMANTICS_VERSION 1920) with bless_golden_hashes: 237 rows. golden_hashes_match_the_table passes and the public fixture engine tests pass 15/15. * Re-bless the golden hashes after ldexp takes the device's denormals (f6a3523c01) 11eaace858 changed the words of every float ldexp. Blessed on development at 11eaace858 (SEMANTICS_VERSION 1921) with bless_golden_hashes; golden_hashes_match_the_table passes. * Re-bless the golden hashes after the native-answer, lockstep and filter packets (4052e2209c) The lockstep barrier rules (a7086d9585), fast atan2 / half fmod (abb2b3db6e), the extended-range blend (808143ef80) and the emulated filters' device sums (abc366a2fa) change emitted modules: 157 rows of crates/metal2vulkan/tests/golden_hashes.tsv move. Blessed at 95852120a3 with bless_golden_hashes (PATH with Homebrew llvm); nothing else moves. * Re-bless the golden hashes after extended-range conversion and the carried root entry (3e20b58763) Extended-range, padded and bfloat conversion by the device's arithmetic (8acec5a4a2) and the wide pointer carrying its root entry (d880609291) change emitted modules: 98 rows of crates/metal2vulkan/tests/golden_hashes.tsv move (the heap and argument-buffer subjects xrconv named, and the wide-pointer fixtures fatptr named). Blessed at 60c300198f with bless_golden_hashes; nothing else moves. * Re-bless the golden hashes after native narrow device-address stores (4f75ca91d1) f69c3459b1 makes a 1- or 2-byte store through a device address one narrow OpStore where the profile has the 8- or 16-bit storage feature. One row moves: kernel_buffer_address_round_trip.ll | buffer_address_round_trip, 5db4c2cb1f24a18f -> 055af465b9839bb3, in 15 profile columns (every column but the two whose profiles lack the access), exactly the cells the lane listed. Blessed at f69c3459b1 by `bless_golden_hashes` (1 passed). |
||
|
|
245b51ef7a |
Read NVIDIA's 10-bit two-plane codes through Metal's arithmetic, and judge the YCbCr lanes by the device's bounds
On the RTX 5080 Laptop GPU (NVIDIA 615.71.09, Linux), development failed 27 of the YCbCr validation tests (runtime_lane::ycbcr_textures 22, ycbcr_minify 2, ycbcr_in_place 2, dma_buf_imports' YCbCr test). Bisect on the 5080, each step built on its own, with the filters test(/runtime_lane::ycbcr/) | test(/dma_buf_imports::a_ycbcr/): - |
||
|
|
8d75695ead |
Answer per buffer whether a no-copy buffer's bytes are imported in place or copied
A no-copy buffer whose import the caller's gate refuses, or whose admitted import fails, is made over a copy of its pages (copied.rs), announced once per device. A consumer that probes whether an import worked could only read a WorkCounts::copied_host_buffers_made delta, which races with buffers other threads make on the same device. A per-buffer answer cannot. What: - Buffer::host_backing(&self) -> Option<HostBacking>, a runtime extension (Metal has none: a no-copy buffer's bytes are always the caller's pages there). HostBacking is #[non_exhaustive]: ImportedByPointer, ImportedAsDmaBuf, InHostRam (bound in a guest RAM's chunk), Copied (the copied-host-pages degradation) and Detached. None for a buffer over no host memory of the caller's; a buffer placed in a no-copy heap answers its heap's. The answer is where the bytes lie now, so it changes only at a rebind (which may move between an import and a copy) or a detach. It reads the import's shape and its copy registration alone: no page read, no import exposed (unlike gpu_address). - buffer::Shape records whether the bytes are bound in a RAM chunk (Placement::over_ram_chunk, a 6-line accessor in memory.rs), so the answer needs no read of the import's objects. - Buffer::copied (crate-internal) now reads host_backing, so the runtime's own decisions and the public answer cannot disagree. - Docs: the runtime README's runtime extensions, HOWTO's copied host buffers section, the copied-host-pages declaration and its docs/API.md catalogue entry name the query. api_signatures.tsv re-blessed: 7 records added, none changed or removed. The metal2vulkan api_surface table does not cover the runtime, so it is unchanged. RUNTIME_VERSION unchanged: a pure query, nothing the runtime does with an artifact moved. Verified on this M3 Max (MoltenVK 1.4.2, macOS 27.0.1), --cfg m2v_gpu, under memcap and maclock: - copied_device: host_backing_answers_what_the_gpu_uses_for_a_buffer_s_bytes (own buffer and own heap's buffer None; pointer import ImportedByPointer; gate-refused Copied; a no-copy heap's buffer its heap's, then Copied after the heap's gate-refused rebind; Detached after a detach; ImportedByPointer after rebinding) and host_backing_follows_a_rebind_between_an_import_and_a_copy (import, gate-refused copy, import, failed-import copy, each read back on the GPU); every copied test's lies_in_a_copy asserts Copied; host_ram_device asserts InHostRam for chunk-bound buffers and rebinds, and Copied for a refused rebind onto two runs. - The host-memory filter (copied|rebind|host_import|in_place|heap|detach|host_ram|host_aliases| host_residency|stand_in|host_backing): 148 passed, 0 failed, no device skipped. - Negative controls: forcing Copied and InHostRam to answer ImportedByPointer (the internal copied kept right) failed 10 tests; forcing Detached to answer None failed the new test. - clippy -D warnings plain and --cfg m2v_gpu; rustdoc -D warnings for the runtime; the api_signatures, api_surface and degradation catalogue tests; refusal surface and Metal coverage checks current. Not run: ImportedAsDmaBuf on a device (the dma-buf import is a Linux path; nothing here ran it). One work packet, landed as 2 commits on archive/development-linear-2026-10-29: 31b81906af, then 27ba200e86 (the re-pin). |
||
|
|
6e88d181dd |
Record each pipeline state creation, and warm a device from an earlier process's records
DeviceOptions::pipeline_records (and RawDevice::pipeline_records) hands a
hook an opaque PipelineRecord once per pipeline state creation that made its
state. That covers compute, render, mesh and tile states, the
additional-binary-functions forms, and a render state's draw-time twins (the
one-sample and factor-scaling ones). A failed creation and a binary
archive's add make none. A record holds the descriptor field by field
("M2VPREC\0", RECORD_FORMAT 1, the library table by content hash, SHA-256),
read back and compared at its making. Its libraries are kept once in the
shader cache's content directory. to_bytes and from_bytes carry it between
processes.
Device::warm(records, byte_budget) stands in for Metal's own pipeline caches
across processes:
- One background thread per device (utility QoS on macOS, Urgency::Warm in
the making budget) runs each record's creation under the default options
and drops the state. Translations, creation records and driver
pipeline-cache data are then in place before the program asks.
- The guest sees nothing of it: no identifier, resource ID, sampler number,
neutral, room, stand-in copy, kept-variant traffic, live-variant sharing,
announcement or record.
- It stops at byte_budget of added driver data.
- An unread record is counted, and the device's first is announced as the
warning metal2vulkan-warm-record-unread; nothing fails.
- WarmStatistics and Device::warm_statistics report the pass.
Ports dev-perf 14df1fb5fe and 66fe0ada29 without per-entry stamps.
Development's build directory names the translator, and its creation records
name RUNTIME_VERSION, so no entry of another translator or runtime version
is ever found, and dev-perf's re-translate-and-compare check has nothing to
do. Adapted:
- the memo is asked but never hands a warm thread a live variant the
program holds;
- a warm thread's waits rank Urgency::Warm, not Program (making.rs), and the
pipewait creation bound still applies on warm threads;
- unread records are announced.
DeviceOptions' and RawDevice's Debug are hand-written. PipelineRecord is
among the consumer auto-trait checks. api_signatures re-blessed; runtime
README and HOWTO updated. RUNTIME_VERSION 1707.
Verified on the M3 Max (MoltenVK 1.4.2), on development 2e2e238346:
- 140 device tests and 500 plain tests pass.
- Five sabotages each fail their guard: an archive add making a record; a
pass answering Warmed without creating; no unread announcement; a warm
state taking an identifier; a warm thread taking a live variant.
- clippy plain and --cfg m2v_gpu, and rustdoc -D warnings, clean.
- Release, 5 runs of the cross-process test, three creations (render,
compute, indirect compute):
- after a warm pass: 3.11-3.42 ms, with 0 stages decoded, 0 translated, 0
directory lookups and 0 driver caches loaded;
- unwarmed over the same directory: 4.19-4.32 ms (6 lookups, 2 loads);
- cold: 4.98-5.10 ms.
Small shaders, and Metal's own cross-process compiler cache serves all
three legs.
Lane commits: ws/warmrec-lane (8d106f29ab hook, 30de4fc948 warm).
One work packet, landed as 2 commits on archive/development-linear-2026-10-29: 8c709f27a7, then e2f0f2a3d9 (the re-pin).
|
||
|
|
d4fa99a14c |
Make a state's predicted key in its general form, every texture class drawn at once
Ports dev-perf 7028c0d92a onto development. On a device that samples
through Metal's own texture unit (MoltenVK) a texture slot a function
converts to `half` declares `SpecKey::PlainHalfTexels` and
`SpecKey::UnmeasuredTexels`, each with an arm that serves every bound
class exactly (0: the class routine; 0: no instruction reads it). A
state's creation predicts no texture bound, so a draw binding an
unmeasured class (BC4 to BC7, the linear ASTC formats among them) keyed
apart from the one pipeline the creation made, compiled its own at the
draw, and its command buffer waited for it (past the commit bound the
draw is dropped).
The residual form becomes the general form (`render/residual.rs`):
RangeAtBindOffset, PlainHalfTexels and UnmeasuredTexels at 0. A state's
creation makes its predicted key's general form, waited as before, and
where the predicted key differs hands the predicted key itself to the
pool right after, at the rank nothing waits for, not waited for. A draw
whose own key is not made takes the general form at once while its own
is made, as the residual form did. graphics_pipeline_now and
made_or_make now say whether the pipeline is the key's own, so a made-now
draw that took the general form keeps nothing in its encoder's memo.
Adapted to development (development wins):
- Development's native half-texel rounding (
|
||
|
|
3fd1f6672b |
Cut copied host buffers' CPU sync: page-at-a-time compare, log-gated copy in, merge only what may be written
The consumer's 4K boot on the RTX 5080 at the stock vm.max_map_count was unusable past its import gate: about 680 MiB of live copies (2,934 made) were compared whole at every commit and every completion, costing about half a core on both sides. Until the GPU copy is wired, three exact cuts, plus the dirty-log reports change 1 needs (the consumer's audit, A to C). - Change 3, a page-at-a-time compare (copied.rs sync): each 4 KiB page is compared whole (slice equality, vectorized), and the byte-exact merge runs only inside a page that differs. Same bytes as before; unit-tested against the old routine on random data, both sides changed included. - A, the copies' merge-back is reported: each copy keeps its pages' DirtySource and a writer id. sync collects the runs it wrote, and merge_back reports them with wrote_as before the completion is visible. Bytes a read-only copy drops are not reported. - B, the runtime's own CPU writes into logged pages are reported: replaceRegion into a heap's shadow texture (texture/heap.rs), the argument encoder and copyParameterDataToBuffer, as buffer_texture.rs already did. - C, GPU writes into logged pages imported in place are reported: each command buffer's written uses over memory with a dirty source, as writer 0 (the consumer's own writes, which every copy counts). They are reported at commit, before signals in the completion turn, and at completion, minus the shadows' own copy-backs. Collection is on while copies or such imports are live. Past the use cap, each written import is reported whole. A texture's use is reported as its whole buffer or heap (correct, coarse). This also closes the texture-shadow gap for pages reached through two imports. - Change 1, the log gates the copy in: where a copy's pages have a log (HostRam::with_dirty_pages, or the object's HostMemory::with_dirty_pages), a commit compares only the pages the log reports written since the copy last agreed. It uses one stamp per log and commit for every copy, waited for as the shadows' gated copy-in waits (DirtyPages::wait). A false wait, a copy's first copy in, bytes no log covers, and a copy that merged back 1 MiB or more since its last copy in compare everything. The copy in now runs before the commit's second state-lock block, since it may wait up to the log's bound. - Change 2, merge-back skips copies no finished batch may have written. Its "may write" is the bindings' write answers plus unnamed reach: a command buffer with a function that reads addresses (a root table), or one that executes an indirect command buffer, counts every copy as written. WorkCounts (new): copied_copy_in_bytes_skipped, copied_merges_compared, copied_merges_skipped. RUNTIME_VERSION 1705. Docs: copied.rs (Cost, Coherence), dirty_pages.rs' trait doc (what the runtime reports), FAST-PATHS (copied-host-pages known gap; the shadow gap closed), HOWTO copied host buffers. Measured, release, 680 MiB of live copies (2,049), median of 7, copy in / merge back in ms: - RTX 5080 laptop host (Core Ultra 9 275HX): - nothing changed: 231.8 / 231.6 before; 0.16 / 0.00 with all three; - 1% of pages changed: 233.7 / 233.8 before; 3.43 / 33.0; - one copy redrawn: 254.6 / 261.6 before; 29.4 / 34.1. - M3 Max: - nothing changed: 314.5 / 314.0 before; 0.12 / 0.00; - 1% of pages changed: 321.4 / 321.4 before; 4.54 / 18.5; - one copy redrawn: 353.9 / 395.4 before; 39.4 / 54.9. The merge-back figures are with the batch naming what it writes. A real frame's skip rate was not measured; the new counters show it. Verified: - M3 Max, MoltenVK 1.4.2, --cfg m2v_gpu, under memcap and maclock: the runtime lib suite passes 1445, 2 skipped. - RTX 5080 Laptop, NVIDIA 615.71.09, one 42 s hold: copied|dirty_pages| host_ram|event 101 pass. - New tests: 6 plain gating and merge-skip tests; a contract test that a concurrent CPU write survives both ways, log on and off; 7 device tests of the B and C reports, the gated copy, a read-only batch skipped, and an unnamed write still merged back. - Negative controls, each shown failing then passing once restored: gate forced off; A's report removed; C's registration or completion reports removed; the shadows' copy-backs not subtracted; B's heap report removed; merge skip forced off; unnamed reach ignored. - clippy plain and --cfg m2v_gpu (Mac, and msi niced), rustdoc -D warnings, api_signatures, api_surface, fast_paths. Lane commits: ws/cpusync-lane (180fc103c1 .. 59d82299ad, 9 commits). One work packet, landed as 2 commits on archive/development-linear-2026-10-29: bb00ae47f6, then 2b8ad3ab58 (the re-pin). |
||
|
|
fb591032fa |
Count a dma-buf lane's in-place texture by its pages' class: the pointer's import on NVIDIA
What. `sampled_textures_over_dma_buf_pages_are_in_place_where_their_pages_make_one_dma_buf` now counts an image in place by `host_textures_in_place` and tells its class apart: over a dma-buf of its own pages (`dma_buf_textures_in_place`) where the device imports dma-bufs (RADV), and over the pointer's import where the device imports the pointer (NVIDIA, lavapipe), where the source must stay uncalled and no texture counts as a dma-buf one. The RADV strict check (one run in place, scattered runs the source's refusal, where the DmaBuf check passed) is kept. Where the device imports the pointer and its Pointer check passed, each texture is in place or a shadow its refusal counts, as in_place_textures.rs holds any texture over host pages (its `refused` helper is now shared). The printed line names both counts. Why. On the RTX 5080 Laptop GPU (NVIDIA 615.71.09) the device refuses foreign dma-buf imports, so the no-copy buffer over the memfd view is a pointer import (`texture.rs`: `CallerMemory::HostPages` without `over_dma_buf()` is `PagesClass::Pointer`), the in-place check answered "Pointer: Passed", and the texture is an image in place over that import, counted in `host_textures_in_place` alone. The test assumed an aliased texture could only come from a dma-buf (`in_place == dma_buf_textures_in_place`), so it failed with left 0, right 1 before its byte checks ran. The product took the right path; the test was wrong. Verified on msi's RTX 5080 Laptop GPU (NVIDIA 615.71.09), --cfg m2v_gpu: - at development 7f76090454 the test fails as reported (left 0, right 1); - with this change `runtime_lane::dma_buf_imports` passes 17 of 17. Printed: one run 64x16 rows 256 bytes apart in place (in place 1, of them over a dma-buf 0, no refusal, the source uncalled), scattered runs 1024x1100 rows 4096 bytes apart in place likewise; the blits of the CPU's bytes and of its later bytes match for both textures, which never ran there before. - clippy -p metal2vulkan-validation --all-targets --all-features -D warnings, plain and --cfg m2v_gpu, clean on msi (Linux, where dma_buf_imports compiles) and on the Mac. One work packet, landed as 1 commit on archive/development-linear-2026-10-29: daf1bf625f. |
||
|
|
97116bb420 |
Keep pages the kernel cannot pin from NVIDIA's driver, and copy them as a failed import is copied
On NVIDIA's driver (615.71.09, RTX 5080 Laptop), a failed host-pointer
import of pages the kernel cannot pin breaks the process's later
host-visible allocations. The consumer's device-creation probe hit this, so
no guest RAM chunk imported afterwards. The runtime now asks the kernel
first on that driver, refuses such pages itself with the answer Vulkan
requires, and never hands them to the driver. The object then goes its
other ways: the dma-buf source, else a copy.
Cause, measured on msi's 5080 through runtime device tests that logged each
call's VkResult and errno, the fd table and the process's maps:
- The consumer's probe makes no dma-buf import on NVIDIA. Its 1025-page view
is past udmabuf's list_limit, so its source refuses. What fails is the
runtime's import of the view's pointer, a VM_PFNMAP mapping of a udmabuf:
vkGetMemoryHostPointerPropertiesEXT succeeds (types 2 and 3), then
vkAllocateMemory answers ERROR_OUT_OF_DEVICE_MEMORY on both.
- After that, vkAllocateMemory answers ERROR_OUT_OF_DEVICE_MEMORY to every
host-pointer import measured:
- memfd pages from 8 KiB to 8 MiB at any offset;
- anonymous pages;
- RAM 512 MiB away;
- 40 retries over 3 s;
- a second VkDevice.
It also fails a plain 64 KiB host-visible allocation. Device-local
allocations still work. The chunk import fails in vkAllocateMemory, not
in the properties query or the requirements check.
- Not the cause: a failed udmabuf import itself (the next 8 chunk imports
bind, and NVIDIA closes the handed clone: F_GETFD EBADF), the properties
query alone, mapping a udmabuf, address reuse, the fd table, VmPin/VmLck,
the kernel log.
Vulkan (vkspec 1.4.366, 11.2.6): such a restriction "must fail the memory
import operation with the error code VK_ERROR_INVALID_EXTERNAL_HANDLE_KHR";
and (Return Codes) "VK_ERROR_OUT_OF_*_MEMORY errors do not modify any
currently existing Vulkan objects."
Fix:
- RuntimeDriverDefect::UnpinnablePagesBreakHostMemory (NVIDIA_PROPRIETARY,
no GPU probed clean, per the defect table's rule).
- On such a device, Device::refuse_unpinnable runs before a no-copy
object's, heap's or rebind's own import and before a guest RAM chunk's
import. It walks the mappings over the pages (PROCMAP_QUERY, or the maps
lines before Linux 6.11) and reads one byte of each through
process_vm_readv. The kernel refuses a whole VM_IO/VM_PFNMAP mapping, so
one read per mapping answers for all its pages.
- Pages it cannot pin get its own Unsupported/HostMemory refusal naming the
defect. That refusal sends the object to the dma-buf source; with none,
or where the source's import fails, the object is a copy, announced as
copied-host-pages and counted as a failed import. This holds for buffers,
heaps and rebinds. A RAM chunk over such pages is not imported, and the
objects over it end in the copy. Pages not mapped readable keep their
refusal. The new refusal reaches a caller only where pages remapped after
their first import are imported again (docs/REFUSALS.md regenerated).
- Counted: WorkCounts::host_imports_unpinnable.
- Every other driver, and every OS but Linux, asks nothing and keeps its
path.
- Docs: driver_defects.rs (the measurement), FAST-PATHS known gaps, HOWTO
section 6 and its copy causes, the runtime README, copied.rs,
CopiedHostPages and its API.md entry.
- RUNTIME_VERSION 1704.
Verified:
- RTX 5080 Laptop, NVIDIA 615.71.09, --cfg m2v_gpu: the runtime filter
host_ram_device|copied_device|rebind|dma_buf|host_residency|
driver_defects|host_memory|host_import|copied passes 97/97 on the
committed tree.
- New: a_chunk_is_imported_after_a_refused_import_of_a_dma_buf_mapping
failed without the fix ((0, 0) where (1, 2) is expected) and passes
with it.
- New: pages_refused_before_the_driver_with_no_source_are_copied: a
buffer, a heap and a rebind over a udmabuf mapping with no gate and no
source give 3 refusals before the driver and 3 copies. The GPU reads
the right bytes, and a chunk then imports with 2 buffers bound.
- The consumer's repro, with its device probe in front
(os::linux::host_ram::tests::a_buffer_over_one_run_of_the_ram_is_bound_in_its_chunk,
built from a read-only copy of their 2cb3c8f91): passes. It fails against
development 2e2e238346.
- M3 Max, MoltenVK 1.4.2: the same filter 83/83; runtime unit tests 1161;
API, refusal-surface and fast-paths tests 34; rustdoc -D warnings clean.
Clippy -D warnings is clean on the Mac (plain and --cfg m2v_gpu) and on
msi (plain and --cfg m2v_gpu).
Left: RADV and ANV refuse such pages themselves, so an object there with no
source is still refused (not run there). A failed chunk import is not kept,
so the kernel is asked again for each object over that chunk (cost not
measured).
Lane commits: ws/chunkfix-lane (a2420020ea, a56fa43f2b).
One work packet, landed as 2 commits on archive/development-linear-2026-10-29: a0a1ea79d4, then 22fa5003db (the re-pin).
|
||
|
|
44eaa09898 |
Copies of read-only pages drop the GPU's writes; the gate is asked before write permission
The consumer's 4K boot on the RTX 5080 (NVIDIA 615.71.09) died at a buffer rebind onto 12 KiB of
read-only pages (`replaceBackingWithRanges:readOnly:`) with `OutOfMemory(Device)`, its gate having
refused the pages.
Cause: on Linux the runtime asked the pages' write permission before the caller's gate. Read-only
pages with a dma-buf source were sent to the source (by_pointer cleared), and the gate, asked only
for pages imported by pointer, was skipped. NVIDIA 615's import of the source's dma-bufs fails with
VK_ERROR_OUT_OF_DEVICE_MEMORY, and that failure was answered as the call's error, where a failed
pointer import takes the copy. The copy path itself never ran. Reproduced on the 5080: a buffer's
rebind, a heap's rebind and a no-copy buffer over read-only pages under a refusing gate each
answered OutOfMemory(Device). On macOS the gate was asked and the copy made, and the copy's
merge-back then wrote the read-only pages: SIGBUS in all three.
Fix:
- The gate is asked before the write permission, at a no-copy buffer's or heap's making and at a
rebind. Pages it refuses, and bytes moved in their page, are a copy, their permission unasked;
only pages imported have it asked.
- An admitted import of the caller's dma-bufs that fails (out of memory, another Vulkan error)
takes the copy too, as the pointer's import did: the gate's documented contract.
- A copy of pages the process cannot write drops the GPU's writes (copied.rs), as Metal drops them
for read-only memory (read_only_view.rs). The copy asks the system as it is made
(`mapped_writable`: PROCMAP_QUERY on Linux, mach_vm_region on macOS). At each completion, every
byte the GPU changed in the copy takes back the byte the pages and the copy last agreed on, and
nothing is written to the pages. Later commands of the same batch read the write back; a later
command buffer reads the pages' bytes. CPU writes through another mapping are copied in at each
commit as before.
- The copied-host-pages detail says so; read-only-pages-written is not announced over a copy.
Changes beyond the consumer's case: gate-refused pages and moved-bytes copies no longer ask the
kernel for write permission (no host_mappings_queried for them). Read-only pages with no source
under a refusing gate are a copy instead of Unsupported.
WorkCounts::copied_dropped_bytes (new). RUNTIME_VERSION 1703. api_signatures.tsv blessed;
REFUSALS.md regenerated, unchanged. Docs: HOWTO (copied host buffers), API.md (copied-host-pages,
read-only-pages-written), FAST-PATHS (the read-only-memory known gap now excepts copies),
ImportGate, HostMemory::new, new_buffer_with_bytes_no_copy, Buffer::rebind_bytes_no_copy, the two
Degradation declarations, copied.rs module docs.
Tests:
- Device, copied_device:
- a no-copy buffer, a buffer's rebind and a heap's rebind over read-only pages under a refusing
gate, the consumer's form: a read-only shared mapping, a dma-buf source on Linux;
- checked in each: the gate asked once with the pages, the source never called, a copy that
reads the bytes and a CPU write through the writable mapping;
- a blit fill completes with the pages unchanged, nothing merged back, copied_dropped_bytes the
fill's changed bytes, and a later command buffer reading the pages' bytes;
- Linux: the rebind under an admitting gate whose dma-buf import fails is a degraded copy that
drops the writes.
- Unit: restore, merge_back of an unwritable copy, mapped_writable (Linux and macOS).
- Negative controls:
- the three refusing-gate tests on the unfixed runtime: RTX 5080 3/3 fail with
OutOfMemory(Device) at the call; M3 Max 3/3 die with SIGBUS;
- the admitted test with only the source-failure copy arm removed: the 5080 fails with
OutOfMemory(Device).
Verified:
- RTX 5080 Laptop, NVIDIA 615.71.09 (msi; four holds, each under a minute): runtime
copied_device|rebind|host_ram_device|tests::copied::|can_be_written 52/52 at the final tree. The
admitted test's copy path ran (its line printed).
- M3 Max, MoltenVK 1.4.2, --cfg m2v_gpu under maclock and memcap: the same filter 49/49 (the
admitted test is Linux-only).
- Mac: degradation_catalogue, copied and host_memory unit tests with api_surface and
published_crates 37/37; api_signatures and fast_paths 16/16; clippy --workspace --all-targets
--all-features, plain and --cfg m2v_gpu, clean; rustdoc -D warnings for the runtime clean.
- msi: clippy -p metal2vulkan-runtime --all-targets --all-features --cfg m2v_gpu clean.
- Not run: the validation suites. The runtime-sources pin is left for landing.
One work packet, landed as 2 commits on archive/development-linear-2026-10-29: 5012056c31, then 6385d650b9 (the re-pin).
|
||
|
|
c0617d796e |
Rebinds take the copy where the gate refuses: heaps, images in place, moved bytes, one-run chunks
The NVIDIA RAM route's rebind part, with RunResolver's doc saying a rebind asks it. One work packet, landed as 4 commits on archive/development-linear-2026-10-29, in order: * Rebinds take the copy where the gate refuses: heaps, images in place, moved bytes, one-run chunks (c0e37e8984) The NVIDIA RAM route's rebind part (consumer spec, part 4). A buffer's rebind with an image in place over it, and a heap's rebind, now take the copy of the new pages (copied_pages) where the caller's gate refuses their import or the admitted import fails, instead of refusing NotImplemented(RebindTextures) or failing the call. Heap rebinds ask the gate like any import. A buffer's rebind to bytes at another offset in their page, under a texture planned at the old offset, takes a copy laid out at the old offset (the gate unasked: nothing is imported) instead of refusing. - The copy's memory, where images will bind in it, holds the window's whole pages from a multiple of the import's unit. The heap's textures bound to its bytes and the images in place over the buffer are made again over the copy: in memory the device allocates, as linear images that start PREINITIALIZED, whose first move keeps the copy's bytes (Vulkan: "the transition away from this layout will preserve that data"). - Where images in place ride on the copy, it lies in fresh pages the runtime maps and imports by pointer (Device::fresh_page_buffer), and each image is made as over the caller's pages for host allocations, under the device's in-place check for fresh pages (PagesClass::Fresh, else RebindTextures). On the RTX 5080 the driver's own linear image does not lie at Metal's 256-byte pitch, so the first form still refused there. - The run resolver at rebind (ram1's route_runs and bind_in_chunk): asked once with the new window, on the calling thread with no runtime lock held, before the gate. One run inside one chunk binds in the chunk's import (no import, no gate); any other answer takes the gate, then the import or the copy. The runs are kept with the new pages, copies included; bytes moved in their page are never chunk-bound. - Metal's rebind order is unchanged: the pending check runs before the gate, and committed-not-submitted command buffers are encoded again over the copy. - RebindTextures stays, for a device that makes no image over the copy at the texels' pitch, memory type or alignment, and for drops-writes buffers (option bit 24) whose bytes moved. WorkCounts (new): copied_rebind_pages_moved (a third cause within copied_host_buffers_made) and copied_rebind_images_made. No new Error variant. heap_raw_image takes (memory, at) and a memory-type check. RUNTIME_VERSION 1702. Docs: HOWTO copied host buffers and guest RAM, API.md copied-host-pages, FAST-PATHS (the heap and in-place rebind exception removed from the known gap), the runtime README, ImportGate, HostMemory::with_runs and with_import_gate, rebind.rs, copied.rs module docs, RebindTextures; REFUSALS.md and api_signatures.tsv regenerated. Verified: - RTX 5080 Laptop, NVIDIA 615.71.09 (msi, one hold): runtime copied_device|host_ram_device|rebind|in_place 48/48; the image over the copy is made (copied_rebind_images_made asserted 1) in the gate-refused, moved and ordering tests. Validation rebinds|dma_buf_imports 28/30: the two failures (ycbcr planes over chunks "off the grid", dma-buf in place "one run") also fail at development 2cfd8d6ef9 on the same GPU. - M3 Max, MoltenVK 1.4.2, --cfg m2v_gpu under maclock: runtime host-memory filter 157/157; validation rebinds|dma_buf|copied|no_copy|host_memory 75/75; at the final tip copied_device|host_ram_device|rebind 40/40. Here textures over buffers are shadows, so only the heap image over the copy runs (1 per heap test). - 7 new device tests: gate-refused buffer rebind with a texture over it, moved bytes, heap rebind gate-refused and import-failed, ordering with a held and an uncommitted command buffer, resolver at rebind (one run binds in the chunk; two runs go gate then copy). - Focused non-device tests 76/76; clippy plain and --cfg m2v_gpu clean; rustdoc -D warnings clean for the runtime. - Not covered by one venue: both images over a copy at once. Lane commits: ws/ram3-lane (d3945d0d9d, 7a114b599e, b93a6c1eac, 8b9fa5fb46). * Re-pin the runtime sources at the landing tip (7f76090454) * Say that a rebind asks the run resolver, as c0e37e8984 made it (8dcba47435) RunResolver's doc still said a rebind to new pages does not ask it. Since c0e37e8984 a buffer's or heap's rebind asks it once with the new window, before the gate, except where the bytes moved in their page under a texture, which take a copy without asking (with_runs' and Buffer::rebind_bytes_no_copy's docs already say so). Doc only. * Re-pin the runtime sources at the landing tip (17896b4366) |
||
|
|
acc99e949b |
Store 8- and 16-bit leaves through device addresses natively where the profile has the access
What: a device-address (PhysicalStorageBuffer) word memory, `PsbMem`, now carries the narrow
units the profile can access (`psb::narrow_units`: `Units::storage_on` without `uvec4`), planned
once per function as `AccessPlan::psb_units` and handed to both PSB paths: a static slot reached
by device address (`emit::prepare`) and a wide (dynamic-root) pointer (`dynamic::wide_at`). Where
the profile has `storageBuffer8BitAccess` (with `shaderInt8`) or `storageBuffer16BitAccess` (with
`shaderInt16`), a 1- or 2-byte leaf is one `OpStore` of a `uchar`/`ushort` through a
`PhysicalStorageBuffer` pointer at the unit's address with `Aligned` 1 or 2, and an aligned
store's 1-3 byte tail is stored as its units, exactly as a descriptor slot's narrow views do.
Without the width's access the store stays the sub-word pair (relaxed device-scope `and` then
`or` on the containing word). The decision reads the profile's facts only.
Loads: the same check makes narrow loads native too (one `OpLoad` of the unit, zero-extended),
since `memory::leaf` uses one `units()` set for both; a 16-bit unit's widening is noted for
`half` reads, as on a narrow view.
Containment is unchanged: `psb::prepare` and `wide_at` still check in `u64` against the root
entry's size, select the sink's address and offset 0 out of bounds, zero a contained load, and
count root-0 misses; only the word memory below them changed.
Why: on an RTX 5080 the consumer measured native 8- and 16-bit stores through
`buffer_reference` at 1.00x a descriptor slot's, while the atomic pair cost 3.4-8.2x in VRAM and
11-25x in host memory. The pair is also a data race beside a plain store to the same word under
the Vulkan memory model; a narrow store touches only its own bytes.
Vulkan's 8/16-bit storage features cover PhysicalStorageBuffer (vkspec.txt, 1.4.366):
"storageBuffer8BitAccess indicates whether objects in the StorageBuffer,
ShaderRecordBufferKHR, or PhysicalStorageBuffer storage class with the Block decoration can
have 8-bit integer members."
"storageBuffer16BitAccess specifies whether objects in the StorageBuffer,
ShaderRecordBufferKHR, or PhysicalStorageBuffer storage class with the Block decoration can
have 16-bit integer and 16-bit floating-point members."
VUID-RuntimeSpirv-storageBuffer8BitAccess-06328 / -storageBuffer16BitAccess-11161: without
the feature such objects "must not have Storage Class of StorageBuffer,
ShaderRecordBufferKHR, or PhysicalStorageBuffer" (so the pair stays there).
VUID-StandaloneSpirv-PhysicalStorageBuffer64-06314: "any load or store through a physical
pointer type must have an Aligned operand which is a multiple of the size of the largest
scalar type in the pointed-to type" (Aligned 1 or 2 on the unit), and -06315 "the pointer
value ... must be at least as aligned as specified by the Aligned memory access operand"
(the unit index comes from the leaf's alignment, as on a narrow view).
`device_place` wraps the unit in its one-member Block, and requirement derivation already maps
an 8/16-bit pointee in PhysicalStorageBuffer to StorageBuffer8BitAccess/16BitAccess.
SEMANTICS_VERSION 1928 -> 1929 (renumber at landing): a PSB sub-word store or narrow load moves
its module on profiles with the access.
Verified (macOS, debug, this tree):
- New `narrow_stores_through_a_loaded_pointer_are_native_where_the_profile_has_the_access`
(engine_pointer_memory): an i8 and an i16 store (in bounds and 4096(t+1) bytes out) and i8/i16
loads through a loaded pointer, on moltenvk-m3, lavapipe and amd-rdna2-apu-radv (robust on
and off) and on moltenvk-m3 and lavapipe without the 8-bit, the 16-bit, and both accesses.
Structural: PSB u8/u16 OpStore/OpLoad counts are [1, 2, 2, 2] per available width and there
is no OpAtomicAnd; without a width its two stores keep the pair (one And each) and no narrow
PSB access. Interpreter, both scheduling orders: the allocation's bytes exact, neighbours
kept, out-of-bounds stores contained (allocation untouched), out-of-bounds load 0.
Negative control: with `PsbMem::units()` forced to none (the old form) the test fails
("narrow device-address loads and stores: left [0, 0, 0, 0], right [1, 2, 2, 2]").
- `engine_places::a_psb_leaf_compiles_as_moltenvk_msl`: the static PSB slot's byte store is now
narrow on moltenvk-m3, so the module holds one atomic (the add), not three.
- cargo nextest run -p metal2vulkan --all-features: 3256 run, 3254 passed, 19 skipped; the two
failures were `a_psb_leaf_compiles_as_moltenvk_msl` (the binary predated its updated
expectation; passes on the final tree) and `golden_hashes_match_the_table` (the cells below).
On the final tree, the PSB/dynamic/access families (engine_places, engine_pointer_memory,
engine_dynamic_roots, engine_access, engine_atomics, engine_copy, engine_volatile,
engine_pointer_cells, engine_pointer_values, every `psb` test): 152 passed, containment, the
out-of-bounds sink and the interpreter runs included.
- clippy -p metal2vulkan --all-targets --all-features -D warnings: clean. Rustdoc
(-D warnings, --all-features --no-deps): clean.
- Golden cells that move (not blessed; re-blessed on development): 15, all
`kernel_buffer_address_round_trip.ll | buffer_address_round_trip`
(5db4c2cb1f24a18f -> 055af465b9839bb3) on every committed profile: amd-780m-hawkpoint-radv,
amd-780m-radv, amd-rdna2-apu-radv, amd-rdna3-radv, gate-lavapipe, gate-lavapipe-x86_64,
intel-arl-anv, intel-irisxe-anv, intel-irisxe-rplp-anv, intel-uhd770-rpls-anv, lavapipe,
moltenvk-m3, nvidia-pascal-linux, nvidia-rtx50-linux, nvidia-rtx5080-laptop.
- Not run: device tests. No runtime device test was found that stores a uchar/ushort through a
device address or argument-buffer pointer; authored validation cases with narrow device
pointers were not qualified on the M3 for this change.
One work packet, landed as 1 commit on archive/development-linear-2026-10-29: f69c3459b1.
|
||
|
|
ce204a1218 |
Carry a wide pointer's root entry in the pointer, so no access reads the root table
What. The wide fat pointer is u64vec4(root, at, host, size) instead of u64vec2(root, offset): `at` is the Metal displacement from the allocation's start (bind_offset plus the old offset), and `host` and `size` are the root entry's, read once where the pointer is formed: the resident-set search reads `host` beside the `guest` and `size` it already read (`roots::resolve_wide`; a miss is (0, i, 0, 0), the null root's fields), and a wide buffer parameter's (2 + n, bind_offset, host, size) is read in the function's first block and held (`dynamic::emit_entry`). The sink's address is read once there too (`EmitCx::sink_host`). A GEP adds to `at`, select and phis carry the vector, and a pointer's Metal address reads only `guest` (guest + at); stored pointers stay Metal addresses. The device-replay shaders keep the narrow search (`roots::resolve`), unchanged. Why. Every access through a wide pointer read four root-table fields (host, bind_offset, size, the sink's host) through device addresses. In a loop that also stores, a driver cannot prove the store leaves the table alone, so it reads them again every iteration. The table is read-only to the dispatch (the binder writes it before submission; a device replay writes a command's slot table in an earlier dispatch behind a barrier; no lowering stores to it), so a field read where the pointer is formed is the field an access would read: containment, the sink and miss counting are unchanged. The finding this answers (ptbench `seq_load+store`, 15x slower through a pointer from an argument buffer on the RTX 5080) is mostly not this. Metal's compiler sank `seqst_static`'s store out of the loop (noalias buffer parameters; our SPIR-V has it in the loop's merge block) and kept `seqst_dynamic`'s inside (the loaded pointer may alias `out`), and `out` is a shared buffer, host memory on the 5080: 16 stores per thread over PCIe against one. A pair of one AIR shape (the store into the loaded private buffer, in the loop, for both) runs dynamic/static 1.03 on the 5080. Evidence. - The new test `accesses_through_a_loaded_pointer_read_no_root_entry_in_a_loop` (6 profiles) counts u64 device-address loads in the kernel's loop: 0; with the old per-access reads put back it fails (6), restored it passes. - metal2vulkan: 495 tests of the wide-pointer modules (pointer memory/values/cells, copy, indirect commands, handles, binder, dynamic roots, places, nonwritable, volatile, profile F, replay, lower::access, memory, fast_paths, profile, api_signatures) pass; the interpreter runs of containment, out-of-bounds sinks and miss counts among them. Public fixture expectations pass. clippy (plain and --cfg m2v_gpu) and rustdoc clean. - ptbench, same-session A/B against development a7086d9585 (gpu ms per dispatch, dynamic path): RTX 5080 private: seq_load+store 2.823 -> 2.675, store_uint 0.0828 -> 0.0811, store_ushort 0.1248 -> 0.1197, store_uchar 0.1705 -> 0.1691; static paths and loads within noise. M3 (MoltenVK) shared: seq_load+store 0.261 -> 0.210, seq_uint4_load 0.275 -> 0.212, store_uchar 0.482 -> 0.191, store_uint_own 0.405 -> 0.287; private agrees but is noisy. Dynamic stores read back correct on both. - Release translation (CLI, best of 5) of seqst_dynamic: 35.4 -> 34.3 ms (5080 profile), 12 MiB peak; module 8556 -> 8368 bytes. SEMANTICS_VERSION 1923 -> 1924. Golden hashes not blessed: 78 rows over 55 fixtures move (every fixture with a wide pointer: ICB encoders, mesh commands, escaping pointer integers, loaded and device-address pointers, argument-buffer pointers). One work packet, landed as 2 commits on archive/development-linear-2026-10-29: d880609291, then 26f405c67b (the re-pin). |
||
|
|
7d1323ebcc |
Convert extended-range, padded and bfloat texels by the device's arithmetic
A read is float(c - 384) times the f32 nearest 1/510 (a padded code's float(c) times 1/1023), a write RoundEven(clamp(v)*510)+384 (padded *1023), an sRGB twin's colour the MSL transfer by the device's Pow on the magnitude, a half result the device's narrowing, a bfloat code its bit shift with NaNs as computed. Metal's correctly rounded quotients, exact-product rounding, ties-away half rounding and its extended/padded sRGB tables leave the shader path: extended_range/table.rs, R10X6_SRGB_DECODE_STEPS, round_exact_product(_lanes) and the plan's table fields are deleted. Each such module records DevicePackConversion; FAST-PATHS' air.pack row and API.md's catalogue state the bounds (one f32 ulp, one code, half a 2^-13 sRGB step, R10X6_SRGB 1.64 steps). The host-side clear_texel and the bicubic code still read extended_srgb.rs's tables, so on an sRGB twin a clear and a shader write can differ by one code. Verified: 331 touched lib tests; clippy plain and m2v_gpu; rustdoc; conformance ledger tests; M3 replay of 89 extended-range cases (exit 0, 276 ledger rows, +254/-57 against development); validation heap_extended on the M3 (6/6); the new tests fail with FDiv decode. Golden: 346 cells in 20 heap/argument-buffer subjects move (blessed on development). Translation words of an sRGB twin's read 4433 -> 588, write 5540 -> 632. One work packet, landed as 2 commits on archive/development-linear-2026-10-29: 8acec5a4a2, then 96d8394995 (the re-pin). |
||
|
|
76d89d87a8 |
See an event signal behind a copied host buffer at its completion turn
An event signal behind a copied host buffer is seen at the batch's completion turn, and the
copied host pages' cost is announced as the catalogue states it.
One work packet, landed as 4 commits on archive/development-linear-2026-10-29, in order:
* See an event signal behind a copied host buffer at its completion turn (8fc9c56dcb)
A batch's event signal is its GPU signal of the event's timeline semaphore,
and the host read the semaphore's counter directly (`EventShared::value`),
while a copied host buffer's GPU writes reach the caller's pages only at the
batch's completion turn (`completion.rs`, merge then `reached`). So a CPU
that saw the value could read the pages before the GPU's writes, and a plain
event's wait chained on the VkQueue let another queue's work start before
them: Metal's writes before a signal are in the pages once its value is
seen (the documented gap in FAST-PATHS, now closed).
A signal kept while the device holds a live copy is marked behind the merge
(`EventTimeline::keep`). No counter read observes it or any signal after it,
and no wait is handed its index (the scheduler's own host wait included); a
plain event's wait for it is held as a shared event's is. The completion
turn, which merges first, observes it and wakes every host wait and held
batch. The signal stays the batch's GPU signal: no submission is added. The
cost per such signal: its value reaches readers one completion turn later
than the counter shows it, and a GPU wait for it is a host hold plus a
vkQueueSubmit at that turn. Counted: WorkCounts::event_signals_behind_merge.
The same mechanism will hold for the GPU-kept copies.
RUNTIME_VERSION 1699 (renumbered at landing).
Verified on the M3 Max (MoltenVK), --cfg m2v_gpu, under memcap and maclock:
57 copied, event, scheduler and fast-path tests pass, among them the new
a_shared_event_s_value_is_seen_once_the_copy_s_bytes_are_in_the_pages
(six rounds, spin reads and host waits, a 64 MiB copy beside to lengthen
the merge) and the timeline unit test
a_signal_behind_a_merge_is_seen_at_its_completion_turn_alone. Negative
control: with the mark off, the device test fails on the byte check
("the write is in the pages once the value is seen"). clippy (plain and
--cfg m2v_gpu) on metal2vulkan and metal2vulkan-runtime, api_signatures
re-blessed (the new field), api_surface pass.
RUNTIME_VERSION 1700.
* Re-pin the runtime sources at the landing tip (2cef515da6)
* Announce the copied host pages' cost as the catalogue states it; list what pack.rs reaches (e9ba27478b) (its crates/metal2vulkan-runtime/src/degradation.rs part)
The final gate on 3e20b58763 failed two tests.
- degradation_catalogue: the signal-behind-merge fix (8fc9c56dcb) closed the
shared-event gap and rewrote the API.md entry for copied-host-pages, but the
runtime still announced "(behind a shared event's value among them)". The
announced cost now drops it, so the catalogue's entry starts with it word
for word again.
- the_runtime_sources_are_the_committed_ones: pack.rs became a runtime input
(the mipmap kernel's sRGB transfers), and it also reaches
metal2vulkan-air's intrinsics, lower/arith/math.rs and lower/arith/narrow.rs
through its pack and unpack intrinsics, which only the compile emits. They
are listed as not runtime with that reason. The stale comment about
srgb.rs's encode, tables and steps (deleted by the mipmap and n7 packets)
now says only what is true.
Verified: the two tests on the landed tip (see the landing).
* Re-pin the runtime sources at the landing tip (538f3f1161)
|
||
|
|
f4394b8712 |
Copy a no-copy buffer's pages the kernel cannot pin where the process maps them readable
Cause: a copied host buffer (the caller's gate refused the import, or the admitted import
failed) read its first bytes only through the kernel: `process_vm_readv` of our own pid on
Linux. That read pins each page, and no page of a VM_PFNMAP or VM_IO mapping can be pinned, so
on a dma-buf's mapping (udmabuf's on Linux 7.2) it fails although the pages are mapped
readable. `CopiedBuffers::add` then answered `NotCopied::Unreadable`, and the buffer, heap or
rebind was refused as not importable (`Unsupported { HostMemory, NotRepresentable }`): the copy
never worked for dma-buf mappings, which is where a consumer's gate refuses imports on NVIDIA
at the kernel's default vm.max_map_count.
Fix: where the kernel's read fails, the copy asks the process's mappings whether every page of
the range is mapped with read permission and, if so, reads it with plain loads, the access the
copy's comparisons already make at every commit and completion (`copied::read_caller`). The
mapping check generalizes the import's write check: `PROCMAP_QUERY` tests
`PROCMAP_QUERY_VMA_READABLE` as it tested `..._WRITABLE`, and before Linux 6.11 the
/proc/self/maps lines' `r` as their `w` (`host_memory::Access`, `queried_permitted`,
`permitted`, `mapped_readable`). Pages not mapped, or mapped without read permission, are still
refused. All three users of `add` (buffers, heaps' own buffers, rebinds) take it. Off Linux
nothing changes (no mapping is asked; macOS's mach_vm_read path as before). RUNTIME_VERSION
1696 -> 1697 (renumbered at landing). Docs: API.md's copied-host-pages entry, HOWTO's copied
host buffers, the runtime README, and FAST-PATHS' known gap with the measured cost.
Evidence (verified):
- msi (Linux 7.2.8, RTX 5080): tests::copied + tests::host_memory 21/21; the udmabuf test
printed "the kernel cannot read this udmabuf mapping: copied with plain loads".
Under the GPU lock on NVIDIA: tests::copied_device + tests::copied 15/15, among them the new
copied_buffer_is_made_over_a_dma_buf_mapping_the_gate_refuses (gate refusal -> copy made,
announced, CPU writes copied in and a fill merged back over the udmabuf pages).
- Negative control on msi: with the fallback disabled the two new copied tests and the new
device test FAIL (the device test at the buffer's refusal); restored, PASS.
- macOS (M3 Max, MoltenVK, under maclock): copied, copied_device, host_memory 25/25; plus
degradation, catalogue and fast_paths 45/45.
- clippy -D warnings clean: macOS plain and --cfg m2v_gpu; Linux (msi) plain and
--cfg m2v_gpu, runtime crate, all targets, all features. rustdoc -D warnings clean (runtime).
- Cost, release, msi: one add of a 64 MiB udmabuf range 15 ms (the failing kernel read 6 us,
the mapping query 22 us); each comparison of a 64 MiB copy 22-41 ms on the CPU; on NVIDIA a
live 64 MiB copy makes each empty command buffer's commit and wait 45-68 ms (0.2 ms without).
- Not run: the Mac's Linux container exposes no /dev/udmabuf.
RUNTIME_VERSION 1698 at landing.
One work packet, landed as 2 commits on archive/development-linear-2026-10-29: 1612481fb3, then 95852120a3 (the re-pin).
|
||
|
|
63859d8cc1 |
Sum emulated filters' taps in the device's arithmetic
Rule 1: where the device has a native form it is the only form. The emulated filters reproduced Metal's datapath bit for bit: a 2^-16 Catmull-Rom weight table, two-word integer sums truncated onto grids and rounded half up, exact quotients, ties-away half rounding, a 12-bit sRGB grid snap, 64ths of a level and 256ths of a blend, and the anisotropic filter's piecewise log2 and chord exp2. All of it is gone. Bicubic (lower/sampler/bicubic.rs, bicubic/routines.rs): - One routine, `Plane::sum`: Catmull-Rom weights computed in f32 from the fraction (vec4 Horner), the sixteen taps summed by the device's multiply and add, rows then columns; Metal's bilinear rule (32-bit float formats, a level under four texels) is the device's FMix of the four inner taps already fetched; UNORM/SNORM clamps. - 1D: `Line::sum`, the device's FMix of its two taps. - An 8-bit sRGB twin's taps are the device's transfer, not the 1/4095 grid. A half result is the device's narrowing (`narrow::round`), not ties-away. - Kept: Metal's footprint, addressing, mirror pin, filter selection, `Quad::exact` (in-place YCbCr's filter, owner form H, not touched). - Deleted: the weight table routine, the exact/half/accumulated plane and row routines, the block and float-quad routines, their words and specials; metal::bicubic's test-only table and its test. Extended range (lower/sampler/extended.rs): - Linear, 3D and the linear mip filter's level blend decode their taps through xrconv's functions as they are, then FMix in f32 at the f32 fractions; the level weight is the f32 fraction, not 64ths; a half result is the device's narrowing. Bicubic clamps into the format's decoded endpoints. The in-place decode keeps `Quad::exact`. - Deleted: the step tables' callers (steps_of, step, level_taps, half_of) and, in xrconv's extended_range.rs and texel_round.rs, the helpers only they used (STEPS_WORDS, has_steps, steps, step_grids, ratio_by_255_to_f32, normal_half_bits; minimal edits in another lane's files). Anisotropic (lower/sampler/anisotropic.rs): - The device's Log2 and Exp2 replace Metal's piecewise log2, chord exp2 and truncations; the level and spacing are not rounded to 256ths, 4096ths or a 6-bit mantissa. - Each tap is one explicit-level sample: under a linear mip filter the fractional level, which the device's own linear mip filter blends. The two-samples-a-tap form existed because an RTX 3090's blend of a fractional level is not Metal's (1.03 codes off without anisotropy); under rule 1 that blend is the device's. A nearest mip filter's level stays whole (the 3090's anisotropic sampler blends the next level at a fractional level whatever its mipmap mode). - Kept: Metal's length, tap count thresholds, floor(256/n) weights, kappa fit and direction. Notes: PrecisionNote::BicubicFilterArithmetic is reused, broadened to the extended-range linear, 3D and level blends (select.rs records it); AnisotropicFilter's doc names the device's logarithm and blend. No new variant, no ARTIFACT_FORMAT_VERSION bump. FAST-PATHS: the two "not built yet / none known" bicubic rows are now one device-gap row (the device's sum is the form); the known-gaps bullet loses the sRGB grid snap. API.md's catalogue entries rewritten. SEMANTICS_VERSION 1922 -> 1923. Tests: the plane routine's interpreter differential against an f32 Catmull-Rom reference in the routine's order (fails on the old table and integer sum), the line routine's FMix, the routines' word bounds; engine_bicubic against the polynomial within 2^-18 (+ half ulp); extended-range engine tests compare within the filter's bound (`filtered_close`); xr_bicubic's `near` adds Metal's table's deviation from the polynomial (WEIGHTS_BOUND 2.1e-3); anisotropic and bias-reach tests count one sample a tap and two Exp2 per emulation. Lanes and the conformance suite: - runtime_lane::extended_range_samples compares linear samples within `xr_bicubic::filtered_close` (moved to devtools from the engine test, which re-exports it); two_plane_samples holds the digest of nearest cases only (a linear one's values are compared by the conformance suite's xr-two-plane-samples cases). - runtime_lane::anisotropic_filter's bounds re-measured on the M3 Max with samplerAnisotropy withheld: linear 10.375 codes max (mean 0.21), nearest mean 0.82 and 6.7% of channels a code or more off, clamp to edge 6.531 max. Other devices not measured. - conformance: the XR two-plane-samples and extended-range/padded extended-swizzles cases declare bicubic-filter-arithmetic; 32 known-gaps rows (Apple M3 Max) for the linear sites the device's FMix moves. - runtime-sources.sha256 re-pinned: metal/bicubic.rs lost its test-only table and docs; no run's behaviour depends on it. Verified (this M3 Max, macOS 27.0.1): metal2vulkan + devtools suites, 3302/3303 passed (golden_hashes_match_the_table fails: 1001 cells moved, not blessed). Module words of a bicubic sample (ANV Iris Xe profile): xr_bicubic xrb_edge 12990 -> 2093, a2_bicubic_weights 15731 -> 3858, bcx_rules 30727 -> 11388; anisotropic emulation (vk12-floor) 2705 -> 1884. Also in this packet: the padded 10-bit formats' linear samples join the known gaps (d326b293c0), and the conformance coverage document is regenerated for the filter rows. Anisotropic emulation (devices without samplerAnisotropy only) now takes the device's Log2/Exp2 and level blend, and Metal's spacing roundings (r' to 256ths, g*S to 4096ths, S to a 6-bit mantissa) are gone with them: on the M3 with samplerAnisotropy withheld, linear reads up to 10.4 codes from Metal (mean <= 0.21), bounded in runtime_lane/anisotropic_filter.rs. One work packet, landed as 2 commits on archive/development-linear-2026-10-29: abc366a2fa, then 8f506cb2fd (the re-pin). |
||
|
|
20287666c0 |
Blend extended-range attachments in the device's arithmetic; drop the 32-bit float Metal blend
Rule 1 (owner, 10-29): where the device has a native form, it is the only form.
An extended-range attachment's raw codes are something no blend unit reads, so the
shader still blends it (capability), inside the pixel interlock or over lavapipe's
input attachment. Its arithmetic used to be Metal's compiler's: lerps, common
factors, fusing by factor rank, half rounding at every step, a separate float4
model and computed-output tables. Now it is a blend unit's arithmetic: S*Fs op D*Fd
in float, in the order of the blend equation, with the source, second source and
blend color clamped to the form's range first (`extended_range::blend::native`).
- computed.rs is deleted. blend_color.rs keeps only the two source ranges.
- input_blend.rs and fetch.rs call native().
- The blend color is pushed as raw f32 bits (HalfBlendColor), so
PushField::BlendColor is gone.
- Every blended extended-range output that stores a channel now records
ExtendedRangeBlendSource (half) or ExtendedRangeFloatBlendSource (float).
- The refusals ConstantColorDifference, SrgbForm and FloatOutput are gone, as is
the fast-math DualSource refusal for extended range. Every factor, operation
and mask is built; only outputs other than four half or float lanes are
still refused (Output).
The 32-bit float storage-form blend (`Blend::float32`, `fetch::float32_blended`)
computed Metal's fused forms in float. Every committed profile except
roadmap-2022 and vk12-floor sets COLOR_ATTACHMENT_BLEND on R32/RG32/RGBA32_SFLOAT,
so that form copied Metal's bits where the device blends natively. It is removed:
- a fetched 32-bit float attachment takes the generic float blend
(UnmeasuredFetchBlend);
- one that is not fetched gets the device's blend after the pass splits.
The float4-output paths of the half/unorm8 model (Atom::Sf, Arith::Kept,
round_inner, Blend::float/narrow/takes_float) were dead after this and are pruned.
Removed:
- the Metal blend-table validation lane (extended_range_blend_table.rs)
- devtools xr_blends
- the xr_blend_table*.txt fixtures
- lower/arith/tests/blend32.rs
- the extended_range tests that pinned Metal's forms
Added:
- every_blend_is_the_devices_arithmetic: every form, 19 factors, 5 operations,
rotating masks and adversarial sources, bit-exact against a float model of
S*Fs op D*Fd
- every_blend_is_built_but_a_placeholder
Docs:
- FAST-PATHS: the "Metal's rounding per shape" fast row is removed. The
extended-range blend is now a device-gaps row with the two notes. The
32-bit float row and the interlock section are fixed.
- artifact.rs note docs and the API.md catalogue are rewritten.
- REFUSALS is regenerated, reach.tsv updated and api_signatures blessed
(removed ExtendedRangeBlend::{ConstantColorDifference, FloatOutput, SrgbForm},
PushField::BlendColor).
- Conformance: the two notes join replay::NATIVE_NOTES, and 16 Apple M3 Max
known-gaps rows hold the xr-blend add/premul sites the device's arithmetic
moves: one code, two at the sRGB premultiplied sites.
- SEMANTICS_VERSION 1923, ARTIFACT_FORMAT_VERSION 479.
Size: a premultiplied half4 fill into RGB10A8_2P_XR10 on moltenvk-m3 goes from
3275 to 1937 SPIR-V words (the blend itself from 2133 to 795). The float4 fill
goes from 3435 to 1951 words, and BGRA10_XR_sRGB premultiplied from 7992 to 6654.
Verified:
- metal2vulkan lib, touched modules: 511/511.
- Sabotage: rounding the source to half in native() fails
every_blend_is_the_devices_arithmetic; restored, it passes.
- clippy, plain and with --cfg m2v_gpu; rustdoc -D warnings.
- M3 Max conformance replay of 25 cases: half-output-blends-*,
blend-interaction-format-float32 and xr-blend-*-one-zero are justified; the 16
xr-blend add/premul sites are held by the new rows.
The replay exits 0 with the ledger held exactly. The conformance crate
passes 1007/1007, CONFORMANCE-COVERAGE is regenerated, and runtime
degradation/catalogue and api_signatures/api_surface/refusal_surface pass.
- M3 device tests (memcap + maclock, --cfg m2v_gpu): 11/11 of
runtime_lane::extended_range_blends and framebuffer_fetch::generic_blend.
The renamed blends_of_half_outputs_into_extended_range_texels asserts
Metal's bytes for one-zero and prints the 16 add/premul outputs the device's
arithmetic moves.
One work packet, landed as 2 commits on archive/development-linear-2026-10-29: 808143ef80, then 18431ee908 (the re-pin).
|
||
|
|
442a9fd538 |
Bind no-copy objects over one run of guest RAM in the device's chunk import
The NVIDIA chunk route's API (HostRam, Device::use_host_ram, HostMemory::with_runs), the chunk
source and one-run route, and a chunk-bound buffer's out-of-bounds writes held to the device's
own containment (a device test and a known gap).
One work packet, landed as 7 commits on archive/development-linear-2026-10-29, in order:
* Add HostRam, Device::use_host_ram and HostMemory::with_runs (d3617f7e1d)
The API of the NVIDIA chunk route (guest RAM imported whole): the types the
chunk source, the GPU copy and the rebind lanes build on.
- HostRam (unsafe new(ranges, keep_alive)): the consumer's guest RAM ranges,
checked as non-empty, whole host pages, within the address space and apart;
a typed refusal otherwise (Invalid, Problem::HostRam). with_dirty_pages
takes one DirtyPages log for the whole RAM whose offsets are host addresses
(the log's pointer is 0), so one stamp per commit can serve every copy. The
keep-alive is dropped with the HostRam (forgotten while the process exits).
- Device::use_host_ram(&Arc<HostRam>) -> HostRamUse: a guard, since runtime
devices live for the process while a lease promises its RAM for one guest
device's life. Dropping the guard ends the use; a later RAM may be used
after. Several RAMs whose ranges are apart may be used at once; one whose
ranges meet a used RAM's (itself among them) is refused as misuse
(Invalid, Problem::HostRam). A device without VK_EXT_external_memory_host
is refused (Unsupported, naming it).
- HostMemory::with_runs(RunResolver): RunResolver is
Arc<dyn Fn(start, len) -> Option<Vec<Range<u64>>> + Send + Sync>, asked with
the import window, answering host addresses in the RAM's ranges. Stored
here; the routing that calls it comes in a later commit.
No Metal counterpart for any of it; the doc comments say so. The chunk import
itself (lazy 64 MiB chunks) and the routing in buffer_over_host_memory follow.
Verified: cargo clippy -p metal2vulkan-runtime --all-targets --all-features
-D warnings (Mac); host_ram unit tests 4/4 (range checks, refusals,
keep-alive drop); api_signatures and refusal_surface 7/7 after the re-bless
and regeneration; rustdoc -D warnings for the runtime crate.
* Re-pin the runtime sources at the landing tip (22c47609a9)
* Bind no-copy objects over one run of guest RAM in the device's chunk import (7f07d19b3d)
What: the chunk source and the one-run route (host_ram.rs).
- Chunk source: a device that uses a HostRam imports it by host pointer in
64 MiB chunks (CHUNK_BYTES), never across a range's end, lazily. Each chunk
is imported the first time an object over it is made, on that thread, once,
under a lock of its own (ChunkSlot). It goes through the existing
Memory::import_host: a coherent type, and the device-address flag where
bufferDeviceAddress is on. A whole-chunk VkBuffer is kept for the runtime's
own copies only, never named by a Metal buffer, root entry or binding.
- Chunk lifetime: chunks are never released while idle (they are no
HostImport, so host_residency never sees them). Once the HostRamUse is
dropped, a chunk is freed when nothing holds it: Placement gains ram_chunk,
so every buffer bound in a chunk holds it, and every command buffer that
used one does too. The RAM, and so its keep-alive, goes after the free
(release_then's after), dropped as the program's. Exiting leaves it all to
the process's end.
- Routing in buffer_over_host_memory: a buffer that lies in a live import of
the same bytes is unchanged. Otherwise, where the device uses a RAM and the
memory has a resolver, the resolver is asked once with the import window, on
the calling thread with no lock held, before the writability query and the
gate. Memory whose GPU writes bit 24 drops is never routed.
- One run inside one chunk: Device::bind_in_chunk makes the VkBuffer with
host_buffer against the object's own window, checks it with binds_in
against that window, and binds it at run offset + binds_in offset in the
chunk's memory. That offset must be a multiple of the buffer's alignment,
and the buffer must allow the chunk's memory type. Its placement
(Placement::ram_chunk) holds the chunk and maps the caller's pointer, so
contents stays the pointer. The buffer gets no import of its own, the gate
is not asked, and buffer_of keeps the import fixed (no Again).
- Several runs, a run crossing a chunk's end, a chunk that cannot be imported
or a buffer that cannot bind exactly: today's gate path (import, or copy
where the gate refuses).
- The RAM and runs are kept on HostPages (ram_runs) until rebind or release,
for the GPU copy lane.
- An answer that is not whole pages of one used RAM totalling the window is
refused: Invalid, Problem::HostRam.
- Heaps over host memory take the same routing (of_heap goes through
buffer_over_host_memory).
- rebind_host_pages only ignores the new HostParts.runs (`runs: _`). The
rebind lane asks the resolver there with Device::route_runs and
bind_in_chunk.
- New WorkCounts: host_ram_chunks_imported, host_ram_chunk_bytes,
host_ram_chunks_live (a gauge), chunk_bound_buffers_made.
- Docs: HOWTO "Guest RAM imported whole", the runtime README's extension list.
RUNTIME_VERSION 1697 -> 1698.
Why: the NVIDIA route (the consumer's spec). On a device that refuses
dma-buf views, each import of scattered guest pages takes a kernel mapping per
page, past vm.max_map_count at 4K. One-run objects bound in chunks take none.
How verified (this Mac, M3 Max, MoltenVK, under memcap + maclock):
- host_ram unit tests 8/8: chunk spans and lookup; one run in a chunk, a
chunk's last pages and a range's short last chunk; several runs and a run
crossing a chunk (gate path); broken answers refused.
- New device tests tests::host_ram_device 6/6. The path ran: the log prints
"chunks imported 1, chunk-bound buffers 2".
- One run binds in the chunk: 1 chunk import of 64 MiB, 0 pointer imports,
gate not asked, contents == pointer, the GPU reads the bytes, a fill
reaches them, a second buffer in the chunk imports nothing.
- Containment: a 1.5-page buffer's copy reach <= its 2-page window, and a
fill of all of it leaves the sentinel page before and the bytes after it
unchanged.
- A no-copy heap binds in the chunk.
- None, two runs and a crossing run ask the gate once and import; short and
outside answers are refused.
- A command buffer held behind an event keeps the chunk (live gauge, and
the keep-alive not dropped) after the buffer, the use and the RAM are let
go of; once it completes the chunk is freed and the keep-alive dropped.
- The same RAM twice and an overlapping RAM are refused, a RAM apart is
taken, and a new RAM over the same ranges is taken after the first use
and imports again.
- Regression on the same Mac: 249/249 for
host_|copied|dirty|rebind|heap|no_copy|dma_buf|in_place|detach|alias|
degradation|profile (copied_device, dirty_pages_device and the
host-import tests among them).
- clippy -D warnings plain and --cfg m2v_gpu (runtime, all targets, all
features); rustdoc -D warnings for the runtime; api_signatures 3/3 after
the re-bless.
Not run here: NVIDIA (msi 5080) and lavapipe; dma-buf devices' own tests
beyond the Mac's.
RUNTIME_VERSION 1699 at landing.
* Re-derive the generated documents at the landing tip (a9c042f142)
They are generated from the whole case set, and the set grew on `development`
while this branch was in flight, so the copy committed here counted a smaller
one.
Verified: regenerating at this tip leaves no change beyond the `Generated at`
stamp.
* Re-pin the runtime sources at the landing tip (2cfd8d6ef9)
* Hold a chunk-bound buffer's out-of-bounds kernel writes to the device's own containment (1b09d84fad)
What: a device test (tests::host_ram_device) whose kernel, the owned fixture's
scale_and_offset, writes three pages of words through a one-page buffer bound
in a chunk of guest RAM. It asserts that the page before the buffer and the
pages after it keep a sentinel, and that the kernel wrote the buffer itself.
The page-after assertion applies wherever the device keeps the same write,
through a one-page buffer of its own, out of the buffer made after it: the
chunk binding is held to the device's own containment, measured in the same
test. A known gap in docs/FAST-PATHS.md records the device that does not
contain such writes.
Why: containment (c) of the route. A chunk-bound VkBuffer ends at the
object's last page, but the chunk's memory goes on past it, so containment
rests on the device's buffer robustness or in-shader checks, not on the
import's end as a per-object import does.
Found and how verified:
- RTX 5080 laptop (NVIDIA 615.71.09), msi, one hold 06:00-06:02, strict form
(no device check): host_ram_device 7/7. The chunk's pages after the buffer
were untouched.
- lavapipe (linux-gate, slot lava, arm64), strict form: 7/7.
- M3 Max (MoltenVK 1.4.2), this form: 15/15 host_ram tests. It prints that
out-of-bounds writes changed 32720 bytes of the device's own next buffer and
32720 bytes of the chunk's next pages. A control run (not committed) showed
that a no-copy pointer import of one page changed 0 bytes past its page. So
MoltenVK's gap is within an allocation; it predates the route, which
inherits it.
- clippy --cfg m2v_gpu -D warnings (runtime, all targets).
Also: the RunResolver doc no longer says rebinds ask it; they do not until rebinds are routed (af9f1e057d).
* Re-pin the runtime sources at the landing tip (60c300198f)
|
||
|
|
d8159532be |
Declare decoded-texel-precision in the 4:2:2 chroma-pair cases
What: the six chroma_pairs cases (chroma-pair-copies, -texel-reads and
-texel-samples, each of gbgr422 and bgrg422) now name
Degradation::DecodedTexelPrecision among their notice declarations, at the
notices site alone, as astc_textures, etc_textures and
texture_descriptor_pairs do. No value is loosened. The module docs no longer
count the allowances as three and one.
Why: since
|
||
|
|
9bd91540f4 |
Take the device's answers for fast atan2, half fmod and precise pow's NaN; delete exact sRGB leftovers
- fast::atan2 without every fast-math flag divides by the device's own
reciprocal of x; past 2^126 the denormal it makes is the device's
(DeviceDenormals through MetalFloatDenormals; NativeDivision as before).
FastAtan2 { reciprocal_flushed } -> FastAtan2 { by_reciprocal }.
- A half fmod answers its float remainder rounded; the Metal zero-sign
select is gone and the call records NativeTranscendentals through
FloatFn::half_zero_of_float.
- Precise pow's NaN is classed BaseToExponentOne, so it records
NativeNanEncoding like fast pow and atan2 (the measured() exclusion
was left over from the removed pow(x,1) bit fix). Fast sin/cos keep
DeviceNanEncoding on purpose: Metal answers +0 there, no NaN to stand for.
- Delete the exact sRGB pack/unpack's dead code: ArithPlan::srgb,
Declared::srgb, SRGB_PACK/SRGB_UNPACK, srgb::TABLE_WORDS,
math::unpack's normalized and sRGB branches (UnpackRounding,
unpack_rounding, mul_exact, unpackable), word::srgb_code.
WordAttachment::output_word returns Option<u32> (None for Srgb8).
With the mipmap filter on the transfer (c9dd35e8a4), srgb's declare/
word/step and SRGB_ENCODE_FIRST lost their last users and go too, with
their texel_round test; SRGB_DECODE_STEPS stays for the ASTC and PVRTC
decoders.
- FAST-PATHS: row 58 names half fmod; known gaps lose the atan2 and
half-fmod lines. API.md: native-transcendentals, native-nan-encoding.
- SEMANTICS_VERSION + 1.
Verified: fmt, clippy (all features, m2v_gpu), rustdoc; metal2vulkan
arith/word/fast_paths 241/241, engine call notes + public fixture
expectations 20/20, api_signatures+api_surface 15/15, runtime 29/29,
validation c3 72/72; the atan2 tests FAIL on the old flushed reciprocal.
No conformance case reaches atan2, fmod or pow. Golden hashes: 21 rows x
19 profiles move (fast_atan2.f32 and fmod.f16 fixtures), re-blessed on
development.
One work packet, landed as 2 commits on archive/development-linear-2026-10-29: abb2b3db6e, then f76cdba457 (the re-pin).
|
||
|
|
a6c58e923f |
Re-record the conformance cost records under record at the call
The M3 Max's and MoltenVK's cost records re-recorded under recording at the call's counts.
One work packet, landed as 3 commits on archive/development-linear-2026-10-29, in order:
* Re-record the conformance cost records on the M3 Max after recording at the call (5556145b53)
Since 6c9d1f4551 `commands_recorded` counts each command at its call across
every command buffer, the scheduler's barrier buffers and primaries begun
ahead included, and the deferred-replay counts (`command_buffers_deferred`,
`command_buffers_replayed`, `command_buffers_replayed_inline`) are gone. The
MoltenVK cost records still held begin/end/barrier bounds from the old,
narrower count, so a replay read them over.
Gate rules first (cost.rs's reported-never-gated table), from replays of
eight-round whole-set measurements that went over on counts that say when a
thread ran or how long the driver took, not what a case did:
- `submit_stalls_on_work` / `submit_stalls_idle` (ELAPSED: a 2 ms threshold;
moved in 160 cases across the measurement's rounds);
- the seven `heads_held_for_*`, `heads_waiting_at_their_gate`,
`heads_awaiting_check_signals`, `batches_held_past_a_look` (LOOKS: counted
at every look of the scheduler's thread; moved in 119 and 51 cases);
- `commands_recorded.begin_command_buffer` (BEGUN: counts the primaries a
completion thread begins ahead, the race `primaries_begun_ahead` is
reported for; moved in 238 cases). `command_buffers_begun`, the case's own
begins, stays gated.
Re-recorded on Apple M3 Max (macOS 27.0.1, MoltenVK 1.4.2), debug build,
through the FIFO Mac GPU lock and memcap.sh:
- `conformance cost --runs 8 --write`, the whole set (1,122 cases: 1,112
measured, 10 the venue's recorded refusals), one lock hold; taken three
times as the rules moved (10m40s, 10m49s, 14m23s); these are the third.
- `conformance cost --alone --runs 8 --write` over every case (every stored
alone reading of `commands_recorded.*` was of the old count): 29 holds of
40 cases, 898 s held, the longest 78 s.
Bounds: `end_command_buffer` rose in 784 records, `cmd_pipeline_barrier` in
751; the three removed counts left every record. Composed counts 11,480 ->
14,425; every record that holds bounds carries its contrast. The README no
longer names `command_buffers_deferred` as a gated total.
Verified: conformance `cost::` tests 10/10, suite 1007/1007; two whole-set
replays on the committed records: 1,112 within, 10 unmeasured, 0 over (the
replay still exits 1 on six 4:2:2 chroma-pair cases announcing
`decoded-texel-precision` undeclared, from
|
||
|
|
9c1df394ef |
Name the per-kind command counts for what they count: commands_recorded
Since recording at the call (6c9d1f4551) there is no deferred replay: `WorkCounts::commands_replayed` counts each command as it is recorded, into any of the device's VkCommandBuffers (an encoder's, the scheduler's barrier buffers, primaries begun ahead), on whichever thread. The name said "replayed", which is now wrong, and the consumer said it is free to rename. Renamed, values and behaviour unchanged: - `WorkCounts::commands_replayed` -> `WorkCounts::commands_recorded` - `metal2vulkan_runtime::CommandsReplayed` -> `CommandsRecorded` (its per-kind members are the Vulkan commands' names, which stay) - validation's `runtime_lane::commands_replayed` module -> `runtime_lane::commands_recorded` - host_ab's `replayed_<command>` work-count names -> `recorded_<command>`, and percall's `rt_replayed_cmd_draw_indexed_at_commit` -> `rt_recorded_cmd_draw_indexed_at_commit` - the prose that called these commands "replayed" (cost.rs's regions and speculation classes, the lanes' printed lines, the conformance README) `replay_logs_kept`, `replay_log_bytes` and `replay_tables_pointed` keep their names: they count a rebind's re-encoding from logs (`replay.rs`) and the GPU replay of indirect command buffers, which are still replays. Conformance's recordings use the names as their counts' keys: 806 of the 1,123 recordings carry 14,928 `commands_replayed.<command>` keys, rewritten mechanically to `commands_recorded.<command>`. Verified by a script over every changed file: the parsed JSON equals the old with the key renamed, every map keeps its key order (still sorted), and the bytes equal the old with only that substring replaced. No value moved; the re-record of the cost bounds is the next commit. api_signatures.tsv re-blessed (the WorkCounts field). Nothing keys on the field's name at run time: the cost half derives its count names from the field names (`Counts`), and the recordings move with them in this commit. No version bump: runtime behaviour is unchanged. Also: the resident-writes lane test (replayed_draws_of_functions_that_write_nothing_write_no_resident_buffer) measures after the device's first-use work: since recording at the call its barrier count includes that work, so the first run read [8, 6] on the M3 (3/3); it now compares a second one-command run, its window opened before the first encoder. Fails 3/3 before, passes 3/3 after. One work packet, landed as 1 commit on archive/development-linear-2026-10-29: 03bb49f57c. |