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

Oleksandr Alex Zinenko llvmlistbot at llvm.org
Wed May 22 03:23:13 PDT 2024


================
@@ -549,22 +555,29 @@ NVPTXSerializer::moduleToObject(llvm::Module &llvmModule) {
   });
 #undef DEBUG_TYPE
 
-  // Return PTX if the compilation target is assembly.
+  // Return PTX if the compilation target is `assembly`.
   if (targetOptions.getCompilationTarget() ==
       gpu::CompilationTarget::Assembly) {
     // Make sure to include the null terminator.
     StringRef bin(serializedISA->c_str(), serializedISA->size() + 1);
     return SmallVector<char, 0>(bin.begin(), bin.end());
   }
 
+  // At this point, compilation target is either `binary` or `fatbinary`, which
+  // requires CUDA toolkit.
+  if (!(MLIR_ENABLE_CUDA_CONVERSIONS)) {
+    getOperation().emitError(
+        "CUDA toolkit not provided when trying to serialize GPU module.");
----------------
ftynse wrote:

```suggestion
        "CUDA toolkit not provided when trying to serialize GPU module");
```

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


More information about the Mlir-commits mailing list