Skip to content

[Pending][OneDNN] add fp8 block gemm#173

Open
Yejing-Lai wants to merge 1 commit intovllm-project:mainfrom
Yejing-Lai:lyj/add_block_gemm_xe2
Open

[Pending][OneDNN] add fp8 block gemm#173
Yejing-Lai wants to merge 1 commit intovllm-project:mainfrom
Yejing-Lai:lyj/add_block_gemm_xe2

Conversation

@Yejing-Lai
Copy link
Contributor

Add fp8 block gemm and UT. All UT passed.

Signed-off-by: Lai, Yejing <yejing.lai@intel.com>
x: [M, N] float tensor (fp16/fp32)
block_m: block rows
block_n: block cols
fp8_dtype: torch.float8_e4m3fn or e5m2
Copy link
Collaborator

Choose a reason for hiding this comment

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

remove e5m2 if not supported

weight_fp8, scale_wei_fp8 = fp8_block_quant_2d(weight, group_size,
group_size)

# reference fp16 gemm
Copy link
Collaborator

Choose a reason for hiding this comment

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

bf16/fp16

group_size)

# reference fp16 gemm
output_ref = torch.matmul(input, weight.t())
Copy link
Collaborator

Choose a reason for hiding this comment

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

what should be the reference here? the purpose here is to check the numerical loss instead of the quantization loss. see https://github.com/pytorch/pytorch/blob/4a1bbf44dde11d5ca0c9928a929d18cb3d180181/test/test_scaled_matmul_cuda.py#L308 for the reference.

Copy link
Contributor Author

@Yejing-Lai Yejing-Lai Mar 5, 2026

Choose a reason for hiding this comment

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

Here referenced the comparison methods used in per_tensor/per_channel/per_token UT from this file(https://github.com/vllm-project/vllm-xpu-kernels/blob/main/tests/test_fp8_gemm_onednn.py#L155). Do we need to update all of these comparison methods?

Copy link
Collaborator

Choose a reason for hiding this comment

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

I see. Please update others in another PR. cc @zufangzhu

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