Thread Architecture
The thread hierarchy of the SIMT programming model consists of two layers:
- Grid: A grid consists of multiple thread blocks. The built-in variable gridDim is used to indicate the number of enabled thread blocks. An AIV core executes only one thread block task at a time.
- Thread block: A thread block consists of multiple threads. The built-in variable blockDim is used to indicate the number of enabled threads in a thread block. A maximum of 2048 threads can be enabled in a thread block.
For a program based on the SIMT programming model, multiple thread blocks with the same structure are executed on the AIV core. The total number of threads executed is equal to gridDim × blockDim.

gridDim is represented by a three-dimensional structure dim3. {dimx, dimy, dimz} is used to specify the sizes of thread blocks in three different dimensions. The product of the three dimensions cannot exceed 65535. Each thread block can be identified by the thread block index blockIdx. blockDim is also represented by a three-dimensional structure dim3. The product of the three dimensions cannot exceed 2048. Each thread can be identified by the thread index threadIdx within a thread block. The following figure shows an example of computing the thread index.

During underlying scheduling, an AIV can execute only one thread block task at a time. Each thread block is divided into multiple warps for sequential scheduling and execution. A warp is a set of threads that execute the same instruction. Each warp contains 32 threads. Each AIV core contains four warp schedulers. The scheduler ID is warp ID % 4.