Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.arch > #32420

Re: SMT ("Hyperthreading") experience in Skylake

From anton@mips.complang.tuwien.ac.at (Anton Ertl)
Newsgroups comp.arch
Subject Re: SMT ("Hyperthreading") experience in Skylake
Date 2016-01-02 13:44 +0000
Organization Institut fuer Computersprachen, Technische Universitaet Wien
Message-ID <2016Jan2.144452@mips.complang.tuwien.ac.at> (permalink)
References <2015Dec28.095749@mips.complang.tuwien.ac.at> <46faf5ed-6dec-4c8a-b126-f517594d2284@googlegroups.com> <a9110c63-9435-41a8-8ebf-867b7834e6db@googlegroups.com> <fb49bad5-e7b4-415a-bcc0-301227d11671@googlegroups.com>

Show all headers | View raw


MitchAlsup <MitchAlsup@aol.com> writes:
>On Tuesday, December 29, 2015 at 7:17:15 PM UTC-6, Quadibloc wrote:
>> On Tuesday, December 29, 2015 at 4:58:43 PM UTC-7, MitchAlsup wrote:
>> > On Monday, December 28, 2015 at 3:09:36 AM UTC-6, Anton Ertl wrote:
>> > 
>> > > So for this benchmark, SMT buys only a factor 1.12 
>> > 
>> > I am continually amazed that anyone thinks that hyperthreading buys 
>> > much at all, or can buy much, or ever will. The fact is that memory
>> > is the bottleneck, not the CPU.
>> 
>> Yes, memory is a horrible bottleneck.
>> 
>> But there's this thing called "cache", which apparently works quite well.
>> 
>> And multithreading helps make effective use of pipelined processors. Unlike 
>> out-of-order execution, if you've *got* another thread available, it's just 
>> about guaranteed to provide additional throughput.
>
>Multi-threading also makes the cache effectively smaller for each thread, 
>and dramatically increase the conflicts for each cache line. This makes 
>the cache miss penalty go way up, and significantly reduces the utility
>of multi-threading.

Ok, to address the various speculations on the performance issues I
have played around a little with performance monitoring counters and
with disabling various cores/threads.  In particular, I enabled either
two cores or one core with two threads, and disabled everything else.
I ran two of these latex runs in parallel, so they would make use of
both cores or both threads, and collected performance counter numbers
for one execution (no averaging across runs, but the variations in the
numbers were not too large).  I needed three runs to get all the
counter results (there are only 4 freely programmable counters
available), and I ran them as follows:

while true; do perf stat -e cycles -e instructions -e r04c4 -e r04c5 -e r82d0 latex bench >/dev/null; done
while true; do perf stat -e instructions -e r81d0 -e r01d1 -e r08d1 -e r02d1 latex bench >/dev/null; done
while true; do perf stat -e instructions -e r10d1 -e r04d1 -e r20d1 latex bench >/dev/null; done

(You may wonder why I am using the raw event numbers rather than the
named events; the linux-4.2 version of perf that I am using apparently
does not know that much about the Skylake yet.)

Here are the results:

2 cores       1core 2threads  event
 868M750k967  1526M150k379    cycles          
1949M558k752  1949M705k920    instructions    
 402M397k933   402M422k201    r04c4 all branches retired     
   4M226k552     4M560k550    r04c5 all branches mispredicted          
 389M988k743   390M015k254    r82d0 all stores retired              
 609M795k749   609M820k645    r81d0 all loads retired                  
 599M789k726   590M869k670    r01d1 load retired l1 hit                
   5M708k401    11M998k206    r08d1 load retired l1 miss               
   4M822k206     9M739k656    r02d1 load retired l2 hit             
     897k646     2M315k712    r10d1 load retired l2 miss               
     884k132     2M299k580    r04d1 load retired l3 hit                
      12k898        16k628    r20d1 load retired l3 miss            

Looking at the small number of L3 misses, memory is obviously not the
bottleneck for this benchmark.  This is also reflected in 2 cores
being faster than 2 threads (if memory was the bottleneck, it would
restrict two cores as much as it would restrict 2 threads), and 4
instances running as fast on 4 cores as the 2 cores result above, and
8 instances running as fast on 4 cores as the 2 threads result above
(if memory was the bottleneck, each run would slow down by a factor of
2 for 4 instances and by a factor of 4 for 8 instances).

L1 and L2 cache misses go up by a factor 2-3 with SMT, but for this
benchmark the hit rates are still good, with only 2% D-cache load
misses (0.6% per instruction) with SMT, and 0.12% L2 load misses per
instruction with SMT, so this explains only a small part of the cycles
with SMT.

L3 misses are miniscule, but also seem to rise with SMT, which is
surprising, because the L3 is shared between the cores, not just
between threads, and so should not be affected by cores vs. threads; I
would have to run the thing again to be sure that this is not just a
result of variations between runs.

Another speculation was that the core ran into store or load issue
limitations when SMT was enabled.  Given that a core can do 1
store/cycle, and actually needed only 0.45 stores/cycle in the 2 cores
variant, store issue limitations should not have a big effect on the
2-threads variant of this benchmark.  Likewise for loads with the CPU
being able to do 2 loads/cycle, and actually performing only 0.7
loads/cycle.

Instruction issue in general is a slightly bigger limitation: It can
do 4/cycles (well, depending on where you count, also 5 or 6 or so),
and actually does 2.24instructions per cycle in the 2 cores setup, so
doubling that would certainly run into limits.  But this does not
explain the almost doubling of the run-time of a single with the 2
threads benchmark, either.

