This little hack allows us to expose the CUDA target architecture as a device function. It exploits the fact that all relevant CUDA C++ compilers need to work with the nvvm libdevice library and, thus, implement transformations around __nvvm_reflect which we can use to get at the target architecture.
tested and seems to work with NVCC, NVRTC, and Clang
This little hack allows us to expose the CUDA target architecture as a device function. It exploits the fact that all relevant CUDA C++ compilers need to work with the nvvm libdevice library and, thus, implement transformations around
__nvvm_reflect
which we can use to get at the target architecture.tested and seems to work with NVCC, NVRTC, and Clang