Skip to content

Commit cf38ef2

Browse files
committed
GPU TPC: Deterministic (and faster since not relying on atomics) linking of extrapolated track segments
1 parent 8494996 commit cf38ef2

File tree

2 files changed

+6
-7
lines changed

2 files changed

+6
-7
lines changed

GPU/GPUTracking/Merger/GPUTPCGMMerger.cxx

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -581,7 +581,7 @@ GPUd() void GPUTPCGMMerger::UnpackSectorGlobal(int32_t nBlocks, int32_t nThreads
581581
uint32_t nTracks = *trk.NTracks();
582582
for (uint32_t itr = nLocalTracks + iBlock * nThreads + iThread; itr < nTracks; itr += nBlocks * nThreads) {
583583
sectorTr = &trk.Tracks()[itr];
584-
int32_t localId = mTrackIDs[(sectorTr->LocalTrackId() >> 24) * mNMaxSingleSectorTracks + (sectorTr->LocalTrackId() & 0xFFFFFF)];
584+
int32_t localId = mTrackIDs[((sectorTr->LocalTrackId() >> 24) & 0x3F) * mNMaxSingleSectorTracks + (sectorTr->LocalTrackId() & 0xFFFFFF)];
585585
if (localId == -1) {
586586
continue;
587587
}
@@ -594,7 +594,7 @@ GPUd() void GPUTPCGMMerger::UnpackSectorGlobal(int32_t nBlocks, int32_t nThreads
594594
track.SetNextNeighbour(-1);
595595
track.SetNextSegmentNeighbour(-1);
596596
track.SetPrevSegmentNeighbour(-1);
597-
track.SetLocalTrackId(localId);
597+
track.SetLocalTrackId(localId | (sectorTr->LocalTrackId() & 0x40000000));
598598
}
599599
}
600600

@@ -643,10 +643,9 @@ GPUd() void GPUTPCGMMerger::LinkExtrapolatedTracks(int32_t nBlocks, int32_t nThr
643643
{
644644
for (int32_t itr = SectorTrackInfoGlobalFirst(0) + iBlock * nThreads + iThread; itr < SectorTrackInfoGlobalLast(NSECTORS - 1); itr += nThreads * nBlocks) {
645645
GPUTPCGMSectorTrack& extrapolatedTrack = mSectorTrackInfos[itr];
646-
GPUTPCGMSectorTrack& localTrack = mSectorTrackInfos[extrapolatedTrack.LocalTrackId()];
647-
if (localTrack.ExtrapolatedTrackId(0) != -1 || !CAMath::AtomicCAS(&localTrack.ExtrapolatedTrackIds()[0], -1, itr)) {
648-
localTrack.SetExtrapolatedTrackId(1, itr);
649-
}
646+
GPUTPCGMSectorTrack& localTrack = mSectorTrackInfos[extrapolatedTrack.LocalTrackId() & 0xFFFFFF];
647+
int up = (extrapolatedTrack.LocalTrackId() & 0x40000000) ? 1 : 0;
648+
localTrack.SetExtrapolatedTrackId(up, itr);
650649
}
651650
}
652651

GPU/GPUTracking/SectorTracker/GPUTPCExtrapolationTracking.cxx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -112,7 +112,7 @@ GPUd() int32_t GPUTPCExtrapolationTracking::PerformExtrapolationTrackingRun(GPUT
112112
track.SetParam(tParam.GetParam());
113113
track.SetNHits(nHits);
114114
track.SetFirstHitID(hitId);
115-
track.SetLocalTrackId((sectorSource.ISector() << 24) | sectorSource.Tracks()[iTrack].LocalTrackId());
115+
track.SetLocalTrackId((direction == 1 ? 0x40000000 : 0) | (sectorSource.ISector() << 24) | sectorSource.Tracks()[iTrack].LocalTrackId());
116116
}
117117

118118
return (nHits >= tracker.Param().rec.tpc.extrapolationTrackingMinHits);

0 commit comments

Comments
 (0)