mirror of
https://github.com/MacosPorters/betterxen.git
synced 2026-11-26 22:10:44 +00:00
Adds v_cmp_{lt,eq,le,gt,ne,ge}_{i32,u32}_e32 across the chain: opcodes
generated from the pinned AMD XML, one typed VectorCompare instruction
(relation + signedness, table-driven decode), the reference interpreter,
the independent semantic-review interpreter, typed IR and MSL.
Rules (RDNA 2 ISA guide 3.9, 2.1, 3.3; contract in
docs/shaders/vector-compare.md): VCC_LO[n] = EXEC_LO[n] & test(lane n),
always fully written, so empty EXEC gives 0 and reads no source; VCC_HI
becomes unknown; EXEC, SCC and VGPRs are unchanged. A lane-derived
VCC_LO may feed only s_cbranch_vccz, v_mov_b32 vN, vcc_lo and another
compare's SRC0, so EXEC never becomes data-dependent. A runtime
s_cbranch_vccz is wave-uniform: the skipped code may hold only integer
vector ALU instructions with initialized destinations, checked whether
or not it is taken, and lowers to selects at the join.
The Metal kernel makes no SIMD-group, threadgroup or barrier assumption:
each thread rebuilds its RDNA wave's mask by recomputing the 32 lanes'
operands from their input words, bounded by threads_per_grid. The
reference now runs lockstep Wave32 waves; absent lanes of a final
partial wave contribute 0.
Verified with an original LLVM-assembled fixture and 251 programs
(every form on 10 boundary values in both operand orders, partial and
empty EXEC, both runtime branch edges in one dispatch, mask chains,
32 pinned rejections) against exact integer definitions. Translator,
reference and second interpreter agree on CPU; all 252 programs match
on native Metal with validation; LLVM agrees on every encoding.
Breaking any implementation (signedness, EXEC masking, empty EXEC,
absent-lane bound, join polarity or uniformity) fails the tests.
Fixes #186
Signed-off-by: elforeign <324243036+elforeign@users.noreply.github.com>
32 lines
1.4 KiB
Bash
Executable File
32 lines
1.4 KiB
Bash
Executable File
#!/bin/sh
|
|
# SPDX-License-Identifier: GPL-3.0-or-later
|
|
set -eu
|
|
cd "$(dirname "$0")/.."
|
|
|
|
export MTL_DEBUG_LAYER=1
|
|
export MTL_SHADER_VALIDATION=1
|
|
export MTL_SHADER_VALIDATION_REPORT_TO_STDERR=1
|
|
export MTL_SHADER_VALIDATION_ABORT_ON_FAULT=1
|
|
export CARGO_BUILD_JOBS=${CARGO_BUILD_JOBS:-4}
|
|
|
|
cargo test --locked -p xenora-metal --features gpu-tests --test native_compute --no-run
|
|
timeout 30s cargo test --locked -p xenora-metal --features gpu-tests --test native_compute -- \
|
|
--nocapture --test-threads=1
|
|
|
|
cargo test --locked -p xenora-loader --features gpu-tests --test dbt_render --no-run
|
|
timeout 30s cargo test --locked -p xenora-loader --features gpu-tests --test dbt_render -- \
|
|
--nocapture --test-threads=1
|
|
|
|
cargo test --locked -p xenora-loader --features gpu-tests --test runtime_x15 --no-run
|
|
timeout 30s cargo test --locked -p xenora-loader --features gpu-tests --test runtime_x15 -- \
|
|
test_fixture_c_service_to_metal_framebuffer --exact --nocapture --test-threads=1
|
|
|
|
cargo test --locked -p xenora-loader --features gpu-tests --test graphics_d3d12 --no-run
|
|
timeout 30s cargo test --locked -p xenora-loader --features gpu-tests --test graphics_d3d12 -- \
|
|
--nocapture --test-threads=1
|
|
|
|
# Native Metal known answers of the independent semantic review, including SOP2 scalar ALU
|
|
# and VOPC compares.
|
|
cargo test --locked -p xenora-semantic-review --no-run
|
|
timeout 60s cargo test --locked -p xenora-semantic-review -- --ignored --nocapture --test-threads=1
|