Commit 909c1d7
committed
perf_logger: remove legacy _compute_per_token_flops back-compat shim
The single-term per-token FLOP function was kept around after the
two-term split (non_attn + coeff·Σ(Lᵢ²)) was introduced, solely so
old unit tests and the startup log line could still reference it.
Nothing in the runtime path was using it — log_step had already
switched to the split formula. Remove the function, the
self._per_token_flops attribute, and the test scaffolding that
existed only to pin the split against the legacy reference:
- _compute_per_token_flops(cfg, seq_len) deleted from all 4 recipes
- self._per_token_flops init + assignment + log-line mention removed
- logger.info startup format no longer includes "per-token FLOPs=%e"
- TestComputePerTokenFlops test class deleted (llama3 only)
- test_algebraic_identity deleted (its whole purpose was to pin
non_attn + coeff·S against the legacy function)
- test_bshd_no_op simplified to test_bshd_shape_synthesis — keeps
the Σ(Lᵢ²)=B·S² shape-synthesis check, drops the legacy comparison
- Docstrings no longer reference the old function
The tests that exercise actual formula correctness
(test_thd_multi_doc_uses_squared_sum, test_cp_size_divides_attention_only,
test_bshd_cp_correction, test_include_padding_*, etc.) all stay — they
verify behavior directly without going through the legacy.
Net: -336 / +40 lines. Pure dead-code removal, no runtime change.
Signed-off-by: Gagan Kaushik <gkaushik@nvidia.com>1 parent f8f84cb commit 909c1d7
8 files changed
Lines changed: 40 additions & 336 deletions
File tree
- bionemo-recipes/recipes
- codonfm_native_te
- tests
- esm2_native_te
- tests
- llama3_native_te
- tests
- opengenome2_llama_native_te
- tests
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
66 | 66 | | |
67 | 67 | | |
68 | 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 | 69 | | |
107 | 70 | | |
108 | 71 | | |
109 | 72 | | |
110 | 73 | | |
111 | | - | |
112 | | - | |
| 74 | + | |
| 75 | + | |
113 | 76 | | |
114 | 77 | | |
115 | 78 | | |
| |||
228 | 191 | | |
229 | 192 | | |
230 | 193 | | |
231 | | - | |
232 | 194 | | |
233 | 195 | | |
234 | 196 | | |
235 | 197 | | |
236 | 198 | | |
237 | | - | |
238 | 199 | | |
239 | 200 | | |
240 | 201 | | |
241 | 202 | | |
242 | 203 | | |
243 | | - | |
244 | | - | |
| 204 | + | |
| 205 | + | |
245 | 206 | | |
246 | 207 | | |
247 | | - | |
248 | | - | |
249 | 208 | | |
250 | 209 | | |
| 210 | + | |
251 | 211 | | |
252 | 212 | | |
253 | 213 | | |
| |||
Lines changed: 3 additions & 16 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
26 | 26 | | |
27 | 27 | | |
28 | 28 | | |
29 | | - | |
30 | 29 | | |
31 | 30 | | |
32 | 31 | | |
| |||
231 | 230 | | |
232 | 231 | | |
233 | 232 | | |
234 | | - | |
| 233 | + | |
235 | 234 | | |
236 | | - | |
237 | | - | |
238 | | - | |
239 | | - | |
240 | | - | |
241 | | - | |
242 | | - | |
243 | | - | |
244 | | - | |
245 | | - | |
246 | | - | |
| 235 | + | |
| 236 | + | |
247 | 237 | | |
248 | 238 | | |
249 | 239 | | |
250 | 240 | | |
251 | | - | |
252 | | - | |
253 | | - | |
254 | 241 | | |
255 | 242 | | |
256 | 243 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
65 | 65 | | |
66 | 66 | | |
67 | 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 | 68 | | |
106 | 69 | | |
107 | 70 | | |
108 | 71 | | |
109 | 72 | | |
110 | | - | |
111 | | - | |
| 73 | + | |
| 74 | + | |
112 | 75 | | |
113 | 76 | | |
114 | 77 | | |
| |||
231 | 194 | | |
232 | 195 | | |
233 | 196 | | |
234 | | - | |
235 | 197 | | |
236 | 198 | | |
237 | 199 | | |
238 | 200 | | |
239 | 201 | | |
240 | | - | |
241 | 202 | | |
242 | 203 | | |
243 | 204 | | |
244 | 205 | | |
245 | 206 | | |
246 | | - | |
247 | | - | |
| 207 | + | |
| 208 | + | |
248 | 209 | | |
249 | 210 | | |
250 | | - | |
251 | | - | |
252 | 211 | | |
253 | 212 | | |
| 213 | + | |
254 | 214 | | |
255 | 215 | | |
256 | 216 | | |
| |||
Lines changed: 3 additions & 16 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
35 | 35 | | |
36 | 36 | | |
37 | 37 | | |
38 | | - | |
39 | 38 | | |
40 | 39 | | |
41 | 40 | | |
| |||
96 | 95 | | |
97 | 96 | | |
98 | 97 | | |
99 | | - | |
| 98 | + | |
100 | 99 | | |
101 | | - | |
102 | | - | |
103 | | - | |
104 | | - | |
105 | | - | |
106 | | - | |
107 | | - | |
108 | | - | |
109 | | - | |
110 | | - | |
111 | | - | |
| 100 | + | |
| 101 | + | |
112 | 102 | | |
113 | 103 | | |
114 | 104 | | |
115 | 105 | | |
116 | | - | |
117 | | - | |
118 | | - | |
119 | 106 | | |
120 | 107 | | |
121 | 108 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
63 | 63 | | |
64 | 64 | | |
65 | 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 | 66 | | |
104 | 67 | | |
105 | 68 | | |
106 | 69 | | |
107 | 70 | | |
108 | | - | |
109 | | - | |
| 71 | + | |
| 72 | + | |
110 | 73 | | |
111 | 74 | | |
112 | 75 | | |
| |||
237 | 200 | | |
238 | 201 | | |
239 | 202 | | |
240 | | - | |
241 | 203 | | |
242 | 204 | | |
243 | 205 | | |
244 | 206 | | |
245 | 207 | | |
246 | | - | |
247 | 208 | | |
248 | 209 | | |
249 | 210 | | |
250 | 211 | | |
251 | 212 | | |
252 | | - | |
253 | | - | |
| 213 | + | |
| 214 | + | |
254 | 215 | | |
255 | 216 | | |
256 | | - | |
257 | | - | |
258 | 217 | | |
259 | 218 | | |
| 219 | + | |
260 | 220 | | |
261 | 221 | | |
262 | 222 | | |
| |||
0 commit comments