docs/testing: LEONIDA_SHADERS changes which tests pass, not just which run #2806

Closed
fiestorra wants to merge 1 commit from upstream-pr/2806 into main
fiestorra commented 2026-12-01 00:30:03 +00:00 (Migrated from github.com)

Imported from ubiquitarianism/leonida. Originally posted by fiestorra on 2026-12-01T00:30:03Z.


LEONIDA_SHADERS changes which tests pass, not just which tests run. docs/testing.md warns that a passing ctest percentage does not establish that the tests ran; this adds the other half of that sentence, because it cost me two false regression reports in one evening.

What happened, on main cd9fe51a9, Release, serial, this machine:

with LEONIDA_SHADERS and LEONIDA_SHADER_DXBC exported (I had them set for shader_library_corpus):
  575 ran, 99% passed, 4 failed
    11:display_white_cache   329:d3d12_r9g9b9e5_uav   355:d3d12_descriptor   399:xbox_present

from a shell with neither set:
  575 ran, 99% passed, 1 failed
    399:xbox_present

And the two in the middle, re-run both ways:

d3d12_r9g9b9e5_uav   with the variable: FAILED 2.28 s     without: Passed 0.23 s
d3d12_descriptor     with the variable: FAILED 2.35 s     without: Passed 0.31 s

