[vectorIntrinsics+mask] RFR: 8268154: Add masking support for vector load intrinsics

Xiaohong Gong xgong at openjdk.java.net
Thu Jun 10 02:08:33 UTC 2021


On Wed, 9 Jun 2021 12:07:08 GMT, Jatin Bhateja <jbhateja at openjdk.org> wrote:

> Currently there following assertion check in both LoadVectorMaskedNode and StoreVectorMaskedNode
> 
> `assert(mask->bottom_type()->is_vectmask(), "sanity");`
> 
> This should be relaxed since mask argument will be VectorUnboxNode until macro expansion.
> 
> I added following static routine in VectorNode class to get over it in my local sandbox, and adjusted the assertion to use it. If suitable maybe we can integrate it in this patch.
> 
> ```
> bool VectorNode::is_vector_mask(Node* n) {
>   if (n->bottom_type()->is_vectmask()) {
>     return true;
>   }
>   if (n->Opcode() == Op_VectorUnbox) {
>     const TypeInstPtr* vector_klass_from = n->as_VectorUnbox()->obj()->bottom_type()->isa_instptr();
>     ciKlass* vbox_klass_from = vector_klass_from->const_oop()->as_instance()->java_lang_Class_klass();
>     return vbox_klass_from->is_subclass_of(ciEnv::current()->vector_VectorMask_klass());
>   }
>   return false;
> }
> ```

Thanks so for your suggestion @jatin-bhateja ! This looks ok to me. So that I can also revert the type changes to VectorBox/VectorUnbox in PR https://github.com/openjdk/panama-vector/pull/78.

> src/hotspot/share/opto/vectorIntrinsics.cpp line 956:
> 
>> 954:   bool use_predicate = Matcher::has_predicated_vectors() &&
>> 955:                        arch_supports_vector(sopc, num_elem, elem_bt, VecMaskUseLoad) &&
>> 956:                        Matcher::match_rule_supported_vector_masked(sopc, num_elem, elem_bt);
> 
> Can we push both  Matcher::has_predicated_vectors() && Matcher::match_rule_supported_vector_masked() into arch_supports_vector and either add an explicit bool argument to it or a new enum value to be passed i.e. VecMaskUseLoad | VecPredOper  under which these checks are enforced.

Good idea! Will do this later. Thanks so much!

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

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


More information about the panama-dev mailing list