From 56df6960e4de253355aa3acae07212375553f5c6 Mon Sep 17 00:00:00 2001 From: Jonathan Lifflander Date: Thu, 14 Oct 2021 13:31:27 -0700 Subject: [PATCH] #1554: location: remove ColT From location manager template --- src/vt/topos/location/manager.h | 18 +++++------ src/vt/topos/location/manager.impl.h | 12 +++---- .../vrt/collection/collection_builder.impl.h | 2 +- src/vt/vrt/collection/manager.impl.h | 32 ++++++++----------- src/vt/vrt/collection/messages/user.h | 10 +++--- 5 files changed, 33 insertions(+), 41 deletions(-) diff --git a/src/vt/topos/location/manager.h b/src/vt/topos/location/manager.h index 806587dcb3..1d4e6b69ef 100644 --- a/src/vt/topos/location/manager.h +++ b/src/vt/topos/location/manager.h @@ -83,12 +83,12 @@ struct LocationManager : runtime::component::Component { using VrtLocProxyType = EntityLocationCoord; using DataRepType = EntityLocationCoord; - template - using CollectionProxyType = ::vt::vrt::VirtualElmProxyType; - template - using VrtColl = EntityLocationCoord>; - template - using CollectionLocType = PtrType>; + template + using IndexedElmType = EntityLocationCoord; + + template + using CollectionLocType = PtrType; + using LocErasureType = LocationCoord; using LocDeleterType = std::function; using CollectionLocErasedType = std::unique_ptr< @@ -127,15 +127,15 @@ struct LocationManager : runtime::component::Component { * * \return pointer to the coordinator, typed on the collection/index */ - template - VrtColl* getCollectionLM(VirtualProxyType const& proxy); + template + IndexedElmType* getCollectionLM(VirtualProxyType const& proxy); /** * \internal \brief Insert a new location coordinator for a collection * * \param[in] proxy the collection proxy bits */ - template + template void insertCollectionLM(VirtualProxyType const& proxy); public: diff --git a/src/vt/topos/location/manager.impl.h b/src/vt/topos/location/manager.impl.h index 063b9ec59f..d6597ccca7 100644 --- a/src/vt/topos/location/manager.impl.h +++ b/src/vt/topos/location/manager.impl.h @@ -56,9 +56,9 @@ namespace vt { namespace location { -template +template void LocationManager::insertCollectionLM(VirtualProxyType const& proxy) { - using LocType = VrtColl; + using LocType = IndexedElmType; auto loc_man_typed = new LocType( collection_lm_tag_t{}, static_cast(proxy) ); @@ -76,10 +76,10 @@ void LocationManager::insertCollectionLM(VirtualProxyType const& proxy) { ); } -template -LocationManager::VrtColl* +template +LocationManager::IndexedElmType* LocationManager::getCollectionLM(VirtualProxyType const& proxy) { - using LocType = VrtColl; + using LocType = IndexedElmType; auto loc_iter = collectionLoc.find(proxy); auto const& found = loc_iter != collectionLoc.end(); @@ -91,7 +91,7 @@ LocationManager::getCollectionLM(VirtualProxyType const& proxy) { ); if (!found) { - LocationManager::insertCollectionLM(proxy); + LocationManager::insertCollectionLM(proxy); loc_iter = collectionLoc.find(proxy); } else if (!found) { return nullptr; diff --git a/src/vt/vrt/collection/collection_builder.impl.h b/src/vt/vrt/collection/collection_builder.impl.h index 1156abe589..ad98090101 100644 --- a/src/vt/vrt/collection/collection_builder.impl.h +++ b/src/vt/vrt/collection/collection_builder.impl.h @@ -128,7 +128,7 @@ void CollectionManager::makeCollectionImpl(param::ConstructParams& po) { // Invoke getCollectionLM() to create a new location manager instance for // this collection - theLocMan()->getCollectionLM(proxy); + theLocMan()->getCollectionLM(proxy); // Insert action on cleanup for this collection addCleanupFn(proxy); diff --git a/src/vt/vrt/collection/manager.impl.h b/src/vt/vrt/collection/manager.impl.h index bcb18d9be8..a27280d364 100644 --- a/src/vt/vrt/collection/manager.impl.h +++ b/src/vt/vrt/collection/manager.impl.h @@ -1178,12 +1178,12 @@ messaging::PendingSend CollectionManager::sendMsgUntypedHandler( theMsg()->pushEpoch(cur_epoch); auto home_node = theCollection()->getMappedNode(col_proxy, idx); // route the message to the destination using the location manager - auto lm = theLocMan()->getCollectionLM(col_proxy); + auto lm = theLocMan()->getCollectionLM(col_proxy); vtAssert(lm != nullptr, "LM must exist"); theMsg()->markAsCollectionMessage(msg); lm->template routeMsgSerializeHandler< MsgT, collectionMsgTypedHandler - >(toProxy, home_node, msg); + >(idx, home_node, msg); theMsg()->popEpoch(cur_epoch); } }; @@ -1233,16 +1233,16 @@ bool CollectionManager::insertCollectionElement( }); if (is_migrated_in) { - theLocMan()->getCollectionLM(proxy)->entityImmigrated( - VrtElmProxy{proxy,idx}, home_node, migrated_from, + theLocMan()->getCollectionLM(proxy)->entityImmigrated( + idx, home_node, migrated_from, CollectionManager::collectionMsgHandler ); elm_holder->applyListeners( listener::ElementEventEnum::ElementMigratedIn, idx ); } else { - theLocMan()->getCollectionLM(proxy)->registerEntity( - VrtElmProxy{proxy,idx}, home_node, + theLocMan()->getCollectionLM(proxy)->registerEntity( + idx, home_node, CollectionManager::collectionMsgHandler ); elm_holder->applyListeners( @@ -1366,7 +1366,7 @@ void CollectionManager::insertMetaCollection( * This is to ensure that the collection LM instance gets created so that * messages can be forwarded properly */ - theLocMan()->getCollectionLM(proxy); + theLocMan()->getCollectionLM(proxy); /** * Type-erase some lambdas for doing the collective broadcast that collects up @@ -1459,9 +1459,8 @@ template using IndexType = typename ColT::IndexType; auto proxy = msg->proxy_; auto idx = msg->idx_; - auto lm = theLocMan()->getCollectionLM(proxy.getProxy()); - VrtElmProxy elm{proxy.getProxy(),idx}; - auto elm_lives_somewhere = lm->isCached(elm); + auto lm = theLocMan()->getCollectionLM(proxy.getProxy()); + auto elm_lives_somewhere = lm->isCached(idx); vt_debug_print( verbose, vrt_coll, @@ -1474,7 +1473,7 @@ template } else { auto const insert_node = msg->construct_node_; // reserve the slot to stop any race with other insertions - lm->registerEntityRemote(elm, msg->home_node_, insert_node); + lm->registerEntityRemote(idx, msg->home_node_, insert_node); // send a message back that the insertion shall proceed auto send_msg = makeMessage>( @@ -1696,11 +1695,8 @@ void CollectionManager::insert( // element exists here and is live--return proceed_with_insertion = false; } else { - auto lm = theLocMan()->getCollectionLM( - untyped_proxy - ); - VrtElmProxy elm{untyped_proxy,idx}; - auto elm_lives_somewhere = lm->isCached(elm); + auto lm = theLocMan()->getCollectionLM(untyped_proxy); + auto elm_lives_somewhere = lm->isCached(idx); if (elm_lives_somewhere) { // element exists somewhere in the system and since we are the home // we check the cache to determine if it has been inserted @@ -1893,9 +1889,7 @@ MigrateStatus CollectionManager::migrateOut( MigrateMsgType, MigrateHandlers::migrateInHandler >(dest, msg); - theLocMan()->getCollectionLM(col_proxy)->entityEmigrated( - proxy, dest - ); + theLocMan()->getCollectionLM(col_proxy)->entityEmigrated(idx, dest); /* * Invoke the virtual epilog migrate out function diff --git a/src/vt/vrt/collection/messages/user.h b/src/vt/vrt/collection/messages/user.h index b8cf9eba10..d2a5cf7230 100644 --- a/src/vt/vrt/collection/messages/user.h +++ b/src/vt/vrt/collection/messages/user.h @@ -57,10 +57,8 @@ namespace vt { namespace vrt { namespace collection { -template -using RoutedMessageType = LocationRoutedMsg< - ::vt::vrt::VirtualElmProxyType, MessageT ->; +template +using RoutedMessageType = LocationRoutedMsg; #pragma GCC diagnostic push #pragma GCC diagnostic ignored "-Wunused-variable" @@ -68,8 +66,8 @@ static struct ColMsgWrapTagType { } ColMsgWrapTag { }; #pragma GCC diagnostic pop template -struct CollectionMessage : RoutedMessageType { - using MessageParentType = RoutedMessageType; +struct CollectionMessage : RoutedMessageType { + using MessageParentType = RoutedMessageType; vt_msg_serialize_if_needed_by_parent(); /*