Skip to content

Conversation

@roiedanino
Copy link
Contributor

What?

Set UCT_MD_MEM_FLAG_LOCK flag when user is allocating a buffer using ucp_mem_map without passing UCP_MEM_MAP_NONBLOCK flag

Why?

Otherwise, non-blocking registration (ODP) can still happen in ucp_memh_register_internal

…t passed to ucp_mem_map

Signed-off-by: Roie Danino <rdanino@nvidia.com>
@roiedanino roiedanino requested review from gleon99 and yosefe August 28, 2025 12:08
@roiedanino roiedanino self-assigned this Aug 28, 2025
flags |= UCT_MD_MEM_FLAG_NONBLOCK;
} else if (params->flags & UCP_MEM_MAP_LOCK) {
} else if ((params->flags & UCP_MEM_MAP_LOCK) ||
(params->flags & UCP_MEM_MAP_ALLOCATE)) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm not sure that would always work.
It leads to usage of reg_block_md_map (https://github.com/roiedanino/ucx/blob/reg-nb/src/ucp/core/ucp_mm.c#L866)
which is populated here.
But if UCX_REG_NONBLOCK_MEM_TYPES is empty (as default), that map would be empty.
@yosefe wdyt?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

should be ok, because it just adds context->reg_block_md_map[mem_type] to the existing reg_map.
but what does it fix? Why would we need this change?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The default for UCX_REG_NONBLOCK_MEM_TYPES is "host,cuda-managed" its not really empty

it is default only for grace

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes my bad

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The issue is on grace machines the default is not empty and then even if NONBLOCK flag wasn't passed it would still use NONBLOCK registration (unless LOCK flag was set on)

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👍🏼

Copy link
Contributor

@gleon99 gleon99 Aug 28, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Meaning, the change will have effect only when UCX_REG_NONBLOCK_MEM_TYPES has a non-empty value.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

but we have UCP_MEM_MAP_LOCK for those who want blocking behavior?
otherwise UCX may decide what is better

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There is more to it.. we need to cancel all effects of REG_NONBLOCK_MEM_TYPES in case of memory allocation. Here, we create another effect (passing UCT lock flag) and we don't prevent the registration md map filtering - that limits registration only to MD that support NONBLOCK registration.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

that was the intent to use ODP on GH machines by default
The issue of ODP+ DPP is being addressed here #10803

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants