FP16 SOP/MAD Operation#

SOP stands for Sum of Products. The FP16 SOP/MAD pipeline is one of the strongest points of the PowerVR ALU pipeline. If used correctly, it makes it possible to pack more operations into a single cycle. This may result in increased performance and reduced power consumption.

The single cycle FP16 SOP/MAD operation can be described by the following pseudo code:

// Inputs:
a, b, c, d = any of {S0, S1, S2, S3, S4, S5}
z = min(s1, 1 - s0)
e, f, g, h = any of {S0, S1, S2, S3, S4, S5} or z

// Inputs only for the MAD pipeline:
v, w, x, y = any of {S0, S1, S2, S3, S4, S5}

// Operations to be performed
jop = any of {add, sub, min, max, rsub, mad}
kop = any of {add, sub, min, max, rsub}

// Either use the MAD or the SOP pipeline
if (jop == mad)
{
    // Two mad operations performed in parallel
    W0.e0 = a*e+v
    W1.e0 = b*f+x
    W0.e1 = c*g+w
    W1.e1 = d*h+y
}
else
{
    // Multiply the SOP inputs and perform the desired operation on the result
    // performed in parallel
    j = (a * e) jop (b * f)
    k = (c * g) kop (d * h)

    // Convert result to FP32 or keep the results as is
    if (rfmt(1) = 1)
    {
     w1 = toF32(k)
     w0 = toF32(j)
    }
    else if (rfmt(0) = 1) then
    {
     w0[31:16] = one of {j, a, b}
     w0[15:0]  = one of {k, c, d}
    }
    else
    {
     w0[31:16] = one of {k, c, d}
     w0[15:0]  = one of {j, a, b}
    }
}

It is also possible to apply various modifiers such as abs(), negate(), clamp(), or oneminus() to the inputs and clamp() to the outputs.