Skip to content

Preserve far-branch re-anchoring checks - #8764

Open
nova-aryan wants to merge 1 commit into
ItsNotRexed:mainfrom
nova-aryan:contrib/02-far-branch-integrity
Open

nova-aryan wants to merge 1 commit into
ItsNotRexed:mainfrom
nova-aryan:contrib/02-far-branch-integrity

Conversation

@nova-aryan

Copy link
Copy Markdown

Claimed in the coordination issue: Far-branch folding preserves re-anchoring checks

What and why

The far-branch fold recognized four instructions by mnemonic and operands. The disassembler's re-anchoring path can leave address gaps or mark instructions whose printed encoding differs from the native word. Substituting a single branch could hide those conditions from the reachability checks.

Require contiguous encoded instructions and preserve normalized instructions for the existing validation. Update the compiler contract and exercise the full translation path with synthetic fixtures. The valid control still jumps over an undecodable word after the complete sequence and writes the expected pixel.

Tested

  • On 867d922, the three gaps inside the sequence and the normalized instruction all translated successfully. The new regression cases now reject them. The positive control and existing forward and backward jump cases pass.
  • 70 focused tests passed on Windows 11 with Python 3.13.14 across far branches, printed encodings, decode checks, and sampler-source analysis.
  • SPIRV-Tools 2026.1 assembled and validated the positive control for Vulkan 1.3. Across 100 repository synthetic listings, all 52 successful outputs were byte-identical as SPIR-V assembly and the others retained their previous refusal.
  • Full WSL semantic suite with Python 3.14.7. Both baseline (5,957 tests) and this branch (5,960 tests) reported the same two failing files, test_image_atomics_guard and test_image_store_d16. The documentation row check also reproduces the baseline failure for duplicate rows in docs/README.md.
  • git diff --check and the changed-file game-data check passed. CPU-only tests with synthetic inputs.

AI-assisted: Yes (Codex).

@Grimkeh Grimkeh left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Independent Linux CPU review (7862c6c9)

What changed: preserve far-branch re-anchoring checks in rdna2spirv; design.md + semantic tests.

Checked: test_far_branch 7 OK.

Looks correct; no game files.

@catminou4

Copy link
Copy Markdown

Tested 7862c6c98 on Apple M1 Max, macOS 27.2.1 arm64, MoltenVK 1.4.2: pass.

  • python -m unittest test_far_branch → 7/7 OK on ARM64.
  • GPU run_gpu_tests.py --filter branch: ps_far_branch PASS (4096/4096 pixels exact — the far-branch control case), ps_uniform_branch PASS; cs_w64x_branch/cs_w64x_wg128_branches SKIP (no 64-wide compute subgroup on MoltenVK, expected).

No game files. AI-assisted (Devin).

@supidooo

Copy link
Copy Markdown

Verified head 7862c6c9 on native Windows 10 Pro (build 19045), Python 3.10.9, and NVIDIA GeForce RTX 4060 Ti (Ada, subgroup 32..32, driver 621.24, Vulkan 1.4.357):

  • python -I scripts/check_no_game_data.py on all 3 changed files: clean (exit 0).
  • Negative control on main (867d922f): running FarBranchReanchoring from this PR against main failed all 4 new assertions (gap_after=0,1,2 and mismatched_setpc=True).
  • python -I -m unittest discover -s tests/semantic -p "test_far_branch.py" -v: 7/7 OK (0.045s).
  • python -I tests/test_design_contract_rows.py: 4/4 OK (0.003s).
  • GPU pixel readback on RTX 4060 Ti (tools/rdna2spirv.py --assembler python --no-validate + runtime/build/vk_harness.exe, 64×64 RGBA32F):
    • ps_far_branch: 4096/4096 pixels exact ([0x00000007, 0x00000013, 0x00000051, 0x0000000b]).
    • ps_reanchored_far_branch (the new contiguous far-branch positive control jumping over an undecodable 0xffffffff word): 4096/4096 pixels exact ([0x3f800000, 0x3f800000, 0x3f800000, 0x3f800000]).

(spirv-val was not run in this native Windows environment; assembled via --assembler python --no-validate.) No game files used. AI-assisted.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants