Skip to content
This repository has been archived by the owner on Dec 9, 2024. It is now read-only.

Commit

Permalink
move data buffer templates from Acc to Dev to be more in line with al…
Browse files Browse the repository at this point in the history
…paka design
  • Loading branch information
slava77devel committed Feb 1, 2024
1 parent 87ad3de commit eca2c59
Show file tree
Hide file tree
Showing 13 changed files with 277 additions and 277 deletions.
2 changes: 1 addition & 1 deletion SDL/Constants.h
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,7 @@ namespace SDL {

// Second allocation wrapper function when queue is not given. Reduces code boilerplate.
template <typename T, typename TAcc, typename TSize>
ALPAKA_FN_HOST ALPAKA_FN_INLINE Buf<TAcc, T> allocBufWrapper(TAcc const& devAccIn, TSize nElements) {
ALPAKA_FN_HOST ALPAKA_FN_INLINE Buf<alpaka::Dev<TAcc>, T> allocBufWrapper(TAcc const& devAccIn, TSize nElements) {
return alpaka::allocBuf<T, Idx>(devAccIn, Vec1d(static_cast<Idx>(nElements)));
}

Expand Down
4 changes: 2 additions & 2 deletions SDL/EndcapGeometry.h
Original file line number Diff line number Diff line change
Expand Up @@ -24,8 +24,8 @@ namespace SDL {
std::map<unsigned int, float> centroid_zs_; // centroid z

public:
Buf<Acc, unsigned int> geoMapDetId_buf;
Buf<Acc, float> geoMapPhi_buf;
Buf<SDL::Dev, unsigned int> geoMapDetId_buf;
Buf<SDL::Dev, float> geoMapPhi_buf;

unsigned int nEndCapMap;

Expand Down
24 changes: 12 additions & 12 deletions SDL/Event.cc
Original file line number Diff line number Diff line change
Expand Up @@ -197,13 +197,13 @@ void SDL::Event::addHitToEvent(std::vector<float> x,
// Initialize space on device/host for next event.
if (hitsInGPU == nullptr) {
hitsInGPU = new SDL::hits();
hitsBuffers = new SDL::hitsBuffer<Acc>(nModules, nHits, devAcc, queue);
hitsBuffers = new SDL::hitsBuffer<Dev>(nModules, nHits, devAcc, queue);
hitsInGPU->setData(*hitsBuffers);
}

if (rangesInGPU == nullptr) {
rangesInGPU = new SDL::objectRanges();
rangesBuffers = new SDL::objectRangesBuffer<Acc>(nModules, nLowerModules, devAcc, queue);
rangesBuffers = new SDL::objectRangesBuffer<Dev>(nModules, nLowerModules, devAcc, queue);
rangesInGPU->setData(*rangesBuffers);
}

Expand Down Expand Up @@ -317,7 +317,7 @@ void SDL::Event::addPixelSegmentToEvent(std::vector<unsigned int> hitIndices0,
nTotalMDs += N_MAX_PIXEL_MD_PER_MODULES;

mdsInGPU = new SDL::miniDoublets();
miniDoubletsBuffers = new SDL::miniDoubletsBuffer<Acc>(nTotalMDs, nLowerModules, devAcc, queue);
miniDoubletsBuffers = new SDL::miniDoubletsBuffer<Dev>(nTotalMDs, nLowerModules, devAcc, queue);
mdsInGPU->setData(*miniDoubletsBuffers);

alpaka::memcpy(queue, miniDoubletsBuffers->nMemoryLocations_buf, nTotalMDs_view);
Expand Down Expand Up @@ -348,7 +348,7 @@ void SDL::Event::addPixelSegmentToEvent(std::vector<unsigned int> hitIndices0,

segmentsInGPU = new SDL::segments();
segmentsBuffers =
new SDL::segmentsBuffer<Acc>(nTotalSegments, nLowerModules, N_MAX_PIXEL_SEGMENTS_PER_MODULE, devAcc, queue);
new SDL::segmentsBuffer<Dev>(nTotalSegments, nLowerModules, N_MAX_PIXEL_SEGMENTS_PER_MODULE, devAcc, queue);
segmentsInGPU->setData(*segmentsBuffers);

alpaka::memcpy(queue, segmentsBuffers->nMemoryLocations_buf, nTotalSegments_view);
Expand Down Expand Up @@ -460,7 +460,7 @@ void SDL::Event::createMiniDoublets() {

if (mdsInGPU == nullptr) {
mdsInGPU = new SDL::miniDoublets();
miniDoubletsBuffers = new SDL::miniDoubletsBuffer<Acc>(nTotalMDs, nLowerModules, devAcc, queue);
miniDoubletsBuffers = new SDL::miniDoubletsBuffer<Dev>(nTotalMDs, nLowerModules, devAcc, queue);
mdsInGPU->setData(*miniDoubletsBuffers);
}

Expand Down Expand Up @@ -505,7 +505,7 @@ void SDL::Event::createSegmentsWithModuleMap() {
if (segmentsInGPU == nullptr) {
segmentsInGPU = new SDL::segments();
segmentsBuffers =
new SDL::segmentsBuffer<Acc>(nTotalSegments, nLowerModules, N_MAX_PIXEL_SEGMENTS_PER_MODULE, devAcc, queue);
new SDL::segmentsBuffer<Dev>(nTotalSegments, nLowerModules, N_MAX_PIXEL_SEGMENTS_PER_MODULE, devAcc, queue);
segmentsInGPU->setData(*segmentsBuffers);
}

Expand Down Expand Up @@ -566,7 +566,7 @@ void SDL::Event::createTriplets() {

tripletsInGPU = new SDL::triplets();
tripletsBuffers =
new SDL::tripletsBuffer<Acc>(*alpaka::getPtrNative(maxTriplets_buf), nLowerModules, devAcc, queue);
new SDL::tripletsBuffer<Dev>(*alpaka::getPtrNative(maxTriplets_buf), nLowerModules, devAcc, queue);
tripletsInGPU->setData(*tripletsBuffers);

alpaka::memcpy(queue, tripletsBuffers->nMemoryLocations_buf, maxTriplets_buf, 1);
Expand Down Expand Up @@ -652,7 +652,7 @@ void SDL::Event::createTriplets() {
void SDL::Event::createTrackCandidates() {
if (trackCandidatesInGPU == nullptr) {
trackCandidatesInGPU = new SDL::trackCandidates();
trackCandidatesBuffers = new SDL::trackCandidatesBuffer<Acc>(
trackCandidatesBuffers = new SDL::trackCandidatesBuffer<Dev>(
N_MAX_NONPIXEL_TRACK_CANDIDATES + N_MAX_PIXEL_TRACK_CANDIDATES, devAcc, queue);
trackCandidatesInGPU->setData(*trackCandidatesBuffers);
}
Expand Down Expand Up @@ -816,7 +816,7 @@ void SDL::Event::createTrackCandidates() {
void SDL::Event::createPixelTriplets() {
if (pixelTripletsInGPU == nullptr) {
pixelTripletsInGPU = new SDL::pixelTriplets();
pixelTripletsBuffers = new SDL::pixelTripletsBuffer<Acc>(N_MAX_PIXEL_TRIPLETS, devAcc, queue);
pixelTripletsBuffers = new SDL::pixelTripletsBuffer<Dev>(N_MAX_PIXEL_TRIPLETS, devAcc, queue);
pixelTripletsInGPU->setData(*pixelTripletsBuffers);
}

Expand Down Expand Up @@ -963,7 +963,7 @@ void SDL::Event::createQuintuplets() {

if (quintupletsInGPU == nullptr) {
quintupletsInGPU = new SDL::quintuplets();
quintupletsBuffers = new SDL::quintupletsBuffer<Acc>(nTotalQuintuplets, nLowerModules, devAcc, queue);
quintupletsBuffers = new SDL::quintupletsBuffer<Dev>(nTotalQuintuplets, nLowerModules, devAcc, queue);
quintupletsInGPU->setData(*quintupletsBuffers);

alpaka::memcpy(queue, quintupletsBuffers->nMemoryLocations_buf, nTotalQuintuplets_buf, 1);
Expand Down Expand Up @@ -1043,12 +1043,12 @@ void SDL::Event::pixelLineSegmentCleaning() {
void SDL::Event::createPixelQuintuplets() {
if (pixelQuintupletsInGPU == nullptr) {
pixelQuintupletsInGPU = new SDL::pixelQuintuplets();
pixelQuintupletsBuffers = new SDL::pixelQuintupletsBuffer<Acc>(N_MAX_PIXEL_QUINTUPLETS, devAcc, queue);
pixelQuintupletsBuffers = new SDL::pixelQuintupletsBuffer<Dev>(N_MAX_PIXEL_QUINTUPLETS, devAcc, queue);
pixelQuintupletsInGPU->setData(*pixelQuintupletsBuffers);
}
if (trackCandidatesInGPU == nullptr) {
trackCandidatesInGPU = new SDL::trackCandidates();
trackCandidatesBuffers = new SDL::trackCandidatesBuffer<Acc>(
trackCandidatesBuffers = new SDL::trackCandidatesBuffer<Dev>(
N_MAX_NONPIXEL_TRACK_CANDIDATES + N_MAX_PIXEL_TRACK_CANDIDATES, devAcc, queue);
trackCandidatesInGPU->setData(*trackCandidatesBuffers);
}
Expand Down
18 changes: 9 additions & 9 deletions SDL/Event.h
Original file line number Diff line number Diff line change
Expand Up @@ -35,23 +35,23 @@ namespace SDL {
//Device stuff
unsigned int nTotalSegments;
struct objectRanges* rangesInGPU;
struct objectRangesBuffer<Acc>* rangesBuffers;
struct objectRangesBuffer<Dev>* rangesBuffers;
struct hits* hitsInGPU;
struct hitsBuffer<Acc>* hitsBuffers;
struct hitsBuffer<Dev>* hitsBuffers;
struct miniDoublets* mdsInGPU;
struct miniDoubletsBuffer<Acc>* miniDoubletsBuffers;
struct miniDoubletsBuffer<Dev>* miniDoubletsBuffers;
struct segments* segmentsInGPU;
struct segmentsBuffer<Acc>* segmentsBuffers;
struct segmentsBuffer<Dev>* segmentsBuffers;
struct triplets* tripletsInGPU;
struct tripletsBuffer<Acc>* tripletsBuffers;
struct tripletsBuffer<Dev>* tripletsBuffers;
struct quintuplets* quintupletsInGPU;
struct quintupletsBuffer<Acc>* quintupletsBuffers;
struct quintupletsBuffer<Dev>* quintupletsBuffers;
struct trackCandidates* trackCandidatesInGPU;
struct trackCandidatesBuffer<Acc>* trackCandidatesBuffers;
struct trackCandidatesBuffer<Dev>* trackCandidatesBuffers;
struct pixelTriplets* pixelTripletsInGPU;
struct pixelTripletsBuffer<Acc>* pixelTripletsBuffers;
struct pixelTripletsBuffer<Dev>* pixelTripletsBuffers;
struct pixelQuintuplets* pixelQuintupletsInGPU;
struct pixelQuintupletsBuffer<Acc>* pixelQuintupletsBuffers;
struct pixelQuintupletsBuffer<Dev>* pixelQuintupletsBuffers;

//CPU interface stuff
objectRangesBuffer<alpaka::DevCpu>* rangesInCPU;
Expand Down
40 changes: 20 additions & 20 deletions SDL/Hit.h
Original file line number Diff line number Diff line change
Expand Up @@ -50,27 +50,27 @@ namespace SDL {
}
};

template <typename TAcc>
template <typename TDev>
struct hitsBuffer : hits {
Buf<TAcc, unsigned int> nHits_buf;
Buf<TAcc, float> xs_buf;
Buf<TAcc, float> ys_buf;
Buf<TAcc, float> zs_buf;
Buf<TAcc, uint16_t> moduleIndices_buf;
Buf<TAcc, unsigned int> idxs_buf;
Buf<TAcc, unsigned int> detid_buf;
Buf<TAcc, float> rts_buf;
Buf<TAcc, float> phis_buf;
Buf<TAcc, float> etas_buf;
Buf<TAcc, float> highEdgeXs_buf;
Buf<TAcc, float> highEdgeYs_buf;
Buf<TAcc, float> lowEdgeXs_buf;
Buf<TAcc, float> lowEdgeYs_buf;
Buf<TAcc, int> hitRanges_buf;
Buf<TAcc, int> hitRangesLower_buf;
Buf<TAcc, int> hitRangesUpper_buf;
Buf<TAcc, int8_t> hitRangesnLower_buf;
Buf<TAcc, int8_t> hitRangesnUpper_buf;
Buf<TDev, unsigned int> nHits_buf;
Buf<TDev, float> xs_buf;
Buf<TDev, float> ys_buf;
Buf<TDev, float> zs_buf;
Buf<TDev, uint16_t> moduleIndices_buf;
Buf<TDev, unsigned int> idxs_buf;
Buf<TDev, unsigned int> detid_buf;
Buf<TDev, float> rts_buf;
Buf<TDev, float> phis_buf;
Buf<TDev, float> etas_buf;
Buf<TDev, float> highEdgeXs_buf;
Buf<TDev, float> highEdgeYs_buf;
Buf<TDev, float> lowEdgeXs_buf;
Buf<TDev, float> lowEdgeYs_buf;
Buf<TDev, int> hitRanges_buf;
Buf<TDev, int> hitRangesLower_buf;
Buf<TDev, int> hitRangesUpper_buf;
Buf<TDev, int8_t> hitRangesnLower_buf;
Buf<TDev, int8_t> hitRangesnUpper_buf;

template <typename TQueue, typename TDevAcc>
hitsBuffer(unsigned int nModules, unsigned int nMaxHits, TDevAcc const& devAccIn, TQueue& queue)
Expand Down
86 changes: 43 additions & 43 deletions SDL/MiniDoublet.h
Original file line number Diff line number Diff line change
Expand Up @@ -93,50 +93,50 @@ namespace SDL {
}
};

template <typename TAcc>
template <typename TDev>
struct miniDoubletsBuffer : miniDoublets {
Buf<TAcc, unsigned int> nMemoryLocations_buf;

Buf<TAcc, unsigned int> anchorHitIndices_buf;
Buf<TAcc, unsigned int> outerHitIndices_buf;
Buf<TAcc, uint16_t> moduleIndices_buf;
Buf<TAcc, int> nMDs_buf;
Buf<TAcc, int> totOccupancyMDs_buf;
Buf<TAcc, float> dphichanges_buf;

Buf<TAcc, float> dzs_buf;
Buf<TAcc, float> dphis_buf;

Buf<TAcc, float> shiftedXs_buf;
Buf<TAcc, float> shiftedYs_buf;
Buf<TAcc, float> shiftedZs_buf;
Buf<TAcc, float> noShiftedDzs_buf;
Buf<TAcc, float> noShiftedDphis_buf;
Buf<TAcc, float> noShiftedDphiChanges_buf;

Buf<TAcc, float> anchorX_buf;
Buf<TAcc, float> anchorY_buf;
Buf<TAcc, float> anchorZ_buf;
Buf<TAcc, float> anchorRt_buf;
Buf<TAcc, float> anchorPhi_buf;
Buf<TAcc, float> anchorEta_buf;
Buf<TAcc, float> anchorHighEdgeX_buf;
Buf<TAcc, float> anchorHighEdgeY_buf;
Buf<TAcc, float> anchorLowEdgeX_buf;
Buf<TAcc, float> anchorLowEdgeY_buf;
Buf<TAcc, float> anchorLowEdgePhi_buf;
Buf<TAcc, float> anchorHighEdgePhi_buf;

Buf<TAcc, float> outerX_buf;
Buf<TAcc, float> outerY_buf;
Buf<TAcc, float> outerZ_buf;
Buf<TAcc, float> outerRt_buf;
Buf<TAcc, float> outerPhi_buf;
Buf<TAcc, float> outerEta_buf;
Buf<TAcc, float> outerHighEdgeX_buf;
Buf<TAcc, float> outerHighEdgeY_buf;
Buf<TAcc, float> outerLowEdgeX_buf;
Buf<TAcc, float> outerLowEdgeY_buf;
Buf<TDev, unsigned int> nMemoryLocations_buf;

Buf<TDev, unsigned int> anchorHitIndices_buf;
Buf<TDev, unsigned int> outerHitIndices_buf;
Buf<TDev, uint16_t> moduleIndices_buf;
Buf<TDev, int> nMDs_buf;
Buf<TDev, int> totOccupancyMDs_buf;
Buf<TDev, float> dphichanges_buf;

Buf<TDev, float> dzs_buf;
Buf<TDev, float> dphis_buf;

Buf<TDev, float> shiftedXs_buf;
Buf<TDev, float> shiftedYs_buf;
Buf<TDev, float> shiftedZs_buf;
Buf<TDev, float> noShiftedDzs_buf;
Buf<TDev, float> noShiftedDphis_buf;
Buf<TDev, float> noShiftedDphiChanges_buf;

Buf<TDev, float> anchorX_buf;
Buf<TDev, float> anchorY_buf;
Buf<TDev, float> anchorZ_buf;
Buf<TDev, float> anchorRt_buf;
Buf<TDev, float> anchorPhi_buf;
Buf<TDev, float> anchorEta_buf;
Buf<TDev, float> anchorHighEdgeX_buf;
Buf<TDev, float> anchorHighEdgeY_buf;
Buf<TDev, float> anchorLowEdgeX_buf;
Buf<TDev, float> anchorLowEdgeY_buf;
Buf<TDev, float> anchorLowEdgePhi_buf;
Buf<TDev, float> anchorHighEdgePhi_buf;

Buf<TDev, float> outerX_buf;
Buf<TDev, float> outerY_buf;
Buf<TDev, float> outerZ_buf;
Buf<TDev, float> outerRt_buf;
Buf<TDev, float> outerPhi_buf;
Buf<TDev, float> outerEta_buf;
Buf<TDev, float> outerHighEdgeX_buf;
Buf<TDev, float> outerHighEdgeY_buf;
Buf<TDev, float> outerLowEdgeX_buf;
Buf<TDev, float> outerLowEdgeY_buf;

template <typename TQueue, typename TDevAcc>
miniDoubletsBuffer(unsigned int nMemoryLoc, uint16_t nLowerModules, TDevAcc const& devAccIn, TQueue& queue)
Expand Down
58 changes: 29 additions & 29 deletions SDL/Module.h
Original file line number Diff line number Diff line change
Expand Up @@ -79,36 +79,36 @@ namespace SDL {
}
};

template <typename TAcc>
template <typename TDev>
struct objectRangesBuffer : objectRanges {
Buf<TAcc, int> hitRanges_buf;
Buf<TAcc, int> hitRangesLower_buf;
Buf<TAcc, int> hitRangesUpper_buf;
Buf<TAcc, int8_t> hitRangesnLower_buf;
Buf<TAcc, int8_t> hitRangesnUpper_buf;
Buf<TAcc, int> mdRanges_buf;
Buf<TAcc, int> segmentRanges_buf;
Buf<TAcc, int> trackletRanges_buf;
Buf<TAcc, int> tripletRanges_buf;
Buf<TAcc, int> trackCandidateRanges_buf;
Buf<TAcc, int> quintupletRanges_buf;

Buf<TAcc, uint16_t> nEligibleT5Modules_buf;
Buf<TAcc, uint16_t> indicesOfEligibleT5Modules_buf;

Buf<TAcc, int> quintupletModuleIndices_buf;
Buf<TAcc, int> quintupletModuleOccupancy_buf;
Buf<TAcc, int> miniDoubletModuleIndices_buf;
Buf<TAcc, int> miniDoubletModuleOccupancy_buf;
Buf<TAcc, int> segmentModuleIndices_buf;
Buf<TAcc, int> segmentModuleOccupancy_buf;
Buf<TAcc, int> tripletModuleIndices_buf;
Buf<TAcc, int> tripletModuleOccupancy_buf;

Buf<TAcc, unsigned int> device_nTotalMDs_buf;
Buf<TAcc, unsigned int> device_nTotalSegs_buf;
Buf<TAcc, unsigned int> device_nTotalTrips_buf;
Buf<TAcc, unsigned int> device_nTotalQuints_buf;
Buf<TDev, int> hitRanges_buf;
Buf<TDev, int> hitRangesLower_buf;
Buf<TDev, int> hitRangesUpper_buf;
Buf<TDev, int8_t> hitRangesnLower_buf;
Buf<TDev, int8_t> hitRangesnUpper_buf;
Buf<TDev, int> mdRanges_buf;
Buf<TDev, int> segmentRanges_buf;
Buf<TDev, int> trackletRanges_buf;
Buf<TDev, int> tripletRanges_buf;
Buf<TDev, int> trackCandidateRanges_buf;
Buf<TDev, int> quintupletRanges_buf;

Buf<TDev, uint16_t> nEligibleT5Modules_buf;
Buf<TDev, uint16_t> indicesOfEligibleT5Modules_buf;

Buf<TDev, int> quintupletModuleIndices_buf;
Buf<TDev, int> quintupletModuleOccupancy_buf;
Buf<TDev, int> miniDoubletModuleIndices_buf;
Buf<TDev, int> miniDoubletModuleOccupancy_buf;
Buf<TDev, int> segmentModuleIndices_buf;
Buf<TDev, int> segmentModuleOccupancy_buf;
Buf<TDev, int> tripletModuleIndices_buf;
Buf<TDev, int> tripletModuleOccupancy_buf;

Buf<TDev, unsigned int> device_nTotalMDs_buf;
Buf<TDev, unsigned int> device_nTotalSegs_buf;
Buf<TDev, unsigned int> device_nTotalTrips_buf;
Buf<TDev, unsigned int> device_nTotalQuints_buf;

template <typename TQueue, typename TDevAcc>
objectRangesBuffer(unsigned int nMod, unsigned int nLowerMod, TDevAcc const& devAccIn, TQueue& queue)
Expand Down
Loading

0 comments on commit eca2c59

Please sign in to comment.