[lworld+fp16] RFR: 8338102: x86 backend support for newly added Float16 intrinsics.

Bhavana Kilambi bkilambi at openjdk.org
Fri Aug 9 11:39:45 UTC 2024


On Fri, 9 Aug 2024 10:35:31 GMT, Jatin Bhateja <jbhateja at openjdk.org> wrote:

> This patch enables newly added Float16 intrinsicfication support added by [JDK-8336406](https://bugs.openjdk.org/browse/JDK-8336406) for x86 targets supporting AVX512_FP16 feature.
> 
> Kindly review and approve.
> 
> Best Regards,
> Jatin
> 
> Hi @Bhavana-Kilambi, 
> On a second thought, do you see a possibility of sharing the IR nodes by appending secondary opcode to shared IR node in applicable scenarios, so we can have one IR for each class of operations (unary / binary / secondary).  It may need defining following new matcher routines and some more interfaces:- 
> 
>    match_rule_supported_shared(int primary_opcode, int secondary_opcode)
>    match_rule_supported_vector_shared (int primary_opcode, int secondary_opcode, int vlen, BasicType bt)
>    VectorNode::opcode(int popc, int sopc, BasicType bt)
> 
> BinaryOpNode (Dst, Src1, Src2, immI_Opcode);   
> 
> 
> Secondary opcode being a immediate operand can be accessed by encoding routines. WDYT ?
> 
> Another possibility could be to encode both primary and secondary opcodes in existing opcode without disturbing the interfaces and add relevant helper routines to extract primary / secondary opcodes, I think opcodes are never -ve values, hence secondary opcode could be accommodated into higher order bits starting from (MSB-1).

test/hotspot/jtreg/compiler/vectorization/TestFloat16VectorOps.java line 64:

> 62:         applyIfCPUFeature = {"avx512_fp16", "true"})
> 63:     @IR(counts = {IRNode.ADD_VHF, ">= 1"},
> 64:         applyIfCPUFeatureOr = {"avx512_fp16", "true", "sve", "true"})

For add operation, avx512_fp16 feature check is already in place.

test/hotspot/jtreg/compiler/vectorization/TestFloat16VectorOps.java line 86:

> 84:     @Warmup(10000)
> 85:     @IR(counts = {IRNode.SUB_VHF, ">= 1"},
> 86:         applyIfCPUFeature = {"avx512_fp16", "true"})

This rule can be merged with the next rule for sve - 
`applyIfCPUFeatureOr = {"avx512_fp16", "true", "sve", "true"}`. Same for other operations below.

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

PR Review Comment: https://git.openjdk.org/valhalla/pull/1196#discussion_r1711305388
PR Review Comment: https://git.openjdk.org/valhalla/pull/1196#discussion_r1711306982


More information about the valhalla-dev mailing list