Skip to content

Shaders: lower the console's scalar bit searches (s_flbit_i32_b64, s_ff0_i32_b32/b64) - #233

Open
pablogonz12 wants to merge 2 commits into
fxceless:mainfrom
pablogonz12:scalar-bit-ops
Open

pablogonz12 wants to merge 2 commits into
fxceless:mainfrom
pablogonz12:scalar-bit-ops

Conversation

@pablogonz12

Copy link
Copy Markdown

Setup: RX 9070 XT (RDNA4), RADV Mesa 26.3.1, Linux, GE-Proton11-14, Series X files.

The decoder names s_flbit_i32_b64, s_ff0_i32_b32, s_ff0_i32_b64 (and the dword
widths in gfx10/fields.rs know their 64-bit sources), but the scalar lowering has no
arms for them: they fall through to the catch-all and a shader containing one is refused
whole. This adds them in DXIL unaryBits, as TuxBox does: the 64-bit searches test the
high word first and continue 32 past the low word's own result, −1 for a zero pair
(s_flbit) or an all-ones pair (s_ff0); none writes SCC.

Complements #171 (GeaorgeAyvazov), which lowers s_bcnt0_i32_b32/b64; that family is
left out here so the two changes do not both touch it.

Adapted from TuxBox (brcly/TuxBox, Apache-2.0, commit 1a50eb9 "shader: restore
s_flbit_i32_b64 and s_ff0_i32 lowering dropped by a merge", Copyright (c) 2026 the TuxBox
authors); NOTICE added. Not ported: s_flbit_i32_i64, which TuxBox guards but does not
lower either.

On an RX 9070 XT this changes 0 of our 751 world programs and 0 of the 25,586 archive
programs
(all 767 emitted DXIL containers byte-identical); it is for the console
programs that carry these instructions, which our captures do not contain. Tests: a
Windows/WARP + hardware oracle for the three against the console's answers, and a
platform-neutral test whose hand-assembled encodings decode to the three names (refused
before). cargo clippy --workspace --all-targets [--all-features] -- -D warnings clean.

AI-assisted: written and tested with an AI coding agent; the port was compared
against TuxBox's source by hand.

…ff0_i32_b32/b64)

The decoder names s_flbit_i32_b64, s_ff0_i32_b32 and s_ff0_i32_b64 (and the
dword widths in gfx10/fields.rs know their 64-bit sources), but the scalar
lowering has no arms for them: they fall through to the catch-all, so a
shader containing one is refused whole.

Lower them as TuxBox does, in DXIL unaryBits: the 64-bit searches test the
high word first and continue 32 past the low word's own result, -1 for a zero
pair (s_flbit) or an all-ones pair (s_ff0). Neither writes SCC, so only the
destination is set, as the existing s_ff1_i32_b64 arm does.

Complements fxceless#171, which lowers s_bcnt0_i32_b32/b64; that family is left out of
this change so the two do not both touch it.

Adapted from TuxBox (https://github.com/brcly/TuxBox, Apache-2.0), commit
1a50eb9 "shader: restore s_flbit_i32_b64 and s_ff0_i32 lowering dropped by a
merge" (Copyright (c) 2026 the TuxBox authors); see NOTICE. Not ported:
s_flbit_i32_i64, which TuxBox guards but does not lower either.

Tests: a Windows/WARP + hardware oracle for the three against the console's
answers (valu_tests), and a platform-neutral lowering test whose hand-assembled
encodings decode to the three names (they were refused before). Offline, the
world dump is unchanged (750 of 751 emitted) and so is the full archive
(25,586 of 26,084): these instructions are not in our captures.

Co-Authored-By: Claude Sonnet 5.2 <noreply@anthropic.com>
@chatgpt-codex-connector

Copy link
Copy Markdown
Codex Review Summary: ❌ Failed

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ❌ Failed 2026-11-24T22:52:59.051238Z
We couldn’t complete this review. Comment @codex review to try again.
4db8615 PR opened
ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

@chatgpt-codex-connector

Copy link
Copy Markdown

You have reached your Codex usage limits for code reviews. You can see your limits in the Codex usage dashboard.

tdogghockey added a commit to tdogghockey/victory-fork that referenced this pull request Nov 25, 2026
…h tests and main's cvt_f32_f64/permlane tests
triippywhale pushed a commit to triippywhale/victory-fork that referenced this pull request Nov 25, 2026
…for a remap, by default

From the measured parts of fxceless#929 (AlexMiu) that
PalmVIDev fxceless#238 turned on: VICTORY_TEXTURE_NO_WAIT is on by default
(=0 waits as before). A texture refresh that finds the runtime remapping
title memory reads through the kernel instead of waiting for the mapping
lock, and leaves the texture for its next refresh if a page is not there.
The author measured a level load going from 4-9.5 s a frame of texture
refresh to under 200 ms.

Not taken from fxceless#238: VICTORY_INDIRECT_WINDOW on by default. PalmVIDev
turns it on only together with its driver watch (fxceless#233), which switches
windows off at the first driver event: every loss of the card in a run
with windows was announced that way. This tree has no driver watch, so
the switch stays opt-in. fxceless#238's other parts (fxfork fxceless#927 16-bit buffer
halves, ~900 lines across the translator; fxceless#930/fxceless#932 diagnostics and
descriptor runs) are not ported here.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_017V7WBA8CxPD68KngjiMeJb
triippywhale pushed a commit to triippywhale/victory-fork that referenced this pull request Nov 25, 2026
…n host texture is left out

From fxceless/victory-gta6 a253706 as PalmVIDev fxceless#233 took it:
copy_texture_region now leaves out a copy between two title textures that
share one host texture (the same subresource), as copy_resource already did
(6e502b3). It was recorded with the texture left in the source state as its
destination (a debug layer's "CopyResource with its destination in the
COPY_SOURCE state"); 402 of them in a five-minute run.

Not taken from fxceless#233 (1,292 lines): the driver watch, frame log, card meter,
efficiency-mode opt-out and capture switches. The self-copy counter is left
out (this tree has no five-second line slot for it).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
triippywhale pushed a commit to triippywhale/victory-fork that referenced this pull request Nov 25, 2026
…eir neg modifiers; no early depth for programs that export depth

Hand port of PalmVIDev db0e9e034 (in fxceless#234) onto this tree's unsplit lower.rs:
- v_pk_* integer operations apply neg / neg_hi per half (two's complement
  wrapped to 16 bits, fxceless#890) instead of refusing the
  program; clamp and omod still refuse.
- A pixel program marked DEPTH_BEFORE_SHADER that exports depth, stencil or
  coverage (DB_SHADER_CONTROL bits 0-2 and 8, or such an output) does not
  get the host's early depth flag (fxceless#907).

Not taken from fxceless#234: the frame-log/driver-watch test and GPU-timestamp
commits (need fxceless#233's frame log), the per-shadow refresh mismatch counts and
the capture format decoding (diagnostics only).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@HAL9000RELOADED

Copy link
Copy Markdown

RX 7900 XTX (RDNA3), Windows 10 + #402 for SM 6.6, main d510ee4: both new tests pass on the card with this PR. With the tests alone on the base, scalar_bit_searches_match_the_console fails (the other test is inline). No other test changed. Run table: #129 (#129 (comment)).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants