Skip to content

Conversation

@miscco
Copy link
Contributor

@miscco miscco commented Jan 5, 2026

We need to avoid using those identifiers as they are frequently used by users

Addresses nvbug5781562

@miscco miscco requested a review from a team as a code owner January 5, 2026 08:13
@miscco miscco requested a review from bernhardmgruber January 5, 2026 08:13
@github-project-automation github-project-automation bot moved this to Todo in CCCL Jan 5, 2026
@cccl-authenticator-app cccl-authenticator-app bot moved this from Todo to In Review in CCCL Jan 5, 2026
@davebayer
Copy link
Contributor

Uuuh, I don't know whether this is a good idea, we could end up adding more and more of these macros. And I don't think it will fix the problem, because then if the user wants to use cc.major() somewhere, it will blow up again.

@miscco
Copy link
Contributor Author

miscco commented Jan 5, 2026

The other option would be to change the member function to major_version or version_major

@pciolkosz what do you prefer?

@github-actions

This comment has been minimized.

@davebayer
Copy link
Contributor

The other option would be to change the member function to major_version or version_major

This API is already released, we cannot change that. I really think that this is user's problem, because if you have a look for example at <nvrtc.h>, they use major and minor as names for function parameters and the compilation would fail if the user defines the macros.

It's not that I don't want to help the user, but this solution is not sustainable. We are already trying our best to prevent the user to modify our internals, but I don't think we should do that for everything.

@jrhemstad
Copy link
Collaborator

@davebayer @miscco the "user" in this situation is just one of the CUDA samples, specifically:
https://github.com/NVIDIA/cuda-samples/tree/master/Samples/3_CUDA_Features/cdpAdvancedQuicksort
https://github.com/NVIDIA/cuda-samples/tree/master/Samples/3_CUDA_Features/cdpQuadtree

That said, I don't see any macro definition of major or minor here that would cause the issue @miscco described.

@miscco
Copy link
Contributor Author

miscco commented Jan 7, 2026

Yeah I am really wondering how this could happen, but that the error in question is:

Command output: /usr/local/cuda-safe-13.2/targets/aarch64-qnx/include/cccl/cuda/__device/compute_capability.h(87): error: expected an identifier
                 __attribute__((__visibility__("hidden"))) constexpr int ((int)((() >> 10) & 0x3f)) const noexcept

This clearly hints at major() being replaced by ((int)((() >> 10) & 0x3f))

@davebayer
Copy link
Contributor

I've done some research and those macros come from sys/sysmacros.h. Could you please update the description for these macros?

@miscco miscco force-pushed the guard_major_minor_macro branch from def970f to 85ad12c Compare January 7, 2026 08:58
@miscco
Copy link
Contributor Author

miscco commented Jan 7, 2026

closing in favor of #7099

@miscco miscco closed this Jan 7, 2026
@github-project-automation github-project-automation bot moved this from In Review to Done in CCCL Jan 7, 2026
@github-actions
Copy link
Contributor

github-actions bot commented Jan 7, 2026

😬 CI Workflow Results

🟥 Finished in 6h 00m: Pass: 95%/91 | Total: 2d 20h | Max: 6h 00m | Hits: 71%/201726

See results here.

@miscco miscco deleted the guard_major_minor_macro branch January 7, 2026 15:16
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Status: Done

Development

Successfully merging this pull request may close these issues.

5 participants