From 2394de9b374f7521efffcb296084511a17f0b84e Mon Sep 17 00:00:00 2001
From: foreman
Date: Fri, 16 Aug 2019 11:44:16 -0400
Subject: [PATCH] P4 to Git Change 1984520 by
vsytchen@vsytchen-remote-ocl-win10 on 2019/08/16 11:35:50
SWDEV-198885 - [CQE][OCL][NAVI10][NAVI14 ] compiler temps not generated
Blender 2.8 spawns a new process for each kernel to be compiled. This makes saving temporaries impossible, since all of the kernels will have the same file names.
1. Add a formatting field %pid% to the dump prefix of -save-temps/-save-temps-all. The runtime will replace this field with the PID of the current process.
ReviewBoardURL = http://ocltc.amd.com/reviews/r/17832/diff/
Affected files ...
... //depot/stg/opencl/drivers/opencl/compiler/lib/utils/options.cpp#45 edit
... //depot/stg/opencl/drivers/opencl/compiler/lib/utils/options.hpp#21 edit
[ROCm/clr commit: 133a9ef59b7283f8188641f39ba797281b43e540]
---
projects/clr/rocclr/compiler/lib/utils/options.cpp | 14 +++++++++++++-
projects/clr/rocclr/compiler/lib/utils/options.hpp | 1 +
2 files changed, 14 insertions(+), 1 deletion(-)
diff --git a/projects/clr/rocclr/compiler/lib/utils/options.cpp b/projects/clr/rocclr/compiler/lib/utils/options.cpp
index 14e2eb1d72..c8d004bbf7 100644
--- a/projects/clr/rocclr/compiler/lib/utils/options.cpp
+++ b/projects/clr/rocclr/compiler/lib/utils/options.cpp
@@ -1513,8 +1513,20 @@ static std::string getValidDumpBaseName(const std::string &path, const std::stri
void
Options::setDumpFileName(const char* val)
{
+ std::string dumpPrefix = oVariables->DumpPrefix;
+ const size_t pidPos = dumpPrefix.find("%pid%");
+ if (pidPos != std::string::npos) {
+#ifdef _WIN32
+ const std::int32_t pid = _getpid();
+#endif
+#ifdef __linux__
+ const std::int32_t pid = getpid();
+#endif
+ dumpPrefix.replace(pidPos, 5, std::to_string(pid));
+ }
+
std::stringstream prefix;
- prefix << oVariables->DumpPrefix << "_" << buildNo << "_" << val;
+ prefix << dumpPrefix << "_" << buildNo << "_" << val;
dumpFileRoot = prefix.str();
// Check whether the length of path meets the system limits
diff --git a/projects/clr/rocclr/compiler/lib/utils/options.hpp b/projects/clr/rocclr/compiler/lib/utils/options.hpp
index f721f58869..cdbec7870c 100644
--- a/projects/clr/rocclr/compiler/lib/utils/options.hpp
+++ b/projects/clr/rocclr/compiler/lib/utils/options.hpp
@@ -16,6 +16,7 @@
#include
#endif
#ifdef _WIN32
+#include
#include
#endif