TEST-LDS-U8-D16-GPUAV: restrict LDS fixture accesses to lane zero #507

Manually merged
github merged 1 commit from gh-pr/507/head into gh-pr/507/base 2026-11-26 09:04:47 +00:00
Owner

@⁠csmith105 on GitHub · 2026-11-24 06:35 UTC · original
csmith105:codex/lds-u8-d16-fixture → main · +34 −5 · 3 files · 1 commits · merged 2026-11-24 07:38 UTC

Claimed as TEST-LDS-U8-D16-GPUAV.

What and why

cs_w32_lds_u8_d16 lets all 32 lanes store the same LDS word before restricting output to lane zero. Matching values do not make those concurrent stores safe: GPU-assisted validation reports six shared-memory data-race errors on an RTX 3080.

Move the existing EXEC mask ahead of the LDS accesses. Lane zero now performs every LDS access and output store, preserving the eight expected byte-read/sign-extension results. Run the CPU fixture with all 32 invocations and observe LDS writes, so serialized execution cannot hide the original race: the regression sees 32 writes before the fix and exactly one afterward. No translator or native harness changes.

Tested

  • Native Windows, RTX 3080: original fixture exits 1 with six GPUAV shared-memory race errors; corrected fixture exits 0, with all eight output words unchanged. Both translate and pass spirv-val (1/1). Repeated the corrected GPU run after rebasing onto a960c06fd.
  • Full semantic suite before rebase: 465 files, 6,105 tests, zero failed files (397 seconds, eight jobs).
  • Three focused CPU tests and fixture regeneration check pass, including after rebase. The new write-count test fails against the original fixture.
  • Python compile check, CLI help, changed-file data-policy check and git diff --check pass.
  • Rebase from 8f481cf16 to a960c06fd is clean. Upstream changes do not touch these files; its translator edit concerns SDWA conversion encodings, which this fixture does not use.

GPU validation used SPIRV-Tools 2026.4, Khronos validation layers 1.4.357.0, LEONIDA_VK_VALIDATION=1 and VK_KHRONOS_VALIDATION_GPUAV_ENABLE=1. This is a wave32 fixture (subgroup 32); the runner's global LEONIDA_W64_EMULATE=1 does not change its mode. Only hand-written synthetic shaders were used.

