Translate SMEM 'off' as a zero byte offset in gfx2hlsl #1689
No reviewers
Labels
No labels
accessibility
awaiting author
bug
documentation
duplicate
enhancement
good first issue
help wanted
invalid
priority: P0
question
wontfix
No milestone
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set
Reference
github/R0Y00--Xbox2Windows!1689
Loading…
Reference in a new issue
No description provided.
Delete branch "gh-pr/1689/head"
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?
@draarivpatel-ui on GitHub · 2026-11-24 17:08 UTC · original
draarivpatel-ui:gfx2hlsl/smem-off-offset→main· +106 −3 · 5 files · 1 commits · closed without mergingChange
Fixes #1674.
s_buffer_load_dword*ands_load_dword*refused the SMEM offset operandoff, the encoding with nom0register and no immediate, so a zero byte offset.op_s_buffer_load_dwordpassed the operand to the uint helper, which raisedoperand 'off';op_s_load_dwordx4failed inint(ops[2], 0)and reported the misleadings_load with a register offset through ....offnow lowers as a zero byte offset:s_buffer_load_dword s0, s[4:7], offemitss0 = r0.Load(0u + 0);ands_load_dword s0, s[4:5], offemitss0 = r0.Load(0);, the same arithmetic the literal0produces. A literal,m0as a buffer register offset, thes_loadregister-offset refusal and unknown operands all keep their existing behaviour. The new section indocs/experiments.mdrecords the accepted operand forms.Verification
On macOS arm64 with Python 3.13:
All 11 checks pass. On the commit before this change the same script fails at the first check with
Unsupported: operand 'off', matching the issue's table. Neighbouring pure-Python checks also pass:startup_gfx2hlsl_capture_check.py,startup_gfx2hlsl_sdwa_check.py,startup_gfx2hlsl_bit_alu_check.py(controls),startup_sampler_heap_check.py,startup_translator_check.pyandstartup_tools_lint_check.py(PASS: 7 files under tools/startup parse).Evidence and follow-up
The new check
tests/startup_gfx2hlsl_smem_off_check.pyis registered asstartup_gfx2hlsl_smem_offand added to the platform-independent Python list in.github/workflows/windows.yml. It feeds source text toStage.onethe waystartup_gfx2hlsl_bit_alu_check.pydoes, so no binary fixture or assembler is needed. Not in this slice, matching the issue: anm0register offset fors_load_dword*(still refused) and proving the whole loading-screen shader set translates.Checklist
AI-assisted (Devin).
@R0Y00 on GitHub · 2026-11-24 17:17 UTC · original
Thanks for the independent reproduction. #1676 has already landed for #1674 with both SMEM load families and the literal, m0, refusal and fixed-word controls. This overlaps the landed change, so I am closing it as a duplicate.
@copilot-pull-request-reviewer[bot] on GitHub · 2026-11-24 17:08 UTC · original · reviewed
Copilot was unable to review this pull request because the user who requested the review has insufficient remaining quota. Try requesting a review at a lower effort level.
@tedin7 on GitHub · 2026-11-24 17:15 UTC · original · reviewed
Review of head
d252298c21c5a181613b29a112c091f0692ffde3. Superseded: #1676 (same issue #1674) was merged tomainat 17:07:34 UTC today, andmainalready contains the fix. This PR also conflicts with it (git merge-tree origin/mainreports a content conflict intools/startup/gfx2hlsl.py).Linux limits. Linux x86_64,
llvm-mc-19, no Windows, no DXC, no GPU. Python-level translation only.Compared with
origin/main(685dcc3a)offis a zero byte offset fors_load_dword*ands_buffer_load_dword*; both mark the buffer wordfixed_buffer_word. Main does it through a sharedsmem_offset()helper.r0.Load(0u + 0), main emitsr0.Load(0x00000000u + 0), the same text the literal0produces.tests/startup_gfx2hlsl_smem_off_check.pyonto main and ran it: it fails at the first check because it expects0u + 0. Main's ownstartup_gfx2hlsl_smem_offset_check.pypasses (0 failed). On its own head this PR's test passes.m0, literal, refusal and negative-control cases, and main's refusal list is wider (of,OFF,offset,null,off:0). The two tests are otherwise equivalent in intent, so keeping both would be a duplicate with a conflicting expected string.windows.ymlline for its test; main's version of the test is already listed.Still open, applies to main too: I could not make the in-tree decoder (
tools/disasm_rdna2.py) printofffor SMEM (64 opcodes x 128 soffset values fuzzed), andllvm-mc-19rejectsofffor gfx1010/gfx1013.offis printed for MUBUF/global addresses. A real shader that producedoperand 'off'would confirm which instruction the original refusals came from.Suggest closing as superseded by #1676. Not approving.
AI-assisted; commands listed were executed locally.
Pull request closed