8388193: [lworld] C2's ClearArray keeps zero fill value alive in register#2641
8388193: [lworld] C2's ClearArray keeps zero fill value alive in register#2641TobiHartmann wants to merge 2 commits into
Conversation
|
👋 Welcome back thartmann! A progress list of the required criteria for merging this PR into |
|
❗ This change is not yet ready to be integrated. |
chhagedorn
left a comment
There was a problem hiding this comment.
The fix looks good, thanks! And good clean-ups, I have some small comments following up on that.
|
|
||
| // clear memory of size 'cnt' qwords, starting at 'base' using XMM/YMM/ZMM registers | ||
| // Fill memory with 'val', for 'cnt' qwords starting at 'base', using XMM/YMM/ZMM registers. | ||
| void MacroAssembler::xmm_clear_mem(Register base, Register cnt, Register val, XMMRegister xtmp, KRegister mask) { |
There was a problem hiding this comment.
Should we also update xmm_clear_mem to xmm_fill_mem?
We should also do these comment updates in the header file.
| // cnt - number of qwords (8-byte words). | ||
| // base - start address, qword aligned. | ||
| Label L_zero_64_bytes, L_loop, L_sloop, L_tail, L_end; | ||
| Label L_fill_64_bytes, L_loop, L_sloop, L_tail, L_end; |
There was a problem hiding this comment.
There are still some references in the .ad file to L_zero_64_bytes that should also be updated to L_fill_64_bytes.
| $$emit$$"# L_loop:\t# 64-byte LOOP\n\t" | ||
| $$emit$$"vmovdqu ymm0,(rax)\n\t" | ||
| $$emit$$"vmovdqu ymm0,0x20(rax)\n\t" | ||
| $$emit$$"vmovdqu $tmp,(rax)\n\t" |
There was a problem hiding this comment.
There are some other hardcoded uses of ymm0, for example in rep_stos_evex(). Do they also need to be updated to $tmp?
|
Thanks for your thorough review Christian! I did another pass over all the affected code. I renamed "zero" and "clear" to "fill" where appropriate, replaced hardcoded registers in the opto assembly printing by the correct placeholders and also fixed some of the other comments. Your comments should be all addressed now. |
chhagedorn
left a comment
There was a problem hiding this comment.
Looks good, thanks for the update!
|
Thanks for the review Christian! |
Valhalla extended
ClearArrayNodewith a value input to support nonzero initialization of flattened/null-restricted arrays. Ordinary array clears still supplied aConL(0)and on x86 the matcher treated that value as an input constrained toRAX. This extended the live range causing increasing spills and a performance regression with the DaCapo23-biojava-large benchmark.The zero-fill rules now match
immL0, only useRAXas a local temporary and materialize zero inMacroAssembler::clear_memlike mainline code does. The fix also renamesword_copy_onlytorequires_word_fill, improved comments and predicates and fixes some of the outdated opto assembly printing.With this fix, we are back to baseline performance (from 47 ms/op to 35 ms/op).
Thanks,
Tobias
Progress
Issue
Reviewers
Reviewing
Using
gitCheckout this PR locally:
$ git fetch https://git.openjdk.org/valhalla.git pull/2641/head:pull/2641$ git checkout pull/2641Update a local copy of the PR:
$ git checkout pull/2641$ git pull https://git.openjdk.org/valhalla.git pull/2641/headUsing Skara CLI tools
Checkout this PR locally:
$ git pr checkout 2641View PR using the GUI difftool:
$ git pr show -t 2641Using diff file
Download this PR as a diff file:
https://git.openjdk.org/valhalla/pull/2641.diff