APIdia Launch Partner
Top Description Inners Fields Constructors Methods
jdk.incubator.vector

pack-priv final Class VectorMathLibrary

extends Object
Class Inheritance
Imports
jdk.internal.vm.annotation.DontInline, .ForceInline, .Stable, jdk.internal.vm.vector.VectorSupport, java.lang.foreign.MemorySegment, .SymbolLookup, java.util.Locale, java.util.function.IntFunction

A wrapper for native vector math libraries bundled with the JDK (SVML and SLEEF). Binds vector operations to native implementations provided by the libraries.

Nested and Inner Type Summary

Modifier and TypeClass and Description
private static record
private static class
pack-priv static interface
private static class
VectorMathLibrary.SLEEF

Naming convention in SLEEF-based vector math library .

private static class
VectorMathLibrary.SVML

Naming convention in SVML vector math library.

Field Summary

Modifier and TypeField and Description
private static final VectorMathLibrary.Library
private static final VectorMathLibrary.Entry<?>[][][]
private static final SymbolLookup
private static final int

Constructor Summary

AccessConstructor and Description
pack-priv

Method Summary

Modifier and TypeMethod and Description
pack-priv static <E, V extends Vector<E>> V
binaryMathOp(VectorOperators.Binary op, int opc, AbstractSpecies<E> vspecies, IntFunction<VectorSupport.BinaryOperation<V, ?>> implSupplier, V v1, V v2)

private static <E, T> VectorMathLibrary.Entry<T>
constructEntry(VectorOperators.Operator op, int opc, VectorSpecies<E> vspecies, IntFunction<T> implSupplier)

private static <T> VectorMathLibrary.Entry<T>
lookup(VectorOperators.Operator op, int opc, VectorSpecies<?> vspecies, IntFunction<T> implSupplier)

pack-priv static <E, V extends Vector<E>> V
unaryMathOp(VectorOperators.Unary op, int opc, AbstractSpecies<E> vspecies, IntFunction<VectorSupport.UnaryOperation<V, ?>> implSupplier, V v)

Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Field Detail

LIBRARYback to summary
private static final VectorMathLibrary.Library LIBRARY
LIBRARY_ENTRIESback to summary
private static final VectorMathLibrary.Entry<?>[][][] LIBRARY_ENTRIES
Annotations
@Stable
LOOKUPback to summary
private static final SymbolLookup LOOKUP
SIZEback to summary
private static final int SIZE

Constructor Detail

VectorMathLibraryback to summary
pack-priv VectorMathLibrary()

Method Detail

binaryMathOpback to summary
pack-priv static <E, V extends Vector<E>> V binaryMathOp(VectorOperators.Binary op, int opc, AbstractSpecies<E> vspecies, IntFunction<VectorSupport.BinaryOperation<V, ?>> implSupplier, V v1, V v2)
Annotations
@ForceInline
constructEntryback to summary
private static <E, T> VectorMathLibrary.Entry<T> constructEntry(VectorOperators.Operator op, int opc, VectorSpecies<E> vspecies, IntFunction<T> implSupplier)
Annotations
@DontInline
lookupback to summary
private static <T> VectorMathLibrary.Entry<T> lookup(VectorOperators.Operator op, int opc, VectorSpecies<?> vspecies, IntFunction<T> implSupplier)
Annotations
@ForceInline
unaryMathOpback to summary
pack-priv static <E, V extends Vector<E>> V unaryMathOp(VectorOperators.Unary op, int opc, AbstractSpecies<E> vspecies, IntFunction<VectorSupport.UnaryOperation<V, ?>> implSupplier, V v)
Annotations
@ForceInline
jdk.incubator.vector back to summary

private final Record VectorMathLibrary.Entry<T>

extends Record
Class Inheritance
Record Components
name:String 
entry:MemorySegment 
impl:T 

Field Summary

Modifier and TypeField and Description
private final MemorySegment
entry

Record Component accessed by entry().

private final T
impl

Record Component accessed by impl().

private final String
name

Record Component accessed by name().

Constructor Summary

AccessConstructor and Description
private
Entry(String name, MemorySegment entry, T impl)

Method Summary

Modifier and TypeMethod and Description
public MemorySegment
entry()

Record Component getter of entry.

public final boolean
equals(Object o)

Implements abstract java.lang.Record.equals.

Indicates whether some other object is "equal to" this one.

public final int
hashCode()

Implements abstract java.lang.Record.hashCode.

Returns a hash code value for the record.

public T
impl()

Record Component getter of impl.

public String
name()

Record Component getter of name.

public final String
toString()

Implements abstract java.lang.Record.toString.

Returns a string representation of the record.

Field Detail

entryback to summary
private final MemorySegment entry

Record Component accessed by entry().

implback to summary
private final T impl

Record Component accessed by impl().

nameback to summary
private final String name

Record Component accessed by name().

Constructor Detail

Entryback to summary
private Entry(String name, MemorySegment entry, T impl)

Method Detail

entryback to summary
public MemorySegment entry()

Record Component getter of entry.

equalsback to summary
public final boolean equals(Object o)

Implements abstract java.lang.Record.equals.

Doc from java.lang.Record.equals.

Indicates whether some other object is "equal to" this one. In addition to the general contract of Object.equals, record classes must further obey the invariant that when a record instance is "copied" by passing the result of the record component accessor methods to the canonical constructor, as follows:

    R copy = new R(r.c1(), r.c2(), ..., r.cn());
then it must be the case that r.equals(copy).
hashCodeback to summary
public final int hashCode()

Implements abstract java.lang.Record.hashCode.

Doc from java.lang.Record.hashCode.

Returns a hash code value for the record. Obeys the general contract of Object.hashCode. For records, hashing behavior is constrained by the refined contract of Record.equals, so that any two records created from the same components must have the same hash code.

