dot

Description

Vector dot product. Returns the dot product of two vectors.

Signature

T dot<T>(
    T x,
    T y)
    where T : __BuiltinFloatingPointType;

T dot<T, int N>(
    vector<T, N> x,
    vector<T, N> y)
    where T : __BuiltinFloatingPointType;

BFloat16 dot<int N>(
    vector<BFloat16, N> x,
    vector<BFloat16, N> y);

T dot<T, int N>(
    vector<T, N> x,
    vector<T, N> y)
    where T : __BuiltinIntegerType;

Generic Parameters

T: __BuiltinFloatingPointType

N : int

T: __BuiltinIntegerType

Parameters

x : T

The first vector.

y : T

The second vector.

x : vector<T, N>

The first vector.

y : vector<T, N>

The second vector.

x : vector<BFloat16, N>

The first vector.

y : vector<BFloat16, N>

The second vector.

Return value

The dot product of x and y.

Remarks

When x and y are scalars, this function is equivalent to x*y.

Availability and Requirements

Defined for the following targets:

hlsl

Available in all stages.

glsl

Available in all stages.

cpp

Available in all stages.

cuda

Available in all stages.

metal

Available in all stages.

wgsl

Available in all stages.

spirv

Available in all stages.

llvm

Available in all stages.