Reading Report: Translation Validation
Xingyu Xie
School of Software, Tsinghua University
Translation Validation
- Graph Equality
- Symbolic Evaluation
Equality-based Approach
Program Expression Graph
referentially transparent: the value of an expression depends only on the value of its constituent expression, without side-effects
complete: no need to maintain any additional representation such as CFG
E-Graph
E-class: equivalence class in the graph
Equality Exploration
Repeatedly apply rewriting rules (equivalence axioms), until finding a fixed point e-graph, which represents all equivalent graph equivalent to the initial graph given a set of rewriting rules.
Use E-graph to check the equivalence of PEGs
Loop in PEG
Loop in equality checking
Normalized value-graph
Normalized value-graph
Strength: effective
Weakness: normalizing rule partially depends on optimization, only few passes are considered, such as global-value numbering and sparse-conditional constant propagation
Symbolic-execution-based Approach
Gauntlet: validation for P4
Simple in nature as programs: no pointer, no loop
TVI: first validator for C
Alive2: nondeterministic execution
To consider UB (undefined behavior) in LLVM:
- Undef: any value of a type. undef & 1 has two results.
- Poison: special value, like NaN. poison & 1 is poison
-
True UB: division by zero
How? from equivalence to refinement
Comparison
Equality-based
- efficient
- cannot locate found bug
Symbolic-execution-based
- hard to handle loop
- hard to handle pointer (simplified heap memory model)
- scalability limited to SMT solver
- more representative
Difficulties
- Transformation-related (specific)
- loop (recursion)
- Pointer (heap memory)
- Interprocedure optimization
References
- PLDI'00. Translation Validation for an Optimizing Compiler.
- PLDI'11. Jean-Baptiste Tristan et al. Evaluating Value-Graph Translation Validation for LLVM.
- CAV'11. Michael Stepp et al. Equality-Based Translation Validator for LLVM.
- SAS'13. Kedar S. Namjoshi et al. Witnessing Program Transformations.
- OSDI'20. Fabian Ruffy et al. Finding Bugs in Compilers for Programmable Packet Processing.
- PLDI'21. Nuno P. Lopes et al. Alive2: Bounded Translation Validation for LLVM.
Reading Report: Translation Validation
By Xingyu Xie
Reading Report: Translation Validation
- 2