Interplane page as plain text, for reading tools and agents. English is the reference text: translate it with your own tool. Text in backticks and in ``` blocks (commands, fingerprints, file names) and link targets in <...> are exact: copy them, never translate them. Page: /drakestapleton/CUDApp/blob/main/src/omega_numeric_om.h # CUDApp CUDA++: AIEN’s GPU machine-code toolchain, runtime and driver client for NVIDIA GPUs without the CUDA toolkit. Hardware coverage and driver replacement limits are explicit. Brought by drakestapleton Sign in to star 0 stars 0 watching About Files History Releases Proposed changes Issues For developers branch `main` Branches Tags History `CUDApp / src / omega_numeric_om.h` 82 lines · 3305 bytes Raw Blame History 1 /* SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception 2 * Copyright 2026 Drake Stapleton (AIEN / aien-dev) 3 * 4 * Private glue between src/omega_numeric.c, src/omega_numeric_reduce.c and 5 * the generated Omega units om/numeric/numeric.om (omega_numeric_ref) and 6 * om/numeric/tile.om (omega_numeric_tile). Not public API. 7 * 8 * Build switches (CUDApp migration convention): 9 * default Omega units are the implementation 10 * -DCUDAPP_MIGRATION_PENDING_C_NUMERIC the old C bodies (oracle) 11 * -DCUDAPP_MIGRATION_PENDING_C_NUMERIC_DIFF both on every call; abort on any bit difference 12 */ 13 #ifndef OMEGA_NUMERIC_OM_H 14 #define OMEGA_NUMERIC_OM_H 15 16 #include 17 18 /* Internal bit-carrier remainder ABI (not part of the installed API). */ 19 uint64_t omega_numeric_rest(unsigned mode, uint64_t a, uint64_t b, 20 uint64_t c, uint64_t d, uint64_t e); 21 22 #if defined(CUDAPP_MIGRATION_PENDING_C_NUMERIC) && defined(CUDAPP_MIGRATION_PENDING_C_NUMERIC_DIFF) 23 #error "CUDAPP_MIGRATION_PENDING_C_NUMERIC_DIFF compares C with Omega: not with CUDAPP_MIGRATION_PENDING_C_NUMERIC" 24 #endif 25 #if defined(CUDAPP_MIGRATION_PENDING_C_NUMERIC) || defined(CUDAPP_MIGRATION_PENDING_C_NUMERIC_DIFF) 26 #define OMEGA_NUMERIC_C_BODIES 1 27 #endif 28 #if !defined(CUDAPP_MIGRATION_PENDING_C_NUMERIC) 29 #define OMEGA_NUMERIC_OM_PATH 1 30 #endif 31 32 /* Operation codes of the numeric_ref dispatcher in om/numeric/numeric.om. */ 33 /* The one NaN every float-producing reference op returns (both paths). */ 34 #define OMEGA_NUMERIC_CANON_NAN_BITS 0x7fffffffU 35 36 enum { 37 OMEGA_NUMERIC_OM_FADD = 0, 38 OMEGA_NUMERIC_OM_FSUB = 1, 39 OMEGA_NUMERIC_OM_FMUL = 2, 40 OMEGA_NUMERIC_OM_FFMA = 3, 41 OMEGA_NUMERIC_OM_FFMA_INT = 4, 42 OMEGA_NUMERIC_OM_FMIN = 5, 43 OMEGA_NUMERIC_OM_FMAX = 6, 44 OMEGA_NUMERIC_OM_FSETP_GE = 7, 45 OMEGA_NUMERIC_OM_FSETP_PRED = 8, 46 OMEGA_NUMERIC_OM_I2F = 9, 47 OMEGA_NUMERIC_OM_U2F = 10, 48 OMEGA_NUMERIC_OM_F2I = 11, 49 OMEGA_NUMERIC_OM_F2I_FLOOR = 12, 50 OMEGA_NUMERIC_OM_F2I_CEIL = 13, 51 OMEGA_NUMERIC_OM_F2I_RNI = 14, 52 OMEGA_NUMERIC_OM_F2U = 15, 53 OMEGA_NUMERIC_OM_F32_TO_F16 = 16, 54 OMEGA_NUMERIC_OM_F32_TO_BF16 = 17, 55 OMEGA_NUMERIC_OM_F16_TO_F32 = 18, 56 OMEGA_NUMERIC_OM_BF16_TO_F32 = 19, 57 OMEGA_NUMERIC_OM_MATH_DIV = 20, 58 OMEGA_NUMERIC_OM_MATH_SQRT = 21, 59 OMEGA_NUMERIC_OM_MATH_EXP = 22, 60 OMEGA_NUMERIC_OM_MATH_LOG = 23, 61 OMEGA_NUMERIC_OM_IEEE_DIV = 24, 62 OMEGA_NUMERIC_OM_IEEE_SQRT = 25, 63 OMEGA_NUMERIC_OM_RCP_SEED = 26, 64 OMEGA_NUMERIC_OM_BITS_EQUAL = 27, 65 OMEGA_NUMERIC_OM_COMPARE_EQUAL = 28, 66 OMEGA_NUMERIC_OM_REDUCE_LEVELS = 29, 67 OMEGA_NUMERIC_OM_LAUNCH_SHAPE = 30, 68 }; 69 70 #if defined(OMEGA_NUMERIC_OM_PATH) 71 /* omega_numeric_ref through the generated unit; a nonzero unit status traps. */ 72 uint64_t omega_numeric_om(unsigned op, uint64_t a, uint64_t b, uint64_t c); 73 /* One 32-lane reduce tile (op = OmegaReduceOp) of FP32 bit patterns. */ 74 uint32_t omega_numeric_om_tile(unsigned op, const uint32_t tile[32]); 75 #endif 76 #if defined(CUDAPP_MIGRATION_PENDING_C_NUMERIC_DIFF) 77 /* Abort with a report when the C oracle and the Omega result differ. */ 78 uint64_t omega_numeric_om_diff(const char *what, uint64_t a, uint64_t b, uint64_t c, uint64_t c_bits, 79 uint64_t om_bits); 80 #endif 81 82 #endif