Skip to content

Commit 899f58c

Browse files
committed
UCX osc: simplify output address computation
Signed-off-by: Joseph Schuchart <[email protected]>
1 parent d888b4f commit 899f58c

File tree

1 file changed

+8
-4
lines changed

1 file changed

+8
-4
lines changed

ompi/mca/osc/ucx/osc_ucx_comm.c

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -369,7 +369,11 @@ static int do_atomic_op_replace_sum(
369369
}
370370

371371
opal_common_ucx_user_req_handler_t user_req_cb = NULL;
372-
void* user_req_ptr = NULL;
372+
void *user_req_ptr = NULL;
373+
void *output_addr = &(module->req_result);
374+
if( result_addr ) {
375+
output_addr = result_addr;
376+
}
373377
for (int i = 0; i < origin_count; ++i) {
374378
uint64_t value = 0;
375379
if ((origin_count - 1) == i && NULL != ucx_req) {
@@ -391,14 +395,14 @@ static int do_atomic_op_replace_sum(
391395
memcpy(&value, origin_addr, origin_dt_bytes);
392396
}
393397
ret = opal_common_ucx_wpmem_fetch_nb(module->mem, opcode, value, target,
394-
result_addr ? result_addr : &(module->req_result),
395-
origin_dt_bytes, remote_addr, user_req_cb, user_req_ptr);
398+
output_addr, origin_dt_bytes, remote_addr,
399+
user_req_cb, user_req_ptr);
396400

397401
// advance origin and remote address
398402
origin_addr = (void*)((intptr_t)origin_addr + origin_dt_bytes);
399403
remote_addr += origin_dt_bytes;
400404
if (result_addr) {
401-
result_addr = (void*)((intptr_t)result_addr + origin_dt_bytes);
405+
output_addr = (void*)((intptr_t)output_addr + origin_dt_bytes);
402406
}
403407
}
404408

0 commit comments

Comments
 (0)