Project
Loading...
Searching...
No Matches
GPUTPCCompression.cxx
Go to the documentation of this file.
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
14
15#include "GPUTPCCompression.h"
16#include "GPUReconstruction.h"
17#include "GPUO2DataTypes.h"
19#include "GPUDefParametersRuntime.h"
20#include "GPUConstantMem.h"
21
22using namespace o2::gpu;
23
25
31
38
40{
41 int32_t gatherMode = mRec->GetProcessingSettings().tpcCompressionGatherMode == -1 ? mRec->getGPUParameters(mRec->GetRecoStepsGPU() & GPUDataTypes::RecoStep::TPCCompression).par_COMP_GATHER_MODE : mRec->GetProcessingSettings().tpcCompressionGatherMode;
43 if (gatherMode >= 2) {
45 }
46 if (gatherMode != 1) {
48 }
49 return mem;
50}
51
53{
54 int32_t gatherMode = mRec->GetProcessingSettings().tpcCompressionGatherMode == -1 ? mRec->getGPUParameters(mRec->GetRecoStepsGPU() & GPUDataTypes::RecoStep::TPCCompression).par_COMP_GATHER_MODE : mRec->GetProcessingSettings().tpcCompressionGatherMode;
56 if (gatherMode == 1) {
58 }
59 return mem;
60}
61
62template <class T>
63void GPUTPCCompression::SetPointersCompressedClusters(void*& mem, T& c, uint32_t nClA, uint32_t nTr, uint32_t nClU, bool reducedClA)
64{
65 computePointerWithAlignment(mem, c.qTotU, nClU); // Do not reorder, qTotU ist used as first address in GPUChainTracking::RunTPCCompression
66 computePointerWithAlignment(mem, c.qMaxU, nClU);
67 computePointerWithAlignment(mem, c.flagsU, nClU);
68 computePointerWithAlignment(mem, c.padDiffU, nClU);
69 computePointerWithAlignment(mem, c.timeDiffU, nClU);
70 computePointerWithAlignment(mem, c.sigmaPadU, nClU);
71 computePointerWithAlignment(mem, c.sigmaTimeU, nClU);
72 computePointerWithAlignment(mem, c.nSliceRowClusters, GPUCA_ROW_COUNT * NSECTORS);
73
74 uint32_t nClAreduced = reducedClA ? nClA - nTr : nClA;
75
76 if (!(mRec->GetParam().rec.tpc.compressionTypeMask & GPUSettings::CompressionTrackModel)) {
77 return; // Track model disabled, do not allocate memory
78 }
79 computePointerWithAlignment(mem, c.qTotA, nClA);
80 computePointerWithAlignment(mem, c.qMaxA, nClA);
81 computePointerWithAlignment(mem, c.flagsA, nClA);
82 computePointerWithAlignment(mem, c.rowDiffA, nClAreduced);
83 computePointerWithAlignment(mem, c.sliceLegDiffA, nClAreduced);
84 computePointerWithAlignment(mem, c.padResA, nClAreduced);
85 computePointerWithAlignment(mem, c.timeResA, nClAreduced);
86 computePointerWithAlignment(mem, c.sigmaPadA, nClA);
87 computePointerWithAlignment(mem, c.sigmaTimeA, nClA);
88
89 computePointerWithAlignment(mem, c.qPtA, nTr);
90 computePointerWithAlignment(mem, c.rowA, nTr);
91 computePointerWithAlignment(mem, c.sliceA, nTr);
92 computePointerWithAlignment(mem, c.timeA, nTr);
93 computePointerWithAlignment(mem, c.padA, nTr);
94
95 computePointerWithAlignment(mem, c.nTrackClusters, nTr);
96}
97
105
121
123{
125 mMaxClusterFactorBase1024 = mMaxClusters > 100000000 ? mRec->MemoryScalers()->NTPCUnattachedHitsBase1024(mRec->GetParam().rec.tpc.rejectionStrategy) : 1024;
127 mMaxTrackClusters = mRec->GetConstantMem().tpcMerger.NMergedTrackClusters(); // TODO: Why is this not using ioPtrs? Could remove GPUConstantMem.h include
128 mMaxTracks = mRec->GetConstantMem().tpcMerger.NMergedTracks();
129 if (mMaxClusters % 16) {
130 mMaxClusters += 16 - (mMaxClusters % 16);
131 }
132}
133
135{
137 out << "\n\nCompressed Clusters:\n";
138 out << O.nTracks << " Tracks\n";
139 out << "Slice Row Clusters:\n";
140 for (uint32_t i = 0; i < NSECTORS; i++) {
141 out << "Sector " << i << ": ";
142 for (uint32_t j = 0; j < GPUCA_ROW_COUNT; j++) {
143 out << (O.nSliceRowClusters ? O.nSliceRowClusters[i * GPUCA_ROW_COUNT + j] : 0) << ", ";
144 }
145 out << "\n";
146 }
147 out << "\nTrack Clusters:\n";
148 for (uint32_t i = 0; i < O.nTracks; i++) {
149 if (i && i % 100 == 0) {
150 out << "\n";
151 }
152 out << O.nTrackClusters[i] << ", ";
153 }
154 out << "\n\nUnattached Clusters\n";
155 uint32_t offset = 0;
156 if (O.nSliceRowClusters) {
157 for (uint32_t i = 0; i < NSECTORS; i++) {
158 for (uint32_t j = 0; j < GPUCA_ROW_COUNT; j++) {
159 out << "Sector " << i << " Row " << j << ": ";
160 for (uint32_t k = 0; k < O.nSliceRowClusters[i * GPUCA_ROW_COUNT + j]; k++) {
161 if (k && k % 10 == 0) {
162 out << "\n ";
163 }
164 const uint32_t l = k + offset;
165 out << "[" << (uint32_t)O.qTotU[l] << ", " << (uint32_t)O.qMaxU[l] << ", " << (uint32_t)O.flagsU[l] << ", " << (int32_t)O.padDiffU[l] << ", " << (int32_t)O.timeDiffU[l] << ", " << (uint32_t)O.sigmaPadU[l] << ", " << (uint32_t)O.sigmaTimeU[l] << "] ";
166 }
168 out << "\n";
169 }
170 }
171 }
172 out << "\n\nAttached Clusters\n";
173 offset = 0;
174 for (uint32_t i = 0; i < O.nTracks; i++) {
175 out << "Track " << i << ": {" << (uint32_t)O.qPtA[i] << ", " << (uint32_t)O.rowA[i] << ", " << (uint32_t)O.sliceA[i] << ", " << (uint32_t)O.timeA[i] << ", " << (uint32_t)O.padA[i] << "} - ";
176 for (uint32_t k = 0; k < O.nTrackClusters[i]; k++) {
177 if (k && k % 10 == 0) {
178 out << "\n ";
179 }
180 const uint32_t l1 = offset + k, l2 = offset - i + k - 1;
181 out << "[";
182 if (k) {
183 out << (int32_t)O.rowDiffA[l2] << ", " << (int32_t)O.sliceLegDiffA[l2] << ", " << (uint32_t)O.padResA[l2] << ", " << (uint32_t)O.timeResA[l2] << ", ";
184 }
185 out << (uint32_t)O.qTotA[l1] << ", " << (uint32_t)O.qMaxA[l1] << ", " << (uint32_t)O.flagsA[l1] << ", " << (uint32_t)O.sigmaPadA[l1] << ", " << (uint32_t)O.sigmaTimeA[l1] << "] ";
186 }
187 offset += O.nTrackClusters[i];
188 out << "\n";
189 }
190}
int32_t i
#define GPUCA_ROW_COUNT
uint32_t j
Definition RawData.h:0
uint32_t c
Definition RawData.h:2
GPUReconstruction * mRec
static void computePointerWithAlignment(T *&basePtr, S *&objPtr, size_t nEntries=1)
static void computePointerWithoutAlignment(T *&basePtr, S *&objPtr, size_t nEntries=1)
RecoStepField GetRecoStepsGPU() const
int16_t RegisterMemoryAllocation(T *proc, void *(T::*setPtr)(void *), int32_t type, const char *name="", const GPUMemoryReuse &re=GPUMemoryReuse())
const GPUParam & GetParam() const
const GPUConstantMem & GetConstantMem() const
GPUMemorySizeScalers * MemoryScalers()
const GPUSettingsProcessing & GetProcessingSettings() const
virtual const GPUDefParameters & getGPUParameters(bool doGPU) const =0
void * SetPointersOutputHost(void *mem)
void SetPointersCompressedClusters(void *&mem, T &c, uint32_t nClA, uint32_t nTr, uint32_t nClU, bool reducedClA)
void DumpCompressedClusters(std::ostream &out)
o2::tpc::CompressedClusters * mOutput
void * SetPointersMemory(void *mem)
void * SetPointersOutputGPU(void *mem)
static constexpr uint32_t NSECTORS
o2::tpc::CompressedClusters * mOutputA
o2::tpc::CompressedClustersPtrs mPtrs
void * SetPointersOutput(void *mem)
o2::tpc::CompressedClustersFlat * mOutputFlat
void SetMaxData(const GPUTrackingInOutPointers &io)
void * SetPointersScratch(void *mem)
GLintptr offset
Definition glcorearb.h:660
size_t NTPCUnattachedHitsBase1024(int32_t type)
const o2::tpc::ClusterNativeAccess * clustersNative