tdpfp16ps
Tile Dot Product FP16 Packed Single
Matrix multiply (FP16 * FP16) accumulating to Float32.
Details
Performs a tile matrix multiply-accumulate operation where two FP16 matrices (tmm2 and tmm3) are multiplied element-wise and accumulated into tmm1 as FP32 results. This is a specialized AMX instruction that leverages tile registers for high-throughput matrix operations. No standard CPU flags are affected; results that overflow to infinity or underflow to zero follow IEEE 754 semantics.
Pseudocode Operation
tmm1 ← tmm1 + (tmm2 * tmm3) // FP16 × FP16 → FP32 accumulation, per tile dimensions
Example
Encoding
Operands
-
dest
TMM -
src1
TMM -
src2
TMM
Reference (Intel® SDM)
Instruction Forms
| Opcode | Instruction | Op/En | 64/32-bit Mode | CPUID | Description |
|---|---|---|---|---|---|
| VEX.128.F2.0F38.W0 5C 11:rrr:bbb | TDPFP16PS tmm1, tmm2, tmm3 | A | V/N.E. | AMX_FP16 | Matrix multiply FP16 elements from tmm2 and tmm3, and accumulate the packed single precision elements in tmm1. |
Instruction Operand Encoding
| Op/En | Tuple Type | Operand 1 | Operand 2 | Operand 3 | Operand 4 |
|---|---|---|---|---|---|
| A | N/A | ModRM:reg (r, w) | ModRM:r/m (r) | VEX.vvvv (r) | N/A |
Description
Operation
TDPFP16PS tsrcdest, tsrc1, tsrc2 // C = m x n (tsrcdest), A = m x k (tsrc1), B = k x n (tsrc2) # src1 and src2 elements are pairs of fp16 elements_src1 := tsrc1.colsb / 4 elements_src2 := tsrc2.colsb / 4 elements_dest := tsrcdest.colsb / 4 elements_temp := tsrcdest.colsb / 2 // Count is in fp16 prior to horizontal for m in 0 ... tsrcdest.rows-1: temp1[ 0 ... elements_temp-1 ] := 0 for k in 0 ... elements_src1-1: for n in 0 ... elements_dest-1: // For this operation: // Handle FP16 denorms. Not forcing input FP16 denorms to 0. // FP32 FMA with DAZ=FTZ=1, RNE rounding. // MXCSR is neither consulted nor updated. // No exceptions raised or denoted. temp1.fp32[2*n+0] += cvt_fp16_to_fp32(tsrc1.row[m].fp16[2*k+0]) *cvt_fp16_to_fp32(tsrc2.row[k].fp16[2*n+0]) temp1.fp32[2*n+1] += cvt_fp16_to_fp32(tsrc1.row[m].fp16[2*k+1]) *cvt_fp16_to_fp32(tsrc2.row[k].fp16[2*n+1]) for n in 0 ... elements_dest-1: // DAZ=FTZ=1, RNE rounding. // MXCSR is neither consulted nor updated. TDPFP16PS—Dot Product of FP16 Tiles Accumulated into Packed Single Precision Tile Vol. 2B 4-718 // No exceptions raised or denoted. tmpf32 := temp1.fp32[2*n] + temp1.fp32[2*n+1] srcdest.row[m].fp32[n] := srcdest.row[m].fp32[n] + tmpf32 write_row_and_zero(tsrcdest, m, tmp, tsrcdest.colsb) zero_upper_rows(tsrcdest, tsrcdest.rows) zero_tileconfig_start()
Flags Affected
None. Exceptions AMX-E4; see Section 2.10, “Intel® AMX Instruction Exception Classes,” for details. TDPFP16PS—Dot Product of FP16 Tiles Accumulated into Packed Single Precision Tile Vol. 2B 4-719