diff options
author | Håvard Pettersen <havardpe@oath.com> | 2021-01-05 12:15:48 +0000 |
---|---|---|
committer | Håvard Pettersen <havardpe@oath.com> | 2021-01-05 12:18:36 +0000 |
commit | d2ac897f41951ec86082b419b22e06369322f04c (patch) | |
tree | 7afdf555f7832324e91f4dc58edf7448ce35da9f /eval | |
parent | 74665956e649cb28682ba25d4f2089a7fae5087e (diff) |
use minimal tensor entry to keep track of tensor data
use thin value views for evaluation and serialization
Diffstat (limited to 'eval')
4 files changed, 11 insertions, 21 deletions
diff --git a/eval/src/vespa/eval/streamed/streamed_value.h b/eval/src/vespa/eval/streamed/streamed_value.h index b7ace4191c3..94603d9d35e 100644 --- a/eval/src/vespa/eval/streamed/streamed_value.h +++ b/eval/src/vespa/eval/streamed/streamed_value.h @@ -45,7 +45,6 @@ public: TypedCells cells() const final override { return TypedCells(_my_cells); } const Value::Index &index() const final override { return _my_index; } MemoryUsage get_memory_usage() const final override; - auto get_data_reference() const { return _my_index.get_data_reference(); } }; } // namespace diff --git a/eval/src/vespa/eval/streamed/streamed_value_index.cpp b/eval/src/vespa/eval/streamed/streamed_value_index.cpp index 0adaa35fc84..a014f2dcee9 100644 --- a/eval/src/vespa/eval/streamed/streamed_value_index.cpp +++ b/eval/src/vespa/eval/streamed/streamed_value_index.cpp @@ -90,7 +90,7 @@ struct StreamedIterationView : Value::Index::View std::unique_ptr<Value::Index::View> StreamedValueIndex::create_view(const std::vector<size_t> &dims) const { - LabelBlockStream label_stream(_data.num_subspaces, _data.labels, _data.num_mapped_dims); + LabelBlockStream label_stream(_num_subspaces, _labels_ref, _num_mapped_dims); if (dims.empty()) { return std::make_unique<StreamedIterationView>(std::move(label_stream)); } diff --git a/eval/src/vespa/eval/streamed/streamed_value_index.h b/eval/src/vespa/eval/streamed/streamed_value_index.h index fb3d48d8176..aa1c9a0e201 100644 --- a/eval/src/vespa/eval/streamed/streamed_value_index.h +++ b/eval/src/vespa/eval/streamed/streamed_value_index.h @@ -13,29 +13,21 @@ namespace vespalib::eval { **/ class StreamedValueIndex : public Value::Index { -public: +private: + uint32_t _num_mapped_dims; + uint32_t _num_subspaces; + const std::vector<label_t> &_labels_ref; - struct SerializedDataRef { - uint32_t num_mapped_dims; - uint32_t num_subspaces; - const std::vector<label_t> labels; - }; - StreamedValueIndex(uint32_t num_mapped_dims, uint32_t num_subspaces, const std::vector<label_t> &labels_in) - : _data{num_mapped_dims, num_subspaces, labels_in} +public: + StreamedValueIndex(uint32_t num_mapped_dims, uint32_t num_subspaces, const std::vector<label_t> &labels_ref) + : _num_mapped_dims(num_mapped_dims), + _num_subspaces(num_subspaces), + _labels_ref(labels_ref) {} // index API: - size_t size() const override { return _data.num_subspaces; } + size_t size() const override { return _num_subspaces; } std::unique_ptr<View> create_view(const std::vector<size_t> &dims) const override; - - // NB NOTE WARNING XXX: simply serializing the handle view and - // discarding the backing streamed value will result in dangling - // string enum value usage when the value is later deserialized. - SerializedDataRef get_data_reference() const { return _data; } - -private: - SerializedDataRef _data; }; } // namespace - diff --git a/eval/src/vespa/eval/streamed/streamed_value_view.h b/eval/src/vespa/eval/streamed/streamed_value_view.h index 060961f5e16..38eb8db786f 100644 --- a/eval/src/vespa/eval/streamed/streamed_value_view.h +++ b/eval/src/vespa/eval/streamed/streamed_value_view.h @@ -39,7 +39,6 @@ public: MemoryUsage get_memory_usage() const final override { return self_memory_usage<StreamedValueView>(); } - auto get_data_reference() const { return _my_index.get_data_reference(); } }; } // namespace |