[vectorIntrinsics+mask] RFR: 8266287: Basic mask IR implementation for the Vector API masking feature support [v4]

Jatin Bhateja jbhateja at openjdk.java.net
Tue Jun 29 10:10:28 UTC 2021


On Thu, 24 Jun 2021 02:29:11 GMT, Xiaohong Gong <xgong at openjdk.org> wrote:

>> 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
>
>> 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
> 
> I think the main issues that I met are related to `VectorUnboxNode` while not `VectorBoxNode`.  BTW, the bottom type of `VectorBoxNode` is the box type while not the vector type. I'm sorry that I cannot see the influence whether the vector type is a `TypeVect` or `TypeVectMask` for it. Could you please kindly elaborate more about this? 
> 
> From my side, setting the `TypeVect` to `VectorBoxNode` might be ok, but how about the `VectorUnboxNode` ? I think they should keep the same with each other?

I agree with you on this. It seems that as long as both vector_type of VectorBoxNode and type of VectorUnboxNode comply it should not lead to any issue. 
May be one can directly pass the type of the vector being boxed instead of creating a new type during box creation.


diff --git a/src/hotspot/share/opto/vectorIntrinsics.cpp b/src/hotspot/share/opto/vectorIntrinsics.cpp
index 940e87b97ad..d1d0e6f5f24 100644
--- a/src/hotspot/share/opto/vectorIntrinsics.cpp
+++ b/src/hotspot/share/opto/vectorIntrinsics.cpp
@@ -73,8 +73,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);
-  VectorBoxNode* vbox = new VectorBoxNode(C, ret, vector, vbox_type, vt);
+  VectorBoxNode* vbox = new VectorBoxNode(C, ret, vector, vbox_type, vector->bottom_type()->is_vect());
   return gvn().transform(vbox);
 }

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

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


More information about the panama-dev mailing list