Skip to main content
QUICK REVIEW

[Paper Review] FusionStitching: Deep Fusion and Code Generation for Tensorflow Computations on GPUs

Guoping Long, Jun Yang|arXiv (Cornell University)|Nov 13, 2018
Advanced Neural Network ApplicationsComputer Science11 references6 citations
TL;DR

FusionStitching is a deep fusion and code generation system for TensorFlow that enables efficient GPU kernel fusion through block composition and shared memory optimization, reducing GPU kernel launches by 55% (geometric mean) compared to XLA and improving end-to-end performance by up to 20% on latency-critical workloads.

ABSTRACT

In recent years, there is a surge on machine learning applications in industry. Many of them are based on popular AI frameworks like Tensorflow, Torch, Caffe, or MxNet, etc, and are enpowered by accelerator platforms such as GPUs. One important challenge of running Tensorflow computations on GPUs is the fine granularity problem, namely, FLOPS of individual ops are far from enough to fully exploit the computing power of underlying accelerators. The XLA framework provides a solid foundation to explore this problem further. In this paper, we propose FusionStitching, a novel, comprehensive Op fusion and code generation system to stitch computations into large GPU kernels. Experimental results on four public models and two of our large inhouse applications show another 55% (geometric mean) reduction of GPU kernel launches, compared to the XLA fusion baseline. This increases the E2E performance of both of our latency critical inhouse applications up to 20%.

Motivation & Objective

  • Address the fine-grained op problem in TensorFlow where individual operations have insufficient FLOPS to fully utilize GPU hardware.
  • Overcome limitations of XLA's static fusion rules that fail to handle complex cases like expensive elementwise ops, batched matmuls, and layout transposes.
  • Enable scalable, automated fusion and code generation for non-MatMul/Convolution ops by decoupling computation specification from low-level schedule details.
  • Develop a novel code generation strategy using block composition and shared memory to compose kernels with distinct parallel loop emitters.
  • Achieve significant performance gains on diverse models, especially in latency-sensitive industrial applications, by minimizing kernel launch overhead.

Proposed method

  • Propose a critical path analysis to guide fusion decisions, prioritizing operations on the longest data dependency chain.
  • Introduce a domain-specific schedule specification language that abstracts low-level tuning parameters while enabling automatic optimization.
  • Design a new IR emitter, IrEmitterStitched, to support block composition by allowing multiple ops to use separate parallel loop emitters with shared memory as intermediaries.
  • Leverage on-chip shared memory as a scratchpad to enable efficient data transfer between fused operations with different scheduling patterns.
  • Implement a shared memory shrinking mechanism when usage exceeds a 20KB threshold, dynamically reducing memory footprint to maintain kernel launch feasibility.
  • Use layered span graphs inspired by dependency analysis to model and optimize fusion opportunities across complex computation graphs.

Experimental results

Research questions

  • RQ1How can we effectively fuse fine-grained TensorFlow operations on GPUs when standard fusion heuristics fail due to complex dependencies or memory access patterns?
  • RQ2What is the impact of shared memory composition and block-level scheduling on kernel fusion scalability and performance in deep learning workloads?
  • RQ3Can a compiler-driven, user-transparent fusion and code generation system outperform existing XLA-based fusion strategies in terms of kernel launch reduction and end-to-end latency?
  • RQ4To what extent can shared memory be reused across multiple fused operations to reduce memory bandwidth pressure and improve throughput?
  • RQ5How does the proposed fusion strategy scale across diverse workloads, including both public models and large-scale industrial applications?

Key findings

  • FusionStitching reduces GPU kernel launches by 55% (geometric mean) compared to the XLA fusion baseline across four public models and two in-house applications.
  • End-to-end performance improves by up to 20% on two latency-critical industrial applications, demonstrating real-world impact.
  • The system successfully handles complex fusion cases such as batched matmuls, expensive elementwise ops, and memory layout transposes, which are problematic for XLA's static fusion rules.
  • Shared memory usage reaches up to 10,432 bytes in the Speech workload, with 17% of allocated space shared across multiple ops in the NMT model, indicating effective result reuse.
  • The shrinking mechanism is triggered in 3 kernels (out of 100+), showing that memory pressure is manageable within the 20KB limit for most workloads.
  • Workloads like LR, W2V, RNN, and BiRNN show minimal shared memory usage and no shrinking, indicating simpler fusion patterns and stable performance.

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.