Skip to content

Commit b66ec2d

Browse files
committed
Fix MC labels with HIP clusters
1 parent a8c5d14 commit b66ec2d

1 file changed

Lines changed: 10 additions & 3 deletions

File tree

GPU/GPUTracking/TPCClusterFinder/GPUTPCCFMCLabelFlattener.cxx

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -46,12 +46,19 @@ template <>
4646
GPUd() void GPUTPCCFMCLabelFlattener::Thread<GPUTPCCFMCLabelFlattener::setRowOffsets>(int32_t nBlocks, int32_t nThreads, int32_t iBlock, int32_t iThread, GPUSharedMemory&, processorType& clusterer)
4747
{
4848
#if !defined(GPUCA_GPUCODE)
49-
Row row = get_global_id(0);
49+
const Row row = get_global_id(0);
50+
const size_t clusterInRow = clusterer.mPclusterInRow[row];
51+
52+
// Label Flattener assumes 1 label container per cluster,
53+
// but HIP clusters don't support MC labels yet and containers are missing for those clusters.
54+
// So append empty label container for each HIP cluster.
55+
// Note: This assumes that HIP cluster are store behind regular clusters!
56+
auto &labels = clusterer.mPlabelsByRow[row].data;
57+
labels.resize(std::max(labels.size(), clusterInRow));
5058

51-
uint32_t clusterInRow = clusterer.mPclusterInRow[row];
5259
uint32_t labelCount = 0;
5360

54-
for (uint32_t i = 0; i < clusterInRow; i++) {
61+
for (size_t i = 0; i < clusterInRow; i++) {
5562
auto& interim = clusterer.mPlabelsByRow[row].data[i];
5663
labelCount += interim.labels.size();
5764
}

0 commit comments

Comments
 (0)