Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

UCT/IB/MLX5/DC: HW dci for each pool, splitting random policy into pools #10421

Draft
wants to merge 1 commit into
base: master
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
28 changes: 26 additions & 2 deletions src/uct/ib/mlx5/dc/dc_mlx5.c
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,8 @@ const char *uct_dc_tx_policy_names[] = {
[UCT_DC_TX_POLICY_DCS_HYBRID] = "dcs_hybrid",
[UCT_DC_TX_POLICY_RAND] = "rand",
[UCT_DC_TX_POLICY_HW_DCS] = "hw_dcs",
[3] = "DUMMY",
[4] = "DUMMY2",
[UCT_DC_TX_POLICY_LAST] = NULL
};

Expand Down Expand Up @@ -789,8 +791,10 @@ static void uct_dc_mlx5_iface_dcis_destroy(uct_dc_mlx5_iface_t *iface)
for (dci_index = 0; dci_index < num_dcis; dci_index++) {
dci = uct_dc_mlx5_iface_dci(iface, dci_index);
if (!uct_dc_mlx5_is_dci_valid(dci)) {
ucs_info("not destroying dci[%d] - dci is not valid", dci_index);
continue;
}
ucs_info("destroying dci[%d]", dci_index);

uct_dc_mlx5_destroy_dci(iface, dci);
}
Expand All @@ -809,6 +813,22 @@ uct_dc_mlx5_dump_dci_pool_config(const uct_dc_mlx5_dci_config_t *config)
config->path_index, config->max_rd_atomic);
}

uct_dci_index_t
uct_dc_mlx5_hw_dci_index(uct_dc_mlx5_iface_t *iface, uint8_t pool_index)
{
return iface->tx.ndci * pool_index + UCT_DC_MLX5_HW_DCI_INDEX;
}

void uct_dc_mlx5_iface_init_hw_dci(uct_dc_mlx5_iface_t *iface, uint8_t pool_index)
{
uct_dci_index_t hw_dci_index = uct_dc_mlx5_hw_dci_index(iface, pool_index);

if (!uct_dc_mlx5_is_dci_valid(uct_dc_mlx5_iface_dci(iface, hw_dci_index))) {
uct_dc_mlx5_iface_resize_and_fill_dcis(iface, hw_dci_index);
uct_dc_mlx5_dci_pool_init_dci(iface, pool_index, hw_dci_index);
}
}

static void
uct_dc_mlx5_iface_create_dci_pool(uct_dc_mlx5_iface_t *iface,
const uct_dc_mlx5_dci_config_t *config,
Expand All @@ -833,6 +853,10 @@ uct_dc_mlx5_iface_create_dci_pool(uct_dc_mlx5_iface_t *iface,
ucs_arbiter_init(&dci_pool->arbiter);
ucs_array_init_dynamic(&dci_pool->stack);

if (iface->tx.policy & UCT_DC_MLX5_POLICY_CAP_HW_DCI) {
uct_dc_mlx5_iface_init_hw_dci(iface, pool_index);
}

iface->tx.num_dci_pools++;
*pool_index_p = pool_index;
}
Expand Down Expand Up @@ -916,6 +940,7 @@ uct_dc_mlx5_iface_init_dcis_array(uct_dc_mlx5_iface_t *iface,
dci = uct_dc_mlx5_iface_dci(iface, 0);

iface->tx.bb_max = dci->txwq.bb_max;
ucs_info("DCI 0 is being destroyed in dcis array initialization");
uct_dc_mlx5_destroy_dci(iface, dci);

ucs_array_length(&iface->tx.dcis) = 0;
Expand Down Expand Up @@ -1677,8 +1702,7 @@ static UCS_CLASS_INIT_FUNC(uct_dc_mlx5_iface_t, uct_md_h tl_md, uct_worker_h wor
return UCS_ERR_INVALID_PARAM;
}

if (uct_dc_mlx5_iface_is_hw_dcs(self) ||
uct_dc_mlx5_iface_is_hybrid(self)) {
if (uct_dc_mlx5_iface_has_hw_dci(self)) {
/* Calculate num_dci_channels: select minimum from requested by runtime
* and supported by HCA, must be power of two */
num_dci_channels = ucs_roundup_pow2(config->num_dci_channels);
Expand Down
28 changes: 21 additions & 7 deletions src/uct/ib/mlx5/dc/dc_mlx5.h
Original file line number Diff line number Diff line change
Expand Up @@ -112,6 +112,13 @@ typedef struct uct_dc_mlx5_iface_flush_addr {
} UCS_S_PACKED uct_dc_mlx5_iface_flush_addr_t;


typedef enum {
UCT_DC_MLX5_POLICY_CAP_QUOTA = UCS_BIT(0),
/* Policies with shared DCI */
UCT_DC_MLX5_POLICY_CAP_SHARED = UCS_BIT(1),
UCT_DC_MLX5_POLICY_CAP_HW_DCI = UCS_BIT(2),
} uct_dc_mlx5_policy_cap_t;

/**
* dci policies:
* - fixed: all eps always use same dci no matter what
Expand Down Expand Up @@ -146,13 +153,13 @@ typedef struct uct_dc_mlx5_iface_flush_addr {
*/
typedef enum {
/* Policies with dedicated DCI per active connection */
UCT_DC_TX_POLICY_DCS,
UCT_DC_TX_POLICY_DCS_QUOTA,
UCT_DC_TX_POLICY_DCS_HYBRID,
/* Policies with shared DCI */
UCT_DC_TX_POLICY_SHARED_FIRST,
UCT_DC_TX_POLICY_RAND = UCT_DC_TX_POLICY_SHARED_FIRST,
UCT_DC_TX_POLICY_HW_DCS,
UCT_DC_TX_POLICY_DCS = 0,
UCT_DC_TX_POLICY_DCS_QUOTA = UCT_DC_MLX5_POLICY_CAP_QUOTA,
UCT_DC_TX_POLICY_DCS_HYBRID = UCT_DC_MLX5_POLICY_CAP_QUOTA |
UCT_DC_MLX5_POLICY_CAP_HW_DCI,
UCT_DC_TX_POLICY_RAND = UCT_DC_MLX5_POLICY_CAP_SHARED,
UCT_DC_TX_POLICY_HW_DCS = UCT_DC_MLX5_POLICY_CAP_HW_DCI |
UCT_DC_MLX5_POLICY_CAP_SHARED,
UCT_DC_TX_POLICY_LAST
} uct_dc_tx_policy_t;

Expand Down Expand Up @@ -412,6 +419,13 @@ ucs_status_t uct_dc_mlx5_iface_create_dci(uct_dc_mlx5_iface_t *iface,
ucs_status_t uct_dc_mlx5_iface_resize_and_fill_dcis(uct_dc_mlx5_iface_t *iface,
uint16_t size);

uct_dci_index_t
uct_dc_mlx5_hw_dci_index(uct_dc_mlx5_iface_t *iface, uint8_t pool_index);

void uct_dc_mlx5_iface_init_hw_dci(uct_dc_mlx5_iface_t *iface,
uint8_t pool_index);


/**
* Checks whether dci pool config is present in dc_config_hash and returns
* the matching pool index or creates a new one
Expand Down
Loading