[PR #542] Add printf buffer flush delay to EP_DEVICE_ASSERT #625

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

📋 Pull Request Information

Original PR: https://github.com/deepseek-ai/DeepEP/pull/542
Author: @yurekami
Created: 12/25/2025
Status: 🔄 Open

Base: main ← Head: fix-device-assert-trap


📝 Commits (1)

  • 5ff7a56 Add printf buffer flush delay to EP_DEVICE_ASSERT

📊 Changes

1 file changed (+4 additions, -0 deletions)

View changed files

📝 csrc/kernels/exception.cuh (+4 -0)

📄 Description

Summary

  • Adds the same printf buffer flush delay to EP_DEVICE_ASSERT as was added to trap() in PR #539
  • Ensures device assertion failure messages are not lost when kernel aborts

Problem

While PR #539 fixed the trap() function to delay before aborting, EP_DEVICE_ASSERT was still using raw asm("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_ITERATIONS and __nanosleep(NUM_WAIT_NANOSECONDS) before the trap instruction in EP_DEVICE_ASSERT.

Changes

  • csrc/kernels/exception.cuh - Added flush delay to EP_DEVICE_ASSERT macro

Test plan

  • Trigger a device assertion and verify the message is printed
  • Verify no performance impact on normal execution (delay only on error path)

Related to #480

🤖 Generated with Claude Code


🔄 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/542 **Author:** [@yurekami](https://github.com/yurekami) **Created:** 12/25/2025 **Status:** 🔄 Open **Base:** `main` ← **Head:** `fix-device-assert-trap` --- ### 📝 Commits (1) - [`5ff7a56`](https://github.com/deepseek-ai/DeepEP/commit/5ff7a56ab5a299bb131fa935b04a5cbfeefaebe1) Add printf buffer flush delay to EP_DEVICE_ASSERT ### 📊 Changes **1 file changed** (+4 additions, -0 deletions) <details> <summary>View changed files</summary> 📝 `csrc/kernels/exception.cuh` (+4 -0) </details> ### 📄 Description ## Summary - Adds the same printf buffer flush delay to `EP_DEVICE_ASSERT` as was added to `trap()` in PR #539 - Ensures device assertion failure messages are not lost when kernel aborts ## Problem While PR #539 fixed the `trap()` function to delay before aborting, `EP_DEVICE_ASSERT` was still using raw `asm("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_ITERATIONS` and `__nanosleep(NUM_WAIT_NANOSECONDS)` before the trap instruction in `EP_DEVICE_ASSERT`. ## Changes - `csrc/kernels/exception.cuh` - Added flush delay to `EP_DEVICE_ASSERT` macro ## Test plan - [ ] Trigger a device assertion and verify the message is printed - [ ] Verify no performance impact on normal execution (delay only on error path) Related to #480 🤖 Generated with [Claude Code](https://claude.com/claude-code) --- <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#625
No description provided.