1 //------------------------------------------------------------------------------ 2 // GB_AxB_defs__plus_lor_uint64: definitions for a single semiring 3 //------------------------------------------------------------------------------ 4 5 // SuiteSparse:GraphBLAS, Timothy A. Davis, (c) 2017-2021, All Rights Reserved. 6 // SPDX-License-Identifier: Apache-2.0 7 8 //------------------------------------------------------------------------------ 9 10 // If this file is in the Generated/ folder, do not edit it (auto-generated). 11 12 #include "GB_dev.h" 13 #ifndef GBCOMPACT 14 #include "GB.h" 15 #include "GB_control.h" 16 #include "GB_bracket.h" 17 #include "GB_sort.h" 18 #include "GB_atomics.h" 19 #include "GB_AxB_saxpy.h" 20 #include "GB_AxB__include.h" 21 #include "GB_unused.h" 22 #include "GB_bitmap_assign_methods.h" 23 #include "GB_ek_slice_search.c" 24 25 // This C=A*B semiring is defined by the following types and operators: 26 27 // A'*B (dot2): GB (_Adot2B__plus_lor_uint64) 28 // A'*B (dot3): GB (_Adot3B__plus_lor_uint64) 29 // C+=A'*B (dot4): GB (_Adot4B__plus_lor_uint64) 30 // A*B (saxpy3): GB (_Asaxpy3B__plus_lor_uint64) 31 // no mask: GB (_Asaxpy3B_noM__plus_lor_uint64) 32 // mask M: GB (_Asaxpy3B_M__plus_lor_uint64) 33 // mask !M: GB (_Asaxpy3B_notM__plus_lor_uint64) 34 // A*B (saxpy bitmap): GB (_AsaxbitB__plus_lor_uint64) 35 36 // C type: uint64_t 37 // A type: uint64_t 38 // B type: uint64_t 39 40 // Multiply: z = ((aik != 0) || (bkj != 0)) 41 // Add: cij += z 42 // 'any' monoid? 0 43 // atomic? 1 44 // OpenMP atomic? 1 45 // MultAdd: uint64_t x_op_y = ((aik != 0) || (bkj != 0)) ; cij += x_op_y 46 // Identity: 0 47 // Terminal: ; 48 49 #define GB_ATYPE \ 50 uint64_t 51 52 #define GB_BTYPE \ 53 uint64_t 54 55 #define GB_CTYPE \ 56 uint64_t 57 58 #define GB_ASIZE (sizeof (GB_BTYPE)) 59 #define GB_BSIZE (sizeof (GB_BTYPE)) 60 #define GB_CSIZE (sizeof (GB_CTYPE)) 61 62 // true for int64, uint64, float, double, float complex, and double complex 63 #define GB_CTYPE_IGNORE_OVERFLOW \ 64 1 65 66 // aik = Ax [pA] 67 #define GB_GETA(aik,Ax,pA) \ 68 uint64_t aik = Ax [pA] 69 70 // bkj = Bx [pB] 71 #define GB_GETB(bkj,Bx,pB) \ 72 uint64_t bkj = Bx [pB] 73 74 // Gx [pG] = Ax [pA] 75 #define GB_LOADA(Gx,pG,Ax,pA) \ 76 Gx [pG] = Ax [pA] 77 78 // Gx [pG] = Bx [pB] 79 #define GB_LOADB(Gx,pG,Bx,pB) \ 80 Gx [pG] = Bx [pB] 81 82 #define GB_CX(p) Cx [p] 83 84 // multiply operator 85 #define GB_MULT(z, x, y, i, k, j) \ 86 z = ((x != 0) || (y != 0)) 87 88 // cast from a real scalar (or 2, if C is complex) to the type of C 89 #define GB_CTYPE_CAST(x,y) \ 90 ((uint64_t) x) 91 92 // cast from a real scalar (or 2, if A is complex) to the type of A 93 #define GB_ATYPE_CAST(x,y) \ 94 ((uint64_t) x) 95 96 // multiply-add 97 #define GB_MULTADD(z, x, y, i, k, j) \ 98 uint64_t x_op_y = ((x != 0) || (y != 0)) ; z += x_op_y 99 100 // monoid identity value 101 #define GB_IDENTITY \ 102 0 103 104 // 1 if the identity value can be assigned via memset, with all bytes the same 105 #define GB_HAS_IDENTITY_BYTE \ 106 1 107 108 // identity byte, for memset 109 #define GB_IDENTITY_BYTE \ 110 0 111 112 // break if cij reaches the terminal value (dot product only) 113 #define GB_DOT_TERMINAL(cij) \ 114 ; 115 116 // simd pragma for dot-product loop vectorization 117 #define GB_PRAGMA_SIMD_DOT(cij) \ 118 GB_PRAGMA_SIMD_REDUCTION (+,cij) 119 120 // simd pragma for other loop vectorization 121 #define GB_PRAGMA_SIMD_VECTORIZE GB_PRAGMA_SIMD 122 123 // 1 for the PLUS_PAIR_(real) semirings, not for the complex case 124 #define GB_IS_PLUS_PAIR_REAL_SEMIRING \ 125 0 126 127 // // 1 for performance-critical semirings, which get extra optimization 128 // #define GB_IS_PERFORMANCE_CRITICAL_SEMIRING \ 129 // GB_is_performance_critical_semiring 130 131 // declare the cij scalar 132 #if GB_IS_PLUS_PAIR_REAL_SEMIRING 133 // also initialize cij to zero 134 #define GB_CIJ_DECLARE(cij) \ 135 uint64_t cij = 0 136 #else 137 // all other semirings: just declare cij, do not initialize it 138 #define GB_CIJ_DECLARE(cij) \ 139 uint64_t cij 140 #endif 141 142 // cij = Cx [pC] 143 #define GB_GETC(cij,p) cij = Cx [p] 144 145 // Cx [pC] = cij 146 #define GB_PUTC(cij,p) Cx [p] = cij 147 148 // Cx [p] = t 149 #define GB_CIJ_WRITE(p,t) Cx [p] = t 150 151 // C(i,j) += t 152 #define GB_CIJ_UPDATE(p,t) \ 153 Cx [p] += t 154 155 // x + y 156 #define GB_ADD_FUNCTION(x,y) \ 157 x + y 158 159 // bit pattern for bool, 8-bit, 16-bit, and 32-bit integers 160 #define GB_CTYPE_BITS \ 161 0 162 163 // 1 if monoid update can skipped entirely (the ANY monoid) 164 #define GB_IS_ANY_MONOID \ 165 0 166 167 // 1 if monoid update is EQ 168 #define GB_IS_EQ_MONOID \ 169 0 170 171 // 1 if monoid update can be done atomically, 0 otherwise 172 #define GB_HAS_ATOMIC \ 173 1 174 175 // 1 if monoid update can be done with an OpenMP atomic update, 0 otherwise 176 #if GB_MICROSOFT 177 #define GB_HAS_OMP_ATOMIC \ 178 1 179 #else 180 #define GB_HAS_OMP_ATOMIC \ 181 1 182 #endif 183 184 // 1 for the ANY_PAIR semirings 185 #define GB_IS_ANY_PAIR_SEMIRING \ 186 0 187 188 // 1 if PAIR is the multiply operator 189 #define GB_IS_PAIR_MULTIPLIER \ 190 0 191 192 // 1 if monoid is PLUS_FC32 193 #define GB_IS_PLUS_FC32_MONOID \ 194 0 195 196 // 1 if monoid is PLUS_FC64 197 #define GB_IS_PLUS_FC64_MONOID \ 198 0 199 200 // 1 if monoid is ANY_FC32 201 #define GB_IS_ANY_FC32_MONOID \ 202 0 203 204 // 1 if monoid is ANY_FC64 205 #define GB_IS_ANY_FC64_MONOID \ 206 0 207 208 // 1 if monoid is MIN for signed or unsigned integers 209 #define GB_IS_IMIN_MONOID \ 210 0 211 212 // 1 if monoid is MAX for signed or unsigned integers 213 #define GB_IS_IMAX_MONOID \ 214 0 215 216 // 1 if monoid is MIN for float or double 217 #define GB_IS_FMIN_MONOID \ 218 0 219 220 // 1 if monoid is MAX for float or double 221 #define GB_IS_FMAX_MONOID \ 222 0 223 224 // 1 for the FIRSTI or FIRSTI1 multiply operator 225 #define GB_IS_FIRSTI_MULTIPLIER \ 226 0 227 228 // 1 for the FIRSTJ or FIRSTJ1 multiply operator 229 #define GB_IS_FIRSTJ_MULTIPLIER \ 230 0 231 232 // 1 for the SECONDJ or SECONDJ1 multiply operator 233 #define GB_IS_SECONDJ_MULTIPLIER \ 234 0 235 236 // atomic compare-exchange 237 #define GB_ATOMIC_COMPARE_EXCHANGE(target, expected, desired) \ 238 GB_ATOMIC_COMPARE_EXCHANGE_64 (target, expected, desired) 239 240 #if GB_IS_ANY_PAIR_SEMIRING 241 242 // result is purely symbolic; no numeric work to do. Hx is not used. 243 #define GB_HX_WRITE(i,t) 244 #define GB_CIJ_GATHER(p,i) 245 #define GB_CIJ_GATHER_UPDATE(p,i) 246 #define GB_HX_UPDATE(i,t) 247 #define GB_CIJ_MEMCPY(p,i,len) 248 249 #else 250 251 // Hx [i] = t 252 #define GB_HX_WRITE(i,t) Hx [i] = t 253 254 // Hx [i] = identity 255 #define GB_HX_CLEAR(i) Hx [i] = GB_IDENTITY 256 257 // Cx [p] = Hx [i] 258 #define GB_CIJ_GATHER(p,i) Cx [p] = Hx [i] 259 260 // Cx [p] += Hx [i] 261 #define GB_CIJ_GATHER_UPDATE(p,i) \ 262 Cx [p] += Hx [i] 263 264 // Hx [i] += t 265 #define GB_HX_UPDATE(i,t) \ 266 Hx [i] += t 267 268 // memcpy (&(Cx [p]), &(Hx [i]), len) 269 #define GB_CIJ_MEMCPY(p,i,len) \ 270 memcpy (Cx +(p), Hx +(i), (len) * sizeof(uint64_t)) 271 272 #endif 273 274 // 1 if the semiring has a concise bitmap multiply-add 275 #define GB_HAS_BITMAP_MULTADD \ 276 1 277 278 // concise statement(s) for the bitmap case: 279 // if (exists) 280 // if (cb == 0) 281 // cx = ax * bx 282 // cb = 1 283 // else 284 // cx += ax * bx 285 #define GB_BITMAP_MULTADD(cb,cx,exists,ax,bx) \ 286 cx += (uint64_t) (((uint64_t) (((ax != 0) || (bx != 0)))) * X [exists]) ; cb |= exists 287 288 // define X for bitmap multiply-add 289 #define GB_XINIT \ 290 uint64_t X [2] = {0,1} 291 292 // load X [1] = bkj for bitmap multiply-add 293 #define GB_XLOAD(bkj) \ 294 ; 295 296 // disable this semiring and use the generic case if these conditions hold 297 #define GB_DISABLE \ 298 (GxB_NO_PLUS || GxB_NO_LOR || GxB_NO_UINT64 || GxB_NO_PLUS_UINT64 || GxB_NO_LOR_UINT64 || GxB_NO_PLUS_LOR_UINT64) 299 300 #endif 301 302