Halide 14.0.0
Halide compiler and libraries
CostModel.h
Go to the documentation of this file.
1#ifndef COST_MODEL_H
2#define COST_MODEL_H
3
4#include <string>
5
6#include "FunctionDAG.h"
7#include "HalideBuffer.h"
8#include "PerfectHashMap.h"
9
10// An abstract base class for a cost model.
11namespace Halide {
12
13namespace Internal {
14namespace Autoscheduler {
16} // namespace Autoscheduler
17} // namespace Internal
18
19class CostModel {
20public:
21 virtual ~CostModel() = default;
22
23 // Configure the cost model for the algorithm to be scheduled.
25 const MachineParams &params) = 0;
26
27 // Enqueue a schedule to be evaluated. Will annotate the value located at cost_ptr when the evaluation takes place.
28 // Note that the dag argument should correspond to the dag specified previously when calling set_pipeline_features.
31 double *cost_ptr) = 0;
32
33 // Evaluate all schedules in the queue.
34 virtual void evaluate_costs() = 0;
35
36 // Discard all schedules in the queue.
37 virtual void reset() = 0;
38};
39
40} // namespace Halide
41
42#endif // COST_MODEL_H
Defines a Buffer type that wraps from halide_buffer_t and adds functionality, and methods for more co...
virtual ~CostModel()=default
virtual void reset()=0
virtual void set_pipeline_features(const Internal::Autoscheduler::FunctionDAG &dag, const MachineParams &params)=0
virtual void enqueue(const Internal::Autoscheduler::FunctionDAG &dag, const Halide::Internal::Autoscheduler::StageMapOfScheduleFeatures &schedule_feats, double *cost_ptr)=0
virtual void evaluate_costs()=0
PerfectHashMap< FunctionDAG::Node::Stage, ScheduleFeatures > StageMapOfScheduleFeatures
Definition: AutoSchedule.h:12
This file defines the class FunctionDAG, which is our representation of a Halide pipeline,...
@ Internal
Not visible externally, similar to 'static' linkage in C.
A struct representing the machine parameters to generate the auto-scheduled code for.
Definition: Pipeline.h:33