-
Notifications
You must be signed in to change notification settings - Fork 787
[SYCL][ESIMD] Add more compile time checks to rdregion and wrregion API #13158
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
Changes from all commits
Commits
Show all changes
10 commits
Select commit
Hold shift + click to select a range
2ca8c9e
Add more checks to rdregion and wrregion API
fineg74 e1a3de4
Replace SFINAE checks with static_assert
fineg74 1ad91bb
Merge remote-tracking branch 'origin/sycl' into regionChecks
fineg74 c28f5de
Split checks for rdregion and wrregion
fineg74 50d4074
Address PR comments
fineg74 89afb11
Add more comments to address PR comments
fineg74 8f7c46c
Add more comments
fineg74 86e6f36
Merge branches 'sycl' and 'regionChecks' of https://github.com/fineg7…
fineg74 e37dd9d
Update sycl/include/sycl/ext/intel/esimd/detail/util.hpp
fineg74 73f987c
Merge remote-tracking branch 'origin/sycl' into regionChecks
fineg74 File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -11,19 +11,27 @@ SYCL_ESIMD_FUNCTION void test_wrregion_size_check() { | |
simd<int, 16> v16 = 0; | ||
simd<int, 64> v64; | ||
v16.template select<64, 1>(0) = v64; | ||
// expected-error@* {{static assertion failed due to requirement 'M <= BN'}} | ||
// expected-error@sycl/ext/intel/esimd/detail/util.hpp:* {{static assertion failed due to requirement '64 <= 16'}} | ||
// expected-note@sycl/ext/intel/esimd/detail/simd_obj_impl.hpp:* {{in instantiation of function template specialization}} | ||
// expected-note@sycl/ext/intel/esimd/detail/simd_view_impl.hpp:* {{in instantiation of function template specialization}} | ||
// expected-note@sycl/ext/intel/esimd/detail/simd_view_impl.hpp:* {{in instantiation of member function}} | ||
// [email protected]:* {{in instantiation of member function}} | ||
// expected-note@sycl/ext/intel/esimd/detail/simd_obj_impl.hpp:* {{expression evaluates to '64 <= 16'}} | ||
// expected-note@* {{in instantiation of member function}} | ||
|
||
// expected-error@sycl/ext/intel/esimd/detail/util.hpp:* {{static assertion failed due to requirement '(64 - 1) * 1 < 16'}} | ||
// expected-note@* {{expression evaluates to '63 < 16'}} | ||
|
||
// expected-error@* {{no matching function for call to '__esimd_wrregion'}} | ||
// expected-note@sycl/ext/intel/esimd/detail/simd_view_impl.hpp:* {{in instantiation of function template specialization}} | ||
// expected-note@sycl/ext/intel/esimd/detail/simd_view_impl.hpp:* {{in instantiation of member function}} | ||
// expected-note@* {{in instantiation of member function}} | ||
// expected-note@sycl/ext/intel/esimd/detail/intrin.hpp:* {{candidate template ignored: requirement '64 <= 16' was not satisfied}} | ||
|
||
simd<int, 2> v2; | ||
v16.template select<2, 64>() = v2; | ||
// expected-error@* {{static assertion failed due to requirement '(M > BN) || (M - 1) * Stride < BN'}} | ||
// expected-error@sycl/ext/intel/esimd/detail/util.hpp:* {{static assertion failed due to requirement '(2 - 1) * 64 < 16'}} | ||
// expected-note@sycl/ext/intel/esimd/detail/simd_obj_impl.hpp:* {{in instantiation of function template specialization}} | ||
// expected-note@sycl/ext/intel/esimd/detail/simd_view_impl.hpp:* {{in instantiation of function template specialization}} | ||
// expected-note@sycl/ext/intel/esimd/detail/simd_view_impl.hpp:* {{in instantiation of member function}} | ||
// [email protected]:* {{in instantiation of member function}} | ||
// expected-note@* {{in instantiation of member function}} | ||
// expected-note@* {{expression evaluates to '64 < 16'}} | ||
} |
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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 write a detailed comment to these 2 functions and their params. Otherwise, it is really difficult (or impossible) to understand what they verify.
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 some comments
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.
Thank you. It is still difficult to understand why the constraint is such:
Width == M || ((M / Width) - 1) * VStride + (Width - 1) * Stride < N
. It would help a lot if the pseudo-code would be copied from __esimd_rdregion/wrregion to the commend of these check functions, e.g.;// This intrinsic computes a vector Result:
//
// \code{.cpp}
// uint16_t EltOffset = Offset / sizeof(T);
// assert(Offset % sizeof(T) == 0);
//
// int NumRows = M / Width;
// assert(M % Width == 0);
//
// int Index = 0;
// for (int i = 0; i < NumRows; ++i) {
// for (int j = 0; j < Width; ++j) {
// Result[Index++] = Input[i * VStride + j * Stride +
// EltOffset];
// }
// }
// \endcode
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.
Done
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.
Can you do the same for __esimd_wrregion please?
Perhaps, fix the comment in both places too - comment does not say that the write is skipped if mask is 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.
Sorry, for confusion. the pseudo-code for __esimd_wrregion is correct. Please just copy it to check function here.
The __esimd_rdregion does not have a mask operand, thus is is all right in the pseudo-code for rdregion.
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.
Done