Resubmit #47 #49 #55 #58 on current main, plus RDNA2 hardware-measured vectors (14 translator fixes) #152

Closed
github-bot wants to merge 6 commits from gh-pr/152/head into gh-pr/152/base
Owner

@⁠QuentinDanblon on GitHub · 2026-11-22 16:18 UTC · original
QuentinDanblon:contrib/all-in-one → main · +4841 −74 · 25 files · 6 commits · closed without merging

Library / area: tombox-xshader, d3d12_xs, compat-common (GameInput)

Exports changed (exports.txt rows): none

Source of the behaviour: RDNA2 ISA, LLVM AMDGPU (gfx1013), AMD machine-readable ISA specification, Mesa and LLPC (reference only), measurements on an RTX 5090, and results measured on AMD RDNA hardware published by the Leonida project (facts only, no code). THIRD_PARTY/CREDITS is updated in the last commit.

Thanks for merging #36 and #61. This carries four of the pull requests you asked me to resubmit (#47, #49, #55, #58), rebased on f10db75 with your requests applied, plus one new change. It is a single pull request with one commit per change, so that you have one place to look. If you prefer separate pull requests, say so and I will split it. #48 is left out, the reason is at the end.

No comment lines are added (PR gate run locally: 25 files checked, 0 problems). No commit message or code names a title, a game corpus or a GPL-2.0 project.

Commits

commit was change your request
c0ebb9d #49 Opcode tables checked against gfx1013 and gfx7 references (tests/isa_table.rs): 17 decoder names and 5 GFX7 lowerings corrected Rebased, no tools/progress change, comment lines removed. In gcn.rs the image_atomic_rsub refusal sits next to the R128 / TFE / LWE refusals of d585b94
7f9c1d6 new 60 cases measured on an AMD Radeon RX 6800, as exec tests. 14 disagreed with main and are fixed (details below)
0b726e7 #58 Mesh: full merged_wave_info in s3, GS_ALLOC_REQ field widths per the ISA The comment lines are removed, game references included. Rebased over 3526327 (local allocation counts), both changes kept
f14fbee #55 d3d12_xs: R9G9B9E5 UAV textures stored as RGBA16F on hosts without a typed UAV for that format Restated without a title or a GPL-2.0 project, comment lines removed, rebased on the current device_wrap.rs (keeps title_layout_size and res3d::note_create)
560c8e7 #47 Virtual pad: keyboard mapping, XInput pads that GameInput does not report, rumble (TOMBOX_PAD_XINPUT / pad_xinput, TOMBOX_PAD_KEYS / pad_keys) Rebased on the current gamepad.rs: host changes go through the new reading history, so GetNextReading / GetPreviousReading see them like scripted ones (one test added). Comment lines removed, tools/dev/pad.ps1 not touched
2f1cfd0 THIRD_PARTY/CREDITS: LLVM and AMD ISA specification lines for the opcode tables, Leonida line extended to the new vectors. Kept apart so that the code commits do not conflict on that file

Files: 0b726e7 touches only hlsl/mesh.rs and tests/mesh.rs, f14fbee only d3d12_xs, 560c8e7 only compat-common. c0ebb9d and 7f9c1d6 both touch rdna2.rs and tests/exec.rs.

Notes per commit

7f9c1d6 (new). The vectors are results an RX 6800 (gfx1030) returned, published in the comments of Leonida's GPU test programs (GPL-3.0). Its NaN vectors were taken with the hw-oracle tool of the AnyPS5 project. Only facts are used (instruction, input bits, measured bits); encodings come from llvm-mc -mcpu=gfx1013. 46 of the 60 cases already passed on main. The 14 others:

  • An inline float constant in an f16 operand is the f16 of that value in the low half and zero in the high half (LLVM getLit16Encoding). v_pack_b32_f16 and v_cvt_f32_f16 read the f32 bit pattern, OPSEL on a constant read the constant again instead of +0.0, and 1/2pi is the f16 0x3118.
  • v_med3_f32 with a NaN operand is MIN3 with the NaN ignored (RDNA2 ISA): med3(NaN, 7, 5) is 5, was 7.
  • SMEM: the 21-bit immediate is signed (LLVM isInt<21> on GFX9+), and soffset and the immediate are each truncated to a multiple of 4 before they are added. A negative immediate without SOFFSET is refused.

