Skip to content

Commit

Permalink
Fixing locality-id calculation
Browse files Browse the repository at this point in the history
  • Loading branch information
hkaiser committed Feb 12, 2024
1 parent f616fe3 commit c824fbd
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 13 deletions.
20 changes: 11 additions & 9 deletions libs/full/agas/src/addressing_service.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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(
Expand Down Expand Up @@ -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();
Expand Down Expand Up @@ -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);

Expand Down Expand Up @@ -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);
Expand Down Expand Up @@ -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();
Expand Down Expand Up @@ -1863,24 +1866,23 @@ 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)
ec = make_success_code();
return;
}

naming::gid_type gid = naming::detail::get_stripped_gid(id);
try
{
LAGAS_(warning).format("addressing_service::remove_cache_entry");
Expand Down
3 changes: 2 additions & 1 deletion libs/full/agas/src/route.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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));
Expand Down
5 changes: 2 additions & 3 deletions libs/full/naming_base/include/hpx/naming_base/gid_type.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -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<std::uint64_t>(locality_id) + 1)
<< gid_type::locality_id_shift) |
gid_type::dont_cache_mask,
return gid_type((static_cast<std::uint64_t>(locality_id) + 1)
<< gid_type::locality_id_shift,
static_cast<std::uint64_t>(0));
}

Expand Down

0 comments on commit c824fbd

Please sign in to comment.