Skip to content

Commit 8c1a139

Browse files
committed
GPUUtils: 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 9be7382 commit 8c1a139

2 files changed

Lines changed: 3 additions & 3 deletions

File tree

GPU/Utils/GPUCommonBitSet.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ class bitset
4242
GPUdDefault() constexpr bitset(const __constant bitset&) = default;
4343
#endif // __OPENCL__
4444
GPUd() constexpr bitset(uint32_t vv) : v(vv) {};
45-
static constexpr uint32_t full_set = ((1ul << N) - 1ul);
45+
static GPUglobalconstexpr() uint32_t full_set = ((1ul << N) - 1ul);
4646

4747
GPUd() constexpr bool all() const { return (v & full_set) == full_set; }
4848
GPUd() constexpr bool any() const { return v & full_set; }

GPU/Utils/MultivariatePolynomialHelper.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -163,8 +163,8 @@ class MultivariatePolynomialParametersHelper
163163
template <uint32_t Dim, uint32_t Degree, bool InteractionOnly>
164164
class MultivariatePolynomialHelper : public MultivariatePolynomialParametersHelper
165165
{
166-
static constexpr uint16_t FMaxdim = 10; ///< maximum dimensionality of the polynomials (number of different digits: 0,1,2,3....9 )
167-
static constexpr uint16_t FMaxdegree = 9; ///< maximum degree of the polynomials (maximum number of digits in unsigned integer - 1)
166+
static GPUglobalconstexpr() uint16_t FMaxdim = 10; ///< maximum dimensionality of the polynomials (number of different digits: 0,1,2,3....9 )
167+
static GPUglobalconstexpr() uint16_t FMaxdegree = 9; ///< maximum degree of the polynomials (maximum number of digits in unsigned integer - 1)
168168

169169
#if !defined(GPUCA_GPUCODE)
170170
static_assert(Dim <= MultivariatePolynomialHelper<Dim, Degree, InteractionOnly>::FMaxdim && Degree <= MultivariatePolynomialHelper<Dim, Degree, InteractionOnly>::FMaxdegree, "Max. number of dimensions or degrees exceeded!");

0 commit comments

Comments
 (0)