Repository navigation
UCP/CORE: Detect memory type on cache miss with non-host detect MDs #11332
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Closed
yafshar
wants to merge
1
commit into
openucx:master
from
intel-staging:fix/ucp-core-memtype-cache-miss
Closed
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
do you know what memory allocator is being used for such unknown memory, and would it make sense to add hook under src/ucm instead? afaiu the slow path was meant to be used when memtype cache was disabled.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Unknown memtype here is not a specific allocator. It can happen even with memtype cache enabled, for example when UCM reports UNKNOWN for existing allocations or paths it cannot classify immediately, or when cache coverage is incomplete for the queried range.
Because of that, the internal slowpath is not only for the cache-disabled case. It is the correctness fallback for unknown or non-covered entries while cache is active.
Adding a hook under src/ucm is useful only if we identify a concrete allocator/runtime path that currently bypasses UCM memtype events. That may reduce slowpath frequency, but it will not remove the need for fallback in cross-context cases such as separate L0 contexts (for example PyTorch or SYCL vs UCX).
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
thanks for details, also I think that memtype cache only tracks non-host memory, so no element currently means host memory type. if so I think that doing slowpath for those cases could have perf impact? for all the cases you mention maybe the memtype could be passed along with pointer?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks, that makes sense. I agree we should avoid per-call warnings in this path, but we can add lightweight observability: I mean to track slowpath hits (miss and unknown cases) in the existing UCP stats tree using UCS_STATS_NODE_DECLARE, and emit a one-time or end-of-run summary hint when the counters are non-zero. That gives actionable feedback to pass explicit memtype hints without adding hot-path log noise.
Also agreed that passing memtype with the pointer is the preferred fix at the application boundary. In our NIXL/Dynamo integration we already do this for PyTorch GPU buffers by setting UCP_MEM_MAP_PARAM_FIELD_MEMORY_TYPE to UCS_MEMORY_TYPE_ZE_DEVICE, and in that path detection is bypassed.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
i think there is logging aspect but also the implied uct_md_mem_query() that could have perf impact for host memory case (repeatedly calling it as host mem type is never in memtype cache).
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I agree we should avoid changing NO_ELEM semantics globally due performance risk on host-heavy paths. I will make this PR into draft for now