triton.experimental.gluon.language.amd.cdna4.scaled_downcast

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

Scale and convert FP16, BF16, or FP32 values to a low-precision MX format, dividing 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 must be compact along axis with one E8M0 byte per block of consecutive input elements along axis, and each block must span a multiple of 8 consecutive input elements.