LEONIDA_TWIN_BIAS (1bb188cf, on by default) breaks the picture on an RX 7900 XT (RDNA 3) #2702

Closed
opened 2026-11-30 08:34:39 +00:00 by github-bot · 1 comment
Owner

@⁠Yassan01 on GitHub · 2026-11-30 08:34 UTC · original

Summary

Since 1bb188cf ("d3d12: raw twins off 16 bytes kept with a bias the shaders add (LEONIDA_TWIN_BIAS)"), the d3d12 runtime renders badly on an RX 7900 XT: stretched triangles across the screen, whole frames black, white, yellow or magenta, blocky noise, and a blown-out window. LEONIDA_TWIN_BIAS=0 on the same build makes every frame clean again.

Setup

  • AMD Radeon RX 7900 XT (RDNA 3), driver 32.0.32029.2010, Resizable BAR on
  • Ryzen 7 5800X3D, 32 GB, Windows 11 (build 26200)
  • d3d12 diag build (--features diagnostics,mimalloc), Series X profile, 2560x1440 output, ray tracing off
  • Settings: play-nvidia.ps1's Series X set (-SeriesX -NoDlss -NoFrameGen), plus LEONIDA_SHADER_LOOP_LIMIT=4096
  • Scene: the opening cutscenes into the prison cell (Continue from the save), standing

How it was narrowed down

Each step: build, leonida shaders + warm --used, a run with LEONIDA_CAPTURE + LEONIDA_CAPTURE_WORLD=1, the prison-cell frames looked at.

The broken builds also had the card busier: about 36-38 ms a frame, against about 30 on 32b9f4a3 in the same scene.

Possibly relevant

The commit message says the change was made for an RX 6800, where move_raw never applied. On this RDNA 3 card the biased twins (or the stride-word bias bits 24..27 the translated programs add) seem to give wrong reads, which would explain geometry stretched to infinity and whole frames of garbage. Untested idea: limit the bias to cards where move_raw cannot apply, or default it off until checked on RDNA 3.

Workaround

LEONIDA_TWIN_BIAS=0.

**@⁠Yassan01** on GitHub · 2026-11-30 08:34 UTC · [original](https://github.com/ProjectLeonida/mandy/issues/2702) **Summary** Since 1bb188cf ("d3d12: raw twins off 16 bytes kept with a bias the shaders add (LEONIDA_TWIN_BIAS)"), the d3d12 runtime renders badly on an RX 7900 XT: stretched triangles across the screen, whole frames black, white, yellow or magenta, blocky noise, and a blown-out window. `LEONIDA_TWIN_BIAS=0` on the same build makes every frame clean again. **Setup** - AMD Radeon RX 7900 XT (RDNA 3), driver 32.0.32029.2010, Resizable BAR on - Ryzen 7 5800X3D, 32 GB, Windows 11 (build 26200) - d3d12 `diag` build (`--features diagnostics,mimalloc`), Series X profile, 2560x1440 output, ray tracing off - Settings: play-nvidia.ps1's Series X set (`-SeriesX -NoDlss -NoFrameGen`), plus `LEONIDA_SHADER_LOOP_LIMIT=4096` - Scene: the opening cutscenes into the prison cell (Continue from the save), standing **How it was narrowed down** Each step: build, `leonida shaders` + `warm --used`, a run with `LEONIDA_CAPTURE` + `LEONIDA_CAPTURE_WORLD=1`, the prison-cell frames looked at. - 32b9f4a3: clean - bbd45f5c (main, 2026-11-30): broken in every run - `git bisect` over the 32 commits touching `d3d12/crates` and `d3d12/apps`: - d9a75eb8: clean - 936843f5: clean - b5cb6f58: broken - 605379ac: clean - left: 1bb188cf (TWIN_BIAS) and ff1874c6 (helper counts by turns) - bbd45f5c with `LEONIDA_TWIN_BIAS=0`: clean, so 1bb188cf is the one. The broken builds also had the card busier: about 36-38 ms a frame, against about 30 on 32b9f4a3 in the same scene. **Possibly relevant** The commit message says the change was made for an RX 6800, where `move_raw` never applied. On this RDNA 3 card the biased twins (or the stride-word bias bits 24..27 the translated programs add) seem to give wrong reads, which would explain geometry stretched to infinity and whole frames of garbage. Untested idea: limit the bias to cards where `move_raw` cannot apply, or default it off until checked on RDNA 3. **Workaround** `LEONIDA_TWIN_BIAS=0`.
github-bot locked as GitHub sync and limited conversation to collaborators 2026-11-30 08:34:39 +00:00
Author
Owner

@⁠zmasi on GitHub · 2026-11-30 15:53 UTC · original

Opened #2757 fixing three bugs in the LEONIDA_TWIN_BIAS (1bb188cf5) path (sub-dword y % 4 != 0 raw twins accepted by settle_twin, 32-bit unsigned wrap-around on sentinel offset + bias wrapping into the 16-byte pre-view prefix of the preceding suballocation, and stale twin-bias bits on recycled dynamic slots).

AI-assisted: Gemini 4 Carbon (High), reviewed with Gemini 4 Neon (XHigh).

**@⁠zmasi** on GitHub · 2026-11-30 15:53 UTC · [original](https://github.com/ProjectLeonida/mandy/issues/2702#issuecomment-7283768721) Opened #2757 fixing three bugs in the LEONIDA_TWIN_BIAS (1bb188cf5) path (sub-dword y % 4 != 0 raw twins accepted by settle_twin, 32-bit unsigned wrap-around on sentinel offset + bias wrapping into the 16-byte pre-view prefix of the preceding suballocation, and stale twin-bias bits on recycled dynamic slots). AI-assisted: Gemini 4 Carbon (High), reviewed with Gemini 4 Neon (XHigh).
This discussion has been locked. Commenting is limited to contributors.
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.

Dependencies

No dependencies set

Reference
github/ubiquitarianism--leonida#2702
No description provided.