Skip to content
9 changes: 6 additions & 3 deletions src/ucp/core/ucp_context.c
Original file line number Diff line number Diff line change
Expand Up @@ -2136,6 +2136,7 @@ static ucs_status_t ucp_fill_resources(ucp_context_h context,
context->dmabuf_mds[mem_type] = UCP_NULL_RESOURCE;
context->alloc_md[mem_type].md_index = UCP_NULL_RESOURCE;
context->alloc_md[mem_type].sys_dev = UCS_SYS_DEVICE_ID_UNKNOWN;
context->alloc_md[mem_type].mem_flags = UCS_MEM_FLAG_CAN_REGISTER;
context->alloc_md[mem_type].initialized = 0;
}

Expand Down Expand Up @@ -2928,19 +2929,20 @@ uct_md_h ucp_context_find_tl_md(ucp_context_h context, const char *md_name)
void ucp_memory_detect_slowpath(ucp_context_h context, const void *address,
size_t length, ucs_memory_info_t *mem_info)
{
uct_md_mem_attr_t mem_attr;
uct_md_mem_attr_v2_t mem_attr = {};
ucs_status_t status;
ucp_tl_md_t *tl_md;
ucp_md_index_t i;

mem_attr.field_mask = UCT_MD_MEM_ATTR_FIELD_MEM_TYPE |
UCT_MD_MEM_ATTR_FIELD_BASE_ADDRESS |
UCT_MD_MEM_ATTR_FIELD_ALLOC_LENGTH |
UCT_MD_MEM_ATTR_FIELD_SYS_DEV;
UCT_MD_MEM_ATTR_FIELD_SYS_DEV |
UCT_MD_MEM_ATTR_FIELD_MEM_FLAGS;

for (i = 0; i < context->num_mem_type_detect_mds; ++i) {
tl_md = &context->tl_mds[context->mem_type_detect_mds[i]];
status = uct_md_mem_query(tl_md->md, address, length, &mem_attr);
status = uct_md_mem_query_v2(tl_md->md, address, length, &mem_attr);
if (status != UCS_OK) {
continue;
}
Expand All @@ -2953,6 +2955,7 @@ void ucp_memory_detect_slowpath(ucp_context_h context, const void *address,
mem_info->sys_dev = mem_attr.sys_dev;
mem_info->base_address = mem_attr.base_address;
mem_info->alloc_length = mem_attr.alloc_length;
mem_info->mem_flags = mem_attr.mem_flags;
return;
}

Expand Down
11 changes: 7 additions & 4 deletions src/ucp/core/ucp_context.h
Original file line number Diff line number Diff line change
Expand Up @@ -388,6 +388,7 @@ typedef struct ucp_context_alloc_md_index {
* using ucp_memh_alloc(). */
ucp_md_index_t md_index;
ucs_sys_device_t sys_dev;
uint8_t mem_flags;
} ucp_context_alloc_md_index_t;


Expand Down Expand Up @@ -709,8 +710,9 @@ ucp_cmpt_attr_by_md_index(ucp_context_h context, ucp_md_index_t md_index)
static UCS_F_ALWAYS_INLINE void
ucp_memory_info_set_host(ucp_memory_info_t *mem_info)
{
mem_info->type = UCS_MEMORY_TYPE_HOST;
mem_info->sys_dev = UCS_SYS_DEVICE_ID_UNKNOWN;
mem_info->type = UCS_MEMORY_TYPE_HOST;
mem_info->sys_dev = UCS_SYS_DEVICE_ID_UNKNOWN;
mem_info->mem_flags = UCS_MEM_FLAG_CAN_REGISTER;
}

static UCS_F_ALWAYS_INLINE void
Expand Down Expand Up @@ -761,8 +763,9 @@ ucp_memory_detect(ucp_context_h context, const void *address, size_t length,

ucp_memory_detect_internal(context, address, length, &mem_info_internal);

mem_info->type = mem_info_internal.type;
mem_info->sys_dev = mem_info_internal.sys_dev;
mem_info->type = mem_info_internal.type;
mem_info->sys_dev = mem_info_internal.sys_dev;
mem_info->mem_flags = mem_info_internal.mem_flags;
}

static UCS_F_ALWAYS_INLINE int
Expand Down
Loading
Loading