RFR: 8317572: C2 SuperWord: refactor/improve TraceSuperWord, replace VectorizeDebugOption with TraceAutoVectorization

Emanuel Peter epeter at openjdk.org
Fri Jan 26 13:34:52 UTC 2024


On Fri, 26 Jan 2024 12:49:50 GMT, Emanuel Peter <epeter at openjdk.org> wrote:

> Subtask of https://github.com/openjdk/jdk/pull/16620
> 
> I got approval to remove VectorizeDebugOption: [JDK-8320668](https://bugs.openjdk.org/browse/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](https://bugs.openjdk.org/browse/JDK-8315361), this flag should become more usable and interpretable.
> 
> How to use the flag:
> TODO

src/hotspot/share/opto/superword.cpp line 83:

> 81:   }
> 82: 
> 83: #endif

Note: initialization now happens via `_vtrace` field, and is constructed implicitly.

src/hotspot/share/opto/superword.cpp line 539:

> 537:   }
> 538: #endif
> 539: 

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`).

src/hotspot/share/opto/superword.cpp line 873:

> 871:       }
> 872:     }
> 873: #endif

We already print the mem slice in `mem_slice_preds`.

src/hotspot/share/opto/superword.cpp line 2421:

> 2419:       uint vlen_in_bytes = 0;
> 2420:       Node* vn = nullptr;
> 2421:       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);})

This was behind the wrong flag `is_trace_cmov`, and I think it was never used anyway.

src/hotspot/share/opto/vectorization.cpp line 49:

> 47:   _nstack(nstack), _analyze_only(analyze_only), _stack_idx(0)
> 48: #ifndef PRODUCT
> 49:   , _tracer(phase->C->directive()->traceautovectorization_tags().at(TraceAutoVectorizationTag::POINTER_ANALYSIS))

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`.

src/hotspot/share/opto/vectorization.hpp line 50:

> 48: };
> 49: #endif
> 50: 

The idea is that this is going to be a "component" of VLoop, once I do the bigger refactoring.

-------------

PR Review Comment: https://git.openjdk.org/jdk/pull/17586#discussion_r1467641637
PR Review Comment: https://git.openjdk.org/jdk/pull/17586#discussion_r1467644151
PR Review Comment: https://git.openjdk.org/jdk/pull/17586#discussion_r1467644620
PR Review Comment: https://git.openjdk.org/jdk/pull/17586#discussion_r1467646109
PR Review Comment: https://git.openjdk.org/jdk/pull/17586#discussion_r1467647587
PR Review Comment: https://git.openjdk.org/jdk/pull/17586#discussion_r1467648209


More information about the hotspot-compiler-dev mailing list