-
Notifications
You must be signed in to change notification settings - Fork 3.4k
Let EP prefill support new DeepGEMM #7310
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
Changes from all commits
2e8baee
54b6056
5f1a0cc
7efc496
f6b4f23
c0a641c
6e29349
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 |
|---|---|---|
|
|
@@ -246,7 +246,13 @@ def dispatch_a( | |
| topk_idx = topk_idx.to(torch.int64) | ||
| if deep_gemm_wrapper.ENABLE_JIT_DEEPGEMM: | ||
| # TODO hard code 128 block quant,use fp8 communication | ||
|
Contributor
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. The To improve maintainability and readability, consider defining this block size (128) as a named constant. This constant could reside in a shared configuration module (e.g., within |
||
| hidden_states = sglang_per_token_group_quant_fp8(hidden_states, 128) | ||
| hidden_states = sglang_per_token_group_quant_fp8( | ||
| hidden_states, | ||
| 128, | ||
| column_major_scales=deep_gemm_wrapper.DEEPGEMM_SCALE_UE8M0, | ||
| scale_tma_aligned=deep_gemm_wrapper.DEEPGEMM_SCALE_UE8M0, | ||
| scale_ue8m0=deep_gemm_wrapper.DEEPGEMM_SCALE_UE8M0, | ||
| ) | ||
| previous_event = Buffer.capture() if self.async_finish else None | ||
| return hidden_states, topk_idx, topk_weights, previous_event | ||
|
|
||
|
|
||
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.
Regarding the
TODO check whether need zeros:If
input_tensor[1](the scale tensor) is guaranteed to be fully overwritten byep_scatterbefore any read operation, usingtorch.empty()could be slightly more performant by avoiding the zero-initialization cost.However, if
DEEPGEMM_SCALE_UE8M0is true, this tensor hasdtype=torch.intand its shape involvesceil_div(K // 128, 4). This suggests a packed format where multiple scale values might be stored within each integer. IfK // 128is not perfectly divisible by 4,ceil_divwill cause padding. If these padding bits within the integers are not guaranteed to be overwritten and could affect subsequent operations (e.g., if the kernel reads them or if they are part of a checksum), thentorch.zeros()is crucial for correctness to ensure these padding bits are zero.Could you clarify if
torch.zerosis strictly necessary for correctness here, or iftorch.emptywould suffice under the assumption thatep_scatterfully populates the required parts of the tensor? This might also relate to theTODO(FIXME)infp8_kernel.pyconcerningsgl_per_token_group_quant_fp8which also initializes a similar scale tensor withtorch.zeroswhenscale_ue8m0is true.