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/API: Add new MD resource query API #10154

Closed
wants to merge 5 commits into from
Closed
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
132 changes: 132 additions & 0 deletions src/uct/api/v2/uct_v2.h
Original file line number Diff line number Diff line change
Expand Up @@ -1050,6 +1050,138 @@ int uct_iface_is_reachable_v2(uct_iface_h iface,
const uct_iface_is_reachable_params_t *params);


/**
* @ingroup UCT_RESOURCE
* @brief Communication resource descriptor.
*
*/
typedef struct uct_tl_resource_desc_v2 {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

how would we make this struct extendable without breaking ABI?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

we can force highest alignment (or pack) and add version field first, currently expected to be zero?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

fixed by returning it in params.

/**
* Transport name
*/
char tl_name[UCT_TL_NAME_MAX];

/**
* Hardware device name
*/
char dev_name[UCT_DEVICE_NAME_MAX];

/**
* Device represented by this resource
* (e.g. UCT_DEVICE_TYPE_NET for a network interface)
*/
uct_device_type_t dev_type;

/**
* The identifier associated with the device bus_id as captured in
* @ref ucs_sys_bus_id_t
*/
ucs_sys_device_t sys_device;

/**
* Associated resource flags using bits from @ref
* uct_md_query_tl_resources_flags_t.
*/
uint64_t flags;
} uct_tl_resource_desc_v2_t;


/**
* @ingroup UCT_RESOURCE
* @brief Capability flags in @ref uct_tl_resource_desc_v2_t.
*
* The enumeration defines bit mask of capabilities in @ref
* uct_tl_resource_desc_v2_t::flags.
*/
typedef enum {
/**
* If set, the resource supports inter-node communications.
*/
UCT_TL_RESOURCE_DESC_FLAG_INTER_NODE = UCS_BIT(0)
} uct_md_query_tl_resources_flags_t;


/**
* @ingroup UCT_RESOURCE
* @brief Describe valid input/output fields set in @ref
* uct_md_query_tl_resources_params_t::field_mask
*/
typedef enum {
/*
* The function @ref uct_md_query_tl_resources_v2 will return a populated
* resource array.
*/
UCT_MD_QUERY_TL_RESOURCES_PARAM_FIELD_RESOURCES = UCS_BIT(0)
} uct_md_query_tl_resources_params_flags_t;


/**
* @ingroup UCT_RESOURCE
* @brief Parameters passed to @ref uct_md_query_tl_resources_v2.
*/
typedef struct {
/**
* Mask of valid or requested fields in this structure.
* Fields not specified in this mask will be ignored.
* Provides ABI compatibility with respect to adding new fields.
*/
uint64_t field_mask;

/*
* Number of resources returned in the resource descriptor. It is an output
* parameter populated when @ref
* UCT_MD_QUERY_TL_RESOURCES_PARAM_FIELD_RESOURCES is set in @ref
* uct_md_query_tl_resources_params_t::field_mask.
*/
unsigned num_resources;

/**
* Resource descriptor is an object representing the network resource.
* Resource descriptor could represent a stand-alone communication resource
* such as an HCA port, network interface, or multiple resources such as
* multiple network interfaces or communication ports. It could also represent
* virtual communication resources that are defined over a single physical
* network interface.
*
* It is an output parameter populated when @ref
* UCT_MD_QUERY_TL_RESOURCES_PARAM_FIELD_RESOURCES is set in @ref
* uct_md_query_tl_resources_params_t::field_mask, which must be released
* by @ref uct_release_tl_resource_list_v2.
*/
uct_tl_resource_desc_v2_t *resources;
} uct_md_query_tl_resources_params_t;


/**
* @ingroup UCT_RESOURCE
* @brief Query for transport resources.
*
* This routine queries the @ref uct_md_h "memory domain" for communication
* resources that are available for it.
*
* @param [in] md Handle to memory domain.
* @param [inout] params Parameters as defined in @ref
* uct_md_query_tl_resources_params_t.
*
* @return Error code.
*/
ucs_status_t
uct_md_query_tl_resources_v2(uct_md_h md,
uct_md_query_tl_resources_params_t *params);


/**
* @ingroup UCT_RESOURCE
* @brief Release the list of resources returned from @ref uct_md_query_tl_resources_v2.
*
* This routine releases the memory associated with the list of resources
* allocated by @ref uct_md_query_tl_resources_v2.
*
* @param [in] resources Array of resource descriptors to release.
*/
void uct_release_tl_resource_list_v2(uct_tl_resource_desc_v2_t *resources);
brminich marked this conversation as resolved.
Show resolved Hide resolved


/**
* @ingroup UCT_RESOURCE
* @brief Connect endpoint to a remote endpoint.
Expand Down
12 changes: 12 additions & 0 deletions src/uct/base/uct_md.c
Original file line number Diff line number Diff line change
Expand Up @@ -170,6 +170,18 @@ uct_md_query_empty_md_resource(uct_md_resource_desc_t **resources_p,
return UCS_OK;
}

ucs_status_t uct_md_query_tl_resources_v2(
uct_md_h UCS_V_UNUSED md,
uct_md_query_tl_resources_params_t *UCS_V_UNUSED params)
{
return UCS_ERR_NOT_IMPLEMENTED;
}

void uct_release_tl_resource_list_v2(
uct_tl_resource_desc_v2_t *UCS_V_UNUSED resources)
{
}

ucs_status_t uct_md_stub_rkey_unpack(uct_component_t *component,
const void *rkey_buffer, uct_rkey_t *rkey_p,
void **handle_p)
Expand Down
Loading