Skip to content

Commit

Permalink
Initialize only required columns
Browse files Browse the repository at this point in the history
  • Loading branch information
ariostas committed Sep 25, 2024
1 parent 9e2a402 commit 96be4f7
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 4 deletions.
18 changes: 14 additions & 4 deletions RecoTracker/LSTCore/src/alpaka/Event.dev.cc
Original file line number Diff line number Diff line change
Expand Up @@ -224,8 +224,13 @@ void Event::addPixelSegmentToEvent(std::vector<unsigned int> const& hitIndices0,
static_cast<int>(nLowerModules_ + 1),
static_cast<int>(n_max_pixel_segments_per_module)}};
segmentsDev_.emplace(segments_sizes, queue_);
auto buf = segmentsDev_->buffer();
alpaka::memset(queue_, buf, 0u); // TODO: We don't need to initialize the entire buffer

auto nSegments_view =
alpaka::createView(devAcc_, segmentsDev_->view<SegmentsOccupancySoA>().nSegments(), nLowerModules_ + 1);
auto totOccupancySegments_view = alpaka::createView(
devAcc_, segmentsDev_->view<SegmentsOccupancySoA>().totOccupancySegments(), nLowerModules_ + 1);
alpaka::memset(queue_, nSegments_view, 0u);
alpaka::memset(queue_, totOccupancySegments_view, 0u);
}

auto hitIndices0_dev = allocBufWrapper<unsigned int>(devAcc_, size, queue_);
Expand Down Expand Up @@ -363,8 +368,13 @@ void Event::createSegmentsWithModuleMap() {
static_cast<int>(nLowerModules_ + 1),
static_cast<int>(n_max_pixel_segments_per_module)}};
segmentsDev_.emplace(segments_sizes, queue_);
auto buf = segmentsDev_->buffer();
alpaka::memset(queue_, buf, 0u); // TODO: We don't need to initialize the entire buffer

auto nSegments_view =
alpaka::createView(devAcc_, segmentsDev_->view<SegmentsOccupancySoA>().nSegments(), nLowerModules_ + 1);
auto totOccupancySegments_view = alpaka::createView(
devAcc_, segmentsDev_->view<SegmentsOccupancySoA>().totOccupancySegments(), nLowerModules_ + 1);
alpaka::memset(queue_, nSegments_view, 0u);
alpaka::memset(queue_, totOccupancySegments_view, 0u);
}

Vec3D const threadsPerBlockCreateSeg{1, 1, 64};
Expand Down
1 change: 1 addition & 0 deletions RecoTracker/LSTCore/src/alpaka/Segment.h
Original file line number Diff line number Diff line change
Expand Up @@ -302,6 +302,7 @@ namespace ALPAKA_ACCELERATOR_NAMESPACE::lst {
segments.dPhiChanges()[idx] = __F2H(dPhiChange);

segmentsPixel.isDup()[pixelSegmentArrayIndex] = false;
segmentsPixel.partOfPT5()[pixelSegmentArrayIndex] = false;
segmentsPixel.score()[pixelSegmentArrayIndex] = score;
segmentsPixel.pLSHitsIdxs()[pixelSegmentArrayIndex].x = hitIdxs[0];
segmentsPixel.pLSHitsIdxs()[pixelSegmentArrayIndex].y = hitIdxs[1];
Expand Down

0 comments on commit 96be4f7

Please sign in to comment.