Use pinned iree-tools-tflite in benchmarks (#13057)

Use pinned `iree-tools-tflite` to import tflite models for benchmarks
and drop the build dependency on `build_tf_integrations`.

Doc to explain how to bump tf/tflite importer for benchmarks will be
added in a follow-up change #13065
diff --git a/.github/workflows/benchmark_long.yml b/.github/workflows/benchmark_long.yml
index 704e8d6..9a713e2 100644
--- a/.github/workflows/benchmark_long.yml
+++ b/.github/workflows/benchmark_long.yml
@@ -34,15 +34,6 @@
       runner-env: ${{ needs.setup.outputs.runner-env }}
       write-caches: ${{ needs.setup.outputs.write-caches }}
 
-  build_tf_integrations:
-    needs: setup
-    if: fromJson(needs.setup.outputs.should-run)
-    uses: ./.github/workflows/build_tf_integrations.yml
-    with:
-      runner-group: ${{ needs.setup.outputs.runner-group }}
-      runner-env: ${{ needs.setup.outputs.runner-env }}
-      write-caches: ${{ needs.setup.outputs.write-caches }}
-
   build_benchmark_tools:
     needs: [setup, build_all]
     if: fromJson(needs.setup.outputs.should-run)
@@ -55,7 +46,7 @@
       build-dir-gcs-artifact: ${{ needs.build_all.outputs.build-dir-gcs-artifact }}
 
   build_e2e_test_artifacts:
-    needs: [setup, build_all, build_tf_integrations]
+    needs: [setup, build_all]
     if: fromJson(needs.setup.outputs.should-run)
     uses: ./.github/workflows/build_e2e_test_artifacts.yml
     with:
@@ -64,9 +55,6 @@
       build-dir: ${{ needs.build_all.outputs.build-dir }}
       build-dir-archive: ${{ needs.build_all.outputs.build-dir-archive }}
       build-dir-gcs-artifact: ${{ needs.build_all.outputs.build-dir-gcs-artifact }}
-      tf-binaries-dir: ${{ needs.build_tf_integrations.outputs.binaries-dir }}
-      tf-binaries-archive: ${{ needs.build_tf_integrations.outputs.binaries-archive }}
-      tf-binaries-gcs-artifact: ${{ needs.build_tf_integrations.outputs.binaries-gcs-artifact }}
 
   compilation_benchmarks:
     needs: [setup, build_e2e_test_artifacts]
@@ -102,7 +90,6 @@
     needs:
       - setup
       - build_all
-      - build_tf_integrations
       - build_benchmark_tools
       - build_e2e_test_artifacts
       - compilation_benchmarks
diff --git a/.github/workflows/build_e2e_test_artifacts.yml b/.github/workflows/build_e2e_test_artifacts.yml
index 8943383..ec78e07 100644
--- a/.github/workflows/build_e2e_test_artifacts.yml
+++ b/.github/workflows/build_e2e_test_artifacts.yml
@@ -28,15 +28,6 @@
       build-dir-gcs-artifact:
         required: true
         type: string
-      tf-binaries-dir:
-        required: true
-        type: string
-      tf-binaries-archive:
-        required: true
-        type: string
-      tf-binaries-gcs-artifact:
-        required: true
-        type: string
     outputs:
       e2e-test-artifacts-dir:
         description: |
@@ -75,9 +66,6 @@
       HOST_BUILD_DIR: ${{ inputs.build-dir }}
       HOST_BUILD_DIR_ARCHIVE: ${{ inputs.build-dir-archive }}
       HOST_BUILD_DIR_GCS_ARTIFACT: ${{ inputs.build-dir-gcs-artifact }}
-      TF_BINARIES_DIR: ${{ inputs.tf-binaries-dir }}
-      TF_BINARIES_ARCHIVE: ${{ inputs.tf-binaries-archive }}
-      TF_BINARIES_GCS_ARTIFACT: ${{ inputs.tf-binaries-gcs-artifact }}
     outputs:
       e2e-test-artifacts-dir: ${{ steps.build.outputs.e2e-test-artifacts-dir }}
       e2e-test-artifacts-gcs-artifact-dir: ${{ steps.upload.outputs.e2e-test-artifacts-gcs-artifact-dir }}
@@ -92,17 +80,12 @@
         run: gcloud storage cp "${HOST_BUILD_DIR_GCS_ARTIFACT}" "${HOST_BUILD_DIR_ARCHIVE}"
       - name: "Extracting install from build dir archive"
         run: tar -xf "${HOST_BUILD_DIR_ARCHIVE}" "${HOST_BUILD_DIR}/install"
-      - name: "Downloading TF binaries archive"
-        run: gcloud storage cp "${TF_BINARIES_GCS_ARTIFACT}" "${TF_BINARIES_ARCHIVE}"
-      - name: "Extracting TF binaries archive"
-        run: tar -xf "${TF_BINARIES_ARCHIVE}"
       - name: "Building e2e test artifacts"
         id: build
         env:
           BUILD_E2E_TEST_ARTIFACTS_DIR: build-e2e-test-artifacts
         run: |
           build_tools/github_actions/docker_run.sh \
-            --env "IREE_TF_BINARIES_DIR=${TF_BINARIES_DIR}" \
             --env "IREE_HOST_BIN_DIR=${HOST_BUILD_DIR}/install/bin" \
             gcr.io/iree-oss/frontends@sha256:f7c5a863e3478a66aff8f3f527b5587666d3e84fe974e3f179a84eee11d79fd2 \
             build_tools/cmake/build_e2e_test_artifacts.sh \
diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml
index 691b242..352a6ac 100644
--- a/.github/workflows/ci.yml
+++ b/.github/workflows/ci.yml
@@ -462,7 +462,7 @@
   ##############################################################################
   # TODO(#11263): Drop this job once the IREE_BUILD_LEGACY_BENCHMARKS is removed.
   test_build_benchmark_suites:
-    needs: [setup, build_all, build_tf_integrations]
+    needs: [setup, build_all]
     if: fromJson(needs.setup.outputs.should-run)
     runs-on:
       - self-hosted # must come first
@@ -474,9 +474,6 @@
       BUILD_DIR: ${{ needs.build_all.outputs.build-dir }}
       BUILD_DIR_ARCHIVE: ${{ needs.build_all.outputs.build-dir-archive }}
       BUILD_DIR_GCS_ARTIFACT: ${{ needs.build_all.outputs.build-dir-gcs-artifact }}
-      TF_BINARIES_DIR: ${{ needs.build_tf_integrations.outputs.binaries-dir }}
-      TF_BINARIES_ARCHIVE: ${{ needs.build_tf_integrations.outputs.binaries-archive }}
-      TF_BINARIES_GCS_ARTIFACT: ${{ needs.build_tf_integrations.outputs.binaries-gcs-artifact }}
       BUILD_BENCHMARKS_DIR: build-benchmarks
     steps:
       - name: "Checking out repository"
@@ -487,15 +484,10 @@
         run: gcloud storage cp "${BUILD_DIR_GCS_ARTIFACT}" "${BUILD_DIR_ARCHIVE}"
       - name: "Extracting install from build dir archive"
         run: tar -xf "${BUILD_DIR_ARCHIVE}" "${BUILD_DIR}/install"
-      - name: "Downloading TF binaries archive"
-        run: gcloud storage cp "${TF_BINARIES_GCS_ARTIFACT}" "${TF_BINARIES_ARCHIVE}"
-      - name: "Extracting TF binaries archive"
-        run: tar -xf "${TF_BINARIES_ARCHIVE}"
       - name: "Building benchmarks"
         id: build
         run: |
           build_tools/github_actions/docker_run.sh \
-            --env "IREE_TF_BINARIES_DIR=${TF_BINARIES_DIR}" \
             --env "IREE_HOST_BIN_DIR=${BUILD_DIR}/install/bin" \
             --env "IREE_BUILD_BENCHMARKS_DIR=${BUILD_BENCHMARKS_DIR}" \
             gcr.io/iree-oss/frontends@sha256:f7c5a863e3478a66aff8f3f527b5587666d3e84fe974e3f179a84eee11d79fd2 \
@@ -729,7 +721,7 @@
       build-dir-gcs-artifact: ${{ needs.build_all.outputs.build-dir-gcs-artifact }}
 
   build_e2e_test_artifacts:
-    needs: [setup, build_all, build_tf_integrations]
+    needs: [setup, build_all]
     if: fromJson(needs.setup.outputs.should-run)
     uses: ./.github/workflows/build_e2e_test_artifacts.yml
     with:
@@ -738,9 +730,6 @@
       build-dir: ${{ needs.build_all.outputs.build-dir }}
       build-dir-archive: ${{ needs.build_all.outputs.build-dir-archive }}
       build-dir-gcs-artifact: ${{ needs.build_all.outputs.build-dir-gcs-artifact }}
-      tf-binaries-dir: ${{ needs.build_tf_integrations.outputs.binaries-dir }}
-      tf-binaries-archive: ${{ needs.build_tf_integrations.outputs.binaries-archive }}
-      tf-binaries-gcs-artifact: ${{ needs.build_tf_integrations.outputs.binaries-gcs-artifact }}
 
   compilation_benchmarks:
     needs: [setup, build_e2e_test_artifacts]
diff --git a/build_tools/cmake/build_benchmarks.sh b/build_tools/cmake/build_benchmarks.sh
index f6efbe3..a73b6cd 100755
--- a/build_tools/cmake/build_benchmarks.sh
+++ b/build_tools/cmake/build_benchmarks.sh
@@ -22,10 +22,9 @@
 
 BUILD_DIR="${1:-${IREE_BUILD_BENCHMARKS_DIR:-build-benchmarks}}"
 IREE_HOST_BIN_DIR="$(realpath ${IREE_HOST_BIN_DIR})"
-IREE_TF_BINARIES_DIR="${IREE_TF_BINARIES_DIR:-integrations/tensorflow/bazel-bin/iree_tf_compiler}"
 
 source build_tools/cmake/setup_build.sh
-source build_tools/cmake/setup_local_python.sh
+source build_tools/cmake/setup_tf_python.sh
 
 echo "Configuring to build benchmarks"
 "${CMAKE_BIN}" -B "${BUILD_DIR}" \
@@ -37,8 +36,7 @@
   -DIREE_BUILD_MICROBENCHMARKS=ON \
   -DIREE_BUILD_COMPILER=OFF \
   -DIREE_BUILD_SAMPLES=OFF \
-  -DIREE_BUILD_TESTS=OFF \
-  -DIREE_IMPORT_TFLITE_PATH="${IREE_TF_BINARIES_DIR}/iree-import-tflite"
+  -DIREE_BUILD_TESTS=OFF
 
 echo "Building benchmark artifacts"
 "${CMAKE_BIN}" \
diff --git a/build_tools/cmake/build_e2e_test_artifacts.sh b/build_tools/cmake/build_e2e_test_artifacts.sh
index f10a51f..8ae8bf1 100755
--- a/build_tools/cmake/build_e2e_test_artifacts.sh
+++ b/build_tools/cmake/build_e2e_test_artifacts.sh
@@ -26,10 +26,9 @@
 
 BUILD_DIR="${1:-${IREE_BUILD_E2E_TEST_ARTIFACTS_DIR:-build-e2e-test-artifacts}}"
 IREE_HOST_BIN_DIR="$(realpath ${IREE_HOST_BIN_DIR})"
-IREE_TF_BINARIES_DIR="${IREE_TF_BINARIES_DIR:-integrations/tensorflow/bazel-bin/iree_tf_compiler}"
 
 source build_tools/cmake/setup_build.sh
-source build_tools/cmake/setup_local_python.sh
+source build_tools/cmake/setup_tf_python.sh
 
 echo "Configuring to build e2e test artifacts"
 "${CMAKE_BIN}" -B "${BUILD_DIR}" \
@@ -40,8 +39,7 @@
   -DIREE_BUILD_E2E_TEST_ARTIFACTS=ON \
   -DIREE_BUILD_COMPILER=OFF \
   -DIREE_BUILD_SAMPLES=OFF \
-  -DIREE_BUILD_TESTS=OFF \
-  -DIREE_IMPORT_TFLITE_PATH="${IREE_TF_BINARIES_DIR}/iree-import-tflite"
+  -DIREE_BUILD_TESTS=OFF
 
 echo "Building e2e test artifacts"
 "${CMAKE_BIN}" \
diff --git a/build_tools/cmake/run_tf_tests.sh b/build_tools/cmake/run_tf_tests.sh
index 1fa3c68..e0852b9 100755
--- a/build_tools/cmake/run_tf_tests.sh
+++ b/build_tools/cmake/run_tf_tests.sh
@@ -16,7 +16,7 @@
 IREE_LLVM_CPU_DISABLE="${IREE_LLVM_CPU_DISABLE:-0}"
 
 source "${BUILD_DIR}/.env" && export PYTHONPATH
-source build_tools/cmake/setup_local_python.sh
+source build_tools/cmake/setup_tf_python.sh
 
 echo "***** Running TensorFlow integration tests *****"
 # TODO: Use "--timeout 900" instead of --max-time below. Requires that
diff --git a/build_tools/cmake/setup_local_python.sh b/build_tools/cmake/setup_tf_python.sh
similarity index 69%
rename from build_tools/cmake/setup_local_python.sh
rename to build_tools/cmake/setup_tf_python.sh
index ef7c6b8..ee91419 100644
--- a/build_tools/cmake/setup_local_python.sh
+++ b/build_tools/cmake/setup_tf_python.sh
@@ -14,4 +14,9 @@
 
 # Install local source-only Python packages. These do not have a build step
 # but export important binaries onto the path.
-"${IREE_PYTHON3_EXECUTABLE}" -m pip install integrations/tensorflow/python_projects/iree_tf
\ No newline at end of file
+"${IREE_PYTHON3_EXECUTABLE}" -m pip install integrations/tensorflow/python_projects/iree_tf
+
+# TODO(#13061): We should install from the local source-only Python packages
+# like iree-tools-tf, once we switch to Pyhton API based tflite importer.
+# Install pinned version of iree-tools-tflite.
+"${IREE_PYTHON3_EXECUTABLE}" -m pip install iree-tools-tflite=="20230412.487" -f https://openxla.github.io/iree/pip-release-links.html