- 
                Notifications
    
You must be signed in to change notification settings  - Fork 6.1k
 
8317572: C2 SuperWord: refactor/improve TraceSuperWord, replace VectorizeDebugOption with TraceAutoVectorization #17586
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
Conversation
| 
          
 👋 Welcome back epeter! A progress list of the required criteria for merging this PR into   | 
    
| _vector_loop_debug = phase->C->directive()->VectorizeDebugOption; | ||
| } | ||
| 
               | 
          ||
| #endif | 
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.
Note: initialization now happens via _vtrace field, and is constructed implicitly.
| } | ||
| } | ||
| #endif | ||
| 
               | 
          
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 was only printed if _do_vector_loop was on, i.e. if OptionVectorize enabled (kinda odd anyway).
And we already do print_bb, which prints all relevant nodes (enabled with SW_INFO or TraceSuperWord).
| _nlist.at(j)->dump(); | ||
| } | ||
| } | ||
| #endif | 
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.
We already print the mem slice in mem_slice_preds.
| uint vlen = p->size(); | ||
| uint vlen_in_bytes = 0; | ||
| Node* vn = nullptr; | ||
| NOT_PRODUCT(if(is_trace_cmov()) {tty->print_cr("VPointer::output: %d executed first, %d executed last in pack", first->_idx, n->_idx); print_pack(p);}) | 
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 was behind the wrong flag is_trace_cmov, and I think it was never used anyway.
| _nstack(nstack), _analyze_only(analyze_only), _stack_idx(0) | ||
| #ifndef PRODUCT | ||
| , _tracer((phase->C->directive()->VectorizeDebugOption & 2) > 0) | ||
| , _tracer(phase->C->directive()->traceautovectorization_tags().at(TraceAutoVectorizationTag::POINTER_ANALYSIS)) | 
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 now do the ugly thing. Later, with the bigger refactoring, I will pass VLoop into the VPointer, and then we can access the flag via VPointer -> VLoop -> VTrace.
| } | ||
| }; | ||
| #endif | ||
| 
               | 
          
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.
The idea is that this is going to be a "component" of VLoop, once I do the bigger refactoring.
          
Webrevs
  | 
    
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.
Generally looks good! I have some comments.
| // Return a memory slice (node list) in predecessor order starting at "start" | ||
| void SuperWord::mem_slice_preds(Node* start, Node* stop, GrowableArray<Node*> &preds) { | ||
| assert(preds.length() == 0, "start empty"); | ||
| Node* n = start; | 
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.
There is still a usage of TraceSuperWord on L927. Should this also be replaced?
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.
It will be removed with #17585 anyway ;)
Co-authored-by: Christian Hagedorn <christian.hagedorn@oracle.com>
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.
It is good. Two comments.
| jio_snprintf(errorbuf, buf_size, "Unrecognized intrinsic detected in %s: %s", option2name(option), validator.what()); | ||
| } | ||
| } | ||
| #ifndef PRODUCT | 
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.
Missing #ifdef COMPILER2 for this and PrintIdealPhase.
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.
done!
| if (!valid) { | ||
| error(VALUE_ERROR, "Unrecognized intrinsic detected in DisableIntrinsic: %s", validator.what()); | ||
| } | ||
| } else if (strncmp(option_key->name, "TraceAutoVectorization", 22) == 0) { | 
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.
Missing #ifndef PRODUCT and #ifdef COMPILER2 for this and for PrintIdealPhase.
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.
done
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.
Looks good.
| 
           @eme64 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 4 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   | 
    
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.
Looks good, thanks for the updates!
| #ifndef SHARE_OPTO_TRACE_AUTO_VECTORIZATION_TAG_HPP | ||
| #define SHARE_OPTO_TRACE_AUTO_VECTORIZATION_TAG_HPP | 
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 think for this define, you should keep SHARE_OPTO_TRACEAUTOVECTORIZATIONTAG_HPP to follow the convention of other files where we do not insert underlines in the filename.
| 
           @chhagedorn @vnkozlov thanks for the reviews and helpful suggestions!  | 
    
| 
          
 Going to push as commit 3066d49. 
 Your commit was automatically rebased without conflicts.  | 
    
Subtask of #16620
I got approval to remove VectorizeDebugOption: JDK-8320668
I want a more general flag for AutoVectorization, that can trace different components of AutoVectorization.
It should be a CompileCommand, so that it can select which methods it traces for.
TraceSuperWord should still look similar, and select a subset of the TraceAutoVectorization components (those for SuperWord), but still apply to all classes/methods.
With more refactoring later in JDK-8315361, this flag should become more usable and interpretable. Especially, the idea is that different components of the
VLoop / VLoopAnalyzercan have tracing enabled / disabled.How to use the flag:
Get "help", i.e. see all available tags:
./java -Xcomp -XX:CompileCommand=TraceAutoVectorization,*::*,help --versionSee "rejections" (i.e. failures where we don't vectorize) and successes (using TraceNewVectors):
./java -Xcomp -XX:CompileCommand=TraceAutoVectorization,*::*,SW_REJECTIONS -XX:+TraceNewVectors --versionThe results are currently underwhealming. I will have to track many more failures, and I will do that with the bigger refactoring, when I move around the code and require error code returning everywhere, and then I can use that error code for printing.
Progress
Issue
Reviewers
Reviewing
Using
gitCheckout this PR locally:
$ git fetch https://git.openjdk.org/jdk.git pull/17586/head:pull/17586$ git checkout pull/17586Update a local copy of the PR:
$ git checkout pull/17586$ git pull https://git.openjdk.org/jdk.git pull/17586/headUsing Skara CLI tools
Checkout this PR locally:
$ git pr checkout 17586View PR using the GUI difftool:
$ git pr show -t 17586Using diff file
Download this PR as a diff file:
https://git.openjdk.org/jdk/pull/17586.diff
Webrev
Link to Webrev Comment