Repository navigation
Cache IPC handles per peer to avoid cross-peer VA collision - v1.23.x (#11756) - #11876
Conversation
|
🤖 Starting review — findings will be posted here when done. |
| int ret; | ||
|
|
||
| pthread_rwlock_rdlock(&cache->lock); | ||
| /* A per-cache lock would be needed only if the caller holds no lock or |
There was a problem hiding this comment.
Stale/misleading comment in uct_rocm_ipc_cache_map_region:
/* A per-cache lock would be needed only if the caller holds no lock or
* just a read lock on the global remote-cache lock, allowing concurrent
* access to this page table. */The map path is always entered under the global write lock, so this hypothetical explanation about "no lock or just a read lock" reads as if there is an unlocked path in this function. Suggest tightening it to state the actual invariant, e.g. that the caller must hold the global write lock so the page table needs no additional locking. Not blocking.
|
Test coverage: This is an internal flow change with no ROCm CI hardware; relying on existing IPC gtest coverage is reasonable. Worth confirming with the author that the existing IPC tests were run on a ROCm box, since the cache path is fully rewritten. |
2d1938f to
63da570
Compare
|
🤖 Starting review — findings will be posted here when done. |
| int ret; | ||
|
|
||
| pthread_rwlock_rdlock(&cache->lock); | ||
| /* A per-cache lock would be needed only if the caller holds no lock or |
There was a problem hiding this comment.
The comment describes a per-cache lock that "would be needed only if the caller holds no lock or just a read lock," but the only caller (uct_rocm_ipc_cache_map_memhandle) always takes the global write lock. As written it reads like there is an optional/conditional locking path. Suggest simplifying to state plainly that the page table is protected by the global remote-cache write lock held by the caller, so no per-cache lock is required.
| } | ||
|
|
||
| ucs_debug("ROCm IPC component cache initialized"); | ||
| it = kh_put(rocm_ipc_rem_cache, hash, key, &ret); |
There was a problem hiding this comment.
In uct_rocm_ipc_remote_cache_get, the CUDA reference asserts ret != UCS_KH_PUT_KEY_PRESENT after kh_put (since a preceding kh_get missed under the write lock). ROCm drops that assertion. Not a correctness bug, but adding the same ucs_assertv_always keeps the two implementations in sync and would catch an unexpected key-present state.
| @@ -7,16 +7,15 @@ | |||
| #define ROCM_IPC_MD_H | |||
|
|
|||
| #include <uct/base/uct_md.h> | |||
There was a problem hiding this comment.
After removing pthread_mutex_t lock from uct_rocm_ipc_component_t, nothing in this header uses pthread anymore. The #include <pthread.h> can be dropped (or replaced by the added <ucs/sys/sys.h> which is now the needed include for ucs_sys_ns_t).
|
Informational: Informational: The map hot path now always takes the global write lock (even on cache hits), serializing all peers, whereas the old ROCm code took a per-cache read lock on hits. This matches the CUDA design intentionally, so it's an accepted tradeoff rather than a defect. Informational: The static-cleanup detach path can still Test coverage: This is an internal flow change with no ROCm CI hardware; relying on existing IPC gtest coverage is reasonable. Worth confirming with the author that the existing IPC tests were run on a ROCm box, since the cache path is fully rewritten. |
edgargabriel
left a comment
There was a problem hiding this comment.
This is a cherry-pick, ignoring auto-review suggestions
What?
Cherry-picking a merged PR from the master branch (#11756)
Why?
Fixes potential cross-peer VA collisions
How?
Adding per-peer IPC handles cache