Skip to content

Commit 6fe065a

Browse files
author
Mamzi Bayatpour [email protected] ()
committed
Revert "adding ref count for accumulate lock"
This reverts commit 174b53c.
1 parent 4c9975b commit 6fe065a

File tree

2 files changed

+18
-27
lines changed

2 files changed

+18
-27
lines changed

ompi/mca/osc/ucx/osc_ucx.h

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -135,7 +135,6 @@ typedef struct ompi_osc_ucx_module {
135135
bool lock_all_is_nocheck;
136136
bool no_locks;
137137
bool acc_single_intrinsic;
138-
uint64_t acc_lock_refcnt;
139138
opal_common_ucx_ctx_t *ctx;
140139
opal_common_ucx_wpmem_t *mem;
141140
opal_common_ucx_wpmem_t *state_mem;

ompi/mca/osc/ucx/osc_ucx_component.c

Lines changed: 18 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -840,7 +840,6 @@ static int component_select(struct ompi_win_t *win, void **base, size_t size, in
840840
OBJ_CONSTRUCT(&module->pending_posts, opal_list_t);
841841
module->start_grp_ranks = NULL;
842842
module->lock_all_is_nocheck = false;
843-
module->acc_lock_refcnt = 0;
844843

845844
if (!module->no_locks) {
846845
OBJ_CONSTRUCT(&module->outstanding_locks, opal_hash_table_t);
@@ -931,26 +930,23 @@ inline int ompi_osc_ucx_state_lock(
931930
int ret = OMPI_SUCCESS;
932931

933932
if (force_lock || ompi_osc_need_acc_lock(module, target)) {
934-
if (module->acc_lock_refcnt == 0) {
935-
for (;;) {
936-
ret = opal_common_ucx_wpmem_cmpswp(module->state_mem,
937-
TARGET_LOCK_UNLOCKED, TARGET_LOCK_EXCLUSIVE,
938-
target, &result_value, sizeof(result_value),
939-
remote_addr, ep);
940-
if (ret != OMPI_SUCCESS) {
941-
OSC_UCX_VERBOSE(1, "opal_common_ucx_mem_cmpswp failed: %d", ret);
942-
return OMPI_ERROR;
943-
}
944-
if (result_value == TARGET_LOCK_UNLOCKED) {
945-
break;
946-
}
947-
948-
opal_common_ucx_wpool_progress(mca_osc_ucx_component.wpool);
933+
for (;;) {
934+
ret = opal_common_ucx_wpmem_cmpswp(module->state_mem,
935+
TARGET_LOCK_UNLOCKED, TARGET_LOCK_EXCLUSIVE,
936+
target, &result_value, sizeof(result_value),
937+
remote_addr, ep);
938+
if (ret != OMPI_SUCCESS) {
939+
OSC_UCX_VERBOSE(1, "opal_common_ucx_mem_cmpswp failed: %d", ret);
940+
return OMPI_ERROR;
949941
}
942+
if (result_value == TARGET_LOCK_UNLOCKED) {
943+
break;
944+
}
945+
946+
opal_common_ucx_wpool_progress(mca_osc_ucx_component.wpool);
950947
}
951948

952949
*lock_acquired = true;
953-
module->acc_lock_refcnt++;
954950
} else {
955951
*lock_acquired = false;
956952
}
@@ -977,15 +973,11 @@ inline int ompi_osc_ucx_state_unlock(
977973
return OMPI_ERROR;
978974
}
979975

980-
if (module->acc_lock_refcnt == 1) {
981-
ret = opal_common_ucx_wpmem_fetch(module->state_mem,
982-
UCP_ATOMIC_FETCH_OP_SWAP, TARGET_LOCK_UNLOCKED,
983-
target, &result_value, sizeof(result_value),
984-
remote_addr, ep);
985-
assert(result_value == TARGET_LOCK_EXCLUSIVE);
986-
}
987-
module->acc_lock_refcnt--;
988-
assert(module->acc_lock_refcnt >= 0);
976+
ret = opal_common_ucx_wpmem_fetch(module->state_mem,
977+
UCP_ATOMIC_FETCH_OP_SWAP, TARGET_LOCK_UNLOCKED,
978+
target, &result_value, sizeof(result_value),
979+
remote_addr, ep);
980+
assert(result_value == TARGET_LOCK_EXCLUSIVE);
989981
} else if (NULL != free_ptr){
990982
/* flush before freeing the buffer */
991983
ret = opal_common_ucx_ctx_flush(module->ctx, OPAL_COMMON_UCX_SCOPE_EP, target);

0 commit comments

Comments
 (0)