Repository navigation
Conversation
6 tasks
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Change
lower_meshrefused everys_cbranch_vccz/vccnzon a VCC written byv_cmp: the v_cmp path always cleared the VCC words andvcc_nonempty. On main, a uniform root compare followed by a VCC branch fails withnative compute +0xc: mesh VCC branch lacks a proven guest whole-wave mask.This change sets them when the proof is the one the SCC path already uses (
src/gfx1013_direct_mesh.inl:874), insrc/gfx1013_direct_mesh.inl:741-759:uniform();wave_activeis known, or the current lane predicate equals the enclosing EXECZ skip guard (exec_nonempty_known(), now shared with the SCC path).vcc_nonemptyis the uniform predicate (ANDed withwave_activewhen present). The VCC words arepred ? exec_word : 0, written only for known EXEC words.Invalidation:
alu.writenow clears the VCC words andvcc_nonemptyinafter_graphics_write(:36-38). This replaces the explicit clears in the v_cmp path and at the gather-arm join.:319) and the CMPX lane-diamond join (:360). Without this, a VCC set inside the region survived the clear andmerge_edgesproduced a per-threadphiwith the entry value, so lanes of one wave could take different branches. With the hook,merge_edges(:238-241) drops a register empty on either edge, so no such phi remains.Tests (
tests/native_direct_mesh_check.py):root-vcc-branch: uniform root compare into VCC, then a VCC branch. Must translate; the DXIL regex ties the branch toicmp u(gt|le) <cbuffer extractvalue>, 6.mesh VCC branch lacks a proven guest whole-wave maskand write no output:lane-vcc-branch: VGPR operand.narrowed-vcc-branch: EXEC narrowed byv_cmpx_eq_u32, full EXEC restored before the branch.overwritten-vcc-branch: a lane compare writes VCC between the compare and the branch.skip-uniform-vcc:s_mov_b64 vcc,-1,v_cmpx_eq_u32 0,v0, EXECZ skip overv_cmp_gt_u32 vcc,s20,6,exec=-1,vccz.diamond-known-vcc:s_mov_b64 vcc,-1, CMPX lane diamond withv_cmp_gt_u32 vcc,s20,6in the then-arm, join,s_cbranch_vccz.Refs #2413, #3416 (item d of my claim, the VCC item).
Verification
First pass: change applied to main
51472392. Second pass: same checks on the final change;git diff --stat 51472392 212d4b5fon the two files is empty, so main212d4b5fdoes not touch them. Release build.Targeted run:
ctest --test-dir out\build\release --no-tests=error --output-on-failure -R "^(native_direct_mesh|native_compile_dxil_refusals|native_fixed_mesh57.*)$": 21/22 pass, 0 skipped.native_fixed_mesh57_waterfall_fine_hardwarefails (pixels (0,0) (2,0) (1,1) (3,1) got 0xff0000ff/0xff00ff00, expected 0xffff0000). It fails the same way with main's.inl, so it predates this change.Fails on main: with main's
.inlrebuilt,native_direct_meshfails atrun('root-vcc-branch', ...)withnative compute +0xc: mesh VCC branch lacks a proven guest whole-wave mask.The join hole, found in the first pass before the
:319/:360hook calls. Probe programs run againstcompile_dxil.exe:vcc,-1(diamond-known-vcc)vcc,-1(skip-uniform-vcc)s_mov_b64 vcc,0insideMutations, each rebuilt and run with
native_direct_mesh::743rhswithoutuniform()lane-vcc-branchacceptedr==106 || r==107branch removed (:36-38)overwritten-vcc-branchaccepted&& exec_nonempty_known()dropped from the VCC pathnarrowed-vcc-branchaccepted:319removedskip-uniform-vcc:360removeddiamond-known-vccM1-M3 ran in both passes, J1-J2 in the second. After restore, both files are byte-identical to before the mutations (sha256) and the targeted run is 21/22 again.
Evidence and follow-up
The fixtures are hand-encoded instruction words in
tests/native_direct_mesh_check.py.#3420 and #3422 also edit
src/gfx1013_direct_mesh.inland the same test file, in other functions and cases.Not covered:
s_mov_b64 vcc,0inside a per-lane skip case is accepted on main. With this change the probe is refused (+0x20), but no test in the suite covers that variant.Checklist