//@HEADER // ************************************************************************ // // Kokkos v. 4.0 // Copyright (2022) National Technology & Engineering // Solutions of Sandia, LLC (NTESS). // // Under the terms of Contract DE-NA0003525 with NTESS, // the U.S. Government retains certain rights in this software. // // Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions. // See https://kokkos.org/LICENSE for license information. // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // //@HEADER #ifndef KOKKOS_IMPL_PUBLIC_INCLUDE #include static_assert(false, "Including non-public Kokkos header files is not allowed."); #endif #ifndef KOKKOS_KOKKOS_EXTENTS_HPP #define KOKKOS_KOKKOS_EXTENTS_HPP #include #include #include #ifdef KOKKOS_ENABLE_IMPL_MDSPAN #include #else #include #endif namespace Kokkos { #ifndef KOKKOS_ENABLE_IMPL_MDSPAN constexpr size_t dynamic_extent = std::numeric_limits::max(); #endif namespace Experimental { template struct Extents { /* TODO @enhancement flesh this out more */ }; template struct PrependExtent; template struct PrependExtent, NewExtent> { using type = Extents; }; template struct AppendExtent; template struct AppendExtent, NewExtent> { using type = Extents; }; } // end namespace Experimental namespace Impl { namespace _parse_view_extents_impl { template struct _all_remaining_extents_dynamic : std::true_type {}; template struct _all_remaining_extents_dynamic : _all_remaining_extents_dynamic { }; template struct _all_remaining_extents_dynamic : std::false_type {}; template struct _parse_impl { using type = Result; }; // We have to treat the case of int**[x] specially, since it *doesn't* go // backwards template struct _parse_impl, std::enable_if_t<_all_remaining_extents_dynamic::value>> : _parse_impl> {}; // int*(*[x])[y] should still work also (meaning int[][x][][y]) template struct _parse_impl< T*, Kokkos::Experimental::Extents, std::enable_if_t::value>> { using _next = Kokkos::Experimental::AppendExtent< typename _parse_impl, void>::type, Kokkos::dynamic_extent>; using type = typename _next::type; }; template struct _parse_impl, void> : _parse_impl // TODO @pedantic // this could be a // narrowing cast > {}; } // end namespace _parse_view_extents_impl template struct ParseViewExtents { using type = typename _parse_view_extents_impl ::_parse_impl< DataType, Kokkos::Experimental::Extents<>>::type; }; template struct ApplyExtent { using type = ValueType[Ext]; }; template struct ApplyExtent { using type = ValueType*; }; template struct ApplyExtent { using type = typename ApplyExtent::type[N]; }; template struct ApplyExtent { using type = ValueType * [Ext]; }; template struct ApplyExtent { using type = typename ApplyExtent::type*; }; template struct ApplyExtent { using type = typename ApplyExtent::type[N]; }; } // end namespace Impl } // end namespace Kokkos #endif // KOKKOS_KOKKOS_EXTENTS_HPP