@@ -216,10 +216,15 @@ template <int NLayers>
216216void TrackerTraitsGPU<NLayers>::findCellsNeighbours(const int iteration)
217217{
218218 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+ }
219223 const int currentLayerCellsNum{static_cast <int >(mTimeFrameGPU ->getNCells ()[iLayer])};
220224 const int nextLayerCellsNum{static_cast <int >(mTimeFrameGPU ->getNCells ()[iLayer + 1 ])};
221225 if (!nextLayerCellsNum || !currentLayerCellsNum) {
222226 mTimeFrameGPU ->getNNeighbours ()[iLayer] = 0 ;
227+ mTimeFrameGPU ->recordEvent (iLayer);
223228 continue ;
224229 }
225230 mTimeFrameGPU ->createNeighboursIndexTablesDevice (iLayer);
@@ -240,6 +245,7 @@ void TrackerTraitsGPU<NLayers>::findCellsNeighbours(const int iteration)
240245 mTimeFrameGPU ->getStream (iLayer));
241246 mTimeFrameGPU ->createNeighboursDevice (iLayer);
242247 if (mTimeFrameGPU ->getNNeighbours ()[iLayer] == 0 ) {
248+ mTimeFrameGPU ->recordEvent (iLayer);
243249 continue ;
244250 }
245251 computeCellNeighboursHandler<NLayers>(mTimeFrameGPU ->getDeviceArrayCells (),
@@ -260,6 +266,7 @@ void TrackerTraitsGPU<NLayers>::findCellsNeighbours(const int iteration)
260266 mTimeFrameGPU ->getArrayNNeighbours ()[iLayer],
261267 mTimeFrameGPU ->getStream (iLayer),
262268 mTimeFrameGPU ->getFrameworkAllocator ());
269+ mTimeFrameGPU ->recordEvent (iLayer);
263270 }
264271 mTimeFrameGPU ->syncStreams (false );
265272}
0 commit comments