Skip to content

Commit 016f398

Browse files
Removed tensorflow_c_lib_path flag from LLVM build for benchmarking (#150)
Should help with the other half of #129. The benchmarking code currently sets the TENSORFLOW_C_LIB_PATH CMake variable when building LLVM. However, this doesn't make sense going forward as we have shifted mostly everything over to TFLite and we don't need to have MLGO development mode enabled for benchmarking in either case. This patch explicitly removes the flag so that the benchmarks simply build LLVM in MLGO release mode.
1 parent 1ad7689 commit 016f398

File tree

3 files changed

+3
-15
lines changed

3 files changed

+3
-15
lines changed

compiler_opt/benchmark/benchmark_chromium.py

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,6 @@
3030
--llvm_build_path=/llvm-build \
3131
--compile_llvm \
3232
--model_path=/tmp/model \
33-
--tensorflow_c_lib_path=/tmp/tensorflow \
3433
--chromium_build_path=./out/Release \
3534
--output_file=./output.json \
3635
--perf_counters=mem_uops_retired.all_loads \
@@ -89,9 +88,6 @@
8988
'The root path of your local llvm-project checkout')
9089
flags.DEFINE_string('model_path', '',
9190
'The path to the model to use when compiling llvm')
92-
flags.DEFINE_string(
93-
'tensorflow_c_lib_path', '/tmp/tensorflow',
94-
'The path to an extracted copy of the tensorflow c library')
9591
flags.DEFINE_string(
9692
'chromium_build_path', './out/Release',
9793
'The chromium build path, relative to the chromium source'
@@ -210,8 +206,7 @@ def main(_):
210206

211207
if FLAGS.compile_llvm:
212208
benchmarking_utils.build_llvm(FLAGS.model_path, FLAGS.llvm_use_incremental,
213-
FLAGS.llvm_build_path, FLAGS.llvm_source_path,
214-
FLAGS.tensorflow_c_lib_path)
209+
FLAGS.llvm_build_path, FLAGS.llvm_source_path)
215210

216211
if FLAGS.compile_tests:
217212
build_chromium_tests(FLAGS.advisor, FLAGS.chromium_build_path,

compiler_opt/benchmark/benchmark_llvm_test_suite.py

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,6 @@
3333
--llvm_build_path=/llvm-build \
3434
--llvm_source_path=/llvm-project \
3535
--llvm_test_suite_build_path=/llvm-test-suite/build \
36-
--tensorflow_c_lib_path=/tmp/tensorflow \
3736
--perf_counter=INSTRUCTIONS \
3837
--perf_counter=MEM_UOPS_RETIRED:ALL_LOADS \
3938
--perf_counter=MEM_UOPS_RETIRED:ALL_STORES
@@ -96,8 +95,6 @@
9695
'The path to the root of the llvm-project repositoy')
9796
flags.DEFINE_string('llvm_test_suite_build_path', None,
9897
'The path to the llvm test suite build')
99-
flags.DEFINE_string('tensorflow_c_lib_path', '/tmp/tensorflow',
100-
'The path to the tensorflow c lib library')
10198
flags.DEFINE_multi_string(
10299
'tests_to_run', default_tests,
103100
'Tests compiled with google benchmark to run,'
@@ -189,8 +186,7 @@ def main(_):
189186
'./build')
190187
if FLAGS.compile_llvm:
191188
benchmarking_utils.build_llvm(FLAGS.model_path, FLAGS.llvm_use_incremental,
192-
FLAGS.llvm_build_path, FLAGS.llvm_source_path,
193-
FLAGS.tensorflow_c_lib_path)
189+
FLAGS.llvm_build_path, FLAGS.llvm_source_path)
194190
if FLAGS.compile_testsuite:
195191
build_test_suite(FLAGS.advisor, FLAGS.llvm_test_suite_build_path,
196192
FLAGS.llvm_build_path, FLAGS.llvm_test_suite_path)

compiler_opt/benchmark/benchmarking_utils.py

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -25,8 +25,7 @@
2525

2626

2727
def build_llvm(model_path: str, use_existing_build: bool, llvm_build_path: str,
28-
llvm_source_path: Optional[str],
29-
tensorflow_c_lib_path: Optional[str]):
28+
llvm_source_path: Optional[str]):
3029
"""Builds LLVM/clang with the specified model and the correct settings
3130
3231
This function invokes CMake with all the correct build flags specified
@@ -60,9 +59,7 @@ def build_llvm(model_path: str, use_existing_build: bool, llvm_build_path: str,
6059
tensorflow_aot_path = os.path.dirname(tensorflow.__file__)
6160
cmake_config_command.extend([
6261
"-DCMAKE_BUILD_TYPE=Release",
63-
f"-DTENSORFLOW_C_LIB_PATH={tensorflow_c_lib_path}",
6462
f"-DTENSORFLOW_AOT_PATH='{tensorflow_aot_path}'",
65-
"-DCMAKE_INSTALL_RPATH_USE_LINK_PATH=ON",
6663
"-DLLVM_ENABLE_PROJECTS='clang;lld'",
6764
"-DLLVM_ENABLE_RUNTIMES='compiler-rt'", f"{llvm_source_path}"
6865
])

0 commit comments

Comments
 (0)