mirror of
https://github.com/deepseek-ai/DeepEP.git
synced 2026-11-05 00:47:32 +00:00
[PR #719] Fix EP_BUFFER_DEBUG=0 turning on Python-side debug output #730
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/DeepEP#730
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/DeepEP/pull/719
Author: @yashkgp
Created: 8/9/2026
Status: 🔄 Open
Base:
main← Head:fix/ep-buffer-debug-env-truthiness📝 Commits (1)
b3475faFix EP_BUFFER_DEBUG=0 turning on Python-side debug output📊 Changes
1 file changed (+2 additions, -2 deletions)
View changed files
📝
deep_ep/buffers/elastic.py(+2 -2)📄 Description
Fixes #718.
Problem
EP_BUFFER_DEBUG=0— the value the README documents as "off" — turns the Python-side debug output on, while the C++ side correctly stays off.The README documents the flag as a
0/1toggle defaulting to0:The C++ side honors that contract by converting before testing (
csrc/kernels/backend/nccl.cu:38,:45,:79;csrc/elastic/buffer.hpp:865,:1055):get_env<int>runs the value throughsscanf(c_str, "%d", &value)(csrc/utils/system.hpp:28-31), so"0"becomes0— falsy.The two Python call sites tested the raw string instead, and
'0'is truthy in Python:The
intdefault0only applies when the variable is absent, which is why the unset case works and only the explicitly-disabled case misbehaves.Fix
Convert before testing, matching
get_env<int>and the idiom already used by every other boolean env flag in the package:Existing call sites that already do this —
deep_ep/__init__.py:51(EP_SUPPRESS_NCCL_CHECK),deep_ep/utils/testing.py:143(EP_USE_NVIDIA_TOOLS),:152(EP_DISABLE_BARRIER_PROFILING),deep_ep/utils/comm.py:62(EP_REUSE_NCCL_COMM), andsetup.py:130/:153. The two lines changed here were the only boolean env reads in the package that omitted the conversion.Verification
Host-side; the defect and the fix are both pure Python and need no device. Evaluating the exact expression at
elastic.py:311/:828before and after:EP_BUFFER_DEBUGget_env<int>)012Python now agrees with the C++ side on every value. Only the
0row changes; the unset and enabled paths are untouched.Scope
Two lines, both inside
ifconditions guardingprintcalls. No behavior change to any code path other than the one that was contradicting its own documentation.Note on the
format-checkjobCI is red here on pre-existing lint in
deep_ep/buffers/elastic.py, not on anything this PR introduces.format.shonly lints files that differ fromorigin/main, somainnever lints this file and these never surface there.Running the pinned tooling (
yapf==0.40.2,ruff==0.6.5, repopyproject.toml) against unmodifiedorigin/main(01dc3aa) versus this branch:Identical — this PR adds zero new violations. The 3 ruff errors on
mainareF401(typing.Listunused, L6) andF541×2 (f-strings without placeholders, L930/L1088).I deliberately did not fold that cleanup in: the yapf delta alone is a ~259-line reformat, which would bury a 2-line bugfix. Happy to send it as a separate PR if you'd like the file made lint-clean — I notice #685 ran into the same thing and made the same offer.
🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.