|
| 1 | +/* |
| 2 | + * Copyright (c) 2024 NVIDIA CORPORATION & AFFILIATES, ALL RIGHTS RESERVED. |
| 3 | + * |
| 4 | + * This software product is a proprietary product of NVIDIA CORPORATION & |
| 5 | + * AFFILIATES (the "Company") and all right, title, and interest in and to the |
| 6 | + * software product, including all associated intellectual property rights, are |
| 7 | + * and shall remain exclusively with the Company. |
| 8 | + * |
| 9 | + * This software product is governed by the End User License Agreement |
| 10 | + * provided with the software product. |
| 11 | + * |
| 12 | + */ |
| 13 | + |
| 14 | +#ifndef UROM_UCC_H_ |
| 15 | +#define UROM_UCC_H_ |
| 16 | + |
| 17 | +#include <ucp/api/ucp.h> |
| 18 | +#include <ucc/api/ucc.h> |
| 19 | + |
| 20 | +#ifdef __cplusplus |
| 21 | +extern "C" { |
| 22 | +#endif |
| 23 | + |
| 24 | +/* UCC serializing next raw, iter points to the offset place and returns the |
| 25 | + buffer start */ |
| 26 | +#define urom_ucc_serialize_next_raw(_iter, _type, _offset) \ |
| 27 | + ({ \ |
| 28 | + _type *_result = (_type *)(*(_iter)); \ |
| 29 | + *(_iter) = UCS_PTR_BYTE_OFFSET(*(_iter), _offset); \ |
| 30 | + _result; \ |
| 31 | + }) |
| 32 | + |
| 33 | +/* UCC command types */ |
| 34 | +enum urom_worker_ucc_cmd_type { |
| 35 | + UROM_WORKER_CMD_UCC_LIB_CREATE, /* UCC library create command */ |
| 36 | + UROM_WORKER_CMD_UCC_LIB_DESTROY, /* UCC library destroy command */ |
| 37 | + UROM_WORKER_CMD_UCC_CONTEXT_CREATE, /* UCC context create command */ |
| 38 | + UROM_WORKER_CMD_UCC_CONTEXT_DESTROY, /* UCC context destroy command */ |
| 39 | + UROM_WORKER_CMD_UCC_TEAM_CREATE, /* UCC team create command */ |
| 40 | + UROM_WORKER_CMD_UCC_COLL, /* UCC collective create command */ |
| 41 | + UROM_WORKER_CMD_UCC_CREATE_PASSIVE_DATA_CHANNEL, /* UCC passive data channel command */ |
| 42 | +}; |
| 43 | + |
| 44 | +/* |
| 45 | + * UCC library create command structure |
| 46 | + * |
| 47 | + * Input parameters for creating the library handle. The semantics of the |
| 48 | + * parameters are defined by ucc.h On successful completion of |
| 49 | + * urom_worker_cmd_ucc_lib_create, The UROM worker will generate a notification |
| 50 | + * on the notification queue. This notification has reference to local library |
| 51 | + * handle on the worker. The implementation can choose to create shadow handles |
| 52 | + * or safely pack the library handle on the BlueCC worker to the AEU. |
| 53 | + */ |
| 54 | +struct urom_worker_cmd_ucc_lib_create { |
| 55 | + void *params; /* UCC library parameters */ |
| 56 | +}; |
| 57 | + |
| 58 | +/* UCC context create command structure */ |
| 59 | +struct urom_worker_cmd_ucc_context_create { |
| 60 | + union { |
| 61 | + int64_t start; /* The started index */ |
| 62 | + int64_t *array; /* Set stride to <= 0 if array is used */ |
| 63 | + }; |
| 64 | + int64_t stride; /* Set number of strides */ |
| 65 | + int64_t size; /* Set stride size */ |
| 66 | + void *base_va; /* Shared buffer address */ |
| 67 | + uint64_t len; /* Buffer length */ |
| 68 | +}; |
| 69 | + |
| 70 | +/* UCC passive data channel command structure */ |
| 71 | +struct urom_worker_cmd_ucc_pass_dc { |
| 72 | + void *ucp_addr; /* UCP worker address on host */ |
| 73 | + size_t addr_len; /* UCP worker address length */ |
| 74 | +}; |
| 75 | + |
| 76 | +/* UCC context destroy command structure */ |
| 77 | +struct urom_worker_cmd_ucc_context_destroy { |
| 78 | + ucc_context_h context_h; /* UCC context pointer */ |
| 79 | +}; |
| 80 | + |
| 81 | +/* UCC team create command structure */ |
| 82 | +struct urom_worker_cmd_ucc_team_create { |
| 83 | + int64_t start; /* Team start index */ |
| 84 | + int64_t stride; /* Number of strides */ |
| 85 | + int64_t size; /* Stride size */ |
| 86 | + ucc_context_h context_h; /* UCC context */ |
| 87 | +}; |
| 88 | + |
| 89 | +/* UCC collective command structure */ |
| 90 | +struct urom_worker_cmd_ucc_coll { |
| 91 | + ucc_coll_args_t *coll_args; /* Collective arguments */ |
| 92 | + ucc_team_h team; /* UCC team */ |
| 93 | + int use_xgvmi; /* If operation uses XGVMI */ |
| 94 | + void *work_buffer; /* Work buffer */ |
| 95 | + size_t work_buffer_size; /* Buffer size */ |
| 96 | + size_t team_size; /* Team size */ |
| 97 | +}; |
| 98 | + |
| 99 | +/* UROM UCC worker command structure */ |
| 100 | +struct urom_worker_ucc_cmd { |
| 101 | + enum urom_worker_ucc_cmd_type cmd_type; |
| 102 | + uint64_t dpu_worker_id; /* DPU worker id as part of the team */ |
| 103 | + union { |
| 104 | + struct urom_worker_cmd_ucc_lib_create lib_create_cmd; /* Lib create command */ |
| 105 | + struct urom_worker_cmd_ucc_context_create context_create_cmd; /* Context create command */ |
| 106 | + struct urom_worker_cmd_ucc_context_destroy context_destroy_cmd; /* Context destroy command */ |
| 107 | + struct urom_worker_cmd_ucc_team_create team_create_cmd; /* Team create command */ |
| 108 | + struct urom_worker_cmd_ucc_coll coll_cmd; /* UCC collective command */ |
| 109 | + struct urom_worker_cmd_ucc_pass_dc pass_dc_create_cmd; /* Passive data channel command */ |
| 110 | + }; |
| 111 | +}; |
| 112 | + |
| 113 | +/* UCC notification types */ |
| 114 | +enum urom_worker_ucc_notify_type { |
| 115 | + UROM_WORKER_NOTIFY_UCC_LIB_CREATE_COMPLETE, /* Create UCC library on DPU notification */ |
| 116 | + UROM_WORKER_NOTIFY_UCC_LIB_DESTROY_COMPLETE, /* Destroy UCC library on DPU notification */ |
| 117 | + UROM_WORKER_NOTIFY_UCC_CONTEXT_CREATE_COMPLETE, /* Create UCC context on DPU notification */ |
| 118 | + UROM_WORKER_NOTIFY_UCC_CONTEXT_DESTROY_COMPLETE, /* Destroy UCC context on DPU notification */ |
| 119 | + UROM_WORKER_NOTIFY_UCC_TEAM_CREATE_COMPLETE, /* Create UCC team on DPU notification */ |
| 120 | + UROM_WORKER_NOTIFY_UCC_COLLECTIVE_COMPLETE, /* UCC collective completion notification */ |
| 121 | + UROM_WORKER_NOTIFY_UCC_PASSIVE_DATA_CHANNEL_COMPLETE, /* UCC data channel completion notification */ |
| 122 | +}; |
| 123 | + |
| 124 | +/* UCC context create notification structure */ |
| 125 | +struct urom_worker_ucc_notify_context_create { |
| 126 | + ucc_context_h context; /* Pointer to UCC context */ |
| 127 | +}; |
| 128 | + |
| 129 | +/* UCC team create notification structure */ |
| 130 | +struct urom_worker_ucc_notify_team_create { |
| 131 | + ucc_team_h team; /* Pointer to UCC team */ |
| 132 | +}; |
| 133 | + |
| 134 | +/* UCC collective notification structure */ |
| 135 | +struct urom_worker_ucc_notify_collective { |
| 136 | + ucc_status_t status; /* UCC collective status */ |
| 137 | +}; |
| 138 | + |
| 139 | +/* UCC passive data channel notification structure */ |
| 140 | +struct urom_worker_ucc_notify_pass_dc { |
| 141 | + ucc_status_t status; /* UCC data channel status */ |
| 142 | +}; |
| 143 | + |
| 144 | +/* UROM UCC worker notification structure */ |
| 145 | +struct urom_worker_notify_ucc { |
| 146 | + enum urom_worker_ucc_notify_type notify_type; |
| 147 | + uint64_t dpu_worker_id; /* DPU worker id */ |
| 148 | + union { |
| 149 | + struct urom_worker_ucc_notify_context_create context_create_nqe; /* Context create notification */ |
| 150 | + struct urom_worker_ucc_notify_team_create team_create_nqe; /* Team create notification */ |
| 151 | + struct urom_worker_ucc_notify_collective coll_nqe; /* Collective notification */ |
| 152 | + struct urom_worker_ucc_notify_pass_dc pass_dc_nqe; /* Passive data channel notification */ |
| 153 | + }; |
| 154 | +}; |
| 155 | + |
| 156 | +typedef struct ucc_worker_key_buf { |
| 157 | + size_t src_len; |
| 158 | + size_t dst_len; |
| 159 | + char rkeys[1024]; |
| 160 | +} ucc_worker_key_buf; |
| 161 | + |
| 162 | +#ifdef __cplusplus |
| 163 | +} /* extern "C" */ |
| 164 | +#endif |
| 165 | + |
| 166 | +#endif /* UROM_UCC_H_ */ |
0 commit comments