Repository navigation
Conversation
It was untranslated (the isa_coverage census listed it as missing). The common use is reading the current round mode, hwreg(MODE, 0, 4). XCL already models MODE[3:0]: [1:0] (f32) is always 0, as any other value is refused, and [3:2] (f16 / f64) is xcl_fp16_rm where a program changes it. A read of a field within MODE[3:0] is therefore exact. MODE[3:2] is now also followed at run time when the program reads it back, not only when an f16 op rounds by it: a change of it in a program without f16 ops was dropped before. Other registers and MODE bits depend on the console's hardware and program set-up (HW_ID1 / HW_ID2, STATUS, SHADER_CYCLES, denormal and clamp bits): refused, naming the register, instead of a made-up value. Tests: the HLSL for constant and followed MODE reads and the refusals, and a GPU test reading MODE around s_round_mode / s_setreg_imm32_b32 in a program without f16 ops. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
|
Verified on Windows 11 10.0.26300, NVIDIA GeForce RTX 5090 (driver 621.24), Rust 1.100.0 MSVC 14.44.35207, debug build, on clean Two more passing tests than main: Tree restored afterwards (md5 and a full diff against a clean checkout), hardware adapter, no Wine, no game data. AI-assisted (opencode): applied the patch to a built tree, ran the suite, reverted it. |
|
Hardware check of Tested
Regression run PR ( Not tested
AI use
|
|
Test report for head Setup
Tested: pass on both GPUs, including an AMD GPU and the native wave64 form you listed as not tested.
Not tested: the save / restore pattern end to end; a title that uses the instruction. Note: these runs check that the translated HLSL matches the test's reference model, in 64-lane and in 32-lane waves. They cannot show that the model matches the hardware (on #925 both had the same mistake, and the test still passed). |
|
Linux / AMD RDNA3 datapoint. Merged state: head Full suite, Footnote: Not tested: retail titles (none here), Windows, RDNA4. Machine: RX 7900 XT (RADV NAVI31), Mesa 26.2.5, kernel 7.2 (Arch), Proton Experimental (wine-11.0), patched vkd3d-proton v3.1, Rust cross AI use: Hermes agent (local Qwen-class) ran the suite and drafted this; I checked it before posting. |
|
Independent verification, merged onto current Machine: Windows 11, Ryzen 9 7900X + RTX 3060 Ti; Rust stable MSVC, debug; DXC 1.8.2502.11.
AI use: test runs by Devin (Cognition, SWE-2); no code changes. |
s_getreg_b32was untranslated (theisa_coveragecensus lists it as missing; no open PR or issue covers it). It reads a field of a hardware register into an SGPR. The common use in compiled shaders is reading the current round mode (hwreg(HW_REG_MODE, 0, 4), what LLVM'sllvm.get.roundingbecomes), often to restore it later.XCL already models MODE's round modes:
[1:0](f32) is always 0, since any other value is refused, and[3:2](f16 / f64) isxcl_fp16_rmwhere a program changes it. So a read of a field insideMODE[3:0]is exact. The rest is refused, with a reason that names the register (which then shows inreport.json), not answered with 0: the other MODE bits (denormals, clamps, IEEE) come from the console's program set-up, and registers such asHW_ID1/HW_ID2(wave, SIMD, CU ids),STATUSorSHADER_CYCLESfrom its hardware. A made-up value would be wrong for some programs, e.g. two waves with the same wave id indexing per-wave slots.What is in it
crates/xcl/src/gpu/recomp/emit.rs:getregfors_getreg_b32(MODE fields within[3:0]; refusals for the rest, named).configure_round_modesalso followsMODE[3:2]at run time when the program reads it back, not only when an f16 op rounds by it: before, a change of it in a program without f16 ops was dropped, and a read would have given 0.crates/xcl/src/gpu/recomp/tests.rs:s_getreg_b32_reads_the_round_modes_and_refuses_the_rest(the HLSL for a constant and a followed MODE, and the refusals with their reasons) andgpu_s_getreg_b32_round_modes(MODE read before and afters_round_modeands_setreg_imm32_b32, in a program with no f16 op:0,0xC, single bits, a field straddling[1:0]/[3:2]). Without theconfigure_round_modeschange the GPU test fails (every read gives 0).Tested
stable-x86_64-pc-windows-msvc, debug, DXC 1.9.2602.17cargo build --workspace && cargo test --workspace --no-fail-fast -- --test-threads=4: 715 passed, 3 failed, 41 ignored. The 3 aremain's memory-pressure failures of Memory: a sparse alloc/free loop makes a new 64 MiB pool each cycle; lib tests fill a 12 GB card (#348's test) #913 (placed_title_textures_share_vram_and_preserve_pixels, thentransitions_apply_when_their_list_is_submittedandd32s8_targets_take_their_own_size_of_video_memoryon its poisoned lock), which D3D12.X: a sparse pool retired a moment ago is taken back (#913) #923 addressescargo test -p xcl --lib -- --test-threads=4 --skip a_freed_block_is_decommitted_before_its_address_is_reused: 676 passed, 0 failed, 21 ignoredgpu_geometry_wave32_prefix_count_over_a_mask,gpu_wave32_program_in_wave64_hardware; noXCL_SAMPLE_*setisa_coveragestill listss_getreg_b32: it encodes each instruction with zero operands, which for this one is hardware register 0, refused on purposeRegression run
main:This PR:
Not tested
s_setreg_b32 hwreg(MODE, 0, 4), sNfrom an SGPR is still refused (dynamic f32 round mode), as before this changeAI use
🤖 Generated with Claude Code