Halide
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.
11 namespace Halide {
12 
13 namespace Internal {
14 namespace Autoscheduler {
16 } // namespace Autoscheduler
17 } // namespace Internal
18 
19 class CostModel {
20 public:
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.
29  virtual void enqueue(const Internal::Autoscheduler::FunctionDAG &dag,
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
Halide::MachineParams
A struct representing the machine parameters to generate the auto-scheduled code for.
Definition: Pipeline.h:31
Halide::Internal::Autoscheduler::FunctionDAG
Definition: FunctionDAG.h:346
HalideBuffer.h
Halide::CostModel::evaluate_costs
virtual void evaluate_costs()=0
FunctionDAG.h
Halide
This file defines the class FunctionDAG, which is our representation of a Halide pipeline,...
Definition: AddAtomicMutex.h:21
PerfectHashMap.h
Halide::LinkageType::Internal
@ Internal
Not visible externally, similar to 'static' linkage in C.
Halide::CostModel
Definition: CostModel.h:19
Halide::CostModel::set_pipeline_features
virtual void set_pipeline_features(const Internal::Autoscheduler::FunctionDAG &dag, const MachineParams &params)=0
Halide::Internal::Autoscheduler::StageMapOfScheduleFeatures
PerfectHashMap< FunctionDAG::Node::Stage, ScheduleFeatures > StageMapOfScheduleFeatures
Definition: AutoSchedule.h:12
Halide::CostModel::enqueue
virtual void enqueue(const Internal::Autoscheduler::FunctionDAG &dag, const Halide::Internal::Autoscheduler::StageMapOfScheduleFeatures &schedule_feats, double *cost_ptr)=0
Halide::CostModel::~CostModel
virtual ~CostModel()=default
Halide::CostModel::reset
virtual void reset()=0
PerfectHashMap
Definition: PerfectHashMap.h:38