This session demonstrates a multi core chain processing of a Colour image on AMD Ryzen AI Phoenix using AIE DIALECTS and AIE API.
RequirementsAMD Ryzen AI Phoenix.Linux® based development environmentPython® (for test automation and result validation)IRON API and MLIR-based AI Engine ToolchainOpenCV (Open Source Computer Vision Library)
Project BriefThe SOC is designed to accelerate AIE-ML algorithms, delivering good to exceptional performance. The NPU complex has
- 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 sessionThis work demonstrates color image processing on the AMD Ryzen™ AI NPU, including pixel scaling for brightness control, RGB-to-grayscale conversion, and grayscale-to-negative conversion.
Architecturehttps://www.hackster.io/ajoejose/amd-ryzen-ai-npu-optimizing-rgb-to-negative-conversion-437a73
Grey of a colour ImageGrayscale conversion transforms an RGB image into a single-channel image by computing a weighted sum of the Red, Green, and Blue components, where human visual sensitivity is highest to green, followed by red and blue. In this implementation, the standard grayscale formula
Gray=0.299R+0.587G+0.114BGray=0.299R+0.587G+0.114B is realized using fixed-point arithmetic with integer scaling factors to ensure hardware efficiency on the AI Engine. Vectorized multiply and multiply-accumulate operations are used to combine the RGB channels, and a final right shift (SRS) restores the correct pixel range, producing an 8-bit grayscale output suitable for high-performance image processing pipelines.
Brightness of an ImageBrightness adjustment modifies the intensity of an image by scaling each pixel value with a programmable factor. In this design, brightness is varied from 0× to 4× using fixed-point arithmetic, where the output pixel is computed as
outpixel=scale×inpixel / 64The AI Engine kernel performs a vectorized multiply of the input pixels with the brightness scale factor, followed by a right shift (SHIFT) to normalize the result. This approach ensures efficient, overflow-safe brightness control while producing an 8-bit output suitable for real-time image processing pipelines.
Data Flow for ComputationThe core then calculates the negative of each pixel and then routes the converted pixels back to L3 memory.
Input images
Output images
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 write a kernel to perform the above functionality and distribute the functionality in multiple cores.








Comments