Repository navigation
Conversation
rkarhila-amd
left a comment
There was a problem hiding this comment.
Another tiny PR that ensures users don't mess up deterministic inference by making bad choices.
I'd personally have combined with #44701, but I don't make the policies for PR scope.
Thanks! I kept them separate because #44489 is stacked on #44438, and folding the mixed-chunk change in would make it depend on that too; this way each can be reviewed and merged on its own. Happy to combine them if the maintainers prefer one PR. |
1d13627 to
022b79d
Compare
This comment has been minimized.
This comment has been minimized.
--prefill-attention-backend and --decode-attention-backend take priority over --attention-backend for their phase, but deterministic inference only checked --attention-backend against its allowlist. A non-deterministic prefill or decode backend was therefore accepted without an error. Check both against the same list.
022b79d to
14c9e46
Compare
This comment has been minimized.
This comment has been minimized.
|
/rerun-failed-ci |
1 similar comment
|
/rerun-failed-ci |
|
/rerun-failed-ci |
1 similar comment
|
/rerun-failed-ci |
|
All pr-test-base passed. |
1am9trash
left a comment
There was a problem hiding this comment.
LGTM.
Add a guard on separated backend.
…roject#44438) Co-authored-by: Thomas Wang <thomawan@amd.com>
Motivation
Deterministic mode checked only
--attention-backend, but this does not guarantee that prefill and decode attention are deterministic:--prefill-attention-backendand--decode-attention-backendoverride it for their phase, and they were not checked. This PR adds the check for both flags. Without it, deterministic mode could be on while prefill or decode used a backend that is not deterministic, with no warning.For example, on MI350X this starts without an error and runs AITER's paged-attention kernels for decode, although
aiteris not on the deterministic list:The same applies on every platform and to any backend outside the list (for example
flashmlaortrtllm_mhafor one phase on NVIDIA).Which models this affects. All of them: the check is model-independent. It matters wherever the per-phase flags are set: AMD serving configurations use them to pick AITER per phase (the MI35x configuration for Qwen3.8 sets
--prefill-attention-backend aiter --decode-attention-backend aiter), and some model defaults set them (Kimi-K3, below). Without this check, such a configuration silently loses the deterministic guarantee.AITER decode attention is in fact batch-invariant on gfx950; #44489 allows it there on top of this PR, with the evidence. This PR only makes deterministic mode check the per-phase flags at all.
Modifications
_deterministic_attention_backend(inarg_groups/overrides.py): in deterministic mode, also checkprefill_attention_backendanddecode_attention_backendagainstDETERMINISTIC_ATTENTION_BACKEND_CHOICESwhen they are set. The error names the flag and the backend.test_model_overrides.py:--attention-backendis on the list;Unchanged:
--attention-backendis untouched);Scope: the check runs where deterministic mode is resolved, so it covers per-phase backends that are set explicitly or by model-specific defaults before it. Two later automatic choices are not covered here:
trtllm_mlaprefill pairing.Both are tied to opt-in features (NVFP4 KV cache, CuteDSL MLA decode). Covering them needs a check after those passes; I'd leave that to a follow-up.
Behaviour change: configurations that combine
--enable-deterministic-inferencewith a per-phase backend outside the list now fail at startup instead of running without the deterministic guarantee. This includes model defaults that set such a backend, for example Kimi-K3's backends for decode context parallelism.Accuracy Tests
No numerical change: this only refuses configurations at startup.
Unit tests,
python3 -m pytest test/registered/unit/test_model_overrides.py -k deterministic(MI350X,rocm/sgl-dev:v0.5.21-rocm724-mi35x-20261013): before, the new refusal test fails for both flags (2 failed, 5 passed); after, 5 passed.Speed Tests and Profiling
No runtime change: the check runs once while the server arguments are resolved.
Checklist
Review and Merge Process
/tag-and-rerun-ci,/tag-run-ci-label,/rerun-failed-ciCI States
Latest PR Test (Base): ✅ Run #40817696448
Latest PR Test (Extra): ❌ Run #40817696393
Latest PR Test (AMD ROCm 10): ✅ Run #40817696482