Skip to content

Commit c8ce55e

Browse files
committed
GPUTracking: rename the cluster finder's fragment to frag
fragment is a reserved word in MSL, where it qualifies a shader stage, so it cannot name a member, a parameter or a local. The cluster finder used it for all three, which was 35 of the errors left in the Metal compile. Purely a rename, in code positions only: the option descriptions in GPUSettingsList.h that mention fragments are strings and are untouched, as are the comments.
1 parent 1b3f1da commit c8ce55e

10 files changed

Lines changed: 96 additions & 96 deletions

‎GPU/GPUTracking/Global/GPUChainTracking.h‎

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -300,11 +300,11 @@ class GPUChainTracking : public GPUChain
300300
int32_t RunTPCTrackingSectors_internal();
301301
int32_t RunTPCClusterizer_prepare(bool restorePointers, const GPUTPCExtraADC& extraADCs);
302302
#ifndef GPUCA_RUN2
303-
std::pair<uint32_t, uint32_t> RunTPCClusterizer_transferZS(int32_t iSector, const CfFragment& fragment, int32_t lane, const GPUTPCExtraADC& extraADCs);
303+
std::pair<uint32_t, uint32_t> RunTPCClusterizer_transferZS(int32_t iSector, const CfFragment& frag, int32_t lane, const GPUTPCExtraADC& extraADCs);
304304
void RunTPCClusterizer_compactPeaks(GPUTPCClusterFinder& clusterer, GPUTPCClusterFinder& clustererShadow, int32_t stage, bool doGPU, int32_t lane);
305-
std::pair<uint32_t, uint32_t> TPCClusterizerDecodeZSCount(uint32_t iSector, const CfFragment& fragment);
306-
std::pair<uint32_t, uint32_t> TPCClusterizerDecodeZSCountUpdate(uint32_t iSector, const CfFragment& fragment);
307-
void TPCClusterizerEnsureZSOffsets(uint32_t iSector, const CfFragment& fragment);
305+
std::pair<uint32_t, uint32_t> TPCClusterizerDecodeZSCount(uint32_t iSector, const CfFragment& frag);
306+
std::pair<uint32_t, uint32_t> TPCClusterizerDecodeZSCountUpdate(uint32_t iSector, const CfFragment& frag);
307+
void TPCClusterizerEnsureZSOffsets(uint32_t iSector, const CfFragment& frag);
308308
void TPCClusterizerTransferExtraADC(GPUTPCClusterFinder& clusterer, GPUTPCClusterFinder& clustererShadow, int lane, const GPUTPCExtraADC& extraADCs);
309309
void TPCClusterizerCheckExtraADCZeros(GPUTPCClusterFinder& clusterer, GPUTPCClusterFinder& clustererShadow, int lane, const GPUTPCExtraADC& extraADCs);
310310
#endif

‎GPU/GPUTracking/Global/GPUChainTrackingClusterizer.cxx‎

Lines changed: 38 additions & 38 deletions
Large diffs are not rendered by default.

‎GPU/GPUTracking/TPCClusterFinder/GPUTPCCFChargeMapFiller.cxx‎

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -24,11 +24,11 @@ template <>
2424
GPUdii() void GPUTPCCFChargeMapFiller::Thread<GPUTPCCFChargeMapFiller::fillIndexMap>(int32_t nBlocks, int32_t nThreads, int32_t iBlock, int32_t iThread, GPUSharedMemory& smem, processorType& clusterer)
2525
{
2626
CfArray2D<uint32_t> indexMap(clusterer.mPindexMap);
27-
fillIndexMapImpl(nBlocks, nThreads, iBlock, iThread, clusterer.mPmemory->fragment, clusterer.mPdigits, indexMap, clusterer.mPmemory->counters.nDigitsInFragment);
27+
fillIndexMapImpl(nBlocks, nThreads, iBlock, iThread, clusterer.mPmemory->frag, clusterer.mPdigits, indexMap, clusterer.mPmemory->counters.nDigitsInFragment);
2828
}
2929

