Prevent false GPU passes from shared test work directories #1966
Closed
leonida/mandy
lgr123 wants to merge 0 commits from
lgr123/gpu-test-work-ownership into main
pull from: lgr123/gpu-test-work-ownership
merge into: leonida:main
leonida:main
leonida:github-pr/3295
leonida:beta
leonida:docs/changelog-3483-3500
leonida:github-pr/3294
leonida:github-pr/2975
leonida:github-pr/2815
leonida:feat/gate-driver-start
leonida:feat/skip-pipelines-release
leonida:perf/lazy-compare
leonida:perf/mwaitx-wait
leonida:test/prio-ceiling-main
leonida:fix/ab-cpu-stdout
leonida:fix/gate-old-crashes
leonida:diag/ab-cpu
leonida:test/main-0312
leonida:github-pr/3291
leonida:diag/indirect-clamp-census
leonida:feat/barrier-enhanced
leonida:perf/texture-frame-ceiling
leonida:perf/dstorage-threads
leonida:fix/console-queue-dma-tables
leonida:fix/port-descriptors-record-parts
leonida:fix/frame-waits-fence
leonida:fix/console-sampler-words
leonida:fix/graphics-userdata-spill
leonida:fix/xg-reserved-layout-rotation
leonida:fix/barrier-console-flags
leonida:fix/switches-wait-test-child
leonida:test/list-value-waits
leonida:test/lot-gxdk-0412
leonida:fix/bvh-compacted-size
leonida:docs/i18n-quickstarts
leonida:feat/native-pipeline-slots
leonida:fix/clippy-leonida-gpu
leonida:fix/list-value-producers
leonida:fix/descriptor-page-straddle
leonida:fix/xmem-low-window
leonida:fix/ffx-jitter-never-zero
leonida:fix/run-stdout-closed
leonida:github-pr/2892
leonida:github-pr/2896
leonida:feat/warm-save-every
leonida:github-pr/2980
leonida:github-pr/2994
leonida:github-pr/3005
leonida:github-pr/3010
leonida:github-pr/3136
leonida:github-pr/3303
leonida:github-pr/3220
leonida:github-pr/3143
leonida:github-pr/3330
leonida:github-pr/3226
leonida:github-pr/3187
leonida:carry/3395
leonida:github-pr/2946
leonida:github-pr/2947
leonida:github-pr/2945
leonida:github-pr/2983
leonida:github-pr/3001
leonida:github-pr/3372
leonida:github-pr/3128
leonida:github-pr/3296
leonida:github-pr/2588
leonida:github-pr/3119
leonida:github-pr/3378
leonida:fix/crash-diagnostics
leonida:feat/dlss-mip-bias
leonida:fix/retired-out-of-order
leonida:fix/dxr-postbuild-barrier
leonida:fix/amd-relay-default
leonida:fix/removed-report-wait
leonida:feat/heap-twin
leonida:feat/vram-margin
leonida:github-pr/2472
leonida:github-pr/3123
leonida:github-pr/3088
leonida:assets/annonce-v1
leonida:github-pr/2794
leonida:github-pr/3300
leonida:github-pr/3304
leonida:github-pr/3308
leonida:github-pr/3367
leonida:github-pr/3369
leonida:fix/launcher-dlss-diagnostics
leonida:github-pr/3269
leonida:github-pr/2957
leonida:github-pr/3205
leonida:fix/crash-zero-guard
leonida:github-pr/3185
leonida:github-pr/3099
leonida:github-pr/3104
leonida:github-pr/3348
leonida:github-pr/3379
leonida:github-pr/3377
leonida:perf/darner-title-priority-ceiling
leonida:github-pr/3376
leonida:gh-readonly-queue/main/pr-3311-b5c45b663dbc5a9c3532bb3f307e5f81b32faefa
leonida:gh-readonly-queue/main/pr-3088-af22e7847ff5808f72d1a1881c24be2fafd20b54
leonida:gh-readonly-queue/main/pr-3123-7f3fa026a94c6646e89244f28e1ce22290361867
leonida:github-pr/3373
leonida:github-pr/3368
leonida:github-pr/3198
leonida:gh-readonly-queue/main/pr-3354-637baa0b77ba47222e7280b17c1a59c6a1781d57
leonida:gh-readonly-queue/main/pr-3365-d7a0e0196a43834813014b4bd3aa5502a8263b14
leonida:gh-readonly-queue/main/pr-3361-5dfe8bbd05ed12fb2f2e1718d9af77a7c5f46fd8
leonida:gh-readonly-queue/main/pr-3366-8da9148204e9d12c585efa9ac2b7cc1ab08c7682
leonida:github-pr/3346
leonida:github-pr/3375
leonida:github-pr/2958
leonida:github-pr/3151
leonida:github-pr/3307
leonida:github-pr/3278
leonida:github-pr/3374
leonida:fix/runtime-test-conservative-fixtures
leonida:github-pr/3366
leonida:ci/shard-semantic-linux
leonida:github-pr/3354
leonida:docs/fg-limit-fps-switch
leonida:github-pr/3365
leonida:fix/read-file-hard-link
leonida:github-pr/3364
leonida:fix/book-slot-heap-never-read
leonida:github-pr/3361
leonida:github-pr/3263
leonida:github-pr/3360
leonida:github-pr/3353
leonida:github-pr/3331
leonida:fix/alias-later-queued-submissions
leonida:github-pr/3352
leonida:github-pr/3228
leonida:github-pr/3349
leonida:claude/gallant-sagan-aamatr
leonida:github-pr/3200
leonida:github-pr/3132
leonida:github-pr/3323
leonida:github-pr/3332
leonida:github-pr/3340
leonida:github-pr/3311
leonida:github-pr/3334
leonida:github-pr/3297
leonida:github-pr/3256
leonida:github-pr/2567
leonida:github-pr/2851
leonida:d3d12/agility-sdk-621
leonida:github-pr/3164
leonida:github-pr/3114
leonida:github-pr/3050
leonida:github-pr/3113
leonida:github-pr/3326
leonida:github-pr/3144
leonida:github-pr/2642
leonida:github-pr/3072
leonida:github-pr/2789
leonida:github-pr/2643
leonida:github-pr/3009
leonida:github-pr/3035
leonida:github-pr/3031
leonida:github-pr/2686
leonida:github-pr/2834
leonida:github-pr/3321
leonida:github-pr/3325
leonida:github-pr/3290
leonida:github-pr/3324
leonida:github-pr/3130
leonida:claude/fervent-curie-m19lnr
leonida:github-pr/3309
leonida:github-pr/3305
leonida:github-pr/3306
leonida:github-pr/3302
leonida:github-pr/3301
leonida:github-pr/3345
leonida:github-pr/3211
leonida:github-pr/3027
leonida:github-pr/3286
leonida:github-pr/3235
leonida:github-pr/3265
leonida:github-pr/3275
leonida:codex/skip-no-hit-ray-passes
leonida:github-pr/2823
leonida:github-pr/2911
leonida:github-pr/3262
leonida:github-pr/3125
leonida:github-pr/3206
leonida:github-pr/3250
leonida:github-pr/3238
leonida:github-pr/3188
leonida:github-pr/2952
leonida:github-pr/3217
leonida:github-pr/3168
leonida:t3/preserve-fsr-sdk-restart-path
leonida:t3/propagate-host-failure-hresult
leonida:github-pr/3209
leonida:t3/launcher-custom-parameters
leonida:github-pr/3207
leonida:github-pr/3183
leonida:github-pr/3160
leonida:github-pr/3201
leonida:ci/less-to-run
leonida:github-pr/2930
leonida:github-pr/2797
leonida:github-pr/2999
leonida:perf/native-compute-shader-forms
leonida:github-pr/3191
leonida:github-pr/3011
leonida:github-pr/3019
leonida:github-pr/2996
leonida:gh-readonly-queue/main/pr-2789-45dc41f95c1cd0dcc29c2c50582e0e9af8a77259
leonida:claude/blissful-franklin-ukp7ag
leonida:github-pr/3141
leonida:github-pr/3156
leonida:github-pr/3150
leonida:github-pr/3153
leonida:github-pr/3163
leonida:github-pr/3142
leonida:github-pr/3139
leonida:github-pr/2841
leonida:github-pr/3069
leonida:github-pr/3098
leonida:github-pr/3107
leonida:github-pr/3071
leonida:github-pr/2774
leonida:github-pr/2889
leonida:github-pr/3075
leonida:github-pr/2661
leonida:github-pr/3064
leonida:github-pr/3054
leonida:github-pr/3049
leonida:github-pr/2855
leonida:github-pr/2943
leonida:github-pr/3016
leonida:github-pr/2887
leonida:github-pr/3006
leonida:github-pr/3003
leonida:github-pr/2993
leonida:notes/card-time-and-plant-flicker
leonida:github-pr/2989
leonida:feat/vulkan-rs
leonida:github-pr/2985
leonida:github-pr/2951
leonida:github-pr/2982
leonida:github-pr/752
leonida:github-pr/792
leonida:github-pr/2877
leonida:github-pr/2654
leonida:github-pr/2893
leonida:github-pr/2948
leonida:github-pr/2944
leonida:github-pr/2919
leonida:github-pr/2915
leonida:archive/ci/less-to-run/20261202T1121Z
leonida:github-pr/2800
leonida:github-pr/2822
leonida:github-pr/2833
leonida:github-pr/2840
leonida:github-pr/2831
leonida:github-pr/2832
leonida:github-pr/2801
leonida:github-pr/2890
leonida:github-pr/2891
leonida:github-pr/2664
leonida:github-pr/2807
leonida:rt-call-trace
leonida:github-pr/2755
leonida:perf/ahead-split
leonida:github-pr/2587
leonida:github-pr/2698
leonida:github-pr/2609
leonida:github-pr/3219
leonida:docs/readme-runtime-proposal
leonida:github-pr/2017
leonida:github-pr/1741
leonida:github-pr/1667
leonida:codex/coord-claim-check-20261124-7e48
No reviewers
Assignees
Clear assignees
No assignees
Labels
Clear labels
bug
Something isn't working
dependencies
Pull requests that update a dependency file
documentation
Improvements or additions to documentation
enhancement
New feature or request
missing claim
Needs a claim in #14
needs rebase
Conflicts with the base branch: rebase it on main
needs-triage
Needs maintainer evaluation before the next triage state
question
Further information is requested
ready-for-agent
Fully specified and ready for an AFK agent
submodules
Pull requests that update submodules code
No labels
bug
dependencies
documentation
enhancement
missing claim
needs rebase
needs-triage
question
ready-for-agent
submodules
Projects
Clear projects
No items
No project
Milestone
Clear milestone
No items
No milestone
Dependencies
No dependencies set
Notifications
1 participant
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".
No due date set.
Reference
leonida/mandy!1966
Loading…
Reference in a new issue
No description provided.
Delete branch "lgr123/gpu-test-work-ownership"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Pull request closed
This pull request cannot be reopened because the branch was deleted.
Claimed as GPU-TEST-WORK-OWNERSHIP.
Two GPU test runs sharing explicit
--workcan produce a false PASS. In the reproduction, a failing syntheticcs_ldstest reported0/1 passedwhen run alone and1/1 passedwhen a second process replaced its module before it was checked. This reproduced on native Windows and Linux.The patched CLI reserves an explicit work directory until validation finishes. A second patched run targeting that directory exits before changing any artifacts. Give simultaneous runs separate work directories when mixing versions. An older runner can still overwrite artifacts because it does not acquire the lock. Sequential replay keeps the same artifact paths. The empty lock file stays in the directory so contenders lock the same file, and the OS releases the lock when its handle closes. The testing guide now documents separate directories for simultaneous runs.
Independent Radeon 780M verification reproduced the false PASS with real shaders, checked that two patched runners cannot race, and verified sequential reuse.
Reviewer check
python -I tests/test_run_gpu_tests_paths.py WorkDirectory.test_simultaneous_cli_runs_cannot_share_an_explicit_work_directoryThe regression exercises the CLI with a second process, a separate work directory, and a retry after the owner exits with a failed result. It requires no GPU, Wine, or game files.
Tested
GPUs tested: n/a.
AI-assisted: yes.
Checklist
Independent verification on a real GPU (AMD Radeon 780M, Windows 11), including a reproduction of the false PASS.
Machine. AMD Radeon 780M Graphics (RDNA3 iGPU, gfx1103), AMD proprietary 26.10.2 (LLPC), Vulkan 1.4.359, Windows 11 10.0.29712. Python 3.13.17, llvm-mc 23.1.6, CMake 4.5.1 + Ninja, llvm-mingw clang++ 23.1.6. Built
mainatfe1553456(targetsvk_compute_test,vk_store_test,vk_harness).Your reviewer check passes here.
The whole file (
tests/test_run_gpu_tests_paths.py) runs 22 tests in 18.637s, all OK.The false PASS reproduces on
mainwith a real GPU, and your fix stops it (run 4; see the scope note below for the mixed-runner case). I used the repo's owncs_imgatomic_extcase: on this GPU it fails onmainand passes with #1518's two changed lines (s12ands15inruntime/test/shaders/cs_imgatomic_ext.asm) applied, so two checkouts of the same repository produce two different modules for the same test name.mainalone,--filter cs_imgatomic:FAIL cs_imgatomic_ext 6 of 64 sint words differ; first word 32: got 0x0badf00d, expected 0x00000101,2/3 passed, exit 1.#1518 alone, same filter:
PASS cs_imgatomic_ext,3/3 passed, exit 0.Both at once on the same
--work, both runs using the unpatchedmainrunner - the first run from themaincheckout, the second from the #1518 checkout, started 1.0 s after the first: the first run reportedPASS cs_imgatomic_extand3/3 passedwith exit 0 - the verdict of the module it did not produce. The sharedspirv/cs_imgatomic_ext.spvchanged content 0.96 s after the first run wrote it (hash3554efc44f74->fd38b80f527e), so it was replaced before it was checked.The same race with your runner on both sides: the second run exited 2 with
and printed no
shaders:line, so it exited before the translation step. The first run kept the trueFAIL(2/3 passed, exit 1) and its module was written only once.Two sequential runs on one
--workwith your runner both ran normally (2/3 passed, exit 1), so sequential reuse of a work directory still works.One scope note. The lock is cooperative. In a race between your runner and a second run of an unpatched CLI on the same
--work, the second run was not refused - it printed3 shaders: 3 translated, 3 pass spirv-val- and the first run again reported the false3/3 passed, with the shared.spvhash changing twice 0.947 s apart. The race this lock covers is CLI-versus-CLI, and run 4 shows it closes that case; a process that does not take the lock can still replace the module, so the lock is not a sandbox for the directory. Not a blocker for me; it is where the guarantee ends.Two smaller notes.
docs/testing.mddescribes the flag as "--filter <text>runs only matching tests, and--work <dir>keeps the intermediate files" and does not say that a--workdirectory serves one run at a time. Your new--helptext does ("artifact directory to keep for replay; one run can use it at a time"), but that is only visible to someone who reads the help output. One sentence indocs/testing.mdwould put the caveat where people read it (that file has no translation copies, so it stays one sentence in one place)..github/workflows/runtime.ymluses four different work directories ($RUNNER_TEMP/gpu-native,gpu-w64,gpu-bary,gpu), so no two CI steps share one and the workflow needs no change. If a future step does share one, the lock will make it exit with the lock error instead of racing silently.For the record on our own numbers. Every GPU run behind our published 780M record used
--build(and sometimes--filter) and never--work, so each of those runs had its owntempfile.mkdtemp(prefix="leonida_gpu_tests_")directory. Those results are not affected by this.Untested question, in case someone has a
--workdirectory on a network share: if the lock call cannot succeed there, a single run would presumably be refused with the same "cannot lock" message. I did not test a share.Thanks for this! Locking the
--workfolder so two GPU test runs cannot report a false PASS from each other's files is worth having.During maintainer testing (local, 2026-11-28) (head 99228f11f, merged on main b1619e0a3 / 6dfca6428, Windows 11, Python tests via pytest/unittest) we found:
tests/test_native_tool_paths.py::MainUsesTheNativeFolder::test_the_suite_runs_in_the_native_spellingfails with this PR alone on main: the lock is taken before the work folder exists ("cannot lock GPU test directory ... No such file or directory", with a non-ASCII work path).To get this merged:
--workfolder before taking the lock (the test expects it to exist before its native spelling is asked for).tests/test_native_tool_paths.pybefore pushing.AI-assisted (Claude Code), posted for DadaCap (maintainer).
Independent verification on Windows 11 (
10.0.26200, x64) with99228f11famerged ontoorigin/main(53b77df14f,0merge conflicts), tested under bothPython 3.12.10andPython 3.14.5:tests/test_run_gpu_tests_paths.py):origin/mainscripts/run_gpu_tests.py+#1966test file):Ran 22 tests,FAILED (failures=1)(test_simultaneous_cli_runs_cannot_share_an_explicit_work_directory).99228f11famerged ontoorigin/main):python -I -B tests/test_run_gpu_tests_paths.pypasses24/24on bothPython 3.12.10(4.64 s) andPython 3.14.5(5.26 s).#7235877447):python -I -B tests/test_native_tool_paths.pystill failsMainUsesTheNativeFolder.test_the_suite_runs_in_the_native_spelling(AssertionError: 2 != 0) on99228f11fa + origin/mainacross bothPython 3.12.10andPython 3.14.5becausehold_work_directory(native)opens.gpu-tests.lockbeforeworkexists.os.makedirs(work, exist_ok=True)before opening.gpu-tests.lock(or creatingworkbeforenativeresolution as noted in#7235877447) makespython -I -B tests/test_native_tool_paths.pypass14/14(OK (skipped=4)).git diff --checkandpython -I scripts/check_no_game_data.pyon all 3 touched files exited0, andgit merge-treewith#1839is clean (0conflicts).AI-assisted.
Verified by OreoFR on macOS 27.2.1 (26B131), Apple M5, APFS (case-insensitive), Python 3.12.16, main 4364a4fa6, PR head 99228f11f : red 1 failure / green 24 OK, but 1 neighbour regression
git merge-tree). Reviews: none. No game data.tests/test_run_gpu_tests_paths.py(+31 lines) since the PR base, so red = the merged test file against main's code: 24 tests, 1 failure:WorkDirectory::test_simultaneous_cli_runs_cannot_share_an_explicit_work_directory. Green: 24/24 OK.tests/test_native_tool_paths.py::MainUsesTheNativeFolder::test_the_suite_runs_in_the_native_spelling—AssertionError: 2 != 0.native_folderto return a fake path (C:\WORK-1~1) that does not exist; the newhold_work_directory(native)opens<native>/.gpu-tests.lockthere, gets an OSError, and the command exits 2. Probably platform-independent (ASSUMED; only checked on macOS).workinstead ofnative, or adapt that test.tests/test_*.pyusingrun_gpu_tests): the 6 failures already on main are identical on the merge.Verdict: FAILS (needs a rebase on current main and the lock path / test fixed).
AI-assisted: Claude Code
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.