shader: accept more result-neutral SOPP hints like s_nop 0 #1681
Loading…
Reference in a new issue
No description provided.
Delete branch "upstream-pr/1688"
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 rm-NoobInCoding on 2026-11-24T17:05:47Z.
Change
tools/pixel_aot.pyalready translates the scheduling hintss_clause,s_setprioands_sleepexactly likes_nop 0, because they affect timing only (docs/experiments.md). This PR applies the same rule to the SOPP hints that change no register, memory or exported result:s_incperflevel,s_decperflevels_ttracedata_imms_ttracedatas_icache_invs_wakeups_sleeps_inst_prefetchwas already accepted, but no fixture used it.Each hint translates exactly like
s_nop 0at the same position. The following stay refused:s_endpgm, as for the existing hints;s_wait_idleands_waitcnt_depctr. Both are waits, not hints.test_pixel_cb_read_trace_follows_translator_scalar_alu_and_waitsalready pinss_waitcnt_depctr 0xffe3as refused, and this PR keeps it that way.s_code_endstays refused as documented.The hinted fixture program (
scheduling_hints()) now carries one of each new hint. So the LLVM 15 assemble/disassemble round trip incheck_binarycovers their spellings, and the controls record them for the coverage chart.tools/scan_unsupported_shaders.pyaccepts the same spellings, and the newtest_timing_hint_instructionscovers both the accepted and the refused ones.Coverage: +7 gfx1013 and gfx1030 SOPP forms (
s_inst_prefetch,s_icache_inv,s_incperflevel,s_decperflevel,s_ttracedata,s_ttracedata_imm,s_wakeup).Verification
Base
f674edfd, patch80f48e3d. Windows 11 build 26300,devpreset, DXC 10.0.26100.0, NVIDIA GeForce RTX 4070 (driver 32.0.16.1714) and WARP.plus every platform-independent Python check listed in AGENTS.md.
pixel_aot_hardwareandpixel_aot_warp: 2/2 passed. Both coverage records list all seven hints.check_scheduling_hintscovers each operand hint at 0, at its field limit (decimal and hex) and one above it, and without an operand. It covers each operandless hint bare, with an operand, and between the export ands_endpgm. It also checkss_wait_idleands_waitcnt_depctr. Every accepted form must translate exactly likes_nop 0.pixel_aot_check.pystatic controls,rdna2_tools_check.py(OK, 18 skipped without LLVM), and all 49 platform-independent Python checks listed in AGENTS.md: passed.Not run locally: the LLVM 15 round trip, because this host has no LLVM with gfx1013. The
Assemble and translate gfx1013 fixturesCI job runs it on the hinted program.Evidence and follow-up
The hints are accepted because none of them changes what the lowered program computes. The fixture shows they translate like
s_nop 0; it does not measure their timing effect on a console.s_waitcnt_depctr(a hardware hazard wait) is a candidate for the same treatment, but because an existing test pins it as refused, that is left to a maintainer's decision.Checklist
AI-assisted.
Imported from R0Y00/Xbox2Windows. Originally posted by tedin7 on 2026-11-24T17:17:53Z.
Review: COMMENTED
Review of head
80f48e3dc8(comment only, not an approval).No blocking findings.
What I checked
s_inst_prefetch,s_icache_inv,s_incperflevel,s_decperflevel,s_ttracedata,s_ttracedata_imm,s_wakeup) withllvm-mc-19 -triple=amdgcn -mcpu=gfx1013(also gfx1030, gfx1010). All assemble and none writes a register, memory or the export.s_wait_idleands_waitcnt_depctralso assemble and stay refused.python3 -B tests/pixel_aot_check.py: exit 0.python3 -B tests/rdna2_tools_check.py: 146 tests OK (18 skipped).git checkout -- <file>and re-run green:"s_incperflevel": 0xf->0x1fin tools/pixel_aot.py (check_scheduling_hints fails); removings_wakeupfromOPERANDLESS_HINTS(same sub-check fails); scanner pattern1[0-5]->1[0-6](rdna2_tools_check fails ons_incperflevel 16).Non-blocking
s_inst_prefetchstays on the old unlimited path and is still accepted after the colour export, so the PR text "a hint between the export ands_endpgmis refused, as for the existing hints" is not true for it. This predates the PR; either soften the sentence or add the refusal case.test_timing_hint_instructionshas no case for an operand on an operandless hint in the scanner. By hands_wakeup 0,s_icache_inv 1ands_ttracedata 3are refused correctly, so it is only a test gap.Overlap: no open PR touches these hints; a conflict is possible only in the docs/experiments.md hint paragraph or
HINT_NAMES.Linux limits: no Windows, MASM, MSVC, DXC or D3D12 device here; LLVM 19 only (CI uses LLVM 15). Anything that needs them was not run.
AI-assisted; commands listed were executed locally.
Imported from R0Y00/Xbox2Windows. Originally posted by tedin7 on 2026-11-24T17:40:36Z.
Review: COMMENTED
Dual-platform peer review at
head_sha:80f48e3dc8812e9b8cb4793454da23443617bf76Findings
No blocking issues (0 P1, 0 P2).
tools/pixel_aot.pyandtools/scan_unsupported_shaders.py: accept the result-neutral SOPP hints (s_incperflevelands_decperflevelwith 4-bit counter0..15,s_ttracedata_immwith 16-bit immediate0..0xffff, and operandlesss_icache_inv,s_ttracedata,s_wakeup) lowered likes_nop 0, while keepings_wait_idle,s_waitcnt_depctr,s_code_end, missing/out-of-range operands, and operands on operandless hints rejected.tests/pixel_aot_check.py,tests/rdna2_tools_check.py,docs/experiments.md: cover positive lowering equivalence tos_nop 0, boundary and refusal cases, and scanner parity; title-neutral.Verification
git diff --check origin/main...HEAD: clean.python3 tests/docs_links_check.py: passed (17 Markdown files, 363 links).python3 tests/bidi_controls_check.py: passed (1280 tracked files).python3 -B tests/rdna2_tools_check.py -k test_timing_hint_instructions: 1 test ran, OK.python3 -B tests/pixel_aot_check.py: passed.llvm-mc-19 -arch=amdgcn -mcpu=gfx1013 -show-encoding: verified encodings for all 7 hint instructions (s_incperflevel 15,s_decperflevel 2,s_ttracedata_imm 0xffff,s_icache_inv,s_ttracedata,s_wakeup,s_inst_prefetch 1).git checkout -- tools/pixel_aot.py):if line in OPERANDLESS_HINTS:withif False:->python3 -B tests/pixel_aot_check.pyfailed incheck_scheduling_hints(ValueError: Unsupported instruction 2: s_icache_inv, exit 1)."s_incperflevel": 0xfto0x10->python3 -B tests/pixel_aot_check.pyfailed incheck_scheduling_hints(AssertionError: translate accepted invalid input, exit 1).tests/pixel_aot_check.pyok (9.2s).--preset dev):ctest --preset dev -R '^(pixel_aot_warp|rdna2_tools_check)$' --parallel 4 --no-tests=error --output-on-failure: 2/2 passed (13.51s)./O2(--preset release):ctest --preset release -R '^(pixel_aot_warp|rdna2_tools_check)$' --parallel 4 --no-tests=error --output-on-failure: 2/2 passed (13.44s).AI-assisted; commands listed were executed locally.