AI Engine Kernel Driver Runtime Resource Configuration and Control Interface - 2024.1 English

AI Engine System Software Driver Reference Manual (UG1642)

Document ID
Release Date
2024.1 English

There are three types of AI Engine hardware I/O access: read, poll, and write. The AI Engine partition allows the application to mmap all the I/O registers to read only to the application so that the application can directly read and poll registers from the userspace to save context switch time between userspace and kernel space. The AI Engine partition driver limits register write, and mask write can only be done with the AI Engine partition driver ioctl syscall.

The reason that the AI Engine partition driver limits the application to write only to AI Engine registers through ioctl is because if userspace is the one to change the configuration without notifying the Linux kernel, the Linux kernel loses track of which configuration has been changed, and userspace might change which kernel Linux set. Also, there are some registers which should be not written from userspace such as AI Engine interface tiles DMA registers. The AI Engine partition kernel driver writes to AI Engine registers. Be aware of the AI Engine resource usage because the AI Engine partition kernel driver is responsible for events backtracking, tracing, and profiling. To use ioctl to write to the register creates context switch overhead. However, with the PDI configuration flow, writing to registers from userspace is not frequent at runtime. Also, if you want to speed up the configuration, consider allowing configuration files with ioctl to execute the configuration requests in batch mode with zero-copy.

sysfs interface can be used for userspace to inquire the kernel module information. You can use it for events and errors statistics and core DMA status dumps. See AI Engine Error and Events Handling for more information about errors and events runtime handling.