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/tests/no_posix_bf16.c # 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 / tests / no_posix_bf16.c` 28 lines · 1296 bytes Raw Blame History 1 /* SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception */ 2 /* Same transport caller for the canonical hosted view, native scalar, and C red. 3 * Sweep every upper half-word, including both signs, every exponent and payload 4 * prefix; lower-half representatives border zero, the RNE tie and UINT16_MAX. 5 * Modes border zero and cover non-32-bit values (the canonical mode is ulong). */ 6 #include "omega_gpu_apiviews.h" 7 #include 8 9 int main(void) { 10 static const uint32_t low[] = {0, 1, 32767, 32768, 32769, 65534, 65535}; 11 static const uint64_t modes[] = {0, 1, 2, UINT32_MAX, UINT64_C(`4294967296`), UINT64_MAX}; 12 float x[7]; 13 uint16_t y[9]; 14 for (unsigned m = 0; m < sizeof modes / sizeof modes[0]; ++m) { 15 if (av_bf16_n(modes[m], 0, NULL, NULL)) return 2; 16 for (uint32_t high = 0; high <= UINT16_MAX; ++high) { 17 for (unsigned i = 0; i < 7; ++i) { 18 uint32_t raw = (high << 16) | low[i]; 19 memcpy(&x[i], &raw, sizeof raw); 20 } 21 y[0] = 0x1234; y[8] = 0x5678; 22 if (av_bf16_n(modes[m], 7, x, y + 1)) return 3; 23 if (y[0] != 0x1234 || y[8] != 0x5678) return 4; 24 if (fwrite(y + 1, sizeof *y, 7, stdout) != 7) return 5; 25 } 26 } 27 return ferror(stdout) ? 6 : 0; 28 }