Skip to content

Initial support for nVidia toolchain#1993

Merged
Dead2 merged 1 commit intozlib-ng:developfrom
mtl1979:nvhpc
Nov 5, 2025
Merged

Initial support for nVidia toolchain#1993
Dead2 merged 1 commit intozlib-ng:developfrom
mtl1979:nvhpc

Conversation

@mtl1979
Copy link
Copy Markdown
Collaborator

@mtl1979 mtl1979 commented Nov 2, 2025

  • Supports native and non-native builds for x86_64 using CMake

Based on comments in #1985 ...

* Supports native and non-native builds for x86_64 using CMake
@codecov
Copy link
Copy Markdown

codecov bot commented Nov 2, 2025

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 82.89%. Comparing base (28d4f3e) to head (0df51bc).
⚠️ Report is 1 commits behind head on develop.

Additional details and impacted files
@@             Coverage Diff             @@
##           develop    #1993      +/-   ##
===========================================
+ Coverage    81.77%   82.89%   +1.11%     
===========================================
  Files          161      161              
  Lines        12960    12960              
  Branches      3149     3149              
===========================================
+ Hits         10598    10743     +145     
+ Misses        1294     1188     -106     
+ Partials      1068     1029      -39     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@coderabbitai
Copy link
Copy Markdown
Contributor

coderabbitai bot commented Nov 2, 2025

Walkthrough

The pull request adds NVIDIA NVHPC compiler support to the CMake build system. CMakeLists.txt extends compiler detection to include NVHPC for warning flag handling and x86 optimization options. cmake/detect-intrinsics.cmake enables intrinsic instruction detection for NVHPC alongside existing GNU and Clang support.

Changes

Cohort / File(s) Summary
Compiler Detection & Warning Flags
CMakeLists.txt
Extended CMAKE_C_COMPILER_ID matching to treat NVHPC like GNU/Clang for warning flags, LTO checks, and native instruction handling. Added NVHPC x86-specific compile option -tp for BASEARCH_X86_FOUND configurations.
Intrinsic Instruction Detection
cmake/detect-intrinsics.cmake
Added CMAKE_C_COMPILER_ID MATCHES "NVHPC" conditions to intrinsic-check macros for AVX512, AVX2, SSE variants, PCLMULQDQ, NEON, and other instruction sets, enabling equivalent HAVE_* checks and flag sets as GNU/Clang/IntelLLVM compilers.

Pre-merge checks and finishing touches

❌ Failed checks (1 warning)
Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. You can run @coderabbitai generate docstrings to improve docstring coverage.
✅ Passed checks (2 passed)
Check name Status Explanation
Title Check ✅ Passed The title "Initial support for nVidia toolchain" directly and accurately captures the primary change of the pull request. The raw summary confirms that the changes add NVHPC (nVidia) compiler support to CMakeLists.txt and cmake/detect-intrinsics.cmake, enabling proper handling for compilation flags, intrinsics checking, and native instruction support. The title is concise, clear, and specific enough for a teammate reviewing the change history to understand the main objective without ambiguity.
Description Check ✅ Passed The description "Supports native and non-native builds for x86_64 using CMake" is directly related to the changeset. The raw summary confirms that NVHPC-specific handling includes native instruction detection and the addition of the -tp flag for x86 platforms, which aligns with the description's reference to native and non-native x86_64 builds. While brief, the description adequately conveys key aspects of the changes and references issue #1985 for additional context.
✨ Finishing touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment

📜 Recent review details

Configuration used: CodeRabbit UI

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 28d4f3e and 0df51bc.

📒 Files selected for processing (2)
  • CMakeLists.txt (3 hunks)
  • cmake/detect-intrinsics.cmake (9 hunks)
🧰 Additional context used
🧠 Learnings (4)
📓 Common learnings
Learnt from: mtl1979
Repo: zlib-ng/zlib-ng PR: 1925
File: arch/loongarch/lasxintrin_ext.h:38-65
Timestamp: 2025-07-04T16:59:44.725Z
Learning: In zlib-ng, the policy for supporting old compilers is to maintain compatibility for up to two years after GitHub removes support for them in CI, or when there is no long-time contributor left testing for the architecture if the architecture was not supported by GitHub Actions at all.
📚 Learning: 2025-02-23T16:51:54.545Z
Learnt from: KungFuJesus
Repo: zlib-ng/zlib-ng PR: 1872
File: arch/x86/x86_intrins.h:114-117
Timestamp: 2025-02-23T16:51:54.545Z
Learning: In x86/x86_intrins.h, the Clang macros for _mm_cvtsi64x_si128 and _mm_cvtsi128_si64x don't need additional MSVC guards since MSVC's implementation is already protected by `defined(_MSC_VER) && !defined(__clang__)`, making them mutually exclusive.

