Skip to content

Commit 45e95e5

Browse files
committed
TPCFastTransformation: place shared constants in the constant address space
MSL requires every variable at program scope, class-scope statics included, to name an address space. GPUglobalconstexpr() expands to constexpr everywhere except Metal, so this is a no-op for host, CUDA, HIP, OpenCL and cling.
1 parent 8391fbd commit 45e95e5

4 files changed

Lines changed: 14 additions & 10 deletions

File tree

‎GPU/TPCFastTransformation/TPCFastSpaceChargeCorrection.h‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -285,7 +285,7 @@ class TPCFastSpaceChargeCorrection : public FlatObject
285285
/// release temporary memory used during construction
286286
void releaseConstructionMemory();
287287

288-
static constexpr float kMaxCorrection = 100.f; ///< maximum correction value, used to protect from FPEs
288+
static GPUglobalconstexpr() float kMaxCorrection = 100.f; ///< maximum correction value, used to protect from FPEs
289289

290290
/// _______________ Data members _______________________________________________
291291

‎GPU/TPCFastTransformation/TPCFastTransform.h‎

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,8 @@
1717
#ifndef ALICEO2_GPUCOMMON_TPCFASTTRANSFORMATION_TPCFASTTRANSFORM_H
1818
#define ALICEO2_GPUCOMMON_TPCFASTTRANSFORMATION_TPCFASTTRANSFORM_H
1919

20+
#include "GPUCommonDef.h"
21+
2022
#include "FlatObject.h"
2123
#include "TPCFastTransformGeo.h"
2224
#include "TPCFastSpaceChargeCorrection.h"
@@ -94,8 +96,8 @@ struct TPCSlowSpaceChargeCorrection {
9496
class TPCFastTransform : public FlatObject
9597
{
9698
public:
97-
static constexpr float DEFLUMI = -1e6f; // default value to check if member was set
98-
static constexpr float DEFIDC = -1e6f; // default value to check if member was set
99+
static GPUglobalconstexpr() float DEFLUMI = -1e6f; // default value to check if member was set
100+
static GPUglobalconstexpr() float DEFIDC = -1e6f; // default value to check if member was set
99101

100102
/// _____________ Constructors / destructors __________________________
101103

‎GPU/TPCFastTransformation/TPCFastTransformGeo.h‎

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -175,9 +175,9 @@ class TPCFastTransformGeo
175175
private:
176176
/// _______________ Data members _______________________________________________
177177

178-
static constexpr int32_t NumberOfSectors = o2::tpc::constants::MAXSECTOR; ///< Number of TPC sectors ( sector = inner + outer sector )
179-
static constexpr int32_t NumberOfSectorsA = NumberOfSectors / 2; ///< Number of TPC sectors side A
180-
static constexpr int32_t MaxNumberOfRows = 160; ///< Max Number of TPC rows in a sector - MUST NOT CHANGE THIS due to on-disk format of stored maps
178+
static GPUglobalconstexpr() int32_t NumberOfSectors = o2::tpc::constants::MAXSECTOR; ///< Number of TPC sectors ( sector = inner + outer sector )
179+
static GPUglobalconstexpr() int32_t NumberOfSectorsA = NumberOfSectors / 2; ///< Number of TPC sectors side A
180+
static GPUglobalconstexpr() int32_t MaxNumberOfRows = 160; ///< Max Number of TPC rows in a sector - MUST NOT CHANGE THIS due to on-disk format of stored maps
181181

182182
/// _______________ Construction control _______________________________________________
183183

‎GPU/TPCFastTransformation/TPCFastTransformPOD.h‎

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,8 @@
1717
#ifndef ALICEO2_GPU_TPCFastTransformPOD_H
1818
#define ALICEO2_GPU_TPCFastTransformPOD_H
1919

20+
#include "GPUCommonDef.h"
21+
2022
#include "GPUCommonRtypes.h"
2123
#include "TPCFastTransform.h"
2224
#include "TPCFastTransformGeoPOD.h"
@@ -240,10 +242,10 @@ class TPCFastTransformPOD
240242

241243
GPUd() float convDriftLengthToTime(float driftLength, float vertexTime) const;
242244

243-
static constexpr int NROWS = o2::tpc::constants::MAXGLOBALPADROW;
244-
static constexpr int NSECTORS = o2::tpc::constants::MAXSECTOR;
245-
static constexpr int NSECTORSA = o2::tpc::constants::MAXSECTOR / 2;
246-
static constexpr int NSplineIDs = 3; ///< number of spline data sets for each sector/row
245+
static GPUglobalconstexpr() int NROWS = o2::tpc::constants::MAXGLOBALPADROW;
246+
static GPUglobalconstexpr() int NSECTORS = o2::tpc::constants::MAXSECTOR;
247+
static GPUglobalconstexpr() int NSECTORSA = o2::tpc::constants::MAXSECTOR / 2;
248+
static GPUglobalconstexpr() int NSplineIDs = 3; ///< number of spline data sets for each sector/row
247249

248250
private:
249251
#if !defined(GPUCA_GPUCODE)

0 commit comments

Comments
 (0)