spirv_mini_interp.py had neither, so the translations of v_bfrev_b32,
s_brev_b32 and s_abs_i32 could not run. OpBitReverse reverses the bits at the
result's width. SAbs wraps the most negative value to itself, as s_abs_i32
does on the hardware.
test_alu_bitrev_abs.py checks v_bfrev_b32 and s_brev_b32 (and that two
reverses give the input back), and s_abs_i32 with its SCC, including
0x80000000. test_interp.py tests both ops directly.
Every GDK title calls XGameRuntimeInitialize first and builds its async work on
XTaskQueue/XAsync. Add an xgameruntime.dll shim table for those, ahead of the
executable: XGameRuntimeInitialize/Uninitialize (reference counted),
XSystemGetDeviceType (Series X; LEONIDA_DEVICE_TYPE overrides) and
XSystemGetConsoleId (placeholder), plus the 23 XTaskQueue/XAsync functions.
XTaskQueue/XAsync come from microsoft/libHttpClient (MIT), copied unmodified
into third_party/xtaskqueue (task queue only, no HTTP stack); a small pch.h
stand-in lets them build alone. xgameruntime_test drives the table through
the shim registry the way a title boots. Nothing goes online.
Both inputs mapped to x.wav (as did x.ogg and x.OPUS on Windows). Two jobs then decoded into the same
x.wav.part.wav at once, and with --jobs 1 the second replaced the first; either way the summary said
"3 WAV written" while one result was gone. output_names now keeps the extension for inputs that share a stem
(x.ogg.wav, x.opus.wav) and adds ~2, ~3 if a name still clashes. Unique names are unchanged, so WAVs from
earlier runs are still found and skipped.
make_game.py is not affected: it runs this tool on awc_opus.py output, which is all .ogg.
Tests: SameStemTest in tests/test_audio_wav.py, with a fake ffmpeg so it runs without ffmpeg installed.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
GFX10 format names list the channel widths from the top bit, so 2_10_10_10
(50) is R10G10B10A2 and 10_10_10_2 (44) has a 2-bit x. FORMATS read them
from bit 0, which swapped the two for typed buffer loads and stores.
cs_store now writes its R10G10B10A2 word through 50. cs_fmt_1010102 covers
both formats; to run it, buffer_load_format masks a shift that was 32 for
aligned elements, and the test interpreter gains the conversions it needs.
spirv_mini_interp.py had OpISubBorrow but no OpIAddCarry, so no carry-out add
(v_add_co_u32, v_add_co_ci_u32, s_add_u32, s_addc_u32) could be run.
test_carry_chain.py checks the result and carry-out of v_add_co_u32,
v_sub_co_u32, v_subrev_co_u32 and their _co_ci forms (e32 through VCC, e64
through SGPRs), and of s_add_u32/s_addc_u32 and s_sub_u32/s_subb_u32 through
SCC, at the carry and borrow boundaries. It also checks the 64-bit add and
subtract built from each pair. test_interp.py tests OpIAddCarry directly.
The fallback block (no VS CMake tools) built vk_texture_test when
VULKAN_SDK is set but not the two tests this branch adds. They are built
the same way now: both include their headers by relative path and need no
library.
Not run here: this machine has no MSVC or PowerShell. The two sources
build with MSVC through CMake (reported on the pull request).
Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
spirv_mini_interp.py had OpULessThan, OpUGreaterThanEqual and a 32-bit
OpSLessThan only, so most v_cmp_* and s_cmp_* translations could not run. It
now has OpULessThanEqual, OpUGreaterThan and the four signed orderings, and
reads a signed operand at the width of its type, so a 64-bit compare is not
cut to 32 bits.
test_int_compares.py checks v_cmp_{eq,ne,lt,le,gt,ge} for u16/i16/u32/i32
(e32 and e64) and u64/i64, s_cmp_{eq,lg,lt,le,gt,ge} for u32/i32, and
s_cmp_{eq,lg}_u64 at sign and width boundaries against Python's own
comparison. test_interp.py tests the new ops directly.
Decode the filler, header, 20-byte records and name record after
code_end, and add a --bindings summary. Measured over 26,503 blobs:
5,640,704 records, all parse.
verify read the manifest with json.load(...)["files"] and indexed each entry's "size" and "sha256" directly,
and main caught only OSError. A truncated or malformed manifest therefore ended in a JSONDecodeError, KeyError
or TypeError traceback. load_manifest now checks the JSON, the "files" table and every entry, and raises
ManifestError, which main reports as an ERROR line with exit 2 like a missing file.
create wrote the final manifest in place, so an interrupted run left exactly such a truncated file. It now
writes <out>.partial and swaps it in with os.replace, removing the partial file on any failure; the previous
manifest stays as it was.
The shipped game/xbox-1.0.2.1.json still loads (108 entries).
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
A device without bufferDeviceAddress or shaderInt64 now gets "unsupported: ..." and exit 77, which check.py and
run_gpu_tests.py report as SKIP (the same handling as #203), so ps_vcc_x2 doesn't turn into a FAIL there. Words
are decimal or 0x hex only (no octal, sign or spaces), a trailing comma is rejected, and an empty VKH_HEAP is unset.
Shaders that only use s_bcnt1_i32_b64 (and related mask ops) on ordinary
SGPR pairs were translated as wave32. Treat those ops as wave64 markers
and add a GPU test that expects a count of 48.
A descriptor is the bytes of its heap slot (a TargetView in RTV and DSV
heaps, otherwise what the shader loads), so both are byte copies.
CopyDescriptors walks the destination and source range lists together,
one descriptor at a time; null size arrays mean one descriptor per range,
and whichever side runs out first ends the copy.
Test: d3d12_descriptor_test, through the Xbox-ABI proxy, checks the slots'
bytes for one run, range lists of different shapes on each side, null
size arrays, a destination longer than its source, and null arguments.
Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
Set 0 as the translator declares it (docs/design.md, docs/d3d12_vulkan.md
section 5), in runtime/src/vulkan_bindless.h: the twenty bindings with the
array sizes vk_pipeline_check uses, and DescriptorTable (descriptor_table.h)
behind binding 2.
- An image has one index in its dimension (2D, 2D array, 3D, 1D), the same
in every binding of that dimension. The storage arrays hold 256, so an
image with a storage view gets an index below 256 and a read-only one
goes above while there is room.
- Index 0 of every array is a fallback (a 1x1 image of zeros, a nearest
clamping sampler), because a miss in the table is index 0.
- Changes are queued and written by flush(), one write a slot: a view
removed before the next flush is never written, so it may be destroyed
at once.
- insert_key / erase_key change the table; flush() copies it to the buffer,
into a new and larger one when it has grown. Erasing compacts a probe
cluster, which moves other keys' entries, and a new buffer rewrites
binding 2: flush_needs_idle() says when a flush would do either, so the
owner can make sure no command buffer that uses the set is still running.
- With update after bind the set may be flushed between submissions; with
partially bound only index 0 is written at creation.
Test: vk_bindless_test, run by runtime/test/shaders/check.py and
scripts/run_gpu_tests.py. ps_tex.asm, a hand-written RDNA2 pixel shader
built by build.py, loads a T# and an S# from a descriptor table and
samples: the translator's own lookup against the table and the set. It
draws the gradient with the T# at the fourth slot probed, the fallback
after the key is erased, the gradient after the table has grown into a new
buffer, another view at the same index and the fallback after removal,
with and without the descriptor-indexing flags; and it adds, removes and
destroys a view before its first flush, which the validation layer reports
if the write is still made.
Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
docs/d3d12_vulkan.md section 5.3 asks for a C++ decoder of the structures the
shaders read from descriptor heaps, and section 3.4 for the layer to write them
in Create*View and CreateSampler. runtime/src/gfx10_descriptors.h is that
piece, as a header with no Windows dependency; nothing uses it yet.
- T# (image, 8 dwords), S# (sampler, 4) and V# (buffer, 4): encode from and
decode to plain structs. Field positions are Mesa's register database
(src/amd/registers/gfx10-rsrc.json, the gfx103 types), enum values its
gfx6.json, and what goes where follows ac_descriptors.c and radv. They agree
with what the translator reads: T# FORMAT at word 1 bits 28:20, the V# base,
stride, NUM_RECORDS, FORMAT and DST_SEL.
- Only what a Vulkan view or sampler needs is encoded; tiling, compression
metadata and tuning fields are written as zero and ignored when decoding.
- decode refuses dwords whose TYPE is not an image's (so a V# in a 32-byte heap
slot is told apart), a reserved DST_SEL, and ranges that end before they
start.
- Format table: GFX10_FORMAT code <-> VkFormat with each format's channel
order as a DST_SEL (BGRA8 is 8_8_8_8 read as Z, Y, X, W), the view format for
a T# on an image, DST_SEL -> VkComponentMapping, S# -> VkSamplerCreateInfo,
T# type -> VkImageViewType (a cube is a 2D array, as the translator samples
it).
Tests: gfx10_descriptors_test (ctest, Vulkan headers only): every field alone
at its bit position, round trips, refusals, the T#s cs_imgstore.asm builds,
the V# as the translator reads it, sampler words as radv writes them, the
format table and the mappings. tests/test_gfx10_descriptors.py reads the
table out of the header and checks each code's name against
tools/gfx10_formats.json and each Vulkan format's layout against that name.
Moving FORMAT by one bit, or giving a row another code, fails them.
Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
Raise Unsupported when a voted branch's segment was not started by the vote's
own round. New tests cs_w64x_mask_reuse2 (EXEC reuse, read after a store,
half of a mask pair rewritten, chained successor starting with a conflicting
load) and cs_w64x_chain_barrier (chained successor starting with s_barrier),
plus a translation test counting mask exchanges. bench_wave64.py reports a
missing bench line readably and compares against the native AMD output.
design.md: how the rules were confirmed, current GPU counts.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
A whole-mask read of a register value already exchanged in the block reuses
the exchange; a block ending in a voted branch runs its successor in the
round that reads the vote. Adds scripts/bench_wave64.py, cs_bench_mix,
VKC_BENCH timing in vk_compute_test and the cs_w64x_mask_reuse test.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
RDNA ISA 10.4.4: EXEC is honoured for reading the source, so a source lane
that is off reads 0. The wave64 paths did this already; the wave32 path
shuffled the raw value. New GPU test cs_bpermute32 (wave32), wired into
check.py, run_gpu_tests.py and tests/test_shader_checks.py; LDS row of
docs/design.md updated. ds_permute_b32 stays Unsupported.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
#219's checker was written for the older workgroup-index model; on an RTX 4060 Ti lanes 0/1/31 of every
group read 32g, 32g+1, 32g+31, which is #209's model (the game's mesh entry shifts v5 right by 7).
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
ps_vcc_x2 reads two dwords through the V# in s[0:3], but vk_harness pushed zeros and bound no memory, so on the
GPU it read address 0 and lost the device; run_gpu_tests.py skipped it and check.py left it out. vk_harness now
takes VKH_SGPRS (user SGPRs) and VKH_HEAP (addr=word seeds in a 64 KiB device-address heap, passed as the heap
base, with bufferDeviceAddress and shaderInt64 enabled only then). Both runners give ps_vcc_x2 the V# and words
tests/semantic uses and expect 0x11223344 0x55667788 0 0.
SHADER-12: check.py already passes --require-wave64 only when
LEONIDA_W64_EMULATE is not 1. run_gpu_tests.py passed it
unconditionally, so cs_wavemask was skipped on every 32-wide GPU
even when the wave64 emulation path was active.
Mirror check.py: omit the flag under emulation and only apply the
64-wide-subgroup skip/confirmation checks when the flag is set.
A blob shorter than 0xC4 bytes made code_range read the code offset past the end and raise struct.error. The
error came out of ex.map and stopped the whole run, so make_game.py failed at the same blob on every rerun.
Such a blob now goes to the s_endpgm scan like any other header miss and is counted as "scan failed" or
"no s_endpgm".
--jobs and --limit now must be at least 1 (--jobs 0 made ThreadPoolExecutor raise, --limit -1 dropped the
last file). A source with no .fssm files, or one that doesn't exist, ends with an ERROR line instead of an
IndexError or FileNotFoundError traceback.
Tests: tests/test_shader_disasm.py, with a fake llvm-mc (no GPU, no game data).
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
- Without --stages, runtime (Windows only for now) is left out off Windows.
Before, the default build ran shaders and assets (hours) and then failed
in runtime, so pipelines never ran.
- Asked for explicitly off Windows, preflight() refuses it before any work.
- pipelines finds vk_pipeline_check where CMake builds it off Windows
(runtime/build/linux as in the README, or runtime/build as in
CONTRIBUTING.md) instead of only vk_pipeline_check.exe, and says how to
build it when it is missing. Windows is unchanged.
- tests/test_make_game_platform.py (9 tests, 6 fail before this change);
test_make_game_preflight.py's all-tools test asks for runtime only on
Windows, since it is now refused elsewhere.
AI-assisted.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
partial_wave_test always set VKC_SUBGROUP_SIZE=64. With LEONIDA_W64_EMULATE=1 the
shader is translated for any subgroup width, and on AMD, where 64 is available,
the emulated path was never run at 32 (#166, RX 6700 XT entry). Under emulation
it now asks for 32; without emulation it still asks for 64.
buffer_load_format_* merges dword 1 above a sub-dword element with
w1 << (32 - bsh) and picks dword 0 when bsh is 0. For every dword-aligned
element, the discarded side shifts by 32, undefined in SPIR-V.
(32 - bsh) & 31 keeps it in range.
tests/semantic/test_buffer_load_format.py runs u32, u32x2/x4, uint8x4,
uint16x2/x4 and f16 loads from interpreter memory. spirv_mini_interp.py learns
the two things the format decode needs: OpConvertUToF/OpConvertSToF and GLSL
FMin/FMax (NaN operands raise UnsupportedConstruct).