Vulkan has no sequentially consistent order ("SequentiallyConsistent memory semantics is not
supported and must not be used", vkspec 1.4.366, Memory Semantics), and an acquire-release fence
lets two threads that each store and then load the other's word both read the old values, which
Metal's seq_cst fence forbids: it "establishes a single total modification order of all tagged
atomic operations" (MSL 6.16.1). Such a fence was refused, Unsupported{IdentityDomains}
SeqCstFence; five kernels of the first-setup walk's library aa5e72671a992cea meet it, each with
four air.atomic.fence(mem_device, seq_cst, device) (probe m3-max-84688).
The planner's ruled form, one for every device: a seq_cst air.atomic.fence at any scope beyond
the thread, an LLVM fence seq_cst, and a program's seq_cst barrier whose memory scope is the
device keep the acquire-release barrier they had at their own scope, then add 1 with
OpAtomicIAdd at Device scope, with the barrier's semantics, to the device's fence word. Adds to one
word are totally ordered and each reads the one before it, so the earlier fence's add (a release)
synchronizes with the later's (an acquire). Threadgroup and simdgroup fences take the device word
too (planner, option A): a stronger order than Metal names, with no workgroup memory and no
change to the threadgroup memory limit.
The word: pipeline::SEQ_CST_FENCE_WORD (256) bytes past PushField::ZeroAddress, in the runtime's
zero chunk: one per device (Core holds one Ring; the chunk is kept for the device's life and never
given back), made with every buffer usage, read only in its first 16 bytes (a checked load's unit
at ZeroAddress, psb::ZERO_RANGE_READ, and an indirect command buffer reset's index token of 0
bytes), its value never read. A function with such a fence reads ZeroAddress whether or not it
checks an access (access::place_zero_address keeps it). No new push field.
- lower::sync::barrier: total_order (selection: notes device scope, places ZeroAddress) and
add_to_fence_word (emission); Fence and Barrier carry `total`; require_seq_cst and
SEQ_CST_FORM deleted. lower::sync::memory_model: the LLVM fence's `total`.
- error: IdentityCause::SeqCstFence deleted (the consumer names it nowhere: git grep -n
'SeqCstFence\|SEQ_CST\|seq_cst_fence' at reims-vgpu f054ad57c1 finds only C __ATOMIC_SEQ_CST).
- Guards: psb.rs asserts ZERO_RANGE_READ <= SEQ_CST_FENCE_WORD at compile time; ring.rs asserts
the word fits its chunk; the_fence_word_lies_past_the_zero_range_s_reads checks both readers.
- Tests: the red test's threadgroup and simdgroup rows take the device add (option A); the
identity, dispatch and MSL 4.1 tests compile a4_device_fence, device_fence_store and
a27_memory_order where they asserted the refusal.
- Validation: ToolingRequirement::SeqCstFence and executor_contract::seq_cst_fence retired, as the
runtime runs the fence; a_seq_cst_fence_runs_through_the_runtime replaces the refusal test.
- Docs: the runtime README moves the fence from the identity refusals to a known gap with the
add's cost (RTX 3090 m3-max-84667, RX 7900 XTX m3-max-84666, Iris Xe m3-max-84668; device
fences, standing for threadgroup and simdgroup ones too); docs/API.md and ring.rs say where the
word lies. api_signatures.tsv blessed; REFUSALS.md regenerated, unchanged.
- SEMANTICS_VERSION 2360 (2359 went to checked naming, which landed first), RUNTIME_VERSION 2565 (a runtime word added; renumbered 2566 below).
Verified, potluck jobs on this branch rebased onto development 436dd1045e, each at a commit of
the branch (whose later commits declare the MSL 4.1 barrier in the test, count 40 requirements,
take RUNTIME 2566, satisfy clippy's assertions_on_constants and add the api_surface row):
- m3-max-84728: the red test at the red commit, with the barrier declared, fails on the
IdentityDomains SeqCstFence refusal (RED EXIT=100); validation 1344 passed, 2 skipped;
conformance 1053 passed, 0 skipped; doctests EXIT=0.
- m3-max-84778, at the tree of the branch's last commit: clippy plain EXIT=0; metal2vulkan,
air, runtime, devtools and harness 3494 run, 3491 passed, 24 skipped, 3 failed: golden_hashes
and the fixture inventory's parts 1 and 4, whose 45 moved cells are a27_memory_order,
a4_device_fence and device_fence_store on each of 15 profiles,
Unsupported{IdentityDomains} -> ok (re-blessed on development). The seq_cst test validates
every module with spirv-val on every profile.
- clippy -D warnings with the const assertions: plain m3-max-84758, --cfg m2v_gpu
m3-max-84759, --cfg m2v_cpu_icd m3-max-84761, each EXIT=0; rustdoc and api-docs at the last
commit's tree, m3-max-84817, EXIT=0.
- Cells against the M3 Max's committed Metal observations: a4_device_fence (8ebbfe8893f9) and
a27_memory_order (914fc7fd4040) Match on lavapipe (m3-max-84766) and on the Radeon 780M under
its venue amd-780m-radv (m3-max-84772); a_seq_cst_fence_runs_through_the_runtime and
a_fence_of_another_order_is_made_through_the_runtime pass on both.