Skip to content

Commit

Permalink
Made view sizes clearer
Browse files Browse the repository at this point in the history
  • Loading branch information
ariostas committed Oct 10, 2024
1 parent 66612e8 commit 3b4fa9e
Showing 1 changed file with 14 additions and 13 deletions.
27 changes: 14 additions & 13 deletions RecoTracker/LSTCore/src/alpaka/Event.dev.cc
Original file line number Diff line number Diff line change
Expand Up @@ -196,10 +196,10 @@ void Event::addPixelSegmentToEvent(std::vector<unsigned int> const& hitIndices0,
std::array<int, 2> const mds_sizes{{static_cast<int>(nTotalMDs), static_cast<int>(nLowerModules_ + 1)}};
miniDoubletsDC_.emplace(mds_sizes, queue_);

auto nMDs_view =
alpaka::createView(devAcc_, miniDoubletsDC_->view<MiniDoubletsOccupancySoA>().nMDs(), nLowerModules_ + 1);
auto totOccupancyMDs_view = alpaka::createView(
devAcc_, miniDoubletsDC_->view<MiniDoubletsOccupancySoA>().totOccupancyMDs(), nLowerModules_ + 1);
auto mdsOccupancy = miniDoubletsDC_->view<MiniDoubletsOccupancySoA>();
auto nMDs_view = alpaka::createView(devAcc_, mdsOccupancy.nMDs(), mdsOccupancy.metadata().size());
auto totOccupancyMDs_view =
alpaka::createView(devAcc_, mdsOccupancy.totOccupancyMDs(), mdsOccupancy.metadata().size());
alpaka::memset(queue_, nMDs_view, 0u);
alpaka::memset(queue_, totOccupancyMDs_view, 0u);
}
Expand Down Expand Up @@ -267,12 +267,13 @@ void Event::addPixelSegmentToEvent(std::vector<unsigned int> const& hitIndices0,
alpaka::createSubView(segmentsBuffers_->totOccupancySegments_buf, (Idx)1u, (Idx)pixelModuleIndex);
alpaka::memcpy(queue_, dst_view_totOccupancySegments, src_view_size);

MiniDoubletsOccupancy mdsOccupancy = miniDoubletsDC_->view<MiniDoubletsOccupancySoA>();
auto nMDs_view = alpaka::createView(devAcc_, mdsOccupancy.nMDs(), (Idx)nLowerModules_ + 1);
auto mdsOccupancy = miniDoubletsDC_->view<MiniDoubletsOccupancySoA>();
auto nMDs_view = alpaka::createView(devAcc_, mdsOccupancy.nMDs(), (Idx)mdsOccupancy.metadata().size());
auto dst_view_nMDs = alpaka::createSubView(nMDs_view, (Idx)1u, (Idx)pixelModuleIndex);
alpaka::memcpy(queue_, dst_view_nMDs, src_view_mdSize);

auto totOccupancyMDs_view = alpaka::createView(devAcc_, mdsOccupancy.totOccupancyMDs(), (Idx)nLowerModules_ + 1);
auto totOccupancyMDs_view =
alpaka::createView(devAcc_, mdsOccupancy.totOccupancyMDs(), (Idx)mdsOccupancy.metadata().size());
auto dst_view_totOccupancyMDs = alpaka::createSubView(totOccupancyMDs_view, (Idx)1u, (Idx)pixelModuleIndex);
alpaka::memcpy(queue_, dst_view_totOccupancyMDs, src_view_mdSize);

Expand Down Expand Up @@ -326,10 +327,10 @@ void Event::createMiniDoublets() {
std::array<int, 2> const mds_sizes{{static_cast<int>(nTotalMDs), static_cast<int>(nLowerModules_ + 1)}};
miniDoubletsDC_.emplace(mds_sizes, queue_);

auto nMDs_view =
alpaka::createView(devAcc_, miniDoubletsDC_->view<MiniDoubletsOccupancySoA>().nMDs(), nLowerModules_ + 1);
auto totOccupancyMDs_view = alpaka::createView(
devAcc_, miniDoubletsDC_->view<MiniDoubletsOccupancySoA>().totOccupancyMDs(), nLowerModules_ + 1);
auto mdsOccupancy = miniDoubletsDC_->view<MiniDoubletsOccupancySoA>();
auto nMDs_view = alpaka::createView(devAcc_, mdsOccupancy.nMDs(), mdsOccupancy.metadata().size());
auto totOccupancyMDs_view =
alpaka::createView(devAcc_, mdsOccupancy.totOccupancyMDs(), mdsOccupancy.metadata().size());
alpaka::memset(queue_, nMDs_view, 0u);
alpaka::memset(queue_, totOccupancyMDs_view, 0u);
}
Expand Down Expand Up @@ -963,8 +964,8 @@ void Event::createPixelQuintuplets() {

void Event::addMiniDoubletsToEventExplicit() {
auto nMDsCPU_buf = allocBufWrapper<unsigned int>(cms::alpakatools::host(), nLowerModules_, queue_);
auto nMDs_view =
alpaka::createView(devAcc_, miniDoubletsDC_->const_view<MiniDoubletsOccupancySoA>().nMDs(), nLowerModules_);
auto mdsOccupancy = miniDoubletsDC_->const_view<MiniDoubletsOccupancySoA>();
auto nMDs_view = alpaka::createView(devAcc_, mdsOccupancy.nMDs(), nLowerModules_); // exclude pixel part
alpaka::memcpy(queue_, nMDsCPU_buf, nMDs_view, nLowerModules_);

// FIXME: replace by ES host data
Expand Down

0 comments on commit 3b4fa9e

Please sign in to comment.