Conversation
|
Hi @llnl/raja-core I've pushed up the discussed changes. |
Co-authored-by: Jason Burmark <MrBurmark@users.noreply.github.com>
| ``RAJA::TypedRangeStrideSegment``. | ||
| * When one of the bounds is a RAJA strong index type, such as a type created | ||
| with ``RAJA_INDEX_VALUE``, that strong type is preserved for the loop | ||
| variable when possible. |
There was a problem hiding this comment.
When possible? Doesn't it always use the strong type if one is provided?
The only case I'm worried about is something like a strong index type with underlying type int combined with a long choosing long instead of being an error.
| with ``RAJA_INDEX_VALUE``, that strong type is preserved for the loop | ||
| variable when possible. | ||
| * Providing an explicit template argument, such as | ||
| ``RAJA::range<MyIndex>(end)``, overrides the deduced storage type. |
There was a problem hiding this comment.
It should still be an error to, for example, explicitly ask for int but provide a strong index type as an argument, or explicitly ask for a strong index type and provide a different strong index type as an argument.
There was a problem hiding this comment.
I wonder if we can use c++20's require to test that these cases fail?
There was a problem hiding this comment.
You definitely can, you could even make concepts to make it easier most likely.
|
I played with making a range type that could have any of begin, end, and stride be runtime or compile time constants. Is that something that you are interested in @artv3. Right now you construct the range in the lambda so the compiler knows that begin is a constant 0, but if you constructed the range outside of the lambda and captured it then the compiler would not know that begin is a constant. If you had a range type that could have any of the parameters be constant or runtime could fix that. |
Yes absolutely! We are always stronger when we combine our ideas! @rhornung67, @MrBurmark could this be something we carve out time to discuss at the next RAJA meeting? |
Here is a basic prototype without support for things like strongly typed indices. https://godbolt.org/z/o4zdcEEdT |
#Summary
Many of my loops start at zero, this gives users a shortcut to generate the desired range segment.