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/runtime/rx_cm_math.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 / runtime / rx_cm_math.h` 38 lines · 1529 bytes Raw Blame History 1 /* SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception */ 2 #ifndef RX_CM_MATH_H 3 #define RX_CM_MATH_H 4 #include "cudapp_native.h" 5 #include 6 #include 7 #include 8 #ifndef CUDAPP_MIGRATION_PENDING_C_CM_MATH 9 #define CUDAPP_MIGRATION_PENDING_C_CM_MATH 0 10 #endif 11 #if !CUDAPP_MIGRATION_PENDING_C_CM_MATH 12 /* Binary64 transport only. Numerical computation and exceptional-value policy 13 * are in the first-party Omega unit, not a host libm call. */ 14 static inline double rx_host_math(unsigned mode, double x) { 15 uint64_t input, output; 16 memcpy(&input, &x, sizeof input); 17 if (omega_cm_math(&output, mode, input) != OMEGA_OK) return NAN; 18 memcpy(&x, &output, sizeof x); 19 return x; 20 } 21 static inline double rx_host_log(double x) { return rx_host_math(0, x); } 22 static inline double rx_host_log2(double x) { return rx_host_math(1, x); } 23 static inline double rx_host_ceil(double x) { return rx_host_math(2, x); } 24 static inline double rx_host_exp(double x) { return rx_host_math(3, x); } 25 static inline double rx_host_exp2(double x) { return rx_host_math(4, x); } 26 static inline double rx_host_sqrt(double x) { return rx_host_math(5, x); } 27 static inline double rx_host_erfc(double x) { return rx_host_math(6, x); } 28 static inline double rx_host_fabs(double x) { return rx_host_math(7, x); } 29 #define log rx_host_log 30 #define log2 rx_host_log2 31 #define ceil rx_host_ceil 32 #define exp rx_host_exp 33 #define exp2 rx_host_exp2 34 #define sqrt rx_host_sqrt 35 #define erfc rx_host_erfc 36 #define fabs rx_host_fabs 37 #endif 38 #endif