RFR: 8378312: [VectorAPI] libraryUnaryOp/libraryBinaryOp failed to intrinsify
Paul Sandoz
psandoz at openjdk.org
Fri Feb 20 17:54:06 UTC 2026
On Fri, 20 Feb 2026 05:30:00 GMT, Yasumasa Suenaga <ysuenaga at openjdk.org> wrote:
> I ran following code with `-Djdk.incubator.vector.DEBUG=true`, however it was not intrinsified.
>
>
> public static void cos(){
> var rand = new Random();
> for(int i = 0; i < 1_000_000; i++){
> var vec = DoubleVector.fromArray(DoubleVector.SPECIES_256, rand.doubles().limit(4).toArray(), 0);
>
> vec.lanewise(VectorOperators.COS);
> }
> }
>
>
> I knew `__jsvml_cos4_ha_l9()` in libjsvml.so should be called in this case (via vector debug log), but it was not hitted even though I set breakpoint in it.
>
> `LaneType` has been introduced in [JDK-8376187](https://bugs.openjdk.org/browse/JDK-8376187), and `LibraryCallKit::inline_vector_call()` was updated to handle lane type rather than class of element type. However `VectorMathLibrary` wasn't modified.
>
> I confirmed `__jsvml_cos4_ha_l9()` is called with this fix, and also all jdk/jdk/incubator/vector jtreg tests passed on Linux AMD64.
Thank you for catching this. We need an IR test, could you investigate if that is possible? Perhaps pick one unary op and one binary op to test.
src/jdk.incubator.vector/share/classes/jdk/incubator/vector/VectorMathLibrary.java line 295:
> 293: @SuppressWarnings({"unchecked"})
> 294: Class<V> vt = (Class<V>)vspecies.vectorType();
> 295: AbstractSpecies<E> asp = (AbstractSpecies<E>)vspecies;
Instead change method signature to use `AbstractSpecies<E>` (from `VectorSpecies<E>`) and at the call site change the argument to be result of `vspecies()` (from `species()`).
-------------
PR Review: https://git.openjdk.org/jdk/pull/29835#pullrequestreview-3833423836
PR Review Comment: https://git.openjdk.org/jdk/pull/29835#discussion_r2834400678
More information about the core-libs-dev
mailing list