Skip to content

[fp8] Select SGLang FP8 block quant kernel to match inference - #1182

Merged
yueming-yuan merged 2 commits into
radixark:mainfrom
yueming-yuan:fp8-quant-kernel-selection
Jun 1, 2026
Merged

yueming-yuan merged 2 commits into
radixark:mainfrom
yueming-yuan:fp8-quant-kernel-selection

Conversation

@yueming-yuan

@yueming-yuan yueming-yuan commented May 22, 2026

Copy link
Copy Markdown
Collaborator

No description provided.

@yueming-yuan
yueming-yuan force-pushed the fp8-quant-kernel-selection branch from 4aee1fc to b6ccb11 Compare May 22, 2026 21:26
@yueming-yuan yueming-yuan changed the title Select SGLang FP8 block quant kernel [fp8] Select SGLang FP8 block quant kernel to match inference May 22, 2026

@gemini-code-assist gemini-code-assist Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code Review

This pull request integrates the per_block_cast_to_fp8 function from the sglang library into the FP8 quantization workflow. It introduces a new internal helper, _blockwise_cast_to_fp8, which conditionally utilizes the sglang implementation when the weight block size is (128, 128) and falls back to the existing Triton-based kernel otherwise. Additionally, the sglang utility is safely imported with a fallback to None to ensure compatibility. I have no feedback to provide as there were no review comments to evaluate.

@maocheng23 maocheng23 left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Approved to unblock, but better address the message

if _get_scale_format(args, name, weight_block_size) == "ue8m0":
qweight, scale = quant_weight_ue8m0(weight, weight_block_size=weight_block_size)
scale = transform_scale_ue8m0(scale, mn=qweight.shape[-2])
elif per_block_cast_to_fp8 is not None and list(weight_block_size) == [128, 128]:

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This looks very hacky, any better ways to do this?

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

added a TODO comment. will fix these issues in later low-precision refactor

Added a TODO comment to address the hacky implementation for [128, 128] weight block size.
@yueming-yuan
yueming-yuan merged commit 84ece16 into radixark:main Jun 1, 2026
22 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants