[SYCL] Flush queue on memory operations
https://github.com/intel/llvm/pull/9944 introduced a hack in the OpenCL PI plugin which maps PI_EVENT_QUEUED to PI_EVENT_SUBMITTED. This hack is problematic because it will make SYCL-RT assume that an event has been flushed when it might not have been. At the moment, this could result in buggy behaviour on the OpenCL backend when using multiple queues. The OpenCL specification states:
"To use event objects that refer to commands enqueued in a command-queue as event objects to wait on by commands enqueued in a different command-queue, the application must call a clFlush or any blocking commands that perform an implicit flush of the command-queue where the commands that refer to these event objects are enqueued."
This PR, changes SYCL-RT to properly flush user events if they are in the PI_EVENT_QUEUED status. This will allow the hack to be removed from unified runtime.
There was also a couple of tests that had to be updated because they made assumptions about the ordering of calls to the PI plugin layers.
I'm not very familiar with the SYCL-RT codebase, so there might be a good reason to do this changes in a different way. It would be great if someone more familiar with the queue implementation could give feedback on this changes.
@intel/llvm-reviewers-runtime / @againull could you have a look at these changes?
I'm sorry for the delayed review.
Closing this PR. Created a new PR that implements the workaround discussed here: https://github.com/intel/llvm/pull/13024