Triforce v0.2.0

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
ruckus7382sfgsgdf
2026-11-10 19:32:48 -06:00
commit 34b3683441
1730 changed files with 554853 additions and 0 deletions

View File

@@ -0,0 +1,43 @@
cmake_minimum_required(VERSION 3.20)
project(global_load_16_ir LANGUAGES CXX)
set(CMAKE_CXX_STANDARD 20)
set(CMAKE_CXX_STANDARD_REQUIRED ON)
if(NOT DEFINED REPO_ROOT OR NOT DEFINED SPIRV_HEADERS_ROOT)
message(FATAL_ERROR "REPO_ROOT and SPIRV_HEADERS_ROOT are required")
endif()
file(GLOB_RECURSE BACKEND_SOURCES CONFIGURE_DEPENDS
"${REPO_ROOT}/gpu/vk/eden/shader_recompiler/backend/spirv/*.cpp")
file(GLOB_RECURSE IR_SOURCES CONFIGURE_DEPENDS
"${REPO_ROOT}/gpu/vk/eden/shader_recompiler/frontend/ir/*.cpp")
file(GLOB_RECURSE OPTIMIZATION_SOURCES CONFIGURE_DEPENDS
"${REPO_ROOT}/gpu/vk/eden/shader_recompiler/ir_opt/*.cpp")
file(GLOB_RECURSE SIRIT_SOURCES CONFIGURE_DEPENDS
"${REPO_ROOT}/gpu/vk/sirit/src/*.cpp")
add_executable(global_load_16_ir
"${REPO_ROOT}/tests/global_load_16_ir.cpp"
${BACKEND_SOURCES}
${IR_SOURCES}
${OPTIMIZATION_SOURCES}
${SIRIT_SOURCES})
target_include_directories(global_load_16_ir PRIVATE
"${REPO_ROOT}/gpu/vk/compat"
"${REPO_ROOT}/gpu/compat"
"${REPO_ROOT}/gpu/vk/eden"
"${REPO_ROOT}/gpu/third_party/suyu"
"${REPO_ROOT}/gpu/vk/sirit/include"
"${REPO_ROOT}/gpu/vk/sirit/src"
"${SPIRV_HEADERS_ROOT}/include")
target_compile_definitions(global_load_16_ir PRIVATE
NDEBUG MKWVK_INCLUDES=2 VK_NO_PROTOTYPES)
if(MSVC)
target_compile_options(global_load_16_ir PRIVATE /W0 /O1 /EHsc)
else()
target_compile_options(global_load_16_ir PRIVATE -w -O1)
endif()

View File

@@ -0,0 +1,46 @@
# SPIR-V global narrow load/store regression
This fixture builds a small `IR::Program`, runs the real shader-info pass and
`EmitSPIRV`, then checks both the emitted instructions and the generated module
with `spirv-val`. It covers signed and unsigned halfword loads at naturally
aligned offsets, preservation of high guest-address bits, and a page-end access
at byte offset `0xffe` whose helper word base is `0xffc`. Narrow 8- and 16-bit
stores use an aligned-word compare-exchange loop and bit-field insert. A
mesh-stage load and store preserve the upstream regression cases. The existing
zero-result behavior without 64-bit integer support is checked too.
Eight single-storage-buffer scenarios trace the actual called U32 helper's
range branch. Its logical end must use the original descriptor address plus
size, then be capped by `OpArrayLength`. Concrete cbuf/descriptor inputs cover
a hit at `0x1004` with size 2 and alignment 16, a miss at `0x1008`, an aligned-base
control, short and zero-length descriptor caps, signed/unsigned loads and a
high 64-bit base. These eight scenarios and the eleven upstream cases emit
nineteen modules. Two more vertex fixtures check that the 32-bit and
128-bit load helpers default to `DontInline` and that the runtime workaround
switches only the 128-bit helper to `Inline`.
The additional `--cas-loops OUTPUT_DIRECTORY` case emits one real compute IR
program with shared/storage byte writes, a storage/global float atomic add and
a global compare-and-swap. With `RX_VK_FOLLOW_STORES=1`, it checks seven emitted
retry loops across the SSBO and page-table routes. Each counter must be a leading
entry-block variable, reset before its loop, incremented once per failed or
successful exchange, and tested against 1024 alongside the actual exchange
success. The failed-attempt path must feed back the returned word and retry.
The two alternative single-exchange global CAS routes must return directly,
without being counted as retry loops. CI validates all twenty-two modules.
The fixture checks the emitted SPIR-V dependency chain; it does not execute a
shader or driver, and does not validate odd guest addresses or AMD hardware. It
tests the SPIR-V backend's lowering contract only.
The workflow checks out the pinned SPIR-V-Headers revision and uses the system
SPIR-V Tools validator with `--uniform-buffer-standard-layout`: the single-SSBO
fixture profiles use four-byte array strides in a uniform block. This validation
option describes those fixture profiles; it does not test device feature enablement.
Reproduce it with Clang in C++20 mode, as in the Linux workflow. The focused
target includes project compatibility headers with a function-local static
inside a `constexpr` assertion macro. GCC rejects that construct in C++20,
while the project's production Linux compiler is Clang in C++20 mode. The
fixture does not establish an unmodified MSVC build.
To include the CAS case when reproducing manually, run the built fixture again
with `RX_VK_FOLLOW_STORES=1` and `--cas-loops` before validating the output modules.