Draft JEP: Vector API (original) (raw)

Frank Yuan frank.yuan at oracle.com
Tue Apr 10 04:04:42 UTC 2018


Hi Sandhya

I read the JEP bug, and have 2 comments.

The first one is about the stream style example code. Suppose Vector API is used for math computation, the code should likely express the math concept, and look like the math formula.

For example: void scalarComputation(float[] a, float[] b, float[] c) { for (int i = 0; i < a.length; i++) { c[i] = (a[i] * a[i] + b[i] * b[i]) * -1.0f; } }

The proposed Vector API code is like: Vector vc = va. mul(va). add(vb.mul(vb)). neg();

It's far away from the math expression: - ( va * va + vb * vb )

I would like the following code more: Vector vc = neg( add(mul(va, va), mul(vb, vb)));

The second comment is that the users should not like to handle the details on the vector size, they only desire the vector computation power! We should wrap all these details, provide a high level abstract for the vector in terms of the math concept, do the loop in our private code and pad the tail. User just say "I want vector a subtract vector b", then we give him a result.

Thanks Frank

-----Original Message----- From: jdk-dev [mailto:jdk-dev-bounces at openjdk.java.net] On Behalf Of Viswanathan, Sandhya Subject: Draft JEP: Vector API

This draft JEP contains a proposal to provide an incubating module to express vector computations in Java that reliably compiles at runtime to optimal vector hardware instructions on supported CPU architectures and thus achieve superior performance than equivalent scalar computations. For more details, please see: https://bugs.openjdk.java.net/browse/JDK-8201271 Best Regards, Sandhya



More information about the jdk-dev mailing list