跳到主要内容

MUSA Math API Reference

The MUSA Math API provides device-side numeric types, conversions, mathematical functions, and low-level intrinsics for MUSA kernels. Use this reference to choose the correct API for the data type, precision, rounding behavior, saturation behavior, and memory access pattern used by a kernel.

Most entries include the C/C++ signature, the operation performed, and the effect that matters to application code. For conversion APIs, pay attention to the destination format, rounding mode, and saturation rule. For load and store intrinsics, pay attention to the pointer type, value type, and memory access constraints documented for the target device. For packed or vector intrinsics, the operation is applied independently to each lane or packed element unless the description states otherwise.

API Category Index

Type and Enum Reference

This section lists the public storage types, interpretation enums, saturation modes, and numeric structs used by the Math API signatures.

FP4 Types and Enums

__mt_fp4_interpretation_t

typedef enum __mt_fp4_interpretation_t {
__MT_E2M1,
} __mt_fp4_interpretation_t;

Enumerates the possible interpretations of 4-bit values when referring to them as FP4 types.

EnumeratorDescription
__MT_E2M1Represents FP4 numbers of e2m1 kind.

FP4 Storage Types

TypeDefinitionDescription
__mt_fp4_storage_ttypedef __mt_fp8_storage_t __mt_fp4_storage_t8-bit unsigned integer storage for FP4 values.
__mt_fp4x2_storage_ttypedef __mt_fp8_storage_t __mt_fp4x2_storage_t8-bit unsigned integer storage for pairs of FP4 values.
__mt_fp4x4_storage_ttypedef __mt_fp8x2_storage_t __mt_fp4x4_storage_t16-bit unsigned integer storage for tetrads of FP4 values.

FP4 Struct Types

TypeDescription
__mt_fp4_e2m1C++ structure for handling an FP4 value of e2m1 kind.
__mt_fp4x2_e2m1C++ structure for handling a vector of two FP4 values of e2m1 kind.
__mt_fp4x4_e2m1C++ structure for handling a vector of four FP4 values of e2m1 kind.

FP6 Types and Enums

__mt_fp6_interpretation_t

typedef enum __mt_fp6_interpretation_t {
__MT_E2M3,
__MT_E3M2,
} __mt_fp6_interpretation_t;

Enumerates the possible interpretations of 6-bit values when referring to them as FP6 types.

EnumeratorDescription
__MT_E2M3Represents FP6 numbers of e2m3 kind.
__MT_E3M2Represents FP6 numbers of e3m2 kind.

FP6 Storage Types

TypeDefinitionDescription
__mt_fp6_storage_ttypedef __mt_fp8_storage_t __mt_fp6_storage_t8-bit unsigned integer storage for FP6 values.
__mt_fp6x2_storage_ttypedef __mt_fp8x2_storage_t __mt_fp6x2_storage_t16-bit unsigned integer storage for pairs of FP6 values.
__mt_fp6x4_storage_ttypedef __mt_fp8x4_storage_t __mt_fp6x4_storage_t32-bit unsigned integer storage for tetrads of FP6 values.

FP6 Struct Types

TypeDescription
__mt_fp6_e2m3C++ structure for handling an FP6 value of e2m3 kind.
__mt_fp6_e3m2C++ structure for handling an FP6 value of e3m2 kind.
__mt_fp6x2_e2m3C++ structure for handling a vector of two FP6 values of e2m3 kind.
__mt_fp6x2_e3m2C++ structure for handling a vector of two FP6 values of e3m2 kind.
__mt_fp6x4_e2m3C++ structure for handling a vector of four FP6 values of e2m3 kind.
__mt_fp6x4_e3m2C++ structure for handling a vector of four FP6 values of e3m2 kind.

FP8 Types and Enums

__musa_saturation_t

typedef enum __musa_saturation_t {
__MT_NOSAT,
__MT_SATFINITE,
} __musa_saturation_t;

Enumerates the saturation modes used when narrowing values to FP8 destination types.

EnumeratorDescription
__MT_NOSATDoes not saturate finite results when rounding produces a value outside the destination range. For e4m3, values larger than the maximum finite value become NaN.
__MT_SATFINITESaturates values larger than the maximum finite value to MAXNORM with the same sign as the input.

__mt_fp8_interpretation_t

typedef enum __mt_fp8_interpretation_t {
__MT_E4M3,
__MT_E5M2,
} __mt_fp8_interpretation_t;

Enumerates the possible interpretations of 8-bit values when referring to them as FP8 types.

EnumeratorDescription
__MT_E4M3Represents FP8 numbers of e4m3 kind.
__MT_E5M2Represents FP8 numbers of e5m2 kind.

FP8 Storage Types

TypeDefinitionDescription
__mt_fp8_storage_ttypedef unsigned char __mt_fp8_storage_t8-bit unsigned integer storage for FP8 values.
__mt_fp8x2_storage_ttypedef unsigned short int __mt_fp8x2_storage_t16-bit unsigned integer storage for pairs of FP8 values.
__mt_fp8x4_storage_ttypedef unsigned int __mt_fp8x4_storage_t32-bit unsigned integer storage for tetrads of FP8 values.

FP8 Struct Types

TypeDescription
__mt_fp8_e4m3C++ structure for handling an FP8 value of e4m3 kind.
__mt_fp8_e5m2C++ structure for handling an FP8 value of e5m2 kind.
__mt_fp8_e8m0C++ structure for handling an FP8 value of e8m0 kind.
__mt_fp8x2_e4m3C++ structure for handling a vector of two FP8 values of e4m3 kind.
__mt_fp8x2_e5m2C++ structure for handling a vector of two FP8 values of e5m2 kind.
__mt_fp8x2_e8m0C++ structure for handling a vector of two FP8 values of e8m0 kind.
__mt_fp8x4_e4m3C++ structure for handling a vector of four FP8 values of e4m3 kind.
__mt_fp8x4_e5m2C++ structure for handling a vector of four FP8 values of e5m2 kind.
__mt_fp8x4_e8m0C++ structure for handling a vector of four FP8 values of e8m0 kind.

Half Precision Types

TypeDescription
__halfC++ structure for storing a half-precision floating-point value.
__half2C++ structure for storing two half-precision floating-point values.
__half_rawRaw storage representation of a half-precision value.
__half2_rawRaw storage representation of two half-precision values.
halfAlias for __half.
half2Alias for __half2.

Bfloat16 Precision Types

TypeDescription
__mt_bfloat16C++ structure for storing an mt_bfloat16 floating-point value.
__mt_bfloat162C++ structure for storing two mt_bfloat16 floating-point values.
__mt_bfloat16_rawRaw storage representation of an mt_bfloat16 value.
__mt_bfloat162_rawRaw storage representation of two mt_bfloat16 values.
mt_bfloat16Alias for __mt_bfloat16.
mt_bfloat162Alias for __mt_bfloat162.

Rounding Mode

Several conversion APIs accept enum musaRoundMode. This enum is shared with the broader MUSA runtime type definitions. Math API entries describe how the rounding mode affects each operation where the behavior is operation-specific.

Struct Reference

This section documents the numeric wrapper structures used by the Math API. These structures provide storage, constructors, conversion operators, and arithmetic or comparison operators where supported by the type.

__half

struct __half

__half data type This structure implements the datatype for storing half-precision floating-point numbers. The structure implements assignment, arithmetic and comparison operators, and type conversions. 16 bits are being used in total: 1 sign bit, 5 bits for the exponent, and the significand is being stored in 10 bits. The total precision is 11 bits. There are 15361 representable numbers within the interval [0.0, 1.0], endpoints included. On average we have log10(2**11) ~ 3.311 decimal digits. The objective here is to provide IEEE754-compliant implementation of binary16 type and arith- metic with limitations due to device hardware not supporting floating-point exceptions. Public functions __half() = default Constructor by default. Empty default constructor. The result is uninitialized.

__half2

struct __half2

__half2 data type This structure implements the datatype for storing two half-precision floating-point numbers. The structure implements assignment, arithmetic and comparison operators, and type conversions.

  • NOTE: __half2 is visible to non-MUSA host compilers Public functions __half2() = default Constructor by default. Empty default constructor. The result is uninitialized.

__half2_raw

struct __half2_raw

__half2_raw data type Type allows static initialization of half2 until it becomes a built-in type.

  • Note: this initialization is as a bit-field representation of half2, and not a conversion from short2 to half2. Such representation will be deprecated in a future version of MUSA.
  • Note: this is visible to non-MUSA compilers, including C-only compilations Public members unsigned short x Storage field contains bits of the lower half part. unsigned short y Storage field contains bits of the upper half part.

__half_raw

struct __half_raw

__half_raw data type Type allows static initialization of half until it becomes a built-in type.

  • Note: this initialization is as a bit-field representation of half, and not a conversion from short to half. Such representation will be deprecated in a future version of MUSA.
  • Note: this is visible to non-MUSA compilers, including C-only compilations Public members unsigned short x Storage field contains bits representation of the half floating-point number.

__mt_bfloat16

struct __mt_bfloat16

mt_bfloat16 data type This structure implements the datatype for storing mt_bfloat16 floating-point numbers. The structure implements assignment operators and type conversions. 16 bits are being used in total: 1 sign bit, 8 bits for the exponent, and the significand is being stored in 7 bits. The total precision is 8 bits. Public functions __mt_bfloat16() = default Constructor by default. Empty default constructor. The result is uninitialized.

__mt_bfloat162

struct __mt_bfloat162

mt_bfloat162 data type This structure implements the datatype for storing two mt_bfloat16 floating-point numbers. The structure implements assignment, arithmetic and comparison operators, and type conversions.

  • NOTE: __mt_bfloat162 is visible to non-MUSA host compilers Public functions __mt_bfloat162() = default Constructor by default. Empty default constructor. The result is uninitialized.

__mt_bfloat162_raw

struct __mt_bfloat162_raw

__mt_bfloat162_raw data type Type allows static initialization of mt_bfloat162 until it becomes a built-in type.

  • Note: this initialization is as a bit-field representation of mt_bfloat162, and not a conversion from short2 to mt_bfloat162. Such representation will be deprecated in a future version of MUSA.

__mt_bfloat16_raw

struct __mt_bfloat16_raw

__mt_bfloat16_raw data type Type allows static initialization of mt_bfloat16 until it becomes a built-in type.

  • Note: this initialization is as a bit-field representation of mt_bfloat16, and not a conversion from short to mt_bfloat16. Such representation will be deprecated in a future version of MUSA.
  • Note: this is visible to non-MUSA compilers, including C-only compilations Public members unsigned short x Storage field contains bits representation of the mt_bfloat16 floating-point number.

__mt_fp4_e2m1

struct __mt_fp4_e2m1

__mt_fp4_e2m1 datatype This structure implements the datatype for handling fp4 floating-point numbers of e2m1 kind: with 1 sign, 2 exponent, 1 implicit and 1 explicit mantissa bits. This encoding does not support Inf/NaN. The structure implements converting constructors and operators. Public functions

__mt_fp4x2_e2m1

struct __mt_fp4x2_e2m1

__mt_fp4x2_e2m1 datatype This structure implements the datatype for handling two fp4 floating-point numbers of e2m1 kind each. The structure implements converting constructors and operators. Public functions

__mt_fp4x4_e2m1

struct __mt_fp4x4_e2m1

__mt_fp4x4_e2m1 datatype This structure implements the datatype for handling four fp4 floating-point numbers of e2m1 kind each. The structure implements converting constructors and operators. Public functions

__mt_fp6_e2m3

struct __mt_fp6_e2m3

__mt_fp6_e2m3 datatype This structure implements the datatype for storing fp6 floating-point numbers of e2m3 kind: with 1 sign, 2 exponent, 1 implicit and 3 explicit mantissa bits. This encoding does not support Inf/NaN. The structure implements converting constructors and operators. Public functions

__mt_fp6_e3m2

struct __mt_fp6_e3m2

__mt_fp6_e3m2 datatype This structure implements the datatype for handling fp6 floating-point numbers of e3m2 kind: with 1 sign, 3 exponent, 1 implicit and 2 explicit mantissa bits. This encoding does not support Inf/NaN. The structure implements converting constructors and operators. Public functions

__mt_fp6x2_e2m3

struct __mt_fp6x2_e2m3

__mt_fp6x2_e2m3 datatype This structure implements the datatype for handling two fp6 floating-point numbers of e2m3 kind each. The structure implements converting constructors and operators. Public functions

__mt_fp6x2_e3m2

struct __mt_fp6x2_e3m2

__mt_fp6x2_e3m2 datatype This structure implements the datatype for handling two fp6 floating-point numbers of e3m2 kind each. The structure implements converting constructors and operators. Public functions

__mt_fp6x4_e2m3

struct __mt_fp6x4_e2m3

__mt_fp6x4_e2m3 datatype This structure implements the datatype for handling four fp6 floating-point numbers of e2m3 kind each. The structure implements converting constructors and operators. Public functions

__mt_fp6x4_e3m2

struct __mt_fp6x4_e3m2

__mt_fp6x4_e3m2 datatype This structure implements the datatype for handling four fp6 floating-point numbers of e3m2 kind each. The structure implements converting constructors and operators. Public functions

__mt_fp8_e4m3

struct __mt_fp8_e4m3

__mt_fp8_e4m3 datatype This structure implements the datatype for storing fp8 floating-point numbers of e4m3 kind: with 1 sign, 4 exponent, 1 implicit and 3 explicit mantissa bits. The encoding doesn’t support Infinity. NaNs are limited to 0x7F and 0xFF values. The structure implements converting constructors and operators. Public functions __mt_fp8_e4m3() = default Constructor by default.

__mt_fp8_e5m2

struct __mt_fp8_e5m2

__mt_fp8_e5m2 datatype This structure implements the datatype for handling fp8 floating-point numbers of e5m2 kind: with 1 sign, 5 exponent, 1 implicit and 2 explicit mantissa bits. The structure implements converting constructors and operators. Public functions __mt_fp8_e5m2() = default Constructor by default.

__mt_fp8_e8m0

struct __mt_fp8_e8m0

__mt_fp8_e8m0 datatype This structure implements the datatype for handling 8-bit scale factors of e8m0 kind: interpreted as powers of two with biased exponent. Bias equals to 127, so numbers 0 through 254 represent 2^-127 through 2^127. Number 0xFF = 255 is reserved for NaN. The structure implements converting constructors and operators.

__mt_fp8x2_e4m3

struct __mt_fp8x2_e4m3

__mt_fp8x2_e4m3 datatype This structure implements the datatype for storage and operations on the vector of two fp8 values of e4m3 kind each: with 1 sign, 4 exponent, 1 implicit and 3 explicit mantissa bits. The encoding doesn’t support Infinity. NaNs are limited to 0x7F and 0xFF values. Public functions __mt_fp8x2_e4m3() = default Constructor by default.

__mt_fp8x2_e5m2

struct __mt_fp8x2_e5m2

__mt_fp8x2_e5m2 datatype This structure implements the datatype for handling two fp8 floating-point numbers of e5m2 kind each: with 1 sign, 5 exponent, 1 implicit and 2 explicit mantissa bits. The structure implements converting constructors and operators. Public functions __mt_fp8x2_e5m2() = default Constructor by default.

__mt_fp8x2_e8m0

struct __mt_fp8x2_e8m0

__mt_fp8x2_e8m0 datatype This structure implements the datatype for storage and operations on the vector of two scale factors of e8m0 kind each. Public functions __mt_fp8x2_e8m0() = default Constructor by default.

__mt_fp8x4_e4m3

struct __mt_fp8x4_e4m3

__mt_fp8x4_e4m3 datatype This structure implements the datatype for storage and operations on the vector of four fp8 values of e4m3 kind each: with 1 sign, 4 exponent, 1 implicit and 3 explicit mantissa bits. The encoding doesn’t support Infinity. NaNs are limited to 0x7F and 0xFF values. Public functions __mt_fp8x4_e4m3() = default Constructor by default.

__mt_fp8x4_e5m2

struct __mt_fp8x4_e5m2

__mt_fp8x4_e5m2 datatype This structure implements the datatype for handling four fp8 floating-point numbers of e5m2 kind each: with 1 sign, 5 exponent, 1 implicit and 2 explicit mantissa bits. The structure implements converting constructors and operators. Public functions __mt_fp8x4_e5m2() = default Constructor by default.

__mt_fp8x4_e8m0

struct __mt_fp8x4_e8m0

__mt_fp8x4_e8m0 datatype This structure implements the datatype for storage and operations on the vector of scale factors of e8m0 kind each. Public functions __mt_fp8x4_e8m0() = default Constructor by default.

FP4 Intrinsics

Use FP4 intrinsics when a kernel needs to pack higher-precision values into 4-bit floating-point storage or unpack FP4 values for computation. These APIs are mainly useful for low-precision data movement, model parameter storage, and kernels that explicitly manage FP4 formats.

FP4 Conversion and Data Movement

__musa_cvt_double_to_fp4

__mt_fp4_storage_t __musa_cvt_double_to_fp4(const double x, const __mt_fp4_interpretation_t fp4_interpretation, const enum musaRoundMode rounding)

Converts input double precision x to fp4 type of the requested kind using specified rounding mode and saturating the out-of-range values.

Converts input x to fp4 type of the kind specified by fp4_interpretation parameter, using rounding mode specified by rounding parameter. Large out-of-range values saturate to MAXNORM of the same sign. NaN input values result in positive MAXNORM.

  • The __mt_fp4_storage_t value holds the result of conversion.

__musa_cvt_double2_to_fp4x2

__mt_fp4x2_storage_t __musa_cvt_double2_to_fp4x2(const double2 x, const __mt_fp4_interpretation_t fp4_interpretation, const enum musaRoundMode rounding)

Converts input vector of two double precision numbers packed in double2 x into a vector of two values of fp4 type of the requested kind using specified rounding mode and saturating the out-of-range values.

Converts input vector x to a vector of two fp4 values of the kind specified by fp4_interpretation parameter, using rounding mode specified by rounding parameter. Large out-of-range values saturate to MAXNORM of the same sign. NaN input values result in positive MAXNORM.

  • The __mt_fp4x2_storage_t value holds the result of conversion.

__musa_cvt_float_to_fp4

__mt_fp4_storage_t __musa_cvt_float_to_fp4(const float x, const __mt_fp4_interpretation_t fp4_interpretation, const enum musaRoundMode rounding)

Converts input single precision x to fp4 type of the requested kind using specified rounding mode and saturating the out-of-range values.

Converts input x to fp4 type of the kind specified by fp4_interpretation parameter, using rounding mode specified by rounding parameter. Large out-of-range values saturate to MAXNORM of the same sign. NaN input values result in positive MAXNORM.

  • The __mt_fp4_storage_t value holds the result of conversion.

__musa_cvt_float2_to_fp4x2

__mt_fp4x2_storage_t __musa_cvt_float2_to_fp4x2(const float2 x, const __mt_fp4_interpretation_t fp4_interpretation, const enum musaRoundMode rounding)

Converts input vector of two single precision numbers packed in float2 x into a vector of two values of fp4 type of the requested kind using specified rounding mode and saturating the out-of-range values.

Converts input vector x to a vector of two fp4 values of the kind specified by fp4_interpretation parameter, using rounding mode specified by rounding parameter. Large out-of-range values saturate to MAXNORM of the same sign. NaN input values result in positive MAXNORM.

  • The __mt_fp4x2_storage_t value holds the result of conversion.

__musa_cvt_halfraw_to_fp4

__mt_fp4_storage_t __musa_cvt_halfraw_to_fp4(const __half_raw x, const __mt_fp4_interpretation_t fp4_interpretation, const enum musaRoundMode rounding)

Converts input half precision x to fp4 type of the requested kind using specified rounding mode and saturating the out-of-range values.

Converts input x to fp4 type of the kind specified by fp4_interpretation parameter, using rounding mode specified by rounding parameter. Large out-of-range values saturate to MAXNORM of the same sign. NaN input values result in positive MAXNORM.

  • The __mt_fp4_storage_t value holds the result of conversion.

__musa_cvt_halfraw2_to_fp4x2

__mt_fp4x2_storage_t __musa_cvt_halfraw2_to_fp4x2(const __half2_raw x, const __mt_fp4_interpretation_t fp4_interpretation, const enum musaRoundMode rounding)

Converts input vector of two half precision numbers packed in __half2_raw x into a vector of two values of fp4 type of the requested kind using specified rounding mode and saturating the out-of-range values.

Converts input vector x to a vector of two fp4 values of the kind specified by fp4_interpretation parameter, using rounding mode specified by rounding parameter. Large out-of-range values saturate to MAXNORM of the same sign. NaN input values result in positive MAXNORM.

  • The __mt_fp4x2_storage_t value holds the result of conversion.

__musa_cvt_bfloat16raw_to_fp4

__mt_fp4_storage_t __musa_cvt_bfloat16raw_to_fp4(const __mt_bfloat16_raw x, const __mt_fp4_interpretation_t fp4_interpretation, const enum musaRoundMode rounding)

Converts input mt_bfloat16 precision x to fp4 type of the requested kind using specified rounding mode and saturating the out-of-range values.

Converts input x to fp4 type of the kind specified by fp4_interpretation parameter, using rounding mode specified by rounding parameter. Large out-of-range values saturate to MAXNORM of the same sign. NaN input values result in positive MAXNORM.

  • The __mt_fp4_storage_t value holds the result of conversion.

__musa_cvt_bfloat16raw2_to_fp4x2

__mt_fp4x2_storage_t __musa_cvt_bfloat16raw2_to_fp4x2(const __mt_bfloat162_raw x, const __mt_fp4_interpretation_t fp4_interpretation, const enum musaRoundMode rounding)

Converts input vector of two mt_bfloat16 precision numbers packed in __mt_bfloat162_raw x into a vector of two values of fp4 type of the requested kind using specified rounding mode and saturating the out-of-range values.

Converts input vector x to a vector of two fp4 values of the kind specified by fp4_interpretation parameter, using rounding mode specified by rounding parameter. Large out-of-range values saturate to MAXNORM of the same sign. NaN input values result in positive MAXNORM.

  • The __mt_fp4x2_storage_t value holds the result of conversion.

__musa_cvt_fp4_to_halfraw

__half_raw __musa_cvt_fp4_to_halfraw(const __mt_fp4_storage_t x, const __mt_fp4_interpretation_t fp4_interpretation)

Converts input fp4 x of the specified kind to half precision.

Converts input x of fp4 type of the kind specified by fp4_interpretation parameter to half precision.

  • The __half_raw value holds the result of conversion.

__musa_cvt_fp4x2_to_halfraw2

__half2_raw __musa_cvt_fp4x2_to_halfraw2(const __mt_fp4x2_storage_t x, const __mt_fp4_interpretation_t fp4_interpretation)

Converts input vector of two fp4 values of the specified kind to a vector of two half precision values packed in __half2_raw structure.

Converts input vector x of fp4 type of the kind specified by fp4_interpretation parameter to a vector of two half precision values and returns as __half2_raw structure.

  • The __half2_raw value holds the result of conversion.

FP6 Intrinsics

Use FP6 intrinsics when a kernel needs a compact floating-point format with more precision or dynamic range than FP4 while still using smaller storage than FP8 or half precision. The interpretation parameter selects the FP6 layout used by the stored value.

FP6 Conversion and Data Movement

__musa_cvt_double_to_fp6

__mt_fp6_storage_t __musa_cvt_double_to_fp6(const double x, const __mt_fp6_interpretation_t fp6_interpretation, const enum musaRoundMode rounding)

Converts input double precision x to fp6 type of the requested kind using specified rounding mode and saturating the out-of-range values.

Converts input x to fp6 type of the kind specified by fp6_interpretation parameter, using rounding mode specified by rounding parameter. Large out-of-range values saturate to MAXNORM of the same sign. NaN input values result in positive MAXNORM.

  • The __mt_fp6_storage_t value holds the result of conversion.

__musa_cvt_double2_to_fp6x2

__mt_fp6x2_storage_t __musa_cvt_double2_to_fp6x2(const double2 x, const __mt_fp6_interpretation_t fp6_interpretation, const enum musaRoundMode rounding)

Converts input vector of two double precision numbers packed in double2 x into a vector of two values of fp6 type of the requested kind using specified rounding mode and saturating the out-of-range values.

Converts input vector x to a vector of two fp6 values of the kind specified by fp6_interpretation parameter, using rounding mode specified by rounding parameter. Large out-of-range values saturate to MAXNORM of the same sign. NaN input values result in positive MAXNORM.

  • The __mt_fp6x2_storage_t value holds the result of conversion.

__musa_cvt_float_to_fp6

__mt_fp6_storage_t __musa_cvt_float_to_fp6(const float x, const __mt_fp6_interpretation_t fp6_interpretation, const enum musaRoundMode rounding)

Converts input single precision x to fp6 type of the requested kind using specified rounding mode and saturating the out-of-range values.

Converts input x to fp6 type of the kind specified by fp6_interpretation parameter, using rounding mode specified by rounding parameter. Large out-of-range values saturate to MAXNORM of the same sign. NaN input values result in positive MAXNORM.

  • The __mt_fp6_storage_t value holds the result of conversion.

__musa_cvt_float2_to_fp6x2

__mt_fp6x2_storage_t __musa_cvt_float2_to_fp6x2(const float2 x, const __mt_fp6_interpretation_t fp6_interpretation, const enum musaRoundMode rounding)

Converts input vector of two single precision numbers packed in float2 x into a vector of two values of fp6 type of the requested kind using specified rounding mode and saturating the out-of-range values.

Converts input vector x to a vector of two fp6 values of the kind specified by fp6_interpretation parameter, using rounding mode specified by rounding parameter. Large out-of-range values saturate to MAXNORM of the same sign. NaN input values result in positive MAXNORM.

  • The __mt_fp6x2_storage_t value holds the result of conversion.

__musa_cvt_halfraw_to_fp6

__mt_fp6_storage_t __musa_cvt_halfraw_to_fp6(const __half_raw x, const __mt_fp6_interpretation_t fp6_interpretation, const enum musaRoundMode rounding)

Converts input half precision x to fp6 type of the requested kind using specified rounding mode and saturating the out-of-range values.

Converts input x to fp6 type of the kind specified by fp6_interpretation parameter, using rounding mode specified by rounding parameter. Large out-of-range values saturate to MAXNORM of the same sign. NaN input values result in positive MAXNORM.

  • The __mt_fp6_storage_t value holds the result of conversion.

__musa_cvt_halfraw2_to_fp6x2

__mt_fp6x2_storage_t __musa_cvt_halfraw2_to_fp6x2(const __half2_raw x, const __mt_fp6_interpretation_t fp6_interpretation, const enum musaRoundMode rounding)

Converts input vector of two half precision numbers packed in __half2_raw x into a vector of two values of fp6 type of the requested kind using specified rounding mode and saturating the out-of-range values.

Converts input vector x to a vector of two fp6 values of the kind specified by fp6_interpretation parameter, using rounding mode specified by rounding parameter. Large out-of-range values saturate to MAXNORM of the same sign. NaN input values result in positive MAXNORM.

  • The __mt_fp6x2_storage_t value holds the result of conversion.

__musa_cvt_bfloat16raw_to_fp6

__mt_fp6_storage_t __musa_cvt_bfloat16raw_to_fp6(const __mt_bfloat16_raw x, const __mt_fp6_interpretation_t fp6_interpretation, const enum musaRoundMode rounding)

Converts input mt_bfloat16 precision x to fp6 type of the requested kind using specified rounding mode and saturating the out-of-range values.

Converts input x to fp6 type of the kind specified by fp6_interpretation parameter, using rounding mode specified by rounding parameter. Large out-of-range values saturate to MAXNORM of the same sign. NaN input values result in positive MAXNORM.

  • The __mt_fp6_storage_t value holds the result of conversion.

__musa_cvt_bfloat16raw2_to_fp6x2

__mt_fp6x2_storage_t __musa_cvt_bfloat16raw2_to_fp6x2(const __mt_bfloat162_raw x, const __mt_fp6_interpretation_t fp6_interpretation, const enum musaRoundMode rounding)

Converts input vector of two mt_bfloat16 precision numbers packed in __mt_bfloat162_raw x into a vector of two values of fp6 type of the requested kind using specified rounding mode and saturating the out-of-range values.

Converts input vector x to a vector of two fp6 values of the kind specified by fp6_interpretation parameter, using rounding mode specified by rounding parameter. Large out-of-range values saturate to MAXNORM of the same sign. NaN input values result in positive MAXNORM.

  • The __mt_fp6x2_storage_t value holds the result of conversion.

__musa_cvt_fp6_to_halfraw

__half_raw __musa_cvt_fp6_to_halfraw(const __mt_fp6_storage_t x, const __mt_fp6_interpretation_t fp6_interpretation)

Converts input fp6 x of the specified kind to half precision.

Converts input x of fp6 type of the kind specified by fp6_interpretation parameter to half precision.

  • The __half_raw value holds the result of conversion.

__musa_cvt_fp6x2_to_halfraw2

__half2_raw __musa_cvt_fp6x2_to_halfraw2(const __mt_fp6x2_storage_t x, const __mt_fp6_interpretation_t fp6_interpretation)

Converts input vector of two fp6 values of the specified kind to a vector of two half precision values packed in __half2_raw structure.

Converts input vector x of fp6 type of the kind specified by fp6_interpretation parameter to a vector of two half precision values and returns as __half2_raw structure.

  • The __half2_raw value holds the result of conversion.

FP8 Intrinsics

Use FP8 intrinsics to convert values to and from compact 8-bit floating-point formats. These APIs are useful when a kernel explicitly controls FP8 storage, scaling factors, saturation behavior, or conversion between FP8 and half/bfloat16 data paths.

FP8 Conversion and Data Movement

__musa_cvt_float_to_fp8

__mt_fp8_storage_t __musa_cvt_float_to_fp8(const float x, const __musa_saturation_t saturate, const __mt_fp8_interpretation_t fp8_interpretation)

Converts input single precision x to fp8 type of the requested kind using round-to-nearest-even rounding and requested saturation mode.

Converts input x to fp8 type of the kind specified by fp8_interpretation parameter, using round-to-nearest-even rounding and saturation mode specified by saturate parameter.

  • The __mt_fp8_storage_t value holds the result of conversion.

__musa_cvt_halfraw_to_fp8

__mt_fp8_storage_t __musa_cvt_halfraw_to_fp8(const __half_raw x, const __musa_saturation_t saturate, const __mt_fp8_interpretation_t fp8_interpretation)

Converts input half precision x to fp8 type of the requested kind using round-to-nearest-even rounding and requested saturation mode.

Converts input x to fp8 type of the kind specified by fp8_interpretation parameter, using round-to-nearest-even rounding and saturation mode specified by saturate parameter.

  • The __mt_fp8_storage_t value holds the result of conversion.

__musa_cvt_bfloat16raw_to_fp8

__mt_fp8_storage_t __musa_cvt_bfloat16raw_to_fp8(const __mt_bfloat16_raw x, const __musa_saturation_t saturate, const __mt_fp8_interpretation_t fp8_interpretation)

Converts input __mt_bfloat16_raw precision x to fp8 type of the requested kind using round-to-nearest-even rounding and requested saturation mode.

Converts input x to fp8 type of the kind specified by fp8_interpretation parameter, using round-to-nearest-even rounding and saturation mode specified by saturate parameter.

  • The __mt_fp8_storage_t value holds the result of conversion.

__musa_cvt_bfloat16raw_to_e8m0

__mt_fp8_storage_t __musa_cvt_bfloat16raw_to_e8m0(const __mt_bfloat16_raw x, const __musa_saturation_t saturate, const enum musaRoundMode rounding)

Converts input bfloat16 input into a scaling factor of e8m0 kind.

Input number's absolute value is rounded to the closest power of two in the direction specified via rounding parameter. Rounded results that are smaller than the smallest representable target format number 2^-127 are then clipped to 2^-127. Results that are larger than the largest representable target format number 2^127 are either clipped to 2^127 if saturate equals to __MT_SATFINITE, or convert to NaN otherwise. NaN inputs convert into NaN output, encoded as 0xFF in the target format.

  • The __mt_fp8_storage_t value holds the result of conversion.

__musa_cvt_bfloat162raw_to_e8m0x2

__mt_fp8x2_storage_t __musa_cvt_bfloat162raw_to_e8m0x2(const __mt_bfloat162_raw x, const __musa_saturation_t saturate, const enum musaRoundMode rounding)

Converts a pair of bfloat16 values into a pair of scaling factors of e8m0 kind.

__musa_cvt_bfloat16raw_to_e8m0() for details of conversion.

  • The __mt_fp8x2_storage_t value holds the result of conversion.

__musa_cvt_float_to_e8m0

__mt_fp8_storage_t __musa_cvt_float_to_e8m0(const float x, const __musa_saturation_t saturate, const enum musaRoundMode rounding)

Converts input float value into a scaling factor of e8m0 kind.

__musa_cvt_bfloat16raw_to_e8m0() for details of conversion.

  • The __mt_fp8_storage_t value holds the result of conversion.

__musa_cvt_float2_to_e8m0x2

__mt_fp8x2_storage_t __musa_cvt_float2_to_e8m0x2(const float2 x, const __musa_saturation_t saturate, const enum musaRoundMode rounding)

Converts a pair of float values into a pair of scaling factors of e8m0 kind.

__musa_cvt_bfloat16raw_to_e8m0() for details of conversion.

  • The __mt_fp8x2_storage_t value holds the result of conversion.

__musa_cvt_double_to_e8m0

__mt_fp8_storage_t __musa_cvt_double_to_e8m0(const double x, const __musa_saturation_t saturate, const enum musaRoundMode rounding)

Converts input double value into a scaling factor of e8m0 kind.

__musa_cvt_bfloat16raw_to_e8m0() for details of conversion.

  • The __mt_fp8_storage_t value holds the result of conversion.

__musa_cvt_double2_to_e8m0x2

__mt_fp8x2_storage_t __musa_cvt_double2_to_e8m0x2(const double2 x, const __musa_saturation_t saturate, const enum musaRoundMode rounding)

Converts a pair of double values into a pair of scaling factors of e8m0 kind.

__musa_cvt_bfloat16raw_to_e8m0() for details of conversion.

  • The __mt_fp8x2_storage_t value holds the result of conversion.

__musa_cvt_e8m0_to_bf16raw

__mt_bfloat16_raw __musa_cvt_e8m0_to_bf16raw(const __mt_fp8_storage_t x)

Converts input scaling factor value of e8m0 kind into bfloat16.

Input scales are exact powers of two or a NaN value, also representable in the target format.

  • The __mt_bfloat16_raw value holds the result of conversion.

__musa_cvt_e8m0x2_to_bf162raw

__mt_bfloat162_raw __musa_cvt_e8m0x2_to_bf162raw(const __mt_fp8x2_storage_t x)

Converts input pair of scaling factors of e8m0 kind into a pair of bfloat16 values.

  • The __mt_bfloat162_raw value holds the result of conversion.

Half Precision Intrinsics

Use half precision intrinsics for device code that stores or computes with 16-bit floating-point values. Scalar __half APIs operate on one half value; __half2 APIs operate on two packed half values and are useful when a kernel can process two lanes with the same operation.

Half Precision Conversion and Data

__double2half

__half __double2half(const double a)

Converts double number to half precision in round-to-nearest-even mode and returns half with converted value.

Converts double number a to half precision in round-to-nearest-even mode.

Parameters

  • a (in): double

Returns

  • half
  • a converted to half.

__float22half2_rn

__half2 __float22half2_rn(const float2 a)

Converts both components of float2 number to half precision in round-to-nearest-even mode and returns half2 with converted values.

Converts both components of float2 to half precision in round-to-nearest mode and combines the results into one half2 number. Low 16 bits of the return value correspond to a.x and high 16 bits of the return value correspond to a.y.

converted float2 components.

Parameters

  • a (in): float2..

Returns

  • half2
  • The half2 which has corresponding halves equal to the

__float2half

__half __float2half(const float a)

Converts float number to half precision in round-to-nearest-even mode and returns half with converted value.

Converts float number a to half precision in round-to-nearest-even mode.

Parameters

  • a (in): float

Returns

  • half
  • a converted to half.

__float2half2_rn

__half2 __float2half2_rn(const float a)

Converts input to half precision in round-to-nearest-even mode and populates both halves of half2 with converted value.

Converts input a to half precision in round-to-nearest-even mode and populates both halves of half2 with converted value.

float

precision number.

Parameters

  • a (in):

Returns

  • half2
  • The half2 value with both halves equal to the converted half

__float2half_rd

__half __float2half_rd(const float a)

Converts float number to half precision in round-down mode and returns half with converted value.

Converts float number a to half precision in round-down mode.

Parameters

  • a (in): float

Returns

  • half
  • a converted to half.

__float2half_rn

__half __float2half_rn(const float a)

Converts float number to half precision in round-to-nearest-even mode and returns half with converted value.

Converts float number a to half precision in round-to-nearest-even mode.

Parameters

  • a (in): float

Returns

  • half
  • a converted to half.

__float2half_ru

__half __float2half_ru(const float a)

Converts float number to half precision in round-up mode and returns half with converted value.

Converts float number a to half precision in round-up mode.

Parameters

  • a (in): float

Returns

  • half
  • a converted to half.

__float2half_rz

__half __float2half_rz(const float a)

Converts float number to half precision in round-towards-zero mode and returns half with converted value.

Converts float number a to half precision in round-towards-zero mode.

converted to half.

Parameters

  • a (in): float

Returns

  • half
  • a

__floats2half2_rn

__half2 __floats2half2_rn(const float a, const float b)

Converts both input floats to half precision in round-to-nearest-even mode and returns half2 with converted values.

Converts both input floats to half precision in round-to-nearest-even mode and combines the results into one half2 number. Low 16 bits of the return value correspond to the input a, high 16 bits correspond to the input b.

converted input floats.

Parameters

  • a (in): float
  • b (in): float

Returns

  • half2
  • The half2 value with corresponding halves equal to the

Half2 Arithmetic Functions

__h2div

__half2 __h2div(const __half2 a, const __half2 b)

Performs half2 vector division in round-to-nearest-even mode.

Divides half2 input vector a by input vector b in round-to-nearest mode.

Parameters

  • a (in): half2..
  • b (in): half2..

Returns

  • half2
  • The elementwise division of a with b.

Half Arithmetic Functions

__habs

__half __habs(const __half a)

Calculates the absolute value of input half number and returns the result.

Calculates the absolute value of input half number and returns the result.

Parameters

  • a (in): half

Returns

  • half
  • The absolute value of a.

Half2 Arithmetic Functions

__habs2

__half2 __habs2(const __half2 a)

Calculates the absolute value of both halves of the input half2 number and returns the result.

Calculates the absolute value of both halves of the input half2 number and returns the result.

Parameters

  • a (in): half2..

Returns

  • half2
  • Returns a with the absolute value of both halves.

Half Arithmetic Functions

__hadd

__half __hadd(const __half a, const __half b)

Performs half addition in round-to-nearest-even mode.

Performs half addition of inputs a and b, in round-to-nearest-even mode.

Parameters

  • a (in): half
  • b (in): half

Returns

  • half
  • The sum of a and b.

Half2 Arithmetic Functions

__hadd2

__half2 __hadd2(const __half2 a, const __half2 b)

Performs half2 vector addition in round-to-nearest-even mode.

Performs half2 vector add of inputs a and b, in round-to-nearest mode.

Parameters

  • a (in): half2..
  • b (in): half2..

Returns

  • half2
  • The sum of vectors a and b.

__hadd2_rn

__half2 __hadd2_rn(const __half2 a, const __half2 b)

Performs half2 vector addition in round-to-nearest-even mode. Prevents floating-point contractions of mul+add into fma.

Performs half2 vector add of inputs a and b, in round-to-nearest mode.

Parameters

  • a (in): half2..
  • b (in): half2..

Returns

  • half2
  • The sum of a and b, with respect to saturation.

__hadd2_sat

__half2 __hadd2_sat(const __half2 a, const __half2 b)

Performs half2 vector addition in round-to-nearest-even mode, with saturation to [0.0, 1.0].

Performs half2 vector add of inputs a and b, in round-to-nearest mode, and clamps the results to range [0.0, 1.0]. NaN results are flushed to +0.0.

Parameters

  • a (in): half2..
  • b (in): half2..

Returns

  • half2
  • The sum of a and b, with respect to saturation.

Half Arithmetic Functions

__hadd_rn

__half __hadd_rn(const __half a, const __half b)

Performs half addition in round-to-nearest-even mode. Prevents floating-point contractions of mul+add into fma.

Performs half addition of inputs a and b, in round-to-nearest-even mode.

Parameters

  • a (in): half
  • b (in): half

Returns

  • half
  • The sum of a and b.

__hadd_sat

__half __hadd_sat(const __half a, const __half b)

Performs half addition in round-to-nearest-even mode, with saturation to [0.0, 1.0].

Performs half add of inputs a and b, in round-to-nearest-even mode, and clamps the result to range [0.0, 1.0]. NaN results are flushed to +0.0.

Parameters

  • a (in): half
  • b (in): half

Returns

  • half
  • The sum of a and b, with respect to saturation.

Half Precision Conversion and Data Movement 69

__half

__half(const __half_raw &hr)

Constructor from __half_raw .

__half

__half()

Constructor from default .

__half

explicit __half(const __mt_bfloat16 f)

Construct __half from __mt_bfloat16 input using default round-to-nearest-even round-ing mode.

__half

__half(const float f)

Construct __half from float input using default round-to-nearest-even rounding mode.

__half

__half(const double f)

Construct __half from double input using default round-to-nearest-even rounding mode.

__half

__half(const short val)

Construct __half from short integer input using default round-to-nearest-even rounding mode.

__half

__half(const unsigned short val)

Construct __half from short integer input using default round-to-nearest-even rounding mode.

__half

__half(const int val)

Construct __half from integer input using default round-to-nearest-even rounding mode.

__half

__half(const unsigned int val)

Construct __half from unsigned int input using default round-to-nearest-even rounding mode.

__half

__half(const long val)

Construct __half from long input using default round-to-nearest-even rounding mode.

__half

__half(const unsigned long val)

Construct __half from unsigned long input using default round-to-nearest-even rounding mode.

__half

__half(const long long val)

Construct __half from long long input using default round-to-nearest-even rounding mode.

__half

__half(const unsigned long long val)

Construct __half from unsigned long long input using default round-to-nearest-even rounding mode.

Half Precision Conversion and Data

__half2

__half2(const __half &a, const __half &b)

Constructor from two __half variables.

__half2

__half2()

Constructor from default.

__half2

__half2(const __half2 &src)

Copy constructor.

__half2

__half2(const __half2 &&src)

Move constructor, available for C++11 and later dialects.

__half2

__half2(const __half2_raw &h2r)

Constructor from __half2_raw .

__half22float2

float2 __half22float2(const __half2 a)

Converts both halves of half2 to float2 and returns the result.

Converts both halves of half2 input a to float2 and returns the result.

Parameters

  • a (in): half2..

Returns

  • float2
  • a converted to float2.

__half2char_rz

signed char __half2char_rz(const __half h)

Convert a half to a signed char in round-towards-zero mode.

Convert the half-precision floating-point value h to a signed char integer in round-towards-zero mode. NaN inputs are converted to 0.

Parameters

  • h (in): half

Returns

  • signed char
  • h converted to a signed char using round-towards-zero mode.

__half2float

float __half2float(const __half a)

Converts half number to float.

Converts half number a to float.

Parameters

  • a (in): float

Returns

  • float
  • a converted to float.

__half2half2

__half2 __half2half2(const __half a)

Returns half2 with both halves equal to the input value.

Returns half2 number with both halves equal to the input a half number.

Parameters

  • a (in): half

Returns

  • half2
  • The vector which has both its halves equal to the input a.

__half2int_rd

int __half2int_rd(const __half h)

Convert a half to a signed integer in round-down mode.

Convert the half-precision floating-point value h to a signed integer in round-down mode.

Parameters

  • h (in): half

Returns

  • int
  • h converted to a signed integer.

__half2int_rn

int __half2int_rn(const __half h)

Convert a half to a signed integer in round-to-nearest-even mode.

Convert the half-precision floating-point value h to a signed integer in round-to-nearest-even mode. NaN inputs are converted to 0.

Parameters

  • h (in): half. Is only being

Returns

  • int
  • h converted to a signed integer.

__half2int_ru

int __half2int_ru(const __half h)

Convert a half to a signed integer in round-up mode.

Convert the half-precision floating-point value h to a signed integer in round-up mode.

Parameters

  • h (in): half

Returns

  • int
  • h converted to a signed integer.

__half2int_rz

int __half2int_rz(const __half h)

Convert a half to a signed integer in round-towards-zero mode.

Convert the half-precision floating-point value h to a signed integer in round-towards-zero mode.

Parameters

  • h (in): - half. Is only being read.

Returns

  • int
  • h converted to a signed integer using round-towards-zero mode.
  • __half2int_rz (±0) returns 0.
  • __half2int_rz (+∞) returns INT_MAX = 0x7FFFFFFF.
  • __half2int_rz (−∞) returns INT_MIN = 0x80000000.
  • __half2int_rz(NaN) returns 0.

__half2ll_rd

long long int __half2ll_rd(const __half h)

Convert a half to a signed 64-bit integer in round-down mode.

Convert the half-precision floating-point value h to a signed 64-bit integer in round-down mode.

Parameters

  • h (in): half

Returns

  • long long int
  • h converted to a signed 64-bit integer.

__half2ll_rn

long long int __half2ll_rn(const __half h)

Convert a half to a signed 64-bit integer in round-to-nearest-even mode.

Convert the half-precision floating-point value h to a signed 64-bit integer in round-to-nearest-even mode.

being.

Parameters

  • h (in): half. Is only

Returns

  • long long int
  • h converted to a signed 64-bit integer.

__half2ll_ru

long long int __half2ll_ru(const __half h)

Convert a half to a signed 64-bit integer in round-up mode.

Convert the half-precision floating-point value h to a signed 64-bit integer in round-up mode.

Parameters

  • h (in): half

Returns

  • long long int
  • h converted to a signed 64-bit integer.

__half2ll_rz

long long int __half2ll_rz(const __half h)

Convert a half to a signed 64-bit integer in round-towards-zero mode.

Convert the half-precision floating-point value h to a signed 64-bit integer in round-towards-zero mode.

read.

Parameters

  • h (in): half. Is only being

Returns

  • long long int
  • h converted to a signed 64-bit integer.

__half2short_rd

short int __half2short_rd(const __half h)

Convert a half to a signed short integer in round-down mode.

Convert the half-precision floating-point value h to a signed short integer in round-down mode.

Parameters

  • h (in): half

Returns

  • short int
  • h converted to a signed short integer.

Half Precision Conversion and Data Movement 69

__half2short_rn

short int __half2short_rn(const __half h)

Convert a half to a signed short integer in round-to-nearest-even mode.

Convert the half-precision floating-point value h to a signed short integer in round-to-nearest-even mode.

being.

Parameters

  • h (in): half. Is only

Returns

  • short int
  • h converted to a signed short integer.

__half2short_ru

short int __half2short_ru(const __half h)

Convert a half to a signed short integer in round-up mode.

Convert the half-precision floating-point value h to a signed short integer in round-up mode.

Parameters

  • h (in): half

Returns

  • short int
  • h converted to a signed short integer.

__half2short_rz

short int __half2short_rz(const __half h)

Convert a half to a signed short integer in round-towards-zero mode.

Convert the half-precision floating-point value h to a signed short integer in round-towards-zero mode.

read.

Parameters

  • h (in): half. Is only being

Returns

  • short int
  • h converted to a signed short integer.

__half2uchar_rz

unsigned char __half2uchar_rz(const __half h)

Convert a half to an unsigned char in round-towards-zero mode.

Convert the half-precision floating-point value h to an unsigned char in round-towards-zero mode. NaN inputs are converted to 0.

Parameters

  • h (in): half

Returns

  • unsigned char
  • h converted to an unsigned char using round-towards-zero mode.

__half2uint_rd

unsigned int __half2uint_rd(const __half h)

Convert a half to an unsigned integer in round-down mode.

Convert the half-precision floating-point value h to an unsigned integer in round-down mode.

Parameters

  • h (in): half

Returns

  • unsigned int
  • h converted to an unsigned integer.

__half2uint_rn

unsigned int __half2uint_rn(const __half h)

Convert a half to an unsigned integer in round-to-nearest-even mode.

Convert the half-precision floating-point value h to an unsigned integer in round-to-nearest-even mode.

read.

Parameters

  • h (in): half. Is only being

Returns

  • unsigned int
  • h converted to an unsigned integer.

__half2uint_ru

unsigned int __half2uint_ru(const __half h)

Convert a half to an unsigned integer in round-up mode.

Convert the half-precision floating-point value h to an unsigned integer in round-up mode.

Parameters

  • h (in): half

Returns

  • unsigned int
  • h converted to an unsigned integer.

__half2uint_rz

unsigned int __half2uint_rz(const __half h)

Convert a half to an unsigned integer in round-towards-zero mode.

Convert the half-precision floating-point value h to an unsigned integer in round-towards-zero mode.

Parameters

  • h (in): half

Returns

  • unsigned int
  • h converted to an unsigned integer.

__half2ull_rd

unsigned long long int __half2ull_rd(const __half h)

Convert a half to an unsigned 64-bit integer in round-down mode.

Convert the half-precision floating-point value h to an unsigned 64-bit integer in round-down mode.

Parameters

  • h (in): half

Returns

  • unsigned long long int
  • h converted to an unsigned 64-bit integer.

__half2ull_rn

unsigned long long int __half2ull_rn(const __half h)

Convert a half to an unsigned 64-bit integer in round-to-nearest-even mode.

Convert the half-precision floating-point value h to an unsigned 64-bit integer in round-to-nearest-even mode.

being.

Parameters

  • h (in): half. Is only

Returns

  • unsigned long long int
  • h converted to an unsigned 64-bit integer.

__half2ull_ru

unsigned long long int __half2ull_ru(const __half h)

Convert a half to an unsigned 64-bit integer in round-up mode.

Convert the half-precision floating-point value h to an unsigned 64-bit integer in round-up mode.

Parameters

  • h (in): half

Returns

  • unsigned long long int
  • h converted to an unsigned 64-bit integer.

__half2ull_rz

unsigned long long int __half2ull_rz(const __half h)

Convert a half to an unsigned 64-bit integer in round-towards-zero mode.

Convert the half-precision floating-point value h to an unsigned 64-bit integer in round-towards-zero mode.

read.

Parameters

  • h (in): half. Is only being

Returns

  • unsigned long long int
  • h converted to an unsigned 64-bit integer.

__half2ushort_rd

unsigned short int __half2ushort_rd(const __half h)

Convert a half to an unsigned short integer in round-down mode.

Convert the half-precision floating-point value h to an unsigned short integer in round-down mode.

Parameters

  • h (in): half

Returns

  • unsigned short int
  • h converted to an unsigned short integer.

__half2ushort_rn

unsigned short int __half2ushort_rn(const __half h)

Convert a half to an unsigned short integer in round-to-nearest-even mode.

Convert the half-precision floating-point value h to an unsigned short integer in round-to-nearest-even mode.

being.

Parameters

  • h (in): half. Is only

Returns

  • unsigned short int
  • h converted to an unsigned short integer.

__half2ushort_ru

unsigned short int __half2ushort_ru(const __half h)

Convert a half to an unsigned short integer in round-up mode.

Convert the half-precision floating-point value h to an unsigned short integer in round-up mode.

Parameters

  • h (in): half

Returns

  • unsigned short int
  • h converted to an unsigned short integer.

__half2ushort_rz

unsigned short int __half2ushort_rz(const __half h)

Convert a half to an unsigned short integer in round-towards-zero mode.

Convert the half-precision floating-point value h to an unsigned short integer in round-towards-zero mode.

read.

Parameters

  • h (in): half. Is only being

Returns

  • unsigned short int
  • h converted to an unsigned short integer.

Half Precision Conversion and Data Movement 71

__half_as_short

short int __half_as_short(const __half h)

Reinterprets bits in a half as a signed short integer.

Reinterprets the bits in the half-precision floating-point number h as a signed short integer.

Parameters

  • h (in): half

Returns

  • short int
  • The reinterpreted value.

__half_as_ushort

unsigned short int __half_as_ushort(const __half h)

Reinterprets bits in a half as an unsigned short integer.

Reinterprets the bits in the half-precision floating-point h as an unsigned short number.

Parameters

  • h (in): half

Returns

  • unsigned short int
  • The reinterpreted value.

__halves2half2

__half2 __halves2half2(const __half a, const __half b)

Combines two half numbers into one half2 number.

Combines two input half number a and b into one half2 number. Input a is stored in low 16 bits of the return value, input b is stored in high 16 bits of the return value.

being.

Parameters

  • a (in): half. Is only
  • b (in): half

Returns

  • half2
  • The half2 with one half equal to a and the other to b.

Half2 Comparison Functions

__hbeq2

bool __hbeq2(const __half2 a, const __half2 b)

Performs half2 vector if-equal comparison and returns boolean true iff both half results are true, boolean false otherwise.

Performs half2 vector if-equal comparison of inputs a and b. The bool result is set to true only if both half if-equal comparisons evaluate to true, or false otherwise. NaN inputs generate false results.

of vectors a and b are true;

Parameters

  • a (in): half2..
  • b (in): half2..

Returns

  • bool
  • true if both half results of if-equal comparison
  • false otherwise.

__hbequ2

bool __hbequ2(const __half2 a, const __half2 b)

Performs half2 vector unordered if-equal comparison and returns boolean true iff both half results are true, boolean false otherwise.

Performs half2 vector if-equal comparison of inputs a and b. The bool result is set to true only if both half if-equal comparisons evaluate to true, or false otherwise. NaN inputs generate true results.

comparison of vectors a and b are true;

Parameters

  • a (in): half2..
  • b (in): half2..

Returns

  • bool
  • true if both half results of unordered if-equal
  • false otherwise.

__hbge2

bool __hbge2(const __half2 a, const __half2 b)

Performs half2 vector greater-equal comparison and returns boolean true iff both half results are true, boolean false otherwise.

Performs half2 vector greater-equal comparison of inputs a and b. The bool result is set to true only if both half greater-equal comparisons evaluate to true, or false otherwise. NaN inputs generate false results.

only.

comparison of vectors a and b are true;

Parameters

  • a (in): half2..
  • b (in): half2. Is

Returns

  • bool
  • true if both half results of greater-equal
  • false otherwise.

__hbgeu2

bool __hbgeu2(const __half2 a, const __half2 b)

Performs half2 vector unordered greater-equal comparison and returns boolean true iff both half results are true, boolean false otherwise.

Performs half2 vector greater-equal comparison of inputs a and b. The bool result is set to true only if both half greater-equal comparisons evaluate to true, or false otherwise. NaN inputs generate true results.

only.

greater-equal comparison of vectors a and b are true;

Parameters

  • a (in): half2..
  • b (in): half2. Is

Returns

  • bool
  • true if both half results of unordered
  • false otherwise.

__hbgt2

bool __hbgt2(const __half2 a, const __half2 b)

Performs half2 vector greater-than comparison and returns boolean true iff both half results are true, boolean false otherwise.

Performs half2 vector greater-than comparison of inputs a and b. The bool result is set to true only if both half greater-than comparisons evaluate to true, or false otherwise. NaN inputs generate false results.

only.

comparison of vectors a and b are true;

Parameters

  • a (in): half2..
  • b (in): half2. Is

Returns

  • bool
  • true if both half results of greater-than
  • false otherwise.

__hbgtu2

bool __hbgtu2(const __half2 a, const __half2 b)

Performs half2 vector unordered greater-than comparison and returns boolean true iff both half results are true, boolean false otherwise.

Performs half2 vector greater-than comparison of inputs a and b. The bool result is set to true only if both half greater-than comparisons evaluate to true, or false otherwise. NaN inputs generate true results.

only.

greater-than comparison of vectors a and b are true;

Parameters

  • a (in): half2..
  • b (in): half2. Is

Returns

  • bool
  • true if both half results of unordered
  • false otherwise.

__hble2

bool __hble2(const __half2 a, const __half2 b)

Performs half2 vector less-equal comparison and returns boolean true iff both half results are true, boolean false otherwise.

Performs half2 vector less-equal comparison of inputs a and b. The bool result is set to true only if both half less-equal comparisons evaluate to true, or false otherwise. NaN inputs generate false results.

of vectors a and b are true;

Parameters

  • a (in): half2..
  • b (in): half2..

Returns

  • bool
  • true if both half results of less-equal comparison
  • false otherwise.

__hbleu2

bool __hbleu2(const __half2 a, const __half2 b)

Performs half2 vector unordered less-equal comparison and returns boolean true iff both half results are true, boolean false otherwise.

Performs half2 vector less-equal comparison of inputs a and b. The bool result is set to true only if both half less-equal comparisons evaluate to true, or false otherwise. NaN inputs generate true results.

comparison of vectors a and b are true;

Parameters

  • a (in): half2..
  • b (in): half2..

Returns

  • bool
  • true if both half results of unordered less-equal
  • false otherwise.

__hblt2

bool __hblt2(const __half2 a, const __half2 b)

Performs half2 vector less-than comparison and returns boolean true iff both half results are true, boolean false otherwise.

Performs half2 vector less-than comparison of inputs a and b. The bool result is set to true only if both half less-than comparisons evaluate to true, or false otherwise. NaN inputs generate false results.

of vectors a and b are true;

Parameters

  • a (in): half2..
  • b (in): half2..

Returns

  • bool
  • true if both half results of less-than comparison
  • false otherwise.

__hbltu2

bool __hbltu2(const __half2 a, const __half2 b)

Performs half2 vector unordered less-than comparison and returns boolean true iff both half results are true, boolean false otherwise.

Performs half2 vector less-than comparison of inputs a and b. The bool result is set to true only if both half less-than comparisons evaluate to true, or false otherwise. NaN inputs generate true results.

vectors a and b are true;

Parameters

  • a (in): half2..
  • b (in): half2..

Returns

  • bool
  • true if both half results of unordered less-than comparison of
  • false otherwise.

__hbne2

bool __hbne2(const __half2 a, const __half2 b)

Performs half2 vector not-equal comparison and returns boolean true iff both half results are true, boolean false otherwise.

Performs half2 vector not-equal comparison of inputs a and b. The bool result is set to true only if both half not-equal comparisons evaluate to true, or false otherwise. NaN inputs generate false results.

of vectors a and b are true,

Parameters

  • a (in): half2..
  • b (in): half2..

Returns

  • bool
  • true if both half results of not-equal comparison
  • false otherwise.

__hbneu2

bool __hbneu2(const __half2 a, const __half2 b)

Performs half2 vector unordered not-equal comparison and returns boolean true iff both half results are true, boolean false otherwise.

Performs half2 vector not-equal comparison of inputs a and b. The bool result is set to true only if both half not-equal comparisons evaluate to true, or false otherwise. NaN inputs generate true results.

comparison of vectors a and b are true;

Parameters

  • a (in): half2..
  • b (in): half2..

Returns

  • bool
  • true if both half results of unordered not-equal
  • false otherwise.

Half2 Arithmetic Functions

__hcmadd

__half2 __hcmadd(const __half2 a, const __half2 b, const __half2 c)

Performs fast complex multiply-accumulate

Interprets vector half2 input pairs a, b, and c as complex numbers in half precision and performs complex multiply-accumulate operation: a*b + c

numbers a, b, and c

Parameters

  • a (in): half2..
  • b (in): half2..
  • c (in): half2..

Returns

  • half2
  • The result of complex multiply-accumulate operation on complex

Half Arithmetic Functions

__hdiv

__half __hdiv(const __half a, const __half b)

Performs half division in round-to-nearest-even mode.

Divides half input a by input b in round-to-nearest mode.

Parameters

  • a (in): half
  • b (in): half

Returns

  • half
  • The result of dividing a by b.

Half Comparison Functions

__heq

bool __heq(const __half a, const __half b)

Performs half if-equal comparison.

Performs half if-equal comparison of inputs a and b. NaN inputs generate false results.

Parameters

  • a (in): half
  • b (in): half

Returns

  • bool
  • The boolean result of if-equal comparison of a and b.

Half2 Comparison Functions

__heq2

__half2 __heq2(const __half2 a, const __half2 b)

Performs half2 vector if-equal comparison.

Performs half2 vector if-equal comparison of inputs a and b. The corresponding half results are set to 1.0 for true, or 0.0 for false. NaN inputs generate false results.

read.

Parameters

  • a (in): half2. Is only being
  • b (in): half2..

Returns

  • half2
  • The vector result of if-equal comparison of vectors a and b.

Half Comparison Functions

__hequ

bool __hequ(const __half a, const __half b)

Performs half unordered if-equal comparison.

Performs half if-equal comparison of inputs a and b. NaN inputs generate true results.

b.

Parameters

  • a (in): half
  • b (in): half

Returns

  • bool
  • The boolean result of unordered if-equal comparison of a and

Half2 Comparison Functions

__hequ2

__half2 __hequ2(const __half2 a, const __half2 b)

Performs half2 vector unordered if-equal comparison.

Performs half2 vector if-equal comparison of inputs a and b. The corresponding half results are set to 1.0 for true, or 0.0 for false. NaN inputs generate true results.

read.

and b.

Parameters

  • a (in): half2. Is only being
  • b (in): half2..

Returns

  • half2
  • The vector result of unordered if-equal comparison of vectors a

Half Arithmetic Functions

__hfma

__half __hfma(const __half a, const __half b, const __half c)

Performs half fused multiply-add in round-to-nearest-even mode.

Performs half multiply on inputs a and b, then performs a half add of the result with c, rounding the result once in round-to-nearest-even mode.

Parameters

  • a (in): half
  • b (in): half
  • c (in): half

Returns

  • half
  • The result of fused multiply-add operation on a, b, and c.

Half2 Arithmetic Functions

__hfma2

__half2 __hfma2(const __half2 a, const __half2 b, const __half2 c)

Performs half2 vector fused multiply-add in round-to-nearest-even mode.

Performs half2 vector multiply on inputs a and b, then performs a half2 vector add of the result with c, rounding the result once in round-to-nearest-even mode.

Parameters

  • a (in): half2..
  • b (in): half2..
  • c (in): half2..

Returns

  • half2
  • The result of elementwise fused multiply-add operation on vectors a, b, and c.

__hfma2_sat

__half2 __hfma2_sat(const __half2 a, const __half2 b, const __half2 c)

Performs half2 vector fused multiply-add in round-to-nearest-even mode, with saturation to [0.0, 1.0].

Performs half2 vector multiply on inputs a and b, then performs a half2 vector add of the result with c, rounding the result once in round-to-nearest-even mode, and clamps the results to range [0.0, 1.0]. NaN results are flushed to +0.0.

Parameters

  • a (in): half2..
  • b (in): half2..
  • c (in): half2..

Returns

  • half2
  • The result of elementwise fused multiply-add operation on vectors a, b, and c, with respect to saturation.

Half Arithmetic Functions

__hfma_sat

__half __hfma_sat(const __half a, const __half b, const __half c)

Performs half fused multiply-add in round-to-nearest-even mode, with saturation to [0.0, 1.0].

Performs half multiply on inputs a and b, then performs a half add of the result with c, rounding the result once in round-to-nearest-even mode, and clamps the result to range [0.0, 1.0]. NaN results are flushed to +0.0.

Parameters

  • a (in): half
  • b (in): half
  • c (in): half

Returns

  • half
  • The result of fused multiply-add operation on a, b, and c, with respect to saturation.

Half Comparison Functions

__hge

bool __hge(const __half a, const __half b)

Performs half greater-equal comparison.

Performs half greater-equal comparison of inputs a and b. NaN inputs generate false results.

Parameters

  • a (in): half
  • b (in): half

Returns

  • bool
  • The boolean result of greater-equal comparison of a and b.

Half2 Comparison Functions 115

__hge2

__half2 __hge2(const __half2 a, const __half2 b)

Performs half2 vector greater-equal comparison.

Performs half2 vector greater-equal comparison of inputs a and b. The corresponding half results are set to 1.0 for true, or 0.0 for false. NaN inputs generate false results.

read.

Parameters

  • a (in): half2. Is only being
  • b (in): half2..

Returns

  • half2
  • The vector result of greater-equal comparison of vectors a and b.

__hge2_mask

unsigned __hge2_mask(const __half2 a, const __half2 b)

Performs half2 vector greater-equal comparison.

Performs half2 vector greater-equal comparison of inputs a and b. The corresponding half unsigned bits are set to 0xFFFF for true, or 0x0 for false. NaN inputs generate true results.

only.

vectors a and b.

Parameters

  • a (in): half2. Is
  • b (in): half2..

Returns

  • usigned int
  • The half2 vector result of greater-equal comparison of

Half Comparison Functions

__hgeu

bool __hgeu(const __half a, const __half b)

Performs half unordered greater-equal comparison.

Performs half greater-equal comparison of inputs a and b. NaN inputs generate true results.

and b.

Parameters

  • a (in): half
  • b (in): half

Returns

  • bool
  • The boolean result of unordered greater-equal comparison of a

Half2 Comparison Functions 115

__hgeu2

__half2 __hgeu2(const __half2 a, const __half2 b)

Performs half2 vector unordered greater-equal comparison.

Performs half2 vector greater-equal comparison of inputs a and b. The corresponding half results are set to 1.0 for true, or 0.0 for false. NaN inputs generate true results.

read.

vectors a and b.

Parameters

  • a (in): half2. Is only being
  • b (in): half2..

Returns

  • half2
  • The half2 vector result of unordered greater-equal comparison of

__hgeu2_mask

unsigned __hgeu2_mask(const __half2 a, const __half2 b)

Performs half2 vector unordered greater-equal comparison.

Performs half2 vector greater-equal comparison of inputs a and b. The corresponding half unsigned bits are set to 0xFFFF for true, or 0x0 for false. NaN inputs generate true results.

only.

vectors a and b.

Parameters

  • a (in): half2. Is
  • b (in): half2..

Returns

  • usigned int
  • The half2 vector result of unordered greater-equal comparison of

Half Comparison Functions

__hgt

bool __hgt(const __half a, const __half b)

Performs half greater-than comparison.

Performs half greater-than comparison of inputs a and b. NaN inputs generate false results.

Parameters

  • a (in): half
  • b (in): half

Returns

  • bool
  • The boolean result of greater-than comparison of a and b.

Half2 Comparison Functions 115

__hgt2

__half2 __hgt2(const __half2 a, const __half2 b)

Performs half2 vector greater-than comparison.

Performs half2 vector greater-than comparison of inputs a and b. The corresponding half results are set to 1.0 for true, or 0.0 for false. NaN inputs generate false results.

read.

Parameters

  • a (in): half2. Is only being
  • b (in): half2..

Returns

  • half2
  • The vector result of greater-than comparison of vectors a and b.

__hgt2_mask

unsigned __hgt2_mask(const __half2 a, const __half2 b)

Performs half2 vector greater-than comparison.

Performs half2 vector greater-than comparison of inputs a and b. The corresponding half unsigned bits are set to 0xFFFF for true, or 0x0 for false. NaN inputs generate false results.

only.

Parameters

  • a (in): half2. Is
  • b (in): half2..

Returns

  • unsigned int
  • The vector result of greater-than comparison of vectors a and b.

Half Comparison Functions

__hgtu

bool __hgtu(const __half a, const __half b)

Performs half unordered greater-than comparison.

Performs half greater-than comparison of inputs a and b. NaN inputs generate true results.

and b.

Parameters

  • a (in): half
  • b (in): half

Returns

  • bool
  • The boolean result of unordered greater-than comparison of a

Half2 Comparison Functions 115

__hgtu2

__half2 __hgtu2(const __half2 a, const __half2 b)

Performs half2 vector unordered greater-than comparison.

Performs half2 vector greater-than comparison of inputs a and b. The corresponding half results are set to 1.0 for true, or 0.0 for false. NaN inputs generate true results.

read.

vectors a and b.

Parameters

  • a (in): half2. Is only being
  • b (in): half2..

Returns

  • half2
  • The half2 vector result of unordered greater-than comparison of

__hgtu2_mask

unsigned __hgtu2_mask(const __half2 a, const __half2 b)

Performs half2 vector unordered greater-than comparison.

Performs half2 vector greater-than comparison of inputs a and b. The corresponding half unsigned bits are set to 0xFFFF for true, or 0x0 for false. NaN inputs generate true results.

only.

Parameters

  • a (in): half2. Is
  • b (in): half2..

Returns

  • unsigned int
  • The vector result of unordered greater-than comparison of vectors a and b.

Half Precision Conversion and Data Movement 71

__high2float

float __high2float(const __half2 a)

Converts high 16 bits of half2 to float and returns the result

Converts high 16 bits of half2 input a to 32-bit floating-point number and returns the result.

being.

Parameters

  • a (in): half2. Is only

Returns

  • float
  • The high 16 bits of a converted to float.

__high2half

__half __high2half(const __half2 a)

Returns high 16 bits of half2 input.

Returns high 16 bits of half2 input a.

Parameters

  • a (in): half2..

Returns

  • half
  • The high 16 bits of the input.

__high2half2

__half2 __high2half2(const __half2 a)

Extracts high 16 bits from half2 input.

Extracts high 16 bits from half2 input a and returns a new half2 number which has both halves equal to the extracted bits.

  • half2..

Parameters

  • a (in):

Returns

  • half2
  • The half2 with both halves equal to the high 16 bits of the input.

__highs2half2

__half2 __highs2half2(const __half2 a, const __half2 b)

Extracts high 16 bits from each of the two half2 inputs and combines into one half2 number.

Extracts high 16 bits from each of the two half2 inputs and combines into one half2 number. High 16 bits from input a is stored in low 16 bits of the return value, high 16 bits from input b is stored in high 16 bits of the return value.

Parameters

  • a (in): half2..
  • b (in): half2..

Returns

  • half2
  • The high 16 bits of a and of b.

Half Comparison Functions

__hisinf

int __hisinf(const __half a)

Checks if the input half number is infinite.

Checks if the input half number a is infinite.

Parameters

  • a (in): half

Returns

  • int
  • -1 iff a is equal to negative infinity,
  • 1 iff a is equal to positive infinity,
  • 0 otherwise.

__hisnan

bool __hisnan(const __half a)

Determine whether half argument is a NaN.

Determine whether half value a is a NaN.

Parameters

  • a (in): half

Returns

  • bool
  • true iff argument is NaN.

Half2 Comparison Functions 115

__hisnan2

__half2 __hisnan2(const __half2 a)

Determine whether half2 argument is a NaN.

Determine whether each half of input half2 number a is a NaN.

1.0 for NaN, 0.0 otherwise.

Parameters

  • a (in): half2..

Returns

  • half2
  • The half2 with the corresponding half results set to

Half Comparison Functions

__hle

bool __hle(const __half a, const __half b)

Performs half less-equal comparison.

Performs half less-equal comparison of inputs a and b. NaN inputs generate false results.

Parameters

  • a (in): half
  • b (in): half

Returns

  • bool
  • The boolean result of less-equal comparison of a and b.

Half2 Comparison Functions 115

__hle2

__half2 __hle2(const __half2 a, const __half2 b)

Performs half2 vector less-equal comparison.

Performs half2 vector less-equal comparison of inputs a and b. The corresponding half results are set to 1.0 for true, or 0.0 for false. NaN inputs generate false results.

read.

Parameters

  • a (in): half2. Is only being read.
  • b (in): half2. Is only being read.

Returns

  • half2
  • The half2 result of less-equal comparison of vectors a and b.

__hle2_mask

unsigned __hle2_mask(const __half2 a, const __half2 b)

Performs half2 vector less-equal comparison.

Performs half2 vector less-equal comparison of inputs a and b. The corresponding half unsigned bits are set to 0xFFFF for true, or 0x0 for false. NaN inputs generate false results.

only.

Parameters

  • a (in): half2. Is
  • b (in): half2..

Returns

  • unsigned int
  • The half2 result of less-equal comparison of vectors a and b.

Half Comparison Functions

__hleu

bool __hleu(const __half a, const __half b)

Performs half unordered less-equal comparison.

Performs half less-equal comparison of inputs a and b. NaN inputs generate true results.

b.

Parameters

  • a (in): half
  • b (in): half

Returns

  • bool
  • The boolean result of unordered less-equal comparison of a and

Half2 Comparison Functions 115

__hleu2

__half2 __hleu2(const __half2 a, const __half2 b)

Performs half2 vector unordered less-equal comparison.

Performs half2 vector less-equal comparison of inputs a and b. The corresponding half results are set to 1.0 for true, or 0.0 for false. NaN inputs generate true results.

and b.

Parameters

  • a (in): half2..
  • b (in): half2..

Returns

  • half2
  • The vector result of unordered less-equal comparison of vectors a

__hleu2_mask

unsigned __hleu2_mask(const __half2 a, const __half2 b)

Performs half2 vector unordered less-equal comparison.

Performs half2 vector less-equal comparison of inputs a and b. The corresponding half unsigned bits are set to 0xFFFF for true, or 0x0 for false. NaN inputs generate true results.

and b.

Parameters

  • a (in): half2..
  • b (in): half2..

Returns

  • unsigned int
  • The vector result of unordered less-equal comparison of vectors a

Half Comparison Functions

__hlt

bool __hlt(const __half a, const __half b)

Performs half less-than comparison.

Performs half less-than comparison of inputs a and b. NaN inputs generate false results.

Parameters

  • a (in): half
  • b (in): half

Returns

  • bool
  • The boolean result of less-than comparison of a and b.

Half2 Comparison Functions 115

__hlt2

__half2 __hlt2(const __half2 a, const __half2 b)

Performs half2 vector less-than comparison.

Performs half2 vector less-than comparison of inputs a and b. The corresponding half results are set to 1.0 for true, or 0.0 for false. NaN inputs generate false results.

read.

b.

Parameters

  • a (in): half2. Is only being
  • b (in): half2..

Returns

  • half2
  • The half2 vector result of less-than comparison of vectors a and

__hlt2_mask

unsigned __hlt2_mask(const __half2 a, const __half2 b)

Performs half2 vector less-than comparison.

Performs half2 vector less-than comparison of inputs a and b. The corresponding half unsigned bits are set to 0xFFFF for true, or 0x0 for false. NaN inputs generate false results.

only.

b.

Parameters

  • a (in): half2. Is
  • b (in): half2..

Returns

  • unsigned int
  • The half2 vector result of less-than comparison of vectors a and

Half Comparison Functions

__hltu

bool __hltu(const __half a, const __half b)

Performs half unordered less-than comparison.

Performs half less-than comparison of inputs a and b. NaN inputs generate true results.

b.

Parameters

  • a (in): half
  • b (in): half

Returns

  • bool
  • The boolean result of unordered less-than comparison of a and

Half2 Comparison Functions 115

__hltu2

__half2 __hltu2(const __half2 a, const __half2 b)

Performs half2 vector unordered less-than comparison.

Performs half2 vector less-than comparison of inputs a and b. The corresponding half results are set to 1.0 for true, or 0.0 for false. NaN inputs generate true results.

read.

and b.

Parameters

  • a (in): half2. Is only being
  • b (in): half2..

Returns

  • half2
  • The vector result of unordered less-than comparison of vectors a

__hltu2_mask

unsigned __hltu2_mask(const __half2 a, const __half2 b)

Performs half2 vector unordered less-than comparison.

Performs half2 vector less-than comparison of inputs a and b. The corresponding half unsigned bits are set to 0xFFFF for true, or 0x0 for false. NaN inputs generate true results.

only.

and b.

Parameters

  • a (in): half2. Is
  • b (in): half2..

Returns

  • unsigned int
  • The vector result of unordered less-than comparison of vectors a

Half Comparison Functions

__hmax

__half __hmax(const __half a, const __half b)

Calculates half maximum of two input values.

Calculates half max(a, b) defined as a > b ? a : b. - If either of inputs is NaN, the other input is returned. - If both inputs are NaNs, then canonical NaN is returned. - If values of both inputs are 0.0, then +0.0 > -0.0.

Parameters

  • a (in): half
  • b (in): half

Returns

  • half

Half2 Comparison Functions 115

__hmax2

__half2 __hmax2(const __half2 a, const __half2 b)

Calculates half2 vector maximum of two inputs.

Calculates half2 vector max(a, b). Elementwise half operation is defined as a > b ? a : b. - If either of inputs is NaN, the other input is returned. - If both inputs are NaNs, then canonical NaN is returned. - If values of both inputs are 0.0, then +0.0 > -0.0.

Parameters

  • a (in): half2..
  • b (in): half2..

Returns

  • half2
  • The result of elementwise maximum of vectors a and b

__hmax2_nan

__half2 __hmax2_nan(const __half2 a, const __half2 b)

Calculates half2 vector maximum of two inputs, NaNs pass through.

Calculates half2 vector max(a, b). Elementwise half operation is defined as a > b ? a : b. - If either of inputs is NaN, then canonical NaN is returned. - If values of both inputs are 0.0, then +0.0 > -0.0.

NaNs pass through

Parameters

  • a (in): half2..
  • b (in): half2..

Returns

  • half2
  • The result of elementwise maximum of vectors a and b, with

Half Comparison Functions

__hmax_nan

__half __hmax_nan(const __half a, const __half b)

Calculates half maximum of two input values, NaNs pass through.

Calculates half max(a, b) defined as a > b ? a : b. - If either of inputs is NaN, then canonical NaN is returned. - If values of both inputs are 0.0, then +0.0 > -0.0.

Parameters

  • a (in): half
  • b (in): half

Returns

  • half

__hmin

__half __hmin(const __half a, const __half b)

Calculates half minimum of two input values.

Calculates half min(a, b) defined as a < b ? a : b. - If either of inputs is NaN, the other input is returned. - If both inputs are NaNs, then canonical NaN is returned. - If values of both inputs are 0.0, then +0.0 > -0.0.

Parameters

  • a (in): half
  • b (in): half

Returns

  • half

Half2 Comparison Functions 115

__hmin2

__half2 __hmin2(const __half2 a, const __half2 b)

Calculates half2 vector minimum of two inputs.

Calculates half2 vector min(a, b). Elementwise half operation is defined as a < b ? a : b. - If either of inputs is NaN, the other input is returned. - If both inputs are NaNs, then canonical NaN is returned. - If values of both inputs are 0.0, then +0.0 > -0.0.

Parameters

  • a (in): half2..
  • b (in): half2..

Returns

  • half2
  • The result of elementwise minimum of vectors a and b

__hmin2_nan

__half2 __hmin2_nan(const __half2 a, const __half2 b)

Calculates half2 vector minimum of two inputs, NaNs pass through.

Calculates half2 vector min(a, b). Elementwise half operation is defined as a < b ? a : b. - If either of inputs is NaN, then canonical NaN is returned. - If values of both inputs are 0.0, then +0.0 > -0.0.

NaNs pass through

Parameters

  • a (in): half2..
  • b (in): half2..

Returns

  • half2
  • The result of elementwise minimum of vectors a and b, with

Half Comparison Functions

__hmin_nan

__half __hmin_nan(const __half a, const __half b)

Calculates half minimum of two input values, NaNs pass through.

Calculates half min(a, b) defined as a < b ? a : b. - If either of inputs is NaN, then canonical NaN is returned. - If values of both inputs are 0.0, then +0.0 > -0.0.

Parameters

  • a (in): half
  • b (in): half

Returns

  • half

Half Arithmetic Functions

__hmul

__half __hmul(const __half a, const __half b)

Performs half multiplication in round-to-nearest-even mode.

Performs half multiplication of inputs a and b, in round-to-nearest mode.

Parameters

  • a (in): half
  • b (in): half

Returns

  • half
  • The result of multiplying a and b.

Half2 Arithmetic Functions

__hmul2

__half2 __hmul2(const __half2 a, const __half2 b)

Performs half2 vector multiplication in round-to-nearest-even mode.

Performs half2 vector multiplication of inputs a and b, in round-to-nearest-even mode.

Parameters

  • a (in): half2..
  • b (in): half2..

Returns

  • half2
  • The result of elementwise multiplying the vectors a and b.

__hmul2_rn

__half2 __hmul2_rn(const __half2 a, const __half2 b)

Performs half2 vector multiplication in round-to-nearest-even mode. Prevents floating-point contractions of mul+add or sub into fma.

Performs half2 vector multiplication of inputs a and b, in round-to-nearest-even mode.

Parameters

  • a (in): half2..
  • b (in): half2..

Returns

  • half2
  • The result of elementwise multiplying the vectors a and b.

__hmul2_sat

__half2 __hmul2_sat(const __half2 a, const __half2 b)

Performs half2 vector multiplication in round-to-nearest-even mode, with saturation to [0.0, 1.0].

Performs half2 vector multiplication of inputs a and b, in round-to-nearest-even mode, and clamps the results to range [0.0, 1.0]. NaN results are flushed to +0.0.

with respect to saturation.

Parameters

  • a (in): half2..
  • b (in): half2..

Returns

  • half2
  • The result of elementwise multiplication of vectors a and b,

Half Arithmetic Functions

__hmul_rn

__half __hmul_rn(const __half a, const __half b)

Performs half multiplication in round-to-nearest-even mode. Prevents floating-point contractions of mul+add or sub into fma.

Performs half multiplication of inputs a and b, in round-to-nearest mode.

Parameters

  • a (in): half
  • b (in): half

Returns

  • half
  • The result of multiplying a and b.

__hmul_sat

__half __hmul_sat(const __half a, const __half b)

Performs half multiplication in round-to-nearest-even mode, with saturation to [0.0, 1.0].

Performs half multiplication of inputs a and b, in round-to-nearest mode, and clamps the result to range [0.0, 1.0]. NaN results are flushed to +0.0.

half

Parameters

  • a (in): half
  • b (in):

Returns

  • half
  • The result of multiplying a and b, with respect to saturation.

Half Comparison Functions

__hne

bool __hne(const __half a, const __half b)

Performs half not-equal comparison.

Performs half not-equal comparison of inputs a and b. NaN inputs generate false results.

Parameters

  • a (in): half
  • b (in): half

Returns

  • bool
  • The boolean result of not-equal comparison of a and b.

Half2 Comparison Functions 115

__hne2

__half2 __hne2(const __half2 a, const __half2 b)

Performs half2 vector not-equal comparison.

Performs half2 vector not-equal comparison of inputs a and b. The corresponding half results are set to 1.0 for true, or 0.0 for false. NaN inputs generate false results.

read.

Parameters

  • a (in): half2. Is only being
  • b (in): half2..

Returns

  • half2
  • The vector result of not-equal comparison of vectors a and b.

__hne2_mask

unsigned __hne2_mask(const __half2 a, const __half2 b)

Performs half2 vector not-equal comparison.

Performs half2 vector not-equal comparison of inputs a and b. The corresponding half unsigned bits are set to 0xFFFF for true, or 0x0 for false. NaN inputs generate false results.

only.

Parameters

  • a (in): half2. Is
  • b (in): half2..

Returns

  • unsigned int
  • The vector result of not-equal comparison of vectors a and b.

Half Arithmetic Functions

__hneg

__half __hneg(const __half a)

Negates input half number and returns the result.

Negates input half number and returns the result.

Parameters

  • a (in): half

Returns

  • half
  • minus a

Half2 Arithmetic Functions

__hneg2

__half2 __hneg2(const __half2 a)

Negates both halves of the input half2 number and returns the result.

Negates both halves of the input half2 number a and returns the result.

half2..

Parameters

  • a (in):

Returns

  • half2
  • Returns a with both halves negated.

Half Comparison Functions

__hneu

bool __hneu(const __half a, const __half b)

Performs half unordered not-equal comparison.

Performs half not-equal comparison of inputs a and b. NaN inputs generate true results.

b.

Parameters

  • a (in): half
  • b (in): half

Returns

  • bool
  • The boolean result of unordered not-equal comparison of a and

Half2 Comparison Functions 115

__hneu2

__half2 __hneu2(const __half2 a, const __half2 b)

Performs half2 vector unordered not-equal comparison.

Performs half2 vector not-equal comparison of inputs a and b. The corresponding half results are set to 1.0 for true, or 0.0 for false. NaN inputs generate true results.

read.

and b.

Parameters

  • a (in): half2. Is only being
  • b (in): half2..

Returns

  • half2
  • The vector result of unordered not-equal comparison of vectors a

__hneu2_mask

unsigned __hneu2_mask(const __half2 a, const __half2 b)

Performs half2 vector not-equal comparison.

Performs half2 vector unordered not-equal comparison of inputs a and b. The corresponding half unsigned bits are set to 0xFFFF for true, or 0x0 for false. NaN inputs generate false results.

half2..

and b.

Parameters

  • a (in):
  • b (in): half2..

Returns

  • unsigned int
  • The vector result of unordered not-equal comparison of vectors a

Half Arithmetic Functions

__hsub

__half __hsub(const __half a, const __half b)

Performs half subtraction in round-to-nearest-even mode.

Subtracts half input b from input a in round-to-nearest mode.

Parameters

  • a (in): half
  • b (in): half

Returns

  • half
  • The result of subtracting b from a.

Half2 Arithmetic Functions

__hsub2

__half2 __hsub2(const __half2 a, const __half2 b)

Performs half2 vector subtraction in round-to-nearest-even mode.

Subtracts half2 input vector b from input vector a in round-to-nearest-even mode.

Parameters

  • a (in): half2..
  • b (in): half2..

Returns

  • half2
  • The subtraction of vector b from a.

__hsub2_rn

__half2 __hsub2_rn(const __half2 a, const __half2 b)

Performs half2 vector subtraction in round-to-nearest-even mode. Prevents floating-point contractions of mul+sub into fma.

Subtracts half2 input vector b from input vector a in round-to-nearest-even mode.

Parameters

  • a (in): half2..
  • b (in): half2..

Returns

  • half2
  • The subtraction of vector b from a.

__hsub2_sat

__half2 __hsub2_sat(const __half2 a, const __half2 b)

Performs half2 vector subtraction in round-to-nearest-even mode, with saturation to [0.0, 1.0].

Subtracts half2 input vector b from input vector a in round-to-nearest-even mode, and clamps the results to range [0.0, 1.0]. NaN results are flushed to +0.0.

Parameters

  • a (in): half2..
  • b (in): half2..

Returns

  • half2
  • The subtraction of vector b from a, with respect to saturation.

Half Arithmetic Functions

__hsub_rn

__half __hsub_rn(const __half a, const __half b)

Performs half subtraction in round-to-nearest-even mode. Prevents floating-point contractions of mul+sub into fma.

Subtracts half input b from input a in round-to-nearest mode.

Parameters

  • a (in): half
  • b (in): half

Returns

  • half
  • The result of subtracting b from a.

__hsub_sat

__half __hsub_sat(const __half a, const __half b)

Performs half subtraction in round-to-nearest-even mode, with saturation to [0.0, 1.0].

Subtracts half input b from input a in round-to-nearest mode, and clamps the result to range [0.0, 1.0]. NaN results are flushed to +0.0.

saturation.

Parameters

  • a (in): half
  • b (in): half

Returns

  • half
  • The result of subtraction of b from a, with respect to

Half Precision Conversion and Data Movement 71

__int2half_rd

__half __int2half_rd(const int i)

Convert a signed integer to a half in round-down mode.

Convert the signed integer value i to a half-precision floating-point value in round-down mode.

read.

Parameters

  • i (in): int. Is only being

Returns

  • half
  • i converted to half.

__int2half_rn

__half __int2half_rn(const int i)

Convert a signed integer to a half in round-to-nearest-even mode.

Convert the signed integer value i to a half-precision floating-point value in round-to-nearest-even mode.

only.

Parameters

  • i (in): int. Is

Returns

  • half
  • i converted to half.

__int2half_ru

__half __int2half_ru(const int i)

Convert a signed integer to a half in round-up mode.

Convert the signed integer value i to a half-precision floating-point value in round-up mode.

read.

Parameters

  • i (in): int. Is only being

Returns

  • half
  • i converted to half.

__int2half_rz

__half __int2half_rz(const int i)

Convert a signed integer to a half in round-towards-zero mode.

Convert the signed integer value i to a half-precision floating-point value in round-towards-zero mode.

being.

Parameters

  • i (in): int. Is only

Returns

  • half
  • i converted to half.

__ldca

__half2 __ldca(const __half2 *const ptr)

Loads a value from the specified global memory address.

Parameters

  • ptr (in): source memory location to load from

Returns

  • The value loaded from ptr

__ldca

__half __ldca(const __half *const ptr)

Loads a value from the specified global memory address.

Parameters

  • ptr (in): source memory location to load from

Returns

  • The value loaded from ptr

__ldcg

__half2 __ldcg(const __half2 *const ptr)

Loads a value from the specified global memory address.

Parameters

  • ptr (in): source memory location to load from

Returns

  • The value loaded from ptr

__ldcg

__half __ldcg(const __half *const ptr)

Loads a value from the specified global memory address.

Parameters

  • ptr (in): source memory location to load from

Returns

  • The value loaded from ptr

__ldcs

__half2 __ldcs(const __half2 *const ptr)

Loads a value from the specified global memory address.

Parameters

  • ptr (in): source memory location to load from

Returns

  • The value loaded from ptr

__ldcs

__half __ldcs(const __half *const ptr)

Loads a value from the specified global memory address.

Parameters

  • ptr (in): source memory location to load from

Returns

  • The value loaded from ptr

__ldcv

__half2 __ldcv(const __half2 *const ptr)

Loads a value from the specified global memory address.

Parameters

  • ptr (in): source memory location to load from

Returns

  • The value loaded from ptr

__ldcv

__half __ldcv(const __half *const ptr)

Loads a value from the specified global memory address.

Parameters

  • ptr (in): source memory location to load from

Returns

  • The value loaded from ptr

__ldg

__half2 __ldg(const __half2 *const ptr)

Loads a value from the specified global memory address.

Parameters

  • ptr (in): source memory location to load from

Returns

  • The value loaded from ptr

__ldg

__half __ldg(const __half *const ptr)

Loads a value from the specified global memory address.

Parameters

  • ptr (in): source memory location to load from

Returns

  • The value loaded from ptr

__ll2half_rd

__half __ll2half_rd(const long long int i)

Convert a signed 64-bit integer to a half in round-down mode.

Convert the signed 64-bit integer value i to a half-precision floating-point value in round-down mode.

only.

Parameters

  • i (in): long long int. Is

Returns

  • half
  • i converted to half.

__ll2half_rn

__half __ll2half_rn(const long long int i)

Convert a signed 64-bit integer to a half in round-to-nearest-even mode.

Convert the signed 64-bit integer value i to a half-precision floating-point value in round-to-nearest-even mode.

int

Parameters

  • i (in): long long

Returns

  • half
  • i converted to half.

Half Precision Conversion and Data Movement 73

__ll2half_ru

__half __ll2half_ru(const long long int i)

Convert a signed 64-bit integer to a half in round-up mode.

Convert the signed 64-bit integer value i to a half-precision floating-point value in round-up mode.

being.

Parameters

  • i (in): long long int. Is only

Returns

  • half
  • i converted to half.

__ll2half_rz

__half __ll2half_rz(const long long int i)

Convert a signed 64-bit integer to a half in round-towards-zero mode.

Convert the signed 64-bit integer value i to a half-precision floating-point value in round-towards-zero mode.

int

Parameters

  • i (in): long long

Returns

  • half
  • i converted to half.

__low2float

float __low2float(const __half2 a)

Converts low 16 bits of half2 to float and returns the result

Converts low 16 bits of half2 input a to 32-bit floating-point number and returns the result.

Parameters

  • a (in): half2..

Returns

  • float
  • The low 16 bits of a converted to float.

__low2half

__half __low2half(const __half2 a)

Returns low 16 bits of half2 input.

Returns low 16 bits of half2 input a.

Parameters

  • a (in): half2..

Returns

  • half
  • Returns half which contains low 16 bits of the input a.

__low2half2

__half2 __low2half2(const __half2 a)

Extracts low 16 bits from half2 input.

Extracts low 16 bits from half2 input a and returns a new half2 number which has both halves equal to the extracted bits.

  • half2..

Parameters

  • a (in):

Returns

  • half2
  • The half2 with both halves equal to the low 16 bits of the input.

__lowhigh2highlow

__half2 __lowhigh2highlow(const __half2 a)

Swaps both halves of the half2 input.

Swaps both halves of the half2 input and returns a new half2 number with swapped halves.

Parameters

  • a (in): half2..

Returns

  • half2
  • a with its halves being swapped.

__lows2half2

__half2 __lows2half2(const __half2 a, const __half2 b)

Extracts low 16 bits from each of the two half2 inputs and combines into one half2 number.

Extracts low 16 bits from each of the two half2 inputs and combines into one half2 number. Low 16 bits from input a is stored in low 16 bits of the return value, low 16 bits from input b is stored in high 16 bits of the return value.

Parameters

  • a (in): half2..
  • b (in): half2..

Returns

  • half2
  • The low 16 bits of a and of b.

__shfl_down_sync

__half2 __shfl_down_sync(const unsigned mask, const __half2 var, const unsigned int delta, const int width)

Exchange a variable between threads within a warp. Copy from a thread with higher ID relative to the caller.

Calculates a source thread ID by adding delta to the caller's thread ID. The value of var held by the resulting thread ID is returned: this has the effect of shifting var down the warp by delta threads. If width is less than warpSize then each subsection of the warp behaves as a separate entity with a starting logical thread ID of 0. As for __shfl_up_sync(), the ID number of the source thread will not wrap around the value of width and so the upper delta threads will remain unchanged.

int

as half2. If the source thread ID is out of range or the source thread has exited, the calling thread's own var is returned.

Parameters

  • mask (in): unsigned
  • var (in): half2..
  • delta (in): int
  • width (in): int

Returns

  • Returns the 4-byte word referenced by var from the source thread ID

__shfl_down_sync

__half __shfl_down_sync(const unsigned mask, const __half var, const unsigned int delta, const int width)

Exchange a variable between threads within a warp. Copy from a thread with higher ID relative to the caller.

Calculates a source thread ID by adding delta to the caller's thread ID. The value of var held by the resulting thread ID is returned: this has the effect of shifting var down the warp by delta threads. If width is less than warpSize then each subsection of the warp behaves as a separate entity with a starting logical thread ID of 0. As for __shfl_up_sync(), the ID number of the source thread will not wrap around the value of width and so the upper delta threads will remain unchanged.

int

as half2. If the source thread ID is out of range or the source thread has exited, the calling thread's own var is returned.

Parameters

  • mask (in): unsigned
  • var (in): half2..
  • delta (in): int
  • width (in): int

Returns

  • Returns the 4-byte word referenced by var from the source thread ID

__shfl_sync

__half2 __shfl_sync(const unsigned mask, const __half2 var, const int delta, const int width)

Exchange a variable between threads within a warp. Direct copy from indexed thread.

Returns the value of var held by the thread whose ID is given by delta. If width is less than warpSize then each subsection of the warp behaves as a separate entity with a starting logical thread ID of 0. If delta is outside the range [0:width-1], the value returned corresponds to the value of var held by the delta modulo width (i.e. within the same subsection). width must have a value which is a power of 2; results are undefined if width is not a power of 2, or is a number greater than warpSize.

unsigned int

as half2. If the source thread ID is out of range or the source thread has exited, the calling thread's own var is returned.

Parameters

  • mask (in):
  • var (in): half2..
  • delta (in): int
  • width (in): int

Returns

  • Returns the 4-byte word referenced by var from the source thread ID

__shfl_sync

__half __shfl_sync(const unsigned mask, const __half var, const int delta, const int width)

Exchange a variable between threads within a warp. Direct copy from indexed thread.

Returns the value of var held by the thread whose ID is given by delta. If width is less than warpSize then each subsection of the warp behaves as a separate entity with a starting logical thread ID of 0. If delta is outside the range [0:width-1], the value returned corresponds to the value of var held by the delta modulo width (i.e. within the same subsection). width must have a value which is a power of 2; results are undefined if width is not a power of 2, or is a number greater than warpSize.

unsigned int

as half2. If the source thread ID is out of range or the source thread has exited, the calling thread's own var is returned.

Parameters

  • mask (in):
  • var (in): half2..
  • delta (in): int
  • width (in): int

Returns

  • Returns the 4-byte word referenced by var from the source thread ID

__shfl_up_sync

__half2 __shfl_up_sync(const unsigned mask, const __half2 var, const unsigned int delta, const int width)

Exchange a variable between threads within a warp. Copy from a thread with lower ID relative to the caller.

Calculates a source thread ID by subtracting delta from the caller's lane ID. The value of var held by the resulting lane ID is returned: in effect, var is shifted up the warp by delta threads. If width is less than warpSize then each subsection of the warp behaves as a separate entity with a starting logical thread ID of 0. The source thread index will not wrap around the value of width, so effectively the lower delta threads will be unchanged. width must have a value which is a power of 2; results are undefined if width is not a power of 2, or is a number greater than warpSize.

unsigned int

as half2. If the source thread ID is out of range or the source thread has exited, the calling thread's own var is returned.

Parameters

  • mask (in):
  • var (in): half2..
  • delta (in): int
  • width (in): int

Returns

  • Returns the 4-byte word referenced by var from the source thread ID

__shfl_up_sync

__half __shfl_up_sync(const unsigned mask, const __half var, const unsigned int delta, const int width)

Exchange a variable between threads within a warp. Copy from a thread with lower ID relative to the caller.

Calculates a source thread ID by subtracting delta from the caller's lane ID. The value of var held by the resulting lane ID is returned: in effect, var is shifted up the warp by delta threads. If width is less than warpSize then each subsection of the warp behaves as a separate entity with a starting logical thread ID of 0. The source thread index will not wrap around the value of width, so effectively the lower delta threads will be unchanged. width must have a value which is a power of 2; results are undefined if width is not a power of 2, or is a number greater than warpSize.

unsigned int

as half2. If the source thread ID is out of range or the source thread has exited, the calling thread's own var is returned.

Parameters

  • mask (in):
  • var (in): half2..
  • delta (in): int
  • width (in): int

Returns

  • Returns the 4-byte word referenced by var from the source thread ID

__shfl_xor_sync

__half2 __shfl_xor_sync(const unsigned mask, const __half2 var, const int delta, const int width)

Exchange a variable between threads within a warp. Copy from a thread based on bitwise XOR of own thread ID.

Calculates a source thread ID by performing a bitwise XOR of the caller's thread ID with mask: the value of var held by the resulting thread ID is returned. If width is less than warpSize then each group of width consecutive threads are able to access elements from earlier groups of threads, however if they attempt to access elements from later groups of threads their own value of var will be returned. This mode implements a butterfly addressing pattern such as is used in tree reduction and broadcast.

as half2. If the source thread ID is out of range or the source thread has exited, the calling thread's own var is returned.

Parameters

  • mask (in): unsigned int
  • var (in): half2..
  • delta (in): int
  • width (in): int

Returns

  • Returns the 4-byte word referenced by var from the source thread ID

__shfl_xor_sync

__half __shfl_xor_sync(const unsigned mask, const __half var, const int delta, const int width)

Exchange a variable between threads within a warp. Copy from a thread based on bitwise XOR of own thread ID.

Calculates a source thread ID by performing a bitwise XOR of the caller's thread ID with mask: the value of var held by the resulting thread ID is returned. If width is less than warpSize then each group of width consecutive threads are able to access elements from earlier groups of threads, however if they attempt to access elements from later groups of threads their own value of var will be returned. This mode implements a butterfly addressing pattern such as is used in tree reduction and broadcast.

as half2. If the source thread ID is out of range or the source thread has exited, the calling thread's own var is returned.

Parameters

  • mask (in): unsigned int
  • var (in): half2..
  • delta (in): int
  • width (in): int

Returns

  • Returns the 4-byte word referenced by var from the source thread ID

__short2half_rd

__half __short2half_rd(const short int i)

Convert a signed short integer to a half in round-down mode.

Convert the signed short integer value i to a half-precision floating-point value in round-down mode.

being.

Parameters

  • i (in): short int. Is only

Returns

  • half
  • i converted to half.

__short2half_rn

__half __short2half_rn(const short int i)

Convert a signed short integer to a half in round-to-nearest-even mode.

Convert the signed short integer value i to a half-precision floating-point value in round-to-nearest-even mode.

Is only.

Parameters

  • i (in): short int.

Returns

  • half
  • i converted to half.

__short2half_ru

__half __short2half_ru(const short int i)

Convert a signed short integer to a half in round-up mode.

Convert the signed short integer value i to a half-precision floating-point value in round-up mode.

being.

Parameters

  • i (in): short int. Is only

Returns

  • half
  • i converted to half.

__short2half_rz

__half __short2half_rz(const short int i)

Convert a signed short integer to a half in round-towards-zero mode.

Convert the signed short integer value i to a half-precision floating-point value in round-towards-zero mode.

only.

Parameters

  • i (in): short int. Is

Returns

  • half
  • i converted to half.

__short_as_half

__half __short_as_half(const short int i)

Reinterprets bits in a signed short integer as a half.

Reinterprets the bits in the signed short integer i as a half-precision floating-point number.

Parameters

  • i (in): short int

Returns

  • half
  • The reinterpreted value.

__stcg

void __stcg(__half2 *const ptr, const __half2 value)

Stores a value to the specified global memory address.

Parameters

  • ptr (out): destination memory location for the store
  • value (in): value to write to ptr

__stcg

void __stcg(__half *const ptr, const __half value)

Stores a value to the specified global memory address.

Parameters

  • ptr (out): destination memory location for the store
  • value (in): value to write to ptr

__stcs

void __stcs(__half2 *const ptr, const __half2 value)

Stores a value to the specified global memory address.

Parameters

  • ptr (out): destination memory location for the store
  • value (in): value to write to ptr

__stcs

void __stcs(__half *const ptr, const __half value)

Stores a value to the specified global memory address.

Parameters

  • ptr (out): destination memory location for the store
  • value (in): value to write to ptr

__stwb

void __stwb(__half2 *const ptr, const __half2 value)

Stores a value to the specified global memory address.

Parameters

  • ptr (out): destination memory location for the store
  • value (in): value to write to ptr

__stwb

void __stwb(__half *const ptr, const __half value)

Stores a value to the specified global memory address.

Parameters

  • ptr (out): destination memory location for the store
  • value (in): value to write to ptr

__stwt

void __stwt(__half2 *const ptr, const __half2 value)

Stores a value to the specified global memory address.

Parameters

  • ptr (out): destination memory location for the store
  • value (in): value to write to ptr

__stwt

void __stwt(__half *const ptr, const __half value)

Stores a value to the specified global memory address.

Parameters

  • ptr (out): destination memory location for the store
  • value (in): value to write to ptr

__uint2half_rd

__half __uint2half_rd(const unsigned int i)

Convert an unsigned integer to a half in round-down mode.

Convert the unsigned integer value i to a half-precision floating-point value in round-down mode.

being.

Parameters

  • i (in): unsigned int. Is only

Returns

  • half
  • i converted to half.

__uint2half_rn

__half __uint2half_rn(const unsigned int i)

Convert an unsigned integer to a half in round-to-nearest-even mode.

Convert the unsigned integer value i to a half-precision floating-point value in round-to-nearest-even mode.

int

Parameters

  • i (in): unsigned

Returns

  • half
  • i converted to half.

__uint2half_ru

__half __uint2half_ru(const unsigned int i)

Convert an unsigned integer to a half in round-up mode.

Convert the unsigned integer value i to a half-precision floating-point value in round-up mode.

being.

Parameters

  • i (in): unsigned int. Is only

Returns

  • half
  • i converted to half.

__uint2half_rz

__half __uint2half_rz(const unsigned int i)

Convert an unsigned integer to a half in round-towards-zero mode.

Convert the unsigned integer value i to a half-precision floating-point value in round-towards-zero mode.

Is only.

Parameters

  • i (in): unsigned int.

Returns

  • half
  • i converted to half.

__ull2half_rd

__half __ull2half_rd(const unsigned long long int i)

Convert an unsigned 64-bit integer to a half in round-down mode.

Convert the unsigned 64-bit integer value i to a half-precision floating-point value in round-down mode.

int

Parameters

  • i (in): unsigned long long

Returns

  • half
  • i converted to half.

__ull2half_rn

__half __ull2half_rn(const unsigned long long int i)

Convert an unsigned 64-bit integer to a half in round-to-nearest-even mode.

Convert the unsigned 64-bit integer value i to a half-precision floating-point value in round-to-nearest-even mode.

long long int

Parameters

  • i (in): unsigned

Returns

  • half
  • i converted to half.

__ull2half_ru

__half __ull2half_ru(const unsigned long long int i)

Convert an unsigned 64-bit integer to a half in round-up mode.

Convert the unsigned 64-bit integer value i to a half-precision floating-point value in round-up mode.

Is only.

Parameters

  • i (in): unsigned long long int.

Returns

  • half
  • i converted to half.

__ull2half_rz

__half __ull2half_rz(const unsigned long long int i)

Convert an unsigned 64-bit integer to a half in round-towards-zero mode.

Convert the unsigned 64-bit integer value i to a half-precision floating-point value in round-towards-zero mode.

long int

Parameters

  • i (in): unsigned long

Returns

  • half
  • i converted to half.

__ushort2half_rd

__half __ushort2half_rd(const unsigned short int i)

Convert an unsigned short integer to a half in round-down mode.

Convert the unsigned short integer value i to a half-precision floating-point value in round-down mode.

Is only.

Parameters

  • i (in): unsigned short int.

Returns

  • half
  • i converted to half.

__ushort2half_rn

__half __ushort2half_rn(const unsigned short int i)

Convert an unsigned short integer to a half in round-to-nearest-even mode.

Convert the unsigned short integer value i to a half-precision floating-point value in round-to-nearest-even mode.

short int

Parameters

  • i (in): unsigned

Returns

  • half
  • i converted to half.

__ushort2half_ru

__half __ushort2half_ru(const unsigned short int i)

Convert an unsigned short integer to a half in round-up mode.

Convert the unsigned short integer value i to a half-precision floating-point value in round-up mode.

only.

Parameters

  • i (in): unsigned short int. Is

Returns

  • half
  • i converted to half.

Half Precision Conversion and Data Movement 75

__ushort2half_rz

__half __ushort2half_rz(const unsigned short int i)

Convert an unsigned short integer to a half in round-towards-zero mode.

Convert the unsigned short integer value i to a half-precision floating-point value in round-towards-zero mode.

short int

Parameters

  • i (in): unsigned

Returns

  • half
  • i converted to half.

__ushort_as_half

__half __ushort_as_half(const unsigned short int i)

Reinterprets bits in an unsigned short integer as a half.

Reinterprets the bits in the unsigned short integer i as a half-precision floating-point number.

Parameters

  • i (in): unsigned short int

Returns

  • half
  • The reinterpreted value.

Half Arithmetic Functions

atomicAdd

__half2 atomicAdd(__half2 *const address, const __half2 val)

Adds val to the value stored at address in global or shared memory, and writes this value back to address .

atomicAdd

__half atomicAdd(__half *const address, const __half val)

Adds val to the value stored at address in global or shared memory, and writes this value back to address .

Half2 Math Functions

h2ceil

__half2 h2ceil(const __half2 h)

Calculate half2 vector ceiling of the input argument.

For each component of vector h compute the smallest integer value not less than h.

Parameters

  • h (in): half2..

Returns

  • half2
  • The vector of smallest integers not less than h.

h2cos

__half2 h2cos(const __half2 a)

Calculates half2 vector cosine in round-to-nearest-even mode.

Calculates half2 cosine of input vector a in round-to-nearest-even mode.

Parameters

  • a (in): half2..

Returns

  • half2
  • The elementwise cosine on vector a.

h2exp

__half2 h2exp(const __half2 a)

Calculates half2 vector exponential function in round-to-nearest mode.

Calculates half2 exponential function of input vector a in round-to-nearest-even mode.

Parameters

  • a (in): half2..

Returns

  • half2
  • The elementwise exponential function on vector a.

h2exp10

__half2 h2exp10(const __half2 a)

Calculates half2 vector decimal exponential function in round-to-nearest-even mode.

Calculates half2 decimal exponential function of input vector a in round-to-nearest-even mode.

Parameters

  • a (in): half2..

Returns

  • half2
  • The elementwise decimal exponential function on vector a.

h2exp2

__half2 h2exp2(const __half2 a)

Calculates half2 vector binary exponential function in round-to-nearest-even mode.

Calculates half2 binary exponential function of input vector a in round-to-nearest-even mode.

Parameters

  • a (in): half2..

Returns

  • half2
  • The elementwise binary exponential function on vector a.

h2floor

__half2 h2floor(const __half2 h)

Calculate the largest integer less than or equal to h.

For each component of vector h calculate the largest integer value which is less than or equal to h.

being.

Parameters

  • h (in): half2. Is only

Returns

  • half2
  • The vector of largest integers which is less than or equal to h.

h2log

__half2 h2log(const __half2 a)

Calculates half2 vector natural logarithm in round-to-nearest-even mode.

Calculates half2 natural logarithm of input vector a in round-to-nearest-even mode.

Parameters

  • a (in): half2..

Returns

  • half2
  • The elementwise natural logarithm on vector a.

h2log10

__half2 h2log10(const __half2 a)

Calculates half2 vector decimal logarithm in round-to-nearest-even mode.

Calculates half2 decimal logarithm of input vector a in round-to-nearest-even mode.

Parameters

  • a (in): half2..

Returns

  • half2
  • The elementwise decimal logarithm on vector a.

h2log2

__half2 h2log2(const __half2 a)

Calculates half2 vector binary logarithm in round-to-nearest-even mode.

Calculates half2 binary logarithm of input vector a in round-to-nearest mode.

Parameters

  • a (in): half2..

Returns

  • half2
  • The elementwise binary logarithm on vector a.

h2rcp

__half2 h2rcp(const __half2 a)

Calculates half2 vector reciprocal in round-to-nearest-even mode.

Calculates half2 reciprocal of input vector a in round-to-nearest-even mode.

Parameters

  • a (in): half2..

Returns

  • half2
  • The elementwise reciprocal on vector a.

h2rint

__half2 h2rint(const __half2 h)

Round input to nearest integer value in half-precision floating-point number.

Round each component of half2 vector h to the nearest integer value in half-precision floating-point format, with halfway cases rounded to the nearest even integer value.

Parameters

  • h (in): half2..

Returns

  • half2
  • The vector of rounded integer values.

h2rsqrt

__half2 h2rsqrt(const __half2 a)

Calculates half2 vector reciprocal square root in round-to-nearest mode.

Calculates half2 reciprocal square root of input vector a in round-to-nearest-even mode.

Parameters

  • a (in): half2..

Returns

  • half2
  • The elementwise reciprocal square root on vector a.

h2sin

__half2 h2sin(const __half2 a)

Calculates half2 vector sine in round-to-nearest-even mode.

Calculates half2 sine of input vector a in round-to-nearest-even mode.

Parameters

  • a (in): half2..

Returns

  • half2
  • The elementwise sine on vector a.

h2sqrt

__half2 h2sqrt(const __half2 a)

Calculates half2 vector square root in round-to-nearest-even mode.

Calculates half2 square root of input vector a in round-to-nearest mode.

Parameters

  • a (in): half2..

Returns

  • half2
  • The elementwise square root on vector a.

h2trunc

__half2 h2trunc(const __half2 h)

Truncate half2 vector input argument to the integral part.

Round each component of vector h to the nearest integer value that does not exceed h in magnitude.

read.

Parameters

  • h (in): half2. Is only being

Returns

  • half2
  • The truncated h.

Half Math Functions

hceil

__half hceil(const __half h)

Calculate ceiling of the input argument.

Compute the smallest integer value not less than h.

Parameters

  • h (in): half

Returns

  • half
  • The smallest integer value not less than h.

hcos

__half hcos(const __half a)

Calculates half cosine in round-to-nearest-even mode.

Calculates half cosine of input a in round-to-nearest-even mode.

Parameters

  • a (in): half

Returns

  • half
  • The cosine of a.

hexp

__half hexp(const __half a)

Calculates half natural exponential function in round-to-nearest mode.

Calculates half natural exponential function of input a in round-to-nearest-even mode.

Parameters

  • a (in): half

Returns

  • half
  • The natural exponential function on a.

hexp10

__half hexp10(const __half a)

Calculates half decimal exponential function in round-to-nearest mode.

Calculates half decimal exponential function of input a in round-to-nearest-even mode.

Parameters

  • a (in): half

Returns

  • half
  • The decimal exponential function on a.

hexp2

__half hexp2(const __half a)

Calculates half binary exponential function in round-to-nearest mode.

Calculates half binary exponential function of input a in round-to-nearest-even mode.

Parameters

  • a (in): half

Returns

  • half
  • The binary exponential function on a.

hfloor

__half hfloor(const __half h)

Calculate the largest integer less than or equal to h.

Calculate the largest integer value which is less than or equal to h.

Parameters

  • h (in): half

Returns

  • half
  • The largest integer value which is less than or equal to h.

hlog

__half hlog(const __half a)

Calculates half natural logarithm in round-to-nearest-even mode.

Calculates half natural logarithm of input a in round-to-nearest-even mode.

Parameters

  • a (in): half

Returns

  • half
  • The natural logarithm of a.

hlog10

__half hlog10(const __half a)

Calculates half decimal logarithm in round-to-nearest-even mode.

Calculates half decimal logarithm of input a in round-to-nearest-even mode.

Parameters

  • a (in): half

Returns

  • half
  • The decimal logarithm of a.

hlog2

__half hlog2(const __half a)

Calculates half binary logarithm in round-to-nearest-even mode.

Calculates half binary logarithm of input a in round-to-nearest-even mode.

Parameters

  • a (in): half

Returns

  • half
  • The binary logarithm of a.

hrcp

__half hrcp(const __half a)

Calculates half reciprocal in round-to-nearest-even mode.

Calculates half reciprocal of input a in round-to-nearest-even mode.

Parameters

  • a (in): half

Returns

  • half
  • The reciprocal of a.

hrint

__half hrint(const __half h)

Round input to nearest integer value in half-precision floating-point number.

Round h to the nearest integer value in half-precision floating-point format, with halfway cases rounded to the nearest even integer value.

Parameters

  • h (in): half

Returns

  • half
  • The nearest integer to h.

hrsqrt

__half hrsqrt(const __half a)

Calculates half reciprocal square root in round-to-nearest-even mode.

Calculates half reciprocal square root of input a in round-to-nearest mode.

Parameters

  • a (in): half

Returns

  • half
  • The reciprocal square root of a.

hsin

__half hsin(const __half a)

Calculates half sine in round-to-nearest-even mode.

Calculates half sine of input a in round-to-nearest-even mode.

Parameters

  • a (in): half

Returns

  • half
  • The sine of a.

hsqrt

__half hsqrt(const __half a)

Calculates half square root in round-to-nearest-even mode.

Calculates half square root of input a in round-to-nearest-even mode.

Parameters

  • a (in): half

Returns

  • half
  • The square root of a.

htanh

__half htanh(const __half a)

Calculates half hyperbolic tangent function in round-to-nearest-even mode.

Calculates half hyperbolic tangent function: _math_formula (a)_musa_math_formula in round-to-nearest-even mode.

Parameters

  • a (in): half

Returns

  • half
  • The hyperbolic tangent function of a.

htanh_approx

__half htanh_approx(const __half a)

Calculates approximate half hyperbolic tangent function.

Calculates approximate half hyperbolic tangent function.

Parameters

  • a (in): half

Returns

  • half
  • The approximate hyperbolic tangent function of a.

htrunc

__half htrunc(const __half h)

Truncate input argument to the integral part.

Round h to the nearest integer value that does not exceed h in magnitude.

Parameters

  • h (in): half

Returns

  • half
  • The truncated integer value.

Half Precision Conversion and Data Movement 75

make_half2

__half2 make_half2(const __half x, const __half y)

Vector function, combines two __half numbers into one __half2 number.

Bfloat16 Precision Intrinsics

Use bfloat16 intrinsics when the kernel needs the wider exponent range of bfloat16 with reduced mantissa precision. Scalar __mt_bfloat16 APIs operate on one value; __mt_bfloat162 APIs operate on two packed bfloat16 values.

Bfloat16 Precision Conversion and Data

__bfloat1622float2

float2 __bfloat1622float2(const __mt_bfloat162 a)

Converts both halves of mt_bfloat162 to float2 and returns the result.

Converts both halves of mt_bfloat162 input a to float2 and returns the result.

Parameters

  • a (in): mt_bfloat162

Returns

  • float2
  • a converted to float2.

__bfloat162bfloat162

__mt_bfloat162 __bfloat162bfloat162(const __mt_bfloat16 a)

Returns mt_bfloat162 with both halves equal to the input value.

Returns mt_bfloat162 number with both halves equal to the input a mt_bfloat16 number.

Parameters

  • a (in): mt_bfloat16

Returns

  • mt_bfloat162
  • The vector which has both its halves equal to the input a.

__bfloat162char_rz

signed char __bfloat162char_rz(const __mt_bfloat16 h)

Convert a mt_bfloat16 to a signed char in round-towards-zero mode.

Convert the mt_bfloat16 floating-point value h to a signed char in round-towards-zero mode. NaN inputs are converted to 0.

Parameters

  • h (in): mt_bfloat16

Returns

  • signed char
  • h converted to an signed char.

__bfloat162float

float __bfloat162float(const __mt_bfloat16 a)

Converts mt_bfloat16 number to float.

Converts mt_bfloat16 number a to float.

Parameters

  • a (in): float

Returns

  • float
  • a converted to float.

__bfloat162int_rd

int __bfloat162int_rd(const __mt_bfloat16 h)

Convert a mt_bfloat16 to a signed integer in round-down mode.

Convert the mt_bfloat16 floating-point value h to a signed integer in round-down mode.

Parameters

  • h (in): mt_bfloat16

Returns

  • int
  • h converted to a signed integer.

__bfloat162int_rn

int __bfloat162int_rn(const __mt_bfloat16 h)

Convert a mt_bfloat16 to a signed integer in round-to-nearest-even mode.

Convert the mt_bfloat16 floating-point value h to a signed integer in round-to-nearest-even mode.

being.

Parameters

  • h (in): mt_bfloat16. Is only

Returns

  • int
  • h converted to a signed integer.

__bfloat162int_ru

int __bfloat162int_ru(const __mt_bfloat16 h)

Convert a mt_bfloat16 to a signed integer in round-up mode.

Convert the mt_bfloat16 floating-point value h to a signed integer in round-up mode.

Parameters

  • h (in): mt_bfloat16

Returns

  • int
  • h converted to a signed integer.

__bfloat162int_rz

int __bfloat162int_rz(const __mt_bfloat16 h)

Convert a mt_bfloat16 to a signed integer in round-towards-zero mode.

Convert the mt_bfloat16 floating-point value h to a signed integer in round-towards-zero mode.

read.

Parameters

  • h (in): mt_bfloat16. Is only being

Returns

  • int
  • h converted to a signed integer.

__bfloat162ll_rd

long long int __bfloat162ll_rd(const __mt_bfloat16 h)

Convert a mt_bfloat16 to a signed 64-bit integer in round-down mode.

Convert the mt_bfloat16 floating-point value h to a signed 64-bit integer in round-down mode.

Parameters

  • h (in): mt_bfloat16

Returns

  • long long int
  • h converted to a signed 64-bit integer.

__bfloat162ll_rn

long long int __bfloat162ll_rn(const __mt_bfloat16 h)

Convert a mt_bfloat16 to a signed 64-bit integer in round-to-nearest-even mode.

Convert the mt_bfloat16 floating-point value h to a signed 64-bit integer in round-to-nearest-even mode.

Parameters

  • h (in): mt_bfloat16

Returns

  • long long int
  • h converted to a signed 64-bit integer.

__bfloat162ll_ru

long long int __bfloat162ll_ru(const __mt_bfloat16 h)

Convert a mt_bfloat16 to a signed 64-bit integer in round-up mode.

Convert the mt_bfloat16 floating-point value h to a signed 64-bit integer in round-up mode.

Parameters

  • h (in): mt_bfloat16

Returns

  • long long int
  • h converted to a signed 64-bit integer.

__bfloat162ll_rz

long long int __bfloat162ll_rz(const __mt_bfloat16 h)

Convert a mt_bfloat16 to a signed 64-bit integer in round-towards-zero mode.

Convert the mt_bfloat16 floating-point value h to a signed 64-bit integer in round-towards-zero mode.

Parameters

  • h (in): mt_bfloat16

Returns

  • long long int
  • h converted to a signed 64-bit integer.

__bfloat162short_rd

short int __bfloat162short_rd(const __mt_bfloat16 h)

Convert a mt_bfloat16 to a signed short integer in round-down mode.

Convert the mt_bfloat16 floating-point value h to a signed short integer in round-down mode.

Parameters

  • h (in): mt_bfloat16

Returns

  • short int
  • h converted to a signed short integer.

__bfloat162short_rn

short int __bfloat162short_rn(const __mt_bfloat16 h)

Convert a mt_bfloat16 to a signed short integer in round-to-nearest-even mode.

Convert the mt_bfloat16 floating-point value h to a signed short integer in round-to-nearest-even mode.

Parameters

  • h (in): mt_bfloat16

Returns

  • short int
  • h converted to a signed short integer.

__bfloat162short_ru

short int __bfloat162short_ru(const __mt_bfloat16 h)

Convert a mt_bfloat16 to a signed short integer in round-up mode.

Convert the mt_bfloat16 floating-point value h to a signed short integer in round-up mode.

Parameters

  • h (in): mt_bfloat16

Returns

  • short int
  • h converted to a signed short integer.

__bfloat162short_rz

short int __bfloat162short_rz(const __mt_bfloat16 h)

Convert a mt_bfloat16 to a signed short integer in round-towards-zero mode.

Convert the mt_bfloat16 floating-point value h to a signed short integer in round-towards-zero mode.

Parameters

  • h (in): mt_bfloat16

Returns

  • short int
  • h converted to a signed short integer.

__bfloat162uchar_rz

unsigned char __bfloat162uchar_rz(const __mt_bfloat16 h)

Convert a mt_bfloat16 to an unsigned char in round-towards-zero mode.

__bfloat162uint_rd

unsigned int __bfloat162uint_rd(const __mt_bfloat16 h)

Convert a mt_bfloat16 to an unsigned integer in round-down mode.

Convert the mt_bfloat16 floating-point value h to an unsigned integer in round-down mode.

Parameters

  • h (in): mt_bfloat16

Returns

  • unsigned int
  • h converted to an unsigned integer.

__bfloat162uint_rn

unsigned int __bfloat162uint_rn(const __mt_bfloat16 h)

Convert a mt_bfloat16 to an unsigned integer in round-to-nearest-even mode.

Convert the mt_bfloat16 floating-point value h to an unsigned integer in round-to-nearest-even mode.

being.

Parameters

  • h (in): mt_bfloat16. Is only

Returns

  • unsigned int
  • h converted to an unsigned integer.

__bfloat162uint_ru

unsigned int __bfloat162uint_ru(const __mt_bfloat16 h)

Convert a mt_bfloat16 to an unsigned integer in round-up mode.

Convert the mt_bfloat16 floating-point value h to an unsigned integer in round-up mode.

Parameters

  • h (in): mt_bfloat16

Returns

  • unsigned int
  • h converted to an unsigned integer.

__bfloat162uint_rz

unsigned int __bfloat162uint_rz(const __mt_bfloat16 h)

Convert a mt_bfloat16 to an unsigned integer in round-towards-zero mode.

Convert the mt_bfloat16 floating-point value h to an unsigned integer in round-towards-zero mode.

read.

Parameters

  • h (in): mt_bfloat16. Is only being

Returns

  • unsigned int
  • h converted to an unsigned integer.

__bfloat162ull_rd

unsigned long long int __bfloat162ull_rd(const __mt_bfloat16 h)

Convert a mt_bfloat16 to an unsigned 64-bit integer in round-down mode.

Convert the mt_bfloat16 floating-point value h to an unsigned 64-bit integer in round-down mode.

read.

Parameters

  • h (in): mt_bfloat16. Is only being

Returns

  • unsigned long long int
  • h converted to an unsigned 64-bit integer.

__bfloat162ull_rn

unsigned long long int __bfloat162ull_rn(const __mt_bfloat16 h)

Convert a mt_bfloat16 to an unsigned 64-bit integer in round-to-nearest-even mode.

Convert the mt_bfloat16 floating-point value h to an unsigned 64-bit integer in round-to-nearest-even mode.

only.

Parameters

  • h (in): mt_bfloat16. Is

Returns

  • unsigned long long int
  • h converted to an unsigned 64-bit integer.

__bfloat162ull_ru

unsigned long long int __bfloat162ull_ru(const __mt_bfloat16 h)

Convert a mt_bfloat16 to an unsigned 64-bit integer in round-up mode.

Convert the mt_bfloat16 floating-point value h to an unsigned 64-bit integer in round-up mode.

read.

Parameters

  • h (in): mt_bfloat16. Is only being

Returns

  • unsigned long long int
  • h converted to an unsigned 64-bit integer.

__bfloat162ull_rz

unsigned long long int __bfloat162ull_rz(const __mt_bfloat16 h)

Convert a mt_bfloat16 to an unsigned 64-bit integer in round-towards-zero mode.

Convert the mt_bfloat16 floating-point value h to an unsigned 64-bit integer in round-towards-zero mode.

only.

Parameters

  • h (in): mt_bfloat16. Is

Returns

  • unsigned long long int
  • h converted to an unsigned 64-bit integer.

__bfloat162ushort_rd

unsigned short int __bfloat162ushort_rd(const __mt_bfloat16 h)

Convert a mt_bfloat16 to an unsigned short integer in round-down mode.

Convert the mt_bfloat16 floating-point value h to an unsigned short integer in round-down mode.

read.

Parameters

  • h (in): mt_bfloat16. Is only being

Returns

  • unsigned short int
  • h converted to an unsigned short integer.

__bfloat162ushort_rn

unsigned short int __bfloat162ushort_rn(const __mt_bfloat16 h)

Convert a mt_bfloat16 to an unsigned short integer in round-to-nearest-even mode.

Convert the mt_bfloat16 floating-point value h to an unsigned short integer in round-to-nearest-even mode.

only.

Parameters

  • h (in): mt_bfloat16. Is

Returns

  • unsigned short int
  • h converted to an unsigned short integer.

__bfloat162ushort_ru

unsigned short int __bfloat162ushort_ru(const __mt_bfloat16 h)

Convert a mt_bfloat16 to an unsigned short integer in round-up mode.

Convert the mt_bfloat16 floating-point value h to an unsigned short integer in round-up mode.

read.

Parameters

  • h (in): mt_bfloat16. Is only being

Returns

  • unsigned short int
  • h converted to an unsigned short integer.

__bfloat162ushort_rz

unsigned short int __bfloat162ushort_rz(const __mt_bfloat16 h)

Convert a mt_bfloat16 to an unsigned short integer in round-towards-zero mode.

Convert the mt_bfloat16 floating-point value h to an unsigned short integer in round-towards-zero mode.

being.

Parameters

  • h (in): mt_bfloat16. Is only

Returns

  • unsigned short int
  • h converted to an unsigned short integer.

__bfloat16_as_short

short int __bfloat16_as_short(const __mt_bfloat16 h)

Reinterprets bits in a mt_bfloat16 as a signed short integer.

Reinterprets the bits in the mt_bfloat16 floating-point number h as a signed short integer.

Parameters

  • h (in): mt_bfloat16

Returns

  • short int
  • The reinterpreted value.

__bfloat16_as_ushort

unsigned short int __bfloat16_as_ushort(const __mt_bfloat16 h)

Reinterprets bits in a mt_bfloat16 as an unsigned short integer.

Reinterprets the bits in the mt_bfloat16 floating-point h as an unsigned short number.

Parameters

  • h (in): mt_bfloat16

Returns

  • unsigned short int
  • The reinterpreted value.

__double2bfloat16

__mt_bfloat16 __double2bfloat16(const double a)

Converts double number to mt_bfloat16 precision in round-to-nearest-even mode and returns mt_bfloat16 with converted value.

Converts double number a to mt_bfloat16 precision in round-to-nearest-even mode.

Parameters

  • a (in): double

Returns

  • mt_bfloat16
  • a converted to mt_bfloat16.

__float22bfloat162_rn

__mt_bfloat162 __float22bfloat162_rn(const float2 a)

Converts both components of float2 number to mt_bfloat16 precision in round-to-nearest-even mode and returns mt_bfloat162 with converted values.

Converts both components of float2 to mt_bfloat16 precision in round-to-nearest mode and combines the results into one mt_bfloat162 number. Low 16 bits of the return value correspond to a.x and high 16 bits of the return value correspond to a.y.

being.

converted float2 components.

Parameters

  • a (in): float2. Is only

Returns

  • mt_bfloat162
  • The mt_bfloat162 which has corresponding halves equal to the

__float2bfloat16

__mt_bfloat16 __float2bfloat16(const float a)

Converts float number to mt_bfloat16 precision in round-to-nearest-even mode and returns mt_bfloat16 with converted value.

Converts float number a to mt_bfloat16 precision in round-to-nearest-even mode.

Parameters

  • a (in): float

Returns

  • mt_bfloat16
  • a converted to mt_bfloat16.

__float2bfloat162_rn

__mt_bfloat162 __float2bfloat162_rn(const float a)

Converts input to mt_bfloat16 precision in round-to-nearest-even mode and populates both halves of mt_bfloat162 with converted value.

Converts input a to mt_bfloat16 precision in round-to-nearest-even mode and populates both halves of mt_bfloat162 with converted value.

mt_bfloat16 precision number.

Parameters

  • a (in): float

Returns

  • mt_bfloat162
  • The mt_bfloat162 value with both halves equal to the converted

__float2bfloat16_rd

__mt_bfloat16 __float2bfloat16_rd(const float a)

Converts float number to mt_bfloat16 precision in round-down mode and returns mt_bfloat16 with converted value.

Converts float number a to mt_bfloat16 precision in round-down mode.

Parameters

  • a (in): float

Returns

  • mt_bfloat16
  • a converted to mt_bfloat16.

Bfloat16 Precision Conversion and Data Movement 161

__float2bfloat16_rn

__mt_bfloat16 __float2bfloat16_rn(const float a)

Converts float number to mt_bfloat16 precision in round-to-nearest-even mode and returns mt_bfloat16 with converted value.

Converts float number a to mt_bfloat16 precision in round-to-nearest-even mode.

Parameters

  • a (in): float

Returns

  • mt_bfloat16
  • a converted to mt_bfloat16.

__float2bfloat16_ru

__mt_bfloat16 __float2bfloat16_ru(const float a)

Converts float number to mt_bfloat16 precision in round-up mode and returns mt_bfloat16 with converted value.

Converts float number a to mt_bfloat16 precision in round-up mode.

Parameters

  • a (in): float

Returns

  • mt_bfloat16
  • a converted to mt_bfloat16.

__float2bfloat16_rz

__mt_bfloat16 __float2bfloat16_rz(const float a)

Converts float number to mt_bfloat16 precision in round-towards-zero mode and returns mt_bfloat16 with converted value.

Converts float number a to mt_bfloat16 precision in round-towards-zero mode.

mt_bfloat16

Parameters

  • a (in): float

Returns

  • a converted to mt_bfloat16.

__floats2bfloat162_rn

__mt_bfloat162 __floats2bfloat162_rn(const float a, const float b)

Converts both input floats to mt_bfloat16 precision in round-to-nearest-even mode and returns mt_bfloat162 with converted values.

Converts both input floats to mt_bfloat16 precision in round-to-nearest-even mode and combines the results into one mt_bfloat162 number. Low 16 bits of the return value correspond to the input a, high 16 bits correspond to the input b.

converted input floats.

Parameters

  • a (in): float
  • b (in): float

Returns

  • mt_bfloat162
  • The mt_bfloat162 value with corresponding halves equal to the

Bfloat162 Arithmetic Functions

__h2div

__mt_bfloat162 __h2div(const __mt_bfloat162 a, const __mt_bfloat162 b)

Performs mt_bfloat162 vector division in round-to-nearest-even mode.

Divides mt_bfloat162 input vector a by input vector b in round-to-nearest mode.

Parameters

  • a (in): mt_bfloat162
  • b (in): mt_bfloat162

Returns

  • mt_bfloat162
  • The elementwise division of a with b.

Bfloat16 Arithmetic Functions

__habs

__mt_bfloat16 __habs(const __mt_bfloat16 a)

Calculates the absolute value of input mt_bfloat16 number and returns the result.

Calculates the absolute value of input mt_bfloat16 number and returns the result.

Parameters

  • a (in): mt_bfloat16

Returns

  • mt_bfloat16
  • The absolute value of a.

Bfloat162 Arithmetic Functions

__habs2

__mt_bfloat162 __habs2(const __mt_bfloat162 a)

Calculates the absolute value of both halves of the input mt_bfloat162 number and returns the result.

Calculates the absolute value of both halves of the input mt_bfloat162 number and returns the result.

only.

Parameters

  • a (in): mt_bfloat162. Is

Returns

  • bfloat2
  • Returns a with the absolute value of both halves.

Bfloat16 Arithmetic Functions

__hadd

__mt_bfloat16 __hadd(const __mt_bfloat16 a, const __mt_bfloat16 b)

Performs mt_bfloat16 addition in round-to-nearest-even mode.

Performs mt_bfloat16 addition of inputs a and b, in round-to-nearest-even mode.

Parameters

  • a (in): mt_bfloat16
  • b (in): mt_bfloat16

Returns

  • mt_bfloat16
  • The sum of a and b.

Bfloat162 Arithmetic Functions

__hadd2

__mt_bfloat162 __hadd2(const __mt_bfloat162 a, const __mt_bfloat162 b)

Performs mt_bfloat162 vector addition in round-to-nearest-even mode.

Performs mt_bfloat162 vector add of inputs a and b, in round-to-nearest mode.

Parameters

  • a (in): mt_bfloat162
  • b (in): mt_bfloat162

Returns

  • mt_bfloat162
  • The sum of vectors a and b.

__hadd2_rn

__mt_bfloat162 __hadd2_rn(const __mt_bfloat162 a, const __mt_bfloat162 b)

Performs mt_bfloat162 vector addition in round-to-nearest-even mode.

Performs mt_bfloat162 vector add of inputs a and b, in round-to-nearest mode.

Parameters

  • a (in): mt_bfloat162
  • b (in): mt_bfloat162

Returns

  • mt_bfloat162
  • The sum of a and b, with respect to saturation.

__hadd2_sat

__mt_bfloat162 __hadd2_sat(const __mt_bfloat162 a, const __mt_bfloat162 b)

Performs mt_bfloat162 vector addition in round-to-nearest-even mode, with saturation to [0.0, 1.0].

Performs mt_bfloat162 vector add of inputs a and b, in round-to-nearest mode, and clamps the results to range [0.0, 1.0]. NaN results are flushed to +0.0.

Parameters

  • a (in): mt_bfloat162
  • b (in): mt_bfloat162

Returns

  • mt_bfloat162
  • The sum of a and b, with respect to saturation.

Bfloat16 Arithmetic Functions

__hadd_rn

__mt_bfloat16 __hadd_rn(const __mt_bfloat16 a, const __mt_bfloat16 b)

Performs mt_bfloat16 addition in round-to-nearest-even mode.

Performs mt_bfloat16 addition of inputs a and b, in round-to-nearest-even mode.

Parameters

  • a (in): mt_bfloat16
  • b (in): mt_bfloat16

Returns

  • mt_bfloat16
  • The sum of a and b.

__hadd_sat

__mt_bfloat16 __hadd_sat(const __mt_bfloat16 a, const __mt_bfloat16 b)

Performs mt_bfloat16 addition in round-to-nearest-even mode, with saturation to [0.0, 1.0].

Performs mt_bfloat16 add of inputs a and b, in round-to-nearest-even mode, and clamps the result to range [0.0, 1.0]. NaN results are flushed to +0.0.

Parameters

  • a (in): mt_bfloat16
  • b (in): mt_bfloat16

Returns

  • mt_bfloat16
  • The sum of a and b, with respect to saturation.

Bfloat16 Precision Conversion and Data Movement 161

__halves2bfloat162

__mt_bfloat162 __halves2bfloat162(const __mt_bfloat16 a, const __mt_bfloat16 b)

Combines two mt_bfloat16 numbers into one mt_bfloat162 number.

Combines two input mt_bfloat16 number a and b into one mt_bfloat162 number. Input a is stored in low 16 bits of the return value, input b is stored in high 16 bits of the return value.

Parameters

  • a (in): mt_bfloat16. Is only being read.
  • b (in): mt_bfloat16. Is only being read.

Returns

  • mt_bfloat162
  • The mt_bfloat162 with one mt_bfloat16 equal to a and the other to

Bfloat162 Comparison Functions

__hbeq2

bool __hbeq2(const __mt_bfloat162 a, const __mt_bfloat162 b)

Performs mt_bfloat162 vector if-equal comparison and returns boolean true iff both mt_bfloat16 results are true, boolean false otherwise.

Performs mt_bfloat162 vector if-equal comparison of inputs a and b. The bool result is set to true only if both mt_bfloat16 if-equal comparisons evaluate to true, or false otherwise. NaN inputs generate false results.

mt_bfloat162

of vectors a and b are true;

Parameters

  • a (in): mt_bfloat162
  • b (in):

Returns

  • bool
  • true if both mt_bfloat16 results of if-equal comparison
  • false otherwise.

__hbequ2

bool __hbequ2(const __mt_bfloat162 a, const __mt_bfloat162 b)

Performs mt_bfloat162 vector unordered if-equal comparison and returns boolean true iff both mt_bfloat16 results are true, boolean false otherwise.

Performs mt_bfloat162 vector if-equal comparison of inputs a and b. The bool result is set to true only if both mt_bfloat16 if-equal comparisons evaluate to true, or false otherwise. NaN inputs generate true results.

mt_bfloat162

comparison of vectors a and b are true;

Parameters

  • a (in): mt_bfloat162
  • b (in):

Returns

  • bool
  • true if both mt_bfloat16 results of unordered if-equal
  • false otherwise.

__hbge2

bool __hbge2(const __mt_bfloat162 a, const __mt_bfloat162 b)

Performs mt_bfloat162 vector greater-equal comparison and returns boolean true iff both mt_bfloat16 results are true, boolean false otherwise.

Performs mt_bfloat162 vector greater-equal comparison of inputs a and b. The bool result is set to true only if both mt_bfloat16 greater-equal comparisons evaluate to true, or false otherwise. NaN inputs generate false results.

comparison of vectors a and b are true;

Parameters

  • a (in): mt_bfloat162
  • b (in): mt_bfloat162

Returns

  • bool
  • true if both mt_bfloat16 results of greater-equal
  • false otherwise.

__hbgeu2

bool __hbgeu2(const __mt_bfloat162 a, const __mt_bfloat162 b)

Performs mt_bfloat162 vector unordered greater-equal comparison and returns boolean true iff both mt_bfloat16 results are true, boolean false otherwise.

Performs mt_bfloat162 vector greater-equal comparison of inputs a and b. The bool result is set to true only if both mt_bfloat16 greater-equal comparisons evaluate to true, or false otherwise. NaN inputs generate true results.

greater-equal comparison of vectors a and b are true;

Parameters

  • a (in): mt_bfloat162
  • b (in): mt_bfloat162

Returns

  • bool
  • true if both mt_bfloat16 results of unordered
  • false otherwise.

__hbgt2

bool __hbgt2(const __mt_bfloat162 a, const __mt_bfloat162 b)

Performs mt_bfloat162 vector greater-than comparison and returns boolean true iff both mt_bfloat16 results are true, boolean false otherwise.

Performs mt_bfloat162 vector greater-than comparison of inputs a and b. The bool result is set to true only if both mt_bfloat16 greater-than comparisons evaluate to true, or false otherwise. NaN inputs generate false results.

comparison of vectors a and b are true;

Parameters

  • a (in): mt_bfloat162
  • b (in): mt_bfloat162

Returns

  • bool
  • true if both mt_bfloat16 results of greater-than
  • false otherwise.

__hbgtu2

bool __hbgtu2(const __mt_bfloat162 a, const __mt_bfloat162 b)

Performs mt_bfloat162 vector unordered greater-than comparison and returns boolean true iff both mt_bfloat16 results are true, boolean false otherwise.

Performs mt_bfloat162 vector greater-than comparison of inputs a and b. The bool result is set to true only if both mt_bfloat16 greater-than comparisons evaluate to true, or false otherwise. NaN inputs generate true results.

greater-than comparison of vectors a and b are true;

Parameters

  • a (in): mt_bfloat162
  • b (in): mt_bfloat162

Returns

  • bool
  • true if both mt_bfloat16 results of unordered
  • false otherwise.

__hble2

bool __hble2(const __mt_bfloat162 a, const __mt_bfloat162 b)

Performs mt_bfloat162 vector less-equal comparison and returns boolean true iff both mt_bfloat16 results are true, boolean false otherwise.

Performs mt_bfloat162 vector less-equal comparison of inputs a and b. The bool result is set to true only if both mt_bfloat16 less-equal comparisons evaluate to true, or false otherwise. NaN inputs generate false results.

of vectors a and b are true;

Parameters

  • a (in): mt_bfloat162
  • b (in): mt_bfloat162

Returns

  • bool
  • true if both mt_bfloat16 results of less-equal comparison
  • false otherwise.

__hbleu2

bool __hbleu2(const __mt_bfloat162 a, const __mt_bfloat162 b)

Performs mt_bfloat162 vector unordered less-equal comparison and returns boolean true iff both mt_bfloat16 results are true, boolean false otherwise.

Performs mt_bfloat162 vector less-equal comparison of inputs a and b. The bool result is set to true only if both mt_bfloat16 less-equal comparisons evaluate to true, or false otherwise. NaN inputs generate true results.

comparison of vectors a and b are true;

Parameters

  • a (in): mt_bfloat162
  • b (in): mt_bfloat162

Returns

  • bool
  • true if both mt_bfloat16 results of unordered less-equal
  • false otherwise.

__hblt2

bool __hblt2(const __mt_bfloat162 a, const __mt_bfloat162 b)

Performs mt_bfloat162 vector less-than comparison and returns boolean true iff both mt_bfloat16 results are true, boolean false otherwise.

Performs mt_bfloat162 vector less-than comparison of inputs a and b. The bool result is set to true only if both mt_bfloat16 less-than comparisons evaluate to true, or false otherwise. NaN inputs generate false results.

of vectors a and b are true;

Parameters

  • a (in): mt_bfloat162
  • b (in): mt_bfloat162

Returns

  • bool
  • true if both mt_bfloat16 results of less-than comparison
  • false otherwise.

__hbltu2

bool __hbltu2(const __mt_bfloat162 a, const __mt_bfloat162 b)

Performs mt_bfloat162 vector unordered less-than comparison and returns boolean true iff both mt_bfloat16 results are true, boolean false otherwise.

Performs mt_bfloat162 vector less-than comparison of inputs a and b. The bool result is set to true only if both mt_bfloat16 less-than comparisons evaluate to true, or false otherwise. NaN inputs generate true results.

of vectors a and b are true;

Parameters

  • a (in): mt_bfloat162
  • b (in): mt_bfloat162

Returns

  • bool
  • true if both mt_bfloat16 results of unordered less-than comparison
  • false otherwise.

__hbne2

bool __hbne2(const __mt_bfloat162 a, const __mt_bfloat162 b)

Performs mt_bfloat162 vector not-equal comparison and returns boolean true iff both mt_bfloat16 results are true, boolean false otherwise.

Performs mt_bfloat162 vector not-equal comparison of inputs a and b. The bool result is set to true only if both mt_bfloat16 not-equal comparisons evaluate to true, or false otherwise. NaN inputs generate false results.

of vectors a and b are true,

Parameters

  • a (in): mt_bfloat162
  • b (in): mt_bfloat162

Returns

  • bool
  • true if both mt_bfloat16 results of not-equal comparison
  • false otherwise.

__hbneu2

bool __hbneu2(const __mt_bfloat162 a, const __mt_bfloat162 b)

Performs mt_bfloat162 vector unordered not-equal comparison and returns boolean true iff both mt_bfloat16 results are true, boolean false otherwise.

Performs mt_bfloat162 vector not-equal comparison of inputs a and b. The bool result is set to true only if both mt_bfloat16 not-equal comparisons evaluate to true, or false otherwise. NaN inputs generate true results.

comparison of vectors a and b are true;

Parameters

  • a (in): mt_bfloat162
  • b (in): mt_bfloat162

Returns

  • bool
  • true if both mt_bfloat16 results of unordered not-equal
  • false otherwise.

Bfloat162 Arithmetic Functions

__hcmadd

__mt_bfloat162 __hcmadd(const __mt_bfloat162 a, const __mt_bfloat162 b, const __mt_bfloat162 c)

Performs fast complex multiply-accumulate

Interprets vector mt_bfloat162 input pairs a, b, and c as complex numbers in mt_bfloat16 precision and performs complex multiply-accumulate operation: a*b + c

being.

mt_bfloat162

numbers a, b, and c

Parameters

  • a (in): mt_bfloat162. Is only
  • b (in): mt_bfloat162
  • c (in):

Returns

  • mt_bfloat162
  • The result of complex multiply-accumulate operation on complex

Bfloat16 Arithmetic Functions

__hdiv

__mt_bfloat16 __hdiv(const __mt_bfloat16 a, const __mt_bfloat16 b)

Performs mt_bfloat16 division in round-to-nearest-even mode.

Divides mt_bfloat16 input a by input b in round-to-nearest mode.

Parameters

  • a (in): mt_bfloat16
  • b (in): mt_bfloat16

Returns

  • mt_bfloat16
  • The result of dividing a by b.

Bfloat16 Comparison Functions

__heq

bool __heq(const __mt_bfloat16 a, const __mt_bfloat16 b)

Performs mt_bfloat16 if-equal comparison.

Performs mt_bfloat16 if-equal comparison of inputs a and b. NaN inputs generate false results.

Parameters

  • a (in): mt_bfloat16
  • b (in): mt_bfloat16

Returns

  • bool
  • The boolean result of if-equal comparison of a and b.

Bfloat162 Comparison Functions

__heq2

__mt_bfloat162 __heq2(const __mt_bfloat162 a, const __mt_bfloat162 b)

Performs mt_bfloat162 vector if-equal comparison.

Performs mt_bfloat162 vector if-equal comparison of inputs a and b. The corresponding mt_bfloat16 results are set to 1.0 for true, or 0.0 for false. NaN inputs generate false results.

mt_bfloat162

read.

Parameters

  • a (in):
  • b (in): mt_bfloat162. Is only being

Returns

  • mt_bfloat162
  • The vector result of if-equal comparison of vectors a and b.

__heq2_mask

unsigned __heq2_mask(const __mt_bfloat162 a, const __mt_bfloat162 b)

Performs mt_bfloat162 vector if-equal comparison.

Performs mt_bfloat162 vector if-equal comparison of inputs a and b. The corresponding mt_bfloat16 results are set to 0xFFFF for true, or 0x0 for false. NaN inputs generate false results.

mt_bfloat162

read.

Parameters

  • a (in):
  • b (in): mt_bfloat162. Is only being

Returns

  • mt_bfloat162
  • The vector result of greater-than comparison of vectors a and b.

Bfloat16 Comparison Functions

__hequ

bool __hequ(const __mt_bfloat16 a, const __mt_bfloat16 b)

Performs mt_bfloat16 unordered if-equal comparison.

Performs mt_bfloat16 if-equal comparison of inputs a and b. NaN inputs generate true results.

b.

Parameters

  • a (in): mt_bfloat16
  • b (in): mt_bfloat16

Returns

  • bool
  • The boolean result of unordered if-equal comparison of a and

Bfloat162 Comparison Functions

__hequ2

__mt_bfloat162 __hequ2(const __mt_bfloat162 a, const __mt_bfloat162 b)

Performs mt_bfloat162 vector unordered if-equal comparison.

Performs mt_bfloat162 vector if-equal comparison of inputs a and b. The corresponding mt_bfloat16 results are set to 1.0 for true, or 0.0 for false. NaN inputs generate true results.

mt_bfloat162

read.

and b.

Parameters

  • a (in):
  • b (in): mt_bfloat162. Is only being

Returns

  • mt_bfloat162
  • The vector result of unordered if-equal comparison of vectors a

__hequ2_mask

unsigned __hequ2_mask(const __mt_bfloat162 a, const __mt_bfloat162 b)

Performs mt_bfloat162 vector unordered if-equal comparison.

Performs mt_bfloat162 vector if-equal comparison of inputs a and b. The corresponding mt_bfloat16 results are set to 0xFFFF for true, or 0x0 for false. NaN inputs generate true results.

mt_bfloat162

read.

Parameters

  • a (in):
  • b (in): mt_bfloat162. Is only being

Returns

  • mt_bfloat162
  • The vector result of greater-than comparison of vectors a and b.

Bfloat16 Arithmetic Functions

__hfma

__mt_bfloat16 __hfma(const __mt_bfloat16 a, const __mt_bfloat16 b, const __mt_bfloat16 c)

Performs mt_bfloat16 fused multiply-add in round-to-nearest-even mode.

Performs mt_bfloat16 multiply on inputs a and b, then performs a mt_bfloat16 add of the result with c, rounding the result once in round-to-nearest-even mode.

Parameters

  • a (in): mt_bfloat16
  • b (in): mt_bfloat16
  • c (in): mt_bfloat16

Returns

  • mt_bfloat16
  • The result of fused multiply-add operation on a, b, and c.

Bfloat162 Arithmetic Functions

__hfma2

__mt_bfloat162 __hfma2(const __mt_bfloat162 a, const __mt_bfloat162 b, const __mt_bfloat162 c)

Performs mt_bfloat162 vector fused multiply-add in round-to-nearest-even mode.

Performs mt_bfloat162 vector multiply on inputs a and b, then performs a mt_bfloat162 vector add of the result with c, rounding the result once in round-to-nearest-even mode.

Parameters

  • a (in): mt_bfloat162
  • b (in): mt_bfloat162
  • c (in): mt_bfloat162

Returns

  • mt_bfloat162
  • The result of elementwise fused multiply-add operation on vectors a, b, and c.

__hfma2_relu

__mt_bfloat162 __hfma2_relu(const __mt_bfloat162 a, const __mt_bfloat162 b, const __mt_bfloat162 c)

Performs mt_bfloat162 vector fused multiply-add in round-to-nearest-even mode with relu saturation.

Performs mt_bfloat162 vector multiply on inputs a and b, then performs a mt_bfloat162 vector add of the result with c, rounding the result once in round-to-nearest-even mode. Then negative result is clamped to 0. NaN result is converted to canonical NaN.

Parameters

  • a (in): mt_bfloat162
  • b (in): mt_bfloat162
  • c (in): mt_bfloat162

Returns

  • mt_bfloat162
  • The result of elementwise fused multiply-add operation on vectors a, b, and c with relu saturation.

__hfma2_sat

__mt_bfloat162 __hfma2_sat(const __mt_bfloat162 a, const __mt_bfloat162 b, const __mt_bfloat162 c)

Performs mt_bfloat162 vector fused multiply-add in round-to-nearest-even mode, with saturation to [0.0, 1.0].

Performs mt_bfloat162 vector multiply on inputs a and b, then performs a mt_bfloat162 vector add of the result with c, rounding the result once in round-to-nearest-even mode, and clamps the results to range [0.0, 1.0]. NaN results are flushed to +0.0.

Parameters

  • a (in): mt_bfloat162
  • b (in): mt_bfloat162
  • c (in): mt_bfloat162

Returns

  • mt_bfloat162
  • The result of elementwise fused multiply-add operation on vectors a, b, and c, with respect to saturation.

Bfloat16 Arithmetic Functions

__hfma_relu

__mt_bfloat16 __hfma_relu(const __mt_bfloat16 a, const __mt_bfloat16 b, const __mt_bfloat16 c)

Performs mt_bfloat16 fused multiply-add in round-to-nearest-even mode with relu saturation.

Performs mt_bfloat16 multiply on inputs a and b, then performs a mt_bfloat16 add of the result with c, rounding the result once in round-to-nearest-even mode. Then negative result is clamped to 0. NaN result is converted to canonical NaN.

Parameters

  • a (in): mt_bfloat16
  • b (in): mt_bfloat16
  • c (in): mt_bfloat16

Returns

  • mt_bfloat16
  • The result of fused multiply-add operation on a, b, and c with relu saturation.

__hfma_sat

__mt_bfloat16 __hfma_sat(const __mt_bfloat16 a, const __mt_bfloat16 b, const __mt_bfloat16 c)

Performs mt_bfloat16 fused multiply-add in round-to-nearest-even mode, with saturation to [0.0, 1.0].

Performs mt_bfloat16 multiply on inputs a and b, then performs a mt_bfloat16 add of the result with c, rounding the result once in round-to-nearest-even mode, and clamps the result to range [0.0, 1.0]. NaN results are flushed to +0.0.

Parameters

  • a (in): mt_bfloat16
  • b (in): mt_bfloat16
  • c (in): mt_bfloat16

Returns

  • mt_bfloat16
  • The result of fused multiply-add operation on a, b, and c, with respect to saturation.

Bfloat16 Comparison Functions

__hge

bool __hge(const __mt_bfloat16 a, const __mt_bfloat16 b)

Performs mt_bfloat16 greater-equal comparison.

Performs mt_bfloat16 greater-equal comparison of inputs a and b. NaN inputs generate false results.

being.

Parameters

  • a (in): mt_bfloat16. Is only
  • b (in): mt_bfloat16

Returns

  • bool
  • The boolean result of greater-equal comparison of a and b.

Bfloat162 Comparison Functions

__hge2

__mt_bfloat162 __hge2(const __mt_bfloat162 a, const __mt_bfloat162 b)

Performs mt_bfloat162 vector greater-equal comparison.

Performs mt_bfloat162 vector greater-equal comparison of inputs a and b. The corresponding mt_bfloat16 results are set to 1.0 for true, or 0.0 for false. NaN inputs generate false results.

mt_bfloat162

read.

Parameters

  • a (in):
  • b (in): mt_bfloat162. Is only being

Returns

  • mt_bfloat162
  • The vector result of greater-equal comparison of vectors a and b.

__hge2_mask

unsigned __hge2_mask(const __mt_bfloat162 a, const __mt_bfloat162 b)

Performs mt_bfloat162 vector greater-equal comparison.

Performs mt_bfloat162 vector greater-equal comparison of inputs a and b. The corresponding mt_bfloat16 results are set to 0xFFFF for true, or 0x0 for false. NaN inputs generate false results.

mt_bfloat162

read.

Parameters

  • a (in):
  • b (in): mt_bfloat162. Is only being

Returns

  • mt_bfloat162
  • The vector result of greater-equal comparison of vectors a and b.

Bfloat16 Comparison Functions

__hgeu

bool __hgeu(const __mt_bfloat16 a, const __mt_bfloat16 b)

Performs mt_bfloat16 unordered greater-equal comparison.

Performs mt_bfloat16 greater-equal comparison of inputs a and b. NaN inputs generate true results.

being.

and b.

Parameters

  • a (in): mt_bfloat16. Is only
  • b (in): mt_bfloat16

Returns

  • bool
  • The boolean result of unordered greater-equal comparison of a

Bfloat162 Comparison Functions

__hgeu2

__mt_bfloat162 __hgeu2(const __mt_bfloat162 a, const __mt_bfloat162 b)

Performs mt_bfloat162 vector unordered greater-equal comparison.

Performs mt_bfloat162 vector greater-equal comparison of inputs a and b. The corresponding mt_bfloat16 results are set to 1.0 for true, or 0.0 for false. NaN inputs generate true results.

mt_bfloat162

read.

comparison of vectors a and b.

Parameters

  • a (in):
  • b (in): mt_bfloat162. Is only being

Returns

  • mt_bfloat162
  • The mt_bfloat162 vector result of unordered greater-equal

__hgeu2_mask

unsigned __hgeu2_mask(const __mt_bfloat162 a, const __mt_bfloat162 b)

Performs mt_bfloat162 vector unordered greater-equal comparison.

Performs mt_bfloat162 vector greater-equal comparison of inputs a and b. The corresponding unsigned bits are set to 0xFFFF for true, or 0x0 for false. NaN inputs generate true results.

vectors a and b.

Parameters

  • a (in): mt_bfloat162
  • b (in): mt_bfloat162

Returns

  • unsigned int
  • The vector mask result of unordered greater-equal comparison of

Bfloat16 Comparison Functions

__hgt

bool __hgt(const __mt_bfloat16 a, const __mt_bfloat16 b)

Performs mt_bfloat16 greater-than comparison.

Performs mt_bfloat16 greater-than comparison of inputs a and b. NaN inputs generate false results.

being.

Parameters

  • a (in): mt_bfloat16. Is only
  • b (in): mt_bfloat16

Returns

  • bool
  • The boolean result of greater-than comparison of a and b.

Bfloat162 Comparison Functions

__hgt2

__mt_bfloat162 __hgt2(const __mt_bfloat162 a, const __mt_bfloat162 b)

Performs mt_bfloat162 vector greater-than comparison.

Performs mt_bfloat162 vector greater-than comparison of inputs a and b. The corresponding mt_bfloat16 results are set to 1.0 for true, or 0.0 for false. NaN inputs generate false results.

mt_bfloat162

read.

Parameters

  • a (in):
  • b (in): mt_bfloat162. Is only being

Returns

  • mt_bfloat162
  • The vector result of greater-than comparison of vectors a and b.

__hgt2_mask

unsigned __hgt2_mask(const __mt_bfloat162 a, const __mt_bfloat162 b)

Performs mt_bfloat162 vector greater-than comparison.

Performs mt_bfloat162 vector greater-than comparison of inputs a and b. The corresponding mt_bfloat16 results are set to 0xFFFF for true, or 0x0 for false. NaN inputs generate false results.

mt_bfloat162

read.

Parameters

  • a (in):
  • b (in): mt_bfloat162. Is only being

Returns

  • mt_bfloat162
  • The vector result of greater-than comparison of vectors a and b.

Bfloat16 Comparison Functions

__hgtu

bool __hgtu(const __mt_bfloat16 a, const __mt_bfloat16 b)

Performs mt_bfloat16 unordered greater-than comparison.

Performs mt_bfloat16 greater-than comparison of inputs a and b. NaN inputs generate true results.

being.

and b.

Parameters

  • a (in): mt_bfloat16. Is only
  • b (in): mt_bfloat16

Returns

  • bool
  • The boolean result of unordered greater-than comparison of a

Bfloat162 Comparison Functions

__hgtu2

__mt_bfloat162 __hgtu2(const __mt_bfloat162 a, const __mt_bfloat162 b)

Performs mt_bfloat162 vector unordered greater-than comparison.

Performs mt_bfloat162 vector greater-than comparison of inputs a and b. The corresponding mt_bfloat16 results are set to 1.0 for true, or 0.0 for false. NaN inputs generate true results.

mt_bfloat162

read.

comparison of vectors a and b.

Parameters

  • a (in):
  • b (in): mt_bfloat162. Is only being

Returns

  • mt_bfloat162
  • The mt_bfloat162 vector result of unordered greater-than

__hgtu2_mask

unsigned __hgtu2_mask(const __mt_bfloat162 a, const __mt_bfloat162 b)

Performs mt_bfloat162 vector unordered greater-than comparison.

Performs mt_bfloat162 vector greater-than comparison of inputs a and b. The corresponding mt_bfloat16 results are set to 0xFFFF for true, or 0x0 for false. NaN inputs generate true results.

mt_bfloat162

read.

comparison of vectors a and b.

Parameters

  • a (in):
  • b (in): mt_bfloat162. Is only being

Returns

  • mt_bfloat162
  • The mt_bfloat162 vector result of unordered greater-than

Bfloat16 Precision Conversion and Data Movement 161

__high2bfloat16

__mt_bfloat16 __high2bfloat16(const __mt_bfloat162 a)

Returns high 16 bits of mt_bfloat162 input.

Returns high 16 bits of mt_bfloat162 input a.

Parameters

  • a (in): mt_bfloat162

Returns

  • mt_bfloat16
  • The high 16 bits of the input.

__high2bfloat162

__mt_bfloat162 __high2bfloat162(const __mt_bfloat162 a)

Extracts high 16 bits from mt_bfloat162 input.

Extracts high 16 bits from mt_bfloat162 input a and returns a new mt_bfloat162 number which has both halves equal to the extracted bits.

input.

Parameters

  • a (in): mt_bfloat162

Returns

  • mt_bfloat162
  • The mt_bfloat162 with both halves equal to the high 16 bits of the

__high2float

float __high2float(const __mt_bfloat162 a)

Converts high 16 bits of mt_bfloat162 to float and returns the result

Converts high 16 bits of mt_bfloat162 input a to 32-bit floating-point number and returns the result.

only.

Parameters

  • a (in): mt_bfloat162. Is

Returns

  • float
  • The high 16 bits of a converted to float.

__highs2bfloat162

__mt_bfloat162 __highs2bfloat162(const __mt_bfloat162 a, const __mt_bfloat162 b)

Extracts high 16 bits from each of the two mt_bfloat162 inputs and combines into one mt_bfloat162 number.

Extracts high 16 bits from each of the two mt_bfloat162 inputs and combines into one mt_bfloat162 number. High 16 bits from input a is stored in low 16 bits of the return value, high 16 bits from input b is stored in high 16 bits of the return value.

only.

Parameters

  • a (in): mt_bfloat162. Is
  • b (in): mt_bfloat162

Returns

  • mt_bfloat162
  • The high 16 bits of a and of b.

Bfloat16 Comparison Functions

__hisinf

int __hisinf(const __mt_bfloat16 a)

Checks if the input mt_bfloat16 number is infinite.

Checks if the input mt_bfloat16 number a is infinite.

Parameters

  • a (in): mt_bfloat16

Returns

  • int
  • -1 iff a is equal to negative infinity,
  • 1 iff a is equal to positive infinity,
  • 0 otherwise.

__hisnan

bool __hisnan(const __mt_bfloat16 a)

Determine whether mt_bfloat16 argument is a NaN.

Determine whether mt_bfloat16 value a is a NaN.

Parameters

  • a (in): mt_bfloat16

Returns

  • bool
  • true iff argument is NaN.

Bfloat162 Comparison Functions

__hisnan2

__mt_bfloat162 __hisnan2(const __mt_bfloat162 a)

Determine whether mt_bfloat162 argument is a NaN.

Determine whether each mt_bfloat16 of input mt_bfloat162 number a is a NaN.

1.0 for NaN, 0.0 otherwise.

Parameters

  • a (in): mt_bfloat162

Returns

  • mt_bfloat162
  • The mt_bfloat162 with the corresponding mt_bfloat16 results set to

Bfloat16 Comparison Functions

__hle

bool __hle(const __mt_bfloat16 a, const __mt_bfloat16 b)

Performs mt_bfloat16 less-equal comparison.

Performs mt_bfloat16 less-equal comparison of inputs a and b. NaN inputs generate false results.

being.

Parameters

  • a (in): mt_bfloat16. Is only
  • b (in): mt_bfloat16

Returns

  • bool
  • The boolean result of less-equal comparison of a and b.

Bfloat162 Comparison Functions 205

__hle2

__mt_bfloat162 __hle2(const __mt_bfloat162 a, const __mt_bfloat162 b)

Performs mt_bfloat162 vector less-equal comparison.

Performs mt_bfloat162 vector less-equal comparison of inputs a and b. The corresponding mt_bfloat16 results are set to 1.0 for true, or 0.0 for false. NaN inputs generate false results.

mt_bfloat162

read.

and b.

Parameters

  • a (in):
  • b (in): mt_bfloat162. Is only being

Returns

  • mt_bfloat162
  • The mt_bfloat162 result of less-equal comparison of vectors a

__hle2_mask

unsigned __hle2_mask(const __mt_bfloat162 a, const __mt_bfloat162 b)

Performs mt_bfloat162 vector less-equal comparison.

Performs mt_bfloat162 vector less-equal comparison of inputs a and b. The corresponding unsigned bits are set to 0xFFFF for true, or 0x0 for false. NaN inputs generate false results.

  • The vector mask result of less-equal comparison of vectors a and b.

Parameters

  • a (in): mt_bfloat162
  • b (in): mt_bfloat162

Returns

  • unsigned int

Bfloat16 Comparison Functions

__hleu

bool __hleu(const __mt_bfloat16 a, const __mt_bfloat16 b)

Performs mt_bfloat16 unordered less-equal comparison.

Performs mt_bfloat16 less-equal comparison of inputs a and b. NaN inputs generate true results.

being.

b.

Parameters

  • a (in): mt_bfloat16. Is only
  • b (in): mt_bfloat16

Returns

  • bool
  • The boolean result of unordered less-equal comparison of a and

Bfloat162 Comparison Functions 205

__hleu2

__mt_bfloat162 __hleu2(const __mt_bfloat162 a, const __mt_bfloat162 b)

Performs mt_bfloat162 vector unordered less-equal comparison.

Performs mt_bfloat162 vector less-equal comparison of inputs a and b. The corresponding mt_bfloat16 results are set to 1.0 for true, or 0.0 for false. NaN inputs generate true results.

only.

and b.

Parameters

  • a (in): mt_bfloat162. Is
  • b (in): mt_bfloat162

Returns

  • mt_bfloat162
  • The vector result of unordered less-equal comparison of vectors a

__hleu2_mask

unsigned __hleu2_mask(const __mt_bfloat162 a, const __mt_bfloat162 b)

Performs mt_bfloat162 vector unordered less-equal comparison.

Performs mt_bfloat162 vector less-equal comparison of inputs a and b. The corresponding unsigned bits are set to 0xFFFF for true, or 0x0 for false. NaN inputs generate true results.

  • The vector mask result of unordered less-equal comparison of vectors a and b.

Parameters

  • a (in): mt_bfloat162
  • b (in): mt_bfloat162

Returns

  • unsigned int

Bfloat16 Comparison Functions

__hlt

bool __hlt(const __mt_bfloat16 a, const __mt_bfloat16 b)

Performs mt_bfloat16 less-than comparison.

Performs mt_bfloat16 less-than comparison of inputs a and b. NaN inputs generate false results.

being.

Parameters

  • a (in): mt_bfloat16. Is only
  • b (in): mt_bfloat16

Returns

  • bool
  • The boolean result of less-than comparison of a and b.

Bfloat162 Comparison Functions 205

__hlt2

__mt_bfloat162 __hlt2(const __mt_bfloat162 a, const __mt_bfloat162 b)

Performs mt_bfloat162 vector less-than comparison.

Performs mt_bfloat162 vector less-than comparison of inputs a and b. The corresponding mt_bfloat16 results are set to 1.0 for true, or 0.0 for false. NaN inputs generate false results.

mt_bfloat162

read.

Parameters

  • a (in):
  • b (in): mt_bfloat162. Is only being

Returns

  • mt_bfloat162
  • The mt_bfloat162 vector result of less-than comparison of vectors a and b.

__hlt2_mask

unsigned __hlt2_mask(const __mt_bfloat162 a, const __mt_bfloat162 b)

Performs mt_bfloat162 vector less-than comparison.

Performs mt_bfloat162 vector less-than comparison of inputs a and b. The corresponding unsigned bits are set to 0xFFFF for true, or 0x0 for false. NaN inputs generate false results.

  • The vector mask result of less-than comparison of vectors a and b.

Parameters

  • a (in): mt_bfloat162
  • b (in): mt_bfloat162

Returns

  • unsigned int

Bfloat16 Comparison Functions

__hltu

bool __hltu(const __mt_bfloat16 a, const __mt_bfloat16 b)

Performs mt_bfloat16 unordered less-than comparison.

Performs mt_bfloat16 less-than comparison of inputs a and b. NaN inputs generate true results.

being.

b.

Parameters

  • a (in): mt_bfloat16. Is only
  • b (in): mt_bfloat16

Returns

  • bool
  • The boolean result of unordered less-than comparison of a and

Bfloat162 Comparison Functions 205

__hltu2

__mt_bfloat162 __hltu2(const __mt_bfloat162 a, const __mt_bfloat162 b)

Performs mt_bfloat162 vector unordered less-than comparison.

Performs mt_bfloat162 vector less-than comparison of inputs a and b. The corresponding mt_bfloat16 results are set to 1.0 for true, or 0.0 for false. NaN inputs generate true results.

mt_bfloat162

read.

and b.

Parameters

  • a (in):
  • b (in): mt_bfloat162. Is only being

Returns

  • mt_bfloat162
  • The vector result of unordered less-than comparison of vectors a

__hltu2_mask

unsigned __hltu2_mask(const __mt_bfloat162 a, const __mt_bfloat162 b)

Performs mt_bfloat162 vector unordered less-than comparison.

Performs mt_bfloat162 vector less-than comparison of inputs a and b. The corresponding unsigned bits are set to 0xFFFF for true, or 0x0 for false. NaN inputs generate true results.

  • The vector mask result of unordered less-than comparison of vectors a and b.

Parameters

  • a (in): mt_bfloat162
  • b (in): mt_bfloat162

Returns

  • unsigned int

Bfloat16 Comparison Functions

__hmax

__mt_bfloat16 __hmax(const __mt_bfloat16 a, const __mt_bfloat16 b)

Calculates mt_bfloat16 maximum of two input values.

Calculates mt_bfloat16 max(a, b) defined as a > b ? a : b. - If either of inputs is NaN, the other input is returned. - If both inputs are NaNs, then canonical NaN is returned. - If values of both inputs are 0.0, then +0.0 > -0.0.

Parameters

  • a (in): mt_bfloat16
  • b (in): mt_bfloat16

Returns

  • mt_bfloat16

Bfloat162 Comparison Functions 205

__hmax2

__mt_bfloat162 __hmax2(const __mt_bfloat162 a, const __mt_bfloat162 b)

Calculates mt_bfloat162 vector maximum of two inputs.

Calculates mt_bfloat162 vector max(a, b). Elementwise mt_bfloat16 operation is defined as a > b ? a : b. - If either of inputs is NaN, the other input is returned. - If both inputs are NaNs, then canonical NaN is returned. - If values of both inputs are 0.0, then +0.0 > -0.0.

Parameters

  • a (in): mt_bfloat162
  • b (in): mt_bfloat162

Returns

  • mt_bfloat162
  • The result of elementwise maximum of vectors a and b

__hmax2_nan

__mt_bfloat162 __hmax2_nan(const __mt_bfloat162 a, const __mt_bfloat162 b)

Calculates mt_bfloat162 vector maximum of two inputs, NaNs pass through.

Calculates mt_bfloat162 vector max(a, b). Elementwise mt_bfloat16 operation is defined as a > b ? a : b. - If either of inputs is NaN, then canonical NaN is returned. - If values of both inputs are 0.0, then +0.0 > -0.0.

NaNs pass through

Parameters

  • a (in): mt_bfloat162
  • b (in): mt_bfloat162

Returns

  • mt_bfloat162
  • The result of elementwise maximum of vectors a and b, with

Bfloat16 Comparison Functions

__hmax_nan

__mt_bfloat16 __hmax_nan(const __mt_bfloat16 a, const __mt_bfloat16 b)

Calculates mt_bfloat16 maximum of two input values, NaNs pass through.

Calculates mt_bfloat16 max(a, b) defined as a > b ? a : b. - If either of inputs is NaN, then canonical NaN is returned. - If values of both inputs are 0.0, then +0.0 > -0.0.

Parameters

  • a (in): mt_bfloat16
  • b (in): mt_bfloat16

Returns

  • mt_bfloat16

__hmin

__mt_bfloat16 __hmin(const __mt_bfloat16 a, const __mt_bfloat16 b)

Calculates mt_bfloat16 minimum of two input values.

Calculates mt_bfloat16 min(a, b) defined as a < b ? a : b. - If either of inputs is NaN, the other input is returned. - If both inputs are NaNs, then canonical NaN is returned. - If values of both inputs are 0.0, then +0.0 > -0.0.

Parameters

  • a (in): mt_bfloat16
  • b (in): mt_bfloat16

Returns

  • mt_bfloat16

Bfloat162 Comparison Functions 205

__hmin2

__mt_bfloat162 __hmin2(const __mt_bfloat162 a, const __mt_bfloat162 b)

Calculates mt_bfloat162 vector minimum of two inputs.

Calculates mt_bfloat162 vector min(a, b). Elementwise mt_bfloat16 operation is defined as a < b ? a : b. - If either of inputs is NaN, the other input is returned. - If both inputs are NaNs, then canonical NaN is returned. - If values of both inputs are 0.0, then +0.0 > -0.0.

Parameters

  • a (in): mt_bfloat162
  • b (in): mt_bfloat162

Returns

  • mt_bfloat162
  • The result of elementwise minimum of vectors a and b

__hmin2_nan

__mt_bfloat162 __hmin2_nan(const __mt_bfloat162 a, const __mt_bfloat162 b)

Calculates mt_bfloat162 vector minimum of two inputs, NaNs pass through.

Calculates mt_bfloat162 vector min(a, b). Elementwise mt_bfloat16 operation is defined as a < b ? a : b. - If either of inputs is NaN, then canonical NaN is returned. - If values of both inputs are 0.0, then +0.0 > -0.0.

NaNs pass through

Parameters

  • a (in): mt_bfloat162
  • b (in): mt_bfloat162

Returns

  • mt_bfloat162
  • The result of elementwise minimum of vectors a and b, with

Bfloat16 Comparison Functions

__hmin_nan

__mt_bfloat16 __hmin_nan(const __mt_bfloat16 a, const __mt_bfloat16 b)

Calculates mt_bfloat16 minimum of two input values, NaNs pass through.

Calculates mt_bfloat16 min(a, b) defined as a < b ? a : b. - If either of inputs is NaN, then canonical NaN is returned. - If values of both inputs are 0.0, then +0.0 > -0.0.

Parameters

  • a (in): mt_bfloat16
  • b (in): mt_bfloat16

Returns

  • mt_bfloat16

Bfloat16 Arithmetic Functions

__hmul

__mt_bfloat16 __hmul(const __mt_bfloat16 a, const __mt_bfloat16 b)

Performs mt_bfloat16 multiplication in round-to-nearest-even mode.

Performs mt_bfloat16 multiplication of inputs a and b, in round-to-nearest mode.

Parameters

  • a (in): mt_bfloat16
  • b (in): mt_bfloat16

Returns

  • mt_bfloat16
  • The result of multiplying a and b.

Bfloat162 Arithmetic Functions

__hmul2

__mt_bfloat162 __hmul2(const __mt_bfloat162 a, const __mt_bfloat162 b)

Performs mt_bfloat162 vector multiplication in round-to-nearest-even mode.

Performs mt_bfloat162 vector multiplication of inputs a and b, in round-to-nearest-even mode.

Parameters

  • a (in): mt_bfloat162
  • b (in): mt_bfloat162

Returns

  • mt_bfloat162
  • The result of elementwise multiplying the vectors a and b.

__hmul2_rn

__mt_bfloat162 __hmul2_rn(const __mt_bfloat162 a, const __mt_bfloat162 b)

Performs mt_bfloat162 vector multiplication in round-to-nearest-even mode.

Subtracts mt_bfloat162 input b from input a in round-to-nearest mode. Prevents floating-point contractions of mul+add or sub into fma.

mt_bfloat162

Parameters

  • a (in): mt_bfloat162
  • b (in):

Returns

  • mt_bfloat162
  • The result of multiplication b from a.

__hmul2_sat

__mt_bfloat162 __hmul2_sat(const __mt_bfloat162 a, const __mt_bfloat162 b)

Performs mt_bfloat162 vector multiplication in round-to-nearest-even mode, with saturation to [0.0, 1.0].

Performs mt_bfloat162 vector multiplication of inputs a and b, in round-to-nearest-even mode, and clamps the results to range [0.0, 1.0]. NaN results are flushed to +0.0.

read.

with respect to saturation.

Parameters

  • a (in): mt_bfloat162. Is only being
  • b (in): mt_bfloat162

Returns

  • mt_bfloat162
  • The result of elementwise multiplication of vectors a and b,

Bfloat16 Arithmetic Functions

__hmul_rn

__mt_bfloat16 __hmul_rn(const __mt_bfloat16 a, const __mt_bfloat16 b)

Performs mt_bfloat16 multiplication in round-to-nearest-even mode.

Subtracts mt_bfloat16 input b from input a in round-to-nearest mode. Prevents floating-point contractions of mul+add or sub into fma.

mt_bfloat16

Parameters

  • a (in): mt_bfloat16
  • b (in):

Returns

  • mt_bfloat16
  • The result of multiplication b from a.

__hmul_sat

__mt_bfloat16 __hmul_sat(const __mt_bfloat16 a, const __mt_bfloat16 b)

Performs mt_bfloat16 multiplication in round-to-nearest-even mode, with saturation to [0.0, 1.0].

Performs mt_bfloat16 multiplication of inputs a and b, in round-to-nearest mode, and clamps the result to range [0.0, 1.0]. NaN results are flushed to +0.0.

Parameters

  • a (in): mt_bfloat16
  • b (in): mt_bfloat16

Returns

  • mt_bfloat16
  • The result of multiplying a and b, with respect to saturation.

Bfloat16 Comparison Functions

__hne

bool __hne(const __mt_bfloat16 a, const __mt_bfloat16 b)

Performs mt_bfloat16 not-equal comparison.

Performs mt_bfloat16 not-equal comparison of inputs a and b. NaN inputs generate false results.

being.

Parameters

  • a (in): mt_bfloat16. Is only
  • b (in): mt_bfloat16

Returns

  • bool
  • The boolean result of not-equal comparison of a and b.

Bfloat162 Comparison Functions 205

__hne2

__mt_bfloat162 __hne2(const __mt_bfloat162 a, const __mt_bfloat162 b)

Performs mt_bfloat162 vector not-equal comparison.

Performs mt_bfloat162 vector not-equal comparison of inputs a and b. The corresponding mt_bfloat16 results are set to 1.0 for true, or 0.0 for false. NaN inputs generate false results.

mt_bfloat162

read.

Parameters

  • a (in):
  • b (in): mt_bfloat162. Is only being

Returns

  • mt_bfloat162
  • The vector result of not-equal comparison of vectors a and b.

__hne2_mask

unsigned __hne2_mask(const __mt_bfloat162 a, const __mt_bfloat162 b)

Performs mt_bfloat162 vector not-equal comparison.

Performs mt_bfloat162 vector not-equal comparison of inputs a and b. The corresponding mt_bfloat16 results are set to 0xFFFF for true, or 0x0 for false. NaN inputs generate false results.

mt_bfloat162

read.

Parameters

  • a (in):
  • b (in): mt_bfloat162. Is only being

Returns

  • unsigned int
  • The vector result of not-equal comparison of vectors a and b.

Bfloat16 Arithmetic Functions

__hneg

__mt_bfloat16 __hneg(const __mt_bfloat16 a)

Negates input mt_bfloat16 number and returns the result.

Negates input mt_bfloat16 number and returns the result.

Parameters

  • a (in): mt_bfloat16

Returns

  • mt_bfloat16
  • minus a

Bfloat162 Arithmetic Functions

__hneg2

__mt_bfloat162 __hneg2(const __mt_bfloat162 a)

Negates both halves of the input mt_bfloat162 number and returns the result.

Negates both halves of the input mt_bfloat162 number a and returns the result.

Parameters

  • a (in): mt_bfloat162

Returns

  • mt_bfloat162
  • Returns a with both halves negated.

Bfloat16 Comparison Functions

__hneu

bool __hneu(const __mt_bfloat16 a, const __mt_bfloat16 b)

Performs mt_bfloat16 unordered not-equal comparison.

Performs mt_bfloat16 not-equal comparison of inputs a and b. NaN inputs generate true results.

being.

b.

Parameters

  • a (in): mt_bfloat16. Is only
  • b (in): mt_bfloat16

Returns

  • bool
  • The boolean result of unordered not-equal comparison of a and

Bfloat162 Comparison Functions 205

__hneu2

__mt_bfloat162 __hneu2(const __mt_bfloat162 a, const __mt_bfloat162 b)

Performs mt_bfloat162 vector unordered not-equal comparison.

Performs mt_bfloat162 vector not-equal comparison of inputs a and b. The corresponding mt_bfloat16 results are set to 1.0 for true, or 0.0 for false. NaN inputs generate true results.

mt_bfloat162

read.

and b.

Parameters

  • a (in):
  • b (in): mt_bfloat162. Is only being

Returns

  • mt_bfloat162
  • The vector result of unordered not-equal comparison of vectors a

__hneu2_mask

unsigned __hneu2_mask(const __mt_bfloat162 a, const __mt_bfloat162 b)

Performs mt_bfloat162 vector unordered not-equal comparison.

Performs mt_bfloat162 vector not-equal comparison of inputs a and b. The corresponding mt_bfloat16 results are set to 0xFFFF for true, or 0x0 for false. NaN inputs generate true results.

mt_bfloat162

read.

Parameters

  • a (in):
  • b (in): mt_bfloat162. Is only being

Returns

  • unsigned int
  • The vector result of not-equal comparison of vectors a and b.

Bfloat16 Arithmetic Functions

__hsub

__mt_bfloat16 __hsub(const __mt_bfloat16 a, const __mt_bfloat16 b)

Performs mt_bfloat16 subtraction in round-to-nearest-even mode.

Subtracts mt_bfloat16 input b from input a in round-to-nearest mode.

Parameters

  • a (in): mt_bfloat16
  • b (in): mt_bfloat16

Returns

  • mt_bfloat16
  • The result of subtracting b from a.

Bfloat162 Arithmetic Functions

__hsub2

__mt_bfloat162 __hsub2(const __mt_bfloat162 a, const __mt_bfloat162 b)

Performs mt_bfloat162 vector subtraction in round-to-nearest-even mode.

Subtracts mt_bfloat162 input vector b from input vector a in round-to-nearest-even mode.

Parameters

  • a (in): mt_bfloat162
  • b (in): mt_bfloat162

Returns

  • mt_bfloat162
  • The subtraction of vector b from a.

__hsub2_rn

__mt_bfloat162 __hsub2_rn(const __mt_bfloat162 a, const __mt_bfloat162 b)

Performs half2 vector subtraction in round-to-nearest-even mode. Prevents floating-point contractions of mul+sub into fma.

Subtracts half2 input vector b from input vector a in round-to-nearest-even mode.

Parameters

  • a (in): half2..
  • b (in): half2..

Returns

  • half2
  • The subtraction of vector b from a.

__hsub2_sat

__mt_bfloat162 __hsub2_sat(const __mt_bfloat162 a, const __mt_bfloat162 b)

Performs mt_bfloat162 vector subtraction in round-to-nearest-even mode, with saturation to [0.0, 1.0].

Subtracts mt_bfloat162 input vector b from input vector a in round-to-nearest-even mode, and clamps the results to range [0.0, 1.0]. NaN results are flushed to +0.0.

read.

Parameters

  • a (in): mt_bfloat162. Is only being
  • b (in): mt_bfloat162

Returns

  • mt_bfloat162
  • The subtraction of vector b from a, with respect to saturation.

Bfloat16 Arithmetic Functions

__hsub_rn

__mt_bfloat16 __hsub_rn(const __mt_bfloat16 a, const __mt_bfloat16 b)

Performs mt_bfloat16 subtraction in round-to-nearest-even mode.

Subtracts mt_bfloat16 input b from input a in round-to-nearest mode. Prevents floating-point contractions of mul+sub into fma.

mt_bfloat16

Parameters

  • a (in): mt_bfloat16
  • b (in):

Returns

  • mt_bfloat16
  • The result of subtracting b from a.

__hsub_sat

__mt_bfloat16 __hsub_sat(const __mt_bfloat16 a, const __mt_bfloat16 b)

Performs mt_bfloat16 subtraction in round-to-nearest-even mode, with saturation to [0.0, 1.0].

Subtracts mt_bfloat16 input b from input a in round-to-nearest mode, and clamps the result to range [0.0, 1.0]. NaN results are flushed to +0.0.

saturation.

Parameters

  • a (in): mt_bfloat16
  • b (in): mt_bfloat16

Returns

  • mt_bfloat16
  • The result of subtraction of b from a, with respect to

Bfloat16 Precision Conversion and Data Movement 161

__int2bfloat16_rd

__mt_bfloat16 __int2bfloat16_rd(const int i)

Convert a signed integer to a mt_bfloat16 in round-down mode.

Convert the signed integer value i to a mt_bfloat16 floating-point value in round-down mode.

read.

Parameters

  • i (in): int. Is only being

Returns

  • mt_bfloat16
  • i converted to mt_bfloat16.

__int2bfloat16_rn

__mt_bfloat16 __int2bfloat16_rn(const int i)

Convert a signed integer to a mt_bfloat16 in round-to-nearest-even mode.

Convert the signed integer value i to a mt_bfloat16 floating-point value in round-to-nearest-even mode.

only.

Parameters

  • i (in): int. Is

Returns

  • mt_bfloat16
  • i converted to mt_bfloat16.

__int2bfloat16_ru

__mt_bfloat16 __int2bfloat16_ru(const int i)

Convert a signed integer to a mt_bfloat16 in round-up mode.

Convert the signed integer value i to a mt_bfloat16 floating-point value in round-up mode.

read.

Parameters

  • i (in): int. Is only being

Returns

  • mt_bfloat16
  • i converted to mt_bfloat16.

__int2bfloat16_rz

__mt_bfloat16 __int2bfloat16_rz(const int i)

Convert a signed integer to a mt_bfloat16 in round-towards-zero mode.

Convert the signed integer value i to a mt_bfloat16 floating-point value in round-towards-zero mode.

being.

Parameters

  • i (in): int. Is only

Returns

  • mt_bfloat16
  • i converted to mt_bfloat16.

__ldca

__mt_bfloat162 __ldca(const __mt_bfloat162 *const ptr)

Loads a value from the specified global memory address.

Parameters

  • ptr (in): source memory location to load from

Returns

  • The value loaded from ptr

__ldca

__mt_bfloat16 __ldca(const __mt_bfloat16 *const ptr)

Loads a value from the specified global memory address.

Parameters

  • ptr (in): source memory location to load from

Returns

  • The value loaded from ptr

__ldcg

__mt_bfloat162 __ldcg(const __mt_bfloat162 *const ptr)

Loads a value from the specified global memory address.

Parameters

  • ptr (in): source memory location to load from

Returns

  • The value loaded from ptr

__ldcg

__mt_bfloat16 __ldcg(const __mt_bfloat16 *const ptr)

Loads a value from the specified global memory address.

Parameters

  • ptr (in): source memory location to load from

Returns

  • The value loaded from ptr

__ldcs

__mt_bfloat162 __ldcs(const __mt_bfloat162 *const ptr)

Loads a value from the specified global memory address.

Parameters

  • ptr (in): source memory location to load from

Returns

  • The value loaded from ptr

__ldcs

__mt_bfloat16 __ldcs(const __mt_bfloat16 *const ptr)

Loads a value from the specified global memory address.

Parameters

  • ptr (in): source memory location to load from

Returns

  • The value loaded from ptr

__ldcv

__mt_bfloat162 __ldcv(const __mt_bfloat162 *const ptr)

Loads a value from the specified global memory address.

Parameters

  • ptr (in): source memory location to load from

Returns

  • The value loaded from ptr

__ldcv

__mt_bfloat16 __ldcv(const __mt_bfloat16 *const ptr)

Loads a value from the specified global memory address.

Parameters

  • ptr (in): source memory location to load from

Returns

  • The value loaded from ptr

__ldg

__mt_bfloat162 __ldg(const __mt_bfloat162 *const ptr)

Loads a value from the specified global memory address.

Parameters

  • ptr (in): source memory location to load from

Returns

  • The value loaded from ptr

__ldg

__mt_bfloat16 __ldg(const __mt_bfloat16 *const ptr)

Loads a value from the specified global memory address.

Parameters

  • ptr (in): source memory location to load from

Returns

  • The value loaded from ptr

__ll2bfloat16_rd

__mt_bfloat16 __ll2bfloat16_rd(const long long int i)

Convert a signed 64-bit integer to a mt_bfloat16 in round-down mode.

Convert the signed 64-bit integer value i to a mt_bfloat16 floating-point value in round-down mode.

only.

Parameters

  • i (in): long long int. Is

Returns

  • mt_bfloat16
  • i converted to mt_bfloat16.

__ll2bfloat16_rn

__mt_bfloat16 __ll2bfloat16_rn(const long long int i)

Convert a signed 64-bit integer to a mt_bfloat16 in round-to-nearest-even mode.

Convert the signed 64-bit integer value i to a mt_bfloat16 floating-point value in round-to-nearest-even mode.

int

Parameters

  • i (in): long long

Returns

  • mt_bfloat16
  • i converted to mt_bfloat16.

__ll2bfloat16_ru

__mt_bfloat16 __ll2bfloat16_ru(const long long int i)

Convert a signed 64-bit integer to a mt_bfloat16 in round-up mode.

Convert the signed 64-bit integer value i to a mt_bfloat16 floating-point value in round-up mode.

being.

Parameters

  • i (in): long long int. Is only

Returns

  • mt_bfloat16
  • i converted to mt_bfloat16.

__ll2bfloat16_rz

__mt_bfloat16 __ll2bfloat16_rz(const long long int i)

Convert a signed 64-bit integer to a mt_bfloat16 in round-towards-zero mode.

Convert the signed 64-bit integer value i to a mt_bfloat16 floating-point value in round-towards-zero mode.

int

Parameters

  • i (in): long long

Returns

  • mt_bfloat16
  • i converted to mt_bfloat16.

__low2bfloat16

__mt_bfloat16 __low2bfloat16(const __mt_bfloat162 a)

Returns low 16 bits of mt_bfloat162 input.

Returns low 16 bits of mt_bfloat162 input a.

Parameters

  • a (in): mt_bfloat162

Returns

  • mt_bfloat16
  • Returns mt_bfloat16 which contains low 16 bits of the input a.

__low2bfloat162

__mt_bfloat162 __low2bfloat162(const __mt_bfloat162 a)

Extracts low 16 bits from mt_bfloat162 input.

Extracts low 16 bits from mt_bfloat162 input a and returns a new mt_bfloat162 number which has both halves equal to the extracted bits.

input.

Parameters

  • a (in): mt_bfloat162

Returns

  • mt_bfloat162
  • The mt_bfloat162 with both halves equal to the low 16 bits of the

__low2float

float __low2float(const __mt_bfloat162 a)

Converts low 16 bits of mt_bfloat162 to float and returns the result

Converts low 16 bits of mt_bfloat162 input a to 32-bit floating-point number and returns the result.

only.

Parameters

  • a (in): mt_bfloat162. Is

Returns

  • float
  • The low 16 bits of a converted to float.

__lowhigh2highlow

__mt_bfloat162 __lowhigh2highlow(const __mt_bfloat162 a)

Swaps both halves of the mt_bfloat162 input.

Swaps both halves of the mt_bfloat162 input and returns a new mt_bfloat162 number with swapped halves.

being.

Parameters

  • a (in): mt_bfloat162. Is only

Returns

  • mt_bfloat162
  • a with its halves being swapped.

__lows2bfloat162

__mt_bfloat162 __lows2bfloat162(const __mt_bfloat162 a, const __mt_bfloat162 b)

Extracts low 16 bits from each of the two mt_bfloat162 inputs and combines into one mt_bfloat162 number.

Extracts low 16 bits from each of the two mt_bfloat162 inputs and combines into one mt_bfloat162 number. Low 16 bits from input a is stored in low 16 bits of the return value, low 16 bits from input b is stored in high 16 bits of the return value.

only.

Parameters

  • a (in): mt_bfloat162. Is
  • b (in): mt_bfloat162

Returns

  • mt_bfloat162
  • The low 16 bits of a and of b.

Bfloat16 Precision Conversion and Data Movement 163

__mt_bfloat16

__mt_bfloat16(const __mt_bfloat16_raw &hr)

Construct __mt_bfloat16 from __mt_bfloat16_raw.

__mt_bfloat16

__mt_bfloat16()

Construct __mt_bfloat16 from default.

__mt_bfloat16

explicit __mt_bfloat16(const __half f)

Construct __mt_bfloat16 from __half input using default round-to-nearest-even rounding mode.

__mt_bfloat16

__mt_bfloat16(const float f)

Construct __mt_bfloat16 from float input using default round-to-nearest-even rounding mode.

__mt_bfloat16

__mt_bfloat16(const double f)

Construct __mt_bfloat16 from double input using default round-to-nearest-even rounding mode.

__mt_bfloat16

__mt_bfloat16(short val)

Construct __mt_bfloat16 from double input using default round-to-nearest-even rounding mode.

__mt_bfloat16

__mt_bfloat16(unsigned short val)

Construct __mt_bfloat16 from short integer input using default round-to-nearest-even rounding mode.

__mt_bfloat16

__mt_bfloat16(int val)

Construct __mt_bfloat16 from int input using default round-to-nearest-even rounding mode.

__mt_bfloat16

__mt_bfloat16(unsigned int val)

Construct __mt_bfloat16 from unsigned int input using default round-to-nearest-even rounding mode.

__mt_bfloat16

__mt_bfloat16(const long val)

Construct __mt_bfloat16 from long input using default round-to-nearest-even rounding mode.

__mt_bfloat16

__mt_bfloat16(const unsigned long val)

Construct __mt_bfloat16 from unsigned long input using default round-to-nearest-even rounding mode.

__mt_bfloat16

__mt_bfloat16(long long val)

Construct __mt_bfloat16 from long long input using default round-to-nearest-even rounding mode.

__mt_bfloat16

__mt_bfloat16(unsigned long long val)

Construct __mt_bfloat16 from unsigned long long input using default round-to-nearest-even rounding mode.

Bfloat16 Precision Conversion and Data Movement 161

__mt_bfloat162

__mt_bfloat162(const __mt_bfloat16 &a, const __mt_bfloat16 &b)

Constructor from two __mt_bfloat16 variables.

__mt_bfloat162

__mt_bfloat162()

Constructor by default.

__mt_bfloat162

__mt_bfloat162(__mt_bfloat162 &&src)

Move constructor, available for C++11 and later dialects.

__mt_bfloat162

__mt_bfloat162(const __mt_bfloat162 &src)

Copy constructor.

__mt_bfloat162

__mt_bfloat162(const __mt_bfloat162_raw &h2r)

Constructor from __mt_bfloat162_raw.

Bfloat16 Precision Conversion and Data Movement 165

__shfl_down_sync

__mt_bfloat162 __shfl_down_sync(const unsigned mask, const __mt_bfloat162 var, const unsigned int delta, const int width)

Exchange a variable between threads within a warp. Copy from a thread with higher ID relative to the caller.

Calculates a source thread ID by adding delta to the caller's thread ID. The value of var held by the resulting thread ID is returned: this has the effect of shifting var down the warp by delta threads. If width is less than warpSize then each subsection of the warp behaves as a separate entity with a starting logical thread ID of 0. As for __shfl_up_sync(), the ID number of the source thread will not wrap around the value of width and so the upper delta threads will remain unchanged.

int

as mt_bfloat162. If the source thread ID is out of range or the source thread has exited, the calling thread's own var is returned.

Parameters

  • mask (in): unsigned
  • var (in): mt_bfloat162
  • delta (in): int
  • width (in): int

Returns

  • Returns the 4-byte word referenced by var from the source thread ID

__shfl_down_sync

__mt_bfloat16 __shfl_down_sync(const unsigned mask, const __mt_bfloat16 var, const unsigned int delta, const int width)

Exchange a variable between threads within a warp. Copy from a thread with higher ID relative to the caller.

Calculates a source thread ID by adding delta to the caller's thread ID. The value of var held by the resulting thread ID is returned: this has the effect of shifting var down the warp by delta threads. If width is less than warpSize then each subsection of the warp behaves as a separate entity with a starting logical thread ID of 0. As for __shfl_up_sync(), the ID number of the source thread will not wrap around the value of width and so the upper delta threads will remain unchanged.

int

as mt_bfloat162. If the source thread ID is out of range or the source thread has exited, the calling thread's own var is returned.

Parameters

  • mask (in): unsigned
  • var (in): mt_bfloat162
  • delta (in): int
  • width (in): int

Returns

  • Returns the 4-byte word referenced by var from the source thread ID

__shfl_sync

__mt_bfloat162 __shfl_sync(const unsigned mask, const __mt_bfloat162 var, const int delta, const int width)

Exchange a variable between threads within a warp. Direct copy from indexed thread.

Returns the value of var held by the thread whose ID is given by delta. If width is less than warpSize then each subsection of the warp behaves as a separate entity with a starting logical thread ID of 0. If delta is outside the range [0:width-1], the value returned corresponds to the value of var held by the delta modulo width (i.e. within the same subsection). width must have a value which is a power of 2; results are undefined if width is not a power of 2, or is a number greater than warpSize.

unsigned int

being.

int

as mt_bfloat162. If the source thread ID is out of range or the source thread has exited, the calling thread's own var is returned.

Parameters

  • mask (in):
  • var (in): mt_bfloat162. Is only
  • delta (in): int
  • width (in):

Returns

  • Returns the 4-byte word referenced by var from the source thread ID

__shfl_sync

__mt_bfloat16 __shfl_sync(const unsigned mask, const __mt_bfloat16 var, const int delta, const int width)

Exchange a variable between threads within a warp. Direct copy from indexed thread.

Returns the value of var held by the thread whose ID is given by delta. If width is less than warpSize then each subsection of the warp behaves as a separate entity with a starting logical thread ID of 0. If delta is outside the range [0:width-1], the value returned corresponds to the value of var held by the delta modulo width (i.e. within the same subsection). width must have a value which is a power of 2; results are undefined if width is not a power of 2, or is a number greater than warpSize.

unsigned int

being.

int

as mt_bfloat162. If the source thread ID is out of range or the source thread has exited, the calling thread's own var is returned.

Parameters

  • mask (in):
  • var (in): mt_bfloat162. Is only
  • delta (in): int
  • width (in):

Returns

  • Returns the 4-byte word referenced by var from the source thread ID

__shfl_up_sync

__mt_bfloat162 __shfl_up_sync(const unsigned mask, const __mt_bfloat162 var, const unsigned int delta, const int width)

Exchange a variable between threads within a warp. Copy from a thread with lower ID relative to the caller.

Calculates a source thread ID by subtracting delta from the caller's lane ID. The value of var held by the resulting lane ID is returned: in effect, var is shifted up the warp by delta threads. If width is less than warpSize then each subsection of the warp behaves as a separate entity with a starting logical thread ID of 0. The source thread index will not wrap around the value of width, so effectively the lower delta threads will be unchanged. width must have a value which is a power of 2; results are undefined if width is not a power of 2, or is a number greater than warpSize.

unsigned int

being.

int

as mt_bfloat162. If the source thread ID is out of range or the source thread has exited, the calling thread's own var is returned.

Parameters

  • mask (in):
  • var (in): mt_bfloat162. Is only
  • delta (in): int
  • width (in):

Returns

  • Returns the 4-byte word referenced by var from the source thread ID

__shfl_up_sync

__mt_bfloat16 __shfl_up_sync(const unsigned mask, const __mt_bfloat16 var, const unsigned int delta, const int width)

Exchange a variable between threads within a warp. Copy from a thread with lower ID relative to the caller.

Calculates a source thread ID by subtracting delta from the caller's lane ID. The value of var held by the resulting lane ID is returned: in effect, var is shifted up the warp by delta threads. If width is less than warpSize then each subsection of the warp behaves as a separate entity with a starting logical thread ID of 0. The source thread index will not wrap around the value of width, so effectively the lower delta threads will be unchanged. width must have a value which is a power of 2; results are undefined if width is not a power of 2, or is a number greater than warpSize.

unsigned int

being.

int

as mt_bfloat162. If the source thread ID is out of range or the source thread has exited, the calling thread's own var is returned.

Parameters

  • mask (in):
  • var (in): mt_bfloat162. Is only
  • delta (in): int
  • width (in):

Returns

  • Returns the 4-byte word referenced by var from the source thread ID

__shfl_xor_sync

__mt_bfloat162 __shfl_xor_sync(const unsigned mask, const __mt_bfloat162 var, const int delta, const int width)

Exchange a variable between threads within a warp. Copy from a thread based on bitwise XOR of own thread ID.

Calculates a source thread ID by performing a bitwise XOR of the caller's thread ID with mask: the value of var held by the resulting thread ID is returned. If width is less than warpSize then each group of width consecutive threads are able to access elements from earlier groups of threads, however if they attempt to access elements from later groups of threads their own value of var will be returned. This mode implements a butterfly addressing pattern such as is used in tree reduction and broadcast.

as mt_bfloat162. If the source thread ID is out of range or the source thread has exited, the calling thread's own var is returned.

Parameters

  • mask (in): unsigned int
  • var (in): mt_bfloat162
  • delta (in): int
  • width (in): int

Returns

  • Returns the 4-byte word referenced by var from the source thread ID

__shfl_xor_sync

__mt_bfloat16 __shfl_xor_sync(const unsigned mask, const __mt_bfloat16 var, const int delta, const int width)

Exchange a variable between threads within a warp. Copy from a thread based on bitwise XOR of own thread ID.

Calculates a source thread ID by performing a bitwise XOR of the caller's thread ID with mask: the value of var held by the resulting thread ID is returned. If width is less than warpSize then each group of width consecutive threads are able to access elements from earlier groups of threads, however if they attempt to access elements from later groups of threads their own value of var will be returned. This mode implements a butterfly addressing pattern such as is used in tree reduction and broadcast.

as mt_bfloat162. If the source thread ID is out of range or the source thread has exited, the calling thread's own var is returned.

Parameters

  • mask (in): unsigned int
  • var (in): mt_bfloat162
  • delta (in): int
  • width (in): int

Returns

  • Returns the 4-byte word referenced by var from the source thread ID

__short2bfloat16_rd

__mt_bfloat16 __short2bfloat16_rd(const short int i)

Convert a signed short integer to a mt_bfloat16 in round-down mode.

Convert the signed short integer value i to a mt_bfloat16 floating-point value in round-down mode.

being.

Parameters

  • i (in): short int. Is only

Returns

  • mt_bfloat16
  • i converted to mt_bfloat16.

__short2bfloat16_rn

__mt_bfloat16 __short2bfloat16_rn(const short int i)

Convert a signed short integer to a mt_bfloat16 in round-to-nearest-even mode.

Convert the signed short integer value i to a mt_bfloat16 floating-point value in round-to-nearest-even mode.

Is only.

Parameters

  • i (in): short int.

Returns

  • mt_bfloat16
  • i converted to mt_bfloat16.

__short2bfloat16_ru

__mt_bfloat16 __short2bfloat16_ru(const short int i)

Convert a signed short integer to a mt_bfloat16 in round-up mode.

Convert the signed short integer value i to a mt_bfloat16 floating-point value in round-up mode.

being.

Parameters

  • i (in): short int. Is only

Returns

  • mt_bfloat16
  • i converted to mt_bfloat16.

__short2bfloat16_rz

__mt_bfloat16 __short2bfloat16_rz(const short int i)

Convert a signed short integer to a mt_bfloat16 in round-towards-zero mode.

Convert the signed short integer value i to a mt_bfloat16 floating-point value in round-towards-zero mode.

only.

Parameters

  • i (in): short int. Is

Returns

  • mt_bfloat16
  • i converted to mt_bfloat16.

__short_as_bfloat16

__mt_bfloat16 __short_as_bfloat16(const short int i)

Reinterprets bits in a signed short integer as a mt_bfloat16.

Reinterprets the bits in the signed short integer i as a mt_bfloat16 floating-point number.

Parameters

  • i (in): short int

Returns

  • mt_bfloat16
  • The reinterpreted value.

__stcg

void __stcg(__mt_bfloat162 *const ptr, const __mt_bfloat162 value)

Stores a value to the specified global memory address.

Parameters

  • ptr (out): destination memory location for the store
  • value (in): value to write to ptr

__stcg

void __stcg(__mt_bfloat16 *const ptr, const __mt_bfloat16 value)

Stores a value to the specified global memory address.

Parameters

  • ptr (out): destination memory location for the store
  • value (in): value to write to ptr

__stcs

void __stcs(__mt_bfloat162 *const ptr, const __mt_bfloat162 value)

Stores a value to the specified global memory address.

Parameters

  • ptr (out): destination memory location for the store
  • value (in): value to write to ptr

__stcs

void __stcs(__mt_bfloat16 *const ptr, const __mt_bfloat16 value)

Stores a value to the specified global memory address.

Parameters

  • ptr (out): destination memory location for the store
  • value (in): value to write to ptr

__stwb

void __stwb(__mt_bfloat162 *const ptr, const __mt_bfloat162 value)

Stores a value to the specified global memory address.

Parameters

  • ptr (out): destination memory location for the store
  • value (in): value to write to ptr

__stwb

void __stwb(__mt_bfloat16 *const ptr, const __mt_bfloat16 value)

Stores a value to the specified global memory address.

Parameters

  • ptr (out): destination memory location for the store
  • value (in): value to write to ptr

__stwt

void __stwt(__mt_bfloat162 *const ptr, const __mt_bfloat162 value)

Stores a value to the specified global memory address.

Parameters

  • ptr (out): destination memory location for the store
  • value (in): value to write to ptr

__stwt

void __stwt(__mt_bfloat16 *const ptr, const __mt_bfloat16 value)

Stores a value to the specified global memory address.

Parameters

  • ptr (out): destination memory location for the store
  • value (in): value to write to ptr

__uint2bfloat16_rd

__mt_bfloat16 __uint2bfloat16_rd(const unsigned int i)

Convert an unsigned integer to a mt_bfloat16 in round-down mode.

Convert the unsigned integer value i to a mt_bfloat16 floating-point value in round-down mode.

being.

Parameters

  • i (in): unsigned int. Is only

Returns

  • mt_bfloat16
  • i converted to mt_bfloat16.

__uint2bfloat16_rn

__mt_bfloat16 __uint2bfloat16_rn(const unsigned int i)

Convert an unsigned integer to a mt_bfloat16 in round-to-nearest-even mode.

Convert the unsigned integer value i to a mt_bfloat16 floating-point value in round-to-nearest-even mode.

int

Parameters

  • i (in): unsigned

Returns

  • mt_bfloat16
  • i converted to mt_bfloat16.

__uint2bfloat16_ru

__mt_bfloat16 __uint2bfloat16_ru(const unsigned int i)

Convert an unsigned integer to a mt_bfloat16 in round-up mode.

Convert the unsigned integer value i to a mt_bfloat16 floating-point value in round-up mode.

being.

Parameters

  • i (in): unsigned int. Is only

Returns

  • mt_bfloat16
  • i converted to mt_bfloat16.

__uint2bfloat16_rz

__mt_bfloat16 __uint2bfloat16_rz(const unsigned int i)

Convert an unsigned integer to a mt_bfloat16 in round-towards-zero mode.

Convert the unsigned integer value i to a mt_bfloat16 floating-point value in round-towards-zero mode.

Is only.

Parameters

  • i (in): unsigned int.

Returns

  • mt_bfloat16
  • i converted to mt_bfloat16.

__ull2bfloat16_rd

__mt_bfloat16 __ull2bfloat16_rd(const unsigned long long int i)

Convert an unsigned 64-bit integer to a mt_bfloat16 in round-down mode.

Convert the unsigned 64-bit integer value i to a mt_bfloat16 floating-point value in round-down mode.

int

Parameters

  • i (in): unsigned long long

Returns

  • mt_bfloat16
  • i converted to mt_bfloat16.

__ull2bfloat16_rn

__mt_bfloat16 __ull2bfloat16_rn(const unsigned long long int i)

Convert an unsigned 64-bit integer to a mt_bfloat16 in round-to-nearest-even mode.

Convert the unsigned 64-bit integer value i to a mt_bfloat16 floating-point value in round-to-nearest-even mode.

long long int

Parameters

  • i (in): unsigned

Returns

  • mt_bfloat16
  • i converted to mt_bfloat16.

__ull2bfloat16_ru

__mt_bfloat16 __ull2bfloat16_ru(const unsigned long long int i)

Convert an unsigned 64-bit integer to a mt_bfloat16 in round-up mode.

Convert the unsigned 64-bit integer value i to a mt_bfloat16 floating-point value in round-up mode.

Is only.

Parameters

  • i (in): unsigned long long int.

Returns

  • mt_bfloat16
  • i converted to mt_bfloat16.

__ull2bfloat16_rz

__mt_bfloat16 __ull2bfloat16_rz(const unsigned long long int i)

Convert an unsigned 64-bit integer to a mt_bfloat16 in round-towards-zero mode.

Convert the unsigned 64-bit integer value i to a mt_bfloat16 floating-point value in round-towards-zero mode.

long int

Parameters

  • i (in): unsigned long

Returns

  • mt_bfloat16
  • i converted to mt_bfloat16.

__ushort2bfloat16_rd

__mt_bfloat16 __ushort2bfloat16_rd(const unsigned short int i)

Convert an unsigned short integer to a mt_bfloat16 in round-down mode.

Convert the unsigned short integer value i to a mt_bfloat16 floating-point value in round-down mode.

Is only.

Parameters

  • i (in): unsigned short int.

Returns

  • mt_bfloat16
  • i converted to mt_bfloat16.

__ushort2bfloat16_rn

__mt_bfloat16 __ushort2bfloat16_rn(const unsigned short int i)

Convert an unsigned short integer to a mt_bfloat16 in round-to-nearest-even mode.

Convert the unsigned short integer value i to a mt_bfloat16 floating-point value in round-to-nearest-even mode.

short int

Parameters

  • i (in): unsigned

Returns

  • mt_bfloat16
  • i converted to mt_bfloat16.

Bfloat16 Precision Conversion and Data Movement 167

__ushort2bfloat16_ru

__mt_bfloat16 __ushort2bfloat16_ru(const unsigned short int i)

Convert an unsigned short integer to a mt_bfloat16 in round-up mode.

Convert the unsigned short integer value i to a mt_bfloat16 floating-point value in round-up mode.

only.

Parameters

  • i (in): unsigned short int. Is

Returns

  • mt_bfloat16
  • i converted to mt_bfloat16.

__ushort2bfloat16_rz

__mt_bfloat16 __ushort2bfloat16_rz(const unsigned short int i)

Convert an unsigned short integer to a mt_bfloat16 in round-towards-zero mode.

Convert the unsigned short integer value i to a mt_bfloat16 floating-point value in round-towards-zero mode.

short int

Parameters

  • i (in): unsigned

Returns

  • mt_bfloat16
  • i converted to mt_bfloat16.

__ushort_as_bfloat16

__mt_bfloat16 __ushort_as_bfloat16(const unsigned short int i)

Reinterprets bits in an unsigned short integer as a mt_bfloat16.

Reinterprets the bits in the unsigned short integer i as a mt_bfloat16 floating-point number.

Parameters

  • i (in): unsigned short int

Returns

  • mt_bfloat16
  • The reinterpreted value.

Bfloat16 Arithmetic Functions

atomicAdd

__mt_bfloat162 atomicAdd(__mt_bfloat162 *const address, const __mt_bfloat162 val)

Adds val to the value stored at address in global or shared memory, and writes this value back to address .

atomicAdd

__mt_bfloat16 atomicAdd(__mt_bfloat16 *const address, const __mt_bfloat16 val)

Adds val to the value stored at address in global or shared memory, and writes this value back to address .

Bfloat162 Math Functions

h2ceil

__mt_bfloat162 h2ceil(const __mt_bfloat162 h)

Calculate mt_bfloat162 vector ceiling of the input argument.

For each component of vector h compute the smallest integer value not less than h.

Parameters

  • h (in): mt_bfloat162

Returns

  • mt_bfloat162
  • The vector of smallest integers not less than h.

h2cos

__mt_bfloat162 h2cos(const __mt_bfloat162 a)

Calculates mt_bfloat162 vector cosine in round-to-nearest-even mode.

Calculates mt_bfloat162 cosine of input vector a in round-to-nearest-even mode.

Parameters

  • a (in): mt_bfloat162

Returns

  • mt_bfloat162
  • The elementwise cosine on vector a.

h2exp

__mt_bfloat162 h2exp(const __mt_bfloat162 a)

Calculates mt_bfloat162 vector exponential function in round-to-nearest mode.

Calculates mt_bfloat162 exponential function of input vector a in round-to-nearest-even mode.

read.

Parameters

  • a (in): mt_bfloat162. Is only being

Returns

  • mt_bfloat162
  • The elementwise exponential function on vector a.

h2exp10

__mt_bfloat162 h2exp10(const __mt_bfloat162 a)

Calculates mt_bfloat162 vector decimal exponential function in round-to-nearest-even mode.

Calculates mt_bfloat162 decimal exponential function of input vector a in round-to-nearest-even mode.

only.

Parameters

  • a (in): mt_bfloat162. Is

Returns

  • mt_bfloat162
  • The elementwise decimal exponential function on vector a.

h2exp2

__mt_bfloat162 h2exp2(const __mt_bfloat162 a)

Calculates mt_bfloat162 vector binary exponential function in round-to-nearest-even mode.

Calculates mt_bfloat162 binary exponential function of input vector a in round-to-nearest-even mode.

only.

Parameters

  • a (in): mt_bfloat162. Is

Returns

  • mt_bfloat162
  • The elementwise binary exponential function on vector a.

h2floor

__mt_bfloat162 h2floor(const __mt_bfloat162 h)

Calculate the largest integer less than or equal to h.

For each component of vector h calculate the largest integer value which is less than or equal to h.

only.

Parameters

  • h (in): mt_bfloat162. Is

Returns

  • mt_bfloat162
  • The vector of largest integers which is less than or equal to h.

h2log

__mt_bfloat162 h2log(const __mt_bfloat162 a)

Calculates mt_bfloat162 vector natural logarithm in round-to-nearest-even mode.

Calculates mt_bfloat162 natural logarithm of input vector a in round-to-nearest-even mode.

Parameters

  • a (in): mt_bfloat162

Returns

  • mt_bfloat162
  • The elementwise natural logarithm on vector a.

h2log10

__mt_bfloat162 h2log10(const __mt_bfloat162 a)

Calculates mt_bfloat162 vector decimal logarithm in round-to-nearest-even mode.

Calculates mt_bfloat162 decimal logarithm of input vector a in round-to-nearest-even mode.

Parameters

  • a (in): mt_bfloat162

Returns

  • mt_bfloat162
  • The elementwise decimal logarithm on vector a.

h2log2

__mt_bfloat162 h2log2(const __mt_bfloat162 a)

Calculates mt_bfloat162 vector binary logarithm in round-to-nearest-even mode.

Calculates mt_bfloat162 binary logarithm of input vector a in round-to-nearest mode.

Parameters

  • a (in): mt_bfloat162

Returns

  • mt_bfloat162
  • The elementwise binary logarithm on vector a.

h2rcp

__mt_bfloat162 h2rcp(const __mt_bfloat162 a)

Calculates mt_bfloat162 vector reciprocal in round-to-nearest-even mode.

Calculates mt_bfloat162 reciprocal of input vector a in round-to-nearest-even mode.

Parameters

  • a (in): mt_bfloat162

Returns

  • mt_bfloat162
  • The elementwise reciprocal on vector a.

h2rint

__mt_bfloat162 h2rint(const __mt_bfloat162 h)

Round input to nearest integer value in mt_bfloat16 floating-point number.

Round each component of mt_bfloat162 vector h to the nearest integer value in mt_bfloat16 floating-point format, with bfloat16way cases rounded to the nearest even integer value.

only.

Parameters

  • h (in): mt_bfloat162. Is

Returns

  • mt_bfloat162
  • The vector of rounded integer values.

h2rsqrt

__mt_bfloat162 h2rsqrt(const __mt_bfloat162 a)

Calculates mt_bfloat162 vector reciprocal square root in round-to-nearest mode.

Calculates mt_bfloat162 reciprocal square root of input vector a in round-to-nearest-even mode.

read.

Parameters

  • a (in): mt_bfloat162. Is only being

Returns

  • mt_bfloat162
  • The elementwise reciprocal square root on vector a.

h2sin

__mt_bfloat162 h2sin(const __mt_bfloat162 a)

Calculates mt_bfloat162 vector sine in round-to-nearest-even mode.

Calculates mt_bfloat162 sine of input vector a in round-to-nearest-even mode.

Parameters

  • a (in): mt_bfloat162

Returns

  • mt_bfloat162
  • The elementwise sine on vector a.

h2sqrt

__mt_bfloat162 h2sqrt(const __mt_bfloat162 a)

Calculates mt_bfloat162 vector square root in round-to-nearest-even mode.

Calculates mt_bfloat162 square root of input vector a in round-to-nearest mode.

Parameters

  • a (in): mt_bfloat162

Returns

  • mt_bfloat162
  • The elementwise square root on vector a.

h2tanh

__mt_bfloat162 h2tanh(const __mt_bfloat162 a)

Calculates mt_bfloat162 vector hyperbolic tangent function in round-to-nearest-even mode.

Calculates mt_bfloat162 hyperbolic tangent function of input vector a in round-to-nearest-even mode.

only.

Parameters

  • a (in): mt_bfloat162. Is

Returns

  • mt_bfloat162
  • The elementwise hyperbolic tangent function on vector a.

h2tanh_approx

__mt_bfloat162 h2tanh_approx(const __mt_bfloat162 a)

Calculates mt_bfloat162 vector hyperbolic tangent function.

Calculates mt_bfloat162 hyperbolic tangent function of input vector a. This operation uses HW acceleration on devices of compute capability 9.x and higher.

Parameters

  • a (in): mt_bfloat162

Returns

  • mt_bfloat162
  • The elementwise hyperbolic tangent function on vector a.

h2trunc

__mt_bfloat162 h2trunc(const __mt_bfloat162 h)

Truncate mt_bfloat162 vector input argument to the integral part.

Round each component of vector h to the nearest integer value that does not exceed h in magnitude.

being.

Parameters

  • h (in): mt_bfloat162. Is only

Returns

  • mt_bfloat162
  • The truncated h.

Bfloat16 Math Functions

hceil

__mt_bfloat16 hceil(const __mt_bfloat16 h)

Calculate ceiling of the input argument.

Compute the smallest integer value not less than h.

Parameters

  • h (in): mt_bfloat16

Returns

  • mt_bfloat16
  • The smallest integer value not less than h.

hcos

__mt_bfloat16 hcos(const __mt_bfloat16 a)

Calculates mt_bfloat16 cosine in round-to-nearest-even mode.

Calculates mt_bfloat16 cosine of input a in round-to-nearest-even mode.

Parameters

  • a (in): mt_bfloat16

Returns

  • mt_bfloat16
  • The cosine of a.

hexp

__mt_bfloat16 hexp(const __mt_bfloat16 a)

Calculates mt_bfloat16 natural exponential function in round-to-nearest mode.

Calculates mt_bfloat16 natural exponential function of input a in round-to-nearest-even mode.

read.

Parameters

  • a (in): mt_bfloat16. Is only being

Returns

  • mt_bfloat16
  • The natural exponential function on a.

hexp10

__mt_bfloat16 hexp10(const __mt_bfloat16 a)

Calculates mt_bfloat16 decimal exponential function in round-to-nearest mode.

Calculates mt_bfloat16 decimal exponential function of input a in round-to-nearest-even mode.

read.

Parameters

  • a (in): mt_bfloat16. Is only being

Returns

  • mt_bfloat16
  • The decimal exponential function on a.

hexp2

__mt_bfloat16 hexp2(const __mt_bfloat16 a)

Calculates mt_bfloat16 binary exponential function in round-to-nearest mode.

Calculates mt_bfloat16 binary exponential function of input a in round-to-nearest-even mode.

read.

Parameters

  • a (in): mt_bfloat16. Is only being

Returns

  • mt_bfloat16
  • The binary exponential function on a.

hfloor

__mt_bfloat16 hfloor(const __mt_bfloat16 h)

Calculate the largest integer less than or equal to h.

Calculate the largest integer value which is less than or equal to h.

Parameters

  • h (in): mt_bfloat16

Returns

  • mt_bfloat16
  • The largest integer value which is less than or equal to h.

hlog

__mt_bfloat16 hlog(const __mt_bfloat16 a)

Calculates mt_bfloat16 natural logarithm in round-to-nearest-even mode.

Calculates mt_bfloat16 natural logarithm of input a in round-to-nearest-even mode.

Parameters

  • a (in): mt_bfloat16

Returns

  • mt_bfloat16
  • The natural logarithm of a.

hlog10

__mt_bfloat16 hlog10(const __mt_bfloat16 a)

Calculates mt_bfloat16 decimal logarithm in round-to-nearest-even mode.

Calculates mt_bfloat16 decimal logarithm of input a in round-to-nearest-even mode.

Parameters

  • a (in): mt_bfloat16

Returns

  • mt_bfloat16
  • The decimal logarithm of a.

hlog2

__mt_bfloat16 hlog2(const __mt_bfloat16 a)

Calculates mt_bfloat16 binary logarithm in round-to-nearest-even mode.

Calculates mt_bfloat16 binary logarithm of input a in round-to-nearest-even mode.

Parameters

  • a (in): mt_bfloat16

Returns

  • mt_bfloat16
  • The binary logarithm of a.

hrcp

__mt_bfloat16 hrcp(const __mt_bfloat16 a)

Calculates mt_bfloat16 reciprocal in round-to-nearest-even mode.

Calculates mt_bfloat16 reciprocal of input a in round-to-nearest-even mode.

Parameters

  • a (in): mt_bfloat16

Returns

  • mt_bfloat16
  • The reciprocal of a.

hrint

__mt_bfloat16 hrint(const __mt_bfloat16 h)

Round input to nearest integer value in mt_bfloat16 floating-point number.

Round h to the nearest integer value in mt_bfloat16 floating-point format, with bfloat16way cases rounded to the nearest even integer value.

Parameters

  • h (in): mt_bfloat16

Returns

  • mt_bfloat16
  • The nearest integer to h.

hrsqrt

__mt_bfloat16 hrsqrt(const __mt_bfloat16 a)

Calculates mt_bfloat16 reciprocal square root in round-to-nearest-even mode.

Calculates mt_bfloat16 reciprocal square root of input a in round-to-nearest mode.

Parameters

  • a (in): mt_bfloat16

Returns

  • mt_bfloat16
  • The reciprocal square root of a.

hsin

__mt_bfloat16 hsin(const __mt_bfloat16 a)

Calculates mt_bfloat16 sine in round-to-nearest-even mode.

Calculates mt_bfloat16 sine of input a in round-to-nearest-even mode.

Parameters

  • a (in): mt_bfloat16

Returns

  • mt_bfloat16
  • The sine of a.

hsqrt

__mt_bfloat16 hsqrt(const __mt_bfloat16 a)

Calculates mt_bfloat16 square root in round-to-nearest-even mode.

Calculates mt_bfloat16 square root of input a in round-to-nearest-even mode.

Parameters

  • a (in): mt_bfloat16

Returns

  • mt_bfloat16
  • The square root of a.

Bfloat16 Math Functions 155

htanh

__mt_bfloat16 htanh(const __mt_bfloat16 a)

Calculates mt_bfloat16 hyperbolic tangent function in round-to-nearest-even mode.

Calculates mt_bfloat16 hyperbolic tangent function tanh(a) in round-to-nearest-even mode.

Parameters

  • a (in): mt_bfloat16

Returns

  • mt_bfloat16
  • The hyperbolic tangent function of a.

htanh_approx

__mt_bfloat16 htanh_approx(const __mt_bfloat16 a)

Calculates mt_bfloat16 hyperbolic tangent function in round-to-nearest-even mode.

Calculates mt_bfloat16 hyperbolic tangent function tanh(a). This operation uses HW acceleration on devices of compute capability 9.x and higher.

Parameters

  • a (in): mt_bfloat16

Returns

  • mt_bfloat16
  • The hyperbolic tangent function of a.

htrunc

__mt_bfloat16 htrunc(const __mt_bfloat16 h)

Truncate input argument to the integral part.

Round h to the nearest integer value that does not exceed h in magnitude.

Parameters

  • h (in): mt_bfloat16

Returns

  • mt_bfloat16
  • The truncated integer value.

Bfloat16 Precision Conversion and Data Movement 167

make_bfloat162

__mt_bfloat162 make_bfloat162(const __mt_bfloat16 x, const __mt_bfloat16 y)

Vector function, combines two mt_bfloat16 numbers into one mt_bfloat162 number.

Single Precision Mathematical Functions

Use these functions for standard single-precision mathematical operations in device code. The function names generally match common C math operations, with variants for rounding, approximation, or MUSA-specific behavior where applicable.

Typedefs

acosf

float acosf(float x)

Calculate the arc cosine of the input argument.

acoshf

float acoshf(float x)

Calculate the nonnegative inverse hyperbolic cosine of the input argument.

asinf

float asinf(float x)

Calculate the arc sine of the input argument.

asinhf

float asinhf(float x)

Calculate the inverse hyperbolic sine of the input argument.

atan2f

float atan2f(float y, float x)

Calculate the arc tangent of the ratio of first and second input arguments.

atanf

float atanf(float x)

Calculate the arc tangent of the input argument.

atanhf

float atanhf(float x)

Calculate the inverse hyperbolic tangent of the input argument.

cbrtf

float cbrtf(float x)

Calculate the cube root of the input argument.

ceilf

float ceilf(float x)

Calculate ceiling of the input argument.

copysignf

float copysignf(float x, float y)

Create value with given magnitude, copying sign of second value.

cosf

float cosf(float x)

Calculate the cosine of the input argument.

coshf

float coshf(float x)

Calculate the hyperbolic cosine of the input argument.

cospif

float cospif(float x)

Calculate the cosine of the input argument ×π .

Functions 285

erf

double erf(double x)

Calculate the error function of the input argument.

erf

float erf(float x)

Calculate the error function of the input argument.

Typedefs

erfcf

float erfcf(float x)

Calculate the complementary error function of the input argument.

erfcinvf

float erfcinvf(float x)

Calculate the inverse complementary error function of the input argument.

erfcxf

float erfcxf(float x)

Calculate the scaled complementary error function of the input argument.

erff

float erff(float x)

Calculate the error function of the input argument.

erfinvf

float erfinvf(float x)

Calculate the inverse error function of the input argument.

exp10f

float exp10f(float x)

Calculate the base 10 exponential of the input argument.

exp2f

float exp2f(float x)

Calculate the base 2 exponential of the input argument.

expf

float expf(float x)

Calculate the base e exponential of the input argument.

expm1f

float expm1f(float x)

Calculate the base e exponential of the input argument, minus 1.

fabsf

float fabsf(float x)

Calculate the absolute value of its argument.

fdimf

float fdimf(float x, float y)

Compute the positive difference between x and y .

floorf

float floorf(float x)

Calculate the largest integer less than or equal to x .

fmaf

float fmaf(float x, float y, float z)

Compute x × y + z as a single operation.

fmaxf

float fmaxf(float x, float y)

Determine the maximum numeric value of the arguments.

fminf

float fminf(float x, float y)

Determine the minimum numeric value of the arguments.

fmodf

float fmodf(float x, float y)

Calculate the floating-point remainder of x / y .

frexpf

float frexpf(float x, int *nptr)

Extract mantissa and exponent of a floating-point value.

hypotf

float hypotf(float x, float y)

Calculate the square root of the sum of squares of two arguments.

ilogbf

int ilogbf(float x)

Compute the unbiased integer exponent of the argument.

isinf

bool isinf(float a)

Determine whether argument is infinite.

isinf

bool isinf(double a)

Determine whether argument is infinite.

ldexpf

float ldexpf(float x, int exp)

Calculate the value of x · 2exp .

lgammaf

float lgammaf(float x)

Calculate the natural logarithm of the absolute value of the gamma function of the input argu- ment.

llrintf

long long int llrintf(float x)

Round input to nearest integer value.

llroundf

long long int llroundf(float x)

Round to nearest integer value.

log10f

float log10f(float x)

Calculate the base 10 logarithm of the input argument.

log1pf

float log1pf(float x)

Calculate the value of loge (1 + x) .

log2f

float log2f(float x)

Calculate the base 2 logarithm of the input argument.

logbf

float logbf(float x)

Calculate the floating-point representation of the exponent of the input argument.

logf

float logf(float x)

Calculate the natural logarithm of the input argument.

lrintf

long int lrintf(float x)

Round input to nearest integer value.

lroundf

long int lroundf(float x)

Round to nearest integer value.

Functions 285

modf

double modf(double x, double *iptr)

Break down the input argument into fractional and integral parts.

Typedefs

modff

float modff(float x, float *iptr)

Break down the input argument into fractional and integral parts.

nanf

float nanf(const char *tagp)

Returns "Not a Number" value.

nearbyintf

float nearbyintf(float x)

Round the input argument to the nearest integer.

nextafterf

float nextafterf(float x, float y)

Return next representable single-precision floating-point value after argument x in the direction of y .

norm3df

float norm3df(float a, float b, float c)

Calculate the square root of the sum of squares of three coordinates of the argument.

norm4df

float norm4df(float a, float b, float c, float d)

Calculate the square root of the sum of squares of four coordinates of the argument.

normcdff

float normcdff(float x)

Calculate the standard normal cumulative distribution function.

normf

float normf(int dim, float const * p)

Calculate the square root of the sum of squares of any number of coordinates.

powf

float powf(float x, float y)

Calculate the value of first argument to the power of second argument.

rcbrtf

float rcbrtf(float x)

Calculate reciprocal cube root function.

remainderf

float remainderf(float x, float y)

Compute single-precision floating-point remainder.

remquof

float remquof(float x, float y, int *quo)

Compute single-precision floating-point remainder and part of quotient.

rhypotf

float rhypotf(float x, float y)

Calculate one over the square root of the sum of squares of two arguments.

rintf

float rintf(float x)

Round input to nearest integer value in floating-point.

rnorm3df

float rnorm3df(float a, float b, float c)

Calculate one over the square root of the sum of squares of three coordinates.

rnorm4df

float rnorm4df(float a, float b, float c, float d)

Calculate one over the square root of the sum of squares of four coordinates.

rnormf

float rnormf(int dim, float const * p)

Calculate the reciprocal of square root of the sum of squares of any number of coordinates.

roundf

float roundf(float x)

Round to nearest integer value in floating-point.

rsqrtf

float rsqrtf(float x)

Calculate the reciprocal of the square root of the input argument.

scalblnf

float scalblnf(float x, long int n)

Scale floating-point input by integer power of two.

scalbnf

float scalbnf(float x, int n)

Scale floating-point input by integer power of two.

sincosf

void sincosf(float x, float *sptr, float *cptr)

Calculate the sine and cosine of the first input argument.

sincospif

void sincospif(float x, float *sptr, float *cptr)

Calculate the sine and cosine of the first input argument ×π .

sinf

float sinf(float x)

Calculate the sine of the input argument.

sinhf

float sinhf(float x)

Calculate the hyperbolic sine of the input argument.

sinpif

float sinpif(float x)

Calculate the sine of the input argument ×π .

sqrtf

float sqrtf(float x)

Calculate the square root of the input argument.

tanf

float tanf(float x)

Calculate the tangent of the input argument.

tanhf

float tanhf(float x)

Calculate the hyperbolic tangent of the input argument.

tgammaf

float tgammaf(float x)

Calculate the gamma function of the input argument.

truncf

float truncf(float x)

Truncate input argument to the integral part.

Single Precision Intrinsics

Use single precision intrinsics when the kernel needs explicit control over rounding, approximation, reciprocal/square-root behavior, or other low-level single-precision operations.

Integer Helper Intrinsics

__brev

unsigned int __brev(unsigned int x)

Reverse the bit order of a 32-bit unsigned integer.

__brevll

unsigned long long int __brevll(unsigned long long int x)

Reverse the bit order of a 64-bit unsigned integer.

__byte_perm

unsigned int __byte_perm(unsigned int x, unsigned int y, unsigned int s)

Return selected bytes from two 32-bit unsigned integers.

__clz

int __clz(int x)

Return the number of consecutive high-order zero bits in a 32-bit integer.

__clzll

int __clzll(long long int x)

Count the number of consecutive high-order zero bits in a 64-bit integer.

__exp10f

float __exp10f(float x)

Calculate the fast approximate base 10 exponential of the input argument.

__expf

float __expf(float x)

Calculate the fast approximate base e exponential of the input argument.

__fadd_rd

float __fadd_rd(float x, float y)

Add two floating-point values in round-down mode.

__fadd_rn

float __fadd_rn(float x, float y)

Add two floating-point values in round-to-nearest-even mode.

__fadd_ru

float __fadd_ru(float x, float y)

Add two floating-point values in round-up mode.

__fadd_rz

float __fadd_rz(float x, float y)

Add two floating-point values in round-towards-zero mode.

__fdiv_rd

float __fdiv_rd(float x, float y)

Divide two floating-point values in round-down mode.

__fdiv_rn

float __fdiv_rn(float x, float y)

Divide two floating-point values in round-to-nearest-even mode.

__fdiv_ru

float __fdiv_ru(float x, float y)

Divide two floating-point values in round-up mode.

__fdiv_rz

float __fdiv_rz(float x, float y)

Divide two floating-point values in round-towards-zero mode.

__fdividef

float __fdividef(float x, float y)

Calculate the fast approximate division of the input arguments.

__ffs

int __ffs(int x)

Find the position of the least significant bit set to 1 in a 32-bit integer.

__ffsll

int __ffsll(long long int x)

Find the position of the least significant bit set to 1 in a 64-bit integer.

Type Casting Intrinsics

__float2int_rd

int __float2int_rd(float x)

Convert a float to a signed integer in round-down mode.

__float2int_rn

int __float2int_rn(float x)

Convert a float to a signed integer in round-to-nearest-even mode.

__float2int_ru

int __float2int_ru(float x)

Convert a float to a signed integer in round-up mode.

__float2int_rz

int __float2int_rz(float x)

Convert a float to a signed integer in round-towards-zero mode.

__float2ll_rd

long long int __float2ll_rd(float x)

Convert a float to a signed 64-bit integer in round-down mode.

__float2ll_rn

long long int __float2ll_rn(float x)

Convert a float to a signed 64-bit integer in round-to-nearest-even mode.

__float2ll_ru

long long int __float2ll_ru(float x)

Convert a float to a signed 64-bit integer in round-up mode.

__float2ll_rz

long long int __float2ll_rz(float x)

Convert a float to a signed 64-bit integer in round-towards-zero mode.

__float2uint_rd

unsigned int __float2uint_rd(float x)

Convert a float to an unsigned integer in round-down mode.

__float2uint_rn

unsigned int __float2uint_rn(float x)

Convert a float to an unsigned integer in round-to-nearest-even mode.

__float2uint_ru

unsigned int __float2uint_ru(float x)

Convert a float to an unsigned integer in round-up mode.

__float2uint_rz

unsigned int __float2uint_rz(float x)

Convert a float to an unsigned integer in round-towards-zero mode.

__float2ull_rd

unsigned long long int __float2ull_rd(float x)

Convert a float to an unsigned 64-bit integer in round-down mode.

__float2ull_rn

unsigned long long int __float2ull_rn(float x)

Convert a float to an unsigned 64-bit integer in round-to-nearest-even mode.

__float2ull_ru

unsigned long long int __float2ull_ru(float x)

Convert a float to an unsigned 64-bit integer in round-up mode.

__float2ull_rz

unsigned long long int __float2ull_rz(float x)

Convert a float to an unsigned 64-bit integer in round-towards-zero mode.

__float_as_int

int __float_as_int(float x)

Reinterpret bits in a float as a signed integer.

__float_as_uint

unsigned int __float_as_uint(float x)

Reinterpret bits in a float as a unsigned integer.

__fmaf_rd

float __fmaf_rd(float x, float y, float z)

Compute x × y + z as a single operation, in round-down mode.

__fmaf_rn

float __fmaf_rn(float x, float y, float z)

Compute x × y + z as a single operation, in round-to-nearest-even mode.

__fmaf_ru

float __fmaf_ru(float x, float y, float z)

Compute x × y + z as a single operation, in round-up mode.

__fmaf_rz

float __fmaf_rz(float x, float y, float z)

Compute x × y + z as a single operation, in round-towards-zero mode.

__fmul_rd

float __fmul_rd(float x, float y)

Multiply two floating-point values in round-down mode.

__fmul_rn

float __fmul_rn(float x, float y)

Multiply two floating-point values in round-to-nearest-even mode.

__fmul_ru

float __fmul_ru(float x, float y)

Multiply two floating-point values in round-up mode.

__fmul_rz

float __fmul_rz(float x, float y)

Multiply two floating-point values in round-towards-zero mode.

__frcp_rd

float __frcp_rd(float x)

Compute x1 in round-down mode.

__frcp_rn

float __frcp_rn(float x)

Compute x1 in round-to-nearest-even mode.

__frcp_ru

float __frcp_ru(float x)

Compute x1 in round-up mode.

__frcp_rz

float __frcp_rz(float x)

Compute x1 in round-towards-zero mode.

__frsqrt_rn

float __frsqrt_rn(float x)

Compute the reciprocal square root of x in round-to-nearest-even mode.

__fsqrt_rd

float __fsqrt_rd(float x)

Compute the square root of x in round-down (to negative infinity) mode.

__fsqrt_rn

float __fsqrt_rn(float x)

Compute the square root of x in round-to-nearest-even mode.

__fsqrt_ru

float __fsqrt_ru(float x)

Compute the square root of x in round-up (to positive infinity) mode.

__fsqrt_rz

float __fsqrt_rz(float x)

Compute the square root of x in round-towards-zero mode.

__fsub_rd

float __fsub_rd(float x, float y)

Subtract two floating-point values in round-down mode.

__fsub_rn

float __fsub_rn(float x, float y)

Subtract two floating-point values in round-to-nearest-even mode.

__fsub_ru

float __fsub_ru(float x, float y)

Subtract two floating-point values in round-up mode.

__fsub_rz

float __fsub_rz(float x, float y)

Subtract two floating-point values in round-towards-zero mode.

Half Arithmetic Functions

__hadd

int __hadd(int a, int b)

Performs mt_bfloat16 addition in round-to-nearest-even mode.

Performs mt_bfloat16 addition of inputs a and b, in round-to-nearest-even mode.

Parameters

  • a (in): mt_bfloat16
  • b (in): mt_bfloat16

Returns

  • mt_bfloat16
  • The sum of a and b.

Type Casting Intrinsics

__int2float_rd

float __int2float_rd(int x)

Convert a signed integer to a float in round-down mode.

__int2float_rn

float __int2float_rn(int x)

Convert a signed integer to a float in round-to-nearest-even mode.

__int2float_ru

float __int2float_ru(int x)

Convert a signed integer to a float in round-up mode.

__int2float_rz

float __int2float_rz(int x)

Convert a signed integer to a float in round-towards-zero mode.

__int_as_float

float __int_as_float(int x)

Reinterpret bits in an integer as a float.

__ll2float_rd

float __ll2float_rd(long long int x)

Convert a signed integer to a float in round-down mode.

__ll2float_rn

float __ll2float_rn(long long int x)

Convert a signed 64-bit integer to a float in round-to-nearest-even mode.

__ll2float_ru

float __ll2float_ru(long long int x)

Convert a signed integer to a float in round-up mode.

__ll2float_rz

float __ll2float_rz(long long int x)

Convert a signed integer to a float in round-towards-zero mode.

__logf

float __logf(float x)

Calculate the fast approximate base e logarithm of the input argument.

Integer Helper Intrinsics

__mul24

int __mul24(int x, int y)

Calculate the least significant 32 bits of the product of the least significant 24 bits of two inte- gers.

__mul64hi

long long int __mul64hi(long long int x, long long int y)

Calculate the most significant 64 bits of the product of the two 64-bit integers.

__mulhi

int __mulhi(int x, int y)

Calculate the most significant 32 bits of the product of the two 32-bit integers.

__popc

int __popc(unsigned int x)

Count the number of bits that are set to 1 in a 32-bit integer.

__popcll

int __popcll(unsigned long long int x)

Count the number of bits that are set to 1 in a 64-bit integer.

__rhadd

int __rhadd(int x, int y)

Compute rounded average of signed input arguments, avoiding overflow in the intermediate sum.

__sad

unsigned int __sad(int x, int y, unsigned int z)

Calculate |x − y| + z , the sum of absolute difference.

__saturatef

float __saturatef(float x)

Clamp the input argument to [+0.0, 1.0].

__sincosf

void __sincosf(float x, float *sptr, float *cptr)

Calculate the fast approximate of sine and cosine of the first input argument.

__sinf

float __sinf(float x)

Calculate the fast approximate sine of the input argument.

__tanf

float __tanf(float x)

Calculate the fast approximate tangent of the input argument.

__uhadd

unsigned int __uhadd(unsigned int x, unsigned int y)

Compute average of unsigned input arguments, avoiding overflow in the intermediate sum.

Type Casting Intrinsics

__uint2float_rd

float __uint2float_rd(unsigned int x)

Convert an unsigned integer to a float in round-down mode.

__uint2float_rn

float __uint2float_rn(unsigned int x)

Convert an unsigned integer to a float in round-to-nearest-even mode.

__uint2float_ru

float __uint2float_ru(unsigned int x)

Convert an unsigned integer to a float in round-up mode.

__uint2float_rz

float __uint2float_rz(unsigned int x)

Convert an unsigned integer to a float in round-towards-zero mode.

__uint_as_float

float __uint_as_float(unsigned int x)

Reinterpret bits in an unsigned integer as a float.

__ull2float_rd

float __ull2float_rd(unsigned long long int x)

Convert an unsigned integer to a float in round-down mode.

__ull2float_rn

float __ull2float_rn(unsigned long long int x)

Convert an unsigned integer to a float in round-to-nearest-even mode.

__ull2float_ru

float __ull2float_ru(unsigned long long int x)

Convert an unsigned integer to a float in round-up mode.

__ull2float_rz

float __ull2float_rz(unsigned long long int x)

Convert an unsigned integer to a float in round-towards-zero mode.

Integer Helper Intrinsics

__umul24

unsigned int __umul24(unsigned int x, unsigned int y)

Calculate the least significant 32 bits of the product of the least significant 24 bits of two un- signed integers.

__umul64hi

unsigned long long int __umul64hi(unsigned long long int x, unsigned long long int y)

Calculate the most significant 64 bits of the product of the two 64 unsigned bit integers.

__umulhi

unsigned int __umulhi(unsigned int x, unsigned int y)

Calculate the most significant 32 bits of the product of the two 32-bit unsigned integers.

__urhadd

unsigned int __urhadd(unsigned int x, unsigned int y)

Compute rounded average of unsigned input arguments, avoiding overflow in the intermediate sum.

__usad

unsigned int __usad(unsigned int x, unsigned int y, unsigned int z)

Calculate |x − y| + z , the sum of absolute difference.

fdivide

double fdivide(double x, double y)

Divide two double point values.

Typedefs

fdividef

float fdividef(float x, float y)

Divide two floating-point values.

Double Precision Mathematical Functions

Use these functions for standard double-precision mathematical operations in device code when accuracy requirements justify the higher precision and cost compared with single precision.

Functions 285

acos

double acos(double x)

Calculate the arc cosine of the input argument.

acos

float acos(float x)

Calculate the arc cosine of the input argument.

acosh

double acosh(double x)

Calculate the nonnegative inverse hyperbolic cosine of the input argument.

acosh

float acosh(float x)

Calculate the nonnegative inverse hyperbolic cosine of the input argument.

asin

double asin(double x)

Calculate the arc sine of the input argument.

asin

float asin(float x)

Calculate the arc sine of the input argument.

asinh

double asinh(double x)

Calculate the inverse hyperbolic sine of the input argument.

asinh

float asinh(float x)

Calculate the inverse hyperbolic sine of the input argument.

atan

double atan(double x)

Calculate the arc tangent of the input argument.

atan

float atan(float x)

Calculate the arc tangent of the input argument.

atan2

double atan2(double y, double x)

Calculate the arc tangent of the ratio of first and second input arguments.

atan2

float atan2(float y, float x)

Calculate the arc tangent of the ratio of first and second input arguments.

atanh

double atanh(double x)

Calculate the inverse hyperbolic tangent of the input argument.

atanh

float atanh(float x)

Calculate the inverse hyperbolic tangent of the input argument.

cbrt

double cbrt(double x)

Calculate the cube root of the input argument.

cbrt

float cbrt(float x)

Calculate the cube root of the input argument.

ceil

double ceil(double x)

Calculate ceiling of the input argument.

ceil

float ceil(float x)

Calculate ceiling of the input argument.

copysign

double copysign(double x, double y)

Create value with given magnitude, copying sign of second value.

copysign

float copysign(float x, float y)

Create value with given magnitude, copying sign of second value.

copysign

inline double copysign(const double x, const float y)

Create value with given magnitude, copying sign of second value.

copysign

inline double copysign(const float x, const double y)

Create value with given magnitude, copying sign of second value.

cos

double cos(double x)

Calculate the cosine of the input argument.

cosh

double cosh(double x)

Calculate the hyperbolic cosine of the input argument.

cosh

float cosh(float x)

Calculate the hyperbolic cosine of the input argument.

cospi

inline float cospi(const float x)

Calculate the cosine of the input argument ×π .

cyl_bessel_i0

double cyl_bessel_i0(double x)

Calculate the value of the regular modified cylindrical Bessel function of order 0 for the input argument.

cyl_bessel_i0

inline float cyl_bessel_i0(const float x)

Calculate the value of the regular modified cylindrical Bessel function of order 0 for the input argument.

erfc

double erfc(double x)

Calculate the complementary error function of the input argument.

erfc

float erfc(float x)

Calculate the complementary error function of the input argument.

erfcinv

double erfcinv(double x)

Calculate the inverse complementary error function of the input argument.

erfcinv

inline float erfcinv(const float x)

Calculate the inverse complementary error function of the input argument.

erfinv

double erfinv(double x)

Calculate the inverse error function of the input argument.

erfinv

inline float erfinv(const float x)

Calculate the inverse error function of the input argument.

exp

double exp(double x)

Calculate the base e exponential of the input argument.

exp

float exp(float x)

Calculate the base e exponential of the input argument.

exp10

double exp10(double x)

Calculate the base 10 exponential of the input argument.

exp10

inline float exp10(const float x)

Calculate the base 10 exponential of the input argument.

exp2

double exp2(double x)

Calculate the base 2 exponential of the input argument.

exp2

float exp2(float x)

Calculate the base 2 exponential of the input argument.

expm1

double expm1(double x)

Calculate the base e exponential of the input argument, minus 1.

expm1

float expm1(float x)

Calculate the base e exponential of the input argument, minus 1.

fabs

double fabs(double x)

Calculate the absolute value of the input argument.

fabs

float fabs(float x)

Calculate the absolute value of the input argument.

fdim

double fdim(double x, double y)

Compute the positive difference between x and y .

fdim

float fdim(float x, float y)

Compute the positive difference between x and y .

floor

double floor(double x)

Calculate the largest integer less than or equal to x .

floor

float floor(float x)

Calculate the largest integer less than or equal to x .

fma

double fma(double x, double y, double z)

Compute x × y + z as a single operation.

fma

float fma(float x, float y, float z)

Compute x × y + z as a single operation.

fmax

double fmax(double x, double y)

Determine the maximum numeric value of the arguments.

fmax

float fmax(float x, float y)

Determine the maximum numeric value of the arguments.

fmin

double fmin(double x, double y)

Determine the minimum numeric value of the arguments.

fmin

float fmin(float x, float y)

Determine the minimum numeric value of the arguments.

fmod

double fmod(double x, double y)

Calculate the double-precision floating-point remainder of x / y .

fmod

float fmod(float x, float y)

Calculate the double-precision floating-point remainder of x / y .

frexp

double frexp(double x, int *nptr)

Extract mantissa and exponent of a floating-point value.

frexp

float frexp(float x, int* nptr)

Extract mantissa and exponent of a floating-point value.

hypot

double hypot(double x, double y)

Calculate the square root of the sum of squares of two arguments.

hypot

float hypot(float x, float y)

Calculate the square root of the sum of squares of two arguments.

ilogb

int ilogb(double x)

Compute the unbiased integer exponent of the argument.

ilogb

int ilogb(float x)

Compute the unbiased integer exponent of the argument.

Typedefs

isfinite

bool isfinite(float a)

Determine whether argument is finite.

isfinite

bool isfinite(double a)

Determine whether argument is finite.

isnan

bool isnan(float a)

Determine whether argument is a NaN.

isnan

bool isnan(double a)

Determine whether argument is a NaN.

Functions 285

ldexp

double ldexp(double x, int exp)

Calculate the value of x · 2exp .

ldexp

float ldexp(float x, int exp)

Calculate the value of x · 2exp .

lgamma

double lgamma(double x)

Calculate the natural logarithm of the absolute value of the gamma function of the input argu- ment.

lgamma

float lgamma(float x)

Calculate the natural logarithm of the absolute value of the gamma function of the input argu- ment.

llrint

long long int llrint(double x)

Round input to nearest integer value.

llrint

long long int llrint(float x)

Round input to nearest integer value.

llround

long long int llround(double x)

Round to nearest integer value.

llround

long long int llround(float x)

Round to nearest integer value.

log

double log(double x)

Calculate the base e logarithm of the input argument.

log

float log(float x)

Calculate the base e logarithm of the input argument.

log10

double log10(double x)

Calculate the base 10 logarithm of the input argument.

log10

float log10(float x)

Calculate the base 10 logarithm of the input argument.

log1p

double log1p(double x)

Calculate the value of loge (1 + x) .

log1p

float log1p(float x)

Calculate the value of loge (1 + x) .

log2

double log2(double x)

Calculate the base 2 logarithm of the input argument.

log2

float log2(float x)

Calculate the base 2 logarithm of the input argument.

logb

double logb(double x)

Calculate the floating-point representation of the exponent of the input argument.

logb

float logb(float x)

Calculate the floating-point representation of the exponent of the input argument.

lrint

long int lrint(double x)

Round input to nearest integer value.

lrint

long int lrint(float x)

Round input to nearest integer value.

lround

long int lround(double x)

Round to nearest integer value.

lround

long int lround(float x)

Round to nearest integer value.

nan

double nan(const char *tagp)

Returns "Not a Number" value.

nearbyint

double nearbyint(double x)

Round the input argument to the nearest integer.

nearbyint

float nearbyint(float x)

Round the input argument to the nearest integer.

nextafter

double nextafter(double x, double y)

Return next representable double-precision floating-point value after argument x in the direction of y .

nextafter

float nextafter(float x, float y)

Return next representable double-precision floating-point value after argument x in the direction of y .

norm

double norm(int dim, double const * p)

Calculate the square root of the sum of squares of any number of coordinates.

pow

double pow(double x, double y)

Calculate the value of first argument to the power of second argument.

pow

float pow(float x, float y)

Calculate the value of first argument to the power of second argument.

rcbrt

double rcbrt(double x)

Calculate reciprocal cube root function.

rcbrt

inline float rcbrt(const float x)

Calculate reciprocal cube root function.

remainder

double remainder(double x, double y)

Compute double-precision floating-point remainder.

remainder

float remainder(float x, float y)

Compute double-precision floating-point remainder.

remquo

double remquo(double x, double y, int *quo)

Compute double-precision floating-point remainder and part of quotient.

remquo

float remquo(float x, float y, int *quo)

Compute double-precision floating-point remainder and part of quotient.

rint

double rint(double x)

Round to nearest integer value in floating-point.

rint

float rint(float x)

Round to nearest integer value in floating-point.

rnorm

double rnorm(int dim, double const * p)

Calculate the reciprocal of square root of the sum of squares of any number of coordinates.

round

double round(double x)

Round to nearest integer value in floating-point.

round

float round(float x)

Round to nearest integer value in floating-point.

rsqrt

double rsqrt(double x)

Calculate the reciprocal of the square root of the input argument.

rsqrt

inline float rsqrt(const float x)

Calculate the reciprocal of the square root of the input argument.

scalbln

double scalbln(double x, long int n)

Scale floating-point input by integer power of two.

scalbln

float scalbln(float x, long int l)

Scale floating-point input by integer power of two.

scalbn

double scalbn(double x, int n)

Scale floating-point input by integer power of two.

scalbn

float scalbn(float x, int n)

Scale floating-point input by integer power of two.

Typedefs

signbit

bool signbit(float a)

Return the sign bit of the input.

signbit

bool signbit(double a)

Return the sign bit of the input.

signbit

bool signbit(long double x)

Return the sign bit of the input.

Functions 285

sin

double sin(double x)

Calculate the sine of the input argument.

sin

float sin(float x)

Calculate the sine of the input argument.

sincos

void sincos(double x, double *sptr, double *cptr)

Calculate the sine and cosine of the first input argument.

sincospi

void sincospi(double x, double *sptr, double *cptr)

Calculate the sine and cosine of the first input argument ×π .

sinh

double sinh(double x)

Calculate the hyperbolic sine of the input argument.

sinh

float sinh(float x)

Calculate the hyperbolic sine of the input argument.

sinpi

double sinpi(double x)

Calculate the sine of the input argument ×π .

sinpi

inline float sinpi(const float x)

Calculate the sine of the input argument ×π .

sqrt

double sqrt(double x)

Calculate the square root of the input argument.

sqrt

float sqrt(float x)

Calculate the square root of the input argument.

tan

double tan(double x)

Calculate the tangent of the input argument.

tan

float tan(float x)

Calculate the tangent of the input argument.

tanh

double tanh(double x)

Calculate the hyperbolic tangent of the input argument.

tanh

float tanh(float x)

Calculate the hyperbolic tangent of the input argument.

tgamma

double tgamma(double x)

Calculate the gamma function of the input argument.

tgamma

float tgamma(float x)

Calculate the gamma function of the input argument.

trunc

double trunc(double x)

Truncate input argument to the integral part.

trunc

float trunc(float x)

Truncate input argument to the integral part.

Double Precision Intrinsics

Use double precision intrinsics when the kernel needs explicit control over rounding, conversion, or low-level double-precision operations.

__dadd_rd

double __dadd_rd(double x, double y)

Add two floating-point values in round-down mode.

__dadd_rn

double __dadd_rn(double x, double y)

Add two floating-point values in round-to-nearest-even mode.

__dadd_ru

double __dadd_ru(double x, double y)

Add two floating-point values in round-up mode.

__dadd_rz

double __dadd_rz(double x, double y)

Add two floating-point values in round-towards-zero mode.

__dmul_rd

double __dmul_rd(double x, double y)

Multiply two floating-point values in round-down mode.

__dmul_rn

double __dmul_rn(double x, double y)

Multiply two floating-point values in round-to-nearest-even mode.

__dmul_ru

double __dmul_ru(double x, double y)

Multiply two floating-point values in round-up mode.

__dmul_rz

double __dmul_rz(double x, double y)

Multiply two floating-point values in round-towards-zero mode.

Type Casting Intrinsics

__double2float_rd

float __double2float_rd(double x)

Convert a double to a float in round-down mode.

__double2float_rn

float __double2float_rn(double x)

Convert a double to a float in round-to-nearest-even mode.

__double2float_ru

float __double2float_ru(double x)

Convert a double to a float in round-up mode.

__double2float_rz

float __double2float_rz(double x)

Convert a double to a float in round-towards-zero mode.

__double2hiint

int __double2hiint(double x)

Reinterpret high 32 bits in a double as a signed integer.

__double2int_rd

int __double2int_rd(double x)

Convert a double to a signed int in round-down mode.

__double2int_rn

int __double2int_rn(double x)

Convert a double to a signed int in round-to-nearest-even mode.

__double2int_ru

int __double2int_ru(double x)

Convert a double to a signed int in round-up mode.

__double2ll_rd

long long int __double2ll_rd(double x)

Convert a double to a signed 64-bit int in round-down mode.

__double2ll_rn

long long int __double2ll_rn(double x)

Convert a double to a signed 64-bit int in round-to-nearest-even mode.

__double2ll_ru

long long int __double2ll_ru(double x)

Convert a double to a signed 64-bit int in round-up mode.

__double2loint

int __double2loint(double x)

Reinterpret low 32 bits in a double as a signed integer.

__double2uint_rd

unsigned int __double2uint_rd(double x)

Convert a double to an unsigned int in round-down mode.

__double2uint_rn

unsigned int __double2uint_rn(double x)

Convert a double to an unsigned int in round-to-nearest-even mode.

__double2uint_ru

unsigned int __double2uint_ru(double x)

Convert a double to an unsigned int in round-up mode.

__double2ull_rd

unsigned long long int __double2ull_rd(double x)

Convert a double to an unsigned 64-bit int in round-down mode.

__double2ull_rn

unsigned long long int __double2ull_rn(double x)

Convert a double to an unsigned 64-bit int in round-to-nearest-even mode.

__double2ull_ru

unsigned long long int __double2ull_ru(double x)

Convert a double to an unsigned 64-bit int in round-up mode.

__double_as_longlong

long long int __double_as_longlong(double x)

Reinterpret bits in a double as a 64-bit signed integer.

__dsub_rd

double __dsub_rd(double x, double y)

Subtract two floating-point values in round-down mode.

__dsub_rn

double __dsub_rn(double x, double y)

Subtract two floating-point values in round-to-nearest-even mode.

__dsub_ru

double __dsub_ru(double x, double y)

Subtract two floating-point values in round-up mode.

__dsub_rz

double __dsub_rz(double x, double y)

Subtract two floating-point values in round-towards-zero mode.

__fma_rd

double __fma_rd(double x, double y, double z)

Compute x × y + z as a single operation in round-down mode.

__fma_rn

double __fma_rn(double x, double y, double z)

Compute x × y + z as a single operation in round-to-nearest-even mode.

__fma_ru

double __fma_ru(double x, double y, double z)

Compute x × y + z as a single operation in round-up mode.

__fma_rz

double __fma_rz(double x, double y, double z)

Compute x × y + z as a single operation in round-towards-zero mode.

__hiloint2double

double __hiloint2double(int hi, int lo)

Reinterpret high and low 32-bit integer values as a double.

__int2double_rn

double __int2double_rn(int x)

Convert a signed int to a double.

__ll2double_rd

double __ll2double_rd(long long int x)

Convert a signed 64-bit int to a double in round-down mode.

__ll2double_rn

double __ll2double_rn(long long int x)

Convert a signed 64-bit int to a double in round-to-nearest-even mode.

__ll2double_ru

double __ll2double_ru(long long int x)

Convert a signed 64-bit int to a double in round-up mode.

__ll2double_rz

double __ll2double_rz(long long int x)

Convert a signed 64-bit int to a double in round-towards-zero mode.

__longlong_as_double

double __longlong_as_double(long long int x)

Reinterpret bits in a 64-bit signed integer as a double.

__uint2double_rn

double __uint2double_rn(unsigned int x)

Convert an unsigned int to a double.

__ull2double_rd

double __ull2double_rd(unsigned long long int x)

Convert an unsigned 64-bit int to a double in round-down mode.

__ull2double_rn

double __ull2double_rn(unsigned long long int x)

Convert an unsigned 64-bit int to a double in round-to-nearest-even mode.

__ull2double_ru

double __ull2double_ru(unsigned long long int x)

Convert an unsigned 64-bit int to a double in round-up mode.

__ull2double_rz

double __ull2double_rz(unsigned long long int x)

Convert an unsigned 64-bit int to a double in round-towards-zero mode.

dadd

double dadd(double x, double y, enum musaRoundMode musaRoundNearest)

Adds two double-precision floating-point values using the specified rounding mode.

dmul

double dmul(double x, double y, enum musaRoundMode musaRoundNearest)

Multiplies two double-precision floating-point values using the specified rounding mode.

double2int

int double2int(double x, enum musaRoundMode rnd)

Converts a double-precision floating-point value to a signed 32-bit integer using the specified rounding mode.

double2ll

long long int double2ll(double x, enum musaRoundMode rnd)

Converts a double-precision floating-point value to a signed 64-bit integer using the specified rounding mode.

double2uint

unsigned int double2uint(double x, enum musaRoundMode rnd)

Converts a double-precision floating-point value to an unsigned 32-bit integer using the specified rounding mode.

double2ull

unsigned long long int double2ull(double x, enum musaRoundMode rnd)

Converts a double-precision floating-point value to an unsigned 64-bit integer using the specified rounding mode.

dsub

double dsub(double x, double y, enum musaRoundMode musaRoundNearest)

Subtracts the second double-precision floating-point value from the first using the specified rounding mode.

float2double

double float2double(float x, enum musaRoundMode musaRoundNearest)

Converts a single-precision floating-point value to a double-precision floating-point value using the specified rounding mode.

fma

double fma(double x, double y, double z, enum musaRoundMode rnd)

Performs a fused multiply-add operation on double-precision floating-point values using the specified rounding mode.

int2double

double int2double(int x, enum musaRoundMode musaRoundNearest)

Converts a signed 32-bit integer to a double-precision floating-point value using the specified rounding mode.

ll2double

double ll2double(long long int x, enum musaRoundMode musaRoundNearest)

Converts a signed 64-bit integer to a double-precision floating-point value using the specified rounding mode.

uint2double

double uint2double(unsigned int x, enum musaRoundMode musaRoundNearest)

Converts an unsigned 32-bit integer to a double-precision floating-point value using the specified rounding mode.

ull2double

double ull2double(unsigned long long int x, enum musaRoundMode musaRoundNearest)

Converts an unsigned 64-bit integer to a double-precision floating-point value using the specified rounding mode.

__double2int_rz

int __double2int_rz(double x)

Convert a double to a signed int in round-towards-zero mode.

__double2ll_rz

long long int __double2ll_rz(double x)

Convert a double to a signed 64-bit int in round-towards-zero mode.

__double2uint_rz

unsigned int __double2uint_rz(double x)

Convert a double to an unsigned int in round-towards-zero mode.

__double2ull_rz

unsigned long long int __double2ull_rz(double x)

Convert a double to an unsigned 64-bit int in round-towards-zero mode.

FP128 Quad Precision Mathematical Functions

Use these functions for quad-precision mathematical operations in device code. Include <musa_runtime.h> and <crt/device_fp128_functions.h>. On supported aarch64 host platforms such as M1000, prefer extern "C" __global__ kernel declarations; when preparing host-side fp128 values, use long double rather than __float128, avoid <quadmath.h> and Q-suffix literals/macros such as 0.0Q, FLT128_MAX, and nextafterq, and pass the 16-byte data to device-side __float128 code with musaMemcpy.

Root, Trigonometric, and Hyperbolic Functions

__mt_fp128_sqrt

__device__ __float128 __mt_fp128_sqrt(__float128 x);

Calculates the square root of the input argument. Returns signed zero for zero input, positive infinity for positive infinity input, and NaN for negative or NaN input.

__mt_fp128_sin

__device__ __float128 __mt_fp128_sin(__float128 x);

Calculates the sine of the input argument in radians.

__mt_fp128_cos

__device__ __float128 __mt_fp128_cos(__float128 x);

Calculates the cosine of the input argument in radians.

__mt_fp128_tan

__device__ __float128 __mt_fp128_tan(__float128 x);

Calculates the tangent of the input argument in radians.

__mt_fp128_asin

__device__ __float128 __mt_fp128_asin(__float128 x);

Calculates the arc sine of the input argument.

__mt_fp128_acos

__device__ __float128 __mt_fp128_acos(__float128 x);

Calculates the arc cosine of the input argument.

__mt_fp128_atan

__device__ __float128 __mt_fp128_atan(__float128 x);

Calculates the arc tangent of the input argument.

__mt_fp128_sinh

__device__ __float128 __mt_fp128_sinh(__float128 x);

Calculates the hyperbolic sine of the input argument.

__mt_fp128_cosh

__device__ __float128 __mt_fp128_cosh(__float128 x);

Calculates the hyperbolic cosine of the input argument.

__mt_fp128_tanh

__device__ __float128 __mt_fp128_tanh(__float128 x);

Calculates the hyperbolic tangent of the input argument.

__mt_fp128_asinh

__device__ __float128 __mt_fp128_asinh(__float128 x);

Calculates the inverse hyperbolic sine of the input argument.

__mt_fp128_acosh

__device__ __float128 __mt_fp128_acosh(__float128 x);

Calculates the nonnegative inverse hyperbolic cosine of the input argument.

__mt_fp128_atanh

__device__ __float128 __mt_fp128_atanh(__float128 x);

Calculates the inverse hyperbolic tangent of the input argument.

Exponential and Logarithmic Functions

__mt_fp128_exp

__device__ __float128 __mt_fp128_exp(__float128 x);

Calculates the base-e exponential of the input argument.

__mt_fp128_exp2

__device__ __float128 __mt_fp128_exp2(__float128 x);

Calculates the base-2 exponential of the input argument.

__mt_fp128_exp10

__device__ __float128 __mt_fp128_exp10(__float128 x);

Calculates the base-10 exponential of the input argument.

__mt_fp128_expm1

__device__ __float128 __mt_fp128_expm1(__float128 x);

Calculates e^x - 1.

__mt_fp128_log

__device__ __float128 __mt_fp128_log(__float128 x);

Calculates the natural logarithm of the input argument. Returns negative infinity for zero input, +0 for 1, positive infinity for positive infinity input, and NaN for negative or NaN input.

__mt_fp128_log2

__device__ __float128 __mt_fp128_log2(__float128 x);

Calculates the base-2 logarithm of the input argument. Returns negative infinity for zero input, +0 for 1, positive infinity for positive infinity input, and NaN for negative or NaN input.

__mt_fp128_log10

__device__ __float128 __mt_fp128_log10(__float128 x);

Calculates the base-10 logarithm of the input argument. Returns negative infinity for zero input, +0 for 1, positive infinity for positive infinity input, and NaN for negative or NaN input.

__mt_fp128_log1p

__device__ __float128 __mt_fp128_log1p(__float128 x);

Calculates log(1 + x).

__mt_fp128_pow

__device__ __float128 __mt_fp128_pow(__float128 x, __float128 y);

Calculates x^y. Returns 1 for x^0, including NaN inputs, and returns NaN for finite negative bases with finite non-integer exponents.

Basic Arithmetic and Fused Operations

__mt_fp128_add

__device__ __float128 __mt_fp128_add(__float128 x, __float128 y);

Adds two floating-point values using round-to-nearest-even mode. The operation is commutative. Returns NaN if either input is NaN or if the inputs are opposite infinities, and returns +0 for x + (-x) with finite x.

__mt_fp128_sub

__device__ __float128 __mt_fp128_sub(__float128 x, __float128 y);

Subtracts the second floating-point value from the first using round-to-nearest-even mode. Returns NaN if either input is NaN or if both inputs are infinities with the same sign, and returns +0 for x - x with finite x.

__mt_fp128_mul

__device__ __float128 __mt_fp128_mul(__float128 x, __float128 y);

Multiplies two floating-point values using round-to-nearest-even mode. The operation is commutative. Returns NaN if either input is NaN or if zero is multiplied by infinity.

__mt_fp128_div

__device__ __float128 __mt_fp128_div(__float128 x, __float128 y);

Divides the first floating-point value by the second using round-to-nearest-even mode. Returns NaN for 0/0, infinity divided by infinity, or NaN inputs.

__mt_fp128_fma

__device__ __float128 __mt_fp128_fma(__float128 x, __float128 y, __float128 z);

Calculates x * y + z as a fused operation using round-to-nearest-even mode. Rounds the combined result once and returns NaN when the multiplication term is indeterminate, such as infinity multiplied by zero.

__mt_fp128_hypot

__device__ __float128 __mt_fp128_hypot(__float128 x, __float128 y);

Calculates the square root of the sum of squares of the input arguments. Avoids undue overflow and underflow, is symmetric in its arguments, and is equivalent to __mt_fp128_fabs(x) when the second input is zero.

Rounding, Decomposition, and Representation Helpers

__mt_fp128_trunc

__device__ __float128 __mt_fp128_trunc(__float128 x);

Truncates the input argument toward zero.

__mt_fp128_floor

__device__ __float128 __mt_fp128_floor(__float128 x);

Rounds the input argument down to the nearest integral value.

__mt_fp128_ceil

__device__ __float128 __mt_fp128_ceil(__float128 x);

Rounds the input argument up to the nearest integral value.

__mt_fp128_round

__device__ __float128 __mt_fp128_round(__float128 x);

Rounds the input argument to the nearest integral value, with halfway cases rounded away from zero. Preserves signed zero and infinity, and returns NaN for NaN input.

__mt_fp128_rint

__device__ __float128 __mt_fp128_rint(__float128 x);

Rounds the input argument to the nearest integral value in floating-point format, with halfway cases rounded to the nearest even integer. Preserves signed zero and infinity, and returns NaN for NaN input.

__mt_fp128_frexp

__device__ __float128 __mt_fp128_frexp(__float128 x, int* exp);

Extracts mantissa and exponent of the input argument. Returns the fractional component and stores the exponent through exp; for zero input, it stores 0, and for infinity or NaN, the stored exponent is unspecified.

__mt_fp128_modf

__device__ __float128 __mt_fp128_modf(__float128 x, __float128* iptr);

Splits the input argument into fractional and integral parts. Stores the integral part through iptr, and both parts keep the sign of the input. For infinity, it returns signed zero and stores infinity; for NaN, it stores and returns NaN.

__mt_fp128_ldexp

__device__ __float128 __mt_fp128_ldexp(__float128 x, int exp);

Calculates x * 2^exp. Returns x when exp is 0, preserves zero and infinity, and returns NaN for NaN input.

__mt_fp128_ilogb

__device__ int __mt_fp128_ilogb(__float128 x);

Computes the unbiased integer exponent of the input argument.

__mt_fp128_remainder

__device__ __float128 __mt_fp128_remainder(__float128 x, __float128 y);

Calculates the IEEE remainder of the division of the input arguments. The quotient is rounded to the nearest integer with ties to even. Returns NaN for x / 0, infinity as the first input, or NaN inputs, and returns x for finite x when y is infinity.

__mt_fp128_fmod

__device__ __float128 __mt_fp128_fmod(__float128 x, __float128 y);

Calculates the floating-point remainder of the division of the input arguments. The result has the same sign as x and magnitude less than |y|. Returns NaN if x is infinity, y is 0, or either input is NaN.

Comparison, Sign, and Classification Helpers

__mt_fp128_fabs

__device__ __float128 __mt_fp128_fabs(__float128 x);

Calculates the absolute value of the input argument.

__mt_fp128_copysign

__device__ __float128 __mt_fp128_copysign(__float128 x, __float128 y);

Returns a value with the magnitude of the first input argument and the sign of the second. If the first input is NaN, the result is a NaN with the sign of the second input.

__mt_fp128_fmax

__device__ __float128 __mt_fp128_fmax(__float128 x, __float128 y);

Returns the larger numeric value of the input arguments.

__mt_fp128_fmin

__device__ __float128 __mt_fp128_fmin(__float128 x, __float128 y);

Returns the smaller numeric value of the input arguments.

__mt_fp128_fdim

__device__ __float128 __mt_fp128_fdim(__float128 x, __float128 y);

Returns the positive difference of the input arguments if the first is larger; otherwise returns 0.

__mt_fp128_isnan

__device__ int __mt_fp128_isnan(__float128 x);

Determines whether the input argument is NaN. Returns a nonzero value if and only if the input is NaN.

__mt_fp128_isunordered

__device__ int __mt_fp128_isunordered(__float128 x, __float128 y);

Determines whether either input argument is NaN, making the comparison unordered. Returns a nonzero value if at least one input is NaN; otherwise returns 0.

Floating-Point Classification Intrinsics

Use these intrinsics to classify floating-point values without converting them. They report whether a value is finite, infinite, NaN, or has its sign bit set.

__finitef

int __finitef(float x)

Determines whether the single-precision floating-point input is finite.

__isinf

int __isinf(double x)

Determines whether the double-precision floating-point input is infinite.

__isinff

int __isinff(float x)

Determines whether the single-precision floating-point input is infinite.

__isnan

int __isnan(double x)

Determines whether the double-precision floating-point input is NaN.

__isnanf

int __isnanf(float x)

Determines whether the single-precision floating-point input is NaN.

__signbitf

int __signbitf(float x)

Returns whether the sign bit of the single-precision floating-point input is set.

Scalar Mathematical Helper Functions

This extracted group mixes integer overloads with generic scalar abs, min, and max helpers. Use the signatures below to select the correct overload for the operand type.

Absolute Value Helpers

abs

int abs(int a)

Calculate the absolute value of the input int argument.

abs

long long int abs(long long int a)

Calculate the absolute value of the input long int argument.

abs

long int abs(long int a)

Calculate the absolute value of the input long int argument.

abs

float abs(float a)

Calculate the absolute value of the input float argument.

abs

double abs(double a)

Calculate the absolute value of the input double argument.

labs

long int labs(long int a)

Calculate the absolute value of the input long int argument.

llabs

long long int llabs(long long int a)

Calculate the absolute value of the input long long int argument.

llmax

long long int llmax(const long long int a, const long long int b)

Calculate the maximum value of the input long long int arguments.

llmin

long long int llmin(const long long int a, const long long int b)

Calculate the minimum value of the input long long int arguments.

max Overloads

max

int max(const int a, const int b)

Calculate the maximum value of the input float arguments.

max

inline unsigned int max(const unsigned int a, const unsigned int b)

Calculate the maximum value of the input unsigned int arguments.

max

inline unsigned int max(const int a, const unsigned int b)

Calculate the maximum value of the input arguments.

max

inline unsigned int max(const unsigned int a, const int b)

Calculate the maximum value of the input arguments.

max

inline long int max(const long int a, const long int b)

Calculate the maximum value of the input long int arguments.

max

inline unsigned long int max(const unsigned long int a, const unsigned long int b)

Calculate the maximum value of the input unsigned long int arguments.

max

inline unsigned long int max(const long int a, const unsigned long int b)

Calculate the maximum value of the input arguments.

max

inline unsigned long int max(const unsigned long int a, const long int b)

Calculate the maximum value of the input arguments.

max

inline long long int max(const long long int a, const long long int b)

Calculate the maximum value of the input long long int arguments.

max

inline unsigned long long int max(const unsigned long long int a, const unsigned long long int b)

Calculate the maximum value of the input unsigned long long int arguments.

max

inline unsigned long long int max(const long long int a, const unsigned long long int b)

Calculate the maximum value of the input arguments.

max

inline unsigned long long int max(const unsigned long long int a, const long long int b)

Calculate the maximum value of the input arguments.

max

inline float max(const float a, const float b)

Calculate the maximum value of the input float arguments.

max

inline double max(const double a, const double b)

Calculate the maximum value of the input double arguments.

max

inline double max(const float a, const double b)

Calculate the maximum value of the input arguments.

max

inline double max(const double a, const float b)

Calculate the maximum value of the input arguments.

min Overloads

min

int min(const int a, const int b)

Calculate the minimum value of the input float arguments.

min

inline unsigned int min(const unsigned int a, const unsigned int b)

Calculate the minimum value of the input unsigned int arguments.

min

inline unsigned int min(const int a, const unsigned int b)

Calculate the minimum value of the input arguments.

min

inline unsigned int min(const unsigned int a, const int b)

Calculate the minimum value of the input arguments.

min

inline long int min(const long int a, const long int b)

Calculate the minimum value of the input long int arguments.

min

inline unsigned long int min(const unsigned long int a, const unsigned long int b)

Calculate the minimum value of the input unsigned long int arguments.

min

inline unsigned long int min(const long int a, const unsigned long int b)

Calculate the minimum value of the input arguments.

min

inline unsigned long int min(const unsigned long int a, const long int b)

Calculate the minimum value of the input arguments.

min

inline long long int min(const long long int a, const long long int b)

Calculate the minimum value of the input long long int arguments.

min

inline unsigned long long int min(const unsigned long long int a, const unsigned long long int b)

Calculate the minimum value of the input unsigned long long int arguments.

min

inline unsigned long long int min(const long long int a, const unsigned long long int b)

Calculate the minimum value of the input arguments.

min

inline unsigned long long int min(const unsigned long long int a, const long long int b)

Calculate the minimum value of the input arguments.

min

inline float min(const float a, const float b)

Calculate the minimum value of the input float arguments.

min

inline double min(const double a, const double b)

Calculate the minimum value of the input double arguments.

min

inline double min(const float a, const double b)

Calculate the minimum value of the input arguments.

min

inline double min(const double a, const float b)

Calculate the minimum value of the input arguments.

Unsigned Extremum Helpers

ullmax

unsigned long long int ullmax(const unsigned long long int a, const unsigned long long int b)

Calculate the maximum value of the input unsigned long long int arguments.

ullmin

unsigned long long int ullmin(const unsigned long long int a, const unsigned long long int b)

Calculate the minimum value of the input unsigned long long int arguments.

umax

unsigned int umax(const unsigned int a, const unsigned int b)

Calculate the maximum value of the input unsigned int arguments.

umin

unsigned int umin(const unsigned int a, const unsigned int b)

Calculate the minimum value of the input unsigned int arguments.

Integer Intrinsics

Use integer intrinsics for low-level integer operations, memory access helpers, bit manipulation, and packed integer behavior. Load and store intrinsics in this section read from or write to global memory using the pointer and value types shown in each signature.

Warp Shuffle Intrinsics

These overloads exchange scalar values between lanes in the same warp. The return type matches the type of var in each signature.

__shfl_down_sync

int __shfl_down_sync(unsigned mask, int var, unsigned int delta, int width=32)

Exchange a value between threads within a warp by copying from a higher-numbered source lane.

__shfl_down_sync

unsigned int __shfl_down_sync(unsigned mask, unsigned int var, unsigned int delta, int width=32)

Exchange a value between threads within a warp by copying from a higher-numbered source lane.

__shfl_down_sync

float __shfl_down_sync(unsigned mask, float var, unsigned int delta, int width=32)

Exchange a value between threads within a warp by copying from a higher-numbered source lane.

__shfl_down_sync

long long __shfl_down_sync(unsigned mask, long long var, unsigned int delta, int width=32)

Exchange a value between threads within a warp by copying from a higher-numbered source lane.

__shfl_down_sync

unsigned long long __shfl_down_sync(unsigned mask, unsigned long long var, unsigned int delta, int width=32)

Exchange a value between threads within a warp by copying from a higher-numbered source lane.

__shfl_down_sync

double __shfl_down_sync(unsigned mask, double var, unsigned int delta, int width=32)

Exchange a value between threads within a warp by copying from a higher-numbered source lane.

__shfl_down_sync

long __shfl_down_sync(unsigned mask, long var, unsigned int delta, int width=32)

Exchange a value between threads within a warp by copying from a higher-numbered source lane.

__shfl_down_sync

unsigned long __shfl_down_sync(unsigned mask, unsigned long var, unsigned int delta, int width=32)

Exchange a value between threads within a warp by copying from a higher-numbered source lane.

__shfl_sync

int __shfl_sync(unsigned mask, int var, int delta, int width=32)

Exchange a value between threads within a warp by copying from the lane selected by delta.

__shfl_sync

unsigned int __shfl_sync(unsigned mask, unsigned int var, int delta, int width=32)

Exchange a value between threads within a warp by copying from the lane selected by delta.

__shfl_sync

float __shfl_sync(unsigned mask, float var, int delta, int width=32)

Exchange a value between threads within a warp by copying from the lane selected by delta.

__shfl_sync

long long __shfl_sync(unsigned mask, long long var, int delta, int width=32)

Exchange a value between threads within a warp by copying from the lane selected by delta.

__shfl_sync

unsigned long long __shfl_sync(unsigned mask, unsigned long long var, int delta, int width=32)

Exchange a value between threads within a warp by copying from the lane selected by delta.

__shfl_sync

double __shfl_sync(unsigned mask, double var, int delta, int width=32)

Exchange a value between threads within a warp by copying from the lane selected by delta.

__shfl_sync

long __shfl_sync(unsigned mask, long var, int delta, int width=32)

Exchange a value between threads within a warp by copying from the lane selected by delta.

__shfl_sync

unsigned long __shfl_sync(unsigned mask, unsigned long var, int delta, int width=32)

Exchange a value between threads within a warp by copying from the lane selected by delta.

__shfl_up_sync

int __shfl_up_sync(unsigned mask, int var, unsigned int delta, int width=32)

Exchange a value between threads within a warp by copying from a lower-numbered source lane.

__shfl_up_sync

unsigned int __shfl_up_sync(unsigned mask, unsigned int var, unsigned int delta, int width=32)

Exchange a value between threads within a warp by copying from a lower-numbered source lane.

__shfl_up_sync

float __shfl_up_sync(unsigned mask, float var, unsigned int delta, int width=32)

Exchange a value between threads within a warp by copying from a lower-numbered source lane.

__shfl_up_sync

long long __shfl_up_sync(unsigned mask, long long var, unsigned int delta, int width=32)

Exchange a value between threads within a warp by copying from a lower-numbered source lane.

__shfl_up_sync

unsigned long long __shfl_up_sync(unsigned mask, unsigned long long var, unsigned int delta, int width=32)

Exchange a value between threads within a warp by copying from a lower-numbered source lane.

__shfl_up_sync

double __shfl_up_sync(unsigned mask, double var, unsigned int delta, int width=32)

Exchange a value between threads within a warp by copying from a lower-numbered source lane.

__shfl_up_sync

long __shfl_up_sync(unsigned mask, long var, unsigned int delta, int width=32)

Exchange a value between threads within a warp by copying from a lower-numbered source lane.

__shfl_up_sync

unsigned long __shfl_up_sync(unsigned mask, unsigned long var, unsigned int delta, int width=32)

Exchange a value between threads within a warp by copying from a lower-numbered source lane.

__shfl_xor_sync

int __shfl_xor_sync(unsigned mask, int var, int delta, int width=32)

Exchange a value between threads within a warp by copying from the lane selected through an XOR lane mask.

__shfl_xor_sync

unsigned int __shfl_xor_sync(unsigned mask, unsigned int var, int delta, int width=32)

Exchange a value between threads within a warp by copying from the lane selected through an XOR lane mask.

__shfl_xor_sync

float __shfl_xor_sync(unsigned mask, float var, int delta, int width=32)

Exchange a value between threads within a warp by copying from the lane selected through an XOR lane mask.

__shfl_xor_sync

long long __shfl_xor_sync(unsigned mask, long long var, int delta, int width=32)

Exchange a value between threads within a warp by copying from the lane selected through an XOR lane mask.

__shfl_xor_sync

unsigned long long __shfl_xor_sync(unsigned mask, unsigned long long var, int delta, int width=32)

Exchange a value between threads within a warp by copying from the lane selected through an XOR lane mask.

__shfl_xor_sync

double __shfl_xor_sync(unsigned mask, double var, int delta, int width=32)

Exchange a value between threads within a warp by copying from the lane selected through an XOR lane mask.

__shfl_xor_sync

long __shfl_xor_sync(unsigned mask, long var, int delta, int width=32)

Exchange a value between threads within a warp by copying from the lane selected through an XOR lane mask.

__shfl_xor_sync

unsigned long __shfl_xor_sync(unsigned mask, unsigned long var, int delta, int width=32)

Exchange a value between threads within a warp by copying from the lane selected through an XOR lane mask.

Load Intrinsics

__shfl_down_sync

int __shfl_down_sync(unsigned mask, int var, unsigned int delta, int width=32)

Exchange a variable between threads within a warp. Copy from a thread with higher ID relative to the caller.

Calculates a source thread ID by adding delta to the caller's thread ID. The value of var held by the resulting thread ID is returned: this has the effect of shifting var down the warp by delta threads. If width is less than warpSize then each subsection of the warp behaves as a separate entity with a starting logical thread ID of 0. As for __shfl_up_sync(), the ID number of the source thread will not wrap around the value of width and so the upper delta threads will remain unchanged.

int

as mt_bfloat162. If the source thread ID is out of range or the source thread has exited, the calling thread's own var is returned.

Parameters

  • mask (in): unsigned
  • var (in): mt_bfloat162
  • delta (in): int
  • width (in): int

Returns

  • Returns the 4-byte word referenced by var from the source thread ID

__shfl_down_sync

unsigned int __shfl_down_sync(unsigned mask, unsigned int var, unsigned int delta, int width=32)

Exchange a variable between threads within a warp. Copy from a thread with higher ID relative to the caller.

Calculates a source thread ID by adding delta to the caller's thread ID. The value of var held by the resulting thread ID is returned: this has the effect of shifting var down the warp by delta threads. If width is less than warpSize then each subsection of the warp behaves as a separate entity with a starting logical thread ID of 0. As for __shfl_up_sync(), the ID number of the source thread will not wrap around the value of width and so the upper delta threads will remain unchanged.

int

as mt_bfloat162. If the source thread ID is out of range or the source thread has exited, the calling thread's own var is returned.

Parameters

  • mask (in): unsigned
  • var (in): mt_bfloat162
  • delta (in): int
  • width (in): int

Returns

  • Returns the 4-byte word referenced by var from the source thread ID

__shfl_down_sync

float __shfl_down_sync(unsigned mask, float var, unsigned int delta, int width=32)

Exchange a variable between threads within a warp. Copy from a thread with higher ID relative to the caller.

Calculates a source thread ID by adding delta to the caller's thread ID. The value of var held by the resulting thread ID is returned: this has the effect of shifting var down the warp by delta threads. If width is less than warpSize then each subsection of the warp behaves as a separate entity with a starting logical thread ID of 0. As for __shfl_up_sync(), the ID number of the source thread will not wrap around the value of width and so the upper delta threads will remain unchanged.

int

as mt_bfloat162. If the source thread ID is out of range or the source thread has exited, the calling thread's own var is returned.

Parameters

  • mask (in): unsigned
  • var (in): mt_bfloat162
  • delta (in): int
  • width (in): int

Returns

  • Returns the 4-byte word referenced by var from the source thread ID

__shfl_down_sync

long long __shfl_down_sync(unsigned mask, long long var, unsigned int delta, int width=32)

Exchange a variable between threads within a warp. Copy from a thread with higher ID relative to the caller.

Calculates a source thread ID by adding delta to the caller's thread ID. The value of var held by the resulting thread ID is returned: this has the effect of shifting var down the warp by delta threads. If width is less than warpSize then each subsection of the warp behaves as a separate entity with a starting logical thread ID of 0. As for __shfl_up_sync(), the ID number of the source thread will not wrap around the value of width and so the upper delta threads will remain unchanged.

int

as mt_bfloat162. If the source thread ID is out of range or the source thread has exited, the calling thread's own var is returned.

Parameters

  • mask (in): unsigned
  • var (in): mt_bfloat162
  • delta (in): int
  • width (in): int

Returns

  • Returns the 4-byte word referenced by var from the source thread ID

__shfl_down_sync

unsigned long long __shfl_down_sync(unsigned mask, unsigned long long var, unsigned int delta, int width=32)

Exchange a variable between threads within a warp. Copy from a thread with higher ID relative to the caller.

Calculates a source thread ID by adding delta to the caller's thread ID. The value of var held by the resulting thread ID is returned: this has the effect of shifting var down the warp by delta threads. If width is less than warpSize then each subsection of the warp behaves as a separate entity with a starting logical thread ID of 0. As for __shfl_up_sync(), the ID number of the source thread will not wrap around the value of width and so the upper delta threads will remain unchanged.

int

as mt_bfloat162. If the source thread ID is out of range or the source thread has exited, the calling thread's own var is returned.

Parameters

  • mask (in): unsigned
  • var (in): mt_bfloat162
  • delta (in): int
  • width (in): int

Returns

  • Returns the 4-byte word referenced by var from the source thread ID

__shfl_down_sync

double __shfl_down_sync(unsigned mask, double var, unsigned int delta, int width=32)

Exchange a variable between threads within a warp. Copy from a thread with higher ID relative to the caller.

Calculates a source thread ID by adding delta to the caller's thread ID. The value of var held by the resulting thread ID is returned: this has the effect of shifting var down the warp by delta threads. If width is less than warpSize then each subsection of the warp behaves as a separate entity with a starting logical thread ID of 0. As for __shfl_up_sync(), the ID number of the source thread will not wrap around the value of width and so the upper delta threads will remain unchanged.

int

as mt_bfloat162. If the source thread ID is out of range or the source thread has exited, the calling thread's own var is returned.

Parameters

  • mask (in): unsigned
  • var (in): mt_bfloat162
  • delta (in): int
  • width (in): int

Returns

  • Returns the 4-byte word referenced by var from the source thread ID

__shfl_down_sync

long __shfl_down_sync(unsigned mask, long var, unsigned int delta, int width=32)

Exchange a variable between threads within a warp. Copy from a thread with higher ID relative to the caller.

Calculates a source thread ID by adding delta to the caller's thread ID. The value of var held by the resulting thread ID is returned: this has the effect of shifting var down the warp by delta threads. If width is less than warpSize then each subsection of the warp behaves as a separate entity with a starting logical thread ID of 0. As for __shfl_up_sync(), the ID number of the source thread will not wrap around the value of width and so the upper delta threads will remain unchanged.

int

as mt_bfloat162. If the source thread ID is out of range or the source thread has exited, the calling thread's own var is returned.

Parameters

  • mask (in): unsigned
  • var (in): mt_bfloat162
  • delta (in): int
  • width (in): int

Returns

  • Returns the 4-byte word referenced by var from the source thread ID

__shfl_down_sync

unsigned long __shfl_down_sync(unsigned mask, unsigned long var, unsigned int delta, int width=32)

Exchange a variable between threads within a warp. Copy from a thread with higher ID relative to the caller.

Calculates a source thread ID by adding delta to the caller's thread ID. The value of var held by the resulting thread ID is returned: this has the effect of shifting var down the warp by delta threads. If width is less than warpSize then each subsection of the warp behaves as a separate entity with a starting logical thread ID of 0. As for __shfl_up_sync(), the ID number of the source thread will not wrap around the value of width and so the upper delta threads will remain unchanged.

int

as mt_bfloat162. If the source thread ID is out of range or the source thread has exited, the calling thread's own var is returned.

Parameters

  • mask (in): unsigned
  • var (in): mt_bfloat162
  • delta (in): int
  • width (in): int

Returns

  • Returns the 4-byte word referenced by var from the source thread ID

__shfl_sync

int __shfl_sync(unsigned mask, int var, int delta, int width=32)

Exchange a variable between threads within a warp. Direct copy from indexed thread.

Returns the value of var held by the thread whose ID is given by delta. If width is less than warpSize then each subsection of the warp behaves as a separate entity with a starting logical thread ID of 0. If delta is outside the range [0:width-1], the value returned corresponds to the value of var held by the delta modulo width (i.e. within the same subsection). width must have a value which is a power of 2; results are undefined if width is not a power of 2, or is a number greater than warpSize.

unsigned int

being.

int

as mt_bfloat162. If the source thread ID is out of range or the source thread has exited, the calling thread's own var is returned.

Parameters

  • mask (in):
  • var (in): mt_bfloat162. Is only
  • delta (in): int
  • width (in):

Returns

  • Returns the 4-byte word referenced by var from the source thread ID

__shfl_sync

unsigned int __shfl_sync(unsigned mask, unsigned int var, int delta, int width=32)

Exchange a variable between threads within a warp. Direct copy from indexed thread.

Returns the value of var held by the thread whose ID is given by delta. If width is less than warpSize then each subsection of the warp behaves as a separate entity with a starting logical thread ID of 0. If delta is outside the range [0:width-1], the value returned corresponds to the value of var held by the delta modulo width (i.e. within the same subsection). width must have a value which is a power of 2; results are undefined if width is not a power of 2, or is a number greater than warpSize.

unsigned int

being.

int

as mt_bfloat162. If the source thread ID is out of range or the source thread has exited, the calling thread's own var is returned.

Parameters

  • mask (in):
  • var (in): mt_bfloat162. Is only
  • delta (in): int
  • width (in):

Returns

  • Returns the 4-byte word referenced by var from the source thread ID

__shfl_sync

float __shfl_sync(unsigned mask, float var, int delta, int width=32)

Exchange a variable between threads within a warp. Direct copy from indexed thread.

Returns the value of var held by the thread whose ID is given by delta. If width is less than warpSize then each subsection of the warp behaves as a separate entity with a starting logical thread ID of 0. If delta is outside the range [0:width-1], the value returned corresponds to the value of var held by the delta modulo width (i.e. within the same subsection). width must have a value which is a power of 2; results are undefined if width is not a power of 2, or is a number greater than warpSize.

unsigned int

being.

int

as mt_bfloat162. If the source thread ID is out of range or the source thread has exited, the calling thread's own var is returned.

Parameters

  • mask (in):
  • var (in): mt_bfloat162. Is only
  • delta (in): int
  • width (in):

Returns

  • Returns the 4-byte word referenced by var from the source thread ID

__shfl_sync

long long __shfl_sync(unsigned mask, long long var, int delta, int width=32)

Exchange a variable between threads within a warp. Direct copy from indexed thread.

Returns the value of var held by the thread whose ID is given by delta. If width is less than warpSize then each subsection of the warp behaves as a separate entity with a starting logical thread ID of 0. If delta is outside the range [0:width-1], the value returned corresponds to the value of var held by the delta modulo width (i.e. within the same subsection). width must have a value which is a power of 2; results are undefined if width is not a power of 2, or is a number greater than warpSize.

unsigned int

being.

int

as mt_bfloat162. If the source thread ID is out of range or the source thread has exited, the calling thread's own var is returned.

Parameters

  • mask (in):
  • var (in): mt_bfloat162. Is only
  • delta (in): int
  • width (in):

Returns

  • Returns the 4-byte word referenced by var from the source thread ID

__shfl_sync

unsigned long long __shfl_sync(unsigned mask, unsigned long long var, int delta, int width=32)

Exchange a variable between threads within a warp. Direct copy from indexed thread.

Returns the value of var held by the thread whose ID is given by delta. If width is less than warpSize then each subsection of the warp behaves as a separate entity with a starting logical thread ID of 0. If delta is outside the range [0:width-1], the value returned corresponds to the value of var held by the delta modulo width (i.e. within the same subsection). width must have a value which is a power of 2; results are undefined if width is not a power of 2, or is a number greater than warpSize.

unsigned int

being.

int

as mt_bfloat162. If the source thread ID is out of range or the source thread has exited, the calling thread's own var is returned.

Parameters

  • mask (in):
  • var (in): mt_bfloat162. Is only
  • delta (in): int
  • width (in):

Returns

  • Returns the 4-byte word referenced by var from the source thread ID

__shfl_sync

double __shfl_sync(unsigned mask, double var, int delta, int width=32)

Exchange a variable between threads within a warp. Direct copy from indexed thread.

Returns the value of var held by the thread whose ID is given by delta. If width is less than warpSize then each subsection of the warp behaves as a separate entity with a starting logical thread ID of 0. If delta is outside the range [0:width-1], the value returned corresponds to the value of var held by the delta modulo width (i.e. within the same subsection). width must have a value which is a power of 2; results are undefined if width is not a power of 2, or is a number greater than warpSize.

unsigned int

being.

int

as mt_bfloat162. If the source thread ID is out of range or the source thread has exited, the calling thread's own var is returned.

Parameters

  • mask (in):
  • var (in): mt_bfloat162. Is only
  • delta (in): int
  • width (in):

Returns

  • Returns the 4-byte word referenced by var from the source thread ID

__shfl_sync

long __shfl_sync(unsigned mask, long var, int delta, int width=32)

Exchange a variable between threads within a warp. Direct copy from indexed thread.

Returns the value of var held by the thread whose ID is given by delta. If width is less than warpSize then each subsection of the warp behaves as a separate entity with a starting logical thread ID of 0. If delta is outside the range [0:width-1], the value returned corresponds to the value of var held by the delta modulo width (i.e. within the same subsection). width must have a value which is a power of 2; results are undefined if width is not a power of 2, or is a number greater than warpSize.

unsigned int

being.

int

as mt_bfloat162. If the source thread ID is out of range or the source thread has exited, the calling thread's own var is returned.

Parameters

  • mask (in):
  • var (in): mt_bfloat162. Is only
  • delta (in): int
  • width (in):

Returns

  • Returns the 4-byte word referenced by var from the source thread ID

__shfl_sync

unsigned long __shfl_sync(unsigned mask, unsigned long var, int delta, int width=32)

Exchange a variable between threads within a warp. Direct copy from indexed thread.

Returns the value of var held by the thread whose ID is given by delta. If width is less than warpSize then each subsection of the warp behaves as a separate entity with a starting logical thread ID of 0. If delta is outside the range [0:width-1], the value returned corresponds to the value of var held by the delta modulo width (i.e. within the same subsection). width must have a value which is a power of 2; results are undefined if width is not a power of 2, or is a number greater than warpSize.

unsigned int

being.

int

as mt_bfloat162. If the source thread ID is out of range or the source thread has exited, the calling thread's own var is returned.

Parameters

  • mask (in):
  • var (in): mt_bfloat162. Is only
  • delta (in): int
  • width (in):

Returns

  • Returns the 4-byte word referenced by var from the source thread ID

__shfl_up_sync

int __shfl_up_sync(unsigned mask, int var, unsigned int delta, int width=32)

Exchange a variable between threads within a warp. Copy from a thread with lower ID relative to the caller.

Calculates a source thread ID by subtracting delta from the caller's lane ID. The value of var held by the resulting lane ID is returned: in effect, var is shifted up the warp by delta threads. If width is less than warpSize then each subsection of the warp behaves as a separate entity with a starting logical thread ID of 0. The source thread index will not wrap around the value of width, so effectively the lower delta threads will be unchanged. width must have a value which is a power of 2; results are undefined if width is not a power of 2, or is a number greater than warpSize.

unsigned int

being.

int

as mt_bfloat162. If the source thread ID is out of range or the source thread has exited, the calling thread's own var is returned.

Parameters

  • mask (in):
  • var (in): mt_bfloat162. Is only
  • delta (in): int
  • width (in):

Returns

  • Returns the 4-byte word referenced by var from the source thread ID

__shfl_up_sync

unsigned int __shfl_up_sync(unsigned mask, unsigned int var, unsigned int delta, int width=32)

Exchange a variable between threads within a warp. Copy from a thread with lower ID relative to the caller.

Calculates a source thread ID by subtracting delta from the caller's lane ID. The value of var held by the resulting lane ID is returned: in effect, var is shifted up the warp by delta threads. If width is less than warpSize then each subsection of the warp behaves as a separate entity with a starting logical thread ID of 0. The source thread index will not wrap around the value of width, so effectively the lower delta threads will be unchanged. width must have a value which is a power of 2; results are undefined if width is not a power of 2, or is a number greater than warpSize.

unsigned int

being.

int

as mt_bfloat162. If the source thread ID is out of range or the source thread has exited, the calling thread's own var is returned.

Parameters

  • mask (in):
  • var (in): mt_bfloat162. Is only
  • delta (in): int
  • width (in):

Returns

  • Returns the 4-byte word referenced by var from the source thread ID

__shfl_up_sync

float __shfl_up_sync(unsigned mask, float var, unsigned int delta, int width=32)

Exchange a variable between threads within a warp. Copy from a thread with lower ID relative to the caller.

Calculates a source thread ID by subtracting delta from the caller's lane ID. The value of var held by the resulting lane ID is returned: in effect, var is shifted up the warp by delta threads. If width is less than warpSize then each subsection of the warp behaves as a separate entity with a starting logical thread ID of 0. The source thread index will not wrap around the value of width, so effectively the lower delta threads will be unchanged. width must have a value which is a power of 2; results are undefined if width is not a power of 2, or is a number greater than warpSize.

unsigned int

being.

int

as mt_bfloat162. If the source thread ID is out of range or the source thread has exited, the calling thread's own var is returned.

Parameters

  • mask (in):
  • var (in): mt_bfloat162. Is only
  • delta (in): int
  • width (in):

Returns

  • Returns the 4-byte word referenced by var from the source thread ID

__shfl_up_sync

long long __shfl_up_sync(unsigned mask, long long var, unsigned int delta, int width=32)

Exchange a variable between threads within a warp. Copy from a thread with lower ID relative to the caller.

Calculates a source thread ID by subtracting delta from the caller's lane ID. The value of var held by the resulting lane ID is returned: in effect, var is shifted up the warp by delta threads. If width is less than warpSize then each subsection of the warp behaves as a separate entity with a starting logical thread ID of 0. The source thread index will not wrap around the value of width, so effectively the lower delta threads will be unchanged. width must have a value which is a power of 2; results are undefined if width is not a power of 2, or is a number greater than warpSize.

unsigned int

being.

int

as mt_bfloat162. If the source thread ID is out of range or the source thread has exited, the calling thread's own var is returned.

Parameters

  • mask (in):
  • var (in): mt_bfloat162. Is only
  • delta (in): int
  • width (in):

Returns

  • Returns the 4-byte word referenced by var from the source thread ID

__shfl_up_sync

unsigned long long __shfl_up_sync(unsigned mask, unsigned long long var, unsigned int delta, int width=32)

Exchange a variable between threads within a warp. Copy from a thread with lower ID relative to the caller.

Calculates a source thread ID by subtracting delta from the caller's lane ID. The value of var held by the resulting lane ID is returned: in effect, var is shifted up the warp by delta threads. If width is less than warpSize then each subsection of the warp behaves as a separate entity with a starting logical thread ID of 0. The source thread index will not wrap around the value of width, so effectively the lower delta threads will be unchanged. width must have a value which is a power of 2; results are undefined if width is not a power of 2, or is a number greater than warpSize.

unsigned int

being.

int

as mt_bfloat162. If the source thread ID is out of range or the source thread has exited, the calling thread's own var is returned.

Parameters

  • mask (in):
  • var (in): mt_bfloat162. Is only
  • delta (in): int
  • width (in):

Returns

  • Returns the 4-byte word referenced by var from the source thread ID

__shfl_up_sync

double __shfl_up_sync(unsigned mask, double var, unsigned int delta, int width=32)

Exchange a variable between threads within a warp. Copy from a thread with lower ID relative to the caller.

Calculates a source thread ID by subtracting delta from the caller's lane ID. The value of var held by the resulting lane ID is returned: in effect, var is shifted up the warp by delta threads. If width is less than warpSize then each subsection of the warp behaves as a separate entity with a starting logical thread ID of 0. The source thread index will not wrap around the value of width, so effectively the lower delta threads will be unchanged. width must have a value which is a power of 2; results are undefined if width is not a power of 2, or is a number greater than warpSize.

unsigned int

being.

int

as mt_bfloat162. If the source thread ID is out of range or the source thread has exited, the calling thread's own var is returned.

Parameters

  • mask (in):
  • var (in): mt_bfloat162. Is only
  • delta (in): int
  • width (in):

Returns

  • Returns the 4-byte word referenced by var from the source thread ID

__shfl_up_sync

long __shfl_up_sync(unsigned mask, long var, unsigned int delta, int width=32)

Exchange a variable between threads within a warp. Copy from a thread with lower ID relative to the caller.

Calculates a source thread ID by subtracting delta from the caller's lane ID. The value of var held by the resulting lane ID is returned: in effect, var is shifted up the warp by delta threads. If width is less than warpSize then each subsection of the warp behaves as a separate entity with a starting logical thread ID of 0. The source thread index will not wrap around the value of width, so effectively the lower delta threads will be unchanged. width must have a value which is a power of 2; results are undefined if width is not a power of 2, or is a number greater than warpSize.

unsigned int

being.

int

as mt_bfloat162. If the source thread ID is out of range or the source thread has exited, the calling thread's own var is returned.

Parameters

  • mask (in):
  • var (in): mt_bfloat162. Is only
  • delta (in): int
  • width (in):

Returns

  • Returns the 4-byte word referenced by var from the source thread ID

__shfl_up_sync

unsigned long __shfl_up_sync(unsigned mask, unsigned long var, unsigned int delta, int width=32)

Exchange a variable between threads within a warp. Copy from a thread with lower ID relative to the caller.

Calculates a source thread ID by subtracting delta from the caller's lane ID. The value of var held by the resulting lane ID is returned: in effect, var is shifted up the warp by delta threads. If width is less than warpSize then each subsection of the warp behaves as a separate entity with a starting logical thread ID of 0. The source thread index will not wrap around the value of width, so effectively the lower delta threads will be unchanged. width must have a value which is a power of 2; results are undefined if width is not a power of 2, or is a number greater than warpSize.

unsigned int

being.

int

as mt_bfloat162. If the source thread ID is out of range or the source thread has exited, the calling thread's own var is returned.

Parameters

  • mask (in):
  • var (in): mt_bfloat162. Is only
  • delta (in): int
  • width (in):

Returns

  • Returns the 4-byte word referenced by var from the source thread ID

__shfl_xor_sync

int __shfl_xor_sync(unsigned mask, int var, int delta, int width=32)

Exchange a variable between threads within a warp. Copy from a thread based on bitwise XOR of own thread ID.

Calculates a source thread ID by performing a bitwise XOR of the caller's thread ID with mask: the value of var held by the resulting thread ID is returned. If width is less than warpSize then each group of width consecutive threads are able to access elements from earlier groups of threads, however if they attempt to access elements from later groups of threads their own value of var will be returned. This mode implements a butterfly addressing pattern such as is used in tree reduction and broadcast.

as mt_bfloat162. If the source thread ID is out of range or the source thread has exited, the calling thread's own var is returned.

Parameters

  • mask (in): unsigned int
  • var (in): mt_bfloat162
  • delta (in): int
  • width (in): int

Returns

  • Returns the 4-byte word referenced by var from the source thread ID

__shfl_xor_sync

unsigned int __shfl_xor_sync(unsigned mask, unsigned int var, int delta, int width=32)

Exchange a variable between threads within a warp. Copy from a thread based on bitwise XOR of own thread ID.

Calculates a source thread ID by performing a bitwise XOR of the caller's thread ID with mask: the value of var held by the resulting thread ID is returned. If width is less than warpSize then each group of width consecutive threads are able to access elements from earlier groups of threads, however if they attempt to access elements from later groups of threads their own value of var will be returned. This mode implements a butterfly addressing pattern such as is used in tree reduction and broadcast.

as mt_bfloat162. If the source thread ID is out of range or the source thread has exited, the calling thread's own var is returned.

Parameters

  • mask (in): unsigned int
  • var (in): mt_bfloat162
  • delta (in): int
  • width (in): int

Returns

  • Returns the 4-byte word referenced by var from the source thread ID

__shfl_xor_sync

float __shfl_xor_sync(unsigned mask, float var, int delta, int width=32)

Exchange a variable between threads within a warp. Copy from a thread based on bitwise XOR of own thread ID.

Calculates a source thread ID by performing a bitwise XOR of the caller's thread ID with mask: the value of var held by the resulting thread ID is returned. If width is less than warpSize then each group of width consecutive threads are able to access elements from earlier groups of threads, however if they attempt to access elements from later groups of threads their own value of var will be returned. This mode implements a butterfly addressing pattern such as is used in tree reduction and broadcast.

as mt_bfloat162. If the source thread ID is out of range or the source thread has exited, the calling thread's own var is returned.

Parameters

  • mask (in): unsigned int
  • var (in): mt_bfloat162
  • delta (in): int
  • width (in): int

Returns

  • Returns the 4-byte word referenced by var from the source thread ID

__shfl_xor_sync

long long __shfl_xor_sync(unsigned mask, long long var, int delta, int width=32)

Exchange a variable between threads within a warp. Copy from a thread based on bitwise XOR of own thread ID.

Calculates a source thread ID by performing a bitwise XOR of the caller's thread ID with mask: the value of var held by the resulting thread ID is returned. If width is less than warpSize then each group of width consecutive threads are able to access elements from earlier groups of threads, however if they attempt to access elements from later groups of threads their own value of var will be returned. This mode implements a butterfly addressing pattern such as is used in tree reduction and broadcast.

as mt_bfloat162. If the source thread ID is out of range or the source thread has exited, the calling thread's own var is returned.

Parameters

  • mask (in): unsigned int
  • var (in): mt_bfloat162
  • delta (in): int
  • width (in): int

Returns

  • Returns the 4-byte word referenced by var from the source thread ID

__shfl_xor_sync

unsigned long long __shfl_xor_sync(unsigned mask, unsigned long long var, int delta, int width=32)

Exchange a variable between threads within a warp. Copy from a thread based on bitwise XOR of own thread ID.

Calculates a source thread ID by performing a bitwise XOR of the caller's thread ID with mask: the value of var held by the resulting thread ID is returned. If width is less than warpSize then each group of width consecutive threads are able to access elements from earlier groups of threads, however if they attempt to access elements from later groups of threads their own value of var will be returned. This mode implements a butterfly addressing pattern such as is used in tree reduction and broadcast.

as mt_bfloat162. If the source thread ID is out of range or the source thread has exited, the calling thread's own var is returned.

Parameters

  • mask (in): unsigned int
  • var (in): mt_bfloat162
  • delta (in): int
  • width (in): int

Returns

  • Returns the 4-byte word referenced by var from the source thread ID

__shfl_xor_sync

double __shfl_xor_sync(unsigned mask, double var, int delta, int width=32)

Exchange a variable between threads within a warp. Copy from a thread based on bitwise XOR of own thread ID.

Calculates a source thread ID by performing a bitwise XOR of the caller's thread ID with mask: the value of var held by the resulting thread ID is returned. If width is less than warpSize then each group of width consecutive threads are able to access elements from earlier groups of threads, however if they attempt to access elements from later groups of threads their own value of var will be returned. This mode implements a butterfly addressing pattern such as is used in tree reduction and broadcast.

as mt_bfloat162. If the source thread ID is out of range or the source thread has exited, the calling thread's own var is returned.

Parameters

  • mask (in): unsigned int
  • var (in): mt_bfloat162
  • delta (in): int
  • width (in): int

Returns

  • Returns the 4-byte word referenced by var from the source thread ID

__shfl_xor_sync

long __shfl_xor_sync(unsigned mask, long var, int delta, int width=32)

Exchange a variable between threads within a warp. Copy from a thread based on bitwise XOR of own thread ID.

Calculates a source thread ID by performing a bitwise XOR of the caller's thread ID with mask: the value of var held by the resulting thread ID is returned. If width is less than warpSize then each group of width consecutive threads are able to access elements from earlier groups of threads, however if they attempt to access elements from later groups of threads their own value of var will be returned. This mode implements a butterfly addressing pattern such as is used in tree reduction and broadcast.

as mt_bfloat162. If the source thread ID is out of range or the source thread has exited, the calling thread's own var is returned.

Parameters

  • mask (in): unsigned int
  • var (in): mt_bfloat162
  • delta (in): int
  • width (in): int

Returns

  • Returns the 4-byte word referenced by var from the source thread ID

__shfl_xor_sync

unsigned long __shfl_xor_sync(unsigned mask, unsigned long var, int delta, int width=32)

Exchange a variable between threads within a warp. Copy from a thread based on bitwise XOR of own thread ID.

Calculates a source thread ID by performing a bitwise XOR of the caller's thread ID with mask: the value of var held by the resulting thread ID is returned. If width is less than warpSize then each group of width consecutive threads are able to access elements from earlier groups of threads, however if they attempt to access elements from later groups of threads their own value of var will be returned. This mode implements a butterfly addressing pattern such as is used in tree reduction and broadcast.

as mt_bfloat162. If the source thread ID is out of range or the source thread has exited, the calling thread's own var is returned.

Parameters

  • mask (in): unsigned int
  • var (in): mt_bfloat162
  • delta (in): int
  • width (in): int

Returns

  • Returns the 4-byte word referenced by var from the source thread ID

Half Precision Conversion and Data Movement 71

__ldca

long __ldca(const long *ptr)

Loads a value from the specified global memory address.

Parameters

  • ptr (in): source memory location to load from

Returns

  • The value loaded from ptr

__ldca

unsigned long __ldca(const unsigned long *ptr)

Loads a value from the specified global memory address.

Parameters

  • ptr (in): source memory location to load from

Returns

  • The value loaded from ptr

__ldca

char __ldca(const char *ptr)

Loads a value from the specified global memory address.

Parameters

  • ptr (in): source memory location to load from

Returns

  • The value loaded from ptr

__ldca

signed char __ldca(const signed char *ptr)

Loads a value from the specified global memory address.

Parameters

  • ptr (in): source memory location to load from

Returns

  • The value loaded from ptr

__ldca

short __ldca(const short *ptr)

Loads a value from the specified global memory address.

Parameters

  • ptr (in): source memory location to load from

Returns

  • The value loaded from ptr

__ldca

int __ldca(const int *ptr)

Loads a value from the specified global memory address.

Parameters

  • ptr (in): source memory location to load from

Returns

  • The value loaded from ptr

__ldca

long long __ldca(const long long *ptr)

Loads a value from the specified global memory address.

Parameters

  • ptr (in): source memory location to load from

Returns

  • The value loaded from ptr

__ldca

char2 __ldca(const char2 *ptr)

Loads a value from the specified global memory address.

Parameters

  • ptr (in): source memory location to load from

Returns

  • The value loaded from ptr

__ldca

char4 __ldca(const char4 *ptr)

Loads a value from the specified global memory address.

Parameters

  • ptr (in): source memory location to load from

Returns

  • The value loaded from ptr

__ldca

short2 __ldca(const short2 *ptr)

Loads a value from the specified global memory address.

Parameters

  • ptr (in): source memory location to load from

Returns

  • The value loaded from ptr

__ldca

short4 __ldca(const short4 *ptr)

Loads a value from the specified global memory address.

Parameters

  • ptr (in): source memory location to load from

Returns

  • The value loaded from ptr

__ldca

int2 __ldca(const int2 *ptr)

Loads a value from the specified global memory address.

Parameters

  • ptr (in): source memory location to load from

Returns

  • The value loaded from ptr

__ldca

int4 __ldca(const int4 *ptr)

Loads a value from the specified global memory address.

Parameters

  • ptr (in): source memory location to load from

Returns

  • The value loaded from ptr

__ldca

longlong2 __ldca(const longlong2 *ptr)

Loads a value from the specified global memory address.

Parameters

  • ptr (in): source memory location to load from

Returns

  • The value loaded from ptr

__ldca

unsigned char __ldca(const unsigned char *ptr)

Loads a value from the specified global memory address.

Parameters

  • ptr (in): source memory location to load from

Returns

  • The value loaded from ptr

__ldca

unsigned short __ldca(const unsigned short *ptr)

Loads a value from the specified global memory address.

Parameters

  • ptr (in): source memory location to load from

Returns

  • The value loaded from ptr

__ldca

unsigned int __ldca(const unsigned int *ptr)

Loads a value from the specified global memory address.

Parameters

  • ptr (in): source memory location to load from

Returns

  • The value loaded from ptr

__ldca

unsigned long long __ldca(const unsigned long long *ptr)

Loads a value from the specified global memory address.

Parameters

  • ptr (in): source memory location to load from

Returns

  • The value loaded from ptr

__ldca

uchar2 __ldca(const uchar2 *ptr)

Loads a value from the specified global memory address.

Parameters

  • ptr (in): source memory location to load from

Returns

  • The value loaded from ptr

__ldca

uchar4 __ldca(const uchar4 *ptr)

Loads a value from the specified global memory address.

Parameters

  • ptr (in): source memory location to load from

Returns

  • The value loaded from ptr

__ldca

ushort2 __ldca(const ushort2 *ptr)

Loads a value from the specified global memory address.

Parameters

  • ptr (in): source memory location to load from

Returns

  • The value loaded from ptr

__ldca

ushort4 __ldca(const ushort4 *ptr)

Loads a value from the specified global memory address.

Parameters

  • ptr (in): source memory location to load from

Returns

  • The value loaded from ptr

__ldca

uint2 __ldca(const uint2 *ptr)

Loads a value from the specified global memory address.

Parameters

  • ptr (in): source memory location to load from

Returns

  • The value loaded from ptr

__ldca

uint4 __ldca(const uint4 *ptr)

Loads a value from the specified global memory address.

Parameters

  • ptr (in): source memory location to load from

Returns

  • The value loaded from ptr

__ldca

ulonglong2 __ldca(const ulonglong2 *ptr)

Loads a value from the specified global memory address.

Parameters

  • ptr (in): source memory location to load from

Returns

  • The value loaded from ptr

__ldca

float __ldca(const float *ptr)

Loads a value from the specified global memory address.

Parameters

  • ptr (in): source memory location to load from

Returns

  • The value loaded from ptr

__ldca

double __ldca(const double *ptr)

Loads a value from the specified global memory address.

Parameters

  • ptr (in): source memory location to load from

Returns

  • The value loaded from ptr

__ldca

float2 __ldca(const float2 *ptr)

Loads a value from the specified global memory address.

Parameters

  • ptr (in): source memory location to load from

Returns

  • The value loaded from ptr

__ldca

float4 __ldca(const float4 *ptr)

Loads a value from the specified global memory address.

Parameters

  • ptr (in): source memory location to load from

Returns

  • The value loaded from ptr

__ldca

double2 __ldca(const double2 *ptr)

Loads a value from the specified global memory address.

Parameters

  • ptr (in): source memory location to load from

Returns

  • The value loaded from ptr

__ldcg

long __ldcg(const long *ptr)

Loads a value from the specified global memory address.

Parameters

  • ptr (in): source memory location to load from

Returns

  • The value loaded from ptr

__ldcg

unsigned long __ldcg(const unsigned long *ptr)

Loads a value from the specified global memory address.

Parameters

  • ptr (in): source memory location to load from

Returns

  • The value loaded from ptr

__ldcg

char __ldcg(const char *ptr)

Loads a value from the specified global memory address.

Parameters

  • ptr (in): source memory location to load from

Returns

  • The value loaded from ptr

__ldcg

signed char __ldcg(const signed char *ptr)

Loads a value from the specified global memory address.

Parameters

  • ptr (in): source memory location to load from

Returns

  • The value loaded from ptr

__ldcg

short __ldcg(const short *ptr)

Loads a value from the specified global memory address.

Parameters

  • ptr (in): source memory location to load from

Returns

  • The value loaded from ptr

__ldcg

int __ldcg(const int *ptr)

Loads a value from the specified global memory address.

Parameters

  • ptr (in): source memory location to load from

Returns

  • The value loaded from ptr

__ldcg

long long __ldcg(const long long *ptr)

Loads a value from the specified global memory address.

Parameters

  • ptr (in): source memory location to load from

Returns

  • The value loaded from ptr

__ldcg

char2 __ldcg(const char2 *ptr)

Loads a value from the specified global memory address.

Parameters

  • ptr (in): source memory location to load from

Returns

  • The value loaded from ptr

__ldcg

char4 __ldcg(const char4 *ptr)

Loads a value from the specified global memory address.

Parameters

  • ptr (in): source memory location to load from

Returns

  • The value loaded from ptr

__ldcg

short2 __ldcg(const short2 *ptr)

Loads a value from the specified global memory address.

Parameters

  • ptr (in): source memory location to load from

Returns

  • The value loaded from ptr

__ldcg

short4 __ldcg(const short4 *ptr)

Loads a value from the specified global memory address.

Parameters

  • ptr (in): source memory location to load from

Returns

  • The value loaded from ptr

__ldcg

int2 __ldcg(const int2 *ptr)

Loads a value from the specified global memory address.

Parameters

  • ptr (in): source memory location to load from

Returns

  • The value loaded from ptr

__ldcg

int4 __ldcg(const int4 *ptr)

Loads a value from the specified global memory address.

Parameters

  • ptr (in): source memory location to load from

Returns

  • The value loaded from ptr

__ldcg

longlong2 __ldcg(const longlong2 *ptr)

Loads a value from the specified global memory address.

Parameters

  • ptr (in): source memory location to load from

Returns

  • The value loaded from ptr

__ldcg

unsigned char __ldcg(const unsigned char *ptr)

Loads a value from the specified global memory address.

Parameters

  • ptr (in): source memory location to load from

Returns

  • The value loaded from ptr

__ldcg

unsigned short __ldcg(const unsigned short *ptr)

Loads a value from the specified global memory address.

Parameters

  • ptr (in): source memory location to load from

Returns

  • The value loaded from ptr

__ldcg

unsigned int __ldcg(const unsigned int *ptr)

Loads a value from the specified global memory address.

Parameters

  • ptr (in): source memory location to load from

Returns

  • The value loaded from ptr

__ldcg

unsigned long long __ldcg(const unsigned long long *ptr)

Loads a value from the specified global memory address.

Parameters

  • ptr (in): source memory location to load from

Returns

  • The value loaded from ptr

__ldcg

uchar2 __ldcg(const uchar2 *ptr)

Loads a value from the specified global memory address.

Parameters

  • ptr (in): source memory location to load from

Returns

  • The value loaded from ptr

__ldcg

uchar4 __ldcg(const uchar4 *ptr)

Loads a value from the specified global memory address.

Parameters

  • ptr (in): source memory location to load from

Returns

  • The value loaded from ptr

__ldcg

ushort2 __ldcg(const ushort2 *ptr)

Loads a value from the specified global memory address.

Parameters

  • ptr (in): source memory location to load from

Returns

  • The value loaded from ptr

__ldcg

ushort4 __ldcg(const ushort4 *ptr)

Loads a value from the specified global memory address.

Parameters

  • ptr (in): source memory location to load from

Returns

  • The value loaded from ptr

__ldcg

uint2 __ldcg(const uint2 *ptr)

Loads a value from the specified global memory address.

Parameters

  • ptr (in): source memory location to load from

Returns

  • The value loaded from ptr

__ldcg

uint4 __ldcg(const uint4 *ptr)

Loads a value from the specified global memory address.

Parameters

  • ptr (in): source memory location to load from

Returns

  • The value loaded from ptr

__ldcg

ulonglong2 __ldcg(const ulonglong2 *ptr)

Loads a value from the specified global memory address.

Parameters

  • ptr (in): source memory location to load from

Returns

  • The value loaded from ptr

__ldcg

float __ldcg(const float *ptr)

Loads a value from the specified global memory address.

Parameters

  • ptr (in): source memory location to load from

Returns

  • The value loaded from ptr

__ldcg

double __ldcg(const double *ptr)

Loads a value from the specified global memory address.

Parameters

  • ptr (in): source memory location to load from

Returns

  • The value loaded from ptr

__ldcg

float2 __ldcg(const float2 *ptr)

Loads a value from the specified global memory address.

Parameters

  • ptr (in): source memory location to load from

Returns

  • The value loaded from ptr

__ldcg

float4 __ldcg(const float4 *ptr)

Loads a value from the specified global memory address.

Parameters

  • ptr (in): source memory location to load from

Returns

  • The value loaded from ptr

__ldcg

double2 __ldcg(const double2 *ptr)

Loads a value from the specified global memory address.

Parameters

  • ptr (in): source memory location to load from

Returns

  • The value loaded from ptr

__ldcs

long __ldcs(const long *ptr)

Loads a value from the specified global memory address.

Parameters

  • ptr (in): source memory location to load from

Returns

  • The value loaded from ptr

__ldcs

unsigned long __ldcs(const unsigned long *ptr)

Loads a value from the specified global memory address.

Parameters

  • ptr (in): source memory location to load from

Returns

  • The value loaded from ptr

__ldcs

char __ldcs(const char *ptr)

Loads a value from the specified global memory address.

Parameters

  • ptr (in): source memory location to load from

Returns

  • The value loaded from ptr

__ldcs

signed char __ldcs(const signed char *ptr)

Loads a value from the specified global memory address.

Parameters

  • ptr (in): source memory location to load from

Returns

  • The value loaded from ptr

__ldcs

short __ldcs(const short *ptr)

Loads a value from the specified global memory address.

Parameters

  • ptr (in): source memory location to load from

Returns

  • The value loaded from ptr

__ldcs

int __ldcs(const int *ptr)

Loads a value from the specified global memory address.

Parameters

  • ptr (in): source memory location to load from

Returns

  • The value loaded from ptr

__ldcs

long long __ldcs(const long long *ptr)

Loads a value from the specified global memory address.

Parameters

  • ptr (in): source memory location to load from

Returns

  • The value loaded from ptr

__ldcs

char2 __ldcs(const char2 *ptr)

Loads a value from the specified global memory address.

Parameters

  • ptr (in): source memory location to load from

Returns

  • The value loaded from ptr

__ldcs

char4 __ldcs(const char4 *ptr)

Loads a value from the specified global memory address.

Parameters

  • ptr (in): source memory location to load from

Returns

  • The value loaded from ptr

__ldcs

short2 __ldcs(const short2 *ptr)

Loads a value from the specified global memory address.

Parameters

  • ptr (in): source memory location to load from

Returns

  • The value loaded from ptr

__ldcs

short4 __ldcs(const short4 *ptr)

Loads a value from the specified global memory address.

Parameters

  • ptr (in): source memory location to load from

Returns

  • The value loaded from ptr

__ldcs

int2 __ldcs(const int2 *ptr)

Loads a value from the specified global memory address.

Parameters

  • ptr (in): source memory location to load from

Returns

  • The value loaded from ptr

__ldcs

int4 __ldcs(const int4 *ptr)

Loads a value from the specified global memory address.

Parameters

  • ptr (in): source memory location to load from

Returns

  • The value loaded from ptr

__ldcs

longlong2 __ldcs(const longlong2 *ptr)

Loads a value from the specified global memory address.

Parameters

  • ptr (in): source memory location to load from

Returns

  • The value loaded from ptr

__ldcs

unsigned char __ldcs(const unsigned char *ptr)

Loads a value from the specified global memory address.

Parameters

  • ptr (in): source memory location to load from

Returns

  • The value loaded from ptr

__ldcs

unsigned short __ldcs(const unsigned short *ptr)

Loads a value from the specified global memory address.

Parameters

  • ptr (in): source memory location to load from

Returns

  • The value loaded from ptr

__ldcs

unsigned int __ldcs(const unsigned int *ptr)

Loads a value from the specified global memory address.

Parameters

  • ptr (in): source memory location to load from

Returns

  • The value loaded from ptr

__ldcs

unsigned long long __ldcs(const unsigned long long *ptr)

Loads a value from the specified global memory address.

Parameters

  • ptr (in): source memory location to load from

Returns

  • The value loaded from ptr

__ldcs

uchar2 __ldcs(const uchar2 *ptr)

Loads a value from the specified global memory address.

Parameters

  • ptr (in): source memory location to load from

Returns

  • The value loaded from ptr

__ldcs

uchar4 __ldcs(const uchar4 *ptr)

Loads a value from the specified global memory address.

Parameters

  • ptr (in): source memory location to load from

Returns

  • The value loaded from ptr

__ldcs

ushort2 __ldcs(const ushort2 *ptr)

Loads a value from the specified global memory address.

Parameters

  • ptr (in): source memory location to load from

Returns

  • The value loaded from ptr

__ldcs

ushort4 __ldcs(const ushort4 *ptr)

Loads a value from the specified global memory address.

Parameters

  • ptr (in): source memory location to load from

Returns

  • The value loaded from ptr

__ldcs

uint2 __ldcs(const uint2 *ptr)

Loads a value from the specified global memory address.

Parameters

  • ptr (in): source memory location to load from

Returns

  • The value loaded from ptr

__ldcs

uint4 __ldcs(const uint4 *ptr)

Loads a value from the specified global memory address.

Parameters

  • ptr (in): source memory location to load from

Returns

  • The value loaded from ptr

__ldcs

ulonglong2 __ldcs(const ulonglong2 *ptr)

Loads a value from the specified global memory address.

Parameters

  • ptr (in): source memory location to load from

Returns

  • The value loaded from ptr

__ldcs

float __ldcs(const float *ptr)

Loads a value from the specified global memory address.

Parameters

  • ptr (in): source memory location to load from

Returns

  • The value loaded from ptr

__ldcs

double __ldcs(const double *ptr)

Loads a value from the specified global memory address.

Parameters

  • ptr (in): source memory location to load from

Returns

  • The value loaded from ptr

__ldcs

float2 __ldcs(const float2 *ptr)

Loads a value from the specified global memory address.

Parameters

  • ptr (in): source memory location to load from

Returns

  • The value loaded from ptr

__ldcs

float4 __ldcs(const float4 *ptr)

Loads a value from the specified global memory address.

Parameters

  • ptr (in): source memory location to load from

Returns

  • The value loaded from ptr

__ldcs

double2 __ldcs(const double2 *ptr)

Loads a value from the specified global memory address.

Parameters

  • ptr (in): source memory location to load from

Returns

  • The value loaded from ptr

__ldcv

long __ldcv(const long *ptr)

Loads a value from the specified global memory address.

Parameters

  • ptr (in): source memory location to load from

Returns

  • The value loaded from ptr

__ldcv

unsigned long __ldcv(const unsigned long *ptr)

Loads a value from the specified global memory address.

Parameters

  • ptr (in): source memory location to load from

Returns

  • The value loaded from ptr

__ldcv

char __ldcv(const char *ptr)

Loads a value from the specified global memory address.

Parameters

  • ptr (in): source memory location to load from

Returns

  • The value loaded from ptr

__ldcv

signed char __ldcv(const signed char *ptr)

Loads a value from the specified global memory address.

Parameters

  • ptr (in): source memory location to load from

Returns

  • The value loaded from ptr

__ldcv

short __ldcv(const short *ptr)

Loads a value from the specified global memory address.

Parameters

  • ptr (in): source memory location to load from

Returns

  • The value loaded from ptr

__ldcv

int __ldcv(const int *ptr)

Loads a value from the specified global memory address.

Parameters

  • ptr (in): source memory location to load from

Returns

  • The value loaded from ptr

__ldcv

long long __ldcv(const long long *ptr)

Loads a value from the specified global memory address.

Parameters

  • ptr (in): source memory location to load from

Returns

  • The value loaded from ptr

__ldcv

char2 __ldcv(const char2 *ptr)

Loads a value from the specified global memory address.

Parameters

  • ptr (in): source memory location to load from

Returns

  • The value loaded from ptr

__ldcv

char4 __ldcv(const char4 *ptr)

Loads a value from the specified global memory address.

Parameters

  • ptr (in): source memory location to load from

Returns

  • The value loaded from ptr

__ldcv

short2 __ldcv(const short2 *ptr)

Loads a value from the specified global memory address.

Parameters

  • ptr (in): source memory location to load from

Returns

  • The value loaded from ptr

__ldcv

short4 __ldcv(const short4 *ptr)

Loads a value from the specified global memory address.

Parameters

  • ptr (in): source memory location to load from

Returns

  • The value loaded from ptr

__ldcv

int2 __ldcv(const int2 *ptr)

Loads a value from the specified global memory address.

Parameters

  • ptr (in): source memory location to load from

Returns

  • The value loaded from ptr

__ldcv

int4 __ldcv(const int4 *ptr)

Loads a value from the specified global memory address.

Parameters

  • ptr (in): source memory location to load from

Returns

  • The value loaded from ptr

__ldcv

longlong2 __ldcv(const longlong2 *ptr)

Loads a value from the specified global memory address.

Parameters

  • ptr (in): source memory location to load from

Returns

  • The value loaded from ptr

__ldcv

unsigned char __ldcv(const unsigned char *ptr)

Loads a value from the specified global memory address.

Parameters

  • ptr (in): source memory location to load from

Returns

  • The value loaded from ptr

__ldcv

unsigned short __ldcv(const unsigned short *ptr)

Loads a value from the specified global memory address.

Parameters

  • ptr (in): source memory location to load from

Returns

  • The value loaded from ptr

__ldcv

unsigned int __ldcv(const unsigned int *ptr)

Loads a value from the specified global memory address.

Parameters

  • ptr (in): source memory location to load from

Returns

  • The value loaded from ptr

__ldcv

unsigned long long __ldcv(const unsigned long long *ptr)

Loads a value from the specified global memory address.

Parameters

  • ptr (in): source memory location to load from

Returns

  • The value loaded from ptr

__ldcv

uchar2 __ldcv(const uchar2 *ptr)

Loads a value from the specified global memory address.

Parameters

  • ptr (in): source memory location to load from

Returns

  • The value loaded from ptr

__ldcv

uchar4 __ldcv(const uchar4 *ptr)

Loads a value from the specified global memory address.

Parameters

  • ptr (in): source memory location to load from

Returns

  • The value loaded from ptr

__ldcv

ushort2 __ldcv(const ushort2 *ptr)

Loads a value from the specified global memory address.

Parameters

  • ptr (in): source memory location to load from

Returns

  • The value loaded from ptr

__ldcv

ushort4 __ldcv(const ushort4 *ptr)

Loads a value from the specified global memory address.

Parameters

  • ptr (in): source memory location to load from

Returns

  • The value loaded from ptr

__ldcv

uint2 __ldcv(const uint2 *ptr)

Loads a value from the specified global memory address.

Parameters

  • ptr (in): source memory location to load from

Returns

  • The value loaded from ptr

__ldcv

uint4 __ldcv(const uint4 *ptr)

Loads a value from the specified global memory address.

Parameters

  • ptr (in): source memory location to load from

Returns

  • The value loaded from ptr

__ldcv

ulonglong2 __ldcv(const ulonglong2 *ptr)

Loads a value from the specified global memory address.

Parameters

  • ptr (in): source memory location to load from

Returns

  • The value loaded from ptr

__ldcv

float __ldcv(const float *ptr)

Loads a value from the specified global memory address.

Parameters

  • ptr (in): source memory location to load from

Returns

  • The value loaded from ptr

__ldcv

double __ldcv(const double *ptr)

Loads a value from the specified global memory address.

Parameters

  • ptr (in): source memory location to load from

Returns

  • The value loaded from ptr

__ldcv

float2 __ldcv(const float2 *ptr)

Loads a value from the specified global memory address.

Parameters

  • ptr (in): source memory location to load from

Returns

  • The value loaded from ptr

__ldcv

float4 __ldcv(const float4 *ptr)

Loads a value from the specified global memory address.

Parameters

  • ptr (in): source memory location to load from

Returns

  • The value loaded from ptr

__ldcv

double2 __ldcv(const double2 *ptr)

Loads a value from the specified global memory address.

Parameters

  • ptr (in): source memory location to load from

Returns

  • The value loaded from ptr

__ldg

long __ldg(const long *ptr)

Loads a value from the specified global memory address.

__ldg

unsigned long __ldg(const unsigned long *ptr)

Loads a value from the specified global memory address.

__ldg

char __ldg(const char *ptr)

Loads a value from the specified global memory address.

__ldg

signed char __ldg(const signed char *ptr)

Loads a value from the specified global memory address.

__ldg

short __ldg(const short *ptr)

Loads a value from the specified global memory address.

__ldg

int __ldg(const int *ptr)

Loads a value from the specified global memory address.

__ldg

long long __ldg(const long long *ptr)

Loads a value from the specified global memory address.

__ldg

char2 __ldg(const char2 *ptr)

Loads a value from the specified global memory address.

__ldg

char4 __ldg(const char4 *ptr)

Loads a value from the specified global memory address.

__ldg

short2 __ldg(const short2 *ptr)

Loads a value from the specified global memory address.

__ldg

short4 __ldg(const short4 *ptr)

Loads a value from the specified global memory address.

__ldg

int2 __ldg(const int2 *ptr)

Loads a value from the specified global memory address.

__ldg

int4 __ldg(const int4 *ptr)

Loads a value from the specified global memory address.

__ldg

longlong2 __ldg(const longlong2 *ptr)

Loads a value from the specified global memory address.

__ldg

unsigned char __ldg(const unsigned char *ptr)

Loads a value from the specified global memory address.

__ldg

unsigned short __ldg(const unsigned short *ptr)

Loads a value from the specified global memory address.

__ldg

unsigned int __ldg(const unsigned int *ptr)

Loads a value from the specified global memory address.

__ldg

unsigned long long __ldg(const unsigned long long *ptr)

Loads a value from the specified global memory address.

__ldg

uchar2 __ldg(const uchar2 *ptr)

Loads a value from the specified global memory address.

__ldg

uchar4 __ldg(const uchar4 *ptr)

Loads a value from the specified global memory address.

__ldg

ushort2 __ldg(const ushort2 *ptr)

Loads a value from the specified global memory address.

__ldg

ushort4 __ldg(const ushort4 *ptr)

Loads a value from the specified global memory address.

__ldg

uint2 __ldg(const uint2 *ptr)

Loads a value from the specified global memory address.

__ldg

uint4 __ldg(const uint4 *ptr)

Loads a value from the specified global memory address.

__ldg

ulonglong2 __ldg(const ulonglong2 *ptr)

Loads a value from the specified global memory address.

__ldg

float __ldg(const float *ptr)

Loads a value from the specified global memory address.

__ldg

double __ldg(const double *ptr)

Loads a value from the specified global memory address.

__ldg

float2 __ldg(const float2 *ptr)

Loads a value from the specified global memory address.

__ldg

float4 __ldg(const float4 *ptr)

Loads a value from the specified global memory address.

__ldg

double2 __ldg(const double2 *ptr)

Loads a value from the specified global memory address.

Half Precision Conversion and Data Movement 73

__stcg

void __stcg(long *ptr, long value)

Stores a value to the specified global memory address.

Parameters

  • ptr (out): destination memory location for the store
  • value (in): value to write to ptr

__stcg

void __stcg(unsigned long *ptr, unsigned long value)

Stores a value to the specified global memory address.

Parameters

  • ptr (out): destination memory location for the store
  • value (in): value to write to ptr

__stcg

void __stcg(char *ptr, char value)

Stores a value to the specified global memory address.

Parameters

  • ptr (out): destination memory location for the store
  • value (in): value to write to ptr

__stcg

void __stcg(signed char *ptr, signed char value)

Stores a value to the specified global memory address.

Parameters

  • ptr (out): destination memory location for the store
  • value (in): value to write to ptr

__stcg

void __stcg(short *ptr, short value)

Stores a value to the specified global memory address.

Parameters

  • ptr (out): destination memory location for the store
  • value (in): value to write to ptr

__stcg

void __stcg(int *ptr, int value)

Stores a value to the specified global memory address.

Parameters

  • ptr (out): destination memory location for the store
  • value (in): value to write to ptr

__stcg

void __stcg(long long *ptr, long long value)

Stores a value to the specified global memory address.

Parameters

  • ptr (out): destination memory location for the store
  • value (in): value to write to ptr

__stcg

void __stcg(char2 *ptr, char2 value)

Stores a value to the specified global memory address.

Parameters

  • ptr (out): destination memory location for the store
  • value (in): value to write to ptr

__stcg

void __stcg(char4 *ptr, char4 value)

Stores a value to the specified global memory address.

Parameters

  • ptr (out): destination memory location for the store
  • value (in): value to write to ptr

__stcg

void __stcg(short2 *ptr, short2 value)

Stores a value to the specified global memory address.

Parameters

  • ptr (out): destination memory location for the store
  • value (in): value to write to ptr

__stcg

void __stcg(short4 *ptr, short4 value)

Stores a value to the specified global memory address.

Parameters

  • ptr (out): destination memory location for the store
  • value (in): value to write to ptr

__stcg

void __stcg(int2 *ptr, int2 value)

Stores a value to the specified global memory address.

Parameters

  • ptr (out): destination memory location for the store
  • value (in): value to write to ptr

__stcg

void __stcg(int4 *ptr, int4 value)

Stores a value to the specified global memory address.

Parameters

  • ptr (out): destination memory location for the store
  • value (in): value to write to ptr

__stcg

void __stcg(longlong2 *ptr, longlong2 value)

Stores a value to the specified global memory address.

Parameters

  • ptr (out): destination memory location for the store
  • value (in): value to write to ptr

__stcg

void __stcg(unsigned char *ptr, unsigned char value)

Stores a value to the specified global memory address.

Parameters

  • ptr (out): destination memory location for the store
  • value (in): value to write to ptr

__stcg

void __stcg(unsigned short *ptr, unsigned short value)

Stores a value to the specified global memory address.

Parameters

  • ptr (out): destination memory location for the store
  • value (in): value to write to ptr

__stcg

void __stcg(unsigned int *ptr, unsigned int value)

Stores a value to the specified global memory address.

Parameters

  • ptr (out): destination memory location for the store
  • value (in): value to write to ptr

__stcg

void __stcg(unsigned long long *ptr, unsigned long long value)

Stores a value to the specified global memory address.

Parameters

  • ptr (out): destination memory location for the store
  • value (in): value to write to ptr

__stcg

void __stcg(uchar2 *ptr, uchar2 value)

Stores a value to the specified global memory address.

Parameters

  • ptr (out): destination memory location for the store
  • value (in): value to write to ptr

__stcg

void __stcg(uchar4 *ptr, uchar4 value)

Stores a value to the specified global memory address.

Parameters

  • ptr (out): destination memory location for the store
  • value (in): value to write to ptr

__stcg

void __stcg(ushort2 *ptr, ushort2 value)

Stores a value to the specified global memory address.

Parameters

  • ptr (out): destination memory location for the store
  • value (in): value to write to ptr

__stcg

void __stcg(ushort4 *ptr, ushort4 value)

Stores a value to the specified global memory address.

Parameters

  • ptr (out): destination memory location for the store
  • value (in): value to write to ptr

__stcg

void __stcg(uint2 *ptr, uint2 value)

Stores a value to the specified global memory address.

Parameters

  • ptr (out): destination memory location for the store
  • value (in): value to write to ptr

__stcg

void __stcg(uint4 *ptr, uint4 value)

Stores a value to the specified global memory address.

Parameters

  • ptr (out): destination memory location for the store
  • value (in): value to write to ptr

__stcg

void __stcg(ulonglong2 *ptr, ulonglong2 value)

Stores a value to the specified global memory address.

Parameters

  • ptr (out): destination memory location for the store
  • value (in): value to write to ptr

__stcg

void __stcg(float *ptr, float value)

Stores a value to the specified global memory address.

Parameters

  • ptr (out): destination memory location for the store
  • value (in): value to write to ptr

__stcg

void __stcg(double *ptr, double value)

Stores a value to the specified global memory address.

Parameters

  • ptr (out): destination memory location for the store
  • value (in): value to write to ptr

__stcg

void __stcg(float2 *ptr, float2 value)

Stores a value to the specified global memory address.

Parameters

  • ptr (out): destination memory location for the store
  • value (in): value to write to ptr

__stcg

void __stcg(float4 *ptr, float4 value)

Stores a value to the specified global memory address.

Parameters

  • ptr (out): destination memory location for the store
  • value (in): value to write to ptr

__stcg

void __stcg(double2 *ptr, double2 value)

Stores a value to the specified global memory address.

Parameters

  • ptr (out): destination memory location for the store
  • value (in): value to write to ptr

__stcs

void __stcs(long *ptr, long value)

Stores a value to the specified global memory address.

Parameters

  • ptr (out): destination memory location for the store
  • value (in): value to write to ptr

__stcs

void __stcs(unsigned long *ptr, unsigned long value)

Stores a value to the specified global memory address.

Parameters

  • ptr (out): destination memory location for the store
  • value (in): value to write to ptr

__stcs

void __stcs(char *ptr, char value)

Stores a value to the specified global memory address.

Parameters

  • ptr (out): destination memory location for the store
  • value (in): value to write to ptr

__stcs

void __stcs(signed char *ptr, signed char value)

Stores a value to the specified global memory address.

Parameters

  • ptr (out): destination memory location for the store
  • value (in): value to write to ptr

__stcs

void __stcs(short *ptr, short value)

Stores a value to the specified global memory address.

Parameters

  • ptr (out): destination memory location for the store
  • value (in): value to write to ptr

__stcs

void __stcs(int *ptr, int value)

Stores a value to the specified global memory address.

Parameters

  • ptr (out): destination memory location for the store
  • value (in): value to write to ptr

__stcs

void __stcs(long long *ptr, long long value)

Stores a value to the specified global memory address.

Parameters

  • ptr (out): destination memory location for the store
  • value (in): value to write to ptr

__stcs

void __stcs(char2 *ptr, char2 value)

Stores a value to the specified global memory address.

Parameters

  • ptr (out): destination memory location for the store
  • value (in): value to write to ptr

__stcs

void __stcs(char4 *ptr, char4 value)

Stores a value to the specified global memory address.

Parameters

  • ptr (out): destination memory location for the store
  • value (in): value to write to ptr

__stcs

void __stcs(short2 *ptr, short2 value)

Stores a value to the specified global memory address.

Parameters

  • ptr (out): destination memory location for the store
  • value (in): value to write to ptr

__stcs

void __stcs(short4 *ptr, short4 value)

Stores a value to the specified global memory address.

Parameters

  • ptr (out): destination memory location for the store
  • value (in): value to write to ptr

__stcs

void __stcs(int2 *ptr, int2 value)

Stores a value to the specified global memory address.

Parameters

  • ptr (out): destination memory location for the store
  • value (in): value to write to ptr

__stcs

void __stcs(int4 *ptr, int4 value)

Stores a value to the specified global memory address.

Parameters

  • ptr (out): destination memory location for the store
  • value (in): value to write to ptr

__stcs

void __stcs(longlong2 *ptr, longlong2 value)

Stores a value to the specified global memory address.

Parameters

  • ptr (out): destination memory location for the store
  • value (in): value to write to ptr

__stcs

void __stcs(unsigned char *ptr, unsigned char value)

Stores a value to the specified global memory address.

Parameters

  • ptr (out): destination memory location for the store
  • value (in): value to write to ptr

__stcs

void __stcs(unsigned short *ptr, unsigned short value)

Stores a value to the specified global memory address.

Parameters

  • ptr (out): destination memory location for the store
  • value (in): value to write to ptr

__stcs

void __stcs(unsigned int *ptr, unsigned int value)

Stores a value to the specified global memory address.

Parameters

  • ptr (out): destination memory location for the store
  • value (in): value to write to ptr

__stcs

void __stcs(unsigned long long *ptr, unsigned long long value)

Stores a value to the specified global memory address.

Parameters

  • ptr (out): destination memory location for the store
  • value (in): value to write to ptr

__stcs

void __stcs(uchar2 *ptr, uchar2 value)

Stores a value to the specified global memory address.

Parameters

  • ptr (out): destination memory location for the store
  • value (in): value to write to ptr

__stcs

void __stcs(uchar4 *ptr, uchar4 value)

Stores a value to the specified global memory address.

Parameters

  • ptr (out): destination memory location for the store
  • value (in): value to write to ptr

__stcs

void __stcs(ushort2 *ptr, ushort2 value)

Stores a value to the specified global memory address.

Parameters

  • ptr (out): destination memory location for the store
  • value (in): value to write to ptr

__stcs

void __stcs(ushort4 *ptr, ushort4 value)

Stores a value to the specified global memory address.

Parameters

  • ptr (out): destination memory location for the store
  • value (in): value to write to ptr

__stcs

void __stcs(uint2 *ptr, uint2 value)

Stores a value to the specified global memory address.

Parameters

  • ptr (out): destination memory location for the store
  • value (in): value to write to ptr

__stcs

void __stcs(uint4 *ptr, uint4 value)

Stores a value to the specified global memory address.

Parameters

  • ptr (out): destination memory location for the store
  • value (in): value to write to ptr

__stcs

void __stcs(ulonglong2 *ptr, ulonglong2 value)

Stores a value to the specified global memory address.

Parameters

  • ptr (out): destination memory location for the store
  • value (in): value to write to ptr

__stcs

void __stcs(float *ptr, float value)

Stores a value to the specified global memory address.

Parameters

  • ptr (out): destination memory location for the store
  • value (in): value to write to ptr

__stcs

void __stcs(double *ptr, double value)

Stores a value to the specified global memory address.

Parameters

  • ptr (out): destination memory location for the store
  • value (in): value to write to ptr

__stcs

void __stcs(float2 *ptr, float2 value)

Stores a value to the specified global memory address.

Parameters

  • ptr (out): destination memory location for the store
  • value (in): value to write to ptr

__stcs

void __stcs(float4 *ptr, float4 value)

Stores a value to the specified global memory address.

Parameters

  • ptr (out): destination memory location for the store
  • value (in): value to write to ptr

__stcs

void __stcs(double2 *ptr, double2 value)

Stores a value to the specified global memory address.

Parameters

  • ptr (out): destination memory location for the store
  • value (in): value to write to ptr

__stwb

void __stwb(long *ptr, long value)

Stores a value to the specified global memory address.

Parameters

  • ptr (out): destination memory location for the store
  • value (in): value to write to ptr

__stwb

void __stwb(unsigned long *ptr, unsigned long value)

Stores a value to the specified global memory address.

Parameters

  • ptr (out): destination memory location for the store
  • value (in): value to write to ptr

__stwb

void __stwb(char *ptr, char value)

Stores a value to the specified global memory address.

Parameters

  • ptr (out): destination memory location for the store
  • value (in): value to write to ptr

__stwb

void __stwb(signed char *ptr, signed char value)

Stores a value to the specified global memory address.

Parameters

  • ptr (out): destination memory location for the store
  • value (in): value to write to ptr

__stwb

void __stwb(short *ptr, short value)

Stores a value to the specified global memory address.

Parameters

  • ptr (out): destination memory location for the store
  • value (in): value to write to ptr

__stwb

void __stwb(int *ptr, int value)

Stores a value to the specified global memory address.

Parameters

  • ptr (out): destination memory location for the store
  • value (in): value to write to ptr

__stwb

void __stwb(long long *ptr, long long value)

Stores a value to the specified global memory address.

Parameters

  • ptr (out): destination memory location for the store
  • value (in): value to write to ptr

__stwb

void __stwb(char2 *ptr, char2 value)

Stores a value to the specified global memory address.

Parameters

  • ptr (out): destination memory location for the store
  • value (in): value to write to ptr

__stwb

void __stwb(char4 *ptr, char4 value)

Stores a value to the specified global memory address.

Parameters

  • ptr (out): destination memory location for the store
  • value (in): value to write to ptr

__stwb

void __stwb(short2 *ptr, short2 value)

Stores a value to the specified global memory address.

Parameters

  • ptr (out): destination memory location for the store
  • value (in): value to write to ptr

__stwb

void __stwb(short4 *ptr, short4 value)

Stores a value to the specified global memory address.

Parameters

  • ptr (out): destination memory location for the store
  • value (in): value to write to ptr

__stwb

void __stwb(int2 *ptr, int2 value)

Stores a value to the specified global memory address.

Parameters

  • ptr (out): destination memory location for the store
  • value (in): value to write to ptr

__stwb

void __stwb(int4 *ptr, int4 value)

Stores a value to the specified global memory address.

Parameters

  • ptr (out): destination memory location for the store
  • value (in): value to write to ptr

__stwb

void __stwb(longlong2 *ptr, longlong2 value)

Stores a value to the specified global memory address.

Parameters

  • ptr (out): destination memory location for the store
  • value (in): value to write to ptr

__stwb

void __stwb(unsigned char *ptr, unsigned char value)

Stores a value to the specified global memory address.

Parameters

  • ptr (out): destination memory location for the store
  • value (in): value to write to ptr

__stwb

void __stwb(unsigned short *ptr, unsigned short value)

Stores a value to the specified global memory address.

Parameters

  • ptr (out): destination memory location for the store
  • value (in): value to write to ptr

__stwb

void __stwb(unsigned int *ptr, unsigned int value)

Stores a value to the specified global memory address.

Parameters

  • ptr (out): destination memory location for the store
  • value (in): value to write to ptr

__stwb

void __stwb(unsigned long long *ptr, unsigned long long value)

Stores a value to the specified global memory address.

Parameters

  • ptr (out): destination memory location for the store
  • value (in): value to write to ptr

__stwb

void __stwb(uchar2 *ptr, uchar2 value)

Stores a value to the specified global memory address.

Parameters

  • ptr (out): destination memory location for the store
  • value (in): value to write to ptr

__stwb

void __stwb(uchar4 *ptr, uchar4 value)

Stores a value to the specified global memory address.

Parameters

  • ptr (out): destination memory location for the store
  • value (in): value to write to ptr

__stwb

void __stwb(ushort2 *ptr, ushort2 value)

Stores a value to the specified global memory address.

Parameters

  • ptr (out): destination memory location for the store
  • value (in): value to write to ptr

__stwb

void __stwb(ushort4 *ptr, ushort4 value)

Stores a value to the specified global memory address.

Parameters

  • ptr (out): destination memory location for the store
  • value (in): value to write to ptr

__stwb

void __stwb(uint2 *ptr, uint2 value)

Stores a value to the specified global memory address.

Parameters

  • ptr (out): destination memory location for the store
  • value (in): value to write to ptr

__stwb

void __stwb(uint4 *ptr, uint4 value)

Stores a value to the specified global memory address.

Parameters

  • ptr (out): destination memory location for the store
  • value (in): value to write to ptr

__stwb

void __stwb(ulonglong2 *ptr, ulonglong2 value)

Stores a value to the specified global memory address.

Parameters

  • ptr (out): destination memory location for the store
  • value (in): value to write to ptr

__stwb

void __stwb(float *ptr, float value)

Stores a value to the specified global memory address.

Parameters

  • ptr (out): destination memory location for the store
  • value (in): value to write to ptr

__stwb

void __stwb(double *ptr, double value)

Stores a value to the specified global memory address.

Parameters

  • ptr (out): destination memory location for the store
  • value (in): value to write to ptr

__stwb

void __stwb(float2 *ptr, float2 value)

Stores a value to the specified global memory address.

Parameters

  • ptr (out): destination memory location for the store
  • value (in): value to write to ptr

__stwb

void __stwb(float4 *ptr, float4 value)

Stores a value to the specified global memory address.

Parameters

  • ptr (out): destination memory location for the store
  • value (in): value to write to ptr

__stwb

void __stwb(double2 *ptr, double2 value)

Stores a value to the specified global memory address.

Parameters

  • ptr (out): destination memory location for the store
  • value (in): value to write to ptr

__stwt

void __stwt(long *ptr, long value)

Stores a value to the specified global memory address.

Parameters

  • ptr (out): destination memory location for the store
  • value (in): value to write to ptr

__stwt

void __stwt(unsigned long *ptr, unsigned long value)

Stores a value to the specified global memory address.

Parameters

  • ptr (out): destination memory location for the store
  • value (in): value to write to ptr

__stwt

void __stwt(char *ptr, char value)

Stores a value to the specified global memory address.

Parameters

  • ptr (out): destination memory location for the store
  • value (in): value to write to ptr

__stwt

void __stwt(signed char *ptr, signed char value)

Stores a value to the specified global memory address.

Parameters

  • ptr (out): destination memory location for the store
  • value (in): value to write to ptr

__stwt

void __stwt(short *ptr, short value)

Stores a value to the specified global memory address.

Parameters

  • ptr (out): destination memory location for the store
  • value (in): value to write to ptr

__stwt

void __stwt(int *ptr, int value)

Stores a value to the specified global memory address.

Parameters

  • ptr (out): destination memory location for the store
  • value (in): value to write to ptr

__stwt

void __stwt(long long *ptr, long long value)

Stores a value to the specified global memory address.

Parameters

  • ptr (out): destination memory location for the store
  • value (in): value to write to ptr

__stwt

void __stwt(char2 *ptr, char2 value)

Stores a value to the specified global memory address.

Parameters

  • ptr (out): destination memory location for the store
  • value (in): value to write to ptr

__stwt

void __stwt(char4 *ptr, char4 value)

Stores a value to the specified global memory address.

Parameters

  • ptr (out): destination memory location for the store
  • value (in): value to write to ptr

__stwt

void __stwt(short2 *ptr, short2 value)

Stores a value to the specified global memory address.

Parameters

  • ptr (out): destination memory location for the store
  • value (in): value to write to ptr

__stwt

void __stwt(short4 *ptr, short4 value)

Stores a value to the specified global memory address.

Parameters

  • ptr (out): destination memory location for the store
  • value (in): value to write to ptr

__stwt

void __stwt(int2 *ptr, int2 value)

Stores a value to the specified global memory address.

Parameters

  • ptr (out): destination memory location for the store
  • value (in): value to write to ptr

__stwt

void __stwt(int4 *ptr, int4 value)

Stores a value to the specified global memory address.

Parameters

  • ptr (out): destination memory location for the store
  • value (in): value to write to ptr

__stwt

void __stwt(longlong2 *ptr, longlong2 value)

Stores a value to the specified global memory address.

Parameters

  • ptr (out): destination memory location for the store
  • value (in): value to write to ptr

__stwt

void __stwt(unsigned char *ptr, unsigned char value)

Stores a value to the specified global memory address.

Parameters

  • ptr (out): destination memory location for the store
  • value (in): value to write to ptr

__stwt

void __stwt(unsigned short *ptr, unsigned short value)

Stores a value to the specified global memory address.

Parameters

  • ptr (out): destination memory location for the store
  • value (in): value to write to ptr

__stwt

void __stwt(unsigned int *ptr, unsigned int value)

Stores a value to the specified global memory address.

Parameters

  • ptr (out): destination memory location for the store
  • value (in): value to write to ptr

__stwt

void __stwt(unsigned long long *ptr, unsigned long long value)

Stores a value to the specified global memory address.

Parameters

  • ptr (out): destination memory location for the store
  • value (in): value to write to ptr

__stwt

void __stwt(uchar2 *ptr, uchar2 value)

Stores a value to the specified global memory address.

Parameters

  • ptr (out): destination memory location for the store
  • value (in): value to write to ptr

__stwt

void __stwt(uchar4 *ptr, uchar4 value)

Stores a value to the specified global memory address.

Parameters

  • ptr (out): destination memory location for the store
  • value (in): value to write to ptr

__stwt

void __stwt(ushort2 *ptr, ushort2 value)

Stores a value to the specified global memory address.

Parameters

  • ptr (out): destination memory location for the store
  • value (in): value to write to ptr

__stwt

void __stwt(ushort4 *ptr, ushort4 value)

Stores a value to the specified global memory address.

Parameters

  • ptr (out): destination memory location for the store
  • value (in): value to write to ptr

__stwt

void __stwt(uint2 *ptr, uint2 value)

Stores a value to the specified global memory address.

Parameters

  • ptr (out): destination memory location for the store
  • value (in): value to write to ptr

__stwt

void __stwt(uint4 *ptr, uint4 value)

Stores a value to the specified global memory address.

Parameters

  • ptr (out): destination memory location for the store
  • value (in): value to write to ptr

__stwt

void __stwt(ulonglong2 *ptr, ulonglong2 value)

Stores a value to the specified global memory address.

Parameters

  • ptr (out): destination memory location for the store
  • value (in): value to write to ptr

__stwt

void __stwt(float *ptr, float value)

Stores a value to the specified global memory address.

Parameters

  • ptr (out): destination memory location for the store
  • value (in): value to write to ptr

__stwt

void __stwt(double *ptr, double value)

Stores a value to the specified global memory address.

Parameters

  • ptr (out): destination memory location for the store
  • value (in): value to write to ptr

__stwt

void __stwt(float2 *ptr, float2 value)

Stores a value to the specified global memory address.

Parameters

  • ptr (out): destination memory location for the store
  • value (in): value to write to ptr

__stwt

void __stwt(float4 *ptr, float4 value)

Stores a value to the specified global memory address.

Parameters

  • ptr (out): destination memory location for the store
  • value (in): value to write to ptr

__stwt

void __stwt(double2 *ptr, double2 value)

Stores a value to the specified global memory address.

Parameters

  • ptr (out): destination memory location for the store
  • value (in): value to write to ptr

SIMD Intrinsics

Use SIMD intrinsics for packed integer operations on multiple smaller values stored inside a single word. The 2 suffix generally operates on two 16-bit lanes, and the 4 suffix generally operates on four 8-bit lanes.

__vabs2

unsigned int __vabs2(unsigned int a)

Computes per-halfword absolute value: |a|.

__vabs4

unsigned int __vabs4(unsigned int a)

Computes per-byte absolute value: |a|.

__vabsdiffs2

unsigned int __vabsdiffs2(unsigned int a, unsigned int b)

Computes per-halfword absolute difference of signed integer: |a - b|.

__vabsdiffs4

unsigned int __vabsdiffs4(unsigned int a, unsigned int b)

Computes per-byte absolute difference of signed integer: |a - b|.

__vabsdiffu2

unsigned int __vabsdiffu2(unsigned int a, unsigned int b)

Computes per-halfword absolute difference of unsigned integer: |a - b|.

__vabsdiffu4

unsigned int __vabsdiffu4(unsigned int a, unsigned int b)

Computes per-byte absolute difference of unsigned integer: |a - b|.

__vabsss2

unsigned int __vabsss2(unsigned int a)

Computes per-halfword absolute value with signed saturation: |a|.

__vabsss4

unsigned int __vabsss4(unsigned int a)

Computes per-byte absolute value with signed saturation: |a|.

__vadd2

unsigned int __vadd2(unsigned int a, unsigned int b)

Performs per-halfword (un)signed addition, with wrap-around: a + b.

__vadd4

unsigned int __vadd4(unsigned int a, unsigned int b)

Performs per-byte (un)signed addition: a + b.

__vaddss2

unsigned int __vaddss2 (unsigned int a, unsigned int b)

Performs per-halfword addition with signed saturation: a + b.

__vaddss4

unsigned int __vaddss4 (unsigned int a, unsigned int b)

Performs per-byte addition with signed saturation: a + b.

__vaddus2

unsigned int __vaddus2 (unsigned int a, unsigned int b)

Performs per-halfword addition with unsigned saturation: a + b.

__vaddus4

unsigned int __vaddus4 (unsigned int a, unsigned int b)

Performs per-byte addition with unsigned saturation: a + b.

__vavgs2

unsigned int __vavgs2(unsigned int a, unsigned int b)

Performs per-halfword signed rounded average computation.

__vavgs4

unsigned int __vavgs4(unsigned int a, unsigned int b)

Computes per-byte signed rounded average.

__vavgu2

unsigned int __vavgu2(unsigned int a, unsigned int b)

Performs per-halfword unsigned rounded average computation.

__vavgu4

unsigned int __vavgu4(unsigned int a, unsigned int b)

Performs per-byte unsigned rounded average.

__vcmpeq2

unsigned int __vcmpeq2(unsigned int a, unsigned int b)

Performs per-halfword (un)signed comparison: a == b ? 0xffff : 0.

__vcmpeq4

unsigned int __vcmpeq4(unsigned int a, unsigned int b)

Performs per-byte (un)signed comparison: a == b ? 0xff : 0.

__vcmpges2

unsigned int __vcmpges2(unsigned int a, unsigned int b)

Performs per-halfword signed comparison: a >= b ? 0xffff : 0.

__vcmpges4

unsigned int __vcmpges4(unsigned int a, unsigned int b)

Performs per-byte signed comparison: a >= b ? 0xff : 0.

__vcmpgeu2

unsigned int __vcmpgeu2(unsigned int a, unsigned int b)

Performs per-halfword unsigned comparison: a >= b ? 0xffff : 0.

__vcmpgeu4

unsigned int __vcmpgeu4(unsigned int a, unsigned int b)

Performs per-byte unsigned comparison: a >= b ? 0xff : 0.

__vcmpgts2

unsigned int __vcmpgts2(unsigned int a, unsigned int b)

Performs per-halfword signed comparison: a > b ? 0xffff : 0.

__vcmpgts4

unsigned int __vcmpgts4(unsigned int a, unsigned int b)

Performs per-byte signed comparison: a > b ? 0xff : 0.

__vcmpgtu2

unsigned int __vcmpgtu2(unsigned int a, unsigned int b)

Performs per-halfword unsigned comparison: a > b ? 0xffff : 0.

__vcmpgtu4

unsigned int __vcmpgtu4(unsigned int a, unsigned int b)

Performs per-byte unsigned comparison: a > b ? 0xff : 0.

__vcmples2

unsigned int __vcmples2(unsigned int a, unsigned int b)

Performs per-halfword signed comparison: a <= b ? 0xffff : 0.

__vcmples4

unsigned int __vcmples4(unsigned int a, unsigned int b)

Performs per-byte signed comparison: a <= b ? 0xff : 0.

__vcmpleu2

unsigned int __vcmpleu2(unsigned int a, unsigned int b)

Performs per-halfword unsigned comparison: a <= b ? 0xffff : 0.

__vcmpleu4

unsigned int __vcmpleu4(unsigned int a, unsigned int b)

Performs per-byte unsigned comparison: a <= b ? 0xff : 0.

__vcmplts2

unsigned int __vcmplts2(unsigned int a, unsigned int b)

Performs per-halfword signed comparison: a < b ? 0xffff : 0.

__vcmplts4

unsigned int __vcmplts4(unsigned int a, unsigned int b)

Performs per-byte signed comparison: a < b ? 0xff : 0.

__vcmpltu2

unsigned int __vcmpltu2(unsigned int a, unsigned int b)

Performs per-halfword unsigned comparison: a < b ? 0xffff : 0.

__vcmpltu4

unsigned int __vcmpltu4(unsigned int a, unsigned int b)

Performs per-byte unsigned comparison: a < b ? 0xff : 0.

__vcmpne2

unsigned int __vcmpne2(unsigned int a, unsigned int b)

Performs per-halfword (un)signed comparison: a != b ? 0xffff : 0.

__vcmpne4

unsigned int __vcmpne4(unsigned int a, unsigned int b)

Performs per-byte (un)signed comparison: a != b ? 0xff : 0.

__vhaddu2

unsigned int __vhaddu2(unsigned int a, unsigned int b)

Performs per-halfword unsigned average computation.

__vhaddu4

unsigned int __vhaddu4(unsigned int a, unsigned int b)

Computes per-byte unsigned average.

__viaddmax_s16x2

unsigned int __viaddmax_s16x2(const unsigned int a, const unsigned int b, const unsigned int c)

Performs per-halfword max(a + b, c)

__viaddmax_s16x2_relu

unsigned int __viaddmax_s16x2_relu(const unsigned int a, const unsigned int b, const unsigned int c)

Performs per-halfword max(max(a + b, c), 0)

__viaddmax_s32

int __viaddmax_s32(const int a, const int b, const int c)

Computes max(a + b, c)

__viaddmax_s32_relu

int __viaddmax_s32_relu(const int a, const int b, const int c)

Computes max(max(a + b, c), 0)

__viaddmax_u16x2

unsigned int __viaddmax_u16x2(const unsigned int a, const unsigned int b, const unsigned int c)

Performs per-halfword max(a + b, c)

__viaddmax_u32

unsigned int __viaddmax_u32(const unsigned int a, const unsigned int b, const unsigned int c)

Computes max(a + b, c)

__viaddmin_s16x2

unsigned int __viaddmin_s16x2(const unsigned int a, const unsigned int b, const unsigned int c)

Performs per-halfword min(a + b, c)

__viaddmin_s16x2_relu

unsigned int __viaddmin_s16x2_relu(const unsigned int a, const unsigned int b, const unsigned int c)

Performs per-halfword max(min(a + b, c), 0)

__viaddmin_s32

int __viaddmin_s32(const int a, const int b, const int c)

Computes min(a + b, c)

__viaddmin_s32_relu

int __viaddmin_s32_relu(const int a, const int b, const int c)

Computes max(min(a + b, c), 0)

__viaddmin_u16x2

unsigned int __viaddmin_u16x2(const unsigned int a, const unsigned int b, const unsigned int c)

Performs per-halfword min(a + b, c)

__viaddmin_u32

unsigned int __viaddmin_u32(const unsigned int a, const unsigned int b, const unsigned int c)

Computes min(a + b, c)

__vibmax_s16x2

unsigned int __vibmax_s16x2(const unsigned int a, const unsigned int b, bool* const pred_hi, bool* const pred_lo)

Performs per-halfword max(a, b), also sets the value pointed to by pred_hi and pred_lo to the per-halfword result of a >= b.

__vibmax_s32

int __vibmax_s32(const int a, const int b, bool* const pred)

Computes max(a, b), also sets the value pointed to by pred to a >= b.

__vibmax_u16x2

unsigned int __vibmax_u16x2(const unsigned int a, const unsigned int b, bool* const pred_hi, bool* const pred_lo)

Performs per-halfword max(a, b), also sets the value pointed to by pred_hi and pred_lo to the per-halfword result of a >= b.

__vibmax_u32

unsigned int __vibmax_u32(const unsigned int a, const unsigned int b, bool* const pred)

Computes max(a, b), also sets the value pointed to by pred to a >= b.

__vibmin_s16x2

unsigned int __vibmin_s16x2(const unsigned int a, const unsigned int b, bool* const pred_hi, bool* const pred_lo)

Performs per-halfword min(a, b), also sets the value pointed to by pred_hi and pred_lo to the per-halfword result of a <= b.

__vibmin_s32

int __vibmin_s32(const int a, const int b, bool* const pred)

Computes min(a, b), also sets the value pointed to by pred to a <= b.

__vibmin_u16x2

unsigned int __vibmin_u16x2(const unsigned int a, const unsigned int b, bool* const pred_hi, bool* const pred_lo)

Performs per-halfword min(a, b), also sets the value pointed to by pred_hi and pred_lo to the per-halfword result of a <= b.

__vibmin_u32

unsigned int __vibmin_u32(const unsigned int a, const unsigned int b, bool* const pred)

Computes min(a, b), also sets the value pointed to by pred to a <= b.

__vimax3_s16x2

unsigned int __vimax3_s16x2(const unsigned int a, const unsigned int b, const unsigned int c)

Performs per-halfword max(max(a, b), c)

__vimax3_s16x2_relu

unsigned int __vimax3_s16x2_relu(const unsigned int a, const unsigned int b, const unsigned int c)

Performs per-halfword max(max(max(a, b), c), 0)

__vimax3_s32

int __vimax3_s32(const int a, const int b, const int c)

Computes max(max(a, b), c)

__vimax3_s32_relu

int __vimax3_s32_relu(const int a, const int b, const int c)

Computes max(max(max(a, b), c), 0)

__vimax3_u16x2

unsigned int __vimax3_u16x2(const unsigned int a, const unsigned int b, const unsigned int c)

Performs per-halfword max(max(a, b), c)

__vimax3_u32

unsigned int __vimax3_u32(const unsigned int a, const unsigned int b, const unsigned int c)

Computes max(max(a, b), c)

__vimax_s16x2_relu

unsigned int __vimax_s16x2_relu(const unsigned int a, const unsigned int b)

Performs per-halfword max(max(a, b), 0)

__vimax_s32_relu

int __vimax_s32_relu(const int a, const int b)

Computes max(max(a, b), 0)

__vimin3_s16x2

unsigned int __vimin3_s16x2(const unsigned int a, const unsigned int b, const unsigned int c)

Performs per-halfword min(min(a, b), c)

__vimin3_s16x2_relu

unsigned int __vimin3_s16x2_relu(const unsigned int a, const unsigned int b, const unsigned int c)

Performs per-halfword max(min(min(a, b), c), 0)

__vimin3_s32

int __vimin3_s32(const int a, const int b, const int c)

Computes min(min(a, b), c)

__vimin3_s32_relu

int __vimin3_s32_relu(const int a, const int b, const int c)

Computes max(min(min(a, b), c), 0)

__vimin3_u16x2

unsigned int __vimin3_u16x2(const unsigned int a, const unsigned int b, const unsigned int c)

Performs per-halfword min(min(a, b), c)

__vimin3_u32

unsigned int __vimin3_u32(const unsigned int a, const unsigned int b, const unsigned int c)

Computes min(min(a, b), c)

__vimin_s16x2_relu

unsigned int __vimin_s16x2_relu(const unsigned int a, const unsigned int b)

Performs per-halfword max(min(a, b), 0)

__vimin_s32_relu

int __vimin_s32_relu(const int a, const int b)

Computes max(min(a, b), 0)

__vmaxs2

unsigned int __vmaxs2(unsigned int a, unsigned int b)

Performs per-halfword signed maximum computation.

__vmaxs4

unsigned int __vmaxs4(unsigned int a, unsigned int b)

Computes per-byte signed maximum.

__vmaxu2

unsigned int __vmaxu2(unsigned int a, unsigned int b)

Performs per-halfword unsigned maximum computation.

__vmaxu4

unsigned int __vmaxu4(unsigned int a, unsigned int b)

Computes per-byte unsigned maximum.

__vmins2

unsigned int __vmins2(unsigned int a, unsigned int b)

Performs per-halfword signed minimum computation.

__vmins4

unsigned int __vmins4(unsigned int a, unsigned int b)

Computes per-byte signed minimum.

__vminu2

unsigned int __vminu2(unsigned int a, unsigned int b)

Performs per-halfword unsigned minimum computation.

__vminu4

unsigned int __vminu4(unsigned int a, unsigned int b)

Computes per-byte unsigned minimum.

__vneg2

unsigned int __vneg2(unsigned int a)

Computes per-halfword negation.

__vneg4

unsigned int __vneg4(unsigned int a)

Performs per-byte negation.

__vnegss2

unsigned int __vnegss2(unsigned int a)

Computes per-halfword negation with signed saturation.

__vnegss4

unsigned int __vnegss4(unsigned int a)

Performs per-byte negation with signed saturation.

__vsads2

unsigned int __vsads2(unsigned int a, unsigned int b)

Performs per-halfword sum of absolute difference of signed.

__vsads4

unsigned int __vsads4(unsigned int a, unsigned int b)

Computes per-byte sum of abs difference of signed.

__vsadu2

unsigned int __vsadu2(unsigned int a, unsigned int b)

Computes per-halfword sum of abs diff of unsigned.

__vsadu4

unsigned int __vsadu4(unsigned int a, unsigned int b)

Computes per-byte sum of abs difference of unsigned.

__vseteq2

unsigned int __vseteq2(unsigned int a, unsigned int b)

Performs per-halfword (un)signed comparison: returns 1 if both parts compare equal.

__vseteq4

unsigned int __vseteq4(unsigned int a, unsigned int b)

Performs per-byte (un)signed comparison: returns 1 if all 4 pairs compare equal.

__vsetges2

unsigned int __vsetges2(unsigned int a, unsigned int b)

Performs per-halfword signed comparison: returns 1 if both parts compare greater than or equal.

__vsetges4

unsigned int __vsetges4(unsigned int a, unsigned int b)

Performs per-byte signed comparison: returns 1 if all 4 pairs compare greater than or equal.

__vsetgeu2

unsigned int __vsetgeu2(unsigned int a, unsigned int b)

Performs per-halfword unsigned comparison: returns 1 if both parts compare greater than or equal.

__vsetgeu4

unsigned int __vsetgeu4(unsigned int a, unsigned int b)

Performs per-byte unsigned comparison: returns 1 if all 4 pairs compare greater than or equal.

__vsetgts2

unsigned int __vsetgts2(unsigned int a, unsigned int b)

Performs per-halfword signed comparison: returns 1 if both parts compare greater than.

__vsetgts4

unsigned int __vsetgts4(unsigned int a, unsigned int b)

Performs per-byte signed comparison: returns 1 if all 4 pairs compare greater than.

__vsetgtu2

unsigned int __vsetgtu2(unsigned int a, unsigned int b)

Performs per-halfword unsigned comparison: returns 1 if both parts compare greater than.

__vsetgtu4

unsigned int __vsetgtu4(unsigned int a, unsigned int b)

Performs per-byte unsigned comparison: returns 1 if all 4 pairs compare greater than.

__vsetles2

unsigned int __vsetles2(unsigned int a, unsigned int b)

Performs per-halfword unsigned comparison: returns 1 if both parts compare less than or equal.

__vsetles4

unsigned int __vsetles4(unsigned int a, unsigned int b)

Performs per-byte signed comparison: returns 1 if all 4 pairs compare less than or equal.

__vsetleu2

unsigned int __vsetleu2(unsigned int a, unsigned int b)

Performs per-halfword signed comparison: returns 1 if both parts compare less than or equal.

__vsetleu4

unsigned int __vsetleu4(unsigned int a, unsigned int b)

Performs per-byte unsigned comparison: returns 1 if all 4 pairs compare less than or equal.

__vsetlts2

unsigned int __vsetlts2(unsigned int a, unsigned int b)

Performs per-halfword signed comparison: returns 1 if both parts compare less than.

__vsetlts4

unsigned int __vsetlts4(unsigned int a, unsigned int b)

Performs per-byte signed comparison: returns 1 if all 4 pairs compare less than.

__vsetltu2

unsigned int __vsetltu2(unsigned int a, unsigned int b)

Performs per-halfword unsigned comparison: returns 1 if both parts compare less than.

__vsetltu4

unsigned int __vsetltu4(unsigned int a, unsigned int b)

Performs per-byte unsigned comparison: returns 1 if all 4 pairs compare less than.

__vsetne2

unsigned int __vsetne2(unsigned int a, unsigned int b)

Performs per-halfword (un)signed comparison: returns 1 if both parts compare not equal.

__vsetne4

unsigned int __vsetne4(unsigned int a, unsigned int b)

Performs per-byte (un)signed comparison: returns 1 if all 4 pairs compare not equal.

__vsub2

unsigned int __vsub2(unsigned int a, unsigned int b)

Performs per-halfword (un)signed subtraction, with wrap-around: a - b.

__vsub4

unsigned int __vsub4(unsigned int a, unsigned int b)

Performs per-byte subtraction: a - b.

__vsubss2

unsigned int __vsubss2 (unsigned int a, unsigned int b)

Performs per-halfword (un)signed subtraction, with signed saturation: a - b.

__vsubss4

unsigned int __vsubss4(unsigned int a, unsigned int b)

Performs per-byte subtraction with signed saturation: a - b.

__vsubus2

unsigned int __vsubus2 (unsigned int a, unsigned int b)

Performs per-halfword subtraction with unsigned saturation: a - b.

__vsubus4

unsigned int __vsubus4(unsigned int a, unsigned int b)

Performs per-byte subtraction with unsigned saturation: a - b.

Integer Intrinsics

__dp2a_hi

int __dp2a_hi(int srcA, int srcB, int c)

Two-way signed int16 by int8 dot product with int32 accumulate, taking the upper half of the second input.

__dp2a_hi

unsigned int __dp2a_hi(unsigned int srcA, unsigned int srcB, unsigned int c)

Two-way signed int16 by int8 dot product with int32 accumulate, taking the upper half of the second input.

__dp2a_hi

int __dp2a_hi(short2 srcA, char4 srcB, int c)

Two-way signed int16 by int8 dot product with int32 accumulate, taking the upper half of the second input.

__dp2a_hi

unsigned int __dp2a_hi(ushort2 srcA, uchar4 srcB, unsigned int c)

Two-way signed int16 by int8 dot product with int32 accumulate, taking the upper half of the second input.

__dp2a_lo

int __dp2a_lo(int srcA, int srcB, int c)

Two-way unsigned int16 by int8 dot product with unsigned int32 accumulate, taking the lower half of the second input.

__dp2a_lo

unsigned int __dp2a_lo(unsigned int srcA, unsigned int srcB, unsigned int c)

Two-way unsigned int16 by int8 dot product with unsigned int32 accumulate, taking the lower half of the second input.

__dp2a_lo

int __dp2a_lo(short2 srcA, char4 srcB, int c)

Two-way unsigned int16 by int8 dot product with unsigned int32 accumulate, taking the lower half of the second input.

__dp2a_lo

unsigned int __dp2a_lo(ushort2 srcA, uchar4 srcB, unsigned int c)

Two-way unsigned int16 by int8 dot product with unsigned int32 accumulate, taking the lower half of the second input.

__dp4a

int __dp4a(int srcA, int srcB, int c)

Four-way unsigned int8 dot product with unsigned int32 accumulate.

__dp4a

unsigned int __dp4a(unsigned int srcA, unsigned int srcB, unsigned int c)

Four-way unsigned int8 dot product with unsigned int32 accumulate.

__dp4a

int __dp4a(char4 srcA, char4 srcB, int c)

Four-way unsigned int8 dot product with unsigned int32 accumulate.

__dp4a

unsigned int __dp4a(uchar4 srcA, uchar4 srcB, unsigned int c)

Four-way unsigned int8 dot product with unsigned int32 accumulate.