Repository navigation
[Bugfix][Metrics][MFU] Size activation traffic from the model dtype - #57070
Conversation
|
@markmc mind taking a look? float32 models under-report activation traffic because activation_byte_size was hardcoded to 2. Resolves the FIXME at perf.py:383. |
|
/ci run |
|
✅ @thillai-c, CI is now available for this PR.
|
Signed-off-by: Thillai Chithambaram <thillaichithambaram.a@gmail.com>
414b832 to
054689b
Compare
|
✅ Triggered Buildkite CI #89327 for commit |
|
Hi @thillai-c, the pre-commit checks have failed. Please run: uv pip install pre-commit>=4.5.1
pre-commit install
pre-commit run --all-filesThen, commit the changes and push to your branch. For future commits, |
|
/ci run |
|
❌ This PR is 2 commits behind upstream |
|
/ci run |
|
✅ Triggered Buildkite CI #89388 for commit |
|
Hi @thillai-c, the pre-commit checks have failed. Please run: uv pip install pre-commit>=4.5.1
pre-commit install
pre-commit run --all-filesThen, commit the changes and push to your branch. For future commits, |
|
/ci run |
|
✅ Triggered Buildkite CI #89400 for commit |
|
/ci run |
|
✅ Triggered Buildkite CI #89449 for commit |
…llm-project#57070) Signed-off-by: Thillai Chithambaram <thillaichithambaram.a@gmail.com>
Purpose
BaseConfigParsersizes weight traffic from the model's dtype but pins activation traffic to 2 bytes:torch_dtypeis already resolved on the line above, so the two values come from the same config and disagree. For a model served with--dtype float32, every activation term in the MBU accounting is counted at half its real size while that same model's weight terms are correct. Activations are produced in the model's compute dtype, so this keys them on it.activation_byte_sizeis set once here and never overridden. Quantization parsers overrideweight_byte_size(fp8, mxfp4 and friends) but leave activations alone, which is why the model dtype remains the right source after this change.Impact
The float32 change is user visible. Anyone tracking MBU for a float32 deployment will see the number move; that movement is the correction, since the previous value understated memory traffic.
Test Plan
New tests in the existing file:
test_base_config_parser_activation_byte_size_follows_dtype, parametrized over float16, bfloat16 and float32, asserting activation and weight byte sizes agree with the dtype.test_attention_read_bytes_scale_with_activation_dtype, which goes throughAttentionMetrics.get_read_bytes_breakdownand assertsqkv_input, a pure activation term, is exactly twice as large for float32 as for bfloat16.The existing
test_base_config_parserassertion ofactivation_byte_size == 2for float16 still holds and is unchanged; only its comment was updated, since 2 is now the dtype's size rather than a default.Test Result
That is the 68 pre-existing tests plus the 4 added here.
Linting:
No model evaluation: this changes analytic MFU/MBU accounting only. No kernel, no model computation, and no output logits are affected.
AI assistance
AI assistance (Claude Code) was used to locate this and draft the tests. I reviewed every changed line and ran the commands above myself.
Essential Elements of an Effective PR Description Checklist
supported_models.mdandexamplesfor a new model.