You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
During PR #2317 (comment) there was the question if we already support the native implementation of C++23 std::mdspan. At the moment we do not support it. Instead we use the reference implementation from the kokkos team. This implementation has the two major advantages that it supports C++17 and is working with all our back-ends.
@fwyzard Suggest that we should use the native implementation of the standard library if the available. Therefore we have to solve two different problems.
C++ 20 and older only supports only the access operator[] with one argument. Instead the operator() is used in the kokkos implementation. If C++23 is used, also the operator[] is available. The standard library implementation only supports the operator[]. Ether we write our codes with an preprocessor if-else or we use a wrapper function to provide the operator() function for the standard library implementation.
Supporting the different back-ends. At the moment only the llvm C++ standard library (libc++) and the Microsoft compiler supports std::mdspan. Therefore the following back-ends works or not.
Working
Clang + libc++ for CPU backends
HIP + libc++
Not working
GCC (in theory it supports the libc++ but we do not support this)
NVCC (does not support the libc++ in general)
Clang as CUDA compiler (does not support the libc++ in general)
Unknown/no tested
MSVC (not tested but should work)
Apple Clang (not tested but should work)
OneAPI/Intel ICPX + libc++ (can work, because the compiler is clang based)
So, we need to implement a mechanism, which checks if the standard library is available and working with the active backend. Otherwise we need to use the kokkos implementation.
The text was updated successfully, but these errors were encountered:
So, we need to implement a mechanism, which checks if the standard library is available and working with the active backend.
We could use
#if __cpp_lib_mdspan >= 202207L
// use the c++23 mdspan
# include<mdspan>using mdspan = std::mdspan;
#else// use the standalone version
# include<experimental/mdspan>using mdspan = std::experimental::mdspan;
#endif
For the accessors, we could use
#if __cplusplus >= 202302L
// use the [x,y] accessor
#else// use the (x,y) accessor
#endif
Actual I would prefer the wrapper. But in this case, we need to inherit from std::mdspan to implement the operator(). Therefore we can also not use the stl implementation directly.
During PR #2317 (comment) there was the question if we already support the native implementation of C++23
std::mdspan
. At the moment we do not support it. Instead we use the reference implementation from the kokkos team. This implementation has the two major advantages that it supports C++17 and is working with all our back-ends.@fwyzard Suggest that we should use the native implementation of the standard library if the available. Therefore we have to solve two different problems.
operator[]
with one argument. Instead theoperator()
is used in the kokkos implementation. If C++23 is used, also theoperator[]
is available. The standard library implementation only supports theoperator[]
. Ether we write our codes with an preprocessor if-else or we use a wrapper function to provide theoperator()
function for the standard library implementation.libc++
) and the Microsoft compiler supportsstd::mdspan
. Therefore the following back-ends works or not.Working
Not working
Unknown/no tested
https://en.cppreference.com/w/cpp/compiler_support#cpp23
So, we need to implement a mechanism, which checks if the standard library is available and working with the active backend. Otherwise we need to use the kokkos implementation.
The text was updated successfully, but these errors were encountered: