[PR #515] [MERGED] TEST-FCMPSWAP-NAN-POSTSTATE: check memory after the buffer NaN atomic #563

Closed
opened 2026-11-26 20:18:18 +01:00 by 4ld0 · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/ubiquitarianism/leonida/pull/515
Author: @csmith105
Created: 11/24/2026
Status: ✅ Merged
Merged: 11/24/2026
Merged by: @QemmHD

Base: main ← Head: codex/fcmpswap-nan-poststate


📝 Commits (1)

  • a672a59 Check buffer NaN compare-and-swap memory post-state

📊 Changes

3 files changed (+30 additions, -7 deletions)

View changed files

📝 runtime/test/shaders/cs_w32_fcmpswap.asm (+4 -1)
📝 tests/semantic/fixtures/disasm/cs_w32_fcmpswap.s (+2 -0)
📝 tests/semantic/test_fcmpswap_fixture.py (+24 -6)

📄 Description

Claimed as TEST-FCMPSWAP-NAN-POSTSTATE.

What and why

The buffer NaN case in cs_w32_fcmpswap stores only the atomic's returned old value. Both correct floating-point comparison and an incorrect integer comparison return the same old NaN, so the existing oracle accepts an erroneous store of 1.0.

Read memory at byte 0x48 after the atomic and expose it in output slot 7. The eight expected words stay unchanged. A targeted negative control substitutes integer comparison for only this NaN atomic and proves that the fixture now rejects the wrong update. Signed-zero cases retain GPU return-value coverage, and test_float_cmpswap.py retains old-value and memory checks for NaNs.

This addresses the coverage gap identified in docs-only #413. It does not change that PR's documentation row or depend on it. No translator or runtime changes.

Tested

On the RTX 3080, all four synthetic variants translate and pass spirv-val:

Fixture NaN comparison Eight-word oracle Memory at 0x48
Original Float Pass 0x7FC00000
Original Integer negative control Pass (coverage gap) 0x3F800000
Corrected Float Pass 0x7FC00000
Corrected Integer negative control Fails as intended 0x3F800000

These native runs used normal Vulkan validation, SPIRV-Tools 2026.4 and Khronos validation layers 1.4.357.0. GPU-assisted validation was also attempted on the original fixture, but reported an unrelated LDS atomic/read pair at byte 0xC0. Both accesses are guarded to lane zero; this is consistent with GPUAV's documented mixed atomic/non-atomic limitation. The failed receipt is retained; a GPUAV pass is not claimed.

  • Eleven focused fixture/float-atomic tests pass, independently repeated by a second reviewer.
  • Full semantic suite on a960c06fd plus this patch: 465 files, 6,106 tests, zero failed files (403 seconds, eight jobs). Rebased cleanly onto c023a365a and repeated the focused fixture tests; the intervening main changes affect only runtime C++ files.
  • Fixture regeneration, compile check, CLI help, changed-file data-policy check and git diff --check pass.

GPUs tested: NVIDIA GeForce RTX 3080 10 GB, driver 610.88, Windows 11 build 26300; wave32/subgroup 32. Hand-written synthetic inputs only.

AI-assisted: yes (Codex).

Checklist

  • Based on current main and merges cleanly.
  • One topic.
  • No game data, keys or decryption.
  • No new translator rule; existing fixture correction only.

🔄 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/515 **Author:** [@csmith105](https://github.com/csmith105) **Created:** 11/24/2026 **Status:** ✅ Merged **Merged:** 11/24/2026 **Merged by:** [@QemmHD](https://github.com/QemmHD) **Base:** `main` ← **Head:** `codex/fcmpswap-nan-poststate` --- ### 📝 Commits (1) - [`a672a59`](https://github.com/ubiquitarianism/leonida/commit/a672a598007278d4d65717b5a0cd650118b0630e) Check buffer NaN compare-and-swap memory post-state ### 📊 Changes **3 files changed** (+30 additions, -7 deletions) <details> <summary>View changed files</summary> 📝 `runtime/test/shaders/cs_w32_fcmpswap.asm` (+4 -1) 📝 `tests/semantic/fixtures/disasm/cs_w32_fcmpswap.s` (+2 -0) 📝 `tests/semantic/test_fcmpswap_fixture.py` (+24 -6) </details> ### 📄 Description Claimed as [TEST-FCMPSWAP-NAN-POSTSTATE](https://github.com/ubiquitarianism/leonida/issues/14#issuecomment-7124052568). ### What and why The buffer NaN case in `cs_w32_fcmpswap` stores only the atomic's returned old value. Both correct floating-point comparison and an incorrect integer comparison return the same old NaN, so the existing oracle accepts an erroneous store of 1.0. Read memory at byte 0x48 after the atomic and expose it in output slot 7. The eight expected words stay unchanged. A targeted negative control substitutes integer comparison for only this NaN atomic and proves that the fixture now rejects the wrong update. Signed-zero cases retain GPU return-value coverage, and `test_float_cmpswap.py` retains old-value and memory checks for NaNs. This addresses the coverage gap identified in docs-only #413. It does not change that PR's documentation row or depend on it. No translator or runtime changes. ### Tested On the RTX 3080, all four synthetic variants translate and pass `spirv-val`: | Fixture | NaN comparison | Eight-word oracle | Memory at 0x48 | |---|---|---|---| | Original | Float | Pass | 0x7FC00000 | | Original | Integer negative control | Pass (coverage gap) | 0x3F800000 | | Corrected | Float | Pass | 0x7FC00000 | | Corrected | Integer negative control | Fails as intended | 0x3F800000 | These native runs used normal Vulkan validation, SPIRV-Tools 2026.4 and Khronos validation layers 1.4.357.0. GPU-assisted validation was also attempted on the original fixture, but reported an unrelated LDS atomic/read pair at byte 0xC0. Both accesses are guarded to lane zero; this is consistent with GPUAV's [documented mixed atomic/non-atomic limitation](https://github.com/KhronosGroup/Vulkan-ValidationLayers/blob/main/layers/gpuav/shaders/instrumentation/shared_memory_data_race.comp#L42-L44). The failed receipt is retained; a GPUAV pass is not claimed. - Eleven focused fixture/float-atomic tests pass, independently repeated by a second reviewer. - Full semantic suite on a960c06fd plus this patch: 465 files, 6,106 tests, zero failed files (403 seconds, eight jobs). Rebased cleanly onto c023a365a and repeated the focused fixture tests; the intervening main changes affect only runtime C++ files. - Fixture regeneration, compile check, CLI help, changed-file data-policy check and `git diff --check` pass. GPUs tested: NVIDIA GeForce RTX 3080 10 GB, driver 610.88, Windows 11 build 26300; wave32/subgroup 32. Hand-written synthetic inputs only. AI-assisted: yes (Codex). ### Checklist - [x] Based on current `main` and merges cleanly. - [x] One topic. - [x] No game data, keys or decryption. - [x] No new translator rule; existing fixture correction only. --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
4ld0 2026-11-26 20:18:18 +01:00
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#563
No description provided.