@@ -50,8 +50,10 @@ GPUd() void GPUTPCCFCheckPadBaseline::CheckBaselineGPU(int32_t nBlocks, int32_t
5050 const CfFragment& fragment = clusterer.mPmemory ->fragment ;
5151 CfArray2D<PackedCharge> chargeMap (reinterpret_cast <PackedCharge*>(clusterer.mPchargeMap ));
5252
53+ constexpr GPUTPCGeometry geo;
54+
5355 const auto iRow = iBlock;
54- const auto rowinfo = GetRowInfo (iRow);
56+ const auto nPads = geo. NPads (iRow);
5557 const CfChargePos basePos{(Row)iRow, 0 , 0 };
5658
5759 int32_t totalCharges = 0 ;
@@ -62,7 +64,7 @@ GPUd() void GPUTPCCFCheckPadBaseline::CheckBaselineGPU(int32_t nBlocks, int32_t
6264 const int16_t iPadOffset = iThread % MaxNPadsPerRow;
6365 const int16_t iTimeOffset = iThread / MaxNPadsPerRow;
6466 const int16_t iPadHandle = iThread;
65- const bool handlePad = iPadHandle < rowinfo. nPads ;
67+ const bool handlePad = iPadHandle < nPads;
6668
6769 const auto firstTB = fragment.firstNonOverlapTimeBin ();
6870 const auto lastTB = fragment.lastNonOverlapTimeBin ();
@@ -73,7 +75,7 @@ GPUd() void GPUTPCCFCheckPadBaseline::CheckBaselineGPU(int32_t nBlocks, int32_t
7375
7476 const CfChargePos pos = basePos.delta ({iPadOffset, iTime});
7577
76- smem.charges [iTimeOffset][iPadOffset] = iTime < lastTB && iPadOffset < rowinfo. nPads ? chargeMap[pos].unpack () : 0 ;
78+ smem.charges [iTimeOffset][iPadOffset] = iTime < lastTB && iPadOffset < nPads ? chargeMap[pos].unpack () : 0 ;
7779
7880 GPUbarrier ();
7981
@@ -91,7 +93,7 @@ GPUd() void GPUTPCCFCheckPadBaseline::CheckBaselineGPU(int32_t nBlocks, int32_t
9193 }
9294
9395 if (handlePad) {
94- updatePadBaseline (rowinfo. globalPadOffset + iPadOffset , clusterer, totalCharges, maxConsecCharges, maxCharge);
96+ updatePadBaseline (basePos. gpad + iPadHandle , clusterer, totalCharges, maxConsecCharges, maxCharge);
9597 }
9698#endif
9799}
@@ -102,11 +104,10 @@ GPUd() void GPUTPCCFCheckPadBaseline::CheckBaselineCPU(int32_t nBlocks, int32_t
102104 const CfFragment& fragment = clusterer.mPmemory ->fragment ;
103105 CfArray2D<PackedCharge> chargeMap (reinterpret_cast <PackedCharge*>(clusterer.mPchargeMap ));
104106
105- int32_t basePad = iBlock * PadsPerCacheline;
106- int32_t padsPerRow;
107- CfChargePos basePos = padToCfChargePos<PadsPerCacheline>(basePad, clusterer, padsPerRow);
107+ CfChargePos basePos (iBlock * PadsPerCacheline, 0 );
108108
109- if (not basePos.valid ()) {
109+ constexpr GPUTPCGeometry geo;
110+ if (basePos.pad () >= geo.NPads (basePos.row ())) {
110111 return ;
111112 }
112113
@@ -153,45 +154,11 @@ GPUd() void GPUTPCCFCheckPadBaseline::CheckBaselineCPU(int32_t nBlocks, int32_t
153154 }
154155
155156 for (tpccf::Pad localpad = 0 ; localpad < PadsPerCacheline; localpad++) {
156- updatePadBaseline (basePad + localpad, clusterer, totalCharges[localpad], maxConsecCharges[localpad], maxCharge[localpad]);
157+ updatePadBaseline (basePos. gpad + localpad, clusterer, totalCharges[localpad], maxConsecCharges[localpad], maxCharge[localpad]);
157158 }
158159#endif
159160}
160161
161- template <int32_t PadsPerBlock>
162- GPUd () CfChargePos GPUTPCCFCheckPadBaseline::padToCfChargePos(int32_t & pad, const GPUTPCClusterFinder& clusterer, int32_t & padsPerRow)
163- {
164- constexpr GPUTPCGeometry geo;
165-
166- int32_t padOffset = 0 ;
167- for (Row r = 0 ; r < GPUCA_ROW_COUNT; r++) {
168- int32_t npads = geo.NPads (r);
169- int32_t padInRow = pad - padOffset;
170- if (0 <= padInRow && padInRow < npads) {
171- int32_t cachelineOffset = padInRow % PadsPerBlock;
172- pad -= cachelineOffset;
173- padsPerRow = npads;
174- return CfChargePos{r, Pad (padInRow - cachelineOffset), 0 };
175- }
176- padOffset += npads;
177- }
178-
179- padsPerRow = 0 ;
180- return CfChargePos{0 , 0 , INVALID_TIME_BIN};
181- }
182-
183- GPUd () GPUTPCCFCheckPadBaseline::RowInfo GPUTPCCFCheckPadBaseline::GetRowInfo(int16_t row)
184- {
185- constexpr GPUTPCGeometry geo;
186-
187- int16_t padOffset = 0 ;
188- for (int16_t r = 0 ; r < row; r++) {
189- padOffset += geo.NPads (r);
190- }
191-
192- return RowInfo{padOffset, geo.NPads (row)};
193- }
194-
195162GPUd () void GPUTPCCFCheckPadBaseline::updatePadBaseline(int32_t pad, const GPUTPCClusterFinder& clusterer, int32_t totalCharges, int32_t consecCharges, Charge maxCharge)
196163{
197164 const CfFragment& fragment = clusterer.mPmemory ->fragment ;
0 commit comments