[vectorIntrinsics+mask] RFR: 8270349: Initial X86 backend support for optimizing masking operations on AVX512 targets.

Xiaohong Gong xgong at openjdk.java.net
Mon Jul 26 10:36:19 UTC 2021


On Mon, 26 Jul 2021 10:09:13 GMT, Jatin Bhateja <jbhateja at openjdk.org> wrote:

>> src/hotspot/cpu/x86/x86.ad line 1927:
>> 
>>> 1925:         return false; // Implementation limitation
>>> 1926:       }
>>> 1927:       return true;
>> 
>> I guess the masked `VectorRearrange` is not generated currently, is it? So if AVX-512 supports the masked operations, will you add modify the API and intrinsics side for it in future?
>
> Yes, rearrange Template needs to accommodate extra mask argument, I added the backend changes in anticipation.

OK, thank you for that. Since SVE doesn't support this masked operation, we will block it in SVE's backend.

>> src/hotspot/share/opto/vectorIntrinsics.cpp line 435:
>> 
>>> 433:      }
>>> 434:   } else {
>>> 435:     const TypeVect* vt = TypeVect::make(elem_bt, num_elem, is_vector_mask(vbox_klass));
>> 
>> Are there any other nary mask operations besides the `"and/xor/or" `?
>
> andNot and eq, but they are implemented in terms of and/or/xor/not. So its more of a optimization since AVX512 have direct instructions for andNot operations on mask.

So I think this change is not needed, since the vector mask type will be created in the `VectorNode::make` method, which is currently used for `and/or/xor`.

>> src/hotspot/share/opto/vectornode.cpp line 435:
>> 
>>> 433:   switch (vopc) {
>>> 434:     case Op_AndV:
>>> 435:       if (Matcher::match_rule_supported_vector_masked(Op_AndVMask, vlen, bt)) {
>> 
>> I intended to use `match_rule_supported_vector_masked` specially for the vector operations that are controlled by a mask. Do you mean we'd better also extend it to the mask operations?
>
> VectorNode::make_mask_node is only going to be called for masked operations. I don't think AndVMask is being created for non-predicated targets.  So we can take either approach.

Ok, can the opcodes like `AndVMask` be blocked for non-predicated targets in `Matcher::match_rule_supported` ?

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

PR: https://git.openjdk.java.net/panama-vector/pull/99


More information about the panama-dev mailing list