session

2020-07-09  本文已影响0人  qianlong21st

@startuml
class SessionBasic {
Init(uint32_t device_id)
GraphId CompileGraph(const AnfNodePtrList &lst, const AnfNodePtrList &outputs)
GraphId CompileGraph(NotNull<FuncGraphPtr> func_graph)
BuildGraph(GraphId)
RunGraph(const GraphId &graph_id, const std::vector<tensor::TensorPtr> &inputs, VectorRef *outputs)
BuildOp(const OpRunInfo &, const GraphInfo &, const std::vector<tensor::TensorPtr> &input_tensors,
const std::vector<int> &tensors_mask)

  py::tuple RunOp(const OpRunInfo &, const GraphInfo &, const std::vector<tensor::TensorPtr> &input_tensors)
  RegisterSummaryCallBackFunc(const CallBackFunc &callback)
  CreateCNodeKernelGraph(const AnfNodePtr node, KernelGraphPtr graph)
  shared_ptr<KernelGraph> ConstructKernelGraph(const AnfNodePtrList &lst, const AnfNodePtrList &outputs)
  shared_ptr<KernelGraph> ConstructKernelGraph(const FuncGraphPtr &func_graph,
                                                    std::vector<KernelGraphPtr> *all_out_graph)
  CNodePtr CreateNewCNode(const CNodePtr &cnode, bool valid_input, KernelGraph *graph, bool *from_other_graph,
                          std::unordered_map<AnfNodePtr, AnfNodePtr> *other_graph_cnode)
  CNodePtr CreateNewCNode(const CNodePtr &cnode, KernelGraph *graph)
  GraphId SetFinalGraphInput(const std::vector<AnfNodePtr> &)
  void SetFinalGraphOutput(const BaseRef &)
  SwitchCompile(GraphId, GraphId, GraphId, const AnfNodePtr &) 
  SetChildGraphInput(GraphId, const VectorRef &)
  GraphId GetGraphIdByNode(const AnfNodePtr &) const
  GraphId GetFinalRunGraph() const
  SetActive(GraphId, GraphId)
  GetSummaryNodes(KernelGraph *graph)

}

class CPUSession {
Init()
CompileGraph()
}

class GPUSession {
Init()
CompileGraph()
RunGraph()
BuildOp()
RunOp()
}

class AscendSession {
Init()
CompileGraph()
RunGraph()
BuildOp()
RunOp()
SetFinalGraphInput
SwitchCompile
SetChildGraphInput
GetGraphIdByNode
GetFinalRunGraph
SetActive
CompileChildGraph
RecurseGetSummaryNodes
GetSummaryNodes
}

interface KernelMod {
GetInputSizeList()
GetOutputSizeList()
GetWorkspaceSizeList()
bool Launch(inputs, workspace,
outputs, stream_ptr)
GenParameters()
}

class GpuKernel {
Init(const CNodePtr &kernel_node)
}

KernelMod <|.. GpuKernel

上一篇下一篇

猜你喜欢

热点阅读