asc_any

Applicability

Product

Supported

Atlas 350 Accelerator Card

Atlas A3 training product/Atlas A3 inference product

x

Atlas A2 training product/Atlas A2 inference product

x

Atlas 200I/500 A2 inference product

x

Atlas inference product AI Core

x

Atlas inference product Vector Core

x

Atlas training product

x

Function Usage

Checks whether the input of an active thread is not 0.

This API is executed by all active threads in the warp to check the input operand predicate of all active threads. If predicate of all active threads is 0, 0 is returned. Otherwise, 1 is returned. All active threads in the warp return the same result.

Prototype

1
inline int32_t asc_any(int32_t predicate)

Parameters

Table 1 Parameters

Parameter

Input/Output

Description

predicate

Input

Operand.

Returns

If the inputs of all active threads in the warp are 0, 0 is returned. Otherwise, 1 is returned.

Restrictions

None

Header File to Be Included

To use this API, the simt_api/device_warp_functions.h header file must be included.

1
#include "simt_api/device_warp_functions.h"

Examples

For SIMD and SIMT programming:
1
2
3
4
5
6
7
8
__simt_vf__ __launch_bounds__(1024) inline void KernelAny(__gm__ int32_t* dst)
{
    // asc_vf_call parameter: dim3{1024, 1, 1}
    int idx = threadIdx.x + blockIdx.x * blockDim.x;
    int32_t laneId = idx % 32;
    int32_t result = asc_any(laneId); // The return value is 1.
    dst[idx] = result;
}