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

Introduce ldg_ptr to Enable __ldg in Data Stores and simple_ptr_holder #1802

Merged
merged 17 commits into from
Sep 24, 2024
Merged
Changes from 1 commit
Commits
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
Enable explicit LDG loads in fn neighbor tables
fthaler committed Aug 27, 2024
commit 6f4ac923c596d354ecb5a3598989ad87366f8d9f
3 changes: 2 additions & 1 deletion include/gridtools/fn/neighbor_table.hpp
Original file line number Diff line number Diff line change
@@ -11,6 +11,7 @@

#include <type_traits>

#include "../common/ldg_ptr.hpp"
#include "../common/tuple_util.hpp"
#include "../meta/logical.hpp"

@@ -56,7 +57,7 @@ namespace gridtools::fn::neighbor_table {

template <class T, std::enable_if_t<is_neighbor_list<T>::value, int> = 0>
GT_FUNCTION T const &neighbor_table_neighbors(T const *table, int index) {
return table[index];
return *as_ldg_ptr(&table[index]);
}

template <class NeighborTable>
3 changes: 2 additions & 1 deletion include/gridtools/fn/sid_neighbor_table.hpp
Original file line number Diff line number Diff line change
@@ -13,6 +13,7 @@
#include <type_traits>

#include "../common/array.hpp"
#include "../common/ldg_ptr.hpp"
#include "../fn/unstructured.hpp"
#include "../sid/concept.hpp"

@@ -46,7 +47,7 @@ namespace gridtools::fn::sid_neighbor_table {

sid::shift(ptr, sid::get_stride<IndexDimension>(table.strides), index);
for (std::size_t element_idx = 0; element_idx < MaxNumNeighbors; ++element_idx) {
neighbors[element_idx] = *ptr;
neighbors[element_idx] = *as_ldg_ptr(ptr);
sid::shift(ptr, sid::get_stride<NeighborDimension>(table.strides), 1_c);
}
return neighbors;