[vectorIntrinsics+mask] RFR: 8266287: Basic mask IR implementation for the Vector API masking feature support [v3]
Xiaohong Gong
xgong at openjdk.java.net
Wed Jun 23 02:08:52 UTC 2021
On Tue, 22 Jun 2021 09:43:07 GMT, Jatin Bhateja <jbhateja at openjdk.org> wrote:
>> Hi @XiaohongGong ,
>>
>> I made following changes in unbox and box creation routines and did not find any crashes as reported in any of VectorAPI jtreg over AVX-512 platform.
>>
>>
>> diff --git a/src/hotspot/share/opto/vectorIntrinsics.cpp b/src/hotspot/share/opto/vectorIntrinsics.cpp
>> index 21e238afb5b..76553c9f2c9 100644
>> --- a/src/hotspot/share/opto/vectorIntrinsics.cpp
>> +++ b/src/hotspot/share/opto/vectorIntrinsics.cpp
>> @@ -81,7 +81,7 @@ Node* GraphKit::box_vector(Node* vector, const TypeInstPtr* vbox_type, BasicType
>> Node* ret = gvn().transform(new ProjNode(alloc, TypeFunc::Parms));
>>
>> assert(check_vbox(vbox_type), "");
>> - const TypeVect* vt = TypeVect::make(elem_bt, num_elem, is_vector_mask(vbox_type->klass()));
>> + const TypeVect* vt = TypeVect::make(elem_bt, num_elem);
>> VectorBoxNode* vbox = new VectorBoxNode(C, ret, vector, vbox_type, vt);
>> return gvn().transform(vbox);
>> }
>> @@ -96,7 +96,7 @@ Node* GraphKit::unbox_vector(Node* v, const TypeInstPtr* vbox_type, BasicType el
>> return NULL; // no nulls are allowed
>> }
>> assert(check_vbox(vbox_type), "");
>> - const TypeVect* vt = TypeVect::make(elem_bt, num_elem, is_vector_mask(vbox_type->klass()));
>> + const TypeVect* vt = TypeVect::make(elem_bt, num_elem);
>> Node* unbox = gvn().transform(new VectorUnboxNode(C, vt, v, merged_memory(), shuffle_to_vector));
>> return unbox;
>> }
>>
>> Can you kindly share a exact re-producer.
>
> Box/Unbox are macro nodes which encapsulates value, in this case the mask value is contained either in a a vector or a predicate register. This should ideally not be disturbing the box's vector type() I think.
Did you implement the vector mask IRs with `TypeVectMask` type in backend? I made a workaround to make sure the tests can pass with this patch but without any backend implementation for AVX-512/SVE. Please see the change in `type.cpp`:
const TypeVect *TypeVect::makemask(const Type* elem, uint length) {
if (Matcher::has_predicated_vectors() &&
// TODO: remove this condition once the backend is supported.
// Workround to make tests pass on AVX-512/SVE when predicate is not supported.
// Could be removed once the backend is supported.
Matcher::match_rule_supported_vector_masked(Op_StoreVectorMasked, MaxVectorSize, T_BOOLEAN)) {
const TypeVect* mtype = Matcher::predicate_reg_type(elem, length);
return (TypeVect*)(const_cast<TypeVect*>(mtype))->hashcons();
} else {
The `TypeVectMask` can only be made successfully when the backend has implemented masked `Op_StoreVectorMasked`. This is just a workaround that would be removed once the AVX-512 add the backend implementation for all mask/masked IRs.
-------------
PR: https://git.openjdk.java.net/panama-vector/pull/78
More information about the panama-dev
mailing list