Skip to content
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

implement new CUDA compiler checks #2983

Closed

Conversation

davebayer
Copy link
Contributor

This PR introduces a new CUDA compiler handling, following the C++ compiler checks.

Changes:

  • _CCCL_CUDA_COMPILER_* now expands to the CUDA compiler version (does what _CCCL_CUDACC_VER did)
  • the current CUDA compiler should be checked using _CCCL_CUDA_COMPILER(_name [, _op, _maj [, min]]) macro
  • the old _CCCL_CUDA_COMPILER is replaced with _CCCL_HAS_CUDA_COMPILER flag
  • the _CCCL_CUDACC_* are replaced by _CCCL_CUDA_COMPILER_* to match the naming
  • _CCCL_CUDA_COMPILATION flag can be used to check if CUDA source file is being compiled
  • _CCCL_DEVICE_COMPILATION flag can be used to check if the device code is being compiled (should replace defined(__CUDA_ARCH__)
  • the _CCCL_PTX_ARCH should be valid for compilation with NVHPC compiler now

There are still many places where the CUDA compiler version is meant to be NVCC only and should be fixed.

Copy link

copy-pr-bot bot commented Nov 28, 2024

This pull request requires additional validation before any workflows can run on NVIDIA's runners.

Pull request vetters can view their responsibilities here.

Contributors can view more details about this message here.

@davebayer davebayer requested review from a team as code owners November 28, 2024 12:25
@bernhardmgruber
Copy link
Contributor

Please properly rebase this PR onto main. I see some changes in the diff that were merged recently.

@davebayer davebayer marked this pull request as draft November 28, 2024 21:16
@@ -45,12 +45,12 @@ _CCCL_DIAG_SUPPRESS_CLANG("-Wunused-function")
# include <cuda_bf16.h>
_CCCL_DIAG_POP

# if _CCCL_CUDACC_AT_LEAST(11, 8)
# if _CCCL_CUDA_COMPILER_AT_LEAST(11, 8)
Copy link
Contributor

@miscco miscco Nov 30, 2024

Choose a reason for hiding this comment

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

We cannot change that macro, This relates to the __CUDACC__ macro, aka the version of the cuda headers used

This is different from the version of e.g clang-cuda and also nvc++ can consume cuda headers from different versions.

So we should leave that macro alone.

So for the currently supported compilers we have

  • nvcc: nvcc version + cudacc version more or less equivalent
  • nvrtc: same as nvcc
  • clang-cuda: clang version + cudacc version. slightly coupled, I believe the cudacc version is bound to the clang version
  • nvc++: nvc++ version and cudacc version are completely uncoupled, nvc++ can consume different cuda header versions

Copy link
Contributor

Choose a reason for hiding this comment

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

@bernhardmgruber @gevtushenko Do you have a opinions here?

Copy link
Contributor

Choose a reason for hiding this comment

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

@miscco it seems you already have a far better understanding what __CUDACC__ means, so I leave this decision to you.

I agree that if __CUDACC__ does not designate a CUDA compiler version, then renaming _CCCL_CUDACC_AT_LEAST to _CCCL_CUDA_COMPILER_AT_LEAST is misleading.

@davebayer
Copy link
Contributor Author

The PR is replaced by #3057.

@davebayer davebayer closed this Dec 4, 2024
@davebayer davebayer deleted the impl_new_cuda_compiler_checks branch December 16, 2024 10:09
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Archived in project
Development

Successfully merging this pull request may close these issues.

3 participants