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


Groups > linux.kernel > #1330083

RE: [PATCH v3 net-next] net: Implement fast csum_partial for x86_64

From David Laight <David.Laight@ACULAB.COM>
Newsgroups linux.kernel
Subject RE: [PATCH v3 net-next] net: Implement fast csum_partial for x86_64
Date 2016-02-09 12:00 +0100
Message-ID <r0ebw-2Tw-31@gated-at.bofh.it> (permalink)
References <r00rT-1Mq-5@gated-at.bofh.it>
Organization linux.* mail to news gateway

Show all headers | View raw


From: George Spelvin [mailto:linux@horizon.com]
> Sent: 08 February 2016 20:13
> David Laight wrote:
> > I'd need convincing that unrolling the loop like that gives any significant gain.
> > You have a dependency chain on the carry flag so have delays between the 'adcq'
> > instructions (these may be more significant than the memory reads from l1 cache).
> 
> If the carry chain is a bottleneck, on Broadwell+ (feature flag
> X86_FEATURE_ADX), there are the ADCX and ADOX instructions, which use
> separate flag bits for their carry chains and so can be interleaved.
> 
> I don't have such a machine to test on, but if someone who does
> would like to do a little benchmarking, that would be an interesting
> data point.
> 
> Unfortunately, that means yet another version of the main loop,
> but if there's a significant benefit...

Well, the only part actually worth writing in assembler is the 'adc' loop.
So run-time substitution of separate versions (as is done for memcpy())
wouldn't be hard.

Since adcx and adox must execute in parallel I clearly need to re-remember
how dependencies against the flags register work. I'm sure I remember
issues with 'false dependencies' against the flags.

However you still need a loop construct that doesn't modify 'o' or 'c'.
Using leal, jcxz, jmp might work.
(Unless broadwell actually has a fast 'loop' instruction.)

(I've not got a suitable test cpu.)

	David

Back to linux.kernel | Previous | NextPrevious in thread | Next in thread | Find similar | Unroll thread


Thread

Re: [PATCH v3 net-next] net: Implement fast csum_partial for x86_64 "George Spelvin" <linux@horizon.com> - 2016-02-08 21:20 +0100
  RE: [PATCH v3 net-next] net: Implement fast csum_partial for x86_64 David Laight <David.Laight@ACULAB.COM> - 2016-02-09 12:00 +0100
    RE: [PATCH v3 net-next] net: Implement fast csum_partial for x86_64 "George Spelvin" <linux@horizon.com> - 2016-02-10 02:00 +0100
      RE: [PATCH v3 net-next] net: Implement fast csum_partial for x86_64 David Laight <David.Laight@ACULAB.COM> - 2016-02-10 12:50 +0100
        RE: [PATCH v3 net-next] net: Implement fast csum_partial for x86_64 "George Spelvin" <linux@horizon.com> - 2016-02-10 15:50 +0100
          RE: [PATCH v3 net-next] net: Implement fast csum_partial for x86_64 David Laight <David.Laight@ACULAB.COM> - 2016-02-10 16:30 +0100

csiph-web