Enabling Highly Efficient Capsule Networks Processing Through A PIM-Based Architecture Design

Xingyao Zhang, Shuaiwen Leon Song, Chenhao Xie, Jing Wang, Weigong Zhang, Xin Fu

TL;DR

Capsule Networks (CapsNets) offer a significant accuracy boost over traditional CNNs by preserving spatial relationships, but their "dynamic routing" mechanism creates a massive computational bottleneck on modern GPUs. This paper proposes PIM-CapsNet, a hybrid architecture that offloads data-intensive routing tasks to 3D-stacked Processing-In-Memory (PIM) hardware, achieving a 2.44x speedup and 64.91% energy savings with negligible accuracy loss.

What Problem Does This Paper Address?

While Convolutional Neural Networks (CNNs) are the workhorses of computer vision, they have a fundamental flaw: pooling operations. Pooling achieves "translational invariance" by throwing away precise positional information. This makes CNNs struggle with object pose, rotation, and complex spatial hierarchies (e.g., knowing that a face is only a face if the eyes are above the mouth).

Capsule Networks (CapsNets) solve this by replacing neurons with "capsules" that output vectors representing both the probability of an entity's existence and its physical properties (pose, size, etc.). However, CapsNets rely on an iterative Routing Procedure (RP) to decide how information flows between layers.

The authors identify that on modern GPUs, this RP accounts for nearly 75% of total inference time. The bottleneck isn't raw math; it's the "Memory Wall." The RP generates massive amounts of intermediate data that cannot be shared across batches and far exceeds the GPU’s on-chip cache, leading to constant, energy-draining off-chip memory accesses and synchronization stalls.

Methods

The authors propose a hybrid computing engine called PIM-CapsNet. The core idea is to let the GPU do what it’s best at (standard matrix operations in Conv and Fully-Connected layers) while pipelining the problematic Routing Procedure to a specialized Processing-In-Memory (PIM) solution.

Key Innovations:

  1. HMC-Based Design: They utilize the Hybrid Memory Cube (HMC), a 3D-stacked memory technology. By integrating logic directly into the HMC’s logic layer, they can process data right where it lives, bypassing the narrow bus between the processor and memory.
  2. Hierarchical Optimization:
    • Inter-Vault Level: They developed a "Guiding Distribution" strategy using an Execution Score. This score helps the compiler decide whether to parallelize the workload across batches, low-level capsules, or high-level capsules to minimize data movement between the HMC's 32 "vaults."
    • Intra-Vault Level: Each vault contains 16 specialized Processing Elements (PEs). To keep the hardware simple and low-power, they use bit-shifting approximations for complex functions like squash (inverse square root) and softmax (exponential functions), followed by a small "accuracy recovery" multiplication.
  3. Memory Access Scheduling (RMAS): Since both the host GPU and the PIM units need to access memory, the authors designed a runtime scheduler to dynamically prioritize requests, preventing the GPU from stalling while the PIM units are working.

Datasets

The architecture was evaluated using 12 different CapsNet configurations across four standard computer vision datasets:

  • MNIST: Handwritten digits.
  • CIFAR10: Common objects (planes, cars, birds, etc.).
  • EMNIST: A larger set of handwritten letters and digits (Balanced and ByClass splits).
  • SVHN: Street View House Numbers.

These datasets were used to test how the design scales with increasing network complexity and batch sizes.

Key Insights and Ideas

  • The Bottleneck is Data, Not Flops: Runtime profiling revealed that while GPU arithmetic units were only 38.6% utilized during routing, the load/store units were at 85.9%. This confirmed that the "routing tax" is a memory movement problem.
  • Approximation is "Good Enough": One of the most elegant parts of the paper is the realization that neural networks are inherently resilient to small errors. By using bit-manipulation to approximate the exp() function, they reduced hardware complexity significantly without hurting the final classification accuracy.
  • Pipelining the Hybrid: By treating the GPU and PIM as a pipeline, the GPU can start processing the next batch's convolutional layers while the PIM unit is still finishing the routing for the current batch.

Key Results

The authors used cycle-accurate simulators (HMC-sim) and gate-level simulations (Cadence) to measure performance:

  • Performance: PIM-CapsNet achieved an average 2.44x speedup (up to 2.76x) over a baseline NVIDIA Tesla P100 GPU.
  • Energy Efficiency: It reduced energy consumption by an average of 64.91% (up to 85.16%).
  • Accuracy: The hardware approximations resulted in a negligible 0.04% average accuracy difference across all benchmarks.
  • Scalability: Unlike GPUs, where the routing bottleneck gets worse as the network grows, PIM-CapsNet showed better performance gains as the capsule count increased.

Limitations and Future Work

  • Simulation vs. Silicon: The results are based on high-fidelity simulations. While the area and thermal overheads were calculated (occupying only 0.32% of the HMC logic surface), real-world thermal management in 3D-stacked memory remains a challenge.
  • Algorithm Specifics: The paper focuses on "Dynamic Routing." While the authors suggest the design is generalizable to other methods like "EM Routing," those algorithms might require different specialized logic in the PEs.
  • Future Direction: The authors suggest that this PIM-based approach could be extended to other emerging non-CNN architectures that suffer from similar memory-intensive bottlenecks.

Summary updated

BibTeX
@inproceedings{zhang2020enabling,
  author = {Xingyao Zhang and Shuaiwen Leon Song and Chenhao Xie and Jing Wang and Weigong Zhang and Xin Fu},
  title = {{Enabling Highly Efficient Capsule Networks Processing Through A PIM-Based Architecture Design}},
  booktitle = {HPCA},
  year = {2020},
  doi = {10.1109/hpca47549.2020.00051},
}
Figure