This session demonstrates a zero padding of an image using the Multi dimension DMA capabilities of AIE shim DMA of AMD Ryzen AI Phoenix using AIE DIALECTS and AIE API.
RequirementsAMD Ryzen AI Phoenix.
Linux® based development environment
Python® (for test automation and result validation)
IRON API and MLIR-based AI Engine Toolchain
OpenCV (Open Source Computer Vision Library)
Project BriefThe SOC is designed to accelerate AIE-ML algorithms, delivering good to exceptional performance. The NPU has complex
- 16 AI Cores for computation
- 4 Memory Tiles for fast memory access
- 4 SHIM DMA to Move data in and out of L3 Memory
Note: This project is customized for Phoenix.
Features covered in this sessionHow to perform a zero padding of an image using the shim DMAs of “AMD Ryzen AI NPU”.
ArchitectureAdd reference to
https://www.hackster.io/ajoejose/amd-ryzen-ai-npu-multi-dimensional-shim-dma-9b8afd
Zero paddingIn image processing and deep learning, zero padding is the process of adding a border of pixels with a value of 0 (which appears black) around the edges of an image.
Why Use Zero Padding?
- Maintain Image Size: Without padding, sliding a filter (kernel) over an image shrinks the output dimensions. Zero padding allows the output to match the original input size.
- Preserve Edge Data: It allows the filter to process the pixels at the very edges of the image as thoroughly as those in the center, preventing information loss.
- Computational Efficiency: In Signal Processing (like FFT), padding to a power of two can speed up calculations.
Note: Image dimensions must be in multiples of 8 pixels.
Padding Configuration
K = width of the image
M = height of the image
Kl = Padding Left
Kr = Padding Right
Mt = Padding Top
Mb = Padding bottom
offset=(Mt*(K + Kr + Kl) + Kl)
sizes=[1, 1, M, K]
strides=[ 1, 1, K + Kr + Kl, 1]
Input
Output
To compile the placed design:
env use_placed=1 make
make zero_padding.exeTo run the design:
./zero_padding.exe -x build/final_256.xclbin -i build/insts.bin -k MLIR_AIE --image input_image.jpgHow to Install and Set Up the Environment?https://www.hackster.io/541340/amd-ryzen-ai-npu-tool-chain-installation-and-execution-b252fa
ConclusionThis session demonstrates how to use the “IRON API and MLIR-based AI Engine Toolchain” and “AIE API” to perform a zero padding of an Image.








Comments