From 24deabe498a001b31ff1802e4cfea9be4416271e Mon Sep 17 00:00:00 2001
From: foreman
Date: Wed, 11 Dec 2019 19:31:20 -0500
Subject: [PATCH] P4 to Git Change 2044310 by cpaquot@cpaquot-ocl-lc-lnx on
2019/12/11 19:20:38
SWDEV-213526 - [hip] OOM issue
Clean up a bit from Laurent's comments.
Affected files ...
... //depot/stg/opencl/drivers/opencl/api/hip/hip_internal.hpp#50 edit
... //depot/stg/opencl/drivers/opencl/api/hip/hip_platform.cpp#56 edit
---
hipamd/api/hip/hip_internal.hpp | 6 +++---
hipamd/api/hip/hip_platform.cpp | 6 ++++++
2 files changed, 9 insertions(+), 3 deletions(-)
diff --git a/hipamd/api/hip/hip_internal.hpp b/hipamd/api/hip/hip_internal.hpp
index a44b5a0b5a..7e1b5e941c 100644
--- a/hipamd/api/hip/hip_internal.hpp
+++ b/hipamd/api/hip/hip_internal.hpp
@@ -124,10 +124,10 @@ struct ihipExec_t {
};
class PlatformState {
- amd::Monitor lock_;
+ amd::Monitor lock_{"Guards global function map"};
std::unordered_map>> modules_;
- bool initialized_;
+ bool initialized_{false};
void digestFatBinary(const void* data, std::vector>& programs);
public:
@@ -181,7 +181,7 @@ private:
static PlatformState* platform_;
- PlatformState() : lock_("Guards global function map"), initialized_(false) {}
+ PlatformState() {}
~PlatformState() {}
public:
static PlatformState& instance() {
diff --git a/hipamd/api/hip/hip_platform.cpp b/hipamd/api/hip/hip_platform.cpp
index 6ce138e7a3..abb7cdb740 100644
--- a/hipamd/api/hip/hip_platform.cpp
+++ b/hipamd/api/hip/hip_platform.cpp
@@ -137,6 +137,10 @@ extern "C" std::vector>* __hipRegisterFatBinary(con
void PlatformState::digestFatBinary(const void* data, std::vector>& programs)
{
+ if (programs.size() > 0) {
+ return;
+ }
+
std::vector> code_objs;
std::vector devices;
for (size_t dev = 0; dev < g_devices.size(); ++dev) {
@@ -164,6 +168,8 @@ void PlatformState::digestFatBinary(const void* data, std::vector