[Mlir-commits] [mlir] [MLIR][NVVM] Make the call to findTool optional for fatbinary (PR #93968)

llvmlistbot at llvm.org llvmlistbot at llvm.org
Fri May 31 07:26:35 PDT 2024


llvmbot wrote:


<!--LLVM PR SUMMARY COMMENT-->

@llvm/pr-subscribers-mlir

Author: Adam Paszke (apaszke)

<details>
<summary>Changes</summary>

The fatbinary tool is only needed when the fatbinary format is requested.

The current code is especially confusing in that it emits an error complaining that fatbinary has not been found even though it's not even used (and the serialization succeeds nevertheless...).

---
Full diff: https://github.com/llvm/llvm-project/pull/93968.diff


1 Files Affected:

- (modified) mlir/lib/Target/LLVM/NVVM/Target.cpp (+6-3) 


``````````diff
diff --git a/mlir/lib/Target/LLVM/NVVM/Target.cpp b/mlir/lib/Target/LLVM/NVVM/Target.cpp
index e75547ff9b850..acb903aa37caf 100644
--- a/mlir/lib/Target/LLVM/NVVM/Target.cpp
+++ b/mlir/lib/Target/LLVM/NVVM/Target.cpp
@@ -267,9 +267,12 @@ NVPTXSerializer::compileToBinary(const std::string &ptxCode) {
   std::optional<std::string> ptxasCompiler = findTool("ptxas");
   if (!ptxasCompiler)
     return std::nullopt;
-  std::optional<std::string> fatbinaryTool = findTool("fatbinary");
-  if (createFatbin && !fatbinaryTool)
-    return std::nullopt;
+  std::optional<std::string> fatbinaryTool;
+  if (createFatbin) {
+    fatbinaryTool = findTool("fatbinary");
+    if (!fatbinaryTool)
+      return std::nullopt;
+  }
   Location loc = getOperation().getLoc();
 
   // Base name for all temp files: mlir-<module name>-<target triple>-<chip>.

``````````

</details>


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


More information about the Mlir-commits mailing list