3030
GPUd() void GPUTPCCFChargeMapFiller::fillIndexMapImpl(int32_t nBlocks, int32_t nThreads, int32_t iBlock, int32_t iThread,
31-
const CfFragment& fragment,
31+
const CfFragment& frag,
3232
const tpc::Digit* digits,
3333
CfArray2D<uint32_t>& indexMap,
3434
size_t maxDigit)
@@ -37,20 +37,20 @@ GPUd() void GPUTPCCFChargeMapFiller::fillIndexMapImpl(int32_t nBlocks, int32_t n
3737
if (idx >= maxDigit) {
3838
return;
3939
}
40-
CPU_ONLY(idx += fragment.digitsStart);
40+
CPU_ONLY(idx += frag.digitsStart);
4141
CPU_ONLY(tpc::Digit digit = digits[idx]);
42-
CPU_ONLY(CfChargePos pos(digit.getRow(), digit.getPad(), fragment.toLocal(digit.getTimeStamp())));
42+
CPU_ONLY(CfChargePos pos(digit.getRow(), digit.getPad(), frag.toLocal(digit.getTimeStamp())));
4343
CPU_ONLY(indexMap.safeWrite(pos, idx));
4444
}
4545

4646
template <>
4747
GPUdii() void GPUTPCCFChargeMapFiller::Thread<GPUTPCCFChargeMapFiller::fillFromDigits>(int32_t nBlocks, int32_t nThreads, int32_t iBlock, int32_t iThread, GPUSharedMemory& smem, processorType& clusterer)
4848
{
4949
CfArray2D<PackedCharge> chargeMap(reinterpret_cast<PackedCharge*>(clusterer.mPchargeMap));
50-
fillFromDigitsImpl(nBlocks, nThreads, iBlock, iThread, clusterer, clusterer.mPmemory->fragment, clusterer.mPmemory->counters.nPositions, clusterer.mPdigits, clusterer.mPpositions, chargeMap);
50+
fillFromDigitsImpl(nBlocks, nThreads, iBlock, iThread, clusterer, clusterer.mPmemory->frag, clusterer.mPmemory->counters.nPositions, clusterer.mPdigits, clusterer.mPpositions, chargeMap);
5151
}
5252

