Files
metal2vulkan/crates
Anees Iqbal a8d9e65d87 Runtime tests: Metal-mode barriers and a fence above one SIMD group, data crossing them
The runtime's device tests held threadgroup_barrier(mem_threadgroup) alone above one wave with
data crossing waves, and nothing else: no mem_device barrier whose data crosses a 64-wide wave
(row_barrier's 32-wide rows pair within one wave on a wave64 device), no barrier of both flags, and
no air.atomic.fence. Four tests beside the originals, which stay unchanged, each with its answer
computed in the test:

- every_device_reads_another_simd_groups_device_word_past_a_device_memory_barrier: the harness
  fixture's row_barrier (mem_device alone) in rows of 64 and 128, threadgroups of 128 and 256,
  so thread t reads what thread t ^ 64 (or t ^ 128) stored in the device buffer: 512 x 4,
  512 x 3 (ragged in y) and 200 x 4 (ragged in x) in 64 x 2, 512 x 4 in 128 x 2, 192 x 8 in 64 x 4.
- every_device_reads_another_simd_groups_device_words_across_a_float_arenas_barrier:
  float_arena_reader, FLOAT_ARENA whose last loop reads the device words the loop before its
  mem_device barrier stored (thread t reads threads 4t..4t+3 mod 256's) in place of the arena.
- every_device_orders_both_memories_across_simd_groups_through_one_barrier: both_flags, a loop of
  four over one barrier of mem_device | mem_threadgroup, thread t reading the threadgroup word of
  t ^ 64 and the device word of (t + 64) % 256, in 8 threadgroups of 256 and 4 of 1,024.
- every_device_gathers_every_simd_groups_word_past_a_fence_and_an_atomic_count: Metal's fence
  pattern (MSL 6.16.1, 6.16.3), the last of 256 threads to add to a relaxed atomic count, after a
  seq_cst air.atomic.fence of mem_device, fences again and copies every thread's word; at
  thread_scope_threadgroup and thread_scope_device, 16 threadgroups. No thread waits for another.

The kernels are LLVM text in the test, as FLOAT_ARENA and VOTE_WORD are; row_barrier is the
harness fixture's own.
2026-11-27 03:33:30 -08:00
..