Skip to main content
QUICK REVIEW

[Paper Review] Softmax Optimizations for Intel Xeon Processor-based Platforms

Jacek Czaja, Michal Gallus|arXiv (Cornell University)|Apr 28, 2019
Parallel Computing and Optimization TechniquesComputer Science9 references3 citations
TL;DR

This paper presents a multi-faceted optimization strategy for the softmax function on Intel Xeon processor-based platforms, focusing on inference workloads. By removing unnecessary clipping, leveraging Intel MKL and MKL-DNN, improving vectorization via OpenMP and hand-optimized assembly, and applying algorithmic simplifications, the authors achieve a 2x speedup in softmax execution and over 15% improvement in the overall Deep Attention Matching (DAM) model performance.

ABSTRACT

Softmax is popular normalization method used in machine learning. Deep learning solutions like Transformer or BERT use the softmax function intensively, so it is worthwhile to optimize its performance. This article presents our methodology of optimization and its results applied to softmax. By presenting this methodology, we hope to increase an interest in deep learning optimizations for CPUs. We believe that the optimization process presented here could be transferred to other deep learning frameworks such as TensorFlow or PyTorch.

Motivation & Objective

  • To improve softmax inference performance on Intel Xeon processors, particularly in NLP workloads where softmax is computationally intensive.
  • To identify performance bottlenecks in the existing PaddlePaddle implementation using profiling techniques.
  • To explore algorithmic, library-based, and low-level optimizations for maximum performance gains on x86-64 architectures.
  • To evaluate whether further optimization is feasible by comparing softmax performance against memory-bound limits like memcpy.
  • To contribute optimized implementations back to the open-source ecosystem, specifically to Intel MKL-DNN.

Proposed method

  • Removed the ValueClip functionality in the softmax implementation, which was unnecessary for inference, reducing execution time by 5%.
  • Used PaddlePaddle’s built-in profiler to identify hotspots, focusing on the exponential function and maximum reduction as performance-critical components.
  • Replaced the Eigen-based implementation with optimized libraries, including Intel MKL and Intel MKL-DNN, for better numerical performance and vectorization.
  • Improved vectorization by applying OpenMP for parallelism and manually coding assembly kernels using Xbyak for the max-finding and exponential operations.
  • Evaluated performance limits using memcpy as a memory-bound baseline to determine if further optimization was feasible.
  • Applied the Roofline model conceptually to assess potential performance gains, though not formally applied in this work.

Experimental results

Research questions

  • RQ1What are the primary performance bottlenecks in the standard softmax implementation on Intel Xeon processors during inference?
  • RQ2How much performance gain can be achieved by combining algorithmic simplifications, optimized libraries, and low-level vectorization?
  • RQ3To what extent is the softmax operation limited by memory bandwidth, and is further optimization still viable?
  • RQ4Can hand-optimized assembly code provide measurable performance improvements over high-level library implementations?
  • RQ5How does the optimized softmax impact the end-to-end performance of a full deep learning model like the Deep Attention Matching (DAM) model?

Key findings

  • Removing the ValueClip optimization reduced execution time by 5% without affecting inference accuracy.
  • The exponential function computation was identified as a major performance bottleneck, consuming a significant portion of the total time.
  • Using Intel MKL and MKL-DNN for softmax operations led to substantial performance improvements, with the final optimized implementation achieving a 2x speedup over the baseline.
  • The overall Deep Attention Matching (DAM) model performance improved by over 15% due to the optimized softmax implementation.
  • The optimized softmax implementation was found to be far from the memory-bound limit, indicating that further performance gains through compute optimization are feasible.
  • The authors successfully upstreamed their optimizations to the Intel MKL-DNN library, enhancing the availability of high-performance softmax for the broader deep learning community.

Read this paper

Open the full text in the Nubint reader and ask about any passage as you read.

Read this paper on Nubint

This review was generated by AI from the original paper. Please check the paper before citing it.