6.5.5Advanced & Emerging Architectures

Processing-in-memory (PIM)

1,880 words9 min readdifficulty · medium

WHY does PIM exist? (The problem it kills)

The energy story is even worse. Moving one bit across the chip costs far more energy than doing the math on it:

WHAT is PIM?

HOW does it help? (Derivation from first principles)

Take a workload that touches NN bytes and does CC compute operations. Total time on a classic von Neumann machine:

TvN=NBmove over bus, bandwidth B+CRcompute at rate RT_{vN} = \underbrace{\frac{N}{B}}_{\text{move over bus, bandwidth } B} + \underbrace{\frac{C}{R}}_{\text{compute at rate } R}

For data-intensive jobs CC is small relative to NN, so TvNN/BT_{vN}\approx N/B: bandwidth-bound.

PIM changes the effective bandwidth. If memory has kk banks each computing locally in parallel, the internal bandwidth BintB_{int} can be much larger than the external bus BB:

Bint=kBbankBB_{int} = k \cdot B_{bank} \gg B

So: TPIMNBint+CR,Speedup=TvNTPIMBintB=kBbankBT_{PIM} \approx \frac{N}{B_{int}} + \frac{C}{R}, \qquad \text{Speedup} = \frac{T_{vN}}{T_{PIM}} \approx \frac{B_{int}}{B} = k\cdot\frac{B_{bank}}{B}


Figure — Processing-in-memory (PIM)

The two big flavors of PIM


Worked example 1 — Is my workload worth PIM-ing? (arithmetic intensity)

Worked example 2 — Speedup estimate


Common mistakes (Steel-manned)


Feynman

Recall Explain to a 12-year-old (click to reveal)

Imagine you're a chef (CPU) and your ingredients are in a warehouse far away (memory). Cooking is fast, but running to the warehouse for every carrot is exhausting and slow. Processing-in-memory is like putting a tiny kitchen inside the warehouse, so you can chop the veggies right where they're stored and only carry the finished dish back. You save a ton of running around — and running around was the tiring part all along.


Active Recall

What problem does PIM primarily attack?
The memory wall — the bandwidth/energy cost of moving data between memory and the processor.
Why is data movement worse than computation, energetically?
Moving a bit across the chip costs ~100–1000× the energy of a single arithmetic op, so movement dominates total energy in data-intensive workloads.
Define arithmetic intensity and its role in PIM.
I = C/N (ops per byte moved); low I means bandwidth-bound and a good PIM candidate; high I means compute-bound and PIM helps little.
Difference between processing-near-memory and processing-using-memory?
PNM puts ordinary logic physically close to memory (e.g., HBM logic die); PUM computes using the analog physics of the memory array itself (e.g., crossbar MVM).
How does a memristor crossbar compute matrix–vector multiply?
Ohm's law gives I=GV per cell; Kirchhoff's current law sums currents per row into a dot product, so I=G·V for the whole matrix in one analog step.
What is the approximate speedup formula for near-memory PIM?
Speedup ≈ B_int / B = k·(B_bank / B), the ratio of internal parallel bandwidth to external bus bandwidth.
Why isn't PIM the same as adding cache?
Cache helps reused (temporal-locality) data on the CPU side; PIM eliminates the trip entirely, helping streaming low-reuse data.
Main downside of analog PUM crossbars?
Results are approximate due to device variation, drift, and ADC/DAC noise — suited to error-tolerant workloads like neural nets.

Connections

Concept Map

motivates

motivates

places compute in memory

bandwidth-bound

unlocks

gives

flavor

flavor

logic on

analog physics of

does

Memory Wall

Processing-in-Memory

Data movement energy 100-1000x compute

Minimize data movement

von Neumann Tvn = N/B + C/R

Internal bandwidth Bint = k x Bbank

Speedup ~ Bint/B

Processing-near-memory

Processing-using-memory

3D-stacked HBM logic die

Memory array e.g. ReRAM crossbar

Matrix-vector multiply in one shot

Hinglish (regional understanding)

Intuition Hinglish mein samjho

Dekho, aaj ke CPU bahut fast hain, lekin data DRAM me door pada hota hai. Har baar number laane ke liye CPU ko ek lambe, slow bus ke through jaana padta hai — aur yahi wait karna sab time kha jaata hai. Isko bolte hain memory wall. Aur mazedaar baat: ek bit ko chip par move karne ki energy, us par calculation karne se ~100 se 1000 guna zyada hoti hai. Matlab problem compute ki nahi, data hilaane ki hai.

Processing-in-Memory (PIM) ka simple idea: data ko CPU tak mat lao, thoda sa computation memory ke andar (ya bilkul paas) le aao. Do flavor hote hain — near-memory (jaise HBM stack ke logic die par chhote ALU) aur using-memory (memory array ki apni physics se compute, jaise memristor crossbar). Crossbar me Ohm's law (I=GVI=GV) aur Kirchhoff se ek hi analog step me poora matrix-vector multiply ho jaata hai — isliye AI accelerators ise pasand karte hain.

Kaunsa workload PIM ke liye achha hai? Bas arithmetic intensity I=C/NI = C/N nikalo — per byte kitne ops. Vector add jaisa low-II kaam bandwidth-bound hota hai, PIM ka bada fayda. Matrix-multiply jaisa high-II kaam compute-bound hota hai, cache already achha karta hai, PIM ka fayda kam. Yaad rakho: PIM ALU ko fast nahi karta, wo data movement kam karta hai — yahi 80/20 wali asli baat hai.

Go deeper — visual, from zero

Test yourself — Advanced & Emerging Architectures

Connections