coopVecReduceSumAccumulate

Description

Atomically accumulates the elements a cooperative vector into a buffer at the specified offset.

Signature

/// Requires Capability Set 1:
void coopVecReduceSumAccumulate<T, int N>(
    CoopVec<T, N> v,
    RWByteAddressBuffer buffer,
    int offset)
    where T : __BuiltinArithmeticType;

/// Requires Capability Set 2:
void coopVecReduceSumAccumulate<T, int N, IgnoredBufferElementType>(
    CoopVec<T, N> v,
    RWStructuredBuffer<IgnoredBufferElementType, DefaultDataLayout> buffer,
    int offset)
    where T : __BuiltinArithmeticType;

/// Requires Capability Set 2:
void coopVecReduceSumAccumulate<T, int N, U, int IgnoredBufferSize>(
    CoopVec<T, N> v,
    U[IgnoredBufferSize] buffer,
    int offset)
    where T : __BuiltinArithmeticType;

/// Requires Capability Set 2:
void coopVecReduceSumAccumulate<T, int N>(
    CoopVec<T, N> v,
    Ptr<void, Access.ReadWrite, AddressSpace.Device> buffer)
    where T : __BuiltinArithmeticType;

Generic Parameters

T: __BuiltinArithmeticType

N : int

IgnoredBufferElementType

U

IgnoredBufferSize : int

Parameters

v : CoopVec<T, N>

The cooperative vector to sum.

buffer : RWByteAddressBuffer

The buffer to accumulate the sum into.

offset : int

Byte offset into the buffer.

buffer : RWStructuredBuffer<IgnoredBufferElementType, DefaultDataLayout>

The buffer to accumulate the sum into.

buffer : U [ IgnoredBufferSize ]

The buffer to accumulate the sum into.

buffer : Ptr<void, Access.ReadWrite, AddressSpace.Device>

The buffer to accumulate the sum into.

Remarks

This function is equivalent to:

for (int i = 0; i < N; i++)
    atomicAdd(dest[i], v[i]);

Availability and Requirements

Capability Set 1

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.

Requires capability: optix_coopvec.

spirv

Available in all stages.

Requires capability: spvCooperativeVectorNV.

Capability Set 2

Defined for the following targets:

spirv

Available in all stages.

Requires capability: spvCooperativeVectorTrainingNV.