Skip to content

Commit

Permalink
TL/MLX5: minor reviews
Browse files Browse the repository at this point in the history
  • Loading branch information
samnordmann committed May 22, 2023
1 parent 12b17da commit 8829d25
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 14 deletions.
10 changes: 2 additions & 8 deletions src/components/tl/mlx5/tl_mlx5.h
Original file line number Diff line number Diff line change
Expand Up @@ -99,16 +99,10 @@ UCC_CLASS_DECLARE(ucc_tl_mlx5_team_t, ucc_base_context_t *,

ucc_status_t tl_mlx5_rcache_create(ucc_tl_mlx5_context_t *ctx);
typedef struct ucc_tl_mlx5_reg {
struct ibv_mr * mr;
ucs_rcache_region_t *region;
ucc_rcache_region_t *super;
struct ibv_mr *mr;
} ucc_tl_mlx5_reg_t;

static inline ucc_tl_mlx5_reg_t *
ucc_tl_mlx5_get_rcache_reg_data(ucc_rcache_region_t *region)
{
return (ucc_tl_mlx5_reg_t *)PTR_OFFSET(region, sizeof(ucc_rcache_region_t));
}

#define UCC_TL_MLX5_SUPPORTED_COLLS (UCC_COLL_TYPE_ALLTOALL)

#define UCC_TL_MLX5_TEAM_LIB(_team) \
Expand Down
12 changes: 6 additions & 6 deletions src/components/tl/mlx5/tl_mlx5_rcache.c
Original file line number Diff line number Diff line change
Expand Up @@ -13,13 +13,13 @@ rcache_reg_mr(void *context, ucs_rcache_t *rcache, //NOLINT: rcache is unused
{
ucc_tl_mlx5_context_t *ctx = (ucc_tl_mlx5_context_t *)context;
void * addr = (void *)rregion->super.start;
ucc_tl_mlx5_reg_t * mlx5_reg = ucc_tl_mlx5_get_rcache_reg_data(
rregion);
ucc_tl_mlx5_reg_t * mlx5_reg = ucc_derived_of(rregion,
ucc_tl_mlx5_reg_t);
size_t length = (size_t)(rregion->super.end
- rregion->super.start);
int * change_flag = (int *)arg;

mlx5_reg->region = rregion;
mlx5_reg->super = rregion;
*change_flag = 1;
mlx5_reg->mr = ibv_reg_mr(ctx->shared_pd, addr, length,
IBV_ACCESS_LOCAL_WRITE | IBV_ACCESS_REMOTE_WRITE);
Expand All @@ -30,13 +30,13 @@ rcache_reg_mr(void *context, ucs_rcache_t *rcache, //NOLINT: rcache is unused
return UCS_OK;
}

static void rcache_dereg_mr(void * context, //NOLINT: context is unused
static void rcache_dereg_mr(void *context, //NOLINT: context is unused
ucc_rcache_t *rcache, //NOLINT: rcache is unused
ucc_rcache_region_t *rregion)
{
ucc_tl_mlx5_reg_t *mlx5_reg = ucc_tl_mlx5_get_rcache_reg_data(rregion);
ucc_tl_mlx5_reg_t *mlx5_reg = ucc_derived_of(rregion, ucc_tl_mlx5_reg_t);

ucc_assert(mlx5_reg->region == rregion);
ucc_assert(mlx5_reg->super == rregion);
ibv_dereg_mr(mlx5_reg->mr);
mlx5_reg->mr = NULL;
}
Expand Down

0 comments on commit 8829d25

Please sign in to comment.