Deep learning (DL) applications have unique architectural characteristics and efficiency requirements. Hence, the choice of computing system has a profound impact on how large a piece of the DL pie a user can finally enjoy. Even though accelerators may provide higher throughput than general-purpose computing systems (CPUs), there are several other metrics and usage scenarios on which CPUs are preferred or are superior. A recent survey paper I’ve coauthored with Poonam Rajput and Sreenivas Subramoney (A Survey of Deep Learning on CPUs: Opportunities and Co-optimizations) highlights the strengths of CPUs in DL, and identifies opportunities for further optimization.
CPU has its forte, and accelerator is not a panacea
Sparse DNNs are inefficient on massively parallel processors because of their irregular memory accesses and inability to leverage optimizations such as cache tiling and vectorization. Further, RNNs are difficult to parallelize due to the dependencies between the steps. Similarly, DNNs such as InceptionNet variants have filter shapes of 1×1, 3×3, 1×3, 3×1, etc., which lead to irregular memory accesses and variable-amount of parallelism across the layers. CPUs are more suitable for such applications with limited parallelism because of their advanced memory management techniques. For example, researchers from Rice University have shown that for fully connected networks over sparse datasets such as Amazon-670K, and Delicious-200K, the DL training problem can be modeled as a search problem. This allows replacing matrix multiplication operation with hash tables. Their technique on CPU provides higher performance than a TensorFlow-based implementation on GPU.
3D CNNs and even 2D CNNs with large batch-size require a massive amount of memory. Since CPU-managed hosts in the cloud and datacenter scenarios have much larger memory capacities than accelerators, running memory-hungry operations on CPUs is not merely attractive but often imperative. Accelerators such as TPU provide high throughput for large batch size; however, for applications requiring real-time inference, the use of large batch size is not preferred. At small batch sizes, CPUs generally provide competitive latency. There are a host of techniques that can be applied to further tune the DL applications on CPUs, for example, hardware-aware pruning, vectorization, cache tiling and approximate computing. Our survey paper summarizes many such techniques.
Across the board: From tiny wearables to large datacenters
IoT devices and wearables have tight power and area budgets, which precludes over-specialization. For example, a smartwatch chip cannot host separate accelerators for speech/audio/image/video processing. In smartphones running Android, the programming support for mobile GPU or DSP is not fully mature. In fact, on a typical mobile SoC, the theoretical peak performance of mobile CPUs equals that of mobile GPUs. Further, datacenters supporting web services such as social networks see a significant fluctuation in computing demand over time. CPUs can meet this variability in demand due to their high availability and efficiency for both DL and non-DL tasks. Finally, in extreme environments such as defense and medical, which require security certifications, CPUs are sometimes the only platform of choice.
Not missing the obvious: economy and ease of use
Accelerators require long design cycles and massive investment. Integrating them into existing ecosystems requires high costs and engineering work. By contrast, the hardware/software stack of CPUs is already well-established and understood. They can provide reasonable speedups on a broad range of applications. While large-scale companies have the resources to build and maintain their custom accelerators, CPUs (or GPUs) remain the most feasible platform for other companies.
Future outlook: brighter than you think
Going forward, merely increasing peak performance will not be sufficient; more revolutionary improvements are required to boost the performance of a broad range of DL applications, such as reinforcement learning and generative adversarial networks. Recent CPUs have begun to provide hardware support for low-precision computing. Once in-memory computing reaches maturity, the large caches of CPUs would turn into massive compute units. Development of open-source ISA such as RISC-V would further break the portability and proprietary barriers of accelerators.
The metrics of interest are numerous and varied, and so are the state-of-the-art DL models. We believe that instead of a “general-purpose processor versus accelerator” debate, the future will see a CPU-accelerator heterogeneous computing approach that brings together the best of both worlds.
About the Author
Dr. Sparsh Mittal is currently working as an assistant professor at IIT Roorkee, India. He received the B.Tech. degree from IIT, Roorkee, India and the Ph.D. degree from Iowa State University (ISU), USA. He has worked as a Post-Doctoral Research Associate at Oak Ridge National Lab (ORNL), USA and as an assistant professor at CSE, IIT Hyderabad. He was the graduating topper of his batch in B.Tech and his BTech project received the best project award. He has received a fellowship from ISU and a performance award from ORNL. He has published more than 90 papers at top venues. He is an associate editor of Elsevier’s Journal of Systems Architecture. He has given invited talks at ISC Conference at Germany, New York University, University of Michigan and Xilinx (Hyderabad).