Skip to content

Fix EP_BUFFER_DEBUG=0 enabling Python-side debug output - #770

Open
YidaWeng wants to merge 1 commit into
deepseek-ai:mainfrom
YidaWeng:fix/ep-buffer-debug-parsing-718
Open

YidaWeng wants to merge 1 commit into
deepseek-ai:mainfrom
YidaWeng:fix/ep-buffer-debug-parsing-718

Conversation

@YidaWeng

@YidaWeng YidaWeng commented Oct 1, 2026

Copy link
Copy Markdown

Summary

Fixes #718.

EP_BUFFER_DEBUG=0 (the documented off value) was enabling the Python-side debug print paths because os.environ.get(...) returns the string '0', which is truthy. C++ get_env<int> already treated "0" as off.

Change

In deep_ep/buffers/ep.py, convert before testing at both call sites:

if int(os.environ.get('EP_BUFFER_DEBUG', 0)):

This matches every other boolean EP_* env flag in the package (EP_SUPPRESS_NCCL_CHECK, EP_USE_NVIDIA_TOOLS, EP_DISABLE_BARRIER_PROFILING, EP_REUSE_NCCL_COMM).

Test

Host-side only (no GPU, no CUDA toolkit, no compiled deep_ep._C):

python tests/utils/test_ep_buffer_debug_env.py
EP_BUFFER_DEBUG Before (Python) After (Python) C++ get_env<int>
unset off off off
0 on off off
1 on on on

Note on earlier PRs

#719 and #742 fixed the same bug in deep_ep/buffers/elastic.py, which no longer exists after the V2.5 buffer split. This PR applies the equivalent change to deep_ep/buffers/ep.py on current main.

What I could not test

Full EPBuffer construction on NVIDIA hardware. The defect and fix are pure Python environment-variable parsing around two print guards.

Parse EP_BUFFER_DEBUG with int() before truth-testing, matching the
documented 0/1 contract, C++ get_env<int>, and every other EP_* boolean
env flag in the package. The raw string '0' is truthy in Python, so the
documented off value incorrectly enabled the two print paths in EPBuffer.

Add a host-side regression test that does not require CUDA or the
compiled extension.

Fixes deepseek-ai#718
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

EP_BUFFER_DEBUG=0 enables Python-side debug output because the env var is tested as a raw string

1 participant