Merge pull request #2445 from alex-mikheev/topic/memheap_find_offset_fix
oshmem: memheap: removes find_offset
Этот коммит содержится в:
Коммит
6c1025d8f3
@ -69,10 +69,6 @@ int mca_memheap_base_dereg(mca_memheap_map_t *);
|
||||
int memheap_oob_init(mca_memheap_map_t *);
|
||||
void memheap_oob_destruct(void);
|
||||
|
||||
OSHMEM_DECLSPEC uint64_t mca_memheap_base_find_offset(int pe,
|
||||
int tr_id,
|
||||
void* va,
|
||||
void* rva);
|
||||
OSHMEM_DECLSPEC int mca_memheap_base_is_symmetric_addr(const void* va);
|
||||
OSHMEM_DECLSPEC sshmem_mkey_t *mca_memheap_base_get_mkey(void* va,
|
||||
int tr_id);
|
||||
|
@ -714,23 +714,6 @@ sshmem_mkey_t *mca_memheap_base_get_mkey(void* va, int tr_id)
|
||||
return ((s && MAP_SEGMENT_IS_VALID(s)) ? &s->mkeys[tr_id] : NULL );
|
||||
}
|
||||
|
||||
uint64_t mca_memheap_base_find_offset(int pe,
|
||||
int tr_id,
|
||||
void* va,
|
||||
void* rva)
|
||||
{
|
||||
map_segment_t *s;
|
||||
int my_pe = oshmem_my_proc_id();
|
||||
|
||||
s = memheap_find_va(va);
|
||||
|
||||
if (my_pe == pe) {
|
||||
return (uintptr_t)va - (uintptr_t)s->super.va_base;
|
||||
}
|
||||
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)
|
||||
{
|
||||
|
@ -34,7 +34,6 @@ mca_memheap_buddy_module_t memheap_buddy = {
|
||||
mca_memheap_buddy_private_free,
|
||||
|
||||
mca_memheap_base_get_mkey,
|
||||
mca_memheap_base_find_offset,
|
||||
mca_memheap_base_is_symmetric_addr,
|
||||
mca_memheap_modex_recv_all,
|
||||
|
||||
|
@ -59,10 +59,6 @@ typedef int (*mca_memheap_base_module_free_fn_t)(void*);
|
||||
/**
|
||||
* Service functions
|
||||
*/
|
||||
typedef uint64_t (*mca_memheap_base_module_find_offset_fn_t)(int pe,
|
||||
int tr_id,
|
||||
void* va,
|
||||
void* rva);
|
||||
|
||||
typedef sshmem_mkey_t * (*mca_memheap_base_module_get_local_mkey_fn_t)(void* va,
|
||||
int transport_id);
|
||||
@ -109,7 +105,6 @@ struct mca_memheap_base_module_t {
|
||||
mca_memheap_base_module_free_fn_t memheap_private_free;
|
||||
|
||||
mca_memheap_base_module_get_local_mkey_fn_t memheap_get_local_mkey;
|
||||
mca_memheap_base_module_find_offset_fn_t memheap_find_offset;
|
||||
mca_memheap_base_is_memheap_addr_fn_t memheap_is_symmetric_addr;
|
||||
mca_memheap_base_mkey_exchange_fn_t memheap_get_all_mkeys;
|
||||
|
||||
|
@ -32,7 +32,6 @@ mca_memheap_ptmalloc_module_t memheap_ptmalloc = {
|
||||
mca_memheap_ptmalloc_free,
|
||||
|
||||
mca_memheap_base_get_mkey,
|
||||
mca_memheap_base_find_offset,
|
||||
mca_memheap_base_is_symmetric_addr,
|
||||
mca_memheap_modex_recv_all,
|
||||
|
||||
|
@ -25,6 +25,7 @@
|
||||
#include "oshmem/shmem/shmem_api_logger.h"
|
||||
#include "oshmem/shmem/shmem_lock.h"
|
||||
#include "oshmem/mca/memheap/memheap.h"
|
||||
#include "oshmem/mca/memheap/base/base.h"
|
||||
#include "oshmem/mca/atomic/atomic.h"
|
||||
|
||||
#define OPAL_BITWISE_SIZEOF_LONG (SIZEOF_LONG * 8)
|
||||
@ -170,8 +171,16 @@ int shmem_lock_finalize()
|
||||
|
||||
static int shmem_lock_get_server(void *lock)
|
||||
{
|
||||
uint64_t offset = MCA_MEMHEAP_CALL(find_offset(shmem_my_pe(), 0, lock, lock));
|
||||
return (offset / 8) % shmem_n_pes();
|
||||
map_segment_t *s;
|
||||
|
||||
s = memheap_find_va(lock);
|
||||
if (NULL == s) {
|
||||
SHMEM_API_ERROR("PE#%i lock %p is not a shared variable", shmem_my_pe(), lock);
|
||||
oshmem_shmem_abort(-1);
|
||||
return 0;
|
||||
}
|
||||
|
||||
return ((int)((uintptr_t)lock - (uintptr_t)s->super.va_base)/8) % shmem_n_pes();
|
||||
}
|
||||
|
||||
static uint64_t get_lock_value(const void *lock, int lock_size)
|
||||
|
Загрузка…
x
Ссылка в новой задаче
Block a user