Skip to content

tests(semantic): update image atomics guard and store_d16 tests for recent translator PRs - #7916

Open
itsfufi wants to merge 2 commits into
ItsNotRexed:mainfrom
itsfufi:fix/test-semantic-suite-image-atomics-and-d16
Open

itsfufi wants to merge 2 commits into
ItsNotRexed:mainfrom
itsfufi:fix/test-semantic-suite-image-atomics-and-d16

Conversation

@itsfufi

@itsfufi itsfufi commented Nov 23, 2026

Copy link
Copy Markdown

What this PR does

Updates two semantic test files whose expectations became stale following recent translator PRs:

  1. ****:

  2. ****:

Verification

  • Suite test:
  • Result: (100% pass rate across the full suite).

AI-assisted. Tested on Linux x86-64.

…ecent translator PRs

- Update find_guarded_texel_block in test_image_atomics_guard.py to accept %true execution mask conditions from active_b() added in PR ItsNotRexed#3559.
- Remove SQ_RSRC_IMG_CUBE from test_unsupported_dims_and_modifiers_still_refused in test_image_store_d16.py since PR ItsNotRexed#6805 added support for cube image stores.

Passes all 5,956 semantic tests in tests/semantic.
AI-assisted. Tested on Linux x86-64.
@MonkeyPython

Copy link
Copy Markdown

