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

Vladimir Ivanov vlivanov at openjdk.java.net
Fri May 14 16:22:47 UTC 2021

On Thu, 6 May 2021 10:12:08 GMT, Xiaohong Gong <xgong at openjdk.org> wrote:

> Based on [1], this patch adds the C2 compiler mid-end changes for the masking feature support. It mainly contains:
>  1) Generation of the mask IRs for vector mask, including:
>     - Mask generations, e.g. load/compare/maskAll
>     - Mask operations, e.g. and/or/xor
>  2) Conversions between vector and mask after loading mask values from memory and before storing mask values into memory
>  3) Generation of the vector IRs which need the mask value as the control
>     - The mask value is appended to the original vector node's input list
> With this change, the bottom type of the vector mask will be set to `"TypeVectMask"` if the platform supports the masking feature and the backend implementations are added.
> Note that this patch only contains the compiler mid-end changes. The backend implementations for SVE/AVX-512 will be in the
> followed-up patches.
> [1] https://github.com/openjdk/panama-vector/pull/57

Can you elaborate, please, what's the purpose of new nodes? 

There's some duplication with existing vector nodes and I'd like to understand how do you intend to merge them.

`LoadVectorMask`/`StoreVectorMask` duplicate `VectorLoadMask (LoadVector)`/`StoreVector (VectorStoreMask)`. What kind of benefits do you expect from exposing the operation as a single node?

Depending on how `MaskToVector`/`VectorToMask` are specified, they can duplicate  `VectorStoreMask`/`VectorLoadMask`.

If mask value always has a vector type,`AndVMask`/`OrVMask`/`XorVMask` can be replaced by `AndV`/`OrV`/`XorV` and special implementations for 2 representations (canonical and native). Same considerations apply to `VectorCmpMaskGen` (compared to `VectorMaskCmp`).

What is left is `MaskAll`, but its purpose is not evident to me. Broadcast, but for masks?


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

More information about the panama-dev mailing list