plan.h 1.9 KB
Newer Older
L
LiYuRio 已提交
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15
// Copyright (c) 2023 PaddlePaddle Authors. All Rights Reserved.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
//     http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.

#pragma once
L
LiYuRio 已提交
16
#include <memory>
L
LiYuRio 已提交
17 18 19
#include <string>
#include <unordered_map>
#include <vector>
20 21 22 23

#include "paddle/fluid/framework/new_executor/interpreter/job.h"

#include "paddle/fluid/framework/program_desc.h"
24
#include "paddle/ir/core/program.h"
L
LiYuRio 已提交
25 26 27 28
#include "paddle/phi/core/macros.h"

namespace paddle {
namespace framework {
29
namespace interpreter {
L
LiYuRio 已提交
30 31 32

class Plan final {
 public:
L
LiYuRio 已提交
33
  Plan(const std::vector<std::shared_ptr<Job>>& job_list,
34
       const std::unordered_map<std::string, ProgramDesc*>& type_to_program);
35 36 37 38
  Plan(const std::vector<std::shared_ptr<Job>>& job_list,
       const std::unordered_map<std::string, std::shared_ptr<::ir::Program>>&
           type_to_ir_program);

L
LiYuRio 已提交
39 40
  ~Plan() = default;

41
  const std::vector<std::shared_ptr<Job>>& JobList() const;
L
LiYuRio 已提交
42

43
  const ProgramDesc* Program(const std::string& job_type) const;
44
  std::shared_ptr<::ir::Program> IrProgram(const std::string& job_type) const;
45 46

  int64_t MicroBatchNum() const;
L
LiYuRio 已提交
47

48 49 50
 private:
  const std::vector<std::shared_ptr<Job>> job_list_;
  const std::unordered_map<std::string, ProgramDesc*> type_to_program_;
51 52
  const std::unordered_map<std::string, std::shared_ptr<::ir::Program>>
      type_to_ir_program_;
53
  int64_t micro_batch_num_;
L
LiYuRio 已提交
54 55
};

56
}  // namespace interpreter
L
LiYuRio 已提交
57 58
}  // namespace framework
}  // namespace paddle