-
Notifications
You must be signed in to change notification settings - Fork 6.2k
8365290: [perf] x86 ArrayFill intrinsic generates SPLIT_STORE for unaligned arrays #26747
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: master
Are you sure you want to change the base?
Conversation
👋 Welcome back vaivanov! A progress list of the required criteria for merging this PR into |
❗ This change is not yet ready to be integrated. |
@IvaVladimir The following label will be automatically applied to this pull request:
When this pull request is ready to be reviewed, an "RFR" email will be sent to the corresponding mailing list. If you would like to change these labels, use the /label pull request command. |
Webrevs
|
@IvaVladimir Thanks for looking into this. It would be good to make this intrinsic (via OptimizeFill) available by default for ECore platforms by making the following change in vm_versions_x86.cpp:
|
// align 'big' arrays to 64 bytes (cache line size) to minimize split_stores | ||
cmpptr(count, 256<<shift); | ||
jcc(Assembler::below, L_fill_32_bytes); | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I see you have an overhead for small sizes, may be we could do a check for small sizes before line 5885 something like below:
movdl(xtmp, value);
vpbroadcastd(xtmp, xtmp, Assembler::AVX_256bit);
subptr(count, 16 << shift);
jcc(Assembler::less, L_check_fill_32_bytes);
Or alternatively move the entire if (EnableX86ECoreOpts) { } block of code to line 5933 adjusting the jump labels accordingly.
cmpptr(count, 256<<shift); | ||
jcc(Assembler::below, L_fill_32_bytes); | ||
|
||
BIND(L_align_64_bytes); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Need to add an align(16) before BIND(L_align_64_bytes);
Later alignment improve performance a little bit. Current numbers are: |
movl(Address(to, 0), value); | ||
addptr(to, 4); | ||
subptr(count, 1<<shift); | ||
jmpb(L_align_64_bytes); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This should be a conditional jump.
On the SRF platform for runs with intrinsic scores for the ArrayFill test reports ~2x drop for several sizes due to a lot of the 'MEM_UOPS_RETIRED.SPLIT_STORES' events. The 'good' case for the ArraysFill.testCharFill with size=8195 reports numbers like
MEM_UOPS_RETIRED.SPLIT_LOADS | 22.6711
MEM_UOPS_RETIRED.SPLIT_STORES | 4.0859
while for 'bad' case these metrics are
MEM_UOPS_RETIRED.SPLIT_LOADS | 69.1785
MEM_UOPS_RETIRED.SPLIT_STORES | 259200.3659
With alignment on the cache size no score drops due to split_stores but small reduction may be reported due to extra
Progress
Issue
Reviewing
Using
git
Checkout this PR locally:
$ git fetch https://git.openjdk.org/jdk.git pull/26747/head:pull/26747
$ git checkout pull/26747
Update a local copy of the PR:
$ git checkout pull/26747
$ git pull https://git.openjdk.org/jdk.git pull/26747/head
Using Skara CLI tools
Checkout this PR locally:
$ git pr checkout 26747
View PR using the GUI difftool:
$ git pr show -t 26747
Using diff file
Download this PR as a diff file:
https://git.openjdk.org/jdk/pull/26747.diff
Using Webrev
Link to Webrev Comment