Commit Graph
10664 Commits
Author SHA1 Message Date
Anees Iqbal ca796ca5ff Tests: behind the agx flag a narrower fragment input links at its output (red)
The draw probe (Apple M3 Max, macOS 27.0.1, job m3-max-87586) measured that a
fragment input narrower than its vertex output reads the output's first lanes
when the vertex module states agx.allow_mismatched_component_counts as 1, for
float under perspective, center_no_perspective and flat interpolation and for
uint and int flat. Vulkan matches exactly that under maintenance4 (spec 19.1.3,
Interface Matching: "if the maintenance4 feature is enabled, they are declared
as OpTypeVector variables, and the output has a Component Count value higher
than that of the input but the same Component Type"; without it
VUID-RuntimeSpirv-maintenance4-06817 forbids it). The runtime's floor requires
and enables maintenance4 (Vulkan 1.3), so this is one form on every device.

The tests:
- link: a narrower vector or scalar input, float or uint, smooth or flat,
  beside matched varyings, takes its output's location and component; a
  description without maintenance4 answers the gap; a wider input stays the
  gap, a mesh producer's either way, and no flag stays Metal's link error;
- engine, over text modules on lavapipe's profile: for each class and
  interpolation, 4 to 2, 4 to 1 and 3 to 2 lanes link, both relocated modules
  pass L3 (spirv-val under the profile's settings, maintenance4 among them),
  and the input's Location is the output's, past a second varying.

Red: link still answers the narrower input with the gap.
2026-12-04 21:23:44 -08:00
Anees Iqbal 2753ea3fbf Varyflag step 1 bless: the golden hashes at semantics 2393
The golden table re-blessed at 39e5964c2a (varyflag step 1 rebased on 9e7034c214), on the Apple
M3 Max, job m3-max-87716 (inventory, golden, printouts, linkhalf and chains each exit 0):
- the semantics line moves 2392 -> 2393, step 1's own number (2391 at that bless, renumbered
  when the stack moved onto pin AB', whose PR 30 and fix-forwards took 2391 and 2392);
- no cell moves and no row is added.
2026-12-04 21:23:44 -08:00
Anees Iqbal 6770dcf8f0 AIR docs: the agx flag's draw probe, flag 0 included
The draw probe (Apple M3 Max, macOS 27.0.1, job m3-max-87586; 720 render
pipelines, one draw each, a pixel read back) measured what 87508 left open:
- flag 0 refuses every count mismatch, as no flag does (180 each); 1 makes all
  180;
- under 1, a narrower fragment input reads the vertex output's first lanes
  (90 rows: float under perspective, center_no_perspective and flat, uint and
  int flat, a second varying absent, after or before);
- a wider input reads the output's lanes, and past them no constant: 150 lanes
  read 147 distinct values, none of them 0, 1 or a value either varying wrote.
EntryPoint::mismatched_component_counts's doc now states these facts. Docs only.
2026-12-04 21:23:44 -08:00
Anees Iqbal be3823ca5f AIR docs: the agx flag's measured refusals name what the probe ran
Job m3-max-87508 ran each vertex and fragment module with the agx flag at 1
(alone or beside irc.version_*) and with no flag at all; it never ran a module
stating 0. The field's doc, and the commit messages of 7285b878a1 and
02b5d3d1a4, said the pipeline is refused at 0: unmeasured. The doc now says
the refusals measured (no flag on the vertex module, whatever the fragment's)
and that 0 is read as no flag, which is not measured. The decoder is unchanged.
2026-12-04 21:23:44 -08:00
Anees Iqbal 7d47114ace Link: a component-count mismatch behind the agx flag is our gap, not Metal's link error
Metal makes a render pipeline whose fragment function reads a user varying at
another component count than the vertex function writes when the vertex
function's module states agx.allow_mismatched_component_counts as 1 (Apple M3
Max, macOS 27.0.1, job m3-max-87508; float4 written and float2 read, and float2
written and float4 read; refused at 0, with no flag, and with the flag on the
fragment module alone; irc.version_* changed nothing). Link answered every such
pipeline Unsupported{UnmatchedVarying, NotRepresentable}, Metal's link error,
for a pipeline Metal makes.

- AIR: module_flags returns whether the agx flag is 1, and the decoder sets
  EntryPoint::mismatched_component_counts on each vertex (post-tessellation
  included) and mesh function the module defines; fragment, kernel and object
  functions never carry it. The flag's docs state the probe's facts.
- Lowering copies it to StageIo::mismatched_component_counts.
- Link (varyings, mesh_fragment): a fragment input whose type differs from
  its producer's output in component count alone (same numeric class and source
  width), behind a producer carrying the flag, is
  Unsupported{UnmatchedVarying, NotImplemented}; everything else stays
  NotRepresentable. A mesh producer is not probed yet, so it stays the typed gap.
- Feature::UnmatchedVarying's doc says both; reach.tsv marks it rare;
  docs/REFUSALS.md regenerated (it also drops TextureSwizzle's four translator
  sites, which a49e4a61c4 and its neighbours removed without a regeneration).
- SEMANTICS_VERSION 2393 (a refusal's class and an interface fact change;
  2392 is PR 30's and its fix-forwards', pin AB').

Verified: the red tests of 7285b878a1 (red in job m3-max-87576) pass here;
the green job is named in the lane's report.
2026-12-04 21:23:43 -08:00
Anees Iqbal 50f744c6c5 Tests: the two translator test entries name the agx field
The red commit's EntryPoint field left two test literals in the translator
crate without it (memory plan and simd uniformity tests); the red job
m3-max-87574 stopped at the build on them.
2026-12-04 21:23:43 -08:00
Anees Iqbal 2ed6b9387b Tests: a component-count mismatch behind the agx flag is our gap (red)
Metal makes a render pipeline whose fragment function reads a user varying at
another component count than the vertex function writes when the vertex
function's module states agx.allow_mismatched_component_counts as 1 (Apple M3
Max, macOS 27.0.1, job m3-max-87508: float4 written and float2 read, and float2
written and float4 read; refused at 0, with no flag, and with the flag on the
fragment module alone). Link refuses it as Metal's link error
(Unsupported{UnmatchedVarying, NotRepresentable}).

This adds the fact's two fields, set nowhere yet, and the tests that hold the
label:
- EntryPoint::mismatched_component_counts (AIR): the decoder test expects it on
  the module's vertex and mesh functions under 1, nowhere else, and nowhere
  under 0 or no flag.
- StageIo::mismatched_component_counts, encoded (ARTIFACT_FORMAT_VERSION 617).
- A link test: a flagged vertex or mesh producer writing wider or narrower than
  the fragment input expects NotImplemented; an unflagged one, the flag on the
  fragment alone, another numeric class or an unwritten key stay the link error.
- An engine test over text modules compiled on lavapipe's profile: the vertex
  module's flag reaches the stage interface and the link answers as above; the
  same count links.

Red: these three fail at this commit (the field is never set, link answers
NotRepresentable).
2026-12-04 21:23:43 -08:00
Anees Iqbal cb574b06fa Pin AB' bless: the golden hashes after PR 30 and its fix-forwards
The golden table re-blessed at b991ca5474 (PR 30's head 6d9f774d63, its fix-forwards and SEMANTICS
2392), on the Apple M3 Max, job m3-max-87900 (inventory, golden, printouts, linkhalf and chains each
exit 0):
- the semantics line moves 2390 -> 2392 (PR 30's 2391 and the fix-forwards' 2392);
- no cell moves and no row is added: no committed fixture declares a memory intrinsic in the older
  form.
