RFR: 8340093: C2 SuperWord: implement cost model [v4]

Emanuel Peter epeter at openjdk.org
Thu Nov 6 07:59:06 UTC 2025


On Wed, 5 Nov 2025 17:27:43 GMT, Quan Anh Mai <qamai at openjdk.org> wrote:

>> Emanuel Peter has updated the pull request incrementally with one additional commit since the last revision:
>> 
>>   rename cost methods for Vladimir K
>
> src/hotspot/share/opto/vectorization.cpp line 604:
> 
>> 602: // If needed, we could also use platform specific costs, if the
>> 603: // default here is not accurate enough.
>> 604: float VLoopAnalyzer::cost_for_scalar_node(int opcode) const {
> 
> You need a `BasicType` parameter for this method, some opcodes are used for multiple kinds of operands.

Will add it :)

> src/hotspot/share/opto/vectorization.cpp line 618:
> 
>> 616: // default here is not accurate enough.
>> 617: float VLoopAnalyzer::cost_for_vector_node(int opcode, int vlen, BasicType bt) const {
>> 618:   float c = 1;
> 
> We have `Matcher::vector_op_pre_select_sz_estimate`, could it be used here? The corresponding for scalar is `Matcher::scalar_op_pre_select_sz_estimate`

Same answer as above :)

> src/hotspot/share/opto/vtransform.cpp line 201:
> 
>> 199: // in_loop: vtn->_idx -> bool
>> 200: void VTransformGraph::mark_vtnodes_in_loop(VectorSet& in_loop) const {
>> 201:   assert(is_scheduled(), "must already be scheduled");
> 
> May I ask if this schedule has already moved unordered reductions like addition out of the loop yet?

`optimize` happens before `schedule`. But the unordered reduction is still in the `VTransformGraph`, and so it is also scheduled. But `mark_vtnodes_in_loop` will find that the unordered reduction is outside the loop :)

Does that answer your question?

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

PR Review Comment: https://git.openjdk.org/jdk/pull/27803#discussion_r2497884992
PR Review Comment: https://git.openjdk.org/jdk/pull/27803#discussion_r2497872764
PR Review Comment: https://git.openjdk.org/jdk/pull/27803#discussion_r2497881539


More information about the hotspot-compiler-dev mailing list