Looking a branch prediction, it is good and apparently not affected by
SMT in this case (might be different if the two threads run different
workloads; or is there a per-thread branch predictor?).  So that does
not explain the results, either.

Given the almost-doubling of the number of cycles from SMT, I expect
that there is a bottleneck somewhere, but it certainly has not shown
up in these numbers.

- anton
-- 
M. Anton Ertl                    Some things have to be seen to be believed
anton@mips.complang.tuwien.ac.at Most things have to be believed to be seen
http://www.complang.tuwien.ac.at/anton/home.html

Back to comp.arch | Previous | Next — Previous in thread | Find similar | Unroll thread


Thread

SMT ("Hyperthreading") experience in Skylake anton@mips.complang.tuwien.ac.at (Anton Ertl) - 2015-12-28 08:57 +0000
  Re: SMT ("Hyperthreading") experience in Skylake Quadibloc <jsavard@ecn.ab.ca> - 2015-12-28 07:40 -0800
    Re: SMT ("Hyperthreading") experience in Skylake Quadibloc <jsavard@ecn.ab.ca> - 2015-12-28 07:44 -0800
    Re: SMT ("Hyperthreading") experience in Skylake Melzzzzz <mel@zzzzz.com> - 2015-12-28 16:54 +0100
      Re: SMT ("Hyperthreading") experience in Skylake "Rick C. Hodgin" <rick.c.hodgin@gmail.com> - 2015-12-28 08:04 -0800
    Re: SMT ("Hyperthreading") experience in Skylake Robert Wessel <robertwessel2@yahoo.com> - 2015-12-28 13:44 -0600
    Re: SMT ("Hyperthreading") experience in Skylake anton@mips.complang.tuwien.ac.at (Anton Ertl) - 2016-01-02 14:33 +0000
  Re: SMT ("Hyperthreading") experience in Skylake "Paul A. Clayton" <paaronclayton@gmail.com> - 2015-12-28 07:44 -0800
    Re: SMT ("Hyperthreading") experience in Skylake Stephen Sprunk <stephen@sprunk.org> - 2015-12-28 11:19 -0600
      Re: SMT ("Hyperthreading") experience in Skylake "Paul A. Clayton" <paaronclayton@gmail.com> - 2015-12-28 11:09 -0800
        Re: SMT ("Hyperthreading") experience in Skylake EricP <ThatWouldBeTelling@thevillage.com> - 2015-12-28 15:09 -0500
          Re: SMT ("Hyperthreading") experience in Skylake "Paul A. Clayton" <paaronclayton@gmail.com> - 2015-12-28 19:23 -0800
            Re: SMT ("Hyperthreading") experience in Skylake EricP <ThatWouldBeTelling@thevillage.com> - 2015-12-29 14:21 -0500
    Re: SMT ("Hyperthreading") experience in Skylake anton@mips.complang.tuwien.ac.at (Anton Ertl) - 2016-01-02 14:43 +0000
      Re: SMT ("Hyperthreading") experience in Skylake Stephen Fuld <SFuld@alumni.cmu.edu.invalid> - 2016-01-02 09:32 -0800
        Re: SMT ("Hyperthreading") experience in Skylake anton@mips.complang.tuwien.ac.at (Anton Ertl) - 2016-01-02 18:45 +0000
  Re: SMT ("Hyperthreading") experience in Skylake MitchAlsup <MitchAlsup@aol.com> - 2015-12-29 15:58 -0800
    Re: SMT ("Hyperthreading") experience in Skylake Quadibloc <jsavard@ecn.ab.ca> - 2015-12-29 17:17 -0800
      Re: SMT ("Hyperthreading") experience in Skylake Ivan Godard <ivan@millcomputing.com> - 2015-12-29 17:56 -0800
        Re: SMT ("Hyperthreading") experience in Skylake Quadibloc <jsavard@ecn.ab.ca> - 2015-12-29 20:06 -0800
          Re: SMT ("Hyperthreading") experience in Skylake Ivan Godard <ivan@millcomputing.com> - 2015-12-29 22:03 -0800
            Re: SMT ("Hyperthreading") experience in Skylake "Paul A. Clayton" <paaronclayton@gmail.com> - 2015-12-30 10:26 -0800
              Re: SMT ("Hyperthreading") experience in Skylake Quadibloc <jsavard@ecn.ab.ca> - 2015-12-30 11:49 -0800
          Re: SMT ("Hyperthreading") experience in Skylake Stephen Sprunk <stephen@sprunk.org> - 2016-01-02 12:21 -0600
        Re: SMT ("Hyperthreading") experience in Skylake Robert Wessel <robertwessel2@yahoo.com> - 2015-12-29 23:47 -0600
        Re: SMT ("Hyperthreading") experience in Skylake Bruce Hoult <bruce.hoult@gmail.com> - 2016-01-01 10:54 -0800
      Re: SMT ("Hyperthreading") experience in Skylake MitchAlsup <MitchAlsup@aol.com> - 2015-12-30 09:15 -0800
        Re: SMT ("Hyperthreading") experience in Skylake Quadibloc <jsavard@ecn.ab.ca> - 2015-12-30 09:58 -0800
        Re: SMT ("Hyperthreading") experience in Skylake anton@mips.complang.tuwien.ac.at (Anton Ertl) - 2016-01-02 13:44 +0000

csiph-web