RFR: 8338126 : C2 SuperWord: VectorCastF2HF / vcvtps2ph produces wrong results for vector length 2 [v2]

Jatin Bhateja jbhateja at openjdk.org
Tue Oct 15 08:20:24 UTC 2024


On Mon, 14 Oct 2024 23:35:43 GMT, Sandhya Viswanathan <sviswanathan at openjdk.org> wrote:

>> When Float.floatToFloat16 is vectorized using a 2-element vector width due to dependencies, we incorrectly generate a 4-element vcvtps2ph with memory as destination storing 8 bytes instead of desired 4 bytes.  This issue is fixed in this PR by limiting the memory version of match rule to 4-element vector and above.
>> Also a regression test case is added accordingly.
>> 
>> Best Regards,
>> Sandhya
>
> Sandhya Viswanathan has updated the pull request incrementally with one additional commit since the last revision:
> 
>   Update test case

src/hotspot/cpu/x86/x86.ad line 3679:

> 3677: 
> 3678: instruct vconvF2HF_mem_reg(memory mem, vec src) %{
> 3679:   predicate(Matcher::vector_length_in_bytes(n->in(3)->in(1)) >= 16);

You can add an eligant prediction check like following instead of accesing bare inputs.

n->as_StoreVector()->memory_size() >= 16.

test/hotspot/jtreg/compiler/vectorization/TestFloatConversionsVector.java line 110:

> 108:         }
> 109: 
> 110:         // Verifying the result

Since we are using IR framework, we can leverage existing[ @Check](https://github.com/openjdk/jdk/blob/521effe017b9b6322036f1851220056a637d6b1c/test/hotspot/jtreg/compiler/lib/ir_framework/Check.java#L32) annotation for verification which works in conjunction with @Test method, it will automatically invoke validation after test method execution. We may need little refactoring for this.

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

PR Review Comment: https://git.openjdk.org/jdk/pull/21480#discussion_r1800662857
PR Review Comment: https://git.openjdk.org/jdk/pull/21480#discussion_r1800673072


More information about the hotspot-compiler-dev mailing list