Skip to content

Commit 32cd543

Browse files
committed
GPUTracking: replace the merger's goto with a flag
MSL supports neither goto nor labels. The label sat at the end of the loop body, so each jump was a continue for the outer loop that could not be written as one because it was issued from an inner loop. The flag is set there instead, breaks out of the loop it was raised in, and continues the outer one; where the jump came from two levels down it breaks twice. The k loop is left early exactly as before, and nothing between the old jumps and the old label ran then either.
1 parent 27f5bda commit 32cd543

1 file changed

Lines changed: 29 additions & 7 deletions

File tree

‎GPU/GPUTracking/Merger/GPUTPCGMMerger.cxx‎

Lines changed: 29 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -554,7 +554,7 @@ GPUd() int32_t GPUTPCGMMerger::RefitSectorTrack(GPUTPCGMSectorTrack& sectorTrack
554554
GPUTPCGMPropagator prop;
555555
prop.SetMaterialTPC();
556556
prop.SetMaxSinPhi(constants::MAX_SIN_PHI);
557-
prop.SetSeedingErrors(true); // Larger errors for seeds, better since we don't start with good hypothesis
557+
prop.SetSeedingErrors(true); // Larger errors for seeds, better since we don't start with good hypothesis
558558
prop.SetFitInProjections(true); // TODO: Was false, consider reenabling after fitInProjection is fixed
559559
prop.SetPolynomialField(&Param().polynomialField);
560560
GPUTPCGMTrackParam trk;
@@ -1202,6 +1202,7 @@ GPUd() void GPUTPCGMMerger::ResolveMergeSectors(GPUResolveSharedMemory& smem, in
12021202
// PrintMergeGraph(track1, std::cout);
12031203
// PrintMergeGraph(track2, std::cout);
12041204

1205+
bool nextTrack = false;
12051206
while (track2->PrevSegmentNeighbour() >= 0) {
12061207
track2 = &mSectorTrackInfos[track2->PrevSegmentNeighbour()];
12071208
}
@@ -1212,26 +1213,41 @@ GPUd() void GPUTPCGMMerger::ResolveMergeSectors(GPUResolveSharedMemory& smem, in
12121213
while (track1->PrevSegmentNeighbour() >= 0) {
12131214
track1 = &mSectorTrackInfos[track1->PrevSegmentNeighbour()];
12141215
if (track1 == track2) {
1215-
goto NextTrack;
1216+
nextTrack = true;
1217+
break;
12161218
}
12171219
}
1220+
if (nextTrack) {
1221+
continue;
1222+
}
12181223
GPUCommonAlgorithm::swap(track1, track1Base);
12191224
for (int32_t k = 0; k < 2; k++) {
12201225
GPUTPCGMSectorTrack* tmp = track1Base;
12211226
while (tmp->Neighbour(k) >= 0) {
12221227
tmp = &mSectorTrackInfos[tmp->Neighbour(k)];
12231228
if (tmp == track2) {
1224-
goto NextTrack;
1229+
nextTrack = true;
1230+
break;
12251231
}
12261232
}
1233+
if (nextTrack) {
1234+
break;
1235+
}
1236+
}
1237+
if (nextTrack) {
1238+
continue;
12271239
}
12281240

12291241
while (track1->NextSegmentNeighbour() >= 0) {
12301242
track1 = &mSectorTrackInfos[track1->NextSegmentNeighbour()];
12311243
if (track1 == track2) {
1232-
goto NextTrack;
1244+
nextTrack = true;
1245+
break;
12331246
}
12341247
}
1248+
if (nextTrack) {
1249+
continue;
1250+
}
12351251
} else {
12361252
while (track1->PrevSegmentNeighbour() >= 0) {
12371253
track1 = &mSectorTrackInfos[track1->PrevSegmentNeighbour()];
@@ -1245,9 +1261,16 @@ GPUd() void GPUTPCGMMerger::ResolveMergeSectors(GPUResolveSharedMemory& smem, in
12451261
while (tmp->Neighbour(k) >= 0) {
12461262
tmp = &mSectorTrackInfos[tmp->Neighbour(k)];
12471263
if (tmp == track2) {
1248-
goto NextTrack;
1264+
nextTrack = true;
1265+
break;
12491266
}
12501267
}
1268+
if (nextTrack) {
1269+
break;
1270+
}
1271+
}
1272+
if (nextTrack) {
1273+
continue;
12511274
}
12521275

12531276
float z1min, z1max, z2min, z2max;
@@ -1319,7 +1342,6 @@ GPUd() void GPUTPCGMMerger::ResolveMergeSectors(GPUResolveSharedMemory& smem, in
13191342
}
13201343
// GPUInfo("Result");
13211344
// PrintMergeGraph(track1, std::cout);
1322-
NextTrack:;
13231345
}
13241346
}
13251347
}
@@ -1851,7 +1873,7 @@ GPUd() void GPUTPCGMMerger::PrepareForFit1(int32_t nBlocks, int32_t nThreads, in
18511873
if (!trk.CCE() && !trk.MergedLooper()) {
18521874
GPUTPCGMMergedTrack* updTrk = trk.GetFirstSegment(mMergedTracks, Param().rec.enableCyclicGraphWorkarounds);
18531875
const auto &cl0 = mClusters[trk.FirstClusterRef()], &cln = mClusters[updTrk->FirstClusterRef() + updTrk->NClusters() - 1];
1854-
const auto& GPUrestrict() cls = GetConstantMem()->ioPtrs.clustersNative->clustersLinear;
1876+
const auto& GPUrestrict() cls = GetConstantMem() -> ioPtrs.clustersNative->clustersLinear;
18551877
float z0 = cls[cl0.num].getTime(), zn = cls[cln.num].getTime();
18561878
const auto tmp = zn > z0 ? std::array<float, 3>{zn, z0, GPUTPCGeometry::Row2X(cln.row)} : std::array<float, 3>{z0, zn, GPUTPCGeometry::Row2X(cl0.row)};
18571879
trk.Param().ShiftZ(this, cl0.sector, tmp[0], tmp[1], tmp[2]);

0 commit comments

Comments
 (0)