Skip to main content

Overview

cutlass::Array is a statically sized array template that accommodates all CUTLASS-supported numeric types and is safe to use in a union. It provides STL-compatible interfaces including iterators, element access, and various operations. Header: cutlass/array.h

Template Signature

Template Parameters

typename
Element type. Can be any CUTLASS numeric type including float, half_t, int8_t, etc.
int
Number of elements in the array
bool
default:"sizeof_bits<T>::value >= 32"
Internal optimization flag. Set to true for types with 32 or more bits.

Member Types

Data Members

Internal storage for array elements.

Member Functions

Element Access

at

Accesses element at specified position with bounds checking.

operator[]

Accesses element at specified position without bounds checking.

front

Returns reference to the first element.

back

Returns reference to the last element.

data

Returns pointer to the underlying array.

raw_data

Returns pointer to the underlying storage.

Capacity

empty

Returns true if the array is empty (N == 0).

size

Returns the number of elements (N).

max_size

Returns the maximum number of elements (N).

Operations

clear

Sets all elements to zero using fill(T(0)).

fill

Fills all elements with the specified value. Implementation:

Iterators

begin / end

Returns iterators to the beginning and end of the array.

rbegin / rend

Returns reverse iterators.

Factory Functions

make_Array

Factory functions to construct arrays with 1-4 elements.

Numeric Specializations

Array provides specialized implementations of numeric operations for SIMD efficiency on supported types like half_t.

Arithmetic Operations

Comparison Operations

Fused Operations

Mathematical Functions

Usage Examples

Basic Array Operations

Factory Functions

Numeric Operations

With Half-Precision Types

In Device Code

SIMD Optimization

For half_t arrays, operations are automatically SIMD-optimized on SM_53 and later:

See Also