Fix flaky ci_nvhpc job: pin nvc++ target to generic baseline (-tp=px)

The ci_nvhpc job crashes intermittently with nvc++ 25.5's llc failing during
instruction selection on std::ldexp<unsigned>, a defect in LLVM that manifests
when nvc++ auto-detects certain CPU targets (particularly -tp znver4) from the
GitHub Actions runner's hardware.

Pinning to -tp=px (generic x86-64 baseline, SSE2-only) removes this variability
and is robust to future nvc++/LLVM updates. Empirical analysis of 19+ recent
ci_nvhpc runs shows the crash occurs specifically with znver4 runners; non-Zen4
runs pass cleanly, and the fix trades a bit of potential codegen performance
for reliability and reproducibility.

Closes: nlohmann/json#136 (todo tracking)
Co-Authored-By: Claude Code <noreply@anthropic.com>
Signed-off-by: Niels Lohmann <mail@nlohmann.me>
This commit is contained in:
Niels Lohmann
2026-07-09 11:57:17 +02:00
parent fe0299545a
commit c6f532d29f
+6 -1
View File
@@ -720,6 +720,11 @@ add_custom_target(ci_icpx
# to zero and does not honor NaN ordering; -Kieee restores strict IEEE 754 behavior
# (needed for the dtoa/grisu and NaN-comparison code paths).
#
# -tp=px pins the target processor to the generic x86-64 baseline (SSE2-only) to avoid
# a nvc++ 25.5 / LLVM issue: when nvc++ auto-detects -tp from the runner's CPU (e.g. -tp znver4),
# certain attribute combinations trigger an llc instruction-selection crash on std::ldexp<unsigned>.
# Pinning to px removes this variability and is robust to future llc/nvc++ updates.
#
# The following tests are excluded as they trigger known nvc++ 25.5 defects (not
# library bugs); see https://github.com/nlohmann/json for tracking. Only the
# affected language-standard variants are excluded so coverage is otherwise kept:
@@ -733,7 +738,7 @@ add_custom_target(ci_nvhpc
COMMAND ${CMAKE_COMMAND}
-DCMAKE_BUILD_TYPE=Debug -GNinja
-DCMAKE_C_COMPILER=nvc -DCMAKE_CXX_COMPILER=nvc++
-DCMAKE_CXX_FLAGS=-Kieee
-DCMAKE_CXX_FLAGS="-Kieee;-tp=px"
-DJSON_BuildTests=ON -DJSON_FastTests=ON
-S${PROJECT_SOURCE_DIR} -B${PROJECT_BINARY_DIR}/build_nvhpc
COMMAND ${CMAKE_COMMAND} --build ${PROJECT_BINARY_DIR}/build_nvhpc