--- layout: stdlib-reference --- # max ## Description Maximum. ## Signature
/// Requires Capability Set 1:
T max<T>(
    T x,
    T y)
    where T : __BuiltinIntegerType;

/// Requires Capability Set 1:
vector<T, N> max<T, int N>(
    vector<T, N> x,
    vector<T, N> y)
    where T : __BuiltinIntegerType;

/// Requires Capability Set 1:
matrix<T, N, M> max<T, int N, int M>(
    matrix<T, N, M> x,
    matrix<T, N, M> y)
    where T : __BuiltinIntegerType;

/// Requires Capability Set 1:
T max<T>(
    T x,
    T y)
    where T : __BuiltinFloatingPointType;

/// Requires Capability Set 1:
vector<T, N> max<T, int N>(
    vector<T, N> x,
    vector<T, N> y)
    where T : __BuiltinFloatingPointType;

/// Requires Capability Set 1:
matrix<T, N, M> max<T, int N, int M>(
    matrix<T, N, M> x,
    matrix<T, N, M> y)
    where T : __BuiltinFloatingPointType;

/// Requires Capability Set 2:
CoopVec<T, N> max<T, int N>(
    CoopVec<T, N> x,
    CoopVec<T, N> y)
    where T : __BuiltinFloatingPointType;

/// Requires Capability Set 3:
CoopVec<T, N> max<T, int N>(
    CoopVec<T, N> x,
    CoopVec<T, N> y)
    where T : __BuiltinIntegerType;

## Generic Parameters #### T: [\_\_BuiltinIntegerType](../interfaces/0_builtinintegertype-029g/index.html) #### N : int #### M : int #### T: [\_\_BuiltinFloatingPointType](../interfaces/0_builtinfloatingpointtype-029hm/index.html) ## Parameters #### x : [T](max.html#typeparam-T) The first value. #### y : [T](max.html#typeparam-T) The second value. #### x : [vector](../types/vector/index.html)\<[T](../types/vector/index.html#typeparam-T), [N](../types/vector/index.html#decl-N)\> The first value. #### y : [vector](../types/vector/index.html)\<[T](../types/vector/index.html#typeparam-T), [N](../types/vector/index.html#decl-N)\> The second value. #### x : [matrix](../types/matrix/index.html)\<[T](../types/matrix/t-0.html), [N](../types/matrix/index.html#decl-N), [M](../types/matrix/index.html#decl-M)\> The first value. #### y : [matrix](../types/matrix/index.html)\<[T](../types/matrix/t-0.html), [N](../types/matrix/index.html#decl-N), [M](../types/matrix/index.html#decl-M)\> The second value. #### x : [CoopVec](../types/coopvec-04/index.html)\<[T](../types/coopvec-04/index.html#typeparam-T), [N](../types/coopvec-04/index.html#decl-N)\> The first value. #### y : [CoopVec](../types/coopvec-04/index.html)\<[T](../types/coopvec-04/index.html#typeparam-T), [N](../types/coopvec-04/index.html#decl-N)\> The second value. ## Return value The maximum of x and y. ## 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. #### metal Available in all stages. #### wgsl Available in all stages. #### spirv Available in all stages. #### llvm Available in all stages. ### Capability Set 2 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 3 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. #### spirv Available in all stages. Requires capability: `spvCooperativeVectorNV`.