Skip to content

Commit

Permalink
CODESTYLE: Update ctx attrs
Browse files Browse the repository at this point in the history
  • Loading branch information
nsarka committed Sep 10, 2024
1 parent 313f2da commit 14b42c2
Show file tree
Hide file tree
Showing 10 changed files with 163 additions and 4 deletions.
19 changes: 19 additions & 0 deletions src/components/cl/basic/cl_basic_context.c
Original file line number Diff line number Diff line change
Expand Up @@ -77,6 +77,25 @@ ucc_cl_basic_get_context_attr(const ucc_base_context_t *context,
attr->attr.ctx_addr_len = 0;
}

if (attr->attr.mask & UCC_CONTEXT_ATTR_FIELD_CTX_ADDR) {
attr->attr.ctx_addr = 0x0;
}

/* Global work buffer size is read directly from TL attr, so report 0
* here even if TL/UCP is enabled
*/
if (attr->attr.mask & UCC_CONTEXT_ATTR_FIELD_WORK_BUFFER_SIZE) {
attr->attr.global_work_buffer_size = 0;
}

if (attr->attr.mask & UCC_CONTEXT_ATTR_FIELD_TYPE) {
attr->attr.type = UCC_CONTEXT_EXCLUSIVE;
}

if (attr->attr.mask & UCC_CONTEXT_ATTR_FIELD_SYNC_TYPE) {
attr->attr.sync_type = UCC_NO_SYNC_COLLECTIVES;
}

/* CL BASIC reports topo_required if any of the TL available
* TL contexts needs it
*/
Expand Down
4 changes: 2 additions & 2 deletions src/components/cl/basic/cl_basic_lib.c
Original file line number Diff line number Diff line change
Expand Up @@ -29,8 +29,8 @@ UCC_CLASS_CLEANUP_FUNC(ucc_cl_basic_lib_t)
UCC_CLASS_DEFINE(ucc_cl_basic_lib_t, ucc_cl_lib_t);

static inline ucc_status_t check_tl_lib_attr(const ucc_base_lib_t *lib,
ucc_tl_iface_t * tl_iface,
ucc_cl_lib_attr_t * attr)
ucc_tl_iface_t *tl_iface,
ucc_cl_lib_attr_t *attr)
{
ucc_tl_lib_attr_t tl_attr;
ucc_status_t status;
Expand Down
18 changes: 18 additions & 0 deletions src/components/cl/hier/cl_hier_context.c
Original file line number Diff line number Diff line change
Expand Up @@ -90,6 +90,24 @@ ucc_cl_hier_get_context_attr(const ucc_base_context_t *context, /* NOLINT */
if (attr->attr.mask & UCC_CONTEXT_ATTR_FIELD_CTX_ADDR_LEN) {
attr->attr.ctx_addr_len = 0;
}

if (attr->attr.mask & UCC_CONTEXT_ATTR_FIELD_CTX_ADDR) {
attr->attr.ctx_addr = 0x0;
}

if (attr->attr.mask & UCC_CONTEXT_ATTR_FIELD_WORK_BUFFER_SIZE) {
attr->attr.global_work_buffer_size = 0;
}

if (attr->attr.mask & UCC_CONTEXT_ATTR_FIELD_TYPE) {
attr->attr.type = UCC_CONTEXT_EXCLUSIVE;
}

if (attr->attr.mask & UCC_CONTEXT_ATTR_FIELD_SYNC_TYPE) {
attr->attr.sync_type = UCC_NO_SYNC_COLLECTIVES;
}

attr->topo_required = 1;

return UCC_OK;
}
18 changes: 18 additions & 0 deletions src/components/tl/cuda/tl_cuda_context.c
Original file line number Diff line number Diff line change
Expand Up @@ -92,6 +92,24 @@ ucc_tl_cuda_get_context_attr(const ucc_base_context_t *context, /* NOLINT */
if (attr->attr.mask & UCC_CONTEXT_ATTR_FIELD_CTX_ADDR_LEN) {
attr->attr.ctx_addr_len = 0;
}

if (attr->attr.mask & UCC_CONTEXT_ATTR_FIELD_CTX_ADDR) {
attr->attr.ctx_addr = 0x0;
}

if (attr->attr.mask & UCC_CONTEXT_ATTR_FIELD_WORK_BUFFER_SIZE) {
attr->attr.global_work_buffer_size = 0;
}

if (attr->attr.mask & UCC_CONTEXT_ATTR_FIELD_TYPE) {
attr->attr.type = UCC_CONTEXT_EXCLUSIVE;
}

if (attr->attr.mask & UCC_CONTEXT_ATTR_FIELD_SYNC_TYPE) {
attr->attr.sync_type = UCC_NO_SYNC_COLLECTIVES;
}

attr->topo_required = 1;

return UCC_OK;
}
20 changes: 19 additions & 1 deletion src/components/tl/mlx5/tl_mlx5_context.c
Original file line number Diff line number Diff line change
Expand Up @@ -91,12 +91,30 @@ UCC_CLASS_DEFINE(ucc_tl_mlx5_context_t, ucc_tl_context_t);

ucc_status_t
ucc_tl_mlx5_get_context_attr(const ucc_base_context_t *context, /* NOLINT */
ucc_base_ctx_attr_t * attr)
ucc_base_ctx_attr_t *attr)
{
if (attr->attr.mask & UCC_CONTEXT_ATTR_FIELD_CTX_ADDR_LEN) {
attr->attr.ctx_addr_len = 0;
}

if (attr->attr.mask & UCC_CONTEXT_ATTR_FIELD_CTX_ADDR) {
attr->attr.ctx_addr = 0x0;
}

if (attr->attr.mask & UCC_CONTEXT_ATTR_FIELD_WORK_BUFFER_SIZE) {
attr->attr.global_work_buffer_size = 0;
}

if (attr->attr.mask & UCC_CONTEXT_ATTR_FIELD_TYPE) {
attr->attr.type = UCC_CONTEXT_EXCLUSIVE;
}

if (attr->attr.mask & UCC_CONTEXT_ATTR_FIELD_SYNC_TYPE) {
attr->attr.sync_type = UCC_NO_SYNC_COLLECTIVES;
}

attr->topo_required = 1;

return UCC_OK;
}

