| AI Engine Intrinsics User Guide (v2026.1)

Loading...
Searching...
No Matches
Functions
Locks
Intrinsics » Scalar Operations

## Overview

A lock is defined by an identifier (currently ranging from 0 to 15 for a memory module) and its current state among four possible states. The state is defined by two bits, the MSB indicating whether the lock is currently acquired or not, and the LSB the current value of the lock which is simply 0 or 1. Locks can be released and acquired with different values to allow synchronization between multiple AI Engines and with the DMAs.

## Functions
void | acquire (unsigned id)
| Acquire a lock without checking its value.
void | acquire (unsigned id, unsigned val)
| Acquire a lock with a specific value.
void | release (unsigned id)
| Release a lock without changing its value.
void | release (unsigned id, unsigned val)
| Release a lock and set it to a specific value.

## Function Documentation

## ◆ acquire() [1/2]

void acquire | ( | unsigned | id | ) |

Acquire a lock without checking its value.

This intrinsic tries to acquires the lock with the identifier id, without checking its value. It will block the program until it acquires successfully.

## ◆ acquire() [2/2]

void acquire | ( | unsigned | id,
|  | unsigned | val )

Acquire a lock with a specific value.

This intrinsic tries to acquires the lock with the identifier id and with its value set to val. It will block the program until it acquires successfully.

## ◆ release() [1/2]

void release | ( | unsigned | id | ) |

Release a lock without changing its value.

This intrinsic tries to release the lock with the identifier id, without modifying its value. This intrinsic is non-blocking.

## ◆ release() [2/2]

void release | ( | unsigned | id,
|  | unsigned | val )

Release a lock and set it to a specific value.

This intrinsic tries to release the lock with the identifier id and set it to val. This intrinsic is non-blocking.