Compute in Memory Explained: Doing Math Where Data Lives

AI accelerators spend most of their energy ferrying weights from memory to compute units and back, a commute that dwarfs the math itself. Compute-in-memory eliminates the trip: perform multiply-accumulate operations directly inside memory arrays, using the physics of the storage cells as the arithmetic. Weights stay put; only inputs arrive and results leave. This article explains how memory learned to think.

The Memory Wall That Math Cannot Climb

A 32-bit multiply-add costs picojoules; fetching its operands from DRAM costs hundreds of times more. Neural networks, dominated by matrix multiplications over millions of weights, feel this imbalance brutally: data movement, not computation, sets both energy and throughput limits. Architects fight back with caching hierarchies and data reuse, but each level adds area and complexity while the fundamental commute persists.

Compute-in-memory inverts the burden. If weights live in the array and inputs arrive along wordlines, physics can produce dot products where the data already sits. The energy savings are potentially hundredfold for inference workloads, with throughput scaling by array parallelism. The catch, as always, is precision, programmability, and the analog devilry of real circuits.

How Analog MAC Works in Memory Arrays

The core trick exploits Ohm’s and Kirchhoff’s laws. In an SRAM-based array, inputs drive wordlines while stored bits gate pull-down paths; in resistive arrays, inputs apply voltages across programmable conductances. Each column sums currents from all rows simultaneously, physically computing a dot product in one step. Hundreds of rows firing at once deliver massive parallelism with minimal data movement.

Weights program as conductance states: high conductance for large weights, low for small. Multi-bit weights need multi-level cells or bit-sliced arrays combining binary cells digitally. Inputs arrive as voltages or pulse widths; outputs emerge as analog currents requiring conversion back to digital. The array is simultaneously memory and math unit, blurring a boundary sacred since von Neumann.

SRAM vs. Emerging Memories for CIM

SRAM-based compute-in-memory builds on standard CMOS: modified bitcells with extra transistors for multiplication, manufactured in any logic fab with digital-friendly flows. Density suffers from the added devices, and volatility means weights reload at boot, but manufacturability is proven and design tools adapt readily. Several commercial edge-AI chips already ship SRAM CIM macros.

Resistive memories promise denser, non-volatile alternatives: ReRAM, phase-change, and MRAM cells storing weights as conductance without power, surveyed in our emerging memories guide. Density soars and standby power vanishes, but device variation, drift, and limited endurance complicate analog precision. The contest pits SRAM’s maturity against resistive memories’ potential, with both advancing rapidly.

The ADC Bottleneck

Analog computation’s dirty secret is conversion cost. Each column’s analog sum must be digitized for downstream digital logic, and analog-to-digital converters resolving fine current differences consume significant area and power, potentially devouring the array’s savings. Low-precision ADCs quantize coarsely, injecting noise that degrades model accuracy; high-precision ones cost more than the compute they serve.

Architects balance ruthlessly: fewer ADCs shared across columns through multiplexing (sacrificing throughput), low-bit conversions matched to quantized models, and clever schemes pushing partial sums digitally. Co-designing models with hardware tolerances, training networks robust to analog noise, recovers much of the loss. The ADC bottleneck, not the array physics, often decides whether CIM wins.

Precision, Variation, and Real-World Limits

Analog computing inherits analog fragility. Device mismatch skews weights unpredictably; temperature drift shifts conductances; noise accumulates through deep networks. Digital accelerators guarantee bit-exact math; CIM arrays approximate, and the approximation must stay within model tolerance. Careful calibration, redundant columns, and variation-aware training contain the damage, but 8-bit-equivalent precision remains challenging and floating point is out of reach.

Workload fit matters equally. CIM excels at dense matrix inference with static weights: vision models, keyword spotting, recommendation scoring. Training, with its constantly updating weights and precision demands, stays digital. Sparse and irregular workloads map poorly onto rigid arrays. Like the spiking systems in our neuromorphic overview, CIM wins specific battles rather than the war.

Where CIM Ships and Where It’s Headed

Commercial traction concentrates at the efficient edge: always-on vision and audio chips where microwatts matter more than flexibility, with SRAM macros from multiple vendors in shipping products. Research prototypes push resistive arrays toward larger models and datacenter inference, while foundries develop CIM-ready memory options on advanced nodes. Standards for benchmarking analog AI hardware are emerging to compare claims honestly.

The trajectory points toward heterogeneous tiles: digital accelerators for training and general math alongside CIM arrays for efficient inference, composed per workload. Memory that computes will not replace processors, but the commute it eliminates was always pure overhead. Doing math where data lives is an idea whose time keeps arriving.

Near-Memory: The Pragmatic Middle Ground

Between distant processors and true in-memory math lies near-memory computing: small digital engines embedded beside memory banks, slashing movement without analog risk. High-bandwidth memory stacks host logic layers running simple operations; processing-in-DIMM products accelerate database scans and encryption at the module. The gains are modest versus analog CIM but the designs are robust, digital, and shippable today.

Many architects view near-memory as the stepping stone: prove the programming models and workloads with digital logic near arrays, then migrate hot kernels into analog CIM as maturity allows. Pragmatism ships products while revolution brews. The memory wall falls by degrees, not all at once.

Computing Where Data Lives

Compute-in-memory turns physics into arithmetic: currents summing dot products inside SRAM and resistive arrays, weights unmoving, energy collapsing hundredfold for the right workloads. ADC costs, analog precision, and workload fit bound the dream, but shipping products prove the concept. The memory wall stands; CIM simply computes on the other side of it.

Comments

Leave a Reply

Your email address will not be published. Required fields are marked *