Skip to content

test: exercise narrowed EXEC for image atomic guards - #7212

Open
lucas-tafuri wants to merge 2 commits into
ItsNotRexed:mainfrom
lucas-tafuri:test/image-atomic-active-guard
Open

lucas-tafuri wants to merge 2 commits into
ItsNotRexed:mainfrom
lucas-tafuri:test/image-atomic-active-guard

Conversation

@lucas-tafuri

Copy link
Copy Markdown
Contributor

Claim: #7049 (comment)

The old fixture did not change EXEC, so the translator folded the active predicate to true, while the assertion expected a runtime load. Narrow EXEC before the atomic and check that the entry branch uses the current per-block active value, whether loaded from or just stored to %active. Constant predicates still fail the guard assertion. The translator is unchanged.

On Windows/Python 3.12 at upstream snapshot 8575d36e, the original test failed 47 subcases and the revised suite passed all three test methods. I also forced the emitted atomic branch to %true in a synthetic negative control and verified that the test rejected it. SPIR-V command-line tools were unavailable, so validation was limited to the CPU assembly assertions.

AI-assisted (OpenAI Codex).

@thehollowedone

Copy link
Copy Markdown

Independent Windows check of 9395858c with CPython 3.12.8 and SPIRV-Tools v2026.4 from Vulkan SDK 1.4.363.0. All three stock test_image_atomics_guard.py tests passed. All 49 generated modules assembled and validated with the SDK tools for Vulkan 1.3.

Two additional synthetic 2D and 3D cases kept the texel pointer behind the active-lane check. Both validated and matched the SDK assembler output apart from the generator word. This was an assembly and validation check.

AI-assisted.

@duudiis

duudiis commented Nov 23, 2026

Copy link
Copy Markdown

I tested 9395858 merged onto main 8575d36 on Windows 11 Pro with CPython 3.11.0, using the CPU only. Result: pass.

  • python -I tests/semantic/test_image_atomics_guard.py on main: 3 tests ran with 47 subtest failures. Every failure was OpImageTexelPointer in unguarded block %tNN_do. On the PR: 3 tests, OK.
  • image_atomic_add ... dim:SQ_RSRC_IMG_2D unorm glc with the narrowed EXEC emits OpStore %active %t9 and then OpBranchConditional %t9 %t95_do ... in the same block. The new check accepts this.
  • Negative control: I rewrote that branch condition to %true in the emitted SPIR-V. find_guarded_texel_block rejects it (unguarded block %t95_do).
  • spirv-as and spirv-val are not on PATH here, so validate_spirv was skipped. The earlier SDK check covers that part.

Review notes: the diff changes only the test, and the translator is unchanged. The guard now has to match the most recent OpLoad/OpStore of %active in the same block, and the constants %true/%false are still rejected. Before, a load of %active anywhere in the module was enough. The wrong-width Unsupported cases still raise with the v_cmpx inserted.

AI-assisted (Claude Code).

@mralanbourne

Copy link
Copy Markdown

Code read (CPU), AI-assisted (Hermes coding agent), no game files. Checked at head 9395858c8 on Linux.

test_image_atomics_guard passes. Two notes for the merge decision: test_image_store_d16 still fails on this branch (Unsupported not raised; the cube d16 store is supported since #6805), so this alone doesn't make main green; and with the forced v_cmpx every fixture now writes EXEC, so the static-EXEC path (a %true guard without an EXEC write, #4473) is no longer covered. #7608 covers both paths and both files.

Add narrow_exec parameter to translate function and modify atomic guard logic.
@lucas-tafuri

Copy link
Copy Markdown
Contributor Author

Thanks for catching the static EXEC coverage gap. a29088c adds an unchanged-EXEC case that checks the texel pointer block is entered by the %true branch, alongside the narrowed-EXEC matrix. All four test methods passed on Windows/Python 3.12 with SPIRV-Tools 2026.4. Forcing the new fixture through the narrowed path made the new assertion fail. The d16 fixture remains in the separate #7194 PR. AI-assisted (OpenAI Codex).

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.

5 participants