Applied to files:

  • cmake/detect-intrinsics.cmake
📚 Learning: 2025-10-08T18:04:33.839Z
Learnt from: mtl1979
Repo: zlib-ng/zlib-ng PR: 1977
File: cmake/detect-intrinsics.cmake:142-180
Timestamp: 2025-10-08T18:04:33.839Z
Learning: MSVC Visual Studio version 18.0.0 (build 11018.127) and later supports the AVX2-VNNI intrinsic _mm256_dpbusd_epi32 via zmmintrin.h header and can compile it with /arch:AVX2 flag.

Applied to files:

  • cmake/detect-intrinsics.cmake
📚 Learning: 2025-02-23T16:50:50.925Z
Learnt from: KungFuJesus
Repo: zlib-ng/zlib-ng PR: 1872
File: arch/x86/x86_intrins.h:0-0
Timestamp: 2025-02-23T16:50:50.925Z
Learning: MSVC does not define `__GNUC__`, so adding `!defined(_MSC_VER)` to GCC detection macros is redundant when `__GNUC__` is already being checked.

Applied to files:

  • cmake/detect-intrinsics.cmake
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (150)
  • GitHub Check: Ubuntu GCC C23
  • GitHub Check: Ubuntu Clang Inflate Allow Invalid Dist
  • GitHub Check: Ubuntu GCC S390X ASAN
  • GitHub Check: Ubuntu Clang Memory Map
  • GitHub Check: Ubuntu MinGW x86_64
  • GitHub Check: Ubuntu GCC S390X No vectorized CRC32 ASAN
  • GitHub Check: Ubuntu GCC 14 LoongArch64
  • GitHub Check: Ubuntu GCC SPARC64
  • GitHub Check: Ubuntu Clang RISC-V
  • GitHub Check: Ubuntu GCC RISC-V
  • GitHub Check: Ubuntu GCC AARCH64 ASAN
  • GitHub Check: Ubuntu GCC ARM HF No ARMv8 ASAN
  • GitHub Check: Ubuntu GCC ARM HF Compat No Opt UBSAN
  • GitHub Check: Ubuntu GCC ARM HF No NEON ASAN
  • GitHub Check: Ubuntu GCC ARM HF ASAN
  • GitHub Check: Ubuntu GCC C23
  • GitHub Check: Ubuntu Clang Inflate Allow Invalid Dist
  • GitHub Check: Ubuntu GCC S390X ASAN
  • GitHub Check: Ubuntu Clang Memory Map
  • GitHub Check: Ubuntu MinGW x86_64
  • GitHub Check: Ubuntu GCC S390X No vectorized CRC32 ASAN
  • GitHub Check: Ubuntu GCC 14 LoongArch64
  • GitHub Check: Ubuntu GCC SPARC64
  • GitHub Check: Ubuntu Clang RISC-V
  • GitHub Check: Ubuntu GCC RISC-V
  • GitHub Check: Ubuntu GCC AARCH64 ASAN
  • GitHub Check: Ubuntu GCC ARM HF No ARMv8 ASAN
  • GitHub Check: Ubuntu GCC ARM HF Compat No Opt UBSAN
  • GitHub Check: Ubuntu GCC ARM HF No NEON ASAN
  • GitHub Check: Ubuntu GCC ARM HF ASAN
  • GitHub Check: Ubuntu GCC C23
  • GitHub Check: Ubuntu Clang Inflate Allow Invalid Dist
  • GitHub Check: Ubuntu GCC S390X ASAN
  • GitHub Check: Ubuntu Clang Memory Map
  • GitHub Check: Ubuntu MinGW x86_64
  • GitHub Check: Ubuntu GCC S390X No vectorized CRC32 ASAN
  • GitHub Check: Ubuntu GCC 14 LoongArch64
  • GitHub Check: Ubuntu GCC SPARC64
  • GitHub Check: Ubuntu Clang RISC-V
  • GitHub Check: Ubuntu GCC RISC-V
  • GitHub Check: Ubuntu GCC AARCH64 ASAN
  • GitHub Check: Ubuntu GCC ARM HF No ARMv8 ASAN
  • GitHub Check: Ubuntu GCC ARM HF Compat No Opt UBSAN
  • GitHub Check: Ubuntu GCC ARM HF No NEON ASAN
  • GitHub Check: Ubuntu GCC ARM HF ASAN
  • GitHub Check: Ubuntu GCC C23
  • GitHub Check: Ubuntu Clang Inflate Allow Invalid Dist
  • GitHub Check: Ubuntu GCC S390X ASAN
  • GitHub Check: Ubuntu Clang Memory Map
  • GitHub Check: Ubuntu MinGW x86_64
  • GitHub Check: Ubuntu GCC S390X No vectorized CRC32 ASAN
  • GitHub Check: Ubuntu GCC 14 LoongArch64
  • GitHub Check: Ubuntu GCC SPARC64
  • GitHub Check: Ubuntu Clang RISC-V
  • GitHub Check: Ubuntu GCC RISC-V
  • GitHub Check: Ubuntu GCC AARCH64 ASAN
  • GitHub Check: Ubuntu GCC ARM HF No ARMv8 ASAN
  • GitHub Check: Ubuntu GCC ARM HF Compat No Opt UBSAN
  • GitHub Check: Ubuntu GCC ARM HF No NEON ASAN
  • GitHub Check: Ubuntu GCC ARM HF ASAN
  • GitHub Check: Ubuntu GCC C23
  • GitHub Check: Ubuntu Clang Inflate Allow Invalid Dist
  • GitHub Check: Ubuntu GCC S390X ASAN
  • GitHub Check: Ubuntu Clang Memory Map
  • GitHub Check: Ubuntu MinGW x86_64
  • GitHub Check: Ubuntu GCC S390X No vectorized CRC32 ASAN
  • GitHub Check: Ubuntu GCC 14 LoongArch64
  • GitHub Check: Ubuntu GCC SPARC64
  • GitHub Check: Ubuntu Clang RISC-V
  • GitHub Check: Ubuntu GCC RISC-V
  • GitHub Check: Ubuntu GCC AARCH64 ASAN
  • GitHub Check: Ubuntu GCC ARM HF No ARMv8 ASAN
  • GitHub Check: Ubuntu GCC ARM HF Compat No Opt UBSAN
  • GitHub Check: Ubuntu GCC ARM HF No NEON ASAN
  • GitHub Check: Ubuntu GCC ARM HF ASAN
  • GitHub Check: Ubuntu GCC C23
  • GitHub Check: Ubuntu Clang Inflate Allow Invalid Dist
  • GitHub Check: Ubuntu GCC S390X ASAN
  • GitHub Check: Ubuntu Clang Memory Map
  • GitHub Check: Ubuntu MinGW x86_64
  • GitHub Check: Ubuntu GCC S390X No vectorized CRC32 ASAN
  • GitHub Check: Ubuntu GCC 14 LoongArch64
  • GitHub Check: Ubuntu GCC SPARC64
  • GitHub Check: Ubuntu Clang RISC-V
  • GitHub Check: Ubuntu GCC RISC-V
  • GitHub Check: Ubuntu GCC AARCH64 ASAN
  • GitHub Check: Ubuntu GCC ARM HF No ARMv8 ASAN
  • GitHub Check: Ubuntu GCC ARM HF Compat No Opt UBSAN
  • GitHub Check: Ubuntu GCC ARM HF No NEON ASAN
  • GitHub Check: Ubuntu GCC ARM HF ASAN
  • GitHub Check: Ubuntu GCC C23
  • GitHub Check: Ubuntu Clang Inflate Allow Invalid Dist
  • GitHub Check: Ubuntu GCC S390X ASAN
  • GitHub Check: Ubuntu Clang Memory Map
  • GitHub Check: Ubuntu MinGW x86_64
  • GitHub Check: Ubuntu GCC S390X No vectorized CRC32 ASAN
  • GitHub Check: Ubuntu GCC 14 LoongArch64
  • GitHub Check: Ubuntu GCC SPARC64
  • GitHub Check: Ubuntu Clang RISC-V
  • GitHub Check: Ubuntu GCC RISC-V
  • GitHub Check: Ubuntu GCC AARCH64 ASAN
  • GitHub Check: Ubuntu GCC ARM HF No ARMv8 ASAN
  • GitHub Check: Ubuntu GCC ARM HF Compat No Opt UBSAN
  • GitHub Check: Ubuntu GCC ARM HF No NEON ASAN
  • GitHub Check: Ubuntu GCC ARM HF ASAN
  • GitHub Check: Ubuntu GCC C23
  • GitHub Check: Ubuntu Clang Inflate Allow Invalid Dist
  • GitHub Check: Ubuntu GCC S390X ASAN
  • GitHub Check: Ubuntu Clang Memory Map
  • GitHub Check: Ubuntu MinGW x86_64
  • GitHub Check: Ubuntu GCC S390X No vectorized CRC32 ASAN
  • GitHub Check: Ubuntu GCC 14 LoongArch64
  • GitHub Check: Ubuntu GCC SPARC64
  • GitHub Check: Ubuntu Clang RISC-V
  • GitHub Check: Ubuntu GCC RISC-V
  • GitHub Check: Ubuntu GCC AARCH64 ASAN
  • GitHub Check: Ubuntu GCC ARM HF No ARMv8 ASAN
  • GitHub Check: Ubuntu GCC ARM HF Compat No Opt UBSAN
  • GitHub Check: Ubuntu GCC ARM HF No NEON ASAN
  • GitHub Check: Ubuntu GCC ARM HF ASAN
  • GitHub Check: Ubuntu GCC C23
  • GitHub Check: Ubuntu Clang Inflate Allow Invalid Dist
  • GitHub Check: Ubuntu GCC S390X ASAN
  • GitHub Check: Ubuntu Clang Memory Map
  • GitHub Check: Ubuntu MinGW x86_64
  • GitHub Check: Ubuntu GCC S390X No vectorized CRC32 ASAN
  • GitHub Check: Ubuntu GCC 14 LoongArch64
  • GitHub Check: Ubuntu GCC SPARC64
  • GitHub Check: Ubuntu Clang RISC-V
  • GitHub Check: Ubuntu GCC RISC-V
  • GitHub Check: Ubuntu GCC AARCH64 ASAN
  • GitHub Check: Ubuntu GCC ARM HF No ARMv8 ASAN
  • GitHub Check: Ubuntu GCC ARM HF Compat No Opt UBSAN
  • GitHub Check: Ubuntu GCC ARM HF No NEON ASAN
  • GitHub Check: Ubuntu GCC ARM HF ASAN
  • GitHub Check: Ubuntu GCC C23
  • GitHub Check: Ubuntu Clang Inflate Allow Invalid Dist
  • GitHub Check: Ubuntu GCC S390X ASAN
  • GitHub Check: Ubuntu Clang Memory Map
  • GitHub Check: Ubuntu MinGW x86_64
  • GitHub Check: Ubuntu GCC S390X No vectorized CRC32 ASAN
  • GitHub Check: Ubuntu GCC 14 LoongArch64
  • GitHub Check: Ubuntu GCC SPARC64
  • GitHub Check: Ubuntu Clang RISC-V
  • GitHub Check: Ubuntu GCC RISC-V
  • GitHub Check: Ubuntu GCC AARCH64 ASAN
  • GitHub Check: Ubuntu GCC ARM HF No ARMv8 ASAN
  • GitHub Check: Ubuntu GCC ARM HF Compat No Opt UBSAN
  • GitHub Check: Ubuntu GCC ARM HF No NEON ASAN
  • GitHub Check: Ubuntu GCC ARM HF ASAN
