User:Bjacob/ArithmeticTimingDifferences: Difference between revisions

Jump to navigation Jump to search
Line 157: Line 157:


It is also reported that some early Pentium 4 CPUs were in the same case. Conversely, not ''all'' Pentium M's are affected (here is an [http://people.mozilla.org/~bjacob/ta/results/intel-pentium-m-1.6GHz-family-6-model-13-stepping-6-dell-inspiron600m-gavin/ unaffected one]).
It is also reported that some early Pentium 4 CPUs were in the same case. Conversely, not ''all'' Pentium M's are affected (here is an [http://people.mozilla.org/~bjacob/ta/results/intel-pentium-m-1.6GHz-family-6-model-13-stepping-6-dell-inspiron600m-gavin/ unaffected one]).
=== Some CPUs have surprising timing differences on 64-bit integer arithmetic using 32-bit integer arithmetic instructions, when DAZ is enabled ===
On x86-32, our int64 subtraction benchmark compiles to this assembly:
  movl (%ebx), %eax
  movl 4(%ebx), %edx
  movl 8(%ebx), %esi
  movl 12(%ebx), %edi
  subl %esi, %eax
  sbbl %edi, %edx
  movl %eax, 16(%ebx)
  movl %edx, 20(%ebx)
On [http://people.mozilla.org/~bjacob/ta/results/intel-pentium-4-3.2GHz-family-15-model-3-stepping-3-tycho/ one Pentium 4 CPU] that we used, this does not quite run in constant time, with timing differences of up to 25% and above 3 sigma from the overall median; and the weirdest part is that this only happens when DAZ is enabled! This is of course particularly surprising as DAZ is not supposed to have any relevance to integer arithmetic.
Here are the results with DAZ, showing slower-than-normal operation when the right hand side of the subtraction is INT64_MIN, with the slowest case being INT64_MIN - INT64_MIN:
* [http://people.mozilla.org/~bjacob/ta/results/intel-pentium-4-3.2GHz-family-15-model-3-stepping-3-tycho/time-math-x86-32-sse2-DAZ.txt With DAZ only;]
* [http://people.mozilla.org/~bjacob/ta/results/intel-pentium-4-3.2GHz-family-15-model-3-stepping-3-tycho/time-math-x86-32-sse2-DAZ-FTZ.txt With DAZ and FTZ.]
On the other hand, here are the results without DAZ, showing no such timing difference with INT64_MIN operands:
* [http://people.mozilla.org/~bjacob/ta/results/intel-pentium-4-3.2GHz-family-15-model-3-stepping-3-tycho/time-math-x86-32-sse2.txt Without DAZ or FTZ;]
* [http://people.mozilla.org/~bjacob/ta/results/intel-pentium-4-3.2GHz-family-15-model-3-stepping-3-tycho/time-math-x86-32-sse2-FTZ.txt With FTZ only.]
It is worth noting that this only happens on that particular Pentium 4 CPU (family 15 model 3) and not on other Netburst-based CPUs that we tested.
Confirmed users
753

edits

Navigation menu