Skip to content

Commit 4d40887

Browse files
authored
Change local/remote handle names (#11145)
UCP/DEVICE/API: Change local/remote handle names
1 parent 15c3ed9 commit 4d40887

File tree

7 files changed

+67
-74
lines changed

7 files changed

+67
-74
lines changed

src/ucp/api/device/ucp_device_impl.h

Lines changed: 14 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -118,7 +118,7 @@ UCS_F_DEVICE ucs_status_t ucp_device_prepare_send(
118118

119119

120120
UCS_F_DEVICE ucs_status_t ucp_device_prepare_send_remote(
121-
ucp_device_remote_mem_list_handle_h dst_mem_list_h,
121+
ucp_device_remote_mem_list_h dst_mem_list_h,
122122
unsigned dst_mem_list_index, uint64_t &remote_address,
123123
ucp_device_request_t *req, uct_device_ep_t *&device_ep,
124124
const uct_device_mem_element_t *&uct_elem,
@@ -143,16 +143,15 @@ UCS_F_DEVICE ucs_status_t ucp_device_prepare_send_remote(
143143
}
144144

145145

146-
UCS_F_DEVICE ucs_status_t
147-
ucp_device_prepare_send(ucp_device_local_mem_list_handle_h src_mem_list_h,
148-
unsigned src_mem_list_index,
149-
ucp_device_remote_mem_list_handle_h dst_mem_list_h,
150-
unsigned dst_mem_list_index, const void *&address,
151-
uint64_t &remote_address, ucp_device_request_t *req,
152-
uct_device_ep_t *&device_ep,
153-
const uct_device_local_mem_list_elem_t *&src_uct_elem,
154-
const uct_device_mem_element_t *&uct_elem,
155-
uct_device_completion_t *&comp)
146+
UCS_F_DEVICE ucs_status_t ucp_device_prepare_send(
147+
ucp_device_local_mem_list_h src_mem_list_h, unsigned src_mem_list_index,
148+
ucp_device_remote_mem_list_h dst_mem_list_h,
149+
unsigned dst_mem_list_index, const void *&address,
150+
uint64_t &remote_address, ucp_device_request_t *req,
151+
uct_device_ep_t *&device_ep,
152+
const uct_device_local_mem_list_elem_t *&src_uct_elem,
153+
const uct_device_mem_element_t *&uct_elem,
154+
uct_device_completion_t *&comp)
156155
{
157156
const size_t elem_size = ucs_offsetof(uct_device_local_mem_list_elem_t,
158157
uct_mem_element) +
@@ -277,9 +276,8 @@ UCS_F_DEVICE ucs_status_t ucp_device_put_single(
277276
*/
278277
template<ucs_device_level_t level = UCS_DEVICE_LEVEL_THREAD>
279278
UCS_F_DEVICE ucs_status_t ucp_device_put(
280-
ucp_device_local_mem_list_handle_h src_mem_list_h,
281-
unsigned src_mem_list_index, size_t src_offset,
282-
ucp_device_remote_mem_list_handle_h dst_mem_list_h,
279+
ucp_device_local_mem_list_h src_mem_list_h, unsigned src_mem_list_index,
280+
size_t src_offset, ucp_device_remote_mem_list_h dst_mem_list_h,
283281
unsigned dst_mem_list_index, size_t dst_offset, size_t length,
284282
unsigned channel_id, uint64_t flags, ucp_device_request_t *req)
285283
{
@@ -398,7 +396,7 @@ UCS_F_DEVICE ucs_status_t ucp_device_counter_inc(
398396
*/
399397
template<ucs_device_level_t level = UCS_DEVICE_LEVEL_THREAD>
400398
UCS_F_DEVICE ucs_status_t ucp_device_counter_inc(
401-
uint64_t inc_value, ucp_device_remote_mem_list_handle_h dst_mem_list_h,
399+
uint64_t inc_value, ucp_device_remote_mem_list_h dst_mem_list_h,
402400
unsigned dst_mem_list_index, size_t remote_offset, unsigned channel_id,
403401
uint64_t flags, ucp_device_request_t *req)
404402
{
@@ -436,7 +434,7 @@ UCS_F_DEVICE ucs_status_t ucp_device_counter_inc(
436434
* @return Error code as defined by @ref ucs_status_t
437435
*/
438436
UCS_F_DEVICE ucs_status_t
439-
ucp_device_get_ptr(ucp_device_remote_mem_list_handle_h mem_list_h,
437+
ucp_device_get_ptr(ucp_device_remote_mem_list_h mem_list_h,
440438
unsigned mem_list_index, void **addr_p)
441439
{
442440
const size_t elem_size = ucs_offsetof(uct_device_remote_mem_list_elem_t,

src/ucp/api/device/ucp_device_types.h

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -98,7 +98,7 @@ typedef struct ucp_device_mem_list_handle {
9898
* The handle and most of its content is stored on GPU memory, with the intent
9999
* to be as memory-local as possible.
100100
*/
101-
typedef struct ucp_device_remote_mem_list_handle {
101+
typedef struct ucp_device_remote_mem_list {
102102
/**
103103
* Structure version. Allow runtime ABI compatibility checks between host
104104
* and device code.
@@ -114,7 +114,7 @@ typedef struct ucp_device_remote_mem_list_handle {
114114
* UCT memory element objects are allocated contiguously.
115115
*/
116116
uct_device_remote_mem_list_elem_t mem_elements[0];
117-
} ucp_device_remote_mem_list_handle_t;
117+
} ucp_device_remote_mem_list_t;
118118

119119

120120
/**
@@ -127,7 +127,7 @@ typedef struct ucp_device_remote_mem_list_handle {
127127
* The handle and most of its content is stored on GPU memory, with the intent
128128
* to be as memory-local as possible.
129129
*/
130-
typedef struct ucp_device_local_mem_list_handle {
130+
typedef struct ucp_device_local_mem_list {
131131
/**
132132
* Structure version. Allow runtime ABI compatibility checks between host
133133
* and device code.
@@ -140,6 +140,6 @@ typedef struct ucp_device_local_mem_list_handle {
140140
uint32_t mem_list_length;
141141

142142
uct_device_local_mem_list_elem_t mem_elements[0];
143-
} ucp_device_local_mem_list_handle_t;
143+
} ucp_device_local_mem_list_t;
144144

145145
#endif /* UCP_DEVICE_TYPES_H */

src/ucp/api/device/ucp_host.h

Lines changed: 10 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -189,14 +189,14 @@ ucp_device_mem_list_create(ucp_ep_h ep,
189189
* It can be used repeatedly, until finally released by calling @ref
190190
* ucp_device_mem_list_release.
191191
*
192-
* @param [in] params Parameters used to create the handle.
193-
* @param [out] handle Created descriptor list handle.
192+
* @param [in] params Parameters used to create the handle.
193+
* @param [out] mem_list_h Created descriptor list handle.
194194
*
195195
* @return Error code as defined by @ref ucs_status_t.
196196
*/
197197
ucs_status_t
198198
ucp_device_local_mem_list_create(const ucp_device_mem_list_params_t *params,
199-
ucp_device_local_mem_list_handle_h *handle);
199+
ucp_device_local_mem_list_h *mem_list_h);
200200

201201

202202
/**
@@ -211,26 +211,25 @@ ucp_device_local_mem_list_create(const ucp_device_mem_list_params_t *params,
211211
* It can be used repeatedly, until finally released by calling @ref
212212
* ucp_device_mem_list_release.
213213
*
214-
* @param [in] params Parameters used to create the handle.
215-
* @param [out] handle Created descriptor list handle.
214+
* @param [in] params Parameters used to create the handle.
215+
* @param [out] mem_list_h Created descriptor list handle.
216216
*
217217
* @return Error code as defined by @ref ucs_status_t.
218218
*/
219219
ucs_status_t
220220
ucp_device_remote_mem_list_create(const ucp_device_mem_list_params_t *params,
221-
ucp_device_remote_mem_list_handle_h *handle);
221+
ucp_device_remote_mem_list_h *mem_list_h);
222222

223223

224224
/**
225225
* @ingroup UCP_DEVICE
226226
* @brief Return the number of elements in the descriptors mem list handle.
227227
*
228-
* @param [in] handle Descriptors list handle.
228+
* @param [in] mem_list_h Descriptors list handle.
229229
*
230230
* @return Descriptors mem list length.
231231
*/
232-
uint32_t
233-
ucp_device_get_mem_list_length(const void* handle);
232+
uint32_t ucp_device_get_mem_list_length(const void *mem_list_h);
234233

235234

236235
/**
@@ -240,9 +239,9 @@ ucp_device_get_mem_list_length(const void* handle);
240239
* This function releases the handle that was created using @ref
241240
* ucp_device_mem_list_create.
242241
*
243-
* @param [in] handle Created handle to release.
242+
* @param [in] mem_list_h Created handle to release.
244243
*/
245-
void ucp_device_mem_list_release(void *handle);
244+
void ucp_device_mem_list_release(void *mem_list_h);
246245

247246

248247
/**

src/ucp/api/ucp_def.h

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -876,9 +876,7 @@ typedef struct {
876876

877877

878878
typedef struct ucp_device_mem_list_handle *ucp_device_mem_list_handle_h;
879-
typedef struct ucp_device_local_mem_list_handle
880-
*ucp_device_local_mem_list_handle_h;
881-
typedef struct ucp_device_remote_mem_list_handle
882-
*ucp_device_remote_mem_list_handle_h;
879+
typedef struct ucp_device_local_mem_list *ucp_device_local_mem_list_h;
880+
typedef struct ucp_device_remote_mem_list *ucp_device_remote_mem_list_h;
883881

884882
#endif

src/ucp/core/ucp_device.c

Lines changed: 16 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -590,7 +590,7 @@ static ucs_status_t ucp_device_local_mem_list_create_handle(
590590
size_t handle_size = 0;
591591
const ucp_device_mem_list_elem_t *ucp_element;
592592
const ucp_worker_iface_t *wiface;
593-
ucp_device_local_mem_list_handle_t handle;
593+
ucp_device_local_mem_list_t handle;
594594
uct_device_local_mem_list_elem_t *uct_element;
595595
size_t i;
596596
ucs_status_t status;
@@ -600,9 +600,9 @@ static ucs_status_t ucp_device_local_mem_list_create_handle(
600600
UCT_MD_MEM_ACCESS_LOCAL_READ |
601601
UCT_MD_MEM_ACCESS_LOCAL_WRITE,
602602
mem_type, local_sys_dev,
603-
"ucp_device_remote_mem_list_handle_t", mem);
603+
"ucp_device_remote_mem_list_t", mem);
604604
if (status != UCS_OK) {
605-
ucs_error("failed to allocate ucp_device_remote_mem_list_handle_t: %s",
605+
ucs_error("failed to allocate ucp_device_remote_mem_list_t: %s",
606606
ucs_status_string(status));
607607
return status;
608608
}
@@ -693,7 +693,7 @@ static ucs_status_t ucp_device_local_mem_list_params_check(
693693

694694
ucs_status_t
695695
ucp_device_local_mem_list_create(const ucp_device_mem_list_params_t *params,
696-
ucp_device_local_mem_list_handle_h *handle_p)
696+
ucp_device_local_mem_list_h *mem_list_h)
697697
{
698698
const ucs_memory_type_t export_mem_type = UCS_MEMORY_TYPE_CUDA;
699699
ucs_status_t status;
@@ -721,7 +721,7 @@ ucp_device_local_mem_list_create(const ucp_device_mem_list_params_t *params,
721721
if (status != UCS_OK) {
722722
uct_mem_free(&mem);
723723
} else {
724-
*handle_p = mem.address;
724+
*mem_list_h = mem.address;
725725
}
726726

727727
return status;
@@ -832,7 +832,7 @@ static ucs_status_t ucp_device_remote_mem_list_create_handle(
832832
size_t handle_size = 0;
833833
const ucp_device_mem_list_elem_t *ucp_element;
834834
ucp_context_h context;
835-
ucp_device_remote_mem_list_handle_t handle;
835+
ucp_device_remote_mem_list_t handle;
836836
uct_device_remote_mem_list_elem_t *uct_element;
837837
ucs_sys_device_t local_sys_dev;
838838
size_t i;
@@ -854,9 +854,9 @@ static ucs_status_t ucp_device_remote_mem_list_create_handle(
854854
UCT_MD_MEM_ACCESS_LOCAL_READ |
855855
UCT_MD_MEM_ACCESS_LOCAL_WRITE,
856856
mem_type, local_sys_dev,
857-
"ucp_device_remote_mem_list_handle_t", mem);
857+
"ucp_device_remote_mem_list_t", mem);
858858
if (status != UCS_OK) {
859-
ucs_error("failed to allocate ucp_device_remote_mem_list_handle_t: %s",
859+
ucs_error("failed to allocate ucp_device_remote_mem_list_t: %s",
860860
ucs_status_string(status));
861861
return status;
862862
}
@@ -952,7 +952,7 @@ static ucs_status_t ucp_device_remote_mem_list_params_check(
952952

953953
ucs_status_t
954954
ucp_device_remote_mem_list_create(const ucp_device_mem_list_params_t *params,
955-
ucp_device_remote_mem_list_handle_h *handle_p)
955+
ucp_device_remote_mem_list_h *mem_list_h)
956956
{
957957
const ucs_memory_type_t export_mem_type = UCS_MEMORY_TYPE_CUDA;
958958
ucs_status_t status;
@@ -982,7 +982,7 @@ ucp_device_remote_mem_list_create(const ucp_device_mem_list_params_t *params,
982982
if (status != UCS_OK) {
983983
uct_mem_free(&mem);
984984
} else {
985-
*handle_p = mem.address;
985+
*mem_list_h = mem.address;
986986
}
987987

988988
return status;
@@ -1060,29 +1060,29 @@ ucp_device_mem_list_create(ucp_ep_h ep,
10601060
return status;
10611061
}
10621062

1063-
uint32_t ucp_device_get_mem_list_length(const void *handle)
1063+
uint32_t ucp_device_get_mem_list_length(const void *mem_list_h)
10641064
{
10651065
khiter_t iter;
10661066
uint32_t length;
10671067

1068-
ucs_assert(handle != NULL);
1068+
ucs_assert(mem_list_h != NULL);
10691069

10701070
ucs_spin_lock(&ucp_device_handle_hash_lock);
10711071
iter = kh_get(ucp_device_handle_allocs, &ucp_device_handle_hash,
1072-
(void*)handle);
1072+
(void*)mem_list_h);
10731073
ucs_assertv_always((iter != kh_end(&ucp_device_handle_hash)), "handle=%p",
1074-
handle);
1074+
mem_list_h);
10751075
length = kh_value(&ucp_device_handle_hash, iter).mem_list_length;
10761076
ucs_spin_unlock(&ucp_device_handle_hash_lock);
10771077

10781078
return length;
10791079
}
10801080

1081-
void ucp_device_mem_list_release(void *handle)
1081+
void ucp_device_mem_list_release(void *mem_list_h)
10821082
{
10831083
uct_allocated_memory_t mem;
10841084

1085-
mem = ucp_device_mem_handle_hash_remove(handle);
1085+
mem = ucp_device_mem_handle_hash_remove(mem_list_h);
10861086
uct_mem_free(&mem);
10871087
}
10881088

test/gtest/ucp/cuda/test_kernels.h

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -22,17 +22,17 @@ typedef enum {
2222
} test_ucp_device_operation_t;
2323

2424
typedef struct {
25-
unsigned num_channels;
26-
unsigned num_threads;
27-
unsigned num_blocks;
28-
test_ucp_device_operation_t operation;
29-
ucs_device_level_t level;
30-
bool with_no_delay;
31-
bool with_request;
32-
size_t num_iters;
33-
ucp_device_mem_list_handle_h mem_list;
34-
ucp_device_local_mem_list_handle_h local_mem_list;
35-
ucp_device_remote_mem_list_handle_h remote_mem_list;
25+
unsigned num_channels;
26+
unsigned num_threads;
27+
unsigned num_blocks;
28+
test_ucp_device_operation_t operation;
29+
ucs_device_level_t level;
30+
bool with_no_delay;
31+
bool with_request;
32+
size_t num_iters;
33+
ucp_device_mem_list_handle_h mem_list;
34+
ucp_device_local_mem_list_h local_mem_list;
35+
ucp_device_remote_mem_list_h remote_mem_list;
3636
union {
3737
struct {
3838
unsigned mem_list_index;

test/gtest/ucp/test_ucp_device.cc

Lines changed: 10 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -60,18 +60,18 @@ class test_ucp_device : public ucp_test {
6060

6161
ucp_device_mem_list_handle_h handle() const;
6262

63-
ucp_device_local_mem_list_handle_h local_handle() const;
63+
ucp_device_local_mem_list_h local_handle() const;
6464

65-
ucp_device_remote_mem_list_handle_h remote_handle() const;
65+
ucp_device_remote_mem_list_h remote_handle() const;
6666

6767
void dst_pattern_check(unsigned index, uint64_t seed) const;
6868

6969
private:
7070
std::vector<std::unique_ptr<mapped_buffer>> m_src, m_dst;
71-
std::vector<ucs::handle<ucp_rkey_h>> m_rkeys;
72-
ucp_device_mem_list_handle_h m_mem_list_h;
73-
ucp_device_local_mem_list_handle_h m_local_mem_list_h;
74-
ucp_device_remote_mem_list_handle_h m_remote_mem_list_h;
71+
std::vector<ucs::handle<ucp_rkey_h>> m_rkeys;
72+
ucp_device_mem_list_handle_h m_mem_list_h;
73+
ucp_device_local_mem_list_h m_local_mem_list_h;
74+
ucp_device_remote_mem_list_h m_remote_mem_list_h;
7575
};
7676

7777
size_t counter_size();
@@ -339,14 +339,12 @@ ucp_device_mem_list_handle_h test_ucp_device::mem_list::handle() const
339339
return m_mem_list_h;
340340
}
341341

342-
ucp_device_local_mem_list_handle_h
343-
test_ucp_device::mem_list::local_handle() const
342+
ucp_device_local_mem_list_h test_ucp_device::mem_list::local_handle() const
344343
{
345344
return m_local_mem_list_h;
346345
}
347346

348-
ucp_device_remote_mem_list_handle_h
349-
test_ucp_device::mem_list::remote_handle() const
347+
ucp_device_remote_mem_list_h test_ucp_device::mem_list::remote_handle() const
350348
{
351349
return m_remote_mem_list_h;
352350
}
@@ -485,7 +483,7 @@ UCS_TEST_P(test_ucp_device, create_fail)
485483

486484
UCS_TEST_P(test_ucp_device, create_local_fail)
487485
{
488-
ucp_device_local_mem_list_handle_h handle = nullptr;
486+
ucp_device_local_mem_list_h handle = nullptr;
489487

490488
scoped_log_handler wrap_err(wrap_errors_logger);
491489

@@ -552,7 +550,7 @@ UCS_TEST_P(test_ucp_device, create_local_fail)
552550

553551
UCS_TEST_P(test_ucp_device, create_remote_fail)
554552
{
555-
ucp_device_remote_mem_list_handle_h handle = nullptr;
553+
ucp_device_remote_mem_list_h handle = nullptr;
556554

557555
scoped_log_handler wrap_err(wrap_errors_logger);
558556

0 commit comments

Comments
 (0)