Files
metal2vulkan/crates
Anees Iqbal e2e76d8879 Translator: a slot's direct base and address are made once where they dominate; an access adds its carry alone
PR 22's carry form cost about 10 SPIR-V instructions for each direct access against 2 before,
and engine_access_size::a_device_access_of_whole_words_is_one_access failed its bounds at
2f5f35ca47 (m3-max-77753, first identity profile: the uint-offset float4 load and store 24
against a bound of 16, the float4-offset load 23 against 16, the pointer chase 33 against 24;
the old form 16, 16, 15 and 24). Most of that was work repeated on every access: the base's u64
bitcast back to words and its split, and an add of the offset's zero high word; and
slot_address added the bias with the same sequence at every use.

Now:
- pointer::direct_base: the slot's address less the bias as its two words (the SlotGuestBase
  push word split, or in a replay variant that word less 2^31 with a borrow), remembered under
  SlotMemo::DirectBase and recalled where its block dominates (EmitCx's invariant memo, as
  slot_bounds does). Reach::Direct holds the words; biased_slot_address, which only the direct
  reach called, goes.
- psb::add_slot_offset: OpIAddCarry of the low word and the offset, its two words, one add of the
  carry to the high word, the words joined and bitcast: six instructions, with no add of a zero
  word and no 64-bit add of a constant.
- pointer::slot_address: remembered under SlotMemo::Address, so a pointer compare, a converted
  or stored pointer or an access from the word below adds the bias once where it dominates.

The arithmetic is unchanged: the address plus the unsigned biased offset modulo 2^64, carried
into the high word as PR 22 made it. SEMANTICS_VERSION 2309 -> 2310 (module bytes change).

Verified: nothing run yet for this commit; the access-size table, the engine suites and the merge
check run next, and the table is reported against the bounds.
2026-12-02 01:58:07 -08:00
..