test(agc): check the stop variants of read_bda_span for a nested load_bda_span call #27718

Open
zarmstrong wants to merge 1 commit from upstream-pr/27718 into main
zarmstrong commented 2026-11-27 05:31:09 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by zarmstrong on 2026-11-27T05:31:09Z.


What

Follow-up to #22774, as @MarcZX10 suggested in review there. The call-nesting contract in RunBdaContractTests checked read_bda_span and read_bda_span_coherent only. A program whose BDA reads stop invocations gets read_bda_span_stop and read_bda_span_stop_coherent from the same DefineBdaSpanReadFunction, so the contract now checks all four for a load_bda_span call inside a selection or loop. Test-only change.

Tested

Windows 11 Pro 10.0.26200, WinLibs GCC 15.2.0 r7, Release, NVIDIA GeForce RTX 5090, driver 621.01, Khronos validation layer 1.4.363 (overlay layers disabled with VK_LOADER_LAYERS_DISABLE). ANYPS5_REQUIRE_VULKAN=1, ANYPS5_NO_SHADER_CACHE=1, VK_INSTANCE_LAYERS=VK_LAYER_KHRONOS_validation, VK_LOADER_DEBUG=layer.

  • ctest --test-dir build -R 'agc_.*bda.*|agc_shader_memory.*|shader_memory_decoder_tolerance|agc_driver_pixel_interlock|agc_driver_scalar_wide_loads' -V, 23 tests, 3 runs each on main 02fe966861 and on this change on top of it: 23/23 pass every run on both. Each log shows the loader inserting VK_LAYER_KHRONOS_validation in all 17 Vulkan tests, none contains was not found but was requested by env var VK_INSTANCE_LAYERS, and neither has any VUID- line.
  • Red check: with SpirvBdaRead.cpp from before #22774 (45d8797428^) and the nesting Require temporarily replaced by a print, all four variants report a nesting of 1: read_bda_span, read_bda_span_coherent, read_bda_span_stop, read_bda_span_stop_coherent. agc_driver_bda_device then fails on the 5090 with the #22773 message, an anchored BDA read differs from the same read through the lookups.
  • tools/check_conventions.py: all checks passed. tools/pr_overlap.py --branch could not compare 9 PRs that already conflict with main (#7642, #9508, #10193, #13928, #13929, #16571, #20519, #22424, #22944); I compared their BdaContracts.cpp changes by hand and none touches this check.

Checklist

  • Based on current main; no other open PR implements the same functions
  • One topic per PR; follow-ups go in a new PR
  • No comments in code except technical debt and the licence notice of code adapted from upstream (see AGENTS.md)
  • Unimplemented paths throw (NotImplemented_nid_no_patch); silent stubs are listed under Silent stubs in their library's technical debt file
  • No notes, investigation .md files or images added to the repository (attach them to this PR)
  • New third-party code is a submodule built from source
  • Generic behaviour, not specific to one title
  • Depends on: none
  • Fixes: none
  • Unblocks: none
  • GPUs tested: NVIDIA GeForce RTX 5090, driver 621.01, Windows 11 Pro 10.0.26200
  • AI-assisted: yes

🤖 Generated with Claude Code

Summary by CodeRabbit

  • Tests
    • Expanded coverage for four-dword BDA reads across stops and coherent values, verifying loader selection and call nesting behavior.
<!-- greyfinch-sync:boykopovar/AnyPS5:issue:5521735449 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/27718). Originally posted by [zarmstrong](https://github.com/zarmstrong) on 2026-11-27T05:31:09Z. --- ### What Follow-up to #22774, as @MarcZX10 suggested in review there. The call-nesting contract in `RunBdaContractTests` checked `read_bda_span` and `read_bda_span_coherent` only. A program whose BDA reads stop invocations gets `read_bda_span_stop` and `read_bda_span_stop_coherent` from the same `DefineBdaSpanReadFunction`, so the contract now checks all four for a `load_bda_span` call inside a selection or loop. Test-only change. ### Tested Windows 11 Pro 10.0.26200, WinLibs GCC 15.2.0 r7, Release, NVIDIA GeForce RTX 5090, driver 621.01, Khronos validation layer 1.4.363 (overlay layers disabled with `VK_LOADER_LAYERS_DISABLE`). `ANYPS5_REQUIRE_VULKAN=1`, `ANYPS5_NO_SHADER_CACHE=1`, `VK_INSTANCE_LAYERS=VK_LAYER_KHRONOS_validation`, `VK_LOADER_DEBUG=layer`. - `ctest --test-dir build -R 'agc_.*bda.*|agc_shader_memory.*|shader_memory_decoder_tolerance|agc_driver_pixel_interlock|agc_driver_scalar_wide_loads' -V`, 23 tests, 3 runs each on `main` `02fe966861` and on this change on top of it: 23/23 pass every run on both. Each log shows the loader inserting `VK_LAYER_KHRONOS_validation` in all 17 Vulkan tests, none contains `was not found but was requested by env var VK_INSTANCE_LAYERS`, and neither has any `VUID-` line. - Red check: with `SpirvBdaRead.cpp` from before #22774 (`45d8797428^`) and the nesting `Require` temporarily replaced by a print, all four variants report a nesting of 1: `read_bda_span`, `read_bda_span_coherent`, `read_bda_span_stop`, `read_bda_span_stop_coherent`. `agc_driver_bda_device` then fails on the 5090 with the #22773 message, `an anchored BDA read differs from the same read through the lookups`. - `tools/check_conventions.py`: all checks passed. `tools/pr_overlap.py --branch` could not compare 9 PRs that already conflict with `main` (#7642, #9508, #10193, #13928, #13929, #16571, #20519, #22424, #22944); I compared their `BdaContracts.cpp` changes by hand and none touches this check. ### Checklist <!-- Rules behind each item: https://github.com/boykopovar/AnyPS5/blob/main/CONTRIBUTING.md --> - [x] Based on current `main`; no other open PR implements the same functions - [x] One topic per PR; follow-ups go in a new PR - [x] No comments in code except [technical debt](https://github.com/boykopovar/AnyPS5/blob/main/docs/dev/CONVENTIONS.md) and the licence notice of code adapted from upstream (see AGENTS.md) - [x] Unimplemented paths throw (`NotImplemented_nid_no_patch`); silent stubs are listed under Silent stubs in their library's [technical debt](https://github.com/boykopovar/AnyPS5/tree/main/docs/dev/debt) file - [x] No notes, investigation `.md` files or images added to the repository (attach them to this PR) - [x] New third-party code is a submodule built from source - [x] Generic behaviour, not specific to one title - [x] Depends on: none - [x] Fixes: none - [x] Unblocks: none - [x] GPUs tested: NVIDIA GeForce RTX 5090, driver 621.01, Windows 11 Pro 10.0.26200 - [x] AI-assisted: yes 🤖 Generated with [Claude Code](https://claude.com/claude-code) <!-- This is an auto-generated comment: release notes by coderabbit.ai --> <!-- coderabbit-ai-generated:v1 --> ## Summary by CodeRabbit * **Tests** * Expanded coverage for four-dword BDA reads across `stops` and `coherent` values, verifying loader selection and call nesting behavior. <!-- end of auto-generated comment: release notes by coderabbit.ai -->
MarcZX10 commented 2026-11-27 05:55:39 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by MarcZX10 on 2026-11-27T05:55:39Z.

Review: APPROVED


Reviewed — looks good

The change adds the nested-call contract checks for all four BDA read variants; I found no defect in the changed test logic.

What I ran

Reviewed head 5ecbe1172e56feab3cc2daedda1954c7408ba978 using repo_read.py to inspect the prepared description, commit list, manifest, diff, changed file, and the CallNesting helper. No tests were run in this review.

Results

Check Result Note
Diff and changed-file review passed One test file read
Test execution not run Author-reported test results only

Findings

Blocking

None.

Non-blocking

None.

Not verified

The full project test suite and the author-reported GPU and Windows test runs were not independently run. No files were excluded according to the manifest; files.json was unavailable in the prepared review folder.

To get this to a good state

Nothing is required.

<!-- greyfinch-sync:boykopovar/AnyPS5:review:6084078674 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/27718#pullrequestreview-6084078674). Originally posted by [MarcZX10](https://github.com/MarcZX10) on 2026-11-27T05:55:39Z. **Review:** APPROVED --- # Reviewed — looks good The change adds the nested-call contract checks for all four BDA read variants; I found no defect in the changed test logic. ## What I ran Reviewed head `5ecbe1172e56feab3cc2daedda1954c7408ba978` using `repo_read.py` to inspect the prepared description, commit list, manifest, diff, changed file, and the `CallNesting` helper. No tests were run in this review. ## Results | Check | Result | Note | |---|---|---| | Diff and changed-file review | passed | One test file read | | Test execution | not run | Author-reported test results only | ## Findings ### Blocking None. ### Non-blocking None. ## Not verified The full project test suite and the author-reported GPU and Windows test runs were not independently run. No files were excluded according to the manifest; `files.json` was unavailable in the prepared review folder. ## To get this to a good state Nothing is required.
Plyxen commented 2026-11-27 06:03:33 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by Plyxen on 2026-11-27T06:03:33Z.

Review: APPROVED


Checked head 5ecbe1172e on Windows 11 with WinLibs GCC 15.2 (Release), applied alone to main ad7582bad4, on both GPUs in this machine: AMD Radeon(TM) Graphics (driver 26.11.2) and NVIDIA GeForce RTX 5080 (driver 621.24). tools/check_conventions.py --head passed.

agc_driver_bda_device passed on main and with this PR on each GPU, with ANYPS5_REQUIRE_VULKAN=1, ANYPS5_NO_SHADER_CACHE=1, VK_INSTANCE_LAYERS=VK_LAYER_KHRONOS_validation, VK_LOADER_DEBUG=layer and the layer from Vulkan SDK 1.4.363.0. Each log shows Insert instance layer "VK_LAYER_KHRONOS_validation", and none has was not found but was requested by env var VK_INSTANCE_LAYERS or any VUID- line.

The change is test-only, so there's no main source to revert. The new names match what SpirvBdaRead.cpp:186 emits (read_bda_span, then _stop, then _coherent), and CallNesting returns no value for a function that isn't there. So the stop variants are really checked now, and a call to load_bda_span nested inside a selection or loop in them would fail the test.

AI-assisted: yes (Claude Code)

<!-- greyfinch-sync:boykopovar/AnyPS5:review:6084163472 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/27718#pullrequestreview-6084163472). Originally posted by [Plyxen](https://github.com/Plyxen) on 2026-11-27T06:03:33Z. **Review:** APPROVED --- Checked head `5ecbe1172e` on Windows 11 with WinLibs GCC 15.2 (Release), applied alone to `main` `ad7582bad4`, on both GPUs in this machine: AMD Radeon(TM) Graphics (driver 26.11.2) and NVIDIA GeForce RTX 5080 (driver 621.24). `tools/check_conventions.py --head` passed. `agc_driver_bda_device` passed on `main` and with this PR on each GPU, with `ANYPS5_REQUIRE_VULKAN=1`, `ANYPS5_NO_SHADER_CACHE=1`, `VK_INSTANCE_LAYERS=VK_LAYER_KHRONOS_validation`, `VK_LOADER_DEBUG=layer` and the layer from Vulkan SDK 1.4.363.0. Each log shows `Insert instance layer "VK_LAYER_KHRONOS_validation"`, and none has `was not found but was requested by env var VK_INSTANCE_LAYERS` or any `VUID-` line. The change is test-only, so there's no `main` source to revert. The new names match what `SpirvBdaRead.cpp:186` emits (`read_bda_span`, then `_stop`, then `_coherent`), and `CallNesting` returns no value for a function that isn't there. So the stop variants are really checked now, and a call to `load_bda_span` nested inside a selection or loop in them would fail the test. AI-assisted: yes (Claude Code)
ligmaSec commented 2026-12-03 18:59:58 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by ligmaSec on 2026-12-03T18:59:58Z.

Review: COMMENTED


agc_driver_bda_device and the scalar-buffer control both passed on Linux/lavapipe on the same baseline and at 5ecbe1172e. Both logs show the Khronos validation layer inserted and contain no missing-layer warnings or VUID messages. The revised contract checks nesting for both stop-mode readers alongside the existing two variants.

AI-assisted: yes.

<!-- greyfinch-sync:boykopovar/AnyPS5:review:6176462497 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/27718#pullrequestreview-6176462497). Originally posted by [ligmaSec](https://github.com/ligmaSec) on 2026-12-03T18:59:58Z. **Review:** COMMENTED --- `agc_driver_bda_device` and the scalar-buffer control both passed on Linux/lavapipe on the same baseline and at `5ecbe1172e`. Both logs show the Khronos validation layer inserted and contain no missing-layer warnings or VUID messages. The revised contract checks nesting for both stop-mode readers alongside the existing two variants. AI-assisted: yes.
This pull request cannot be merged automatically due to conflicts.
Merge manually to resolve the conflicts.
View command line instructions

Checkout

From your project repository, check out a new branch and test the changes.
git fetch -u origin 'upstream-pr/27718:upstream-pr/27718'
git switch 'upstream-pr/27718'

Merge

Merge the changes and update on Forgejo.

Warning: The "Autodetect manual merge" setting is not enabled for this repository, you will have to mark this pull request as manually merged afterwards.

git switch 'main'
git merge --no-ff 'upstream-pr/27718'
git switch 'upstream-pr/27718'
git rebase 'main'
git switch 'main'
git merge --ff-only 'upstream-pr/27718'
git switch 'upstream-pr/27718'
git rebase 'main'
git switch 'main'
git merge --no-ff 'upstream-pr/27718'
git switch 'main'
git merge --squash 'upstream-pr/27718'
git switch 'main'
git merge --ff-only 'upstream-pr/27718'
git switch 'main'
git merge 'upstream-pr/27718'
git push origin 'main'
Sign in to join this conversation.
No reviewers
No labels
No milestone
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.

Reference
boykopovar/AnyPS5!27718
No description provided.