Intel® ISA Extensions
Use hardware-based isolation and memory encryption to provide more code protection in your solutions.

Simple question about single and double float terminology

magicfoot
Beginner
2,899 Views

On a 32 bit system, a program loop will take the same time to process a loop using double floating point arithmetic as it does with single floating point arithmetic. The double float calculations are done done in hardware, as opposed to using some sort of software emulation, as is done on most GPUs. The GPU takes more than twice as long to process  a loop of double floats than it does a single float loop.

Please exclude all thought of SSE or AVX registers or calculations for the moment.

I understand how the calculation of single(32 bit) floating point values is performed. How is it that the use of double precision values(64 bit) does not use more time on the same hardware. Must the processor ALU be based on 64 bit architecture to achieve this, despite being a 32 bit operating system ?

What hardware mechanism is used to achieve this / Does anyone have a good description ?

 

 

0 Kudos
25 Replies
Bernard
Valued Contributor I
447 Views

Actually the only "advantage" of x87 ISA is extended 80-bit precision.The question is does your code really benefit from this.

0 Kudos
Bernard
Valued Contributor I
447 Views

IIRC  _MSC_VER == 1800 even on 32-bit builds does not emit x87 code.In order to be sure I need to check the .cod file.

0 Kudos
acctpurge_a_1
Novice
447 Views

Hi Richard, you're right, and thanks for fixing my error. In 32-bit mode you can choose whether to use SSE or not, based on compiler flags. As iliyapolak points out, there isn't really a reason to use x87 anymore unless you really need the extra precision (which is unlikely). x87 is scalar only. All 64-bit CPUs have SSE2 support.

0 Kudos
McCalpinJohn
Honored Contributor III
447 Views

Another situation in which 32-bit arithmetic provides twice the performance of 64-bit arithmetic for scalar code is provided by memory-access-limited codes operating on contiguous data.  One cache line transfer provides 16 32-bit values, but only 8 64-bit values, so as long as the rate of cache line transfers is the same, the rate at which computations can be performed will be twice as fast for the 32-bit version.

The STREAM benchmark version 5.10 (http://www.cs.virginia.edu/stream/FTP/Code/stream.c) can easily be configured to use 32-bit arithmetic rather than 64-bit arithmetic -- simply add "-DSTREAM_TYPE=float" to the compiler options to override the default type of "double".  There are few recent published submissions with 32-bit arithmetic, but it is trivial to demonstrate for yourself that bandwidth in GB/s is almost the same whether using 32-bit or 64-bit data types on most recent computers, so the arithmetic rate using 32-bit data types is twice that obtained when using 64-bit data types.

0 Kudos
Bernard
Valued Contributor I
447 Views

 

One of the reason for using extended precision can be for example more precise approximation of special or trigo functions.

0 Kudos
Reply