triton.experimental.gluon.language.amd.cdna5.scaled_downcast

triton.experimental.gluon.language.amd.cdna5.scaled_downcast(input, scale, format, axis=-1, _semantic=None)

Scale and convert FP16, BF16, or FP32 values to a low-precision MX format.

Divide input values by the raw E8M0 scale payload (int8 or uint8).

format selects the target type and packing behavior:

  • "e4m3" / "e5m2" (fp8): elementwise, so the output keeps the shape and layout of input.

  • "e2m1" (packed fp4): consecutive pairs of values along axis are packed into one output byte (even element -> low nibble, next element -> high nibble), so the result extent along axis is halved (the inverse of scaled_upcast).

axis (default: last dim) selects the dimension along which scales are shared. scale provides one E8M0 byte per block of consecutive input elements along axis. The block size must be a power of two and a multiple of 2 on CDNA4 or 8 on CDNA5. For packed FP4, CDNA4 permits one scale per output byte. The block size and scale layout are checked when the kernel is compiled.