This is an automated email from the ASF dual-hosted git repository.
hongze pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/incubator-gluten.git
The following commit(s) were added to refs/heads/main by this push:
new 2a6a974d6 [GLUTEN-6534] [VL] Fix ObjectStore::stores initialized twice
issue (#6549)
2a6a974d6 is described below
commit 2a6a974d6fbaa38869eb9a0b91b2e796a578884c
Author: James Xu <[email protected]>
AuthorDate: Tue Jul 23 09:40:19 2024 +0800
[GLUTEN-6534] [VL] Fix ObjectStore::stores initialized twice issue (#6549)
---
cpp/core/utils/ObjectStore.cc | 6 ++++++
cpp/core/utils/ObjectStore.h | 5 +----
cpp/core/utils/ResourceMap.h | 7 +++++--
3 files changed, 12 insertions(+), 6 deletions(-)
diff --git a/cpp/core/utils/ObjectStore.cc b/cpp/core/utils/ObjectStore.cc
index 648163e4b..82929a18d 100644
--- a/cpp/core/utils/ObjectStore.cc
+++ b/cpp/core/utils/ObjectStore.cc
@@ -19,6 +19,12 @@
#include <glog/logging.h>
#include <iostream>
+// static
+gluten::ResourceMap<gluten::ObjectStore*>& gluten::ObjectStore::stores() {
+ static gluten::ResourceMap<gluten::ObjectStore*> stores;
+ return stores;
+}
+
gluten::ObjectStore::~ObjectStore() {
// destructing in reversed order (the last added object destructed first)
const std::lock_guard<std::mutex> lock(mtx_);
diff --git a/cpp/core/utils/ObjectStore.h b/cpp/core/utils/ObjectStore.h
index 8e5dd250a..5a38a1af3 100644
--- a/cpp/core/utils/ObjectStore.h
+++ b/cpp/core/utils/ObjectStore.h
@@ -73,10 +73,7 @@ class ObjectStore {
ObjectHandle save(std::shared_ptr<void> obj);
private:
- static ResourceMap<ObjectStore*>& stores() {
- static ResourceMap<ObjectStore*> stores;
- return stores;
- }
+ static ResourceMap<ObjectStore*>& stores();
ObjectHandle toObjHandle(ResourceHandle rh) {
ObjectHandle prefix = static_cast<ObjectHandle>(storeId_) <<
(sizeof(ResourceHandle) * 8);
diff --git a/cpp/core/utils/ResourceMap.h b/cpp/core/utils/ResourceMap.h
index 580ad4f6f..b60051afe 100644
--- a/cpp/core/utils/ResourceMap.h
+++ b/cpp/core/utils/ResourceMap.h
@@ -56,13 +56,16 @@ class ResourceMap {
void erase(ResourceHandle moduleId) {
const std::lock_guard<std::mutex> lock(mtx_);
- GLUTEN_CHECK(map_.erase(moduleId) == 1, "Module not found in resource map:
" + std::to_string(moduleId));
+ GLUTEN_CHECK(
+ map_.erase(moduleId) == 1,
+ "ResourceHandle not found in resource map when try to erase: " +
std::to_string(moduleId));
}
TResource lookup(ResourceHandle moduleId) {
const std::lock_guard<std::mutex> lock(mtx_);
auto it = map_.find(moduleId);
- GLUTEN_CHECK(it != map_.end(), "Module not found in resource map: " +
std::to_string(moduleId));
+ GLUTEN_CHECK(
+ it != map_.end(), "ResourceHandle not found in resource map when try
to lookup: " + std::to_string(moduleId));
return it->second;
}
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]