[Mlir-commits] [mlir] [MLIR][GPU] Truncate temp filename path size to avoid linux limitations (PR #155108)

llvmlistbot at llvm.org llvmlistbot at llvm.org
Sat Aug 23 09:21:40 PDT 2025


llvmbot wrote:


<!--LLVM PR SUMMARY COMMENT-->

@llvm/pr-subscribers-mlir

Author: William Moses (wsmoses)

<details>
<summary>Changes</summary>

Linux has a limitation of 256 characters for a path. Large function names being serialized will cause this to fail. As createTemporaryFile already unique's the file (up to 128 retries for different name variations), truncating should suffice

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


1 Files Affected:

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


``````````diff
diff --git a/mlir/lib/Target/LLVM/NVVM/Target.cpp b/mlir/lib/Target/LLVM/NVVM/Target.cpp
index 62eaadb3d16b1..8760ea8588e2c 100644
--- a/mlir/lib/Target/LLVM/NVVM/Target.cpp
+++ b/mlir/lib/Target/LLVM/NVVM/Target.cpp
@@ -267,6 +267,8 @@ NVPTXSerializer::NVPTXSerializer(Operation &module, NVVMTargetAttr target,
 std::optional<NVPTXSerializer::TmpFile>
 NVPTXSerializer::createTemp(StringRef name, StringRef suffix) {
   llvm::SmallString<128> filename;
+  if (name.size() > 80)
+    name = name.substr(0, 80);
   std::error_code ec =
       llvm::sys::fs::createTemporaryFile(name, suffix, filename);
   if (ec) {

``````````

</details>


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


More information about the Mlir-commits mailing list