-
Notifications
You must be signed in to change notification settings - Fork 3.1k
Update cutlass_moe.py #8545
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
Update cutlass_moe.py #8545
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change | ||
---|---|---|---|---|
|
@@ -209,7 +209,7 @@ def cutlass_fused_experts_fp8( | |||
) | ||||
|
||||
result = torch.empty((m, k), device=device, dtype=out_dtype) | ||||
apply_shuffle_mul_sum(c2, result, c_map, topk_weights) | ||||
apply_shuffle_mul_sum(c2, result, c_map, topk_weights.to(out_dtype)) | ||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Can we also add a dtype check in c++ side There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. It seems we want to make sure the There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. We have the checker hence the need to cast to out_dtype.
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I see. Just curious why this mismatch wasn't captured by the previous commit. |
||||
return result | ||||
|
||||
|
||||
|
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.
There is a potential dtype mismatch here. The
apply_shuffle_mul_sum
kernel expectsc2
,result
, andtopk_weights
to have the same dtype (out_dtype
). However,topk_weights
is passed without an explicit cast, which can lead to incorrect results or silent errors if its dtype does not match. It should be cast toout_dtype
before being passed to the kernel.