[PATCH] D140061: [mlgo] Use LLVM_HAVE_TFLITE instead of LLVM_HAVE_TF_API

Kazu Hirata via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Wed Dec 14 14:45:12 PST 2022


kazu created this revision.
Herald added a subscriber: hiraditya.
Herald added a project: All.
kazu requested review of this revision.
Herald added a project: LLVM.
Herald added a subscriber: llvm-commits.

This patch replaces uses of LLVM_HAVE_TF_API with LLVM_HAVE_TFLITE in
a couple of CMakeLists.txt.

Now that 842b0d0fe2dd142305a9461e50cdce9aff7f86bc <https://reviews.llvm.org/rG842b0d0fe2dd142305a9461e50cdce9aff7f86bc> has landed,
we now have:

  LLVM_HAVE_TF_API is defined if and only if LLVM_HAVE_TFLITE
  evaluates to true

in the CMake variable world (assuming that you do not set
LLVM_HAVE_TF_API on the cmake invocation).

FWIW, the story is a little different in the C++ macro world, where:

  LLVM_HAVE_TF_API is defined if and only if LLVM_HAVE_TFLITE is
  defined

This is why edc83a15b45e6b91fce3f35622a6b0a6d34e5211 <https://reviews.llvm.org/rGedc83a15b45e6b91fce3f35622a6b0a6d34e5211> consisted only of
mechanical replacements.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D140061

Files:
  llvm/lib/Analysis/CMakeLists.txt
  llvm/unittests/Analysis/CMakeLists.txt


Index: llvm/unittests/Analysis/CMakeLists.txt
===================================================================
--- llvm/unittests/Analysis/CMakeLists.txt
+++ llvm/unittests/Analysis/CMakeLists.txt
@@ -7,7 +7,7 @@
   )
 
 set(MLGO_TESTS TFUtilsTest.cpp TrainingLoggerTest.cpp)
-if (DEFINED LLVM_HAVE_TF_API)
+if (LLVM_HAVE_TFLITE)
   LIST(APPEND EXTRA_TESTS ${MLGO_TESTS})
 else()
   LIST(APPEND LLVM_OPTIONAL_SOURCES ${MLGO_TESTS})
Index: llvm/lib/Analysis/CMakeLists.txt
===================================================================
--- llvm/lib/Analysis/CMakeLists.txt
+++ llvm/lib/Analysis/CMakeLists.txt
@@ -1,4 +1,4 @@
-if (DEFINED LLVM_HAVE_TF_AOT OR DEFINED LLVM_HAVE_TF_API)
+if (DEFINED LLVM_HAVE_TF_AOT OR LLVM_HAVE_TFLITE)
   include(TensorFlowCompile)
   set(LLVM_INLINER_MODEL_PATH_DEFAULT "models/inliner-Oz")
 
@@ -17,18 +17,14 @@
     )
   endif()
 
-  if (DEFINED LLVM_HAVE_TF_API)
-    if (LLVM_HAVE_TFLITE)
-      build_proto(
-        tensorflow/core/protobuf/error_codes
-        tensorflow/core/example/feature
-        tensorflow/core/example/example)
-      list(APPEND MLLinkDeps 
-        tensorflow-lite::tensorflow-lite
-        protobuf::libprotobuf)
-    else()
-      list(APPEND MLLinkDeps ${tensorflow_c_api} ${tensorflow_fx})
-    endif()
+  if (LLVM_HAVE_TFLITE)
+    build_proto(
+      tensorflow/core/protobuf/error_codes
+      tensorflow/core/example/feature
+      tensorflow/core/example/example)
+    list(APPEND MLLinkDeps
+      tensorflow-lite::tensorflow-lite
+      protobuf::libprotobuf)
   endif()
 endif()
 


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D140061.483001.patch
Type: text/x-patch
Size: 1568 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20221214/ec71a375/attachment.bin>


More information about the llvm-commits mailing list