Automated test generation for OpenCL kernels using fuzzing and constraint solving
School of Informatics, University of Edinburgh, UK
13th Annual Workshop on General Purpose Processing using Graphics Processing Unit, 2020
@inproceedings{10.1145/3366428.3380768,
author={Peng, Chao and Rajan, Ajitha},
title={Automated Test Generation for OpenCL Kernels Using Fuzzing and Constraint Solving},
year={2020},
isbn={9781450370257},
publisher={Association for Computing Machinery},
address={New York, NY, USA},
url={https://doi.org/10.1145/3366428.3380768},
doi={10.1145/3366428.3380768},
booktitle={Proceedings of the 13th Annual Workshop on General Purpose Processing Using Graphics Processing Unit},
pages={61–70},
numpages={10},
keywords={test case generation, constraint solving, GPU, fuzz testing, data race, OpenCL, software testing},
location={San Diego, California},
series={GPGPU ’20}
}
Graphics Processing Units (GPUs) are massively parallel processors offering performance acceleration and energy efficiency unmatched by current processors (CPUs) in computers. These advantages along with recent advances in the programmability of GPUs have made them attractive for general-purpose computations. Despite the advances in programmability, GPU kernels are hard to code and analyse due to the high complexity of memory sharing patterns, striding patterns for memory accesses, implicit synchronisation, and combinatorial explosion of thread interleavings. Existing few techniques for testing GPU kernels use symbolic execution for test generation that incur a high overhead, have limited scalability and do not handle all data types. We propose a test generation technique for OpenCL kernels that combines mutation-based fuzzing and selective constraint solving with the goal of being fast, effective and scalable. Fuzz testing for GPU kernels has not been explored previously. Our approach for fuzz testing randomly mutates input kernel argument values with the goal of increasing branch coverage. When fuzz testing is unable to increase branch coverage with random mutations, we gather path constraints for uncovered branch conditions and invoke the Z3 constraint solver to generate tests for them. In addition to the test generator, we also present a schedule amplifier that simulates multiple work-group schedules, with which to execute each of the generated tests. The schedule amplifier is designed to help uncover inter work-group data races. We evaluate the effectiveness of the generated tests and schedule amplifier using 217 kernels from open source projects and industry standard benchmark suites measuring branch coverage and fault finding. We find our test generation technique achieves close to 100% coverage and mutation score for majority of the kernels. Overhead incurred in test generation is small (average of 0.8 seconds). We also confirmed our technique scales easily to large kernels, and can support all OpenCL data types, including complex data structures.
March 15, 2020 by hgpu