Skip to content

[SYCL] Implement a builtin to mark a sycl kernel #3894

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 9 commits into from
Jun 9, 2021

Conversation

erichkeane
Copy link
Contributor

The unique-stable-name constraint that you can't look up the name in a
constant expression before instantiating the kernel is causing issues.

This provides a constexpr builtin so that you can mark the kernel
without having to instantiate the kernel.

The unique-stable-name constraint that you can't look up the name in a
constant expression before instantiating the kernel is causing issues.

This provides a constexpr builtin so that you can mark the kernel
without having to instantiate the kernel.
@erichkeane
Copy link
Contributor Author

This is an alternative solution to #3886

I think THIS fixes our problem, but I'm not positive it is what we want. Do we ever try to instantiate a KernelInfo on something that is NOT a kernel? @romanovvlad ?

I also have a 'TODO' in here whether we need to do something to force the instantiation though. Otherwise, I want to make sure that this passes validation.

I still have to spend some time getting this ready for commit (writing tests, perhaps a slight refactor) if we decide this is worth doing.

@erichkeane
Copy link
Contributor Author

Note the clang-format complaint is something I'm not willing to do. I'm not going to re-format the entirety of this comment that community has aligned intentionally.

@erichkeane
Copy link
Contributor Author

/summary:run

@erichkeane
Copy link
Contributor Author

Looks like WIndows likes it! @romanovvlad and @AlexeySachkov WDYT?

@erichkeane erichkeane marked this pull request as ready for review June 7, 2021 18:11
@erichkeane
Copy link
Contributor Author

erichkeane commented Jun 7, 2021

Ok, this should be functional now... hopefully CI stops being broken long enough to validate this :)

EDIT: I'm STILL ignoring that clang-format, that is a much worse fix.

@AaronBallman
Copy link
Contributor

Ok, this should be functional now... hopefully CI stops being broken long enough to validate this :)

EDIT: I'm STILL ignoring that clang-format, that is a much worse fix.

Agreed, ignore clang-format in this case.

@erichkeane
Copy link
Contributor Author

/summary:run

@@ -187,6 +187,7 @@ class accessor {
template <int dimensions, access::mode accessmode, access::target accesstarget>
struct opencl_image_type;

#ifdef __SYCL_DEVICE_ONLY__
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Note the CFE only provides these types in device mode, so this change lets us uses this in header properly in host mode.

@romanovvlad
Copy link
Contributor

This is an alternative solution to #3886

I think THIS fixes our problem, but I'm not positive it is what we want. Do we ever try to instantiate a KernelInfo on something that is NOT a kernel? @romanovvlad ?

I also have a 'TODO' in here whether we need to do something to force the instantiation though. Otherwise, I want to make sure that this passes validation.

I still have to spend some time getting this ready for commit (writing tests, perhaps a slight refactor) if we decide this is worth doing.

We do not instantiate a KernelInfo on something that is not a kernel in the SYCL headers directly, but it can happen as a result of incorrect users code. We instantiate a KernelInfo with a type a user gives us, for example, in `sycl::get_kernel_id" API, so we can end up instantiating with "non-kernel type"(results of the call should be "kernel not found" error).

@erichkeane
Copy link
Contributor Author

This is an alternative solution to #3886
I think THIS fixes our problem, but I'm not positive it is what we want. Do we ever try to instantiate a KernelInfo on something that is NOT a kernel? @romanovvlad ?
I also have a 'TODO' in here whether we need to do something to force the instantiation though. Otherwise, I want to make sure that this passes validation.
I still have to spend some time getting this ready for commit (writing tests, perhaps a slight refactor) if we decide this is worth doing.

We do not instantiate a KernelInfo on something that is not a kernel in the SYCL headers directly, but it can happen as a result of incorrect users code. We instantiate a KernelInfo with a type a user gives us, for example, in `sycl::get_kernel_id" API, so we can end up instantiating with "non-kernel type"(results of the call should be "kernel not found" error).

Ok, thanks! As long as you're not doing so intentionally (that is, using it to test whether something is a kernel or not) than we're fine. All that will happen is that the unique-stable-name result will not be the name a of a kernel if you do (AND it likely messes up the name of other kernels around it).

@erichkeane
Copy link
Contributor Author

So I think we've got all the questions answered, so @AaronBallman and @elizabethandrews : are we happy with the CFE changes? Can someone from the @intel/llvm-reviewers-runtime take a look to make sure the change is acceptable?

Copy link
Contributor

@AaronBallman AaronBallman left a comment

Choose a reason for hiding this comment

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

LGTM!

Copy link
Contributor

@elizabethandrews elizabethandrews left a comment

Choose a reason for hiding this comment

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

Thanks!

Copy link
Contributor

@dm-vodopyanov dm-vodopyanov left a comment

Choose a reason for hiding this comment

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

Library changes and regression test LGTM

@erichkeane
Copy link
Contributor Author

@bader: The clang-format change is one we don't want to make, so this is ready!

@bader
Copy link
Contributor

bader commented Jun 9, 2021

/summary:run

@bader bader changed the title [SYCL] implement a builtin to mark a sycl kernel [SYCL] Implement a builtin to mark a sycl kernel Jun 9, 2021
@bader bader merged commit 642ee82 into intel:sycl Jun 9, 2021
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