-
Notifications
You must be signed in to change notification settings - Fork 0
[Bugfix] Fix Maverick correctness by filling zero to cache space in cutlass_moe #2
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
@@ -176,6 +176,7 @@ def run_cutlass_moe_fp8( | |||
c1 = _resize_cache(workspace13, (M * topk, N * 2)) | |||
c2 = _resize_cache(workspace2, (M * topk, N)) | |||
c3 = _resize_cache(workspace13, (M * topk, K)) | |||
c1.fill_(0) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
great! any way to capture this in test_cutlass_moe?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
yep, added a couple unit tests
Signed-off-by: Ming Yang <[email protected]>
52be3eb
to
66c457b
Compare
Signed-off-by: Ming Yang <[email protected]>
66c457b
to
25d3af8
Compare
Signed-off-by: Ming Yang <[email protected]>
Signed-off-by: Ming Yang <[email protected]>
if expert_map is not None: | ||
c1.fill_(0) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
One more tiny thing: can you check if we need to do this if per_act_token
is true?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
no we don't. I figured out the root cause is that the random data in the unused space in c1 caused scale (over the whole c1) to be larger, resulting in precision loss for the actual data. So if we use per_act_token==True
, scales won't be impacted. Let me update the PR in vllm-project.
I'll close this PR to avoid confusion -- this was a experimental PR for early review.
move to vllm-project#20167. closing. |
Purpose
vllm-project#19667 changed the workspace creation from
torch.zeros
totorch.empty
. This ends up causing correctness for models using cutlass_moe, e.g. Maverick in our test case. This PR fixes the correctness issue by explicitly filling zeros in cutlass_moe.Test Plan
lm_eval, ut
Test Result
lm_eval results:
local-chat-completions (model=meta-llama/Llama-4-Maverick-17B-128E-Instruct-FP8,base_url=http://127.0.0.1:8081/v1/chat/completions,num_concurrent=32), gen_kwargs: (None), limit: 200.0, num_fewshot: 5, batch_size: 1
unit test stability verified:
c1.fill_(0)
, the following one liner verifies stable failure:c1.fill_(0)
, the following verifies stable success:(Optional) Documentation Update
BEFORE SUBMITTING, PLEASE READ https://docs.vllm.ai/en/latest/contributing (anything written below this line will be removed by GitHub Actions)