Skip to content

Commit

Permalink
[llvm] Port the cBench dataset to the new API.
Browse files Browse the repository at this point in the history
This adds the new Dataset implementation of the cBench dataset. The
validation logic isn't super tidy and could be tidied up a bit, its
just copied over from //compiler_gym/envs/llvm:legacy_datasets.

Issue facebookresearch#45.
  • Loading branch information
ChrisCummins authored and bwasti committed Aug 3, 2021
1 parent 656aed6 commit 3cc33c2
Show file tree
Hide file tree
Showing 7 changed files with 1,079 additions and 0 deletions.
1 change: 1 addition & 0 deletions compiler_gym/envs/llvm/datasets/BUILD
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ py_library(
srcs = [
"__init__.py",
"anghabench.py",
"cbench.py",
"clgen.py",
"csmith.py",
"llvm_stress.py",
Expand Down
15 changes: 15 additions & 0 deletions compiler_gym/envs/llvm/datasets/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@

from compiler_gym.datasets import Dataset, TarDatasetWithManifest
from compiler_gym.envs.llvm.datasets.anghabench import AnghaBenchDataset
from compiler_gym.envs.llvm.datasets.cbench import CBenchDataset, CBenchLegacyDataset
from compiler_gym.envs.llvm.datasets.clgen import CLgenDataset
from compiler_gym.envs.llvm.datasets.csmith import CsmithBenchmark, CsmithDataset
from compiler_gym.envs.llvm.datasets.llvm_stress import LlvmStressDataset
Expand Down Expand Up @@ -206,6 +207,18 @@ def get_llvm_datasets(site_data_base: Optional[Path] = None) -> Iterable[Dataset
yield AnghaBenchDataset(site_data_base=site_data_base, sort_order=0)
yield BlasDataset(site_data_base=site_data_base, sort_order=0)
yield CLgenDataset(site_data_base=site_data_base, sort_order=0)
yield CBenchDataset(site_data_base=site_data_base, sort_order=-1)
# Add legacy version of cbench-v1 in which the 'b' was capitalized. This
# is deprecated and will be removed no earlier than v0.1.10.
yield CBenchDataset(
site_data_base=site_data_base,
name="benchmark://cBench-v1",
hidden=True,
manifest_url="https://dl.fbaipublicfiles.com/compiler_gym/llvm_bitcodes-10.0.0-cBench-v1-manifest.bz2",
manifest_sha256="635b94eeb2784dfedb3b53fd8f84517c3b4b95d851ddb662d4c1058c72dc81e0",
sort_order=100,
)
yield CBenchLegacyDataset(site_data_base=site_data_base)
yield CsmithDataset(site_data_base=site_data_base, sort_order=0)
yield GitHubDataset(site_data_base=site_data_base, sort_order=0)
yield LinuxDataset(site_data_base=site_data_base, sort_order=0)
Expand All @@ -222,6 +235,8 @@ def get_llvm_datasets(site_data_base: Optional[Path] = None) -> Iterable[Dataset
"AnghaBenchDataset",
"BlasDataset",
"CLgenDataset",
"CBenchDataset",
"CBenchLegacyDataset",
"CsmithDataset",
"CsmithBenchmark",
"get_llvm_datasets",
Expand Down
Loading

0 comments on commit 3cc33c2

Please sign in to comment.