[vectorIntrinsics+mask] RFR: 8266287: Basic mask IR implementation for the Vector API masking feature support [v2]
Xiaohong Gong
xgong at openjdk.java.net
Mon Jun 21 09:56:42 UTC 2021
On Mon, 24 May 2021 07:56:38 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
>
> Xiaohong Gong has updated the pull request with a new target base due to a merge or a rebase. The pull request now contains three commits:
>
> - Use "Flag_is_predicated_vector" for masked vector nodes
> - Merge branch 'vectorIntrinsics+mask'
> - 8266287: Basic mask IR implementation for the Vector API masking feature support
Hi there, the new commit refines the C2 compiler IRs for vector mask. The main idea is trying to use the same nodes but with
different types (i.e. use `"TypeVectMask"` for SVE/AVX-512, while `"TypeVect"` for others). It doesn't need to create new IRs specially for SVE/AVX-512 predicate type. The `"idea_reg"` is decided by the type of the node, so that the compiler can choose the right register for vector mask during codegen.
For more details, the following existed IRs are kept to use normally:
- fromArray: LoadVector + VectorLoadMask
- compare: VectorMaskCmp
- others: VectorMaskCast
And to spearate the IRs for vector and vector mask, the following mask IRs are added:
- maskAll: MaskAll
- and/or/xor: AndVMask/OrVMask/XorVMask
Further more, to improve the performance of vector mask loading/storing with SVE, the following transformations are also kept:
- fromArray:
LoadVector + VectorLoadMask ==> LoadVectorMask
- intoArray:
VectorStoreMask + StoreVector ==> StoreVectorMask
Any feedback is welcome! Thanks so much!
Best Regards,
Xiaohong
-------------
PR: https://git.openjdk.java.net/panama-vector/pull/78
More information about the panama-dev
mailing list