[PATCH] benchtests: Add memset zero fill benchmark tests

naohirot@fujitsu.com naohirot@fujitsu.com
Tue Jul 20 08:51:16 GMT 2021


Hi Lucas, Wilco, Noah,

> From: Tamura, Naohiro/田村 直広 <naohirot@fujitsu.com>
> Sent: Thursday, July 15, 2021 5:16 PM

> > [1] https://travisdowns.github.io/blog/2020/05/13/intel-zero-opt.html
> 
> I throughly read the blog, it's very interesting.
> It seems that Skylake-S microarchitcture has some zero-over-zero
> optimization in the size range of L3 and RAM.
> 
> So why don't we proceed like this?
> - create a new benchtest file, ex. memset-zerofill.c.
>   it measures zero-over-zero and zero-over-one from 32KB(L1), through
>   L2 and L3, to 64MB(RAM)
> - create a script to extract some part of data such as zero-over-zero
>   or zero-over-one from JSON bench result to CSV in the first place in
>   order to create graph in spreadsheet
> - update benchtests/scripts/plot_strings.py later so that it can draw
>   zero-over-zero and zero-over-one separately

Here is a result of the memset zero fill patch v2 [1] using the source code A64FX memset patch v2 [2].

The first graph [3] is the zero-over-zero result by typing the command:

$ cat bench-memset-zerofill.out | jq -r '.functions.memset."bench-variant"="zerofill-0o0" | del(.functions.memset.results[] | select(.char1 != 0))' | plot_strings.py -l -p thru -v -

The second graph [4] is the zero-over-one result by typing the command:

$ cat bench-memset-zerofill.out | jq -r '.functions.memset."bench-variant"="zerofill-0o1" | del(.functions.memset.results[] | select(.char1 != 1))' | plot_strings.py -l -p thru -v -

In case of zero-over-zero, it's very interesting that memset_generic is faster than memset_a64fx.
On the other hand, however, in case of zero-over-one, memset_a64fx is faster is faster than memset_generic.
It may be due to SVE code.
Comparing the memset_generic performance, that is non SVE code, between zero-over-zero and zero-over-one, 
it seems that a64fx micro-architecture has some zero-over-zero optimization?.

[1] https://sourceware.org/pipermail/libc-alpha/2021-July/129290.html
[2] https://sourceware.org/pipermail/libc-alpha/2021-July/128857.html
[3] https://drive.google.com/file/d/1iNlp-srAq-p9fr7PuRh62TRj-V2eJi0U/view?usp=sharing
[4] https://drive.google.com/file/d/1UipGRHUWU8WJ1-EbV6YzoTcOtxtOhAy0/view?usp=sharing

Thanks.
Naohiro



More information about the Libc-alpha mailing list