@@ -209,16 +209,22 @@ void TrackerTraitsGPU<NLayers>::computeLayerCells(const int iteration)
209209 this ->mTrkParams [iteration].LayerxX0 ,
210210 mTimeFrameGPU ->getStreams ());
211211 }
212+ mTimeFrameGPU ->syncStreams (false );
212213}
213214
214215template <int NLayers>
215216void TrackerTraitsGPU<NLayers>::findCellsNeighbours(const int iteration)
216217{
217218 for (int iLayer{0 }; iLayer < this ->mTrkParams [iteration].NeighboursPerRoad (); ++iLayer) {
219+ if (iLayer > 0 ) {
220+ // Previous layer updates levels in this layer's cells.
221+ mTimeFrameGPU ->waitEvent (iLayer, iLayer - 1 );
222+ }
218223 const int currentLayerCellsNum{static_cast <int >(mTimeFrameGPU ->getNCells ()[iLayer])};
219224 const int nextLayerCellsNum{static_cast <int >(mTimeFrameGPU ->getNCells ()[iLayer + 1 ])};
220225 if (!nextLayerCellsNum || !currentLayerCellsNum) {
221226 mTimeFrameGPU ->getNNeighbours ()[iLayer] = 0 ;
227+ mTimeFrameGPU ->recordEvent (iLayer);
222228 continue ;
223229 }
224230 mTimeFrameGPU ->createNeighboursIndexTablesDevice (iLayer);
@@ -239,6 +245,7 @@ void TrackerTraitsGPU<NLayers>::findCellsNeighbours(const int iteration)
239245 mTimeFrameGPU ->getStream (iLayer));
240246 mTimeFrameGPU ->createNeighboursDevice (iLayer);
241247 if (mTimeFrameGPU ->getNNeighbours ()[iLayer] == 0 ) {
248+ mTimeFrameGPU ->recordEvent (iLayer);
242249 continue ;
243250 }
244251 computeCellNeighboursHandler<NLayers>(mTimeFrameGPU ->getDeviceArrayCells (),
@@ -259,6 +266,7 @@ void TrackerTraitsGPU<NLayers>::findCellsNeighbours(const int iteration)
259266 mTimeFrameGPU ->getArrayNNeighbours ()[iLayer],
260267 mTimeFrameGPU ->getStream (iLayer),
261268 mTimeFrameGPU ->getFrameworkAllocator ());
269+ mTimeFrameGPU ->recordEvent (iLayer);
262270 }
263271 mTimeFrameGPU ->syncStreams (false );
264272}
0 commit comments