[Mlir-commits] [mlir] [MLIR][GPU] Truncate temp filename path size to avoid linux limitations (PR #155108)
William Moses
llvmlistbot at llvm.org
Sat Aug 23 09:21:09 PDT 2025
https://github.com/wsmoses created https://github.com/llvm/llvm-project/pull/155108
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
>From a80db473cd165e2cdf96d12061fdd94a341933cf Mon Sep 17 00:00:00 2001
From: "William S. Moses" <gh at wsmoses.com>
Date: Sat, 23 Aug 2025 11:17:13 -0500
Subject: [PATCH] [MLIR][GPU] Truncate temp filename path size to avoid linux
limitations
---
mlir/lib/Target/LLVM/NVVM/Target.cpp | 2 ++
1 file changed, 2 insertions(+)
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) {
More information about the Mlir-commits
mailing list