Skip to content

Commit

Permalink
Merge pull request #545 from facebookresearch/release/v0.2.2
Browse files Browse the repository at this point in the history
Release v0.2.2
  • Loading branch information
ChrisCummins authored Jan 21, 2022
2 parents 100967a + c1fabd7 commit c6f46eb
Show file tree
Hide file tree
Showing 238 changed files with 10,700 additions and 1,190 deletions.
2 changes: 1 addition & 1 deletion .bazelversion
Original file line number Diff line number Diff line change
@@ -1 +1 @@
4.0.0
4.2.2
2 changes: 1 addition & 1 deletion .github/ISSUE_TEMPLATE/--bug-report.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
name: "\U0001F41B Bug Report"
about: Create a report to help us improve CompilerGym
title: ''
labels: ''
labels: 'Bug'
assignees: ''

---
Expand Down
2 changes: 1 addition & 1 deletion .github/ISSUE_TEMPLATE/--questions-help-support.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
name: "❓Questions/Help/Support"
about: Do you need support? We have resources.
title: ''
labels: ''
labels: 'Question'
assignees: ''

---
Expand Down
2 changes: 1 addition & 1 deletion .github/actions/install-build-dependencies/action.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ runs:
sudo apt-get install -y clang-9 patchelf
fi
python -m pip install -U pip wheel
python -m pip install -r compiler_gym/requirements.txt
python -m pip install -r compiler_gym/requirements_build.txt
shell: bash
env:
LDFLAGS: -L/usr/local/opt/zlib/lib
Expand Down
27 changes: 27 additions & 0 deletions .github/actions/install-cmake-build-dependencies/action.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
---
name: Install CMake build dependencies
description: Install CMake build dependencies
runs:
using: composite
steps:
- uses: ./.github/actions/install-build-dependencies

- name: Install CMake dependencies
run: |
if [ "$(uname)" = "Darwin" ]; then
echo "CMake build for Darwin is unimplemented."
exit 1
else
# Compiler
sudo apt-get install clang++-9 lld-9 tar bzip2 ninja-build
sudo apt-get install tar bzip2 ninja-build
# CMake
wget https://github.com/Kitware/CMake/releases/download/v3.20.5/cmake-3.20.5-linux-x86_64.sh -O /tmp/cmake.sh
sudo bash /tmp/cmake.sh --prefix=/usr/local --exclude-subdir --skip-license
rm /tmp/cmake.sh
# protobuf
sudo apt-get install autoconf libtool make
# Testing
sudo apt-get install coreutils
fi
shell: bash
88 changes: 70 additions & 18 deletions .github/workflows/ci.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -14,15 +14,6 @@ jobs:
build-linux:
runs-on: ubuntu-latest
steps:
- name: Persist the bazel cache
uses: actions/cache@v2
with:
path: ~/.cache/bazel/_bazel_runner
key: bazel-${{ runner.os }}-${{ hashFiles('WORKSPACE') }}-${{ hashFiles('**/BUILD') }}
restore-keys: |
bazel-${{ runner.os }}-${{ hashFiles('WORKSPACE') }}-
bazel-${{ runner.os }}-
- uses: actions/checkout@v2

- uses: actions/setup-python@v2
Expand All @@ -49,18 +40,46 @@ jobs:
if-no-files-found: error
retention-days: 7

build-macos:
runs-on: macos-latest
build-linux-cmake:
runs-on: ubuntu-latest
steps:
- name: Persist the bazel cache
uses: actions/cache@v2
- uses: actions/checkout@v2

- uses: actions/setup-python@v2
with:
python-version: 3.9

- name: Install build dependencies
uses: ./.github/actions/install-cmake-build-dependencies

- name: CMake Build
run: |
cmake \
-GNinja \
-DCMAKE_C_COMPILER=clang-9 \
-DCMAKE_CXX_COMPILER=clang++-9 \
-DCMAKE_EXE_LINKER_FLAGS_INIT="-fuse-ld=lld" \
-DCMAKE_MODULE_LINKER_FLAGS_INIT="-fuse-ld=lld" \
-DCMAKE_SHARED_LINKER_FLAGS_INIT="-fuse-ld=lld" \
-DPython3_FIND_VIRTUALENV=FIRST \
-DCOMPILER_GYM_BUILD_TESTS=ON \
-DCOMPILER_GYM_BUILD_EXAMPLES=ON \
-S . \
-B ~/cmake_build
cmake --build ~/cmake_build
shell: bash

