diff --git a/include/lc/pool.h b/include/lc/pool.h index 27767be2..45886cf0 100644 --- a/include/lc/pool.h +++ b/include/lc/pool.h @@ -69,7 +69,7 @@ void* lc_pool_get_nb(lc_pool* pool); #define POOL_UNINIT ((int32_t)-1) -LC_INLINE int32_t lc_pool_get_local(struct lc_pool* pool) +LC_INLINE int32_t lc_pool_get_local_id(struct lc_pool* pool) { int wid = lc_worker_id(); int32_t pid = tls_pool_struct[wid][pool->key]; @@ -110,7 +110,7 @@ LC_INLINE void* lc_pool_steal(struct lc_pool* pool, int32_t pid) LC_INLINE void lc_pool_put(struct lc_pool* pool, void* elm) { - int32_t pid = lc_pool_get_local(pool); + int32_t pid = lc_pool_get_local_id(pool); struct dequeue* lpool = pool->lpools[pid]; dq_push_top(lpool, elm); } @@ -123,7 +123,7 @@ LC_INLINE void lc_pool_put_to(struct lc_pool* pool, void* elm, int32_t pid) LC_INLINE void* lc_pool_get_nb(struct lc_pool* pool) { - int32_t pid = lc_pool_get_local(pool); + int32_t pid = lc_pool_get_local_id(pool); struct dequeue* lpool = pool->lpools[pid]; void* elm = dq_pop_top(lpool); if (elm == NULL) @@ -133,7 +133,7 @@ LC_INLINE void* lc_pool_get_nb(struct lc_pool* pool) LC_INLINE void* lc_pool_get(struct lc_pool* pool) { - int32_t pid = lc_pool_get_local(pool); + int32_t pid = lc_pool_get_local_id(pool); struct dequeue* lpool = pool->lpools[pid]; void* elm = NULL; while (elm == NULL) { diff --git a/src/include/server/server_ibv_helper.h b/src/include/server/server_ibv_helper.h index ce0cb083..829e7cbb 100644 --- a/src/include/server/server_ibv_helper.h +++ b/src/include/server/server_ibv_helper.h @@ -177,7 +177,7 @@ static inline void ibv_post_recv_(lc_server* s, lc_packet* p) .num_sge = 1, }; - p->context.poolid = lc_pool_get_local(s->pkpool); + p->context.poolid = lc_pool_get_local_id(s->pkpool); struct ibv_recv_wr* bad_wr = 0; IBV_SAFECALL(ibv_post_srq_recv(s->dev_srq, &wr, &bad_wr)); diff --git a/src/include/server/server_psm2.h b/src/include/server/server_psm2.h index 1d9c512d..2a2835b9 100644 --- a/src/include/server/server_psm2.h +++ b/src/include/server/server_psm2.h @@ -321,7 +321,7 @@ static inline void lc_server_post_recv(lc_server* s, lc_packet* p) } psm2_mq_tag_t rtag = PSM_TAG_TRECV_DATA(); - p->context.poolid = lc_pool_get_local(s->pkpool); + p->context.poolid = lc_pool_get_local_id(s->pkpool); PSM_SAFECALL(psm2_mq_irecv2( s->mq, PSM2_MQ_ANY_ADDR, &rtag, /* message tag */ diff --git a/src/long.c b/src/long.c index 5e5a1c02..4265dd47 100644 --- a/src/long.c +++ b/src/long.c @@ -5,7 +5,7 @@ #include "lc/pool.h" #ifdef LC_PKT_RET_LONG -#define LC_LONG_POOL_ID(ep) (lc_pool_get_local(ep->pkpool)) +#define LC_LONG_POOL_ID(ep) (lc_pool_get_local_id(ep->pkpool)) #else #define LC_LONG_POOL_ID(ep) (-1) #endif diff --git a/src/medium.c b/src/medium.c index 8252ccce..6682960d 100644 --- a/src/medium.c +++ b/src/medium.c @@ -4,11 +4,12 @@ #include "lc_priv.h" #include "lc/pool.h" +#define LC_MED_POOL_ID(ep, size) ((size > LC_PKT_RET_MED_SIZE) ? lc_pool_get_local_id(ep->pkpool) : -1) + lc_status lc_sendm(void* src, size_t size, int rank, int tag, lc_ep ep) { LC_POOL_GET_OR_RETN(ep->pkpool, p); - lci_pk_init(ep, (size > LC_PKT_RET_MED_SIZE) ? lc_pool_get_local(ep->pkpool) : -1, - LC_PROTO_DATA, p); + lci_pk_init(ep, LC_MED_POOL_ID(ep, size), LC_PROTO_DATA, p); struct lci_rep* rep = &(ep->rep[rank]); memcpy(p->data.buffer, src, size); lc_server_sendm(ep->server, rep->handle, size, p, @@ -19,8 +20,7 @@ lc_status lc_sendm(void* src, size_t size, int rank, int tag, lc_ep ep) lc_status lc_putm(void* src, size_t size, int rank, uintptr_t addr, lc_ep ep) { LC_POOL_GET_OR_RETN(ep->pkpool, p); - lci_pk_init(ep, (size > LC_PKT_RET_MED_SIZE) ? lc_pool_get_local(ep->pkpool) : -1, - LC_PROTO_DATA, p); + lci_pk_init(ep, LC_MED_POOL_ID(ep, size), LC_PROTO_DATA, p); struct lci_rep* rep = &(ep->rep[rank]); memcpy(&p->data, src, size); lc_server_putm(ep->server, rep->handle, rep->base, (uint32_t) (addr - rep->base), @@ -31,8 +31,7 @@ lc_status lc_putm(void* src, size_t size, int rank, uintptr_t addr, lc_ep ep) lc_status lc_putms(void* src, size_t size, int rank, uintptr_t addr, int meta, lc_ep ep) { LC_POOL_GET_OR_RETN(ep->pkpool, p); - lci_pk_init(ep, (size > LC_PKT_RET_MED_SIZE) ? lc_pool_get_local(ep->pkpool) : -1, - LC_PROTO_DATA, p); + lci_pk_init(ep, LC_MED_POOL_ID(ep, size), LC_PROTO_DATA, p); struct lci_rep* rep = &(ep->rep[rank]); memcpy(&p->data, src, size); lc_server_putms(ep->server, rep->handle, rep->base, (uint32_t) (addr - rep->base),