--- layout: stdlib-reference --- # 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> buffer)
    where T : __BuiltinArithmeticType;

## Generic Parameters #### T: [\_\_BuiltinArithmeticType](../interfaces/0_builtinarithmetictype-029j/index.html) #### N : int #### IgnoredBufferElementType #### U #### IgnoredBufferSize : int ## Parameters #### v : [CoopVec](../types/coopvec-04/index.html)\<[T](../types/coopvec-04/index.html#typeparam-T), [N](../types/coopvec-04/index.html#decl-N)\> The cooperative vector to sum. #### buffer : [RWByteAddressBuffer](../types/rwbyteaddressbuffer-0126d/index.html) The buffer to accumulate the sum into. #### offset : int Byte offset into the buffer. #### buffer : [RWStructuredBuffer](../types/rwstructuredbuffer-012c/index.html)\ The buffer to accumulate the sum into. #### buffer : [U](coopvecreducesumaccumulate-47dg.html#typeparam-U) \[ [IgnoredBufferSize](coopvecreducesumaccumulate-47dg.html#decl-IgnoredBufferSize) \] The buffer to accumulate the sum into. #### buffer : [Ptr](../types/ptr-0/index.html)\ 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. Requires capability: `hlsl_coopvec_poc`. #### 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`.