1
0
mirror of https://github.com/paboyle/Grid.git synced 2024-11-13 01:05:36 +00:00

Coalesced loops

This commit is contained in:
Peter Boyle 2019-06-15 08:01:39 +01:00
parent f3c89df948
commit 7f99e1cd3b

View File

@ -43,8 +43,8 @@ inline auto trace(const Lattice<vobj> &lhs) -> Lattice<decltype(trace(vobj()))>
Lattice<decltype(trace(vobj()))> ret(lhs.Grid()); Lattice<decltype(trace(vobj()))> ret(lhs.Grid());
auto ret_v = ret.View(); auto ret_v = ret.View();
auto lhs_v = lhs.View(); auto lhs_v = lhs.View();
accelerator_loop( ss, lhs_v, { accelerator_for( ss, lhs_v.size(), vobj::Nsimd(), {
ret_v[ss] = trace(lhs_v[ss]); coalescedWrite(ret_v[ss], trace(lhs_v(ss)));
}); });
return ret; return ret;
}; };
@ -58,8 +58,8 @@ inline auto TraceIndex(const Lattice<vobj> &lhs) -> Lattice<decltype(traceIndex<
Lattice<decltype(traceIndex<Index>(vobj()))> ret(lhs.Grid()); Lattice<decltype(traceIndex<Index>(vobj()))> ret(lhs.Grid());
auto ret_v = ret.View(); auto ret_v = ret.View();
auto lhs_v = lhs.View(); auto lhs_v = lhs.View();
accelerator_loop( ss, lhs_v, { accelerator_for( ss, lhs_v.size(), vobj::Nsimd(), {
ret_v[ss] = traceIndex<Index>(lhs_v[ss]); coalescedWrite(ret_v[ss], traceIndex<Index>(lhs_v(ss)));
}); });
return ret; return ret;
}; };