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

llvmlistbot at llvm.org llvmlistbot at llvm.org
Wed May 22 05:21:18 PDT 2024


tyb0807 wrote:

> They're already decoupled, `MLIR_ENABLE_CUDA_CONVERSIONS` is an alias for checking whether the `NVPTX` target was built, see: https://github.com/llvm/llvm-project/blob/main/mlir/CMakeLists.txt#L115C1-L119
> 
> Also, `moduleToObject` will succeed if `NVPTX` was built and the compilation target is `offload` or `ptx`, I know this because I use it frequently in a machine without the toolkit.
> 
> I'm ok with changing the name of the flag as it might be confusing.

Yes, one of the changes introduced here is just replacing `MLIR_ENABLE_CUDA_CONVERSIONS` to `LLVM_HAS_NVPTX_TARGET`. However, I'm keeping `MLIR_ENABLE_CUDA_CONVERSIONS` flag to indicate whether CUDA toolkit is configured or not, as one can build LLVM with `NVPTX`, then accidentally try to serialize to `binary` without having the toolkit available. 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?

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


More information about the Mlir-commits mailing list