Skip to content

[ESIMD] Add more user-friendly error msg when write beyond simd obj #12059

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 1 commit into from
Dec 4, 2023

Conversation

v-klochkov
Copy link
Contributor

@v-klochkov v-klochkov commented Dec 2, 2023

It is still not prohibited to create 'simd_view' that views beyond the bounds of viewed 'simd' object. And it is not yet prohibited to read using such 'simd_view' object, but the commit 17f8939 prohibited writing beyong simd bounds. The error message was difficult to read and did not give any guidance on the proposed fix.

The old error message only said that __esimd_wrregion call could not be matched. The newly added static assert says that the viewed object in LHS does not fit the value in RHS.

Example of problem situation:
simd<float, 16> vec; // vec is only 16-elements
auto vec_too_bit_view = vec.select<128, 1>();// 128-elems - too many
vec_too_bit_view = simd<float, 128>{0}; //error: write 128-elem to
16-elem storage

It is still not prohibited to create 'simd_view' that views
beyond the bounds of viewed 'simd' object. And it is not yet
prohibited to read using such 'simd_view' object, but the commit
17f8939 prohibited writing beyong
simd bounds. The error message was difficult to read and did not
give any guidance on the proposed fix.

The old error message only said that __esimd_wrregion call could not be
matched. The newly added static assert says that the viewed object in
LHS does not fit the value in RHS.

Example, of problem situation:
  simd<float, 16> vec; // vec is only 16-elements
  auto vec_too_bit_view = vec.select<128, 1>();// 128-elems - too many
  vec_too_bit_view = simd<float, 128>{0}; //error: write 128-elem to
16-elem storage

Signed-off-by: Klochkov, Vyacheslav N <[email protected]>
@v-klochkov v-klochkov marked this pull request as ready for review December 4, 2023 16:02
@v-klochkov v-klochkov requested a review from a team as a code owner December 4, 2023 16:02
@v-klochkov v-klochkov merged commit 197c33a into intel:sycl Dec 4, 2023
@v-klochkov v-klochkov deleted the esimd_better_diags_wrregion branch December 4, 2023 20:26
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