Skip to content

[SYCL][InvokeSIMD] Add error for invalid uniform arguments #8916

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 4 commits into from
Apr 11, 2023

Conversation

sarnex
Copy link
Contributor

@sarnex sarnex commented Mar 31, 2023

The spec requires uniform arguments to contain a trivially copyable type. Add an error if it isn't.

@sarnex sarnex marked this pull request as ready for review March 31, 2023 20:07
@sarnex sarnex requested review from a team and rolandschulz as code owners March 31, 2023 20:07
@sarnex sarnex temporarily deployed to aws March 31, 2023 20:40 — with GitHub Actions Inactive
@sarnex sarnex temporarily deployed to aws March 31, 2023 22:11 — with GitHub Actions Inactive
@@ -420,6 +431,7 @@ __attribute__((always_inline)) auto invoke_simd(sycl::sub_group sg,
// what the subgroup size is and arguments don't need widening and return
// value does not need shrinking by this library or SPMD compiler, so 0
// is fine in this case.
detail::verify_valid_args<T...>();
detail::verify_no_ref<Callable>();
Copy link
Contributor

Choose a reason for hiding this comment

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

The name of the function seems a bit too general. Now it checks only that all arguments are trivially_copiable.
If keep the name, then it would be reasonable to move checks from verify_no_ref to that function as well.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

good point, im gonna pick the second option so it is more extensible in the future, thanks

@sarnex sarnex temporarily deployed to aws April 3, 2023 21:53 — with GitHub Actions Inactive
@sarnex sarnex temporarily deployed to aws April 4, 2023 00:24 — with GitHub Actions Inactive
template <typename T> struct is_non_trivially_copyable_uniform {
static constexpr bool value =
is_uniform_type<T>::value &&
!std::is_trivially_copyable_v<typename unwrap_uniform<T>::type>;
Copy link
Contributor

Choose a reason for hiding this comment

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

@rolandschulz , @Pennycook - is the trivially-copyable requirement applied to parameters ONLY ON DEVICE?

Let's say, sycl::local_accessor has different representation on HOST and DEVICE. It uses std::shared_ptr on HOST and simpler types on DEVICE. Such object is trivially_copyable on DEVICE

So, should this check be applied like this?

#ifdef __SYCL_DEVICE_ONLY__
check that invoke_simd arg is trivially copyable
#endif

@sarnex
Copy link
Contributor Author

sarnex commented Apr 10, 2023

@v-klochkov Should I change it so this check only happens for device code, and then we can merge?

Yes, please do the trivially-copyable check under

#ifdef __SYCL_DEVICE_ONLY__

sarnex added 4 commits April 11, 2023 13:52
The spec requires uniform arguments to contain a trivially copyable type.
Add an error if it isn't.

Signed-off-by: Sarnie, Nick <[email protected]>
Signed-off-by: Sarnie, Nick <[email protected]>
Signed-off-by: Sarnie, Nick <[email protected]>
@sarnex
Copy link
Contributor Author

sarnex commented Apr 11, 2023

@v-klochkov ok this is ready for you to take another look, thanks!

@sarnex sarnex temporarily deployed to aws April 11, 2023 18:20 — with GitHub Actions Inactive
@sarnex sarnex temporarily deployed to aws April 11, 2023 20:09 — with GitHub Actions Inactive
@sarnex
Copy link
Contributor Author

sarnex commented Apr 11, 2023

 Failed Tests (1):
  SYCL :: Basic/memory-consumption.cpp
  • ESIMD Emu, so LGTM for merge

@v-klochkov v-klochkov merged commit 487c1f8 into intel:sycl Apr 11, 2023
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.

2 participants