Files
Triforce-Source/tests/f2i_immediate
ruckus7382sfgsgdf 34b3683441 Triforce v0.2.0
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-10 19:32:48 -06:00
..
2026-11-10 19:32:48 -06:00
2026-11-10 19:32:48 -06:00
2026-11-10 19:32:48 -06:00

Native F2I immediate regression

This game-free fixture constructs its instructions from independently chosen registers, float values and bit patterns. It calls the production Ampere lowerer, Maxwell decoder and conversion implementations, then emits real IR and SPIR-V. No game, dump, cache, driver or GPU is used.

The immediate contains all 32 source bits. Bits 62 and 63 of the native instruction belong to that literal; they are not the register source's abs/neg modifiers. The test checks literal preservation, signedness, destination width, four rounding modes, FTZ, ordinary/inverted predicates and @!PT skipping. It also checks existing register/cbuf/uniform source forms and explicitly rejects immediate F16, F64, 64-bit output, non-NTZ and unknown modes. The accepted U16 form remains FTZ/nearest only.

CC=clang CXX=clang++ cmake -S tests/f2i_immediate -B build-f2i \
  -DREPO_ROOT="$PWD" -DSPIRV_HEADERS_ROOT=/path/to/SPIRV-Headers
cmake --build build-f2i --parallel 2
build-f2i/f2i_immediate build-f2i/modules
for module in build-f2i/modules/*.spv; do
  spirv-val --target-env vulkan1.3 --uniform-buffer-standard-layout "$module"
done

The unmodified 232eecb lowerer fails the first authored immediate case with unsupported native opcode. The fixture tests the conversion path and its IR controls; SPIR-V validation does not establish numerical results on a GPU or a fix for any particular visible game symptom. In particular, it does not change or independently certify existing register-path saturation at numeric limits.

Encoding reference: Mesa NAK, pinned sm70_encode.rs (OpF2I, encode_alu_base and encode_alu_imm). The 0x105 base plus immediate form 4 in bits 9–11 gives 0x905. Inputs or outputs wider than 32 bits use a different base, 0x111. NVIDIA PTX conversion documentation describes rounding, FTZ, saturation and NaN results; it is not a SASS encoding specification.