Skip to main content
QUICK REVIEW

[Paper Review] A Learned Performance Model for Tensor Processing Units

Samuel J. Kaufman, Phitchaya Mangpo Phothilimthana|arXiv (Cornell University)|Aug 3, 2020
Parallel Computing and Optimization TechniquesComputer Science26 references33 citations
TL;DR

The paper presents a learned performance model for TPUs that predicts kernel runtimes using a graph neural network, outperforming an analytical model on tile-size selection and operator fusion, and aiding autotuning when hardware access is limited.

ABSTRACT

Accurate hardware performance models are critical to efficient code generation. They can be used by compilers to make heuristic decisions, by superoptimizers as a minimization objective, or by autotuners to find an optimal configuration for a specific program. However, they are difficult to develop because contemporary processors are complex, and the recent proliferation of deep learning accelerators has increased the development burden. We demonstrate a method of learning performance models from a corpus of tensor computation graph programs for Tensor Processing Unit (TPU) instances. We show that our learned model outperforms a heavily-optimized analytical performance model on two tasks -- tile-size selection and operator fusion -- and that it helps an autotuner discover faster programs in a setting where access to TPUs is limited or expensive.

Motivation & Objective

  • Provide accurate runtime prediction for tensor programs on TPUs to reduce reliance on real hardware.
  • Generalize across diverse tensor programs and optimization tasks without heavy feature engineering.
  • Enable retargetable performance modeling for different compiler optimization tasks.
  • Demonstrate improved autotuning efficiency when TPU access is limited or expensive.

Proposed method

  • Represent tensor programs as data flow graphs with operation nodes and tensor-flow edges.
  • Use a Graph Neural Network (GraphSAGE) to compute node embeddings from local neighborhoods.
  • Optionally couple a sequence model (LSTM or Transformer) on top of node embeddings to capture long-range dependencies.
  • Incorporate opcode embeddings and per-node/kernel features to form input vectors for the model.
  • Train with task-specific objectives: a pairwise rank loss for tile-size selection and a squared-error (log-transformed targets) loss for fusion to predict absolute runtimes.
  • Compare against a heavily hand-tuned analytical model and integrate the learned model into an XLA autotuner to guide configuration searches.

Experimental results

Research questions

  • RQ1Can a learned model predict TPU kernel runtimes accurately enough to guide tile-size selection and operator fusion?
  • RQ2Does a graph-based representation with minimal feature engineering generalize across unseen tensor programs and different hardware generations (TPU v2/v3)?
  • RQ3Does integrating a learned model into an autotuner reduce the number of real-hardware evaluations needed to find fast configurations?

Key findings

  • The learned model achieves 96.3% and 95.5% accuracy with respect to true measurements for tile-size and fusion tasks, respectively.
  • The learned model yields 2.4% and 26.6% better accuracy than the best hand-tuned analytical model for tile-size and fusion tasks, respectively.
  • On TPU v3, the learned model attains 3.8% mean error with a slightly lower mean correlation (0.65) for tile-size evaluation.
  • Ablation studies show edge direction, static performance features, and kernel-embedding choices significantly impact fusion-task accuracy and, to a lesser extent, tile-size task accuracy.
  • Integrating the learned model into the XLA autotuner enables faster discovery of efficient configurations when hardware access is limited or expensive.

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.