@@ -1739,8 +1739,8 @@ ucp_update_memtype_md_map(uint64_t mem_types_map, ucs_memory_type_t mem_type,
17391739static void ucp_fill_resources_reg_md_map_update (ucp_context_h context )
17401740{
17411741 UCS_STRING_BUFFER_ONSTACK (strb , 256 );
1742- ucp_md_map_t reg_block_md_map = 0 ;
1743- ucp_md_map_t reg_nonblock_md_map = 0 ;
1742+ ucp_md_map_t reg_block_md_map ;
1743+ ucp_md_map_t reg_nonblock_md_map ;
17441744 ucs_memory_type_t mem_type ;
17451745 ucp_md_index_t md_index ;
17461746 const uct_md_attr_v2_t * md_attr ;
@@ -1757,6 +1757,8 @@ static void ucp_fill_resources_reg_md_map_update(ucp_context_h context)
17571757 }
17581758
17591759 ucs_memory_type_for_each (mem_type ) {
1760+ reg_block_md_map = 0 ;
1761+ reg_nonblock_md_map = 0 ;
17601762 for (md_index = 0 ; md_index < context -> num_mds ; ++ md_index ) {
17611763 md_attr = & context -> tl_mds [md_index ].attr ;
17621764 if (md_attr -> dmabuf_mem_types & UCS_BIT (mem_type )) {
@@ -1787,9 +1789,8 @@ static void ucp_fill_resources_reg_md_map_update(ucp_context_h context)
17871789 }
17881790 }
17891791
1790- if (context -> config .ext .reg_nb_mem_types & UCS_BIT (mem_type )) {
1791- if ((reg_nonblock_md_map != 0 ) ||
1792- !context -> config .ext .reg_nb_fallback ) {
1792+ if ((context -> config .ext .reg_nb_mem_types & UCS_BIT (mem_type )) &&
1793+ ((reg_nonblock_md_map != 0 ) || !context -> config .ext .reg_nb_fallback )) {
17931794 /* Keep map of MDs supporting blocking registration
17941795 * if non-blocking registration is requested for the
17951796 * given memory type. In some cases blocking
@@ -1798,14 +1799,9 @@ static void ucp_fill_resources_reg_md_map_update(ucp_context_h context)
17981799 context -> reg_block_md_map [mem_type ] =
17991800 reg_block_md_map & ~reg_nonblock_md_map ;
18001801 context -> reg_md_map [mem_type ] = reg_nonblock_md_map ;
1801- } else {
1802- /* Fallback: non-blocking registration was requested for this
1803- * memory type but no MD actually supports it, treat it as if
1804- * the request was not set (i.e., allow blocking-capable MDs as
1805- * well). */
1806- context -> reg_block_md_map [mem_type ] = reg_block_md_map ;
1807- context -> reg_md_map [mem_type ] = reg_block_md_map ;
1808- }
1802+ } else {
1803+ context -> reg_block_md_map [mem_type ] = reg_block_md_map ;
1804+ context -> reg_md_map [mem_type ] = reg_block_md_map ;
18091805 }
18101806
18111807 /* If we have a dmabuf provider for a memory type, it means we can
0 commit comments