-
Notifications
You must be signed in to change notification settings - Fork 70
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Support early print buffer flushing in debug mode #61
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks @zibaiwan! Could you include a commit message that summarizes the change and also motivates why it was made?
Have you taken a look at the unit tests to see if anything could be inserted to test this new functionality, as far as is feasible in a unit test? For instance, checking that the new state variables added here correspond to the expected state.
@pcolberg , thank you very much for your review. I have updated the PR based on your suggestions. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks @zibaiwan for the additional tests, much appreciated 🙂
A small question about a (maybe) corner case: What happens if the kernel stalls before the next 10 sec printf buffer dumps? |
@sherry-yuan Good question. If a kernel is stalled because the printf buffer is full (runtime doesn't seem to stall for other reason, even it does, it wouldn't matter here), it will print the rest of the printf buffer which hasn't been dumped by the debug dumps and clear the buffer. |
c62dfe7
to
3c3e8e6
Compare
Added a flow to flush printf() buffer before the Kernel ends. This will be helpful for debugging a hang Kernel. The Runtime periodically polls from the device and process the printf buffer from the last processed point. If ACL_HAL_DEBUG = 1 and the Kernel is Hang, Kernel status (existing feature) and printf buffer will be flushed to stdout every 10 seconds (approximately). The thread will run if there are spare cycles. If ACL_HAL_DEBUG = 3, Kernel status and printf buffer will flushed every 10 seconds, even the Kernel isn't hung. The behavior of printf() is not altered in non-debug mode.
Added a flow to flush printf() buffer before the Kernel ends. This will be helpful for debugging a hang Kernel. The Runtime periodically polls from the device and process the printf buffer from the last processed point.
If ACL_HAL_DEBUG = 1 and the Kernel is Hang, Kernel status (existing feature) and printf buffer will be flushed to stdout every 10 seconds (approximately). The thread will run if there are spare cycles.
If ACL_HAL_DEBUG = 3, Kernel status and printf buffer will flushed every 10 seconds, even the Kernel isn't hung.
The behavior of printf() is not altered in non-debug mode.
Sample output
ToDo