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
CUDApp / om / apiviews / fp8sc.om
| 1 | note SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception |
| 2 | note bf16 scale for one fp8 block. a is the f32 bit pattern of amax (non-negative). |
| 3 | note Zero returns the bf16 code of 1 (16256, 0x3F80). Otherwise amax/448 rounded |
| 4 | note up: any nonzero low 16 bits increments the high half. 448.0f32 bits 1138753536. |
| 5 | note WolframLanguageEvaluator: FromDigits of the Real32 bit list of 448 -> 1138753536. |
| 6 | fn av_fp8sc a ulong to ulong |
| 7 | if eq a 0 |
| 8 | ret 16256 |
| 9 | end |
| 10 | q = div bitcast f32 uint a bitcast f32 uint 1138753536 |
| 11 | b = bitcast uint q |
| 12 | h = shr b 16 |
| 13 | if ne and b 65535 0 |
| 14 | h = add h 1 |
| 15 | end |
| 16 | ret ulong and h 65535 |
| 17 | end |