Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
32 changes: 32 additions & 0 deletions GPU/Common/GPUCommonNumericLimits.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
// Copyright 2019-2026 CERN and copyright holders of ALICE O2.
// See https://alice-o2.web.cern.ch/copyright for details of the copyright holders.
// All rights not expressly granted are reserved.
//
// This software is distributed under the terms of the GNU General Public
// License v3 (GPL Version 3), copied verbatim in the file "COPYING".
//
// In applying this license CERN does not waive the privileges and immunities
// granted to it by virtue of its status as an Intergovernmental Organization
// or submit itself to any jurisdiction.

/// \file GPUCommonNumericLimits.h

#ifndef GPUCOMMONNUMERICLIMITS_H
#define GPUCOMMONNUMERICLIMITS_H

#include "GPUCommonDef.h"

#if !defined(GPUCA_GPUCODE_DEVICE) || defined(__CUDACC__) || defined(__HIPCC__) // TODO: Get rid of this once std is available in all backends
#ifndef GPUCA_GPUCODE_COMPILEKERNELS
#include <limits>
#endif
#elif defined(__METAL__) // metal::numeric_limits comes with <metal_stdlib>, which the Metal kernel source includes first
namespace std
{
using metal::numeric_limits;
} // namespace std
#else
// Not supported yet for OpenCL / other backends
#endif

#endif
4 changes: 4 additions & 0 deletions GPU/Common/GPUCommonTypeTraits.h
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,10 @@
#endif
namespace std
{
template <class T>
GPUCA_TT_PROGRAMSCOPE static constexpr bool is_standard_layout_v = __is_standard_layout(T);
template <class T>
GPUCA_TT_PROGRAMSCOPE static constexpr bool is_trivially_copyable_v = __is_trivially_copyable(T);
template <bool B, class T, class F>
struct conditional {
typedef T type;
Expand Down
Loading