[FEA]: Emit diagnostic when users attempt to use CCCL with an invalid version of the CTK
- Dominant language
- C++
- Stars
- 2.5k
- Forks
- 487
- Avg merge
- 2d 7h
- Merged PRs (30d)
- 296
Description
### Is this a duplicate?
- [X] I confirmed there appear to be no [duplicate issues](https://github.com/NVIDIA/cccl/issues) for this request and that I agree to the [Code of Conduct](CODE_OF_CONDUCT.md)
### Area
General CCCL
### Is your feature request related to a problem? Please describe.
As a user of CCCL, I'd like to know if I am violating CCCL's compatibility guarantees by using a version of CCCL with an unsupported version of the CTK.
This can happen in two ways:
1. Backwards compatibility
- A CCCL release is backwards compatible with the oldest minor version of the preceeding major version release. e.g., CCCL 2.2 is not compatible with CTK <= 11.1.
3. Forwards compatibility
- CCCL is _never_ forwards compatible, so users should get a diagnostic when attempting to compile a CCCL header with a CTK version newer than what it was released with.
### Describe the solution you'd like
In a central header, we should have a check something like this:
```
#if (_LIBCUDACXX_CUDACC > __CCCL_NEWEST_SUPPORTED_CTK) && !defined(CCCL_ALLOW_UNSUPPORTED_CTK)
#error "Attempting to use CCCL STRINGIFY(__CCCL_VERSION) with too new a version of CUDA STRINGIFY(_LIBCUDACXX_CUDACC). CCCL is not forward compatible and this is unsupported. To silence this warning, upgrade the version of CCCL you are using or define CCCL_ALLOW_UNSUPPORTED_CTK at your own risk."
#endif
#if (_LIBCUDACXX_CUDACC < __CCCL_OLDEST_SUPPORTED_CTK) && !defined(CCCL_ALLOW_UNSUPPORTED_CTK)
#error "Attempting to use CCCL version STRINGIFY(__CCCL_VERSION) with too old a version of CUDA STRINGIFY(_LIBCUDACXX_CUDACC). To silence this warning, upgrade the version of the CTK you are using or define CCCL_ALLOW_UNSUPPORTED_CTK at your own risk.
#endif
```
### Describe alternatives you've considered
_No response_
### Additional context
Related to new compatibility guarantees as part of https://github.com/NVIDIA/cccl/issues/66
Contributor guide
Assessment
This issue has not been assessed yet.