HirFuzz: Detecting High-Level Optimization Bugs in DL Compilers via Computational Graph Generation
Deep Learning (DL) compilers are widely adopted to optimize advanced DL models for efficient deployment at diverse hardware. However, the optimization of high-level intermediate representation (IR) is found to be error-prone. Testing the implementation of high-level optimization is challenging. First, generating high-level IRs that conform to the integrity constraints required by high-level optimization is non-trivial. Non-conforming IRs are readily rejected by DL compilers before entering the optimization stage, and therefore these IRs are not useful to detect bugs at the stage. Second, it is challenging to expose high-level optimization bugs that does not result in crashes. To address the challenges, we propose HIRFuzz, a fuzzing technique that aims to reveal bugs occurring at the optimization of high-level IR in DL compilers. HIRFuzz generates computational graphs, which are then converted to their underlying high-level IRs for optimization. To reveal high-level optimization bugs, the computational graphs are so generated to explore possible combinations of data types, tensor shapes and operators while conforming to the IR's integrity constraints. In addition, novel test oracles are designed to detect bugs occurring at high-level optimization. HIRFuzz has successfully detected 24 new high-level optimization bugs that occur at TVM, with 19 bugs confirmed and 14 fixed. Furthermore, our experiment results show that HIRFuzz outperforms the state-of-the-art DL compiler fuzzers that can cover high-level optimization stage. Specifically, HIRFuzz found 12 more bugs than the second best fuzzer within the same time budget.
READ FULL TEXT