[clang] [clang][NVPTX] Define macro indicating the PTX version (PR #94934)

Victor Lomuller via cfe-commits cfe-commits at lists.llvm.org
Thu Jun 27 09:34:07 PDT 2024


Naghasan wrote:

Thanks for setting the reviewer

> Can you please include rationale for why this this name e.g. why not __NVPTX_VERSION__?

`NVPTX` is the name of the LLVM backend, `PTX` is the name of assembly which have a version hence `__PTX_VERSION__`. Happy to use a better name, but it is pretty descriptive for what it represent. We could use `__NVPTX_PTX_VERSION__` to avoid a potential clash with future nvcc.

> How does it relate to __CUDA_ARCH__

Doesn't directly relates to `__CUDA_ARCH__`. `__CUDA_ARCH__` is the minimal GPU on which you want to run, the proposed macro indicates the assembly version used and so ties to the ptxas version.

> and why is __CUDA_ARCH__ not sufficient?

as said in the description: usually each new PTX version brings a new sm version and the associated instructions. However, some of these instructions can also be made available to older sm. This allows applications to check more accurately for available instructions.



https://github.com/llvm/llvm-project/pull/94934


More information about the cfe-commits mailing list