Skip to content

Improve CUDA 13.1 compatibility with newer glibc - #31

Open
remer wants to merge 1 commit into
brontoguana:mainfrom
remer:fix/cuda-glibc-compat
Open

Improve CUDA 13.1 compatibility with newer glibc#31
remer wants to merge 1 commit into
brontoguana:mainfrom
remer:fix/cuda-glibc-compat

Conversation

@remer

@remer remer commented Aug 21, 2026

Copy link
Copy Markdown

Summary

Pass -U_GNU_SOURCE -D_DEFAULT_SOURCE to Krasis NVCC invocations on Linux. This avoids the rsqrt/rsqrtf exception-specification conflict between newer glibc headers and CUDA 13.0/13.1 headers while retaining the standard/default interfaces.

Krasis already centralizes optional NVCC host arguments in nvcc_host_compiler_args(), so the compatibility flags apply consistently without changing the system compiler or non-Linux builds.

Observed failure

With CUDA 13.1 and glibc 2.43, CUDA kernel compilation fails with errors equivalent to:

bits/mathcalls.h: error: exception specification is incompatible with that of previous function "rsqrt"
crt/math_functions.h: previous declaration of "rsqrt"

Changing the selected host compiler did not resolve the collision because it is between the visible glibc and CUDA declarations.

Validation

  • complete Krasis extension build succeeded after adding the flags
  • all prefill, decode, HQQ, and supporting CUDA/PTX compilation completed
  • the system's default compiler was not changed
  • git diff --check

Compatibility scope

The observed Ubuntu 26.04/CUDA 13.1 combination is outside CUDA 13.1's validated distribution matrix, so this is a portability improvement rather than a claim that Krasis is defective on a supported CUDA configuration. CUDA 13.3 validates Ubuntu 26.04.

An open PR against NVIDIA's cuda-samples repository documents the same CUDA 13.1/glibc conflict and feature-macro workaround: NVIDIA/cuda-samples#403

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.

1 participant