Mixed-precision floating-point arithmetic circuitry in specialized processing blocks
View Patent ↗The present embodiments relate to integrated circuits with circuitry that efficiently performs mixed-precision floating-point arithmetic operations. Such circuitry may be implemented in specialized processing blocks. The specialized processing blocks may include configurable interconnect circuitry to support a variety of different use modes. For example, the specialized processing blocks may implement fixed-point addition, floating-point addition, fixed-point multiplication, floating-point multiplication, sum of two multiplications in a first floating-point precision, with or without casting to a second floating-point precision and the latter followed by a subsequent addition in the second floating-point precision, if desired, just to name a few. In some embodiments, two or more specialized processing blocks may be arranged in a cascade chain and perform together more complex operations such as a recursive mode dot product of two vectors of floating-point numbers having a first floating-point precision and output the dot product in a second floating-point precision.
1. An integrated circuit that generates a dot product of first and second vectors, comprising:
a first specialized processing block that provides a first partial result of a first floating-point precision; and
a second specialized processing block that receives the first partial result via a cascade connection from the first specialized processing block and comprises:
first floating-point arithmetic operator circuitry that generates a second partial result having the first floating-point precision based on a quaternary reduction of two tuples having a second floating-point precision from each of the first and second vectors, and
second floating-point arithmetic operator circuitry that generates the dot product by performing a binary reduction of the first and second partial results.
2. The integrated circuit of claim 1 , wherein the first floating-point arithmetic operator circuitry further comprises:
a first multiplier circuit that generates a first product based on a first tuple of the two tuples from the first vector and a first tuple of the two tuples from the second vector, wherein the first product has the second floating-point precision; and
a second multiplier circuit that generates a second product based on a second tuple of the two tuples from the first vector and a second tuple of the two tuples from the second vector, wherein the second product has the second floating-point precision.
3. The integrated circuit of claim 2 , wherein the first floating-point arithmetic operator circuitry further comprises:
an adder circuit that generates a sum of the first and second products, wherein the sum has the second floating-point precision.
4. The integrated circuit of claim 3 , wherein the first floating-point arithmetic operator circuitry further comprises:
a cast function circuit that receives the sum from the adder circuit and generates the second partial result by converting the sum from the second floating-point precision into the first floating-point precision.
5. The integrated circuit of claim 4 , wherein the cast function circuit increases the exponent size of the sum from the second to the first floating-point precision.
6. The integrated circuit of claim 4 , wherein the cast function circuit adjusts the bias of the exponent of the sum from the bias of the second floating-point precision to the bias of the second floating-point precision.
7. The integrated circuit of claim 4 , wherein the second specialized processing block further comprises:
an output port that is coupled to the second floating-point arithmetic operator circuitry; and
a bypass path between the adder circuit and the output port, wherein the bypass path bypasses the cast function circuit and the second floating-point arithmetic operator circuitry.
8. The integrated circuit of claim 1 , wherein the second floating-point arithmetic operator circuitry further comprises:
an adder circuit that generates the dot product by adding the first and second partial results.
9. A method for operating an integrated circuit that generates a dot product of first and second vectors, comprising:
generating a first partial result of a first floating-point precision with a first specialized processing block;
providing the first partial result at a cascade output of the first specialized processing block;
receiving the first partial result via a cascade connection from the cascade output of the first specialized processing block at a cascade input of a second specialized processing block;
generating a second partial result having the first floating-point precision based on a quaternary reduction of two tuples having a second floating-point precision from each of the first and second vectors in the second specialized processing block; and
generating the dot product by performing a binary reduction of the first and second partial results in the second specialized processing block.
10. The method of claim 9 , wherein generating the second partial result further comprises:
using a first multiplier circuit to generate a first product based on a first tuple of the two tuples from the first vector and a first tuple of the two tuples from the second vector, wherein the first product has the second floating-point precision; and
using a second multiplier circuit to generate a second product based on a second tuple of the two tuples from the first vector and a second tuple of the two tuples from the second vector, wherein the second product has the second floating-point precision.
11. The method of claim 10 , further comprising:
using an adder circuit to generate a sum of the first and second products, wherein the sum has the second floating-point precision.
12. The method of claim 11 , further comprising:
using a cast function circuit that receives the sum from the adder circuit and generates the second partial result by converting the sum from the second floating-point precision into the first floating-point precision.
13. The method of claim 12 , further comprising:
with the cast function circuit, increasing the exponent size of the sum from the second to the first floating-point precision.
14. The method of claim 12 , further comprising:
with the cast function circuit, adjusting the bias of the exponent of the sum from the bias of the second floating-point precision to the bias of the second floating-point precision.
15. The method of claim 12 , further comprising:
bypassing the cast function circuit on a bypass path that couples the adder circuit to an output port of the second specialized processing block.
16. A non-transitory machine readable storage medium encoded with instructions for configuring an integrated circuit to generate a dot product of first and second vectors, wherein the integrated circuit includes first and second specialized processing blocks that are coupled by a cascade connection, wherein the first and second specialized processing blocks each comprise first and second floating-point arithmetic operator circuitry and configurable interconnection circuitry, the instructions comprising:
instructions to configure the first floating-point arithmetic operator circuitry in the first specialized processing block to generate a first partial result having a first floating-point precision based on a first quaternary reduction of first two tuples having a second floating-point precision from each of the first and second vectors;
instructions to configure the configurable interconnection circuitry in the first and second specialized processing blocks to route the first partial result from the first floating-point arithmetic operator circuitry in the first specialized processing block via the cascade connection to the second arithmetic operator circuitry in the second specialized processing block;
instructions to configure the first floating-point arithmetic operator circuitry in the second specialized processing block to generate a second partial result having the first floating-point precision based on a second quaternary reduction of second two tuples having the second floating-point precision from each of the first and second vectors; and
instructions to configure the second floating-point arithmetic operator circuitry in the second specialized processing block to generate the dot product by performing a binary reduction of the first and second partial results.
17. The non-transitory machine readable storage medium of claim 16 , further comprising:
instructions to generate the instructions of claim 16 .
18. The non-transitory machine readable storage medium of claim 16 , wherein the instructions to configure the first floating-point arithmetic operator circuitry in the first specialized processing block further comprise:
instructions to configure a first multiplier circuit to generate a first product based on a first tuple of the first two tuples from the first vector and a first tuple of the first two tuples from the second vector, wherein the first product has the second floating-point precision; and
instructions to configure a second multiplier circuit to generate a second product based on a second tuple of the first two tuples from the first vector and a second tuple of the first two tuples from the second vector, wherein the second product has the second floating-point precision.
19. The non-transitory machine readable storage medium of claim 18 , wherein the instructions to configure the first floating-point arithmetic operator circuitry in the first specialized processing block further comprise:
instructions to configure an adder circuit to generate a sum of the first and second products, wherein the sum has the second floating-point precision.
20. The non-transitory machine readable storage medium of claim 19 , wherein the instructions to configure the first floating-point arithmetic operator circuitry in the first specialized processing block further comprise:
instructions to configure a cast function circuit to generate the second partial result by converting the sum from the second floating-point precision into the first floating-point precision.