Masked Matrix Multiplication for Emergent Sparsity

Fuente: arXiv
Salvato in:
Dettagli Bibliografici
Autori principali: Wheatman, Brian, Madhyastha, Meghana, Burns, Randal
Natura: Preprint
Pubblicazione: 2024
Soggetti:
Accesso online:
Tags: Aggiungi Tag
Nessun Tag, puoi essere il primo ad aggiungerne!!
_version_ 1866914688654114816
author Wheatman, Brian
Madhyastha, Meghana
Burns, Randal
author_facet Wheatman, Brian
Madhyastha, Meghana
Burns, Randal
contents Artificial intelligence workloads, especially transformer models, exhibit emergent sparsity in which computations perform selective sparse access to dense data. The workloads are inefficient on hardware designed for dense computations and do not map well onto sparse data representations. We build a vectorized and parallel matrix-multiplication system A X B = C that eliminates unnecessary computations and avoids branches based on a runtime evaluation of sparsity. We use a combination of dynamic code lookup to adapt to the specific sparsity encoded in the B matrix and preprocessing of sparsity maps of the A and B matrices to compute conditional branches once for the whole computation. For a wide range of sparsity, from 60% to 95% zeros, our implementation performs fewer instructions and increases performance when compared with Intel MKL's dense or sparse matrix multiply routines. Benefits can be as large as 2 times speedup and 4 times fewer instructions.
format Preprint
id arxiv_https___arxiv_org_abs_2402_14118
institution arXiv
publishDate 2024
record_format arxiv
spellingShingle Masked Matrix Multiplication for Emergent Sparsity
Wheatman, Brian
Madhyastha, Meghana
Burns, Randal
Data Structures and Algorithms
Artificial Intelligence
Artificial intelligence workloads, especially transformer models, exhibit emergent sparsity in which computations perform selective sparse access to dense data. The workloads are inefficient on hardware designed for dense computations and do not map well onto sparse data representations. We build a vectorized and parallel matrix-multiplication system A X B = C that eliminates unnecessary computations and avoids branches based on a runtime evaluation of sparsity. We use a combination of dynamic code lookup to adapt to the specific sparsity encoded in the B matrix and preprocessing of sparsity maps of the A and B matrices to compute conditional branches once for the whole computation. For a wide range of sparsity, from 60% to 95% zeros, our implementation performs fewer instructions and increases performance when compared with Intel MKL's dense or sparse matrix multiply routines. Benefits can be as large as 2 times speedup and 4 times fewer instructions.
title Masked Matrix Multiplication for Emergent Sparsity
topic Data Structures and Algorithms
Artificial Intelligence
url https://arxiv.org/abs/2402.14118