Skip to content
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

Reshape method #1760

Merged
merged 44 commits into from
Mar 11, 2025
Merged
Changes from 1 commit
Commits
Show all changes
44 commits
Select commit Hold shift + click to select a range
726da15
reshape methods
artv3 Nov 5, 2024
119cc95
Merge branch 'develop' into artv3/reshape
artv3 Dec 12, 2024
e105bae
Merge branch 'develop' into artv3/reshape
artv3 Dec 23, 2024
78d32b3
add alias for view type
artv3 Dec 23, 2024
9807f31
compile time reverse array
artv3 Dec 23, 2024
28e714d
review reshape example
artv3 Dec 23, 2024
fc1f6a8
clean up pass
artv3 Dec 23, 2024
4d05ea5
clean up reshape example
artv3 Dec 23, 2024
b0a836a
push up version that takes index_seq
artv3 Dec 23, 2024
a1a254d
fix bug with custom layout
artv3 Dec 26, 2024
a691f40
clean up based on pr comments
artv3 Dec 26, 2024
cf3ff8c
Update include/RAJA/util/View.hpp
artv3 Dec 26, 2024
7ddbdb1
fix inside function call
artv3 Dec 26, 2024
c33e1d1
merge develop + fix conflict
artv3 Jan 16, 2025
d09d6e0
make style
artv3 Jan 17, 2025
a9a9119
Merge branch 'develop' into artv3/reshape
rhornung67 Feb 20, 2025
fb46fec
Merge branch 'develop' into artv3/reshape
artv3 Mar 5, 2025
c2afb99
add docs
artv3 Mar 5, 2025
94cf153
clean up pass
artv3 Mar 5, 2025
a1534f3
fix spelling
artv3 Mar 5, 2025
41c4b0c
PR comments
artv3 Mar 5, 2025
0b98518
Update docs/sphinx/user_guide/feature/view.rst
artv3 Mar 5, 2025
a317bd5
Update docs/sphinx/user_guide/feature/view.rst
artv3 Mar 5, 2025
6dbbc9c
Update docs/sphinx/user_guide/feature/view.rst
artv3 Mar 5, 2025
5f39b64
Update docs/sphinx/user_guide/feature/view.rst
artv3 Mar 5, 2025
928bd1d
remove unused code
artv3 Mar 5, 2025
163f91c
clean up pass
artv3 Mar 5, 2025
1d3fd1d
clean up pass
artv3 Mar 5, 2025
d316505
another pass
artv3 Mar 5, 2025
fe98d65
clean up pass
artv3 Mar 6, 2025
94014d2
switch reference location
artv3 Mar 6, 2025
93c37c8
fix reference
artv3 Mar 6, 2025
1c39a2d
clean up pass
artv3 Mar 6, 2025
14cfa78
clean up pass
artv3 Mar 6, 2025
d91216c
add missing deallocation
artv3 Mar 6, 2025
48a4d77
make permuted view rename
artv3 Mar 10, 2025
b54c2a9
update docs
artv3 Mar 10, 2025
a86f802
update internal usage definitions
artv3 Mar 10, 2025
61cabd1
make style
artv3 Mar 10, 2025
d09d868
Reshape->PermutedViewHelper
artv3 Mar 10, 2025
3a44a92
clean up pass
artv3 Mar 11, 2025
6f318bb
make style
artv3 Mar 11, 2025
8e41928
clean up pass
artv3 Mar 11, 2025
89b3f19
clean up make reverse array
artv3 Mar 11, 2025
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
clean up pass
artv3 committed Mar 11, 2025
commit 8e4192800f5bf615b90c2edd8e2ce52ad4a40b4a
23 changes: 10 additions & 13 deletions include/RAJA/util/View.hpp
Original file line number Diff line number Diff line change
@@ -307,13 +307,13 @@ template<std::size_t... stride_order_idx>
struct PermutedViewHelper<std::index_sequence<stride_order_idx...>>
{
template<typename IndexType, typename T, typename... Extents>
static auto get(T* ptr, Extents... extents)
static auto get(T* ptr, Extents&&... extents)
{
constexpr int N = sizeof...(Extents);
std::array<RAJA::idx_t, N> extent_arr {extents...};

auto custom_layout = RAJA::make_permuted_layout(
extent_arr, std::array<RAJA::idx_t, N> {stride_order_idx...});
std::array<RAJA::idx_t, N> {std::forward<Extents>(extents)...},
std::array<RAJA::idx_t, N> {stride_order_idx...});

constexpr auto unit_stride = detail::get_last_index(stride_order_idx...);
using view_t = RAJA::View<T, RAJA::Layout<N, IndexType, unit_stride>>;
@@ -326,12 +326,12 @@ template<>
struct PermutedViewHelper<layout_right>
{
template<typename IndexType, typename T, typename... Extents>
static auto get(T* ptr, Extents... extends)
static auto get(T* ptr, Extents&&... extents)
{
constexpr int N = sizeof...(Extents);
using view_t = RAJA::View<T, RAJA::Layout<N, IndexType, N - 1>>;

return view_t(ptr, extends...);
return view_t(ptr, std::forward<Extents>(extents)...);
}
};

@@ -347,17 +347,14 @@ template<>
struct PermutedViewHelper<layout_left>
{
template<typename IndexType, typename T, typename... Extents>
static auto get(T* ptr, Extents... extends)
static auto get(T* ptr, Extents&&... extents)
{
constexpr int N = sizeof...(Extents);

std::array<RAJA::idx_t, N> extent_arr {extends...};

constexpr auto reverse_array =
detail::make_reverse_array(std::make_index_sequence<N> {});

auto reverse_layout = RAJA::make_permuted_layout(extent_arr, reverse_array);
using view_t = RAJA::View<T, RAJA::Layout<N, IndexType, 0U>>;
auto reverse_layout = RAJA::make_permuted_layout(
std::array<RAJA::idx_t, N> {std::forward<Extents>(extents)...},
make_reverse_array(std::make_index_sequence<N> {}));
using view_t = RAJA::View<T, RAJA::Layout<N, IndexType, 0U>>;

return view_t(ptr, reverse_layout);
}