FlashSketch: Sketch-Kernel Co-Design for Fast Sparse Sketching on GPUs
Abstract
Lay Summary
Doing math on computers is usually split into two subproblems. On the one hand, mathematicians design theoretically elegant and fast algorithms purely in the abstract, with the idea that a certain notion of fast would translate to actual efficiency on real computers. The second aspect is to take an abstract mathematical algorithm and actually create concrete instructions to implement this algorithm on real computers. In the context of modern computers, specifically GPUs (Graphics Processing Units), a divide exists between what is mathematically fast and what ends up being actually fast when implemented. We investigate one specific mathematical task called "sketching" that we want to do fast on GPUs. Sketching is a mechanism that greatly reduces the size of large data into something much more manageable, at the cost of some accuracy. It compresses data by approximation. The utility of this is that some downstream tasks that we would want to do on this data could now be much easier and faster, and still accurate since they can tolerate approximations. An inherent aspect of sketching is that there is some "randomness" in this procedure. This is what makes the approximation mathematically good. But this randomness also makes the real concrete instructions to run this procedure on GPUs very slow. The reason for this is that the sketching procedure was developed independently in the abstract, without explicitly taking into account the special characteristics of GPUs. To resolve this tension, we develop FlashSketch. The core principle is to design a new sketching procedure that still maintains good properties from a mathematical perspective, while also being amenable to a much faster and more elegant implementation on modern GPUs. This is a "co-design" approach to solving the overarching problem of doing this specific math problem on modern computers. It resolves, in this setting, a fundamental mismatch between mathematical efficiency and hardware efficiency. The result is that FlashSketch pushes the "Pareto" frontier, which means that it achieves the same level of approximation quality at a much faster speed, roughly 1.7x faster than previous approaches which were not co-designed with the GPU in mind. We also mathematically show that the approximation it produces remains strong.