Skip to content

[SYCL] Don't block execution when flushing a stream #2581

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

Merged
merged 15 commits into from
Oct 14, 2020

Conversation

againull
Copy link
Contributor

@againull againull commented Oct 1, 2020

Currently stream flush is a blocking operation. This is incorrect, there
are cases when kernels must be executed in parallel, for example, when
2 kernels are connected with FPGA pipe. This commit implements stream
flush as a non-blocking operation by means of host_tasks.

Currently stream flush is a blocking operation. This is incorrect, there
are cases when kernels must be executed in parallel, for example, when
2 kernels are connected with FPGA pipe. This commit implements stream
flush as a non-blocking operation by means of host_tasks.
@againull againull requested a review from a team as a code owner October 1, 2020 22:32
@againull againull requested a review from v-klochkov October 1, 2020 22:32
@againull
Copy link
Contributor Author

againull commented Oct 1, 2020

/summary:run

@againull
Copy link
Contributor Author

againull commented Oct 2, 2020

Sorry, looks like this approach causes multiple regressions. Please do not review yet.

@againull againull changed the title [SYCL] Don't block execution when flushing a stream [WIP][SYCL] Don't block execution when flushing a stream Oct 2, 2020
@romanovvlad romanovvlad requested a review from s-kanaev October 5, 2020 08:58
Copy link
Contributor

@s-kanaev s-kanaev left a comment

Choose a reason for hiding this comment

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

The approach is good as for me.
Though I have some comments on the implementation.
I wonder what caused LIT regressions here...

Deallocate stream buffers in cleanup function, this will guarantee that
resources are released and output is printed by the end of the program.
@againull againull changed the title [WIP][SYCL] Don't block execution when flushing a stream [SYCL] Don't block execution when flushing a stream Oct 13, 2020
@againull
Copy link
Contributor Author

/summary:run

@@ -6,6 +6,7 @@
//
//===----------------------------------------------------------------------===//

#include <CL/sycl/queue.hpp>
Copy link
Contributor

Choose a reason for hiding this comment

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

Should all these includes using "" instead as they are implementation details and not user-facing system includes? What happens if there is already an incompatible SYCL implementation on the system and you are testing this one at the same time without installing it?

s-kanaev
s-kanaev previously approved these changes Oct 14, 2020
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.

Sorry for the late comment.

// warning in this case.
std::lock_guard<std::mutex> lock(StreamBuffersPoolMutex);
if (!StreamBuffersPool.empty())
std::cerr
Copy link
Contributor

Choose a reason for hiding this comment

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

Please do not print to standard output streams as it can be unexpected by customers. I suggest replacing it with an assert or printing only if pi trace is enabled. Also it would be more safe to print using printf to avoid problems with ordering of global objects destruction(Scheduler and IIRC cerr are global objects).

Copy link
Contributor

Choose a reason for hiding this comment

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

Assertion won't available in release build. I believe the user won't ever see it. Thus, it should be either an output with PI tracing or an exception.

@romanovvlad
Copy link
Contributor

/summary:run

Copy link
Contributor

@sergey-semenov sergey-semenov left a comment

Choose a reason for hiding this comment

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

Vlad's comment aside, LGTM

@romanovvlad romanovvlad merged commit e7492fb into intel:sycl Oct 14, 2020
@againull againull deleted the pipes branch December 3, 2022 00:03
jsji pushed a commit that referenced this pull request May 30, 2024
Calls to printf can generated by a user call to __builtin_printf. Represent this in SPIRV with a printf extended instruction instead of a SPIRV call to "printf". A SPIRV call to a variadic function will fail in spirv-val.

Signed-off-by: Lu, John <[email protected]>

Original commit:
KhronosGroup/SPIRV-LLVM-Translator@d4098cdd72bce73
kbenzie pushed a commit to kbenzie/intel-llvm that referenced this pull request Feb 17, 2025
[L0 v2] Add dependency on UR_DPCXX for kernel tests
Chenyang-L pushed a commit that referenced this pull request Feb 18, 2025
[L0 v2] Add dependency on UR_DPCXX for kernel tests
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.

6 participants