mirror of
https://github.com/deepseek-ai/DeepGEMM.git
synced 2026-11-05 00:47:26 +00:00
[PR #466] Make pack_ue8m0_to_int CUDA graph capture safe #470
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#470
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/466
Author: @zhoubiao188
Created: 10/6/2026
Status: 🔄 Open
Base:
main← Head:fix/pack-ue8m0-capture-safe📝 Commits (1)
063e257Makepack_ue8m0_to_intCUDA graph capture safe📊 Changes
2 files changed (+90 additions, -1 deletions)
View changed files
📝
deep_gemm/utils/math.py(+5 -1)➕
tests/test_pack_ue8m0.py(+85 -0)📄 Description
Summary
deep_gemm.utils.math.pack_ue8m0_to_intvalidated its input with Python asserts over CUDA tensors. Evaluating those 0-dim tensors as bools forces a device-to-host sync, which fails withcudaErrorStreamCaptureUnsupportedwhen the helper runs while a CUDA graph is being captured.(x.view(torch.int) >> 23).to(torch.uint8).view(torch.int)) is capture safe, and eager validation is preserved everywhere else.x.is_cuda, so CPU-only torch builds never evaluatetorch.cuda.is_current_stream_capturing()(which raises on builds without CUDA) and CPU tensors keep full validation unconditionally.Fixes #414
Validation
tests/test_pack_ue8m0.py:unpack_ue8m0_from_int;torch.cuda.graphcapture, replay, and comparison against the eager packing — this capture raises onmainbefore the fix;per_token_cast_to_fp8/per_token_cast_to_fp4withuse_packed_ue8m0=Truestill round-trip throughcast_back_from_*.🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.