Skip to content

[SYCL] Wait before deleting a stream buffer #2646

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

Closed
wants to merge 1 commit into from

Conversation

againull
Copy link
Contributor

@againull againull commented Oct 15, 2020

Currently streamed data is printed in a host task. Host task has a corresponding empty task which is a leaf command for a stream buffer. Since stream buffer is not a leaf for a kernel it doesn't block the kernel from being cleaned up after completion. During this cleanup process stream buffer is deleted, as a result scheduler does a blocking enqueue of the empty task. Problem is that this empty task has a blocked status (blocked by host task). This results in exception saying that we try to wait for a blocked command. It is not clear if this use case is invalid or there is a bug in the scheduler.

Explicitly waiting for a host task before stream buffer deletion is correct for sure and resolves this problem.

Currently streamed data is printed in a host task. Host task has a
corresponding empty task which is a leaf command for a stream buffer.
Since stream buffer is not a leaf for a kernel it doesn't block the
kernel from being cleaned up after completion. During this cleanup
process stream buffer is deleted, as a result scheduler does a blocking
enqueue of the empty task. Problem is that this empty task has a
blocked status (blocked by host task). This results in exception saying
that we try to wait for a blocked command. It is not clear if this use
case is invalid or there is a bug in the scheduler.

Explicitly waiting for a host task before stream buffer deletion is
correct for sure and resolves this problem.
@againull againull force-pushed the wa_async_flush branch 2 times, most recently from b2ed312 to 16f624f Compare October 16, 2020 06:22
@againull againull marked this pull request as ready for review October 16, 2020 06:23
@againull againull requested a review from a team as a code owner October 16, 2020 06:23
@s-kanaev
Copy link
Contributor

/summary:run

@@ -67,7 +67,7 @@ void stream_impl::flush() {
// finishes execution.
auto Q = detail::createSyclObjFromImpl<queue>(
cl::sycl::detail::Scheduler::getInstance().getDefaultHostQueue());
Q.submit([&](handler &cgh) {
auto Event = Q.submit([&](handler &cgh) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

During this cleanup process stream buffer is deleted, as a result scheduler does a blocking enqueue of the empty task.

As far as I understand the cleanup may happen right after the kernel is executed while the printing host-task isn't executed yet. Is that correct?
Hence, I wonder if it is possible that stream_impl::flush is invoked after kernel's execution?

Copy link
Contributor

@romanovvlad romanovvlad left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm not sure it's a bug, let's discuss offline.

@againull againull closed this Oct 16, 2020
@againull againull deleted the wa_async_flush branch December 3, 2022 00:06
kbenzie pushed a commit to kbenzie/intel-llvm that referenced this pull request Feb 17, 2025
Refactor KNOWN_FAILURE implementation to avoid repeated logic.
Chenyang-L pushed a commit that referenced this pull request Feb 18, 2025
Refactor KNOWN_FAILURE implementation to avoid repeated logic.
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.

3 participants