Weights from a variable describe one board on one day. Unset or "auto", RADIANCE_AR8_SHARD_WEIGHTS
now reads them from the links: each rank takes its card's bus id from the runtime
(hipDeviceGetPCIBusId), walks /sys/bus/pci/devices from the root port down to the card as
core/diag/sysinfo.cpp's read_card does, and keeps the slowest hop's current speed x width x line
code (8b/10b under 8 GT/s, 128b/130b from there) / 8. The R9700 sits behind an on-card switch
whose endpoint reports Gen5 x16 in any slot, so a degraded slot shows only at the root port. The
weight is round(4 x (rate / fastest)^2): x16 4, half the rate 1, a quarter 0. On the board of the
previous commits that is the measured best, 4,1,0,4,0,1,4,4, and after both Gen4 links retrained
at Gen5 x8 it is 4,1,1,4,1,1,4,4, where the 16 MiB two-shot takes 1360 us. "off" keeps the shards
even and eight integers set them, as before.
The ranks publish their links in the rendezvous (ar8_settle) and, after one barrier, derive the
same table from the same eight entries before anything is sized; settings that differ between
ranks fail init on every rank. Equal weights run the unweighted kernel, and a rank whose path says
nothing (no /sys/bus/pci in a container) leaves the shards even, with a warning naming it. Startup
logs one line, "[r4d] eight-rank two-shot shard weights from the slowest PCIe hop of each card: r0
32.0 GT/s x16 63.0 GB/s w4, r1 32.0 GT/s x8 31.5 GB/s w1, ...". The links are read once, at init:
a link that falls back while the server runs changes the weights at the next start.
r4d_ar_links_test builds that board's sysfs under a temporary root (root port, on-card switch,
endpoint) and checks the bottleneck hop, the weights before and after the repair, equal links, the
line code and a path that says nothing; it needs only libr4d's include path. r4d_selftest runs
auto and off at the default floors, for bits only since what auto derives depends on the box, and
--perfar8 derives the weights the same way and names each rank's link. 206 of 206 on the cards.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>