-
Notifications
You must be signed in to change notification settings - Fork 513
ITS: new CPU + GPU seeding vertexer #15733
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
cima22
wants to merge
1
commit into
AliceO2Group:dev
Choose a base branch
from
cima22:parallel-vertexer
base: dev
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
+2,707
−333
Open
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -21,6 +21,8 @@ | |
| #include "ITStracking/Configuration.h" | ||
| #include "ITStracking/TrackExtensionHypothesis.h" | ||
| #include "ITStrackingGPU/Utils.h" | ||
| #include "ITStracking/ClusterLines.h" | ||
| #include "ITStracking/LineProjection.h" | ||
|
|
||
| namespace o2::its::gpu | ||
| { | ||
|
|
@@ -54,10 +56,14 @@ class TimeFrameGPU : public TimeFrame<NLayers> | |
| void createTrackingFrameInfoDeviceArray(const int = NLayers); | ||
| void loadUnsortedClustersDevice(const int); | ||
| void createUnsortedClustersDeviceArray(const int = NLayers); | ||
| void loadClustersDevice(const int); | ||
| void createClustersDeviceArray(const int = NLayers); | ||
| void loadClustersIndexTables(const int); | ||
| void createClustersIndexTablesArray(const int = NLayers); | ||
| void createClustersDevice(const int); | ||
| void createClustersIndexTables(const int); | ||
| void createClusterRadiiDevice(); | ||
| void uploadClusterRadii(); | ||
| void sortClustersDevice(const int layer, const TrackingParameters& trkParam); | ||
| void createUsedClustersDevice(const int); | ||
| void createUsedClustersDeviceArray(const int = NLayers); | ||
| void loadUsedClustersDevice(); | ||
|
|
@@ -87,6 +93,20 @@ class TimeFrameGPU : public TimeFrame<NLayers> | |
| void createTrackExtensionScratchDevice(const int nThreads, const int maxHypotheses); | ||
| void downloadTrackITSExtDevice(); | ||
|
|
||
| // Seeding-vertexer | ||
| void createClusterOwnersDeviceArray(); | ||
| void createClusterOwnersDevice(); | ||
| void resetClusterOwnersDevice(); | ||
| void createClusterSortScratchDevice(const int layer); | ||
|
|
||
| void createLinesDevice(const int nCells); | ||
| void createDiamondDevice(const Vertex& diamond); | ||
| unsigned int downloadLinesDevice(); | ||
| unsigned int getNLines(); | ||
| const auto& getHostLines() const { return mLinesHost; } | ||
| const auto& getHostLineRof() const { return mLineRofHost; } | ||
| const auto& getHostLineClusters() const { return mLineClustersHost; } | ||
|
|
||
| /// synchronization | ||
| auto& getStream(const size_t stream) { return mGpuStreams[stream]; } | ||
| auto& getStreams() { return mGpuStreams; } | ||
|
|
@@ -111,6 +131,17 @@ class TimeFrameGPU : public TimeFrame<NLayers> | |
| auto& getTrackITSExt() { return mTrackITSExt; } | ||
| auto& getTrackIndices() { return mTrackIndices; } | ||
| Vertex* getDeviceVertices() { return mPrimaryVerticesDevice; } | ||
| int* getDeviceROFramesClusters(const int layer) { return mROFramesClustersDevice[layer]; } | ||
| int* getDeviceClusterSortKeys(const int layer) { return mClusterSortKeysDevice[layer]; } | ||
| int* getDeviceClusterSortPerm(const int layer) { return mClusterSortPermDevice[layer]; } | ||
| Cluster* getDeviceUnsortedClusters(const int layer) { return mUnsortedClustersDevice[layer]; } | ||
| Cluster* getDeviceClusters(const int layer) { return mClustersDevice[layer]; } | ||
| int* getDeviceClustersIndexTable(const int layer) { return mClustersIndexTablesDevice[layer]; } | ||
| const float* getDeviceMinRs() const { return mClusterMinRDevice; } | ||
| const float* getDeviceMaxRs() const { return mClusterMaxRDevice; } | ||
| int* getDeviceROFramesPV() { return mROFramesPVDevice; } | ||
| unsigned char* getDeviceUsedClusters(const int); | ||
| const o2::base::Propagator* getChainPropagator(); | ||
|
|
||
| // Hybrid | ||
| TrackITSExt* getDeviceTrackITSExt() { return mTrackITSExtDevice; } | ||
|
|
@@ -119,6 +150,39 @@ class TimeFrameGPU : public TimeFrame<NLayers> | |
| TrackExtensionHypothesis<NLayers>* getDeviceNextTrackExtensionHypotheses() { return mNextTrackExtensionHypothesesDevice; } | ||
| int* getDeviceNeighboursLUT(const int layer) { return mNeighboursLUTDevice[layer]; } | ||
| CellNeighbour** getDeviceArrayNeighbours() { return mNeighboursDeviceArray; } | ||
| unsigned long long** getDeviceArrayClusterOwners() { return mClusterOwnersDeviceArray; } | ||
| o2::its::Line* getDeviceLines() { return mLinesDevice; } | ||
| int* getDeviceLineSlots() { return mLineSlotsDevice; } | ||
| int* getDeviceLineRof() { return mLineRofDevice; } | ||
| int* getDeviceLineClusters() { return mLineClustersDevice; } | ||
| float* getDeviceLineChi2() { return mLineChi2Device; } | ||
| float* getDeviceLinePt() { return mLinePtDevice; } | ||
| float* getDeviceLineZs() { return mLineZsDevice; } | ||
| o2::its::TimeEstBC* getDeviceLineTimes() { return mLineTimesDevice; } | ||
| int* getDeviceLineSortedIdx() { return mLinesSortedIdx; } | ||
| LineProjSoA getLineProjSoA() { return {mLineZsDevice, mLineTimesDevice, mLinesSortedIdx, mLineRofDevice}; } | ||
| LineProjSoA getLineProjSortedSoA() { return {mLineZsSortedDevice, mLineTimesSortedDevice, mLinesSortedIdx, mLineRofSortedDevice}; } | ||
| int* getDeviceRofLineOffsets() { return mRofLineOffsetsDevice; } | ||
| int* getDeviceLineDensity() { return mLineDensityDevice; } | ||
| gpu::LineWindow* getDeviceLineWin() { return mLineWinDevice; } | ||
| uint8_t* getDeviceLineIsPeak() { return mLineIsPeakDevice; } | ||
| int* getDeviceLineDensityFine() { return mLineDensityFineDevice; } | ||
| gpu::LineWindow* getDeviceLineWinFine() { return mLineWinFineDevice; } | ||
| uint8_t* getDeviceLineIsPeakFine() { return mLineIsPeakFineDevice; } | ||
| int* getDevicePeakScan() { return mPeakScanDevice; } | ||
| int* getDevicePeakLineIdx() { return mPeakLineIdxDevice; } | ||
| int* getDevicePeakOffsets() { return mPeakOffsetsDevice; } | ||
| const int* getDeviceNPeaks() { return mPeakOffsetsDevice + this->getNrof(1); } | ||
| VertexCand* getDeviceVertexCands() { return mVertexCandsDevice; } | ||
| int downloadVertexCandsDevice(); | ||
| void downloadPeakMembershipInputs(); // MC-only: peak indices, z-windows and the sorted time/idx columns | ||
| const auto& getHostVertexCands() const { return mVertexCandsHost; } | ||
| const auto& getHostPeakOffsets() const { return mPeakOffsetsHost; } | ||
| const auto& getHostPeakMembership() const { return mPeakMembershipHost; } | ||
| std::vector<o2::MCCompLabel>& getLineLabelFlat() { return mLineLabelFlatHost; } | ||
| const std::vector<o2::MCCompLabel>& getLineLabelFlat() const { return mLineLabelFlatHost; } | ||
| Vertex* getDeviceDiamond() { return mDiamondDevice; } | ||
| std::array<CellNeighbour*, MaxCells>& getDeviceNeighboursAll() { return mNeighboursDevice; } | ||
| CellNeighbour* getDeviceNeighbours(const int layer) { return mNeighboursDevice[layer]; } | ||
| const TrackingFrameInfo** getDeviceArrayTrackingFrameInfo() const { return mTrackingFrameInfoDeviceArray; } | ||
| const Cluster** getDeviceArrayClusters() const { return mClustersDeviceArray; } | ||
|
|
@@ -156,6 +220,10 @@ class TimeFrameGPU : public TimeFrame<NLayers> | |
| size_t getNumberOfCells() const final; | ||
| size_t getNumberOfNeighbours() const final; | ||
|
|
||
| protected: | ||
| void prepareClusters(const TrackingParameters& trkParam, const int maxLayers) override; | ||
| void allocateClusterSortStorage(const TrackingParameters& trkParam, const int maxLayers) override; | ||
|
|
||
| private: | ||
| enum class SlotInit { | ||
| Raw, ///< whatever the allocator handed back | ||
|
|
@@ -215,6 +283,11 @@ class TimeFrameGPU : public TimeFrame<NLayers> | |
| const int** mClustersIndexTablesDeviceArray{nullptr}; | ||
| uint8_t** mUsedClustersDeviceArray{nullptr}; | ||
| const int** mROFramesClustersDeviceArray{nullptr}; | ||
| int* mROFramesPVDevice; | ||
| std::array<int*, NLayers> mClusterSortKeysDevice{}; | ||
| std::array<int*, NLayers> mClusterSortPermDevice{}; | ||
| float* mClusterMinRDevice{nullptr}; | ||
| float* mClusterMaxRDevice{nullptr}; | ||
| std::array<Tracklet*, MaxLinks> mTrackletsDevice{}; | ||
| std::array<int*, MaxLinks> mTrackletsLUTDevice{}; | ||
| std::array<int*, MaxCells> mCellsLUTDevice{}; | ||
|
|
@@ -239,6 +312,40 @@ class TimeFrameGPU : public TimeFrame<NLayers> | |
| CellNeighbour** mNeighboursDeviceArray{nullptr}; | ||
| std::array<TrackingFrameInfo*, NLayers> mTrackingFrameInfoDevice{}; | ||
| const TrackingFrameInfo** mTrackingFrameInfoDeviceArray{nullptr}; | ||
| std::array<unsigned long long*, 3> mClusterOwnersDevice{}; | ||
| unsigned long long** mClusterOwnersDeviceArray{nullptr}; | ||
| int* mLineSlotsDevice{nullptr}; | ||
| o2::its::Line* mLinesDevice{nullptr}; | ||
| int* mLineRofDevice{nullptr}; | ||
| int* mLineClustersDevice{nullptr}; | ||
| float* mLineChi2Device{nullptr}; | ||
| float* mLinePtDevice{nullptr}; | ||
| float* mLineZsDevice{nullptr}; | ||
| o2::its::TimeEstBC* mLineTimesDevice{nullptr}; | ||
| float* mLineZsSortedDevice{nullptr}; | ||
| o2::its::TimeEstBC* mLineTimesSortedDevice{nullptr}; | ||
| int* mLinesSortedIdx{nullptr}; | ||
| int* mLineRofSortedDevice{nullptr}; // per (sorted) line's ROF | ||
| int* mRofLineOffsetsDevice{nullptr}; // CSR offsets into the (rof,z)-sorted lines, size nRofs+1 | ||
| int* mLineDensityDevice{nullptr}; // per (sorted) line: count of time-compatible neighbours in its z-window | ||
| gpu::LineWindow* mLineWinDevice{nullptr}; // per (sorted) line: [lo,hi) bounds of its z-window (sorted coords) | ||
| uint8_t* mLineIsPeakDevice{nullptr}; // per (sorted) line: 1 if it is a local density peak (vertex candidate) | ||
| int* mLineDensityFineDevice{nullptr}; | ||
| gpu::LineWindow* mLineWinFineDevice{nullptr}; | ||
| uint8_t* mLineIsPeakFineDevice{nullptr}; | ||
| int* mPeakScanDevice{nullptr}; // per (sorted) line: number of peaks strictly before it | ||
| int* mPeakLineIdxDevice{nullptr}; // per peak slot: the sorted line index it came from | ||
| int* mPeakOffsetsDevice{nullptr}; // CSR offsets into the compacted peaks | ||
| VertexCand* mVertexCandsDevice{nullptr}; | ||
| int mNLinesCapacity{0}; // = nCells the line buffers were sized for | ||
| std::vector<o2::its::Line> mLinesHost; | ||
| std::vector<int> mLineRofHost; | ||
| std::vector<int> mLineClustersHost; | ||
| std::vector<VertexCand> mVertexCandsHost; | ||
| std::vector<int> mPeakOffsetsHost; | ||
| PeakMembershipHost mPeakMembershipHost; | ||
| std::vector<o2::MCCompLabel> mLineLabelFlatHost; | ||
|
Comment on lines
+341
to
+347
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. should these not use the bounded_vector? |
||
| Vertex* mDiamondDevice{nullptr}; | ||
|
|
||
| // State | ||
| Streams mGpuStreams; | ||
|
|
||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I am not sure why this is necessary, the MC labels we only compute on the host (and general we are not using the labels in the first place for GPU)?