From c824fbdd61b3d7623055003a46e045ac38d767c8 Mon Sep 17 00:00:00 2001 From: Hartmut Kaiser Date: Mon, 5 Feb 2024 13:46:02 -0600 Subject: [PATCH] Fixing locality-id calculation --- libs/full/agas/src/addressing_service.cpp | 20 ++++++++++--------- libs/full/agas/src/route.cpp | 3 ++- .../include/hpx/naming_base/gid_type.hpp | 5 ++--- 3 files changed, 15 insertions(+), 13 deletions(-) diff --git a/libs/full/agas/src/addressing_service.cpp b/libs/full/agas/src/addressing_service.cpp index 3ddf7ac7624d..98cd0342deec 100644 --- a/libs/full/agas/src/addressing_service.cpp +++ b/libs/full/agas/src/addressing_service.cpp @@ -842,7 +842,9 @@ namespace hpx::agas { { // NOTE: This should still be migration safe. return naming::detail::strip_internal_bits_and_component_type_from_gid( - msb) == get_local_locality().get_msb(); + msb) == + naming::detail::strip_internal_bits_and_component_type_from_gid( + get_local_locality().get_msb()); } bool addressing_service::resolve_locally_known_addresses( @@ -1019,7 +1021,7 @@ namespace hpx::agas { } // don't look at cache if id is marked as non-cache-able - if (!naming::detail::store_in_cache(id)) + if (!naming::detail::store_in_cache(id) || naming::is_locality(id)) { if (&ec != &throws) ec = make_success_code(); @@ -1131,7 +1133,7 @@ namespace hpx::agas { } // Resolve the gva to the real resolved address (which is just a gva - // with as fully resolved LVA and and offset of zero). + // with as fully resolved LVA and offset of zero). naming::gid_type const base_gid = hpx::get<0>(rep); gva const base_gva = hpx::get<1>(rep); @@ -1220,8 +1222,9 @@ namespace hpx::agas { if (get<0>(rep) == naming::invalid_gid || get<2>(rep) == naming::invalid_gid) return false; + // Resolve the gva to the real resolved address (which is - // just a gva with as fully resolved LVA and and offset of + // just a gva with as fully resolved LVA and offset of // zero). naming::gid_type base_gid = get<0>(rep); gva const base_gva = get<1>(rep); @@ -1695,7 +1698,7 @@ namespace hpx::agas { } // don't look at cache if id is marked as non-cache-able - if (!naming::detail::store_in_cache(id)) + if (!naming::detail::store_in_cache(id) || naming::is_locality(id)) { if (&ec != &throws) ec = make_success_code(); @@ -1863,17 +1866,15 @@ namespace hpx::agas { } // don't look at cache if id is marked as non-cache-able - if (!naming::detail::store_in_cache(id)) + if (!naming::detail::store_in_cache(id) || naming::is_locality(id)) { if (&ec != &throws) ec = make_success_code(); return; } - naming::gid_type gid = naming::detail::get_stripped_gid(id); - // don't look at the cache if the id is locally managed - if (naming::get_locality_id_from_gid(gid) == + if (naming::get_locality_id_from_gid(id) == naming::get_locality_id_from_gid(locality_)) { if (&ec != &throws) @@ -1881,6 +1882,7 @@ namespace hpx::agas { return; } + naming::gid_type gid = naming::detail::get_stripped_gid(id); try { LAGAS_(warning).format("addressing_service::remove_cache_entry"); diff --git a/libs/full/agas/src/route.cpp b/libs/full/agas/src/route.cpp index a9e237b7fab6..8c1eafeba9a2 100644 --- a/libs/full/agas/src/route.cpp +++ b/libs/full/agas/src/route.cpp @@ -77,7 +77,8 @@ namespace hpx::agas::server { } // retain don't store in cache flag - if (!naming::detail::store_in_cache(gid)) + if (!naming::detail::store_in_cache(gid) && + !naming::is_locality(gid)) { naming::detail::set_dont_store_in_cache( hpx::get<0>(cache_address)); diff --git a/libs/full/naming_base/include/hpx/naming_base/gid_type.hpp b/libs/full/naming_base/include/hpx/naming_base/gid_type.hpp index bed45c13b952..5e49da7d36e2 100644 --- a/libs/full/naming_base/include/hpx/naming_base/gid_type.hpp +++ b/libs/full/naming_base/include/hpx/naming_base/gid_type.hpp @@ -390,9 +390,8 @@ namespace hpx::naming { constexpr gid_type get_gid_from_locality_id( std::uint32_t locality_id) noexcept { - return gid_type(((static_cast(locality_id) + 1) - << gid_type::locality_id_shift) | - gid_type::dont_cache_mask, + return gid_type((static_cast(locality_id) + 1) + << gid_type::locality_id_shift, static_cast(0)); }