Repository navigation
UCT/TCP: Query netif capabilities once per iface - #12201
Conversation
|
🤖 Starting review — findings will be posted here when done. |
|
🤖 CI Triage Agent — TL;DR: This isn't a code bug — the "AUTHORS file update check" failed because PR #12201's author (Bryce Westheimer) is a new contributor who is not listed in the Full analysisSummary: The Root cause: The pipeline step computes the PR commit range ( Implicated commit: [REDACTED:Hex High Entropy String] (Bryce Westheimer) — the PR head commit; no implicated commit in CI infrastructure. File: AUTHORS:23-24 (insertion point); check logic at contrib/authors_update.sh:36-46 Suggested fix: In the PR branch Equivalently, manually insert Related: PR #12201 (openucx/ucx) — no existing issue found for this failure signature.
|
| ucs_time_t user_timeout; /* TCP_USER_TIMEOUT */ | ||
| double max_bw; /* Upper bound to TCP iface bandwidth */ | ||
| double latency; /* Netdev latency */ | ||
| double bandwidth; /* Netdev bandwidth */ |
There was a problem hiding this comment.
minor: the comment is inaccurate — the cached value is not just the netdev bandwidth, it is the min of netdev BW, PCI BW and UCX_TCP_MAX_BW.
| double bandwidth; /* Netdev bandwidth */ | |
| double bandwidth; /* Netdev BW, bounded by PCI BW and MAX_BW */ |
| goto err_cleanup_rx_mpool; | ||
| } | ||
|
|
||
| status = uct_tcp_iface_init_netif_caps(self, config); |
There was a problem hiding this comment.
Placement of the new call: maybe we can call this next to the other self->config assignments (before the mpool init)? It only needs if_name and config, and then the failure path does not have to unwind the mpools.
There was a problem hiding this comment.
Done: moved before the mpool init, failure path is now a plain goto err.
|
Residual gap: device latency/bandwidth and default-route priority are now sampled once at iface open instead of on every query, so a link-speed or default-route change after open is no longer picked up. UCP queries iface attrs once per iface, so the practical impact looks negligible — worth confirming the PR description mentions this behavior change. |
204b6e2 to
319aeba
Compare
|
🤖 Starting review — findings will be posted here when done. |
|
Re the residual gap: yes, intended and described in the How section (attributes static after open; the one runtime consumer is the UCP IB port-speed-change handler, which now keeps the open-time bandwidth for a tcp iface sharing the device). This follows the IB iface_query, which also reads port attributes cached at device open. |
|
🤖 Review complete — no issues found. |
|
🤖 CI Triage Agent — TL;DR: The gtest step failed with a single non-fatal failure — Full analysisSummary: Azure job "new on worker 3" → step Root cause: From the log, the failure is a non-fatal gtest failure (the run continued to completion through all remaining suites and the tear-down, no SIGSEGV/abort, no timeout, no large timestamp gaps — the longest waits in the log are legitimate Implicated commit: File: Suggested fix:
Related: PR #12201 (this change); #11947 / commit |
|
Re the red leg (Tests new on worker 3: On the triage points: /azp run UCX PR |
319aeba to
e964bb8
Compare
|
Pushed e964bb8: rebased on master and set |
|
🤖 Starting review — findings will be posted here when done. |
|
|
||
| iface->config.priority = is_default ? 0 : 1; | ||
| } else { | ||
| iface->config.priority = 0; |
There was a problem hiding this comment.
minor: status is already UCS_OK here.
| iface->config.priority = 0; | |
| iface->config.priority = 0; |
There was a problem hiding this comment.
Agreed it is already UCS_OK; the explicit assignment was added for the CI triage comment above (point 2), so the success return of this branch does not depend on the earlier path-buffer call. Either form is fine with me; I will follow the reviewers' preference.
|
🤖 CI Triage Agent — TL;DR: The gtest binary aborted on a debug assertion in Full analysisSummary: Root cause: Log sequence (15:57:43–15:57:44) shows the test invalidate lane 0/2 of the DC endpoint (
This is in the UCP fault-tolerance/DC path only. The PR under test (#12201, branch Implicated commit: unknown for the exact regression; most plausible candidates in the failover/DC-recovery area are File: Suggested fix:
Related: PR #12201 (the PR being tested, unrelated to the failure); failover work: #12048, #11923, #12091, #12005, #12160 ("UCP/CORE/FT: add recovery enable", open); purge-outstanding work that introduced the NOP-only-on-FAILED rule: #11836, #12062.
|
| * It cannot exceed 255. */ | ||
| ucs_time_t user_timeout; /* TCP_USER_TIMEOUT */ | ||
| double max_bw; /* Upper bound to TCP iface bandwidth */ | ||
| double latency; /* Netdev latency */ |
There was a problem hiding this comment.
can we keep config for the user's settings and cache only what the netdev reports? prefer_default and max_bw would stay in config and iface_query keeps applying them, so the cache holds no configuration (and float.h/DBL_MAX stay as is):
struct {
double latency; /* Netdev latency */
double bandwidth; /* Min of netdev and PCI BW */
int is_default; /* Netdev has the default route */
} netif_caps; attr->latency.c = iface->netif_caps.latency;
/* Bandwidth is bounded by TCP stack computation time */
attr->bandwidth.shared = ucs_min(iface->netif_caps.bandwidth,
iface->config.max_bw);
...
attr->priority = (iface->config.prefer_default &&
!iface->netif_caps.is_default) ? 1 : 0;uct_tcp_iface_init_netif_caps() then only needs iface, and can free the path buffer right after ucs_topo_get_pci_bw(), which drops the out_free_path_buffer label.
There was a problem hiding this comment.
Done in 833ef05: config keeps prefer_default/max_bw (and float.h/DBL_MAX), new netif_caps {latency, bandwidth, is_default} holds only what the netdev reports, iface_query applies MAX_BW and PREFER_DEFAULT as before, and the helper takes only iface and frees the path buffer right after ucs_topo_get_pci_bw(). ucx_info -d tcp output unchanged; tcp gtests pass with PREFER_DEFAULT=n/y and MAX_BW set.
e964bb8 to
833ef05
Compare
|
🤖 Starting review — findings will be posted here when done. |
|
|
||
| iface->netif_caps.bandwidth = ucs_min(pci_bw, network_bw); | ||
|
|
||
| return uct_tcp_netif_is_default(iface->if_name, |
There was a problem hiding this comment.
uct_tcp_netif_is_default() is now called unconditionally, where before it was only called under if (iface->config.prefer_default). Two consequences: every TCP iface open scans /proc/net/route even when the result is discarded, and if /proc/net/route is unreadable the iface open now fails, whereas previously UCX_TCP_PREFER_DEFAULT=n kept TCP usable. Narrow environment, but it is an avoidable behavior change.
Suggestion:
| return uct_tcp_netif_is_default(iface->if_name, | |
| if (!iface->config.prefer_default) { | |
| iface->netif_caps.is_default = 0; | |
| return UCS_OK; | |
| } | |
| return uct_tcp_netif_is_default(iface->if_name, | |
| &iface->netif_caps.is_default); |
There was a problem hiding this comment.
Done in 5570242: with PREFER_DEFAULT=n the route check is skipped and is_default is set to 0, so iface open no longer depends on /proc/net/route in that case.
833ef05 to
5570242
Compare
|
🤖 Starting review — findings will be posted here when done. |
| attr->bandwidth.dedicated = 0; | ||
| attr->latency.m = 0; | ||
| attr->overhead = 50e-6; /* 50 usec */ | ||
| attr->priority = (iface->config.prefer_default && |
There was a problem hiding this comment.
minor: maybe store the resolved priority in netif_caps instead of is_default? Then query is a plain assignment and prefer_default is not checked in two places — right now is_default == 0 means both "not the default route" and "not checked".
There was a problem hiding this comment.
Keeping the reviewer's shape: netif_caps holds only what the netdev reports (is_default is the fact, PREFER_DEFAULT is policy applied in the query, as MAX_BW is for bandwidth). With PREFER_DEFAULT=n the flag is never read, so the two meanings of 0 do not reach a consumer.
| .ep_outstanding_purge = (uct_ep_outstanding_purge_func_t)ucs_empty_function_return_unsupported | ||
| }; | ||
|
|
||
| static ucs_status_t uct_tcp_iface_init_netif_caps(uct_tcp_iface_t *iface) |
There was a problem hiding this comment.
minor: pls rename uct_tcp_iface_init_netif_caps to uct_tcp_iface_netif_caps_init to match the <object>_<verb> naming of the neighboring uct_tcp_iface_listener_init/uct_tcp_iface_server_init.
There was a problem hiding this comment.
Fair point on naming. Leaving the head as approved; happy to rename in a follow-up or now if a maintainer prefers.
There was a problem hiding this comment.
Renamed to uct_tcp_iface_netif_caps_init in 803672b.
|
Residual gap (not blocking): no focused test asserting TCP Behavior change worth making explicit in the PR description (raised in an earlier round): link-speed or default-route changes after iface open are no longer picked up by later queries. |
|
🤖 CI Triage Agent — TL;DR: The gtest binary aborted on a UCS registration-cache assertion ( Full analysisSummary: Root cause: From the log:
Note on attribution: the backtrace contains no TCP code at all — the PR under test (#12201, Implicated commit: Not the PR commit. The most recent change to the implicated file is File: Suggested fix:
Related: PR under test: #12201 · most recent change to the implicated file: #12150 · possibly relevant rcache work: #11958 (no existing issue found for this assertion) |
|
Re the red leg on 5570242 (Tests new on worker 3, rcache assertion |
uct_tcp_iface_query() ran uct_tcp_netif_caps() (SIOCETHTOOL, SIOCGIFHWADDR, SIOCGIFMTU, one socket each), a sysfs walk for the PCI bandwidth and a /proc/net/route scan on every call. UCP queries an iface far more often than once per open: uct_iface_set_am_handler() and uct_base_iface_estimate_perf() both call uct_iface_query(). Calls per tcp iface per ucp_worker_create, counted with gdb breakpoints on uct_tcp_netif_caps (ucx_info -u t -p -w, UCX_TLS=tcp,sm,self): - ucp_worker_iface_open: 1 (wiface->attr) - ucp_worker_iface_port_speed -> estimate_perf: 1 - ucp_worker_iface_init -> deactivate -> set_am_handlers: 13 (one per UCP AM id) That is 15 per iface per worker, plus 13 more in ucp_worker_destroy (remove_am_handlers). Protocol selection and wireup on the first send add about 66 estimate_perf calls, and each iface activation another 13. ucx_info -w on a host with 2 tcp devices issued 56 SIOCETHTOOL ioctls; with this change it issues 2. SIOCETHTOOL runs under rtnl_lock and, on IPoIB, queries the HCA port, so with many netdevs and many processes or threads per node these repeated queries serialize worker creation: 72 threads creating and destroying one worker each (test/apps/test_init_mt) take 12-68 s instead of 1-3 s, and MPI_Init at 72 ranks per node on a host with six tcp netdevs drops from 7.3 s to 1.7 s with this change. Query the netdev once in the iface constructor, before the memory pools are created, and keep its latency, bandwidth and default-route flag in the iface; iface_query applies MAX_BW and PREFER_DEFAULT to the stored values as before. This follows the IB transport, whose iface_query reads the port attributes cached at device open. tcp iface attributes are therefore static after open for every consumer: link speed or default route changes after open are not reflected, and the one consumer that re-estimates bandwidth at runtime, the UCP handler for the IB port speed change event, keeps the open-time bandwidth for a tcp iface that shares the device with the IB port. ucx_info -d output is unchanged.
5570242 to
803672b
Compare
|
🤖 Starting review — findings will be posted here when done. |
|
minor: can we cache the resulting |
|
🤖 CI Triage Agent — TL;DR: The Full analysisSummary: 8965/8966 gtests passed; Root cause: The fetched log tail only contains the gtest summary ( Implicated commit: none — not a regression from [REDACTED:Hex High Entropy String] / PR #12201 (TCP-only). Test-side fragility originates in File: Suggested fix:
Related: PR #12201 (
|
What?
Compute the tcp iface netif capabilities (latency, bandwidth, priority) once in the iface constructor and return the stored values from
uct_tcp_iface_query().Why?
uct_tcp_iface_query()ranuct_tcp_netif_caps()(SIOCETHTOOL, SIOCGIFHWADDR, SIOCGIFMTU, one socket each), a sysfs walk for the PCI bandwidth and a/proc/net/routescan on every call, and UCP queries an iface far more often than once:uct_iface_set_am_handler()anduct_base_iface_estimate_perf()both calluct_iface_query(). Per tcp iface perucp_worker_createthat is 15 queries (1 open, 1 port_speed, 13 AM handler ids) plus 13 atucp_worker_destroy, and about 66 moreestimate_perfcalls on the first send. SIOCETHTOOL takesrtnl_lockand on IPoIB reaches the HCA port query, so with many netdevs and many processes or threads per node worker creation serializes node-wide.Measured:
test/apps/test_init_mtwith 72 OpenMP threads on a GH200 node with 12 netdevs (4 IPoIB, one USB NIC): 12.1 s per iteration -> 2.35 s (UCX_TLS=^tcp control: 2.0 s). SIOCETHTOOL per run 12960 -> 432. (Internal CI hit the 1 min per-iteration timeout on this test.)UCX_TLS=allon the same node: 7.3 s -> 1.7 s.ucx_info -u t -won a host with 2 tcp devices: 56 -> 2 SIOCETHTOOL.How?
New
uct_tcp_iface_init_netif_caps()runs after the netdev address lookup succeeded, stores the three values iniface->config, and replaces the storedprefer_defaultandmax_bw(the explicitMAX_BWcap is applied once at init). This follows the IB transport, whoseiface_queryreads port attributes cached at device open. tcp iface attributes are therefore static after open: link speed or default route changes after open are not reflected, and the UCP handler for the IB port speed change event keeps the open-time bandwidth for a tcp iface that shares the device with the IB port.Why not cache in
uct_iface_set_am_handler(): the expensive work is tcp-specific and is reached from three base-layer callers (set_am_handler,estimate_perf,port_speed), so a cache at one caller would be both broader (all transports) and incomplete.Tests: no unprivileged gtest can observe the change (two consecutive queries return equal values before and after), so coverage is the existing
tcp/test_uct_tcp.*and UCP-over-tcp gtests (all pass, also under valgrind and withUCX_TCP_PREFER_DEFAULT=y/UCX_TCP_MAX_BWset), anducx_info -d -t tcpis byte-identical before and after. On a GH200 node with IB and real netdevs the*tcp*gtests pass excepttcp/test_ucp_loopback.envelope/28 <tcp/put_bw>, which times out identically on master.