[vectorIntrinsics+mask] RFR: 8266287: Basic mask IR implementation for the Vector API masking feature support [v3]
Jatin Bhateja
jbhateja at openjdk.java.net
Wed Jun 23 12:57:57 UTC 2021
On Wed, 23 Jun 2021 02:08:57 GMT, Xiaohong Gong <xgong at openjdk.org> wrote:
>> 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.
>
> From the crash log, I guess the issue happens for a `PhiNode` with vector masks as its values. Assume one of its value is a `VectorUnboxNode` with `TypeVect` while others are mask nodes with `TypeVectMask`, then the crash can happen when the compiler try to decide the final type of the `PhiNode`. Please correct me if I misunderstand it. Thanks!
Hi @XiaohongGong,
There could be a problem during scalarize_vbox_node if vector type of mask VectorBoxNode is made as TypeVectMask
https://github.com/jatin-bhateja/panama-vector/blob/628dc716b3f171e1b7b62fd1ec452a3d14a04af9/src/hotspot/share/opto/vector.cpp#L212
There is an ideal transformation which re-associates the Phi node having all its inputs as VectorBoxes of same type.
https://github.com/openjdk/panama-vector/blob/vectorIntrinsics%2Bmask/src/hotspot/share/opto/cfgnode.cpp#L2413
This can lead to a situation where PhiNode is created with TypeVect and inputs are of TypeVectMask, as a workaround I added another transformation which adjusts to bottom type of PhiNode to match with the bottom type of its inputs (TypeVectMask). This change is in my local repo having other masking changes.
https://github.com/jatin-bhateja/panama-vector/blob/JDK-8262356_vectorIntrinsics%2Bmask/src/hotspot/share/opto/cfgnode.cpp#L2433
-------------
PR: https://git.openjdk.java.net/panama-vector/pull/78
More information about the panama-dev
mailing list