-
Notifications
You must be signed in to change notification settings - Fork 5.6k
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
8309697: [TESTBUG] Remove "@requires vm.flagless" from jtreg vectorization tests #15011
Conversation
…ation tests This patch removes `@require vm.flagless` annotations from HotSpot jtreg tests in `compiler/vectorization/runner`. All jtreg cases in this folder are invoked by test driver `VectorizationTestRunner.java` which checks both correctness and vectorizability (IR) for each test method. We added flagless requirement before because extra flags may mess with compiler control in the test driver for correctness check. But `flagless` has a side effect that it makes tests with extra flags skipped. So we propose to get rid of it now. To adapt the removal of `@require vm.flagless`, a few checks are added in the test driver to skip the correctness check if extra flags make the compiler control not work. This patch also moves previously hard-coded flag `-XX:-OptimizeFill` in the test driver to conditions in IR checks. Tested various of compiler control related VM flags on x86 and AArch64.
👋 Welcome back pli! A progress list of the required criteria for merging this PR into |
Webrevs
|
boolean use_intp = WB.getBooleanVMFlag("UseInterpreter"); | ||
boolean use_comp = WB.getBooleanVMFlag("UseCompiler"); | ||
boolean bg_comp = WB.getBooleanVMFlag("BackgroundCompilation"); | ||
if (use_intp && use_comp && bg_comp) { |
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.
Why you check BackgroundCompilation
?
For -Xcomp
you need only check UseInterpreter
.
Xor -Xint
you need only check UseCompiler
.
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.
For -Xbatch
we need check BackgroundCompilation
. As we lock the compilation before running the test method in the interpreter to get reference result, the VM will hang if both background compilation is disabled and the compilation is locked by WhiteBox.
I just experimented an alternative approach that running reference result with C1 execution instead of interpretation. In this way we can run with background compilation off. What do you think of this new approach?
fail("Method is not compiled after " + COMP_THRES_SECONDS + "s."); | ||
// C2 compilation may timeout with extra compiler control options. | ||
// We skip the correctness check in this case. | ||
System.out.println("WARNING: Correctness check is skipped because C2 compilation times out"); | ||
return; |
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.
Why not run with BackgroundCompilation
OFF? The code will return from WHITE_BOX.enqueueMethodForCompilation()
only after finishing compiling or compiler skip.
Compilation speed is very different on different platform. Using time for check is not reliable.
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.
Why not run with BackgroundCompilation OFF?
I just explained the reason in my another reply above. Using time for check is to avoid jtreg timeout with extra VM options like -XX:CompileThreshold=100 -XX:-TieredCompilation
. But I think this can also be avoided if we get reference result from C1 execution. What do you think of the new approach?
|
Hi @TobiHartmann ,
I just tried this on multiple x86 machines we have but didn't reproduce the failure. Could you share more info (cpu features, etc.) of your test machine so I can find why the test method is not vectorized. |
The test has Byte multiply operation but it checks only presence of SSE2:
I am not sure how your testing passed. |
Hi @vnkozlov , I re-worked the correctness check in my latest commit. This time we get reference results from C1 execution so we can allow "-Xbatch" and remove the time-based check now. But we have to add another check of tiered compilation for C1 execution. The failed case is also fixed in my latest commit. Could you help re-review? |
Thank you for addressing the test issue. About your change to allow -Xbatch. Let me clarify, if you exclude
You don't need to call Note, this work with and without BackgroundCompilation enabled. If you called a method once it will be executed in Interpreter if |
Hi @vnkozlov , Thanks for your reply. But it still has problems.
These tests are a bit different because we test loops. If the loop iteration count reaches some threshold, the loop will be OSR compiled even test method is called only once. I just did an experiment according to your suggestion. After removing
A solution to this may be adding one more check of Now the question is, which verification approach do you think is better? "C2 vs. interpreted" or "C2 vs. C1"? |
I would suggest to use
We usually use Interpreter as gold standard. |
Hi @vnkozlov , Thanks for your comments. I have reverted the patch to my 1st commit and re-addressed your comments.
In my new commit, I choose to set and restore |
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 looks good.
@pfustc This change now passes all automated pre-integration checks. ℹ️ This project also has non-automated pre-integration requirements. Please see the file CONTRIBUTING.md for details. After integration, the commit message for the final commit will be:
You can use pull request commands such as /summary, /contributor and /issue to adjust it as needed. At the time when this comment was updated there had been 8 new commits pushed to the
Please see this link for an up-to-date comparison between the source branch of this pull request and the ➡️ To integrate this PR with the above commit message to the |
@vnkozlov @TobiHartmann we should re-run testing from our side. @pfustc Why do you only test correctness (compare results) in some conditions? Is there not a risk that we miss doing it in some cases we should do it, just because we get the conditions slightly wrong? Just FYI: we should integrate this whole correctness of results testing into the IR framework. I filed JDK-8310533. That would make it easier to use for new tests. It could also be used for any test, not just the ones located in |
Hi @eme64 , Thanks for looking at this.
Yes, you are right! These conditions are added before to avoid jtreg hanging when compilation is locked. But now I can remove them because the lock is removed. In my latest commit, I have removed the conditions and some useless imports.
I have noticed this JBS before. The reason I didn't added correctness check into the IR framework is that I implemented this kind of check before the IR framework exists. (We have used it internally for a few years.) But anyway, it is a good proposal and I'm willing to help if needed. |
@pfustc This looks good to me, thanks for making these changes. It will really increase the coverage. |
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 am fine with update.
All tests passed (@eme64). |
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.
Thanks @TobiHartmann .
-> approved
@pfustc Since you are working on IR tests here, it would be good if you first merge the changes from JDK-8310308, and test the IR rules again. |
Thanks @vnkozlov @TobiHartmann @eme64 for your review. Patch is currently merged with latest master and re-tested. I will integrate this if there's no further comment. |
I will also give this another spin in our testing. |
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.
Testing looked good!
/integrate |
Going to push as commit a03954e.
Your commit was automatically rebased without conflicts. |
This patch removes
@require vm.flagless
annotations from HotSpot jtreg tests incompiler/vectorization/runner
. All jtreg cases in this folder are invoked by test driverVectorizationTestRunner.java
which checks both correctness and vectorizability (IR) for each test method. We added flagless requirement before because extra flags may mess with compiler control in the test driver for correctness check. Butflagless
has a side effect that it makes tests with extra flags skipped. So we propose to get rid of it now.To adapt the removal of
@require vm.flagless
, a few checks are added in the test driver to skip the correctness check if extra flags make the compiler control not work. This patch also moves previously hard-coded flag-XX:-OptimizeFill
in the test driver to conditions in IR checks.Tested various of compiler control related VM flags on x86 and AArch64.
Progress
Issue
Reviewers
Reviewing
Using
git
Checkout this PR locally:
$ git fetch https://git.openjdk.org/jdk.git pull/15011/head:pull/15011
$ git checkout pull/15011
Update a local copy of the PR:
$ git checkout pull/15011
$ git pull https://git.openjdk.org/jdk.git pull/15011/head
Using Skara CLI tools
Checkout this PR locally:
$ git pr checkout 15011
View PR using the GUI difftool:
$ git pr show -t 15011
Using diff file
Download this PR as a diff file:
https://git.openjdk.org/jdk/pull/15011.diff
Webrev
Link to Webrev Comment