TorchLean API

FloatLib.Floats.Formats.OCP.MX.E2M1

OCP MX E2M1 #

FloatLib.Floats.E2M1 is the four-bit floating element used by OCP microscaling formats, with type-level identity E2M1.Family. It stores its code in the low four bits of a UInt8, and the high-bit invariant is erased at runtime. Balanced and throughput planning select exhaustive proved tables for all six operations, including the 4,096-entry fused-multiply-add table. Latency planning selects arithmetic kernels.

This package implements the scalar element format. OCP block semantics and scale selection are defined under FloatLib.Floats.Formats.OCP.MX.Standard.

Reference #

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

    Instances For

      The E2M1 encoding fits in its direct byte carrier.

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

      OCP MX FP4 E2M1 element: 2 exponent bits and 1 fraction bit with bias 1, every code finite, stored in the low four bits of a byte. Under balanced and throughput planning, arithmetic, including fused multiply-add, reads certified byte tables.

      Instances For
        @[inline]

        Construct E2M1 from a natural pattern, reduced to four bits.

        Instances For
          @[inline]

          Read the byte whose low four bits contain the E2M1 code.

          Instances For