mirror of
https://github.com/deepseek-ai/DeepGEMM.git
synced 2026-11-05 00:47:26 +00:00
[PR #477] [Fix][Einsum] Reject c in SM90 fp8_einsum("bhr,hdr->bhd") to prevent silent data corruption in sm90_fp8_bmm #480
Labels
No labels
pull-request
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference
deepseek-ai/DeepGEMM#480
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
📋 Pull Request Information
Original PR: https://github.com/deepseek-ai/DeepGEMM/pull/477
Author: @arxgy
Created: 10/17/2026
Status: 🔄 Open
Base:
main← Head:fix/sm90-fp8-einsum-c📝 Commits (1)
7035f91Reject C in SM90 FP8 BMM instead of silently dropping it📊 Changes
2 files changed (+10 additions, -1 deletions)
View changed files
📝
csrc/jit_kernels/impls/sm90_fp8_gemm_1d2d.hpp(+1 -1)📝
tests/test_einsum.py(+9 -0)📄 Description
This PR fixes #476 .
Summary
On SM90,
deep_gemm.fp8_einsum("bhr,hdr->bhd", a, b, d, c)returnsa @ b.Tinstead ofc + a @ b.T:cis silently dropped.cintod, expecting the kernel to adda @ b.Tontod(gemm.hpp L49–L51).sm90_fp8_bmmlaunchessm90_fp8_gemm_1d2d_impl, which cannot add ontod. It writesdwith a plain TMA store (sm90_fp8_gemm_1d2d.cuh L434), which overwritesc.sm90_fp8_bmmsetswith_accumulation(L300), but never passes it to the kernel (L36–L61).sm90_fp8_gemm_1d2d, rejectsc(L81).sm90_fp8_bmmdoes not (L290)."bhr,hdr->bhd"is the onlyfp8_einsumexpression that runs on SM90, andtests/test_einsum.pypassescto it only on SM100, which accumulates correctly.Reproduction: See Issue #476 .
Fix
Add the missing
not c.has_value()check tosm90_fp8_bmm, as insm90_fp8_gemm_1d2d. Passingcon SM90 now raises an error instead of returning a wrong result. As withsm90_fp8_gemm_1d2d,dhas already been overwritten withcwhen the error is raised.Tests
test_fp8_bhr_hdr_bhdalready checkscon SM100. This PR adds the SM90 counterpart: a call withcmust raise. The accumulator has the layout of the SM100 check ([h, b, d]viewed as[b, h, d]), in BF16, the onlydtypesm90_fp8_bmmaccepts.Tested on an H100 80GB HBM3 (driver 580.126.09, CUDA 13.0, torch 2.9.1+cu130), on
main(1fc9c66) and on this branch, both built with./develop.sh. The test functions run in the order of__main__, after one warm-upbench_kinetocall. Without the warm-up,python tests/test_einsum.pystops at its first benchmark with aZeroDivisionErroron both trees, becausebench_kinetoreturns 0 on its first call in a process (#426).mainwith the new test: the call withcdoes not raise, so the test fails.This PR:
🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.