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,26 @@
cmake_minimum_required(VERSION 3.20)
project(native_suatom 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()
set(SHADER "${REPO_ROOT}/gpu/vk/eden/shader_recompiler")
file(GLOB_RECURSE SOURCES CONFIGURE_DEPENDS
"${SHADER}/backend/spirv/*.cpp"
"${SHADER}/frontend/ir/*.cpp"
"${SHADER}/frontend/maxwell/*.cpp"
"${SHADER}/ir_opt/*.cpp"
"${REPO_ROOT}/gpu/vk/sirit/src/*.cpp")
add_executable(native_suatom "${REPO_ROOT}/tests/native_suatom.cpp" ${SOURCES})
target_include_directories(native_suatom 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(native_suatom PRIVATE NDEBUG MKWVK_INCLUDES=2 VK_NO_PROTOTYPES)
if(MSVC)
target_compile_options(native_suatom PRIVATE /W0 /O1 /EHsc)
else()
target_compile_options(native_suatom PRIVATE -w -O1)
endif()

View File

@@ -0,0 +1,34 @@
# Direct surface atomic regression
The fields in `../native_suatom.cpp` are independently authored. No game shader,
dump, cache or private SDK instruction is used. The small Python check compiles
the production lowering header; the CMake target additionally runs the same
instructions through the actual Maxwell CFG/translator, optimization passes and
SPIR-V emitter. Every emitted module is validated in the existing Linux SPIR-V
job. No GPU or game executes.
The accepted form is direct-descriptor `0x593`, 1D U32 ADD, sample addressing,
IGN, Strong(GPU), normal eviction, and no fault-predicate destination. Other
forms and modifiers are refused. Registers and descriptor fields are authored
separately, with alias/high-register, predication, branch relocation, offset/bank
boundary and conflict cases. The full path checks the descriptor bank and byte
offset, atomic coordinate/addend, and a store consuming the returned old value.
Strong(GPU) is not an acquire/release qualifier. Mesa emits image atomics with
`MemOrder::Strong(MemScope::GPU)` and handles explicit barriers separately. The
existing image atomic backend emits a Device-scoped relaxed atomic; no fences
are added by this lowering. A case with explicit native MEMBARs verifies those
barriers survive independently.
Encoding references:
- [Independent decoder](https://github.com/seedds/nxnative/blob/7f50222003e4270e3655d4f798e85744d390edf0/dm/third_party/ryujinx/src/Ryujinx.Graphics.Shader/Instructions/InstEmitAmpereMem.cs#L529): direct descriptor bank/word offset and SUATOM operands.
- [Mesa encoder](https://chromium.googlesource.com/external/gitlab.freedesktop.org/mesa/mesa/+/b1fe47e94409d81924c8663f58fac97e66ab4527/src/nouveau/compiler/nak/sm70_encode.rs): shared atomic/dimension/type/order fields. Mesa encodes its register-handle form, not this direct-descriptor opcode.
- [Mesa NIR translation](https://chromium.googlesource.com/external/gitlab.freedesktop.org/mesa/mesa/+/b1fe47e94409d81924c8663f58fac97e66ab4527/src/nouveau/compiler/nak/from_nir.rs): Strong(GPU) image atomics and separate barriers.
- [Public SM87 encoding tables](https://mbuchel.github.io/sass-encoding-lab/): `0x593` and IGN. The opcode table SHA-256 is `559048b6a840e5548ba5fa577e31230f0a217f370d50c7c378e12997d96dd747`.
Configure with Clang C++20 and `-DREPO_ROOT=<repo>` plus
`-DSPIRV_HEADERS_ROOT=<SPIRV-Headers>`, then build `native_suatom`. Run it with an
authored output directory and validate its `.spv` files using `spirv-val
--target-env vulkan1.3`. These checks establish translation and module validity,
not driver execution, general surface-atomic coverage or a visible game fix.