Commit Graph

112 Commits

Author SHA1 Message Date
cd5ee11079 rdna2spirv(r9b): unconditional CS/MS LDS bounds, PS EarlyFragmentTests, mesh epilogue & PS quad swizzle
Round 9b translator fixes for rendering correctness and Mandy d3d12/ parity:

1. Unconditional CS & MS LDS OOB bounds (Mandy 21633b328 parity):
   - Record g.lds_declared from PSV0.shared for MS and RSRC2.LDS_SIZE for CS.
   - Whenever g.lds_declared > 0 (opt-out --no-lds-bounds), set
     g.lds_dwords = g.lds_bound = min(g.lds_declared, 16384) so every LDS
     read, write, sub-dword, wide, and atomic op goes through lds_access()
     (OOB reads return 0, OOB writes/atomics dropped instead of wrapping).

2. PS DB_SHADER_CONTROL bit 12 EarlyFragmentTests (Mandy f33940415/bf479a3cd):
   - Add fssm_header.db_shader_control() reading u32 at E + 0x138 (0x24C for
     rec = 0xB0; 3,023/12,101 corpus PS have bit 12 DEPTH_BEFORE_SHADER set).
   - Emit OpExecutionMode %main EarlyFragmentTests (opt-out --no-early-depth)
     and record early_depth in shader_meta when bit 12 is set and the PS does
     not export depth/stencil (no exp mrtz, DB_SHADER_CONTROL & 0x7 == 0, no
     OSG1 SV_Depth*/SV_StencilRef).

3. Defensive mesh epilogue & PS helper-lane quad swizzle:
   - MeshEXT and --mesh-compute epilogues explicitly write CullPrimitiveEXT =
     true (1) and (0, 0, 0) when %mli < %msp and !%ms_has_prim.
   - Lower quad-local ds_swizzle_b32 in PS via OpGroupNonUniformQuadBroadcast /
     OpGroupNonUniformQuadSwap (GroupNonUniformQuad capability) so Vulkan 2x2
     helper invocations participate on AMD RADV while EXEC-masked lanes still
     read 0.

Verified: compileall, check_no_game_data.py, 6,674/6,674 semantic tests (0
failures), 200/200 corpus slice (200/200 spirv-val), plus targeted LDS MS
(5/5), LDS CS (60/60), early-depth PS (120/120), and PS quad-swizzle (50/50)
corpus slices (100% spirv-val). AI-assisted.
2026-11-29 09:25:40 -05:00
314b4e73dd Merge upstream ProjectLeonida/mandy main (b589e0fe0) into round10 base
# Conflicts:
#	docs/design.md
#	runtime/shims/d3d12_vulkan_device.cpp
#	runtime/src/queue_holds.h
#	runtime/src/shader_library.h
#	runtime/src/vulkan_backend.h
#	runtime/src/vulkan_replay.h
#	runtime/test/vk_harness.cpp
#	tests/semantic/test_wave32_lane_select.py
#	tools/lane_masks.py
#	tools/rdna2spirv.py
2026-11-29 06:33:39 -05:00
9fac739da4 Merge pull request #2239 from zmasi/fix/rdna2spirv-f16-interp-computed-ij
rdna2spirv: lower computed I/J barycentrics under --f16-interp-fallback (SHADER-F16-INTERP-COMPUTED-IJ)
2026-11-29 04:36:24 +01:00
25fd8e4776 Merge remote-tracking branch 'origin/main' into fix/rdna2spirv-f16-interp-computed-ij 2026-11-27 23:02:20 -08:00
0508c53713 Merge branch 'r3b/img-sampler' into test/round3
# Conflicts:
#	docs/design.md
#	tests/semantic/spirv_mini_interp.py
#	tools/rdna2spirv.py
2026-11-27 21:18:18 -05:00
73fdc2a4c6 rdna2spirv: enable FTZ32/fmulz and per-load NonWritable SMEM with outlined slow paths
Enable DenormFlushToZero 32 alongside DenormPreserve 16 (with --no-ftz32
override and fmulz fusion), add sound per-load NonWritable scalar memory
analysis for descriptor/read-only SMEM loads, and outline wide s_buffer_load
partial-OOB slow paths into shared helper functions.

