-
Notifications
You must be signed in to change notification settings - Fork 129
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add semantics validation for cBench benchmarks.
Add semantics validation for cBench benchmarks. This is achieved by adding a new validation callback mechanism that, when invoked, compiles the given cBench benchmark to a binary and executes it using prepared datasets. The output of the program, along with any generated output files, is differential tested against a copy of the program compiled without optimizations. A change in program behavior that is detected by this mechanism is reported. Calling `compiler_gym.validate_state()` on a benchmark that supports semantics validation will automatically run it. The core of the implementation is in compiler_gym/envs/llvm/dataset.py. It defines a set of library functions so that these validation callbacks can be defined ad-hoc for cBench in quite a succinct form, e.g.: validator( benchmark="benchmark://cBench-v0/ghostscript", cmd="$BIN -sDEVICE=ppm -dNOPAUSE -dQUIET -sOutputFile=output.ppm -- 1.ps", data=["office_data/1.ps"], outs=["output.ppm"], linkopts=["-lm", "-lz"], pre_execution_callback=setup_ghostscript_library_files, ) As part of #45 we may want to make a public API similar to this and move it into the dataset definitions. Multiple validation callbacks can be defined for a single benchmark. Where a benchmark matches multiple validators, they are executed in parallel. Compiling binaries from cBench benchmarks requires that the bitcodes be compiled against the system-specific standard library, so this patch also splits the cBench dataset into macOS and Linux versions.
- Loading branch information
1 parent
377461b
commit 8c8fdd6
Showing
106 changed files
with
1,200 additions
and
351 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.