From e26c668a9b8e4a2f9ae76a221ba62a81c04f768a Mon Sep 17 00:00:00 2001 From: Chen Fu Date: Wed, 19 May 2021 20:12:17 -0700 Subject: [PATCH] add google benchmark as direct dependency (#7762) Co-authored-by: Chen Fu Description: This change add google benchmark git repo as a submodule in onnxruntime repo. Motivation and Context Currently we have benchmarking code that depends on google benchmark. The version we are using has cross compilation issues for ARM CPUs. Recent changes in Google benchmark fixed these issues. Another problem is that we now rely on ONNX to pull in Google benchmark, an indirect dependency. Updating ONNX involves complex steps and rightly so. However, updating Google benchmark dependency should not be hindered by these processes. --- .gitmodules | 3 +++ cgmanifests/submodules/cgmanifest.json | 10 ++++++++++ cmake/CMakeLists.txt | 2 +- cmake/external/googlebenchmark | 1 + 4 files changed, 15 insertions(+), 1 deletion(-) create mode 160000 cmake/external/googlebenchmark diff --git a/.gitmodules b/.gitmodules index 389a903343..64ad14e6ac 100644 --- a/.gitmodules +++ b/.gitmodules @@ -4,6 +4,9 @@ [submodule "cmake/external/googletest"] path = cmake/external/googletest url = https://github.com/google/googletest.git +[submodule "cmake/external/googlebenchmark"] + path = cmake/external/googlebenchmark + url = https://github.com/google/benchmark.git [submodule "cmake/external/onnx"] path = cmake/external/onnx url = https://github.com/onnx/onnx diff --git a/cgmanifests/submodules/cgmanifest.json b/cgmanifests/submodules/cgmanifest.json index 7bb7befc6b..f4ac602b82 100644 --- a/cgmanifests/submodules/cgmanifest.json +++ b/cgmanifests/submodules/cgmanifest.json @@ -198,6 +198,16 @@ "comments": "git submodule at cmake/external/flatbuffers" } }, + { + "component": { + "type": "git", + "git": { + "commitHash": "7d0d9061d83b663ce05d9de5da3d5865a3845b79", + "repositoryUrl": "https://github.com/google/benchmark.git" + }, + "comments": "git submodule at cmake/external/googlebenchmark" + } + }, { "component": { "type": "git", diff --git a/cmake/CMakeLists.txt b/cmake/CMakeLists.txt index 6848b04b7c..409e80cfee 100644 --- a/cmake/CMakeLists.txt +++ b/cmake/CMakeLists.txt @@ -664,7 +664,7 @@ if(onnxruntime_BUILD_BENCHMARKS) set(BENCHMARK_ENABLE_TESTING OFF CACHE BOOL "Disable benchmark testing as we don't need it.") # We will not need to install benchmark since we link it statically. set(BENCHMARK_ENABLE_INSTALL OFF CACHE BOOL "Disable benchmark install to avoid overwriting vendor install.") - add_subdirectory(${PROJECT_SOURCE_DIR}/external/onnx/third_party/benchmark EXCLUDE_FROM_ALL) + add_subdirectory(${PROJECT_SOURCE_DIR}/external/googlebenchmark EXCLUDE_FROM_ALL) add_library(benchmark::benchmark ALIAS benchmark) endif() endif() diff --git a/cmake/external/googlebenchmark b/cmake/external/googlebenchmark new file mode 160000 index 0000000000..7d0d9061d8 --- /dev/null +++ b/cmake/external/googlebenchmark @@ -0,0 +1 @@ +Subproject commit 7d0d9061d83b663ce05d9de5da3d5865a3845b79