TorchLean API

FloatLib.Floats.Formats.OCP.FP8.E4M3FN

OCP FP8 E4M3FN #

FloatLib.Floats.E4M3FN is OCP E4M3FN with a direct UInt8 runtime carrier, and E4M3FN.Family is its type-level identity. For addition, subtraction, multiplication, division, and square root, balanced and throughput planning select exhaustive byte tables, and latency planning selects the arithmetic kernels. Fused multiply-add uses the proved generic single-rounding kernel because an eight-bit ternary table would contain 16,777,216 entries.

The binary-interchange descriptor specifies the format and its kernels. It is not stored in an E4M3FN value.

Reference #

Type-level identity of E4M3FN, selecting its descriptor, carrier, and kernels.

    Instances For

      The E4M3FN encoding fits in its direct byte carrier.

      @[instance_reducible, always_inline]

      Package the five dense byte tables with the proved arithmetic FMA baseline. The tables total about 256 KiB, and keeping the single-rounding model kernel avoids a 16 MiB FMA table.

      @[instance_reducible, always_inline]
      @[reducible, inline]

      OCP FP8 E4M3FN: 4 exponent and 3 fraction bits with bias 7, no infinity, and NaN only at the two all-ones codes. Values are stored in one byte, and balanced and throughput planning answer the five basic operations from certified byte tables.

      ExecFloat.Binary (exponentBits := 4) (fractionBits := 3) (encoding := .finiteMaxNaN) is the same format on the general binary carrier, with directed rounding and status options.

      Instances For
        @[inline]

        Construct OCP E4M3FN from a natural bit pattern, reduced to eight bits.

        Instances For
          @[inline]

          Read the complete OCP E4M3FN encoding byte.

          Instances For