Skip to content

Commit e836285

Browse files
authored
Merge pull request #10912 from brminich/ucp/polish_md_init
UCP: Simplify md map initialization
2 parents 064ef8a + 52283e5 commit e836285

File tree

1 file changed

+15
-12
lines changed

1 file changed

+15
-12
lines changed

src/ucp/core/ucp_context.c

Lines changed: 15 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1800,19 +1800,22 @@ static void ucp_fill_resources_reg_md_map_update(ucp_context_h context)
18001800
}
18011801
}
18021802

1803-
if ((context->config.ext.reg_nb_mem_types & UCS_BIT(mem_type)) &&
1804-
((reg_nonblock_md_map != 0) || !context->config.ext.reg_nb_fallback)) {
1805-
/* Keep map of MDs supporting blocking registration
1806-
* if non-blocking registration is requested for the
1807-
* given memory type. In some cases blocking
1808-
* registration maybe required anyway (e.g. internal
1809-
* staging buffers for rndv pipeline protocols). */
1810-
context->reg_block_md_map[mem_type] =
1811-
reg_block_md_map & ~reg_nonblock_md_map;
1812-
context->reg_md_map[mem_type] = reg_nonblock_md_map;
1803+
/* Keep map of MDs supporting blocking registration if non-blocking
1804+
* registration is requested for the given memory type. In some cases
1805+
* blocking registration maybe required anyway (e.g. internal staging
1806+
* buffers for rndv pipeline protocols). */
1807+
context->reg_block_md_map[mem_type] = reg_block_md_map;
1808+
1809+
if ((reg_nonblock_md_map == 0) && context->config.ext.reg_nb_fallback) {
1810+
/* Fallback to blocking registration if no MD supports non-blocking
1811+
* registration */
1812+
reg_nonblock_md_map = reg_block_md_map;
1813+
}
1814+
1815+
if (context->config.ext.reg_nb_mem_types & UCS_BIT(mem_type)) {
1816+
context->reg_md_map[mem_type] = reg_nonblock_md_map;
18131817
} else {
1814-
context->reg_block_md_map[mem_type] = reg_block_md_map;
1815-
context->reg_md_map[mem_type] = reg_block_md_map;
1818+
context->reg_md_map[mem_type] = reg_block_md_map;
18161819
}
18171820

18181821
/* If we have a dmabuf provider for a memory type, it means we can

0 commit comments

Comments
 (0)