aboutsummaryrefslogtreecommitdiffstats
path: root/eval/src/vespa/eval/eval/fast_value_index.h
blob: 49e61585c4cf89e4282d13a33bd099ea1c2dbd67 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
// Copyright Vespa.ai. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root.

#pragma once

#include "value.h"
#include "fast_addr_map.h"

namespace vespalib::eval {

/*
 * Tensor value index, used to map labels to dense subspace indexes.
 *
 * This is the class instructions will look for when optimizing sparse
 * operations by calling inline functions directly.
 */
struct FastValueIndex final : Value::Index {
    FastAddrMap map;
    FastValueIndex(size_t num_mapped_dims_in, const StringIdVector &labels, size_t expected_subspaces_in)
        : map(num_mapped_dims_in, labels, expected_subspaces_in) {}
    size_t size() const override { return map.size(); }
    std::unique_ptr<View> create_view(ConstArrayRef<size_t> dims) const override;
};

}