Skip to content

Commit

Permalink
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
#2063: Update void* to std::byte* in ObjGroupManager
Browse files Browse the repository at this point in the history
thearusable committed Mar 19, 2024
1 parent 6d2c0cf commit 686db79
Showing 3 changed files with 7 additions and 7 deletions.
2 changes: 1 addition & 1 deletion src/vt/objgroup/manager.cc
Original file line number Diff line number Diff line change
@@ -84,7 +84,7 @@ ObjGroupProxyType ObjGroupManager::getProxy(ObjGroupProxyType proxy) {
}

ObjGroupProxyType ObjGroupManager::makeCollectiveImpl(
std::string const& label, HolderBasePtrType base, void* obj_ptr
std::string const& label, HolderBasePtrType base, std::byte* obj_ptr
) {
auto const id = cur_obj_id_++;
auto const node = theContext()->getNode();
4 changes: 2 additions & 2 deletions src/vt/objgroup/manager.h
Original file line number Diff line number Diff line change
@@ -446,7 +446,7 @@ struct ObjGroupManager : runtime::component::Component<ObjGroupManager> {
* \return a new untyped proxy
*/
ObjGroupProxyType makeCollectiveImpl(
std::string const& label, HolderBasePtrType b, void* obj_ptr
std::string const& label, HolderBasePtrType b, std::byte* obj_ptr
);

/**
@@ -496,7 +496,7 @@ struct ObjGroupManager : runtime::component::Component<ObjGroupManager> {
/// Type-erased pointers to the objects held on this node
std::unordered_map<ObjGroupProxyType, HolderBasePtrType> objs_;
/// Reverse lookup map from an object pointer to the proxy
std::unordered_map<void*, ObjGroupProxyType> obj_to_proxy_;
std::unordered_map<std::byte*, ObjGroupProxyType> obj_to_proxy_;
/// Messages that are pending creation for delivery
std::unordered_map<ObjGroupProxyType, std::vector<ActionType>> pending_;
/// Map of object groups' labels
8 changes: 4 additions & 4 deletions src/vt/objgroup/manager.impl.h
Original file line number Diff line number Diff line change
@@ -103,7 +103,7 @@ ObjGroupManager::makeCollective(std::unique_ptr<ObjT> obj, std::string const& la
template <typename ObjT>
ObjGroupManager::ProxyType<ObjT>
ObjGroupManager::makeCollectiveObj(std::string const& label, ObjT* obj, HolderBasePtrType holder) {
auto const obj_ptr = reinterpret_cast<void*>(obj);
auto const obj_ptr = reinterpret_cast<std::byte*>(obj);
auto const proxy = makeCollectiveImpl(label, std::move(holder), obj_ptr);
auto iter = objs_.find(proxy);
vtAssert(iter != objs_.end(), "Obj must exist on this node");
@@ -301,14 +301,14 @@ void ObjGroupManager::update(ProxyElmType<ObjT> proxy, Args&&... args) {
HolderBaseType* holder = iter->second.get();
auto obj_holder = static_cast<holder::Holder<ObjT>*>(holder);

auto const cur_obj_ptr = obj_holder->get();
auto const cur_obj_ptr = reinterpret_cast<std::byte*>(obj_holder->get());
auto map_iter = obj_to_proxy_.find(cur_obj_ptr);
vtAssert(map_iter != obj_to_proxy_.end(), "Object pointer must exist in map");
obj_to_proxy_.erase(map_iter);

obj_holder->reset(std::forward<Args>(args)...);

auto const new_obj_ptr = obj_holder->get();
auto const new_obj_ptr = reinterpret_cast<std::byte*>(obj_holder->get());
obj_to_proxy_[new_obj_ptr] = proxy_bits;
}

@@ -321,7 +321,7 @@ void ObjGroupManager::update(ProxyType<ObjT> proxy, Args&&... args) {

template <typename ObjT>
typename ObjGroupManager::ProxyType<ObjT> ObjGroupManager::getProxy(ObjT* obj) {
auto map_iter = obj_to_proxy_.find(obj);
auto map_iter = obj_to_proxy_.find(reinterpret_cast<std::byte*>(obj));
vtAssert(map_iter != obj_to_proxy_.end(), "Object pointer does not exist");
return ProxyType<ObjT>(map_iter->second);
}

0 comments on commit 686db79

Please sign in to comment.