[vector] binary operations with a scalar
Viswanathan, Sandhya
sandhya.viswanathan at intel.com
Sat Feb 17 16:10:47 UTC 2018
Agree, and it is the binaryOpInt that the JIT would need to look into intrinsifying by expanding into two IR nodes.
Thanks,
Sandhya
-----Original Message-----
From: Paul Sandoz [mailto:paul.sandoz at oracle.com]
Sent: Friday, February 16, 2018 5:58 PM
To: Viswanathan, Sandhya <sandhya.viswanathan at intel.com>
Cc: panama-dev at openjdk.java.net
Subject: Re: [vector] binary operations with a scalar
I am hoping it's possible to push the intrinsic down into VectorIntrinsics, for example:
VectorIntrinsics:
—
@HotSpotIntrinsicCandidate
static <S extends Vector.Shape>
IntVector<S> binaryOpInt(int oprId, Class<? extends IntVector<S>> vectorClass, Class<?> elementType, int vlen,
IntVector<S> v1, int s2, /*Vector.Mask<E,S> m,*/
BiFunction<IntVector<S>,IntVector<S>,IntVector<S>> defaultImpl) {
return binaryOp(oprId, vectorClass, elementType, vlen,
v1, v1.species().broadcast(s2), defaultImpl);
}
Int256Vector
—
@Override
@ForceInline
public Int256Vector add(int o) {
return (Int256Vector) VectorIntrinsics.binaryOpInt(
VECTOR_OP_ADD, Int256Vector.class, int.class, LENGTH,
this, o,
(v1, v2) -> ((Int256Vector)v1).bOp(v2, (i, a, b) -> (int)(a + b))); }
that leaves the broadcast for the non-intrinsic case, and it’s possible to clean that up later on with a more specialized function.
Paul.
> On Feb 16, 2018, at 5:30 PM, Viswanathan, Sandhya <sandhya.viswanathan at intel.com> wrote:
>
>
> Thanks for adding these. The "species" field access would result in boxing, so generalized intrinsic will have to be at v.add(int) level, possibly leading to expansion to two IR nodes: broadcast followed by operation. By doing expansion at IR level, the broadcast will then be moved out of loop by existing compiler optimizations.
>
> It will be very interesting to get Vladimir's thought on this.
>
> Best Regards,
> Sandhya
>
More information about the panama-dev
mailing list