[vectorIntrinsics+fp16] RFR: 8302454: Improve VectorAPI fallback implementation for FP16 operations.
Jatin Bhateja
jbhateja at openjdk.org
Mon Feb 27 11:52:47 UTC 2023
On Thu, 16 Feb 2023 05:03:53 GMT, Swati Sharma <duke at openjdk.org> wrote:
> Hi All,
>
> The patch contains the below changes:
> - Remove redundant Halffloat object creation and rebase existing implementation using Float.float16ToFloat and floatToFloat16 APIs.
> - Enable all the vector API tests for FP16 operations.
>
> Please review and provide your feedback.
>
> Thanks,
> Swati
test/jdk/jdk/incubator/vector/templates/Unit-Miscellaneous.template line 249:
> 247: }
> 248: #if[Halffloat]
> 249: // assertBroadcastLongArraysEquals(r, a, b, mask, $vectorteststype$::blend);
Assertion needs to be uncommented.
test/jdk/jdk/incubator/vector/templates/Unit-Miscellaneous.template line 632:
> 630: #else[Halffloat]
> 631: VectorSpecies species = vsh.withLanes($type$.class);
> 632: #end[Halffloat]
You can save adding special handling in template by introducing a new template-variable
test/jdk/jdk/incubator/vector/templates/Unit-header.template line 1063:
> 1061: withToString("Halffloat[i * 5]", (int s) -> {
> 1062: return fill(s * BUFFER_REPS,
> 1063: i -> Halffloat.valueOf(i * 5));
You can move the specialization part of lambda into a separate routine, it will prevent replicating the GENERATOR code.
test/jdk/jdk/incubator/vector/templates/Unit-header.template line 1139:
> 1137: withToString("Halffloat[i + 1]", (int s) -> {
> 1138: return fill(s * BUFFER_REPS,
> 1139: i -> ((($type$)(i + 1) == 0) ? Halffloat.valueOf(1) : Halffloat.valueOf(i + 1)));
Code replication can be saved by moving specialization into a new routine
test/jdk/jdk/incubator/vector/templates/X-LoadStoreTest.java.template line 251:
> 249: for (int i = 0; i < a.length; i++) {
> 250: #if[Halffloat]
> 251: ms.set(ValueLayout.JAVA_SHORT, i * SPECIES.elementSize() / 8 , a[i]);
Try removing conditions as suggested above.
-------------
PR: https://git.openjdk.org/panama-vector/pull/211
More information about the panama-dev
mailing list