🔇 Additional comments (4)
cmake/detect-intrinsics.cmake (1)

150-625: Consistent NVHPC support across all x86 intrinsic checks.

The implementation correctly extends NVHPC support to all x86 intrinsic detection paths (AVX512VNNI, AVX2, PCLMULQDQ, VPCLMULQDQ, SSE2, SSSE3, SSE41, SSE42). The pattern is consistent and appropriate for the stated PR objective of supporting x86_64 builds.

CMakeLists.txt (3)

315-320: Clean implementation of NVHPC native instruction detection.

The NVHPC-specific check for -tp native support is correctly implemented as a separate block from the GNU/Clang path, ensuring proper detection for each compiler type.


279-281: No issues found—code and comments are accurate.

The NVHPC compiler does default to auto-selecting the host target (using all supported instructions on the compile machine), and -tp px correctly generates portable x86-64 code usable on any x86-64 processor. The code change correctly overrides the default native optimization behavior for non-native x86 builds.


233-246: NVHPC LTO flag integration needs verification.

Warning flags (-Wall, -Wextra) are supported by NVHPC, but NVHPC/CUDA use their own LTO options (device LTO uses -dlto / --dlink-time-opt; host LTO behavior with -fno-lto is only supported when the toolchain supports it). The code's defensive check_c_source_compiles() check helps, but you should prefer using the SDK's documented LTO flags rather than relying on an undocumented -fno-lto alias.

Verify that -fno-lto correctly disables LTO when using NVHPC, or consider using NVHPC's native LTO flags (-dlto, --dlink-time-opt) instead.


Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@Dead2 Dead2 added the Build Env label Nov 3, 2025
Copy link
Copy Markdown
Member

@Dead2 Dead2 left a comment

Choose a reason for hiding this comment

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

LGTM

@Dead2 Dead2 merged commit 7bee4b6 into zlib-ng:develop Nov 5, 2025
156 checks passed
@Dead2 Dead2 mentioned this pull request Nov 5, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants