diff options
| author | YurenHao0426 <Blackhao0426@gmail.com> | 2026-07-22 15:14:59 -0500 |
|---|---|---|
| committer | YurenHao0426 <Blackhao0426@gmail.com> | 2026-07-22 15:14:59 -0500 |
| commit | f75412664634494b3a6ebefd1f70d63a0f3e18c5 (patch) | |
| tree | de6645194392cd28fca7c73ed0d6e857f23b87ca | |
| parent | a631235d469c919cac88c58c2b83e04c1834b03e (diff) | |
audit: conservatively count predictor arithmetic
| -rw-r--r-- | experiments/conv_run.py | 9 | ||||
| -rw-r--r-- | sdil/conv.py | 15 |
2 files changed, 20 insertions, 4 deletions
diff --git a/experiments/conv_run.py b/experiments/conv_run.py index 2e2787b..c25c48c 100644 --- a/experiments/conv_run.py +++ b/experiments/conv_run.py @@ -191,7 +191,11 @@ def work_report(net, mode, counters): * net.mixed_elementwise_ops_per_example() + (counters["predictor_warmup_examples"] + counters["predictor_update_examples"]) - * net.predictor_elementwise_ops_per_example) + * net.predictor_elementwise_ops_per_example + + counters["traffic_calibration_examples"] + * net.traffic_calibration_elementwise_ops_per_example + + counters["traffic_audit_examples"] + * net.predictor_audit_elementwise_ops_per_example) else: elementwise_operations = 0 components = { @@ -234,7 +238,8 @@ def work_report(net, mode, counters): "equals one forward-weight MAC count; BP reverse is estimated as one " "weight-gradient plus one activation-gradient convolution per forward " "convolution; mixed-traffic/predictor elementwise arithmetic is reported " - "separately and is not folded into MACs"), + "as a conservative operation estimate separately and is not folded " + "into MACs"), } diff --git a/sdil/conv.py b/sdil/conv.py index cc4c7c6..ea62e95 100644 --- a/sdil/conv.py +++ b/sdil/conv.py @@ -662,8 +662,19 @@ class CIFARKPMixedTrafficResNet(CIFARKPResNet): @property def predictor_elementwise_ops_per_example(self): - # Residual, centering, moments, normalization, and affine updates. - return 12 * self.mixed_units_per_example + # Conservative count for traffic/prediction, centering, reductions, + # normalized moments, residual power, and affine parameter updates. + return 24 * self.mixed_units_per_example + + @property + def traffic_calibration_elementwise_ops_per_example(self): + # Two RMS measurements, gain application, and achieved-ratio audit. + return 8 * self.mixed_units_per_example + + @property + def predictor_audit_elementwise_ops_per_example(self): + # Traffic/prediction/residual construction and two power reductions. + return 10 * self.mixed_units_per_example @torch.no_grad() def traffic_fields(self, hiddens): |
