Skip to content

Commit f189c01

Browse files
fweigdavidrohr
authored andcommitted
TPCClusterFinder: Use memory scaler to determine upper bound of clusters.
1 parent 30f8ec4 commit f189c01

3 files changed

Lines changed: 9 additions & 8 deletions

File tree

GPU/GPUTracking/TPCClusterFinder/GPUTPCCFStreamCompaction.cxx

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -25,8 +25,7 @@ template <>
2525
GPUdii() void GPUTPCCFStreamCompaction::Thread<GPUTPCCFStreamCompaction::nativeScanUpStart>(int nBlocks, int nThreads, int iBlock, int iThread, GPUSharedMemory& smem, processorType& clusterer, int iBuf, int stage)
2626
{
2727
int nElems = compactionElems(clusterer, stage);
28-
size_t bufferSize = (stage) ? clusterer.mNMaxClusters : clusterer.mNMaxPeaks;
29-
nativeScanUpStartImpl(get_num_groups(0), get_local_size(0), get_group_id(0), get_local_id(0), smem, clusterer.mPisPeak, clusterer.mPbuf + (iBuf - 1) * clusterer.mBufSize, clusterer.mPbuf + iBuf * clusterer.mBufSize, nElems, bufferSize);
28+
nativeScanUpStartImpl(get_num_groups(0), get_local_size(0), get_group_id(0), get_local_id(0), smem, clusterer.mPisPeak, clusterer.mPbuf + (iBuf - 1) * clusterer.mBufSize, clusterer.mPbuf + iBuf * clusterer.mBufSize, nElems);
3029
}
3130

3231
GPUd() void GPUTPCCFStreamCompaction::nativeScanUpStartImpl(int nBlocks, int nThreads, int iBlock, int iThread, GPUSharedMemory& smem,
@@ -123,8 +122,8 @@ template <>
123122
GPUdii() void GPUTPCCFStreamCompaction::Thread<GPUTPCCFStreamCompaction::compactDigit>(int nBlocks, int nThreads, int iBlock, int iThread, GPUSharedMemory& smem, processorType& clusterer, int iBuf, int stage, deprecated::PackedDigit* in, deprecated::PackedDigit* out)
124123
{
125124
unsigned int nElems = compactionElems(clusterer, stage);
126-
127-
compactDigitImpl(get_num_groups(0), get_local_size(0), get_group_id(0), get_local_id(0), smem, in, out, clusterer.mPisPeak, clusterer.mPbuf + (iBuf - 1) * clusterer.mBufSize, clusterer.mPbuf + iBuf * clusterer.mBufSize, nElems);
125+
size_t bufferSize = (stage) ? clusterer.mNMaxClusters : clusterer.mNMaxPeaks;
126+
compactDigitImpl(get_num_groups(0), get_local_size(0), get_group_id(0), get_local_id(0), smem, in, out, clusterer.mPisPeak, clusterer.mPbuf + (iBuf - 1) * clusterer.mBufSize, clusterer.mPbuf + iBuf * clusterer.mBufSize, nElems, bufferSize);
128127
unsigned int lastId = get_global_size(0) - 1;
129128
if ((unsigned int)get_global_id(0) == lastId) {
130129
if (stage) {
@@ -141,7 +140,8 @@ GPUd() void GPUTPCCFStreamCompaction::compactDigitImpl(int nBlocks, int nThreads
141140
const uchar* predicate,
142141
int* newIdx,
143142
const int* incr,
144-
int nElems)
143+
int nElems,
144+
size_t bufferSize)
145145
{
146146
int gid = get_group_id(0);
147147
int idx = get_global_id(0);

GPU/GPUTracking/TPCClusterFinder/GPUTPCCFStreamCompaction.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,7 @@ class GPUTPCCFStreamCompaction
5555
static GPUd() void compactDigitImpl(int, int, int, int, GPUSharedMemory&,
5656
const deprecated::Digit*, deprecated::Digit*,
5757
const uchar*, int*, const int*,
58-
int, size_t)
58+
int, size_t);
5959

6060
#ifdef HAVE_O2HEADERS
6161
typedef GPUTPCClusterFinder processorType;

GPU/GPUTracking/TPCClusterFinder/GPUTPCClusterFinder.cxx

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@
1313

1414
#include "GPUTPCClusterFinder.h"
1515
#include "GPUReconstruction.h"
16+
#include "GPUMemorySizeScalers.h"
1617

1718
#include "DataFormatsTPC/ZeroSuppression.h"
1819
#include "Digit.h"
@@ -67,8 +68,8 @@ void GPUTPCClusterFinder::RegisterMemoryAllocation()
6768

6869
void GPUTPCClusterFinder::SetMaxData(const GPUTrackingInOutPointers& io)
6970
{
70-
mNMaxPeaks = 0.5f * mNMaxDigits;
71-
mNMaxClusters = mNMaxPeaks;
71+
mNMaxPeaks = mRec->MemoryScalers()->NTPCClusters(mNMaxDigits);
72+
mNMaxClusters = mNMaxPeaks; // Noise suppression doesn't remove that many peaks, so don't scale this
7273
mNMaxClusterPerRow = 0.01f * mNMaxDigits;
7374
mBufSize = nextMultipleOf<std::max<int>(GPUCA_MEMALIGN, mScanWorkGroupSize)>(mNMaxDigits);
7475
mNBufs = getNSteps(mBufSize);

0 commit comments

Comments
 (0)