Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix CMake Linux for opt-loops #608

Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions compiler_gym/third_party/autophase/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -53,3 +53,6 @@ cg_cc_binary(
${LLVM_DEFINITIONS}
PUBLIC
)

ADD_CUSTOM_TARGET(link_compute_autophase_target ALL
COMMAND ${CMAKE_COMMAND} -E create_symlink ${CMAKE_BINARY_DIR}/compiler_gym/third_party/autophase/compute_autophase ${CMAKE_SOURCE_DIR}/compiler_gym/third_party/autophase/compute_autophase-prelinked)
15 changes: 9 additions & 6 deletions compiler_gym/third_party/programl/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@

cg_add_all_subdirs()

llvm_map_components_to_libnames(_LLVM_LIBS analysis core irreader support)
llvm_map_components_to_libnames(_LLVM_LIBS analysis core irreader support passes)
cg_cc_binary(
NAME
compute_programl
Expand All @@ -14,17 +14,20 @@ cg_cc_binary(
COPTS
"-DGOOGLE_PROTOBUF_NO_RTTI"
"-fno-rtti"
DEPS
nlohmann_json::nlohmann_json
ProGraML::graph::format::node_link_graph
ProGraML::ir::llvm::llvm-10
ProGraML::proto::programl_cc
ABS_DEPS
glog::glog
${_LLVM_LIBS}
ProGraML::graph::format::node_link_graph
ProGraML::ir::llvm::llvm-10
ProGraML::proto::programl_cc
nlohmann_json::nlohmann_json
protobuf::libprotobuf
INCLUDES
${LLVM_INCLUDE_DIRS}
DEFINES
${LLVM_DEFINITIONS}
PUBLIC
)

ADD_CUSTOM_TARGET(link_compute_programl_target ALL
COMMAND ${CMAKE_COMMAND} -E create_symlink ${CMAKE_BINARY_DIR}/compiler_gym/third_party/programl/compute_programl ${CMAKE_SOURCE_DIR}/compiler_gym/third_party/programl/compute_programl)
Original file line number Diff line number Diff line change
Expand Up @@ -158,7 +158,7 @@ def benchmark_from_parsed_uri(self, uri: BenchmarkUri) -> Benchmark:
with compiler_gym.make(
"loops-opt-py-v0",
benchmark="loops-opt-v0/add",
observation_space="ir",
observation_space="Programl",
reward_space="runtime",
) as env:
compiler_gym.set_debug_level(4) # TODO: check why this has no effect
Expand Down
4 changes: 2 additions & 2 deletions examples/loop_optimizations_service/service_py/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,8 @@ cg_py_library(
"loops_opt_service.py"
DATA
examples::loop_optimizations_service::opt_loops::opt_loops
compiler_gym::third_party::autophase:compute_autophase
compiler_gym::third_party::programl:compute_programl
compiler_gym::third_party::autophase::compute_autophase
compiler_gym::third_party::programl::compute_programl
DEPS
PUBLIC
)
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@
from compiler_gym.third_party.autophase import AUTOPHASE_FEATURE_NAMES
from compiler_gym.third_party.inst2vec import Inst2vecEncoder
from compiler_gym.util.commands import run_command
from compiler_gym.util.runfiles_path import runfiles_path
from compiler_gym.util.runfiles_path import runfiles_path # noqa
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why keep this import?


_INST2VEC_ENCODER = Inst2vecEncoder()

Expand Down Expand Up @@ -270,8 +270,9 @@ def get_observation(self, observation_space: ObservationSpace) -> Event:
elif observation_space.name == "Autophase":
Autophase_str = run_command(
[
runfiles_path(
"compiler_gym/third_party/autophase/compute_autophase-prelinked"
os.path.join(
os.path.dirname(__file__),
"../../../compiler_gym/third_party/autophase/compute_autophase-prelinked",
),
self._llvm_path,
],
Expand All @@ -286,8 +287,9 @@ def get_observation(self, observation_space: ObservationSpace) -> Event:
elif observation_space.name == "AutophaseDict":
Autophase_str = run_command(
[
runfiles_path(
"compiler_gym/third_party/autophase/compute_autophase-prelinked"
os.path.join(
os.path.dirname(__file__),
"../../../compiler_gym/third_party/autophase/compute_autophase-prelinked",
),
self._llvm_path,
],
Expand All @@ -302,7 +304,10 @@ def get_observation(self, observation_space: ObservationSpace) -> Event:
elif observation_space.name == "Programl":
Programl_str = run_command(
[
runfiles_path("compiler_gym/third_party/programl/compute_programl"),
os.path.join(
os.path.dirname(__file__),
"../../../compiler_gym/third_party/programl/compute_programl",
),
self._llvm_path,
],
timeout=30,
Expand Down