Forum Discussion
kkvasan
New Contributor
4 years agoHi Yohann,
Yes, Using pipes for Kernel to Kernel communication makes life easier.
It seams tweaking code with little bit extra global memory helps to avoid stalling by pipe read and write.
template <int idx1, int idx2> int g_read_write(const rAcc &ptrR1, const wAcc &ptrW1, int total_itr, int delay){ [[intel::ivdep]] [[intel::initiation_interval(1)]] for(int i = 0; i < total_itr+delay; i++){ struct dPath16 vec1 = ptrR1[i+delay]; if(i < total_itr){ pipeS::PipeAt<idx1>::write(vec1); } struct dPath16 vecW1; // = pipeS::PipeAt<idx2>::read(); if(i >= delay){ vecW1 = pipeS::PipeAt<idx2>::read();; } ptrW1[i] = vecW1; //vecW1;; } return 0; }
By having a required depth for pipes and delay value, we can avoid stalling due to pipe read and write. it will cost delay*sizeof(dPath16) byes of additional global memory at the beginning of buffer.
this function can be called inside the iterative loop.
Many Thanks,
Vasan