Abstract
Optimizing the execution of Deep Neural Networks (DNNs) on mobile and embedded hardware is a critical challenge in modern computer vision. Convolutional layers, which constitute the majority of the computational workload, can be implemented using various algorithms, each with distinct performance characteristics depending on the input dimensions and hardware constraints. This paper explores a data-driven approach to algorithm selection, replacing traditional manual heuristics with machine learning classifiers. By training Decision Trees and Naive Bayes models on thousands of performance benchmarks, we demonstrate that simple "white-box" models can significantly outperform the ARM Compute Library's default selection logic, achieving speedups of up to 3x on mobile GPUs.
Introduction
Convolution is the most computationally expensive operation in a Convolutional Neural Network (CNN). To mitigate this cost, hardware libraries provide multiple implementation strategies, such as Direct convolution, Winograd-based approaches, and General Matrix Multiplication (GEMM/Image-to-column). However, there is no universal "best" algorithm; the optimal choice depends on a complex interplay of input width, height, channel depth, kernel dimensions, stride, and padding.
Standard industry libraries, such as the ARM Compute Library (ACL), typically rely on manual heuristics or basic auto-tuners to select an algorithm at runtime. These static rules often fail to account for the diverse data structures found in modern architectures, leading to suboptimal performance. This research proposes a methodology to automate this selection process using supervised learning, treating algorithm selection as a classification problem.
Methodology
The authors propose a three-step workflow to develop and integrate a predictive performance model:
1. Dataset Generation
To build a robust training set, the authors utilized the NNTest library to conduct over 4,000 experiments. These benchmarks measured the execution time of three primary convolution implementations—Direct, Winograd, and GEMM—across a vast array of artificial CNN layer shapes. This exhaustive benchmarking created a ground-truth dataset mapping specific tensor configurations to the fastest available algorithm.
2. Model Training
The study focused on "white-box" supervised classifiers to ensure the resulting logic remained interpretable for developers:
- Decision Tree (DT): This model generates a flowchart-like structure, making decisions based on input features to categorize which algorithm will yield the lowest latency.
- Naive Bayesian Classifier (nBC): A probabilistic model that calculates the likelihood of an algorithm being the optimal choice based on the distribution of parameters in the training data.
The features used for training included input dimensions (width/height), the number of input and output channels, kernel size, stride, and padding.
3. Evaluation Framework
The trained models were integrated into a performance modeling workflow and tested against real-world workloads. The evaluation focused on two prominent architectures: Inception v3 (66 convolution layers) and MobileNets (15 convolution layers), running on an ARM Mali-T860 GPU (Midgard architecture).
Key Insights
The "No Free Lunch" Theorem of Convolutions
The experimental data reinforces that no single algorithm dominates the performance landscape. While Winograd is frequently the fastest choice for 3x3 kernels, it can be outperformed by GEMM or Direct methods on specific tensor shapes or when memory constraints become a factor. The complexity of these trade-offs is what makes manual heuristic design so difficult for human engineers.
The Efficacy of Simple Models
A significant finding of this work is that complex Deep Learning models are not required to optimize Deep Learning performance. Simple Decision Trees proved highly effective. Because these are white-box models, developers can inspect the decision nodes to understand the underlying logic, providing a level of transparency that neural network-based tuners lack.
Surpassing Vendor Heuristics
The primary takeaway is that manual selection logic provided by hardware vendors is often too conservative. By using a learning-based model, the system can identify "pockets" of performance—specific configurations where a non-obvious algorithm choice leads to significant gains—that are typically missed by static rules.
Results
The experimental results demonstrate a clear advantage for the machine learning approach over standard library heuristics:
- Classification Accuracy: The Decision Tree model was exceptionally accurate, achieving 100% accuracy in selecting the optimal method for MobileNets and ~97% accuracy for the more complex Inception v3.
- Performance Gains: The predictive models consistently outperformed the ARM Compute Library’s default selections. In specific layer configurations, the authors observed speedups of up to 3x.
- Proximity to the Oracle: When compared to an "Oracle" ( a theoretical model that always picks the fastest possible algorithm), the Decision Tree's performance was nearly identical. This suggests that the model has effectively "solved" the algorithm selection problem for the target hardware.
Discussion and Future Work
While the results are promising, the authors identify several areas for further development. The most significant bottleneck is the cost of data collection; running 4,000+ benchmarks is time-consuming and must be repeated for every new GPU architecture. Future research may look toward Reinforcement Learning to automate and optimize the exploration of the parameter space, reducing the number of benchmarks required to train an accurate model.
Additionally, while the current study focused on the ARM Mali-T860, further testing is needed to determine how well these models generalize to newer architectures like Bifrost or Valhall. Integrating these predictive models directly into Just-In-Time (JIT) compilers could also provide a more seamless experience for developers, allowing for transparent, hardware-specific optimizations at runtime.
Summary updated