Recompiler: key translations on XCL_RDNA_FLOAT and XCL_WATERFALL_COLLAPSE #3621
Loading…
Reference in a new issue
No description provided.
Delete branch "upstream-pr/3621"
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?
Imported from ivall/xcl. Originally posted by kole07139 on 2026-12-01T22:47:03Z.
XCL_RDNA_FLOATandXCL_WATERFALL_COLLAPSEboth change the DXIL the direct translator emits, but neither was in the translated cache's identity nor in the warm-pipeline settings key. After a default run, a run with either set to0(the obvious thing to try when a float result or a sampled texture looks wrong) loaded the translations made with the switch on, so the switch did nothing. The other way round, a cache filled with=0served its programs to a default run. Same class as #1409 / #2327 (XCL_SAFE_BARRIER).Fixes #3520 (reported by @Grimkaaah, whose proposed fix this follows).
XCL_WATERFALL_COLLAPSE(added in4250e761) has the same gap and is not in the issue.Rebased onto
main38ad22da. The only conflict was thesemantic_pipeline_settingline, where #3655 addedXCL_WAVE64_IDIOMSbeside these names; that switch is already in the translated identity throughcompact_nest_tag.What is in it
gpu/recomp/pso.rs:translated::direct_switches_taggedtags an identity for each switch that is off (xcl-rdna-float-0,xcl-waterfall-collapse-0), the wayXCL_X_LDS_ORDER=0does. With both on (the default) it adds no tag. It is applied inidentity_from_sourcewhen the backend is direct, and indirect_output_identity, which keys the enormous programs rerouted to the direct translator on the HLSL path.direct_output_identitytakes the two switches as parameters, likenest_tagandsplit_limit, so a test can reach it.gpu/dxil/waterfall.rs:collapse_enabled(), the switchcollapsealready read.gpu/dxil/mod.rs:preludeandwaterfallarepub(crate), sopso.rscan read both switches.shaders.rs: both names joinsemantic_pipeline_setting.warm_settings_key().direct_output_switches_split_the_disk_cacheruns each case as a process of its own on one disk cache (the identities use OnceLock), asrerouted_disk_entries_follow_compact_nesting_policydoes:identity_from_source(XCL_DIRECT_DXIL=all,left: 1, right: 2) and without the switches indirect_output()(=0, same).direct_output_switches_that_are_off_get_their_own_identity: the default keeps the identity, and each combination of switches gives a distinct one.warm_settings_ignore_waits_watchdogs_and_traces_but_keep_pipeline_switchesnow also checks both names.XCL_RDNA_FLOAT stays in the key).Tested
cargo test --workspace -- --test-threads=4(with--no-fail-fast) on this head (ac528d09), aftercargo clean -p xcl, twice:hle::d3d12x::list_x::tests::wait64_flags_do_not_mask_the_recorded_counter("misaligned pointer dereference" inwindows-core, a non-unwinding panic,0xc0000409). The other 42 binaries: 148 passed, 0 failed, 20 ignored.list_x.cdb365bd): 2906 passed, 0 failed, 51 ignored, twice on a quiet machine.cda7d4d3), whose non-test code was the same ascdb365bd's, one of two full runs hadtitle_textures::tests::placed_title_textures_share_vram_and_preserve_pixelsfail, plus threePoisonErrors from the mutex it poisoned.main).title_textures; reported on #3180.no wave64(wave32 adapter), 2no heap windows(opt-inXCL_HEAP_WINDOWS=1), 1pso_measurement_compiles_an_exact_synthetic_record(cannot disable the driver cache without Developer Mode)cda7d4d3), counting the entries under eachtranslated/v2identity:main: with either switch at0, no entry is written anywhere; all 26,008 entries come from the default identity, so the switch has no effect.XCL_RDNA_FLOAT=0andXCL_WATERFALL_COLLAPSE=0each make their own identity (220 and 799 entries), and a default run afterwards goes back to its own.XCL_RDNA_FLOAT=0, 4 of 799 withXCL_WATERFALL_COLLAPSE=0.XCL_DXIL_CACHEfolders and a fixed set (xcl shaders <pack> --precompile --only ms|vs --limit 300, plus--only psonmain):main: a default pass after anXCL_RDNA_FLOAT=0pass reuses those entries. Against a clean default cache, 9,457 of 12,356 programs differ (Pixel 9,341, Mesh 80, Vertex 36).cdb365bd): the same order leaves the default entries byte for byte equal to a clean default cache (0 of 300 differ), while the=0identity differs in 116 of 300.XCL_WATERFALL_COLLAPSE=0changes none of the programs in this set.Regression run
Same title, 60 s each, release builds of this head and of the
mainit is rebased on, run one after the other on a quiet machine. Both builds have new translated-cache identities:mainchanged the direct translator's sources since the earlier runs, and this PR edits them too. So both runs started with a cold translated cache for the title.main:This PR's head:
Not tested
Noticed, not changed
XCL_PER_LANE_MAX_INSTS(the per-lane form's instruction limit) is in no cache key either. It only matters withXCL_PER_LANE=1, so it is left out here.ComputePolicyKey(pso.rs, "output-affecting process policy") lists neither switch, norXCL_X_LDS_ORDER. It only keys in-flight builds within one process, where the environment does not change, so nothing goes wrong.XCL_DIRECT_DXIL=0, whether a compute program takes the huge direct route depends on the size of its direct output, which the switches change. The HLSL entry stored under the untagged HLSL identity is found first, so a run with a switch at0can leave an HLSL translation that later default runs keep using.XCL_DIRECT_COMPACTandXCL_DIRECT_SPLIT_INSTRUCTIONSare in the same position: they also tag the identity only when the backend is direct.gpu/dxilchangesXCL_DIRECT_DXIL_SOURCE_ID, so the first run after this PR translates the direct programs again (expected, as for every such merge). That also drops any entries made before it with a switch at0.AI use
🤖 Generated with Claude Code
Imported from ivall/xcl. Originally posted by kole07139 on 2026-12-01T22:47:14Z.
More local tests, beyond the description. Heads: this PR's
cdb365bd, and the previous headcda7d4d3, which has the same non-test code (only the new test and a line wrap inshaders.rsdiffer). Base:main6bfb5c51.Machine: RTX 3070 8 GB (driver 32.0.16.2140), i9-9900K, 32 GB, Windows 11 Pro N 26200, Rust 1.99.0 MSVC.
1. Each switch on a warm translated cache (retail title, release,
scripts/smoke.ps1, 60 s each, one after the other, previous head; the entries under eachtranslated/v2identity were counted before and after each run)XCL_RDNA_FLOAT=0XCL_WATERFALL_COLLAPSE=0XCL_RDNA_FLOAT=0XCL_WATERFALL_COLLAPSE=0The same programs under each switch's identity and the default one, the 32-byte header (which holds the identity) excluded:
XCL_RDNA_FLOAT=0: 105 of 220 have other DXIL.XCL_WATERFALL_COLLAPSE=0: 4 of 799.2. The reverse direction, deterministic (fresh
XCL_DXIL_CACHEper case, CPU only:xcl shaders <pack> --precompile --only ms|vs --limit 300, and--only psonmain)XCL_RDNA_FLOAT=0, then default11d4bba9…); the default pass took the PS set in 9.7 s against 680.7 s, all hitsXCL_WATERFALL_COLLAPSE=0, then defaultXCL_RDNA_FLOAT=0, then default6af2e0c3…for=0,be5f11cb…default)=0identity differs in 116 of 300So on
maina default run is served what a=0run translated. With this PR it is not.3. Test suite
cargo test --workspace --no-fail-fast -- --test-threads=4, quiet machine:cargo clean -p xcl: 2906 passed, 0 failed, 51 ignored (25 SKIPPED) both times;direct_output_switches_split_the_disk_cachepasses, and fails with either wiring point removed.hle::d3d12x::title_textures::tests::placed_title_textures_share_vram_and_preserve_pixels; the other three werePoisonErrors from the mutex it poisoned.cargo test -p xcl --lib -- --test-threads=413/13 on this PR and 6/6 onmain. Noted on #3180.4. Long runs, default settings (600 s asked, one pair, previous head)
AI use: Claude Code (Claude Opus 5.5) ran these tests and wrote this report.
Imported from ivall/xcl. Originally posted by Foniass on 2026-12-01T22:49:00Z.
Review (head
cdb365bd, diff read, not a merge-check):No problems found in the diff. Checked the new tags against how
translated::identity_from_source,direct_output/rerouted_identity, the mesh and geometrycached_forcallers,compile_console_shader's huge and enormous reroutes (pso.rs~825-866), and the warm library and replay keys use these identities; the switches are read only ingpu/dxil(prelude.rs,kernel.rs~329), the tags apply only when the direct translator can run, and with both switches at their defaultsdirect_switches_taggedreturns the identity unchanged (pso.rs~350-353), so existing caches stay valid. The subprocess test follows the existingrerouted_disk_entries_follow_compact_nesting_policypattern.AI review: Claude Code (Claude Opus 5.5), posted by Foniass without a human check of each point.
Imported from ivall/xcl. Originally posted by Foniass on 2026-12-02T14:27:30Z.
Follow-up review (head
ac528d09, sincecdb365bd, diff read, not a merge-check):main, which only moves the new warm-setting names next toXCL_WAVE64_IDIOMSinshaders.rs.New: none.
AI review: Claude Code (Claude Opus 5.5), posted by Foniass without a human check of each point.
Imported from ivall/xcl. Originally posted by bmjask on 2026-12-02T16:21:30Z.
@Prime1997 could you take a look at this one for review and merge? My automated review notes are above, if any.
Imported from ivall/xcl. Originally posted by fromthemoonx on 2026-12-02T19:53:39Z.
merge-check
base:
5ad98adbc3head:
ac528d092amerge: clean
build: cargo build --workspace -> ok
tests: cargo test --workspace --no-fail-fast -- --test-threads=4 -> 3007 passed, 0 failed, 52 ignored (3004 / 0 / 52 on
817eb1f, plus this PR's 2 tests and 1 that main gained since); SKIPPED: 25 (22 no wave64, 2 no heap windows, 1 no GPU_UPLOAD heaps); failing: nonereview: read the whole diff (4 files, +122 -7). No blocking findings.
identity_from_sourcedirect_output_switches_split_the_disk_cache(a run with the switch off gets the default run's entry: left 1, right 2)direct_output_identitydirect_output_switches_that_are_off_get_their_own_identitysemantic_pipeline_settingwarm_settings_ignore_waits_watchdogs_and_traces_but_keep_pipeline_switchesXCL_*name ingpu/dxil/*.rs. The other ones that change the output are already in a key, so I found no third switch with this gap there. I did not repeat that forgpu/recomp.gpu/dxilchange. The description says so. It also drops entries an earlier=0run left behind.performance: two tags when an identity is computed, none by default; one retranslation after the merge as in 4 (reasoned, not measured)
verdict: safe to merge
hardware / tool and model: RTX 3060 12 GB (610.88), Ryzen 7 5700X, Windows 11 Pro 26300 / Claude Code (Claude Opus 5.5)
View command line instructions
Checkout
From your project repository, check out a new branch and test the changes.Merge
Merge the changes and update on Forgejo.Warning: The "Autodetect manual merge" setting is not enabled for this repository, you will have to mark this pull request as manually merged afterwards.