-
Notifications
You must be signed in to change notification settings - Fork 116
feature: restore IndexValue support and testing #2049
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
Draft
johnbowen42
wants to merge
10
commits into
develop
Choose a base branch
from
feature/bowen/restore-indexvalue-support
base: develop
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Draft
Changes from all commits
Commits
Show all changes
10 commits
Select commit
Hold shift + click to select a range
f31850b
split tests into two categories: strongindex support and non stron in…
johnbowen42 8b0df00
Merge branch 'develop' into feature/bowen/restore-indexvalue-support
johnbowen42 f175e67
Refactor kernel unit tests to support IndexValue types
johnbowen42 4796946
Merge branch 'develop' into feature/bowen/restore-indexvalue-support
johnbowen42 1fd80e6
Fix merge build errors and test failure
johnbowen42 d01ff4f
fix build error
johnbowen42 d768d5f
reformat forall and launch tests to support IndexValue types in test …
johnbowen42 ed04fe8
make constructor explicit again
johnbowen42 b56fe40
Make Tile compatible with IdnexValue types
johnbowen42 481cddd
Finish refactor of CUDA and SYCL tile backends to support IndexValue …
johnbowen42 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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -58,6 +58,12 @@ struct IndexValue : public IndexValueBase | |
| RAJA_INLINE IndexValue& operator=(IndexValue const&) = default; | ||
| RAJA_INLINE IndexValue& operator=(IndexValue&&) = default; | ||
|
|
||
| RAJA_INLINE IndexValue& operator=(const value_type& v) | ||
| { | ||
| value = v; | ||
| return *this; | ||
| } | ||
|
|
||
| /*! | ||
| * \brief Explicit constructor. | ||
| * \param v Initial value | ||
|
|
@@ -300,23 +306,107 @@ convertIndex_helper(typename FROM::IndexValueType const val) | |
|
|
||
| } // namespace internal | ||
|
|
||
| namespace concepts | ||
| { | ||
| // Should we try to move this to either util/concepts.hpp | ||
| // or pattern/concepts.hpp? | ||
| template<typename T> | ||
| concept IndexValued = std::is_base_of_v< | ||
| RAJA::IndexValue<std::remove_cvref_t<T>, | ||
| typename std::remove_cvref_t<T>::value_type>, | ||
|
Comment on lines
+315
to
+316
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Do we have any concern about using |
||
| std::remove_cvref_t<T>>; | ||
|
|
||
|
|
||
| } // namespace concepts | ||
|
|
||
| namespace type_traits | ||
| { | ||
| template<typename T> | ||
| struct is_instance_of_index_value | ||
| : std::is_base_of<RAJA::IndexValue<std::remove_cvref_t<T>>, | ||
| std::remove_cvref_t<T>> | ||
| : std::bool_constant<RAJA::concepts::IndexValued<T>> | ||
| {}; | ||
|
|
||
| template<typename T> | ||
| constexpr bool is_instance_of_index_value_v = | ||
| inline constexpr bool is_instance_of_index_value_v = | ||
| is_instance_of_index_value<T>::value; | ||
|
|
||
| } // namespace type_traits | ||
|
|
||
| namespace concepts | ||
| template<concepts::IndexValued TYPE> | ||
| RAJA_HOST_DEVICE RAJA_INLINE TYPE operator+(typename TYPE::value_type lhs, | ||
| TYPE rhs) | ||
| { | ||
| template<typename T> | ||
| concept IndexValued = type_traits::is_instance_of_index_value_v<T>; | ||
| return TYPE(lhs + *rhs); | ||
| } | ||
|
|
||
| template<concepts::IndexValued TYPE> | ||
| RAJA_HOST_DEVICE RAJA_INLINE TYPE operator-(typename TYPE::value_type lhs, | ||
| TYPE rhs) | ||
| { | ||
| return TYPE(lhs - *rhs); | ||
| } | ||
|
|
||
| template<concepts::IndexValued TYPE> | ||
| RAJA_HOST_DEVICE RAJA_INLINE TYPE operator*(typename TYPE::value_type lhs, | ||
| TYPE rhs) | ||
| { | ||
| return TYPE(lhs * *rhs); | ||
| } | ||
|
|
||
| template<concepts::IndexValued TYPE> | ||
| RAJA_HOST_DEVICE RAJA_INLINE TYPE operator/(typename TYPE::value_type lhs, | ||
| TYPE rhs) | ||
| { | ||
| return TYPE(lhs / *rhs); | ||
| } | ||
|
|
||
| template<concepts::IndexValued TYPE> | ||
| RAJA_HOST_DEVICE RAJA_INLINE TYPE operator%(typename TYPE::value_type lhs, | ||
| TYPE rhs) | ||
| { | ||
| return TYPE(lhs % *rhs); | ||
| } | ||
|
|
||
| template<concepts::IndexValued TYPE> | ||
| RAJA_HOST_DEVICE RAJA_INLINE bool operator<(typename TYPE::value_type lhs, | ||
| TYPE rhs) | ||
| { | ||
| return lhs < *rhs; | ||
| } | ||
|
|
||
| template<concepts::IndexValued TYPE> | ||
| RAJA_HOST_DEVICE RAJA_INLINE bool operator<=(typename TYPE::value_type lhs, | ||
| TYPE rhs) | ||
| { | ||
| return lhs <= *rhs; | ||
| } | ||
|
|
||
| template<concepts::IndexValued TYPE> | ||
| RAJA_HOST_DEVICE RAJA_INLINE bool operator>(typename TYPE::value_type lhs, | ||
| TYPE rhs) | ||
| { | ||
| return lhs > *rhs; | ||
| } | ||
|
|
||
| template<concepts::IndexValued TYPE> | ||
| RAJA_HOST_DEVICE RAJA_INLINE bool operator>=(typename TYPE::value_type lhs, | ||
| TYPE rhs) | ||
| { | ||
| return lhs >= *rhs; | ||
| } | ||
|
|
||
| template<concepts::IndexValued TYPE> | ||
| RAJA_HOST_DEVICE RAJA_INLINE bool operator==(typename TYPE::value_type lhs, | ||
| TYPE rhs) | ||
| { | ||
| return lhs == *rhs; | ||
| } | ||
|
|
||
| template<concepts::IndexValued TYPE> | ||
| RAJA_HOST_DEVICE RAJA_INLINE bool operator!=(typename TYPE::value_type lhs, | ||
| TYPE rhs) | ||
| { | ||
| return lhs != *rhs; | ||
| } | ||
|
|
||
| /*! | ||
|
|
@@ -404,9 +494,12 @@ using make_signed_t = | |
| #define RAJA_INDEX_VALUE(TYPE, NAME) \ | ||
| class TYPE : public ::RAJA::IndexValue<TYPE> \ | ||
| { \ | ||
| using parent = ::RAJA::IndexValue<TYPE>; \ | ||
| \ | ||
| public: \ | ||
| using parent = ::RAJA::IndexValue<TYPE>; \ | ||
| using parent::operator=; \ | ||
| using parent::operator*; \ | ||
| using parent::operator++; \ | ||
| using parent::operator--; \ | ||
| using IndexValueType = TYPE; \ | ||
| RAJA_HOST_DEVICE RAJA_INLINE TYPE() : parent::IndexValue() {} \ | ||
| RAJA_HOST_DEVICE RAJA_INLINE explicit TYPE(::RAJA::Index_type v) \ | ||
|
|
@@ -425,6 +518,11 @@ using make_signed_t = | |
| class TYPE : public ::RAJA::IndexValue<TYPE, IDXT> \ | ||
| { \ | ||
| public: \ | ||
| using parent = RAJA::IndexValue<TYPE, IDXT>; \ | ||
| using parent::operator=; \ | ||
| using parent::operator*; \ | ||
| using parent::operator++; \ | ||
| using parent::operator--; \ | ||
| RAJA_HOST_DEVICE RAJA_INLINE TYPE() \ | ||
| : RAJA::IndexValue<TYPE, IDXT>::IndexValue() \ | ||
| {} \ | ||
|
|
||
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
Oops, something went wrong.
Oops, something went wrong.
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.
Do we want to be able to easily assign to a strongly typed index?