[vector] Unary/Ternary ops

Paul Sandoz paul.sandoz at oracle.com
Wed Feb 14 19:03:15 UTC 2018


I suggest we create explicit functions, kind of like what you have done, but without varargs, be explicit in the arity (that’s what i did for the Java implementation for the scalar functions).

VectorUnaryOp 
VectorUnaryMaskOp 
VectorBinaryOp 
VectorBinaryMaskOp 
VectorTernaryOp 
VectorTernaryMaskOp 
VectorBinaryTest // returns boolean 

(Being a little verbose in the names does not matter so much as they will only appear in the interface declarations and VectorIntrinsic method signatures).

I would like to ensure we avoid boxing and packing into arrays to be more efficient for the cases where an intrinsic is not supported (what we are referring to as graceful degradation).

We could do all that as a follow on patch.

Paul.

> On Feb 14, 2018, at 10:47 AM, Al K <someusername3 at gmail.com> wrote:
> 
> Any idea what the interfaces for masked variants would look like? I
> imagine we'd have to create additional functional interfaces for each
> op to accept mask argument as well (f.e. unop would be a binop with
> 1 vector 1 mask, binop would be ternop with 2 vectors 1 mask, etc.).
> Would it be better to just have 2 functional interfaces, f.e.,
> 
> interface VecOperator<V> {
>     V apply(V... xn);
> }
> 
> interface VecMaskOperator<V, M> {
>     V apply(M mask, V... xn);
> }
> 
> Something like that work?
> 
> Cheers,
> Al
> 
> On Wed, Feb 14, 2018 at 12:26 PM, Paul Sandoz <paul.sandoz at oracle.com <mailto:paul.sandoz at oracle.com>> wrote:
> 
> 
> > On Feb 14, 2018, at 10:12 AM, Al K <someusername3 at gmail.com <mailto:someusername3 at gmail.com>> wrote:
> >
> > Oops, wrong patch link, see
> > http://cr.openjdk.java.net/~vlivanov/panama/al_miftah/vector_ops/webrev.00/index.html <http://cr.openjdk.java.net/~vlivanov/panama/al_miftah/vector_ops/webrev.00/index.html>
> >
> 
> One comment:
> 
> - For fma I recommend creating a package private TriFunction rather than packing into an array, then i think the additional casts will be redundant.
> 
> Thanks,
> Paul.
> 
> > On Wed, Feb 14, 2018 at 11:54 AM, Al K <someusername3 at gmail.com <mailto:someusername3 at gmail.com>> wrote:
> >
> >> http://cr.openjdk.java.net/~vlivanov/panama/vector.generalized_intrinsics/webrev.06/ <http://cr.openjdk.java.net/~vlivanov/panama/vector.generalized_intrinsics/webrev.06/>
> >>
> >>
> >> This extends the generalized intrinsics changeset with the following:
> >>
> >> 1. General ternary ops - currently only fma
> >>
> >> 2. General unary ops - abs/neg/sqrt
> >>
> >>
> >> I've replaced the previous inline_vector_binary_operation() in opto/library_call
> >>
> >> with a generic inline_vector_nary_operation() to avoid writing specialized impls
> >>
> >> for the various n-ary ops.
> >>
> >>
> >> There's also a change in os/linux/os_linux to fix the pointer comparison so clang
> >>
> >> would stop complaining.
> >>
> >>
> >> I've signed the OCA, awaiting for it to be reflected on the site.
> >>
> >>
> >> Cheers,
> >>
> >> Al
> >>
> >>
> 
> 



More information about the panama-dev mailing list