Skip to content

[ESIMD] Add Simd constructor from simd_view #15174

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 3 commits into from
Aug 28, 2024
Merged

Conversation

fineg74
Copy link
Contributor

@fineg74 fineg74 commented Aug 22, 2024

No description provided.

@fineg74 fineg74 marked this pull request as ready for review August 23, 2024 02:09
@fineg74 fineg74 requested a review from a team as a code owner August 23, 2024 02:09
simd(const sycl::ext::oneapi::experimental::simd<Ty, N1> &v)
: simd(static_cast<raw_vector_type>(v)) {}

// Implicit conversion constructor from simd_view
template <typename BaseTy>
simd(simd_view<BaseTy, region1d_t<Ty, N, 1>> &v) : simd(v.read()) {}
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 the read function is const, so can we make this a const ref?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

It conflicts with simd operator of simd_view

simd(const sycl::ext::oneapi::experimental::simd<Ty, N1> &v)
: simd(static_cast<raw_vector_type>(v)) {}

// Implicit conversion constructor from simd_view
template <typename BaseTy>
simd(simd_view<BaseTy, region1d_t<Ty, N, 1>> &v) : simd(v.read()) {}
Copy link
Contributor

Choose a reason for hiding this comment

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

does this also work with other region types, which I guess could be:

// The region applied on the base object. Its type could be
  // - region1d_t
  // - region2d_t
  // - std::pair<top_region_type, base_region_type>
  //

Copy link
Contributor Author

Choose a reason for hiding this comment

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

It doesn't and the reason is that it must infer Ty, and N class template parameters from constructor parameter type. While it is doable for 1d case I am not sure how to infer N in 2d case where length is a product of X size and Y Size but doesn't appear as a single parameter that can be inferred.
The interface with pair is even more complicated as it could be a long chain of views with actual size can be inferred only at the very end

Copy link
Contributor Author

Choose a reason for hiding this comment

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

So the suggestion is to provide it for 1d first and if there will be an interest we can get back to it

Copy link
Contributor

Choose a reason for hiding this comment

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

thanks, will review as-is

@sarnex sarnex merged commit 1f5e1dc into intel:sycl Aug 28, 2024
15 checks passed
@fineg74 fineg74 deleted the simdConstructor branch August 28, 2024 15:38
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