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

llvmlistbot at llvm.org llvmlistbot at llvm.org
Wed May 22 06:02:10 PDT 2024


tyb0807 wrote:

> 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.

Yes I'd wanted to change the definition of `MLIR_ENABLE_CUDA_CONVERSIONS` in a separate patch, but now I realize it doesn't make much sense w/o that change here.

> If the CUDA toolkit is not installed and try to serialize to binary you'll get:

Right, I know this situation is handled, but thought it'd be better to guard the whole definition of `compileToBinary` behind a flag saying whether CUDA toolkit is available.

Note that naming of `MLIR_ENABLE_CUDA_CONVERSIONS` is so confusing that it is set here https://github.com/llvm/llvm-project/blob/cdcd65350bdeafccda33a5d4185c04f4bbe59495/utils/bazel/llvm-project-overlay/mlir/BUILD.bazel#L54-L56 w/o checking NVPTX target.

So I guess we should only change `MLIR_ENABLE_CUDA_CONVERSIONS` to `LLVM_HAS_NVPTX_TARGET` here. I've looked at other usages of `MLIR_ENABLE_CUDA_CONVERSIONS` across the codebase and I believe we can replace `MLIR_ENABLE_CUDA_CONVERSIONS` by `LLVM_HAS_NVPTX_TARGET` entirely. WDYT?

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


More information about the Mlir-commits mailing list