Skip to content

Commit

Permalink
Added concrete dimensions to kernels
Browse files Browse the repository at this point in the history
  • Loading branch information
ariostas committed Dec 20, 2024
1 parent 9444e18 commit 0da8474
Show file tree
Hide file tree
Showing 9 changed files with 29 additions and 68 deletions.
6 changes: 2 additions & 4 deletions RecoTracker/LSTCore/src/alpaka/Hit.h
Original file line number Diff line number Diff line change
Expand Up @@ -80,8 +80,7 @@ namespace ALPAKA_ACCELERATOR_NAMESPACE::lst {
}

struct ModuleRangesKernel {
template <typename TAcc>
ALPAKA_FN_ACC void operator()(TAcc const& acc,
ALPAKA_FN_ACC void operator()(Acc1D const& acc,
ModulesConst modules,
HitsRanges hitsRanges,
int nLowerModules) const {
Expand All @@ -100,8 +99,7 @@ namespace ALPAKA_ACCELERATOR_NAMESPACE::lst {
};

struct HitLoopKernel {
template <typename TAcc>
ALPAKA_FN_ACC void operator()(TAcc const& acc,
ALPAKA_FN_ACC void operator()(Acc1D const& acc,
uint16_t Endcap, // Integer corresponding to endcap in module subdets
uint16_t TwoS, // Integer corresponding to TwoS in moduleType
unsigned int nModules, // Number of modules
Expand Down
15 changes: 5 additions & 10 deletions RecoTracker/LSTCore/src/alpaka/Kernels.h
Original file line number Diff line number Diff line change
Expand Up @@ -141,8 +141,7 @@ namespace ALPAKA_ACCELERATOR_NAMESPACE::lst {
}

struct RemoveDupQuintupletsAfterBuild {
template <typename TAcc>
ALPAKA_FN_ACC void operator()(TAcc const& acc,
ALPAKA_FN_ACC void operator()(Acc3D const& acc,
ModulesConst modules,
Quintuplets quintuplets,
QuintupletsOccupancyConst quintupletsOccupancy,
Expand Down Expand Up @@ -188,8 +187,7 @@ namespace ALPAKA_ACCELERATOR_NAMESPACE::lst {
};

struct RemoveDupQuintupletsBeforeTC {
template <typename TAcc>
ALPAKA_FN_ACC void operator()(TAcc const& acc,
ALPAKA_FN_ACC void operator()(Acc2D const& acc,
Quintuplets quintuplets,
QuintupletsOccupancyConst quintupletsOccupancy,
ObjectRangesConst ranges) const {
Expand Down Expand Up @@ -267,8 +265,7 @@ namespace ALPAKA_ACCELERATOR_NAMESPACE::lst {
};

struct RemoveDupPixelTripletsFromMap {
template <typename TAcc>
ALPAKA_FN_ACC void operator()(TAcc const& acc, PixelTriplets pixelTriplets) const {
ALPAKA_FN_ACC void operator()(Acc2D const& acc, PixelTriplets pixelTriplets) const {
for (unsigned int ix : cms::alpakatools::uniform_elements_y(acc, pixelTriplets.nPixelTriplets())) {
for (unsigned int jx : cms::alpakatools::uniform_elements_x(acc, pixelTriplets.nPixelTriplets())) {
if (ix == jx)
Expand Down Expand Up @@ -298,8 +295,7 @@ namespace ALPAKA_ACCELERATOR_NAMESPACE::lst {
};

struct RemoveDupPixelQuintupletsFromMap {
template <typename TAcc>
ALPAKA_FN_ACC void operator()(TAcc const& acc, PixelQuintuplets pixelQuintuplets) const {
ALPAKA_FN_ACC void operator()(Acc2D const& acc, PixelQuintuplets pixelQuintuplets) const {
unsigned int nPixelQuintuplets = pixelQuintuplets.nPixelQuintuplets();
for (unsigned int ix : cms::alpakatools::uniform_elements_y(acc, nPixelQuintuplets)) {
float score1 = __H2F(pixelQuintuplets.score()[ix]);
Expand All @@ -322,8 +318,7 @@ namespace ALPAKA_ACCELERATOR_NAMESPACE::lst {
};

struct CheckHitspLS {
template <typename TAcc>
ALPAKA_FN_ACC void operator()(TAcc const& acc,
ALPAKA_FN_ACC void operator()(Acc2D const& acc,
ModulesConst modules,
SegmentsOccupancyConst segmentsOccupancy,
SegmentsPixel segmentsPixel,
Expand Down
11 changes: 3 additions & 8 deletions RecoTracker/LSTCore/src/alpaka/MiniDoublet.h
Original file line number Diff line number Diff line change
Expand Up @@ -675,8 +675,7 @@ namespace ALPAKA_ACCELERATOR_NAMESPACE::lst {
}

struct CreateMiniDoublets {
template <typename TAcc>
ALPAKA_FN_ACC void operator()(TAcc const& acc,
ALPAKA_FN_ACC void operator()(Acc2D const& acc,
ModulesConst modules,
HitsConst hits,
HitsRangesConst hitsRanges,
Expand Down Expand Up @@ -802,10 +801,8 @@ namespace ALPAKA_ACCELERATOR_NAMESPACE::lst {
}

struct CreateMDArrayRangesGPU {
template <typename TAcc>
ALPAKA_FN_ACC void operator()(TAcc const& acc, ModulesConst modules, ObjectRanges ranges, const float ptCut) const {
ALPAKA_FN_ACC void operator()(Acc1D const& acc, ModulesConst modules, ObjectRanges ranges, const float ptCut) const {
// implementation is 1D with a single block
static_assert(std::is_same_v<TAcc, ALPAKA_ACCELERATOR_NAMESPACE::Acc1D>, "Should be Acc1D");
ALPAKA_ASSERT_ACC((alpaka::getWorkDiv<alpaka::Grid, alpaka::Blocks>(acc)[0] == 1));

// Declare variables in shared memory and set to 0
Expand Down Expand Up @@ -869,14 +866,12 @@ namespace ALPAKA_ACCELERATOR_NAMESPACE::lst {
};

struct AddMiniDoubletRangesToEventExplicit {
template <typename TAcc>
ALPAKA_FN_ACC void operator()(TAcc const& acc,
ALPAKA_FN_ACC void operator()(Acc1D const& acc,
ModulesConst modules,
MiniDoubletsOccupancy mdsOccupancy,
ObjectRanges ranges,
HitsRangesConst hitsRanges) const {
// implementation is 1D with a single block
static_assert(std::is_same_v<TAcc, ALPAKA_ACCELERATOR_NAMESPACE::Acc1D>, "Should be Acc1D");
ALPAKA_ASSERT_ACC((alpaka::getWorkDiv<alpaka::Grid, alpaka::Blocks>(acc)[0] == 1));

for (uint16_t i : cms::alpakatools::uniform_elements(acc, modules.nLowerModules())) {
Expand Down
3 changes: 1 addition & 2 deletions RecoTracker/LSTCore/src/alpaka/PixelQuintuplet.h
Original file line number Diff line number Diff line change
Expand Up @@ -634,8 +634,7 @@ namespace ALPAKA_ACCELERATOR_NAMESPACE::lst {
}

struct CreatePixelQuintupletsFromMap {
template <typename TAcc>
ALPAKA_FN_ACC void operator()(TAcc const& acc,
ALPAKA_FN_ACC void operator()(Acc3D const& acc,
ModulesConst modules,
ModulesPixelConst modulesPixel,
MiniDoubletsConst mds,
Expand Down
3 changes: 1 addition & 2 deletions RecoTracker/LSTCore/src/alpaka/PixelTriplet.h
Original file line number Diff line number Diff line change
Expand Up @@ -786,8 +786,7 @@ namespace ALPAKA_ACCELERATOR_NAMESPACE::lst {
}

struct CreatePixelTripletsFromMap {
template <typename TAcc>
ALPAKA_FN_ACC void operator()(TAcc const& acc,
ALPAKA_FN_ACC void operator()(Acc3D const& acc,
ModulesConst modules,
ModulesPixelConst modulesPixel,
ObjectRangesConst ranges,
Expand Down
11 changes: 3 additions & 8 deletions RecoTracker/LSTCore/src/alpaka/Quintuplet.h
Original file line number Diff line number Diff line change
Expand Up @@ -1642,8 +1642,7 @@ namespace ALPAKA_ACCELERATOR_NAMESPACE::lst {
}

struct CreateQuintuplets {
template <typename TAcc>
ALPAKA_FN_ACC void operator()(TAcc const& acc,
ALPAKA_FN_ACC void operator()(Acc3D const& acc,
ModulesConst modules,
MiniDoubletsConst mds,
SegmentsConst segments,
Expand Down Expand Up @@ -1773,14 +1772,12 @@ namespace ALPAKA_ACCELERATOR_NAMESPACE::lst {
};

struct CreateEligibleModulesListForQuintuplets {
template <typename TAcc>
ALPAKA_FN_ACC void operator()(TAcc const& acc,
ALPAKA_FN_ACC void operator()(Acc1D const& acc,
ModulesConst modules,
TripletsOccupancyConst tripletsOccupancy,
ObjectRanges ranges,
const float ptCut) const {
// implementation is 1D with a single block
static_assert(std::is_same_v<TAcc, ALPAKA_ACCELERATOR_NAMESPACE::Acc1D>, "Should be Acc1D");
ALPAKA_ASSERT_ACC((alpaka::getWorkDiv<alpaka::Grid, alpaka::Blocks>(acc)[0] == 1));

// Initialize variables in shared memory and set to 0
Expand Down Expand Up @@ -1857,13 +1854,11 @@ namespace ALPAKA_ACCELERATOR_NAMESPACE::lst {
};

struct AddQuintupletRangesToEventExplicit {
template <typename TAcc>
ALPAKA_FN_ACC void operator()(TAcc const& acc,
ALPAKA_FN_ACC void operator()(Acc1D const& acc,
ModulesConst modules,
QuintupletsOccupancyConst quintupletsOccupancy,
ObjectRanges ranges) const {
// implementation is 1D with a single block
static_assert(std::is_same_v<TAcc, ALPAKA_ACCELERATOR_NAMESPACE::Acc1D>, "Should be Acc1D");
ALPAKA_ASSERT_ACC((alpaka::getWorkDiv<alpaka::Grid, alpaka::Blocks>(acc)[0] == 1));

for (uint16_t i : cms::alpakatools::uniform_elements(acc, modules.nLowerModules())) {
Expand Down
14 changes: 4 additions & 10 deletions RecoTracker/LSTCore/src/alpaka/Segment.h
Original file line number Diff line number Diff line change
Expand Up @@ -525,8 +525,7 @@ namespace ALPAKA_ACCELERATOR_NAMESPACE::lst {
}

struct CreateSegments {
template <typename TAcc>
ALPAKA_FN_ACC void operator()(TAcc const& acc,
ALPAKA_FN_ACC void operator()(Acc3D const& acc,
ModulesConst modules,
MiniDoubletsConst mds,
MiniDoubletsOccupancyConst mdsOccupancy,
Expand Down Expand Up @@ -620,11 +619,9 @@ namespace ALPAKA_ACCELERATOR_NAMESPACE::lst {
};

struct CreateSegmentArrayRanges {
template <typename TAcc>
ALPAKA_FN_ACC void operator()(
TAcc const& acc, ModulesConst modules, ObjectRanges ranges, MiniDoubletsConst mds, const float ptCut) const {
Acc1D const& acc, ModulesConst modules, ObjectRanges ranges, MiniDoubletsConst mds, const float ptCut) const {
// implementation is 1D with a single block
static_assert(std::is_same_v<TAcc, ALPAKA_ACCELERATOR_NAMESPACE::Acc1D>, "Should be Acc1D");
ALPAKA_ASSERT_ACC((alpaka::getWorkDiv<alpaka::Grid, alpaka::Blocks>(acc)[0] == 1));

// Initialize variables in shared memory and set to 0
Expand Down Expand Up @@ -693,13 +690,11 @@ namespace ALPAKA_ACCELERATOR_NAMESPACE::lst {
};

struct AddSegmentRangesToEventExplicit {
template <typename TAcc>
ALPAKA_FN_ACC void operator()(TAcc const& acc,
ALPAKA_FN_ACC void operator()(Acc1D const& acc,
ModulesConst modules,
SegmentsOccupancyConst segmentsOccupancy,
ObjectRanges ranges) const {
// implementation is 1D with a single block
static_assert(std::is_same_v<TAcc, ALPAKA_ACCELERATOR_NAMESPACE::Acc1D>, "Should be Acc1D");
ALPAKA_ASSERT_ACC((alpaka::getWorkDiv<alpaka::Grid, alpaka::Blocks>(acc)[0] == 1));

for (uint16_t i : cms::alpakatools::uniform_elements(acc, modules.nLowerModules())) {
Expand All @@ -715,8 +710,7 @@ namespace ALPAKA_ACCELERATOR_NAMESPACE::lst {
};

struct AddPixelSegmentToEventKernel {
template <typename TAcc>
ALPAKA_FN_ACC void operator()(TAcc const& acc,
ALPAKA_FN_ACC void operator()(Acc1D const& acc,
ModulesConst modules,
ObjectRangesConst ranges,
HitsConst hits,
Expand Down
23 changes: 7 additions & 16 deletions RecoTracker/LSTCore/src/alpaka/TrackCandidate.h
Original file line number Diff line number Diff line change
Expand Up @@ -108,8 +108,7 @@ namespace ALPAKA_ACCELERATOR_NAMESPACE::lst {
}

struct CrossCleanpT3 {
template <typename TAcc>
ALPAKA_FN_ACC void operator()(TAcc const& acc,
ALPAKA_FN_ACC void operator()(Acc2D const& acc,
ModulesConst modules,
ObjectRangesConst ranges,
PixelTriplets pixelTriplets,
Expand Down Expand Up @@ -144,8 +143,7 @@ namespace ALPAKA_ACCELERATOR_NAMESPACE::lst {
};

struct CrossCleanT5 {
template <typename TAcc>
ALPAKA_FN_ACC void operator()(TAcc const& acc,
ALPAKA_FN_ACC void operator()(Acc3D const& acc,
ModulesConst modules,
Quintuplets quintuplets,
QuintupletsOccupancyConst quintupletsOccupancy,
Expand Down Expand Up @@ -193,8 +191,7 @@ namespace ALPAKA_ACCELERATOR_NAMESPACE::lst {
};

struct CrossCleanpLS {
template <typename TAcc>
ALPAKA_FN_ACC void operator()(TAcc const& acc,
ALPAKA_FN_ACC void operator()(Acc2D const& acc,
ModulesConst modules,
ObjectRangesConst ranges,
PixelTripletsConst pixelTriplets,
Expand Down Expand Up @@ -268,15 +265,13 @@ namespace ALPAKA_ACCELERATOR_NAMESPACE::lst {
};

struct AddpT3asTrackCandidates {
template <typename TAcc>
ALPAKA_FN_ACC void operator()(TAcc const& acc,
ALPAKA_FN_ACC void operator()(Acc1D const& acc,
uint16_t nLowerModules,
PixelTripletsConst pixelTriplets,
TrackCandidates cands,
SegmentsPixelConst segmentsPixel,
ObjectRangesConst ranges) const {
// implementation is 1D with a single block
static_assert(std::is_same_v<TAcc, ALPAKA_ACCELERATOR_NAMESPACE::Acc1D>, "Should be Acc1D");
ALPAKA_ASSERT_ACC((alpaka::getWorkDiv<alpaka::Grid, alpaka::Blocks>(acc)[0] == 1));

unsigned int nPixelTriplets = pixelTriplets.nPixelTriplets();
Expand Down Expand Up @@ -320,8 +315,7 @@ namespace ALPAKA_ACCELERATOR_NAMESPACE::lst {
};

struct AddT5asTrackCandidate {
template <typename TAcc>
ALPAKA_FN_ACC void operator()(TAcc const& acc,
ALPAKA_FN_ACC void operator()(Acc2D const& acc,
uint16_t nLowerModules,
QuintupletsConst quintuplets,
QuintupletsOccupancyConst quintupletsOccupancy,
Expand Down Expand Up @@ -371,8 +365,7 @@ namespace ALPAKA_ACCELERATOR_NAMESPACE::lst {
};

struct AddpLSasTrackCandidate {
template <typename TAcc>
ALPAKA_FN_ACC void operator()(TAcc const& acc,
ALPAKA_FN_ACC void operator()(Acc1D const& acc,
uint16_t nLowerModules,
TrackCandidates cands,
SegmentsOccupancyConst segmentsOccupancy,
Expand Down Expand Up @@ -408,15 +401,13 @@ namespace ALPAKA_ACCELERATOR_NAMESPACE::lst {
};

struct AddpT5asTrackCandidate {
template <typename TAcc>
ALPAKA_FN_ACC void operator()(TAcc const& acc,
ALPAKA_FN_ACC void operator()(Acc1D const& acc,
uint16_t nLowerModules,
PixelQuintupletsConst pixelQuintuplets,
TrackCandidates cands,
SegmentsPixelConst segmentsPixel,
ObjectRangesConst ranges) const {
// implementation is 1D with a single block
static_assert(std::is_same_v<TAcc, ALPAKA_ACCELERATOR_NAMESPACE::Acc1D>, "Should be Acc1D");
ALPAKA_ASSERT_ACC((alpaka::getWorkDiv<alpaka::Grid, alpaka::Blocks>(acc)[0] == 1));

int nPixelQuintuplets = pixelQuintuplets.nPixelQuintuplets();
Expand Down
11 changes: 3 additions & 8 deletions RecoTracker/LSTCore/src/alpaka/Triplet.h
Original file line number Diff line number Diff line change
Expand Up @@ -734,8 +734,7 @@ namespace ALPAKA_ACCELERATOR_NAMESPACE::lst {
}

struct CreateTriplets {
template <typename TAcc>
ALPAKA_FN_ACC void operator()(TAcc const& acc,
ALPAKA_FN_ACC void operator()(Acc3D const& acc,
ModulesConst modules,
MiniDoubletsConst mds,
SegmentsConst segments,
Expand Down Expand Up @@ -835,14 +834,12 @@ namespace ALPAKA_ACCELERATOR_NAMESPACE::lst {
};

struct CreateTripletArrayRanges {
template <typename TAcc>
ALPAKA_FN_ACC void operator()(TAcc const& acc,
ALPAKA_FN_ACC void operator()(Acc1D const& acc,
ModulesConst modules,
ObjectRanges ranges,
SegmentsOccupancyConst segmentsOccupancy,
const float ptCut) const {
// implementation is 1D with a single block
static_assert(std::is_same_v<TAcc, ALPAKA_ACCELERATOR_NAMESPACE::Acc1D>, "Should be Acc1D");
ALPAKA_ASSERT_ACC((alpaka::getWorkDiv<alpaka::Grid, alpaka::Blocks>(acc)[0] == 1));

// Initialize variables in shared memory and set to 0
Expand Down Expand Up @@ -910,13 +907,11 @@ namespace ALPAKA_ACCELERATOR_NAMESPACE::lst {
};

struct AddTripletRangesToEventExplicit {
template <typename TAcc>
ALPAKA_FN_ACC void operator()(TAcc const& acc,
ALPAKA_FN_ACC void operator()(Acc1D const& acc,
ModulesConst modules,
TripletsOccupancyConst tripletsOccupancy,
ObjectRanges ranges) const {
// implementation is 1D with a single block
static_assert(std::is_same_v<TAcc, ALPAKA_ACCELERATOR_NAMESPACE::Acc1D>, "Should be Acc1D");
ALPAKA_ASSERT_ACC((alpaka::getWorkDiv<alpaka::Grid, alpaka::Blocks>(acc)[0] == 1));

for (uint16_t i : cms::alpakatools::uniform_elements(acc, modules.nLowerModules())) {
Expand Down

0 comments on commit 0da8474

Please sign in to comment.