Recompiler: patch console FP16 PS exports for 32-bit render targets #3200

Merged
Lakanya merged 1 commit from upstream-pr/3200 into main 2026-11-29 13:58:36 +00:00
Lakanya commented 2026-11-28 19:01:05 +00:00 (Migrated from github.com)

Imported from ivall/xcl. Originally posted by Lakanya on 2026-11-28T19:01:05Z.


Console pixel shaders ship with a default FP16 compressed export epilogue (v_cvt_pkrtz_f16_f32 followed by exp mrtK ... compr) that the console runtime patches into an uncompressed 32-bit export whenever a render target has 32-bit per-channel components (R32*, R32G32*, R32G32B32*, R32G32B32A32*). Lowering that unpatched epilogue literally converts raw 32-bit packed integer bits or 32-bit floats to f16 (e.g. 0x7BFF / 0x8000 in a retail title's R32_UINT subsurface-scattering diffuse target), producing bright blue/purple skin blowout and missing diffuse light on lit faces.

This PR patches matched v_cvt_pkrtz_f16_f32 + exp mrtK ... compr sequences into uncompressed 32-bit exports right after RDNA2 decoding for both the HLSL and direct-DXIL backends, keyed by a bitmask of 32-bit render targets from the PSO. When no 32-bit RT is bound (rt32_mask == 0), the shader cache key and generated HLSL are unchanged.

What is in it

  • crates/xcl/src/gpu/recomp/mod.rs: add is_rt32_format, rt32_mask_from_formats, Options::ps_rt32_mask, and patch_ps_32bit_exports (always checks later-read liveness of matched v_cvt_pkrtz_f16_f32 destinations before mutating EXP; declines the patch if an aliased conversion destination stays live after EXP or reaches a branch/join; otherwise rewrites exp mrtK ... compr to COMPR=0 with the original VGPR sources and NOPs dead conversions), called in translate() for pixel shaders.
  • crates/xcl/src/gpu/dxil/kernel.rs: add translate_pixel_rt32 and call patch_ps_32bit_exports in translate_on_this_thread so the direct-DXIL backend applies the same patching.
  • crates/xcl/src/gpu/recomp/pso.rs: add console_ps_to_dxil_for and thread rt32_mask into ShaderKey and translated::file_for (appending _rt32_<hex> only when rt32_mask != 0, keeping non-32-bit RT cache keys untouched), plus unit test rt32_mask_formats_and_cache_key.
  • crates/xcl/src/hle/d3d12x/real.rs: compute rt32_mask from PSO render-target formats in translated_graphics_pso_once, translated_graphics_stream_once, translated_mesh_pso, and translated_gs_pso, and pass it to pixel shader translation.
  • crates/xcl/src/gpu/dxil/core_tests.rs: add ps_32bit_rt_export_patches_pkrtz_in_both_backends (including in-place v_cvt_pkrtz_f16_f32 overwrite and mixed 16-bit/32-bit MRTs) and ps_32bit_rt_export_declines_patch_when_aliased_pkrtz_dst_is_live_after_exp covering both HLSL and direct-DXIL lowering.

Tested

  • Hardware: NVIDIA GeForce RTX 5070 Laptop GPU (8 GB, driver 617.71), Windows 11 Pro 26300, rustc 1.100.0 (0ef1bc386 2026-11-09), debug (tests) and release (smoke / visual check).
  • On head 99f94b04:
    • cargo test -p xcl --lib ps_32bit_rt_export: 2 passed, 0 failed, 0 ignored.
    • cargo test -p xcl --lib rt32_mask_formats_and_cache_key: 1 passed, 0 failed, 0 ignored.
  • On c8dde3a1 (before the liveness guard commit 99f94b04):
    • cargo test -p xcl --lib gpu:: -- --test-threads=4: 788 passed, 4 failed (pre-existing gpu::dxil::fuzz_tests::fuzz_validate_and_gpu_0..3 hitting CreateComputePipelineState: 0x8007000E OOM on this 8 GB GPU), 23 ignored; 24 SKIPPED lines (21 no wave64, 3 per-lane form: refused).
    • cargo test -p xcl --lib hle::d3d12x::list_x::tests -- --test-threads=1: 86 passed, 0 failed, 0 ignored.
    • cargo test --workspace --test '*' -- --test-threads=4 (after cargo build --workspace): 131 passed, 0 failed, 20 ignored, 1 SKIPPED.
    • Retail title (2c508222, XCL_DEVICE_TYPE=lockhart, XCL_DIRECT_DXIL=1, 192 s run, frame_2798.bmp vs pre-fix frame_2862.bmp): bright blue/purple subsurface-scattering blowout on character skin is eliminated and skin renders with natural diffuse lighting.

Regression run

xcl-smoke v1
commit: fa204595a488c60c6c5f905244f0172072c9c2a9
gpu: NVIDIA GeForce RTX 5070 Laptop GPU
title: 2c508222
seconds: 60
exit: 0x0
frames shown: 1576 (PresentX 1576)
presents per 2 s (last 3): 60 60 61
device removals: 0
crashes: 0
peak commit: 12877 MB
xcl-smoke v1
commit: 1cd8d7fe1031723a9f7c4731ffec1dc629e5c0e5
gpu: NVIDIA GeForce RTX 5070 Laptop GPU
title: 2c508222
seconds: 60
exit: 0x0
frames shown: 1535 (PresentX 1535)
presents per 2 s (last 3): 60 60 61
device removals: 0
crashes: 0
peak commit: 12978 MB

Not tested

  • AMD / Intel GPUs and native wave64 hardware (the 21 wave64 GPU tests were SKIPPED).
  • XCL_DIRECT_DXIL=all on a full retail title run (direct-DXIL 32-bit PS export patching was verified via ps_32bit_rt_export_* + DXIL validation/disassembly).
  • Single-process cargo test --workspace with hle:: lib tests all together (pre-existing cross-test sparse upload state in hle:: causes end_title(0x80004005)).

AI use

  • Antigravity, Gemini 4 Neon: implemented the 32-bit RT export patching across both backends and PSO wiring, addressed review feedback with the liveness guard and regression test, ran the tests and smoke runs, and drafted this PR description.
  • Claude Code, Claude Opus 5.5: performed the initial read-only static analysis identifying the unpatched v_cvt_pkrtz_f16_f32 + exp mrt1 compr epilogue on R32_UINT targets.
<!-- greyfinch-sync:ivall/xcl:issue:5543577776 --> Imported from [ivall/xcl](https://github.com/xcl-dev/xcl/pull/3200). Originally posted by [Lakanya](https://github.com/Lakanya) on 2026-11-28T19:01:05Z. --- Console pixel shaders ship with a default FP16 compressed export epilogue (`v_cvt_pkrtz_f16_f32` followed by `exp mrtK ... compr`) that the console runtime patches into an uncompressed 32-bit export whenever a render target has 32-bit per-channel components (`R32*`, `R32G32*`, `R32G32B32*`, `R32G32B32A32*`). Lowering that unpatched epilogue literally converts raw 32-bit packed integer bits or 32-bit floats to f16 (e.g. `0x7BFF` / `0x8000` in a retail title's `R32_UINT` subsurface-scattering diffuse target), producing bright blue/purple skin blowout and missing diffuse light on lit faces. This PR patches matched `v_cvt_pkrtz_f16_f32` + `exp mrtK ... compr` sequences into uncompressed 32-bit exports right after RDNA2 decoding for both the HLSL and direct-DXIL backends, keyed by a bitmask of 32-bit render targets from the PSO. When no 32-bit RT is bound (`rt32_mask == 0`), the shader cache key and generated HLSL are unchanged. **What is in it** - `crates/xcl/src/gpu/recomp/mod.rs`: add `is_rt32_format`, `rt32_mask_from_formats`, `Options::ps_rt32_mask`, and `patch_ps_32bit_exports` (always checks later-read liveness of matched `v_cvt_pkrtz_f16_f32` destinations before mutating `EXP`; declines the patch if an aliased conversion destination stays live after `EXP` or reaches a branch/join; otherwise rewrites `exp mrtK ... compr` to `COMPR=0` with the original VGPR sources and NOPs dead conversions), called in `translate()` for pixel shaders. - `crates/xcl/src/gpu/dxil/kernel.rs`: add `translate_pixel_rt32` and call `patch_ps_32bit_exports` in `translate_on_this_thread` so the direct-DXIL backend applies the same patching. - `crates/xcl/src/gpu/recomp/pso.rs`: add `console_ps_to_dxil_for` and thread `rt32_mask` into `ShaderKey` and `translated::file_for` (appending `_rt32_<hex>` only when `rt32_mask != 0`, keeping non-32-bit RT cache keys untouched), plus unit test `rt32_mask_formats_and_cache_key`. - `crates/xcl/src/hle/d3d12x/real.rs`: compute `rt32_mask` from PSO render-target formats in `translated_graphics_pso_once`, `translated_graphics_stream_once`, `translated_mesh_pso`, and `translated_gs_pso`, and pass it to pixel shader translation. - `crates/xcl/src/gpu/dxil/core_tests.rs`: add `ps_32bit_rt_export_patches_pkrtz_in_both_backends` (including in-place `v_cvt_pkrtz_f16_f32` overwrite and mixed 16-bit/32-bit MRTs) and `ps_32bit_rt_export_declines_patch_when_aliased_pkrtz_dst_is_live_after_exp` covering both HLSL and direct-DXIL lowering. **Tested** - Hardware: NVIDIA GeForce RTX 5070 Laptop GPU (8 GB, driver 617.71), Windows 11 Pro 26300, `rustc 1.100.0 (0ef1bc386 2026-11-09)`, debug (tests) and release (smoke / visual check). - On head `99f94b04`: - `cargo test -p xcl --lib ps_32bit_rt_export`: 2 passed, 0 failed, 0 ignored. - `cargo test -p xcl --lib rt32_mask_formats_and_cache_key`: 1 passed, 0 failed, 0 ignored. - On `c8dde3a1` (before the liveness guard commit `99f94b04`): - `cargo test -p xcl --lib gpu:: -- --test-threads=4`: 788 passed, 4 failed (pre-existing `gpu::dxil::fuzz_tests::fuzz_validate_and_gpu_0..3` hitting `CreateComputePipelineState: 0x8007000E` OOM on this 8 GB GPU), 23 ignored; 24 `SKIPPED` lines (`21 no wave64`, `3 per-lane form: refused`). - `cargo test -p xcl --lib hle::d3d12x::list_x::tests -- --test-threads=1`: 86 passed, 0 failed, 0 ignored. - `cargo test --workspace --test '*' -- --test-threads=4` (after `cargo build --workspace`): 131 passed, 0 failed, 20 ignored, 1 `SKIPPED`. - Retail title (`2c508222`, `XCL_DEVICE_TYPE=lockhart`, `XCL_DIRECT_DXIL=1`, 192 s run, `frame_2798.bmp` vs pre-fix `frame_2862.bmp`): bright blue/purple subsurface-scattering blowout on character skin is eliminated and skin renders with natural diffuse lighting. **Regression run** ``` xcl-smoke v1 commit: fa204595a488c60c6c5f905244f0172072c9c2a9 gpu: NVIDIA GeForce RTX 5070 Laptop GPU title: 2c508222 seconds: 60 exit: 0x0 frames shown: 1576 (PresentX 1576) presents per 2 s (last 3): 60 60 61 device removals: 0 crashes: 0 peak commit: 12877 MB ``` ``` xcl-smoke v1 commit: 1cd8d7fe1031723a9f7c4731ffec1dc629e5c0e5 gpu: NVIDIA GeForce RTX 5070 Laptop GPU title: 2c508222 seconds: 60 exit: 0x0 frames shown: 1535 (PresentX 1535) presents per 2 s (last 3): 60 60 61 device removals: 0 crashes: 0 peak commit: 12978 MB ``` **Not tested** - AMD / Intel GPUs and native wave64 hardware (the 21 wave64 GPU tests were `SKIPPED`). - `XCL_DIRECT_DXIL=all` on a full retail title run (direct-DXIL 32-bit PS export patching was verified via `ps_32bit_rt_export_*` + DXIL validation/disassembly). - Single-process `cargo test --workspace` with `hle::` lib tests all together (pre-existing cross-test sparse upload state in `hle::` causes `end_title(0x80004005)`). **AI use** - Antigravity, Gemini 4 Neon: implemented the 32-bit RT export patching across both backends and PSO wiring, addressed review feedback with the liveness guard and regression test, ran the tests and smoke runs, and drafted this PR description. - Claude Code, Claude Opus 5.5: performed the initial read-only static analysis identifying the unpatched `v_cvt_pkrtz_f16_f32` + `exp mrt1 compr` epilogue on `R32_UINT` targets.
JJAutoCompare commented 2026-11-28 19:40:31 +00:00 (Migrated from github.com)

Imported from ivall/xcl. Originally posted by JJAutoCompare on 2026-11-28T19:40:31Z.


Tested

Independently reran the pinned XCL library test executable at c8dde3a184dfb5ac8dc4e163d83ee36c641cb39b on Windows 11 x64 build 26200.9974 with a Ryzen 7 3800X. It was built with Rust 1.100.1 (x86_64 MSVC) from the exact-head source plus a private test-only module.

xcl-8941870b96d3eddf.exe --exact hle::d3d12x::real::rt32_stream_verification_tests::maps_rtv_formats_and_limits_rt32_mask_to_active_slots --nocapture --test-threads=1
xcl-8941870b96d3eddf.exe --exact gpu::recomp::pso::direct_probe_tests::rt32_mask_formats_and_cache_key --nocapture --test-threads=1

Both native processes exited 0. Total was 2 passed, 0 failed, 0 ignored, 0 skipped, with 2047 filtered out per invocation. In both synthetic subobject orders the raw RTV format IDs [28, 42, 86, 67, 10, 41, 115, 43] mapped to [28, 42, 28, 26, 10, 41, 28, 43]. Counts 3, 8, and 0 yielded RT32 masks 0x02, 0xa2, and 0x00, respectively. An absent RTV subobject yielded count 0, eight UNKNOWN formats, and a zero mask. The stock format and cache-key control passed separately.

Not tested

Device initialization, live stream adoption, shader translation, cache persistence, GPU, retail titles, and the workspace suite.

AI use

T3 Code through Codex (gpt-6.2-sol, high) prepared the fixture, verified the source and executable pins, independently reran both tests, and drafted this report.

<!-- greyfinch-sync:ivall/xcl:comment:7244721332 --> Imported from [ivall/xcl](https://github.com/xcl-dev/xcl/pull/3200#issuecomment-7244721332). Originally posted by [JJAutoCompare](https://github.com/JJAutoCompare) on 2026-11-28T19:40:31Z. --- **Tested** Independently reran the pinned XCL library test executable at `c8dde3a184dfb5ac8dc4e163d83ee36c641cb39b` on Windows 11 x64 build 26200.9974 with a Ryzen 7 3800X. It was built with Rust 1.100.1 (x86_64 MSVC) from the exact-head source plus a private test-only module. ```text xcl-8941870b96d3eddf.exe --exact hle::d3d12x::real::rt32_stream_verification_tests::maps_rtv_formats_and_limits_rt32_mask_to_active_slots --nocapture --test-threads=1 xcl-8941870b96d3eddf.exe --exact gpu::recomp::pso::direct_probe_tests::rt32_mask_formats_and_cache_key --nocapture --test-threads=1 ``` Both native processes exited 0. Total was 2 passed, 0 failed, 0 ignored, 0 skipped, with 2047 filtered out per invocation. In both synthetic subobject orders the raw RTV format IDs `[28, 42, 86, 67, 10, 41, 115, 43]` mapped to `[28, 42, 28, 26, 10, 41, 28, 43]`. Counts 3, 8, and 0 yielded RT32 masks `0x02`, `0xa2`, and `0x00`, respectively. An absent RTV subobject yielded count 0, eight UNKNOWN formats, and a zero mask. The stock format and cache-key control passed separately. **Not tested** Device initialization, live stream adoption, shader translation, cache persistence, GPU, retail titles, and the workspace suite. **AI use** T3 Code through Codex (`gpt-6.2-sol`, high) prepared the fixture, verified the source and executable pins, independently reran both tests, and drafted this report.
bmjask commented 2026-11-28 22:04:15 +00:00 (Migrated from github.com)

Imported from ivall/xcl. Originally posted by bmjask on 2026-11-28T22:04:15Z.

Review: CHANGES_REQUESTED


The NOP decision is unsafe when the conversion destination overlaps an export source. In patch_ps_32bit_exports, overwrites_src suppresses the later-read scan, and line 323 then replaces the conversion whenever overwrites_src is true. If the packed conversion result is consumed later in the same block, that consumer instead sees the pre-conversion value. The matcher does not establish that the export is terminal.

Please always perform the later-read liveness check. If the raw export needs the original source while the converted destination remains live, preserve one value in a temporary or decline the patch. Add a regression where v_cvt_pkrtz_f16_f32 aliases the raw export source and a later instruction reads its destination after EXP.

Reviewed at c8dde3a184 with Codex (GPT-5).

<!-- greyfinch-sync:ivall/xcl:review:6100275100 --> Imported from [ivall/xcl](https://github.com/xcl-dev/xcl/pull/3200#pullrequestreview-6100275100). Originally posted by [bmjask](https://github.com/bmjask) on 2026-11-28T22:04:15Z. **Review:** CHANGES_REQUESTED --- The NOP decision is unsafe when the conversion destination overlaps an export source. In `patch_ps_32bit_exports`, `overwrites_src` suppresses the later-read scan, and line 323 then replaces the conversion whenever `overwrites_src` is true. If the packed conversion result is consumed later in the same block, that consumer instead sees the pre-conversion value. The matcher does not establish that the export is terminal. Please always perform the later-read liveness check. If the raw export needs the original source while the converted destination remains live, preserve one value in a temporary or decline the patch. Add a regression where `v_cvt_pkrtz_f16_f32` aliases the raw export source and a later instruction reads its destination after `EXP`. Reviewed at c8dde3a184dfb5ac8dc4e163d83ee36c641cb39b with Codex (GPT-5).
Lakanya commented 2026-11-28 22:27:09 +00:00 (Migrated from github.com)

Imported from ivall/xcl. Originally posted by Lakanya on 2026-11-28T22:27:09Z.


Fixed in 99f94b04: patch_ps_32bit_exports now always runs the later-read liveness scan before mutating EXP (treating branch targets and branch instructions conservatively as potentially live), and declines the patch whenever an aliased v_cvt_pkrtz_f16_f32 destination remains live after EXP. Added regression test ps_32bit_rt_export_declines_patch_when_aliased_pkrtz_dst_is_live_after_exp covering both HLSL and direct-DXIL backends, and reran scripts/smoke.ps1 -Game <title> -Seconds 60 on 99f94b04 (updated in Regression run).

<!-- greyfinch-sync:ivall/xcl:comment:7246745110 --> Imported from [ivall/xcl](https://github.com/xcl-dev/xcl/pull/3200#issuecomment-7246745110). Originally posted by [Lakanya](https://github.com/Lakanya) on 2026-11-28T22:27:09Z. --- Fixed in `99f94b04`: `patch_ps_32bit_exports` now always runs the later-read liveness scan before mutating `EXP` (treating branch targets and branch instructions conservatively as potentially live), and declines the patch whenever an aliased `v_cvt_pkrtz_f16_f32` destination remains live after `EXP`. Added regression test `ps_32bit_rt_export_declines_patch_when_aliased_pkrtz_dst_is_live_after_exp` covering both HLSL and direct-DXIL backends, and reran `scripts/smoke.ps1 -Game <title> -Seconds 60` on `99f94b04` (updated in **Regression run**).
Kalmarv commented 2026-11-29 02:41:09 +00:00 (Migrated from github.com)

Imported from ivall/xcl. Originally posted by Kalmarv on 2026-11-29T02:41:09Z.


merge-check
base: fa204595a4
head: 1cd8d7fe10
merge: clean (fast-forward: the head sits on main fa204595; tested at 1cd8d7fe)
build: cargo build --workspace -> ok
tests: cargo test --workspace --no-fail-fast -- --test-threads=4 (XCL_DXC_DIR = DXC 1.9.2609) -> 2611 passed, 0 failed, 49 ignored; SKIPPED: 26, the usual set (21 no wave64 on this 32-lane GPU, 3 per-lane f16/f32 forms refused (#1426 semantics), 2 no heap windows). All three new tests ran and passed: ps_32bit_rt_export_patches_pkrtz_in_both_backends, ps_32bit_rt_export_declines_patch_when_aliased_pkrtz_dst_is_live_after_exp, rt32_mask_formats_and_cache_key.
review: none blocking; whole diff read. is_rt32_format names exactly the R32 / R32G32 / R32G32B32 / R32G32B32A32 DXGI values (1-8, 15-18, 39, 41-43; D32_FLOAT and R32G8X24 excluded). The desc path reads RTVFormats without pc_target_format while the stream paths map them, but that mapping never moves a format into or out of those ranges, so the masks agree. patch_ps_32bit_exports clears COMPR (bit 10 of the EXP word) and writes the four pkrtz sources into VSRC0-3. It only matches VGPR-sourced pkrtz in VOP2 or modifier-free VOP3, within the export's basic block. It declines when a source is clobbered before the export, or when a pkrtz destination that overwrote a needed source is still read after the export (or at a join). Dead conversions become s_nop of the same length, so PCs don't move. Both backends run it right after decoding. The mask is part of both the in-memory ShaderKey and the disk file name (_rt32_XX only when non-zero, so mask-0 entries keep their names). Gap: warm_graphics (real.rs, "the translation … as translated_graphics_pso_once makes them") still asks for the mask-0 PS through console_to_dxil_for. For a pipeline with an R32 target, the warm-up translates a variant nothing uses, and the real build then translates the rt32 one itself. A one-line follow-up fixes it (rt32_mask_d3d12(desc.NumRenderTargets, &desc.RTVFormats) + console_ps_to_dxil_for). Likewise the standalone pass of xcl shaders --precompile (standalone_graphics_variants) only makes mask-0 variants; it has no formats to go on, so only its recorded-pipeline replay (through translated_graphics_pso) can fill rt32 entries. I didn't run a precompile to see how many it covers.
performance: Title run (release build of the head, scratch/fast-world.py fast profile, about 85 s in world): exit 0, 0 crashes, 0 device removals, failed_pipelines 0, no translation errors, peak commit 30,508 MB, world entry 129.2 s (main fa204595 on the same harness: 76.8 s). This title binds R32 targets often: the run made 135 rt32 PS variants (43 with RT0 R32, 92 with RT1 R32; the cache snapshot had none, since main never makes them), and each one compiled in play. That shows in the log: 186 WARN lines against 86 on main, almost all of them "waited N ms for a graphics pipeline being built" (125 lines, against 23-36 in three other runs this session), plus one 4.5 s Present stall. No new WARN kinds otherwise. This is the one-time cost of changing those shaders' translation, and the next run with the same cache finds them. But see the precompile gap above: until a precompile can make these variants, a precompiled title still builds them in play once. All runs show 0 fps in the world because the cache doesn't match the translator identity, so I couldn't check the visual fix on this title.
verdict: safe to merge
hardware / tool and model: NVIDIA GeForce RTX 5070 Ti 16 GB (driver 610.74, wave32 only), AMD Ryzen 9 9950X, Windows 11 build 26200; rustc 1.99.0, debug test profile, release build for the title run, DXC 1.9.2609 via XCL_DXC_DIR. Claude Code, Claude Opus 5.5: build, suite, title run and full-diff review; this report.

<!-- greyfinch-sync:ivall/xcl:comment:7249583031 --> Imported from [ivall/xcl](https://github.com/xcl-dev/xcl/pull/3200#issuecomment-7249583031). Originally posted by [Kalmarv](https://github.com/Kalmarv) on 2026-11-29T02:41:09Z. --- merge-check base: fa204595a488c60c6c5f905244f0172072c9c2a9 head: 1cd8d7fe1031723a9f7c4731ffec1dc629e5c0e5 merge: clean (fast-forward: the head sits on main fa204595; tested at 1cd8d7fe) build: cargo build --workspace -> ok tests: cargo test --workspace --no-fail-fast -- --test-threads=4 (XCL_DXC_DIR = DXC 1.9.2609) -> 2611 passed, 0 failed, 49 ignored; SKIPPED: 26, the usual set (21 no wave64 on this 32-lane GPU, 3 per-lane f16/f32 forms refused (#1426 semantics), 2 no heap windows). All three new tests ran and passed: `ps_32bit_rt_export_patches_pkrtz_in_both_backends`, `ps_32bit_rt_export_declines_patch_when_aliased_pkrtz_dst_is_live_after_exp`, `rt32_mask_formats_and_cache_key`. review: none blocking; whole diff read. `is_rt32_format` names exactly the R32 / R32G32 / R32G32B32 / R32G32B32A32 DXGI values (1-8, 15-18, 39, 41-43; D32_FLOAT and R32G8X24 excluded). The desc path reads `RTVFormats` without `pc_target_format` while the stream paths map them, but that mapping never moves a format into or out of those ranges, so the masks agree. `patch_ps_32bit_exports` clears COMPR (bit 10 of the EXP word) and writes the four pkrtz sources into VSRC0-3. It only matches VGPR-sourced pkrtz in VOP2 or modifier-free VOP3, within the export's basic block. It declines when a source is clobbered before the export, or when a pkrtz destination that overwrote a needed source is still read after the export (or at a join). Dead conversions become `s_nop` of the same length, so PCs don't move. Both backends run it right after decoding. The mask is part of both the in-memory `ShaderKey` and the disk file name (`_rt32_XX` only when non-zero, so mask-0 entries keep their names). Gap: `warm_graphics` (`real.rs`, "the translation … as `translated_graphics_pso_once` makes them") still asks for the mask-0 PS through `console_to_dxil_for`. For a pipeline with an R32 target, the warm-up translates a variant nothing uses, and the real build then translates the rt32 one itself. A one-line follow-up fixes it (`rt32_mask_d3d12(desc.NumRenderTargets, &desc.RTVFormats)` + `console_ps_to_dxil_for`). Likewise the standalone pass of `xcl shaders --precompile` (`standalone_graphics_variants`) only makes mask-0 variants; it has no formats to go on, so only its recorded-pipeline replay (through `translated_graphics_pso`) can fill rt32 entries. I didn't run a precompile to see how many it covers. performance: Title run (release build of the head, scratch/fast-world.py fast profile, about 85 s in world): exit 0, 0 crashes, 0 device removals, `failed_pipelines` 0, no translation errors, peak commit 30,508 MB, world entry 129.2 s (main fa204595 on the same harness: 76.8 s). This title binds R32 targets often: the run made 135 rt32 PS variants (43 with RT0 R32, 92 with RT1 R32; the cache snapshot had none, since main never makes them), and each one compiled in play. That shows in the log: 186 WARN lines against 86 on main, almost all of them "waited N ms for a graphics pipeline being built" (125 lines, against 23-36 in three other runs this session), plus one 4.5 s Present stall. No new WARN kinds otherwise. This is the one-time cost of changing those shaders' translation, and the next run with the same cache finds them. But see the precompile gap above: until a precompile can make these variants, a precompiled title still builds them in play once. All runs show 0 fps in the world because the cache doesn't match the translator identity, so I couldn't check the visual fix on this title. verdict: safe to merge hardware / tool and model: NVIDIA GeForce RTX 5070 Ti 16 GB (driver 610.74, wave32 only), AMD Ryzen 9 9950X, Windows 11 build 26200; rustc 1.99.0, debug test profile, release build for the title run, DXC 1.9.2609 via XCL_DXC_DIR. Claude Code, Claude Opus 5.5: build, suite, title run and full-diff review; this report.
throny commented 2026-11-29 08:41:37 +00:00 (Migrated from github.com)

Imported from ivall/xcl. Originally posted by throny on 2026-11-29T08:41:37Z.


merge-check claim
head: 1cd8d7fe10

<!-- greyfinch-sync:ivall/xcl:comment:7253270056 --> Imported from [ivall/xcl](https://github.com/xcl-dev/xcl/pull/3200#issuecomment-7253270056). Originally posted by [throny](https://github.com/throny) on 2026-11-29T08:41:37Z. --- merge-check claim head: 1cd8d7fe1031723a9f7c4731ffec1dc629e5c0e5
throny commented 2026-11-29 09:00:58 +00:00 (Migrated from github.com)

Imported from ivall/xcl. Originally posted by throny on 2026-11-29T09:00:58Z.


merge-check
base: d8bd9a38
head: 1cd8d7fe10
merge: clean
build: cargo build --workspace -> ok
tests: cargo test --workspace --no-fail-fast -- --test-threads=4 -> 2621 passed, 0 failed, 49 ignored (27 SKIPPED lines). Base alone at d8bd9a38: 2618 passed, 0 failed, 49 ignored.
review: no blocking finding. For a pipeline whose render target has 32-bit channels, the packed 16-bit export is rewritten into an uncompressed 32-bit one in both backends, and the render-target mask joins the in-memory and on-disk cache keys (mask 0 keeps the old file names, and the changed translator source already changes the cache identity, so build.rs needs nothing). The patch declines when a source is overwritten and handles the case where one half's pack overwrites a source of the other. Notes: (1) three places still translate the pixel shader with mask 0: the pipeline warm-up, xcl shaders --precompile and the target dump. Not wrong, but the warm-up then compiles a variant the build never uses and the real one is compiled cold at build time; passing the mask in the warm-up would fix that. (2) It does not check for a change of EXEC between the pack and the export. (3) The first direct-DXIL assertion looks for a literal that may also appear without the change, so it is weaker than the HLSL ones. Not checked here: the picture in a title; this check is the suite and the code only.
performance: not measured; see note (1) for a possible cold compile per such pipeline.
verdict: safe to merge
hardware / tool and model: RTX 4080 16 GB (621.40), i9-12900K, Windows 11 26300, Rust 1.100.0, debug. Claude Code; merge, build and suite run by Claude Fable 5.2, diff review by Claude Opus 5.5 (every hunk read; nothing run on the GPU beyond the suite).

<!-- greyfinch-sync:ivall/xcl:comment:7253478778 --> Imported from [ivall/xcl](https://github.com/xcl-dev/xcl/pull/3200#issuecomment-7253478778). Originally posted by [throny](https://github.com/throny) on 2026-11-29T09:00:58Z. --- merge-check base: d8bd9a38 head: 1cd8d7fe1031723a9f7c4731ffec1dc629e5c0e5 merge: clean build: cargo build --workspace -> ok tests: cargo test --workspace --no-fail-fast -- --test-threads=4 -> 2621 passed, 0 failed, 49 ignored (27 SKIPPED lines). Base alone at d8bd9a38: 2618 passed, 0 failed, 49 ignored. review: no blocking finding. For a pipeline whose render target has 32-bit channels, the packed 16-bit export is rewritten into an uncompressed 32-bit one in both backends, and the render-target mask joins the in-memory and on-disk cache keys (mask 0 keeps the old file names, and the changed translator source already changes the cache identity, so build.rs needs nothing). The patch declines when a source is overwritten and handles the case where one half's pack overwrites a source of the other. Notes: (1) three places still translate the pixel shader with mask 0: the pipeline warm-up, `xcl shaders --precompile` and the target dump. Not wrong, but the warm-up then compiles a variant the build never uses and the real one is compiled cold at build time; passing the mask in the warm-up would fix that. (2) It does not check for a change of EXEC between the pack and the export. (3) The first direct-DXIL assertion looks for a literal that may also appear without the change, so it is weaker than the HLSL ones. Not checked here: the picture in a title; this check is the suite and the code only. performance: not measured; see note (1) for a possible cold compile per such pipeline. verdict: safe to merge hardware / tool and model: RTX 4080 16 GB (621.40), i9-12900K, Windows 11 26300, Rust 1.100.0, debug. Claude Code; merge, build and suite run by Claude Fable 5.2, diff review by Claude Opus 5.5 (every hunk read; nothing run on the GPU beyond the suite).
Sign in to join this conversation.
No reviewers
No labels
No milestone
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Reference
xcl-dev/xcl!3200
No description provided.