Recompiler: XCL_RDNA_FLOAT changes the direct DXIL but is in no cache key, so a run with =0 can load translations made with it on #3520

Open
opened 2026-11-30 11:40:09 +00:00 by Grimkaaah · 1 comment
Grimkaaah commented 2026-11-30 11:40:09 +00:00 (Migrated from github.com)
Contributor

Imported from ivall/xcl. Originally posted by Grimkaaah on 2026-11-30T11:40:09Z.


XCL_RDNA_FLOAT (default on, =0 turns it off) changes the DXIL the direct translator emits: v_fract_f32 becomes a single dx.op.unary(Frc) and mul_legacy / fma_legacy drop their == 0 checks for known constants (crates/xcl/src/gpu/dxil/prelude.rs:9-15, used at :85, :223, :248).

On main 9dfbe3e it is in none of the places that keep translations and pipelines apart:

  • translated::identity_from_source (crates/xcl/src/gpu/recomp/pso.rs:363-393) tags XCL_DIRECT_COMPACT, XCL_DIRECT_COMPACT_NEST, the dispatch split, XCL_X_LDS_ORDER and XCL_PER_LANE, but not XCL_RDNA_FLOAT;
  • semantic_pipeline_setting (crates/xcl/src/shaders.rs:30-41), which keys the warm list and the saved pipelines, does not list it.

So after a normal run, a run with XCL_RDNA_FLOAT=0 (the obvious thing to try when a float result looks wrong) loads the translations and driver blobs made with it on, and the switch seems to do nothing. The other way round, a cache filled with =0 serves its programs to a default run.

This is the same class as #1409 / #2327 (XCL_SAFE_BARRIER), on the direct DXIL side.

Proposed fix (small; I can open the PR):

  • in identity_from_source, when rdna_float_enabled() is false, tag the identity (identity_for(&id.to_string(), "xcl-rdna-float-0")), the same way as XCL_X_LDS_ORDER=0; the default identity stays unchanged, so existing caches stay valid;
  • add "XCL_RDNA_FLOAT" to semantic_pipeline_setting;
  • a unit test that the identity differs with the switch off and is unchanged by default.

Found by reading the code (a cross-check against how the Victory Grimkaaah translator keys its switches); not reproduced on a title yet.

AI use: Claude Code (Claude Opus 5.5) found this while comparing code and drafted this issue at my request.

<!-- greyfinch-sync:ivall/xcl:issue:6695413768 --> Imported from [ivall/xcl](https://github.com/xcl-dev/xcl/issues/3520). Originally posted by [Grimkaaah](https://github.com/Grimkaaah) on 2026-11-30T11:40:09Z. --- `XCL_RDNA_FLOAT` (default on, `=0` turns it off) changes the DXIL the direct translator emits: `v_fract_f32` becomes a single `dx.op.unary(Frc)` and `mul_legacy` / `fma_legacy` drop their `== 0` checks for known constants (`crates/xcl/src/gpu/dxil/prelude.rs:9-15`, used at `:85`, `:223`, `:248`). On `main` 9dfbe3e it is in none of the places that keep translations and pipelines apart: - `translated::identity_from_source` (`crates/xcl/src/gpu/recomp/pso.rs:363-393`) tags `XCL_DIRECT_COMPACT`, `XCL_DIRECT_COMPACT_NEST`, the dispatch split, `XCL_X_LDS_ORDER` and `XCL_PER_LANE`, but not `XCL_RDNA_FLOAT`; - `semantic_pipeline_setting` (`crates/xcl/src/shaders.rs:30-41`), which keys the warm list and the saved pipelines, does not list it. So after a normal run, a run with `XCL_RDNA_FLOAT=0` (the obvious thing to try when a float result looks wrong) loads the translations and driver blobs made with it on, and the switch seems to do nothing. The other way round, a cache filled with `=0` serves its programs to a default run. This is the same class as #1409 / #2327 (`XCL_SAFE_BARRIER`), on the direct DXIL side. **Proposed fix** (small; I can open the PR): - in `identity_from_source`, when `rdna_float_enabled()` is false, tag the identity (`identity_for(&id.to_string(), "xcl-rdna-float-0")`), the same way as `XCL_X_LDS_ORDER=0`; the default identity stays unchanged, so existing caches stay valid; - add `"XCL_RDNA_FLOAT"` to `semantic_pipeline_setting`; - a unit test that the identity differs with the switch off and is unchanged by default. **Found by** reading the code (a cross-check against how the Victory Grimkaaah translator keys its switches); not reproduced on a title yet. **AI use:** Claude Code (Claude Opus 5.5) found this while comparing code and drafted this issue at my request.
kole07139 commented 2026-12-01 20:02:59 +00:00 (Migrated from github.com)
Author
Contributor

Imported from ivall/xcl. Originally posted by kole07139 on 2026-12-01T20:02:59Z.


@Grimkaaah I'd like to take this one, unless you already have it in progress: say so and I'll drop mine and test yours instead.

While checking it I found a second switch of the same kind: XCL_WATERFALL_COLLAPSE=0 (added in 4250e761 on 11-29) turns off the sampler-waterfall collapse in gpu/dxil/waterfall.rs, so it changes the direct DXIL too, and it is in neither identity_from_source nor semantic_pipeline_setting.

The fix follows your proposal, for both switches: a switch that is off tags the direct identity (also direct_output_identity, which keys the enormous programs rerouted to the direct translator on the HLSL path), the default gets no tag, and both names join semantic_pipeline_setting. Its unit tests fail without it. The PR follows once the full suite and the two smoke runs are done.

AI use: Claude Code (Claude Opus 5.5).

<!-- greyfinch-sync:ivall/xcl:comment:7323945037 --> Imported from [ivall/xcl](https://github.com/xcl-dev/xcl/issues/3520#issuecomment-7323945037). Originally posted by [kole07139](https://github.com/kole07139) on 2026-12-01T20:02:59Z. --- @Grimkaaah I'd like to take this one, unless you already have it in progress: say so and I'll drop mine and test yours instead. While checking it I found a second switch of the same kind: `XCL_WATERFALL_COLLAPSE=0` (added in 4250e761 on 11-29) turns off the sampler-waterfall collapse in `gpu/dxil/waterfall.rs`, so it changes the direct DXIL too, and it is in neither `identity_from_source` nor `semantic_pipeline_setting`. The fix follows your proposal, for both switches: a switch that is off tags the direct identity (also `direct_output_identity`, which keys the enormous programs rerouted to the direct translator on the HLSL path), the default gets no tag, and both names join `semantic_pipeline_setting`. Its unit tests fail without it. The PR follows once the full suite and the two smoke runs are done. AI use: Claude Code (Claude Opus 5.5).
Sign in to join this conversation.
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#3520
No description provided.