Component ID: AIE_FAL - 2024.1 English

AI Engine System Software Driver Reference Manual (UG1642)

Document ID
Release Date
2024.1 English

The AI Engine functional abstraction layer (FAL) driver offers a hardware abstraction layer that defines how AI Engine resources can be accessed. The FAL builds upon the AI Engine driver by providing a resource management abstraction based on functions. For example, while the AI Engine driver defines APIs for accessing various performance counters, the FAL offers an object-oriented class abstraction to streamline profiling tasks using these counters. With FAL, you can specify what they want to profile, and the class abstraction defines APIs for applying the user's profiling criteria to the hardware through the AI Engine driver.

FAL consists of C++ headers only, allowing user applications to include these headers for utilization. Currently, it exclusively provides abstractions for profiling-related resources, including performance counters, broadcast channels, PC events, trace events, stream post-selects, and combo events. The following diagram illustrates the role of FAL within an application, showing that it is included as part of the user application.

Figure 1. AI Engine FAL – Resource Management

FAL offers abstraction for each AI Engine resource and oversees their states. It effectively handles resource reservation, configuration, and release, taking into account both the resource state and the configuration specified by the user. In addition to individual resource management, FAL introduces a resource group class template that allows grouping of resources with similar functions across different tiles. FAL also includes a container class that enables the bundling of various resources used to fulfill a common user-defined function within the same container.

Figure 2. AI Engine SW Stack – FAL

The resource management within the FAL layer offers a self-contained solution to prevent one function from using resources allocated to another function. It meticulously oversees each resource independently, with each resource having its own designated state. In contrast to direct calls to the AI Engine driver, this layer introduces a safeguard by necessitating resource reservation before release. While it incurs some memory overhead due to state management and a degree of performance overhead when requesting resources individually, it provides the crucial flexibility to add or remove resources individually and offers protection against resource utilization or release without prior reservation. This protection is particularly vital in scenarios involving profiling and event tracing.

Important: The FAL layer does not incorporate a built-in locking mechanism for ensuring thread safety. Instead, it relies on the underlying low-level driver to provide thread safety. For example, the Linux kernel-based AI Engine driver lacks built-in thread safety, so in Linux resource allocation is protected through mutex mechanisms implemented by the Linux kernel.