Menu

Building a Zero-Dependency Edge AI Inference Engine in C/AVX2 + Python
📰

Building a Zero-Dependency Edge AI Inference Engine in C/AVX2 + Python

DEV Community: cpp·Aman Bhawsar·9 days ago
#tOW9IneK
Long article (277 words) — no AI summary yet.
Reading 0:00
15s threshold

Can a standard Intel i5 CPU handle AI inference without an expensive GPU?

I wanted to explore this by building a lightweight Edge-AI inference engine from scratch using C, AVX2 and Python.

My focus was on three challenges: compute efficiency, memory bandwidth and real-world model compatibility.

Bit-Sliced Ternary GEMM

I implemented ternary matrix multiplication using values {-1, 0, +1}.

Instead of traditional floating-point multiplication, the kernel uses bitwise operations and POPCNT.

Benchmark on an Intel i5 CPU:

380 GOP/s achieved

252 GOP/s with standard OpenBLAS in my test

Bit-exact results

Delta-Frame Processing

For static-camera applications such as CCTV, safety monitoring and drones, most pixels often remain unchanged between frames.

I developed a gather-free INT8 delta-frame kernel that processes changed pixels instead of recomputing the entire frame.

In my tested workloads:

14×–124× speedup over the standard float BLAS baseline

Bit-exact results

Testing with Real ONNX Models

I…

Continue reading — create a free account

Join HashtagPLUS to read full articles, follow hashtags, vote, and join the conversation.