mirror of
https://github.com/deepseek-ai/DeepGEMM.git
synced 2026-11-05 00:47:26 +00:00
[PR #310] fix: correct operator precedence in pack_ue8m0_to_int assertion #356
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#356
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/310
Author: @kuishou68
Created: 4/19/2026
Status: 🔄 Open
Base:
main← Head:fix/issue-309-pack-ue8m0-assertion📝 Commits (1)
1436d10fix: correct operator precedence in pack_ue8m0_to_int assertion (Closes #309)📊 Changes
1 file changed (+1 additions, -1 deletions)
View changed files
📝
deep_gemm/utils/math.py(+1 -1)📄 Description
Closes #309
Problem
In
deep_gemm/utils/math.py, thepack_ue8m0_to_intfunction has an operator precedence bug in its assertion:In Python, the
==operator has higher precedence than&. So this is actually parsed as:((1 << 23) - 1) == 0evaluates toFalse(i.e.,0), sox.view(torch.int) & 0produces a tensor of all zeros..all()on all zeros returnsTrue.The assertion always passes, never catching cases where mantissa bits are non-zero.
Fix
Added parentheses to ensure
&is applied before==:This correctly verifies that the lower 23 mantissa bits are all zero, which is required for valid UE8M0 format floats.
🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.