mirror of
https://github.com/deepseek-ai/DeepGEMM.git
synced 2026-11-05 00:47:26 +00:00
[PR #456] [Fix] Reject FP32 bmk,bnk->mn einsum without C instead of crashing #461
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#461
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/456
Author: @LiRunGuo
Created: 9/22/2026
Status: 🔄 Open
Base:
main← Head:fix-einsum-fp32-without-c📝 Commits (1)
c139db6Reject FP32 bmk,bnk->mn einsum without C instead of crashing📊 Changes
2 files changed (+18 additions, -1 deletions)
View changed files
📝
csrc/apis/einsum.hpp(+1 -1)📝
tests/test_einsum.py(+17 -0)📄 Description
Problem
deep_gemm.einsum('bmk,bnk->mn', a, b, d)with an FP32dand noccrashes the whole Python process with a segmentation fault, instead of raising an error.For an FP32 D,
bmk_bnk_mnonly supports the accumulated expression, socmust beditself. The check that enforces this dereferences the optionalcwithout testing it first:When
cisNone, this is undefined behavior on an emptystd::optional. On an H200 with DeepGEMMmain(78b6900) the process exits with SIGSEGV:The check runs before architecture dispatch, so SM100 is affected as well. I found this with a randomized shape fuzzer that calls the public einsum API.
Fix
Check
c.has_value()first, so the call fails the host assertion like any other unsupported argument. All other->dereferences of optional tensors undercsrc/apis/are already guarded by ahas_value()check.Test
tests/test_einsum.pygetstest_bmk_bnk_mn_fp32_requires_c, which expects aRuntimeErrorfor an FP32dwithoutc.Results on an H200 (CUDA 13.0, PyTorch 2.11.0+cu130):
test_bmk_bnk_mn_fp32_requires_cmain(78b6900)RuntimeErrorfrom the host assertion, test passesThe full
python tests/test_einsum.pypasses on this branch.🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.