Gaiwan: a Size-Polymorphic Typesystem for GPU Programs
UGent, Krijgslaan 281-S9, 9000 Gent, Belgium
Science of Computer Programming, 2023
@article{singh2023gaiwan,
title={Gaiwan: a Size-Polymorphic Typesystem for GPU Programs},
author={Singh, Robbert Gurdeep and Scholliers, Christophe},
journal={Science of Computer Programming},
pages={102989},
year={2023},
publisher={Elsevier}
}
General-purpose computing on graphics processing units (GPGPU) is increasingly used for number crunching tasks such as analyzing time series data. GPUs are a good fit for these tasks as they can execute many computations in parallel. To leverage this parallelism, the programmer is forced to carefully divide their input data into data blocks that are then distributed over the many GPU cores. The optimal block sizes are unrelated to the programmers goals, instead, they are based on characteristics of the used GPU and the input data. GPGPU programmers must additionally be wary of introducing race conditions in their programs. We believe that GPGPU programmers should be able to express GPU transformations without worrying about splitting data or race conditions. For this, we created Gaiwan, a GPGPU programming language with a size-polymorphic type system that only features data race free operations. Programmers can declare the effects of program steps on the sizes of buffers by using affine functions (e.g. Image 1). From a step sequence, Gaiwan derives a set of constraints on the size and shape of valid inputs. Gaiwan guarantees that the program will run for any input satisfying these constraints. This means that one program may analyze both a hundred data points and millions of data points, as long as the input satisfies the constraints. We prove that our system is sound and show it works with two usage examples. Our benchmarks show that our initial OpenCL-based implementation of Gaiwan scales to handling large programs.
December 31, 2023 by hgpu