1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
# SPDX-FileCopyrightText: Copyright (c) 2025-2026 NVIDIA CORPORATION & AFFILIATES. All rights reserved.
# SPDX-License-Identifier: Apache-2.0
#
"""The refit throughput floor, shared by every receiver that moves weights.
There are two receivers, they use the same transport, and they were reached by
different framework paths: ``refit.reshard.receiver`` builds its own plan for the
Megatron path, while ``modelexpress_rl.inference.nixl_staged_transfer`` stages for
the FSDP path. A floor that lives in one of them protects one framework and
silently does nothing for the other, which is the failure this module exists to
prevent - the incident that motivated the floor was measured on the FSDP path.
One implementation also means one schema. A CI gate keys on the marker string, so
two copies free to drift would let the same regression fail one path and pass the
other, and the gate would look green for the wrong reason.
"""
# Grepped by the CI perf gate, so it is named once rather than spelled at each
# call site.
=
=
"""Per-rank floor in Gbps; 0 disables the check.
Read at call time so a harness can set it per run. Off unless configured
because only the operator knows what their fabric should deliver.
A non-finite floor disables the check rather than being compared against.
``float("nan")`` parses happily and every comparison against NaN is False, so
a fat-fingered value would pass the "is it configured" test and then fail the
"is the rate acceptable" test, warning on every single refit and turning the
guard into noise. Infinity parses too and would condemn every refit outright.
A negative floor disables it too, but says so. ``warn_if_below_floor`` treats
anything at or below zero as off, so a stray minus sign would otherwise take
a configured gate out of service in silence - and the caller who wrote -50
believes a floor is in force. Only ``0`` is documented as the off switch, so
every other disabling value has to announce itself.
"""
=
return 0.0
return 0.0
return
"""Report a wire rate far below what the fabric should deliver.
``MX_RESHARD_MAX_GBPS`` catches a transfer that did not happen. Nothing
caught one that happened 20x too slowly: four concurrent receivers on a node
collapsed from ~26 GB/s to ~1.5 GB/s each with byte counts exact, descriptor
counts exact, coverage complete and fallback zero. Every signal available
said the refit was healthy, because a rate is only interpretable against a
bound and only the upper one existed.
Warns rather than raising, which is deliberately the opposite of the ceiling.
An impossible rate means the payload never moved so the buffers cannot be
trusted; a slow rate is still a correct refit, and killing a training run
over throughput would be worse than the throughput. The record is structured
so a CI gate can fail on its presence, which is where enforcement belongs: a
perf regression should block a merge, not a production refit.
``context`` is merged into the record so each receiver can name whoever saw
it. The incident had one fast rank and three slow ones in the same run, so a
record that cannot be attributed is a record that cannot describe it.
Logs through the caller's logger so the report surfaces under the module that
owns the transfer, next to that receiver's own cost record.
"""
=
return
= * 8 / / 1e9
return
=