Add printf buffer flush delay to EP_DEVICE_ASSERT#542
Open
yurekami wants to merge 1 commit intodeepseek-ai:mainfrom
Open
Add printf buffer flush delay to EP_DEVICE_ASSERT#542yurekami wants to merge 1 commit intodeepseek-ai:mainfrom
yurekami wants to merge 1 commit intodeepseek-ai:mainfrom
Conversation
Similar to the trap() function fix (PR deepseek-ai#539), this adds a delay before the trap in EP_DEVICE_ASSERT to ensure printf buffer contents are flushed before kernel termination. This ensures assertion failure messages from device code are not lost when the kernel aborts. Related to deepseek-ai#480 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
EP_DEVICE_ASSERTas was added totrap()in PR Add delay before trap() to allow printf buffer flush #539Problem
While PR #539 fixed the
trap()function to delay before aborting,EP_DEVICE_ASSERTwas still using rawasm("trap;")without any delay. This meant assertion failures in device code could still lose their printf output.Solution
Added the same delay loop using
NUM_TRAP_FLUSH_ITERATIONSand__nanosleep(NUM_WAIT_NANOSECONDS)before the trap instruction inEP_DEVICE_ASSERT.Changes
csrc/kernels/exception.cuh- Added flush delay toEP_DEVICE_ASSERTmacroTest plan
Related to #480
🤖 Generated with Claude Code