-
Notifications
You must be signed in to change notification settings - Fork 769
[ESIMD] Allow constructing simd_view from simd #4514
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
Conversation
The patch allows the following code to work: ``` simd<int, 16> s = 0; simd_view v = s; ``` I added default template parameter for simd_view_impl class and put it as a last template argument.
The corresponding E2E test is here: intel/llvm-test-suite#454 |
sycl/test/esimd/simd_view.cpp
Outdated
@@ -69,6 +69,19 @@ SYCL_ESIMD_FUNCTION void test_simd_view_copy_ctor() { | |||
auto v0_view_copy(v0_view); | |||
} | |||
|
|||
// test construction from vector. | |||
SYCL_ESIMD_FUNCTION void test_simd_view_from_vector() { | |||
simd<int, 16> s = 0; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
please a test case for length 1
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Added here: 33eede7
@DenisBakhvalov, could you please hold this until this big one is merged #4230 ? |
@DenisBakhvalov, #4230 merged, please resolve conflicts then |
@kbobrovs, @kychendev, @sndmitriev, do you need someone else to resolve merge conflicts? |
Ping. |
@bader, sorry for delay. I resolved the conflicts, let's see the testing results. |
Signed-off-by: Vyacheslav N Klochkov <[email protected]>
@@ -70,6 +72,9 @@ class simd_view : public detail::simd_view_impl<BaseTy, RegionTy> { | |||
simd_view(const simd_view &Other) = default; | |||
simd_view(simd_view &&Other) = default; | |||
|
|||
// Construct a complete view of a vector | |||
simd_view(BaseTy &Base) : BaseClass(Base) {} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please convert this to a documentation comment, and mention that this does not work for VL=1
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks. Is VL != 1 limitation still in effect? If so the best way would be to use SFINAE to disable this constructor in this case.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I added constructor to scalar specialization. So, VL=1 case works. See this commit: 33eede7
Signed-off-by: Vyacheslav N Klochkov <[email protected]>
Signed-off-by: Vyacheslav N Klochkov <[email protected]>
intel/llvm#4514 Signed-off-by: Vyacheslav N Klochkov <[email protected]>
The patch allows the following code to work:
I added default template parameter for simd_view_impl class
and put it as a last template argument.