python_code
stringlengths
0
4.04M
repo_name
stringlengths
7
58
file_path
stringlengths
5
147
# Copyright (c) Facebook, Inc. and its affiliates. # # This source code is licensed under the MIT license found in the # LICENSE file in the root directory of this source tree. """Integrations tests for the LLVM CompilerGym environments.""" import sys import pytest from flaky import flaky from compiler_gym.envs impor...
CompilerGym-development
tests/llvm/fresh_environment_observation_reward_test.py
# Copyright (c) Facebook, Inc. and its affiliates. # # This source code is licensed under the MIT license found in the # LICENSE file in the root directory of this source tree. """Tests for LLVM session parameter handlers.""" import pytest from flaky import flaky from compiler_gym.envs.llvm import LlvmEnv from compile...
CompilerGym-development
tests/llvm/llvm_session_parameters_test.py
# Copyright (c) Facebook, Inc. and its affiliates. # # This source code is licensed under the MIT license found in the # LICENSE file in the root directory of this source tree. import os from concurrent.futures import ThreadPoolExecutor from pathlib import Path from compiler_gym.third_party import llvm from compiler_g...
CompilerGym-development
tests/llvm/download_llvm_test.py
# Copyright (c) Facebook, Inc. and its affiliates. # # This source code is licensed under the MIT license found in the # LICENSE file in the root directory of this source tree. """Test that LlvmEnv is compatible with OpenAI gym interface.""" import gym import pytest from compiler_gym.envs.llvm import LlvmEnv from test...
CompilerGym-development
tests/llvm/gym_interface_compatability_test.py
# Copyright (c) Facebook, Inc. and its affiliates. # # This source code is licensed under the MIT license found in the # LICENSE file in the root directory of this source tree. """Integrations tests for the LLVM CompilerGym environments.""" import re import tempfile from pathlib import Path import pytest from compile...
CompilerGym-development
tests/llvm/llvm_benchmark_test.py
# Copyright (c) Facebook, Inc. and its affiliates. # # This source code is licensed under the MIT license found in the # LICENSE file in the root directory of this source tree. """Regression tests generated by fuzzing.""" import difflib import subprocess import pytest from tests.test_main import main pytest_plugins ...
CompilerGym-development
tests/llvm/fuzzing_regression_test.py
# Copyright (c) Facebook, Inc. and its affiliates. # # This source code is licensed under the MIT license found in the # LICENSE file in the root directory of this source tree. """Regression tests for LlvmEnv.fork() identified by hand or through fuzzing.""" from typing import List, NamedTuple import pytest from flaky...
CompilerGym-development
tests/llvm/fork_regression_test.py
# Copyright (c) Facebook, Inc. and its affiliates. # # This source code is licensed under the MIT license found in the # LICENSE file in the root directory of this source tree. """Tests for LlvmEnv.fork().""" import subprocess import sys import pytest from compiler_gym.envs import LlvmEnv from compiler_gym.util.runfi...
CompilerGym-development
tests/llvm/fork_env_test.py
# Copyright (c) Facebook, Inc. and its affiliates. # # This source code is licensed under the MIT license found in the # LICENSE file in the root directory of this source tree. """Integrations tests for LLVM runtime support.""" from pathlib import Path from typing import List import numpy as np import pytest from flak...
CompilerGym-development
tests/llvm/runtime_test.py
# Copyright (c) Facebook, Inc. and its affiliates. # # This source code is licensed under the MIT license found in the # LICENSE file in the root directory of this source tree. """Integrations tests for the LLVM CompilerGym environments.""" import numpy as np from compiler_gym.envs import CompilerEnv from compiler_gy...
CompilerGym-development
tests/llvm/all_actions_single_step_test.py
# Copyright (c) Facebook, Inc. and its affiliates. # # This source code is licensed under the MIT license found in the # LICENSE file in the root directory of this source tree. """Tests for serializing LLVM datasets.""" import pickle from compiler_gym.datasets import Dataset from compiler_gym.envs.llvm import LlvmEnv ...
CompilerGym-development
tests/llvm/datasets_pickle_test.py
# Copyright (c) Facebook, Inc. and its affiliates. # # This source code is licensed under the MIT license found in the # LICENSE file in the root directory of this source tree. """Tests for the LLVM datasets.""" import gym import compiler_gym.envs.llvm # noqa register environments from tests.test_main import main d...
CompilerGym-development
tests/llvm/datasets/llvm_datasets_test.py
# Copyright (c) Facebook, Inc. and its affiliates. # # This source code is licensed under the MIT license found in the # LICENSE file in the root directory of this source tree. """Tests for the POJ104 dataset.""" import sys from itertools import islice from pathlib import Path import gym import pytest import compiler...
CompilerGym-development
tests/llvm/datasets/poj104_test.py
# Copyright (c) Facebook, Inc. and its affiliates. # # This source code is licensed under the MIT license found in the # LICENSE file in the root directory of this source tree. """Tests for the GitHub dataset.""" import sys from itertools import islice import gym import pytest import compiler_gym.envs.llvm # noqa re...
CompilerGym-development
tests/llvm/datasets/github_test.py
# Copyright (c) Facebook, Inc. and its affiliates. # # This source code is licensed under the MIT license found in the # LICENSE file in the root directory of this source tree. """Tests for the AnghaBench dataset.""" import gym import pytest import compiler_gym.envs.llvm # noqa register environments from compiler_gym...
CompilerGym-development
tests/llvm/datasets/chstone_test.py
# Copyright (c) Facebook, Inc. and its affiliates. # # This source code is licensed under the MIT license found in the # LICENSE file in the root directory of this source tree. """Test for cBench semantics validation.""" import pytest from compiler_gym import ValidationResult from compiler_gym.envs.llvm import LlvmEnv...
CompilerGym-development
tests/llvm/datasets/cbench_validate_test.py
# Copyright (c) Facebook, Inc. and its affiliates. # # This source code is licensed under the MIT license found in the LICENSE file # in the root directory of this source tree. # # tests/**/__init__.py files are needed for pytest Python path resolution. See: # https://docs.pytest.org/en/latest/explanation/pythonpath.ht...
CompilerGym-development
tests/llvm/datasets/__init__.py
# Copyright (c) Facebook, Inc. and its affiliates. # # This source code is licensed under the MIT license found in the # LICENSE file in the root directory of this source tree. """Tests for the AnghaBench dataset.""" import sys from itertools import islice import gym import numpy as np import pytest import compiler_g...
CompilerGym-development
tests/llvm/datasets/llvm_stress_test.py
# Copyright (c) Facebook, Inc. and its affiliates. # # This source code is licensed under the MIT license found in the # LICENSE file in the root directory of this source tree. """Tests for the JotaiBench dataset.""" from itertools import islice from pathlib import Path import pytest import compiler_gym from compiler...
CompilerGym-development
tests/llvm/datasets/jotaibench_test.py
# Copyright (c) Facebook, Inc. and its affiliates. # # This source code is licensed under the MIT license found in the # LICENSE file in the root directory of this source tree. """Tests for the CLgen dataset.""" from itertools import islice from pathlib import Path import gym import pytest import compiler_gym.envs.ll...
CompilerGym-development
tests/llvm/datasets/clgen_test.py
# Copyright (c) Facebook, Inc. and its affiliates. # # This source code is licensed under the MIT license found in the # LICENSE file in the root directory of this source tree. """Tests for the Csmith dataset.""" from itertools import islice from pathlib import Path import gym import numpy as np import pytest from fla...
CompilerGym-development
tests/llvm/datasets/csmith_test.py
# Copyright (c) Facebook, Inc. and its affiliates. # # This source code is licensed under the MIT license found in the # LICENSE file in the root directory of this source tree. """Tests for the AnghaBench dataset.""" import sys from itertools import islice from pathlib import Path import gym import pytest import comp...
CompilerGym-development
tests/llvm/datasets/anghabench_test.py
# Copyright (c) Facebook, Inc. and its affiliates. # # This source code is licensed under the MIT license found in the # LICENSE file in the root directory of this source tree. """Tests for the cbench dataset.""" import tempfile from pathlib import Path import pytest from compiler_gym.envs.llvm import LlvmEnv from co...
CompilerGym-development
tests/llvm/datasets/cbench_test.py
# Copyright (c) Facebook, Inc. and its affiliates. # # This source code is licensed under the MIT license found in the # LICENSE file in the root directory of this source tree. """Tests for the GCC CompilerGym service.""" import re import gym import numpy as np import pytest import compiler_gym.envs.gcc # noqa regis...
CompilerGym-development
tests/gcc/gcc_env_test.py
# Copyright (c) Facebook, Inc. and its affiliates. # # This source code is licensed under the MIT license found in the # LICENSE file in the root directory of this source tree. """Tests for the GCC CompilerGym service.""" import gym import pytest import compiler_gym.envs.gcc # noqa register environments from compiler...
CompilerGym-development
tests/gcc/gcc_docker_test.py
# Copyright (c) Facebook, Inc. and its affiliates. # # This source code is licensed under the MIT license found in the LICENSE file # in the root directory of this source tree. # # tests/**/__init__.py files are needed for pytest Python path resolution. See: # https://docs.pytest.org/en/latest/explanation/pythonpath.ht...
CompilerGym-development
tests/gcc/__init__.py
# Copyright (c) Facebook, Inc. and its affiliates. # # This source code is licensed under the MIT license found in the # LICENSE file in the root directory of this source tree. """Tests for the GCC CompilerGym service.""" import gym import pytest import compiler_gym.envs.gcc # noqa register environments from compiler...
CompilerGym-development
tests/gcc/gcc_bin_test.py
# Copyright (c) Facebook, Inc. and its affiliates. # # This source code is licensed under the MIT license found in the LICENSE file # in the root directory of this source tree. # # tests/**/__init__.py files are needed for pytest Python path resolution. See: # https://docs.pytest.org/en/latest/explanation/pythonpath.ht...
CompilerGym-development
tests/gcc/datasets/__init__.py
# Copyright (c) Facebook, Inc. and its affiliates. # # This source code is licensed under the MIT license found in the # LICENSE file in the root directory of this source tree. """Tests for the Csmith dataset.""" from itertools import islice from pathlib import Path import gym import numpy as np import pytest from co...
CompilerGym-development
tests/gcc/datasets/csmith_test.py
# Copyright (c) Facebook, Inc. and its affiliates. # # This source code is licensed under the MIT license found in the # LICENSE file in the root directory of this source tree. """Tests for the AnghaBench dataset.""" import sys from itertools import islice import gym import pytest import compiler_gym.envs.gcc # noqa...
CompilerGym-development
tests/gcc/datasets/anghabench_test.py
# Copyright (c) Facebook, Inc. and its affiliates. # # This source code is licensed under the MIT license found in the # LICENSE file in the root directory of this source tree. """Tests for //compiler_gym/leaderboard:llvm_instcount.""" from pathlib import Path import pytest from absl import flags from compiler_gym.le...
CompilerGym-development
tests/leaderboard/llvm_instcount_test.py
# Copyright (c) Facebook, Inc. and its affiliates. # # This source code is licensed under the MIT license found in the LICENSE file # in the root directory of this source tree. # # tests/**/__init__.py files are needed for pytest Python path resolution. See: # https://docs.pytest.org/en/latest/explanation/pythonpath.ht...
CompilerGym-development
tests/leaderboard/__init__.py
# Copyright (c) Facebook, Inc. and its affiliates. # # This source code is licensed under the MIT license found in the # LICENSE file in the root directory of this source tree. """Integration tests for the MLIR CompilerGym environments.""" from numbers import Real import gym import numpy as np import pytest import co...
CompilerGym-development
tests/mlir/mlir_env_test.py
# Copyright (c) Facebook, Inc. and its affiliates. # # This source code is licensed under the MIT license found in the LICENSE file # in the root directory of this source tree. # # tests/**/__init__.py files are needed for pytest Python path resolution. See: # https://docs.pytest.org/en/latest/explanation/pythonpath.ht...
CompilerGym-development
tests/mlir/__init__.py
# Copyright (c) Facebook, Inc. and its affiliates. # # This source code is licensed under the MIT license found in the # LICENSE file in the root directory of this source tree. import random import warnings import gym import numpy as np import pytest import torch from flaky import flaky from ray.rllib.agents.ppo impor...
CompilerGym-development
tests/mlir/rllib_ppo_smoke_test.py
# Copyright (c) Facebook, Inc. and its affiliates. # # This source code is licensed under the MIT license found in the LICENSE file # in the root directory of this source tree. # # tests/**/__init__.py files are needed for pytest Python path resolution. See: # https://docs.pytest.org/en/latest/explanation/pythonpath.ht...
CompilerGym-development
tests/mlir/datasets/__init__.py
# Copyright (c) Facebook, Inc. and its affiliates. # # This source code is licensed under the MIT license found in the # LICENSE file in the root directory of this source tree. """Tests for the matmul dataset.""" import re from copy import deepcopy from itertools import islice from pathlib import Path import gym impor...
CompilerGym-development
tests/mlir/datasets/matmul_test.py
# Copyright (c) Facebook, Inc. and its affiliates. # # This source code is licensed under the MIT license found in the # LICENSE file in the root directory of this source tree. """Utilities for random testing.""" import random from time import time from typing import List, Tuple from compiler_gym.envs import CompilerE...
CompilerGym-development
tests/pytest_plugins/random_util.py
# Copyright (c) Facebook, Inc. and its affiliates. # # This source code is licensed under the MIT license found in the LICENSE file # in the root directory of this source tree. # # tests/**/__init__.py files are needed for pytest Python path resolution. See: # https://docs.pytest.org/en/latest/explanation/pythonpath.ht...
CompilerGym-development
tests/pytest_plugins/__init__.py
# Copyright (c) Facebook, Inc. and its affiliates. # # This source code is licensed under the MIT license found in the # LICENSE file in the root directory of this source tree. """Pytest fixtures for the LLVM CompilerGym environments.""" import os from pathlib import Path from typing import Iterable, List import gym i...
CompilerGym-development
tests/pytest_plugins/llvm.py
# Copyright (c) Facebook, Inc. and its affiliates. # # This source code is licensed under the MIT license found in the # LICENSE file in the root directory of this source tree. """Pytest fixtures for CompilerGym tests.""" import os import sys import tempfile from pathlib import Path from typing import List import dock...
CompilerGym-development
tests/pytest_plugins/common.py
# Copyright (c) Facebook, Inc. and its affiliates. # # This source code is licensed under the MIT license found in the # LICENSE file in the root directory of this source tree. """Pytest fixtures for the GCC CompilerGym environments.""" import subprocess from functools import lru_cache from typing import Iterable imp...
CompilerGym-development
tests/pytest_plugins/gcc.py
# Copyright (c) Facebook, Inc. and its affiliates. # # This source code is licensed under the MIT license found in the # LICENSE file in the root directory of this source tree. """Pytest fixtures for the MLIR CompilerGym environments.""" from pathlib import Path from typing import Iterable import gym import pytest fr...
CompilerGym-development
tests/pytest_plugins/mlir.py
# Copyright (c) Facebook, Inc. and its affiliates. # # This source code is licensed under the MIT license found in the LICENSE file # in the root directory of this source tree. # # tests/**/__init__.py files are needed for pytest Python path resolution. See: # https://docs.pytest.org/en/latest/explanation/pythonpath.ht...
CompilerGym-development
tests/third_party/__init__.py
# Adapted from David Malcolm's gcc invocation library. # # Copyright 2013 David Malcolm <dmalcolm@redhat.com> # Copyright 2013 Red Hat, Inc. # # This library is free software; you can redistribute it and/or # modify it under the terms of the GNU Lesser General Public # License as published by the Free Softwar...
CompilerGym-development
tests/third_party/gccinvocation/gccinvocation_test.py
# Copyright (c) Facebook, Inc. and its affiliates. # # This source code is licensed under the MIT license found in the LICENSE file # in the root directory of this source tree. # # tests/**/__init__.py files are needed for pytest Python path resolution. See: # https://docs.pytest.org/en/latest/explanation/pythonpath.ht...
CompilerGym-development
tests/third_party/gccinvocation/__init__.py
# Copyright (c) Facebook, Inc. and its affiliates. # # This source code is licensed under the MIT license found in the # LICENSE file in the root directory of this source tree. """Unit tests for compiler_gym/service/service_cache.py.""" from compiler_gym.service.service_cache import ServiceCache from tests.test_main im...
CompilerGym-development
tests/service/service_cache_test.py
# Copyright (c) Facebook, Inc. and its affiliates. # # This source code is licensed under the MIT license found in the # LICENSE file in the root directory of this source tree. """Unit tests for //compiler_gym/service:connection.""" import gym import pytest import compiler_gym.envs # noqa Register LLVM environments. ...
CompilerGym-development
tests/service/connection_test.py
# Copyright (c) Facebook, Inc. and its affiliates. # # This source code is licensed under the MIT license found in the LICENSE file # in the root directory of this source tree. # # tests/**/__init__.py files are needed for pytest Python path resolution. See: # https://docs.pytest.org/en/latest/explanation/pythonpath.ht...
CompilerGym-development
tests/service/__init__.py
# Copyright (c) Facebook, Inc. and its affiliates. # # This source code is licensed under the MIT license found in the # LICENSE file in the root directory of this source tree. """Unit tests for //compiler_gym:validate.""" from collections.abc import Collection, Mapping import google.protobuf.any_pb2 as any_pb2 import...
CompilerGym-development
tests/service/proto/py_converters_test.py
# Copyright (c) Facebook, Inc. and its affiliates. # # This source code is licensed under the MIT license found in the LICENSE file # in the root directory of this source tree. # # tests/**/__init__.py files are needed for pytest Python path resolution. See: # https://docs.pytest.org/en/latest/explanation/pythonpath.ht...
CompilerGym-development
tests/service/proto/__init__.py
# Copyright (c) Facebook, Inc. and its affiliates. # # This source code is licensed under the MIT license found in the LICENSE file # in the root directory of this source tree. # # tests/**/__init__.py files are needed for pytest Python path resolution. See: # https://docs.pytest.org/en/latest/explanation/pythonpath.ht...
CompilerGym-development
tests/service/runtime/__init__.py
# Copyright (c) Facebook, Inc. and its affiliates. # # This source code is licensed under the MIT license found in the # LICENSE file in the root directory of this source tree. """Unit tests for //compiler_gym/service/runtime:benchmark_cache.""" import pytest from compiler_gym.service.proto import Benchmark, File fro...
CompilerGym-development
tests/service/runtime/benchmark_cache_test.py
# Copyright (c) Facebook, Inc. and its affiliates. # # This source code is licensed under the MIT license found in the LICENSE file # in the root directory of this source tree. # # tests/**/__init__.py files are needed for pytest Python path resolution. See: # https://docs.pytest.org/en/latest/explanation/pythonpath.ht...
CompilerGym-development
tests/views/__init__.py
# Copyright (c) Facebook, Inc. and its affiliates. # # This source code is licensed under the MIT license found in the # LICENSE file in the root directory of this source tree. """Unit tests for //compiler_gym/views.""" import pytest from compiler_gym.views import RewardView from tests.test_main import main class Mo...
CompilerGym-development
tests/views/reward_test.py
# Copyright (c) Facebook, Inc. and its affiliates. # # This source code is licensed under the MIT license found in the # LICENSE file in the root directory of this source tree. """Unit tests for //compiler_gym/views.""" import numpy as np import pytest from compiler_gym.errors import ServiceError from compiler_gym.ser...
CompilerGym-development
tests/views/observation_test.py
# Copyright (c) Facebook, Inc. and its affiliates. # # This source code is licensed under the MIT license found in the # LICENSE file in the root directory of this source tree. """Evaluate tabular_q policy for leaderboard.""" import os import sys from typing import Dict from absl import app, flags from compiler_gym.e...
CompilerGym-development
leaderboard/llvm_instcount/tabular_q/tabular_q_eval.py
# Copyright (c) Facebook, Inc. and its affiliates. # # This source code is licensed under the MIT license found in the # LICENSE file in the root directory of this source tree. """Tests for //leaderboard/llvm_instcount/tabular_q_eval.""" import pytest from absl import flags from compiler_gym.leaderboard.llvm_instcount...
CompilerGym-development
leaderboard/llvm_instcount/tabular_q/tabular_q_test.py
# Copyright (c) Facebook, Inc. and its affiliates. # # This source code is licensed under the MIT license found in the # LICENSE file in the root directory of this source tree. """An implementation of a random search policy for the LLVM codesize task. The search is the same as the included compiler_gym.bin.random_sear...
CompilerGym-development
leaderboard/llvm_instcount/random_search/random_search.py
# Copyright (c) Facebook, Inc. and its affiliates. # # This source code is licensed under the MIT license found in the # LICENSE file in the root directory of this source tree. """Tests for //leaderboard/llvm_instcount/random_search.""" import pytest from leaderboard.llvm_instcount.random_search.random_search import (...
CompilerGym-development
leaderboard/llvm_instcount/random_search/random_search_test.py
# Copyright (c) Facebook, Inc. and its affiliates. # # This source code is licensed under the MIT license found in the # LICENSE file in the root directory of this source tree. """Tests for //leaderboard/llvm_instcount/e_greedy.""" import sys from concurrent.futures import ThreadPoolExecutor import pytest from absl im...
CompilerGym-development
leaderboard/llvm_instcount/e_greedy/e_greedy_test.py
# Copyright (c) Facebook, Inc. and its affiliates. # # This source code is licensed under the MIT license found in the # LICENSE file in the root directory of this source tree. """ϵ-greedy policy for LLVM codesize.""" import logging import random from concurrent.futures import ThreadPoolExecutor, as_completed from typi...
CompilerGym-development
leaderboard/llvm_instcount/e_greedy/e_greedy.py
#!/usr/bin/env python3 # # Copyright (c) Facebook, Inc. and its affiliates. # # This source code is licensed under the MIT license found in the # LICENSE file in the root directory of this source tree. """A script to auto-populate RST files from the CompilerGym header files. Usage: $ python generate_cc_rst.py """...
CompilerGym-development
docs/generate_cc_rst.py
# Copyright (c) Facebook, Inc. and its affiliates. # # This source code is licensed under the MIT license found in the # LICENSE file in the root directory of this source tree. # # Configuration file for the Sphinx documentation builder. # -- Path setup -------------------------------------------------------------- #...
CompilerGym-development
docs/source/conf.py
# Copyright (c) Facebook, Inc. and its affiliates. # # This source code is licensed under the MIT license found in the # LICENSE file in the root directory of this source tree. """A CompilerGym API and web frontend. This exposes an API with two operations: 1. /api/v4/describe Describe the CompilerGym inte...
CompilerGym-development
www/www.py
# Copyright (c) Facebook, Inc. and its affiliates. # # This source code is licensed under the MIT license found in the # LICENSE file in the root directory of this source tree. """Unit tests for //compiler_gym/bin:random_walk.""" import re from absl.flags import FLAGS from random_walk import run_random_walk import co...
CompilerGym-development
examples/random_walk_test.py
# Copyright (c) Facebook, Inc. and its affiliates. # # This source code is licensed under the MIT license found in the # LICENSE file in the root directory of this source tree. import explore def test_run_explore_smoke_test(capsys): explore.main( [ "explore", "--env=llvm-ic-v0", ...
CompilerGym-development
examples/explore_test.py
# Copyright (c) Facebook, Inc. and its affiliates. # # This source code is licensed under the MIT license found in the # LICENSE file in the root directory of this source tree. """Tests for //compiler_gym/bin:actor_critic.""" import sys from absl import flags from actor_critic import main from compiler_gym.util.captu...
CompilerGym-development
examples/actor_critic_test.py
# Copyright (c) Facebook, Inc. and its affiliates. # # This source code is licensed under the MIT license found in the # LICENSE file in the root directory of this source tree. """Simple compiler gym tabular q learning example. Usage: python tabular_q.py --benchmark=<benchmark> Using selected features from Autophase ...
CompilerGym-development
examples/tabular_q.py
# Copyright (c) Facebook, Inc. and its affiliates. # # This source code is licensed under the MIT license found in the # LICENSE file in the root directory of this source tree. """Simple PT compiler gym actor-critic RL example. Usage: python actor_critic.py Use --help to list the configurable options. The objective ...
CompilerGym-development
examples/actor_critic.py
# Copyright (c) Facebook, Inc. and its affiliates. # # This source code is licensed under the MIT license found in the # LICENSE file in the root directory of this source tree. """Unit tests for //compiler_gym/bin:brute_force.""" import tempfile from pathlib import Path import gym from brute_force import run_brute_for...
CompilerGym-development
examples/brute_force_test.py
# Copyright (c) Facebook, Inc. and its affiliates. # # This source code is licensed under the MIT license found in the # LICENSE file in the root directory of this source tree. """Sweep the inner loop size of CUDA loop nests.""" import logging from itertools import product from pathlib import Path from typing import Li...
CompilerGym-development
examples/loop_tool_sweep.py
#!/usr/bin/env python3 # # Copyright (c) Facebook, Inc. and its affiliates. # # This source code is licensed under the MIT license found in the # LICENSE file in the root directory of this source tree. import distutils.util import setuptools with open("../VERSION") as f: version = f.read().strip() with open("req...
CompilerGym-development
examples/setup.py
# Copyright (c) Facebook, Inc. and its affiliates. # # This source code is licensed under the MIT license found in the # LICENSE file in the root directory of this source tree. """Tests for //compiler_gym/bin:tabular_q.""" from absl import flags from tabular_q import main from compiler_gym.util.capture_output import c...
CompilerGym-development
examples/tabular_q_test.py
# Copyright (c) Facebook, Inc. and its affiliates. # # This source code is licensed under the MIT license found in the # LICENSE file in the root directory of this source tree. """Run a parallelized brute force of an action space. This script enumerates all possible combinations of actions up to a finite length and ev...
CompilerGym-development
examples/brute_force.py
# Copyright (c) Facebook, Inc. and its affiliates. # # This source code is licensed under the MIT license found in the # LICENSE file in the root directory of this source tree. """This script runs microbenchmarks of CompilerGym environment operations. To collect new measurements, run one of the following commands: ...
CompilerGym-development
examples/op_benchmarks.py
# Copyright (c) Facebook, Inc. and its affiliates. # # This source code is licensed under the MIT license found in the # LICENSE file in the root directory of this source tree. """Run a parallelized exhaustive search of an action space. All possible combinations of actions up to a finite limit are evaluated, but parti...
CompilerGym-development
examples/explore.py
# Copyright (c) Facebook, Inc. and its affiliates. # # This source code is licensed under the MIT license found in the # LICENSE file in the root directory of this source tree. """Perform a random walk of the action space of a CompilerGym environment. Example usage: # Run a random walk on cBench example program u...
CompilerGym-development
examples/random_walk.py
# Copyright (c) Facebook, Inc. and its affiliates. # # This source code is licensed under the MIT license found in the # LICENSE file in the root directory of this source tree. """Tests for the unrolling CompilerGym service example.""" import subprocess from pathlib import Path import gym import numpy as np import pyt...
CompilerGym-development
examples/example_unrolling_service/env_tests.py
# Copyright (c) Facebook, Inc. and its affiliates. # # This source code is licensed under the MIT license found in the # LICENSE file in the root directory of this source tree. """Tests for the unrolling CompilerGym service example.""" import os import subprocess import sys from getpass import getuser from pathlib impo...
CompilerGym-development
examples/example_unrolling_service/env_without_bazel_test.py
# Copyright (c) Facebook, Inc. and its affiliates. # # This source code is licensed under the MIT license found in the # LICENSE file in the root directory of this source tree. """Smoke test for examples/example_unrolling_service/example_without_bazel.py""" from example_unrolling_service.example_without_bazel import ma...
CompilerGym-development
examples/example_unrolling_service/example_without_bazel_test.py
# Copyright (c) Facebook, Inc. and its affiliates. # # This source code is licensed under the MIT license found in the # LICENSE file in the root directory of this source tree. """This module defines and registers the example gym environments.""" import os import subprocess from pathlib import Path from typing import I...
CompilerGym-development
examples/example_unrolling_service/__init__.py
# Copyright (c) Facebook, Inc. and its affiliates. # # This source code is licensed under the MIT license found in the # LICENSE file in the root directory of this source tree. """This script demonstrates how the Python example service without needing to use the bazel build system. Prerequisite: # In the repo's IN...
CompilerGym-development
examples/example_unrolling_service/example_without_bazel.py
# Copyright (c) Facebook, Inc. and its affiliates. # # This source code is licensed under the MIT license found in the # LICENSE file in the root directory of this source tree. """This script demonstrates how the example services defined in this directory can be used as gym environments. Usage: $ bazel run -c opt ...
CompilerGym-development
examples/example_unrolling_service/example.py
# Copyright (c) Facebook, Inc. and its affiliates. # # This source code is licensed under the MIT license found in the # LICENSE file in the root directory of this source tree. def extract_statistics_from_ir(ir: str): stats = {"control_flow": 0, "arithmetic": 0, "memory": 0} for line in ir.splitlines(): ...
CompilerGym-development
examples/example_unrolling_service/service_py/utils.py
#! /usr/bin/env python3 # # Copyright (c) Facebook, Inc. and its affiliates. # # This source code is licensed under the MIT license found in the # LICENSE file in the root directory of this source tree. """An example CompilerGym service in python.""" import logging import os import shutil import subprocess from pathli...
CompilerGym-development
examples/example_unrolling_service/service_py/example_service.py
# Copyright (c) Facebook, Inc. and its affiliates. # # This source code is licensed under the MIT license found in the # LICENSE file in the root directory of this source tree. """Tests for the unrolling CompilerGym service example.""" import subprocess from pathlib import Path import gym import numpy as np import pyt...
CompilerGym-development
examples/loop_optimizations_service/env_tests.py
# Copyright (c) Facebook, Inc. and its affiliates. # # This source code is licensed under the MIT license found in the # LICENSE file in the root directory of this source tree. """Tests for the loop optimizations environment example.""" import os import subprocess import sys from getpass import getuser from pathlib imp...
CompilerGym-development
examples/loop_optimizations_service/env_without_bazel_test.py
# Copyright (c) Facebook, Inc. and its affiliates. # # This source code is licensed under the MIT license found in the # LICENSE file in the root directory of this source tree. """Smoke test for examples/loop_optimizations_service/example_without_bazel.py""" from flaky import flaky from loop_optimizations_service.examp...
CompilerGym-development
examples/loop_optimizations_service/example_without_bazel_test.py
# Copyright (c) Facebook, Inc. and its affiliates. # # This source code is licensed under the MIT license found in the # LICENSE file in the root directory of this source tree. """This module registers the Loop Optimizations CompilerGym environment """ import os import subprocess from pathlib import Path from typing im...
CompilerGym-development
examples/loop_optimizations_service/__init__.py
# Copyright (c) Facebook, Inc. and its affiliates. # # This source code is licensed under the MIT license found in the # LICENSE file in the root directory of this source tree. """This script uses the loop optimizations service without needing to use the bazel build system. Prerequisite: # In the repo's INSTALL.md...
CompilerGym-development
examples/loop_optimizations_service/example_without_bazel.py
# Copyright (c) Facebook, Inc. and its affiliates. # # This source code is licensed under the MIT license found in the # LICENSE file in the root directory of this source tree. import compiler_gym import examples.loop_optimizations_service as loop_optimizations_service # noqa Register environments. with compiler_gym....
CompilerGym-development
examples/loop_optimizations_service/example.py
#! /usr/bin/env python3 # # Copyright (c) Facebook, Inc. and its affiliates. # # This source code is licensed under the MIT license found in the # LICENSE file in the root directory of this source tree. """An example CompilerGym service in python.""" import logging import os import shutil import subprocess from pathlib...
CompilerGym-development
examples/loop_optimizations_service/service_py/loops_opt_service.py
# Copyright (c) Facebook, Inc. and its affiliates. # # This source code is licensed under the MIT license found in the # LICENSE file in the root directory of this source tree. import logging from enum import Enum from pathlib import Path from threading import Lock from typing import Union import numpy as np from llvm...
CompilerGym-development
examples/llvm_autotuning/optimization_target.py
# Copyright (c) Facebook, Inc. and its affiliates. # # This source code is licensed under the MIT license found in the # LICENSE file in the root directory of this source tree.
CompilerGym-development
examples/llvm_autotuning/__init__.py
# Copyright (c) Facebook, Inc. and its affiliates. # # This source code is licensed under the MIT license found in the # LICENSE file in the root directory of this source tree. import json import logging from pathlib import Path from typing import Dict, Iterable, List import gym import pandas as pd import yaml from ll...
CompilerGym-development
examples/llvm_autotuning/experiment.py
# Copyright (c) Facebook, Inc. and its affiliates. # # This source code is licensed under the MIT license found in the # LICENSE file in the root directory of this source tree. import os import sys import hydra from llvm_autotuning.experiment import Experiment from omegaconf import DictConfig, OmegaConf from pydantic ...
CompilerGym-development
examples/llvm_autotuning/tune.py
# Copyright (c) Facebook, Inc. and its affiliates. # # This source code is licensed under the MIT license found in the # LICENSE file in the root directory of this source tree. import logging from compiler_gym.wrappers import CompilerEnvWrapper logger = logging.getLogger(__name__) # TODO(github.com/facebookresearch...
CompilerGym-development
examples/llvm_autotuning/just_keep_going_env.py
# Copyright (c) Facebook, Inc. and its affiliates. # # This source code is licensed under the MIT license found in the # LICENSE file in the root directory of this source tree. import sys from pathlib import Path from typing import List import pandas as pd from llvm_autotuning.experiment import Experiment from pydanti...
CompilerGym-development
examples/llvm_autotuning/info.py
# Copyright (c) Facebook, Inc. and its affiliates. # # This source code is licensed under the MIT license found in the # LICENSE file in the root directory of this source tree. from itertools import islice from typing import Iterable, List, Union from pydantic import BaseModel, Field, root_validator, validator from c...
CompilerGym-development
examples/llvm_autotuning/benchmarks.py