UCT/PLUGIN: ib plugin for token query#11277
Conversation
| } | ||
|
|
||
| ucs_status_t __attribute__((weak)) | ||
| uct_ib_plugin_ep_query(uct_ep_h ep, uct_ep_attr_t *ep_attr) |
There was a problem hiding this comment.
Will it be possible to change this to:
uct_ib_plugin_query_qp()
?
| dv/ib_mlx5_dv.c \ | ||
| dv/ib_mlx5dv_md.c | ||
| dv/ib_mlx5dv_md.c \ | ||
| ../plugin/uct_ib_plugin_stubs.c |
There was a problem hiding this comment.
Add a Makefile.am in /plugin and the stub there
(we should also add the .h file to the noinst_HEADERS list)
| pluginincludedir = $(includedir)/uct/ib/plugin | ||
| plugininclude_HEADERS = plugin/uct_ib_plugin.h |
There was a problem hiding this comment.
should be added in plugin/Makefile.am
| uct_ib_plugin_qp_query(const uct_ib_plugin_qp_query_params_t *params, | ||
| uct_ib_plugin_qp_query_attr_t *attr) | ||
| { |
There was a problem hiding this comment.
Where is it going to be called from?
There was a problem hiding this comment.
It will be invoked by uct_iface_query_v2 and uct_ep_query.
The UCT implementation will be submitted in a separate PR.
| * @brief QP query input parameters. | ||
| */ | ||
| typedef struct uct_ib_plugin_qp_query_params { | ||
| uint64_t field_mask; |
There was a problem hiding this comment.
should also define an enum for the field_mask
| /* IB plugin capability */ | ||
| #define UCT_IFACE_FLAG_IB_PLUGIN_QUERY_TOKEN UCS_BIT(47) /**< IB plugin for token query is available */ |
There was a problem hiding this comment.
need to getrid of "IB" and "plugin" in UCT API, just "UCT_IFACE_FLAG_QUERY_TOKEN", not implemented/supported => no capability
| /** | ||
| * @brief Field mask bits for @ref uct_ib_plugin_qp_query_attr_t. | ||
| * Selects which output fields to populate. | ||
| */ | ||
| enum uct_ib_plugin_qp_query_attr_field { | ||
| UCT_IB_PLUGIN_QP_QUERY_ATTR_FIELD_TX_TOKEN_LEN = UCS_BIT(0), | ||
| UCT_IB_PLUGIN_QP_QUERY_ATTR_FIELD_RX_TOKEN_LEN = UCS_BIT(1), | ||
| UCT_IB_PLUGIN_QP_QUERY_ATTR_FIELD_TX_TOKEN = UCS_BIT(2), | ||
| UCT_IB_PLUGIN_QP_QUERY_ATTR_FIELD_RX_TOKEN = UCS_BIT(3) | ||
| }; |
There was a problem hiding this comment.
I think we'll have similar bits for uct_ep_query, so why dont pass the same semantic to the "uct_ib_plugin_ep_query", cast to correct ep_type and access QP.
Then uct_ib_plugin_qp_query_params_t becomes redundant.
| /** | ||
| * @brief Return plugin-contributed iface capability flags. | ||
| * | ||
| * @return Bitmask of UCT_IFACE_FLAG_* contributed by the plugin. | ||
| */ | ||
| uint64_t uct_ib_plugin_iface_flags(void); |
There was a problem hiding this comment.
👍 for plugin contribution to defined UCT API
| * @return UCS_OK on success, error code otherwise. | ||
| */ | ||
| ucs_status_t | ||
| uct_ib_plugin_qp_query(const uct_ib_plugin_qp_query_params_t *params, |
There was a problem hiding this comment.
uct_ib_plugin_ep_query?
There was a problem hiding this comment.
@roiedanino suggests renaming it to uct_ib_plugin_query_qp. We now rely on mlx5dv_devx_obj and ibv_qp rather than the internal UCT structure, which might provide a cleaner and simpler approach.
Will it be possible to change this to:
uct_ib_plugin_query_qp()?
There was a problem hiding this comment.
IMO it adds inconsistency and overcomplication. Why does iface_flags return native UCT API level flags, but ep_query requires conversion of ep -> qp and qp_attr -> ep_attr converting in base (non-plugin) UCT/IB code?
| UCT_IB_PLUGIN_QP_QUERY_ATTR_FIELD_TX_TOKEN_LEN = UCS_BIT(0), | ||
| UCT_IB_PLUGIN_QP_QUERY_ATTR_FIELD_RX_TOKEN_LEN = UCS_BIT(1), |
There was a problem hiding this comment.
in #11234 these are defined as iface attributes
|
Example code for plugin side: static ucs_status_t uct_ib_plugin_iface_flags(void) {
ucs_info("executed uct_ib_plugin_iface_flags successfully");
return UCS_OK;
}
static ucs_status_t
uct_ib_plugin_qp_query(const uct_ib_mlx5_ext_qp_query_attr_t *params,
uct_ib_mlx5_ext_qp_query_attr_t *attr) {
ucs_info("executed uct_ib_plugin_qp_query successfully %p %p", params, attr);
return UCS_OK;
}
static uct_ib_mlx5_ext_ops_t ucx_ext_plugin_ops = {
.iface_flags = uct_ib_plugin_iface_flags,
.qp_query = uct_ib_plugin_qp_query,
};
UCS_MODULE_INIT()
{
// ...
uct_ib_mlx5_ext_register(&ucx_ext_plugin_ops);
return UCS_OK;
}
|
| are no outstanding send operations */ | ||
|
|
||
| /* Token query capability */ | ||
| #define UCT_IFACE_FLAG_QUERY_TOKEN UCS_BIT(47) /**< Interface supports token query */ |
There was a problem hiding this comment.
- let's add this to uct_iface_query_v2
- do we need to separate to TX_TOKEN and RX_TOKEN? we need to use TX_TOKEN on 2iface transports like DC
| ucs_assertv(ops->iface_flags != NULL, "ext_resgiter: iface_flags function is NULL"); | ||
| ucs_assertv(ops->qp_query != NULL, "ext_resgiter: qp_query function is NULL"); |
| ucs_assertv(ops->iface_flags != NULL, "ext_resgiter: iface_flags function is NULL"); | ||
| ucs_assertv(ops->qp_query != NULL, "ext_resgiter: qp_query function is NULL"); | ||
| uct_ib_mlx5_ext_ops = *ops; | ||
| ucs_info("ib mlx5: registered external ops successfully"); |
| #include <ucs/type/status.h> | ||
| #include <ucs/sys/stubs.h> | ||
|
|
||
|
|
| struct ibv_qp; | ||
| struct mlx5dv_devx_obj; |
There was a problem hiding this comment.
we can include ib / mlx5dv headers directly
| uint64_t field_mask; | ||
| size_t tx_token_len; | ||
| size_t rx_token_len; | ||
| void *tx_token; | ||
| void *rx_token; | ||
| uint32_t qp_num; |
| typedef ucs_status_t (*uct_ib_mlx5_ext_iface_flags_func_t)(uint64_t *flags); | ||
| typedef ucs_status_t (*uct_ib_mlx5_ext_qp_query_func_t)( | ||
| struct ibv_qp *qp, struct mlx5dv_devx_obj *devx_obj, | ||
| uct_ib_mlx5_ext_qp_query_attr_t *attr); |
| { | ||
| ucs_assertv(ops->iface_flags != NULL, "ext_resgiter: iface_flags function is NULL"); | ||
| ucs_assertv(ops->qp_query != NULL, "ext_resgiter: qp_query function is NULL"); | ||
| uct_ib_mlx5_ext_ops = *ops; |
There was a problem hiding this comment.
we probably want a list of providers, move uct_ib_mlx5_ext_ops only to C file, and add function that search for the first non-NULL operation in the list and calls the operation or returns NOT_SUPPORTED if not found. maybe adde default provider that returns 0 from iface_flags .
Signed-off-by: Roie Danino <rdanino@nvidia.com>
…x5_ext_register during UCS_MODULE_INIT Signed-off-by: Roie Danino <rdanino@nvidia.com>
Signed-off-by: Roie Danino <rdanino@nvidia.com>
f48724e to
a2e4020
Compare
What?
Add plugin support for token query(capability, rx token, tx token, tx token lengh, rx token length).
This is the plugin part of PR#11234
How?
Add weak symbols in uct.
The implementation will be provided by plugin lib.