6 research outputs found
White-box Compiler Fuzzing Empowered by Large Language Models
Compiler correctness is crucial, as miscompilation falsifying the program
behaviors can lead to serious consequences. In the literature, fuzzing has been
extensively studied to uncover compiler defects. However, compiler fuzzing
remains challenging: Existing arts focus on black- and grey-box fuzzing, which
generates tests without sufficient understanding of internal compiler
behaviors. As such, they often fail to construct programs to exercise
conditions of intricate optimizations. Meanwhile, traditional white-box
techniques are computationally inapplicable to the giant codebase of compilers.
Recent advances demonstrate that Large Language Models (LLMs) excel in code
generation/understanding tasks and have achieved state-of-the-art performance
in black-box fuzzing. Nonetheless, prompting LLMs with compiler source-code
information remains a missing piece of research in compiler testing.
To this end, we propose WhiteFox, the first white-box compiler fuzzer using
LLMs with source-code information to test compiler optimization. WhiteFox
adopts a dual-model framework: (i) an analysis LLM examines the low-level
optimization source code and produces requirements on the high-level test
programs that can trigger the optimization; (ii) a generation LLM produces test
programs based on the summarized requirements. Additionally,
optimization-triggering tests are used as feedback to further enhance the test
generation on the fly. Our evaluation on four popular compilers shows that
WhiteFox can generate high-quality tests to exercise deep optimizations
requiring intricate conditions, practicing up to 80 more optimizations than
state-of-the-art fuzzers. To date, WhiteFox has found in total 96 bugs, with 80
confirmed as previously unknown and 51 already fixed. Beyond compiler testing,
WhiteFox can also be adapted for white-box fuzzing of other complex, real-world
software systems in general
Finding Missed Compiler Optimizations by Differential Testing
International audienceRandomized differential testing of compilers has had great success in finding compiler crashes and silent miscompila-tions. In this paper we investigate whether we can use similar techniques to improve the quality of the generated code: Can we compare the code generated by different compilers to find optimizations performed by one but missed by another? We have developed a set of tools for running such tests. We compile C code generated by standard random program generators and use a custom binary analysis tool to compare the output programs. Depending on the optimization of interest, the tool can be configured to compare features such as the number of total instructions, multiply or divide instructions, function calls, stack accesses, and more. A standard test case reduction tool produces minimal examples once an interesting difference has been found. We have used our tools to compare the code generated by GCC, Clang, and CompCert. We have found previously un-reported missing arithmetic optimizations in all three compilers, as well as individual cases of unnecessary register spilling, missed opportunities for register coalescing, dead stores, redundant computations, and missing instruction selection patterns
Synthesizing Quantum-Circuit Optimizers
Near-term quantum computers are expected to work in an environment where each
operation is noisy, with no error correction. Therefore, quantum-circuit
optimizers are applied to minimize the number of noisy operations. Today,
physicists are constantly experimenting with novel devices and architectures.
For every new physical substrate and for every modification of a quantum
computer, we need to modify or rewrite major pieces of the optimizer to run
successful experiments. In this paper, we present QUESO, an efficient approach
for automatically synthesizing a quantum-circuit optimizer for a given quantum
device. For instance, in 1.2 minutes, QUESO can synthesize an optimizer with
high-probability correctness guarantees for IBM computers that significantly
outperforms leading compilers, such as IBM's Qiskit and TKET, on the majority
(85%) of the circuits in a diverse benchmark suite.
A number of theoretical and algorithmic insights underlie QUESO: (1) An
algebraic approach for representing rewrite rules and their semantics. This
facilitates reasoning about complex symbolic rewrite rules that are beyond the
scope of existing techniques. (2) A fast approach for probabilistically
verifying equivalence of quantum circuits by reducing the problem to a special
form of polynomial identity testing. (3) A novel probabilistic data structure,
called a polynomial identity filter (PIF), for efficiently synthesizing rewrite
rules. (4) A beam-search-based algorithm that efficiently applies the
synthesized symbolic rewrite rules to optimize quantum circuits.Comment: Full version of PLDI 2023 pape