aboutsummaryrefslogtreecommitdiffstats
path: root/eval/src/vespa/eval/eval/llvm/deinline_forest.h
blob: 04b795eb637e9a85c962ccc19e1b391442ea6690 (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
25
26
27
28
29
30
31
32
33
34
// Copyright Yahoo. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root.

#pragma once

#include <vespa/eval/eval/gbdt.h>
#include "llvm_wrapper.h"

namespace vespalib {
namespace eval {
namespace gbdt {

/**
 * GBDT forest optimizer performing automatic function de-inlining.
 **/
class DeinlineForest : public Forest
{
private:
    using array_function = double (*)(const double *);

    LLVMWrapper                 _llvm_wrapper;
    std::vector<array_function> _fragments;

public:
    explicit DeinlineForest(const std::vector<const nodes::Node *> &trees);
    static Optimize::Result optimize(const ForestStats &stats,
                                     const std::vector<const nodes::Node *> &trees);
    static double eval(const Forest *forest, const double *input);
    static Optimize::Chain optimize_chain;
};

} // namespace vespalib::eval::gbdt
} // namespace vespalib::eval
} // namespace vespalib