[clang] [flang] [llvm] [mlir] Reland "[NVPTX] Validate user-specified PTX version against SM version" (PR #179304)
Joseph Huber via cfe-commits
cfe-commits at lists.llvm.org
Thu Feb 5 12:58:26 PST 2026
jhuber6 wrote:
I'm just catching up here, what's the intention here? I intentionally set the PTX version when compiling the GPU runtimes to fulfill the minimum subset of features we need on the different targets.
Getting this CMake check to work is mostly an insane hack because of NVIDIA's decision to keep all their binaries separate, not provide a PTX backend, and to not treat `nvlink` like a proper linker. I pass `-flto -c` to skip the linker entirely because not every system will have them installed.
```
/buildbot/cuda-builder/work/build/./bin/clang++ --target=nvptx64-nvidia-cuda -DCXX_SUPPORTS_CUSTOM_LINKER -flto -c -MD -MT CMakeFiles/cmTC_25eda.dir/src.cxx.o -MF CMakeFiles/cmTC_25eda.dir/src.cxx.o.d -o CMakeFiles/cmTC_25eda.dir/src.cxx.o -c /buildbot/cuda-builder/work/build/runtimes/runtimes-nvptx64-nvidia-cuda-bins/CMakeFiles/CMakeScratch/TryCompile-kmIhCc/src.cxx
```
I'm honestly not sure why this is failing here, it seems to work fine on my machine and I would expect this to just hit some reasonable default. Does this PR intend to change the behavior of this?
```
clang --target=nvptx64-nvidia-cuda -flto -c foo.c
```
https://github.com/llvm/llvm-project/pull/179304
More information about the cfe-commits
mailing list