Skip to content

Commit f2c04e4

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 4838938 commit f2c04e4

1 file changed

Lines changed: 27 additions & 5 deletions

File tree

‎GPU/GPUTracking/Merger/GPUTPCGMMerger.cxx‎

Lines changed: 27 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1201,6 +1201,7 @@ GPUd() void GPUTPCGMMerger::ResolveMergeSectors(GPUResolveSharedMemory& smem, in
12011201
// PrintMergeGraph(track1, std::cout);
12021202
// PrintMergeGraph(track2, std::cout);
12031203

1204+
bool nextTrack = false;
12041205
while (track2->PrevSegmentNeighbour() >= 0) {
12051206
track2 = &mSectorTrackInfos[track2->PrevSegmentNeighbour()];
12061207
}
@@ -1211,26 +1212,41 @@ GPUd() void GPUTPCGMMerger::ResolveMergeSectors(GPUResolveSharedMemory& smem, in
12111212
while (track1->PrevSegmentNeighbour() >= 0) {
12121213
track1 = &mSectorTrackInfos[track1->PrevSegmentNeighbour()];
12131214
if (track1 == track2) {
1214-
goto NextTrack;
1215+
nextTrack = true;
1216+
break;
12151217
}
12161218
}
1219+
if (nextTrack) {
1220+
continue;
1221+
}
12171222
GPUCommonAlgorithm::swap(track1, track1Base);
12181223
for (int32_t k = 0; k < 2; k++) {
12191224
GPUTPCGMSectorTrack* tmp = track1Base;
12201225
while (tmp->Neighbour(k) >= 0) {
12211226
tmp = &mSectorTrackInfos[tmp->Neighbour(k)];
12221227
if (tmp == track2) {
1223-
goto NextTrack;
1228+
nextTrack = true;
1229+
break;
12241230
}
12251231
}
1232+
if (nextTrack) {
1233+
break;
1234+
}
1235+
}
1236+
if (nextTrack) {
1237+
continue;
12261238
}
12271239

12281240
while (track1->NextSegmentNeighbour() >= 0) {
12291241
track1 = &mSectorTrackInfos[track1->NextSegmentNeighbour()];
12301242
if (track1 == track2) {
1231-
goto NextTrack;
1243+
nextTrack = true;
1244+
break;
12321245
}
12331246
}
1247+
if (nextTrack) {
1248+
continue;
1249+
}
12341250
} else {
12351251
while (track1->PrevSegmentNeighbour() >= 0) {
12361252
track1 = &mSectorTrackInfos[track1->PrevSegmentNeighbour()];
@@ -1244,9 +1260,16 @@ GPUd() void GPUTPCGMMerger::ResolveMergeSectors(GPUResolveSharedMemory& smem, in
12441260
while (tmp->Neighbour(k) >= 0) {
12451261
tmp = &mSectorTrackInfos[tmp->Neighbour(k)];
12461262
if (tmp == track2) {
1247-
goto NextTrack;
1263+
nextTrack = true;
1264+
break;
12481265
}
12491266
}
1267+
if (nextTrack) {
1268+
break;
1269+
}
1270+
}
1271+
if (nextTrack) {
1272+
continue;
12501273
}
12511274

12521275
float z1min, z1max, z2min, z2max;
@@ -1318,7 +1341,6 @@ GPUd() void GPUTPCGMMerger::ResolveMergeSectors(GPUResolveSharedMemory& smem, in
13181341
}
13191342
// GPUInfo("Result");
13201343
// PrintMergeGraph(track1, std::cout);
1321-
NextTrack:;
13221344
}
13231345
}
13241346
}

0 commit comments

Comments
 (0)