Abstract
While on-device inference has become a standard feature in mobile applications, on-device training remains a significant bottleneck. This paper investigates the feasibility of leveraging mobile GPUs for the training phase of Deep Neural Networks (DNNs). Using the Mobile Neural Network (MNN) framework and OpenCL-based optimizations, we demonstrate a critical paradox: while GPU compute kernels can be optimized to outperform mobile CPUs by over 2x in raw floating-point operations, the end-to-end training process on the GPU is up to 15x slower than on the CPU. Our analysis identifies data movement between system memory and the GPU as the primary bottleneck, accounting for over 90% of total execution time.
1. Introduction
The deep learning community has successfully optimized DNN inference for mobile devices through techniques such as quantization, pruning, and hardware-specific acceleration. However, on-device training—which is essential for preserving user privacy and enabling real-time personalization—has been largely neglected. Currently, mobile developers face a technical hurdle: smartphones contain powerful GPUs designed for parallel workloads, yet popular frameworks like TensorFlow Lite and PyTorch Mobile primarily optimize for inference or default to the CPU for training tasks. This study explores whether it is feasible to leverage mobile GPUs via OpenCL to outperform mobile CPUs during both the forward and backward passes of training.
2. Methodology
2.1 Framework and Backend
The researchers utilized the MNN (Mobile Neural Network) framework, an open-source project known for its efficient OpenCL backend. The investigation was conducted in three distinct stages: baseline analysis, kernel optimization, and detailed profiling.
2.2 Kernel Optimization Techniques
To address computational bottlenecks, the OpenCL matrix multiplication (SGEMM) kernels were optimized using two primary strategies:
- Tiling: This technique leverages local memory (shared among work items) to cache portions of input matrices. By doing so, the system reduces redundant loads from global memory, which is a common source of latency in mobile GPU architectures.
- Vectorization: The researchers employed vector data types (e.g.,
float4) to align with the 32-byte cache lines of mobile GPUs. This maximizes spatial locality and ensures that the hardware's SIMD (Single Instruction, Multiple Data) capabilities are fully utilized.
2.3 Profiling and Benchmarking
Performance was measured using the OpenCL profiler and hardware-level GPU timers. This allowed the team to decompose execution time into "actual computation" versus "data movement," providing a clear view of where the time was spent during the training cycle.
3. Experimental Setup
3.1 Datasets and Models
- MNIST: This served as the primary benchmark for end-to-end training of feed-forward neural networks.
- Synthetic Randomized Matrices: To isolate the effects of layer architecture from specific dataset constraints, synthetic matrices were used to test varying widths and depths of neural network layers.
3.2 Hardware
The experiments were conducted on Snapdragon 8 series processors, specifically the Adreno 630 (OnePlus 6) and the Adreno 650 (OnePlus 8 Pro), to determine if architectural improvements in newer chips mitigated the observed bottlenecks.
4. Key Insights and Results
4.1 The GFLOPS Illusion
The optimization efforts were successful in terms of raw math. The optimized GPU kernels reached performance levels of 40–70 GFLOPS, significantly outperforming the CPU's 15–30 GFLOPS. However, this computational advantage did not translate to faster training times.
4.2 The Memory Wall
On mobile architectures, the GPU and CPU typically share system memory. Despite this shared physical space, the bandwidth available to the GPU for the frequent data transfers required during training (such as updating weights and gradients) is a massive bottleneck. Profiling revealed that data movement accounted for approximately 91% of the total training time.
4.3 End-to-End Performance
Despite the 2x speedup in raw compute kernels, full DNN training on the GPU was 10–15x slower than on the CPU. It takes significantly longer to copy data to and from the GPU than it does to perform the actual training calculations. This phenomenon is a classic illustration of Amdahl’s Law: because the non-computational part of the task (data movement) is so dominant, doubling the speed of the computational part has a negligible impact on the total wall-clock time.
5. Conclusion and Future Work
Our findings suggest that current mobile GPU architectures and software frameworks are not yet optimized for the iterative, data-heavy nature of model training. The performance gap is not a result of poor compute power, but rather a fundamental architectural challenge regarding memory bandwidth and data transfer overhead.
Future research should focus on:
- Zero-Copy Memory: Investigating unified memory architectures that allow the GPU to access data without explicit, high-latency transfers.
- Expanded Layer Support: Extending the study to Convolutional Neural Networks (CNNs), which are more computationally intensive and may yield different bottleneck profiles.
- Full-Stack Optimization: Moving other training components, such as optimizers (SGD, Adam) and activation functions, entirely onto the GPU to minimize the frequency of data round-trips to the CPU.
Summary updated