§10.1 moved compute near the memory. Processing in memory processing in memory Performing MACs inside the weight memory itself: inputs drive word lines, storage elements multiply, bit lines accumulate; only results are read out (PIM / in-memory computing). defined in ch. 10 — open in glossary (PIM, also “in-memory computing”) goes further: it moves the compute into the memory that stores the weights. This page covers the general PIM architecture — the crossbar model that every later subsection builds on — and its first technology instantiation, non-volatile memories.
Conventional vs in-memory — what stops moving
DNN processing can be phrased as matrix–vector multiplication (the full book’s Chapter 4 shows FC layers as one big matrix–vector product, and CONV layers reduced to it via the Toeplitz expansion — glossed here where needed). In a conventional design, both operands travel: the input-activation vector and the weight matrix are read from their memories into a MAC array. The number of weights readable at once is capped by the memory interface (read-out logic, ports) — capping operations per cycle, and with it throughput.
PIM’s move (Figure 10.2): put the compute inside the weight memory — weights are never read out. Only the inputs flow in and only computed results (partial sums or output activations) flow out. Two wins:
- Weight movement disappears — the cost of reading the A×B weight matrix is gone.
- Weight bandwidth explodes — parallel access is no longer limited by the memory interface; in theory the whole matrix participates at once.
The crossbar: Figure 10.3, live
The typical PIM design is a weight-stationary dataflow dataflow The order of operations and where data is stored and reused in a DNN accelerator; determines how often each piece of data moves. defined in ch. 3 — open in glossary : weights sit still, inputs stream past them. Word lines (WLs) word line The row wire of a memory array; in processing-in-memory it delivers the input activation (voltage or pulse train) to every storage element in the row (WL). defined in ch. 10 — open in glossary deliver the input activations to the storage elements; bit lines (BLs) bit line The column wire of a memory array; in processing-in-memory it accumulates per-cell products (current or charge) into a partial sum read by the ADC (BL). defined in ch. 10 — open in glossary collect the computed partial sums. Each storage element performs a multiplication; the accumulation across all elements on a column happens on the wire. An array of B rows × A columns can, in theory, use all A×B weights simultaneously: A dot products of B elements — A×B MACs — in one cycle. Step it yourself (the numbers are the book’s own toy example from Figure 10.7):
B = CHW = 4 rows, A = M = 4 columns: one cycle computes all 16 MACs, yielding the psum vector [7, 13, 10, 5]. Later (10.2.4) the same lab reruns with realistic limits — watch this 1 cycle become 12.
Three more properties of this array, from the book:
- Input reuse for free: each input activation on a word line reaches all A columns — up to A-fold reuse without re-reading the input.
- Tiny “MACs”: a storage element is 10–100× smaller in area (3–10× in edge length) than digital MAC logic, so the wires that deliver inputs are shorter — less routing capacitance, cheaper input delivery.
- Converters at the edges: depending on input/output formats, DACs dac Digital-to-analog converter — in PIM it drives inputs onto word lines; its cost scales with input precision, hence 1-bit DACs plus time coding in practice. defined in ch. 10 — open in glossary drive the word lines (cost scales with input precision) and ADCs adc Analog-to-digital converter — in PIM it resolves the accumulated bit-line value. Its bit count, area (pitch-matching), power, and thermal noise are the central peripheral bottleneck. defined in ch. 10 — open in glossary resolve the bit lines (cost scales with psum precision, which grows with weight/input precision and with B, the number of values accumulated).
Aside — the ADC’s thermal-noise tax (book footnote 5)
An N-bit ADC must place 2N−1 decision boundaries. Thermal noise (∝ kT/C of its sampling capacitor) jiggles those boundaries dynamically and randomly — degrading the DNN’s accuracy, not just signal quality. Low-noise ADCs cost power and area, so ADC design is a genuine three-way trade (power / area / accuracy) that the book insists should be included when reporting PIM accuracy.
The same machine as a loop nest
The full book (its Chapter 5) writes dataflows as loop nests —
parallel-for loops run spatially (all iterations at once, in hardware),
plain for loops run temporally (one iteration per cycle). An FC layer
with M output channels and inputs flattened to length CHW becomes
Design 20 — note there is no temporal loop: everything happens in
one cycle.
i = Array(CHW) # input activations
f = Array(M, CHW) # filter weights
o = Array(M) # output partial sums
parallel-for m in [0, M):
parallel-for chw in [0, CHW):
o[m] += i[chw] * f[m, chw]
Mapping constraints: A ≥ M (a column per output channel) and
B ≥ CHW (a row per input element). When they don’t hold with
equality, part of the array idles — the under-utilization story of
10.2.4. A 1-D convolution (Design 21) adds one
temporal loop over output positions q; each cycle uses all M×S×C
weights, reuses each input activation C×S times, and accumulates M
psums — with the same input value delivered again for different qs (the
Toeplitz-expansion effect: convolution re-reads shifted input windows):
i = Array(C, W) # input activations
f = Array(M, C, S) # filter weights
o = Array(M, Q) # output partial sums
parallel-for m in [0, M):
parallel-for s in [0, S):
parallel-for c in [0, C]:
for q in [0, Q): # temporal — Q cycles
w = q + s
o[m, q] += i[c, w] * f[m, c, s]
Constraints here: A ≥ M and B ≥ C × S.
10.2.1 Non-volatile memories: physics does the MAC
NVM brings the density argument: storage-plus-compute packed at roughly DRAM density, dense enough to hold entire models and replace off-chip memory. The storage elements are programmable resistive devices — memristors memristor A programmable resistive NVM element: conductance G encodes a weight, so Ohm's law I = V·G multiplies and Kirchhoff current summing accumulates. defined in ch. 10 — open in glossary (as cross-point elements they can even sit at wire crossings without an access transistor).
The multiplication is Ohm’s law; the accumulation is Kirchhoff’s current law — the current-based approach current-based pim PIM style that multiplies via device I-V characteristics and accumulates by current summing on the bit line (NVM, 6T SRAM); sensitive to nonlinearity and variations. defined in ch. 10 — open in glossary :
| term | meaning | units | dictated by |
|---|---|---|---|
| word-line voltage — encodes input activation i | V | input (via DAC) | |
| device conductance (1/resistance) — programmed to the weight | S | stored weight | |
| device current = the product Vi × Gi | A | physics (Ohm) | |
| bit-line current = accumulated partial sum | A | physics (Kirchhoff) |
Worked example: V₁ = 0.6 V on a 40 µS device gives 24 µA; V₂ = 0.3 V on 80 µS gives 24 µA; the bit line carries their sum, 48 µA — a two-element dot product with zero transistors of arithmetic. Flash-based NVM does the same via the floating-gate transistor: the weight sets the threshold voltage V_T, and the device’s I–V characteristics produce I_DS(V_GS, V_T); currents again sum on the bit line.
Figure 10.4(b)/(d), recreated: the two ways a device’s I–V curve encodes a weight — as the slope (resistive LRS/HRS states) or as a threshold shift (floating gate).
NVM’s three unique challenges
- Writes are expensive. Programming memristors costs far more than SRAM/DRAM writes — so designs hold all weights resident rather than swapping per layer (the book likens it to FPGA designs like Brainwave and FINN that pin weights at synthesis). Chapter 3’s flexibility flexibility The range of DNN models a processor supports — functionally (tier 1) and while maintaining efficiency (tier 2). defined in ch. 3 — open in glossary warning applies: model size becomes bounded by array capacity.
- Devices vary and bend. Device-to-device and cycle-to-cycle variations plus nonlinear conductance limit precision to 1–4 bits per device and shape the signaling: instead of encoding inputs as voltage amplitudes, many designs encode them in time — pulse-width modulation pulse-width modulation Encoding an input activation in time at fixed voltage (unary pulses) so a 1-bit DAC suffices; robust to nonlinearity, but costs cycles. defined in ch. 10 — open in glossary at fixed voltage (unary coding), integrating current on a capacitor.
- No negative resistance. Signed weights need differential signaling — two storage elements (often two whole arrays) per weight — or must be avoided: binary weights as [0,1] with XNOR (or NAND) logic replacing multiplication (reduced-precision tricks from the full book’s Chapter 7).
| Device | Traded properties | |
|---|---|---|
| PCRAM | phase-change RAM | endurance · retention · write current · density · variation · speed |
| RRAM / ReRAM | resistive RAM | same six axes |
| CBRAM | conductive-bridge RAM | same six axes |
| STT-MRAM | spin-transfer-torque magnetic RAM | same six axes |
The book points to in-depth treatments of how these device properties affect DNN processing — and notes work that flips the problem: design the device so it suits DNN processing (including in-place, parallel weight updates for training).
Simulation vs silicon — the reality gap
NVM-PIM results split sharply. Simulated designs demonstrate large models (VGG-class on ImageNet) and assume all 128–256 rows activate simultaneously. Fabricated test chips demonstrate MNIST-scale digit classification, activate at most ~32 rows (process variations, read-out/ADC limits), and use one bit per memristor. Read every PIM headline with §3.7’s test-setup checklist in hand.
Design takeaway
PIM trades the interface bottleneck for an analog computing problem: the multiply is a device property, the add is a wire law, and every non-ideality (variation, nonlinearity, noise) now lands directly on DNN accuracy. The next two pages instantiate this in SRAM and DRAM; 10.2.4 prices the whole bargain.
Check yourself
Check yourself — PIM Fundamentals & NVM
1.What data does a processing-in-memory architecture avoid moving, compared to a conventional design?
2.In the weight-stationary PIM array (Fig. 10.3), a MAC's multiply and accumulate map onto which physical elements?
3.How does a memristor perform a multiplication?
4.Why do NVM-based PIM designs typically require the memory to hold ALL of the DNN model's weights at once?
5.NVM devices cannot have negative resistance. Predict how signed weights are supported.
6.What gap does the book highlight between simulated and fabricated NVM-PIM results?