interplane.Get Omega
Read in your language

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

branch main Branches Tags History

CUDApp / om / apiviews / fp8sc.om

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