Repository navigation
GPU: provide the layout type traits on all device backends, numeric_limits for Metal - #16181
Conversation
|
@davidrohr this will be needed by the ITS Metal port. |
| #endif | ||
| namespace std | ||
| { | ||
| #ifdef __METAL__ |
There was a problem hiding this comment.
Why only for metal? These are just normal type traits? So we should provide them for all GPU backends, which do not include <type_traits>? Or what am I missing?
|
For |
CUDA and HIP include <type_traits>, so all traits come from the standard library for them. This header is basically disabled for them and just forwards to type_traits. |
|
Ok, I kept only |
…imits for Metal OpenCL C++ and MSL have no <type_traits>, so GPUCommonTypeTraits now provides is_standard_layout_v and is_trivially_copyable_v for both, spelled like its other program-scope variables. numeric_limits is not a type trait, so it gets its own GPUCommonNumericLimits.h, with the same backend selection: <limits> on the host, CUDA and HIP, metal::numeric_limits as std::numeric_limits for Metal, nothing yet for OpenCL.
|
@davidrohr Separate file, as discussed offline. |
OpenCL C++ and MSL have no <type_traits>, so GPUCommonTypeTraits now provides
is_standard_layout_v and is_trivially_copyable_v for both, spelled like its
other program-scope variables.
numeric_limits is not a type trait, so it gets its own GPUCommonNumericLimits.h,
with the same backend selection: on the host, CUDA and HIP,
metal::numeric_limits as std::numeric_limits for Metal, nothing yet for OpenCL.