Skip to content

UCP/WIREUP: Consider BW for AM/keepalive lanes with same latency in selection#11503

Open
shasson5 wants to merge 4 commits into
openucx:masterfrom
shasson5:umbriel
Open

UCP/WIREUP: Consider BW for AM/keepalive lanes with same latency in selection#11503
shasson5 wants to merge 4 commits into
openucx:masterfrom
shasson5:umbriel

Conversation

@shasson5
Copy link
Copy Markdown
Contributor

@shasson5 shasson5 commented May 28, 2026

What?

UCP/WIREUP: Consider BW for AM lanes with same latency in selection

Why?

Better lanes selection in wireup process

solve https://redmine.mellanox.com/issues/4958573

How?

Add optional tiebreak score callback in order to calculate a tiebreak value for equal/similar scores

@shasson5 shasson5 added the WIP-DNM Work in progress / Do not review label May 28, 2026
@shasson5 shasson5 force-pushed the umbriel branch 5 times, most recently from 5100c56 to a88d0ed Compare June 1, 2026 17:56
@shasson5 shasson5 changed the title umbriel UCP/WIREUP: Consider BW for AM lanes with same latency in selection Jun 1, 2026
@shasson5 shasson5 marked this pull request as ready for review June 1, 2026 17:58
@shasson5
Copy link
Copy Markdown
Contributor Author

shasson5 commented Jun 1, 2026

@svc-nvidia-pr-review

@svc-nvidia-pr-review
Copy link
Copy Markdown

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

Copy link
Copy Markdown

@svc-nvidia-pr-review svc-nvidia-pr-review left a comment

Choose a reason for hiding this comment

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

Code Review

6 findings⚠️ 6 minors

6 findings posted as inline comments.

Comment thread src/ucp/wireup/select.c Outdated
Comment thread src/ucp/wireup/select.c Outdated
Comment thread src/ucp/wireup/select.c
Comment thread src/ucp/wireup/select.c Outdated
Comment thread src/ucp/wireup/select.c
Comment thread src/ucp/wireup/wireup.h
@shasson5 shasson5 removed the WIP-DNM Work in progress / Do not review label Jun 2, 2026
Comment thread src/ucp/wireup/wireup.h Outdated
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Suggested change
* Copyright (c) NVIDIA CORPORATION & AFFILIATES, 2001-2026. ALL RIGHTS RESERVED.

Comment thread test/gtest/ucp/test_ucp_proto_mock.cc Outdated
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Suggested change
* Copyright (c) NVIDIA CORPORATION & AFFILIATES, 2024-2026. ALL RIGHTS RESERVED.

Comment thread src/ucp/wireup/select.c
#include <ucs/sys/sock.h>
#include <ucp/core/ucp_ep.inl>
#include <string.h>
#include <inttypes.h>
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Suggested change
#include <inttypes.h>
#include <math.h>

Explicit include for fabs

Comment thread src/ucp/wireup/select.c
int cand_prio,
const ucp_wireup_select_info_t *sel)
{
double ref_score = ucs_min(cand_score, sel->score);
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

I think it's problematic that the ref_score keeps changing while iterating over candidates.
This makes the selection depend on ordering.

Maybe we should find the ref_score in a first pass, and then compare to it in a second pass?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

IMO it overcomplicates the code and not worth it for a minor corner case.

Comment thread src/ucp/wireup/select.c
criteria.local_md_flags = 0;
criteria.is_keepalive = 1;
criteria.calc_score = ucp_wireup_keepalive_score_func;
criteria.calc_tiebreak = ucp_wireup_tiebreak_func;
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

The PR says it's only for AM, should the title/description also mention keepalive?

@shasson5 shasson5 requested review from gleon99 and yosefe June 2, 2026 12:40
@shasson5 shasson5 changed the title UCP/WIREUP: Consider BW for AM lanes with same latency in selection UCP/WIREUP: Consider BW for lanes with same latency in selection Jun 3, 2026
@shasson5 shasson5 changed the title UCP/WIREUP: Consider BW for lanes with same latency in selection UCP/WIREUP: Consider BW for AM/keepalive lanes with same latency in selection Jun 3, 2026
Comment thread src/ucp/wireup/select.c
* (then priority) decides. Returns >0 if the candidate is better, <0 if worse,
* 0 if equal.
*/
static int ucp_wireup_candidate_cmp(double cand_score, double cand_tiebreak,
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

candidate, don't use abbreviations

Comment thread src/ucp/wireup/select.c
* (then priority) decides. Returns >0 if the candidate is better, <0 if worse,
* 0 if equal.
*/
static int ucp_wireup_candidate_cmp(double cand_score, double cand_tiebreak,
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

This func is nor order-dependent.
Meaning, with multiple candidates inside the "window", the lane will be chosen arbitrarily based on bitmap/iter order.
Maybe better find best primary score, then use tiebreak.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Comment thread src/ucp/wireup/select.c
/* best for 4k messages */
double local_bw;

if (unpacked_addr->dst_version < 17) {
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Remote BW from addr v2 is FP8-unpacked, while local BW here remains exact. Nearby code packs/unpacks the local value for symmetry; the AM/keepalive tiebreak should do the same.

Comment thread src/ucp/wireup/select.c
criteria.local_md_flags = 0;
criteria.is_keepalive = 1;
criteria.calc_score = ucp_wireup_keepalive_score_func;
criteria.calc_tiebreak = ucp_wireup_tiebreak_func;
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

New tiebreak for KA, but the PR tests only AM send selection. Plz add coverage for KA candidates, (w max_inflight_eps..)

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