cmake: generated/ exists at configure time and before vk_null_descriptor_test's rule; no "Failed to open file" on a fresh build (BUILD-NULL-DESCRIPTOR-GENERATED-DIR) #2096
Loading…
Reference in a new issue
No description provided.
Delete branch "upstream-pr/2096"
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?
Imported from ubiquitarianism/leonida. Originally posted by Tauwni on 2026-11-25T20:16:44Z.
Claimed in the coordination issue as: https://github.com/ubiquitarianism/leonida/issues/1608#issuecomment-7173420976
What and why
Since
ba626820e, a fresh macOS or Linux build of the runtime can fail at a rule that writes intogenerated/:glslangValidatorwrites${CMAKE_CURRENT_BINARY_DIR}/generated/cs_null_descriptors.spv(orcs_bindless_dimensions.spv), but nothing has createdgenerated/when that rule runs, so it stops with "ERROR: Failed to open file" and the targets and ctest runs after it fail too.Two changes, both in
runtime/CMakeLists.txt:file(MAKE_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/generated)right afterinclude(CTest), so the folder exists at configure time, before any rule runs, whatever order-jpicks.cs_null_descriptors.spvrule also runs${CMAKE_COMMAND} -E make_directoryfirst, as the other rule writing togenerated/does.Tested
On an Apple M3 (macOS 26.5.1, CMake 4.5.1, Homebrew glslangValidator), from an empty build directory:
maindb1a22d29, before:cmake --build ... --target vk_null_descriptor_testfails with "Failed to open file"; after: it builds,ctest -R vk_null_descriptorpasses, and the whole build plusctestgive 96/96 passed.main1a441d336(one with #2441, one with #1774 merged in, neither touching CMake) stopped with "Failed to open file", one atgenerated/cs_bindless_dimensions.spv, the other at bothcs_bindless_dimensions.spvandcs_null_descriptors.spv(MEASURED, 2 builds).main02f71ccfemerged into this branch, after:generated/exists right after configure,vk_null_descriptor_testandvk_bindless_dimensions_testbuild from an empty directory, andctest -R '^vk_null_descriptor$'passes (MEASURED, 1 run).c94bc3003(https://github.com/ProjectLeonida/mandy/pull/2096#pullrequestreview-6093316473), 2/2.GPUs tested: Apple M3 (MoltenVK 1.4.2), for
vk_null_descriptoronlyAI-assisted: yes (Claude Code)
Checklist
mainand merges cleanly.🤖 Generated with Claude Code
Red checks: from
main, not this changeThe failing jobs (
check,macos-python,stdlib-tests-linux,linux-gpu-tools,macos,windows) fail the same way onmaind48a957bb(MEASURED on macOS for the Python tests, 1 run, with the same assertion text; GPU tests READ from this PR's CI logs). The open pull requests that fix them:maintest_docs_cli_flagstest_make_game_preflight,test_progress_dashboard(repository URL)test_docs_repo_pathsmain, a merge is onTauwni:fix/2552-merge-main, correction)test_tool_stdout_encodingTauwni:fix/stdout-replace-two-new-scripts(no PR, open PR limit)test_windows_boot_journal_seedtest_docs_python_depstest_build_runtime_fallbackvk_bindless_dimensions(macOS)test_docs_env_varstest_make_game_pipelines,test_sampler_source_census,test_spirv_metal_set0_cli_errors,test_spirv_metal_set0_extra,tests/semantic/test_valu_cvt_f16_int16_mods.py,ps_exp_f32_denorm_rt(macOS)Tauwni/leonida, no PR (finding)cs_imgatomic_ext(macOS, linux-gpu-tools)vk_xdxr_postbuild_readback(Windows)main: mergemainNot checked by a second agent or human yet.
Imported from ubiquitarianism/leonida. Originally posted by Tauwni on 2026-11-26T11:32:49Z.
Merged
main(a73a57e13) into this branch. It is still needed there: on an Apple M3 (macOS 26.5.1), a freshcmake -S runtime -B build && cmake --build buildofmainstops atgenerated/cs_null_descriptors.spv(Error 1).ctestthen gives 106/108, withroot_signatureandvk_null_descriptorNot Run. With this one line the build finishes, and those two pass: 108/108 (3 skipped:shader_library_corpus,vk_device_markers,vk_sync_validation).AI-assisted (Claude Code).
Imported from ubiquitarianism/leonida. Originally posted by Tauwni on 2026-11-27T08:59:54Z.
Updated with
mainmerged (c94bc3003), and widened after @wavehs's finding in #1608: the othergenerated/*.spvrules also only worked because some earlier rule had made the folder.runtime/CMakeLists.txtnow runsfile(MAKE_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/generated)once at configure time, right afterinclude(CTest), so no rule can run before the folder exists. The per-rulemake_directorystays.On an Apple M3 (macOS 26.5.1): a fresh
cmake -S runtime -B <new dir>thencmake --build -j8completes with no "Failed to open file", and ctest gives 114/115. The one failure,vk_bindless_dimensions, is amainfailure on MoltenVK with its own fix. Without this change, a fresh build of just that test's target stops atgenerated/cs_bindless_dimensions.spvthe same way, which shows the null-descriptor rule wasn't the only one affected.AI-assisted (Claude Code).
Imported from ubiquitarianism/leonida. Originally posted by Andretuta on 2026-11-27T21:00:48Z.
Review: COMMENTED
Verified
c94bc3003on Windows (MSVC 19.44, NMake clean build + RTX 3060): without this change, a clean NMake build fails withFailed to open fileongenerated/cs_bindless_dimensions.spv; withc94bc3003,generated/is created at configure time, both targets build cleanly, andctestpasses 2/2 (vk_null_descriptorandvk_bindless_dimensions).#2055and#2063have now landed onmain(which resolves the earlierlinux-gpu-toolsfailure withoutglslangValidator), and this branch still merges cleanly. Feel free to mark this ready for review whenever you're ready (optionally updating the PR title/body to mention the configure-timefile(MAKE_DIRECTORY ...)addition as well).AI-assisted review.
Imported from ubiquitarianism/leonida. Originally posted by zmasi on 2026-11-28T22:01:55Z.
#2096 | head
48f8e63297(merged cleanly with maina8465211fb) |cmake -S runtime -B <build> -G "Visual Studio 17 2022" -A x64+<build>/generatedconfigure-time directory check +python -I tests/test_ctest_registration.py| red on main: fresh CMake configure leaves<build>/generatedabsent (generated_exists=False), so parallel-jrules writinggenerated/*.spv(includingvk_null_descriptor_test'sgenerated/cs_null_descriptors.spv) race against rules that creategenerated/and fail with"Failed to open file"| green on PR+main: CMake configure creates<build>/generatedupfront (generated_is_dir=True),vk_null_descriptor_test's custom command also guards${CMAKE_COMMAND} -E make_directory ${CMAKE_CURRENT_BINARY_DIR}/generated, andtest_ctest_registration.pypasses7 ran, OK| Windows 11 (10.0.26200.9974), MSVC 19.44.35228.0, CMake, Python 3.12.10 | AI-assisted: yesAudited
runtime/CMakeLists.txton Windows 11 (Visual Studio 2022 x64 generator):file(MAKE_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/generated)right afterinclude(CTest)ensuresgenerated/exists at configure time for every generator, and themake_directorystep invk_null_descriptor_test'scs_null_descriptors.spvcustom command keeps clean-directory rebuilds safe ifgenerated/is removed between builds.Imported from ubiquitarianism/leonida. Originally posted by TheGeogeo on 2026-11-29T01:49:34Z.
Tested
48f8e6329merged (no commit) withmain53b77df14. GPUs tested: NVIDIA GeForce RTX 3080, driver 621.40, Windows 11 10.0.26300; MSVC 19.52 (Visual Studio 18), Ninja, RelWithDebInfo.check_no_game_data.pyis clean.cmake -S runtime -B <empty> -G Ninja,generated/does not exist onmain. With this PR it does, before any rule runs. That is exactly the gap the race needs.glslangValidatorrule running first in a parallel fresh build): it is timing-dependent.gta6rt.exelinks withoutws2_32.libwith nothing new overmain.generated/exists, the check above.No blocker from my side. AI-assisted (Claude Code).
Imported from ubiquitarianism/leonida. Originally posted by MoonEyes on 2026-11-29T08:11:05Z.
Merged after TheGeogeo's red/green check (check: green with this PR merged onto
main, red without it;gta6rt.exestill links with unchanged imports when the PR touches the runtime) and a re-check here: no conflict withmain01c555a3c, same head as checked, not frozen, and the only ctest failures in the Windows/macOS CI jobs are tests this diff does not touch (known onmainor Vulkan).AI-assisted (Claude Code, Claude Opus 5.5), merged for MoonEyes.