[PR #1907] wave64_halves: model image_atomic_* as atomic memory sinks (SHADER-W64-HALVES-IMAGE-ATOMIC) #1917

Open
opened 2026-11-26 21:19:24 +01:00 by 4ld0 · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/ubiquitarianism/leonida/pull/1907
Author: @JordanWebDev
Created: 11/25/2026
Status: 🔄 Open

Base: main ← Head: contrib/w64-halves-image-atomic


📝 Commits (1)

  • 1cfb452 wave64_halves: model image_atomic_* as atomic memory sinks (SHADER-W64-HALVES-IMAGE-ATOMIC)

📊 Changes

3 files changed (+111 additions, -8 deletions)

View changed files

📝 docs/design.md (+1 -1)
📝 tests/semantic/test_wave64_halves.py (+102 -0)
📝 tools/wave64_halves.py (+8 -7)

📄 Description

Claimed in the coordination issue as: SHADER-W64-HALVES-IMAGE-ATOMIC

What and why

tools/wave64_halves.py did not classify image_atomic_* instructions as atomic memory sinks:

  1. operands() (tools/wave64_halves.py:290-292): added "image_atomic" alongside "global_atomic" / "flat_atomic" so dests = [a[0]] only when "glc" is present and srcs = list(a).
  2. Analysis.transfer() (tools/wave64_halves.py:723-757): routed "image_atomic" into the atomic sink handler (data_op = a[0], addr_ops = list(a[1:])), and updated the elected address VGPR uniformity check to iterate _regs(x) (isinstance(r, tuple) and r[0] == "v") instead of only x.get("k") == "vgpr", so NSA coordinate vlist operands are checked under elected-lane rules too.
  3. Analysis.stale_uses() (tools/wave64_halves.py:1776-1778): included "flat_atomic" and "image_atomic" (and dropped the dead or dests and False) so scalar descriptor operands (s[0:7]) are always checked for stale-scalar reads.
  4. Added ImageAtomics (10 tests covering operands(), uniform A, lane-id data/vector/NSA coords, lane-count, glc allocation-order, elected constant elected-side-effect, elected NSA non-uniform coord elected-lane, aggregated B idiom, and stale-scalar descriptor) in tests/semantic/test_wave64_halves.py and updated the Wave64 graphics: partition invariance (SHADER-10) contract row in docs/design.md.

Tested

  • python -I scripts/check_no_game_data.py tools/wave64_halves.py tests/semantic/test_wave64_halves.py docs/design.md -> exit 0
  • python -I tests/semantic/test_wave64_halves.py -> Ran 137 tests in 8.223s OK
  • python -I -m compileall -q make_game.py tools tests -> exit 0
  • python -I tests/test_text_write_line_endings.py (3 OK), tests/test_report_paths.py (22 tests, 1 skipped, OK), tests/test_docs_design_rows.py (5 OK), tests/test_docs_repo_paths.py (3 OK), tests/test_docs_repeated_lines.py (2 OK), tests/test_ci_registration.py (16 OK)
  • Pre-rebase (3f81d46ac): python -I scripts/run_semantic_tests.py tests/semantic -> 487 files, 6289 tests, 0 files failed in 213 s
  • Note: pytest is not installed locally, so tests/test_wave64_halves_fixtures.py and GPU fixtures were not run locally.

GPUs tested: n/a

AI-assisted: yes

Checklist

  • Based on current main and merges cleanly (a conflicting pull request is labeled needs rebase).
  • One topic; follow-up work goes in a new pull request.
  • No game data, keys or decryption (CONTRIBUTING.md), including in logs or reports quoted here.
  • A new translator rule is in the contract table of docs/design.md, with how it was confirmed.

🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.

## 📋 Pull Request Information **Original PR:** https://github.com/ubiquitarianism/leonida/pull/1907 **Author:** [@JordanWebDev](https://github.com/JordanWebDev) **Created:** 11/25/2026 **Status:** 🔄 Open **Base:** `main` ← **Head:** `contrib/w64-halves-image-atomic` --- ### 📝 Commits (1) - [`1cfb452`](https://github.com/ubiquitarianism/leonida/commit/1cfb452aad8b7f8f5b08e6152d77d2f67a52cf6a) wave64_halves: model image_atomic_* as atomic memory sinks (SHADER-W64-HALVES-IMAGE-ATOMIC) ### 📊 Changes **3 files changed** (+111 additions, -8 deletions) <details> <summary>View changed files</summary> 📝 `docs/design.md` (+1 -1) 📝 `tests/semantic/test_wave64_halves.py` (+102 -0) 📝 `tools/wave64_halves.py` (+8 -7) </details> ### 📄 Description Claimed in the coordination issue as: SHADER-W64-HALVES-IMAGE-ATOMIC ### What and why `tools/wave64_halves.py` did not classify `image_atomic_*` instructions as atomic memory sinks: 1. `operands()` (`tools/wave64_halves.py:290-292`): added `"image_atomic"` alongside `"global_atomic"` / `"flat_atomic"` so `dests = [a[0]]` only when `"glc"` is present and `srcs = list(a)`. 2. `Analysis.transfer()` (`tools/wave64_halves.py:723-757`): routed `"image_atomic"` into the atomic sink handler (`data_op = a[0]`, `addr_ops = list(a[1:])`), and updated the `elected` address VGPR uniformity check to iterate `_regs(x)` (`isinstance(r, tuple) and r[0] == "v"`) instead of only `x.get("k") == "vgpr"`, so NSA coordinate `vlist` operands are checked under elected-lane rules too. 3. `Analysis.stale_uses()` (`tools/wave64_halves.py:1776-1778`): included `"flat_atomic"` and `"image_atomic"` (and dropped the dead `or dests and False`) so scalar descriptor operands (`s[0:7]`) are always checked for stale-scalar reads. 4. Added `ImageAtomics` (10 tests covering `operands()`, uniform `A`, `lane-id` data/vector/NSA coords, `lane-count`, `glc` `allocation-order`, elected constant `elected-side-effect`, elected NSA non-uniform coord `elected-lane`, aggregated `B` idiom, and `stale-scalar` descriptor) in `tests/semantic/test_wave64_halves.py` and updated the `Wave64 graphics: partition invariance (SHADER-10)` contract row in `docs/design.md`. ### Tested - `python -I scripts/check_no_game_data.py tools/wave64_halves.py tests/semantic/test_wave64_halves.py docs/design.md` -> exit 0 - `python -I tests/semantic/test_wave64_halves.py` -> Ran 137 tests in 8.223s OK - `python -I -m compileall -q make_game.py tools tests` -> exit 0 - `python -I tests/test_text_write_line_endings.py` (3 OK), `tests/test_report_paths.py` (22 tests, 1 skipped, OK), `tests/test_docs_design_rows.py` (5 OK), `tests/test_docs_repo_paths.py` (3 OK), `tests/test_docs_repeated_lines.py` (2 OK), `tests/test_ci_registration.py` (16 OK) - Pre-rebase (`3f81d46ac`): `python -I scripts/run_semantic_tests.py tests/semantic` -> 487 files, 6289 tests, 0 files failed in 213 s - Note: `pytest` is not installed locally, so `tests/test_wave64_halves_fixtures.py` and GPU fixtures were not run locally. GPUs tested: n/a AI-assisted: yes ### Checklist - [x] Based on current `main` and merges cleanly (a conflicting pull request is labeled `needs rebase`). - [x] One topic; follow-up work goes in a new pull request. - [x] No game data, keys or decryption (CONTRIBUTING.md), including in logs or reports quoted here. - [x] A new translator rule is in the contract table of `docs/design.md`, with how it was confirmed. --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
Sign in to join this conversation.
No labels
bug
pull-request
No milestone
No project
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.

Dependencies

No dependencies set

Reference
starred/leonida#1917
No description provided.