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.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.h` 467 lines · 21327 bytes Raw Blame History 1 /* SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception 2 * Copyright 2026 Drake Stapleton (AIEN / aien-dev) 3 * 4 * Licensed under the Apache License, Version 2.0 (the "License"); 5 * you may not use this file except in compliance with the License. 6 * You may obtain a copy of the License at 7 * 8 * http://www.apache.org/licenses/LICENSE-2.0 9 * 10 * Unless required by applicable law or agreed to in writing, software 11 * distributed under the License is distributed on an "AS IS" BASIS, 12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 * See the License for the specific language governing permissions and 14 * limitations under the License. 15 */ 16 17 #ifndef OMEGA_NUMERIC_H 18 #define OMEGA_NUMERIC_H 19 20 /* 21 * OMEGA-NUMERIC-0 (M19R Gate 5): FP32 substrate. 22 * 23 * This file is host-pure: the semantic reference tier, the CPU realization 24 * tier, the Omega math sequences, the op registry (which ops have a GB10 25 * encoding and how their results are compared), the kernel patch words, and 26 * the parity comparators. Nothing here opens a device. The GB10 executor is 27 * src/omega_numeric_gb10.c. 28 * 29 * The default implementation is seeded Omega through generated hosted units. 30 * Build with -ffp-contract=off: neither tier may depend on implicit fusion. 31 * Independent native C/assembly remains a default-OFF migration oracle under 32 * CUDAPP_MIGRATION_PENDING_C_NUMERIC_REST. 33 */ 34 35 #include 36 #include 37 #include 38 #include "omega_numeric_om.h" 39 40 /* 41 * Frozen numerical reduction order specification: 42 * Pairwise binary tree across 32 lanes (delta = 16, 8, 4, 2, 1). 43 */ 44 #define OMEGA_WARP_REDUCTION_DECLARED_ORDER "PAIRWISE_TREE_LANE_DELTA_16_8_4_2_1" 45 46 /* 47 * Bitcast utility functions 48 */ 49 static inline uint32_t omega_float_to_bits(float f) { 50 union { float f; uint32_t u; } u; 51 u.f = f; 52 return u.u; 53 } 54 55 static inline float omega_bits_to_float(uint32_t u) { 56 union { float f; uint32_t u; } un; 57 un.u = u; 58 return un.f; 59 } 60 61 /* 62 * Bit-level IEEE-754 classification and manipulation (Zero Libm) 63 */ 64 #define OMEGA_INF_POS 0x7f800000U 65 #define OMEGA_INF_NEG 0xff800000U 66 #define OMEGA_QNAN_BITS 0x7fc00000U 67 68 #if defined(CUDAPP_MIGRATION_PENDING_C_NUMERIC_REST) || defined(CUDAPP_MIGRATION_PENDING_C_NUMERIC_REST_DIFF) 69 static inline float omega_fabs(float x) { 70 return omega_bits_to_float(omega_float_to_bits(x) & 0x7fffffffU); 71 } 72 73 static inline bool omega_isnan(float x) { 74 uint32_t u = omega_float_to_bits(x); 75 return ((u & 0x7f800000U) == 0x7f800000U) && ((u & 0x007fffffU) != 0); 76 } 77 78 static inline bool omega_isinf(float x) { 79 uint32_t u = omega_float_to_bits(x); 80 return (u & 0x7fffffffU) == 0x7f800000U; 81 } 82 83 static inline bool omega_signbit(float x) { 84 return (omega_float_to_bits(x) & 0x80000000U) != 0; 85 } 86 87 static inline bool omega_issubnormal(float x) { 88 uint32_t u = omega_float_to_bits(x); 89 return ((u & 0x7f800000U) == 0) && ((u & 0x007fffffU) != 0); 90 } 91 92 static inline bool omega_iszero(float x) { 93 return (omega_float_to_bits(x) & 0x7fffffffU) == 0; 94 } 95 #else 96 static inline float omega_fabs(float x) { 97 return omega_bits_to_float((uint32_t)omega_numeric_rest(0, omega_float_to_bits(x), 0, 0, 0, 0)); 98 } 99 static inline bool omega_isnan(float x) { 100 return omega_numeric_rest(1, omega_float_to_bits(x), 0, 0, 0, 0) != 0; 101 } 102 static inline bool omega_isinf(float x) { 103 return omega_numeric_rest(2, omega_float_to_bits(x), 0, 0, 0, 0) != 0; 104 } 105 static inline bool omega_signbit(float x) { 106 return omega_numeric_rest(3, omega_float_to_bits(x), 0, 0, 0, 0) != 0; 107 } 108 static inline bool omega_issubnormal(float x) { 109 return omega_numeric_rest(4, omega_float_to_bits(x), 0, 0, 0, 0) != 0; 110 } 111 static inline bool omega_iszero(float x) { 112 return omega_numeric_rest(5, omega_float_to_bits(x), 0, 0, 0, 0) != 0; 113 } 114 #endif 115 116 /* 117 * Required host FP environment. The reference and CPU tiers compute with the 118 * host FPU, so a caller that changed the rounding mode or turned on flush to 119 * zero would make both tiers agree on the same wrong answer. These FPCR bits 120 * must be clear: RMode [23:22] (00 = round to nearest even), FZ [24], DN [25], 121 * FZ16 [19], AHP [26] (alternative half precision: F16 conversions must use 122 * IEEE binary16), and the FEAT_AFP controls FIZ [0], AH [1], NEP [2]. 123 * omega_numeric_reference, omega_numeric_cpu_realize, 124 * omega_numeric_reference_ftz and omega_numeric_seed_bound refuse with 125 * OMEGA_NUMERIC_ERR_FPENV (and compute nothing) when any is set. They never 126 * change the environment themselves. On x86-64, MXCSR rounding, FTZ and DAZ 127 * and the x87 rounding mode are checked; read_fpcr returns a normalized report 128 * in the same bit positions (not the raw MXCSR). The x86 arithmetic tier uses 129 * scalar SSE and fmaf (existing host libm dependency); integer conversions 130 * share the exact bit-model and are not an independent conversion oracle. 131 */ 132 #define OMEGA_NUMERIC_FPCR_REQUIRED_CLEAR \ 133 ((1ULL << 0) | (1ULL << 1) | (1ULL << 2) | (1ULL << 19) | (3ULL << 22) | (1ULL << 24) | (1ULL << 25) | \ 134 (1ULL << 26)) 135 uint64_t omega_numeric_read_fpcr(void); 136 bool omega_numeric_fpenv_ok(void); 137 138 /* 139 * Semantic Reference Tier: 140 * Exact IEEE 754-2008 single-precision specification, round to nearest even. 141 * Subnormals are preserved bit-exactly (Flush-To-Zero is strictly rejected). 142 */ 143 float omega_ref_fadd(float a, float b); 144 float omega_ref_fsub(float a, float b); 145 float omega_ref_fmul(float a, float b); 146 float omega_ref_ffma(float a, float b, float c); 147 float omega_ref_fmin(float a, float b); 148 float omega_ref_fmax(float a, float b); 149 bool omega_ref_fsetp_ge(float a, float b); 150 float omega_ref_i2f(int32_t a); 151 int32_t omega_ref_f2i(float a); 152 /* 153 * E1 scalar contract (docs/numeric/E1_SCALAR_CONTRACT.md). Explicit, 154 * FPCR-independent reference definitions written with integer operations on 155 * the IEEE bit patterns; no host conversion or compare instruction is used. 156 * 157 * Integer conversions: NaN -> 0; the value is rounded to an integer in the 158 * named direction, then saturated to the target range (F2U: negatives -> 0). 159 * RNI is round to nearest, ties to even. 160 */ 161 int32_t omega_ref_f2i_floor(float a); 162 int32_t omega_ref_f2i_ceil(float a); 163 int32_t omega_ref_f2i_rni(float a); 164 uint32_t omega_ref_f2u(float a); /* truncate */ 165 float omega_ref_u2f(uint32_t a); /* RNE */ 166 /* Narrowing: RNE, overflow to signed infinity, subnormal results kept, NaN 167 * stays NaN (payload not semantic). Widening is exact. */ 168 uint16_t omega_ref_f32_to_f16(float a); 169 uint16_t omega_ref_f32_to_bf16(float a); 170 float omega_ref_f16_to_f32(uint16_t h); 171 float omega_ref_bf16_to_f32(uint16_t h); 172 /* 173 * Compare predicate of a compare-and-select op (FSETP_SEL and the 174 * FSETP_

_SEL ops): 1 if the predicate holds for (a, b), 0 if not, -1 if 175 * op is not a compare-and-select op. Ordered predicates are false when either 176 * operand is NaN, unordered (U) ones true; -0 equals +0. 177 */ 178 int omega_ref_fsetp_pred(int op, float a, float b); 179 /* a * b + c rounded once (RNE, subnormals kept), integer arithmetic on the bit 180 * patterns (no FMADD). NaN results are the canonical quiet NaN. */ 181 float omega_ref_ffma_int(float a, float b, float c); 182 /* True when the AArch64 CPU has FEAT_BF16 (BFCVT). Other hosts return false. 183 * The x86 tier implements the exact integer BF16 conversion without that ISA. */ 184 bool omega_numeric_cpu_has_bf16(void); 185 186 /* Correctly rounded IEEE division and square root (AArch64 FDIV/FSQRT or 187 * x86 scalar SSE). The semantic target for omega_math_div/sqrt. */ 188 float omega_ieee_div(float x, float y); 189 float omega_ieee_sqrt(float x); 190 191 /* 192 * Omega-defined sequences for division and square root: correctly rounded 193 * (round to nearest, ties to even, subnormal results kept, overflow to 194 * infinity), computed with integer operations only (restoring long division, 195 * bitwise integer square root, one shared rounding step). No MUFU seed and no 196 * FP arithmetic, so the result does not depend on FPCR. Compared bit for bit 197 * against omega_ieee_div / omega_ieee_sqrt. Host sweep on 2026-09-30: SQRT 198 * over all 2^32 inputs and DIV over 10^9 stratified random pairs, zero 199 * mismatches. 200 */ 201 float omega_math_div(float x, float y); 202 float omega_math_sqrt(float x); 203 204 /* 205 * Omega-defined polynomial approximations for Transcendentals: 206 * Zero dependency on libm or CUDA math libraries. 207 * Range reduction, coefficients, and evaluation order are frozen. 208 */ 209 float omega_math_exp(float x); 210 float omega_math_log(float x); 211 212 /* 213 * Declared-order warp reduction: 214 * Reduces 32 float inputs across a warp using the frozen pairwise-tree order. 215 */ 216 float omega_warp_reduce_sum(const float warp_inputs[32]); 217 218 /* 219 * Equivalence comparator: 220 * Verifies that two floats match bit-for-bit, except that all quiet/signaling 221 * NaNs are considered equivalent in the NaN class. 222 */ 223 bool omega_numeric_bits_equal(float a, float b); 224 225 /* ---- Op registry --------------------------------------------------------- */ 226 227 typedef enum { 228 OMEGA_NOP_FADD = 0, 229 OMEGA_NOP_FSUB, 230 OMEGA_NOP_FMUL, 231 OMEGA_NOP_FFMA, /* a*b + c, c uniform per launch (constant bank) */ 232 OMEGA_NOP_FSETP_SEL, /* FSETP.GE P0, a, b ; FSEL out = P0 ? a : b */ 233 OMEGA_NOP_FSEL, /* FSETP.GE P0, a, RZ ; FSEL out = P0 ? b : a */ 234 OMEGA_NOP_FMNMX_MIN, 235 OMEGA_NOP_FMNMX_MAX, 236 OMEGA_NOP_I2FP, /* input bits read as int32, output FP32 */ 237 OMEGA_NOP_F2I, /* input FP32, output bits are int32 */ 238 OMEGA_NOP_MUFU_RCP, /* seed only: never compared bit-exactly */ 239 OMEGA_NOP_MUFU_RSQ, /* seed only: never compared bit-exactly */ 240 OMEGA_NOP_LDS_STS, /* STS, BAR.SYNC, LDS: out[i] = a[i ^ 63] per CTA */ 241 OMEGA_NOP_SHFL_DOWN, /* SHFL.DOWN by 1, clamp 0x1f */ 242 OMEGA_NOP_DIV, 243 OMEGA_NOP_SQRT, 244 OMEGA_NOP_EXP, 245 OMEGA_NOP_LOG, 246 OMEGA_NOP_REDUCE_SUM, 247 /* E1 scalar contract ops (docs/numeric/E1_SCALAR_CONTRACT.md): semantic 248 * reference, CPU realization and GB10 encoding (E1 WP-C; GB10 parity is 249 * established by the Gate 5 chip receipt only). Compare-and-select: out = P(a, b) ? a : b, bits 250 * moved unchanged (FSETP.

P0, a, b ; FSEL out, a, b, P0). */ 251 OMEGA_NOP_FSETP_LT_SEL, 252 OMEGA_NOP_FSETP_LE_SEL, 253 OMEGA_NOP_FSETP_GT_SEL, 254 OMEGA_NOP_FSETP_EQ_SEL, 255 OMEGA_NOP_FSETP_NE_SEL, /* ordered: false if either is NaN */ 256 OMEGA_NOP_FSETP_NUM_SEL, /* neither is NaN */ 257 OMEGA_NOP_FSETP_NAN_SEL, /* either is NaN */ 258 OMEGA_NOP_FSETP_LTU_SEL, 259 OMEGA_NOP_FSETP_LEU_SEL, 260 OMEGA_NOP_FSETP_GTU_SEL, 261 OMEGA_NOP_FSETP_GEU_SEL, 262 OMEGA_NOP_FSETP_EQU_SEL, 263 OMEGA_NOP_FSETP_NEU_SEL, /* IEEE !=: true if either is NaN */ 264 OMEGA_NOP_F2I_FLOOR, /* input FP32, output bits are int32 */ 265 OMEGA_NOP_F2I_CEIL, 266 OMEGA_NOP_F2I_RNI, 267 OMEGA_NOP_F2U, /* input FP32, output bits are uint32 */ 268 OMEGA_NOP_I2FP_U32, /* input bits read as uint32, output FP32 */ 269 OMEGA_NOP_F32_TO_F16, /* output: F16 bits in [15:0], [31:16] zero */ 270 OMEGA_NOP_F32_TO_BF16, /* output: BF16 bits in [15:0], [31:16] zero */ 271 OMEGA_NOP_F16_TO_F32, /* input: F16 bits in [15:0], [31:16] ignored */ 272 OMEGA_NOP_BF16_TO_F32, /* input: BF16 bits in [15:0], [31:16] ignored */ 273 OMEGA_NOP_FFMA_V, /* a*b + c, c read per element */ 274 OMEGA_NOP_COUNT 275 } OmegaNumericOp; 276 277 typedef enum { 278 OMEGA_CMP_BIT_EXACT = 0, /* FP32 bits equal; any NaN equals any NaN */ 279 OMEGA_CMP_INT_EXACT, /* raw 32-bit words equal (integer results) */ 280 OMEGA_CMP_SEED_BOUND, /* MUFU: relative-error bound only, never bits */ 281 OMEGA_CMP_F16_BITS, /* [31:16] zero; [15:0] F16 bits equal, any F16 NaN equals any F16 NaN */ 282 OMEGA_CMP_BF16_BITS /* [31:16] zero; [15:0] BF16 bits equal, any BF16 NaN equals any BF16 NaN */ 283 } OmegaNumericCompare; 284 285 /* The equality a parity comparison uses for one element under mode (not 286 * defined for SEED_BOUND, which returns false). */ 287 bool omega_numeric_compare_equal(OmegaNumericCompare mode, uint32_t expect, uint32_t got); 288 289 typedef struct { 290 OmegaNumericOp op; 291 const char *name; 292 int arity; /* inputs used: 1 (a), 2 (a,b), 3 (a,b,c) */ 293 bool gb10_encoded; /* a real kernel exists for this op */ 294 OmegaNumericCompare compare; 295 const char *reference; /* what the expected value is */ 296 const char *not_encoded_reason; 297 } OmegaNumericOpInfo; 298 299 size_t omega_numeric_op_count(void); 300 const OmegaNumericOpInfo *omega_numeric_op_at(size_t index); 301 /* Finds an op by name. "LDS" and "STS" are aliases of LDS_STS, "FSETP" of 302 * FSETP_SEL. Returns NULL for unknown names. */ 303 const OmegaNumericOpInfo *omega_numeric_op_find(const char *name); 304 const char *omega_numeric_compare_name(OmegaNumericCompare c); 305 306 /* Ops whose GB10 kernel is a whole program from 307 * src/omega_numeric_divsqrt_gb10.c (DIV, SQRT) instead of a patch into the 308 * calibrated vecadd: they have no patch words, omega_numeric_build_kernel 309 * refuses them, and their structural checks (omega_ds_check_args, _kernel, 310 * _digest, _qmd) run inside omega_ds_gb10_run before the device is opened. */ 311 bool omega_numeric_op_whole_kernel(OmegaNumericOp op); 312 313 /* Return codes of omega_numeric_submit_check and omega_gb10_execute_simt_op */ 314 #define OMEGA_NUMERIC_OK 0 315 #define OMEGA_NUMERIC_ERR_BAD_ARGS -1 /* unknown op or missing buffers */ 316 #define OMEGA_NUMERIC_ERR_NOT_ENCODED -2 /* op known, no GB10 kernel exists */ 317 #define OMEGA_NUMERIC_ERR_OPERANDS -3 /* operand shape the kernel can't do */ 318 #define OMEGA_NUMERIC_ERR_DEVICE -4 /* device open/alloc/submit/wait */ 319 #define OMEGA_NUMERIC_ERR_FPENV -5 /* host FPCR is not RNE with FZ clear */ 320 321 #define OMEGA_NUMERIC_MAX_COUNT 65536u 322 323 /* 324 * Threads per CTA of every numeric launch (QMD CTA_THREAD_DIMENSION0 and the 325 * grid width in src/omega_numeric_gb10.c). LDS_STS exchanges values inside 326 * one CTA, so its count must be a whole number of CTAs: a partial CTA would 327 * have exited threads that never reach BAR.SYNC. 328 */ 329 #define OMEGA_NUMERIC_CTA_THREADS 64u 330 /* Bytes of shared memory LDS_STS touches per CTA: one 32-bit word per thread. */ 331 #define OMEGA_NUMERIC_LDS_STS_SHARED_BYTES (OMEGA_NUMERIC_CTA_THREADS * 4u) 332 333 /* 334 * Variants of the shared-memory and warp ops that have no GB10 encoding. 335 * omega_numeric_submit_check refuses each with OMEGA_NUMERIC_ERR_NOT_ENCODED 336 * and names it, so a caller asking for LDS.U8 or SHFL_UP learns it is 337 * unencoded instead of being handed the 32-bit or SHFL.DOWN kernel. 338 */ 339 size_t omega_numeric_refused_variant_count(void); 340 const char *omega_numeric_refused_variant_at(size_t index); 341 342 /* 343 * Everything that must be true before any device is touched. Writes a 344 * one-line reason into err (if non-NULL) on refusal. 345 */ 346 int omega_numeric_submit_check(const char *op_name, 347 const float *in_a, const float *in_b, const float *in_c, 348 const float *out_res, size_t count, 349 char *err, size_t err_len); 350 351 /* 352 * Kernel patch: the instruction words written at byte offset 353 * OMEGA_NUMERIC_PATCH_OFFSET of the vecadd kernel (replacing its IADD3, and 354 * for multi-instruction ops also its STG/EXIT). Returns the number of 128-bit 355 * instructions, or a negative OMEGA_NUMERIC_ERR_* code for ops without an 356 * encoding. 357 */ 358 #define OMEGA_NUMERIC_PATCH_OFFSET 0x110u 359 #define OMEGA_NUMERIC_PATCH_MAX 15u /* slots 0x110..0x1f0 of the 0x200-byte kernel */ 360 typedef struct { 361 uint32_t w[4]; 362 const char *text; 363 const char *provenance_key; /* NULL for vecadd baseline STG / EXIT */ 364 } OmegaNumericPatchInsn; 365 366 int omega_numeric_patch_words(OmegaNumericOp op, 367 OmegaNumericPatchInsn out[OMEGA_NUMERIC_PATCH_MAX]); 368 369 /* Encodes the vecadd baseline and applies the patch for op. */ 370 int omega_numeric_build_kernel(OmegaNumericOp op, uint8_t *code, size_t code_len, 371 size_t *out_len); 372 373 /* 374 * Structural check of a patch against the launch it will run in. Called by 375 * omega_numeric_submit_check (on a QMD built for count) and again by the GB10 376 * executor on the exact QMD it submits. It decodes the words, so it catches a 377 * wrong patch even when the patch table itself was edited: 378 * every patch length 1..PATCH_MAX; a variable-latency result (write 379 * barrier set) is waited on by the very next instruction; 380 * STS/LDS/BAR/SHFL words match their one encoded form in every 381 * non-register bit (no .U8/.64/.128, no offsets, no other 382 * barrier id, no SHFL mode other than DOWN); 383 * shared use STS before BAR.SYNC 0 before LDS; the QMD declares at least 384 * one barrier; the address is SHF.L R0 (tid.x) by exactly 2, 385 * the LDS address is that value XOR (CTA-1)*4; the CTA width 386 * in the QMD is OMEGA_NUMERIC_CTA_THREADS (a power of two); 387 * (CTA-1)*4 + 4 bytes fit in the QMD shared-memory size; 388 * REDUCE_SUM exactly five SHFL.DOWN, deltas 16, 8, 4, 2, 1 in that 389 * order, clamp 0x1f, each followed by an FADD (no negate, no 390 * modifiers) that waits on the shuffle, adds the shuffled value 391 * to the running sum, and the last FADD writes R9, which the 392 * STG stores. 393 * qmd1_words is the 96-word compute QMD. Returns OMEGA_NUMERIC_OK or 394 * OMEGA_NUMERIC_ERR_OPERANDS with a one-line reason in err. 395 */ 396 int omega_numeric_check_patch(OmegaNumericOp op, const OmegaNumericPatchInsn *patch, int n, 397 const uint32_t *qmd1_words, char *err, size_t err_len); 398 399 /* Launch shape for count elements: OMEGA_NUMERIC_CTA_THREADS threads per CTA 400 * and enough CTAs to cover count. Shared by submit_check and the executor. */ 401 void omega_numeric_launch_shape(size_t count, uint32_t *threads_per_block, uint32_t *grid_width); 402 403 /* ---- Tiers and comparison ------------------------------------------------- */ 404 405 /* Semantic reference tier for every op. c may be NULL except for FFMA and 406 * FFMA_V (arity 3). */ 407 int omega_numeric_reference(OmegaNumericOp op, const float *a, const float *b, 408 const float *c, float *out, size_t count); 409 410 /* CPU realization semantics, implemented in seeded Omega by default. The 411 * retained independent native-instruction realization is an opt-in C oracle. */ 412 int omega_numeric_cpu_realize(OmegaNumericOp op, const float *a, const float *b, 413 const float *c, float *out, size_t count); 414 415 /* Elements that carry a result for op (REDUCE_SUM: lane 0 of each warp). */ 416 bool omega_numeric_element_checked(OmegaNumericOp op, size_t index); 417 418 typedef struct { 419 size_t checked; /* elements compared */ 420 size_t mismatches; 421 long first_index; /* -1 when none */ 422 uint32_t first_expect; 423 uint32_t first_got; 424 size_t subnormal_expected; /* checked elements whose expected value is subnormal */ 425 size_t out_of_bound; /* SEED_BOUND only: results outside the bound */ 426 size_t bound_skipped; /* SEED_BOUND only: elements outside the bounded domain */ 427 } OmegaParityTrace; 428 429 /* 430 * Bit parity: refuses (returns OMEGA_NUMERIC_ERR_OPERANDS) for a SEED_BOUND 431 * op. That refusal is the structural guarantee behind 432 * MUFU_SEED_ONLY_NOT_COMPARED. 433 */ 434 int omega_numeric_parity(OmegaNumericOp op, const float *expect, const float *got, 435 size_t count, OmegaParityTrace *trace); 436 437 /* Seed bound for MUFU: compares against the true 1/x or 1/sqrt(x) (IEEE) 438 * with relative error <= 2^-20 on inputs whose result is a finite normal. 439 * Refuses non-SEED_BOUND ops. */ 440 int omega_numeric_seed_bound(OmegaNumericOp op, const float *a, const float *got, 441 size_t count, OmegaParityTrace *trace); 442 443 /* Flush-to-zero model used by the negative test: subnormal inputs and outputs 444 * replaced by signed zero. */ 445 int omega_numeric_reference_ftz(OmegaNumericOp op, const float *a, const float *b, 446 const float *c, float *out, size_t count); 447 448 /* Host magic-constant seeds (NOT a model of hardware MUFU). Used only to show 449 * that an unrefined seed fails bit parity. */ 450 float omega_numeric_host_rcp_seed(float y); 451 452 /* ---- GB10 executor (src/omega_numeric_gb10.c) ----------------------------- */ 453 454 /* 455 * Execution on physical GB10 silicon: runs omega_numeric_submit_check first 456 * (no device is opened when it refuses), then patches the calibrated vecadd 457 * kernel and dispatches it through the GPFIFO channel. FFMA's c operand must 458 * be uniform (it is carried in the constant bank). 459 */ 460 int omega_gb10_execute_simt_op(const char *op_name, 461 const float *in_a, 462 const float *in_b, 463 const float *in_c, 464 float *out_res, 465 size_t count); 466 467 #endif /* OMEGA_NUMERIC_H */