diff --git a/src/ucp/core/ucp_rkey.c b/src/ucp/core/ucp_rkey.c index 4fb99dfb1f7d..f988dcf0a454 100644 --- a/src/ucp/core/ucp_rkey.c +++ b/src/ucp/core/ucp_rkey.c @@ -15,8 +15,8 @@ static struct { ucp_md_map_t md_map; - uint8_t mem_type; -} UCS_S_PACKED ucp_mem_dummy_buffer = {0, 0}; + uint8_t mem_type; +} UCS_S_PACKED ucp_mem_dummy_buffer = {0, UCT_MD_MEM_TYPE_HOST}; size_t ucp_rkey_packed_size(ucp_context_h context, ucp_md_map_t md_map) @@ -359,6 +359,7 @@ static ucp_lane_index_t ucp_config_find_rma_lane(ucp_context_h context, ucp_md_index_t md_index; uct_md_attr_t *md_attr; uint8_t rkey_index; + int valid_mem_type_lane; int prio; for (prio = 0; prio < UCP_MAX_LANES; ++prio) { @@ -372,10 +373,12 @@ static ucp_lane_index_t ucp_config_find_rma_lane(ucp_context_h context, md_index = config->md_index[lane]; md_attr = &context->tl_mds[md_index].attr; + valid_mem_type_lane = (!rkey || ((md_attr->cap.mem_type == mem_type) && + (md_attr->cap.mem_type == rkey->mem_type))); + if ((md_index != UCP_NULL_RESOURCE) && (!(md_attr->cap.flags & UCT_MD_FLAG_NEED_RKEY)) && - (!rkey || (md_attr->cap.mem_type == mem_type && - md_attr->cap.mem_type == rkey->mem_type))) + (valid_mem_type_lane)) { /* Lane does not need rkey, can use the lane with invalid rkey */ *uct_rkey_p = UCT_INVALID_RKEY;