Top Description Fields Constructors Methods
jdk.incubator.vector

public final Enum VectorShape

extends Enum<VectorShape>
Class Inheritance
Imports
jdk.internal.vm.annotation.ForceInline, .Stable, jdk.internal.vm.vector.VectorSupport

A VectorShape selects a particular implementation of Vectors. A shape in combination with the element type determines a particular vector species object.

API Note

Because not all shapes are supported by all platforms, shape-agnostic code is more portable. User code that selects particular shapes may fail to run, or run slowly, on some platforms. Use VectorShape.preferredShape() and VectorSpecies.ofPreferred() to select the shape that is usually preferable for most uses.

Field Summary

Modifier and TypeField and Description
pack-priv static final int
pack-priv static final int
private static VectorShape
public static final VectorShape
S_128_BIT

Shape of length 128 bits

public static final VectorShape
S_256_BIT

Shape of length 256 bits

public static final VectorShape
S_512_BIT

Shape of length 512 bits

public static final VectorShape
S_64_BIT

Shape of length 64 bits

public static final VectorShape
S_Max_BIT

Shape of maximum length supported on the platform

pack-priv static final int
pack-priv static final int
pack-priv static final int
pack-priv static final int
pack-priv static final int
pack-priv static final int
pack-priv final int
pack-priv final int
pack-priv final int

Constructor Summary

AccessConstructor and Description
private
VectorShape(int vectorBitSize)

Method Summary

Modifier and TypeMethod and Description
private static VectorShape
public static VectorShape

Returns:

a shape corresponding to the vector bit-size
forBitSize
(int
the proposed vector size in bits
bitSize
)

Finds an appropriate shape depending on the proposed bit-size of a vector.

public static VectorShape

Returns:

a shape corresponding to the index vector bit-size and element size.
forIndexBitSize
(int
the proposed index vector size in bits
indexBitSize
,
int
the proposed element size in bits
elementSize
)

Finds an appropriate index shape depending on the proposed index-bit-size and element-size of a vector.

pack-priv static int

Returns:

the maximum vector bit.
getMaxVectorBitSize
(Class<?>
the element type.
etype
)

Returns the maximum vector bit size for a given element type.

pack-priv int

Returns:

the number of lanes
laneCount
(VectorSpecies<?>
the species describing the element type
species
)

Return the number of lanes of a vector of this shape and whose element type is of the provided species

pack-priv static VectorShape
pack-priv static VectorShape
ofSwitchKey(int sk)

public static VectorShape

Returns:

a preferred shape for all element types
preferredShape
()

Finds the vector shape preferred by the current platform for all vector element types.

public static VectorShape
public static VectorShape[]
public int

Returns:

the size, in bits, of vectors of this shape.
vectorBitSize
()

Returns the size, in bits, of vectors of this shape.

public <
the boxed element type
E
>
VectorSpecies<E>

Returns:

a species for the given element type and this shape
withLanes
(Class<E>
the required element type
elementType
)

Finds a vector species with the given element type and the current shape.

Inherited from java.lang.Enum:
clonecompareTodescribeConstableequalsfinalizegetDeclaringClasshashCodenameordinaltoStringvalueOf

Field Detail

INC_VECTOR_SIZEback to summary
pack-priv static final int INC_VECTOR_SIZE
MAX_VECTOR_SIZEback to summary
pack-priv static final int MAX_VECTOR_SIZE
PREFERRED_SHAPEback to summary
private static VectorShape PREFERRED_SHAPE
Annotations
@Stable
S_128_BITback to summary
public static final VectorShape S_128_BIT

Shape of length 128 bits

S_256_BITback to summary
public static final VectorShape S_256_BIT

Shape of length 256 bits

S_512_BITback to summary
public static final VectorShape S_512_BIT

Shape of length 512 bits

S_64_BITback to summary
public static final VectorShape S_64_BIT

Shape of length 64 bits

S_Max_BITback to summary
public static final VectorShape S_Max_BIT

Shape of maximum length supported on the platform

SK_128_BITback to summary
pack-priv static final int SK_128_BIT
SK_256_BITback to summary
pack-priv static final int SK_256_BIT
SK_512_BITback to summary
pack-priv static final int SK_512_BIT
SK_64_BITback to summary
pack-priv static final int SK_64_BIT
SK_LIMITback to summary
pack-priv static final int SK_LIMIT
SK_Max_BITback to summary
pack-priv static final int SK_Max_BIT
switchKeyback to summary
pack-priv final int switchKey
vectorBitSizeback to summary
pack-priv final int vectorBitSize
vectorBitSizeLog2back to summary
pack-priv final int vectorBitSizeLog2

Constructor Detail

VectorShapeback to summary
private VectorShape(int vectorBitSize)

Method Detail

computePreferredShapeback to summary
private static VectorShape computePreferredShape()
forBitSizeback to summary
public static VectorShape forBitSize(int bitSize)

Finds an appropriate shape depending on the proposed bit-size of a vector.

Parameters
bitSize:int

the proposed vector size in bits

Returns:VectorShape

a shape corresponding to the vector bit-size

Exceptions
IllegalArgumentException:
if no such vector shape exists
See Also
vectorBitSize()
forIndexBitSizeback to summary
public static VectorShape forIndexBitSize(int indexBitSize, int elementSize)

Finds an appropriate index shape depending on the proposed index-bit-size and element-size of a vector.

Parameters
indexBitSize:int

the proposed index vector size in bits

elementSize:int

the proposed element size in bits

Returns:VectorShape

a shape corresponding to the index vector bit-size and element size.

Exceptions
IllegalArgumentException:
if no such vector shape exists
See Also
vectorBitSize()
getMaxVectorBitSizeback to summary
pack-priv static int getMaxVectorBitSize(Class<?> etype)

Returns the maximum vector bit size for a given element type.

Parameters
etype:Class<?>

the element type.

Returns:int

the maximum vector bit.

laneCountback to summary
pack-priv int laneCount(VectorSpecies<?> species)

Return the number of lanes of a vector of this shape and whose element type is of the provided species

Parameters
species:VectorSpecies<?>

the species describing the element type

Returns:int

the number of lanes

largestShapeForback to summary
pack-priv static VectorShape largestShapeFor(Class<?> etype)
ofSwitchKeyback to summary
pack-priv static VectorShape ofSwitchKey(int sk)
preferredShapeback to summary
public static VectorShape preferredShape()

Finds the vector shape preferred by the current platform for all vector element types.

The preferred shape by the platform has the largest possible bit-size, under the constraint that all lane sizes are supported, from byte to double. Thus, all the preferred vector species for various lane types will have a common underlying shape.

Returns:VectorShape

a preferred shape for all element types

Annotations
@ForceInline
Exceptions
UnsupportedOperationException:
if no such shape exists
See Also
VectorSpecies#ofPreferred(Class)
valueOfback to summary
public static VectorShape valueOf(String name)
valuesback to summary
public static VectorShape[] values()
vectorBitSizeback to summary
public int vectorBitSize()

Returns the size, in bits, of vectors of this shape.

Returns:int

the size, in bits, of vectors of this shape.

Annotations
@ForceInline
withLanesback to summary
public <E> VectorSpecies<E> withLanes(Class<E> elementType)

Finds a vector species with the given element type and the current shape. Returns the same value as VectorSpecies.of(elementType, this).

Parameters
<E>
the boxed element type
elementType:Class<E>

the required element type

Returns:VectorSpecies<E>

a species for the given element type and this shape

See Also
VectorSpecies#of(Class, VectorShape)