Skip to content

UCP/RKEY: Keep configurations at stable addresses - v1.23.x - #12043

Merged
tvegas1 merged 1 commit into
openucx:v1.23.xfrom
guy-ealey-morag:jmahou-fix-rkey-config-stability-v1.23.x
Oct 7, 2026
Merged

tvegas1 merged 1 commit into
openucx:v1.23.xfrom
guy-ealey-morag:jmahou-fix-rkey-config-stability-v1.23.x

Conversation

@guy-ealey-morag

Copy link
Copy Markdown
Contributor

Backport #11676.

@svc-nvidia-pr-review

Copy link
Copy Markdown

🤖 Starting review — findings will be posted here when done.

Comment thread src/ucp/core/ucp_rkey.inl
/**
* @return remote key configuration by configuration index
*/
static inline ucp_rkey_config_t *

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

pls use UCS_F_ALWAYS_INLINE, since ucp_rkey_config() is on the RMA short path (ucp_put_send_short, amo_send).

Suggested change
static inline ucp_rkey_config_t *
static UCS_F_ALWAYS_INLINE ucp_rkey_config_t *
ucp_worker_rkey_config(ucp_worker_h worker, ucp_worker_cfg_index_t cfg_index)

Comment thread src/ucp/core/ucp_worker.h

/* rkey configuration storage */
UCS_ARRAY_DECLARE_TYPE(ucp_rkey_config_arr_t, unsigned, ucp_rkey_config_t);
UCS_ARRAY_DECLARE_TYPE(ucp_rkey_config_arr_t, unsigned, ucp_rkey_config_t*);

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

this adds an extra pointer dereference to ucp_rkey_config() in the put_short/amo fast path; did you check there is no message-rate impact?

Comment thread src/ucp/core/ucp_worker.c
goto err;);
rkey_cfg_index = ucs_array_length(&worker->rkey_config);
rkey_config = ucs_malloc(sizeof(*rkey_config), "rkey_config");
if (rkey_config == NULL) {

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

pls log the allocation failure, like the other allocations in this file (ucs_error("failed to allocate worker ifaces") etc.); previously ucs_array_grow() printed it for us.

Suggested change
if (rkey_config == NULL) {
rkey_config = ucs_malloc(sizeof(*rkey_config), "rkey_config");
if (rkey_config == NULL) {
ucs_error("failed to allocate rkey configuration");
status = UCS_ERR_NO_MEMORY;
goto err;
}

old_buffer = ucs_array_begin(&worker()->rkey_config);

/* Grow past the initial reserve using the production path only */
for (key.md_map = 1; key.md_map <= 64; ++key.md_map) {

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

the bound 64 silently depends on the ucs_array_reserve(&worker->rkey_config, 32) in ucp_worker_create(); can we derive it from the initial ucs_array_capacity(&worker()->rkey_config) so ASSERT_NE(old_buffer, ...) does not become a no-op if the reserve changes?

@svc-nvidia-pr-review

Copy link
Copy Markdown

Coverage note: the new test does fail without the fix (the first config pointer moves after reallocation), which satisfies the regression-test expectation. One residual gap: the test covers pointer stability, not the behavior the removed FIXME described (a proto_select cache/pointer used across a recursive rkey-config addition). Existing coverage for that path is test_ucp_proto_mock/test_ucp_proto rndv remote-proto selection, which exercises recursive ucp_worker_rkey_config_get() but not with a forced reallocation. Not worth blocking on.

@tvegas1
tvegas1 enabled auto-merge (squash) October 7, 2026 15:23
@tvegas1
tvegas1 merged commit 332d30c into openucx:v1.23.x Oct 7, 2026
162 checks passed
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.

3 participants