Skip to content

Commit 8712235

Browse files
ChrisCumminsChris Cummins
authored andcommitted
WIP: ir2vec CMake support
1 parent a14f891 commit 8712235

File tree

4 files changed

+46
-3
lines changed

4 files changed

+46
-3
lines changed

WORKSPACE

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -367,9 +367,9 @@ cc_library(
367367
],
368368
)
369369
""",
370-
sha256 = "92cbe1d023593c2d45588caf2b1530795f376045e8bc3d2868ba349fb8d61ea5",
371-
strip_prefix = "IR2Vec-1.1.0",
372-
urls = ["https://github.com/IITH-Compilers/IR2Vec/archive/refs/tags/v1.1.0.tar.gz"],
370+
sha256 = "92cbe1d0235a3c2d45588caf2b1530795f376045e8bc3d2868ba349fb8d61ea5",
371+
strip_prefix = "IR2Vec-828e50584b9c8bc305208e22d2cca272bdb1ab64",
372+
urls = ["https://github.com/ChrisCummins/IR2Vec/archive/828e50584b9c8bc305208e22d2cca272bdb1ab64.tar.gz"],
373373
)
374374

375375
# === Eigen ===

compiler_gym/envs/llvm/service/CMakeLists.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -238,6 +238,7 @@ cg_cc_library(
238238
CpuInfo::cpuinfo
239239
Boost::filesystem
240240
glog::glog
241+
ir2vec::ir2vec
241242
${_LLVM_LIBS}
242243
magic_enum
243244
nlohmann_json::nlohmann_json

external/external.cmake

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -135,6 +135,25 @@ else()
135135
find_package(glog REQUIRED)
136136
endif()
137137

138+
# === IR2Vec ===
139+
# https://github.com/IITH-Compilers/IR2Vec
140+
141+
set(COMPILER_GYM_IR2VEC_PROVIDER "internal"
142+
CACHE STRING "Find or build IR2Vec together with Compiler Gym."
143+
)
144+
set_property(
145+
CACHE COMPILER_GYM_IR2VEC_PROVIDER
146+
PROPERTY STRINGS "internal" "external"
147+
)
148+
if(COMPILER_GYM_IR2VEC_PROVIDER STREQUAL "internal")
149+
build_external_cmake_project(
150+
NAME ir2vec
151+
SRC_DIR "${CMAKE_CURRENT_LIST_DIR}/ir2vec"
152+
)
153+
else()
154+
find_package(ir2vec REQUIRED)
155+
endif()
156+
138157
# === LLVM ===
139158

140159
set(COMPILER_GYM_LLVM_PROVIDER "internal"

external/ir2vec/CMakeLists.txt

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
# Copyright (c) Facebook, Inc. and its affiliates.
2+
#
3+
# This source code is licensed under the MIT license found in the
4+
# LICENSE file in the root directory of this source tree.
5+
6+
project(ir2vec)
7+
cmake_minimum_required(VERSION 3.15)
8+
9+
include(ExternalProject)
10+
11+
externalproject_add(
12+
ir2vec
13+
PREFIX "${CMAKE_CURRENT_BINARY_DIR}/ir2vec"
14+
GIT_REPOSITORY "https://github.com/ChrisCummins/IR2Vec.git"
15+
GIT_TAG 828e50584b9c8bc305208e22d2cca272bdb1ab64
16+
CMAKE_ARGS
17+
-C "${CMAKE_CURRENT_BINARY_DIR}/ir2vec_initial_cache.cmake"
18+
"-DCMAKE_INSTALL_PREFIX=${CMAKE_INSTALL_PREFIX}"
19+
"-DLT_LLVM_INSTALL_DIR=${CMAKE_INSTALL_PREFIX}"
20+
USES_TERMINAL_CONFIGURE TRUE
21+
USES_TERMINAL_BUILD TRUE
22+
USES_TERMINAL_INSTALL TRUE
23+
)

0 commit comments

Comments
 (0)