Commit Graph
5577 Commits
Author SHA1 Message Date
Dean 50e7712002 Merge pull request #608 from adriadam10/test/scalar-program-flow
fix(shader): wave-wide exec and vcc branch conditions
2026-10-05 18:13:07 +13:00
Dean f809199b0a Merge pull request #606 from adriadam10/fix/permlane16-inactive-source
fix(shader): keep v_permlane16 lanes whose source lane is inactive
2026-10-05 18:12:26 +13:00
Dean Galvin 60c655211d perf(recompiler): let exec-guarded memory and exports end a masked select
A register written under EXEC is usually consumed by an LDS or buffer
access or an export under the same EXEC. MaskedSelectEliminator kept
the select in that case, which leaves the NGG mesh shaders where they
were.

The emitter performs buffer and LDS loads and stores (8 to 128 bits,
GPU-selected V# included) and SetAttribute only in lanes whose active
operand is true: stores and exports sit in an if on it, loads return 0
outside it. Every other operand is read only in those lanes. So such an
access whose active operand implies the select's condition reads the
derived value only where it equals the original, and it now ends the
search like a masked select does. The active operand itself, atomics,
append/consume, scratch and address-space accesses and image accesses
still keep the select.
2026-10-05 18:12:23 +13:00
Dean Galvin dd2a70bc13 perf(recompiler): drop exec selects whose inactive lanes nobody reads
Every VGPR write under EXEC is translated to Select(exec, new, old), so
in SSA each register's previous value stays live until the next write,
even when the guest only used the register as a temporary. In NGG mesh
shaders at 255 registers that keeps dead values alive and the driver
spills them to local memory.

MaskedSelectEliminator (after SSA, folding and the readlane pass)
replaces r = Select(m, new, old) by new when no lane where m is false
can observe r:
- every value derived from r is either a lane-local pure op or a phi,
  and their uses are checked the same way;
- or the derived value reaches the true operand of a select, or an
  operand of a LogicalAnd, whose condition implies m: m itself, a
  LogicalAnd containing m, or a thread bit rebuilt from a ballot of
  such a condition (also through ANDs of the mask words);
- anything else (cross-lane ops, ballots, readfirstlane, DPP, swizzle,
  permutes, stores, exports, atomics, branch references, implicit-LOD
  pixel samples, the false operand of any select) keeps the select.
The select and every value it reaches must be in blocks outside loops,
so each of them runs at most once per invocation and every use sees the
same instance of m. Selects whose condition is the full wave
((0xffffffff >> (lane & 31)) & 1) are replaced in any block.

Exact: in lanes where m is true r equals new, so every derived value is
unchanged there; in lanes where m is false only derived values change,
and each path from them ends in a select or AND that discards those
lanes. The selects are removed latest first and dead code is removed
between rounds, so chains of writes to one register collapse.
2026-10-05 18:12:23 +13:00
Dean e074483ab7 Merge pull request #604 from adriadam10/fix/smem-buffer-offset-overflow
fix(shader): return zero when an s_buffer_load offset passes 2^32
2026-10-05 18:11:43 +13:00
Dean e90d2edf54 Merge pull request #596 from adriadam10/fix/vop3-pack-ldexp-bits
fix(shader): compute v_cvt_pknorm_*_f32, v_ldexp_f32 and v_pack_b32_f16 on the bits
2026-10-05 18:11:01 +13:00
Dean bdd10f1929 Merge pull request #475 from adriadam10/feat/mimg-coarse-g16
feat(shader): implement image_sample_cd/_g16 variants and fix a16 gradient layout
2026-10-05 18:10:20 +13:00
Dean 71f248ad54 Merge pull request #568 from adriadam10/fix/f32-minmax-nan
fix(shader): return src0 when both f32 min/max sources are NaN
2026-10-05 18:09:38 +13:00
Dean 4ca60c434c Merge pull request #524 from DotDebian/feat/mimg-bvh64-intersect-ray
feat(shader): implement image_bvh64_intersect_ray
2026-10-05 18:08:57 +13:00
Dean 1e0f62e118 Merge pull request #515 from adriadam10/fix/dpp16-inactive-source
fix(shader): DPP16 lanes whose source lane is inactive
2026-10-05 18:08:46 +13:00
Dean a84d759dd2 Merge pull request #498 from adriadam10/feat/vop2-dpp-sdwa-float-mods
feat(shader): accept float modifiers on v_cndmask_b32, v_mul_legacy_f32 and v_ldexp_f16
2026-10-05 18:08:04 +13:00
Dean 0087fb6369 Merge pull request #567 from adriadam10/fix/f32-omod-zero
fix(shader): apply the f32 output modifier on the bits like the hardware
2026-10-05 18:07:22 +13:00
Dean dbfdcb1c79 Merge pull request #537 from adriadam10/test/vop1-float-unary
fix(shader): choose unary f32/f16 special results on the bits, as RDNA does
2026-10-05 18:06:40 +13:00
Dean 9f5fac08c8 Merge pull request #323 from adriadam10/fix/f16-result-clamp
fix(shader): apply clamp but not omod to f16 results, as RDNA does
2026-10-05 18:06:29 +13:00
Dean 3e92cefb4c Merge pull request #613 from nicolasabosch/feat/ult-blocking-queues
feat(ult): implement blocking queues and shared data pools
2026-10-05 18:06:19 +13:00
Dean f7ecd24ddb Merge pull request #610 from adriadam10/feat/div-fmas-fixup-clamp
feat(shader): accept clamp on v_div_fmas/fixup and omod on their f64 forms
2026-10-05 18:05:38 +13:00
Dean 3067a93fe9 Merge pull request #609 from nicolasabosch/fix/rtc-arithmetic-bounds
fix(rtc): reject out-of-range source ticks in date arithmetic
2026-10-05 18:04:57 +13:00
Nicolas Abosch 93efde8056 fix(relinker): merge function symbol alias extents 2026-10-05 01:50:14 -03:00
Dean Galvin 1c4aadb3e3 fix(agc): route compacted color exports to the slots CB_SHADER_MASK enables
Pixel shader color exports are compacted: export MRTi goes to the i-th
MRT slot with a non-zero CB_SHADER_MASK nibble and takes the i-th
SPI_SHADER_COL_FORMAT field. Draws still mapped export i to slot i and
read slot i's format field, so a shader with CB_SHADER_MASK 0xf000f and
SPI_SHADER_COL_FORMAT 0x44 (export 1 to slot 4) was refused with
"color export format 0".

Each color target now carries its export index next to its slot.
Attachment references, blend states, export mappings and the pipeline
and pass keys follow the export index; the color buffer, blend control
and target mask come from the slot. An unwritten export below the
highest written one stays an unused attachment.
2026-10-05 17:03:43 +13:00
Dean 4dac9d6373 Merge pull request #602 from NumberGuan/fix/relinker-prx-directory
fix(relinker): discover bundled modules in prx directories
2026-10-05 16:54:18 +13:00
Nicolas Abosch 65c139336e feat(ult): implement blocking queues and shared data pools 2026-10-05 00:52:22 -03:00
Adrià FranchandClaude c6df07e604 feat(shader): accept clamp on v_div_fmas/fixup and omod on their f64 forms
Co-Authored-By: Claude <[email protected]>
2026-10-05 05:19:06 +02:00
Nicolas Abosch 76b7294f06 fix(rtc): reject out-of-range source ticks in date arithmetic 2026-10-05 00:15:57 -03:00
Dean e91eecc402 Merge pull request #607 from adriadam10/test/setpc
fix(shader): refuse s_setpc_b64 after s_sub with the immediate first
2026-10-05 16:10:53 +13:00
Dean 3aedbbc128 Merge pull request #605 from adriadam10/test/ds-swizzle
test(shader): execute ds_swizzle_b32 in all three offset modes
2026-10-05 16:10:11 +13:00
Dean 202a73b543 Merge pull request #603 from nicolasabosch/fix/libc-long-integer-conversions
fix(libc): preserve 64-bit strtol and strtoul results on Windows
2026-10-05 16:09:30 +13:00
Adrià FranchandClaude c67634a15c feat(shader): implement the float and 64-bit inc/dec flat and global atomics
Co-Authored-By: Claude <[email protected]>
2026-10-05 05:05:10 +02:00
Adrià FranchandClaude 183a0f09b4 feat(shader): accept the glc, slc and dlc cache bits on flat, global and scratch
Loads and stores with glc or dlc are coherent, as MUBUF already does; slc
is a cache hint and changes no result. Atomics keep glc as the return bit.
lds, segment 3 and scratch atomics still throw.

Co-Authored-By: Claude <[email protected]>
2026-10-05 05:05:10 +02:00
Adrià FranchandClaude 038ded6382 feat(shader): implement the integer flat and global atomics
Co-Authored-By: Claude <[email protected]>
2026-10-05 05:05:03 +02:00
DotDebianandClaude Opus 5.5 be866e4214 feat(shader): store through flat and global addresses
flat_store_* and global_store_* decoded and translated, but a store whose
segment is not scratch was refused when the SPIR-V was emitted ("writable
FLAT/GLOBAL addresses require GPU ownership tracking").

Such a store now goes through the BDA page table like a store through a
GPU-selected V#: the write lookup needs Write permission, which only a
writable registered range imported in place has, and the written page is
noted for the host to mark GPU-written. Byte and short stores, and dword
stores to an address that is not dword aligned, are stored byte by byte.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
2026-10-05 05:05:03 +02:00
Adrià FranchandClaude b5da7d00e4 fix(shader): apply the f32 output modifier on the bits like the hardware
Co-Authored-By: Claude <[email protected]>
2026-10-05 05:00:29 +02:00
Adrià FranchandClaude e58e2f0605 feat(shader): accept float modifiers on v_cndmask_b32, v_mul_legacy_f32 and v_ldexp_f16
- v_cndmask_b32: neg/abs on DPP; neg/abs applied on the bits, as the hardware does
- v_mul_legacy_f32: neg/abs on DPP and SDWA, clamp/omod on SDWA and VOP3
- v_ldexp_f16: neg/abs on src0 for VOP3, DPP and SDWA; NaN result chosen on the bits

Co-Authored-By: Claude <[email protected]>
2026-10-05 04:59:40 +02:00
Adrià FranchandClaude a15a21c2c6 feat(shader): implement clamp on v_mad_u64_u32 and v_mad_i64_i32
Co-Authored-By: Claude <[email protected]>
2026-10-05 04:59:15 +02:00
Adrià FranchandClaude aff00b8cde fix(shader): wave-wide exec and vcc branch conditions
s_cbranch_execz/execnz/vccz/vccnz test the whole wave mask on hardware,
but the single-lane path branched on each lane's own bit, so inactive
lanes took the other side and diverged in scalar state. Branch on a
wave ballot instead, and execute the untested SOPP ops (cdbg branches,
s_clause, s_inst_prefetch, s_setprio, s_waitcnt_depctr, s_ttracedata)
against values measured on hardware.

Co-Authored-By: Claude <[email protected]>
2026-10-05 04:56:35 +02:00
Dean 00407df8a9 Merge pull request #585 from Raghav314/feat/ajm-batch-job-queries
feat(ajm): implement DecodeSingle, GetGaplessDecode and GetCodecInfo
2026-10-05 15:54:58 +13:00
Dean 7dcbc18182 Merge pull request #601 from nicolasabosch/test/pixel-lds-pipeline-statistics
test(agc): validate pixel LDS and expose pipeline statistics
2026-10-05 15:52:43 +13:00
Dean 0bd711b13b Merge pull request #599 from adriadam10/test/tbuffer-d16-xyzw
test(shader): execute tbuffer_load_format_d16_xyzw against hardware results
2026-10-05 15:52:02 +13:00
Dean 912f43670c Merge pull request #598 from adriadam10/test/buffer-atomic-x2-leftovers
test(shader): execute buffer_atomic_or_x2 and buffer_atomic_swap_x2 against hardware results
2026-10-05 15:51:20 +13:00
Dean 352c6acf4b Merge pull request #597 from adriadam10/test/flat-d16-loads
test(shader): execute the flat D16 loads against hardware results
2026-10-05 15:51:10 +13:00
Dean f8a3211cea Merge pull request #522 from adriadam10/fix/dpp16-no-form
fix(shader): refuse DPP16 on opcodes with no DPP form
2026-10-05 15:50:28 +13:00
Dean 6d23390ac7 Merge pull request #513 from adriadam10/feat/dpp8
feat(shader): decode DPP8 on VOP1 and VOP2
2026-10-05 15:49:47 +13:00
Dean adac06b59b Merge pull request #474 from adriadam10/feat/div-f64
feat(shader): implement v_div_scale_f64, v_div_fmas_f64 and v_div_fixup_f64
2026-10-05 15:49:04 +13:00
Dean bd06241645 Merge pull request #447 from adriadam10/feat/vop3-f64-rest
feat(shader): implement v_rcp/rsq/sqrt_f64 and v_trig_preop_f64
2026-10-05 15:48:23 +13:00
Dean 9121886b0d Merge pull request #436 from adriadam10/feat/sopp-smem-misc
feat(shader): decode the s_endpgm variants, s_round_mode and SMEM probe/discard
2026-10-05 15:47:41 +13:00
Adrià FranchandClaude c0a98e3a6a fix(shader): refuse s_setpc_b64 after s_sub with the immediate first
Co-Authored-By: Claude <[email protected]>
2026-10-05 04:45:57 +02:00
Adrià FranchandClaude 9edb57d6b5 fix(shader): keep v_permlane16 lanes whose source lane is inactive
Without fetch-inactive or bound_ctrl, a v_permlane16_b32/v_permlanex16_b32
lane whose source lane is inactive keeps its old value on hardware;
AnyPS5 wrote 0 there. bound_ctrl alone now writes 0.

Co-Authored-By: Claude <[email protected]>
2026-10-05 04:38:40 +02:00
Adrià FranchandClaude c97030cc7b test(shader): execute ds_swizzle_b32 in all three offset modes
Co-Authored-By: Claude <[email protected]>
2026-10-05 04:34:00 +02:00
Adrià FranchandClaude 47b71dbaa4 fix(shader): return zero when an s_buffer_load offset passes 2^32
The byte address of each dword of s_buffer_load (soffset + imm + 4*i)
was computed in 32 bits, so a sum past 2^32 wrapped around and read the
start of the buffer. On hardware the sum doesn't wrap: such dwords are
out of range and read 0, like any dword at or past num_records. Both the
bound V# path and the GPU-computed V# path now check the carry.

The new execution test runs s_buffer_load_dwordx4/x16 and
s_load_dwordx16 against values captured on hardware.

Co-Authored-By: Claude <[email protected]>
2026-10-05 04:29:33 +02:00
Nicolas Abosch aa08977a59 fix(libc): preserve 64-bit long integer conversions 2026-10-04 23:27:17 -03:00
NumberGuan 75f407b926 fix(relinker): discover bundled modules in prx directories
Preserve each bundled module directory under app0 and resolve Linux dependencies across directories. Add integration coverage for both output formats and Windows startup. Refs #556; duplicate-export rejection remains unchanged.
2026-10-04 23:22:50 -03:00