Skip to content

d3d12_bindless_churn_test: a scratch folder of its own process (the two ctest entries raced on one folder) - #6184

Open
Exopus-0x65f7ad0 wants to merge 1 commit into
ItsNotRexed:mainfrom
Exopus-0x65f7ad0:test/bindless-churn-scratch
Open

Exopus-0x65f7ad0 wants to merge 1 commit into
ItsNotRexed:mainfrom
Exopus-0x65f7ad0:test/bindless-churn-scratch

Conversation

@Exopus-0x65f7ad0

Copy link
Copy Markdown
Contributor

Claimed in the coordination issue: #5581 (comment)

What and why

d3d12_bindless_churn_validated fails now and then under ctest -j, with line 142: SUCCEEDED(device->CreateComputePipelineState(&pso_desc, IID_PPV_ARGS(&pso.p))). The cause isn't the layer. runtime/CMakeLists.txt registers the same program twice (d3d12_bindless_churn and d3d12_bindless_churn_validated --validated), and ctest runs the two at once. Both wrote the translated shader and its index into a fixed %TEMP%\leonida_bindless_churn_test and remove_all'd it at the end. So the first to finish could delete the other's shader before that one created its PSO.

The test now uses testfiles::ScratchDir from test_temp_dir.h: a per-process folder name, emptied on creation and removed on exit, as the other GPU tests use. It also uses testfiles::copy_file, which reports a failed copy instead of throwing. Of the ten tests with a fixed-name temp folder, this is the only one registered twice, so it's the only one that can race. The others are left as they are.

Tested

RTX 5060 Ti / 621.14, Windows 11 26300, MSVC 14.51, Vulkan SDK 1.4.363.0, LEONIDA_VK_VALIDATION=1, the two tests together (ctest -R ^d3d12_bindless_churn -j2):

paired runs with a failure
main 561b65a8 3 of 20 (the CreateComputePipelineState line above)
this change 0 of 40

On main it also showed up in 1 of 3 full ctest -j8 runs. No leonida_bindless_churn_test* folder is left behind afterwards.

No game files. AI-assisted (Claude Code, Claude Opus 5.5).

ctest runs this program twice at once (d3d12_bindless_churn and d3d12_bindless_churn_validated). Both
wrote the translated shader into a fixed %TEMP%\leonida_bindless_churn_test and remove_all'd it at the
end, so the first to finish could delete the other's shader before its PSO was created:
"line 142: SUCCEEDED(device->CreateComputePipelineState(...))" under ctest -j. It now uses
testfiles::ScratchDir (a per-process name, removed on exit) and testfiles::copy_file.

RTX 5060 Ti, LEONIDA_VK_VALIDATION=1, the two tests at -j2: main 3 of 20 paired runs fail, this
change 0 of 40.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@shdann

shdann commented Nov 23, 2026

Copy link
Copy Markdown
Contributor

Tested cc7e07d on Windows 11 with Vulkan validation: pass on NVIDIA GeForce RTX 4090 (32.0.16.2101) and AMD Radeon(TM) Graphics (32.0.21043.5001).

I built the RelWithDebInfo target on the head and parent 561b65a. On each GPU I ran both churn tests together four times per revision. All 16 individual tests passed on each revision. The intermittent pipeline failure did not occur in this sample.

I checked the directories while the processes were running. On the parent, two live test processes shared one leonida_bindless_churn_test directory. On the head, processes 21512 and 30188 each had a directory with its own PID suffix. This confirms the change isolates concurrent shader files.

Commands for each build:

  • cmake --build <build> --config RelWithDebInfo --target d3d12_bindless_churn_test -j 8
  • ctest --test-dir <build> -C RelWithDebInfo -R "^d3d12_bindless_churn(_validated)?$" -j2 -V

I set LEONIDA_VK_VALIDATION=1. For NVIDIA I used LEONIDA_VK_DEVICE=4090 and VK_LOADER_DRIVERS_DISABLE=amd. For AMD I used Radeon and nv. Both test programs printed the selected adapter and confirmed validation. The runs used synthetic test shaders.

AI-assisted.

@larpinguser larpinguser left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Summary: runtime/test/d3d12_bindless_churn_test.cpp replaces the fixed %TEMP%\leonida_bindless_churn_test folder with testfiles::ScratchDir, copies the shader via testfiles::copy_file, and drops the manual remove_all (the RAII object cleans up). The two ctest registrations of this program previously deleted each other's shader mid-run.

Why merge: Removes an intermittent CreateComputePipelineState failure under ctest -j without touching any other GPU test's temp-folder handling.

Verdict: Approve

@larpinguser

Copy link
Copy Markdown

Summary: runtime/test/d3d12_bindless_churn_test.cpp replaces the fixed %TEMP%\leonida_bindless_churn_test folder with testfiles::ScratchDir, copies the shader via testfiles::copy_file, and drops the manual remove_all (the RAII object cleans up). The two ctest registrations of this program previously deleted each other's shader mid-run.

Why merge: Removes an intermittent CreateComputePipelineState failure under ctest -j without touching any other GPU test's temp-folder handling.

Verdict: Approve

@JRamos1993

JRamos1993 commented Nov 23, 2026 •

Copy link
Copy Markdown
Contributor

Tested cc7e07d merged onto main 1cc6e3c on an RTX 5090 (driver 621.24), Windows 11, MSVC 19.44, Vulkan SDK 1.4.363, RelWithDebInfo:

  • Full ctest: 258/259. The failures main 1cc6e3c also has without this PR: d3d12_indirect_dispatch_count.
  • d3d12_bindless_churn and d3d12_bindless_churn_validated: pass 11 of 11 runs each, and pass under LEONIDA_VK_VALIDATION=1 with 0 validation messages.
  • Warnings: none new in the files this PR changes.

AI-assisted (Claude Code).

@myokex

myokex commented Nov 23, 2026

Copy link
Copy Markdown

Tested cc7e07d73: pass, fixes the race here. Windows 11, AMD Radeon RX 7800 XT (driver 32.0.32029.2010), MSVC 2022 RelWithDebInfo, Vulkan SDK 1.4.363.0, merged onto main dde82f27e. Stress: 6 copies of d3d12_bindless_churn_test.exe started at once, 5 rounds (30 runs), which is what ctest -j does to its two entries (d3d12_bindless_churn, _validated, same program).

build failed runs at
main 2/30 (and 4/18 in an earlier 6x3 round) line 142: SUCCEEDED(device->CreateComputePipelineState(...)), every time
#6221 a06dcc044 0/30
#6184 cc7e07d73 0/30

No leonida_bindless_churn_test* folder was left in %TEMP% after either. This is the "failed once under load" seen in #166; on this card it also showed up as a one-off d3d12_bindless_churn failure in several full ctest -j8 runs of unrelated PRs.

Both fix it; this one also removes the folder on early returns (ScratchDir) and reports a failed copy instead of throwing. Synthetic, no game files. AI-assisted (Claude Code).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants