|
2 | 2 | * Copyright (C) 2001-2017 Mellanox Technologies Ltd. ALL RIGHTS RESERVED.
|
3 | 3 | * Copyright (c) 2019-2020 High Performance Computing Center Stuttgart,
|
4 | 4 | * University of Stuttgart. All rights reserved.
|
| 5 | + * Copyright (c) 2021 IBM Corporation. All rights reserved. |
5 | 6 | * $COPYRIGHT$
|
6 | 7 | *
|
7 | 8 | * Additional copyrights may follow
|
|
26 | 27 | return OMPI_ERROR; \
|
27 | 28 | }
|
28 | 29 |
|
29 |
| -/* helper to check whether UCX supports atomic operation on the size the operands */ |
30 |
| -static inline __opal_attribute_always_inline__ bool is_atomic_size_supported(uint64_t remote_addr, |
31 |
| - size_t size) |
32 |
| -{ |
33 |
| - return ((sizeof(uint32_t) == size && !(remote_addr & 0x3)) || |
34 |
| - (sizeof(uint64_t) == size && !(remote_addr & 0x7))); |
35 |
| -} |
36 |
| - |
37 | 30 | typedef struct ucx_iovec {
|
38 | 31 | void *addr;
|
39 | 32 | size_t len;
|
@@ -403,7 +396,7 @@ bool use_atomic_op(
|
403 | 396 | ompi_datatype_type_size(origin_dt, &origin_dt_bytes);
|
404 | 397 | ompi_datatype_type_size(target_dt, &target_dt_bytes);
|
405 | 398 | /* UCX only supports 32 and 64-bit operands atm */
|
406 |
| - if (is_atomic_size_supported(remote_addr, origin_dt_bytes) && |
| 399 | + if (ompi_osc_base_is_atomic_size_supported(remote_addr, origin_dt_bytes) && |
407 | 400 | origin_dt_bytes == target_dt_bytes && origin_count == target_count) {
|
408 | 401 | return true;
|
409 | 402 | }
|
@@ -796,7 +789,7 @@ int ompi_osc_ucx_compare_and_swap(const void *origin_addr, const void *compare_a
|
796 | 789 | }
|
797 | 790 |
|
798 | 791 | ompi_datatype_type_size(dt, &dt_bytes);
|
799 |
| - if (is_atomic_size_supported(remote_addr, dt_bytes)) { |
| 792 | + if (ompi_osc_base_is_atomic_size_supported(remote_addr, dt_bytes)) { |
800 | 793 | // fast path using UCX atomic operations
|
801 | 794 | return do_atomic_compare_and_swap(origin_addr, compare_addr,
|
802 | 795 | result_addr, dt, target,
|
@@ -852,7 +845,7 @@ int ompi_osc_ucx_fetch_and_op(const void *origin_addr, void *result_addr,
|
852 | 845 | ompi_datatype_type_size(dt, &dt_bytes);
|
853 | 846 |
|
854 | 847 | /* UCX atomics are only supported on 32 and 64 bit values */
|
855 |
| - if (is_atomic_size_supported(remote_addr, dt_bytes) && |
| 848 | + if (ompi_osc_base_is_atomic_size_supported(remote_addr, dt_bytes) && |
856 | 849 | (op == &ompi_mpi_op_no_op.op || op == &ompi_mpi_op_replace.op ||
|
857 | 850 | op == &ompi_mpi_op_sum.op)) {
|
858 | 851 | uint64_t value;
|
|
0 commit comments