aboutsummaryrefslogtreecommitdiffstats
path: root/eval/src/tests
diff options
context:
space:
mode:
authorArne Juul <arnej@verizonmedia.com>2020-12-01 13:44:41 +0000
committerArne Juul <arnej@verizonmedia.com>2020-12-01 13:44:41 +0000
commit3e9bb253be74a9a4498743ff8780ecc349373dcf (patch)
treed8256972597e0487a4db76d612b3edcbbfa90a6e /eval/src/tests
parentc85fa192079701624b2f763a61bb17821fa7594a (diff)
remove engine testing
Diffstat (limited to 'eval/src/tests')
-rw-r--r--eval/src/tests/eval/tensor_lambda/tensor_lambda_test.cpp76
1 files changed, 8 insertions, 68 deletions
diff --git a/eval/src/tests/eval/tensor_lambda/tensor_lambda_test.cpp b/eval/src/tests/eval/tensor_lambda/tensor_lambda_test.cpp
index 54893894443..8d84389d578 100644
--- a/eval/src/tests/eval/tensor_lambda/tensor_lambda_test.cpp
+++ b/eval/src/tests/eval/tensor_lambda/tensor_lambda_test.cpp
@@ -2,11 +2,8 @@
#include <vespa/vespalib/testkit/test_kit.h>
#include <vespa/eval/eval/tensor_function.h>
-#include <vespa/eval/eval/simple_tensor.h>
-#include <vespa/eval/eval/simple_tensor_engine.h>
#include <vespa/eval/eval/simple_value.h>
#include <vespa/eval/eval/fast_value.h>
-#include <vespa/eval/tensor/default_tensor_engine.h>
#include <vespa/eval/tensor/dense/dense_replace_type_function.h>
#include <vespa/eval/instruction/dense_cell_range_function.h>
#include <vespa/eval/instruction/dense_lambda_peek_function.h>
@@ -41,7 +38,6 @@ std::ostream &operator<<(std::ostream &os, EvalMode eval_mode)
}
-const TensorEngine &prod_engine = DefaultTensorEngine::ref();
const ValueBuilderFactory &simple_factory = SimpleValueBuilderFactory::get();
const ValueBuilderFactory &prod_factory = FastValueBuilderFactory::get();
@@ -61,13 +57,14 @@ EvalFixture::ParamRepo param_repo = make_params();
template <typename T, typename F>
void verify_impl(const vespalib::string &expr, const vespalib::string &expect, F &&inspect) {
- EvalFixture fixture(prod_engine, expr, param_repo, true);
- EvalFixture slow_fixture(prod_engine, expr, param_repo, false);
+ EvalFixture fixture(prod_factory, expr, param_repo, true);
+ EvalFixture slow_fixture(prod_factory, expr, param_repo, false);
EvalFixture simple_factory_fixture(simple_factory, expr, param_repo, false);
- EXPECT_EQUAL(fixture.result(), slow_fixture.result());
- EXPECT_EQUAL(fixture.result(), simple_factory_fixture.result());
- EXPECT_EQUAL(fixture.result(), EvalFixture::ref(expr, param_repo));
- EXPECT_EQUAL(fixture.result(), EvalFixture::ref(expect, param_repo));
+ auto expect_spec = EvalFixture::ref(expect, param_repo);
+ EXPECT_EQUAL(fixture.result(), expect_spec);
+ EXPECT_EQUAL(slow_fixture.result(), expect_spec);
+ EXPECT_EQUAL(simple_factory_fixture.result(), expect_spec);
+ EXPECT_EQUAL(EvalFixture::ref(expr, param_repo), expect_spec);
auto info = fixture.find_all<T>();
if (EXPECT_EQUAL(info.size(), 1u)) {
inspect(info[0]);
@@ -79,13 +76,7 @@ void verify_impl(const vespalib::string &expr, const vespalib::string &expect) {
}
void verify_not_optimized(const vespalib::string &expr, const vespalib::string &expect) {
- EvalFixture fixture(prod_factory, expr, param_repo, true);
- EvalFixture simple_factory_fixture(simple_factory, expr, param_repo, false);
- EXPECT_EQUAL(fixture.result(), simple_factory_fixture.result());
- EXPECT_EQUAL(fixture.result(), EvalFixture::ref(expr, param_repo));
- EXPECT_EQUAL(fixture.result(), EvalFixture::ref(expect, param_repo));
- auto info = fixture.find_all<tensor_function::Lambda>();
- EXPECT_EQUAL(info.size(), 1u);
+ verify_impl<tensor_function::Lambda>(expr, expect);
}
void verify_reshape(const vespalib::string &expr, const vespalib::string &expect) {
@@ -192,57 +183,6 @@ TEST("require that out-of-bounds cell extraction is not optimized") {
TEST_DO(verify_not_optimized("tensor(x[3])(x3y5{x:(x-1),y:(x)})", "tensor(x[3]):[0,2,8]"));
}
-//---------------------------------------------------------------------------
-// to be removed when DefaultTensorEngine is removed:
-
-void verify_generic(const vespalib::string &expr, const vespalib::string &expect,
- EvalMode expect_eval_mode)
-{
- verify_impl<DenseLambdaFunction>(expr, expect,
- [&](const DenseLambdaFunction *info)
- {
- EXPECT_EQUAL(info->eval_mode(), expect_eval_mode);
- });
-}
-
-
-TEST("require that simple dynamic tensor lambda works") {
- TEST_DO(verify_generic("tensor(x[3])(x+a)", "tensor(x[3]):[1,2,3]", EvalMode::COMPILED));
-}
-
-TEST("require that compiled multi-dimensional multi-param dynamic tensor lambda works") {
- TEST_DO(verify_generic("tensor(x[3],y[2])((b-a)+x+y)", "tensor(x[3],y[2]):[[1,2],[2,3],[3,4]]", EvalMode::COMPILED));
- TEST_DO(verify_generic("tensor<float>(x[3],y[2])((b-a)+x+y)", "tensor<float>(x[3],y[2]):[[1,2],[2,3],[3,4]]", EvalMode::COMPILED));
-}
-
-TEST("require that interpreted multi-dimensional multi-param dynamic tensor lambda works") {
- TEST_DO(verify_generic("tensor(x[3],y[2])((x3{x:(a)}-a)+x+y)", "tensor(x[3],y[2]):[[1,2],[2,3],[3,4]]", EvalMode::INTERPRETED));
- TEST_DO(verify_generic("tensor<float>(x[3],y[2])((x3{x:(a)}-a)+x+y)", "tensor<float>(x[3],y[2]):[[1,2],[2,3],[3,4]]", EvalMode::INTERPRETED));
-}
-
-TEST("require that tensor lambda can be used for tensor slicing") {
- TEST_DO(verify_generic("tensor(x[2])(x3{x:(x+a)})", "tensor(x[2]):[2,3]", EvalMode::INTERPRETED));
- TEST_DO(verify_generic("tensor(x[2])(a+x3{x:(x)})", "tensor(x[2]):[2,3]", EvalMode::INTERPRETED));
-}
-
-TEST("require that tensor lambda can be used to convert from sparse to dense tensors") {
- TEST_DO(verify_generic("tensor(x[3])(x3m{x:(x)})", "tensor(x[3]):[1,2,3]", EvalMode::INTERPRETED));
- TEST_DO(verify_generic("tensor(x[2])(x3m{x:(x)})", "tensor(x[2]):[1,2]", EvalMode::INTERPRETED));
-}
-
-TEST("require that dynamic nested tensor lambda using tensor peek works") {
- TEST_DO(verify_generic("tensor(x[2])(tensor(y[2])((x+y)+a){y:(x)})", "tensor(x[2]):[1,3]", EvalMode::INTERPRETED));
-}
-
-TEST("require that out-of-bounds cell extraction is not optimized") {
- TEST_DO(verify_generic("tensor(x[3])(x3y5{x:1,y:(x+3)})", "tensor(x[3]):[9,10,0]", EvalMode::INTERPRETED));
- TEST_DO(verify_generic("tensor(x[3])(x3y5{x:1,y:(x-1)})", "tensor(x[3]):[0,6,7]", EvalMode::INTERPRETED));
- TEST_DO(verify_generic("tensor(x[3])(x3y5{x:(x+1),y:(x)})", "tensor(x[3]):[6,12,0]", EvalMode::INTERPRETED));
- TEST_DO(verify_generic("tensor(x[3])(x3y5{x:(x-1),y:(x)})", "tensor(x[3]):[0,2,8]", EvalMode::INTERPRETED));
-}
-
-//---------------------------------------------------------------------------
-
TEST("require that non-double result from inner tensor lambda function fails type resolving") {
auto fun_a = Function::parse("tensor(x[2])(a)");
auto fun_b = Function::parse("tensor(x[2])(a{y:(x)})");