@@ -511,6 +511,11 @@ static ucs_config_field_t ucp_context_config_table[] = {
511511 ucs_offsetof (ucp_context_config_t , reg_nb_mem_types ),
512512 UCS_CONFIG_TYPE_BITMAP (ucs_memory_type_names )},
513513
514+ {"REG_NONBLOCK_FALLBACK" , "y" ,
515+ "Allow fallback to blocking memory registration if no MDs supporting non-blocking\n"
516+ "registration." ,
517+ ucs_offsetof (ucp_context_config_t , reg_nb_fallback ), UCS_CONFIG_TYPE_BOOL },
518+
514519 {"PREFER_OFFLOAD" , "y" ,
515520 "Prefer transports capable of remote memory access for RMA and AMO operations.\n"
516521 "The value is interpreted as follows:\n"
@@ -1617,13 +1622,13 @@ ucp_add_component_resources(ucp_context_h context, ucp_rsc_index_t cmpt_index,
16171622{
16181623 const ucp_tl_cmpt_t * tl_cmpt = & context -> tl_cmpts [cmpt_index ];
16191624 size_t avail_mds = config -> max_component_mds ;
1620- uint64_t mem_type_mask = UCS_BIT (UCS_MEMORY_TYPE_HOST );
16211625 uct_component_attr_t uct_component_attr ;
16221626 unsigned num_tl_resources ;
16231627 ucs_status_t status ;
16241628 ucp_rsc_index_t i ;
16251629 const uct_md_attr_v2_t * md_attr ;
16261630 unsigned md_index ;
1631+ uint64_t mem_type_mask ;
16271632 uint64_t mem_type_bitmap ;
16281633
16291634 /* List memory domain resources */
@@ -1638,6 +1643,7 @@ ucp_add_component_resources(ucp_context_h context, ucp_rsc_index_t cmpt_index,
16381643 }
16391644
16401645 /* Open all memory domains */
1646+ mem_type_mask = UCS_BIT (UCS_MEMORY_TYPE_HOST );
16411647 for (i = 0 ; i < tl_cmpt -> attr .md_resource_count ; ++ i ) {
16421648 if (avail_mds == 0 ) {
16431649 ucs_debug ("only first %zu domains kept for component %s with %u "
@@ -1726,7 +1732,7 @@ ucp_update_memtype_md_map(uint64_t mem_types_map, ucs_memory_type_t mem_type,
17261732 ucp_md_index_t md_index , ucp_md_map_t * md_map_p )
17271733{
17281734 if (mem_types_map & UCS_BIT (mem_type )) {
1729- * md_map_p |= UCS_BIT (md_index );
1735+ * md_map_p |= UCS_BIT (md_index );
17301736 }
17311737}
17321738
@@ -1782,7 +1788,8 @@ static void ucp_fill_resources_reg_md_map_update(ucp_context_h context)
17821788 }
17831789
17841790 if (context -> config .ext .reg_nb_mem_types & UCS_BIT (mem_type )) {
1785- if (reg_nonblock_md_map != 0 ) {
1791+ if ((reg_nonblock_md_map != 0 ) ||
1792+ !context -> config .ext .reg_nb_fallback ) {
17861793 /* Keep map of MDs supporting blocking registration
17871794 * if non-blocking registration is requested for the
17881795 * given memory type. In some cases blocking
@@ -1850,7 +1857,6 @@ static ucs_status_t ucp_fill_resources(ucp_context_h context,
18501857 context -> mem_type_mask = 0 ;
18511858 context -> num_mem_type_detect_mds = 0 ;
18521859 context -> export_md_map = 0 ;
1853- context -> reg_nb_supported_mem_types = 0 ;
18541860
18551861 ucs_memory_type_for_each (mem_type ) {
18561862 context -> reg_md_map [mem_type ] = 0 ;
0 commit comments