Skip to content

vk_pipeline_check: parse floating-point CLI values without from_chars (BUILD-822) - #2927

Merged
ItsNotRexed merged 1 commit into
ItsNotRexed:mainfrom
bobcatchris:fix/macos-vk-pipeline-check-from-chars
Nov 22, 2026
Merged

ItsNotRexed merged 1 commit into
ItsNotRexed:mainfrom
bobcatchris:fix/macos-vk-pipeline-check-from-chars

Conversation

@bobcatchris

Copy link
Copy Markdown
Contributor

BUILD-822 (finding: #2716 (comment)), claimed in #2891 (comment).

What and why

upstream/main ec8ec4c does not fully build on macOS with Xcode CLT 17 (AppleClang 17.0.0.17000013): runtime/test/vk_pipeline_check.cpp:567 calls std::from_chars with a floating-point destination through its templated CLI number() lambda. Apple's libc++ provides no floating-point from_chars overload, so the full build exits 2 at that target. Merged #1596 fixed the same class of call in shader_library.h but not this file.

Change

One commit (c575a03): for floating-point CLI destinations only, parse the already-delimited token with std::strtod, requiring full-token consumption and no ERANGE, mirroring #1596; integral options keep the existing std::from_chars path byte-for-byte in behaviour. Added the needed unconditional <cerrno> and <type_traits> includes. The CLI regression test adds --slow 1.2.3 so a partial numeric prefix cannot silently pass again.

Verified on Apple M2 (Mac14,3), macOS 26.4, AppleClang 17 / CLT SDK

  • cmake -S runtime -B runtime/build/linux -DVulkan_INCLUDE_DIR=/opt/homebrew/include and full cmake --build runtime/build/linux --parallel: exit 0, every target built (same tree without the fix exits 2 at vk_pipeline_check.cpp).
  • ctest --test-dir runtime/build/linux -R '^vk_pipeline_check_cli$' --output-on-failure: 1/1 passed in 0.37 s, including the new case.
  • Full ctest: 36/37 passed in 41.79 s; the only failure is the pre-existing xdxr_build_check (open issue xdxr_build: radix scan writes offsets apart from the counts, correct on MoltenVK 1.4.2 #2423, MoltenVK radix-scan offsets), unrelated to this change.
  • python -m unittest discover -s tests/semantic: 4137 tests, OK. git diff --check: clean.

No game files, no keys; synthetic CLI inputs and aggregate counts only.

AI-assisted.

@tupacfan04

Copy link
Copy Markdown
Contributor

Code read of c575a03f. Looks right. if constexpr keeps from_chars for the integer options and uses strtod only for floating ones, requiring the whole token to be consumed (the new 1.2.3 case) and refusing ERANGE, and --slow's existing isfinite/>= 0 checks still reject inf/nan. The one behavioural difference from from_chars is that strtod also accepts leading whitespace and hex floats (0x1p3). That's harmless for a CLI value, and the program never calls setlocale, so the decimal point stays ..

AI-assisted review (Claude Code).

@Marukooh

Copy link
Copy Markdown
Contributor

Tested c575a03f on CachyOS Linux. Built vk_pipeline_check with native CMake/Ninja and passed the vk_pipeline_check_cli CTest. With --slow 1e-3, the tool built one synthetic compute pipeline on the RTX 5070 Ti (NVIDIA 620.73.04) and printed the slow-pipeline record. All six invalid values (partial token, overflow, underflow, NaN, infinity and a negative finite value) produced the expected exit-2 CLI diagnostic. AI-assisted, synthetic inputs only.

@crastinator

Copy link
Copy Markdown
Contributor

Tested c575a03 merged into main 16282101 (clean merge) on AMD Radeon RX 6700 XT (Navi 22, gfx1031, subgroup 32..64), RADV Mesa 26.3.1, CachyOS, Linux 7.3.5, GCC 16.2.1, llvm-mc 23.1.5: pass.

  • Whole run_gpu_tests.py: 175/189 native, 175/189 with LEONIDA_W64_EMULATE=1 (the skips are the D3D12-only fixtures and ps_w64x_readlane, as on main). ctest 37/37.

No game files. AI-assisted (Claude Code).

@bobcatchris

Copy link
Copy Markdown
Contributor Author

Additional evidence from current main f847748 on Apple M2 (macOS 26.4, AppleClang 17): without this fix, cmake --build runtime/build/linux --parallel fails at vk_pipeline_check.cpp and the retained stale binary makes 10 tests in tests/test_vk_pipeline_check_index.py and test_vk_pipeline_check_isolate.py fail while the rest of the CPU suite passes (5216 passed, 99 skipped, 6482 subtests passed).

I cherry-picked this commit onto current main in a throwaway worktree (no push to any shared branch): git cherry-pick c575a03f applied cleanly, full build exit 0, and pytest -q tests/test_vk_pipeline_check_index.py tests/test_vk_pipeline_check_isolate.py now gives 13 passed, 3 subtests passed in 1.51 s (0 failures). So this one-line-per-call portability fix both restores the macOS build and removes 10 misleading test failures caused by the stale binary. Synthetic tests only, no game files.

AI-assisted.

@2-CD

2-CD commented Nov 22, 2026

Copy link
Copy Markdown
Contributor

Windows + GPU check: RTX 5080 + RTX 3070 Ti (NVIDIA 621.01) and AMD Radeon 610M iGPU (Ryzen 9 9950X3D, driver 32.0.13018.6), Windows 11, MSVC RelWithDebInfo/Ninja. Tested head 3ca9290.

  • Clean build; the vk_pipeline_check_cli fixture (extended here) passes, including float CLI values.
  • Full ctest -C RelWithDebInfo -j 6: 125/125 on the RTX 5080 and 125/125 on the iGPU (the four window-showing present/swapchain tests excluded from the loops).
  • The PR's unstable CI state did not reproduce locally; every run green. (MSVC always had float from_chars, so this is expected to be a no-op here; the fix matters for AppleClang.)

Synthetic fixtures only, no game files. AI-assisted (opencode); runs on my machine.

@bobcatchris bobcatchris reopened this Nov 22, 2026
@ItsNotRexed
ItsNotRexed merged commit 92d53a0 into ItsNotRexed:main Nov 22, 2026
2 of 13 checks passed
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.

6 participants