f14fbee (#55). The failure was first documented by the americas-recomp project (GPL-2.0). Only the behavioural fact is used, the code is independent; #55 has the context. The hardware test for your side: cargo test -p d3d12_xs --release --lib hw_rgb9e5 -- --ignored. It skips on WARP, which supports the format natively.

560c8e7 (#47). The one change #47 made to tools/dev/pad.ps1, for when you regenerate it, was a line in the help output: host input (a real XInput pad, keyboard WASD/arrows/Space... while the title window is focused) feeds the same pad; a running script, or a scripted 'down' not yet released, masks it (compat-common pad_host.rs).

Results

Run on 2f1cfd0 (this branch on f10db75), Windows 11, RTX 5090, --release.

suite WARP RTX 5090 (TOMBOX_EXEC_HW=1)
cargo test -p tombox-xshader, all targets 0 failed. exec 94 passed (2 ignored), lib 70, mesh 22 (1 ignored), opcodes 23, synthetic 18, isa_table 3, linkage 3, mixed_table 3, gcn_dims 3
--test exec 94 passed, 0 failed, 2 ignored 94 passed, 0 failed, 2 ignored
--test isa_sweep 541 mnemonics: 530 pass, 0 fail, 11 known WARP deviations 541 pass, 0 fail
--test mesh / centroid 22 passed (1 ignored) / 1 passed 22 passed (1 ignored) / 1 passed
  • Host input: compat-common lib 33 passed (filtered on the pad, GameInput and host input tests), gameinput_ext 3 passed.
  • d3d12_xs hardware tests (hw_, ignored by default): 39 passed, hw_rgb9e5_typed_uav_texture_is_substituted included.
  • d3d12_xs --lib: 482 passed, 2 failed, 40 ignored. The same two tests fail on f10db75 without this branch (471 passed, 2 failed, 39 ignored): xs_exports::console_fixed_tests::fixed_result_dxgix_exports_match_every_console_d3d12_xs and device_console_fix::tests::console_heap_properties_create_on_pc_through_every_wrapped_path. On 9ab6f59, in a debug build, the first failed and the second passed, with and without this branch.
  • Not run against a title.

Not included

  • #48 (XTaskQueue / XAsync conformance tests). I reran it as you asked, on 9ab6f59. The 24 DIFFERS entries still hold, each run in its own process (22 fail, one does not return, one fails only under load). But the default run is not stable: with that commit alone on 9ab6f59, 1 of 12 serial runs and 1 of 12 parallel runs failed, in verify_async_block_reuse or verify_simple_async_call, because XAsyncGetStatus(wait) returned before the completion callback had run. verify_no_write_after_get_status_race also failed in 2 of 5 runs of the whole suite, with the async block written after the wait returned. gdk/rt.rs is unchanged since 6741468. I will resubmit it when the default run is deterministic.

  • #72, to resubmit after #41 as you said.

  • cargo test -p tombox-xshader passes on WARP

  • No game or console files and no binaries included

  • No fake success; anything not possible is left missing with a note

🤖 Generated with Claude Code

**@⁠QuentinDanblon** on GitHub · 2026-11-22 16:18 UTC · [original](https://github.com/omonkeyz/xbox-emulator/pull/152) `QuentinDanblon:contrib/all-in-one` → `main` · +4841 −74 · 25 files · 6 commits · closed without merging **Library / area:** tombox-xshader, d3d12_xs, compat-common (GameInput) **Exports changed (exports.txt rows):** none **Source of the behaviour:** RDNA2 ISA, LLVM AMDGPU (gfx1013), AMD machine-readable ISA specification, Mesa and LLPC (reference only), measurements on an RTX 5090, and results measured on AMD RDNA hardware published by the Leonida project (facts only, no code). `THIRD_PARTY/CREDITS` is updated in the last commit. Thanks for merging #36 and #61. This carries four of the pull requests you asked me to resubmit (#47, #49, #55, #58), rebased on `f10db75` with your requests applied, plus one new change. It is a single pull request with **one commit per change**, so that you have one place to look. If you prefer separate pull requests, say so and I will split it. #48 is left out, the reason is at the end. No comment lines are added (PR gate run locally: 25 files checked, 0 problems). No commit message or code names a title, a game corpus or a GPL-2.0 project. ### Commits | commit | was | change | your request | |---|---|---|---| | `c0ebb9d` | #49 | Opcode tables checked against gfx1013 and gfx7 references (`tests/isa_table.rs`): 17 decoder names and 5 GFX7 lowerings corrected | Rebased, no `tools/progress` change, comment lines removed. In `gcn.rs` the `image_atomic_rsub` refusal sits next to the R128 / TFE / LWE refusals of `d585b94` | | `7f9c1d6` | new | 60 cases measured on an AMD Radeon RX 6800, as exec tests. 14 disagreed with main and are fixed (details below) | | | `0b726e7` | #58 | Mesh: full `merged_wave_info` in s3, `GS_ALLOC_REQ` field widths per the ISA | The comment lines are removed, game references included. Rebased over `3526327` (local allocation counts), both changes kept | | `f14fbee` | #55 | d3d12_xs: R9G9B9E5 UAV textures stored as RGBA16F on hosts without a typed UAV for that format | Restated without a title or a GPL-2.0 project, comment lines removed, rebased on the current `device_wrap.rs` (keeps `title_layout_size` and `res3d::note_create`) | | `560c8e7` | #47 | Virtual pad: keyboard mapping, XInput pads that GameInput does not report, rumble (`TOMBOX_PAD_XINPUT` / `pad_xinput`, `TOMBOX_PAD_KEYS` / `pad_keys`) | Rebased on the current `gamepad.rs`: host changes go through the new reading history, so `GetNextReading` / `GetPreviousReading` see them like scripted ones (one test added). Comment lines removed, `tools/dev/pad.ps1` not touched | | `2f1cfd0` | | `THIRD_PARTY/CREDITS`: LLVM and AMD ISA specification lines for the opcode tables, Leonida line extended to the new vectors. Kept apart so that the code commits do not conflict on that file | | Files: `0b726e7` touches only `hlsl/mesh.rs` and `tests/mesh.rs`, `f14fbee` only `d3d12_xs`, `560c8e7` only `compat-common`. `c0ebb9d` and `7f9c1d6` both touch `rdna2.rs` and `tests/exec.rs`. ### Notes per commit **`7f9c1d6` (new).** The vectors are results an RX 6800 (gfx1030) returned, published in the comments of Leonida's GPU test programs (GPL-3.0). Its NaN vectors were taken with the hw-oracle tool of the AnyPS5 project. Only facts are used (instruction, input bits, measured bits); encodings come from `llvm-mc -mcpu=gfx1013`. 46 of the 60 cases already passed on main. The 14 others: - An inline float constant in an f16 operand is the f16 of that value in the low half and zero in the high half (LLVM `getLit16Encoding`). `v_pack_b32_f16` and `v_cvt_f32_f16` read the f32 bit pattern, OPSEL on a constant read the constant again instead of +0.0, and 1/2pi is the f16 `0x3118`. - `v_med3_f32` with a NaN operand is MIN3 with the NaN ignored (RDNA2 ISA): `med3(NaN, 7, 5)` is 5, was 7. - SMEM: the 21-bit immediate is signed (LLVM `isInt<21>` on GFX9+), and soffset and the immediate are each truncated to a multiple of 4 before they are added. A negative immediate without SOFFSET is refused. **`f14fbee` (#55).** The failure was first documented by the americas-recomp project (GPL-2.0). Only the behavioural fact is used, the code is independent; #55 has the context. The hardware test for your side: `cargo test -p d3d12_xs --release --lib hw_rgb9e5 -- --ignored`. It skips on WARP, which supports the format natively. **`560c8e7` (#47).** The one change #47 made to `tools/dev/pad.ps1`, for when you regenerate it, was a line in the help output: `host input (a real XInput pad, keyboard WASD/arrows/Space... while the title window is focused) feeds the same pad; a running script, or a scripted 'down' not yet released, masks it (compat-common pad_host.rs)`. ### Results Run on `2f1cfd0` (this branch on `f10db75`), Windows 11, RTX 5090, `--release`. | suite | WARP | RTX 5090 (`TOMBOX_EXEC_HW=1`) | |---|---|---| | `cargo test -p tombox-xshader`, all targets | 0 failed. exec 94 passed (2 ignored), lib 70, mesh 22 (1 ignored), opcodes 23, synthetic 18, isa_table 3, linkage 3, mixed_table 3, gcn_dims 3 | | | `--test exec` | 94 passed, 0 failed, 2 ignored | 94 passed, 0 failed, 2 ignored | | `--test isa_sweep` | 541 mnemonics: 530 pass, 0 fail, 11 known WARP deviations | 541 pass, 0 fail | | `--test mesh` / `centroid` | 22 passed (1 ignored) / 1 passed | 22 passed (1 ignored) / 1 passed | - Host input: `compat-common` lib 33 passed (filtered on the pad, GameInput and host input tests), `gameinput_ext` 3 passed. - `d3d12_xs` hardware tests (`hw_`, ignored by default): 39 passed, `hw_rgb9e5_typed_uav_texture_is_substituted` included. - `d3d12_xs --lib`: 482 passed, **2 failed**, 40 ignored. The same two tests fail on `f10db75` without this branch (471 passed, 2 failed, 39 ignored): `xs_exports::console_fixed_tests::fixed_result_dxgix_exports_match_every_console_d3d12_xs` and `device_console_fix::tests::console_heap_properties_create_on_pc_through_every_wrapped_path`. On `9ab6f59`, in a debug build, the first failed and the second passed, with and without this branch. - Not run against a title. ### Not included - **#48 (XTaskQueue / XAsync conformance tests).** I reran it as you asked, on `9ab6f59`. The 24 `DIFFERS` entries still hold, each run in its own process (22 fail, one does not return, one fails only under load). But the default run is not stable: with that commit alone on `9ab6f59`, 1 of 12 serial runs and 1 of 12 parallel runs failed, in `verify_async_block_reuse` or `verify_simple_async_call`, because `XAsyncGetStatus(wait)` returned before the completion callback had run. `verify_no_write_after_get_status_race` also failed in 2 of 5 runs of the whole suite, with the async block written after the wait returned. `gdk/rt.rs` is unchanged since `6741468`. I will resubmit it when the default run is deterministic. - **#72**, to resubmit after #41 as you said. - [x] `cargo test -p tombox-xshader` passes on WARP - [x] No game or console files and no binaries included - [x] No fake success; anything not possible is left `missing` with a note 🤖 Generated with [Claude Code](https://claude.com/claude-code)
Add tests/isa_table.rs with committed references derived from LLVM MC test
vectors (llvm-project 963ab285f26c, Apache-2.0 WITH LLVM-exception) and AMD's
machine-readable RDNA1/RDNA2 ISA XML (MIT), both in THIRD_PARTY/CREDITS: every opcode the decoder names must
exist in gfx1013 (GFX10.1 + BVH) under that name, and every GFX7 instruction
the GCN lowering accepts must land on the same (or a documented equivalent)
GFX10 instruction.

Fixes found by the check:
- VOP2 0x36/0x37/0x38 (VOP3 0x136) are v_fmac_f16 / v_fmamk_f16 / v_fmaak_f16
  on GFX10, not v_mac_f16 / v_madmk_f16 / v_madak_f16. Translate them as fused
  f16 FMAs that keep denormals, rounded once like v_fma_f16 (tb_rto), default
  and MODE paths; this replaces the MAD lowering with f16 denormal flushing
  (tb_hz/tb_hzb) and the isa_sweep v_mac_f16/v_madmk_f16/v_madak_f16 cases now
  check v_fmac_f16/v_fmamk_f16/v_fmaak_f16 against hfma.
- VOP3 no longer names VOP2/VOP1-only opcodes (madmk/madak/fmamk/fmaak,
  v_pk_fmac_f16, v_swap_b32); VINTRP op 3 is undefined; MIMG gather4 has no
  _d/_d_cl forms.
- GCN SMRD: s_memtime is 0x1e and s_dcache_inv 0x1f on GFX7 (0x1d, the
  volatile invalidate, maps to s_dcache_inv); buffer_wbinvl1(_vol) lowers to
  buffer_gl0_inv + buffer_gl1_inv; image_atomic_rsub is refused.

Co-Authored-By: Claude Fable 5.2 <[email protected]>
New tests/exec_vop/rdna2_hw.rs: results an AMD Radeon RX 6800 (gfx1030) returned,
as published in the comments of the Leonida project's GPU test programs
(ItsNotRexed/Leonida, runtime/test/shaders/*.asm, GPL-3.0). Facts only
(instruction, input bits, measured bits), no code copied; encodings from
llvm-mc -mcpu=gfx1013. Credit: Leonida authors (THIRD_PARTY/CREDITS).

Fourteen cases disagreed with the translator. Fixed:
- An inline float constant in an f16 operand is the f16 of that value in the low
  half and zero in the high half (LLVM getLit16Encoding). v_pack_b32_f16 and
  v_cvt_f32_f16 read the f32 bit pattern; OPSEL on a constant read the constant
  again instead of +0.0; 1/2pi is the f16 0x3118, not the f32 value.
- v_med3_f32 with a NaN operand is MIN3 with the NaN ignored (RDNA2 ISA):
  med3(NaN, 7, 5) = 5, was 7.
- SMEM: the 21-bit immediate is signed (LLVM isInt<21> on GFX9+), and soffset
  and the immediate are each truncated to a multiple of 4 before they are added.
  A negative immediate without SOFFSET is refused.

Co-Authored-By: Claude Fable 5.2 <[email protected]>
s3 now carries TGsize[31:28] = ceil(threads/wave), the wave index [27:24] and
the per-wave ES vertex / GS primitive counts [7:0]/[15:8] (RDNA2 ISA 3.12.2,
ES+GS SGPR 3; Mesa ac_nir_lower_intrinsics_to_args.c, ac_nir_lower_ngg.c; LLPC
MeshTaskShader.cpp). GS_ALLOC_REQ decodes M0[9:0] vertices and M0[22:12]
primitives (RDNA2 ISA 12.5.1). v5 semantics unchanged.

Tests: synthetic mesh programs extract s3[31:28] and s3[15:0] for wave64/wave32
at 128, 96 and 80 threads, and a GS_ALLOC_REQ at the 128/128 limit with bits
outside both fields set; WARP and RTX 5090.

Co-Authored-By: Claude Fable 5.2 <[email protected]>
A FidelityFX upscaler library built for the console creates a 1920x1080
R9G9B9E5_SHAREDEXP texture with ALLOW_UNORDERED_ACCESS (device slot 76). RDNA2 consoles accept it.
NVIDIA rejects it with E_INVALIDARG because the format lacks
FORMAT_SUPPORT1_TYPED_UNORDERED_ACCESS_VIEW, and ffxCreateContext throws.

The code is an independent implementation. Where the failure was first
observed is in the pull request text.

Measured on this machine with CheckFeatureSupport(FORMAT_SUPPORT):
- RTX 5090 and UHD 770: R9G9B9E5 Support1=0x8013f0, so CreateCommittedResource
  with ALLOW_UAV returns 0x80070057.
- WARP: Support1=0x2ecd3f1, and it accepts the texture.
- 85/86/115/191 (B5G6R5, B5G5R5A1, B4G4R4A4, A4B4G4R4) are the only other
  formats that WARP binds as typed UAVs and NVIDIA/Intel do not. They are left
  alone: there is no console evidence for them and no exact wider container.

R16G16B16A16_FLOAT is an exact container for RGB9E5. Every channel value
m*2^(e-24) (m<512, e<=31, max 65408) is an f16; a unit test checks all 16384.

uav_subst.rs:
- Decision gated on the host's real Support1. Unknown support never
  substitutes.
- Substitution applied in CreateCommittedResource (27, also reached by
  76/83), CreatePlacedResource (29) and CreatePlacedResourceX (44, which then
  gets its own committed resource because the wider texture must not alias the
  title's neighbouring VA placements).
- CPU-visible heaps are refused so that Map/Read/WriteToSubresource never see
  8-byte texels.
- Per-resource registry, validated against GetDesc.
- SRV/UAV/RTV descriptors whose format is R9G9B9E5 are rewritten through a
  hook on the real device's method table (18/19/20), installed with the first
  substitution. That one point covers wrapper slots, placed-view slots,
  title_heap and titles that hold the real device. SRV swizzles that read
  source alpha are forced to 1, as an RGB9E5 read returns.
- GetResourceAllocationInfo sizes substituted descs at 8 bytes per texel.
- Title-memory mirroring (upload.rs) widens console RGB9E5 texels to RGBA16F
  while de-tiling.
- On the Xbox command list, copies between a substituted texture and an
  R9G9B9E5 footprint or an unsubstituted texture are refused and logged; they
  are never forwarded as corrupt data. Substitute-to-substitute copies pass.

Not mapped:
- Shader UAV stores keep f16 values: more precise, within one RGB9E5 quantum,
  with no clamp of negatives/NaN/>65408.
- Typed UAV loads return the stored alpha.
- Reserved resources are not substituted.

Tests:
- Unit tests for the decision table, desc/view rewrite, swizzle, copy rules,
  conversions and the widening de-tile.
- hw_rgb9e5_typed_uav_texture_is_substituted goes through slot 76, writes
  with a UAV compute shader and reads back through an SRV.
  - On the RTX 5090: 512 texels are exact, 512 more are within one quantum,
    and the refusal of the console-footprint copy is checked.
  - The test skips on WARP, which supports the format natively.
  - With the debug layer it reports only the intended host rejection.

Co-Authored-By: Claude Fable 5.2 <[email protected]>
pad_host.rs feeds the virtual gamepad from a real XInput pad (xinput1_4.dll,
loaded at run time; only while the host GameInput reports no gamepad itself)
and from a keyboard-to-pad mapping sampled while a window of the title is in
the foreground (off once the title asks GameInput for keyboard readings).
Scripted pad commands win while a command file runs or a scripted 'down' is
held. SetRumbleState on the virtual pad sends low/high motors to the feeding
XInput pad. Config: TOMBOX_PAD_XINPUT / pad_xinput, TOMBOX_PAD_KEYS / pad_keys.
Host changes are pushed to the virtual pad's reading history, so
GetNextReading / GetPreviousReading see them like scripted ones.

Co-Authored-By: Claude Fable 5.2 <[email protected]>
Credits for the opcode table references of tests/isa_table and for the
hardware-measured vectors of tests/exec_vop/rdna2_hw.rs.

Co-Authored-By: Claude Fable 5.2 <[email protected]>
github-bot locked as GitHub sync and limited conversation to collaborators 2026-11-26 06:11:56 +00:00
github-bot closed this pull request 2026-11-26 06:11:56 +00:00
Author
Owner

@⁠omonkeyz on GitHub · 2026-11-22 16:26 UTC · original

Thanks for resubmitting all of this on current main, and for the hardware-measured vectors! At about 4,800 lines across compat-common (pad host), d3d12_xs (UAV substitution, upload.rs, device_wrap) and the shader translator, it's too large to review and land as one change. Please split it into small PRs of a few hundred lines each, one topic per PR, each with its own tests:

  1. One PR for each former PR you're resubmitting (#47, #49, #55, #58), rebased onto current main.
  2. The translator fixes, in small groups, with the isa_table vectors that check them. The large gfx1013.txt / gfx7.txt tables can go in with the first translator PR that uses them.
  3. The pad host / gamepad change on its own.
  4. The uav_subst change on its own. It touches the d3d12_xs hot path, so please include its cost on a draw-heavy workload or a micro-bench.
  5. upload.rs changes on their own. Note that #146 just landed there and #153 is under review.

Please keep each new THIRD_PARTY/CREDITS line with the PR that uses it.

**@⁠omonkeyz** on GitHub · 2026-11-22 16:26 UTC · [original](https://github.com/omonkeyz/xbox-emulator/pull/152#issuecomment-7082073345) Thanks for resubmitting all of this on current main, and for the hardware-measured vectors! At about 4,800 lines across compat-common (pad host), d3d12_xs (UAV substitution, upload.rs, device_wrap) and the shader translator, it's too large to review and land as one change. Please split it into small PRs of a few hundred lines each, one topic per PR, each with its own tests: 1. One PR for each former PR you're resubmitting (#47, #49, #55, #58), rebased onto current main. 2. The translator fixes, in small groups, with the `isa_table` vectors that check them. The large `gfx1013.txt` / `gfx7.txt` tables can go in with the first translator PR that uses them. 3. The pad host / gamepad change on its own. 4. The `uav_subst` change on its own. It touches the d3d12_xs hot path, so please include its cost on a draw-heavy workload or a micro-bench. 5. `upload.rs` changes on their own. Note that #146 just landed there and #153 is under review. Please keep each new THIRD_PARTY/CREDITS line with the PR that uses it.
Author
Owner

@⁠MiguelMatMar on GitHub · 2026-11-22 17:57 UTC · original

Ran this on Windows 11, MSVC, NVIDIA Ada / RTX 40-series (a second NVIDIA generation besides your RTX 5090), each tree with its own target dir.

On the branch itself (2f1cfd0) everything passes:

suite WARP Hardware (TOMBOX_EXEC_HW=1)
--test exec 94 passed, 0 failed, 2 ignored 94 passed, 0 failed, 2 ignored
--test isa_sweep 541: 530 pass, 0 fail, 11 known WARP deviations 541 pass, 0 fail
cargo test -p tombox-xshader, all targets 0 failed
d3d12_xs hw_rgb9e5_typed_uav_texture_is_substituted passed; this adapter has no typed R9G9B9E5 UAV (Support1=0x8013f0), so the substitution path really ran

Merged onto main 0a9ebcd (only conflict: the Leonida / TomBox lines in THIRD_PARTY/CREDITS, keeping both sides' additions), exec (99 passed) and isa_sweep (541) still pass on WARP and hardware, but isa_table::gcn_lowering_keeps_instruction fails:

6 gfx7 lowering mismatches:
gfx7 vop2 0x00d v_min_legacy_f32 lowers to v_cmp_lt_f32 + v_cndmask_b32
gfx7 vop2 0x00e v_max_legacy_f32 lowers to v_cmp_ge_f32 + v_cndmask_b32
gfx7 vop2 0x02c v_cvt_pkaccum_u8_f32 lowers to v_cvt_pk_u8_f32
gfx7 vop3 0x10d v_min_legacy_f32 lowers to v_cmp_lt_f32 + v_cndmask_b32
gfx7 vop3 0x10e v_max_legacy_f32 lowers to v_cmp_ge_f32 + v_cndmask_b32
gfx7 vop3 0x12c v_cvt_pkaccum_u8_f32 lowers to v_cvt_pk_u8_f32

Those are the intended lowerings from #140 and #141, which landed after this branch was cut. Adding them to gfx7_equivalent in tests/isa_table.rs fixes it:

        "v_min_legacy_f32" => return vec!["v_cmp_lt_f32".into(), "v_cndmask_b32".into()],
        "v_max_legacy_f32" => return vec!["v_cmp_ge_f32".into(), "v_cndmask_b32".into()],
        "v_cvt_pkaccum_u8_f32" => "v_cvt_pk_u8_f32",

With that, isa_table passes 3/3 and the rest of the tombox-xshader suites pass too (16 suites, 213 tests, 0 failed).

Heads-up: against the newest main (1e77fcc) the branch now also conflicts in crates/compat/d3d12_xs/src/device_wrap.rs and upload.rs, so it will need a rebase anyway.

**@⁠MiguelMatMar** on GitHub · 2026-11-22 17:57 UTC · [original](https://github.com/omonkeyz/xbox-emulator/pull/152#issuecomment-7083228515) Ran this on Windows 11, MSVC, NVIDIA Ada / RTX 40-series (a second NVIDIA generation besides your RTX 5090), each tree with its own target dir. **On the branch itself (`2f1cfd0`)** everything passes: | suite | WARP | Hardware (`TOMBOX_EXEC_HW=1`) | |---|---|---| | `--test exec` | 94 passed, 0 failed, 2 ignored | 94 passed, 0 failed, 2 ignored | | `--test isa_sweep` | 541: 530 pass, 0 fail, 11 known WARP deviations | 541 pass, 0 fail | | `cargo test -p tombox-xshader`, all targets | 0 failed | | | `d3d12_xs hw_rgb9e5_typed_uav_texture_is_substituted` | | passed; this adapter has no typed R9G9B9E5 UAV (`Support1=0x8013f0`), so the substitution path really ran | **Merged onto main `0a9ebcd`** (only conflict: the Leonida / TomBox lines in `THIRD_PARTY/CREDITS`, keeping both sides' additions), `exec` (99 passed) and `isa_sweep` (541) still pass on WARP and hardware, but **`isa_table::gcn_lowering_keeps_instruction` fails**: ```text 6 gfx7 lowering mismatches: gfx7 vop2 0x00d v_min_legacy_f32 lowers to v_cmp_lt_f32 + v_cndmask_b32 gfx7 vop2 0x00e v_max_legacy_f32 lowers to v_cmp_ge_f32 + v_cndmask_b32 gfx7 vop2 0x02c v_cvt_pkaccum_u8_f32 lowers to v_cvt_pk_u8_f32 gfx7 vop3 0x10d v_min_legacy_f32 lowers to v_cmp_lt_f32 + v_cndmask_b32 gfx7 vop3 0x10e v_max_legacy_f32 lowers to v_cmp_ge_f32 + v_cndmask_b32 gfx7 vop3 0x12c v_cvt_pkaccum_u8_f32 lowers to v_cvt_pk_u8_f32 ``` Those are the intended lowerings from #140 and #141, which landed after this branch was cut. Adding them to `gfx7_equivalent` in `tests/isa_table.rs` fixes it: ```rust "v_min_legacy_f32" => return vec!["v_cmp_lt_f32".into(), "v_cndmask_b32".into()], "v_max_legacy_f32" => return vec!["v_cmp_ge_f32".into(), "v_cndmask_b32".into()], "v_cvt_pkaccum_u8_f32" => "v_cvt_pk_u8_f32", ``` With that, `isa_table` passes 3/3 and the rest of the `tombox-xshader` suites pass too (16 suites, 213 tests, 0 failed). Heads-up: against the newest main (`1e77fcc`) the branch now also conflicts in `crates/compat/d3d12_xs/src/device_wrap.rs` and `upload.rs`, so it will need a rebase anyway.
Author
Owner

@⁠QuentinDanblon on GitHub · 2026-11-23 01:16 UTC · original

Split as you asked, one topic per PR, each with its tests:

PR topic size
#200 mesh: merged_wave_info in s3, GS_ALLOC_REQ widths (was #58), written for the two-pass path of 256-thread shaders +54 / -14
#201 opcode tables checked against gfx1013 and gfx7 (was #49) 238 lines of code and tests, plus the two reference tables
#202 inline float constants in f16 operands, with the RX 6800 vectors +116 / -5
#203 v_med3_f32 with a NaN operand +17 / -1
#206 the SMEM immediate is signed +24 / -4
#207 pad host / gamepad (was #47) +654 / -8
  • #201 fixes the isa_table failure this PR had after #140 and #141. Thanks to MiguelMatMar for the run on a second NVIDIA generation and for the three equivalence lines, they are in #201 and the commit message names the source.
  • #206 is rebased over your smem_bounds.rs. Main now truncates soffset and the immediate, so that part is dropped and only the signed immediate is left: three of the RX 6800 vectors still return 0 on 2eda8b0.
  • Each THIRD_PARTY/CREDITS line is in the PR that uses it (#201 and #206). #202 and #203 put their tests in tests/exec_vop/leonida.rs, which the existing Leonida line already covers.
  • All six were validated on WARP only, because the GPU of my machine is busy for now. Each PR says so. I will post the hardware runs when the card is free.

Still to come, as separate PRs: uav_subst (was #55) with its cost on a draw-heavy workload or a micro-bench, then the upload.rs change on its own. Both need the GPU.

Closing this one in favour of the PRs above.

**@⁠QuentinDanblon** on GitHub · 2026-11-23 01:16 UTC · [original](https://github.com/omonkeyz/xbox-emulator/pull/152#issuecomment-7089020276) Split as you asked, one topic per PR, each with its tests: | PR | topic | size | |---|---|---| | #200 | mesh: `merged_wave_info` in s3, `GS_ALLOC_REQ` widths (was #58), written for the two-pass path of 256-thread shaders | +54 / -14 | | #201 | opcode tables checked against gfx1013 and gfx7 (was #49) | 238 lines of code and tests, plus the two reference tables | | #202 | inline float constants in f16 operands, with the RX 6800 vectors | +116 / -5 | | #203 | `v_med3_f32` with a NaN operand | +17 / -1 | | #206 | the SMEM immediate is signed | +24 / -4 | | #207 | pad host / gamepad (was #47) | +654 / -8 | - #201 fixes the `isa_table` failure this PR had after #140 and #141. Thanks to MiguelMatMar for the run on a second NVIDIA generation and for the three equivalence lines, they are in #201 and the commit message names the source. - #206 is rebased over your `smem_bounds.rs`. Main now truncates soffset and the immediate, so that part is dropped and only the signed immediate is left: three of the RX 6800 vectors still return 0 on `2eda8b0`. - Each `THIRD_PARTY/CREDITS` line is in the PR that uses it (#201 and #206). #202 and #203 put their tests in `tests/exec_vop/leonida.rs`, which the existing Leonida line already covers. - All six were validated on WARP only, because the GPU of my machine is busy for now. Each PR says so. I will post the hardware runs when the card is free. Still to come, as separate PRs: `uav_subst` (was #55) with its cost on a draw-heavy workload or a micro-bench, then the `upload.rs` change on its own. Both need the GPU. Closing this one in favour of the PRs above.

Pull request closed

This discussion has been locked. Commenting is limited to contributors.
No description provided.