Expand Down
18 changes: 18 additions & 0 deletions src/components/tl/nccl/tl_nccl_context.c
Original file line number Diff line number Diff line change
Expand Up @@ -223,6 +223,24 @@ ucc_tl_nccl_get_context_attr(const ucc_base_context_t *context, /* NOLINT */
if (attr->attr.mask & UCC_CONTEXT_ATTR_FIELD_CTX_ADDR_LEN) {
attr->attr.ctx_addr_len = 0;
}

if (attr->attr.mask & UCC_CONTEXT_ATTR_FIELD_CTX_ADDR) {
attr->attr.ctx_addr = 0x0;
}

if (attr->attr.mask & UCC_CONTEXT_ATTR_FIELD_WORK_BUFFER_SIZE) {
attr->attr.global_work_buffer_size = 0;
}

if (attr->attr.mask & UCC_CONTEXT_ATTR_FIELD_TYPE) {
attr->attr.type = UCC_CONTEXT_EXCLUSIVE;
}

if (attr->attr.mask & UCC_CONTEXT_ATTR_FIELD_SYNC_TYPE) {
attr->attr.sync_type = UCC_NO_SYNC_COLLECTIVES;
}

attr->topo_required = 0;

return UCC_OK;
}
18 changes: 18 additions & 0 deletions src/components/tl/rccl/tl_rccl_context.c
Original file line number Diff line number Diff line change
Expand Up @@ -120,6 +120,24 @@ ucc_tl_rccl_get_context_attr(const ucc_base_context_t *context, /* NOLINT */
if (attr->attr.mask & UCC_CONTEXT_ATTR_FIELD_CTX_ADDR_LEN) {
attr->attr.ctx_addr_len = 0;
}

if (attr->attr.mask & UCC_CONTEXT_ATTR_FIELD_CTX_ADDR) {
attr->attr.ctx_addr = 0x0;
}

if (attr->attr.mask & UCC_CONTEXT_ATTR_FIELD_WORK_BUFFER_SIZE) {
attr->attr.global_work_buffer_size = 0;
}

if (attr->attr.mask & UCC_CONTEXT_ATTR_FIELD_TYPE) {
attr->attr.type = UCC_CONTEXT_EXCLUSIVE;
}

if (attr->attr.mask & UCC_CONTEXT_ATTR_FIELD_SYNC_TYPE) {
attr->attr.sync_type = UCC_NO_SYNC_COLLECTIVES;
}

attr->topo_required = 0;

return UCC_OK;
}
24 changes: 23 additions & 1 deletion src/components/tl/self/tl_self_context.c
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,29 @@ UCC_CLASS_DEFINE(ucc_tl_self_context_t, ucc_tl_context_t);

