-
Notifications
You must be signed in to change notification settings - Fork 788
[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
Conversation
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.
/summary:run |
Sorry, looks like this approach causes multiple regressions. Please do not review yet. |
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.
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.
/summary:run |
@@ -6,6 +6,7 @@ | |||
// | |||
//===----------------------------------------------------------------------===// | |||
|
|||
#include <CL/sycl/queue.hpp> |
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.
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?
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.
Sorry for the late comment.
// warning in this case. | ||
std::lock_guard<std::mutex> lock(StreamBuffersPoolMutex); | ||
if (!StreamBuffersPool.empty()) | ||
std::cerr |
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.
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).
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.
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.
/summary:run |
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.
Vlad's comment aside, LGTM
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
[L0 v2] Add dependency on UR_DPCXX for kernel tests
[L0 v2] Add dependency on UR_DPCXX for kernel tests
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.