Skip to content

[SYCL][L0] Implementation of ext_oneapi_prod API #13555

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 41 commits into from
May 21, 2024

Conversation

lbushi25
Copy link
Contributor

@lbushi25 lbushi25 commented Apr 24, 2024

This PR includes a preliminary implementation of the ext_oneapi_prod extension defined here:
https://github.com/intel/llvm/blob/sycl/sycl/doc/extensions/proposed/sycl_ext_oneapi_prod.asciidoc
It is preliminary because the UR-Level Zero queue flushing method which I've used to implement this extension is a no-op at the moment but I have a PR in review to change that: oneapi-src/unified-runtime#1545.
Afterwards, my guess is that I will have to update the UR version we use in this repo to include that new commit once the Unified Runtime PR is merged.
Nevertheless, I think I can continue with the review and merge of this PR independently of that since compilation will succeed because the UR flush method is defined, it just does nothing at the moment.

@lbushi25 lbushi25 requested a review from a team as a code owner April 24, 2024 22:12
@lbushi25 lbushi25 requested review from uditagarwal97, HPS-1, victor-eds, tovinkere and AlexeySachkov and removed request for uditagarwal97 April 24, 2024 22:12
@lbushi25 lbushi25 requested review from againull and removed request for HPS-1, victor-eds and tovinkere April 25, 2024 03:53
Copy link
Contributor

@againull againull left a comment

Choose a reason for hiding this comment

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

PR mentions only L0. Is this going to be supported for other backends?

@@ -104,6 +104,7 @@ inline namespace _V1 {
#define SYCL_EXT_INTEL_MATRIX 1
#define SYCL_EXT_INTEL_FPGA_TASK_SEQUENCE 1
#define SYCL_EXT_ONEAPI_PRIVATE_ALLOCA 1
#define SYCL_EXT_ONEAPI_PROD 1
Copy link
Contributor

Choose a reason for hiding this comment

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

As far as I understand, defining this macro indicates to the user that feature is supported. But it is not supported yet because you have to bring UR changes.
Also once feature is supported we should move the extension document to the supported directory.
So may be it makes sense to merge changes to UR first and then combine these changes with UR tag update + move the document to supported. Or probably we shouldn't define the macro for now.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I'll wait until the UR changes are merged and then merge this one.

Copy link
Contributor

Choose a reason for hiding this comment

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

This feature is a hint and implementation may decide to ignore it completely. Therefore, I think that it is fine to say that this is supported, even if we have some bugs on UR side

@@ -388,6 +388,10 @@ class queue_impl {
template <typename Param>
typename Param::return_type get_backend_info() const;

/// Begin to execute previously issued commands on this queue
/// if they have not been executed yet. Overrides normal batching behaviour.
void flush() { getPlugin()->call<PiApiKind::piQueueFlush>(MQueues[0]); }
Copy link
Contributor

Choose a reason for hiding this comment

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

I think it is possible for MQueues to be empty. At least internally we most likely use host queues which don't have any PI handles.

So, it will be nice to have some tests for this feature.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Ok, I'll add a check to verify that MQueues is not empty. I'm also working on adding some tests on this PR.

@lbushi25
Copy link
Contributor Author

lbushi25 commented Apr 25, 2024

PR mentions only L0. Is this going to be supported for other backends?

I don't know whether it will be supported for other backends. From what I can see it is already implemented for OpenCL but not HIP and CUDA.

@@ -388,6 +388,10 @@ class queue_impl {
template <typename Param>
typename Param::return_type get_backend_info() const;

/// Begin to execute previously issued commands on this queue
/// if they have not been executed yet. Overrides normal batching behaviour.
void flush() { getPlugin()->call<PiApiKind::piQueueFlush>(MQueues[0]); }
Copy link
Contributor

Choose a reason for hiding this comment

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

Also, I think special handling is needed for the case when graph recording is in progress. (for example, see queue_impl::wait). It will be nice to have test for this case as well.

@lbushi25 lbushi25 requested a review from againull April 25, 2024 21:07
@lbushi25
Copy link
Contributor Author

lbushi25 commented Apr 25, 2024

@againull I added a check for when the MQueues member is empty and added some code to throw an exception when the queue is in graph recording mode since I guess it does not make sense to call flush while commands are being recorded. I'm working on adding several tests to cover these cases.

@lbushi25 lbushi25 temporarily deployed to WindowsCILock May 2, 2024 18:13 — with GitHub Actions Inactive
@lbushi25 lbushi25 temporarily deployed to WindowsCILock May 2, 2024 18:52 — with GitHub Actions Inactive
@lbushi25 lbushi25 temporarily deployed to WindowsCILock May 2, 2024 20:04 — with GitHub Actions Inactive
@lbushi25 lbushi25 temporarily deployed to WindowsCILock May 2, 2024 20:37 — with GitHub Actions Inactive
@lbushi25 lbushi25 requested a review from AlexeySachkov May 3, 2024 14:25
Copy link
Contributor

@kbenzie kbenzie left a comment

Choose a reason for hiding this comment

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

UR LGTM

@AlexeySachkov AlexeySachkov dismissed their stale review May 15, 2024 15:41

UR tag was updated which resolves my comment

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