xshader on real NVIDIA hardware: RTX 5090 exec 67 pass / 6 fail -> 76 / 0 (ISA-exact fixes, wave32 lane halves, hardware-checked vectors) #61
No reviewers
Labels
No labels
accessibility
bug
documentation
duplicate
enhancement
good first issue
help wanted
invalid
library
question
wontfix
No milestone
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set
Reference
github/omonkeyz--xbox-emulator!61
Loading…
Reference in a new issue
No description provided.
Delete branch "gh-pr/61/head"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
@QuentinDanblon on GitHub · 2026-11-21 22:02 UTC · original
QuentinDanblon:fix/nvidia-hw-conformance→main· +210 −0 · 4 files · 107 commits · closed without mergingLibrary / area: tombox-xshader: results on real NVIDIA hardware
Exports changed (exports.txt rows): none
Source of the behaviour: RDNA2 ISA (an input NaN is returned quieted, denormals follow MODE, wave32 lanes are 0-31). Each NVIDIA behaviour was isolated with small HLSL probes on an RTX 5090. Test vectors in
tests/exec_vop/leonida.rsare re-expressed as facts from Leonida's GPU tests (runtime/test/shaders/*.asm, GPL-3.0, no code copied, credited in comments), with encodings from llvm-mc-mcpu=gfx1013. The observation that some drivers run 64-lane fragment subgroups comes from americas-recomp (observation only).Rebased on
51f5319. This PR now also carries #62 and #64, which I closed to leave one PR for everything that concerns real hardware. Four commits, one per subject.Results
cargo test -p tombox-xshader --release --test exec, same machine:51f5319TOMBOX_EXEC_HW=1)TOMBOX_DXC_BRANCH_FREE=0The 3 extra tests are the new hardware-vector tests. Your evidence mentions an RTX 5060, so the six failures should show up on your machine too.
--test isa_sweep: 541 of 541 on the RTX 5090, and 530 plus the 11 known WARP deviations on WARP, on both main and this branch.--test opcodes23,--test synthetic11,--test mixed_table3,--test mesh13,--test centroid1 pass on both adapters.1. ISA-exact results on NVIDIA (
7d6f37c)vop::basic::vop1_basic:v_trunc/ceil/floor_f32of NaN give 0x7fffffff, ISA 0x7fc00000tb_trunc/tb_ceil/tb_floor: integer NaN test, return input | 0x400000scalar_mode_effects:s_denorm_modecase gives 0x80000000, expected 0xbf800000-denorm preservevector_vop3:v_add_nc_i16gives 0xffffffff, expected 0xabcdffffclamp(x,-32768,32767) & 0xffff(the DXIL is correct)sat_int(): clamp in an offset unsigned range, also used by v_sub / mad_i16, cvt_pk_i16_i32 and MTBUF sint packingvop::trig_preop_f64: 4 denormal results give 0tb_ldexp64's multiply chain at compile timetb_ldexp64markedpreciseexec_mem::ds::ds_lds_atomics_ext:ds_sub_u32/ds_sub_rtn_u32, CreateComputePipelineState 0x8007000eds_rsubalready usesvop::vopc::vopc_f16(only withTOMBOX_DXC_BRANCH_FREE=0):v_cmp(x)_nlg/ngt_f16, pipeline creation 0x8007000efcmp ule/ugewhen operand bits are partly knownnan || <ordered complement>, same resultsv_log_f32also returns powers of two exactly (0.25 was one ulp off on hardware).2.
image_get_lodon hardware (f99b40c)The sixth failure,
exec_mem::mimg::image_mimg_query, is not a translator error.CalculateLevelOfDetailUnclampedon the RTX 5090 returns multiples of 1/256, the 8 fractional bits D3D12 specifies (D3D12_MIP_LOD_FRACTIONAL_BIT_COUNT), and 4 - 1/256 (0x407fc000) for the exact 4.0 of the last case. WARP keeps float precision. The test tolerance is one LOD step whenTOMBOX_EXEC_HWis set, and stays 1e-5 on WARP.3. Wave32 lanes on a 64-lane host wave (
8630ef2, was #62)Guest lane numbers were used as absolute host lane indices. On a host that runs 64-lane waves, host lanes 32-63 are a second guest wave and would read or write the first one's lanes.
guest_lane(L)=(WaveGetLaneIndex() & ~31) | (L & 31)for wave32 guests, used by v_readlane and v_writelane. Wave64 guests are unchanged.(l >> 4) & 1. GDSds_append/ds_consumecount and elect within the lane's half.lane_numbering_follows_guest_wavechecks the emitted HLSL.4. Hardware-checked vectors as exec tests (
4d2995d, was #64)v_pk_lshlrev_b16(0x404) andv_pk_lshrrev_b16(0x405) had no decoder name, so a shader using them failed to translate. They are named and translated per the ISA: per-half shift by bits [3:0] of S0's selected half, OPSEL / OPSEL_HI as for the f16 packed ops, NEG / NEG_HI / CLAMP refused.tests/exec_vop/leonida.rs, each case run with constant and runtime inputs: SDWA vectors, pk shifts,v_add_nc_u16VOP3 keeping the dst high half,v_sin_f16keeping the high half,v_mul_legacy_f320 x inf and 0 x NaN,s_bfm_b64, 64-bit exec-mask half ops, MUBUF raw bounds.#[ignore]d test (wave_scc_readfirstlane_isa) documents a known limit of the one-lane-per-invocation model: afters_and_saveexec_b64, SCC andv_readfirstlaneare per-lane values, not wave values.Tests
Both adapters, all suites: see Results.
--lib: 60 pass.--test ps_linkage: 1 pass.Not run against a title.
cargo test -p tombox-xshaderpasses on WARP and on the RTX 5090No game or console files and no binaries included
No fake success; anything not possible is left
missingwith a note🤖 Generated with Claude Code
@QuentinDanblon on GitHub · 2026-11-21 23:09 UTC · original
Rebased onto
8491769and re-run on both backends.--test execThe 3 left on hardware are
image_mimg_query(LOD precision, as before) plusscalar_sop2andvop::basic::salu_basic. Those two also fail on main on WARP since8491769: thes_bfetest oracles were not updated with the translator. #70 fixes them, which would put this branch back at 69 / 1 on the 5090.@omonkeyz on GitHub · 2026-11-22 13:12 UTC · original
Main's history was rewritten, which auto-closed this PR. It is applied in
4f89f4e,93861d6,b445a1fand6afb54f(merged in81a1252) with your authorship kept, thanks! The added comment lines were stripped on the applied copy (the project keeps code free of comment lines).Pull request closed