PTX ISA v9.4

9.7.5.4. Mixed Precision Floating Point Instructions: mul

mul

Multiply two values.

Syntax

ptx
mul.ftz.rz.dtype1.atype1.ctype1 d, a, c;
mul.rz.dtype2.atype1.ctype1 d, a, c;
mul.dtype3.atype2.ctype2 d, a, c;
mul.dtype4.atype3.ctype3 d, a, c;

.dtype1 = { .f16x2 }
.dtype2 = { .bf16x2 }
.atype1 = .ctype1 = { .f32x2 }
.dtype3 = .atype2 = { .bf16x2 }
.ctype2 = { .f16x2 }
.dtype4 = .atype3 = { .f16x2 }
.ctype3 = { .bf16x2 }

Description

Converts input operands, while performing multiplication, a and c to dtype. The resulting value is stored in the destination operand d.

Semantics

ptx
if (dtype == .f16x2 || dtype == .bf16x2) {
    if (atype/ctype == .f32x2) { // downconvert
        d[0:15] = convert(a[0:31] * c[0:31]); // Apply rz for output
        d[16:31] = convert(a[32:63] * c[32:63]); // Apply rz for output
    } else if (atype/ctype == .f16x2 || atype/ctype == .bf16x2) { // convert to dtype
        d[0:15] = a[0:15] * convert(c[0:15]);
        d[16:31] = a[16:31] * convert(c[16:31]);
    }
}

Notes

Rounding modifiers:

  • .rz — mantissa LSB rounds towards zero

Subnormal numbers:

  • By default, subnormal numbers are supported.

PTX ISA Notes

Introduced in PTX ISA version 9.4.

Target ISA Notes

Supported on following family-specific architectures:

  • sm_107f or higher in the same family

Examples

ptx
.reg .f16x2 rd;
.reg .f32x2 ra, rc;
mul.ftz.rz.f16x2.f32x2.f32x2 rd, ra, rc;
esc
Type to search across all documentation