AI-assisted: Antigravity (Gemini 4 Neon).
2026-11-27 21:13:24 -05:00
67273351ec rdna2spirv: add coherent VMM, literal sampler SpecId, float image elision, table store, and writes_buffer meta
Emit VulkanMemoryModel NonPrivatePointer/MakePointerVisible/Available for
glc/dlc buffer ops and reads_glc_buffer metadata, specialize literal S#
samplers via OpSpecConstant, elide dead uint/sint image_read_typed paths
when float-only, replace the 77-way buffer_store_format switch with a
compact lookup table, and emit writes_buffer + buffer_write_slots metadata.

AI-assisted: Antigravity (Gemini 4 Neon).
2026-11-27 21:12:04 -05:00
de8604c3dc Merge ProjectLeonida/mandy main (431ceba4f) into test/round2
Preserves all Round 1/2/2.1 CPU/GPU runtime optimizations alongside upstream
mandy/main changes, resolves all 10 conflicted files, and fixes arena_window
accounting on retired/dropped title windows.

AI-assisted: Antigravity (Gemini 4 Neon).
2026-11-27 19:57:44 -05:00
cab6609160 Merge remote-tracking branch 'lc/main' into lc/addr-no-int64 2026-11-27 23:49:06 +02:00
2e54980149 rdna2spirv: multi-dword scalar loads as wide loads with one bound check
s_load_dwordx2/4/8/16 and s_buffer_load_dwordx2/4/8/16 read their dwords as
uvec4 / uvec2 loads instead of one uint each. An s_buffer_load with a
run-time bound checks its last dword once and takes the wide loads; a load
that is partly out of range keeps the per-dword path, so out-of-range dwords
are still 0 and not read. The vectors go through a NonWritable block (SMEM
on RADV) only in modules that write no memory: with the decoration in a
module that stores, RADV ordered the load before the store and
valu_fuzz --family mem read old words in 18 of 600 programs.

Tested: tests/semantic/test_wide_scalar_load.py (new fixture),
SmemHardwareRuleTests, the translator suite, valu_fuzz --family mem on the
Radeon iGPU (600/600, wave32 and wave64), scripts/run_gpu_tests.py on the
iGPU (same results as before), a synthetic GPU program on the RX 7900 XTX
(docs/design.md row).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-27 05:48:40 -05:00
0513e00b07 rdna2spirv: the 4x8-bit dot products as SPV_KHR_integer_dot_product
v_dot4_i32_i8, v_dot4c_i32_i8, v_dot4_u32_u8 and v_dot4c_u32_u8 become one
OpSDot / OpUDot on the packed bytes plus OpIAdd for the addend, and
OpSDotAccSat / OpUDotAccSat under clamp (both saturate the addend plus the
exact sum, as the hardware does). op_sel halves are put together into one
dword first. RADV did not re-form v_dot4 from the old expansion (four
extracts, multiplies and adds each), which made the FidelityFX upscaler
passes ALU bound.

--integer-dot-fallback keeps the expansion for a device without
shaderIntegerDotProduct (required by Vulkan 1.3): vk_subgroup_info.py
reports integer_dot_product and make_game.py turns the flag on where it is
false. The runtime and vk_pipeline_check enable the feature where the
device has it; the interpreters of the semantic tests run the new ops.

Tested: tests/semantic/test_packed_dot4.py (new fixtures), the translator
suite, tools/dot_diff.py on the four ops, a wave32 GPU program on the
Radeon iGPU (gfx1036) and the RX 7900 XTX against the gfx1036-measured
words, RADV statistics of the upscaler passes (docs/design.md row).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-27 05:48:33 -05:00
22a8be16cd rdna2spirv: decode only the components a typed load writes; fconst is an OpConstant (SHADER-FORMAT-DECODE-ONE-COMPONENT)
A buffer_load_format_* with a run-time FORMAT called the four per-component
decode functions %fmt_dec_c0..3 at every load, whatever it wrote. One
function %fmt_dec(format, element, component) replaces them, and a load
calls it once per register it writes, with the component that register's
DST_SEL picks: _x makes one call, not four. The function computes the four
components' channel width and offset as before and the parameter selects
one, so the values are the same.

