Skip to main content
QUICK REVIEW

[Paper Review] Autotuning OpenCL Workgroup Size for Stencil Patterns

Chris Cummins, Pavlos Petoumenos|ENLIGHTEN (Jurnal Bimbingan dan Konseling Islam)|Nov 8, 2015
Parallel Computing and Optimization TechniquesComputer Science13 references8 citations
TL;DR

This paper proposes machine learning-enabled autotuning to automatically select optimal OpenCL workgroup sizes for stencil patterns across diverse CPUs and multi-GPUs. Using classifiers and regressors trained on synthetic benchmarks, it achieves a median 3.79× speedup over fixed workgroup sizes and attains 94% of maximum performance.

ABSTRACT

Selecting an appropriate workgroup size is critical for the performance of OpenCL kernels, and requires knowledge of the underlying hardware, the data being operated on, and the implementation of the kernel. This makes portable performance of OpenCL programs a challenging goal, since simple heuristics and statically chosen values fail to exploit the available performance. To address this, we propose the use of machine learning-enabled autotuning to automatically predict workgroup sizes for stencil patterns on CPUs and multi-GPUs. We present three methodologies for predicting workgroup sizes. The first, using classifiers to select the optimal workgroup size. The second and third proposed methodologies employ the novel use of regressors for performing classification by predicting the runtime of kernels and the relative performance of different workgroup sizes, respectively. We evaluate the effectiveness of each technique in an empirical study of 429 combinations of architecture, kernel, and dataset, comparing an average of 629 different workgroup sizes for each. We find that autotuning provides a median 3.79x speedup over the best possible fixed workgroup size, achieving 94% of the maximum performance.

Motivation & Objective

  • Address the challenge of achieving portable, high-performance OpenCL kernels for stencil patterns across heterogeneous architectures.
  • Overcome the limitations of fixed heuristics and manual tuning by automating workgroup size selection using machine learning.
  • Enable cross-program generalization through training on synthetic benchmarks, reducing the need for per-program tuning.
  • Evaluate multiple machine learning approaches—classifiers and regressors—for predicting optimal workgroup sizes.

Proposed method

  • Employed three autotuning methodologies: (1) binary classifiers to predict the optimal workgroup size, (2) regressors to predict kernel runtime, and (3) regressors to predict relative performance across workgroup sizes.
  • Extracted features from kernel and architecture metadata, including matrix dimensions, border region size, and device-specific constraints.
  • Collected training data from 429 combinations of architecture, kernel, and dataset, evaluating up to 629 workgroup sizes per scenario.
  • Used decision trees and regression models trained on synthetic benchmarks to predict performant workgroup sizes for unseen programs.
  • Applied constraints from OpenCL device and kernel limits to filter invalid workgroup sizes during training and prediction.
  • Evaluated performance using speedup over the best fixed workgroup size and compared median and IQR of results across techniques.

Experimental results

Research questions

  • RQ1Can machine learning models effectively predict optimal workgroup sizes for stencil patterns in OpenCL without manual tuning?
  • RQ2How do different machine learning approaches—classification versus regression—compare in predicting performant workgroup sizes?
  • RQ3What is the impact of using regressors to predict relative performance versus direct classification of optimal sizes?
  • RQ4How robust is the autotuning approach across diverse hardware, kernels, and datasets, especially under driver-induced constraints?

Key findings

  • The autotuner achieved a median speedup of 3.79× over the best fixed workgroup size across 429 test scenarios.
  • The approach attained 94% of the maximum possible performance, demonstrating strong scalability and portability.
  • Predicting relative performance using regressors yielded the highest median speedup at 1.33×, outperforming other techniques.
  • Classifier-based prediction of the optimal workgroup size had the lowest runtime overhead, offering a good trade-off between speed and accuracy.
  • The regressor-based runtime prediction method was the least effective, with lower median speedup and higher IQR, indicating less consistent results.
  • Outliers in performance were observed, with some predictions yielding speedups below 1.0× and others exceeding 2.0×, highlighting variability under edge cases.

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.