Skip to content

Commit 6385a0e

Browse files
committed
GPU: Extract unattached cluster compression to include file
1 parent ad97e2e commit 6385a0e

3 files changed

Lines changed: 45 additions & 18 deletions

File tree

GPU/GPUTracking/CMakeLists.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -159,6 +159,7 @@ set(HDRS_INSTALL
159159
DataTypes/GPUTRDInterfaceO2Track.h
160160
Base/GPUParam.inc
161161
DataCompression/TPCClusterDecompressor.inc
162+
DataCompression/GPUTPCCompressionKernels.inc
162163
Merger/GPUTPCGMMergerTypes.h
163164
Global/GPUErrorCodes.h
164165
Global/GPUChainTrackingDefs.h

GPU/GPUTracking/DataCompression/GPUTPCCompressionKernels.cxx

Lines changed: 3 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@
2020
#include "GPUTPCCompressionTrackModel.h"
2121
#include "GPUTPCGeometry.h"
2222
#include "GPUTPCClusterRejection.h"
23+
#include "GPUTPCCompressionKernels.inc"
2324

2425
using namespace GPUCA_NAMESPACE::gpu;
2526
using namespace o2::tpc;
@@ -272,25 +273,9 @@ GPUdii() void GPUTPCCompressionKernels::Thread<GPUTPCCompressionKernels::step1un
272273
for (unsigned int j = get_local_id(0); j < count; j += get_local_size(0)) {
273274
int outidx = idOffsetOut + totalCount + j;
274275
const ClusterNative& GPUrestrict() orgCl = clusters->clusters[iSlice][iRow][sortBuffer[j]];
275-
unsigned int lastTime = 0;
276-
unsigned int lastPad = 0;
277-
if (param.rec.tpc.compressionTypeMask & GPUSettings::CompressionDifferences) {
278-
if (j != 0) {
279-
const ClusterNative& GPUrestrict() orgClPre = clusters->clusters[iSlice][iRow][sortBuffer[j - 1]];
280-
lastPad = orgClPre.padPacked;
281-
lastTime = orgClPre.getTimePacked();
282-
} else if (totalCount != 0) {
283-
const ClusterNative& GPUrestrict() orgClPre = clusters->clusters[iSlice][iRow][smem.lastIndex];
284-
lastPad = orgClPre.padPacked;
285-
lastTime = orgClPre.getTimePacked();
286-
}
287276

288-
c.padDiffU[outidx] = orgCl.padPacked - lastPad;
289-
c.timeDiffU[outidx] = (orgCl.getTimePacked() - lastTime) & 0xFFFFFF;
290-
} else {
291-
c.padDiffU[outidx] = orgCl.padPacked;
292-
c.timeDiffU[outidx] = orgCl.getTimePacked();
293-
}
277+
int preId = j != 0 ? (int)sortBuffer[j - 1] : (totalCount != 0 ? (int)smem.lastIndex : -1);
278+
GPUTPCCompression_EncodeUnattached(param, orgCl, c, outidx, preId == -1 ? nullptr : &clusters->clusters[iSlice][iRow][preId]);
294279

295280
unsigned short qtot = orgCl.qTot, qmax = orgCl.qMax;
296281
unsigned char sigmapad = orgCl.sigmaPadPacked, sigmatime = orgCl.sigmaTimePacked;
Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
1+
// Copyright 2019-2020 CERN and copyright holders of ALICE O2.
2+
// See https://alice-o2.web.cern.ch/copyright for details of the copyright holders.
3+
// All rights not expressly granted are reserved.
4+
//
5+
// This software is distributed under the terms of the GNU General Public
6+
// License v3 (GPL Version 3), copied verbatim in the file "COPYING".
7+
//
8+
// In applying this license CERN does not waive the privileges and immunities
9+
// granted to it by virtue of its status as an Intergovernmental Organization
10+
// or submit itself to any jurisdiction.
11+
12+
/// \file GPUTPCCompressionKernels.cxx
13+
/// \author David Rohr
14+
15+
#include "GPUO2DataTypes.h"
16+
#include "GPUParam.h"
17+
#include "GPUTPCGeometry.h"
18+
#include "GPUTPCClusterRejection.h"
19+
20+
namespace o2::gpu
21+
{
22+
23+
template <class T>
24+
GPUdii() void GPUTPCCompression_EncodeUnattached(const GPUParam& param, const o2::tpc::ClusterNative& orgCl, T& c, int outidx, const o2::tpc::ClusterNative* orgClPre = nullptr)
25+
{
26+
if (param.rec.tpc.compressionTypeMask & GPUSettings::CompressionDifferences) {
27+
unsigned int lastTime = 0, lastPad = 0;
28+
if (orgClPre) {
29+
lastPad = orgClPre->padPacked;
30+
lastTime = orgClPre->getTimePacked();
31+
}
32+
33+
c.padDiffU[outidx] = orgCl.padPacked - lastPad;
34+
c.timeDiffU[outidx] = (orgCl.getTimePacked() - lastTime) & 0xFFFFFF;
35+
} else {
36+
c.padDiffU[outidx] = orgCl.padPacked;
37+
c.timeDiffU[outidx] = orgCl.getTimePacked();
38+
}
39+
}
40+
41+
} // namespace o2::gpu

0 commit comments

Comments
 (0)