random123

Counter-based Random Number Generators
git clone git://git.meso-star.com/random123.git
Log | Files | Refs | README | LICENSE

metalfeatures.h (3211B)


      1 /*
      2 Copyright 2010-2011, D. E. Shaw Research.
      3 All rights reserved.
      4 
      5 Redistribution and use in source and binary forms, with or without
      6 modification, are permitted provided that the following conditions are
      7 met:
      8 
      9 * Redistributions of source code must retain the above copyright
     10   notice, this list of conditions, and the following disclaimer.
     11 
     12 * Redistributions in binary form must reproduce the above copyright
     13   notice, this list of conditions, and the following disclaimer in the
     14   documentation and/or other materials provided with the distribution.
     15 
     16 * Neither the name of D. E. Shaw Research nor the names of its
     17   contributors may be used to endorse or promote products derived from
     18   this software without specific prior written permission.
     19 
     20 THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
     21 "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
     22 LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
     23 A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
     24 OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
     25 SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
     26 LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
     27 DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
     28 THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
     29 (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
     30 OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
     31 */
     32 
     33 /*
     34  * Written by Tom Schoonjans <Tom.Schoonjans@me.com>
     35  */
     36 
     37 #ifndef __metalfeatures_dot_hpp
     38 #define __metalfeatures_dot_hpp
     39 
     40 #ifndef R123_STATIC_INLINE
     41 #define R123_STATIC_INLINE inline
     42 #endif
     43 
     44 #ifndef R123_FORCE_INLINE
     45 #define R123_FORCE_INLINE(decl) decl __attribute__((always_inline))
     46 #endif
     47 
     48 #ifndef R123_CUDA_DEVICE
     49 #define R123_CUDA_DEVICE
     50 #endif
     51 
     52 #ifndef R123_METAL_THREAD_ADDRESS_SPACE
     53 #define R123_METAL_THREAD_ADDRESS_SPACE thread
     54 #endif
     55 
     56 #ifndef R123_METAL_CONSTANT_ADDRESS_SPACE
     57 #define R123_METAL_CONSTANT_ADDRESS_SPACE constant
     58 #endif
     59 
     60 #ifndef R123_ASSERT
     61 #define R123_ASSERT(x)
     62 #endif
     63 
     64 #ifndef R123_BUILTIN_EXPECT
     65 #define R123_BUILTIN_EXPECT(expr,likely) expr
     66 #endif
     67 
     68 #ifndef R123_USE_GNU_UINT128
     69 #define R123_USE_GNU_UINT128 0
     70 #endif
     71 
     72 #ifndef R123_USE_MULHILO64_ASM
     73 #define R123_USE_MULHILO64_ASM 0
     74 #endif
     75 
     76 #ifndef R123_USE_MULHILO64_MSVC_INTRIN
     77 #define R123_USE_MULHILO64_MSVC_INTRIN 0
     78 #endif
     79 
     80 #ifndef R123_USE_MULHILO64_CUDA_INTRIN
     81 #define R123_USE_MULHILO64_CUDA_INTRIN 0
     82 #endif
     83 
     84 #ifndef R123_USE_MULHILO64_OPENCL_INTRIN
     85 #define R123_USE_MULHILO64_OPENCL_INTRIN 0
     86 #endif
     87 
     88 #ifndef R123_USE_MULHILO32_MULHI_INTRIN
     89 #define R123_USE_MULHILO32_MULHI_INTRIN 1
     90 #endif
     91 
     92 #if R123_USE_MULHILO32_MULHI_INTRIN
     93 #include <metal_integer>
     94 #define R123_MULHILO32_MULHI_INTRIN metal::mulhi
     95 #endif
     96 
     97 #ifndef R123_USE_AES_NI
     98 #define R123_USE_AES_NI 0
     99 #endif
    100 
    101 #ifndef R123_USE_64BIT
    102 #define R123_USE_64BIT 0 /* Metal currently (Feb 2019, Specification-2) does not support 64-bit variable types */
    103 #endif
    104 
    105 #ifndef R123_ULONG_LONG
    106 /* the longest integer type in Metal (Feb 2019, Specification-2) is a
    107  * 32-bit unsigned int.  Let's hope for the best... */
    108 #define R123_ULONG_LONG unsigned int 
    109 #endif
    110 
    111 #endif