Skip to content

Commit 4d64784

Browse files
committed
GPU: Simplify some type_traits use, get rid of ::values and ::type
1 parent 46ef93f commit 4d64784

File tree

6 files changed

+13
-13
lines changed

6 files changed

+13
-13
lines changed

GPU/GPUTracking/Base/cuda/GPUReconstructionCUDAInternals.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -79,7 +79,7 @@ class GPUDebugTiming
7979
bool mDo;
8080
};
8181

82-
static_assert(std::is_convertible<cudaEvent_t, void*>::value, "CUDA event type incompatible to deviceEvent");
82+
static_assert(std::is_convertible_v<cudaEvent_t, void*>, "CUDA event type incompatible to deviceEvent");
8383

8484
} // namespace o2::gpu
8585

GPU/GPUTracking/Base/opencl/GPUReconstructionOCL.cxx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@
1818

1919
#include <map>
2020

21-
static_assert(std::is_convertible<cl_event, void*>::value, "OpenCL event type incompatible to deviceEvent");
21+
static_assert(std::is_convertible_v<cl_event, void*>, "OpenCL event type incompatible to deviceEvent");
2222

2323
#define GPUErrorReturn(...) \
2424
{ \

GPU/GPUTracking/Merger/GPUTPCGMMerger.cxx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -235,7 +235,7 @@ int64_t GPUTPCGMMerger::GetTrackLabelA(const S& trk) const
235235
{
236236
GPUTPCGMSectorTrack* sectorTrack = nullptr;
237237
int32_t nClusters = 0;
238-
if constexpr (std::is_same<S, GPUTPCGMBorderTrack&>::value) {
238+
if constexpr (std::is_same_v<S, GPUTPCGMBorderTrack&>) {
239239
sectorTrack = &mSectorTrackInfos[trk.TrackID()];
240240
nClusters = sectorTrack->OrigTrack()->NHits();
241241
} else {
@@ -244,7 +244,7 @@ int64_t GPUTPCGMMerger::GetTrackLabelA(const S& trk) const
244244
auto acc = GPUTPCTrkLbl<false, GPUTPCTrkLbl_ret>(resolveMCLabels<T>(GetConstantMem()->ioPtrs.clustersNative ? GetConstantMem()->ioPtrs.clustersNative->clustersMCTruth : nullptr, GetConstantMem()->ioPtrs.mcLabelsTPC), 0.5f);
245245
for (int32_t i = 0; i < nClusters; i++) {
246246
int32_t id;
247-
if constexpr (std::is_same<S, GPUTPCGMBorderTrack&>::value) {
247+
if constexpr (std::is_same_v<S, GPUTPCGMBorderTrack&>) {
248248
const GPUTPCTracker& tracker = GetConstantMem()->tpcTrackers[sectorTrack->Sector()];
249249
const GPUTPCHitId& ic = tracker.TrackHits()[sectorTrack->OrigTrack()->FirstHitID() + i];
250250
id = tracker.Data().ClusterDataIndex(tracker.Data().Row(ic.RowIndex()), ic.HitIndex()) + GetConstantMem()->ioPtrs.clustersNative->clusterOffset[sectorTrack->Sector()][0];

GPU/GPUTracking/qa/GPUQAHelper.h

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@ class GPUTPCTrkLbl
4848
}
4949
inline void addLabel(uint32_t elementId)
5050
{
51-
if constexpr (std::is_same<T, AliHLTTPCClusterMCWeight>::value) {
51+
if constexpr (std::is_same_v<T, AliHLTTPCClusterMCWeight>) {
5252
for (uint32_t i = 0; i < sizeof(mClusterLabels[elementId]) / sizeof(mClusterLabels[elementId].fClusterID[0]); i++) {
5353
const auto& element = mClusterLabels[elementId].fClusterID[i];
5454
if (element.fMCID >= 0) {
@@ -101,7 +101,7 @@ class GPUTPCTrkLbl
101101
}
102102
}
103103
auto& bestLabel = mLabels[bestLabelNum].first;
104-
if constexpr (std::is_same<T, AliHLTTPCClusterMCWeight>::value && WEIGHT) {
104+
if constexpr (std::is_same_v<T, AliHLTTPCClusterMCWeight> && WEIGHT) {
105105
*labelWeight = bestLabel.fWeight;
106106
*totalWeight = mTotalWeight;
107107
*maxCount = bestLabelCount;
@@ -147,7 +147,7 @@ struct GPUTPCTrkLbl_ret {
147147
template <bool WEIGHT = false, class U = void, class T, template <class> class S, typename... Args>
148148
static inline auto GPUTPCTrkLbl(const S<T>* x, Args... args)
149149
{
150-
if constexpr (std::is_same<U, void>::value) {
150+
if constexpr (std::is_same_v<U, void>) {
151151
return internal::GPUTPCTrkLbl<WEIGHT, T, S<T>>(x, args...);
152152
} else {
153153
return internal::GPUTPCTrkLbl<WEIGHT, T, S<T>, U>(x, args...);
@@ -159,7 +159,7 @@ static inline auto GPUTPCTrkLbl(const AliHLTTPCClusterMCLabel* x, Args... args)
159159
{
160160
using S = AliHLTTPCClusterMCLabel;
161161
using T = AliHLTTPCClusterMCWeight;
162-
if constexpr (std::is_same<U, void>::value) {
162+
if constexpr (std::is_same_v<U, void>) {
163163
return internal::GPUTPCTrkLbl<WEIGHT, T, S>(x, args...);
164164
} else {
165165
return internal::GPUTPCTrkLbl<WEIGHT, T, S, U>(x, args...);

GPU/GPUTracking/utils/bitfield.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -93,7 +93,7 @@ class bitfield
9393
}
9494

9595
#if !defined(GPUCA_GPUCODE_DEVICE)
96-
static_assert(std::is_integral<S>::value, "Storage type non integral");
96+
static_assert(std::is_integral_v<S>, "Storage type non integral");
9797
static_assert(sizeof(S) >= sizeof(T), "Storage type has insufficient capacity");
9898
#endif
9999

GPU/GPUTracking/utils/qconfig.cxx

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -126,7 +126,7 @@ static inline int32_t qAddOptionMainTupleElem(qConfigSettings<typename qSettings
126126
qConfigSettings<T> settings = settingsTup;
127127
return (qAddOptionType<T>(settings, ref, i, argv, argc, def));
128128
}
129-
template <typename T, int32_t index = 0, int32_t left = std::tuple_size<T>::value>
129+
template <typename T, int32_t index = 0, int32_t left = std::tuple_size_v<T>>
130130
struct qAddOptionMainTupleStruct {
131131
static inline int32_t qAddOptionMainTuple(qConfigSettings<typename qSettingsType<T>::settingsType> settings, T& tup, int32_t& i, const char** argv, const int argc)
132132
{
@@ -157,13 +157,13 @@ struct qConfigType {
157157
// Recursive handling of additional settings
158158
static inline void qProcessSetting(qConfigSettings<T>& settings, qmin_t<T> minval)
159159
{
160-
static_assert(!std::is_same<T, bool>::value, "min option not supported for boolean settings");
160+
static_assert(!std::is_same_v<T, bool>, "min option not supported for boolean settings");
161161
settings.checkMin = true;
162162
settings.min = minval.v;
163163
}
164164
static inline void qProcessSetting(qConfigSettings<T>& settings, qmax_t<T> maxval)
165165
{
166-
static_assert(!std::is_same<T, bool>::value, "max option not supported for boolean settings");
166+
static_assert(!std::is_same_v<T, bool>, "max option not supported for boolean settings");
167167
settings.checkMax = true;
168168
settings.max = maxval.v;
169169
}
@@ -244,7 +244,7 @@ struct qConfigType {
244244
static inline void qConfigHelpOption(const char* name, const char* type, const char* def, const char* optname, char optnameshort, const char* preopt, char preoptshort, int32_t optionType, const char* help, Args&&... args)
245245
{
246246
auto settings = qConfigGetSettings(args...);
247-
const bool boolType = optionType != 1 && std::is_same<T, bool>::value;
247+
const bool boolType = optionType != 1 && std::is_same_v<T, bool>;
248248
const char* arguments = settings.doSet ? " (" : (settings.doDefault || optionType == 1 || boolType) ? " [arg] (" : optionType == 2 ? " [...] (" : " arg (";
249249
char argBuffer[4] = {0};
250250
uint32_t argBufferPos = 0;

0 commit comments

Comments
 (0)