gather latency

By: Travis Downs (, June 19, 2019 12:15 pm
Room: Moderated Discussions
Why is Intel gather latency so damn high on x86?

On Intel chips the latency depends only on the number of loaded elements, not their width or the address width[1] and on SKL 2, 4 or 8 elements the latency is 18, 20 and 22 cycles respectively.

On SKX, the latency dropped by a cycle and you also have 16 element gathers, and the latency is 17, 19, 21 and 25 respectively.

All of these take 1 load uop per element, plus ~3 other ops total for p015, probably to merge the results.

It looks like the latency differences between the various element counts is mostly explained by the additional load uops: starting 8 extra loads takes 4 cycles, so 21 + 4 = 25. Same for 4 vs 8 elements (2 vs 4 is off by a cycle though, not all that weird).

So there is some kind of baseline latency of 17-18 cycles for any gather, in addition to the time to issue all the load uops. What could cause that?

On Zen, the latency is similar (actually a couple cycles better in many cases), but the throughput is terrible: similar to the latency. Gathers use up to 65 uops there, so it's a crummy implementation but at least everything makes sense: latency is that long because the total amount of work to do is huge and you are limited by execution throughput to chew through dozens of uops.


[1] That is, the QQ DQ and QD forms for a given vector size load the same number of elements and have the same latency. Similarly the QQ form for ymm registers loads 4 elements just like the DD form for xmm regs, and they have the same latency.
 Next Post in Thread >
TopicPosted ByDate
gather latencyTravis Downs2019/06/19 12:15 PM
  gather throughputMichael S2019/06/19 12:55 PM
    gather throughputEric Bron2019/06/19 01:59 PM
      gather throughputMichael S2019/06/19 11:57 PM
        gather throughputEric Bron2019/06/20 01:11 AM
    gather throughputTravis Downs2019/06/19 04:47 PM
      gather throughputMichael S2019/06/20 01:37 AM
  gather latencyLinus Torvalds2019/06/19 05:02 PM
    gather latencyTravis Downs2019/06/19 06:31 PM
      gather latencyanon2019/06/20 02:48 AM
        gather latencyTravis Downs2019/06/20 08:07 AM
          gather latencyanon2019/06/20 09:34 AM
            gather latencyTravis Downs2019/06/20 12:25 PM
              gather latencyanon2019/06/20 01:05 PM
                gather latencyTravis Downs2019/06/20 04:27 PM
                  gather latencyanon2019/06/21 12:31 AM
                    gather latencyMichael S2019/06/21 01:37 AM
                      gather latencyanon2019/06/21 03:20 AM
                        gather latencyMichael S2019/06/21 03:24 AM
                          gather latencyanon2019/06/21 03:48 AM
                            gather latencyTravis Downs2019/06/21 07:10 AM
                              gather latencyanon2019/06/21 07:50 AM
                                gather latencyMichael S2019/06/21 08:21 AM
                                  gather latencyanon2019/06/21 08:58 AM
                                gather latencyTravis Downs2019/06/21 08:39 AM
                                  gather latencyanon2019/06/21 09:16 AM
                                    gather latencyTravis Downs2019/06/21 10:51 AM
                                      gather latencyanon2019/06/21 12:38 PM
                                        gather latencyTravis Downs2019/06/21 12:53 PM
                                          gather latencyanon2019/06/21 01:44 PM
                                            You could be right, I am not sure (NT)Travis Downs2019/06/21 01:46 PM
                gather latencyTravis Downs2019/06/20 05:34 PM
                  gather latencyMichael S2019/06/21 01:45 AM
                    gather latencyTravis Downs2019/06/21 08:04 AM
Reply to this Topic
Body: No Text
How do you spell purple?