Skip to content

Commit 5b54e2f

Browse files
committed
DetectorsCommonDataFormats: place DetID 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 a9654fb commit 5b54e2f

1 file changed

Lines changed: 33 additions & 31 deletions

File tree

  • DataFormats/Detectors/Common/include/DetectorsCommonDataFormats

‎DataFormats/Detectors/Common/include/DetectorsCommonDataFormats/DetID.h‎

Lines changed: 33 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,8 @@
2828
#ifndef O2_BASE_DETID_
2929
#define O2_BASE_DETID_
3030

31+
#include "GPUCommonDef.h"
32+
3133
#include "GPUCommonRtypes.h"
3234
#include "GPUCommonBitSet.h"
3335
#include "MathUtils/Utils.h"
@@ -60,45 +62,45 @@ class DetID
6062
/// Detector identifiers: continuous, starting from 0
6163
typedef int ID;
6264

63-
static constexpr ID ITS = 0;
64-
static constexpr ID TPC = 1;
65-
static constexpr ID TRD = 2;
66-
static constexpr ID TOF = 3;
67-
static constexpr ID PHS = 4;
68-
static constexpr ID CPV = 5;
69-
static constexpr ID EMC = 6;
70-
static constexpr ID HMP = 7;
71-
static constexpr ID MFT = 8;
72-
static constexpr ID MCH = 9;
73-
static constexpr ID MID = 10;
74-
static constexpr ID ZDC = 11;
75-
static constexpr ID FT0 = 12;
76-
static constexpr ID FV0 = 13;
77-
static constexpr ID FDD = 14;
78-
static constexpr ID TST = 15;
79-
static constexpr ID CTP = 16;
80-
static constexpr ID FOC = 17;
65+
static GPUglobalconstexpr() ID ITS = 0;
66+
static GPUglobalconstexpr() ID TPC = 1;
67+
static GPUglobalconstexpr() ID TRD = 2;
68+
static GPUglobalconstexpr() ID TOF = 3;
69+
static GPUglobalconstexpr() ID PHS = 4;
70+
static GPUglobalconstexpr() ID CPV = 5;
71+
static GPUglobalconstexpr() ID EMC = 6;
72+
static GPUglobalconstexpr() ID HMP = 7;
73+
static GPUglobalconstexpr() ID MFT = 8;
74+
static GPUglobalconstexpr() ID MCH = 9;
75+
static GPUglobalconstexpr() ID MID = 10;
76+
static GPUglobalconstexpr() ID ZDC = 11;
77+
static GPUglobalconstexpr() ID FT0 = 12;
78+
static GPUglobalconstexpr() ID FV0 = 13;
79+
static GPUglobalconstexpr() ID FDD = 14;
80+
static GPUglobalconstexpr() ID TST = 15;
81+
static GPUglobalconstexpr() ID CTP = 16;
82+
static GPUglobalconstexpr() ID FOC = 17;
8183
#ifdef ENABLE_UPGRADES
82-
static constexpr ID IT3 = 18;
83-
static constexpr ID TRK = 19;
84-
static constexpr ID FT3 = 20;
85-
static constexpr ID FCT = 21;
86-
static constexpr ID TF3 = 22;
87-
static constexpr ID RCH = 23;
88-
static constexpr ID MI3 = 24;
89-
static constexpr ID ECL = 25;
90-
static constexpr ID FD3 = 26;
91-
static constexpr ID Last = FD3;
84+
static GPUglobalconstexpr() ID IT3 = 18;
85+
static GPUglobalconstexpr() ID TRK = 19;
86+
static GPUglobalconstexpr() ID FT3 = 20;
87+
static GPUglobalconstexpr() ID FCT = 21;
88+
static GPUglobalconstexpr() ID TF3 = 22;
89+
static GPUglobalconstexpr() ID RCH = 23;
90+
static GPUglobalconstexpr() ID MI3 = 24;
91+
static GPUglobalconstexpr() ID ECL = 25;
92+
static GPUglobalconstexpr() ID FD3 = 26;
93+
static GPUglobalconstexpr() ID Last = FD3;
9294
#else
9395
static constexpr ID Last = FOC; ///< if extra detectors added, update this !!!
9496
#endif
95-
static constexpr ID First = ITS;
97+
static GPUglobalconstexpr() ID First = ITS;
9698

97-
static constexpr int nDetectors = Last + 1; ///< number of defined detectors
99+
static GPUglobalconstexpr() int nDetectors = Last + 1; ///< number of defined detectors
98100
typedef o2::gpu::gpustd::bitset<32> mask_t;
99101
static_assert(nDetectors <= 32, "bitset<32> insufficient");
100102

101-
static constexpr mask_t FullMask = (0x1u << nDetectors) - 1;
103+
static GPUglobalconstexpr() mask_t FullMask = (0x1u << nDetectors) - 1;
102104

103105
#ifndef GPUCA_GPUCODE_DEVICE
104106
static constexpr std::string_view NONE{"none"}; ///< keywork for no-detector

0 commit comments

Comments
 (0)