Skip to content

Commit a3a5c9b

Browse files
mconcasdavidrohr
authored andcommitted
Fix some HIP specific issues
1 parent 33066f9 commit a3a5c9b

4 files changed

Lines changed: 17 additions & 5 deletions

File tree

DataFormats/Reconstruction/include/ReconstructionDataFormats/Vertex.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ class VertexBase
4040
kCovYZ,
4141
kCovZZ };
4242
static constexpr int kNCov = 6;
43-
GPUdDefault() VertexBase() = default;
43+
GPUhd() VertexBase() = default;
4444
GPUdDefault() ~VertexBase() = default;
4545
GPUd() VertexBase(const math_utils::Point3D<float>& pos, const gpu::gpustd::array<float, kNCov>& cov) : mPos(pos), mCov(cov)
4646
{
@@ -119,7 +119,7 @@ class Vertex : public VertexBase
119119
FlagsMask = 0xffff
120120
};
121121

122-
GPUdDefault() Vertex() = default;
122+
GPUhd() Vertex() = default;
123123
GPUdDefault() ~Vertex() = default;
124124
GPUd() Vertex(const math_utils::Point3D<float>& pos, const gpu::gpustd::array<float, kNCov>& cov, ushort nCont, float chi2)
125125
: VertexBase(pos, cov), mNContributors(nCont), mChi2(chi2)

DataFormats/common/include/CommonDataFormat/TimeStamp.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ template <typename T>
2525
class TimeStamp
2626
{
2727
public:
28-
GPUdDefault() TimeStamp() CON_DEFAULT;
28+
GPUhd() TimeStamp() CON_DEFAULT;
2929
GPUdDefault() ~TimeStamp() CON_DEFAULT;
3030
GPUdi() TimeStamp(T time) { mTimeStamp = time; }
3131
GPUdi() T getTimeStamp() const { return mTimeStamp; }

Detectors/ITSMFT/ITS/tracking/GPU/ITStrackingGPU/TimeFrameGPU.h

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -73,7 +73,11 @@ class TimeFrameGPU : public TimeFrame
7373
int* getDeviceXHistograms(const int rofId);
7474
int* getDeviceYHistograms(const int rofId);
7575
int* getDeviceZHistograms(const int rofId);
76+
#ifdef __HIPCC__
77+
hipcub::KeyValuePair<int, int>* getTmpVertexPositionBins(const int rofId);
78+
#else
7679
cub::KeyValuePair<int, int>* getTmpVertexPositionBins(const int rofId);
80+
#endif
7781
float* getDeviceBeamPosition(const int rofId);
7882
Vertex* getDeviceVertices(const int rofId);
7983

@@ -100,9 +104,13 @@ class TimeFrameGPU : public TimeFrame
100104
Vector<float> mZCentroids;
101105
std::array<Vector<int>, 2> mNTrackletsPerClusterD;
102106
std::array<Vector<int>, 3> mXYZHistograms;
103-
Vector<cub::KeyValuePair<int, int>> mTmpVertexPositionBins;
104107
Vector<float> mBeamPosition;
105108
Vector<Vertex> mGPUVertices;
109+
#ifdef __HIPCC__
110+
Vector<hipcub::KeyValuePair<int, int>> mTmpVertexPositionBins;
111+
#else
112+
Vector<cub::KeyValuePair<int, int>> mTmpVertexPositionBins;
113+
#endif
106114
};
107115

108116
template <int NLayers>
@@ -235,7 +243,11 @@ inline int* TimeFrameGPU<NLayers>::getDeviceZHistograms(const int rofId)
235243
}
236244

237245
template <int NLayers>
246+
#ifdef __HIPCC__
247+
inline hipcub::KeyValuePair<int, int>* TimeFrameGPU<NLayers>::getTmpVertexPositionBins(const int rofId)
248+
#else
238249
inline cub::KeyValuePair<int, int>* TimeFrameGPU<NLayers>::getTmpVertexPositionBins(const int rofId)
250+
#endif
239251
{
240252
if (rofId < 0 || rofId >= mNrof) {
241253
LOG(error) << "Invalid rofId: " << rofId << "/" << mNrof << ", returning nullptr";

Detectors/ITSMFT/ITS/tracking/GPU/cuda/VertexerTraitsGPU.cu

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -342,7 +342,7 @@ GPUg() void computeVertexKernel(cub::KeyValuePair<int, int>* tmpVertexBins,
342342
histZ[iBin] = 0;
343343
}
344344
if (sumWZ > minContributors || vertIndex == 0) {
345-
new (vertices + vertIndex) Vertex{o2::math_utils::Point3D<float>(beamPosition[0], beamPosition[1], wZ / sumWZ), o2::gpu::gpustd::array<float, 6>{ex, 0, ey, 0, 0, ez}, sumWZ, 0};
345+
new (vertices + vertIndex) Vertex{o2::math_utils::Point3D<float>(beamPosition[0], beamPosition[1], wZ / sumWZ), o2::gpu::gpustd::array<float, 6>{ex, 0, ey, 0, 0, ez}, static_cast<ushort>(sumWZ), 0};
346346
} else {
347347
new (vertices + vertIndex) Vertex{};
348348
}

0 commit comments

Comments
 (0)