The present disclosure generally relates to the field of computing. More particularly, an embodiment of the invention generally relates to techniques for fast branch-free vector division computation.
Compared to other simple arithmetic operations, hardware implementations for division operations have been quite slow, for example, due to larger latency. Some speedup could be achieved in vector cases due to various kind of parallelism existence on modern architectures, such as via SIMD (Single-Instruction, Multiple-Data) parallelism, superscalar, and out-of-order execution. For example, reciprocal approximation with further Newton-Raphson refinement iterations method (such as discussed at http://en.wikipedia.org/wiki/Newton%E2%80%93Raphson_method) generally works well for single precision (SP) case providing up to a two-fold speedup over hardware division operation in some implementations. However, this approach loses most of its benefits on double precision (DP) side because of absence of double precision reciprocal operation in current SSE architectures. Consequently, additional DP to SP and SP to DP conversions may need to be performed, along with exponent field manipulations. Further, the SP and DP above-described approximations generally require special processing of denominator with infinite (INF) or zero values, reducing parallelism and reducing potential performance gains.
The detailed description is provided with reference to the accompanying figures. In the figures, the left-most digit(s) of a reference number identifies the figure in which the reference number first appears. The use of the same reference numbers in different figures indicates similar or identical items.
In the following description, numerous specific details are set forth in order to provide a thorough understanding of various embodiments. However, various embodiments of the invention may be practiced without the specific details. In other instances, well-known methods, procedures, components, and circuits have not been described in detail so as not to obscure the particular embodiments of the invention. Further, various aspects of embodiments of the invention may be performed using various means, such as integrated semiconductor circuits (“hardware”), computer-readable instructions organized into one or more programs (“software”), or some combination of hardware and software. For the purposes of this disclosure reference to “logic” shall mean either hardware, software (including for example micro-code that controls the operations of a processor), or some combination thereof.
Reference in the specification to “one embodiment” or “an embodiment” means that a particular feature, structure, or characteristic described in connection with the embodiment may be included in at least an implementation. The appearances of the phrase “in one embodiment” in various places in the specification may or may not be all referring to the same embodiment.
Also, in the description and claims, the terms “coupled” and “connected,” along with their derivatives, may be used. In some embodiments of the invention, “connected” may be used to indicate that two or more elements are in direct physical or electrical contact with each other. “Coupled” may mean that two or more elements are in direct physical or electrical contact. However, “coupled” may also mean that two or more elements may not be in direct contact with each other, but may still cooperate or interact with each other.
Some of the embodiments discussed herein may provide improved performance for double precision division/inversion vector computations, e.g., without requiring branches or special actions which were previously necessary. The vector division computations may be performed on SIMD computing platforms. Generally, SIMD is a technique employed to achieve data level parallelism. In particular, multiple data may be processed in multiple corresponding lanes of an SIMD vector processor (such as processors 402 and 502/504 of
In some implementations, only one division operation is performed for several inversions. Taking the following as an example (proposed by I. I. Zavarzin, V. F. Kuryakin, V. V. Lunev, D. M. Obuvalin, V. G. Ryzhih in “Optimizatsiya Vychislenij Vektornyh Funktsyj.” VANT. ser. Matematicheskoe modelirovanie fizicheskih protsessov. 1997. Vol. 4 (Russian language magazine)):
The inversion of every argument may be computed using three additional multiplications by R and three other arguments which is generally faster than four hardware divisions that involve large latency and large throughput value. More specifically, for the general case of N values, the next maximum possible performance gain estimation for this technique (D, M—throughput values for Division and Multiplier, respectively) may be:
A weakness of this approach lies in high possibility to encounter overflow or underflow for the product x1·x2·x3·x4 because of argument exponents variety which may result in incorrect outputs for the whole four-arguments bundle. For example, if x1=0.0, but x2≠0.0, x3≠0.0, x4≠0.0, then R=INF and three of four results are incorrect:
To address this problem, there needs to be a guarantee that the sum of all input exponents is not going to cause underflow or overflow. This makes the work interval quite narrow and requires argument comparisons with possible branches for special cases that cannot be processed properly in the main path. In an embodiment, the above-mentioned problems may be addressed by argument scaling and reconstruction.
More specifically,
f=20+f1·2−1+f2·2−2+ . . . +fp·2−p=1·f1f2 . . . fpB−mantissa(1≦f<2).
The inversion can be determined:
Assume that (x1, x2, x3, x4) are input arguments where xi=(−1)s
for i=
At an operation 110, the result is reconstructed as
where
in an embodiment, by an “insertion” of negated input exponent 2−n
This approach provides sufficient accuracy and processes Institute of Electrical and Electronics Engineers, Inc. (IEEE) special values within the main path. As much as ziε[1,2), no results with over/under-flow may occur during computation, e.g., a product of any two values zi·zjε[1,4), of any three values zi·zj·zkε[1,8), of all four arguments z1·z2·z3·z4ε[1,16) and
etc.
Furthermore, every multiplication may be done by rounding to working precision with error as much as 0.5 ulp (Unit in the Last Place or Unit of Least Precision; see, e.g., http://en.wikipcdia.org/wiki/Ulp; see, also, e.g., “On the definition of ulp(x)” by Jean-Michel Muller, INRIA Technical Report 5504), so the error of calculating z1·z2·z3·z4 will not be higher than 3·0.5=1.5 ulp.
In an embodiment, to find
another three multiplications may be used with additional 3·0.5=1.5 ulp and one inversion which is error-free this case. Thus, error of the result
will be less or equal to (3+3)*0.5=3.0 ulp. Final reconstruction
does not add any additional errors due to IEEE floating point numbers representation. Resulting 3.0 ulp is within requirements for ICL (Intel Compiler), SVML (Short Vector Math Library), MKL (Math Kernel Library) and IPP (Intel Performance Primitives) vector math libraries LA (Low Accuracy) default flavor—up to four ulp that corresponds to two incorrect mantissa bits which is enough for large majority of applications.
Furthermore, even though a case with a four-value bundle is discussed herein, these techniques could be applied to any bundle size.
Moreover, the computing system 400 may include one or more central processing unit(s) (CPUs) 402 or processors that communicate via an interconnection network (or bus) 404. The processors 402 may include a general purpose processor, a network processor (that processes data communicated over a computer network 403), or other types of a processor (including a reduced instruction set computer (RISC) processor or a complex instruction set computer (CISC)). Moreover, the processors 402 may have a single or multiple core design. The processors 402 with a multiple core design may integrate different types of processor cores on the same integrated circuit (IC) die. Also, the processors 402 with a multiple core design may be implemented as symmetrical or asymmetrical multiprocessors. Additionally, the processors 402 may utilize an SIMD architecture. Moreover, the operations discussed with reference to
A chipset 406 may also communicate with the interconnection network 404. The chipset 406 may include a memory control hub (MCH) 408. The MCH 408 may include a memory controller 410 that communicates with a memory 412. The memory 412 may store data, including sequences of instructions that are executed by the CPU 402, or any other device included in the computing system 400. In one embodiment of the invention, the memory 412 may include one or more volatile storage (or memory) devices such as random access memory (RAM), dynamic RAM (DRAM), synchronous DRAM (SDRAM), static RAM (SRAM), or other types of storage devices. Nonvolatile memory may also be utilized such as a hard disk. Additional devices may communicate via the interconnection network 404, such as multiple CPUs and/or multiple system memories.
The MCH 408 may also include a graphics interface 414 that communicates with a display 416. The display 416 may be used to show a user results of operations associated with the fast division/inversion discussed herein. In one embodiment of the invention, the graphics interface 414 may communicate with the display 416 via an accelerated graphics port (AGP). In an embodiment of the invention, the display 416 may be a flat panel display that communicates with the graphics interface 414 through, for example, a signal converter that translates a digital representation of an image stored in a storage device such as video memory or system memory into display signals that are interpreted and displayed by the display 416. The display signals produced by the interface 414 may pass through various control devices before being interpreted by and subsequently displayed on the display 416.
A hub interface 418 may allow the MCH 408 and an input/output control hub (ICH) 420 to communicate. The ICH 420 may provide an interface to I/O devices that communicate with the computing system 400. The ICH 420 may communicate with a bus 422 through a peripheral bridge (or controller) 424, such as a peripheral component interconnect (PCI) bridge, a universal serial bus (USB) controller, or other types of peripheral bridges or controllers. The bridge 424 may provide a data path between the CPU 402 and peripheral devices. Other types of topologies may be utilized. Also, multiple buses may communicate with the ICH 420, e.g., through multiple bridges or controllers. Moreover, other peripherals in communication with the ICH 420 may include, in various embodiments of the invention, integrated drive electronics (IDE) or small computer system interface (SCSI) hard drive(s), USB port(s), a keyboard, a mouse, parallel port(s), serial port(s), floppy disk drive(s), digital output support (e.g., digital video interface (DVI)), or other devices.
The bus 422 may communicate with an audio device 426, one or more disk drive(s) 428, and a network interface device 430, which may be in communication with the computer network 403. In an embodiment, the device 430 may be a NIC capable of wireless communication. Other devices may communicate via the bus 422. Also, various components (such as the network interface device 430) may communicate with the MCH 408 in some embodiments of the invention. In addition, the processor 402 and the MCH 408 may be combined to form a single chip. Furthermore, the graphics interface 414 may be included within the MCH 408 in other embodiments of the invention.
Furthermore, the computing system 400 may include volatile and/or nonvolatile memory (or storage). For example, nonvolatile memory may include one or more of the following: read-only memory (ROM), programmable ROM (PROM), erasable PROM (EPROM), electrically EPROM (EEPROM), a disk drive (e.g., 428), a floppy disk, a compact disk ROM (CD-ROM), a digital versatile disk (DVD), flash memory, a magneto-optical disk, or other types of nonvolatile machine-readable media that are capable of storing electronic data (e.g., including instructions). In an embodiment, components of the system 400 may be arranged in a point-to-point (PtP) configuration such as discussed with reference to
More specifically,
As illustrated in
The processors 502 and 504 may be any suitable processor such as those discussed with reference to the processors 402 of
At least one embodiment of the invention may be provided by utilizing the processors 502 and 504. For example, the processors 502 and/or 504 may perform one or more of the operations of
The chipset 520 may be coupled to a bus 540 using a PtP interface circuit 541. The bus 540 may have one or more devices coupled to it, such as a bus bridge 542 and I/O devices 543. Via a bus 544, the bus bridge 543 may be coupled to other devices such as a keyboard/mouse 545, the network interface device 530 discussed with reference to
In various embodiments of the invention, the operations discussed herein, e.g., with reference to
Additionally, such tangible computer-readable media may be downloaded as a computer program product, wherein the program may be transferred from a remote computer (e.g., a server) to a requesting computer (e.g., a client) by way of data signals embodied in tangible propagation medium via a communication link (e.g., a bus, a modem, or a network connection).
Thus, although embodiments of the invention have been described in language specific to structural features and/or methodological acts, it is to be understood that claimed subject matter may not be limited to the specific features or acts described. Rather, the specific features and acts are disclosed as sample forms of implementing the claimed subject matter.
Filing Document | Filing Date | Country | Kind | 371c Date |
---|---|---|---|---|
PCT/RU09/00727 | 12/25/2009 | WO | 00 | 6/13/2012 |