-
Notifications
You must be signed in to change notification settings - Fork 1k
Fix CCCL/Jitify compatibility issues for NVRTC compilation #19951
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: branch-25.10
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,65 @@ | ||
| From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 | ||
| From: Claude <noreply@anthropic.com> | ||
| Date: Sat, 14 Sep 2025 00:00:00 +0000 | ||
| Subject: [PATCH] Fix CCCL/Jitify compatibility for NVRTC | ||
|
|
||
| This patch fixes type redeclaration conflicts between CCCL and Jitify | ||
| when compiling with NVRTC by: | ||
| 1. Adding guards to prevent duplicate type definitions when stdint.h is included | ||
| 2. Fixing CHAR_MIN/MAX with explicit casts to avoid narrowing conversions | ||
|
|
||
| diff --git a/libcudacxx/include/cuda/std/cstdint b/libcudacxx/include/cuda/std/cstdint | ||
| index ae444b9bd..3ad5e955b 100644 | ||
| --- a/libcudacxx/include/cuda/std/cstdint | ||
| +++ b/libcudacxx/include/cuda/std/cstdint | ||
| @@ -30,6 +30,9 @@ _CCCL_PUSH_MACROS | ||
| #else // ^^^ !_CCCL_COMPILER(NVRTC) ^^^ / vvv _CCCL_COMPILER(NVRTC) vvv | ||
| # include <cuda/std/climits> | ||
|
|
||
| +// Only define types if stdint.h hasn't been included | ||
| +#ifndef _STDINT_H | ||
|
Comment on lines
+19
to
+20
|
||
| + | ||
| using int8_t = signed char; | ||
| using int16_t = signed short; | ||
| using int32_t = signed int; | ||
| @@ -63,6 +66,11 @@ using uintptr_t = uint64_t; | ||
| using intmax_t = int64_t; | ||
| using uintmax_t = uint64_t; | ||
|
|
||
| +#endif // _STDINT_H | ||
| + | ||
| +// Only define macros if stdint.h hasn't been included | ||
| +#ifndef _STDINT_H | ||
|
Comment on lines
+31
to
+32
|
||
| + | ||
| # define INT8_MIN SCHAR_MIN | ||
| # define INT16_MIN SHRT_MIN | ||
| # define INT32_MIN INT_MIN | ||
| @@ -126,6 +134,8 @@ using uintmax_t = uint64_t; | ||
|
|
||
| # define INTMAX_C(X) ((::intmax_t)(X)) | ||
| # define UINTMAX_C(X) ((::uintmax_t)(X)) | ||
| + | ||
| +#endif // _STDINT_H | ||
| #endif // ^^^ _CCCL_COMPILER(NVRTC) | ||
|
|
||
| _LIBCUDACXX_BEGIN_NAMESPACE_STD | ||
| diff --git a/libcudacxx/include/cuda/std/climits b/libcudacxx/include/cuda/std/climits | ||
| index a605f2dc5..085205322 100644 | ||
| --- a/libcudacxx/include/cuda/std/climits | ||
| +++ b/libcudacxx/include/cuda/std/climits | ||
| @@ -34,10 +34,10 @@ _CCCL_PUSH_MACROS | ||
| # define __CHAR_UNSIGNED__ ('\xff' > 0) // CURSED | ||
| # if __CHAR_UNSIGNED__ | ||
| # define CHAR_MIN 0 | ||
| -# define CHAR_MAX UCHAR_MAX | ||
| +# define CHAR_MAX ((char)UCHAR_MAX) | ||
| # else | ||
| -# define CHAR_MIN SCHAR_MIN | ||
| -# define CHAR_MAX SCHAR_MAX | ||
| +# define CHAR_MIN ((char)SCHAR_MIN) | ||
| +# define CHAR_MAX ((char)SCHAR_MAX) | ||
| # endif | ||
| # define SHRT_MIN (-SHRT_MAX - 1) | ||
| # define SHRT_MAX 0x7fff | ||
| -- | ||
| 2.34.1 | ||
|
Comment on lines
+15
to
+65
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I don't think CCCL is the right place to have these changes.
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Hi @lamarrr, Thank you for reviewing my PR and for opening NVIDIA/jitify#150 to address the Since there is now an upstream fix for Jitify and CCCL does not want downstream patches:contentReference[oaicite:5]{index=5}, I'm thinking about closing this PR rather than keeping a temporary CCCL patch in cuDF. Do you think it makes sense to close it and wait for the Jitify fix to land, or should we keep this open (perhaps removing the CCCL part) until the upstream changes are merged and cuDF is updated? I’d appreciate your guidance on the best course of action. Thanks again! |
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,16 @@ | ||
| { | ||
| "packages": { | ||
| "CCCL": { | ||
| "version": "3.0.2", | ||
| "git_url": "https://github.com/NVIDIA/cccl.git", | ||
| "git_tag": "9c40ed11560fa8ffd21abe4cdc8dc3ce875e48e3", | ||
| "patches": [ | ||
| { | ||
| "file": "${current_json_dir}/cccl_jitify_compatibility.patch", | ||
| "issue": "Fix CCCL/Jitify compatibility issues with stdint types and char limits", | ||
| "fixed_in": "" | ||
| } | ||
| ] | ||
| } | ||
| } | ||
| } |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,23 @@ | ||
| From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 | ||
| From: Claude <noreply@anthropic.com> | ||
| Date: Sat, 14 Sep 2025 00:00:00 +0000 | ||
| Subject: [PATCH] Fix char limits narrowing conversion in numeric_limits | ||
|
|
||
| This patch fixes the narrowing conversion error when instantiating | ||
| numeric_limits<char> by adding explicit casts to CHAR_MIN and CHAR_MAX. | ||
|
|
||
| diff --git a/jitify2.hpp b/jitify2.hpp | ||
| index 1234567..2345678 100644 | ||
| --- a/jitify2.hpp | ||
| +++ b/jitify2.hpp | ||
| @@ -6080,7 +6080,7 @@ struct numeric_limits<bool> | ||
| : public __jitify_detail::IntegerLimits<bool, false, true, 1> {}; | ||
| template <> | ||
| struct numeric_limits<char> | ||
| - : public __jitify_detail::IntegerLimits<char, CHAR_MIN, CHAR_MAX> {}; | ||
| + : public __jitify_detail::IntegerLimits<char, (char)CHAR_MIN, (char)CHAR_MAX> {}; | ||
| template <> | ||
| struct numeric_limits<signed char> | ||
| : public __jitify_detail::IntegerLimits<signed char, SCHAR_MIN, SCHAR_MAX> { | ||
| -- | ||
| 2.34.1 |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,16 @@ | ||
| { | ||
| "packages": { | ||
| "jitify": { | ||
| "version": "2.0.0", | ||
| "git_url": "https://github.com/NVIDIA/jitify.git", | ||
| "git_tag": "44e978b21fc8bdb6b2d7d8d179523c8350db72e5", | ||
| "patches": [ | ||
| { | ||
| "file": "${current_json_dir}/jitify_char_limits.patch", | ||
| "issue": "Fix char limits narrowing conversion in numeric_limits template", | ||
| "fixed_in": "" | ||
| } | ||
| ] | ||
| } | ||
| } | ||
| } |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The
|| trueclause will suppress all git apply failures, including legitimate patch application errors. This could mask real issues when the patch fails to apply correctly, leading to silent build failures later.