Synchronization Mechanism
SIMT is a single-instruction, multiple-thread programming model. Its asynchronous programming model aims to accelerate memory operations through concurrent execution of multiple threads. In this programming model, threads are the smallest abstract units for performing computations or memory operations, and their operations are independent of each other. However, in some application scenarios, synchronization between threads needs to be supported, or data races caused by read and write operations of different threads on the same memory area need to be prevented. To address this, Ascend C provides corresponding synchronization APIs. These APIs allow you to select an appropriate synchronization mechanism as needed to ensure the correctness and performance of asynchronous operations.
|
API |
Description |
|---|---|
|
Waits until all threads in the current thread block reach this function. |
|
|
Ensures the time sequence of write operations when different threads access the same global or shared memory. It does not block threads and only ensures the visibility sequence of memory operations. |
|
|
Coordinates the memory operation sequence of threads in the same thread block to ensure that all memory read and write operations before a thread calls asc_threadfence_block() are visible to other threads in the same thread block. |