[Mlir-commits] [mlir] [MLIR][NVVM] Make the call to findTool optional for fatbinary (PR #93968)
Adam Paszke
llvmlistbot at llvm.org
Fri May 31 07:26:07 PDT 2024
https://github.com/apaszke created https://github.com/llvm/llvm-project/pull/93968
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...).
>From 08a160763c461885b4c418f1b1ffe04345821564 Mon Sep 17 00:00:00 2001
From: Adam Paszke <apaszke at google.com>
Date: Fri, 31 May 2024 16:13:22 +0200
Subject: [PATCH] [MLIR][NVVM] Make the call to findTool optional for fatbinary
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...).
---
mlir/lib/Target/LLVM/NVVM/Target.cpp | 9 ++++++---
1 file changed, 6 insertions(+), 3 deletions(-)
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>.
More information about the Mlir-commits
mailing list