Skip to content

Commit 584c573

Browse files
committed
GPU QA: Fix accounting of protected and unattached clusters with attachProtect flag
1 parent ee4bb3b commit 584c573

File tree

7 files changed

+99
-92
lines changed

7 files changed

+99
-92
lines changed

GPU/GPUTracking/DataCompression/GPUTPCClusterRejection.h

Lines changed: 11 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -16,12 +16,19 @@
1616
#define GPUTPCCLUSTERREJECTION_H
1717

1818
#include "GPUTPCGMMergerTypes.h"
19+
#include "GPUCommonMath.h"
1920

2021
namespace o2::gpu
2122
{
2223
struct GPUTPCClusterRejection {
24+
template <class T, class S>
25+
GPUdi() static bool IsTrackRejected(const T& trk, const S& param)
26+
{
27+
return CAMath::Abs(trk.GetParam().GetQPt() * param.qptB5Scaler) > param.rec.tpc.rejectQPtB5 || trk.MergedLooper();
28+
}
29+
2330
template <bool C, class T = void, class S = void>
24-
static constexpr inline bool GetProtectionStatus(int32_t attach, bool& physics, bool& protect, T* counts = nullptr, S* mev200 = nullptr)
31+
GPUdi() static constexpr bool GetRejectionStatus(int32_t attach, bool& physics, T* counts = nullptr, S* mev200 = nullptr)
2532
{
2633
(void)counts; // FIXME: Avoid incorrect -Wunused-but-set-parameter warning
2734
(void)mev200;
@@ -39,7 +46,6 @@ struct GPUTPCClusterRejection {
3946
}
4047
retVal = true;
4148
} else if (attach & gputpcgmmergertypes::attachTube) {
42-
protect = true;
4349
if constexpr (C) {
4450
if (*mev200) {
4551
counts->nTube200++;
@@ -49,7 +55,6 @@ struct GPUTPCClusterRejection {
4955
}
5056
retVal = false;
5157
} else if ((attach & gputpcgmmergertypes::attachGood) == 0) {
52-
protect = true;
5358
if constexpr (C) {
5459
counts->nRejected++;
5560
}
@@ -60,16 +65,15 @@ struct GPUTPCClusterRejection {
6065
}
6166

6267
if (attach & gputpcgmmergertypes::attachProtect) {
63-
protect = true;
6468
retVal = false;
6569
}
6670
return retVal;
6771
}
6872

69-
static constexpr inline bool GetIsRejected(int32_t attach)
73+
GPUdi() static constexpr bool GetIsRejected(int32_t attach)
7074
{
71-
bool physics = false, protect = false;
72-
return GetProtectionStatus<false>(attach, physics, protect);
75+
bool physics = false;
76+
return GetRejectionStatus<false>(attach, physics);
7377
}
7478
};
7579
} // namespace o2::gpu

GPU/GPUTracking/DataCompression/GPUTPCCompression.cxx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -111,7 +111,7 @@ void GPUTPCCompression::RegisterMemoryAllocation()
111111
if (gatherMode == 3) {
112112
mMemoryResOutputGPU = mRec->RegisterMemoryAllocation(this, &GPUTPCCompression::SetPointersOutputGPU, GPUMemoryResource::MEMORY_SCRATCH | GPUMemoryResource::MEMORY_GPU | GPUMemoryResource::MEMORY_CUSTOM | GPUMemoryResource::MEMORY_STACK, "TPCCompressionOutputGPU");
113113
}
114-
uint32_t stackScratch = (gatherMode != 3) ? GPUMemoryResource::MEMORY_STACK : 0;
114+
uint32_t stackScratch = (gatherMode != 3) ? GPUMemoryResource::MEMORY_STACK : 0; // TODO: Can we use stacked memory also with gather mode 3?
115115
if (gatherMode < 2) {
116116
mRec->RegisterMemoryAllocation(this, &GPUTPCCompression::SetPointersOutput, GPUMemoryResource::MEMORY_OUTPUT | stackScratch, "TPCCompressionOutput");
117117
}

GPU/GPUTracking/DataCompression/GPUTPCCompression.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -60,6 +60,7 @@ class GPUTPCCompression : public GPUProcessor
6060
#ifndef GPUCA_GPUCODE
6161
void DumpCompressedClusters(std::ostream& out);
6262
#endif
63+
GPUd() bool rejectCluster(int32_t idx, const GPUParam& param, const GPUTrackingInOutPointers& ioPtrs) const;
6364

6465
protected:
6566
struct memory {
@@ -89,7 +90,6 @@ class GPUTPCCompression : public GPUProcessor
8990
void SetPointersCompressedClusters(void*& mem, T& c, uint32_t nClA, uint32_t nTr, uint32_t nClU, bool reducedClA);
9091
template <class T>
9192
GPUd() static void truncateSignificantBits(T& val, uint32_t nBits, uint32_t max);
92-
GPUd() bool rejectCluster(int32_t idx, GPUParam& param, const GPUTrackingInOutPointers& ioPtrs);
9393

9494
int16_t mMemoryResOutputHost = -1;
9595
int16_t mMemoryResOutputGPU = -1;

GPU/GPUTracking/DataCompression/GPUTPCCompressionKernels.cxx

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ GPUdii() void GPUTPCCompressionKernels::Thread<GPUTPCCompressionKernels::step0at
3939
if (!trk.OK()) {
4040
continue;
4141
}
42-
bool rejectTrk = CAMath::Abs(trk.GetParam().GetQPt() * processors.param.qptB5Scaler) > processors.param.rec.tpc.rejectQPtB5 || trk.MergedLooper();
42+
bool rejectTrk = GPUTPCClusterRejection::IsTrackRejected(trk, param);
4343
uint32_t nClustersStored = 0;
4444
CompressedClustersPtrs& GPUrestrict() c = compressor.mPtrs;
4545
uint8_t lastRow = 0, lastSector = 0;
@@ -185,7 +185,7 @@ GPUd() bool GPUTPCCompressionKernels::GPUTPCCompressionKernels_Compare<4>::opera
185185
return mClsPtr[a].qTot < mClsPtr[b].qTot;
186186
}
187187

188-
GPUd() bool GPUTPCCompression::rejectCluster(int32_t idx, GPUParam& GPUrestrict() param, const GPUTrackingInOutPointers& GPUrestrict() ioPtrs)
188+
GPUd() bool GPUTPCCompression::rejectCluster(int32_t idx, const GPUParam& GPUrestrict() param, const GPUTrackingInOutPointers& GPUrestrict() ioPtrs) const
189189
{
190190
if (mClusterStatus[idx]) {
191191
return true;
@@ -206,7 +206,7 @@ GPUd() bool GPUTPCCompression::rejectCluster(int32_t idx, GPUParam& GPUrestrict(
206206
}
207207
int32_t id = attach & gputpcgmmergertypes::attachTrackMask;
208208
auto& trk = ioPtrs.mergedTracks[id];
209-
if (CAMath::Abs(trk.GetParam().GetQPt() * param.qptB5Scaler) > param.rec.tpc.rejectQPtB5 || trk.MergedLooper()) {
209+
if (GPUTPCClusterRejection::IsTrackRejected(trk, param)) {
210210
return true;
211211
}
212212
}

GPU/GPUTracking/Global/GPUChainTrackingClusterizer.cxx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -587,7 +587,7 @@ int32_t GPUChainTracking::RunTPCClusterizer(bool synchronizeOutput)
587587
return ForwardTPCDigits();
588588
}
589589
#ifdef GPUCA_TPC_GEOMETRY_O2
590-
[[maybe_unused]] int32_t tpcTimeBinCut = mUpdateNewCalibObjects && mNewCalibValues->newTPCTimeBinCut ? mNewCalibValues->tpcTimeBinCut : param().tpcCutTimeBin;
590+
[[maybe_unused]] int32_t tpcTimeBinCut = (mUpdateNewCalibObjects && mNewCalibValues->newTPCTimeBinCut) ? mNewCalibValues->tpcTimeBinCut : param().tpcCutTimeBin; // TODO: Implement time bin cut fultering
591591
mRec->PushNonPersistentMemory(qStr2Tag("TPCCLUST"));
592592
const auto& threadContext = GetThreadContext();
593593
const bool doGPU = GetRecoStepsGPU() & RecoStep::TPCClusterFinding;

0 commit comments

Comments
 (0)