Repository navigation
runtime: -DLEONIDA_VULKAN_HEADERS_FETCH=ON uses the pinned Vulkan-Headers even when others are installed (CMAKE-VULKAN-HEADERS-PIN) - #491
Conversation
|
Independent Windows check at One configuration still silently uses installed headers with the fetch flag on. In a fresh build directory I ran: My synthetic installed package contains In CMake's ALWAYS mode, the implicit package lookup occurs inside Synthetic configure tests only. AI-assisted (Codex). |
…ders even when others are installed (CMAKE-VULKAN-HEADERS-PIN) find_package(Vulkan) and the find_path(Vulkan_INCLUDE_DIR) fallback ran before the fetch branch, so any Vulkan headers on the machine (an SDK, conda-forge's vulkan-headers, /usr/include) defined Vulkan::Headers first and the pinned Khronos Vulkan-Headers 6802bb47 (vulkan-sdk-1.4.363.0) were never used, even with the flag on. Against conda-forge's Vulkan 1.3 headers that cost a Radeon 780M three GPU tests (225/248 passed instead of 228/248). The fetch, or a FETCHCONTENT_SOURCE_DIR_VULKANHEADERS copy, now runs first. FindVulkan still runs afterwards for glslangValidator and leaves the existing Vulkan::Headers alone. The pinned commit is one variable the URL uses. Every configure with headers prints one "-- Vulkan headers:" line with the include directory, VK_HEADER_VERSION and whether they are the pin (runtime/cmake/vulkan_headers_report.cmake); docs/testing.md and docs/gpu_test_results.md ask a GPU record to build with the pin and quote it. tests/test_cmake_vulkan_headers_pin.py configures runtime/ with a fake SDK on VULKAN_SDK and a fake local copy of the pin (no network) and checks the include directories Vulkan::Headers carries; it fails on main. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…ON uses the pinned Vulkan-Headers even when others are installed (CMAKE-VULKAN-HEADERS-PIN)
13604ac to
c8ac7e4
Compare
…kage (CMAKE-VULKAN-HEADERS-PIN) With -DFETCHCONTENT_TRY_FIND_PACKAGE_MODE=ALWAYS, FetchContent_MakeAvailable(VulkanHeaders) tried find_package(VulkanHeaders) first: an installed VulkanHeadersConfig.cmake (VK_HEADER_VERSION 111) became Vulkan::Headers, nothing was downloaded, and the "Vulkan headers:" line still called it the pin. - The declaration carries OVERRIDE_FIND_PACKAGE, so FetchContent never tries find_package() in place of the pin, and a later find_package(VulkanHeaders) gets the pin. - After FetchContent_MakeAvailable, leonida_vulkan_headers_check fails the configure unless Vulkan::Headers is the copy FetchContent populated, which catches a dependency provider or an earlier FetchContent_Declare(VulkanHeaders). For the pin, the copy must also be VK_HEADER_VERSION LEONIDA_VULKAN_HEADERS_PIN_VERSION (363), which catches a stale copy kept by FETCHCONTENT_FULLY_DISCONNECTED=ON. - tests/test_cmake_vulkan_headers_pin.py: offline configures for ALWAYS mode with an installed package (pre-seeded FETCHCONTENT_BASE_DIR, FULLY_DISCONNECTED), a dependency provider and a stale copy, cmake -P cases for the check, and the pin version against runtime.yml. Reported by Dezmonius on ProjectLeonida#491. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
|
Ty for the fix. I independently checked I configured fresh build directories with
I also confirmed Dezmonius’s All nine tests in |
|
Thanks, reproduced. At
Tested on Linux only (CMake 4.4.5, Ninja); Windows and macOS are left to CI. AI-assisted (Claude Code). |
|
@Okachamie thanks for the independent check. I re-ran your command at Game-free configure and build only. AI-assisted. |
|
The red
#877 and this pull request both change AI-assisted. |
|
Independent Linux check at |
…eaders "hash-checked" (CMAKE-VULKAN-HEADERS-PIN) With FETCHCONTENT_FULLY_DISCONNECTED=ON, FetchContent reuses the copy already in FETCHCONTENT_BASE_DIR and checks no archive, but the "Vulkan headers:" line still said "hash-checked". The path and version checks confirm what was selected, not that this configure checked an archive. - A new origin, PIN_CACHED, is used when FETCHCONTENT_FULLY_DISCONNECTED is on and no FETCHCONTENT_SOURCE_DIR_VULKANHEADERS is given. The line reads "the pinned version, cached source: Khronos Vulkan-Headers <commit>; archive not checked in this configure (FETCHCONTENT_FULLY_DISCONNECTED=ON)". leonida_vulkan_headers_check still requires LEONIDA_VULKAN_HEADERS_PIN_VERSION for it. - Each branch of the report builds its text with string(CONCAT) on quoted pieces, so the ";" survives. - tests/test_cmake_vulkan_headers_pin.py: the disconnected-mode configure test asserts the wording and that "hash-checked" is gone, a cmake -P case checks the wording, and the version check runs for both pin origins (19 tests). Reported by titoreinaldo on ProjectLeonida#491. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
|
@titoreinaldo agreed. The version and path checks show what was selected, not that this configure checked an archive. Fixed in b7c9afd. With
With the real download already in a build folder, reconfiguring with |
Brings the branch up to date with main 68d1331. No conflicts; the merged tree was tested before the push (every standalone test file under tests/ passes except tests/test_ci_registration.py, which fails on main alone since ProjectLeonida#930). Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
Claimed in the coordination issue as: CMAKE-VULKAN-HEADERS-PIN (claim)
What and why
Mby159's finding (record in #431):
runtime/CMakeLists.txtranfind_package(Vulkan QUIET)and thefind_path(Vulkan_INCLUDE_DIR ...)fallback before theLEONIDA_VULKAN_HEADERS_FETCH/FETCHCONTENT_SOURCE_DIR_VULKANHEADERSbranch. Any Vulkan headers on the machine (an SDK, conda-forge'svulkan-headers,/usr/include) therefore definedVulkan::Headersfirst, and the pinned Khronos Vulkan-Headers6802bb47(vulkan-sdk-1.4.363.0, the same commit.github/workflows/runtime.ymlchecks out) were never used, even with-DLEONIDA_VULKAN_HEADERS_FETCH=ON. On a Radeon 780M this changed the GPU counts: against conda-forge's Vulkan 1.3 headersrun_gpu_tests.pyskippedps_texoff,ps_texoff_formsandps_texoff_implicit(225/248 passed instead of 228/248).FETCHCONTENT_SOURCE_DIR_VULKANHEADERS, now runs beforefind_package(Vulkan). FindVulkan still runs afterwards, because it is what findsglslangValidator(Vulkan_GLSLANG_VALIDATOR_EXECUTABLE, used by the shader-building tests). It createsVulkan::Headersonlyif(... NOT TARGET Vulkan::Headers), so the target is defined once. If the fetched project defines noVulkan::Headers, the configure stops instead of quietly falling back to other headers. Without the flag nothing changes and nothing is downloaded.-DFETCHCONTENT_TRY_FIND_PACKAGE_MODE=ALWAYS,FetchContent_MakeAvailable()used to tryfind_package(VulkanHeaders)first, so an installedVulkanHeadersConfig.cmake(VK_HEADER_VERSION 111) becameVulkan::Headers, nothing was downloaded, and the line still said "the pin". The declaration now carriesOVERRIDE_FIND_PACKAGE, which stops that try. AfterFetchContent_MakeAvailable(),leonida_vulkan_headers_checkfails the configure unlessVulkan::Headersis the copy FetchContent populated, which covers a dependency provider or an earlierFetchContent_Declare(VulkanHeaders). For the pin, the copy must also have VK_HEADER_VERSIONLEONIDA_VULKAN_HEADERS_PIN_VERSION(363), which covers a stale copy thatFETCHCONTENT_FULLY_DISCONNECTED=ONkeeps after the pin changes.LEONIDA_VULKAN_HEADERS_PIN, which the URL uses, and its VK_HEADER_VERSION inLEONIDA_VULKAN_HEADERS_PIN_VERSION. A test checks both against the two checkouts inruntime.yml(ref: <commit> # vulkan-sdk-1.4.363.0).runtime/cmake/vulkan_headers_report.cmake):FETCHCONTENT_SOURCE_DIR_VULKANHEADERScopy is reported as such: a local copy that is not checked against the pin. WithFETCHCONTENT_FULLY_DISCONNECTED=ON, FetchContent reuses the copy already inFETCHCONTENT_BASE_DIRand checks no archive. The version check still applies, but the line no longer says "hash-checked" (titoreinaldo's review):docs/testing.md(Build the test programs) anddocs/gpu_test_results.mdnow say: for a result you will post, configure with-DLEONIDA_VULKAN_HEADERS_FETCH=ONand quote theVulkan headers:line. They also note that older entries naming the flag may have used installed headers.runtime/README.mdand the option's doc string no longer say the flag only applies "if no Vulkan headers are found".The fetch stays opt-in rather than becoming the default: the configure downloads nothing unless asked.
#269 (Vulkan header version check for the Windows runtime) edits the same block. This PR doesn't build on it and stays out of its way: the two
endif()lines and theif(TARGET Vulkan::Headers)line where #269 inserts its check are unchanged.git merge-treeof this branch with #269's heada2828eeeis clean, and on the merged treetests/test_cmake_vulkan_headers_version.py,tests/test_cmake_vulkan_headers_pin.pyandtests/test_cmake_vulkan_missing.pyall pass. If both land, #269's advice to pass the flag "with no other headers installed" can drop that qualifier.Tested
CachyOS Linux (kernel 7.3.3), CMake 4.4.5 + Ninja, GCC 16.2.1, system Vulkan headers in
/usr/include(VK_HEADER_VERSION 363):tests/test_cmake_vulkan_headers_pin.py(new, 19 tests, 3.6 s): it configuresruntime/with a fake installed SDK onVULKAN_SDK(VK_HEADER_VERSION 231) and a fake local copy of the pinned project throughFETCHCONTENT_SOURCE_DIR_VULKANHEADERS(363), with no network. Acmake_language(DEFER)hook reads the include directoriesVulkan::Headersreally carries. With FETCH=ON on a fresh build folder, and after turning FETCH on in a folder that already found (and cached) the SDK, the pin is used; turning it off again returns to the SDK. Thecmake -Pcases check the report line and the new check. Onorigin/mainthe first version of the file failed 9/9, and the configure case failed for the bug itself:Vulkan::Headers includes ['/tmp/.../sdk/include'], not /tmp/.../vulkan-headers/include.VulkanHeadersConfig.cmake, VK_HEADER_VERSION 111) onVulkanHeaders_DIR,-DFETCHCONTENT_TRY_FIND_PACKAGE_MODE=ALWAYS, noFETCHCONTENT_SOURCE_DIR_VULKANHEADERS, and a fake pin already inFETCHCONTENT_BASE_DIRwithFETCHCONTENT_FULLY_DISCONNECTED=ON. The pin is used. There is also a dependency provider (CMAKE_PROJECT_TOP_LEVEL_INCLUDES) that answers with the package, and a stale copy at version 362; both now fail the configure. On the previous headc8ac7e4athe ALWAYS case fails withVulkan::Headers includes ['/tmp/.../package/include'], not /tmp/.../deps/vulkanheaders-src/include, and the provider configure exits 0 while calling 111 the pin. The disconnected case also asserts the "cached source; archive not checked" wording and no "hash-checked"; onaea4da4cthat assertion fails.c8ac7e4ait exits 0 with no_deps/and prints.../pkg/include (VK_HEADER_VERSION 111), the pin: .... With this PR it downloads the pin and prints<build>/_deps/vulkanheaders-src/include (VK_HEADER_VERSION 363), the pin: ....main,-DLEONIDA_VULKAN_HEADERS_FETCH=ONcreates no_deps/, cachesVulkan_INCLUDE_DIR=/usr/include, andvk_harnesscompiles with no-I. With this PR,compile_commands.jsonhasvk_harnesscompiled with-I<build>/_deps/vulkanheaders-src/includewhile/usr/includeis still found (Vulkan_INCLUDE_DIRandglslangValidatorare cached as before). Without the flag it is/usr/include, as before.ctest --test-dir <build> --output-on-failure(portable subset): 72 tests, 70 passed and 2 skipped (shader_library_corpus,vk_sync_validation), the same onmain, on this PR without the flag, on this PR with the pin, and with the pin under-DFETCHCONTENT_TRY_FIND_PACKAGE_MODE=ALWAYSafter the review fix. The GPU runs below predate the review fix, which leaves the headers of both those builds unchanged (the same-Ipaths).python -I scripts/run_gpu_tests.py(VK_LOADER_DRIVERS_SELECT='*nvidia*',VK_LOADER_LAYERS_DISABLE='~implicit~'):main(system headers) gave 257/257 shaders translated and spirv-val valid, and 197/248 passed, 49 skipped, 2 failed. This PR built against the pin gave the same, with identical per-test statuses. The two failures are the knowncs_imgload_tfe/cs_imgload_d16_tfe(the tfe status VGPR), and the skips are the wave64 fixtures plus the 16 "run by d3d12_*_test" cases, as ingpu-test-results/RTX4070Ti.txt. The system headers here are also 363, so no count difference was expected.tests/test_docs_*.py,tests/test_cmake_*.py,tests/test_build_runtime_cmake.py,tests/test_text_write_line_endings.py,python -m compileall -q make_game.py tools tests, andscripts/check_no_game_data.pyon every changed file: all OK.-DLEONIDA_BUILD_WINDOWS_RUNTIME=OFF -DBUILD_TESTING=OFFand skips when CMake has no working C++ compiler.GPUs tested: NVIDIA GeForce RTX 4070 Ti (AD104), NVIDIA 620.70.06 (proprietary), Vulkan 1.4.357, CachyOS Linux
AI-assisted: yes (Claude Code)
Checklist
mainand merges cleanly (a conflicting pull request is labeledneeds rebase).docs/design.md, with how it was confirmed. (n/a: no translator change)🤖 Generated with Claude Code