2026-12-04 21:23:04 -08:00
Anees Iqbal b991ca5474 Cache: SEMANTICS_VERSION 2392, PR 30's fix-forwards
A legacy memory intrinsic's alignment that is not a power of two (or above 2^32) is now refused
as a malformed record, not ImmediateNotConstant (f32b143935), and a legacy call whose volatile flag
is not a constant now meets the verifier the current form meets instead of failing decode's verify
(3e311ec8ac). Both change what decode answers for a module, so cached answers keyed by the old
version must not be reused.
2026-12-04 21:18:05 -08:00
Anees Iqbal 3e311ec8ac Verifier: an unbound legacy memory intrinsic call is one operand short of its declaration
Decode upgrades a call of the older LLVM's llvm.memcpy, llvm.memmove or llvm.memset (an i32
alignment before the volatile flag) by removing the alignment operand. Where the volatile flag is
not a constant in the function that makes the call, decode keeps the upgraded call
Callee::Unbound with its template, as it keeps a current-form call (bitcode/function.rs). The
verifier's legacy arm took only Callee::Llvm, so such a call failed Verify(OperandType) in the
Module::new that decode runs (bitcode/decoded.rs), refusing the whole module. The arm now also
takes Callee::Unbound { template: Template::Llvm(Memset | Memcpy | Memmove) }, under the same
conditions: not variadic, one operand short, and a five-parameter declaration whose fourth
parameter is i32 and fifth i1.

What such a call then meets, read on the current form's path (not run): canonicalization's SCCP
binds an Unbound call with Template::bind over its four operands and the current signature
(canon/sccp.rs), so where inlining makes the flag a constant the call becomes Callee::Llvm, the
form the PR already verifies and translates; where the flag stays a kernel parameter or a value
the run computes, the post-check refuses it at the call in the inlined entry as
InvalidInput(Intrinsic(ImmediateNotConstant)) (canon/mod.rs), the refusal a current-form call
with that flag meets (docs/API.md, OpenCL C kernels).

Makes a_legacy_memory_intrinsic_with_an_unbound_volatile_flag_verifies pass (expected; not run:
the brief holds every build and test until PR 30 merges). No SEMANTICS_VERSION bump here: PR 30's
2391 covers its decode change, of which this is part. Checked: cargo fmt clean.
2026-12-04 21:17:50 -08:00
Anees Iqbal a5a4c0f839 Tests: a legacy memory intrinsic whose volatile flag is not a constant verifies unbound
New test a_legacy_memory_intrinsic_with_an_unbound_volatile_flag_verifies: a kernel
@k(ptr addrspace(1) %p, i1 %v) calls the older LLVM's llvm.memcpy.p1i8.p1i8.i64, declared
void (ptr, ptr, i64, i32, i1), as memcpy(%p, %p, 400, i32 16, %v). It expects decode to upgrade
the call (four operands, align 16 on both pointers), keep it Callee::Unbound with the template
Llvm(Memcpy), as a current-form call whose flag is not a constant is kept, and the module to
verify (verify_module_level, the Module::new that decode runs).

At ace196acec the verifier takes a call one operand short of the legacy declaration only when its
callee is Callee::Llvm, so this one, whose flag is a parameter, fails Verify(OperandType), and
the whole module is refused at decode. Expected to fail here; the next commit makes it pass.

legacy_copy_module gains LegacyAlign::VolatileParameter(bytes): a constant alignment, and the
volatile flag the kernel's second parameter, an i1. The other variants build the same module as
before.

Not run: the brief holds every build and test until PR 30 merges. Checked: cargo fmt clean.
2026-12-04 21:17:49 -08:00
Anees Iqbal f32b143935 Translator: a legacy memory intrinsic's alignment that is not a power of two is a malformed record
Decode upgrades a call of the older LLVM's llvm.memcpy, llvm.memmove or llvm.memset (an i32
alignment before the volatile flag) by moving the alignment to the pointers' align. A constant
alignment that is not a power of two (or is above 2^32) was refused as
Intrinsic(ImmediateNotConstant), whose own doc says the operand is not a constant. It is now
Bitcode(MalformedRecord { block: FUNCTION_BLOCK, code: FUNC_CALL }), the decoder's answer to an
align attribute of such a value (attrs.rs). An alignment that is not a constant stays
Intrinsic(ImmediateNotConstant) at the call.

How: upgrade_legacy_memory returns a crate-private LegacyAlignmentError, Intrinsic(e) for the
immediate read's error and Malformed for a value Align::from_bytes refuses; the call's decode maps
Malformed to the CALL record's malformed-record error and Intrinsic(e) to the input error at the
record, as before. No public type changes; the outcome class is InvalidInput either way.

Makes a_legacy_memory_intrinsic_s_alignment_must_be_a_constant_power_of_two pass (expected; not
run: the brief holds every build and test until PR 30 merges). No SEMANTICS_VERSION bump here:
PR 30's 2391 covers the decode change, and only the error kind of an input refused either way
changes. Checked: cargo fmt clean.
2026-12-04 21:17:49 -08:00
Anees Iqbal 50b914e42b Tests: a legacy memory intrinsic's alignment that is not a power of two is a malformed record
a_legacy_memory_intrinsic_s_alignment_must_be_a_constant_power_of_two now expects a constant
alignment of 24 on the older LLVM's llvm.memcpy declaration to fail decode as
Bitcode(MalformedRecord { block: FUNCTION_BLOCK, code: FUNC_CALL }), and an alignment that is the
kernel's i32 parameter to fail as ImmediateNotConstant, as before.

Why: IntrinsicError::ImmediateNotConstant says "An operand that must be an immediate is not a
constant", and 24 is a constant. The decoder's precedent for a value that is not a power of two
where an alignment must be one is the align attribute's: MalformedRecord (attrs.rs).

Expected to fail at ace196acec, which reports both alignments as ImmediateNotConstant; the next
commit makes it pass. Not run: the brief holds every build and test until PR 30 merges.
Checked: cargo fmt clean.
2026-12-04 21:17:49 -08:00
Jacob McSwain 6d9f774d63 Translator: accept memory intrinsics declared with an alignment operand
Modules from older LLVM-based Metal frontends couldn't be translated. They declare llvm.memcpy,
llvm.memmove and llvm.memset with an i32 alignment before the volatile flag, and that declaration
was refused as Intrinsic(DeclaredSignatureMismatch).

The declarations involved:
- llvm.memcpy and llvm.memmove: void (ptr, ptr, i64, i32 align, i1 volatile)
- llvm.memset: void (ptr, i8, i64, i32 align, i1 volatile)
- seen in typed-pointer bitcode from metalfe-32023.35

What changes: decode upgrades such a call the way LLVM's own reader does (UpgradeIntrinsicCall): the
alignment operand is removed, and its value becomes the align of the pointer operands. In detail:
- the removed operand's attributes go with it, and later attributes move down one place;
- the alignment replaces any align the call states, and an alignment of 0 removes it
  (setDestAlignment, setSourceAlignment);
- a non-constant alignment, or one that is not a power of two, is refused as ImmediateNotConstant;
- the verifier accepts the one-short call only when the declaration has exactly that legacy form.

No public API changes.

Evidence:
- On 466 real libraries from one metalfe-32023.35 game, all refused before: 66 now translate (48
  render or compute functions, plus 18 kernels given a stage-input descriptor). Each is
  byte-identical to the translation of the same library after llvm-dis upgrades it with LLVM's
  reader. The other 400 stop at an unrelated later refusal (Lowering(StageIo)), the same on both
  forms.
- New tests: a_legacy_memory_intrinsic_states_its_alignment_on_its_pointers,
  a_legacy_memory_intrinsic_s_alignment_must_be_a_constant_power_of_two,
  a_legacy_memory_intrinsic_s_attributes_move_with_its_operands,
  a_memory_intrinsic_call_one_short_only_of_the_legacy_declaration. Undoing each part of the change
  on its own makes at least one of them fail.
