1
0
mirror of https://github.com/paboyle/Grid.git synced 2024-11-10 07:55:35 +00:00

Make referencign the stencil and all info required to evaluate the kernel

accelerator marked up
This commit is contained in:
paboyle 2018-02-02 11:37:13 +00:00
parent ede0dff794
commit 51eb2c5dfc

View File

@ -145,13 +145,15 @@ protected:
GridBase * _grid; GridBase * _grid;
public: public:
GridBase *Grid(void) const { return _grid; } GridBase *Grid(void) const { return _grid; }
// npoints of these // npoints of these; make it a template param and std::array
std::vector<int> _directions; std::vector<int> _directions;
std::vector<int> _distances; std::vector<int> _distances;
std::vector<int> _comm_buf_size; std::vector<int> _comm_buf_size;
std::vector<int> _permute_type; std::vector<int> _permute_type;
std::vector<int> _simd_layout;
Vector<StencilEntry> _entries; Vector<StencilEntry> _entries; // Resident in managed memory
StencilEntry* _entries_p;
std::vector<Packet> Packets; std::vector<Packet> Packets;
std::vector<Merge> Mergers; std::vector<Merge> Mergers;
std::vector<Merge> MergersSHM; std::vector<Merge> MergersSHM;
@ -227,30 +229,30 @@ public:
return 1; return 1;
} }
inline int GetNodeLocal(int osite,int point) { accelerator_inline int GetNodeLocal(int osite,int point) {
return _entries[point+_npoints*osite]._is_local; return _entries_p[point+_npoints*osite]._is_local;
} }
inline StencilEntry * GetEntry(int &ptype,int point,int osite) { accelerator_inline StencilEntry * GetEntry(int &ptype,int point,int osite) {
ptype = _permute_type[point]; return & _entries[point+_npoints*osite]; ptype = _permute_type[point]; return & _entries_p[point+_npoints*osite];
} }
inline uint64_t GetInfo(int &ptype,int &local,int &perm,int point,int ent,uint64_t base) { accelerator_inline uint64_t GetInfo(int &ptype,int &local,int &perm,int point,int ent,uint64_t base) {
uint64_t cbase = (uint64_t)&u_recv_buf_p[0]; uint64_t cbase = (uint64_t)&u_recv_buf_p[0];
local = _entries[ent]._is_local; local = _entries_p[ent]._is_local;
perm = _entries[ent]._permute; perm = _entries_p[ent]._permute;
if (perm) ptype = _permute_type[point]; if (perm) ptype = _permute_type[point];
if (local) { if (local) {
return base + _entries[ent]._byte_offset; return base + _entries_p[ent]._byte_offset;
} else { } else {
return cbase + _entries[ent]._byte_offset; return cbase + _entries_p[ent]._byte_offset;
} }
} }
inline uint64_t GetPFInfo(int ent,uint64_t base) { accelerator_inline uint64_t GetPFInfo(int ent,uint64_t base) {
uint64_t cbase = (uint64_t)&u_recv_buf_p[0]; uint64_t cbase = (uint64_t)&u_recv_buf_p[0];
int local = _entries[ent]._is_local; int local = _entries_p[ent]._is_local;
if (local) return base + _entries[ent]._byte_offset; if (local) return base + _entries_p[ent]._byte_offset;
else return cbase + _entries[ent]._byte_offset; else return cbase + _entries_p[ent]._byte_offset;
} }
////////////////////////////////////////// //////////////////////////////////////////
@ -550,10 +552,12 @@ public:
_directions = directions; _directions = directions;
_distances = distances; _distances = distances;
_unified_buffer_size=0; _unified_buffer_size=0;
_simd_layout = _grid->_simd_layout; // copy simd_layout to give access to Accelerator Kernels
int osites = _grid->oSites(); int osites = _grid->oSites();
_entries.resize(_npoints* osites); _entries.resize(_npoints* osites);
_entries_p = &_entries[0];
for(int ii=0;ii<npoints;ii++){ for(int ii=0;ii<npoints;ii++){
int i = ii; // reverse direction to get SIMD comms done first int i = ii; // reverse direction to get SIMD comms done first