|
| 1 | +/** |
| 2 | + * Copyright (c) NVIDIA CORPORATION & AFFILIATES, 2025. ALL RIGHTS RESERVED. |
| 3 | + * |
| 4 | + * See file LICENSE for terms. |
| 5 | + */ |
| 6 | + |
| 7 | +#ifndef UCT_DEVICE_IMPL_H |
| 8 | +#define UCT_DEVICE_IMPL_H |
| 9 | + |
| 10 | +#include "uct_device_types.h" |
| 11 | + |
| 12 | +#include <uct/api/uct_def.h> |
| 13 | +#include <ucs/sys/compiler_def.h> |
| 14 | + |
| 15 | + |
| 16 | +/** |
| 17 | + * @ingroup UCT_DEVICE |
| 18 | + * @brief Posts one memory put operation. |
| 19 | + * |
| 20 | + * This device routine writes a single memory block from the local address @a address |
| 21 | + * to the remote address @a remote_address using the device endpoint @a device_ep. |
| 22 | + * The memory element @a mem_elem must be valid and contain the local and remote |
| 23 | + * memory regions to be transferred. |
| 24 | + * |
| 25 | + * User can pass @a comp to track execution and completion status. |
| 26 | + * The @a flags parameter can be used to modify the behavior |
| 27 | + * of the routine. |
| 28 | + * |
| 29 | + * @param [in] device_ep Device endpoint to be used for the operation. |
| 30 | + * @param [in] mem_elem Memory element representing the memory to be transferred. |
| 31 | + * @param [in] address Local virtual address to send data from. |
| 32 | + * @param [in] remote_address Remote virtual address to write data to. |
| 33 | + * @param [in] length Length in bytes of the data to send. |
| 34 | + * @param [in] flags Flags to modify the function behavior. |
| 35 | + * @param [in] comp Completion object to track the progress of operation. |
| 36 | + * |
| 37 | + * @return Error code as defined by @ref ucs_status_t |
| 38 | + */ |
| 39 | +template<uct_device_level_t level = UCT_DEVICE_LEVEL_THREAD> |
| 40 | +UCS_F_DEVICE ucs_status_t uct_device_ep_put_single( |
| 41 | + uct_device_ep_h device_ep, const uct_device_mem_element_t *mem_elem, |
| 42 | + const void *address, uint64_t remote_address, size_t length, |
| 43 | + uint64_t flags, uct_device_completion_t *comp) |
| 44 | +{ |
| 45 | + if (device_ep->uct_tl_id == UCT_DEVICE_TL_RC_MLX5_GDA) { |
| 46 | + // return uct_rc_mlx5_gda_ep_put_single(device_ep, mem_elem, address, |
| 47 | + // remote_address, length, flags, |
| 48 | + // comp); |
| 49 | + } else if (device_ep->uct_tl_id == UCT_DEVICE_TL_CUDA_IPC) { |
| 50 | + // return uct_cuda_ipc_ep_put_single(device_ep, mem_elem, address, |
| 51 | + // remote_address, length, flags, comp); |
| 52 | + } |
| 53 | + return UCS_ERR_UNSUPPORTED; |
| 54 | +} |
| 55 | + |
| 56 | + |
| 57 | +/** |
| 58 | + * @ingroup UCT_DEVICE |
| 59 | + * @brief Initialize a device completion object. |
| 60 | + * |
| 61 | + * @param [out] comp Device completion object to initialize. |
| 62 | + */ |
| 63 | +template<uct_device_level_t level = UCT_DEVICE_LEVEL_THREAD> |
| 64 | +UCS_F_DEVICE void uct_device_completion_init(uct_device_completion_t *comp) |
| 65 | +{ |
| 66 | + comp->count = 0; |
| 67 | + comp->status = UCS_OK; |
| 68 | +} |
| 69 | + |
| 70 | +#endif |
0 commit comments