- name: Upload Python wheel
uses: actions/upload-artifact@v2
with:
path: /private/var/tmp/_bazel_runner
key: bazel-${{ runner.os }}-${{ hashFiles('WORKSPACE') }}-${{ hashFiles('**/BUILD') }}
restore-keys: |
bazel-${{ runner.os }}-${{ hashFiles('WORKSPACE') }}-
bazel-${{ runner.os }}-
name: linux-wheel-cmake
path: ~/cmake_build/py_pkg/dist/*.whl
if-no-files-found: error
retention-days: 7

build-macos:
runs-on: macos-latest
steps:
- uses: actions/checkout@v2

- uses: actions/setup-python@v2
Expand Down Expand Up @@ -119,6 +138,39 @@ jobs:

- name: Upload coverage report to Codecov
uses: codecov/codecov-action@v2

test-linux-cmake:
needs: build-linux-cmake
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
python: [3.9]
steps:
- uses: actions/checkout@v2

- name: Set up Python ${{ matrix.python }}
uses: actions/setup-python@v2
with:
python-version: ${{ matrix.python }}

- name: Download Python wheel
uses: actions/download-artifact@v2
with:
name: linux-wheel-cmake

- name: Install wheel
run: python -m pip install *.whl

- name: Install runtime dependencies
uses: ./.github/actions/install-runtime-dependencies

- name: Install test dependencies
run: python -m pip install -r tests/requirements.txt

- name: Run the test suite
run: make install-test

test-macos:
needs: build-macos
runs-on: macos-latest
Expand Down
1 change: 0 additions & 1 deletion .github/workflows/pre_commit.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,6 @@ jobs:

- name: Install Python dependencies
run: |
sudo apt-get install python3-setuptools
python3 -m pip install --upgrade wheel
python3 -m pip install -r requirements_pre_commit.txt
python3 -m isort --version
Expand Down
54 changes: 54 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,57 @@
## Release 0.2.2 (2022-01-19)

Amongst the highlights of this release are support for building with CMake and a
new compiler environment based on loop unrolling. Many thanks to @sogartar,
@mostafaelhoushi, @KyleHerndon, and @yqtianust for code contributions!

- Added support for building CompilerGym from source on Linux using **CMake**
([#498](https://github.com/facebookresearch/CompilerGym/pull/498),
[#478](https://github.com/facebookresearch/CompilerGym/pull/478)). The new
build system coexists with the bazel build and enables customization over the
CMake configuration used to build the LLVM environment. See
[INSTALL.md](https://github.com/facebookresearch/CompilerGym/blob/development/INSTALL.md#building-from-source-with-cmake)
for details. Credit: @sogartar, @KyleHerndon.
- Added an environment for loop optimizations in LLVM
([#530](https://github.com/facebookresearch/CompilerGym/pull/530),
[#529](https://github.com/facebookresearch/CompilerGym/pull/529),
[#517](https://github.com/facebookresearch/CompilerGym/pull/517)). This new
example environment provides control over loop unrolling factors and
demonstrates how to build a standalone LLVM binary using the new CMake build
system. Credit: @mostafaelhoushi.
- Added a new `BenchmarkUri` class and API for parsing URIs
([#525](https://github.com/facebookresearch/CompilerGym/pull/525)). This
enables benchmarks to have optional parameters that can be used by the backend
services to modify their behavior.
- **[llvm]** Enabled runtime reward to be calculated on systems where `/dev/shm`
does not permit executables
([#510](https://github.com/facebookresearch/CompilerGym/pull/510)).
- **[llvm]** Added a new `benchmark://mibench-v1` dataset and deprecated
`benchmark://mibench-v0`
([#511](https://github.com/facebookresearch/CompilerGym/pull/511)). If you are
using `mibench-v0`, please update to the new version.
- **[llvm]** Enabled all 20 of the cBench runtime datasets to be used by the
`benchmark://cbench-v1` dataset
([#525](https://github.com/facebookresearch/CompilerGym/pull/525)).
- Made the `site_data_base` argument of the `Dataset` class constructor optional
([#518](https://github.com/facebookresearch/CompilerGym/pull/518)).
- Added support for building CompilerGym from source on macOS Monterey
([#494](https://github.com/facebookresearch/CompilerGym/issues/494)).
- Removed the legacy dataset scripts and APIs that were deprecated in v0.1.8.
Please use the [new dataset
API](https://compilergym.com/compiler_gym/datasets.html#datasets). The
following has been removed:
- The `compiler_gym.bin.datasets` script.
- The properties: `CompilerEnv.available_datasets`, and
`CompilerEnv.benchmarks`.
- The `CompilerEnv.require_dataset()`, `CompilerEnv.require_datasets()`,
`CompilerEnv.register_dataset()`, and
`CompilerEnv.get_benchmark_validation_callback()` methods.
- Numerous other bug fixes and improvements.

**Full Change Log**:
[v0.2.1...v0.2.2](https://github.com/facebookresearch/CompilerGym/compare/v0.2.1...v0.2.2)


## Release 0.2.1 (2021-11-17)

Highlights of this release include:
Expand Down
4 changes: 2 additions & 2 deletions CITATION.cff
Original file line number Diff line number Diff line change
Expand Up @@ -31,8 +31,8 @@ authors:
- family-names: "Leather"
given-names: "Hugh"
title: "CompilerGym"
version: 0.2.1
date-released: 2021-11-17
version: 0.2.2
date-released: 2022-01-19
url: "https://github.com/facebookresearch/CompilerGym"
preferred-citation:
type: article
Expand Down
72 changes: 72 additions & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,72 @@
# 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.

cmake_minimum_required(VERSION 3.20)

if(CMAKE_CURRENT_SOURCE_DIR STREQUAL CMAKE_CURRENT_BINARY_DIR)
message(FATAL_ERROR "In-source builds are unsupported. Please, build out of the source tree.")
endif()

if (${CMAKE_SYSTEM_NAME} MATCHES "Darwin")
set(DARWIN TRUE)
endif()

set(CMAKE_EXPORT_COMPILE_COMMANDS ON)

project(compiler_gym ASM C CXX)

set(CMAKE_C_STANDARD 11 CACHE STRING "C standard to be used.")
set(CMAKE_CXX_STANDARD 17 CACHE STRING "C++ standard to be used.")

set_property(GLOBAL PROPERTY USE_FOLDERS ON)

list(APPEND CMAKE_MODULE_PATH
${CMAKE_CURRENT_LIST_DIR}/build_tools/cmake/
)

set(COMPILER_GYM_BUILD_TESTS OFF CACHE BOOL "Enable Compiler Gym tests.")
set(COMPILER_GYM_BUILD_EXAMPLES OFF CACHE BOOL "Enable Comiler Gym examples.")

include(cg_macros)
include(cg_copts)
include(cg_genrule)
include(cg_cc_binary)
include(cg_cc_library)
include(cg_cc_test)
include(cg_py_binary)
include(cg_py_library)
include(cg_py_test)
include(cg_python)
include(cg_add_all_subdirs)
include(cg_filegroup)
include(grpc)
include(protobuf)

set(COMPILER_GYM_PYTHONPATH "$ENV{PYTHONPATH}" CACHE STRING "PYTHONPATH environment variable during build step.")
if (COMPILER_GYM_PYTHONPATH)
string(PREPEND COMPILER_GYM_PYTHONPATH ":")
endif()
string(PREPEND COMPILER_GYM_PYTHONPATH "${CMAKE_BINARY_DIR}")
include(set_command_pythonpath)

set(DEFAULT_CMAKE_BUILD_TYPE "Release")
if(NOT CMAKE_BUILD_TYPE AND NOT CMAKE_CONFIGURATION_TYPES)
message(STATUS "No build type selected, default to ${DEFAULT_CMAKE_BUILD_TYPE}")
set(CMAKE_BUILD_TYPE "${DEFAULT_CMAKE_BUILD_TYPE}" CACHE STRING "Build type (default ${DEFAULT_CMAKE_BUILD_TYPE})" FORCE)
endif()

set(CMAKE_POSITION_INDEPENDENT_CODE TRUE)

find_package(Python3 REQUIRED COMPONENTS Interpreter)

include(external/external.cmake)
add_subdirectory(compiler_gym)
if(COMPILER_GYM_BUILD_TESTS)
enable_testing()
add_subdirectory(tests)
endif()
if(COMPILER_GYM_BUILD_EXAMPLES)
add_subdirectory(examples)
endif()
Loading

0 comments on commit c6f46eb

Please sign in to comment.