shader: inline s_call_b64 with its s_setpc_b64 return in pixel_aot #2181
Loading…
Reference in a new issue
No description provided.
Delete branch "upstream-pr/2189"
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?
Imported from R0Y00/Xbox2Windows. Originally posted by JB2WIN on 2026-11-25T03:26:20Z.
Refs #1786
Change
This is the first slice proposed in #1786.
tools/pixel_aot.pyinlines a forwards_call_b64whose callee returns withs_setpc_b64of the unmodified saved pair. This coverss_call_b64(SOPK) and the matchings_setpc_b64(SOP1). It is opened as a PR so the scope can be reviewed on the code. If you want it narrower, I'll cut it down.Semantics. The AMD RDNA 2 ISA (30 November 2020) gives, in section 12.2 (SOPK opcode 22),
D.u64 = PC + 4; PC = PC + signext(SIMM16 * 4) + 4, and in section 4.2SGPR_pair = PC+4. The saved return address is therefore the instruction after the call, and that is where the inlined body continues. The target is computed like ans_branch: in LLVM 15.0.7 both use the samefixup_si_sopp_br, measured with llvm-mc.Shape accepted:
s_endpgm.s_setpc_b64of the same pair.inline_calls()runs as a pre-pass inlower()and does nothing for programs withouts_call_b64.s_setpc_b64. Offsets keep the real instruction sizes.Refused:
s_setpc_b64, or code after the callee;s_setpc_b64of another pair, or without a call;s_swappc_b64,s_getpc_b64, and a call in a masked region (the existing region gate).The only change to existing control flow is the refusal of branches across the call, and it applies only to programs that contain
s_call_b64.Not included:
s_subvector_loop_begin/_end. The ISA defines them (opcodes 27/28), but how they readEXEC_HIin the wave32 profile is not stated. The question is in #1786.Test
New mode
draw-s-call, registered aspixel_aot_s_call_hardwareand_warp(60 s timeout, skip code 77, its ownFORM_COVERAGE_RECORD).form_coverage_check.pycountss_call_b64ands_setpc_b64as covered and asserts thats_swappc_b64,s_getpc_b64ands_subvector_loop_*stay refused.check_scall_binarypins0xbb1e0000 | dwordsfor the call andbe80201efors_setpc_b64 s[30:31].The generic round-trip list expects a container that ends in
s_endpgm, so this program is checked there instead of in that list.main: withmain'stools/pixel_aot.pythe program fails withUnsupported instruction 22: s_call_b64 s[30:31], 4.Run on
e779b736, rebased on65f8ef9d, with an NVIDIA GeForce RTX 3080 (driver 32.0.16.2124), WARP 10.0.26100.9818 and Windows 11 build 26200:The pure checks and the LLVM 15.0.7 binary round trip pass.
tools/scan_unsupported_shaders.pyis unchanged, because a static scan cannot see whether the narrow shape is met.AI-assisted.
Imported from R0Y00/Xbox2Windows. Originally posted by tedin7 on 2026-11-25T03:34:53Z.
Review: COMMENTED
Review of head
e779b7368425736ff4b426f04b551516a9ee9af2: 0 P1, 0 P2.Logic (clean-room, vs RDNA2 SOPK s_call_b64:
D = PC + 4; PC = PC + 4 + signext(simm16)*4):s_setpc_b64of the same pair. Branches across the call or into the callee are refused. Offsets after the call move by the body size, so branch displacements stay valid.s_call_b64/s_setpc_b64.Linux (all executed locally):
python3 tests/pixel_aot_check.py-> Self-test passedpython3 tests/docs_links_check.py-> 402 links OKpython3 tests/bidi_controls_check.py-> OKgit diff --check origin/main...HEAD-> cleancheck_scall_controlsfail (each reverted afterwards):landing >= targetchanged tolanding > targetWindows Server 2025 (WARP + hardware adapter),
python3 x2w_pipe.py win2025 2189 --scope direct --targets offscreen_check --regex 'pixel_aot_s_call|form_coverage|pixel_aot_scc_skip' --wait 3600:Build and test on Windows: passNote:
tests/form_coverage_check.pycould not run on Linux here (missingiced_x86); it passed on Win2025.AI-assisted; commands listed were executed locally.