implback to summary
public T impl()

Record Component getter of impl.

nameback to summary
public String name()

Record Component getter of name.

toStringback to summary
public final String toString()

Implements abstract java.lang.Record.toString.

Doc from java.lang.Record.toString.

Returns a string representation of the record. In accordance with the general contract of Object#toString(), the toString method returns a string that "textually represents" this record. The result should be a concise but informative representation that is easy for a person to read.

In addition to this general contract, record classes must further participate in the invariant that any two records which are equal must produce equal strings. This invariant is necessarily relaxed in the rare case where corresponding equal component values might fail to produce equal strings for themselves.

jdk.incubator.vector back to summary

private Class VectorMathLibrary.Java

extends Object
implements Library
Class Inheritance
All Implemented Interfaces
jdk.incubator.vector.VectorMathLibrary.Library

Constructor Summary

AccessConstructor and Description
private
Java()

Method Summary

Modifier and TypeMethod and Description
public boolean
public String
Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Constructor Detail

Javaback to summary
private Java()

Method Detail

isSupportedback to summary
public boolean isSupported(VectorOperators.Operator op, VectorSpecies<?> vspecies)

Implements jdk.incubator.vector.VectorMathLibrary.Library.isSupported.

Annotations
@Override
symbolNameback to summary
public String symbolName(VectorOperators.Operator op, VectorSpecies<?> vspecies)

Implements jdk.incubator.vector.VectorMathLibrary.Library.symbolName.

Annotations
@Override
jdk.incubator.vector back to summary

pack-priv Interface VectorMathLibrary.Library

Known Direct Implementers
jdk.incubator.vector.VectorMathLibrary.Java, jdk.incubator.vector.VectorMathLibrary.SVML, jdk.incubator.vector.VectorMathLibrary.SLEEF

Field Summary

Modifier and TypeField and Description
public static final String
public static final String
public static final String

Method Summary

Modifier and TypeMethod and Description
public static String
public static VectorMathLibrary.Library
public boolean
public String

Field Detail

JAVAback to summary
public static final String JAVA
SLEEFback to summary
public static final String SLEEF
SVMLback to summary
public static final String SVML

Method Detail

getDefaultNameback to summary
public static String getDefaultName()
getInstanceback to summary
public static VectorMathLibrary.Library getInstance()
isSupportedback to summary
public boolean isSupported(VectorOperators.Operator op, VectorSpecies<?> vspecies)
symbolNameback to summary
public String symbolName(VectorOperators.Operator op, VectorSpecies<?> vspecies)
jdk.incubator.vector back to summary

private Class VectorMathLibrary.SLEEF

extends Object
implements Library
Class Inheritance
All Implemented Interfaces
jdk.incubator.vector.VectorMathLibrary.Library

Naming convention in SLEEF-based vector math library . All the methods are named as _ where: is the operation name, e.g. sin is optional to indicate float/double "f/d" for vector float/double operation is the number of elements in the vector "2/4" for neon, and "x" for sve/rvv is the precision level "u10/u05" represents 1.0/0.5 ULP error bounds We use "u10" for all operations by default But for those functions do not have u10 support, we use "u05" instead indicates neon/sve/rvv "sve/advsimd/rvv" for sve/neon/rvv implementations e.g. sinfx_u10sve is the method for computing vector float sin using SVE instructions cosd2_u10advsimd is the method for computing 2 elements vector double cos using NEON instructions

Constructor Summary

AccessConstructor and Description
private

Constructor Detail

SLEEFback to summary
private SLEEF()

Method Detail

isSupportedback to summary
public boolean isSupported(VectorOperators.Operator op, VectorSpecies<?> vspecies)

Implements jdk.incubator.vector.VectorMathLibrary.Library.isSupported.

Annotations
@Override
precisionLevelback to summary
private static String precisionLevel(VectorOperators.Operator op)
suffixback to summary
private static String suffix(VectorShape vshape, boolean isShapeAgnostic)
symbolNameback to summary
public String symbolName(VectorOperators.Operator op, VectorSpecies<?> vspecies)

Implements jdk.incubator.vector.VectorMathLibrary.Library.symbolName.

Annotations
@Override
jdk.incubator.vector back to summary

private Class VectorMathLibrary.SVML

extends Object
implements Library
Class Inheritance
All Implemented Interfaces
jdk.incubator.vector.VectorMathLibrary.Library

Naming convention in SVML vector math library. All the methods are named as __jsvml__ha_ where: ha stands for high accuracy is optional to indicate float/double Set to f for vector float operation Omitted for vector double operation is the number of elements in the vector 1, 2, 4, 8, 16 e.g. 128 bit float vector has 4 float elements indicates the avx/sse level: z0 is AVX512, l9 is AVX2, e9 is AVX1 and ex is for SSE2 e.g. __jsvml_expf16_ha_z0 is the method for computing 16 element vector float exp using AVX 512 insns __jsvml_exp8_ha_z0 is the method for computing 8 element vector double exp using AVX 512 insns

Constructor Summary

AccessConstructor and Description
private
SVML()

Constructor Detail

SVMLback to summary
private SVML()

Method Detail

isSupportedback to summary
public boolean isSupported(VectorOperators.Operator op, VectorSpecies<?> vspecies)

Implements jdk.incubator.vector.VectorMathLibrary.Library.isSupported.

Annotations
@Override
loadNativeLibraryback to summary
private static void loadNativeLibrary()
suffixback to summary
private static String suffix(VectorSpecies<?> vspecies)
symbolNameback to summary
public String symbolName(VectorOperators.Operator op, VectorSpecies<?> vspecies)

Implements jdk.incubator.vector.VectorMathLibrary.Library.symbolName.

Annotations
@Override