Skip to content

Commit b12e033

Browse files
authored
[MLIR][GPU] Truncate temp filename path size to avoid linux limitations (#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
1 parent 524665f commit b12e033

File tree

1 file changed

+2
-0
lines changed

1 file changed

+2
-0
lines changed

mlir/lib/Target/LLVM/NVVM/Target.cpp

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -267,6 +267,8 @@ NVPTXSerializer::NVPTXSerializer(Operation &module, NVVMTargetAttr target,
267267
std::optional<NVPTXSerializer::TmpFile>
268268
NVPTXSerializer::createTemp(StringRef name, StringRef suffix) {
269269
llvm::SmallString<128> filename;
270+
if (name.size() > 80)
271+
name = name.substr(0, 80);
270272
std::error_code ec =
271273
llvm::sys::fs::createTemporaryFile(name, suffix, filename);
272274
if (ec) {

0 commit comments

Comments
 (0)