Skip to content

Commit dccd039

Browse files
committed
GPU: three additional Metal adaptations
GPUCommonAlgorithm::sortOnDevice takes an auto parameter, which is C++20. It is already skipped for OpenCL, at C++17, and MSL 4.1 reports C++17 as well. GPUTPCTrackParam::TransportToXAlpha declares its material constants static at function scope, which MSL rejects; constexpr without static is accepted, as in SMatrixGPU. Guard SMatrixGPU C++20 code using __cplusplus version macro.
1 parent 4f90725 commit dccd039

3 files changed

Lines changed: 5 additions & 5 deletions

File tree

‎Common/MathUtils/include/MathUtils/SMatrixGPU.h‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -518,7 +518,7 @@ class SMatrixGPU
518518
R mRep;
519519
};
520520

521-
#if !defined(__OPENCL__) && !defined(__METAL__) // TODO: current C++ for OpenCL 2021 and MSL 4.1 are both at C++17, so no concepts. But we don't need this trick there anyway, so we can just hide it.
521+
#if __cplusplus >= 202002L // the constraint below is a requires-clause; we do not need the trick where there are no concepts
522522
template <class T, unsigned int D1, unsigned int D2, class R, typename Y, typename X = Y>
523523
requires(sizeof(typename X::traits_type::pos_type) != 0) // do not provide a template to fair::Logger, etc... (pos_type is a member type of all std::ostream classes)
524524
GPUd() X& operator<<(Y& y, const SMatrixGPU<T, D1, D2, R>&)

‎GPU/Common/GPUCommonAlgorithm.h‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ class GPUCommonAlgorithm
4141
GPUd() static void sortInBlock(T* begin, T* end, const S& comp);
4242
template <class T, class S>
4343
GPUd() static void sortDeviceDynamic(T* begin, T* end, const S& comp);
44-
#ifndef __OPENCL__
44+
#if __cplusplus >= 202002L // sortOnDevice takes an auto parameter
4545
template <class T, class S>
4646
GPUh() static void sortOnDevice(auto* rec, int32_t stream, T* begin, size_t N, const S& comp);
4747
#endif

‎GPU/GPUTracking/SectorTracker/GPUTPCTrackParam.cxx‎

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -304,10 +304,10 @@ GPUd() bool GPUTPCTrackParam::TransportToXWithMaterial(float x, GPUTPCTrackLinea
304304
{
305305
//* Transport the track parameters to X=x taking into account material budget
306306

307-
static constexpr float kRho = 1.025e-3f; // [g/cm^3]
308-
static constexpr float kRadLen = 28811.7f; //[cm]
307+
constexpr float kRho = 1.025e-3f; // [g/cm^3]
308+
constexpr float kRadLen = 28811.7f; //[cm]
309309

310-
static constexpr float kRadLenInv = 1.f / kRadLen;
310+
constexpr float kRadLenInv = 1.f / kRadLen;
311311
float dl;
312312

313313
if (!TransportToX(x, t0, Bz, maxSinPhi, &dl)) {

0 commit comments

Comments
 (0)