[llvm] b32e76c - [mlgo] fix build rules

Mircea Trofin via llvm-commits llvm-commits at lists.llvm.org
Sat Apr 3 12:59:13 PDT 2021


Author: Mircea Trofin
Date: 2021-04-03T12:49:03-07:00
New Revision: b32e76c6d507361b3cf2f1bed6756cd228588236

URL: https://github.com/llvm/llvm-project/commit/b32e76c6d507361b3cf2f1bed6756cd228588236
DIFF: https://github.com/llvm/llvm-project/commit/b32e76c6d507361b3cf2f1bed6756cd228588236.diff

LOG: [mlgo] fix build rules

This was prompted by D95727, which had the side-effect to break the
'release' mode build bot for ML-driven policies. The problem is that now
the pre-compiled object files don't get transitively carried through as
'source' anymore; that being said, the previous way of consuming them
was problematic, because it was only working for static builds; in
dynamic builds, the whole tf_xla_runtime was linked, which is
undesirable.

The alternative is to treat tf_xla_runtime as an archive, which then
leads to the desired effect.

Differential Revision: https://reviews.llvm.org/D99829

Added: 
    

Modified: 
    llvm/CMakeLists.txt
    llvm/lib/Analysis/CMakeLists.txt

Removed: 
    


################################################################################
diff  --git a/llvm/CMakeLists.txt b/llvm/CMakeLists.txt
index ddd81d608cae..9e9785345c43 100644
--- a/llvm/CMakeLists.txt
+++ b/llvm/CMakeLists.txt
@@ -794,6 +794,9 @@ if (NOT TENSORFLOW_AOT_PATH STREQUAL "")
   include_directories(${TENSORFLOW_AOT_PATH}/include)
   add_subdirectory(${TENSORFLOW_AOT_PATH}/xla_aot_runtime_src
     ${CMAKE_ARCHIVE_OUTPUT_DIRECTORY}/tf_runtime)
+  install(TARGETS tf_xla_runtime EXPORT LLVMExports 
+    ARCHIVE DESTINATION lib${LLVM_LIBDIR_SUFFIX} COMPONENT tf_xla_runtime)
+  set_property(GLOBAL APPEND PROPERTY LLVM_EXPORTS tf_xla_runtime)
 endif()
 
 # Keep the legacy CMake flag ENABLE_EXPERIMENTAL_NEW_PASS_MANAGER for

diff  --git a/llvm/lib/Analysis/CMakeLists.txt b/llvm/lib/Analysis/CMakeLists.txt
index c866d6b118f3..114542d4eb03 100644
--- a/llvm/lib/Analysis/CMakeLists.txt
+++ b/llvm/lib/Analysis/CMakeLists.txt
@@ -6,9 +6,10 @@ if (DEFINED LLVM_HAVE_TF_AOT OR DEFINED LLVM_HAVE_TF_API)
     include(TensorFlowCompile)
     tfcompile(${LLVM_INLINER_MODEL_PATH} serve action InlinerSizeModel llvm::InlinerSizeModel)
     list(APPEND GeneratedMLSources
-      $<TARGET_OBJECTS:tf_xla_runtime_objects>
-      ${GENERATED_OBJS}
+      ${GENERATED_HEADERS}
     )
+    LIST(APPEND MLDeps tf_xla_runtime)
+    LIST(APPEND MLLinkDeps tf_xla_runtime ${GENERATED_OBJS})
   endif()
 
   if (DEFINED LLVM_HAVE_TF_API)
@@ -137,6 +138,7 @@ add_llvm_component_library(LLVMAnalysis
 
   DEPENDS
   intrinsics_gen
+  ${MLDeps}
 
   LINK_LIBS
   ${MLLinkDeps}


        


More information about the llvm-commits mailing list