Skip to content

Commit

Permalink
WIP: ir2vec CMake support
Browse files Browse the repository at this point in the history
  • Loading branch information
ChrisCummins committed Mar 21, 2022
1 parent adce428 commit 4223b3d
Show file tree
Hide file tree
Showing 4 changed files with 46 additions and 3 deletions.
6 changes: 3 additions & 3 deletions WORKSPACE
Original file line number Diff line number Diff line change
Expand Up @@ -367,9 +367,9 @@ cc_library(
],
)
""",
sha256 = "92cbe1d023593c2d45588caf2b1530795f376045e8bc3d2868ba349fb8d61ea5",
strip_prefix = "IR2Vec-1.1.0",
urls = ["https://github.com/IITH-Compilers/IR2Vec/archive/refs/tags/v1.1.0.tar.gz"],
sha256 = "92cbe1d0235a3c2d45588caf2b1530795f376045e8bc3d2868ba349fb8d61ea5",
strip_prefix = "IR2Vec-828e50584b9c8bc305208e22d2cca272bdb1ab64",
urls = ["https://github.com/ChrisCummins/IR2Vec/archive/828e50584b9c8bc305208e22d2cca272bdb1ab64.tar.gz"],
)

# === Eigen ===
Expand Down
1 change: 1 addition & 0 deletions compiler_gym/envs/llvm/service/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -238,6 +238,7 @@ cg_cc_library(
CpuInfo::cpuinfo
Boost::filesystem
glog::glog
ir2vec::ir2vec
${_LLVM_LIBS}
magic_enum
nlohmann_json::nlohmann_json
Expand Down
19 changes: 19 additions & 0 deletions external/external.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -135,6 +135,25 @@ else()
find_package(glog REQUIRED)
endif()

# === IR2Vec ===
# https://github.com/IITH-Compilers/IR2Vec

set(COMPILER_GYM_IR2VEC_PROVIDER "internal"
CACHE STRING "Find or build IR2Vec together with Compiler Gym."
)
set_property(
CACHE COMPILER_GYM_IR2VEC_PROVIDER
PROPERTY STRINGS "internal" "external"
)
if(COMPILER_GYM_IR2VEC_PROVIDER STREQUAL "internal")
build_external_cmake_project(
NAME ir2vec
SRC_DIR "${CMAKE_CURRENT_LIST_DIR}/ir2vec"
)
else()
find_package(ir2vec REQUIRED)
endif()

# === LLVM ===

set(COMPILER_GYM_LLVM_PROVIDER "internal"
Expand Down
23 changes: 23 additions & 0 deletions external/ir2vec/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
# 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.

project(ir2vec)
cmake_minimum_required(VERSION 3.15)

include(ExternalProject)

externalproject_add(
ir2vec
PREFIX "${CMAKE_CURRENT_BINARY_DIR}/ir2vec"
GIT_REPOSITORY "https://github.com/ChrisCummins/IR2Vec.git"
GIT_TAG 828e50584b9c8bc305208e22d2cca272bdb1ab64
CMAKE_ARGS
-C "${CMAKE_CURRENT_BINARY_DIR}/ir2vec_initial_cache.cmake"
"-DCMAKE_INSTALL_PREFIX=${CMAKE_INSTALL_PREFIX}"
"-DLT_LLVM_INSTALL_DIR=${CMAKE_INSTALL_PREFIX}"
USES_TERMINAL_CONFIGURE TRUE
USES_TERMINAL_BUILD TRUE
USES_TERMINAL_INSTALL TRUE
)

0 comments on commit 4223b3d

Please sign in to comment.