53-
GPUd() void GPUTPCCFChargeMapFiller::fillFromDigitsImpl(int32_t nBlocks, int32_t nThreads, int32_t iBlock, int32_t iThread, processorType& clusterer, const CfFragment& fragment, size_t digitNum,
53+
GPUd() void GPUTPCCFChargeMapFiller::fillFromDigitsImpl(int32_t nBlocks, int32_t nThreads, int32_t iBlock, int32_t iThread, processorType& clusterer, const CfFragment& frag, size_t digitNum,
5454
const tpc::Digit* digits,
5555
CfChargePos* positions,
5656
CfArray2D<PackedCharge>& chargeMap)
@@ -59,9 +59,9 @@ GPUd() void GPUTPCCFChargeMapFiller::fillFromDigitsImpl(int32_t nBlocks, int32_t
5959
if (idx >= digitNum) {
6060
return;
6161
}
62-
tpc::Digit digit = digits[fragment.digitsStart + idx];
62+
tpc::Digit digit = digits[frag.digitsStart + idx];
6363

64-
CfChargePos pos(digit.getRow(), digit.getPad(), fragment.toLocal(digit.getTimeStamp()));
64+
CfChargePos pos(digit.getRow(), digit.getPad(), frag.toLocal(digit.getTimeStamp()));
6565
positions[idx] = pos;
6666
float q = digit.getChargeFloat();
6767
q *= clusterer.GetConstantMem()->calibObjects.tpcPadGain->getGainCorrection(clusterer.mISector, digit.getRow(), digit.getPad());
@@ -77,10 +77,10 @@ GPUdii() void GPUTPCCFChargeMapFiller::Thread<GPUTPCCFChargeMapFiller::findFragm
7777

7878
size_t nDigits = clusterer.mPmemory->counters.nDigits;
7979
const tpc::Digit* digits = clusterer.mPdigits;
80-
size_t st = findTransition(clusterer.mPmemory->fragment.first(), digits, nDigits, 0);
81-
size_t end = findTransition(clusterer.mPmemory->fragment.last(), digits, nDigits, st);
80+
size_t st = findTransition(clusterer.mPmemory->frag.first(), digits, nDigits, 0);
81+
size_t end = findTransition(clusterer.mPmemory->frag.last(), digits, nDigits, st);
8282

83-
clusterer.mPmemory->fragment.digitsStart = st;
83+
clusterer.mPmemory->frag.digitsStart = st;
8484

8585
size_t elems = end - st;
8686

‎GPU/GPUTracking/TPCClusterFinder/GPUTPCCFCheckPadBaseline.cxx‎

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -224,7 +224,7 @@ GPUd() void GPUTPCCFCheckPadBaseline::CheckBaselineGPU(int32_t nBlocks, int32_t
224224
return;
225225
}
226226

227-
const CfFragment& fragment = clusterer.mPmemory->fragment;
227+
const CfFragment& frag = clusterer.mPmemory->frag;
228228
const bool hipFilterOn = clusterer.Param().rec.tpc.hipTailFilter;
229229
const Charge hipTailThreshold = clusterer.Param().rec.tpc.hipTailFilterThreshold;
230230
const Charge hipTailFilterAlpha = clusterer.Param().rec.tpc.hipTailFilterAlpha;
@@ -253,7 +253,7 @@ GPUd() void GPUTPCCFCheckPadBaseline::CheckBaselineGPU(int32_t nBlocks, int32_t
253253
// saturated signal in overlap region can create tails in the next fragment
254254
// even when cleared in current fragment as they're decoded twice
255255
const TPCFragmentTime firstTB = 0;
256-
const TPCFragmentTime lastTB = fragment.length;
256+
const TPCFragmentTime lastTB = frag.length;
257257

258258
for (uint16_t t = firstTB; t < lastTB; t += NumOfCachedTBs) {
259259

@@ -384,7 +384,7 @@ GPUd() void GPUTPCCFCheckPadBaseline::CheckBaselineCPU(int32_t nBlocks, int32_t
384384
const int32_t nPads = geo.NPads(row);
385385
const int32_t nVecPads = (nPads + PadsPerCacheline - 1) / PadsPerCacheline;
386386

387-
const CfFragment& fragment = clusterer.mPmemory->fragment;
387+
const CfFragment& frag = clusterer.mPmemory->frag;
388388
const bool hipFilterOn = clusterer.Param().rec.tpc.hipTailFilter;
389389
const Charge hipTailThreshold = clusterer.Param().rec.tpc.hipTailFilterThreshold;
390390
const Charge hipTailFilterAlpha = clusterer.Param().rec.tpc.hipTailFilterAlpha;
@@ -409,7 +409,7 @@ GPUd() void GPUTPCCFCheckPadBaseline::CheckBaselineCPU(int32_t nBlocks, int32_t
409409
std::vector<Short8> activeHIPTailEndV(nVecPads, -1);
410410
std::vector<Charge8> tailFilterChargeV(nVecPads, Charge8{Vc::Zero});
411411

412-
for (int16_t t = 0; t < fragment.length; t += NumOfCachedTBs) {
412+
for (int16_t t = 0; t < frag.length; t += NumOfCachedTBs) {
413413

414414
bool hasAnyTrigger = false;
415415

@@ -432,7 +432,7 @@ GPUd() void GPUTPCCFCheckPadBaseline::CheckBaselineCPU(int32_t nBlocks, int32_t
432432
for (tpccf::TPCFragmentTime localtime = 0; localtime < NumOfCachedTBs; localtime++) {
433433

434434
const uint16_t* packedChargeStart = reinterpret_cast<uint16_t*>(&chargeMap[basePos.delta({0, localtime})]);
435-
const UShort8 packedCharges = t + localtime < fragment.length
435+
const UShort8 packedCharges = t + localtime < frag.length
436436
? UShort8{packedChargeStart, Vc::Aligned}
437437
: UShort8{Vc::Zero};
438438
const auto isCharge = packedCharges != 0;
@@ -585,7 +585,7 @@ GPUd() void GPUTPCCFCheckPadBaseline::CheckBaselineCPU(int32_t nBlocks, int32_t
585585
auto activeHIPTailEnd = activeHIPTailEndV[iVecPad];
586586

587587
const auto shouldCloseTail = activeHIPTailStart > -1;
588-
activeHIPTailEnd(shouldCloseTail && activeHIPTailEnd < 0) = fragment.length;
588+
activeHIPTailEnd(shouldCloseTail && activeHIPTailEnd < 0) = frag.length;
589589

590590
if (hipFilterOn && shouldCloseTail.isNotEmpty()) {
591591
for (int16_t p = 0; p < PadsPerCacheline; p++) {
@@ -639,8 +639,8 @@ GPUd() void GPUTPCCFCheckPadBaseline::CheckBaselineCPU(int32_t nBlocks, int32_t
639639

640640
GPUd() void GPUTPCCFCheckPadBaseline::updatePadBaseline(int32_t pad, const GPUTPCClusterFinder& clusterer, int32_t totalCharges, int32_t consecCharges, Charge maxCharge)
641641
{
642-
const CfFragment& fragment = clusterer.mPmemory->fragment;
643-
const int32_t totalChargesBaseline = clusterer.Param().rec.tpc.maxTimeBinAboveThresholdIn1000Bin * fragment.lengthWithoutOverlap() / 1000;
642+
const CfFragment& frag = clusterer.mPmemory->frag;
643+
const int32_t totalChargesBaseline = clusterer.Param().rec.tpc.maxTimeBinAboveThresholdIn1000Bin * frag.lengthWithoutOverlap() / 1000;
644644
const int32_t consecChargesBaseline = clusterer.Param().rec.tpc.maxConsecTimeBinAboveThreshold;
645645
const uint16_t saturationThreshold = clusterer.Param().rec.tpc.noisyPadSaturationThreshold;
646646
const bool isNoisy = (!saturationThreshold || maxCharge < saturationThreshold) && ((totalChargesBaseline > 0 && totalCharges >= totalChargesBaseline) || (consecChargesBaseline > 0 && consecCharges >= consecChargesBaseline));
@@ -728,7 +728,7 @@ GPUd() void GPUTPCCFHIPClusterizer::Thread<0>(int32_t nBlocks, int32_t nThreads,
728728
nTails = CAMath::Min(nTails, (uint32_t)MaxHIPTailsPerRow - 1);
729729

730730
const auto* tails = GetHIPTails(clusterer, row);
731-
const auto& fragment = clusterer.mPmemory->fragment;
731+
const auto& frag = clusterer.mPmemory->frag;
732732

733733
auto* clusterPosInRow = clusterer.mPhipClusterPosInRow
734734
? clusterer.mPhipClusterPosInRow + row * MaxHIPTailsPerRow
@@ -776,7 +776,7 @@ GPUd() void GPUTPCCFHIPClusterizer::Thread<0>(int32_t nBlocks, int32_t nThreads,
776776
cn.qMax = qMax;
777777
cn.setSaturatedQtot(qTot);
778778
cn.setSaturatedTailLength(tailEnd - tailStart);
779-
float clusterTime = fragment.start + timeMean - clusterer.Param().rec.tpc.clustersShiftTimebinsClusterizer;
779+
float clusterTime = frag.start + timeMean - clusterer.Param().rec.tpc.clustersShiftTimebinsClusterizer;
780780
cn.setTimeFlags(clusterTime, 0);
781781
cn.setPad(padMean);
782782
cn.setSigmaPad(padSigma);

‎GPU/GPUTracking/TPCClusterFinder/GPUTPCCFClusterizer.cxx‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,5 +35,5 @@ GPUdii() void GPUTPCCFClusterizer::Thread<0>(int32_t nBlocks, int32_t nThreads,
3535

3636
tpc::ClusterNative* clusterOut = onlyMC ? nullptr : clusterer.mPclusterByRow;
3737

38-
GPUTPCCFClusterizer::computeClustersImpl(nBlocks, nThreads, iBlock, iThread, clusterer, clusterer.mPmemory->fragment, smem, chargeMap, clusterer.mPfilteredPeakPositions, clusterer.Param().rec, CPU_PTR(&labelAcc), clusterer.mPmemory->counters.nClusters, clusterer.mNMaxClusterPerRow, clusterer.mPclusterInRow, clusterOut, clusterer.mPclusterPosInRow, true);
38+
GPUTPCCFClusterizer::computeClustersImpl(nBlocks, nThreads, iBlock, iThread, clusterer, clusterer.mPmemory->frag, smem, chargeMap, clusterer.mPfilteredPeakPositions, clusterer.Param().rec, CPU_PTR(&labelAcc), clusterer.mPmemory->counters.nClusters, clusterer.mNMaxClusterPerRow, clusterer.mPclusterInRow, clusterOut, clusterer.mPclusterPosInRow, true);
3939
}

‎GPU/GPUTracking/TPCClusterFinder/GPUTPCCFClusterizer.inc‎

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@
1717

1818
GPUdii() void GPUTPCCFClusterizer::computeClustersImpl(int32_t nBlocks, int32_t nThreads, int32_t iBlock, int32_t iThread,
1919
processorType& clusterer,
20-
const CfFragment& fragment,
20+
const CfFragment& frag,
2121
GPUSharedMemory& smem,
2222
const CfArray2D<PackedCharge>& chargeMap,
2323
const CfChargePos* filteredPeakPositions,
@@ -55,14 +55,14 @@ GPUdii() void GPUTPCCFClusterizer::computeClustersImpl(int32_t nBlocks, int32_t
5555
if (idx >= clusternum) {
5656
return;
5757
}
58-
if (fragment.isOverlap(pos.time())) {
58+
if (frag.isOverlap(pos.time())) {
5959
if (clusterPosInRow) {
6060
clusterPosInRow[idx] = maxClusterPerRow;
6161
}
6262
return;
6363
}
6464
tpc::ClusterNative myCluster;
65-
pc.finalize(pos, charge, fragment.start);
65+
pc.finalize(pos, charge, frag.start);
6666
bool rejectCluster = !pc.toNative(pos, charge, myCluster, clusterer.Param(), chargeMap);
6767
if (!isAccepted) {
6868
rejectCluster = true;

‎GPU/GPUTracking/TPCClusterFinder/GPUTPCCFDecodeZS.cxx‎

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -172,13 +172,13 @@ GPUdii() void GPUTPCCFDecodeZS::decode(GPUTPCClusterFinder& clusterer, GPUshared
172172
seqLen = rowData[(nSeq + 1) * 2] - rowData[nSeq * 2];
173173
pad = rowData[nSeq++ * 2 + 1];
174174
}
175-
const CfFragment& fragment = clusterer.mPmemory->fragment;
175+
const CfFragment& frag = clusterer.mPmemory->frag;
176176
TPCTime globalTime = timeBin + l;
177-
bool discardTimeBin = not fragment.contains(globalTime);
177+
bool discardTimeBin = not frag.contains(globalTime);
178178
discardTimeBin |= (tpcTimeBinCut > 0 && globalTime > tpcTimeBinCut);
179179

180180
Row row = rowOffset + m;
181-
CfChargePos pos(row, Pad(pad), discardTimeBin ? INVALID_TIME_BIN : fragment.toLocal(globalTime));
181+
CfChargePos pos(row, Pad(pad), discardTimeBin ? INVALID_TIME_BIN : frag.toLocal(globalTime));
182182
positions[nDigitsTmp++] = pos;
183183

184184
if (!discardTimeBin) {
@@ -219,7 +219,7 @@ GPUdii() void GPUTPCCFDecodeZSLink::Thread<0>(int32_t nBlocks, int32_t nThreads,
219219

220220
GPUd() size_t GPUTPCCFDecodeZSLink::DecodePage(GPUSharedMemory& smem, DecodeCtx& ctx)
221221
{
222-
const CfFragment& fragment = ctx.clusterer.mPmemory->fragment;
222+
const CfFragment& frag = ctx.clusterer.mPmemory->frag;
223223

224224
const auto* rdHdr = ConsumeHeader<header::RAWDataHeader>(ctx.page);
225225

@@ -246,7 +246,7 @@ GPUd() size_t GPUTPCCFDecodeZSLink::DecodePage(GPUSharedMemory& smem, DecodeCtx&
246246

247247
nDecoded += nAdc;
248248

249-
bool discardTimeBin = not fragment.contains(timeBin);
249+
bool discardTimeBin = not frag.contains(timeBin);
250250
discardTimeBin |= (ctx.tpcTimeBinCut > 0 && timeBin > ctx.tpcTimeBinCut);
251251

252252
if (discardTimeBin) {
@@ -331,9 +331,9 @@ GPUd() void GPUTPCCFDecodeZSLink::DecodeTB(
331331
}
332332

333333
o2::tpc::PadPos padAndRow = GetPadAndRowFromFEC(ctx.clusterer, cru, rawFECChannel, fecInPartition);
334-
const CfFragment& fragment = ctx.clusterer.mPmemory->fragment;
334+
const CfFragment& frag = ctx.clusterer.mPmemory->frag;
335335
float charge = ADCToFloat(adc, DECODE_MASK, DECODE_BITS_FACTOR);
336-
WriteCharge(ctx.clusterer, charge, padAndRow, fragment.toLocal(timeBin), ctx.pageDigitOffset + myOffset);
336+
WriteCharge(ctx.clusterer, charge, padAndRow, frag.toLocal(timeBin), ctx.pageDigitOffset + myOffset);
337337

338338
} // for (uint8_t i = iThread; blockOffset < nAdc; i += NThreads)
339339
}
@@ -651,7 +651,7 @@ GPUd() int16_t GPUTPCCFDecodeZSDenseLink::DecodeTB(
651651
constexpr int32_t NTHREADS = GPUCA_GET_THREAD_COUNT(GPUCA_LB_GPUTPCCFDecodeZSDenseLink);
652652
static_assert(NTHREADS == GPUCA_WARP_SIZE, "Decoding TB Headers in parallel assumes block size is a single warp.");
653653

654-
const CfFragment& fragment = ctx.clusterer.mPmemory->fragment;
654+
const CfFragment& frag = ctx.clusterer.mPmemory->frag;
655655

656656
// Read timebin block header
657657
uint16_t tbbHdr = ConsumeByte(ctx.page);
@@ -721,7 +721,7 @@ GPUd() int16_t GPUTPCCFDecodeZSDenseLink::DecodeTB(
721721
const uint8_t* adcData = ConsumeBytes(ctx.page, (nSamplesInTB * DECODE_BITS + 7) / 8);
722722
MAYBE_PAGE_OVERFLOW(ctx.page);
723723

724-
bool discardTimeBin = not fragment.contains(timeBin);
724+
bool discardTimeBin = not frag.contains(timeBin);
725725
discardTimeBin |= (ctx.tpcTimeBinCut > 0 && timeBin > ctx.tpcTimeBinCut);
726726

727727
if (discardTimeBin) {
@@ -754,7 +754,7 @@ GPUd() int16_t GPUTPCCFDecodeZSDenseLink::DecodeTB(
754754
o2::tpc::PadPos padAndRow = GetPadAndRowFromFEC(ctx.clusterer, cru, rawFECChannelLink, smem.linkIds[iLink]);
755755

756756
float charge = ADCToFloat(adc, DECODE_MASK, DECODE_BITS_FACTOR);
757-
WriteCharge(ctx.clusterer, charge, padAndRow, fragment.toLocal(timeBin), ctx.pageDigitOffset + sample);
757+
WriteCharge(ctx.clusterer, charge, padAndRow, frag.toLocal(timeBin), ctx.pageDigitOffset + sample);
758758

759759
} // for (uint16_t sample = iThread; sample < nSamplesInTB; sample += NTHREADS)
760760

‎GPU/GPUTracking/TPCClusterFinder/GPUTPCClusterFinder.h‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,7 @@ class GPUTPCClusterFinder : public GPUProcessor
6363
uint32_t maxTimeBin = 0;
6464
uint32_t nPagesSubsector = 0;
6565
} counters;
66-
CfFragment fragment;
66+
CfFragment frag;
6767
};
6868

6969
struct ZSOffset {

0 commit comments

Comments
 (0)