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

Improve the SoA accessors and optimisations [12.5.x] #40087

Merged
merged 5 commits into from
Nov 17, 2022
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
Update the SoA tests to check the fields' address
Update the SoA tests to check the various ways of taking the address of
a column, scalar, or Eigen column fields.
  • Loading branch information
fwyzard committed Oct 28, 2022
commit 50cbaadbaecf3c51277c98ee3704a5afc3bfdf27
19 changes: 19 additions & 0 deletions HeterogeneousCore/AlpakaTest/plugins/TestAlpakaAnalyzer.cc
Original file line number Diff line number Diff line change
@@ -88,6 +88,25 @@ class TestAlpakaAnalyzer : public edm::stream::EDAnalyzer<> {
reinterpret_cast<intptr_t>(view.metadata().addressOf_r());
}

assert(view.metadata().addressOf_x() == view.x());
assert(view.metadata().addressOf_x() == &view.x(0));
assert(view.metadata().addressOf_x() == &view[0].x());
assert(view.metadata().addressOf_y() == view.y());
assert(view.metadata().addressOf_y() == &view.y(0));
assert(view.metadata().addressOf_y() == &view[0].y());
assert(view.metadata().addressOf_z() == view.z());
assert(view.metadata().addressOf_z() == &view.z(0));
assert(view.metadata().addressOf_z() == &view[0].z());
assert(view.metadata().addressOf_id() == view.id());
assert(view.metadata().addressOf_id() == &view.id(0));
assert(view.metadata().addressOf_id() == &view[0].id());
assert(view.metadata().addressOf_m() == view.m());
//assert(view.metadata().addressOf_m() == &view.m(0).coeffRef(0,0)); // view.m(0) does not seem to be supported for Eigen columns ?
assert(view.metadata().addressOf_m() == &view[0].m().coeffRef(0, 0));
assert(view.metadata().addressOf_r() == &view.r());
//assert(view.metadata().addressOf_r() == &view.r(0)); // cannot access a scalar with an index
//assert(view.metadata().addressOf_r() == &view[0].r()); // cannot access a scalar via a SoA row-like accessor

const portabletest::Matrix matrix{{1, 2, 3, 4, 5, 6}, {2, 4, 6, 8, 10, 12}, {3, 6, 9, 12, 15, 18}};
assert(view.r() == 1.);
for (int32_t i = 0; i < view.metadata().size(); ++i) {