mirror of
https://github.com/deepseek-ai/DeepEP.git
synced 2026-11-05 00:47:32 +00:00
[GH-ISSUE #718] EP_BUFFER_DEBUG=0 enables Python-side debug output because the env var is tested as a raw string #411
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#411
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?
Originally created by @yashkgp on GitHub (Aug 9, 2026).
Original GitHub issue: https://github.com/deepseek-ai/DeepEP/issues/718
Summary
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 Python code tests the raw environment string for truthiness, and the string'0'is truthy in Python.Details
The README documents the flag as a
0/1toggle, defaulting to0:The C++ side honors that contract — it parses the value as an
intbefore testing it:get_env<int>runs the value throughsscanf(c_str, "%d", &value)(csrc/utils/system.hpp:28-31), so"0"becomes0— falsy. Correct.The Python side never converts, and tests the string directly:
With
EP_BUFFER_DEBUG=0,os.environ.get(...)returns the string'0', which is truthy — so bothprintcalls fire.Note the default value
0(anint) is never actually what gets tested when the variable is set; it only applies when the variable is absent. That is why the unset case behaves correctly and only the explicitly-disabled case misbehaves.Reproduction
Any non-empty value behaves the same way, so
EP_BUFFER_DEBUG=falseandEP_BUFFER_DEBUG=offalso enable the Python output.Expected vs. actual
EP_BUFFER_DEBUG01The two halves of a single documented flag disagree, and explicitly disabling it is the one case that breaks.
Impact
Minor but user-visible: a user who explicitly disables the flag gets per-rank
printoutput on everyElasticBufferconstruction and everyget_theoretical_num_smscall, with no way to turn it off short of unsetting the variable. Explicitly setting a flag to its documented off value is a common thing to do in launcher scripts and config templates, where variables are usually set unconditionally rather than conditionally omitted.Suggested fix
Convert before testing, which is the idiom this repo already uses at every other
EP_*boolean flag:For reference, the existing call sites that already do this:
deep_ep/__init__.py:51—int(os.environ.get('EP_SUPPRESS_NCCL_CHECK', 0))deep_ep/utils/testing.py:143—int(os.environ.get('EP_USE_NVIDIA_TOOLS', 0))deep_ep/utils/testing.py:152—int(os.environ.get('EP_DISABLE_BARRIER_PROFILING', 0))deep_ep/utils/comm.py:62—int(os.getenv('EP_REUSE_NCCL_COMM', '1'))setup.py:130,setup.py:153— same patternEP_BUFFER_DEBUGatelastic.py:311andelastic.py:828are the only two boolean env reads in the package that omit the conversion.I'd be happy to send a PR for this.
@YidaWeng commented on GitHub (Oct 1, 2026):
I would like to refresh the fix for this on current
main.#719and#742both targetdeep_ep/buffers/elastic.py, which was removed in the V2.5 split (ElasticBuffer→EPBuffer). The bug is still present indeep_ep/buffers/ep.py(the twoos.environ.get('EP_BUFFER_DEBUG', 0)truth tests).Plan:
int(...), matching the existingEP_*boolean idiom and C++get_env<int>tests/utils/(no CUDA / no compiled extension)mainIs anyone actively rebasing
#719/#742, or is a fresh PR againstep.pypreferred?