From 08a160763c461885b4c418f1b1ffe04345821564 Mon Sep 17 00:00:00 2001 From: Adam Paszke 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 ptxasCompiler = findTool("ptxas"); if (!ptxasCompiler) return std::nullopt; - std::optional fatbinaryTool = findTool("fatbinary"); - if (createFatbin && !fatbinaryTool) - return std::nullopt; + std::optional fatbinaryTool; + if (createFatbin) { + fatbinaryTool = findTool("fatbinary"); + if (!fatbinaryTool) + return std::nullopt; + } Location loc = getOperation().getLoc(); // Base name for all temp files: mlir---.