compute: prove a loop break inside a block s_cbranch_execz skips (task list) #2637
Open
opened 2026-11-26 00:20:41 +00:00 by NiiRoZz
·
11 comments
No Branch/Tag specified
main
codex/indirect-large-backed-views
codex/word3-preflight-check
codex/vertex-table-two-records
codex/live-index-alias
codex/copied-vertex-buffer-srv
codex/windows-stage-test-output
codex/preserve-live-srv-retirement
codex/share-render-target-tracking
codex/sgd5-negative-offset-fixture
coverage-dashboard
codex/mesh-loose-root
codex/mesh86-cache-padding
codex/xmem-scatter-preflight
codex/mesh-depth-ps
codex/indirect-dispatch-refresh
codex/compute-container-index
codex/startup-compute-formatted-load
codex/compute-indirect-producer
codex/compute-atomic-soffset
codex/mesh-dual-handoff
codex/startup-run-sh-watcher-control
codex/queue31-page-alias
codex/indexed-indirect-compute-root
codex/typed-buffer-view-metadata
codex/translated-indexed-address-alias
codex/fixed-mesh-create-result
codex/xmem-section-lease
codex/startup-slot86-mesh-cache
codex/restore-mesh-barrier-iteration
codex/translated-indirect-upload-index
codex/xapu-completion-opt-in
codex/translated-indexed-rect
codex/translated-indexed-indirect
codex/startup-mesh-lds-integration
codex/startup-console-ms24
codex/startup-slot57-mesh-request
codex/indirect-copy-provenance
codex/present-color-producer-trace
codex/compute-dispatch-binding-trace
codex/translated-indirect-table-buffers
codex/indirect-copy-provenance-base
codex/mix-half-literal-source
codex/translated-indirect-draw
codex/xmem-scatter-diagnostics
codex/slot148-recording-upload
codex/slot70-loading-art-verified
codex/command-list-upload-arena
codex/recover-failed-command-list
codex/startup-heap-timing-notes
codex/align-audio-input-timeline
codex/synthetic-depth-export-control
codex/startup-texture1d-on-windows
codex/1629-packed-position-fixture
codex/cpu-srv-refresh
codex/stream-root-srv-draw
codex/audio-mixer-timer
codex/startup-reload-published-shader
codex/priority-integrate-1284
codex/guest-sixteen-page-record
codex/aot-placed-dxr-batch
codex/guest-directory-selection
codex/gamesave-enumerate-read
codex/readme-archive-to-pixels
codex/pe-placed-view-draw
codex/archive-directory-gpu
codex/slot133-dxr-build
codex/materialize-placed-vertex-view
codex/dstorage-directory-offsets
codex/xg-nine-bc-copy
codex/xg-slot10-bc64-arrays
codex/dxr-guest-address-readback
codex/gpu-va-high-bits
codex/clarify-diagnostic-startup-scope
codex/xg-six-levels
codex/typed-derived-blend
codex/english-legal-text-progress
codex/address-bc-4ks
codex/dstorage-bounded-file-read
codex/wide-srv-offsets-menu
codex/startup-memory-srv
codex/bound-view-tail
codex/language-selector-readback
codex/setup-menu-progress
codex/cpu-plane-refresh
codex/startup-ubyte-vertex
codex/presenter-window-selection
codex/startup-uniform-buffer-lane
codex/intro-loop-timing
codex/static-clzero-loops
codex/document-rtx-intro
codex/startup-insertq
codex/nv12-startup-texture
codex/stream-stage-draw
codex/startup-null-uav-format
codex/startup-draw-capture
codex/shorten-windows-checks
codex/dstorage-rfc1950
codex/startup-dump-fence
codex/pr1135-review-base
codex/startup-stream-requests
codex/startup-chroma-view
codex/readme-graphics-pipeline-streams
codex/static-crt-free-tls
codex/arc-140t-rtx-5080-laptop-gpu-reports
codex/main-startup-progress-entry
codex/signed-dxil-catalogue
codex/reloc-free-preferred-base
codex/quad-dpp-bit-mask
codex/raw-srv-bounds
codex/rx9070-31044-hardware-report
codex/gpu-page-source-provenance
codex/runtime-placeholder-interior
codex/gpu-copy-queue-tile-order
codex/pe-pin-external-providers
codex/xmem-placeholder-reservations
codex/xmem-shared-physical-pages
codex/pe-package-startup
codex/xmem-tools-memory-query
codex/cpu-stack-output-import
codex/pe-load-security-cookie
codex/record-three-bvh-retests
codex/cpu-rbp-frame-anchor
codex/xmem-default-startup
codex/record-rtx-3050-ti-9597
codex/docs-readme-start-here
codex/check-compute-mad24-truncation
codex/docs-discord-community
codex/bound-rcx-branch-mutants
codex/rtx5060ti-bvh-62114
codex/837-neutral-readme-disclaimer
codex/record-rtx-3070-ti
codex/title-neutral-public-wording
codex/exe-shadow-frame-submissions
codex/exe-shadow-runtime-chain
codex/readme-polish
codex/gpu-coverage-nov23
codex/spirv-minlod
codex/shadow-shim-device
codex/exe-two-shadow-frames
codex/shim-dispatch-cleanup
codex/fix-spirv-cache-probe
codex/sampler-use
codex/ballot-bit-extract
codex/packed-fma-release
codex/cpu-packed-fma-o2
codex/publish-coverage-dashboard
codex/mesh-cbv-binding-order
codex/spirv-window-fixture
codex/ps-e32-float-uint
codex/ps-cbuffer-reads
codex/fixed-profile-rescan
codex/shim-compute-integration
codex/readme-visible-coverage
codex/readme-research-navigation
codex/integrate-pr-256
codex/indexed-mesh
codex/sampled-coverage
codex/first-ms
codex/dual-ps
codex/ps-attribute
codex/compute-first
codex/ps-export
codex/readme-research-status
codex/ps-layout
codex/blast-window
codex/chart-caption
codex/reviewer-roles
codex/blast-aot
codex/archive-program
codex/crc-stream-program
codex/exe-image-data-chain
codex/local-cpu-fixture-coverage
codex/exe-bound-frame-chain
codex/exe-mapped-comparison
codex/contribution-dependencies
codex/exe-entry-aot
codex/bink-frame-heap-integration
docs/hardware-seven-reports
codex/bink-custom-heap
codex/bink-heap-callers
codex/discussions-entry-points
codex/gpu-community-batch-64
codex/ffx-scratch-writers
codex/generic-project-documentation
codex/ffx-dispatch-rcas
codex/four-windows-gpu-reports
codex/title-neutral-project-wording
codex/community-coverage-provenance
codex/rcas-packed-texels
codex/community-gpu-retests
codex/community-build-and-gpu-reports
codex/ffx-provider-loop
codex/ffx-recurrent-views
codex/ffx-recurrent-resource
codex/amd-wave64-reports
codex/ffx-backend-slots
codex/upscaler-device-init
codex/ffx-context-lifecycle
codex/ffx-version-query
codex/ffx-provider-contract
codex/typed-object-callback
codex/cpu-ordinal-import
codex/chained-cpu-ranges
codex/cpu-import-call
codex/cpu-direct-call
codex/cpu-leaf-aot
codex/community-project-status
codex/script-state-path-replay
codex/script-state-evidence
codex/bc7-resident-tail
codex/bcpack-mip-tail
codex/bc7-texture-draw
codex/asset-ranges
codex/pixel-constants
codex/pixel-aot
codex/pre-exe-workloads
codex/root-signature-device-coverage
engineering/packed-bvh-leaves
engineering/bvh-build-and-update
engineering/intake-root-roundtrip
community/gpu-check-release
community/english-contributor-entry
gpu-check-v0.1.0
Labels
Clear labels
No items
No labels
Milestone
Clear milestone
No items
No milestone
Assignees
Clear assignees
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".
No due date set.
Reference
R0Y00/Xbox2Windows#2637
Loading…
Reference in a new issue
No description provided.
Delete branch "%!s()"
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 NiiRoZz on 2026-11-26T00:20:41Z.
Problem
Part of #2274 (section A, execz handling). Refs #1723.
In one local run of the compute path, 27 compute programs (761,026 dispatches) were first refused by the translator with
s_cbranch_scc0 inside a block s_cbranch_execz skips per lane: branch out of the block: the path that stays does not go on at the join(counts only; not reproducible from the repository). The reason text and the exit proof it belongs to are not on main yet; they come from the local branch stacked on #2557, where a branch out of a block thats_cbranch_execzskips is accepted only as the "lane mask exhausted" exit, with the path that stays going straight on at the join. On main the same programs are refused earlier, as a branch out of the block.26 of the 27 (756,551 dispatches) have one shape, a loop break inside the skipped block:
Four conditions of that proof fail at once, so this is not a near form of the accepted exit:
The 27th program (4,475 dispatches) is a wave64 form where only the "stays at the join" condition failed. A local change accepts a straight run between the branch and the join when every vector instruction in it runs with exec proven clear; that program then stops at a live-definition refusal, so the change translates nothing on its own and is not proposed here.
Proposal
A loop-break proof for the one-lane model, in claimable pieces:
s_mov_b32 sM, exec_loor ans_and_b32with exec before the block, with no write of the mask since). With it,s_mov_b32 exec_lo, sMon the path that stays keeps a skipped lane's bit clear exactly when that lane's bit ofsMis clear, which the existing clear-mask step can then use.s_add_u32,s_cmp_ge_u32,s_cbranch_scc0to the head) or keep it refused with its own reason.s_and_b32 sA, sA, exec_lothens_or_b32 sB, sB, sAonly moves a lane's own bit; prove it lane-kept the way the if-conversion mask of #2505 is, and require every later read to be per lane.Each task: a hand-assembled check case on which the check's wave interpreter and lane interpreter agree, one near-miss per condition that stays refused and shows the lane disagreement, and the accepted case refused again with the change reverted.
Alternatives
Verification
v_mov_b32_e32 on the path that stays with exec not proven clearwithout translating any. That T1 to T4 together let them translate is a hypothesis; the next refusal after them was not observed.Checklist
🤖 Generated with Claude Code
Imported from R0Y00/Xbox2Windows. Originally posted by triggered02 on 2026-11-26T03:38:41Z.
Triaging this as a task-list item rather than a bug on main, and naming what is missing:
What main does today. The same programs are refused earlier, as a branch out of the block � the reason text and the exit proof you describe live only on your local branch stacked on #2557. So there is nothing on main that can be tested against the 26-program shape yet; the count (27 programs / 761,026 dispatches) cannot be reproduced from the repository as it stands.
Smallest useful step. Land the two things that are source-buildable in this repo, in this order: (1) a synthetic fixture that reproduces the shape � two saved exec masks via s_andn2_b32, s_cbranch_scc0 when no lane remains, the staying path remasking exec_lo and reaching the join, plus the join after the skipped block � with the expected per-lane result spelled out; (2) the bounded refusal/acceptance reason string from the #2557 stack, so the census separates "loop break inside a skipped block" from the generic "branch out of the block". With (1) alone the refusal is pinned as fail-first; (2) is what makes the count attributable.
What I am not claiming. That main accepts this shape after (1) � it does not; (1) is the fixture for the acceptance work, not the acceptance itself.
If you can attach the synthetic assembly for one of the 26 (the loop skeleton with the two saved masks and the join), I will build the fixture from it and keep #2274 section A as the parent.
Imported from R0Y00/Xbox2Windows. Originally posted by R0Y00 on 2026-11-26T04:30:15Z.
The prerequisite #2557 is now on main at
1226f02e. Please base the existing loop-exit experiment on that revision or newer. A small source-built pair can now isolate the next proof: one loop that exits only through the execz-skipped block, and one with an additional live or bypass edge that must be refused. Please show the first diagnostic for the negative and the exact readback for the accepted variant before extending the corpus result.Imported from R0Y00/Xbox2Windows. Originally posted by RonLogic on 2026-11-26T04:34:06Z.
@triggered02 I built the small synthetic Wave32 skeleton you asked for, now that #2557 is on main. This covers the two saved masks, branch from inside the skipped block, remask on the staying path, backward counted edge, and scalar instructions before the final EXEC restore. The accumulated/live mask in T4 is outside this skeleton. No title input or runtime changes.
Use the same root and compute state as case O of
tests/startup_gfx2hlsl_compute_check.py(8×1×1). For one group, the first eight output words should be[9, 1, 2, 9, 9, 9, 9, 9]. A small CPU trace of the wave and individual lanes agreed. On the translator from1226f02eplus the unrelated gather diagnostic, the bytes below decoded as shown and reached the refusals_cbranch_scc0 inside a block s_cbranch_execz skips per lane: branch out of the block. That is the expected fail-first observation.I used the repository decoder to verify the hand-encoded words on Windows. Please use the skeleton in the fixture you offered to build. I can independently check the proof and near-miss once a branch is available.
Imported from R0Y00/Xbox2Windows. Originally posted by triggered02 on 2026-11-26T05:06:57Z.
Measured census data for this task list, from a run of
mainatfd033046with the shader translator writing per-request status lines. Counts only; no game data, paths or shader text.s_branch inside a block s_cbranch_execz skips per lane: branch out of the blocks_cbranch_execz inside a block s_cbranch_execz skips per lane: branch out of the blockv_cmp_gt_i32_e32 inside a block s_cbranch_execz skips per lane: definition of vcc_hi, live where the block joinsThat is 44 refused programs in this census whose primary refusal is the execz-block branch shape this task list tracks, so the "counts only, not reproducible from the repository" caveat in the issue body now has a second, independent measurement attached to it.
Two of the three are plain
s_branch/s_cbranch_execzout of the skipped block; the third is the VCC-liveness variant (v_cmp_gt_i32_e32definingvcc_hithat is live at the join), which is a different proof obligation and probably a separate slice from the loop-break shape.Next step stays what the issue says: a synthetic fixture for the two-saved-mask loop break (
s_andn2_b32twice,s_cbranch_scc0when no lane remains, the staying path remaskingexec_lo, join after the block), with the VCC-liveness case as a separate refusal pin. If whoever takes that slice wants the raw per-request figures, they are in the run's translate log by count only.AI-assisted; counts from the run's translate log.
Imported from R0Y00/Xbox2Windows. Originally posted by stan495 on 2026-11-26T15:57:36Z.
Updated https://github.com/R0Y00/Xbox2Windows/pull/2877 at commit \
33b4e3d0\ (fixed the \s_cbranch_scc0 6\n\ replacement in \O-loop-subset\ so the \s_cbranch_scc0 65524\ latch keeps its opcode for \llvm-mc-15). Re-ran \ ests/startup_gfx2hlsl_compute_check.py, \ctest --preset dev --no-tests=error -R '^startup_gfx2hlsl_compute_'\ (71/71 on WARP + \AMD Radeon RX 7900 XTX, debug layer enabled), and \ ools/run_checks_parallel.py -j 4 --from-dir tests/checks/python-linux\ (5/5 passed).Imported from R0Y00/Xbox2Windows. Originally posted by stan495 on 2026-11-26T15:49:36Z.
Claiming T1 (mask subset facts) in \ ools/startup/gfx2hlsl.py\ (\Stage.execz_refusals).
Plan:
'exec', 0), ('exec_hi', 1)\ (keeping the \exec\-only invariant set for the per-instruction \exec write\ check and loop floor so overwritten saved masks cannot re-enter \fter.AI-assisted.
Imported from R0Y00/Xbox2Windows. Originally posted by Not-Saii on 2026-11-26T16:51:16Z.
Question before claiming T3, with a T3 claim that depends on the answer
#2852 took T2's "keep it refused with its own reason" option (
loop exit crosses a backward s_cbranch_scc0), so I'm leaving T2 alone. T3 and T4 both relax conditions of the "lane maskexhausted" exit proof, which the issue body places on a local branch stacked on #2557. At
b505c32bthat proof is not on main:
Stage.execz_refusalsrefuses every branch whose target lies outsidethe skipped block and its join, as
branch out of the block. RonLogic's skeleton with the latchremoved gets that refusal, and
check_execz_loop_breakpins it.@NiiRoZz, do you plan to open the exit proof as a PR? If you do, I'll stack T3 on it. If not, I can
land the straight form of it (no backward branch between the join and the exit target, so #2852's
refusal stays) together with T3, as one PR.
Payoff: all 26 programs in the body contain the latch, so T3 or T4 alone translates none of them.
triggered02's census has no
s_cbranch_scc0row, so it can't rank T3 against T4. I picked T3 becauseRonLogic's skeleton covers it.
Claim, depending on the answer above: T3 (an exit target that is a scalar run before the exec
rewrite), in
tools/startup/gfx2hlsl.py(Stage.execz_refusals).Scope:
execz_refusals. For an accepted exit whose target starts withinstructions other than the move into exec (
s_mov_b32 exec_lo, sSors_mov_b64 exec, s[a:b]),accept a straight run of them when each one is a scalar ALU,
s_loadors_waitcntinstructionwith no effect outside scalar registers (
EXECZ_REFUSED), and reads neither exec nor a word thatanything between the exit branch and the target may write. The wave and the model can hold
different values in those words at the target. Vector instructions and branches in the run stay
refused.
execz_live_readand theif-conversion mask rules.
How it fits with T1 (#2877): #2877 changes the entry seed, adds the
pre_subdataflow and changesthe
exec writecondition. T3 touches only the branch-out arm. The accepted case needs T1 to proves_mov_b32 exec_lo, s22on the path that stays, so I'll rebase on #2877 after it merges. Its exactLOOP_BREAK_WORDSassertion (only+0x30,loop exit crosses a backward s_cbranch_scc0) stays asit is.
Fixture (
tests/startup_gfx2hlsl_compute_check.py, case O state, 8×1×1, built only from encodingsalready in the check and confirmed with the repository decoder):
check_execz_loop_breakmovesfrom refused to accepted. The wave stays, and wave and per-lane traces agree on
[9, 1, 1, 9, 9, 9, 9, 9]. A second variant starts the counter at 3, so every lane breaks and thewave takes the exit. It is checked the same way.
base comes from the counter
s24, which the wave and the exiting lane hold at different values.v_mov_b32 v5, s24): the exiting laneruns it with its exec bit set and the wave with that bit clear (lane 0: model 1, wave 9).
branch out of the block.Verification:
python -B tests/startup_gfx2hlsl_compute_check.pyandctest --preset dev --no-tests=error -R '^startup_gfx2hlsl_compute_'on Windows. That covers thefirst diagnostic of each negative, plus WARP and one short hardware readback of the accepted case's
first eight words, reported with adapter, driver, Windows build, commit and debug-layer status.
binary llvm-mc-15and decode modes won't run here (nollvm-mc). They'll be listed as not run.AI-assisted (Claude Code).
Imported from R0Y00/Xbox2Windows. Originally posted by Not-Saii on 2026-11-26T18:14:11Z.
#2900 (brainbudt, opened 17:29Z) does T3 together with the straight lane-exhaustion exit proof. That is the second option in my comment above, so I'm withdrawing my conditional T3 claim to avoid duplicate work. The question above about the exit proof on the local branch still stands, since #2900 now adds a version of it.
AI-assisted (Claude Code).
Imported from R0Y00/Xbox2Windows. Originally posted by SimSalabimse on 2026-11-27T10:23:51Z.
Claiming T4 (an accumulated lane mask live at the exit target) in
tools/startup/gfx2hlsl.py(Stage.execz_refusals/Stage.execz_scalar_exit).Base: #2900 at
022212aa. Onmainat98007de5the lane-exhaustion exit is absent: a branch out of a blocks_cbranch_execzskips is refused asbranch out of the block, or asloop exit crosses a backward s_cbranch_scc0when it jumps over a backward latch. T4 relaxes a condition of the straight exit proof, so this work is stacked on #2900. #2877 is a separate line and is not part of this base. The straight fixture uses the single saved mask that proof already accepts.Scope:
s_mov_b32 exec_lo, maskand before the exit target, accepts_and_b32 sA, sA, exec_lofollowed bys_or_b32 sB, sB, sA. The exit branch jumps over the pair. A lane that leaves skips it; the wave runs it with that lane's exec bit clear, so the lane's own bit ofsBis unchanged.sAmust be dead at the exit target: the wave clears a leaving lane's bit and the one-lane model does not.sB, untilsBis rewritten, must be per lane (Stage.per_lane_read:v_cndmask, carry-in,s_and_saveexec_b32,s_and_b32with exec), the same reads as the if-conversion mask.Fixture (
tests/startup_gfx2hlsl_compute_check.py, case O state, built from the straight exit fixture):s_and_b32 sA, sA, exec_lo; s_or_b32 sB, sB, sAbetween the staying remask and the exit,sBlive and read per lane. Wave and singleton traces agree. A second group in which every lane leaves is checked the same way; the wave skips the pair too.branch out of the block, each with the wave and singleton disagreement shown in the check:sBthat is not per lane.s_or_b32 sB, sB, sCwheresCis not the exec-maskedsA, ors_and_b32whose other source is notexec_lo).sAwhen that lane's bit ofsAwas 1.branch out of the block.Verification:
python -B tests/startup_gfx2hlsl_compute_check.py, and that check underllvm-mc-15when the assembler is present;tools/run_checks_parallel.py -j 4 --from-dir tests/checks/python-linux. On a Windows test PC (RTX 4070 Ti):ctest --preset dev --no-tests=error -R '^startup_gfx2hlsl_compute_'. D3D12 readback is not part of the host result.AI-Assisted
Imported from R0Y00/Xbox2Windows. Originally posted by Leyukaka on 2026-11-29T20:38:16Z.
I'm working on the
<op> inside a block s_cbranch_execz skips per lane: definition of <regs>, live where the block joins[: read by <op> after the join]refusal (tools/startup/gfx2hlsl.py:3339/:3342,Stage.execz_refusals, main5b86df1d), as a new task here. It is a different branch frombranch out of the block(execz_scalar_exit), which is all #3109 changes. In one long local run of the application it is among the most frequent first refusals of compute shaders requested late in the run.Plan: accept more live definitions where every read from the join on is proven: words
phi_mask_okskips because the block is not straight, and readsexecz_live_readrejects (word not kept throughs_andn2, or EXEC no longer unchanged since the join). Everything else stays refused with the same text.Tests: one accepted and one refused control per form, each checked by mutation.
Imported from R0Y00/Xbox2Windows. Originally posted by Leyukaka on 2026-11-29T20:44:43Z.
Releasing my claim above on the
live where the block joinsexecz refusal intools/startup/gfx2hlsl.py; nothing was pushed. Since #3449 default runs setX2W_NATIVE_SHADERS_ONLY=1, andload_translation/load_compute_translationthen return before reading<key>.txt, so a Python lowering no longer changes what a default run of the application executes. I'll look at the native frontend's refusals instead.