Skip to content

Commit

Permalink
[llvm] Add system flags to build_cmd protos.
Browse files Browse the repository at this point in the history
  • Loading branch information
ChrisCummins committed Feb 22, 2022
1 parent 91b1bd6 commit 60218c2
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 2 deletions.
5 changes: 4 additions & 1 deletion compiler_gym/envs/llvm/datasets/cbench.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@

from compiler_gym.datasets import Benchmark, TarDatasetWithManifest
from compiler_gym.datasets.uri import BenchmarkUri
from compiler_gym.envs.llvm import llvm_benchmark
from compiler_gym.service.proto import BenchmarkDynamicConfig, Command
from compiler_gym.third_party import llvm
from compiler_gym.util.commands import Popen
Expand Down Expand Up @@ -491,7 +492,9 @@ def validator(
DYNAMIC_CONFIGS[uri.path].append(
BenchmarkDynamicConfig(
build_cmd=Command(
argument=["$CC", "$IN", "-o", "a.out"] + linkopts,
argument=["$CC", "$IN", "-o", "a.out"]
+ llvm_benchmark.get_system_library_flags()
+ linkopts,
timeout_seconds=60,
outfile=["a.out"],
),
Expand Down
4 changes: 3 additions & 1 deletion compiler_gym/envs/llvm/datasets/csmith.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
from compiler_gym.datasets import Benchmark, BenchmarkSource, Dataset
from compiler_gym.datasets.benchmark import BenchmarkInitError, BenchmarkWithSource
from compiler_gym.datasets.uri import BenchmarkUri
from compiler_gym.envs.llvm import llvm_benchmark
from compiler_gym.envs.llvm.llvm_benchmark import ClangInvocation
from compiler_gym.service.proto import BenchmarkDynamicConfig, Command
from compiler_gym.util.commands import Popen, communicate
Expand Down Expand Up @@ -40,7 +41,8 @@ def __init__(self, *args, **kwargs):
self.proto.dynamic_config.MergeFrom(
BenchmarkDynamicConfig(
build_cmd=Command(
argument=["$CC", "-o", "a.out", "$IN"],
argument=["$CC", "-o", "a.out", "$IN"]
+ llvm_benchmark.get_system_library_flags(),
outfile=["a.out"],
timeout_seconds=60,
),
Expand Down

0 comments on commit 60218c2

Please sign in to comment.