ucc_status_t
ucc_tl_self_get_context_attr(const ucc_base_context_t *context, /* NOLINT */
ucc_base_ctx_attr_t *attr /* NOLINT */)
ucc_base_ctx_attr_t *attr)
{
if (attr->attr.mask & UCC_CONTEXT_ATTR_FIELD_CTX_ADDR_LEN) {
attr->attr.ctx_addr_len = 0;
}

if (attr->attr.mask & UCC_CONTEXT_ATTR_FIELD_CTX_ADDR) {
attr->attr.ctx_addr = 0x0;
}

if (attr->attr.mask & UCC_CONTEXT_ATTR_FIELD_WORK_BUFFER_SIZE) {
attr->attr.global_work_buffer_size = 0;
}

if (attr->attr.mask & UCC_CONTEXT_ATTR_FIELD_TYPE) {
attr->attr.type = UCC_CONTEXT_EXCLUSIVE;
}

if (attr->attr.mask & UCC_CONTEXT_ATTR_FIELD_SYNC_TYPE) {
attr->attr.sync_type = UCC_NO_SYNC_COLLECTIVES;
}

attr->topo_required = 0;

return UCC_OK;
}
16 changes: 16 additions & 0 deletions src/components/tl/sharp/tl_sharp_context.c
Original file line number Diff line number Diff line change
Expand Up @@ -510,6 +510,22 @@ ucc_status_t ucc_tl_sharp_get_context_attr(const ucc_base_context_t *context, /*
attr->attr.ctx_addr_len = 0;
}

if (attr->attr.mask & UCC_CONTEXT_ATTR_FIELD_CTX_ADDR) {
attr->attr.ctx_addr = 0x0;
}

if (attr->attr.mask & UCC_CONTEXT_ATTR_FIELD_WORK_BUFFER_SIZE) {
attr->attr.global_work_buffer_size = 0;
}

if (attr->attr.mask & UCC_CONTEXT_ATTR_FIELD_TYPE) {
attr->attr.type = UCC_CONTEXT_EXCLUSIVE;
}

if (attr->attr.mask & UCC_CONTEXT_ATTR_FIELD_SYNC_TYPE) {
attr->attr.sync_type = UCC_NO_SYNC_COLLECTIVES;
}

attr->topo_required = 1;

return UCC_OK;
Expand Down
12 changes: 12 additions & 0 deletions src/components/tl/ucp/tl_ucp_context.c
Original file line number Diff line number Diff line change
Expand Up @@ -605,6 +605,7 @@ ucc_status_t ucc_tl_ucp_get_context_attr(const ucc_base_context_t *context,
}
attr->attr.ctx_addr_len = packed_length;
}

if (attr->attr.mask & UCC_CONTEXT_ATTR_FIELD_CTX_ADDR) {
*offset = ctx->worker.ucp_addrlen;
offset = TL_UCP_EP_ADDR_WORKER(offset);
Expand All @@ -621,10 +622,21 @@ ucc_status_t ucc_tl_ucp_get_context_attr(const ucc_base_context_t *context,
ucc_tl_ucp_ctx_remote_pack_data(ctx, offset);
}
}

if (attr->attr.mask & UCC_CONTEXT_ATTR_FIELD_WORK_BUFFER_SIZE) {
attr->attr.global_work_buffer_size =
ONESIDED_SYNC_SIZE + ONESIDED_REDUCE_SIZE;
}

if (attr->attr.mask & UCC_CONTEXT_ATTR_FIELD_TYPE) {
attr->attr.type = UCC_CONTEXT_EXCLUSIVE;
}

if (attr->attr.mask & UCC_CONTEXT_ATTR_FIELD_SYNC_TYPE) {
attr->attr.sync_type = UCC_NO_SYNC_COLLECTIVES;
}

attr->topo_required = ctx->topo_required;

return UCC_OK;
}

0 comments on commit 14b42c2

Please sign in to comment.