Tested 6d17ae34 on Windows 11 (10.0.26300), Python 3.14.6, with spirv-as/spirv-val from C:\VulkanSDK\1.4.363.0\Bin (SPIRV-Tools v2026.4) prepended to PATH: pass — full semantic suite green.

  • python -I scripts/run_semantic_tests.py tests/semantic: 447 files, 5956 tests, 0 files failed (266 s, 16 jobs).
  • test_image_atomics_guard.py: 3 tests OK; test_image_store_d16.py: 4 tests OK (both also OK with spirv-as/spirv-val active; without those tools on PATH the files' validation asserts skip silently — re-ran with them present).
  • Baseline at parent dde82f27, same interpreter/machine: test_image_atomics_guard FAILED (failures=47, "OpImageTexelPointer in unguarded block"), test_image_store_d16 FAILED (failures=1, "Unsupported not raised"). This PR resolves both.
  • Diff read: these inputs never modify EXEC, so active_b() returns %true and the module contains no %active load — accepting %true is required. The structural requirement (OpSelectionMerge + OpBranchConditional into the block holding OpImageTexelPointer) still rejects an unguarded translator; note a constant-%true guard now also passes and the dynamic per-lane path is no longer exercised by this file (a divergent-EXEC case would restore it). CUBE d16 refusal removal matches merged rdna2spirv: support image_store and coherent image_load on SQ_RSRC_IMG_CUBE #6805 (15:59 UTC); positive cube d16 coverage remains in test_image_cube_store_glc.py; tfe/lwe refusals untouched. rdna2spirv: guard all image_atomic_* by active lane #3559 merged 16:01 UTC.
  • Minor: the added literal "true" (no %) can never match the regex (m.group(1) always starts with %); find_guarded_texel_block's docstring still says the condition "is an OpLoad %bool %active".

AI-assisted (Hermes agent). No game files used.

@RAINighty

Copy link
Copy Markdown

Tested 6d17ae34c merged with main dde82f27e (clean merge) on Windows 11 (10.0.26300), Python 3.13.15 (venv with the pinned tests/requirements.txt), with llvm-mc 21.1.8 (AMDGPU) and SPIRV-Tools v2026.4 on PATH: pass.

  • tests/semantic/test_image_atomics_guard.py with this PR: passes (Ran 3 tests in 3.130s, OK). On main: fails (Ran 3 tests in 2.916s, FAILED (failures=47)).
  • tests/semantic/test_image_store_d16.py with this PR: passes (Ran 4 tests in 0.687s, OK). On main: fails (Ran 4 tests in 0.683s, FAILED (failures=1)).
  • Test-only change: the failure it fixes is the one listed above for main.
  • Code not reviewed beyond running it. No GPU or game files.

AI-assisted (Claude Code).

@itsfufi

itsfufi commented Nov 23, 2026

Copy link
Copy Markdown
Author

Thanks for the thorough review and testing on Windows @MonkeyPython and @RAINighty! I have pushed a minor commit refining the set to and updating the docstring.

@mralanbourne

Copy link
Copy Markdown

Code read (CPU), AI-assisted (Hermes coding agent), no game files. Checked at head 39a2be5d3 on Linux (Python 3.14.10 and 3.12.16, identical).

Both files pass on this branch, but the checker change has two blind spots:

  1. Accepts a guard folded to %true after an EXEC write. active_loads.add("%true") is unconditional, so a translation whose guard is %true although EXEC was written (the regression this test exists for) passes. Reproduced with the SPIR-V of v_cmp_gt_u32_e32 vcc_lo, 3, v0 / s_and_saveexec_b32 s12, vcc_lo / image_atomic_add v0, v[1:2], s[4:11] dmask:0x1 dim:SQ_RSRC_IMG_2D unorm glc, guard condition replaced by %true: accepted.

  2. Rejects a correct translation when the EXEC write and the atomic are in one block. There the guard condition is the value the EXEC write stored (OpStore %active %t12; rdna2spirv: cache per-block %active loads and fast-path no-EXEC dst() writes #4473's per-block %active cache), neither an OpLoad %bool %active nor %true: AssertionError: OpImageTexelPointer in unguarded block %t101_do. The current fixtures don't have that shape, which is why the suite is green.

Context: f469596f9 (#3559) was already red at its own merge commit (bisected over the five later rdna2spirv.py commits, identical 47 + 1), so both failures are #4473 / #6805 effects that landed before the test did.

#7608 handles both cases (OpStore %active values count as the active bit; %true only with allow_static_exec, with explicit tests for both paths). With its checker the real guard above is accepted and the folded one rejected.

@cryptocxeq cryptocxeq 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 CPU review at 39a2be5d39450aa22f20e93b2f44742c334d8a0b against main 32a50c949e882ae539f2d54be93fadd50ce76cae, native Windows CPython 3.14.0. Review claim.

The old tests fail on this snapshot: image-atomic guards report 47 subcase failures, and the D16 suite still expects cube stores to be rejected. With this patch both modules pass (3 and 4 tests). %true is accepted alongside a load of %active while the existing structured guard/texel-pointer assertions remain. Removing cube from the rejection list agrees with its existing positive dimension coverage. A deliberately wrong atomic opcode is still detected by the guard suite (4 failures). These are CPU structure/emulator checks; optional SPIR-V tools and GPU validation were not run.

Commands and results (each changed test module run separately):

  • python -I tests/semantic/test_image_atomics_guard.py: exit 0; Ran 3 tests in 0.436s.
  • python -I tests/semantic/test_image_store_d16.py: exit 0; Ran 4 tests in 0.173s.

Only public source and handwritten/synthetic fixtures were used. No game files, keys, external game services, GPU runs or LLVM/SPIR-V tool validation. This is a COMMENT review, not a merge approval.

@N4use4tic

Copy link
Copy Markdown

Tested 39a2be5 on Windows 11, Python 3.14.4, no GPU or LLVM: pass.
From tests/semantic: test_image_atomics_guard (3 tests) and test_image_store_d16 (4 tests) both OK.
On main (54ce888) the same two files fail (47 failures and 1 failure), which matches #7284.
Code not reviewed beyond the test run.

@lucasserafin94

Copy link
Copy Markdown

Tested 39a2be5 merged onto main 2a3b3b5 on Windows 11 (Python 3.12.10, LLVM_MC = a local llvm-mc 21.1.8 built with scripts/build_llvm_mc.ps1): partial.

  • test_image_atomics_guard.py: FAILED (failures=47) on main, OK with this PR.
  • test_image_store_d16.py: FAILED (failures=1) on main, OK with this PR.
  • test_image_cube_store_glc.py (not touched here) still fails on Windows with LLVM_MC set: FileNotFoundError from subprocess, because llvm_mc_cmd() uses shlex.split, which drops the backslashes of a Windows path.

#7284 (opened earlier) changes the same two files plus that third one (mc_command.split_command) and passes all three here, so the two overlap; per the coordination rules the first to land wins.

AI-assisted (Claude Code); no game files involved.

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.

7 participants