Skip to content

Commit 72b16ac

Browse files
committed
Use qTot as marker for HIP clusters instead of qMax
1 parent 0853880 commit 72b16ac

4 files changed

Lines changed: 13 additions & 14 deletions

File tree

DataFormats/Detectors/TPC/include/DataFormatsTPC/ClusterNative.h

Lines changed: 9 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -63,8 +63,9 @@ struct ClusterNative {
6363
static constexpr int scalePadPacked = 64; //< ~60 is needed for 0.1mm precision, but power of two avoids rounding
6464
static constexpr int scaleSigmaTimePacked = 32; // 1/32nd of pad/timebin precision for cluster size
6565
static constexpr int scaleSigmaPadPacked = 32;
66-
static constexpr int scaleSaturatedQTot = 4;
67-
static constexpr int maxSaturatedQTot = USHRT_MAX * scaleSaturatedQTot;
66+
static constexpr int scaleSaturatedQtot = 8;
67+
static constexpr int maxRegularQtot = 25 * 1024;
68+
static constexpr int maxSaturatedQtot = (USHRT_MAX - maxRegularQtot) * scaleSaturatedQtot;
6869

6970
uint32_t timeFlagsPacked; //< Contains the time in the lower 24 bits in a packed format, contains the flags in the
7071
// upper 8 bits
@@ -89,9 +90,7 @@ struct ClusterNative {
8990
GPUd() uint16_t getQtot() const
9091
{
9192
if (isSaturated()) [[unlikely]] {
92-
// Check for overflow, so return type can stay uint16
93-
auto sqtot = getSaturatedQtot();
94-
return sqtot <= USHRT_MAX ? sqtot : USHRT_MAX;
93+
return maxRegularQtot;
9594
}
9695
return qTot;
9796
}
@@ -155,19 +154,19 @@ struct ClusterNative {
155154
sigmaPadPacked = tmp;
156155
}
157156

158-
GPUd() bool isSaturated() const { return qMax >= 1023; }
157+
GPUd() bool isSaturated() const { return qTot > maxRegularQtot; }
159158

160159
GPUd() void setSaturatedQtot(uint32_t qtot)
161160
{
162-
if (qtot > maxSaturatedQTot) {
163-
qtot = maxSaturatedQTot;
161+
if (qtot > maxSaturatedQtot) {
162+
qtot = maxSaturatedQtot;
164163
}
165-
this->qTot = (qtot + scaleSaturatedQTot / 2) / scaleSaturatedQTot;
164+
this->qTot = ((qtot + scaleSaturatedQtot / 2) / scaleSaturatedQtot) + maxRegularQtot;
166165
}
167166

168167
GPUd() uint32_t getSaturatedQtot() const
169168
{
170-
return uint32_t(qTot) * scaleSaturatedQTot;
169+
return uint32_t(qTot - maxRegularQtot) * scaleSaturatedQtot;
171170
}
172171

173172
GPUd() void setSaturatedTailLength(uint32_t tail)

GPU/GPUTracking/DataCompression/GPUTPCClusterStatistics.cxx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -129,7 +129,7 @@ void GPUTPCClusterStatistics::RunStatistics(const o2::tpc::ClusterNativeAccess*
129129
if (param.rec.tpc.compressionTypeMask & GPUSettings::CompressionTruncate) {
130130
GPUTPCCompression::truncateSignificantBitsChargeMax(tmpClusters[k].qMax, param);
131131
GPUTPCCompression::truncateSignificantBitsWidth(tmpClusters[k].sigmaPadPacked, param);
132-
if (!tmpClusters[k].isSaturated()) {
132+
if (!tmpClusters[k].isSaturated()) [[likely]] {
133133
GPUTPCCompression::truncateSignificantBitsCharge(tmpClusters[k].qTot, param);
134134
GPUTPCCompression::truncateSignificantBitsWidth(tmpClusters[k].sigmaTimePacked, param);
135135
}

GPU/GPUTracking/DataCompression/GPUTPCCompression.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@ class GPUTPCCompression : public GPUProcessor
4747
#endif
4848

4949
static constexpr uint32_t P_MAX_QMAX = 1 << 10;
50-
static constexpr uint32_t P_MAX_QTOT = 1 << 16;
50+
static constexpr uint32_t P_MAX_QTOT = 5 * 5 * P_MAX_QMAX;
5151
static constexpr uint32_t P_MAX_TIME = 1 << 24;
5252
static constexpr uint32_t P_MAX_PAD = 1 << 16;
5353
static constexpr uint32_t P_MAX_SIGMA = 1 << 8;

GPU/GPUTracking/DataCompression/GPUTPCCompressionKernels.cxx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -122,7 +122,7 @@ GPUdii() void GPUTPCCompressionKernels::Thread<GPUTPCCompressionKernels::step0at
122122
if (param.rec.tpc.compressionTypeMask & GPUSettings::CompressionTruncate) {
123123
compressor.truncateSignificantBitsChargeMax(qmax, param);
124124
compressor.truncateSignificantBitsWidth(sigmapad, param);
125-
if (!orgCl.isSaturated()) {
125+
if (!orgCl.isSaturated()) [[likely]] {
126126
compressor.truncateSignificantBitsCharge(qtot, param);
127127
compressor.truncateSignificantBitsWidth(sigmatime, param);
128128
}
@@ -301,7 +301,7 @@ GPUdii() void GPUTPCCompressionKernels::Thread<GPUTPCCompressionKernels::step1un
301301
if (param.rec.tpc.compressionTypeMask & GPUSettings::CompressionTruncate) {
302302
compressor.truncateSignificantBitsChargeMax(qmax, param);
303303
compressor.truncateSignificantBitsWidth(sigmapad, param);
304-
if (!orgCl.isSaturated()) {
304+
if (!orgCl.isSaturated()) [[likely]] {
305305
compressor.truncateSignificantBitsCharge(qtot, param);
306306
compressor.truncateSignificantBitsWidth(sigmatime, param);
307307
}

0 commit comments

Comments
 (0)