diff options
author | Håvard Pettersen <havardpe@oath.com> | 2018-01-30 14:17:02 +0000 |
---|---|---|
committer | Håvard Pettersen <havardpe@oath.com> | 2018-01-30 14:17:02 +0000 |
commit | 8e9b0ddef1c6169615cde56f0f280e78d2fba6de (patch) | |
tree | 854f43bc20c7dc70d51abd411d74b0570da7825f /eval/src/tests | |
parent | 7f45ed2811f70693ce90ce742872b7a217cce37d (diff) |
optimized dot product now has children
also remove instruction trampoline
Diffstat (limited to 'eval/src/tests')
3 files changed, 17 insertions, 7 deletions
diff --git a/eval/src/tests/eval/interpreted_function/interpreted_function_test.cpp b/eval/src/tests/eval/interpreted_function/interpreted_function_test.cpp index f0306e99a91..e0de483fde2 100644 --- a/eval/src/tests/eval/interpreted_function/interpreted_function_test.cpp +++ b/eval/src/tests/eval/interpreted_function/interpreted_function_test.cpp @@ -193,7 +193,7 @@ struct InnerProduct { types(function, {ValueType::from_spec(a.type()), ValueType::from_spec(b.type())}), interpreted(engine, function, types) {} void verify_optimized() const { - EXPECT_EQUAL(1u, interpreted.program_size()); + EXPECT_LESS(interpreted.program_size(), 4u); InterpretedFunction::Context ctx(interpreted); Value::UP va = engine.from_spec(a); Value::UP vb = engine.from_spec(b); diff --git a/eval/src/tests/tensor/dense_dot_product_function/dense_dot_product_function_test.cpp b/eval/src/tests/tensor/dense_dot_product_function/dense_dot_product_function_test.cpp index 8b4b1497243..80e994d8c0b 100644 --- a/eval/src/tests/tensor/dense_dot_product_function/dense_dot_product_function_test.cpp +++ b/eval/src/tests/tensor/dense_dot_product_function/dense_dot_product_function_test.cpp @@ -73,8 +73,10 @@ public: struct Fixture { - DenseDotProductFunction function; FunctionInput input; + tensor_function::Inject a; + tensor_function::Inject b; + DenseDotProductFunction function; Fixture(size_t lhsNumCells, size_t rhsNumCells); ~Fixture(); double eval() const { @@ -90,8 +92,10 @@ struct Fixture }; Fixture::Fixture(size_t lhsNumCells, size_t rhsNumCells) - : function(0, 1), - input(lhsNumCells, rhsNumCells) + : input(lhsNumCells, rhsNumCells), + a(input.param(0).type(), 0), + b(input.param(1).type(), 1), + function(a, b) { } Fixture::~Fixture() { } diff --git a/eval/src/tests/tensor/dense_tensor_function_optimizer/dense_tensor_function_optimizer_test.cpp b/eval/src/tests/tensor/dense_tensor_function_optimizer/dense_tensor_function_optimizer_test.cpp index 57d03c09686..1c8527a3eb4 100644 --- a/eval/src/tests/tensor/dense_tensor_function_optimizer/dense_tensor_function_optimizer_test.cpp +++ b/eval/src/tests/tensor/dense_tensor_function_optimizer/dense_tensor_function_optimizer_test.cpp @@ -26,16 +26,22 @@ optimizeDotProduct(const vespalib::string &lhsType, return DenseTensorFunctionOptimizer::optimize(reduceNode, stash); } +void assertParam(const TensorFunction &node, size_t expect_idx) { + auto inject = as<Inject>(node); + ASSERT_TRUE(inject); + EXPECT_EQUAL(inject->param_idx(), expect_idx); +} + void assertOptimizedDotProduct(const vespalib::string &lhsType, - const vespalib::string &rhsType) + const vespalib::string &rhsType) { Stash stash; const TensorFunction &func = optimizeDotProduct(lhsType, rhsType, stash); const DenseDotProductFunction *dotProduct = as<DenseDotProductFunction>(func); ASSERT_TRUE(dotProduct); - EXPECT_EQUAL(1u, dotProduct->lhsTensorId()); - EXPECT_EQUAL(3u, dotProduct->rhsTensorId()); + TEST_DO(assertParam(dotProduct->lhs(), 1)); + TEST_DO(assertParam(dotProduct->rhs(), 3)); } void |