US 8106914 B2 Abstract A functional unit is added to a graphics processor to provide direct support for double-precision arithmetic, in addition to the single-precision functional units used for rendering. The double-precision functional unit can execute a number of different operations, including fused multiply-add, on double-precision inputs using data paths and/or logic circuits that are at least double-precision width. The double-precision and single-precision functional units can be controlled by a shared instruction issue circuit, and the number of copies of the double-precision functional unit included in a core can be less than the number of copies of the single-precision functional units, thereby reducing the effect of adding support for double-precision on chip area.
Claims(17) 1. A graphics processor comprising:
a rendering pipeline adapted to generate image data, the rendering pipeline including a processing core adapted to execute a plurality of concurrent threads, wherein the rendering pipeline operates on single-precision operands,
the processing core further including a multipurpose double-precision functional unit adapted to selectably execute one of a plurality of double-precision operations on a set of double-precision input operands, the multipurpose double-precision functional unit including at least one arithmetic logic circuit, the plurality of double-precision operations including an addition operation that adds two double-precision operands, a multiplication operation that multiplies two double-precision operands, and a fused multiply-add operation that computes a product of a first double precision operand and a second double-precision operand then adds a third double-precision operand to the product,
wherein the multipurpose double-precision functional unit is wide enough to perform each of the plurality of double-precision operations in a single pass, such that each of the plurality of double-precision operations completes in a same number of clock cycles, and
wherein all of the arithmetic logic circuits of the double-precision functional unit are sufficiently wide to operate at double-precision.
2. The graphics processor of
3. The graphics processor of
4. The graphics processor of
5. The graphics processor of
6. The graphics processor of
a double-precision maximum (DMAX) operation that returns a larger one of two double-precision input operands; and
a double-precision minimum (DMIN) operation that returns a smaller one of two double-precision input operands.
7. The graphics processor of
8. The graphics processor of
9. A graphics processor comprising:
a rendering pipeline adapted to generate image data, the rendering pipeline including a processing core adapted to execute a plurality of concurrent threads,
the processing core including a single-precision functional unit adapted to execute an arithmetic operation on one or more single-precision operands,
the processing core further including a double-precision fused multiply-add (DFMA) functional unit adapted to execute a fused multiply-add operation on a set of double-precision input operands and to provide a double-precision result, to execute an addition operation on a pair of double-precision input operands and to provide a double-precision result, and to execute a multiplication operation on a pair of double-precision input operands and to provide a double-precision result,
wherein the DFMA functional unit includes a DFMA pipeline having data paths wide enough to perform the fused multiply-add operation, the addition operation, or the multiplication operation in a single pass through the DFMA pipeline, such that the fused multiply-add operation, the addition operation, and the multiplication operation are each completed in a same number of clock cycles.
10. The graphics processor of
a multiplier adapted to compute a product of two double-precision mantissas in a single iteration; and
an adder adapted to compute a sum of two double-precision mantissas in a single iteration.
11. The graphics processor of
the fused multiply-add operation, the addition operation, and the multiplication operation are each completed in a same number of clock cycles, regardless of whether an overflow or underflow condition occurs.
12. The graphics processor of
13. The graphics processor of
14. The graphics processor of
15. The graphics processor of
16. The graphics processor of
17. The graphics processor of
Description The present invention relates in general to graphics processors and in particular to a double-precision fused multiply-add functional unit for a graphics processor. Graphics processors are commonly used in computer systems to accelerate rendering of images from two-dimensional or three-dimensional geometry data. Such processors are typically designed with a high degree of parallelism and high throughput, allowing thousands of primitives to be processed in parallel to render complex, realistic animated images in real time. High-end graphics processors provide more computing power than typical central processing units (CPUs). More recently, there has been interest in leveraging the power of graphics processors to accelerate various computations unrelated to image rendering. A “general-purpose” graphics processor can be used to perform computations in scientific, financial, business and other fields. One difficulty in adapting graphics processors for general-purpose computations is that graphics processors are usually designed for relatively low numerical precision. High quality images can be rendered using 32-bit (“single-precision”) or even 16-bit (“half-precision”) floating point values, and the functional units and internal pipelines are configured to support these data widths. In contrast, many general-purpose computations require higher numerical precision, e.g., 64 bits (“double-precision”). To support higher precision, some graphics processors use software techniques to execute double-precision computations using a sequence of machine instructions and 32-bit or 16-bit functional units. This approach slows throughput; for instance, a hundred or more machine instructions might be required to complete a single 64-bit multiplication operation. Such long sequences can significantly reduce the double-precision throughput of the graphics processor. In one representative case, it is estimated that the graphics processor would complete double-precision computations at about ⅕ the throughput possible with a high-end dual-core CPU chip. (By comparison, the same graphics processor can complete single-precision computations at about 15-20 times the throughput of the dual-core CPU.) Because software-based solutions are so much slower, existing graphics processors are rarely used for double-precision computations. Another solution is simply to make all of the arithmetic circuits of the graphics processor wide enough to handle double-precision operands. This would increase the graphics processor's throughput for double-precision operations to match the single-speed throughput. However, graphics processors typically have dozens of copies of each arithmetic circuit to support parallel operations, and increasing the size of each such circuit would substantially increase the chip area, cost and power consumption. Still another solution, as described in commonly-owned co-pending U.S. patent application Ser. No. 11/359,353, filed Feb. 21, 2006, is to leverage single-precision arithmetic circuits to perform double-precision operations. In this approach, special hardware included in a single-precision functional unit is used to perform a double-precision operation iteratively. This approach is considerably faster than software-based solutions (throughput might be reduced, e.g., by a factor of 4 relative to single-precision throughput, rather than by a factor of ˜100), but it can significantly complicate the chip design. In addition, sharing the same functional unit between single-precision and double-precision operations can result in that unit becoming a bottleneck in the pipeline if too many instructions require the same functional unit. Embodiments of the present invention directly support double-precision arithmetic in a graphics processor. A multipurpose double-precision functional unit is provided in addition to the single-precision functional units used for rendering. The double-precision functional unit can execute a number of different operations, including fused multiply-add, on double-precision inputs using data paths and/or logic circuits that are at least double-precision width. The double-precision and single-precision functional units can be controlled by a shared instruction issue circuit, and the number of copies of the double-precision functional unit included in a core can be less than the number of copies of the single-precision functional units, thereby reducing the effect of adding support for double-precision on chip area. According to one aspect of the present invention, a graphics processor has a rendering pipeline adapted to generate image data. The rendering pipeline, which operates on single-precision operands, includes a processing core adapted to execute a number of concurrent threads. The processing core includes a multipurpose double-precision functional unit adapted to selectably execute one of a number of double-precision operations on a set of double-precision input operands. The multipurpose double-precision functional unit includes at least one arithmetic logic circuit, and all of the arithmetic logic circuits of the double-precision functional unit are sufficiently wide to operate at double-precision. In some embodiments, the double-precision functional unit is adapted such that each of the double-precision operations completes in a same number of clock cycles, and the unit may also be adapted such that a time (e.g., number of clock cycles) required to complete any one of the of double-precision operations is not affected by an underflow or overflow condition. Various operations and combinations of double-precision operations can be supported. In one embodiment, the double-precision operations include an addition operation that adds two double-precision operands; a multiplication operation that multiplies two double-precision operands; and a fused multiply add operation that computes a product of a first double-precision operand and a second double-precision operand, then adds a third double-precision operand to the product. Other double-precision operations that can be supported include a double-precision comparison (DSET) operation that performs a comparison test on a first operand and a second operand and generates a Boolean result indicating whether the comparison test is satisfied, a double-precision maximum (DMAX) operation that returns a larger one of two double-precision input operands, or a double-precision minimum (DMIN) operation that returns a smaller one of two double-precision input operands. In addition, format conversion operations that convert an operand from a double-precision format to a non double-precision format (or vice versa) can also be supported. According to another aspect of the present invention, a graphics processor includes a rendering pipeline adapted to generate image data. The rendering pipeline including a processing core adapted to execute multiple concurrent threads. The processing core includes a single-precision functional unit adapted to execute an arithmetic operation on one or more single-precision operands and a double-precision fused multiply add (DFMA) functional unit adapted to execute a fused multiply add operation on a set of double-precision input operands and to provide a double-precision result. The DFMA functional unit advantageously includes a DFMA pipeline having data paths wide enough to perform the fused multiply add operation in a single pass through the DFMA pipeline. For example, the DFMA functional unit may include a multiplier adapted to compute a product of two double-precision mantissas in a single iteration and an adder adapted to compute a sum of two double-precision mantissas in a single iteration. The DFMA functional unit can also be configured to execute other operations. For instance, in some embodiments the DFMA is configured to execute a multiplication operation on a pair of double-precision input operands and to provide a double-precision result. In some embodiments, the multiplication operation and the fused multiply add operation are each completed in a same number of clock cycles. Similarly, the DFMA functional unit can be configured to execute an addition operation on a pair of double-precision input operands and to provide a double-precision result. In one embodiment, the addition operation and the fused multiply add operation are each completed in a same number of clock cycles. In some embodiments, the processing core includes a number (P) of copies of the first functional unit adapted to operate in parallel and a number (N) of copies of the DFMA functional unit, the number P being larger than the number N. In one embodiment, the number N is one. The processing core may include an input manager circuit adapted to collect P sets of double-precision input operands for the DFMA functional unit and to deliver different ones of the P sets of double-precision operands to the DFMA functional unit on different (e.g., successive) clock cycles. The input manager circuit may also be adapted to collect P sets of single-precision input operands for the first functional unit and to deliver, in parallel, a different one of the P sets of single-precision operands to each one of the P copies of the first functional unit. The following detailed description together with the accompanying drawings will provide a better understanding of the nature and advantages of the present invention. Embodiments of the present invention provide graphics processors that include dedicated double-precision (e.g., 64-bit) functional units. In one embodiment, a double-precision functional unit is capable of performing addition, multiplication and fused-multiply add operations, as well as double-precision comparisons and format conversions to and from double-precision formats. I. System Overview A. Computer System Overview Graphics processing subsystem GPU CPU It will be appreciated that the system shown herein is illustrative and that variations and modifications are possible. The bus topology, including the number and arrangement of bridges, may be modified as desired. For instance, in some embodiments, system memory The connection of GPU A GPU may be provided with any amount of local graphics memory, including no local memory, and may use local memory and system memory in any combination. For instance, in a unified memory architecture (UMA) embodiment, no dedicated graphics memory device is provided, and the GPU uses system memory exclusively or almost exclusively. In UMA embodiments, the GPU may be integrated into a bus bridge chip or provided as a discrete chip with a high-speed bus (e.g., PCI-E) connecting the GPU to the bridge chip and system memory. It is also to be understood that any number of GPUs may be included in a system, e.g., by including multiple GPUs on a single graphics card or by connecting multiple graphics cards to bus In addition, GPUs embodying aspects of the present invention may be incorporated into a variety of devices, including general purpose computer systems, video game consoles and other special purpose computer systems, DVD players, handheld devices such as mobile phones or personal digital assistants, and so on. B. Rendering Pipeline Overview In addition to multithreaded core array For rendering operations, front end The state information and rendering commands define processing parameters and actions for various stages of rendering pipeline Front end Geometry module After the vertex and/or geometry shader programs have executed, geometry module Setup module After determining which pixels are covered by a primitive, rasterizer These attribute equations are advantageously usable in a pixel shader program to calculate a value for the attribute at any location within the primitive; conventional techniques can be used to generate the equations. For instance, in one embodiment, color assembly module Color assembly module Pixel shader programs are advantageously executed in multithreaded core array Once processing for a pixel or group of pixels is complete, pixel module For general-purpose computations, multithreaded core array can be controlled by pixel module Each processing task advantageously includes executing a number of processing threads, where each thread executes the same program. The program advantageously includes instructions to read input data from “global memory” (e.g., system memory It will be appreciated that the rendering pipeline described herein is illustrative and that variations and modifications are possible. The pipeline may include different units from those shown and the sequence of processing events may be varied from that described herein. Further, multiple instances of some or all of the modules described herein may be operated in parallel. In one such embodiment, multithreaded core array C. Core Overview Multithreaded core array Execution core The other functional units During operation of execution core DFMA unit In one embodiment, core It will be appreciated that the execution core of Additionally, persons of ordinary skill in the art with access to the present teachings will recognize that DFMA unit C. DFMA Unit Overview In accordance with one embodiment of the present invention, execution core DFMA unit “Fp32”, as used herein, refers to the standard IEEE 754 single-precision floating-point format, in which a normal floating point number is represented by a sign bit, eight exponent bits, and 23 significand bits. The exponent is biased upward by 127 so that exponents in the range 2 “Fp64,” as used herein refers to the standard IEEE 754 double-precision floating-point format, in which a normal floating point number is represented by a sign bit, 11 exponent bits and 52 significand bits. The exponent is biased upward by 1023 so that exponents in the range 2 “Fp16,” as used herein refers to a “half-precision” floating-point format commonly used in graphics, in which a normal floating point number is represented by a sign bit, 5 exponent bits and 10 significand bits. The exponent is biased upward by 15 so that exponents in the range 2 In fp16, fp32 and fp64 formats, numbers with all zeroes in the exponent bits are referred to as denormalized numbers (or “denorms”) and are interpreted as not having an implied leading 1 in the mantissa; such numbers may represent, e.g., an underflow in a computation. The (positive or negative) number with all ones in the exponent bits and zeroes in the significand bits are referred to as (positive or negative) INF; this number may represent, e.g., an overflow in a computation. Numbers with all ones in the exponent bits and a non-zero number in the significand bits are referred to as Not a Number (NaN) and may be used, e.g., to represent a value that is undefined. Zero is also considered a special number and is represented by all of the exponent and significand bits being set to zero. Zero can have either sign; thus both positive and negative zero are allowed. Fixed-point formats are specified herein by an initial “s” or “u” indicating whether the format is signed or unsigned and a number denoting the total number of bits (e.g., 16, 32, 64); thus, s32 refers to signed 32-bit format, u64 to an unsigned 64-bit format and so on. For the signed formats, two's complement representation is advantageously used. In all formats used herein, the most significant bit (MSB) is at the left of the bit field and the least significant bit (LSB) is at the right. It is to be understood that these formats are defined and referred to herein for purposes of illustration and that a DFMA unit might support any combination of these formats or different formats without departing from the scope of the present invention. In particular, it is to be understood that “single-precision” and “double-precision” can refer to any two different floating-point formats, not limited to currently defined standards; a double-precision format (e.g., fp64) refers to any format that uses a larger number of bits than a related single-precision format (e.g., fp32) to represent a larger range of floating-point numbers and/or to represent floating-point values to a higher degree of precision. Similarly, “half-precision” can refer generally to a format that uses fewer bits than a related single-precision format to represent a smaller range of floating-point numbers and/or to represent floating-point numbers with a lower degree of precision. An embodiment of DFMA unit Section Section Section The D2D operation is used to apply rounding operations, such as the IEEE rounding modes, to an fp64 operand. These operations round the fp64 operand to an integer value represented in fp64 format. In one embodiment, the supported D2D operations include truncation (rounding toward zero), ceiling (rounding toward +INF), floor (rounding toward −INF), and nearest (rounding up or down to the nearest integer). In this embodiment, DFMA unit Sections II and III describe a DFMA unit II. DFMA Unit Structure DFMA unit Section II.A provides an overview of the DFMA pipeline, and Sections II.B-I describe the circuit blocks of each section in detail. A. DFMA Pipeline An initial understanding of the pipeline can be had with reference to how the circuit blocks are used during a DFMA operation. Operand preparation block Mantissa path Sign path Output section It is to be understood that while names such as “mantissa path” and “exponent path” may suggest functions performed during certain operations (e.g., DFMA) by the various circuit blocks of each path, circuit blocks along any of the internal data paths may be leveraged for a variety of uses in an operation-dependent manner. Examples are described below. In addition to the data paths, DFMA unit It should noted that the circuit blocks for a given stage may require different amounts of processing time and that the time required at a particular stage might vary from one operation to another. Accordingly, DFMA unit A. Operand Preparation The operands A, B and C are received at respective NaN detection blocks Absolute value/negation blocks For double-precision arithmetic, the operands A, B and C produced by absolute value/negation blocks For format conversion operands, the input might not be in fp64 format. An fp32 extraction circuit An unsigned/signed (U/S) extraction circuit Operand selection muxes Operand selection mux Operand selection mux The operands A, B and C selected by selection muxes Regardless of whether any special numbers are detected, special number detection circuits B. Exponent Path An exponent calculation circuit In addition, exponent calculation block The mantissa Cm is provided to a negation circuit In one embodiment, shift circuit In an alternative embodiment, conventional swap muxes can be used to select the larger operand between product Am*Bm and Cm, then right-shift the smaller operand. For D2D operations, mantissa Cm is also provided to a D2D logic circuit Selection mux Underflow logic Exponent path C. Mantissa Path A 53Ũ53 multiplier Mantissa path Normalization logic Left-shift circuit The result selected by mux D. Sign Path More specifically, sign path Final sign circuit Based on this information, final sign circuit E. Output Section Output mux control logic Significand selection mux Exponent selection mux Concatenation block F. Operand Bypass or Pass-through Paths DFMA unit Thus, operational descriptions in Section III (below) may refer to various operands being bypassed or passed through to a particular circuit block; it is to be understood that this can be accomplished either by controlling any intervening circuit blocks to perform an operation that does not affect the operand (e.g., adding zero or multiplying by 1.0) so that the input to the block is passed through as the output or by using a bypass path. Further, following a bypass or pass-through path around some circuit blocks does not necessarily require continuing to follow the bypass path at subsequent circuit blocks. In addition, a value that is modified in one circuit block may follow a bypass pass around a subsequent circuit block. Where a particular circuit block is bypassed during an operation, that circuit block may be set into an inactive state to reduce power consumption or allowed to operate normally with its output being ignored, e.g., through the use of selection muxes or other circuit elements. It will be appreciated that the DFMA unit described herein is illustrative and that variations and modifications are possible. Many of the circuit blocks described herein provide conventional functions and may be implemented using techniques known in the art; accordingly, detailed descriptions of these blocks have been omitted. The division of operational circuitry into blocks may be modified, and blocks may be combined or varied. In addition, the number of pipeline stages and the assignment of particular circuit blocks or operations to particular pipeline stages may also be modified or varied. The selection and arrangement of circuit blocks for a particular implementation will depend on the set of operations to be supported, and those skilled in the art will recognize that not all of the blocks described herein are required for every possible combination of operations. III. DFMA Unit Operations DFMA unit It should be noted that floating-point exceptions (including, e.g., overflow or underflow conditions) are handled within DFMA unit A. Fused Multiply-Add (DFMA) For DFMA operations, DFMA unit A/B comparison circuit In sign path In exponent path Negation block Shift circuit In mantissa path Adder The final sum S selected by mux Normalization logic In parallel with the rounding operations, exponent path In parallel with the rounding operations, final sign circuit Output section Significand mux Exponent mux Concatenation block It should be noted that DFMA unit B. Multiplication Multiplication (DMUL) can be implemented identically to the DFMA operation described above, with operand C set to zero; DFMA unit C. Addition Addition (DADD) can be implemented identically to the DFMA operation described above, with operand B set to 1.0; DFMA unit D. DMAX and DMIN For DMAX or DMIN operations, operand preparation block A/B comparison circuit Specifically, for DMAX operations, operand A mux Special number detection circuits Fp32 extraction circuit Mantissa path Output section In an alternative embodiment, some or all components of mantissa path E. DSET Like DMAX and DMIN, DSET operations use A/B comparison circuit For DSET operations, operand preparation block A/B comparison circuit Fp32 extraction circuit Mantissa path Output section F. Format Conversions In some embodiments, DFMA unit 1. fp32 to fp64 (F2D) For F2D operations, an fp32 input operand A is converted to a corresponding fp64 number. Special number inputs are handled appropriately; e.g., fp32 INF or NaN is converted to fp64 INF or NaN. All fp32 denorms can be converted to fp64 normal numbers. Operand preparation block Operand C mux Mantissa path In output section 2. Integer to fp64 (I2D) For I2D operations, an integer (u64, s64, u32 or s32 format) is converted to fp64 format. Operand preparation block U/S extraction block Operand C mux Mantissa path In output section 3. fp64 to fp32 (D2F) Since fp64 covers a larger range of floating-point values than fp32, converting from fp64 to fp32 (D2F) requires detection of overflows and underflows in the fp32 value. For D2F operations, the operand C is provided to operand preparation block In exponent path In mantissa path Output section The 8-bit fp32 exponent is provided in an 11-bit exponent field. Output mux control logic Concatenation block 4. fp64 to integer (D2I) For D2I operations, overflows and underflows are detected. Overflows are set to the maximum integer value, and underflows are set to zero. The operand to be converted is provided as operand C in fp64 format. Absolute value/negation circuit In exponent path Shift circuit In mantissa path In output section IV. Further Embodiments While the invention has been described with respect to specific embodiments, one skilled in the art will recognize that numerous modifications are possible. For instance, a DFMA unit may be implemented to support more, fewer, or different functions in combination and to support operands and results in any format or combinations of formats. The various bypass paths and pass-throughs described herein may also be varied. In general, where a bypass path around any circuit block is described, that path may be replaced by an identity operation (i.e., an operation with no effect on its operand, such as adding zero) in that block. A circuit block is bypassed during a given operation may be placed into an idle state (e.g., a reduced power state) or operated normally with its result being ignored by downstream blocks, e.g., through operation of selection muxes or other circuits. The DFMA pipeline can be divided into any number of stages, and the combination of components at each stage may be varied as desired. Functionality ascribed to particular circuit blocks herein may also be separated across pipeline stages; for instance, a multiplier tree might occupy multiple stages. The functionality of various blocks may also be modified. In some embodiments, for example, different adder circuits or multiplier circuits may be used. In addition, the DFMA unit has been described in terms of circuit blocks to facilitate understanding; those skilled in the art will recognize that the blocks may be implemented using a variety of circuit components and layouts and that blocks described herein are not limited to a particular set of components or physical layout. Blocks may be physically combined or separated as desired. A processor may include one or more DFMA units in an execution core. For example, where superscalar instruction issue (i.e., issuing more than one instruction per cycle) or SIMD instruction issue is desired, multiple DFMA units may be implemented, and different DFMA units may support different combinations of functions. A processor may also include multiple execution cores, and each core may have its own DFMA unit(s). In some embodiments where the execution core supports SIMD instruction issue, a single DFMA unit may be used in combination with appropriate input sequencing and output collection logic to allow multiple data sets to be processed sequentially in a single DFMA pipeline. An input manager For single-precision instructions, one collector (e.g., collector For instructions to DFMA unit Core Muxes It will be appreciated that the operand collection and sequencing logic described herein is illustrative and that variations and modifications are possible. In a SIMD-capable core, any number of DFMA units may be provided and instructions may be issued to any number of the DFMA units in parallel. In some embodiments, throughput for double-precision operations relative to single-precision operations scales with the number of DFMA units. For example, if there are P SIMD units and N DFMA units, double-precision throughput will be N/P of the single-precision throughput. In some embodiments, N is optimally equal to P; in other embodiments, other factors—e.g., the width of internal data paths between the register file and the functional units—may limit the double-precision throughput to less than the single-precision throughput regardless of the number of DFMA units present. In that case, N is optimally no larger than the other limiting factors allow. It should also be noted that since the DFMA unit is separate from single-precision functional units, it can be powered down when not in use, e.g., when the graphics processor or core is being used exclusively for rendering processes or other computations that do not require double-precision. Further, the DFMA unit can be removed from the integrated circuit design without affecting the operation of other circuit components. This facilitates the design of product families in which different chips provide different levels of support for double-precision operations. For instance, a GPU family might include a high-end GPU with many cores, each of which includes at least one DFMA unit, and a low-end GPU with no hardware-based double-precision support and no DFMA units. Further, while the invention has been described with reference to a graphics processor, those skilled in the art will appreciate that aspects of the present invention may also be employed in other processors such as math co-processors, vector processors, or general-purpose processors. Thus, although the invention has been described with respect to specific embodiments, it will be appreciated that the invention is intended to cover all modifications and equivalents within the scope of the following claims. Patent Citations
Non-Patent Citations
Referenced by
Classifications
Legal Events
Rotate |