Исходный код СУБД RuDB — свободной СУБД с открытым исходным кодом на базе PostgreSQL
rudb
2 days ago bd039d1e92813358c5c5a1e346b49074baf513f2
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
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
// Copyright (c) Microsoft Corporation. All rights reserved.
// Licensed under the MIT License.
 
#pragma once
 
#if !defined(ORT_MINIMAL_BUILD) || defined(ORT_EXTENDED_MINIMAL_BUILD)
 
#include <string>
#include <unordered_map>
#include <vector>
 
#include "core/common/flatbuffers.h"
 
#include "core/common/common.h"
#include "core/graph/runtime_optimization_record.h"
 
namespace onnxruntime {
 
namespace fbs {
struct RuntimeOptimizationRecordContainerEntry;
}  // namespace fbs
 
class RuntimeOptimizationRecordContainer {
 public:
  bool IsEmpty() const { return optimizer_name_to_records_.empty(); }
 
#if !defined(ORT_MINIMAL_BUILD)
 
  bool RecordExists(const std::string& optimizer_name,
                    const std::string& action_id,
                    const NodesToOptimizeIndices& nodes_to_optimize_indices) const;
 
  void AddRecord(const std::string& optimizer_name, RuntimeOptimizationRecord&& runtime_optimization_record);
 
#endif  // !defined(ORT_MINIMAL_BUILD)
 
  std::vector<RuntimeOptimizationRecord> RemoveRecordsForOptimizer(const std::string& optimizer_name);
 
  using FbsRuntimeOptimizationRecordContainer =
      flatbuffers::Vector<flatbuffers::Offset<
          onnxruntime::fbs::RuntimeOptimizationRecordContainerEntry>>;
 
  Status SaveToOrtFormat(flatbuffers::FlatBufferBuilder& builder,
                         flatbuffers::Offset<FbsRuntimeOptimizationRecordContainer>& fbs_runtime_optimizations) const;
 
  Status LoadFromOrtFormat(const FbsRuntimeOptimizationRecordContainer& fbs_runtime_optimizations);
 
 private:
  using OptimizerNameToRecordsMap = std::unordered_map<std::string, std::vector<RuntimeOptimizationRecord>>;
  OptimizerNameToRecordsMap optimizer_name_to_records_;
};
 
}  // namespace onnxruntime
 
#endif  // !defined(ORT_MINIMAL_BUILD) || defined(ORT_EXTENDED_MINIMAL_BUILD)