summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorArne Juul <arnej@verizonmedia.com>2020-10-26 10:22:37 +0000
committerArne Juul <arnej@verizonmedia.com>2020-10-26 10:45:34 +0000
commit022f598308d71035f78997e8938aef08e850a72a (patch)
tree3719dd6ea66a5560b507b431c363f6403be1dcbf
parent43385cecdebe5cd9160f9e9b150f76ef8643bb14 (diff)
use a run-time flag instead of conditional compilation
-rw-r--r--eval/src/tests/tensor/instruction_benchmark/.gitignore1
-rw-r--r--eval/src/tests/tensor/instruction_benchmark/CMakeLists.txt12
-rw-r--r--eval/src/tests/tensor/instruction_benchmark/instruction_benchmark.cpp24
-rw-r--r--eval/src/tests/tensor/instruction_benchmark/prod_benchmark.cpp5
4 files changed, 15 insertions, 27 deletions
diff --git a/eval/src/tests/tensor/instruction_benchmark/.gitignore b/eval/src/tests/tensor/instruction_benchmark/.gitignore
index 4159041c1fd..dc5c408cf29 100644
--- a/eval/src/tests/tensor/instruction_benchmark/.gitignore
+++ b/eval/src/tests/tensor/instruction_benchmark/.gitignore
@@ -1,2 +1 @@
-/eval_instruction_benchmark_app
vespa-tensor-instructions-benchmark
diff --git a/eval/src/tests/tensor/instruction_benchmark/CMakeLists.txt b/eval/src/tests/tensor/instruction_benchmark/CMakeLists.txt
index 4342a965060..b5949398f50 100644
--- a/eval/src/tests/tensor/instruction_benchmark/CMakeLists.txt
+++ b/eval/src/tests/tensor/instruction_benchmark/CMakeLists.txt
@@ -1,17 +1,9 @@
# Copyright Verizon Media. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root.
vespa_add_executable(vespa-tensor-instructions-benchmark
- SOURCES
- prod_benchmark.cpp
- OUTPUT_NAME vespa-tensor-instructions-benchmark
- INSTALL bin
- DEPENDS
- vespaeval
- GTest::GTest
-)
-
-vespa_add_executable(eval_instruction_benchmark_app TEST
SOURCES
instruction_benchmark.cpp
+ OUTPUT_NAME vespa-tensor-instructions-benchmark
+ INSTALL bin
DEPENDS
vespaeval
GTest::GTest
diff --git a/eval/src/tests/tensor/instruction_benchmark/instruction_benchmark.cpp b/eval/src/tests/tensor/instruction_benchmark/instruction_benchmark.cpp
index 98e8909949c..9c7db09ff00 100644
--- a/eval/src/tests/tensor/instruction_benchmark/instruction_benchmark.cpp
+++ b/eval/src/tests/tensor/instruction_benchmark/instruction_benchmark.cpp
@@ -227,13 +227,11 @@ struct Impl {
//-----------------------------------------------------------------------------
Impl default_tensor_engine_impl(1, "DefaultTensorEngine", "OLD PROD", DefaultTensorEngine::ref(), false);
+Impl simple_value_impl(3, " SimpleValue", " SimpleV", SimpleValueBuilderFactory::get(), false);
Impl fast_value_impl(0, " FastValue", "NEW PROD", FastValueBuilderFactory::get(), false);
-#ifndef BM_ONLY_PROD
Impl optimized_fast_value_impl(2, "Optimized FastValue", "Optimize", FastValueBuilderFactory::get(), true);
-Impl default_tensor_value_impl(3, " DefaultValue", "DefaultV", DefaultValueBuilderFactory::get(), false);
-Impl simple_value_impl(4, " SimpleValue", " SimpleV", SimpleValueBuilderFactory::get(), false);
Impl packed_mixed_tensor_impl(5, " PackedMixedTensor", " Packed", PackedMixedTensorBuilderFactory::get(), false);
-#endif
+Impl default_tensor_value_impl(4, " DefaultValue", "DefaultV", DefaultValueBuilderFactory::get(), false);
vespalib::string short_header("--------");
constexpr double budget = 5.0;
@@ -241,16 +239,12 @@ constexpr double best_limit = 0.95; // everything within 95% of best performance
constexpr double bad_limit = 0.90; // BAD: new prod has performance lower than 90% of old prod
constexpr double good_limit = 1.10; // GOOD: new prod has performance higher than 110% of old prod
-std::vector<CREF<Impl>> impl_list = {
+std::vector<CREF<Impl>> impl_list = {default_tensor_engine_impl,
+ simple_value_impl,
fast_value_impl,
-#ifndef BM_ONLY_PROD
optimized_fast_value_impl,
- simple_value_impl,
- default_tensor_value_impl,
packed_mixed_tensor_impl,
-#endif
- default_tensor_engine_impl
-};
+ default_tensor_value_impl};
//-----------------------------------------------------------------------------
@@ -988,6 +982,14 @@ void print_summary() {
}
int main(int argc, char **argv) {
+ const std::string run_only_prod_option = "--limit-implementations";
+ if ((argc > 1) && (argv[1] == run_only_prod_option )) {
+ impl_list.clear();
+ impl_list.push_back(fast_value_impl);
+ impl_list.push_back(default_tensor_engine_impl);
+ ++argv;
+ --argc;
+ }
::testing::InitGoogleTest(&argc, argv);
int result = RUN_ALL_TESTS();
print_summary();
diff --git a/eval/src/tests/tensor/instruction_benchmark/prod_benchmark.cpp b/eval/src/tests/tensor/instruction_benchmark/prod_benchmark.cpp
deleted file mode 100644
index 5c18bb6ccae..00000000000
--- a/eval/src/tests/tensor/instruction_benchmark/prod_benchmark.cpp
+++ /dev/null
@@ -1,5 +0,0 @@
-// Copyright Verizon Media. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root.
-
-#define BM_ONLY_PROD
-
-#include "instruction_benchmark.cpp"