Skip to content

UCP: Name the peer version checks of rkey, ep recovery and AM PSN - #12234

Closed
dmitrygx wants to merge 1 commit into
openucx:masterfrom
dmitrygx:topic/ucx/dst-version-rest
Closed

dmitrygx wants to merge 1 commit into
openucx:masterfrom
dmitrygx:topic/ucx/dst-version-rest

Conversation

@dmitrygx

@dmitrygx dmitrygx commented Nov 4, 2026

Copy link
Copy Markdown
Member

What?

Replace the raw peer release numbers compared with dst_version in ucp_rkey.c, ucp_ep.c and am/eager_multi.c with named constants. No functional change.

  • ucp_rkey.c: UCP_RKEY_SYS_DEV_MIN_DST_VERSION (20), the peer always packs the system device of a non-empty remote key, and the lane distances if the device is known. Used in ucp_rkey_extract_sys_dev() and ucp_rkey_proto_resolve(). dst_version > 19 becomes dst_version >= UCP_RKEY_SYS_DEV_MIN_DST_VERSION, which is the same for the unsigned dst_version.
  • ucp_ep.c: UCP_EP_RECOVERY_MIN_DST_VERSION (22), the peer supports the endpoint recovery. Used in ucp_ep_recovery_arm(), whose diagnostic message prints the constant instead of a literal 1.22, so the text stays the same.
  • am/eager_multi.c: UCP_AM_PSN_MIN_DST_VERSION (21), the peer supports the PSN protocol. Used in ucp_am_eager_multi_zcopy_psn_proto_probe().

The constants are local to their only users, like UCP_PROTO_RMA_RNDV_MIN_DST_VERSION in rma_rndv.c.

Why?

A raw release number does not say which peer capability it checks. A named constant documents it in one place, so the check is easy to find and keep consistent with the code it protects. The lane selection checks in select.c are named in #12233; after both, no dst_version check in src/ucp compares with a raw number.

How?

The values are not changed: with the constants replaced by their values (>= 20 as > 19, and 1.%d with 22 as 1.22), each file is the same as on master token by token. grep -rnE 'dst_version *(<|>|<=|>=|==|!=) *[0-9]' src/ prints only the select.c checks handled by #12233.

ucp_rkey.c, ucp_ep.c and am/eager_multi.c compared dst_version of the peer
with raw release numbers. Define them as local *_MIN_DST_VERSION constants,
like UCP_PROTO_RMA_RNDV_MIN_DST_VERSION in rma_rndv.c:
- UCP_RKEY_SYS_DEV_MIN_DST_VERSION (20): the peer always packs the system
  device of a non-empty remote key. "> 19" becomes ">= 20", dst_version is
  unsigned.
- UCP_EP_RECOVERY_MIN_DST_VERSION (22): the peer supports the endpoint
  recovery. The diagnostic message prints it instead of a literal 1.22.
- UCP_AM_PSN_MIN_DST_VERSION (21): the peer supports the PSN protocol.

No functional change.
@dmitrygx
dmitrygx requested a review from a team as a code owner November 4, 2026 08:22
@svc-nvidia-pr-review

Copy link
Copy Markdown

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

Comment thread src/ucp/core/ucp_ep.c
if (ucp_ep_config(ep)->key.dst_version < 22) {
ucs_diag("ep: %p: recovery support requires UCX 1.22 or later, "
if (ucp_ep_config(ep)->key.dst_version < UCP_EP_RECOVERY_MIN_DST_VERSION) {
ucs_diag("ep: %p: recovery support requires UCX 1.%d or later, "

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

minor: while touching this message, pls print the peer version with %u — key.dst_version is declared unsigned (ucp_ep.h:283), but the reflowed message still prints it with %d. Impact: cosmetic/format-type mismatch only.

@svc-nvidia-pr-review

Copy link
Copy Markdown

soft suggestion — PR scope: the same kind of raw version gate remains in src/ucp/wireup/select.c (dst_version < 17 at lines 1106 and 1713, < 18 at 415, >= 19 at 1457, >= 17 at 2322). Maybe also convert these to *_MIN_DST_VERSION constants so all of them follow the same pattern? Otherwise the stated cleanup goal is only partially achieved, and the magic numbers stay in the file where there are most of them.

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.

2 participants