fc8809d849e2e5b72f3e89c2d12cd4eafa61ea44
36
Commits
| Author | SHA1 | Message | Date | |
|---|---|---|---|---|
|
|
fa5d051b64 |
Translator: the two-word 64-bit integer forms deleted; every profile holds 64-bit integers in u64s
What: the arithmetic family's word form of 64-bit integers is deleted: Held::Wide and every arm on it, lower/arith/wide.rs (its word arithmetic, division, casts and lane moves) with its tests, ArithStrategy::Wide and ArithPlan's wide and divides, the profile's wide forms (wide_form_on, wide_demote, widen, widen_const, holds_wide), the two-word switch selector (SelectorForm::Words), the chunked vector's two-word lanes, the ulong texel's word form (TexelConv::U64Words loses its flag), the matrix descriptor's word form, and in the access family the two-word address (pointer.rs's Address enum and its helpers, the handle table's word entries and HandleIds, psb.rs's word base). The helpers the u64 paths still use move to arith/ops.rs (low_word, zext_word) and access/psb.rs (Pair, split). Every !int64 refusal goes with them: Feature::Int64Arithmetic, and Feature::PointerCompare, whose one producer was the static guest plan's !int64 arm. LeafCaps::int64 is deleted, and the mesh fold no longer asks for shaderInt64. BinOp::ISubBorrow, which only the word subtraction built, goes with its interpreter and builder arms (the grammar's Op::ISubBorrow stays in spv.rs). Why: Device::from_queries refuses a device without bufferDeviceAddress and shaderInt64 (IdentityDomains), and it is the only way to make a profile, so every profile has shaderInt64 and every arm deleted here was unreachable. This commit's parent is the last that holds the word form. Consumer search: reims-vgpu development cadac770c2 plus its steelbrain refs younger than a day (190 refs): 0 hits each for Int64Arithmetic, PointerCompare, LeafCaps and leaf.int64. The profile's fingerprint changes on every device (the field leaves the profile's Debug text), so the golden cells read "profile changed" until the table is re-blessed; no key stays unchanged, so SEMANTICS_VERSION does not move. The module words do not move: the u64 paths emit the same instructions in the same order (the uvec2 the slot offset builds is the same type the word form's type helper made). Tests: chunk.rs keeps the chunked lane-move and fragment-shuffle bound tests, on 64-bit and 32-bit lanes held whole; the selector test drops the word cases; the tests that asserted or filtered on the int64 field or Int64Arithmetic drop those lines; the dynamic move between slots runs L3 on every profile. docs/API.md (the object grid's needs), docs/REFUSALS.md, scripts/refusal-surface/reach.tsv and tests/api_signatures.tsv are updated; runtime-sources.sha256 is re-pinned. Verified: job m3-max-84770 at this commit (CPU only; the device steps on lavapipe): clippy plain, --cfg m2v_gpu and --cfg m2v_cpu_icd EXIT=0; rustdoc EXIT=0 and private-item docs of five crates with 0 diagnostics; the translator's suite 2,594 of 2,595 passed, 20 skipped, the one failure golden_hashes_match_the_table (28,950 cells under a changed profile fingerprint, 0 changed under an unchanged key); air, runtime, devtools and harness 872 passed, 4 skipped; validation 1,348 passed, 2 skipped; conformance 1,053 passed; doctests passed; the conformance replay on lavapipe EXIT=0 with 0 ledger drift lines; the refusal-surface and signatures checks EXIT=0. The golden and engine inventory lists at the parent and at this commit show 0 computed cells moved and no inventory line. |
||
|
|
31d8a874f1 |
Translator: the Floor buffer access deleted; every profile reaches buffers by address
What: BufferAccess and ProfileFields::buffer_access are deleted with every Floor arm:
the refusals that named addressed_needs (the Floor arms of DereferenceLoadedPointer,
Int64Atomics, GpuEncodedIndirectCommands in the indirect-command, replay and execution-range
paths, the de-indexed and private list forms, and the addressed function tables), the
memory planner's addressed flag and its loaded-pointer refusal, the plan's needs (MemNeeds:
that refusal read its dynamic_roots, and the handle classes beside it had no reader since the
handle table went), provenance's dynamic_deref field, the Floor mechanism of
RuntimeFact::FunctionTableRange, the Floor values of MetalDeviceProperties (argument buffers
tier, max buffer length), and the null pointer's static escape that only a profile without
device addresses took. Public items gone:
DeviceProfile::addressed_needs and Feature::{ArgumentBufferPointers, PointerToInteger,
BufferRange}, whose only producers were those arms.
Why: Device::from_queries refuses a device without bufferDeviceAddress and shaderInt64
(IdentityDomains), and it is the only way to make a profile, so no profile is Floor: every
arm deleted here was unreachable. This commit's parent is the last that holds the Floor form.
Consumer search: reims-vgpu development f054ad57c1 plus its steelbrain refs younger than a
day (188 refs): 0 hits each for addressed_needs, ArgumentBufferPointers, PointerToInteger
and BufferRange.
The profile's fingerprint changes on every device (the field leaves the profile's Debug
text), so every golden cell reads "profile changed" until the table is re-blessed; no key
stays unchanged, so SEMANTICS_VERSION does not move.
Devtools: the fuzz Target loses its addressed flag; the pointer-select generator draws the
loaded form on every target, the same draw a target with device addresses made.
Tests: the memory plan tests ask whether a buffer pointer is wide in place of the needs, and
drop the handle-table asserts; the profile tests drop the field's asserts (the max buffer
length test keeps its allocation-limit arm); the pointer-cell tests no longer accept
PointerToInteger; the atomic, kernel stage-in and tessellation tests no longer filter on the
field.
docs/REFUSALS.md, scripts/refusal-surface/reach.tsv and tests/api_signatures.tsv are
regenerated; runtime-sources.sha256 is re-pinned.
Verified: job m3-max-84770 (CPU only, no card): the golden and engine
inventory lists at the parent and at this commit show 0 computed cells
moved of 28,950 (every cell re-keyed by the profile fingerprint, which
this commit moves) and no inventory line. The stack's tip ran the whole
gate (see its message).
|
||
|
|
9211eb3c10 |
Translator: half +, -, *, / and fma on the 16-bit instructions record NativeHalfConversion
Under the 16-bit float controls, a half +, -, * or / and a half fused multiply-add run on the device's 16-bit instructions, between exact conversions. By the Vulkan spec their results are Metal's. A driver's compiler may still compute them in float and leave them unrounded. Intel's Windows driver 101.2145 on a UHD Graphics 630 does: - A standalone tree of three 16-bit OpFAdds, or Fmas of a product, each decorated NoContraction under all three 16-bit controls, ran on 4,096 invocations. 2,284 sums and 4,080 products matched neither the half tree nor the float tree rounded once (job m3-max-83092). - The Iris Xe under Mesa ANV 26.2.6 gave the half tree on every invocation (job m3-max-83093). - In the runtime's quad test on the UHD, 112 of the 1,536 compared halves are the float chain rounded once at the store (job m3-max-82918). Per the planner's ruling, the operation carries the static note on every device, with no device check. narrow::computes_half_arithmetic looks in the emitted module for a 16-bit OpFAdd, OpFSub, OpFMul, OpVectorTimesScalar or OpFDiv, or a GLSL.std.450 Fma. Where it finds one, the pipeline records NativeHalfConversion, beside the conversion pair's existing cases. A Sqrt alone records nothing, and neither does the simdgroup half tree's ClusteredReduce. The note's reach in validation narrows to half arithmetic. Until now it reached every word fed by any float family. The AIR word scan now feeds a new family, HalfArithmetic, beside the operation's own family, from these operations: - an fadd, fsub, fmul, fdiv, frem or fneg with a half result; - a float cast whose result or operand is a half; - a call of a modelled family whose result or an argument is a half. NativeHalfConversion reaches only that family. A half word that only float arithmetic fed, through a move, is no longer reached. The note stays unbounded at the word, now on the comparison's stay-unbounded list with its reason. A driver may leave the chain unrounded and round it once at the store, and with cancellation the two answers differ by more than the stored value's ulps (40 codes measured on the UHD). How far rests on the operands, which a word does not carry. Docs: - The note's API.md catalogue entry and its PrecisionNote doc said those operations "take no such rounding". They now say the operations record the note, and give the UHD 630 measurement beside NVIDIA's fold and RADV's fusion. - The DeviceHalfDenormals entry points to it. - VALIDATION.md names the half family among those the word scan reads. Tests: - engine_native_half: the controlled-conversion test's sum kernel now records the note, as every kernel there does. - engine_float_call_notes sets the module-level note aside for 16-bit arithmetic, as it does for the conversion pair. - half_simd_reductions accepts, where the quad pipeline records the note, a quad word whose every half is Metal's or the float operations rounded once. The model is the new devtools quads_once. - In validation: - the scan's packed-halves test expects HalfArithmetic on the half word alone; - a words test shows the note reaching a half word only when half arithmetic feeds it; - the reach row is pinned. SEMANTICS_VERSION 2340 -> 2341 (precision notes added). ENGINE_EXECUTOR_ABI vulkan-engine-v215 -> v216 (the word scan feeds HalfArithmetic, and the note's reach narrows to it). Golden hashes: no cell moves. The cells hash the final SPIR-V, which the note does not touch. Job m3-max-83293 (Linux) ran golden_hashes_match_the_table twice: at this change, and with compile.rs and cache/mod.rs at |
||
|
|
7364fcd49b |
Tests: the half quad model's operation type named, for clippy's type_complexity
Clippy's type_complexity rejected the pair of function-pointer types in the quad model (`quads`), so the gate's three clippy configurations failed in metal2vulkan-devtools. The operation type is now the private alias `Operation`; the model is unchanged. Verified: the gate's clippy steps (plain, m2v_gpu, m2v_cpu_icd) rerun on this commit. |
||
|
|
e79b8d0fed |
Tests: Metal's half quad sums, products and quad prefix operations, on every device
Metal's quad_sum and quad_product of half operands are (x0 op x1) op (x2 op x3) with each operation rounded to half, and its quad prefix sums and products the lane-order chain over the quad's lanes with each operation rounded, the empty exclusive sum -0 and product 1. Measured on the M3 Max (macOS 27.0.1), fast math on and off alike, over the operands of metal2vulkan_devtools::half_simd_reductions, all 256 threads (m3-max-81130, our own MSL): those models match every thread; the float result rounded once misses 48 of the quad sums, 64 of the products and 6 to 25 of each prefix operation. half_simd_reductions gains a third kernel, QUADS: thread t takes entry t of SUM_OPERANDS and PRODUCT_OPERANDS and writes five words, its quad reductions, its quad prefix sums and its quad prefix products, then its simdgroup prefix sums and products. devtools::half_simd_reductions::quads answers the first three words from those models (a small exact half rounding of an f64 sum or product). Metal's simdgroup half prefix order matches none of the models (the lane-order chain, Hillis and Steele, and the float result rounded once miss 60 to 137 threads each), so those two words are written, not compared: they make the kernel a simdgroup user, which a device with subgroups narrower than 32 lanes (lavapipe's 8) runs on the emulated tier, quad operations included. The runtime's device test runs the kernel on every device beside the two simdgroup kernels and prints how many of the compared words differ. This is the test of the quad half step the next commit moves to the 16-bit instruction under the 16-bit float controls. Verified: cargo fmt only (this Mac runs no builds); the device runs are the timing job's correctness leg on the RTX 2080, the 780M and lavapipe. |
||
|
|
2695dca124 |
Tests: Metal's half simdgroup sums and products are trees of rounded half operations (red)
Metal's simd_sum and simd_product of half operands combine the lanes as a tree. In round d (1, 2, 4, 8, 16), each aligned block of 2d lanes holds its two halves' results combined and rounded to half, and a lane that takes no part counts as the identity. Measured on an M3 Max (macOS 27.0.1, our own MSL, fast math on and off alike): - sums: potluck job m3-max-80839; - products: m3-max-80879; - sums and products over three masks of active lanes: m3-max-80890. The tree matches every answer. The float result rounded once misses five of the eight sums, four of the eight products and ten of the 48 masked results. The tree over the active lanes packed together misses three masked sums. metal2vulkan-devtools' half_simd_reductions holds two kernels of our own AIR, the operands and Metal's answers: - half_simd_reductions: eight simdgroups summing and multiplying their lanes in a uniform block; - half_simd_reductions_masked: the same in blocks only a mask of lanes executes. Three tests run them: - engine_simd: the Direct tier at 32 lanes and the Cluster32 tier at 64, on the CPU interpreter. Red: those tiers fold the f32-held values with OpGroupNonUniformFAdd or FMul and round once. - engine_simd_emulated: the emulated tier's pairwise tree at every width, on lavapipe's and the floor's profiles. Its rounded combine is Metal's tree, so this test is expected green. - the runtime's half_simd_reductions: under a device cfg, every device of the cfg's kind. It prints the kernel subgroup sizes and each pipeline's precision notes. Verified: none of these tests has run yet; their jobs follow. cargo fmt only on this host. |
||
|
|
4da155fd34 |
Devtools: the Format enum's doc links to the write function, not the ambiguous write
`[`write`]` on the private Format enum (from
|
||
|
|
ab18b5cdcf |
Translator: LoweringInputs::word_bound_buffers holds a buffer bound at a multiple of 4 below its alignment to what its accesses need
What: a new lowering input, the buffer slots a dispatch binds where the address is a multiple of 4 and not of the argument's alignment (8 or 16). Under the identity domains such a device-address slot states RuntimeFact::AddressAlignment as its argument's alignment up to what its accesses need: 4 for words and wider units, 8 where a 64-bit atomic reaches it, and 8 for every such slot of a function whose 64-bit atomic goes through a wide pointer (AccessPlan::wide_atomics64). The slot's direct accesses claim no more Aligned than the address is held to: AccessPlan::aligned now maps each slot to that alignment, psb::Reach::Direct carries it, and whole_place declares the proven multiple of 8 or 16 up to it. A slot of alignment 4 or less is unchanged by the set. Why: a guest's system texture-decode kernel binds a 16-aligned argument's buffer at an offset that is 4 mod 16 (1871700), and the runtime refused it (Refusal::BufferOffsetAlignment). Plain Metal reaches each element of such a bind at its own address (an Apple M3 Max, macOS 27.0.1, probes/misaligned_buffer_binds.m). The unconditional form (steelbrain/offsetalign, 8ed59d496e) cost the 3090's constant_* rows 99-122 us -> 234-252 us (job 74651), so the relaxed form is a variant only a dispatch bound so compiles. The empty set leaves everything as it is: the key appends the set only when non-empty, the base's held alignment is the argument's, which is at least every proven offset alignment of its leaves (MemoryPlan::proven_align takes the base's twos), so min(proven, held) is the proven one, and note_reach's 8 for a 64-bit atomic is read only as reach.min(4) outside the set. No SEMANTICS_VERSION bump: no existing input's translation changes. Tests (not yet run): engine_word_phases a_word_bound_variant_claims_and_states_4 (vwp_vec16 claims and states 4 under the set, vwp_words's words unchanged by it) and vec16_answers_metal_bound_at_a_multiple_of_4 (the CPU interpreter, VEC16_AT_WORDS: the variant answers Metal's words, the plain module traps on its Aligned 16); engine_access_offsets a_word_bound_slot_is_held_to_what_its_accesses_need (plain 8/16 both ways; under the set 8/4, and 8/8 through a wide 64-bit atomic). devtools: VEC16_AT_WORDS and answer_at, from 8ed59d496e. api_signatures.tsv blessed (one field). |
||
|
|
4bcb58dbb1 |
Container: read a metallib of format 2.2, whose entries carry no MDSZ and which has no extended header
What: MDSZ is no longer a required function-entry tag. An entry without it holds its module from its start (OFFT) to the next module's start, the nearest larger bitcode start of any entry, or to the bitcode section's end for the last. And where a section holding bytes starts at the last entry's end, the library has no extended header and no extended tags. The entries' bitcode ranges are resolved once every entry's start is known (a new Entry, read from the tags, then with_bitcode). NAME, TYPE, HASH, OFFT and VERS stay required. The overlap, section-bounds and HASH checks are as before, and HASH is verified over the resolved range. Why: a guest's library, an app's precompiled metallib of format 2.2 from an older toolchain, was refused as Container(MissingTag) at its first entry, and every pipeline made from it was dropped. Its seven entries are NAME, TYPE, HASH, OFFT, VERS. The length rule comes from what the file itself states and is exact. In Apple's output every module is a bitcode wrapper padded to a multiple of 16 bytes, written right after the one before it, and MDSZ is the distance to the next module's start, not the wrapper's offset plus size (probe m3-max-73748, 4 of 4 modules). In the guest's file, read for structure only on its lab host (m3-max-73749), each HASH is the SHA-256 of the bytes up to the next module's start for 7 of 7 functions. The wrapper's own size gives that range for only 4 of 7, so reading it would have refused 3 with HashMismatch. Since HASH is checked over the range, a module of any other length is still refused. Behind the MDSZ refusal the same file met a second one: its public metadata starts right at the end of its function list (939), so there is no extended header, and the reader would have parsed the metadata as tags (BadTag). Metal takes such a library and runs it: m3-max-73748 made a library from our own MSL with MDSZ removed from every entry, at header 2.9 and 2.2, made all its functions, and ran both kernels and the render pipeline as expected, with MTL_DEBUG_LAYER on and off. Without any of the other five tags Metal makes no function that runs as written, so they stay required. Docs: mtlb.rs's module docs (the 2.2 layout, the length rule and why it is exact, Metal's answers); ContainerError::MissingTag's doc. No refusal kind, public type or cached artifact changes: a library that parsed before parses to the same functions. Fixture: metal2vulkan-devtools' metallib_2_2 writes the 2.2 layout (header 2.2 with os and os version 0, no MDSZ, no extended header) around the modules a test supplies. Tests: container::tests::format_2_2_entries_hold_their_module_to_the_next_start (padded and unpadded modules, the table equal to the MDSZ layout's, one entry without MDSZ among entries with it, a HASH of the unpadded wrapper refused as HashMismatch); malformed_function_tags no longer lists MDSZ; tests::format_2_2_libraries (three owned fixtures padded to 16 bytes, one past its wrapper's end, in metallib_2_2: same content keys, compile keys and SPIR-V words as in today's layout). Both new tests fail without the reader change (MissingTag). |
||
|
|
bc36b3775b |
Translator: a variable written or read by parts takes no store at a loop trip's top
spirv::carry stores an undefined value into a marked variable at each loop trip's top. Its domain was held only by what the structurizer marks (demoted and phi variables, which the emitter loads and stores whole); the pass itself followed access chains as reads and ignored partial stores, so a marked variable that a trip wrote by parts and the next trip read would have lost what the earlier trip wrote. The pass now leaves alone every marked variable one of whose pointer's uses is not a load or a store through it (an access chain, a phi, a terminator, any other instruction, a store of the pointer itself), and reads only loads through the variable's own pointer. Tests: - spirv/carry/tests.rs: a three-trip loop whose marked vec2 a trip writes through an access chain and the next trip reads takes no store; the same loop written whole takes one (the control). - The loop kernels move to metal2vulkan-devtools (loop_kernels): the vote loop a thread leaves early, a loop of three exits, and a nested loop whose outer loop has four exits and whose inner loop leaves both, each exit reading values defined on its own path, with their answers and trip bounds that reach every exit. The product's interpreter tests run them on six profiles; validation's new candidate test loop_exits runs them on the test device and counts the stores of an undefined value in the SPIR-V the dispatch ran (one or more for the exit kernels, none for the predicated vote loop). The structurizer's marked variables are accessed whole, so modules are expected unchanged; the lane's job compares the module hashes against the parent. |
||
|
|
92ce7950fc |
Docs: "the runtime", not "the new runtime"
There is one runtime, so the prose of the harness, validation, devtools,
the translator's lockstep module, .config/nextest.toml and the refusal
surface and conformance coverage generators says "the runtime"
(scratch newrt.py: a word replacement, identifiers such as new_runtime
and NewRuntime untouched). docs/REFUSALS.md and
docs/CONFORMANCE-COVERAGE.md are regenerated from the edited scripts.
Four harness passages said the runtime makes no heap and no texture
over a buffer, and has no Managed mode. The runtime has all three
(Device::new_heap_buffer and heap textures, Buffer::new_texture,
Device::new_managed_buffer); the harness's own backend refuses the two
texture sources. They now say the harness makes neither on the runtime,
and the Managed note names Device::new_managed_buffer. The refusal
strings keep the words the harness's described test matches ("makes no
heap", "makes no texture over a buffer").
Left: three fixture comments (.metal under validation's public
fixtures, whose text keys the golden tables and the committed AIR) and
scripts/matrix, whose keys (harness-new) carry the same naming.
Verified locally: the refusal surface, Metal coverage, conformance
coverage and API signature checks pass.
|
||
|
|
c6ff002ede |
Devtools: the carried-tree check's floor counts validation's sources alone
The check that the carried trees read the checkout through the runner's directory first asserts
that its walk found the trees, as a floor on the number of sources read. The floor, 500, counted
the old runtime's tests too; with that crate deleted the carried trees are validation's src and
tests, 372 files, and the test failed on the floor alone ("372 sources read") on host and lavapipe
(m3-max-58615). The floor is now 300, under today's count with room for files to move.
Verified: m3-max-58615 shows the failure at the old floor; the fix's run is the gate of this commit.
|
||
|
|
5d725aeec7 |
Delete metal2vulkan-runtime, with every test and script that read it
The cutover deletes the old runtime: crates/metal2vulkan-runtime and its workspace member go. Nothing in the workspace depends on it any more: the harness and conformance lost their old arms, and validation dropped its dependency in its own commit. Adapted in this commit, so no gate reads the deleted tree: - CI and scripts/linux-gate-ci: the crate's per-feature clippy group, its `-p` in the Windows clippy and the test step, and its private-doc-links row go. Packaging needs no edit: the workspace's published crates are now metal2vulkan and metal2vulkan-air. - The published-crates test lists those two; devtools' carried trees and the five nextest groups of the old crate's tests go. - scripts/api-signatures: the crate leaves CRATES, FLOORS and the header, its self-test trees name rt (read by the same rules), and the table is re-blessed (the old crate's 4555 rows go); api_signatures.rs pins the three crates left. - scripts/refusal-surface: the old crate's tree and its sections go (RuntimeGap, AppleOnly, Problem and the problem enums it forwards to), with their 87 reach rows, the `--delegations` verb and the test that counted the old Problem's delegations; docs/REFUSALS.md is regenerated. The basis check now holds rt's refusal enums alone, which it already required. - scripts/api-cost-coverage goes: it measured only the old crate's surface. - feature_vocabulary.rs: the old crate's two enable tables go; the Khronos and validation tables stay held to the vocabulary. - The conformance coverage generator's by-hand roots read rt instead of the old crate, and docs/CONFORMANCE-COVERAGE.md is regenerated (MTLResourceOptions' row, which only the old crate modelled, gives way to rt's MTLCommandBufferError). - scripts/matrix: the harness times the new runtime alone (`--runtime new`), so the rules that judged it against the old one go: the new-over-old budget with its floors (floors.tsv, gpu-floors.tsv), ceilings, card variance and status table (status.tsv), the frozen arm, the base spread and the timing once more it set off, the re-timed pairs, the five creation rounds and the old runtime's parked tests and records. A harness row's time is judged as a cross-GPU outlier, with its alone runs as before, and the frame and burst rows by their stored instruction counts; the creation rows run once, in their own process. docs/VALIDATION.md's matrix section says these rules. Checked locally (python, no build): signatures.py --check and --selftest, refusal_surface.py --check, --selftest and --missing-basis, coverage.py --check and --selftest, and scripts/matrix's 49 tests pass. The compile gate (fmt, clippy plain, --cfg m2v_gpu and --cfg m2v_cpu_icd, Windows clippy for gnullvm and msvc, workspace Rustdoc, packaging, the touched crates' suites on the host and on lavapipe) runs on this sha as potluck jobs that the landing note names. |
||
|
|
7708b4ba82 |
conformance, rt test: threadgroup memory read before the program writes it
The conformance case compute-threadgroup-memory-reads-zero runs tgz_reads in one compute pass: the [[threadgroup(0)]] region's length set once, then 2048 threadgroups of 256, of 250 and of 30 threads, twice each, each dispatch into its own 16-byte slot, so later threadgroups of a dispatch and the second dispatch run where earlier threadgroups stored their patterns. Its test holds Metal's recorded words equal to metal2vulkan_devtools::threadgroup_start::answer: nothing read nonzero before the program wrote it, every pattern read back, Metal's SIMD groups. The new runtime's device test every_device_reads_zero_from_threadgroup_memory_until_the_program_writes_it runs the same dispatches on every device and holds the same answer; at a size that is not whole groups of what the plain module runs, it holds that the emulated SIMD-group module was made and ran. |
||
|
|
1dc4565331 |
devtools: the kernel CPU list's parse is Linux's, built only with the Linux counters that read it
cpu_list (from
|
||
|
|
dd8d1fdf7b |
rt tests: the lock budget, locked instructions per added draw, bind and dispatch
An encoder call's success path executes no locked instruction, since one between two recorded commands flushes a write-combining command stream (about 490 ns on the RX 7900 XTX). Three GPU device tests now hold the encoders to that, each as a difference: a recording of 4,000 commands less one of 2,000, over the 2,000 added, so what a command buffer costs once (its begin, commit, submission and retirement) drops out: - draws: 2,000 draws more in one pass; - binds: 2,000 draws more, each with a vertex buffer and a fragment texture set before it, both alternating between two objects, so every set changes its slot; - dispatches: 2,000 dispatches more, each reading the one before's writes. The count is the whole test process's in user space, with inherited counters opened before the instance: the encoding thread's, the runtime's threads' and the driver's. Each length is recorded twice at the longer length to warm the rings, lists and pools, then 7 times each, alternating; the least count of each length is compared, and every round's difference is printed (`LOCKS <device>: ...`) with the bound, 0.02 locked instructions per added command. The CPU's event is the node's: `M2V_LOCK_EVENT` names it as perf names a raw event (`cpu_core/r21d0`, an Intel performance core's MEM_INST_RETIRED.LOCK_LOADS; `r1e25`, Zen 4's locked instructions). A node that names none prints LOCKS-UNMEASURED and passes. The test pins itself to the CPUs of the event's unit (a hybrid CPU's performance cores) before it starts the device's threads. devtools gains the counter it reads with: instructions::ProcessEvent (a raw event of the whole process in user space on one unit, named `<unit>/r<hex>` or `r<hex>`) and pin_this_thread, with tests of the name and CPU-list parsing and of rc0 (retired instructions on Intel and AMD alike) counting the fixed loop on its unit's CPUs. |
||
|
|
eb16d34f15 |
matrix: the instructions gate judges the new runtime's own threads, a driver's left beside
The burst rows' whole-process count swung by up to 25 million instructions per run between processes on NVIDIA, all of it in the driver's own "[vkrt] Analysis" thread, while rt's own threads held steady (48-50k instructions per command buffer on the 2080, 23k on the XTX). A gate on the whole count judged the driver. rt now registers the OS id of every thread it starts in Gauges::threads, at one place: the spawn helper device::start, which the reaper, block-maker, submit and completion threads and the cache store's removal thread all start through. A thread holds its slot until it ends. The list is bounded by construction (5 slots), nothing on a commit or submit path reads it, and Device::new's paths are untouched. devtools gains ThreadInstructions (per-thread user-space counters by OS id, a thread that already ended skipped) and this_thread. The harness reads the runtime's thread ids through Device::threads before a row's timed runs, counts them with its own thread, and records own_per_run and others_per_run beside per_run. Every counter read now sits outside the timed wall span. results.py, per the planner's ruling: EXACT, the new runtime's own count at most 1.03 times its stored count (instructions.tsv now holds own counts), ratcheting down; LENIENT, named on every row, the own count at most the old runtime's whole count, old's driver share not separable since the old runtime names no threads. A whole count with no own count fails the row. The base comparison skips the harness's counts: the gate judges them. Verified: scripts/matrix/test_results.py, 42 tests OK locally. Builds and the other suites run on the check job. |
||
|
|
d2e5edbd60 |
harness and matrix: record the whole process's instructions per run and gate the frame and burst rows on them
The harness now counts each timed run's user-space instructions across the whole process. The counts repeat run to run where the times do not: rt's p50 spread across processes was 0.16 to 0.27%. The matrix gates the frame and burst rows (WALL_ROWS) on those counts, beside the host-time judgement and floors they keep under the GPU-p50 rule. devtools: ProcessInstructions opens one user-space instructions counter per core type with inherit set, so every thread started after it opens counts: the runtimes' and the drivers' threads too. The harness opens it first thing in main, before any device starts a thread, and each timed run records the counted delta. A node that refuses perf_event_open, and every non-Linux host, records none. harness: each row whose runs were not sized prints `M2V-MATRIX instructions harness-<runtime>/<row>/per_run <p50>`. matrix: a frame or burst row with a count on both runtimes passes the instructions gate as well as its time's limit: - it fails when rt's count is over old's; - it fails when rt's count is past 1.03 times the stored count in scripts/matrix/instructions.tsv (one column per driver family, `all` where the legs agree within 3%); - it is named when its count is more than 1% under the stored count, which then ratchets down; - it is named when no count is stored, and is then gated against old alone. The single-kernel rows stay judged on their GPU p50 as before, and every row's count is shown beside its times. The old runtime's harness counts are parked from the per-record instructions-versus-base check, like its times. instructions.tsv starts empty: a matrix run's counts seed it. VALIDATION.md describes the time rules and the gate in one paragraph. Verified: scripts/matrix tests (python3 -m unittest discover, 45 OK) on this Mac, over this rule and the GPU-p50 rule together. Before the rebase, check m3-max-45591 on msi (at c597bb3603) passed clippy x4, nextest for devtools, harness and rt (118 passed, with the process counter's test), and the release harness build. Count job m3-max-45641 on the 2080's node recorded the per_run count of every row on both runtimes except long_4cb, which is sized. |
||
|
|
f2cead2c6c | conformance: vector-word-phases recordings (Apple M3 Max, job m3-max-41993); rt: every device places each vector access at its own address | ||
|
|
cbc2a4be13 | tests: vector accesses at each word phase claim at most the proven alignment and answer Metal's words on the interpreter | ||
|
|
b4b22c7b2c | matrix: the per-commit matrix runner and the user-space instruction counter (WIP) | ||
|
|
52a784770c |
Validation tests find their inputs and their compile worker under any archive selection
Validation reads the checkout where the test runner names it, everywhere
A lib-only archive of the validation crate, built on msi and run from another root with
--workspace-remap and the build tree's sources moved away (lavapipe, job m3-max-34590), failed
runtime_lane::tests::a_kernel_runs_the_functions_its_descriptor_links (NotFound at tests.rs:697:
crate::engine::profiles_dir() is env!("CARGO_MANIFEST_DIR")/profiles) and
candidate::engine::graphics::tests::public_render_cases_plan_or_refuse_typed ("0 public render
cases planned": a baked corpus root). Both pass when the build tree is present. The scan
|
||
|
|
adb6f3c93c |
devtools: the tool runner's test module on unix hosts only
Its one test runs /bin/sh; on Windows the module held only an unused import. Verified: Windows clippy (gnullvm and msvc, --all-targets) reported this as the only error at 438f0c42cb (job m3-max-31946). |
||
|
|
4c6a29c409 |
Windows: dma-buf items unix-only; dirty pages, residency and rotation on every host
The runtime's first Windows check stopped at its module tree: dma_buf.rs takes file descriptors (std::os::fd) unconditionally, while dirty_pages, host_residency and texture/rotation were unix-only modules that every host's code names. - dma_buf.rs: every item that holds or makes a file descriptor (the sources, requests and chunks, the imports of dma-bufs and their pages, images bound to them, exported pages) is cfg(unix). The DRM-modifier image items that hold none (ModifierMemory, the explicit-plane and natural-layout checks, the format queries) stay on every host: their extension decides at run time. - dirty_pages and texture/rotation hold no unix code: on every host. - host_residency: the descriptor limit (RLIMIT_NOFILE), the dma-buf form of an import made again and its descriptor counts are unix-only; the pointer form and the sweeps stay on every host. - devtools' scratch lock: the file identity on Windows is the volume serial number and file index (GetFileInformationByHandle) in place of dev/ino. Verified: a step of the Windows check iteration (gnullvm, msi job). |
||
|
|
39bff0de2a |
The carried test trees read the checkout where the test runner names it
Every env!("CARGO_MANIFEST_DIR") in validation's runtime_lane.rs and runtime_lane/ and in
metal2vulkan-runtime/src/tests (135 sites) named the directory the test binary was built in. A
nextest archive built on msi and run on another node with --workspace-remap read msi's path there:
teardown_threads panicked reading runtime_examples.ll, and public_cases read no case shard.
metal2vulkan-devtools gets one resolver, workspace_dir(): two levels above the manifest directory
the runner names as the test runs (cargo and nextest name the test's crate; a remapped archive
names it in the running machine's checkout), where that root holds the validation fixtures, else
above the dev-tools crate as built (the fallback fixtures_dir already had). validation_dir() and
fixtures_dir() sit on it; engine_dir() is unchanged. The sites move onto them:
- fixture reads (fixtures/public, engine/ and examples/) onto fixtures_dir() and engine_dir(),
with the two hand-rolled "runtime variable else built" copies (attachment_reads, encoder_holds);
- committed cases and observations (validation_dir()/corpus), and public_cases and
public_case_names now read the public source rows through source::public_sources_under on
fixtures_dir() instead of source::public_sources(), which bakes the path;
- the runtime tests' device profiles (validation_dir()/profiles) and degradation_sites' read of
the lane's sources;
- the conformance recordings, docs/API.md and the runtime's own src/ through workspace_dir().
The imports of std::path the moves left unused are removed.
Test-only. tests::the_carried_tests_read_the_checkout_where_the_runner_names_it (devtools, the
previous commit) fails before this commit and passes after. Verification: the msi job that builds
both commits, runs the remapped archive at each and lints the tip is reported with this sha.
With 4e06c87523 (the scan check), e9a0927685 (render_state.rs and line_width tests; the scan covers all of runtime/src),
74aa3e44cc and 086962f1fa (fixes; source.rs fixture reads through fixtures_dir). Test code only.
Compiled in m3-max-31605 (msi: clippy x3; scan passes; lavapipe suites 6235 passed, failures all pre-existing pin-97
items or the runtime-sources pin; remapped run with the build tree hidden 201/202, the last needing an all-targets
archive, 31641). Base 4e06c87523 (31508): scan lists 135 sites; remapped run fails 63/202.
|
||
|
|
ea5d2b5dbb |
The dev tools find the fixtures beside the crate the test runner names
devtools::fixtures_dir() returned the validation crate's fixtures/public beside the dev-tools crate as it was built (env! of CARGO_MANIFEST_DIR at compile time). A nextest archive built on one machine and run on another, as the GPU nodes now run every device leg (built on msi, carried to um790), therefore read the build machine's paths and found no fixtures. It now looks first beside the manifest directory the test runner names at run time (cargo test and cargo nextest set CARGO_MANIFEST_DIR for the test's crate; a run with --workspace-remap names it in that machine's checkout), and falls back to the build-time path where that directory has no fixtures. Test infrastructure only (metal2vulkan-devtools, unpublished); no product path reads it. Verified (devcopy, 5c30935a78): validation-lane archives built on msi ran their fixture tests on um790 (the XTX device_copy run 27511 and the 2080 run 27575 read their fixtures through it). |
||
|
|
02341f3157 |
End to end: the linked-signature fixtures compute Metal's words by position
The owned fixtures engine/linked_signature_caller and linked_signature_functions (regenerated by scripts/regen-air-fixtures on the M3, Metal 32023.922, SDK 27.2) are the MSL the probe linked_function_signatures.m compiles. metal2vulkan_devtools::linked_signatures holds their 28 cases and word 0 of each: Metal's where the M3 Max stored one (m3-max-3300, which also matched m3-max-3238 case for case), the translator's own where Metal's read is undefined, or a refusal for the shapes no adapter passes. tests::engine_linked_signatures runs every case on the CPU interpreter and compiles the linking ones on every committed profile through L3; runtime_lane::linked_signatures runs them through the runtime under the validation layer, linked in functions, and in privateFunctions for the stitched and the plain extra-argument cases Metal measured so. (cherry picked from commit 98d793e667d739cb96c005ec63a0f7680f5129fc) |
||
|
|
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.) |
||
|
|
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.
|
||
|
|
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.
|
||
|
|
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).
|
||
|
|
8264a4c1f0 |
Remove each scratch temporary that outlived its tool, kill included
Content: the tree of `development` at 16257a79ad, unchanged. |
||
|
|
e320a1f475 |
Drop design-record, work-package and evidence codes from comments, and retire vk12-bare from the corpus
Comments, fixture notes and docs lose their design-record numbers, work-package codes and evidence codes; lines that earlier commits of this series added carry their cleaned text there, so this commit holds the cleanup of lines that predate the series, the retired vk12-bare profile's corpus rows (a rationale and two observation rows), and docs/FAST-PATHS.md's measurements stated as they stand. Thirteen hash-keyed files keep their citations, because their bytes are case or record identities: eight case-keyed .ll fixtures and five parity sources. Verified: the CPU suites (4997 of 4997 and 1328 of 1328), clippy, rustdoc and doctests. Folds in: - Drop evidence codes, design-record numbers and work-package codes from comments and fixture notes - Drop the retired vk12-bare profile from the corpus - Say the fast-path ledger's measurements as they stand, without commits, rounds or host incidents - Keep the case-keyed .ll fixtures byte for byte - Keep the parity lanes' fingerprinted sources byte for byte |
||
|
|
4b564766ec |
Sample extended-range textures through Metal's bicubic filter
A sample of a BGR10_XR, BGRA10_XR or RGB10A8_2P_XR10 texture (or an sRGB twin) through a constexpr bicubic sampler, or through a runtime sampler whose bound word states Cubic, was refused (NotImplemented(SamplerBicubicFilter) in the lowering, NotImplemented(Format) in the binder). It is now Metal's bicubic filter of the decoded texels, measured on an Apple M3 Max (macOS 26.7) through the owned fixture xr_bicubic: random codes of each of the six formats at 16x16, 7x5, 3x3, 2x6 and 1x1, 2,304 coordinates each (every texel's centre, then random ones up to 0.15 of the texture past its edges), through 12 kernels (a runtime Cubic sampler with float and half results; constexpr samplers under clamp to edge with float and half results, repeat, mirrored repeat, clamp to zero, the opaque-white and opaque-black borders, pixel coordinates, and an offset under clamp to edge and repeat): 3,317,760 lanes. What Metal does, and what the lowering now does: the footprint, weights, addressing, a mirrored axis and a level below four texels are the other formats' bicubic filter's, each tap the decoded texel or the border texel through the format's channels; a level below four texels sums as the extended-range linear filter (terms truncated); otherwise each tap's step is weighed by the product of Metal's weights and summed exactly (no term truncated, unlike the linear filter), the step rounded half up, clamped into the steps of the codes 0 and 1023 (a color lane's (0-384)/510 and (1023-384)/510, an sRGB twin's table steps, alpha [0, 1]), and divided by the grid exactly; a half result rounds as the linear filter's does. The clamp is applied to the rounded result, which equals clamping the step because each rounding is monotonic. Every lane but 4,050 matches that model; each of the 4,050 is one step from Metal's (1/8160 a color lane, 1/8192 an sRGB color lane, 1/4080 alpha), its exact sum within 0.014 of a step of a rounding tie that Metal rounds the other way. No model of Metal's datapath tried closes that residue, so the sample records PrecisionNote::BicubicFilterArithmetic, and docs/FAST-PATHS.md and docs/API.md say so. A bfloat or padded form's bicubic sample, a swizzled texture's and a gather through a bicubic sampler were not measured and are refused. How: select_extended takes the bicubic state of a constexpr sampler or of the slot's cubic-sampler variant (LoweringInputs::cubic_samplers) and plans Metal's bicubic filter; the extended sampler emits it through bicubic::filter with Texels::Extended, which fetches each tap's raw texel and decodes it, through the exact routines alone, then clamps. The binder takes a cubic word at an extended-range slot as the cubic-sampler variant's, and gives such a slot the neutral BicubicTexels value in the plan of the pipeline as compiled, which binds the neutral there (it refused the format before naming the variant: the device lane found that). SEMANTICS_VERSION 1693; RUNTIME_VERSION 1184, as a run of an existing artifact with a cubic sampler at an extended-range slot is no longer refused; the runtime-sources hash re-pinned. The table: xr_bicubic.tsv (2,067 samples of the probe's, per texture and kernel the middle texel's centre, four random coordinates, the first sample with a lane at a clamp bound and the first with a lane at a tie), shared through metal2vulkan_devtools::xr_bicubic with the probe's texture generator. Verified on homelab-gem10 (debug builds): - tests::engine_extended_range::bicubic, on the CPU interpreter on the lavapipe and MoltenVK-M3 profiles: every lane of the table through the same 12 kernels, compiled under the six forms' variants (the runtime ones under the cubic-sampler word the binder plans), is Metal's bits but the 136 lanes the table marks, each one step away; each compile validates and its estimate bounds it. A padded or bfloat form's bicubic sample, a swizzled texture's and a gather are refused as above (a two-plane gather as Format, under any sampler); on every committed profile the pipeline as compiled plans the variants with the XR texture and a Cubic sampler bound, and the variant's pipeline plans the same key. - runtime_lane::extended_range_bicubic (new): the 8,268 lanes on the Radeon 780M (RADV), the RTX 3090 and lavapipe, textures written as the probe wrote them: 0 differ from Metal (136 at a tie, one step away), and the state announces bicubic-filter-arithmetic. The extended_range_samples, two_plane_samples and two_plane_copies lanes, whose helpers this shares, pass on all three. - Release build, 12 kernels x 6 forms x 5 profiles (lavapipe, 780M, RTX 5080 Laptop, Arc ANV, MoltenVK-M3): 360 translations, mean 1.31 ms, slowest 1.97 ms (xrb_runtime, BGRA10_XR sRGB, 780M), budget ledger peak at most 935 KiB, process peak RSS 15.6 MB; the linear XR kernels take 0.81 ms on average. - clippy -D warnings (workspace, all features, all targets; validation also under m2v_gpu), rustdoc -D warnings and the doctests pass. Suites: metal2vulkan, -air, -runtime and -devtools 4,566 of 4,567, validation 1,293 of 1,293. The one failure is tests::golden_hashes, whose 380 stale cells are the two new fixtures' alone (smw_writers 7 and xr_bicubic 12 entries x 20 profiles), left to be blessed on development. |
||
|
|
13b279df1b |
Squash 11203 commits of translator, runtime, and validation work
Rolls up everything since
|