Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
27 commits
Select commit Hold shift + click to select a range
35103d5
fix: load and run GlmMoeDsaForCausalLM with quark mxfp4+ptpcfp8-attn …
ColinZ22 Jun 17, 2026
f4585de
defensive check and style
ColinZ22 Jun 19, 2026
051bae4
avoid unnecessarily quantizing to group-128 FP8 for quark FP8 path
ColinZ22 Jun 24, 2026
8ad495b
merge main
ColinZ22 Jun 26, 2026
8395177
Merge branch 'main' into glm52-mxfp4-ptpcfp8-attn-fixes
ColinZ22 Jun 26, 2026
d1fa68b
Merge branch 'main' into glm52-mxfp4-ptpcfp8-attn-fixes
ColinZ22 Jun 29, 2026
e763e2b
Merge branch 'main' into glm52-mxfp4-ptpcfp8-attn-fixes
ColinZ22 Jul 1, 2026
f137031
Merge branch 'main' into glm52-mxfp4-ptpcfp8-attn-fixes
ColinZ22 Jul 8, 2026
f078a89
Merge branch 'main' into glm52-mxfp4-ptpcfp8-attn-fixes
ColinZ22 Jul 10, 2026
09c730a
fix merge typo
ColinZ22 Jul 13, 2026
1f228ad
Merge branch 'main' into glm52-mxfp4-ptpcfp8-attn-fixes
ColinZ22 Jul 15, 2026
9d16fe7
review fixes
ColinZ22 Jul 16, 2026
36d8c2e
Merge branch 'main' into glm52-mxfp4-ptpcfp8-attn-fixes
ColinZ22 Jul 16, 2026
bdc4db3
Merge branch 'main' into glm52-mxfp4-ptpcfp8-attn-fixes
ColinZ22 Jul 16, 2026
7d06bc4
Merge branch 'main' into glm52-mxfp4-ptpcfp8-attn-fixes
ColinZ22 Jul 18, 2026
da302c9
Merge branch 'main' into glm52-mxfp4-ptpcfp8-attn-fixes
ColinZ22 Jul 20, 2026
e08143c
Merge branch 'main' into glm52-mxfp4-ptpcfp8-attn-fixes
ColinZ22 Jul 21, 2026
aa23525
Merge branch 'main' into glm52-mxfp4-ptpcfp8-attn-fixes
ColinZ22 Aug 4, 2026
7645794
Merge branch 'main' into glm52-mxfp4-ptpcfp8-attn-fixes
ColinZ22 Aug 19, 2026
f078967
Merge branch 'main' into glm52-mxfp4-ptpcfp8-attn-fixes
ColinZ22 Aug 20, 2026
2a6eaf9
Merge branch 'main' into glm52-mxfp4-ptpcfp8-attn-fixes
ColinZ22 Aug 24, 2026
651c3a8
Merge branch 'main' into glm52-mxfp4-ptpcfp8-attn-fixes
ColinZ22 Aug 25, 2026
1fc359e
Merge branch 'main' into glm52-mxfp4-ptpcfp8-attn-fixes
ColinZ22 Aug 28, 2026
0b73fb9
removed unused function
ColinZ22 Sep 2, 2026
4608fa9
Merge branch 'main' into glm52-mxfp4-ptpcfp8-attn-fixes
ColinZ22 Sep 11, 2026
fa66091
Merge branch 'main' into glm52-mxfp4-ptpcfp8-attn-fixes
ColinZ22 Sep 22, 2026
5803d11
Merge branch 'main' into glm52-mxfp4-ptpcfp8-attn-fixes
ColinZ22 Sep 25, 2026
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 8 additions & 0 deletions python/sglang/srt/layers/attention/dsa/dsa_indexer.py
Original file line number Diff line number Diff line change
Expand Up @@ -444,6 +444,10 @@ def _get_q_k_bf16(
enable_dual_stream: bool,
forward_batch: ForwardBatch,
):
# fused_rms_fp8_group_quant with output_unquantized_inp1=True produces a
# (fp8, scale, bf16) 3-tuple; extract the bf16 for the unquantized wk layer.
if isinstance(x, tuple) and len(x) >= 3:
x = x[2]
Comment thread
ColinZ22 marked this conversation as resolved.
Resolved
if enable_dual_stream:
current_stream = torch.cuda.current_stream()
self.alt_stream.wait_stream(current_stream)
Expand Down Expand Up @@ -534,6 +538,10 @@ def _get_k_bf16(
positions: torch.Tensor,
enable_dual_stream: bool,
):
# fused_rms_fp8_group_quant with output_unquantized_inp1=True produces a
# (fp8, scale, bf16) 3-tuple; extract the bf16 for the unquantized wk layer.
if isinstance(x, tuple) and len(x) >= 3:
x = x[2]
Comment thread
ColinZ22 marked this conversation as resolved.
Resolved
# Compute only key, skip query
key, _ = self.wk(x)
key = self.k_norm(key)
Expand Down
8 changes: 6 additions & 2 deletions python/sglang/srt/layers/quantization/fp8_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -1428,6 +1428,9 @@ def channel_quant_to_tensor_quant(
x_q_channel: torch.Tensor,
x_s: torch.Tensor,
) -> Tuple[torch.Tensor, torch.Tensor]:
# Reshape per-output-channel scale [N] -> [N, 1, ...] to broadcast over K dims.
if x_s.dim() < x_q_channel.dim():
x_s = x_s.view(x_s.shape + (1,) * (x_q_channel.dim() - x_s.dim()))
Comment thread
ColinZ22 marked this conversation as resolved.
Resolved
x_dq_channel = x_q_channel.to(torch.float32) * x_s
x_q_tensor, scale = (
scaled_fp8_quant(x_dq_channel)
Expand Down Expand Up @@ -1693,9 +1696,10 @@ def apply_fp8_ptpc_linear(
compressed_tensor_quant: bool = False,
) -> torch.Tensor:
"""FP8 per-token per-channel linear. Only used with the aiter (ROCm) backend."""
# Handle pre-quantized (fp8_tensor, scale) tuple from fused RMSNorm+Quant
# Handle pre-quantized (fp8_tensor, scale[, bf16]) tuple from fused RMSNorm+Quant.
# The optional 3rd element is the unquantized bf16 tensor kept for DSA; ignore it.
if isinstance(input, tuple):
q_input, x_scale = input
q_input, x_scale = input[0], input[1]
q_input = q_input.view(-1, q_input.shape[-1])
output_shape = [*q_input.shape[:-1], weight.shape[0]]
output = aiter.gemm_a8w8_bpreshuffle(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
)
from sglang.srt.layers.quantization.fp8_kernel import is_fp8_fnuz
from sglang.srt.layers.quantization.fp8_utils import (
_use_aiter_bpreshuffle_gfx95,
apply_fp8_linear,
cutlass_fp8_supported,
normalize_e4m3fn_to_e4m3fnuz,
Expand Down Expand Up @@ -174,6 +175,27 @@ def apply_weights(
x: torch.Tensor,
bias: Optional[torch.Tensor] = None,
) -> torch.Tensor:
# fused_rms_fp8_group_quant (aiter gfx95) passes activations as a tuple.
# 3-tuple (fp8, scale, bf16): use the bf16 copy produced by output_unquantized_inp1=True.
# 2-tuple (fp8, group_scale): dequantize to bf16; scale layout mirrors
# transpose_scale=_use_aiter_bpreshuffle_gfx95 used at quantization time.
if isinstance(x, tuple):
if len(x) >= 3:
x = x[2]
else:
fp8_q, gs = x[0], x[1]
m, k = fp8_q.shape
if _use_aiter_bpreshuffle_gfx95:
gs = gs.t().contiguous()
k_groups = gs.shape[1]
group_size = k // k_groups
x = (
fp8_q.to(torch.float32)
.view(m, k_groups, group_size)
.mul_(gs.to(torch.float32).unsqueeze(-1))
.view(m, k)
.to(torch.bfloat16)
)
Comment thread
ColinZ22 marked this conversation as resolved.
Resolved

return apply_fp8_linear(
x,
Expand Down
Loading