fconst (and tof of a uint constant) emitted a new OpBitcast of the uint
constant at every use; they now give one cached OpConstant %float per bit
pattern, written so spirv-as reads back the same 32 bits (float_literal:
shortest decimal for a finite value, the SPIRV-Tools hex-float spelling for
an infinity or a NaN). The test interpreters read that spelling.

Tests: test_buffer_format_decode_one.py with hand-written fixtures
(calls per load, values for 16 codes, swizzles, out of bounds, _x/_xy
against _xyzw for all 128 codes) and test_fconst_constant.py (exact bits of
+-0, denormals, infinities and NaN payloads).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-27 08:58:14 +01:00
cd8d9aa7a8 rdna2spirv: lower computed I/J barycentrics under --f16-interp-fallback
Lower computed v_interp_p1/p2 (I, J) pairs under --f16-interp-fallback (without --bary-fallback) without PerVertexKHR or a geometry shader by hoisting OpDPdxFine/OpDPdyFine screen-quad barycentric and attribute derivatives into uniform %entry (OpCapability DerivativeControl, guarded by an integer IEEE-754 normal determinant check) and evaluating P_0 + I*P_10 + J*P_20 per site.
2026-11-26 01:57:43 -08:00
6112644606 Merge remote-tracking branch 'lc/main' into lc/addr-no-int64
# Conflicts:
#	docs/design.md
2026-11-25 18:58:21 +02:00
39879ce0fd Merge main into RT-PROTON-STORY-LOAD (#984)
Merges main at 1154976d4 into the integration branch at 273b3bdf9 (merge base ece4ba5b3). 42 files conflicted;
this commit is the resolution only. Build and test repairs follow in their own commits.

Rule of resolution: where both sides added different things, both stay; where both made the same change in two
forms, main's reviewed form stays and whatever #984's form did in addition is carried into it; where the two
changed the same code for different purposes, both purposes are kept.

Xbox proxy code (runtime/shims/d3d12_xs_device.cpp, d3d12_xs_device.h, d3d12_xs.cpp, d3d12_xs_alloc_size.h,
d3d12_xs_desc_clean.h, registry.cpp):
- d3d12_xs_device.cpp is #984's file with main's differing pieces ported in: env_slot and the configurable device
  routes, XboxQueueSlotRoutes, PresentationHandler / set_presentation_handler, the console caller rule for device
  slots 61 and 74 (#383, #385), route_xbox_device_slot, slot 81 as GetFrameStatisticsX, create_host_device, the
  console-form rule for slots 25 and 56, the console list IID of #359, and the forms of queue slot 18 (#403) and
  list slot 139 (#396).
- Kept from #984: the list proxy with handle translation, queue slots 16/17 as Signal/Wait, the fence's
  completed-value mirror, the shared FrameTokenSource, PresentX through queue_present_x when no handler is
  attached (slot 30, or 32 on a queue detected as the newer layout), slots 27/53/55/57/70/71/133, the wider
  pc_resource_desc, S_OK for queue slots past the PC table.
- Dropped: #984's GetFrameEventsX and LEONIDA_XS_FRAME_EVENTS_SLOT, its second-word rule for slot 61, its
  undetected-layout rule for queue slot 18, its list IID mapping to GraphicsCommandList6; main's copy of the base
  list proxy, its null-view slot 70 and its refusing slot 133.

Proxy tests (runtime/test/xs_proxy_mock_test.cpp, device_proxy_test.cpp, queue_proxy_test.cpp):
- Checks of both sides, each run once; main's forms of the render-target size and layout checks with #984's extra
  cases added; main's --env-slots-74 and #984's --env-slots-70.
- Adapted to the merged code: the queue tail answers S_OK, slot 73 answers an unknown IID with the list proxy,
  the queue slot 18 case installs a console caller. Dropped: #984's slot 81 GetFrameEventsX cases.

D3D12/Vulkan layer (runtime/shims/d3d12_com.cpp, d3d12_vulkan_device.cpp, runtime/src/command_list.h,
frame_pacer.h, shader_library.h, vulkan_backend.h, vulkan_replay.h, runtime/test/command_list_test.cpp,
d3d12_close_parity_test.cpp, d3d12_execute_indirect_validation_test.cpp, replay_texture_barrier_test.cpp,
vk_pipeline_check.cpp, vk_test_device.h):
- Resource::create_texture: #984's title images (deferred placed, pending streamed, title pool) and main's
  ordinary textures (#1413 shared blocks, #1364 staging fallback) are exclusive branches chosen by the texture's
  origin, so both pools run on disjoint sets of textures.
- frame_pacer.h is main's pacer (#402) with #984's FrameTokenSource as the token counter.
- main's forms kept for ExecuteIndirect (#1066, #377), the barrier into LAYOUT_UNDEFINED (#1055), the B4G4R4A4
  stand-in, per-face stencil masks, the unaligned tile staging (#528) and the device-lost flag (#980).
- shader_library.h: main's block inflate; #984's `bulk` parameter now defaults to true so main's callers keep it.
- Dropped: #984's B8G8R8A8 stand-in for B4G4R4A4 targets, its refusal of separate stencil masks, its zero-count
  refusal in ExecuteIndirect, its wider UNDEFINED -> UNDEFINED release and the test case for it.

Other shims (runtime/shims/dstorage.cpp, file_system.cpp, gameinput.cpp, xgameruntime_offline.cpp,
runtime/test/xgameruntime_offline_test.cpp, xmem_test.cpp):
- ReadFile and DirectStorage reads: #984's pinned kernel_writes read, then main's touch_pages retry on
  ERROR_NOACCESS. main's rt::fs::read_file is folded into #984's read_file.
- gameinput: main's strict LEONIDA_INPUT_SCRIPT parser with #984's rsup/rsdown entries.
- Speech synthesis: main's one silent voice and handle checks; #984's accept-anything form dropped.

Build, tools, docs (runtime/CMakeLists.txt, runtime/cmake/translator_deps.cmake, scripts/build_runtime.ps1,
make_game.py, tools/rdna2spirv.py, shader_disasm.py, shader_ir.py, shader_library.py,
runtime/test/shaders/cs_imgload_tfe.asm, cs_imgload_d16_tfe.asm, docs/README.md, boot.md, d3d12_vulkan.md,
runtime/README.md):
- Unions of the test, target and source lists; spirv_loop_guard.py added to translator_deps.cmake.
- rdna2spirv.py: main's DPP compare rule (#957), SMEM vcc base (#647) and widen_wave64_masks (#1021); #984's
  restore_skipped_instructions and restore_dot4_inline_sel. #984's duplicate widen_wave64_valu_masks dropped.
- shader_disasm.py and shader_ir.py: main's structure with #984's one-line-per-dword llvm-mc input and wave flags.
- shader_library.py: main's structure with #984's --compute-hashes and per-state compute variants.

One file that did not conflict is changed here: tools/rdna2_decode.py. Git kept both sides' decoders for a VOPC
compare with a DPP operand, and #984's narrower one shadowed main's; it is main's file again.

Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
2026-11-24 19:38:04 -05:00
273b3bdf9d [integration] Linux/Proton and native Windows: boot through the story load (RT-PROTON-STORY-LOAD)
One squashed commit of a fork that was developed on a Linux/Proton machine and
tested on two native Windows machines. On all of them the retail 1.0.2.1
package now launches, shows its launch movie, first-run pages and landing
prompt, runs the story load to its end with the loading slideshow drawing its
artwork, and enters the world phase. A first world frame is not verified yet.
docs/linux_proton.md has the setup, a healthy boot's timeline, the machines
and where it stops.

Runtime: frames in the title's own window; DirectStorage pinned reads,
page-list scatter/gather, BCPack and unshuffle with a locally generated
predictor file; pooled, device-local and deferred image backing for streamed
and placed textures; enhanced barriers into LAYOUT_UNDEFINED; a bindless table
that degrades instead of refusing a submission; a descriptor hash finalizer
(off until a library carries it); directly indexed heap offsets for compute
dispatches and VS/PS/GS draws; title buffer windows outside a fragmented
arena; opt-in device-local copies of streamed buffer views; write-fault
retries under the tracker lock, shared trackers and write-watched title memory
for native Windows; device-loss, compute-input and memory probes.

Translator: loop bounds at structured exits, the eight FidelityFX programs
that use a packed-dot form the disassembler skips, buffer bounds modes per
view kind, a compaction option, the hash finalizer option.

Tools and scripts: Linux boot scripts (Wine/Proton, no network), a Windows
boot script, the paired compute translation script.

No game data. AI-assisted (Claude Code and Codex agents), reviewed and booted
by people on the machines named in docs/linux_proton.md.

Co-authored-by: Plaaasma <47513553+Plaaasma@users.noreply.github.com>
Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
2026-11-24 11:42:12 -06:00
adc25699fd spirv_mini_interp: binary64 Sqrt/InverseSqrt stay binary64, and OpFAdd/OpFSub/OpFDiv run on doubles (TEST-MINI-INTERP-F64)
GLSL.std.450 Sqrt and InverseSqrt rounded a double result to binary32: the translated v_sqrt_f64 of 2.0 gave
0x3ff6a09e60000000 instead of 0x3ff6a09e667f3bcd, and v_rsq_f64 likewise. OpFAdd, OpFSub and OpFDiv on binary64 raised
UnsupportedConstruct, so v_add_f64 and v_rcp_f64 could not run in this interpreter at all.

A double Sqrt is math.sqrt (correctly rounded). A double InverseSqrt is the new rsqrt_f64, rounded once from the
exact value through an integer square root: 1.0 / math.sqrt(x) rounds twice and misses by an ulp on about a quarter
of random doubles (5,219 of 20,008, checked against a 90-digit decimal; rsqrt_f64 matched all of them). Binary64
OpFAdd/OpFSub/OpFDiv follow the binary32 path's rules: a division by zero is still refused as undefined, and a NaN
made from non-NaN operands goes through ieee_nan.

tests/semantic/test_mini_interp_f64.py translates v_sqrt_f64, v_rsq_f64, v_rcp_f64 and v_add_f64 and checks the
pair against Python's binary64 operations and, for the inverse root, a 60-digit decimal reference; against main's
interpreter it gives 2 failures and 14 errors.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-24 16:39:32 +02:00
4f2628f83f rdna2spirv: 64-bit buffer addresses without Int64 (SHADER-423)
lower_addr64 rewrites the assembled module's 64-bit address arithmetic (the zero-extend, shift-by-32, OR/AND, add and
subtract with carry, narrowing, sign-extension, 64-bit bitcasts and pair compares the address idiom uses) into uint
pairs and an OpBitcast of a 2x32 vector to the PhysicalStorageBuffer pointer, and drops OpCapability Int64 when
nothing else needs it, so translated shaders run on devices without shaderInt64. --int64-addresses keeps the 64-bit
form. Semantic tests for the lowering, the interpreters learn the pair pointer form, design.md row.

Co-Authored-By: Claude Mythos 5.2 <noreply@anthropic.com>
2026-11-24 16:26:16 +02:00
b8956e4f3b tests: execute a mesh shader's exp prim and GS_ALLOC_REQ translation in the interpreter
fixtures/ms_prim_export.asm (72 threads, two wave64 waves) runs as a mesh shader and with --mesh-compute: m0 = prims << 12 | verts gives the counts, the three 9-bit index fields exclude the edge flags, bit 31 sets CullPrimitiveEXT, and threads at or past a count write nothing. spirv_mini_interp learns OpSetMeshOutputsEXT, struct zero values, aggregate outputs and OpAtomicStore.
2026-11-24 01:06:22 +03:00
14b2e4462f tests/semantic: negate binary32 on its sign bit in spirv_mini_interp (AllNaNSrc0PayloadTests) (#7302)
OpFNegate went through f32(), whose struct round trip sets the quiet bit of a signalling NaN before
CPython 3.14 (issue #509), so -v1 on 0x7F800001 gave 0xFFC00001 and test_float_nan_fract's
AllNaNSrc0PayloadTests failed for v_min3/v_max3/v_med3_f32 on 3.12 and 3.13, CI's 3.12 included.
IEEE 754 negate only flips the sign bit, so the interpreter does that for binary32; binary64 is
unchanged.


Claude-Session: https://claude.ai/code/session_013GadNheKKmV2dMw6NR5TUu

Co-authored-by: Adm1H <322105863+Adm1H@users.noreply.github.com>
Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-23 10:29:39 -06:00
4ce16cd58e rdna2spirv: a wave32 pixel shader reads its descriptor index from a running lane of its half, not lane 0 (SHADER-1016, the #4225 RDNA1 regression) (#6898)
Squash-merged after diff review of PR #6898 - rdna2spirv: a wave32 pixel shader reads its descriptor index from a running lane of its half, not lane 0 (SHADER-1016, the #4225 RDNA1 regression)
2026-11-23 09:44:13 -06:00
28ec8eba68 Merge pull request #4537 from Luiz Neves
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-22 23:15:42 -05:00
5769573cec Merge pull request #4513 from tedin7
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-22 23:15:26 -05:00
68ac20877b Merge pull request #4225 from 73N1X
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

# Conflicts:
#	docs/design.md
2026-11-22 23:12:31 -05:00
332efe1a94 Merge pull request #4172 from leather147
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-22 23:12:00 -05:00
b595ca11bb Merge pull request #4122 from leather147
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-22 23:11:30 -05:00
40ec9695a0 Merge pull request #4069 from Tom1419-git
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-22 23:11:00 -05:00
b6a1a6a7ca Merge pull request #3891 from lumenpearson
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-22 23:09:16 -05:00
005ba67c55 Merge pull request #3508 from shdann
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-22 23:07:36 -05:00
49431d4519 Merge pull request #3444 from shdann
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-22 23:07:29 -05:00
be8570ace1 Merge remote-tracking branch 'origin/main' into triage-r43
# Conflicts:
#	docs/runtime_imports.md
#	runtime/CMakeLists.txt
#	runtime/shims/xgameruntime.cpp
#	runtime/test/xmem_test.cpp
#	tools/rdna2spirv.py
2026-11-22 22:12:50 -05:00
c962d09d0c Merge upstream main into interp-int64-width
Keep null constant type information and composite constant handling. AI-assisted.
2026-11-23 05:41:38 +03:00
0600822f83 Check operand widths for signed and bit-search GLSL operations
AI-assisted.
2026-11-23 05:30:53 +03:00
26a0911f25 Reject duplicate OpPhi results and identify the incoming edge
AI-assisted.
2026-11-23 05:30:46 +03:00
af4929c2d7 spirv_mini_interp: run_workgroup shares LDS; OpControlBarrier
Every invocation of run_workgroup had its own zero-initialised Workgroup
variables, so no CPU test could check lanes communicating through LDS or
racing on an LDS dword, and OpControlBarrier was refused. The Workgroup boxes
are now the workgroup's (created by the first invocation, shared by the
rest), and OpControlBarrier is a point every invocation must reach together,
as a subgroup operation is. run_fragment still refuses it
(test_barrier_control pins that).

tests/semantic/test_interp_shared_lds.py: one lane writes and all read after
s_barrier (one and two waves), lanes racing with ds_add_u32 and its
returned values, the ds_add_f32 CAS loop on shared LDS, separate workgroups,
and a barrier only one invocation reaches.
2026-11-22 23:12:08 -03:00
aa8a986867 tests/semantic: the mini interpreter parses a module once, not once per invocation
run_workgroup runs one generator per invocation over the same SPIR-V text, and each one split and regex-matched every line again. The parsed lines are now cached by text (a line that does not parse still raises where it is reached). test_saveexec_b64 40.9 s -> 24.5 s, test_wave64_scmp_masks 38.2 s -> 19.9 s; the 366 semantic test files give the same results.
2026-11-23 02:57:11 +01:00
4f760c1aed Shader: isolate wave32 pixel operations in wider subgroups (SHADER-731) 2026-11-22 20:07:05 -04:00
ea291b12b2 tests: preserve binary64 for SPIR-V negate and absolute value 2026-11-23 02:45:13 +03:00
5fbadea3a0 tests: preserve binary64 in SPIR-V int-to-float conversions 2026-11-23 02:30:13 +03:00
8acce97b56 tests/semantic: generated NaNs are the x86 default NaN on every host
The measured words pinned in the semantic tests use 0xFFC00000 for a NaN made
from non-NaN operands (inf - inf, 0 * inf). The interpreter left that sign to
the host CPU, so 30 rows in test_alu_vop3_mods_hw and test_alu_sdwa_hw failed
on ARM64 (Apple Silicon), where the host gives 0x7FC00000. ieee_nan() makes the
sign explicit for OpFAdd, OpFSub, OpFMul and fma_f32. x86-64 results are
unchanged.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
2026-11-23 00:15:02 +01:00
81a428ecd0 tests: preserve SPIR-V aggregate value copies (TEST-851) 2026-11-23 01:18:22 +03:00
aa2988cc55 rdna2spirv: typed buffer loads read the format's byte size from one table
buffer_load_format with a run-time V# format picked the element size twice per load through a select chain over
all of FORMATS (dwords spanned, and the bounds-check size): about 150 of the ~390 instructions a load cost. The sizes
are now one Private constant array, %fmt_size_tab (128 entries, 0 for a code FORMATS does not decode), read once
per use; a tbuffer's fixed format still folds at translate time. Same results: an unknown format loads one dword
and bounds-checks 4 bytes, as before.

indirect_diffuse_lighting's ScreenProbes_ActivateProbes (3,281 such loads, the module NVIDIA's compiler failed on):
52.4 MB / 2.50 M ids -> 29.8 MB / 1.43 M ids under --wave64-emulate, 43.8 -> 29.4 MB native; passes spirv-val.
spirv_mini_interp reads OpConstantComposite and Private variables so the semantic tests run through the table.
Typed-buffer, image and d16 tests (383), the shader checks and both GPU suites (164/210, 195/210 W64) pass.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-22 17:08:57 -05:00
b168216aba Merge pull request #3508 from shdann 2026-11-22 17:02:24 -05:00
d497c01b9a Merge pull request #3444 from shdann 2026-11-22 17:02:04 -05:00
829af7fd6a tests/semantic: the interpreters run OpBitCount and the signed GLSL ops at the width of a 64-bit type
Both interpreters accept OpTypeInt 64 but treated a 64-bit operand of
OpBitCount, SMin, SMax, SClamp, SAbs, FindILsb, FindUMsb and FindSMsb as
32-bit: OpBitCount of 0xFFFFFFFF00000000 gave 0, and SMin(2^31, 1) on a
64-bit type gave 2^31.

OpBitCount now counts every bit of its operand's type, and SMin, SMax,
SClamp and SAbs read their operands as signed at the width of their type.
FindILsb, FindUMsb and FindSMsb raise UnsupportedConstruct for a type that
is not 32-bit, since GLSL.std.450 limits them to 32-bit components. Results
for 32-bit types are unchanged.

Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
2026-11-22 23:44:12 +03:00
0312e4df3e tests/semantic: the mini interpreter gives the OpPhi of a block their values together
spirv_mini_interp.py evaluated the OpPhi of a block one after another and
wrote each result at once, so a later OpPhi that names an earlier one of the
same block read its new value. A loop header that swaps two values
(%a = OpPhi ... %b %cont, %b = OpPhi ... %a %cont) gave (2, 2) after three
iterations from (1, 2); SPIR-V and spirv_wave_interp.py give (2, 1). The
first OpPhi of a block now evaluates the whole run against the values from
before the block, and each one then takes its own.

The module docstring and the README's Limits said backward branches, loops
and calls are rejected; the interpreter runs them (10000 backward branches
at most), and only rejects switches.

Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
2026-11-22 23:32:44 +03:00
a5d95ef895 Merge pull request #3289 from jaybeebabageyus 2026-11-22 15:16:42 -05:00
64f178993f rdna2spirv: add binary64 round-to-integral VALU ops (SHADER-379) 2026-11-22 23:03:48 +03:00
4222dd4953 tests: pin the interpreter's f16 NaN rule across Python versions
struct's '<e' drops NaN payloads before 3.14 and keeps them from 3.14
(CPython gh-130317), so spirv_mini_interp's half_to_float/float_to_half
returned version-dependent words while CI (3.12) pins the pre-3.14
canonical-quiet results. Convert both helpers bit-level with the pinned
rule (a NaN keeps its sign, payload dropped to the canonical quiet NaN)
and add direct regression tests; RNE rounding, subnormals and overflow
are unchanged, so no expected word moves on any Python.
2026-11-22 21:00:21 +01:00
fd40f8a7f6 Use a device-scope atomic load to seed inc/dec compare-exchange 2026-11-22 14:17:45 -03:00