Team Ai
Datasetpublic

codekingpro/portable-devtools

sourceHugging Faceupdated 5mo agoView on Hugging Face
1likes14kdownloads
config.h288 linesDownload Raw Back to __mdspan
1/*2//@HEADER3// ************************************************************************4//5//                        Kokkos v. 2.06//              Copyright (2019) Sandia Corporation7//8// Under the terms of Contract DE-AC04-94AL85000 with Sandia Corporation,9// the U.S. Government retains certain rights in this software.10//11// Redistribution and use in source and binary forms, with or without12// modification, are permitted provided that the following conditions are13// met:14//15// 1. Redistributions of source code must retain the above copyright16// notice, this list of conditions and the following disclaimer.17//18// 2. Redistributions in binary form must reproduce the above copyright19// notice, this list of conditions and the following disclaimer in the20// documentation and/or other materials provided with the distribution.21//22// 3. Neither the name of the Corporation nor the names of the23// contributors may be used to endorse or promote products derived from24// this software without specific prior written permission.25//26// THIS SOFTWARE IS PROVIDED BY SANDIA CORPORATION "AS IS" AND ANY27// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE28// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR29// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL SANDIA CORPORATION OR THE30// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,31// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,32// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR33// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF34// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING35// NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS36// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.37//38// Questions? Contact Christian R. Trott (crtrott@sandia.gov)39//40// ************************************************************************41//@HEADER42*/43 44#ifndef _LIBCUDACXX___MDSPAN_CONFIG_HPP45#define _LIBCUDACXX___MDSPAN_CONFIG_HPP46 47#ifndef __cuda_std__48#include <__config>49#endif // __cuda_std__50 51#if _LIBCUDACXX_STD_VER > 1152 53#ifndef __has_include54#  define __has_include(x) 055#endif56 57#ifndef __cuda_std__58#if __has_include(<version>)59#  include <version>60#else61#  include <type_traits>62#  include <utility>63#endif64#endif65 66#ifdef _MSVC_LANG67#define __MDSPAN_CPLUSPLUS _MSVC_LANG68#else69#define __MDSPAN_CPLUSPLUS __cplusplus70#endif71 72#define __MDSPAN_CXX_STD_14 201402L73#define __MDSPAN_CXX_STD_17 201703L74#define __MDSPAN_CXX_STD_20 202002L75 76#define __MDSPAN_HAS_CXX_14 (__MDSPAN_CPLUSPLUS >= __MDSPAN_CXX_STD_14)77#define __MDSPAN_HAS_CXX_17 (__MDSPAN_CPLUSPLUS >= __MDSPAN_CXX_STD_17)78#define __MDSPAN_HAS_CXX_20 (__MDSPAN_CPLUSPLUS >= __MDSPAN_CXX_STD_20)79 80static_assert(__MDSPAN_CPLUSPLUS >= __MDSPAN_CXX_STD_14, "mdspan requires C++14 or later.");81 82#ifndef __MDSPAN_COMPILER_CLANG83#  if defined(__clang__)84#    define __MDSPAN_COMPILER_CLANG __clang__85#  endif86#endif87 88#if !defined(__MDSPAN_COMPILER_MSVC) && !defined(__MDSPAN_COMPILER_MSVC_CLANG)89#  if defined(_MSC_VER)90#    if !defined(__MDSPAN_COMPILER_CLANG)91#      define __MDSPAN_COMPILER_MSVC _MSC_VER92#    else93#      define __MDSPAN_COMPILER_MSVC_CLANG _MSC_VER94#    endif95#  endif96#endif97 98#ifndef __MDSPAN_COMPILER_INTEL99#  ifdef __INTEL_COMPILER100#    define __MDSPAN_COMPILER_INTEL __INTEL_COMPILER101#  endif102#endif103 104#ifndef __MDSPAN_COMPILER_APPLECLANG105#  ifdef __apple_build_version__106#    define __MDSPAN_COMPILER_APPLECLANG __apple_build_version__107#  endif108#endif109 110#ifndef __MDSPAN_HAS_CUDA111#  if defined(__CUDACC__)112#    define __MDSPAN_HAS_CUDA __CUDACC__113#  endif114#endif115 116#ifndef __MDSPAN_HAS_HIP117#  if defined(__HIPCC__)118#    define __MDSPAN_HAS_HIP __HIPCC__119#  endif120#endif121 122#ifndef __has_cpp_attribute123#  define __has_cpp_attribute(x) 0124#endif125 126#ifndef __MDSPAN_PRESERVE_STANDARD_LAYOUT127// Preserve standard layout by default, but we're not removing the old version128// that turns this off until we're sure this doesn't have an unreasonable cost129// to the compiler or optimizer.130#  define __MDSPAN_PRESERVE_STANDARD_LAYOUT 1131#endif132 133#ifndef __MDSPAN_USE_CONCEPTS134// Looks like concepts doesn't work in CUDA 12135#  if defined(__cpp_concepts) && __cpp_concepts >= 201507L && !defined __cuda_std__136#    define __MDSPAN_USE_CONCEPTS 1137#  endif138#endif139 140#ifndef __MDSPAN_USE_FOLD_EXPRESSIONS141#  if (defined(__cpp_fold_expressions) && __cpp_fold_expressions >= 201603L) \142          || (!defined(__cpp_fold_expressions) && __MDSPAN_HAS_CXX_17)143#    define __MDSPAN_USE_FOLD_EXPRESSIONS 1144#  endif145#endif146 147#ifndef __MDSPAN_NEEDS_TRAIT_VARIABLE_TEMPLATE_BACKPORTS148#  if (!(defined(__cpp_lib_type_trait_variable_templates) && __cpp_lib_type_trait_variable_templates >= 201510L) \149          || !__MDSPAN_HAS_CXX_17)150#    if !(defined(__MDSPAN_COMPILER_APPLECLANG) && __MDSPAN_HAS_CXX_17)151#      define __MDSPAN_NEEDS_TRAIT_VARIABLE_TEMPLATE_BACKPORTS 1152#    endif153#  endif154#endif155 156#ifndef __MDSPAN_USE_VARIABLE_TEMPLATES157#  if (defined(__cpp_variable_templates) && __cpp_variable_templates >= 201304 && __MDSPAN_HAS_CXX_17) \158        || (!defined(__cpp_variable_templates) && __MDSPAN_HAS_CXX_17)159#    define __MDSPAN_USE_VARIABLE_TEMPLATES 1160#  endif161#endif // __MDSPAN_USE_VARIABLE_TEMPLATES162 163#ifndef __MDSPAN_USE_CONSTEXPR_14164#  if (defined(__cpp_constexpr) && __cpp_constexpr >= 201304) \165        || (!defined(__cpp_constexpr) && __MDSPAN_HAS_CXX_14) \166        && (!(defined(__INTEL_COMPILER) && __INTEL_COMPILER <= 1700))167#    define __MDSPAN_USE_CONSTEXPR_14 1168#  endif169#endif170 171#ifndef __MDSPAN_USE_INTEGER_SEQUENCE172#  if defined(__MDSPAN_COMPILER_MSVC)173#    if (defined(__cpp_lib_integer_sequence) && __cpp_lib_integer_sequence >= 201304)174#      define __MDSPAN_USE_INTEGER_SEQUENCE 1175#    endif176#  endif177#endif178#ifndef __MDSPAN_USE_INTEGER_SEQUENCE179#  if (defined(__cpp_lib_integer_sequence) && __cpp_lib_integer_sequence >= 201304) \180        || (!defined(__cpp_lib_integer_sequence) && __MDSPAN_HAS_CXX_14) \181        /* as far as I can tell, libc++ seems to think this is a C++11 feature... */ \182        || (defined(__GLIBCXX__) && __GLIBCXX__ > 20150422 && __GNUC__ < 5 && !defined(__INTEL_CXX11_MODE__))183     // several compilers lie about integer_sequence working properly unless the C++14 standard is used184#    define __MDSPAN_USE_INTEGER_SEQUENCE 1185#  elif defined(__MDSPAN_COMPILER_APPLECLANG) && __MDSPAN_HAS_CXX_14186     // appleclang seems to be missing the __cpp_lib_... macros, but doesn't seem to lie about C++14 making187     // integer_sequence work188#    define __MDSPAN_USE_INTEGER_SEQUENCE 1189#  endif190#endif191 192#ifndef __MDSPAN_USE_RETURN_TYPE_DEDUCTION193#  if (defined(__cpp_return_type_deduction) && __cpp_return_type_deduction >= 201304) \194          || (!defined(__cpp_return_type_deduction) && __MDSPAN_HAS_CXX_14)195#    define __MDSPAN_USE_RETURN_TYPE_DEDUCTION 1196#  endif197#endif198 199#ifndef __MDSPAN_USE_CLASS_TEMPLATE_ARGUMENT_DEDUCTION200// GCC 10 is known not to work with CTAD for this case.201#  if (defined(__MDSPAN_COMPILER_CLANG) || !defined(_LIBCUDACXX_COMPILER_GCC) || __GNUC__ >= 11) \202      && ((defined(__cpp_deduction_guides) && __cpp_deduction_guides >= 201703) \203         || (!defined(__cpp_deduction_guides) && __MDSPAN_HAS_CXX_17))204#    define __MDSPAN_USE_CLASS_TEMPLATE_ARGUMENT_DEDUCTION 1205#  endif206#endif207 208#ifndef __MDSPAN_USE_ALIAS_TEMPLATE_ARGUMENT_DEDUCTION209// GCC 10 is known not to work with CTAD for this case.210#  if (defined(__MDSPAN_COMPILER_CLANG) || !defined(_LIBCUDACXX_COMPILER_GCC) || __GNUC__ >= 11) \211      && ((defined(__cpp_deduction_guides) && __cpp_deduction_guides >= 201907) \212          || (!defined(__cpp_deduction_guides) && __MDSPAN_HAS_CXX_20))213#    define __MDSPAN_USE_ALIAS_TEMPLATE_ARGUMENT_DEDUCTION 1214#  endif215#endif216 217#ifndef __MDSPAN_USE_STANDARD_TRAIT_ALIASES218#  if (defined(__cpp_lib_transformation_trait_aliases) && __cpp_lib_transformation_trait_aliases >= 201304) \219          || (!defined(__cpp_lib_transformation_trait_aliases) && __MDSPAN_HAS_CXX_14)220#    define __MDSPAN_USE_STANDARD_TRAIT_ALIASES 1221#  elif defined(__MDSPAN_COMPILER_APPLECLANG) && __MDSPAN_HAS_CXX_14222     // appleclang seems to be missing the __cpp_lib_... macros, but doesn't seem to lie about C++14223#    define __MDSPAN_USE_STANDARD_TRAIT_ALIASES 1224#  endif225#endif226 227#ifndef __MDSPAN_DEFAULTED_CONSTRUCTORS_INHERITANCE_WORKAROUND228#  ifdef __GNUC__229#    if __GNUC__ < 9230#      define __MDSPAN_DEFAULTED_CONSTRUCTORS_INHERITANCE_WORKAROUND 1231#    endif232#  endif233#endif234 235#ifndef __MDSPAN_CONDITIONAL_EXPLICIT236#  if __MDSPAN_HAS_CXX_20 && !defined(__MDSPAN_COMPILER_MSVC)237#    define __MDSPAN_CONDITIONAL_EXPLICIT(COND) explicit(COND)238#  else239#    define __MDSPAN_CONDITIONAL_EXPLICIT(COND)240#  endif241#endif242 243#ifndef __MDSPAN_USE_BRACKET_OPERATOR244#  if defined(__cpp_multidimensional_subscript)245#    define __MDSPAN_USE_BRACKET_OPERATOR 1246#  else247#    define __MDSPAN_USE_BRACKET_OPERATOR 0248#  endif249#endif250 251#ifndef __MDSPAN_USE_PAREN_OPERATOR252#  if !__MDSPAN_USE_BRACKET_OPERATOR253#    define __MDSPAN_USE_PAREN_OPERATOR 1254#  else255#    define __MDSPAN_USE_PAREN_OPERATOR 0256#  endif257#endif258 259#if __MDSPAN_USE_BRACKET_OPERATOR260#  define __MDSPAN_OP(mds,...) mds[__VA_ARGS__]261// Corentins demo compiler for subscript chokes on empty [] call,262// though I believe the proposal supports it?263#ifdef __MDSPAN_NO_EMPTY_BRACKET_OPERATOR264#  define __MDSPAN_OP0(mds) mds.accessor().access(mds.data_handle(),0)265#else266#  define __MDSPAN_OP0(mds) mds[]267#endif268#  define __MDSPAN_OP1(mds, a) mds[a]269#  define __MDSPAN_OP2(mds, a, b) mds[a,b]270#  define __MDSPAN_OP3(mds, a, b, c) mds[a,b,c]271#  define __MDSPAN_OP4(mds, a, b, c, d) mds[a,b,c,d]272#  define __MDSPAN_OP5(mds, a, b, c, d, e) mds[a,b,c,d,e]273#  define __MDSPAN_OP6(mds, a, b, c, d, e, f) mds[a,b,c,d,e,f]274#else275#  define __MDSPAN_OP(mds,...) mds(__VA_ARGS__)276#  define __MDSPAN_OP0(mds) mds()277#  define __MDSPAN_OP1(mds, a) mds(a)278#  define __MDSPAN_OP2(mds, a, b) mds(a,b)279#  define __MDSPAN_OP3(mds, a, b, c) mds(a,b,c)280#  define __MDSPAN_OP4(mds, a, b, c, d) mds(a,b,c,d)281#  define __MDSPAN_OP5(mds, a, b, c, d, e) mds(a,b,c,d,e)282#  define __MDSPAN_OP6(mds, a, b, c, d, e, f) mds(a,b,c,d,e,f)283#endif284 285#endif // _LIBCUDACXX_STD_VER > 11286 287#endif // _LIBCUDACXX___MDSPAN_CONFIG_HPP288 
codekingpro/portable-devtools · Team Ai