[PR #701] fix(legacy): avoid undefined 32-bit shift #716

Open
opened 2026-10-27 21:05:33 +00:00 by bsakaguchi · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/deepseek-ai/DeepEP/pull/701
Author: @youchengsong
Created: 7/27/2026
Status: 🔄 Open

Base: main ← Head: fix-legacy-shift32


📝 Commits (1)

  • 7d9d0cf fix(legacy): avoid undefined 32-bit shift

📊 Changes

1 file changed (+25 additions, -17 deletions)

View changed files

📝 csrc/kernels/legacy/internode.cu (+25 -17)

📄 Description

Summary

  • avoid shifting a 32-bit dispatch transaction window by 32
  • explicitly clear the window after all 32 pending slots become contiguous

Why

When window == 0xffffffffu, num_empty_slots is 32. Shifting a
32-bit value by its width is undefined behavior in C++, so the compiler is
not required to produce the intended zero value. If the bitmap is not
cleared, the dispatch transaction window can retain stale completion state.

The full-window case has no remaining pending bits, so assigning zero is the
direct representation of the intended state. Other shift counts retain the
existing behavior.

Fixes #366.

Validation

  • standalone GCC 15.2 UBSan regression:
    • the old expression fails with shift exponent 32 is too large
    • the fixed expression returns 0u for the full-window case
    • shift counts 1 through 31 retain the previous result
  • bash ./format.sh
  • git diff --check upstream/main...HEAD

format.sh also reformats several pre-existing long lines in the same
legacy source file; the only behavioral change is the transaction-window
assignment.


🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.

## 📋 Pull Request Information **Original PR:** https://github.com/deepseek-ai/DeepEP/pull/701 **Author:** [@youchengsong](https://github.com/youchengsong) **Created:** 7/27/2026 **Status:** 🔄 Open **Base:** `main` ← **Head:** `fix-legacy-shift32` --- ### 📝 Commits (1) - [`7d9d0cf`](https://github.com/deepseek-ai/DeepEP/commit/7d9d0cfef94f471d51ea45dd281e913a9943aeff) fix(legacy): avoid undefined 32-bit shift ### 📊 Changes **1 file changed** (+25 additions, -17 deletions) <details> <summary>View changed files</summary> 📝 `csrc/kernels/legacy/internode.cu` (+25 -17) </details> ### 📄 Description ## Summary - avoid shifting a 32-bit dispatch transaction window by 32 - explicitly clear the window after all 32 pending slots become contiguous ## Why When `window == 0xffffffffu`, `num_empty_slots` is 32. Shifting a 32-bit value by its width is undefined behavior in C++, so the compiler is not required to produce the intended zero value. If the bitmap is not cleared, the dispatch transaction window can retain stale completion state. The full-window case has no remaining pending bits, so assigning zero is the direct representation of the intended state. Other shift counts retain the existing behavior. Fixes #366. ## Validation - standalone GCC 15.2 UBSan regression: - the old expression fails with `shift exponent 32 is too large` - the fixed expression returns `0u` for the full-window case - shift counts 1 through 31 retain the previous result - `bash ./format.sh` - `git diff --check upstream/main...HEAD` `format.sh` also reformats several pre-existing long lines in the same legacy source file; the only behavioral change is the transaction-window assignment. --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
Sign in to join this conversation.
No labels
pull-request
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
deepseek-ai/DeepEP#716
No description provided.