Skip to content
This repository was archived by the owner on Sep 30, 2022. It is now read-only.
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 7 additions & 1 deletion oshmem/mca/memheap/base/memheap_base_mkey.c
Original file line number Diff line number Diff line change
Expand Up @@ -755,10 +755,16 @@ uint64_t mca_memheap_base_find_offset(int pe,
void* rva)
{
map_segment_t *s;
int my_pe = oshmem_my_proc_id();

s = __find_va(va);

return ((s && MAP_SEGMENT_IS_VALID(s)) ? ((uintptr_t)rva - (uintptr_t)(s->mkeys_cache[pe][tr_id].va_base)) : 0);
if (my_pe == pe) {
return (uintptr_t)va - (uintptr_t)s->seg_base_addr;
}
else {
return ((s && MAP_SEGMENT_IS_VALID(s)) ? ((uintptr_t)rva - (uintptr_t)(s->mkeys_cache[pe][tr_id].va_base)) : 0);
}
}

int mca_memheap_base_is_symmetric_addr(const void* va)
Expand Down
7 changes: 4 additions & 3 deletions oshmem/shmem/c/shmem_lock.c
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@ static int shmem_lock_pack_pe_next(void *lock,
static void shmem_lock_increment_counter(void *lock, int lock_size);
static int shmem_lock_decrement_counter(void *lock, int lock_size);

static int shmem_lock_get_server(const void *lock);
static int shmem_lock_get_server(void *lock);
static int shmem_lock_is_mine(void *lock, int lock_size);

static int shmem_lock_get_ticket(void *lock);
Expand Down Expand Up @@ -166,9 +166,10 @@ int shmem_lock_finalize()
return OSHMEM_SUCCESS;
}

static int shmem_lock_get_server(const void *lock)
static int shmem_lock_get_server(void *lock)
{
return (int) (((uintptr_t) lock) / 8) % shmem_n_pes();
uint64_t offset = MCA_MEMHEAP_CALL(find_offset(shmem_my_pe(), 0, lock, lock));
return (offset / 8) % shmem_n_pes();
}

static uint64_t get_lock_value(const void *lock, int lock_size)
Expand Down