Mace-cl-compiled-program.bin
When the user runs the MACE-powered app for the first time, the GPU runtime will look for the pre-compiled OpenCL binary in all designated OpenCL binary paths. If the file does not exist (as is the case the first time), the framework will fall back to the original OpenCL kernel source code ( program_file_name ). It then compiles this source code online. The result of this compilation is a device-specific binary.
| Attribute | Value | |-----------|-------| | | MACE (Mobile AI Compute Engine, by Xiaomi) | | Language | OpenCL C (pre-compiled to binary) | | Hardware target | Specific GPU model (e.g., Adreno, Mali, PowerVR) | | Purpose | Accelerate neural network inference on GPU without JIT compilation time | | Portability | None – crashes on different GPU | | Typical location | App’s assets or model cache directory |
// Generate and save the binary mace::MaceStatus status = engine->SaveOptimizedModel("path/to/save", &error_msg); // This saves the compiled OpenCL binary alongside other model files.
When a developer uses the MACE toolchain to compile a model for GPU deployment, the framework will generate OpenCL kernel source code. During the code generation build process ( build_type: code ), MACE has an internal mechanism to compile these kernels and generate the .bin file. A specific commit in MACE's history adds the functionality to "generate opencl kernel binary from source, and create opencl program with binary," marking the introduction of this file. mace-cl-compiled-program.bin
Since you are looking to put together a "proper report" based on this technical artifact, the report should focus on the of an AI model on mobile hardware. 1. Project Overview Framework : Mobile AI Compute Engine (MACE)
This caching mechanism significantly reduces app startup latency and optimizes runtime performance. Why is it on Your Device?
This public link is valid for 7 days and shares a thread, including any personal information you added. This link or copies made by others cannot be deleted. If you share with third parties, their policies apply. Can’t copy the link right now. Try again later. When the user runs the MACE-powered app for
MACE is designed to utilize whatever computing cores are available on a device. It can distribute AI workloads across: (via NEON optimization) GPUs (via OpenCL and Vulkan)
Once generated, the paths to these binaries are linked inside the application's engine initialization routines via the GPUContextBuilder :
| Offset (hex) | Size (bytes) | Typical Content | |--------------|--------------|------------------| | 0x00 | 4 | Magic number (e.g., 0x4D414345 = "MACE") | | 0x04 | 4 | Version (e.g., 0x00010002) | | 0x08 | 8 | Total binary size | | 0x10 | 64 | SHA-256 hash of payload | | 0x50 | 256 | Signature (RSA or ECDSA) | | 0x150 | variable | Compressed/encrypted OpenCL kernel binary | The result of this compilation is a device-specific binary
, it needs to translate complex mathematical AI models into a language your phone's graphics chip understands. Because every phone has a slightly different GPU (Qualcomm Adreno, ARM Mali, etc.), the app "compiles" the model the first time you run it. It then saves that result as mace-cl-compiled-program.bin
By skipping the compilation phase at runtime, the application saves CPU cycles and memory, resulting in a smoother user experience. How is the File Generated?
Because Xiaomi developed MACE, many system applications (like the stock MIUI/HyperOS Camera app or gallery utilities) generate this file.