- Linking a legacy-form module with a current-form one is not tested.

Version: SEMANTICS_VERSION becomes 2391, because inputs refused before can now compile.

Golden table: unchanged; this change adds no fixture.

Not run: the GPU device tests, the Windows clippy legs and the CI matrix.
2026-12-04 21:52:27 -06:00
Anees Iqbal 9e7034c214 Pin AB bless: the golden hashes after PR 29
The golden table re-blessed at 3c3d214397 (PR 29's head 8f117956ef and its docs fix-forward), on
the Apple M3 Max, job m3-max-87637 (inventory, golden and printouts each exit 0):
- the semantics line moves 2389 -> 2390, PR 29's own number;
- one row is added, the new fixture vertex_stack_return_aggregate.ll (stack_return_vertex), the
  same hash on every profile.
No existing cell moves, as the PR's reading predicted: no committed fixture loads or stores a
whole aggregate in thread memory.
2026-12-04 19:40:00 -08:00
Anees Iqbal 3c3d214397 Docs: PR 29's comments say what is true now and keep to 100 columns
The fix-forward of PR 29's reading (lane pr29read; docs only, no code):
- engine_stack_return_aggregate.rs says it compiles on one profile, `nvidia-rtx50-linux`, and
  that its expectations row holds the fixture to `ok` on every committed profile, as the
  converter-flags engine test does since d3316d621e.
- canon/aggregates.rs's module doc drops "left whole, it was refused" (history); the refusal a
  whole access of a larger aggregate meets is named where the doc says lowering refuses it.
- The PR's new comment lines over 100 columns are wrapped: aggregates.rs's opening paragraph,
  canon/mod.rs's pass list and its call-site comment, and tests/aggregates.rs's module doc.

Checked: cargo fmt --all makes no change; the comment lines the PR added are at most 100
columns.
2026-12-04 19:24:23 -08:00
Jacob McSwain 8f117956ef Translator: split whole-struct stack loads and stores into members
Vertex functions that build their return value on the stack couldn't be translated. A whole struct
stored to or loaded from an alloca reached lowering, which handles only scalars and vectors there,
and was refused as Lowering(Access) AccessType.

The shape involved, seen in modules Apple's Metal shader converter wrote:
- a store of zeroinitializer to an alloca of the return struct;
- stores to its members;
- one load of the whole struct.

What changes: the split that already turns a whole-aggregate access of device, constant and
threadgroup memory into its members' accesses now covers stack memory too. Still kept whole, and
refused by lowering as before:
- a volatile access;
- an aggregate that holds a pointer;
- an aggregate with more members than the split takes.

No public API changes.

Evidence:
- a_stack_aggregate_is_split checks the member stores and loads, their alignments and byte offsets,
  the two insertvalues, and that no whole-struct access is left.
- what_is_not_split_stays_whole gains the three stack cases above.
- The new fixture compiles, links and validates.
- a_stack_aggregate_is_split and a_return_value_built_in_a_stack_slot_compiles fail without this
  change.
- No release-mode timing was taken; the split adds a bounded walk per whole stack access.

Version: SEMANTICS_VERSION 2389 -> 2390, because inputs refused before can now compile.

Golden table: left for the bless on development; golden_hashes_match_the_table lists the new
fixture's cells. The fixture's expectations row is included.

Not run: the GPU device tests, the Windows clippy legs and the CI matrix.
2026-12-04 21:22:16 -06:00
Anees Iqbal f0c64c3b1d Tests: the API tests' slot helper lives in the serde module that alone calls it
CI run 47469915099 at 69664cbc1a failed "Clippy under each feature alone" on both
legs: with no feature, `slot` in pipeline/api_tests.rs is never used (dead_code under
-D warnings). a49e4a61c4 removed its last caller outside `serde_round_trips`, and the
merge check runs clippy only with all features, so nothing caught it before the push.

The helper and the three `sym` types it names move into `serde_round_trips`, where
every caller is. The empty `bind_serde_round_trips` module goes with it: it holds
nothing.

Checked: cargo fmt clean. The per-feature clippy (metal2vulkan none, serde, ash,
cli; metal2vulkan-air none, serde) runs on this commit as its own leg.
2026-12-04 19:01:03 -08:00
Anees Iqbal 69664cbc1a Pin AA' bless: the golden hashes after PR 28 and the hoist containment
PR 28 (74e4ad9d3a) added the owned fixture kernel_converter_module_flags, whose cells the
contribution left for this bless, and the hoist containment (7a066a4b80) checks a load the
translator makes where the program did not run it in the address form, which moves that form's
cells. golden_hashes.tsv gains the fixture's row and 23 rows move, re-blessed on macOS (M3 Max,
job m3-max-87519, BLESS_JOBS=4); after the bless the job's golden, inventory, printouts, linkhalf
and chains checks report 0. Data only: no source changes.
2026-12-04 18:34:36 -08:00
Anees Iqbal 08ce42bf68 Cache: SEMANTICS_VERSION 2389, the containment's own number after the rebase onto d3316d621e
7a066a4b80 (a load made where the program did not run it is checked in the address form) bumped
SEMANTICS_VERSION from 2387 to 2388. Rebased onto d3316d621e, whose development already says
2388 (1c685f0524, the hoist's number after PR 28 took 2387), the same textual change merged
without a conflict, so the containment shared the hoist's number. A cache written at the hoist
alone holds unchecked entry loads in the address form; 2389 keys the checked ones apart.

Verified: the version line diffed against d3316d621e at staging (2388 at the base, 2389 here);
the touched suites at this tip run in the CPU job named at landing.
2026-12-04 18:28:49 -08:00
Anees Iqbal cf69f7cd7a Tests: a speculated arm's constant-reference load is checked in the address form
engine_hoist_contain gains a second kernel: a short arm beside a quad_broadcast_first, which
Metal's backend speculates, reads k, a 4-byte constant reference, behind a store to out that
keeps the hoist away. canon's arm speculation runs that load in every lane of the branch's block
and marks it speculative (99bcd849f6); the test asks that on every identity profile the address
form reads k's SlotBounds and the zero range, and loads it through a selected address. At
8f8617ca5d, where speculate marked nothing, the load is at a constant offset and unchecked, so
the test is expected to fail there (not run at the base).

Evidence for 99bcd849f6 and this branch, recorded here as that commit is already reported:
- Consumer use of InstKind (the public field InstKind::Load::speculative): the consumer's
  checkout at development 985ecd39f0 and its 27 steelbrain/* tips younger than a day,
  git grep -w -F InstKind and git grep -F metal2vulkan_air::ir over *.rs: 0 code hits.
- The three guest kernels the hoist was timed on: their SPIR-V is equal at 8f8617ca5d and at
  960999d529 on all 10 committed RADV, ANV and NVIDIA profiles (job m3-max-87433, release
  command line), and equal to the hoist lane's measured tip build, so the hoist's gains on the
  RX 7900 XTX, the Iris Xe and the RTX 3090 are expected (same SPIR-V as the measured build on
  the bound-form profile). It differs only on the address-form profiles (lavapipe,
  gate-lavapipe-x86_64, moltenvk-m3), where the hoisted load is now checked.
- Golden table at 960999d529 (job m3-max-87441, every changed cell listed): 60 cells move, all
  on the five address-form profiles, none on a RADV, ANV or NVIDIA profile.
- Authored-compile census at 960999d529 (job m3-max-87432): 2390 cases, 0 differences,
  0 regressions, 0 failed, 0 table rows changed; slowest compile 1120 ms.
2026-12-04 18:28:29 -08:00
Anees Iqbal fabf409a81 Tests: the word-bound hoist case counts only device-address loads
On a profile with the bound form, flag's slot is a storage view, so the module has one
device-address load (extra's, selected), not two. Job m3-max-87420 at 99bcd849f6 failed only this
count on amd-780m-hawkpoint-radv ([1, 0] against [1, 1]); its bounds and zero-range assertions
held, as did every other engine_hoist_contain, engine_identity_contain, engine_bound_buffers and
engine_word_phases test and the api_signatures table.
2026-12-04 18:28:29 -08:00
Anees Iqbal 7a066a4b80 Canon and lowering: a load made where the program did not run it is checked in the address form
The constant-reference hoist makes a kernel's load of a constant T& at a fixed offset in its entry
block, so every thread of every dispatch reads it where the program read it only behind a
branch. Metal requires the reference's binding only where the program reads it, so an app may
leave it unbound, or bound shorter than the object, while that branch is not taken. In the
bound form the pipeline's robust buffer access contains the read (a null descriptor or a short
range reads zero), but where the slot is reached by its device address an access at a constant
offset was never checked: a short binding was read past its end by every thread, and an unbound
one past the nil buffer's 64 KiB under a larger object, a GPU fault where a mapping ends.

The mark: InstKind::Load gains `speculative`, false for every decoded load. const_hoist sets it
on each load it moves; speculate sets it on each load of an arm it flattens (a constant
reference's, at offset 0, run in every lane of the branch's block: the same window, narrower);
aggregates carries it to a split load's members. Lowering reads it: a speculative load's slots
are noted as reached at a variable offset (SlotBounds and, for a device-address read, the zero
range), and emit::prepare checks it against the slot's buffer whatever its offset, reading zero
outside, as an access at a run-time offset is. The bound form is unchanged: a bound slot drops
its bounds and its view is not checked in the shader. Covered: a device without the bound form's
queries, a slot bound below its argument's alignment on one with them, and every render stage.

const_hoist also leaves a reference whose pointer another root may share (the parameter or an
address step from it as a phi, select or insert operand, a stored value or the result): such a
pointer may meet one loaded from memory, and lowering then reaches the reference by a device
address no check bounds.

Docs: const_hoist's and speculate's module docs, canon's list, ARCHITECTURE.md, API.md sections
1 and 5, the runtime README's bounds paragraphs and push layout, PushField::SlotBounds. The
public signature table is re-blessed for InstKind::Load (no consumer use of InstKind: zero hits
in the consumer's development and its day-old steelbrain/* tips). SEMANTICS_VERSION 2388.

Tests: engine_hoist_contain (red at the base in jobs m3-max-87402 and m3-max-87403: no
SlotBounds for the hoisted load's slot on any identity profile or for a word-bound slot on a
bound-form profile, and the interpreter traps OutOfBounds at EXTRA+98304 and NIL+98304 with the
flag off); constant_hoist's loads are speculative where moved and a shared reference keeps its
loads; speculate's arm load is speculative where speculated and not where kept.
2026-12-04 18:28:29 -08:00
Anees Iqbal 59c23554a5 Red: the hoisted load's interpreter test reports every binding case
The case loop stopped at the first trap, so the red showed only the short binding. Each case now
runs and every failing one is named, so the base shows the unbound case (an object over the nil
buffer's 64 KiB) as well.

Verified at the base in job m3-max-87402 on the parent commit: the short case traps OutOfBounds
at the hoisted load.
2026-12-04 18:28:29 -08:00
Anees Iqbal 1712d580c8 Red: a hoisted constant-reference load reads outside a short or unbound binding in the address form
The constant-reference hoist makes a kernel's plain load of a constant T& at a fixed offset in its
entry block, so every thread of every dispatch reads it where the program read it only behind a
branch. Where the slot is reached by its device address, a load at a constant offset is never
checked against the slot's bounds, so a binding shorter than the object, or an unbound one (the
runtime's 64 KiB nil buffer) under an object over 64 KiB, is read past its end by every thread.

engine_hoist_contain's kernel reads extra (a 128 KiB constant reference) at byte 98304 only
under a flag from another buffer. The new tests ask that, in the address form, the hoisted load
read its slot's bounds and go through an address selected toward the zero range on every
identity profile; that a slot bound below its argument's alignment on a bound-form profile do
the same, and a bound view stay unchecked; and that on the CPU interpreter, with the flag off,
extra bound 16 bytes long or unbound reads nothing outside (no trap) and out keeps its words.

Expected red at the base: the three assertions on the check fail, and the interpreter traps
OutOfBounds at the hoisted load for the short and unbound cases.
2026-12-04 18:28:29 -08:00
Anees Iqbal d3316d621e Tests: the converter-flags engine test says it runs on one profile
PR 28's engine test compiles its fixture on nvidia-rtx50-linux alone, while its row in
public_fixture_expectations_engine.tsv holds it to ok on all 15 committed profiles. The module
doc now says which test covers what. Documentation only; no behaviour changes.
2026-12-04 18:13:53 -08:00
Anees Iqbal 1c685f0524 Cache: SEMANTICS_VERSION 2388, the hoist's own number after PR 28 took 2387
PR 28 (74e4ad9d3a, the converter's module flags, merged on GitHub by fast-forward) bumped
SEMANTICS_VERSION from 2386 to 2387. The constant-reference hoist (062b71cf63, rebased onto the
PR head) made the same textual change, 2386 to 2387, so the rebase merged the two without a
conflict and both changes shared one number. A cache written under the PR alone and one written
with the hoist must not match, so the hoist's translation takes 2388.

Verified: the rebased development differs from its pre-rebase tip (8f8617ca5d, kept as
steelbrain/dev-before-pr28) by exactly the PR's diff less its version line (6 files, +115/-3).
2026-12-04 18:13:13 -08:00
Anees Iqbal ffa4d3891d Pin AA bless: the golden hashes after the constant-reference hoist
The hoist (494bf5f743) moves a kernel's constant-reference loads into its entry block, so the SPIR-V of
the kernels it reaches changes. 11 rows of golden_hashes.tsv move, re-blessed on macOS (M3 Max, job
m3-max-87341, BLESS_JOBS=4); after the bless the job's golden, inventory, printouts, linkhalf and chains
checks report 0. Data only: no source changes.
2026-12-04 18:12:44 -08:00
Anees Iqbal 062b71cf63 Canon: a kernel's constant-reference loads are made in its entry block, ahead of its bounds branch
A kernel often reads a constant T& parameter only behind its bounds branch
(if (gid >= n) return; out[gid] = in[gid] * scale;). canon::const_hoist
moves each such load into the entry block, its value reaching its uses by
dominance, where all of these hold, each read from the body's structure and
the entry's ABI:

- a plain load (not volatile, not atomic) of an integer, a float or a vector
  of them; a pointer's or an aggregate's load stays;
- its address is a parameter the ABI binds as a constant-space buffer with a
  stated air.buffer_size and no function-constant predicate (a constant T&),
  or that parameter plus GEPs at constant, non-negative indices and bitcasts,
  which move with it; the bytes read lie inside [0, air.buffer_size). The
  address is then one address for every thread, and each form contains it at
  the entry as where it stood: the same slot, a bound storage view under its
  robust buffer access, or a device address at a constant offset, which no
  check clamps in either place. A constant T* (no size), an offset past the
  object and an offset the run computes stay;
- no instruction on any path from the function's start to the load may write
  device memory or order another thread's writes before it: a store or
  memory intrinsic whose destination is not thread or threadgroup memory, an
  atomic or atomic load of any space, a fence or barrier, a texture write,
  or any call but arithmetic, conversions, group operations, built-in reads
  and texture reads and queries. A forward reach from every writing block
  marks the blocks a write may precede; a load's own block counts up to it.

Where it lives: a new canon pass beside speculate, not inside it.
speculate.rs is a fidelity pass: it gives Metal's measured if-conversion of
group operations, keyed by Metal's budgets, and its moves change what a
program observes. This one changes nothing a program observes and its rule
is soundness alone (no write before, the access contained), so it has no
place in speculate's measured decisions; it shares rewrite::BodyEdit's moves
with it. It runs after aggregates::expand, so an aggregate load of a
reference, split into its members' loads, moves too, and before the
OpenCL hidden buffers and the program-scope bindings add parameters. Kernels
only: the measured kernels are compute kernels.

The planner's measurement (the audit seat's lab pass, which moved every load
at a constant parameter itself) on the compute benchmark's guest kernels FM
copy, FM vertical and Fluid's pressure step, GPU time of 20 dispatches, arms
alternated, output digests equal in every pair: the RTX 3090 -3.6%, -0.1%,
-9.5%; the RX 7900 XTX -7.3%, -0.7%, -12.2%; the Iris Xe +0.4%, 0.0%,
0.0%. On the Iris, ANV sinks the loads back into the branches: FM copy's
compiled code goes from 134 to 132 instructions (1026 to 912 cycles), its 8
SENDs unchanged (read from INTEL_DEBUG=cs, not from Mesa's source).

SEMANTICS_VERSION 2386 -> 2387: a kernel whose constant-reference loads move
translates to other words.

Verified: pending the green job.
2026-12-04 18:12:44 -08:00
Anees Iqbal 236541d678 Red: a kernel's constant-reference loads behind its bounds branch, made in its entry block
canon/tests/constant_hoist.rs builds the bounds-branch shape of the three
compute kernels the hoist was measured on, synthetic and ours:
kernel k(device float* out, constant uint& n, constant float& scale,
constant P& p, uint gid) { if (gid >= n) return; out[gid] = float(gid) *
scale + p.bias; }, and specializes it.

- Positive: the loads of scale (the parameter itself) and p.bias (a GEP at
  byte 4 of the 8-byte object) are made in the entry block beside n's, and
  the store stays behind the branch. Red today: both loads stay behind it.
- Refusals, each keeping its load behind the branch: a store to out before
  the loads; an AIR atomic add before them; a callee that stores to out and
  then reads scale (inlined); p.bias read at an offset the branch's block
  computes ((&p.first)[gid & 1]); scale as a constant float* (no
  air.buffer_size); p.bias read at byte 8, past p's 8 bytes. These pass
  today (nothing moves); each goes red with its guard removed.

Verified: pending the red job.
2026-12-04 18:12:44 -08:00
Anees Iqbal 53a3321828 Runtime tests: an import's pages hold the pending work's bytes after its release, and nothing later
Extends every_device_imports_host_memory_and_releases_it_after_the_free: the fill of the import's
second half is committed held for a shared event's value, and the buffer and then the block, the
consumer's last handles of the import, drop while it is pending. The release must not have run 20 ms
later; once the event's value lets the fill run, the release runs, the gauges come back, and the
pages hold what the fill wrote (the first half the host's bytes). The test then writes the pages
again as their owner, commits a later command buffer, waits for the device to go idle, and checks
the pages hold its own bytes: nothing of the runtime wrote them after the release. Before, the test
waited for the fill and read the pages while the import was still held.
2026-12-04 18:12:44 -08:00
Anees Iqbal 2ada87ed21 Runtime: a failed wait for a batch is made again, so no restore write-back runs after the make returns
A texture made in place over host memory's import (integrated or CPU devices) restores the
import's bytes with a save, a move home and a write-back in one batch of the runtime's own, and the
make waits for that batch through Done::wait. Done::wait returned any result of vkWaitSemaphores
other than VK_TIMEOUT as an Error::Vulkan. Where that result was VK_ERROR_OUT_OF_HOST_MEMORY,
VK_ERROR_OUT_OF_DEVICE_MEMORY or VK_ERROR_UNKNOWN on a live device, the make returned Err while the
batch, and with it the write-back of the saved bytes, was still pending: the import's pages were
written after the caller saw the make fail, and may have released or reused them.

Vulkan's words: vkWaitSemaphores lists those results as failures and says nothing of the wait's
condition with them (only that with a loss the call "must return in finite time with either
VK_SUCCESS or VK_ERROR_DEVICE_LOST"); a failed call leaves every submitted batch pending, executing
as the queue runs it, whatever the host's wait returned. Only a loss ends what is pending: "for the
purpose of determining whether a command buffer is in the pending state ... a return value of
VK_ERROR_DEVICE_LOST is equivalent to VK_SUCCESS" (Lost Device).

So Done::wait now makes such a call again through complete::wait_through, as the device's idle wait
and an import's bind wait already do, until it succeeds or the device is lost, and returns Err only
at a loss, as its doc already said. Every caller of Done::wait gets that: the restoring make's
drain and batch waits, the upload room and staging span waits, a surface making's wait, and a
texture read's staging wait (whose span went back while its copy could still write it). A lasting
failure on a live device waits as long as it lasts. The README's restore paragraph says the make's
wait returns only once the batch completed or the device is lost.

The tests' stand-in for a failed wait (Core::fail_waits, inside wait_through) now reaches
Done::wait. New device test failed_waits::a_failed_restore_wait_is_made_again: with a Busy gate
holding the device's queue, a make in place whose batch wait fails at its first call must not
return while the gate holds the batch, then returns the texture in place once it opens, counted as
one restoring make with its two restore copies, and the pages hold the host's bytes.
2026-12-04 18:12:44 -08:00
Anees Iqbal 5e9855565a Validation: runtime-sources re-pinned after the swizzled_storage removal
crates/metal2vulkan/src/device/mechanism.rs moved in fddfdd2ce1, so the
runtime-sources fingerprint moves with it. The validation suite at the
lane's tip (job m3-max-87020) failed only this guard and printed the new
hash; pin-compute over development's tree gives the same value.
2026-12-04 18:12:44 -08:00
Anees Iqbal 1aa297d251 Docs: stale resident-table and ResourcePresence history says what is true now
- crates/metal2vulkan-runtime/src/error.rs: both RuntimeFact causes
  (the draw's and the kernel's) gave "ResourcePresence" as an example
  fact name; that fact no longer exists. The example is now "FlatGrid"
  (RuntimeFact::name of RuntimeFact::FlatGrid, which neither the
  kernel's nor the draw's fact match in the runtime names). The
  kernel's cause also named "a resource's presence or a sampler's
  coordinates" as facts the runtime does not name; neither is a
  RuntimeFact now, so the examples go.
- crates/metal2vulkan/src/tests/engine_extended_range/levels.rs: the
  module doc and the 3D test's doc told of development's resident-table
  tests and "the one form, as development's default policy did". They
  now say what holds: the conformance probe extended_linear_mip_blends
  measures Metal's mip filters, and the identity domains refuse such a
  sample with its texture argument.
- crates/metal2vulkan-validation/src/executor_contract/out_of_bounds/
  tests.rs: the identity-domains containment test's doc ended with a
  sentence on the resident table and the handle table, which the test
  no longer runs; it goes.

Searches: git grep -n 'ResourcePresence\|resident-table' over crates and
docs -> 0 hits after (3 before, all these sites).
refusal_surface.py --check passes.

Correction to 6d3a51f4fe's body: open_cl_1d_images at f6fc9cf282 is
8 hits in crates/metal2vulkan-air and 3 in crates/metal2vulkan, not 7
and 4. The total, 11, was right.
2026-12-04 18:12:44 -08:00
Anees Iqbal 050fb088af AIR: Entry.open_cl_1d_images goes; nothing reads it
Entry.open_cl_1d_images held the texture indices of an OpenCL-mode
kernel's 1D images. No caller in this tree read it: metal2vulkan's two
readers were test literals setting it to the default, and
pipeline::compile's bound_entry dropped canon::opencl::entry's set
(`let (ep, _) = ...`). Deleted:
- the field, and its binding in canon::specialize;
- the set canon::opencl::entry built, along with the AbiInt match that
  filled it; entry now returns the EntryPoint alone, and its retyping
  of each 1D image to the 2D texture Apple's OpenCL binds is unchanged;
- the BTreeSet imports of opencl.rs and tests/opencl.rs;
- the two test literals.
opencl_1d_images_take_their_2d_textures_types now checks, in place of
the set, that without the mode each image keeps its own 1D type: the
names bound_texture leaves at indices 1 to 3.

Searches:
- this tree at f6fc9cf282: git grep -n open_cl_1d_images -> 11 hits
  (crates/metal2vulkan-air 7, crates/metal2vulkan 4 with the signatures
  table); 0 after.
- reims-vgpu c16328ee3d (and cc1f47b30b): git grep -n open_cl_1d_images
  -> 0 hits.

The signatures table is blessed: exactly one record removed
(metal2vulkan-air::Entry.open_cl_1d_images).

Correction to 141dabb1e8's body: its swizzled_storage count at
f6fc9cf282 is 33 hits, not 32 (crates/metal2vulkan/src/cache/mod.rs has
5, not 4).
2026-12-04 18:12:43 -08:00
Anees Iqbal a49e4a61c4 Translator: the swizzled_storage variant goes; the runtime never asks for it
LoweringInputs::swizzled_storage and VariantKey::swizzled_storage have
no setter outside the translator's own tests. Since the identity domains
refuse any slot whose SlotPlan::swizzle is set
(IdentityCause::TextureState), a slot of the variant could only lead to
a refusal or to nothing. Nothing else reads the swizzle any more: the
emit side went in 6a08124f54.

Deleted with it:
- the cache key's "swizzled-storage" block;
- lower::texture::swizzled_storage and ::swizzles;
- SlotPlan::swizzle (identity_lowered now tests offset_base alone);
- the NotImplemented(TextureSwizzle) refusals of the variant's ulong,
  short-lane and imageblock-slice accesses (Feature::TextureSwizzle
  stays: bind/heap.rs refuses with it);
- the bicubic and packed-normalized sampling arms that read the
  variant, and the read path's storage_swizzle alpha term;
- the public RuntimeFact::TextureSwizzle, which only swizzles()
  produced, with its codec entry, mechanism, identity_unsourced arm and
  name. The mechanism test's variant index 35 now holds PrivateList and
  the covered range is 0..55.
Tests: tests/engine_swizzled_storage.rs goes (its reference rules
checked only its own helpers once the emit side was gone), and
engine_extended_range/bicubic.rs loses its swizzled cases. Docs fixed:
LoweringInputs, VariantKey, the sampler select and extended module
docs, IdentityCause::TextureState's examples, and the runtime README's
identity refusal list (TextureSwizzle no longer named).

No compile with empty inputs changes: every deleted arm was gated on
the set. The RuntimeFact encoding loses a variant; the
ARTIFACT_FORMAT_VERSION bump to 616 in 9cc7dd223a on this branch covers
it.

Searches:
- this tree at f6fc9cf282: git grep -n swizzled_storage in
  crates/metal2vulkan{,-runtime,-air,-validation,-harness,-devtools}
  and docs, fixture names (rrp_swizzled_storage) and the conformance
  case module aside -> 32 hits, all in crates/metal2vulkan; 0 after
  (crates/metal2vulkan-runtime: 0 before).
- reims-vgpu c16328ee3d (and cc1f47b30b): git grep -n swizzled_storage
  -> 0 hits; git grep -n RuntimeFact -> 0 hits.

The signatures table is blessed: exactly 3 records removed
(VariantKey.swizzled_storage, LoweringInputs.swizzled_storage,
RuntimeFact::TextureSwizzle). refusal_surface.py --check passes, so
docs/REFUSALS.md does not change.
2026-12-04 18:12:43 -08:00
Anees Iqbal ab351430d3 Translator: SpecConstant.unread_bits and the spec_bits analysis go; nothing reads them
StageSpec.unread_bits and the public SpecConstant.unread_bits were set
and never read. spirv::spec_bits::mark_unread computed them on every
compiled module, and link::specialize intersected them per key. Nothing
read the result: not the runtime (crates/metal2vulkan-runtime has no
hit), not the validation or conformance crates, and not the consumer.

Deleted:
- both fields, with their codec entries (cache/codec.rs);
- link::specialize's unread map and its doc sentence;
- compile.rs's mark_unread call;
- spirv/spec_bits.rs (the demanded-bits pass, 299 lines);
- its test module tests/engine_spec_bits.rs (149 lines);
- api_tests.rs's literal field.
engine_skeleton's expected StageSpecs are now plain StageSpec::new.
The SPIR-V a compile emits does not change: the pass only wrote the
interface fields.

ARTIFACT_FORMAT_VERSION goes from 615 to 616: StageInterface and
SpecializationLayout lose a field from their encoding.

Searches:
- this tree at f6fc9cf282: git grep -n unread_bits -> 13 hits, all in
  crates/metal2vulkan (the fields, codec, link, spec_bits, three tests,
  the signatures table); 0 after.
- reims-vgpu c16328ee3d (and cc1f47b30b): git grep -n unread_bits -> 0
  hits.
- reims-vgpu c16328ee3d: git grep -n spec_bits -> 3 hits, all in
  crates/reims-vgpu-c/link-order.txt (a link order list of symbol
  names; its doc says a function removed since is skipped and costs
  only the order's speed).

The signatures table is blessed: exactly one record removed
(SpecConstant.unread_bits). The proof jobs at the branch tip carry the
suites and clippy.
2026-12-04 18:12:43 -08:00
Anees Iqbal 53e2f370d8 CI: qualify the committed object and mesh cases on lavapipe
The engine's candidate now draws object and mesh cases through the
runtime's mesh pipeline, so the Linux qualification step runs the 13
committed mesh and object cases that draw on lavapipe against their
Metal rows. Two committed cases stay out: the object function's
threadgroup memory (3ff818075803), which the runtime refuses at the
state's make and the candidate meets as mesh_threadgroup_memory, and
the mesh function that numbers its primitive from its payload
(d2c517d1426d), whose mesh function aborts lavapipe's LLVM ("Cannot
emit physreg copy instruction").

Verified: the 13 cases matched Metal on lavapipe through corpus-vulkan
at c1bdd1e491 (job m3-max-86906); this commit's script run follows.
2026-12-04 18:12:43 -08:00
Anees Iqbal 27c7d07d06 Validation tests: the mesh threadgroup test's store takes its root by value
Clippy's needless_borrows_for_generic_args under --cfg m2v_gpu and --cfg m2v_cpu_icd (job
m3-max-86887).
2026-12-04 18:12:43 -08:00
Anees Iqbal 6f963fa297 Validation: an object case's threadgroup memory is the source's requirement alone
The previous commit also raised mesh_threadgroup_memory from a case's authored threadgroup_memory
(executor_contract::case_requirements). The mesh case's mapping refuses the case's literal
families (require_case_families), so the authored compile census's preparation, which sets the
requirement aside to compile the case, was refused too (the lavapipe validation suite, job
m3-max-86881: the_census_compiles_the_mesh_pipelines, engine_case_families_follow_the_case_literals
and the engine_mesh threadgroup test failed). The function's reflection alone raises it
(mesh_threadgroup_memory_requirement), as it raised the requirement this one narrows.
2026-12-04 18:12:43 -08:00
Anees Iqbal 7cb4195db7 Validation: the engine's candidate draws object and mesh cases through the runtime
The runtime makes and draws mesh render pipeline states (Device::new_mesh_render_pipeline_state,
the render encoder's set_object_*, set_mesh_* and draw_mesh_* calls), so the engine's candidate
now draws an object or mesh case as the Metal oracle draws it, instead of refusing every one as
mesh_render_pipeline. candidate::platform::runtime_mesh makes one mesh render pipeline state of
the oracle's descriptor (MeshTemplate::descriptor: the case's own function and the partners its
draw names from the row's library, the generated stages of an observation or object launch from
the companion's, its color formats or the 1x1 R8Unorm sink without rasterization), makes and
binds the own stage's buffers, argument-buffer members, textures and samplers through that
stage's setters (runtime_render's Stages, which now binds a stage of either pipeline kind and
selects a stage's output for both), makes each color target a Shared 2D texture of one sample
written from the case's bytes (Targets::of_colors), draws once (draw_mesh_threadgroups or
draw_mesh_threads), and reads the output back. A threadgroup within Metal's maximum and past the
state's on the device (Limit::MeshThreadgroupThreads) records not_enabled, as a sample count the
device makes no texture of does.

One vocabulary: mesh_render_pipeline is retired, and the one shape the runtime refuses keeps a
requirement of its own, mesh_threadgroup_memory (Limit::Runtime): an object or mesh function that
declares a [[threadgroup(n)]] argument (its reflected threadgroup buffer), and a case that authors
an object function's threadgroup_memory. Its doc names the runtime's refusal it mirrors, in the
runtime README's words: "An object or mesh function with a [[threadgroup(n)]] argument is refused
at the creation (Gap::RenderPipeline), as setObjectThreadgroupMemoryLength:atIndex: and its mesh
form are not built". The authored compile census still prepares such a case to compile it
(prepare_compile), so no compile cell changes. Classification, the case checker, the executor,
the triage, census, executor-contract, requirement and compile-census tests, the validation
README, docs/VALIDATION.md and the runtime README's sentence about validation's mesh cases follow.

Versions: the structural-triage analyzer v87 (rows' requirements change). ENGINE_EXECUTOR_ABI is
not bumped: no recorded row observes the change, as the executor refused every object and mesh
case before any device and stored no row of one. SEMANTICS_VERSION is untouched: translation
output does not change. The authored compile census version is untouched: no cell changes.

Venue: lavapipe lists VK_EXT_mesh_shader with taskShader, meshShader and multiDrawIndirect, the
runtime's mesh set, so lavapipe draws mesh pipelines and is the device test's venue.
2026-12-04 18:12:43 -08:00
Anees Iqbal 97a5f5732a Validation tests: the owned object and mesh fixtures drawn by the engine's candidate
A device test (candidate::tests::engine_mesh, under m2v_cpu_icd and m2v_gpu on Linux) admits each
owned object and mesh fixture of mesh_cases for the engine's candidate, prepares it and runs it as
a run of the candidate does (run_prepared, now pub(crate)), and holds the output to the words
Metal drew for it: a mesh grid through its fragment partner, an object case through its mesh and
fragment partners, a mesh function's device write without rasterization, a mesh grid through the
generated observer, an object case's launch through the generated mesh function, and the payload
a generated object function writes (payload_order on a GPU only, as its fixture states). The
fixtures now compile for the Linux device tests too.

At this commit the test fails: the candidate refuses every object and mesh case before it maps
(mesh_render_pipeline). The next commit makes the candidate draw them through the runtime.
Verified: the red run is named in the lane's report.
2026-12-04 18:12:43 -08:00
Anees Iqbal 37ab640c30 Docs and a test: a required constant left without a value is undefined, and the imageblock case is refused
Metal makes a function and its pipeline state from a specialization that leaves a required
function constant without a value, and runs it (the probe undefined_function_constant_values.m,
cases set0 and ib/*, the Apple M3 Max under macOS 27.0.1, job m3-max-86943), though Apple's
MTLFunctionConstant.required page says such a constant needs a value. What a program computes
from it is undefined, and the translation does not emulate Metal's answers, which follow no one
rule (the probe's kib, kib2 and derived reads against its gate kernel kg).

docs/API.md's "Function constants" says so, and names the case seen: a kernel whose explicit
imageblock argument is gated on a bool derived from the constant, and whose body still reaches the
imageblock on the way taken, is refused Unsupported{Imageblocks} with ImageblockCause::Missing.
The runtime README's known gaps of pipeline states records the same refusal of a state
(Error::Translation): the runtime compiles the consumer's specialized FunctionDescriptor as given
and does not consult FunctionDescriptor::needs_specialization, so a guest's specialization that
leaves the constant out reaches it.

engine_undefined_imageblock_gate pins today's answers for the probe's kib shape (its slice write
left out), on every profile that takes threadgroup memory: without a value for the constant,
Unsupported{Imageblocks} with ImageblockCause::Missing; with 0 or 0xffffffff, the kernel compiles.

Behaviour is unchanged, so no SEMANTICS_VERSION bump.
2026-12-04 18:12:42 -08:00
Anees Iqbal d650736ff7 Probe undefined_function_constant_values: required constants left out, and an imageblock gated on one
Apple's MTLFunctionConstant.required page says a required constant needs a value to specialize
the function. The probe now answers what Metal does when a specialization leaves one out, and
what it does with a kernel whose explicit imageblock argument is gated on a bool derived from one.

- A function Metal does not make prints the error's domain and code with its text.
- Cases ib/<kernel>/<how>: kib and kib2 gate an explicit imageblock on a bool derived from a
  required uint constant (index 40), kib branching on the bool and kib2 on its negation; each is
  made with no value, with 0 and with 0xffffffff, dispatched once, and its imageblock length,
  buffer words and two texels printed. Case ib-source prints their library's source for xcrun
  metal.

WHAT IT MEASURED, in the header: on the Apple M3 Max under macOS 27.0.1 (build 26A434), job
m3-max-86943, set0 (six required constants left out) makes the function and the state and
completes; kib with no value runs its buffer way with no imageblock (length 0), kib2 with no
value runs its imageblock way (length 1024) and its slice writes the expected texels. No case
errors, so no domain or code was printed.
2026-12-04 18:12:42 -08:00
Anees Iqbal 5787ca04d1 Validation: runtime-sources re-pinned after the translator's dead-code removal
bind/heap.rs, bind/state.rs and metal/format/mod.rs changed in the deadcode landing
(aa623881f4, 6a08124f54 replayed); pin-compute.py over the 50 listed modules (69 inputs) at this
tree gives d545bf4f7314, as the lane's validation job m3-max-86923 reported at its tip.
2026-12-04 18:12:42 -08:00
Anees Iqbal 8df73ca6dd Translator: pipeline::compile calls opencl::entry and specialized without the lines set
20030f2954 removed the open_cl_lines set from canon::opencl::entry and
from StageEntries::specialized's key, but three callers in
pipeline/compile.rs still passed it: bound_entry passed an empty set to
opencl::entry, and the render-stage and fragment lookups passed
(false, &BTreeSet::new()) where specialized now takes the bool alone.
They now pass `first` alone and `false`. bound_entry's comment loses
"whatever a variant binds": no variant binds a 1D image as a line now.

Verified: clippy job m3-max-86910 at e9ed4d85e4 reported exactly these
three errors (E0061 at compile.rs:704, E0308 at 1385 and 1624); the
rerun at this commit is the next clippy job.
2026-12-04 18:12:42 -08:00
Anees Iqbal 495b52603c AIR: canon::opencl_1d drops the Idx import of_params read
of_params, deleted one commit back with the open_cl_lines variant, was the import's only user
(a.index()); clippy's unused-imports failed metal2vulkan-air at 20030f2954 (job m3-max-86909).

That commit's body names 37 hits for git grep -n open_cl_lines -- crates docs at 9db78abe7d;
the count is 53 (the same files), 0 after.
2026-12-04 18:12:42 -08:00
Anees Iqbal a7166b2ded Translator: the open_cl_lines variant goes; the runtime never asks for it
LoweringInputs::open_cl_lines, VariantKey::open_cl_lines and metal2vulkan-air's
SpecRequest::open_cl_lines named the 1D images of a kernel of OpenCL mode that a 1D texture is
bound for, which then kept their 1D type and operations. metal2vulkan-runtime never asks for
that variant: it refuses a 1D texture bound for such a kernel (Gap::OpenClLineTexture, the
encoder's check of interface.open_cl_mode), since no reading of one is documented Metal, and
nothing else in the tree sets the field.

Consumer search: reims-vgpu cc1f47b30b (its development, read only): git grep -n open_cl_lines
-> 0 hits (its only OpenCL hits are its own open_cl_mode fields and the
RGFX_COMPUTE_PIPELINE_OPENCL_MODE flag). Its generated link-order.txt names
VariantKey::lowering_inputs' closures, not the field.

Deleted:
- metal2vulkan-air: SpecRequest::open_cl_lines; canon::opencl::entry's lines argument (every 1D
  image of the kernel now takes its 2D texture's type); canon::opencl_1d's kept parameters
  (site, of_params, kept_params), so expand rewrites every 1D operation it lists; the doc lines
  that named the variant. Entry::open_cl_1d_images stays: its doc drops the variant.
- metal2vulkan: LoweringInputs::open_cl_lines, VariantKey::open_cl_lines (is_empty and
  lowering_inputs), the function key's "open-cl-lines" part (appended only when set, so every
  surviving key hashes the same bytes), and compile.rs's plumbing: InputsFrom::open_cl_lines,
  StageEntry::open_cl_lines, the lines half of the stage entries' (mode, lines) match,
  given_inputs' clearing and the request's lines.
- Tests: the variant's half of the AIR test (renamed
  opencl_1d_images_take_their_2d_textures_types, which keeps its OpenCL-mode type names and
  open_cl_1d_images assertions), the api round-trip values, and the field in every
  SpecRequest and LoweringInputs literal (air canon tests, memory plan tests, air_canon,
  validation's check.rs).
- docs/API.md's OpenCL image paragraph named the variant; it now says each Mac's reading of a
  1D texture there, which the kernel does not take.

Public surface: python3 scripts/api-signatures/signatures.py --bless removes exactly the three
field records (metal2vulkan-air::SpecRequest.open_cl_lines,
metal2vulkan::cache::VariantKey.open_cl_lines, metal2vulkan::pipeline::LoweringInputs.open_cl_lines),
a breaking change of the two published crates. refusal_surface.py reads no such field:
--check passes unchanged, docs/REFUSALS.md does not move.

Output: none moves for any input the runtime makes. A kernel compiled with an empty set, the
only one anything sent, specializes and keys as before; SEMANTICS_VERSION stays (as at
a7dd2e846e for the binder's inputs). The per-parameter meter ticks of kept_params go with it.

Search at 9db78abe7d: git grep -n open_cl_lines -- crates docs: 37 hits across compile.rs,
cache/mod.rs, lower_inputs.rs, key.rs, the AIR canon and the tests; 0 after.
2026-12-04 18:12:42 -08:00
Anees Iqbal 2a9bad3c81 Translator: the swizzle and offset-base emit side goes; no slot carrying either is ever emitted
texture::Declared::swizzle and Declared::offset_base, the TextureSwizzle word and the
OffsetBaseAxes tests of a slot, were never inserted: their specializations are gone. Every
emit-side lookup of them therefore failed, and none was reached: a function that reads a slot's
bound swizzle (SlotPlan::swizzle, set with RuntimeFact::TextureSwizzle by texture::swizzles) or
places an offset by a view parent's base-level size (SlotPlan::offset_base) is refused at the
end of select by identity_admits (SlotPlan::identity_lowered, IdentityCause::TextureState),
which runs on every plan before any emit, and select builds the only Plan. Every flag the emit
side read (Sampling::swizzle and offset_base, extended::Sample's, routine::Extended's,
texture::Read::storage_swizzle, texture::Write::swizzle) was true only in such a function.

Deleted:
- texture: Declared::swizzle and offset_base, OffsetBase, Read::storage_swizzle,
  Write::swizzle; emit's swizzled read and unswizzled write arms and their helpers
  (swizzle_lanes, swizzled_texel, unswizzled, swizzled_float, swizzled_held, swizzled_gather,
  held_lane, sampled_lane).
- sampler: Sampling::swizzle and offset_base, with shared_shape's test of them and their
  estimated words (SWIZZLE_WORDS); emit::swizzled_value, texel_and_word and offset_base;
  extended::Sample::swizzle and offset_base, Texture::swizzle and parent, swizzled(), and their
  words; routine::Extended::swizzle and offset_base; bicubic::At::parent and the parent
  argument of footprint_of_image, axis and placed_offset; position::offset_dropped's parent
  argument and PARENT_RULE_WORDS.
- bind::state: TextureFacts::offset_base_axes, parent_relative_level and parent_base_size, and
  TextureShape::Texture::offset_base_axes, which only those read (bind::state is
  crate-private).
- position/tests.rs: the parent-bit test the_offset_rule_reads_the_parent_s_base_through_the_view_bit;
  the rule kernel keeps its two parentless forms, which its other tests read.

Kept: the selection side. A read, write or sample of a swizzled_storage slot still calls
texture::swizzles (the TextureSwizzle fact and SlotPlan::swizzle), and a wrapped offset still
sets SlotPlan::offset_base or, on a heap element, notes ViewBaseTexelOffset, so every refusal is
the one it was; the NotImplemented(TextureSwizzle) refusals are untouched.

Docs that named the deleted specializations now say what is true: RuntimeFact::TextureSwizzle,
LoweringInputs::swizzled_storage, VariantKey::swizzled_storage (the runtime asks for none:
git grep swizzled_storage -- crates/metal2vulkan-runtime has 0 hits), SlotPlan's two flags,
texture::swizzles and swizzled_storage, position's module doc, extended's module doc and
engine_swizzled_storage's.

Output: none moves. Every deleted branch ran only where its flag was true, in a plan the
identity domains refuse; offset_dropped with no parent emits the same instructions as before
(the (base, None) arm without the disjunction, the (None, None) arm as was). The estimated
words that leave counted only refused functions, so no census moves.

Search at 9db78abe7d: git grep -n 'offset_base\b\|OffsetBase\b' -- crates: 45 hits, now the two
SlotPlan flag writes, its field and identity_lowered's read, and the docs; git grep -n
'swizzle.insert\|offset_base.insert' -- crates: 0 (never inserted); git grep -n
'OffsetBaseAxes\|SpecKey::TextureSwizzle' -- crates docs: 0 after.

The runtime-sources inputs move: crates/metal2vulkan/src/bind/state.rs (bind/).
2026-12-04 18:12:42 -08:00
Anees Iqbal b770cc4af7 Translator tests: engine_texture.rs drops the FamilyStrategy import the nil-arm census read
The nil-arm test (removed one commit back) was its only user (s.words()); clippy's
unused-imports failed the lib test build at 4d40d42166 (job m3-max-86868).
2026-12-04 18:12:42 -08:00