Skip to content

Commit

Permalink
make the PhiBinner the size of the hits
Browse files Browse the repository at this point in the history
  • Loading branch information
VinInn committed Dec 6, 2020
1 parent fc80e1e commit 99e2a46
Show file tree
Hide file tree
Showing 4 changed files with 11 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@ class TrackingRecHit2DHeterogeneous {
auto hitsModuleStart() const { return m_hitsModuleStart; }
auto hitsLayerStart() { return m_hitsLayerStart; }
auto phiBinner() { return m_hist; }
auto binnerStorage() {return m_histStorage;}
auto iphi() { return m_iphi; }

// only the local coord and detector index
Expand All @@ -43,7 +44,7 @@ class TrackingRecHit2DHeterogeneous {

private:
static constexpr uint32_t n16 = 4;
static constexpr uint32_t n32 = 9;
static constexpr uint32_t n32 = 10;
static_assert(sizeof(uint32_t) == sizeof(float)); // just stating the obvious

unique_ptr<uint16_t[]> m_store16; //!
Expand All @@ -60,6 +61,7 @@ class TrackingRecHit2DHeterogeneous {

// needed as kernel params...
Hist* m_hist;
Hist::index_type * m_histStorage;
uint32_t* m_hitsLayerStart;
int16_t* m_iphi;
};
Expand Down Expand Up @@ -101,11 +103,15 @@ TrackingRecHit2DHeterogeneous<Traits>::TrackingRecHit2DHeterogeneous(uint32_t nH
m_store32 = Traits::template make_device_unique<float[]>(nHits * n32 + 11, stream);
m_HistStore = Traits::template make_device_unique<TrackingRecHit2DSOAView::Hist>(stream);

static_assert(sizeof(TrackingRecHit2DSOAView::hindex_type)==sizeof(float));
static_assert(sizeof(TrackingRecHit2DSOAView::hindex_type)==sizeof(TrackingRecHit2DSOAView::Hist::index_type));

auto get16 = [&](int i) { return m_store16.get() + i * nHits; };
auto get32 = [&](int i) { return m_store32.get() + i * nHits; };

// copy all the pointers
m_hist = view->m_hist = m_HistStore.get();
m_histStorage = view->m_histStorage = reinterpret_cast<TrackingRecHit2DSOAView::Hist::index_type *>(get32(9));

view->m_xl = get32(0);
view->m_yl = get32(1);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ class TrackingRecHit2DSOAView {
using hindex_type = uint32_t; // if above is <=2^32

using PhiBinner =
cms::cuda::HistoContainer<int16_t, 128, gpuClustering::MaxNumClusters, 8 * sizeof(int16_t), hindex_type, 10>;
cms::cuda::HistoContainer<int16_t, 128, -1, 8 * sizeof(int16_t), hindex_type, 10>;

using Hist = PhiBinner; // FIXME

Expand Down Expand Up @@ -96,6 +96,7 @@ class TrackingRecHit2DSOAView {
uint32_t* m_hitsLayerStart;

PhiBinner* m_hist; // FIXME use a more descriptive name consistently
PhiBinner::index_type * m_histStorage;

uint32_t m_nHits;
};
Expand Down
2 changes: 1 addition & 1 deletion RecoLocalTracker/SiPixelRecHits/plugins/PixelRecHits.cu
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ namespace pixelgpudetails {

if (nHits) {
cms::cuda::fillManyFromVector(
hits_d.phiBinner(), 10, hits_d.iphi(), hits_d.hitsLayerStart(), nHits, 256, nullptr, stream);
hits_d.phiBinner(), 10, hits_d.iphi(), hits_d.hitsLayerStart(), nHits, 256, hits_d.binnerStorage(), stream);
cudaCheck(cudaGetLastError());
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -240,7 +240,7 @@ void SiPixelRecHitSoAFromLegacy::produce(edm::StreamID streamID, edm::Event& iEv
output->hitsLayerStart()[i] = hitsModuleStart[cpeView.layerGeometry().layerStart[i]];
}
cms::cuda::fillManyFromVector(
output->phiBinner(), 10, output->iphi(), output->hitsLayerStart(), numberOfHits, 256, nullptr);
output->phiBinner(), 10, output->iphi(), output->hitsLayerStart(), numberOfHits, 256, output->binnerStorage());

// std::cout << "created HitSoa for " << numberOfClusters << " clusters in " << numberOfDetUnits << " Dets" << std::endl;
iEvent.put(std::move(output));
Expand Down

0 comments on commit 99e2a46

Please sign in to comment.