-
Notifications
You must be signed in to change notification settings - Fork 787
[SYCL] Specific error messages for invalid properties on non pointer types #11843
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
dm-vodopyanov
merged 5 commits into
intel:sycl
from
yug-intel:error-message-for-invalid-property
Nov 14, 2023
Merged
[SYCL] Specific error messages for invalid properties on non pointer types #11843
dm-vodopyanov
merged 5 commits into
intel:sycl
from
yug-intel:error-message-for-invalid-property
Nov 14, 2023
Conversation
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
annotated_arg header file
tiwaria1
reviewed
Nov 9, 2023
sycl/include/sycl/ext/oneapi/experimental/annotated_arg/annotated_arg.hpp
Show resolved
Hide resolved
tiwaria1
approved these changes
Nov 9, 2023
dm-vodopyanov
approved these changes
Nov 13, 2023
@againull Could you merge this PR? |
wangdi4
pushed a commit
to wangdi4/llvm
that referenced
this pull request
Dec 12, 2023
…types (intel#11843) This change adds specific error messages for invalid properties that are specified on non pointer types. This change is directly in the header annotated_arg.hpp and these checks are done before the `check_property_list` check which previously accounted for this but had a generic error message. This change adds static asserts so that the error message specifies the invalid property and that it is invalid due to a non pointer type for the underlying data type. For example, if the user tries to declare the following variable: ```cpp annotated_arg<int, decltype(properties{buffer_location<0>})> a; ``` The following error message is outputted: ``` error: static assertion failed due to requirement '!has_buffer_location': Property buffer_location cannot be specified for annotated_arg<T> when T is a non pointer type. 288 | static_assert(!has_buffer_location, | ^~~~~~~~~~~~~~~~~~~~ ``` Prior to this change, the following generic error message was printed with multiple notes: ``` /p/psg/swip/w/yugteshs/sycl_include/sycl/ext/oneapi/experimental/common_annotated_properties/properties.hpp:59:17: error: static assertion failed due to requirement 'is_valid_property_for_given_type': Property is invalid for the given type. 59 | static_assert(is_valid_property_for_given_type, | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ /p/psg/swip/w/yugteshs/sycl_include/sycl/ext/oneapi/experimental/annotated_arg/annotated_arg.hpp:307:7: note: in instantiation of template class 'sycl::ext::oneapi::experimental::check_property_list<int, sycl::ext::oneapi::experimental::property_value<sycl::ext::intel::experimental::buffer_location_key, std::integral_constant<int, 0>>>' requested here 307 | check_property_list<T, Props...>::value; | ^ /p/psg/swip/w/yugteshs/sycl_include/sycl/ext/oneapi/experimental/annotated_arg/annotated_arg.hpp:308:17: note: in instantiation of static data member 'sycl::ext::oneapi::experimental::annotated_arg<int, sycl::ext::oneapi::experimental::properties<std::tuple<sycl::ext::oneapi::experimental::property_value<sycl::ext::intel::experimental::buffer_location_key, std::integral_constant<int, 0>>>>>::contains_valid_properties' requested here 308 | static_assert(contains_valid_properties, | ^ temp.cpp:15:66: note: in instantiation of template class 'sycl::ext::oneapi::experimental::annotated_arg<int, sycl::ext::oneapi::experimental::properties<std::tuple<sycl::ext::oneapi::experimental::property_value<sycl::ext::intel::experimental::buffer_location_key, std::integral_constant<int, 0>>>>>' requested here 15 | annotated_arg<int, decltype(properties{buffer_location<0>})> a; | ^ ``` ### Alternate Methods PR intel#11748 adds the same checks but in the `fpga_annotated_properties.hpp` file as a separate check. This PR has the checks directly in the `annotated_arg.hpp` header file so that there are fewer notes printed below the error message. Here is a comparison of how the error message is outputted when the checks are in different files: With error checks in properties header file and using a macro (PR intel#11748): ``` /p/psg/swip/w/yugteshs/sycl_include/sycl/ext/intel/experimental/fpga_annotated_properties.hpp:396:3: error: static assertion failed due to requirement '!has_buffer_location': Property buffer_location cannot be specified for annotated_arg<T> when T is a non pointer type. 396 | CHECK_INVALID_PROPERTY(buffer_location, list) | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ /p/psg/swip/w/yugteshs/sycl_include/sycl/ext/intel/experimental/fpga_annotated_properties.hpp:389:17: note: expanded from macro 'CHECK_INVALID_PROPERTY' 389 | static_assert(!has_##property, \ | ^~~~~~~~~~~~~~~ /p/psg/swip/w/yugteshs/sycl_include/sycl/ext/oneapi/experimental/annotated_arg/annotated_arg.hpp:202:25: note: in instantiation of template class 'sycl::ext::oneapi::experimental::detail::checkPropertiesForNonPointerType<sycl::ext::oneapi::experimental::property_value<sycl::ext::intel::experimental::buffer_location_key, std::integral_constant<int, 0>>>' requested here 202 | static_assert(detail::checkPropertiesForNonPointerType<Props...>::value); | ^ temp.cpp:15:66: note: in instantiation of template class 'sycl::ext::oneapi::experimental::annotated_arg<int, sycl::ext::oneapi::experimental::properties<std::tuple<sycl::ext::oneapi::experimental::property_value<sycl::ext::intel::experimental::buffer_location_key, std::integral_constant<int, 0>>>>>' requested here 15 | annotated_arg<int, decltype(properties{buffer_location<0>})> a; | ^ ``` With error check in annotated_arg header and using a macro: ``` /p/psg/swip/w/yugteshs/sycl_include/sycl/ext/oneapi/experimental/annotated_arg/annotated_arg.hpp:292:3: error: static assertion failed due to requirement '!has_buffer_location': Property buffer_location cannot be specified for annotated_arg<T> when T is a non pointer type. 292 | CHECK_INVALID_PROPERTY(buffer_location, property_tuple) | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ /p/psg/swip/w/yugteshs/sycl_include/sycl/ext/oneapi/experimental/annotated_arg/annotated_arg.hpp:23:17: note: expanded from macro 'CHECK_INVALID_PROPERTY' 23 | static_assert(!has_##property, \ | ^~~~~~~~~~~~~~~ temp.cpp:15:66: note: in instantiation of template class 'sycl::ext::oneapi::experimental::annotated_arg<int, sycl::ext::oneapi::experimental::properties<std::tuple<sycl::ext::oneapi::experimental::property_value<sycl::ext::intel::experimental::buffer_location_key, std::integral_constant<int, 0>>>>>' requested here 15 | annotated_arg<int, decltype(properties{buffer_location<0>})> a; | ^ ``` ### This Change With error check in annotated_arg header and not using a macro (This PR): ``` /p/psg/swip/w/yugteshs/sycl_include/sycl/ext/oneapi/experimental/annotated_arg/annotated_arg.hpp:288:17: error: static assertion failed due to requirement '!has_buffer_location': Property buffer_location cannot be specified for annotated_arg<T> when T is a non pointer type. 288 | static_assert(!has_buffer_location, | ^~~~~~~~~~~~~~~~~~~~ temp.cpp:15:66: note: in instantiation of template class 'sycl::ext::oneapi::experimental::annotated_arg<int, sycl::ext::oneapi::experimental::properties<std::tuple<sycl::ext::oneapi::experimental::property_value<sycl::ext::intel::experimental::buffer_location_key, std::integral_constant<int, 0>>>>>' requested here 15 | annotated_arg<int, decltype(properties{buffer_location<0>})> a; | ^ ``` This version only prints one note and therefore it is more clear for the user.
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
This change adds specific error messages for invalid properties that are specified on non pointer types. This change is directly in the header annotated_arg.hpp and these checks are done before the
check_property_list
check which previously accounted for this but had a generic error message.This change adds static asserts so that the error message specifies the invalid property and that it is invalid due to a non pointer type for the underlying data type.
For example, if the user tries to declare the following variable:
The following error message is outputted:
Prior to this change, the following generic error message was printed with multiple notes:
Alternate Methods
PR #11748 adds the same checks but in the
fpga_annotated_properties.hpp
file as a separate check. This PR has the checks directly in theannotated_arg.hpp
header file so that there are fewer notes printed below the error message. Here is a comparison of how the error message is outputted when the checks are in different files:With error checks in properties header file and using a macro (PR #11748):
With error check in annotated_arg header and using a macro:
This Change
With error check in annotated_arg header and not using a macro (This PR):
This version only prints one note and therefore it is more clear for the user.