GPUs tested: NVIDIA GeForce RTX 3080 10 GB, driver 610.88, Windows 11 build 26300.

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.
**@⁠csmith105** on GitHub · 2026-11-24 06:35 UTC · [original](https://github.com/ubiquitarianism/leonida/pull/507) `csmith105:codex/lds-u8-d16-fixture` → `main` · +34 −5 · 3 files · 1 commits · merged 2026-11-24 07:38 UTC Claimed as [TEST-LDS-U8-D16-GPUAV](https://git.gtahub.st/github/ubiquitarianism--leonida/issues/14). ### What and why `cs_w32_lds_u8_d16` lets all 32 lanes store the same LDS word before restricting output to lane zero. Matching values do not make those concurrent stores safe: GPU-assisted validation reports six shared-memory data-race errors on an RTX 3080. Move the existing EXEC mask ahead of the LDS accesses. Lane zero now performs every LDS access and output store, preserving the eight expected byte-read/sign-extension results. Run the CPU fixture with all 32 invocations and observe LDS writes, so serialized execution cannot hide the original race: the regression sees 32 writes before the fix and exactly one afterward. No translator or native harness changes. ### Tested - Native Windows, RTX 3080: original fixture exits 1 with six GPUAV shared-memory race errors; corrected fixture exits 0, with all eight output words unchanged. Both translate and pass `spirv-val` (1/1). Repeated the corrected GPU run after rebasing onto `a960c06fd`. - Full semantic suite before rebase: 465 files, 6,105 tests, zero failed files (397 seconds, eight jobs). - Three focused CPU tests and fixture regeneration check pass, including after rebase. The new write-count test fails against the original fixture. - Python compile check, CLI help, changed-file data-policy check and `git diff --check` pass. - Rebase from `8f481cf16` to `a960c06fd` is clean. Upstream changes do not touch these files; its translator edit concerns SDWA conversion encodings, which this fixture does not use. GPU validation used SPIRV-Tools 2026.4, Khronos validation layers 1.4.357.0, `LEONIDA_VK_VALIDATION=1` and `VK_KHRONOS_VALIDATION_GPUAV_ENABLE=1`. This is a wave32 fixture (subgroup 32); the runner's global `LEONIDA_W64_EMULATE=1` does not change its mode. Only hand-written synthetic shaders were used. GPUs tested: NVIDIA GeForce RTX 3080 10 GB, driver 610.88, Windows 11 build 26300. 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.
github-bot locked as GitHub sync and limited conversation to collaborators 2026-11-26 09:04:43 +00:00
github manually merged commit d4eacf7d05 into gh-pr/507/base 2026-11-26 09:04:47 +00:00
Author
Owner

@⁠pwu2775-dev on GitHub · 2026-11-24 07:37 UTC · original · reviewed

Code read of d4eacf7d against main: no issues.

v_cmpx_eq_u32 0, v0 now runs before the first LDS write, so only lane 0 touches LDS and stores output; the .asm and generated .s match and the eight expected words are unchanged. The new test runs the full 32-lane workgroup and observes the writes to the workgroup array (exactly one store, (0, 0x7F80FF01)), which is the right way to catch it since the interpreter serializes racing stores and the output alone could not.

AI-assisted: review by Codex (gpt-6.1-terra); the conclusions were checked against the tests I ran, listed in my test comment.

**@⁠pwu2775-dev** on GitHub · 2026-11-24 07:37 UTC · [original](https://github.com/ubiquitarianism/leonida/pull/507#pullrequestreview-6035356322) · **reviewed** Code read of d4eacf7d against main: no issues. `v_cmpx_eq_u32 0, v0` now runs before the first LDS write, so only lane 0 touches LDS and stores output; the `.asm` and generated `.s` match and the eight expected words are unchanged. The new test runs the full 32-lane workgroup and observes the writes to the workgroup array (exactly one store, `(0, 0x7F80FF01)`), which is the right way to catch it since the interpreter serializes racing stores and the output alone could not. AI-assisted: review by Codex (gpt-6.1-terra); the conclusions were checked against the tests I ran, listed in my test comment.
Author
Owner

@⁠pwu2775-dev on GitHub · 2026-11-24 07:37 UTC · original

Tested d4eacf7d on NVIDIA GeForce RTX 4070, driver 617.42, Windows 11 10.0.26300, MSVC (VS 2022), Vulkan SDK 1.4.363.0, Ninja RelWithDebInfo: pass.

  • tests/semantic/test_lds_read_u8_d16.py (run from tests/semantic): 3/3, including the one-LDS-store check over the full 32-lane workgroup.
  • run_gpu_tests.py --filter lds_u8_d16: cs_w32_lds_u8_d16 1/1, words 0xbeef00ff 0xff1234 0xbeefff80 0xff801234 0xbeef007f 0x7f1234 0xbeef0080 0xffff1234, unchanged.
  • ctest: 302/303 passed; the one failure is d3d12_execute_indirect_validation, which is the red-on-main case in #504 and fails the same way on all three PRs. I did not rerun it on main itself.
  • Full run_gpu_tests.py: 197/248 passed, 49 skipped; with LEONIDA_W64_EMULATE=1: 229/248 passed, 17 skipped, the same totals as my unmodified-main record in #534.

Code read: no issues; details in my review: #507

AI-assisted: review by Codex (gpt-6.1-terra).

**@⁠pwu2775-dev** on GitHub · 2026-11-24 07:37 UTC · [original](https://github.com/ubiquitarianism/leonida/pull/507#issuecomment-7125199103) Tested d4eacf7d on NVIDIA GeForce RTX 4070, driver 617.42, Windows 11 10.0.26300, MSVC (VS 2022), Vulkan SDK 1.4.363.0, Ninja RelWithDebInfo: pass. - `tests/semantic/test_lds_read_u8_d16.py` (run from `tests/semantic`): 3/3, including the one-LDS-store check over the full 32-lane workgroup. - `run_gpu_tests.py --filter lds_u8_d16`: `cs_w32_lds_u8_d16` 1/1, words `0xbeef00ff 0xff1234 0xbeefff80 0xff801234 0xbeef007f 0x7f1234 0xbeef0080 0xffff1234`, unchanged. - `ctest`: 302/303 passed; the one failure is `d3d12_execute_indirect_validation`, which is the red-on-main case in #504 and fails the same way on all three PRs. I did not rerun it on `main` itself. - Full `run_gpu_tests.py`: 197/248 passed, 49 skipped; with `LEONIDA_W64_EMULATE=1`: 229/248 passed, 17 skipped, the same totals as my unmodified-`main` record in #534. Code read: no issues; details in my review: https://git.gtahub.st/github/ubiquitarianism--leonida/pulls/507 AI-assisted: review by Codex (gpt-6.1-terra).
Author
Owner

@⁠QemmHD on GitHub · 2026-11-24 07:38 UTC · original

Merging. Why merged: the LDS u8_d16 GPU fixture now has only lane 0 touch shared memory, removing a race between the 32 lanes.
Why it's good: security-reviewed; on main d42773d the new test fails and passes with this PR (3/3); the GPU fixture passes on an RTX 4070 SUPER (driver 621.24).

AI-assisted (Claude Code, Claude Opus 5.5).

**@⁠QemmHD** on GitHub · 2026-11-24 07:38 UTC · [original](https://github.com/ubiquitarianism/leonida/pull/507#issuecomment-7125216587) Merging. Why merged: the LDS u8_d16 GPU fixture now has only lane 0 touch shared memory, removing a race between the 32 lanes. Why it's good: security-reviewed; on main d42773d the new test fails and passes with this PR (3/3); the GPU fixture passes on an RTX 4070 SUPER (driver 621.24). AI-assisted (Claude Code, Claude Opus 5.5).
This discussion has been locked. Commenting is limited to contributors.
No description provided.