Both binaries print OK and 0 validation errors when run directly, so it is not the test being flaky - it is the environment changing what it tests. display_white_cache is a different thing: its own assertion races the scheduler (about 1 in 1000 runs here, written up in #2713), and I mention it only because it landed in the same run and would otherwise look like a third environment effect.

The paragraph added, after the existing warning:

LEONIDA_SHADERS is one environment variable that changes which tests pass, not just which ones run. It is what shader_library_corpus reads, and d3d12_descriptor and d3d12_r9g9b9e5_uav also pick up whatever it names. Set the variable for the corpus test only, or pass it on that test's command line, so the rest of the suite runs in the environment it was written for.

Why a doc and not a code change: I do not know why those two tests read it - they may load the library deliberately, and making them ignore it could remove a check. The honest fix tonight is to say what happens, and if the coupling is unintended, that is a separate change its authors should make.

docs-only, +9/-0, one file, no code.

AI-assisted: yes - DeepSeek v4.1 (flash), which is also what ran the suite both ways.

Written with an AI assistant.

<!-- greyfinch-sync:ubiquitarianism/leonida:issue:5576390568 --> Imported from [ubiquitarianism/leonida](https://github.com/ProjectLeonida/mandy/pull/2806). Originally posted by [fiestorra](https://github.com/fiestorra) on 2026-12-01T00:30:03Z. --- **`LEONIDA_SHADERS` changes which tests pass, not just which tests run. `docs/testing.md` warns that a passing `ctest` percentage does not establish that the tests ran; this adds the other half of that sentence, because it cost me two false regression reports in one evening.** **What happened, on `main` `cd9fe51a9`, Release, serial, this machine:** ``` with LEONIDA_SHADERS and LEONIDA_SHADER_DXBC exported (I had them set for shader_library_corpus): 575 ran, 99% passed, 4 failed 11:display_white_cache 329:d3d12_r9g9b9e5_uav 355:d3d12_descriptor 399:xbox_present from a shell with neither set: 575 ran, 99% passed, 1 failed 399:xbox_present ``` **And the two in the middle, re-run both ways:** ``` d3d12_r9g9b9e5_uav with the variable: FAILED 2.28 s without: Passed 0.23 s d3d12_descriptor with the variable: FAILED 2.35 s without: Passed 0.31 s ``` **Both binaries print `OK` and `0 validation errors` when run directly**, so **it is not the test being flaky - it is the environment changing what it tests.** **`display_white_cache` is a different thing**: **its own assertion races the scheduler** (about 1 in 1000 runs here, written up in #2713), **and I mention it only because it landed in the same run and would otherwise look like a third environment effect.** **The paragraph added**, after the existing warning: > `LEONIDA_SHADERS` is one environment variable that changes which tests pass, not just which ones run. It is what `shader_library_corpus` reads, and `d3d12_descriptor` and `d3d12_r9g9b9e5_uav` also pick up whatever it names. **Set the variable for the corpus test only, or pass it on that test's command line**, so the rest of the suite runs in the environment it was written for. **Why a doc and not a code change:** **I do not know why those two tests read it** - **they may load the library deliberately, and making them ignore it could remove a check.** **The honest fix tonight is to say what happens**, **and if the coupling is unintended, that is a separate change its authors should make.** **`docs-only`, `+9/-0`, one file, no code.** **AI-assisted:** yes - DeepSeek v4.1 (flash), which is also what ran the suite both ways. Written with an AI assistant.
OreoFR commented 2026-12-01 00:43:00 +00:00 (Migrated from github.com)

Imported from ubiquitarianism/leonida. Originally posted by OreoFR on 2026-12-01T00:43:00Z.


Read by OreoFR on macOS 27.2.1, Apple M5, head 97691daa2, main b7a1be296. This PR only changes the docs (docs/testing.md, +9).

READ IN CODE

  • LEONIDA_SHADERS is read on main in the runtime shims, among them runtime/shims/d3d12_xs_device.cpp, d3d12_vulkan_device.cpp, d3d12_precompile.h and runtime/src/shader_directory.h.
  • d3d12_descriptor and d3d12_r9g9b9e5_uav link gta6rt_d3d12_com (runtime/CMakeLists.txt:3337 for the latter), which contains those shims. So it is plausible that they pick the variable up, as the paragraph says.
  • shader_library_corpus is its own test (CMakeLists.txt:1742-1745, skip code 77, 1 h timeout).

ASSUMED

  • The four-failures-versus-one observation is from your machine (it is Windows-only: those tests are under the MSVC block). Not reproduced here. The advice (set the variable for the corpus test only) is sound either way.

AI-assisted: Claude Code

<!-- greyfinch-sync:ubiquitarianism/leonida:comment:7296652917 --> Imported from [ubiquitarianism/leonida](https://github.com/ProjectLeonida/mandy/pull/2806#issuecomment-7296652917). Originally posted by [OreoFR](https://github.com/OreoFR) on 2026-12-01T00:43:00Z. --- Read by OreoFR on macOS 27.2.1, Apple M5, head `97691daa2`, main `b7a1be296`. This PR only changes the docs (`docs/testing.md`, +9). **READ IN CODE** - `LEONIDA_SHADERS` is read on main in the runtime shims, among them `runtime/shims/d3d12_xs_device.cpp`, `d3d12_vulkan_device.cpp`, `d3d12_precompile.h` and `runtime/src/shader_directory.h`. - `d3d12_descriptor` and `d3d12_r9g9b9e5_uav` link `gta6rt_d3d12_com` (`runtime/CMakeLists.txt:3337` for the latter), which contains those shims. So it is plausible that they pick the variable up, as the paragraph says. - `shader_library_corpus` is its own test (`CMakeLists.txt:1742-1745`, skip code 77, 1 h timeout). **ASSUMED** - The four-failures-versus-one observation is from your machine (it is Windows-only: those tests are under the MSVC block). Not reproduced here. The advice (set the variable for the corpus test only) is sound either way. AI-assisted: Claude Code
KelboLive commented 2026-12-01 05:42:48 +00:00 (Migrated from github.com)

Imported from ubiquitarianism/leonida. Originally posted by KelboLive on 2026-12-01T05:42:48Z.

Review: COMMENTED


The mechanism checks out: a device created with an empty VulkanDeviceInfo::shader_dir loads whatever LEONIDA_SHADERS names (d3d12_vulkan_device.cpp:12263, with the count printed at :12267-12281), and both tests you cite leave it empty (d3d12_descriptor_test.cpp:330-347, d3d12_r9g9b9e5_uav_test.cpp:385-399). shader_library_corpus_test.cpp:121-124 is the registered-but-skipping one (SKIP_RETURN_CODE 77), so the variable changes pass/skip, not collection — the title is right.

But the enumeration is a big understatement, and that is the part that will rot: 95 of the 138 test files that call create_vulkan_device never set info.shader_dir, so on a shell with the variable exported they all load the corpus — d3d12_a8_copy, d3d12_clear_formats, d3d12_existing_heap, xbox_present_test and ninety-odd more. Please state the rule ("any test whose VulkanDeviceInfo leaves shader_dir empty") and give these two as examples.

Two smaller fixes:

  • display_white_cache is listed among the four failures, but your own description calls it an unrelated scheduler race (#2713). As written, a reader will blame the variable — drop it from the list or label it.
  • "Pass it on that test's command line" does not work: shader_library_corpus_test.cpp:120 is int main() and add_test passes no arguments — only the environment (or an env prefix) works. And the corpus test also reads LEONIDA_SHADER_DXBC and defaults to ../dxbc (:126-127), not just LEONIDA_SHADERS.

Otherwise the advice is worth having: run_gpu_tests.py never sets the variable, so a reader who exported it for the game gets exactly the false regression you describe. No test guards prose in this page (tests/test_docs_design_rows.py only checks table shape), which is another reason to state the rule rather than a list.

<!-- greyfinch-sync:ubiquitarianism/leonida:review:6125770109 --> Imported from [ubiquitarianism/leonida](https://github.com/ProjectLeonida/mandy/pull/2806#pullrequestreview-6125770109). Originally posted by [KelboLive](https://github.com/KelboLive) on 2026-12-01T05:42:48Z. **Review:** COMMENTED --- The mechanism checks out: a device created with an empty `VulkanDeviceInfo::shader_dir` loads whatever `LEONIDA_SHADERS` names (`d3d12_vulkan_device.cpp:12263`, with the count printed at `:12267-12281`), and both tests you cite leave it empty (`d3d12_descriptor_test.cpp:330-347`, `d3d12_r9g9b9e5_uav_test.cpp:385-399`). `shader_library_corpus_test.cpp:121-124` is the registered-but-skipping one (`SKIP_RETURN_CODE 77`), so the variable changes pass/skip, not collection — the title is right. But the enumeration is a big understatement, and that is the part that will rot: **95 of the 138 test files that call `create_vulkan_device` never set `info.shader_dir`**, so on a shell with the variable exported they all load the corpus — `d3d12_a8_copy`, `d3d12_clear_formats`, `d3d12_existing_heap`, `xbox_present_test` and ninety-odd more. Please state the rule ("any test whose `VulkanDeviceInfo` leaves `shader_dir` empty") and give these two as examples. Two smaller fixes: - `display_white_cache` is listed among the four failures, but your own description calls it an unrelated scheduler race (#2713). As written, a reader will blame the variable — drop it from the list or label it. - "Pass it on that test's command line" does not work: `shader_library_corpus_test.cpp:120` is `int main()` and `add_test` passes no arguments — only the environment (or an env prefix) works. And the corpus test also reads `LEONIDA_SHADER_DXBC` and defaults to `../dxbc` (`:126-127`), not just `LEONIDA_SHADERS`. Otherwise the advice is worth having: `run_gpu_tests.py` never sets the variable, so a reader who exported it for the game gets exactly the false regression you describe. No test guards prose in this page (`tests/test_docs_design_rows.py` only checks table shape), which is another reason to state the rule rather than a list.
aegish-zagi commented 2026-12-01 14:37:43 +00:00 (Migrated from github.com)

Imported from ubiquitarianism/leonida. Originally posted by aegish-zagi on 2026-12-01T14:37:43Z.


Verification — VERIFY-2806

Verdict: PASS

  • PR: #2806 | head sha: 97691daa29270bec0f7cd41fd1bca9220a5ca521 | merge state vs main: clean merge with current main cd0c52fcf in a scratch worktree (docs/testing.md auto-merged, no conflicts)
  • Diff audited: docs-only — one paragraph in docs/testing.md stating LEONIDA_SHADERS changes which tests pass, not just which run, naming shader_library_corpus, d3d12_descriptor and d3d12_r9g9b9e5_uav, with the measured four-vs-one failure comparison and the advice to scope the variable to the corpus test.
  • Claim checked READ IN CODE: LEONIDA_SHADERS is genuinely read by the runtime/device code (runtime/shims/d3d12_vulkan_device.cpp, d3d12_xs_device.cpp, runtime/src/main.cpp) and shader_library_corpus is wired in runtime/CMakeLists.txt, so the mechanism the paragraph describes exists as written. The specific failure counts are the author's measurement on a GPU/Windows host — not reproducible on this no-GPU Linux host, stated as a limit.
  • Tests run (Linux, Python 3.12.3, python -I): on the merged PR, tests/test_docs_env_vars.py, tests/test_docs_repo_paths.py and tests/test_docs_links.py all OK — the new paragraph introduces no stale path, link or env-var documentation error. Docs-only change, so no red/green pair applies.

AI-assisted: yes (Muse Wonder, Muse by Meta)

<!-- greyfinch-sync:ubiquitarianism/leonida:comment:7314567580 --> Imported from [ubiquitarianism/leonida](https://github.com/ProjectLeonida/mandy/pull/2806#issuecomment-7314567580). Originally posted by [aegish-zagi](https://github.com/aegish-zagi) on 2026-12-01T14:37:43Z. --- ## Verification — VERIFY-2806 **Verdict: PASS** - PR: #2806 | head sha: `97691daa29270bec0f7cd41fd1bca9220a5ca521` | merge state vs main: clean merge with current main `cd0c52fcf` in a scratch worktree (docs/testing.md auto-merged, no conflicts) - Diff audited: docs-only — one paragraph in docs/testing.md stating `LEONIDA_SHADERS` changes which tests pass, not just which run, naming `shader_library_corpus`, `d3d12_descriptor` and `d3d12_r9g9b9e5_uav`, with the measured four-vs-one failure comparison and the advice to scope the variable to the corpus test. - Claim checked READ IN CODE: `LEONIDA_SHADERS` is genuinely read by the runtime/device code (runtime/shims/d3d12_vulkan_device.cpp, d3d12_xs_device.cpp, runtime/src/main.cpp) and `shader_library_corpus` is wired in runtime/CMakeLists.txt, so the mechanism the paragraph describes exists as written. The specific failure counts are the author's measurement on a GPU/Windows host — not reproducible on this no-GPU Linux host, stated as a limit. - Tests run (Linux, Python 3.12.3, `python -I`): on the merged PR, tests/test_docs_env_vars.py, tests/test_docs_repo_paths.py and tests/test_docs_links.py all OK — the new paragraph introduces no stale path, link or env-var documentation error. Docs-only change, so no red/green pair applies. AI-assisted: yes (Muse Wonder, Muse by Meta)
merzleckeier commented 2026-12-01 14:51:26 +00:00 (Migrated from github.com)

Imported from ubiquitarianism/leonida. Originally posted by merzleckeier on 2026-12-01T14:51:26Z.


I ran a synthetic A/B/C/D check of the two named GPU tests on cd0c52fcf with docs revision 97691daa applied. The stock Win64 Release executables ran under Wine 11.22 on Radeon Raphael (RADV 26.3.1) and RTX 4070 SUPER (620.73.04). Both shader folders contained the same hand-written no-op compute SPIR-V, with the same digest. The only difference was the module’s descriptor_hash in index.json.

Environment d3d12_descriptor_test d3d12_r9g9b9e5_uav_test
LEONIDA_SHADERS unset Pass Pass
Synthetic library, fnv1a Pass Pass
Same library, fnv1a_fmix32 Fail Fail
Same fmix library, LEONIDA_DESCRIPTOR_HASH=fnv1a Pass Pass

Every row agreed on both physical GPUs. The fmix runs explicitly logged that the library was loaded and selected fnv1a_fmix32. The descriptor test hit count == texels. The R9 test read 0 where the bindless sample expected 1. This isolates an independent way to reproduce the two failures without a translated corpus. The doc env-var, repo-path and link checks also passed. MEASURED with a synthetic shader. AI-assisted (Codex).

<!-- greyfinch-sync:ubiquitarianism/leonida:comment:7314940139 --> Imported from [ubiquitarianism/leonida](https://github.com/ProjectLeonida/mandy/pull/2806#issuecomment-7314940139). Originally posted by [merzleckeier](https://github.com/merzleckeier) on 2026-12-01T14:51:26Z. --- I ran a synthetic A/B/C/D check of the two named GPU tests on cd0c52fcf with docs revision 97691daa applied. The stock Win64 Release executables ran under Wine 11.22 on Radeon Raphael (RADV 26.3.1) and RTX 4070 SUPER (620.73.04). Both shader folders contained the same hand-written no-op compute SPIR-V, with the same digest. The only difference was the module’s descriptor_hash in index.json. | Environment | d3d12_descriptor_test | d3d12_r9g9b9e5_uav_test | | --- | --- | --- | | LEONIDA_SHADERS unset | Pass | Pass | | Synthetic library, fnv1a | Pass | Pass | | Same library, fnv1a_fmix32 | Fail | Fail | | Same fmix library, LEONIDA_DESCRIPTOR_HASH=fnv1a | Pass | Pass | Every row agreed on both physical GPUs. The fmix runs explicitly logged that the library was loaded and selected fnv1a_fmix32. The descriptor test hit count == texels. The R9 test read 0 where the bindless sample expected 1. This isolates an independent way to reproduce the two failures without a translated corpus. The doc env-var, repo-path and link checks also passed. MEASURED with a synthetic shader. AI-assisted (Codex).
aslan2142 commented 2026-12-01 17:26:35 +00:00 (Migrated from github.com)

Imported from ubiquitarianism/leonida. Originally posted by aslan2142 on 2026-12-01T17:26:35Z.


Closing this PR because the legacy C++ Vulkan runtime (and legacy Python shader compiler) is now considered deprecated in favor of the new Rust Vulkan runtime (in progress) and the Rust DX12 runtime (d3d12/) available now. Thank you for the contribution! If you believe this PR was closed by mistake (for example, if it still applies to active tools, d3d12/, or general docs), please feel free to reopen it.

<!-- greyfinch-sync:ubiquitarianism/leonida:comment:7319305504 --> Imported from [ubiquitarianism/leonida](https://github.com/ProjectLeonida/mandy/pull/2806#issuecomment-7319305504). Originally posted by [aslan2142](https://github.com/aslan2142) on 2026-12-01T17:26:35Z. --- Closing this PR because the legacy C++ Vulkan runtime (and legacy Python shader compiler) is now considered deprecated in favor of the new Rust Vulkan runtime (in progress) and the Rust DX12 runtime (`d3d12/`) available now. Thank you for the contribution! If you believe this PR was closed by mistake (for example, if it still applies to active tools, `d3d12/`, or general docs), please feel free to reopen it.

Pull request closed

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
ProjectLeonida/mandy!2806
No description provided.