Salvato in:
Dettagli Bibliografici
Autori principali: Gonon, Antoine, Zheng, Léon, Carrivain, Pascal, Le, Quoc-Tung
Natura: Preprint
Pubblicazione: 2024
Soggetti:
Accesso online:https://arxiv.org/abs/2405.15013
Tags: Aggiungi Tag
Nessun Tag, puoi essere il primo ad aggiungerne!!
_version_ 1866911003829075968
author Gonon, Antoine
Zheng, Léon
Carrivain, Pascal
Le, Quoc-Tung
author_facet Gonon, Antoine
Zheng, Léon
Carrivain, Pascal
Le, Quoc-Tung
contents Kronecker-sparse (KS) matrices -- whose supports are Kronecker products of identity and all-ones blocks -- underpin the structure of Butterfly and Monarch matrices and offer the promise of more efficient models. However, existing GPU kernels for KS matrix multiplication suffer from high data movement costs, with up to 50% of time spent on memory-bound tensor permutations. We propose a fused, output-stationary GPU kernel that eliminates these overheads, reducing global memory traffic threefold. Across 600 KS patterns, our kernel achieves in FP32 a median speedup of x1.4 and lowers energy consumption by 15%. A simple heuristic based on KS pattern parameters predicts when our method outperforms existing ones. We release all code at github.com/PascalCarrivain/ksmm, including a PyTorch-compatible KSLinear layer, and demonstrate in FP32 end-to-end latency reductions of up to 22% in ViT-S/16 and 16% in GPT-2 medium.
format Preprint
id arxiv_https___arxiv_org_abs_2405_15013
institution arXiv
publishDate 2024
record_format arxiv
spellingShingle Fast Inference with Kronecker-Sparse Matrices
Gonon, Antoine
Zheng, Léon
Carrivain, Pascal
Le, Quoc-Tung
Machine Learning
Kronecker-sparse (KS) matrices -- whose supports are Kronecker products of identity and all-ones blocks -- underpin the structure of Butterfly and Monarch matrices and offer the promise of more efficient models. However, existing GPU kernels for KS matrix multiplication suffer from high data movement costs, with up to 50% of time spent on memory-bound tensor permutations. We propose a fused, output-stationary GPU kernel that eliminates these overheads, reducing global memory traffic threefold. Across 600 KS patterns, our kernel achieves in FP32 a median speedup of x1.4 and lowers energy consumption by 15%. A simple heuristic based on KS pattern parameters predicts when our method outperforms existing ones. We release all code at github.com/PascalCarrivain/ksmm, including a PyTorch-compatible KSLinear layer, and demonstrate in FP32 end-to-end latency reductions of up to 22% in ViT-S/16 and 16% in GPT-2 medium.
title Fast Inference with Kronecker-Sparse Matrices
topic Machine Learning
url https://arxiv.org/abs/2405.15013