[Mlir-commits] [mlir] [mlir] Decouple NVPTX target from CUDA toolkit presence (PR #93008)

Fabian Mora llvmlistbot at llvm.org
Wed May 22 05:36:35 PDT 2024


fabianmcg wrote:

> The part of the code that does actual serialization to binary (using `ptxas` or `nvptxcompiler`) will now be guarded by `MLIR_ENABLE_CUDA_CONVERSIONS` and should only be available if CUDA toolkit is configured.
> 
> Does this make sense?

Not really. Because you're not changing the definition of `MLIR_ENABLE_CUDA_CONVERSIONS`, hence `MLIR_ENABLE_CUDA_CONVERSIONS` and `LLVM_HAS_NVPTX_TARGET` still fulfill the same purpose.

If the CUDA toolkit is not installed and try to serialize you'll get:
```
error: Couldn't find the `ptxas` binary. Please specify the toolkit path, add the compiler to $PATH, or set one of the environment variables in `NVVM::getCUDAToolkitPath()`.
```
And that's by design, as it allows to ship the functionality of compilation without requiring a hard dependency on the toolkit. This is also what `clang` does, you don't need the toolkit to build clang, only for compiling the code and if the toolkit is missing then fail gracefully.

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


More information about the Mlir-commits mailing list