This is the mail archive of the
libc-alpha@sourceware.org
mailing list for the glibc project.
Re: [PATCH RFC] Improve 64bit memset for Corei7 with avx2 instruction
- From: OndÅej BÃlka <neleai at seznam dot cz>
- To: "H.J. Lu" <hjl dot tools at gmail dot com>
- Cc: Ling Ma <ling dot ma dot program at gmail dot com>, GNU C Library <libc-alpha at sourceware dot org>, Liubov Dmitrieva <liubov dot dmitrieva at gmail dot com>
- Date: Thu, 1 Aug 2013 17:48:40 +0200
- Subject: Re: [PATCH RFC] Improve 64bit memset for Corei7 with avx2 instruction
- References: <CAOGi=dMfjBWkFOhUh7QjBM=XiJqkP+6sEsVSHgz+=wC9z1+O=w at mail dot gmail dot com> <20130730071521 dot GA8596 at domone dot kolej dot mff dot cuni dot cz> <20130730071717 dot GA8741 at domone dot kolej dot mff dot cuni dot cz> <CAOGi=dOCH41BCXY+yN7_w4Ed4DCAHQKJMvJhKUs-pi3EkxHp=g at mail dot gmail dot com> <20130730113445 dot GA4577 at domone dot kolej dot mff dot cuni dot cz> <CAOGi=dMPnGq_35r9TmTHkPn6oS-kbjb=eFmFWQL+N9DBMreu-A at mail dot gmail dot com> <CAMe9rOoi3sdGhg4fpKVnq-O4hqgMTz=PvjYN3ZiL0Zfjig8knw at mail dot gmail dot com>
On Thu, Aug 01, 2013 at 08:32:36AM -0700, H.J. Lu wrote:
> On Tue, Jul 30, 2013 at 5:38 AM, Ling Ma <ling.ma.program@gmail.com> wrote:
> > 2013/7/30, OndÅej BÃlka <neleai@seznam.cz>:
> >> On Tue, Jul 30, 2013 at 05:26:09PM +0800, Ling Ma wrote:
> >>> We never find prefetcht1 is good instruction to pre-fetch data on
> >>> core2, nehalem, sandybridge, and haswell. Our experiments show
> >>> prefetchw is best in your cases.
> >>
>
And
> There is no need to test prefetchw on Haswll since it isn't
> supported. I think this is a rare case where prefetcht0 helps.
>
This was testcase about prefetch being harmul. A benchmark code was:
memset2(ary+4096-512+(4096*((unsigned)rand_r(&seed)))%SIZE,0,512);
We memset only last 512 bytes in pages. With prefetching also first 512
bytes from pages will be fetched. This will double cache usage and
degrade performance.
Of course when prefetchw is not supported it will help.
>
> --
> H.J.