Skip to content

Commit 652e304

Browse files
committed
[llvm][NFC] Remove definition from build system of LLVM_HAVE_TF_AOT
We can just use the definition from config.h. This means we need to move a few lines around in CMakeLists.txt - the TF_AOT detection needs to be before the spot we process the config.h.cmake files. Differential Revision: https://reviews.llvm.org/D84349
1 parent d26526f commit 652e304

File tree

2 files changed

+24
-28
lines changed

2 files changed

+24
-28
lines changed

llvm/CMakeLists.txt

+23-28
Original file line numberDiff line numberDiff line change
@@ -845,6 +845,29 @@ if (tensorflow_c_api)
845845
include_directories(${TENSORFLOW_C_LIB_PATH}/include)
846846
endif()
847847

848+
# They are not referenced. See set_output_directory().
849+
set( CMAKE_RUNTIME_OUTPUT_DIRECTORY ${LLVM_BINARY_DIR}/bin )
850+
set( CMAKE_LIBRARY_OUTPUT_DIRECTORY ${LLVM_BINARY_DIR}/lib${LLVM_LIBDIR_SUFFIX} )
851+
set( CMAKE_ARCHIVE_OUTPUT_DIRECTORY ${LLVM_BINARY_DIR}/lib${LLVM_LIBDIR_SUFFIX} )
852+
853+
# For up-to-date instructions for installing the Tensorflow dependency, refer to
854+
# the bot setup script: https://github.com/google/ml-compiler-opt/blob/master/buildbot/buildbot_init.sh
855+
# Specifically, assuming python3 is installed:
856+
# python3 -m pip install --upgrade pip && python3 -m pip install --user tf_nightly==2.3.0.dev20200528
857+
# Then set TENSORFLOW_AOT_PATH to the package install - usually it's ~/.local/lib/python3.7/site-packages/tensorflow
858+
#
859+
set(TENSORFLOW_AOT_PATH "" CACHE PATH "Path to TensorFlow pip install dir")
860+
861+
if (NOT TENSORFLOW_AOT_PATH STREQUAL "")
862+
set(LLVM_HAVE_TF_AOT "ON" CACHE BOOL "Tensorflow AOT available")
863+
set(TENSORFLOW_AOT_COMPILER
864+
"${TENSORFLOW_AOT_PATH}/../../../../bin/saved_model_cli"
865+
CACHE PATH "Path to the Tensorflow AOT compiler")
866+
include_directories(${TENSORFLOW_AOT_PATH}/include)
867+
add_subdirectory(${TENSORFLOW_AOT_PATH}/xla_aot_runtime_src
868+
${CMAKE_ARCHIVE_OUTPUT_DIRECTORY}/tf_runtime)
869+
endif()
870+
848871
# Configure the three LLVM configuration header files.
849872
configure_file(
850873
${LLVM_MAIN_INCLUDE_DIR}/llvm/Config/config.h.cmake
@@ -875,12 +898,6 @@ add_custom_target(srpm
875898
COMMAND rpmbuild -bs --define '_topdir ${LLVM_SRPM_DIR}' ${LLVM_SRPM_BINARY_SPECFILE})
876899
set_target_properties(srpm PROPERTIES FOLDER "Misc")
877900

878-
879-
# They are not referenced. See set_output_directory().
880-
set( CMAKE_RUNTIME_OUTPUT_DIRECTORY ${LLVM_BINARY_DIR}/bin )
881-
set( CMAKE_LIBRARY_OUTPUT_DIRECTORY ${LLVM_BINARY_DIR}/lib${LLVM_LIBDIR_SUFFIX} )
882-
set( CMAKE_ARCHIVE_OUTPUT_DIRECTORY ${LLVM_BINARY_DIR}/lib${LLVM_LIBDIR_SUFFIX} )
883-
884901
if(APPLE AND DARWIN_LTO_LIBRARY)
885902
set(CMAKE_EXE_LINKER_FLAGS
886903
"${CMAKE_EXE_LINKER_FLAGS} -Wl,-lto_library -Wl,${DARWIN_LTO_LIBRARY}")
@@ -975,28 +992,6 @@ if( MINGW AND NOT "${CMAKE_CXX_COMPILER_ID}" MATCHES "Clang" )
975992
llvm_replace_compiler_option(CMAKE_CXX_FLAGS_RELEASE "-O3" "-O2")
976993
endif()
977994

978-
# For up-to-date instructions for installing the Tensorflow dependency, refer to
979-
# the bot setup script: https://github.com/google/ml-compiler-opt/blob/master/buildbot/buildbot_init.sh
980-
# Specifically, assuming python3 is installed:
981-
# python3 -m pip install --upgrade pip && python3 -m pip install --user tf_nightly==2.3.0.dev20200528
982-
# Then set TENSORFLOW_AOT_PATH to the package install - usually it's ~/.local/lib/python3.7/site-packages/tensorflow
983-
#
984-
set(TENSORFLOW_AOT_PATH "" CACHE PATH "Path to TensorFlow pip install dir")
985-
986-
if (NOT TENSORFLOW_AOT_PATH STREQUAL "")
987-
set(LLVM_HAVE_TF_AOT "ON" CACHE BOOL "Tensorflow AOT available")
988-
set(TENSORFLOW_AOT_COMPILER
989-
"${TENSORFLOW_AOT_PATH}/../../../../bin/saved_model_cli"
990-
CACHE PATH "Path to the Tensorflow AOT compiler")
991-
# Unlike the LLVM_HAVE_TF_API case, we don't need to expose this through
992-
# llvm-config.h, because it's an internal implementation detail. A user of the llvm library that wants to also
993-
# use the TF AOT compiler may do so through their custom build step.
994-
add_definitions("-DLLVM_HAVE_TF_AOT")
995-
include_directories(${TENSORFLOW_AOT_PATH}/include)
996-
add_subdirectory(${TENSORFLOW_AOT_PATH}/xla_aot_runtime_src
997-
${CMAKE_ARCHIVE_OUTPUT_DIRECTORY}/tf_runtime)
998-
endif()
999-
1000995
# Put this before tblgen. Else we have a circular dependence.
1001996
add_subdirectory(lib/Demangle)
1002997
add_subdirectory(lib/Support)

llvm/include/llvm/Analysis/InlineAdvisor.h

+1
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@
1414
#include <vector>
1515

1616
#include "llvm/Analysis/InlineCost.h"
17+
#include "llvm/Config/config.h"
1718
#include "llvm/IR/PassManager.h"
1819

1920
namespace llvm {

0 commit comments

Comments
 (0)