Skip to content

feat(shader): implement S_BFE_I64 - #234

Closed
Digote wants to merge 1 commit into
boykopovar:mainfrom
Digote:feat/shader-s-bfe-i64
Closed

Digote wants to merge 1 commit into
boykopovar:mainfrom
Digote:feat/shader-s-bfe-i64

Conversation

@Digote

@Digote Digote commented Oct 1, 2026

Copy link
Copy Markdown
Contributor

What

  • Decode S_BFE_I64 as SOP2 opcode 0x2A.
  • Sign-extend the selected 64-bit scalar field and update SCC from the result.
  • Add regression coverage for decoding, classification, destination width, and translation.

Tested

Windows 11, MinGW-w64 GCC 16.1.0:

  • cmake --build build-s-bfe-i64-gcc
  • ctest --test-dir build-s-bfe-i64-gcc --output-on-failure --timeout 120 (89/89 passed)
  • python tools/progress.py build-s-bfe-i64-gcc/progress-current (GPU shader instructions: 610/1166, 52.32%)

Checklist

  • Based on current main; no other open PR implements the same functions
  • One topic per PR; follow-ups go in a new PR
  • No comments in code except technical debt
  • Unimplemented paths throw (NotImplemented_nid_no_patch); silent stubs are listed in TechnicalDebt
  • No notes, investigation .md files or images added to the repository (attach them to this PR)
  • New third-party code is a submodule built from source
  • Generic behaviour, not specific to one title
  • Depends on: none
  • AI-assisted: yes

@github-actions

github-actions Bot commented Oct 1, 2026 •

Copy link
Copy Markdown

Progress report (7384588 → f9f792c)

📈 GPU shader instructions: 72.73% (+0.09%, +1 implemented instructions)

✅ 1 implemented
Encoding Name
SOP2 S_BFE_I64

@Digote
Digote force-pushed the feat/shader-s-bfe-i64 branch from bfa7156 to f9f792c Compare October 4, 2026 01:11
@github-actions

github-actions Bot commented Oct 4, 2026 •

Copy link
Copy Markdown

Other open pull requests touch the same code. Merging one will break the other, or both implement the same thing. If this one builds on them, list them in Depends on.

Pull request Conflicting files (lines on main) Same exports Same new files
#295 core/libs/prx/libSceAgcDriver/CMakeLists.txt L806
#381 core/libs/prx/libSceAgcDriver/CMakeLists.txt L806
#838 core/shader/recompiler/Translation/include/Translation/TranslationContext.hpp L242
core/shader/recompiler/Translation/src/IntegerInstructions.cpp L675-679, L683-684

@github-actions github-actions Bot mentioned this pull request Oct 4, 2026
9 tasks done
@github-actions github-actions Bot removed the needs rebase Conflicts with main, rebase needed label Oct 4, 2026
@oneandonlydean

Copy link
Copy Markdown
Collaborator

Thanks for this and for the rebase, the sign extension looks right to me, including the offset + width > 64 case, which comes out as the arithmetic shift the ISA describes. One thing before it can go in: the test only checks that a ShiftRightArithmetic64 appears. Could you turn it into an execution test with values (see core/libs/prx/libSceAgcDriver/tests/execution/ScalarBitCount.cpp for the pattern), covering a negative field, width 0, width 64 and offset + width > 64? That would pin the behaviour rather than the IR shape.

@adriadam10

Copy link
Copy Markdown
Collaborator

@oneandonlydean measured on RDNA2 hardware (gfx1035, same SOP2 encoding as gfx1013): the semantics here match. 512 random rows through s_bfe_i64, including width 0, 1, 63, 64, 65 and 127, offset + width > 64, and garbage in the unused bits of S1, all agree with this PR's model: count = min(S1[22:16], 64 - S1[5:0]), the field sign-extended from bit count - 1, 0 for count 0, SCC = result != 0. Only your pending ask (an execution test) is left.

@github-actions github-actions Bot mentioned this pull request Oct 6, 2026
9 tasks done
@Digote Digote closed this Oct 6, 2026
@adriadam10 adriadam10 mentioned this pull request Oct 6, 2026
9 tasks done
relativespace2K added a commit to relativespace2K/AnyPS5 that referenced this pull request Nov 23, 2026
Record FileHole, ResidentPages, st_blocks and the THP policy in both sparse-read tests, after the writes and after each read range, and keep the captured values beside the assertions. This gives the next intermittent kyty_shim_memory failure the operands that failed; the occurrence in boykopovar#266 failed at line 1035, the same residency invariant as boykopovar#234.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

agc libSceAgc* build shader core/shader

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants