You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
Paddle/paddle/fluid/inference/analysis
Zhaolong Xing 83c85f34e8
Merge pull request #12598 from NHZlX/add_tensorrt_softmax
7 years ago
..
CMakeLists.txt inference analyzer as bin (#12450) 7 years ago
README.md analysis/code clean (#11964) 7 years ago
analyzer.cc Merge pull request #12598 from NHZlX/add_tensorrt_softmax 7 years ago
analyzer.h inference analyzer as bin (#12450) 7 years ago
analyzer_main.cc inference analyzer as bin (#12450) 7 years ago
analyzer_tester.cc inference analyzer as bin (#12450) 7 years ago
argument.cc Feature/pass manager (#11440) 7 years ago
argument.h Modify style (#12465) 7 years ago
data_flow_graph.cc filter redundant output 7 years ago
data_flow_graph.h filter redundant output 7 years ago
data_flow_graph_tester.cc inference analyzer as bin (#12450) 7 years ago
data_flow_graph_to_fluid_pass.cc merge develop 7 years ago
data_flow_graph_to_fluid_pass.h bugfix/tensorrt analysis fix subgraph trigger (#12266) 7 years ago
data_flow_graph_to_fluid_pass_tester.cc inference analyzer as bin (#12450) 7 years ago
device.h clean up codes 7 years ago
dfg_graphviz_draw_pass.cc refine graph draw 7 years ago
dfg_graphviz_draw_pass.h Fix codesytle (#11836) 7 years ago
dfg_graphviz_draw_pass_tester.cc inference analyzer as bin (#12450) 7 years ago
dot.cc feature/inference analysis dot (#10494) 7 years ago
dot.h Merge branch 'develop' of github.com:PaddlePaddle/Paddle into overlap_send_op 7 years ago
dot_tester.cc feature/analysis node representation (#10522) 7 years ago
fluid_to_data_flow_graph_pass.cc inference analyzer as bin (#12450) 7 years ago
fluid_to_data_flow_graph_pass.h inference analysis support ssa 7 years ago
fluid_to_data_flow_graph_pass_tester.cc inference analyzer as bin (#12450) 7 years ago
graph_traits.cc fix inference api (#10867) 7 years ago
graph_traits.h Inference analysis/init data flow graph analysis (#10776) 7 years ago
helper.cc feature/analysis to support sub-graph for TRT engine (#11538) 7 years ago
helper.h inference analyzer as bin (#12450) 7 years ago
model_store_pass.cc Modify style (#12465) 7 years ago
model_store_pass.h Modify style (#12465) 7 years ago
model_store_pass_tester.cc inference analyzer as bin (#12450) 7 years ago
node.cc fix type comparation bugs 7 years ago
node.h fix type comparation bugs 7 years ago
node_attr_flags.h feature/analysis to support sub-graph for TRT engine (#11538) 7 years ago
node_tester.cc fix inference api (#10867) 7 years ago
pass.cc fix inference api (#10867) 7 years ago
pass.h inference analyzer as bin (#12450) 7 years ago
pass_manager.cc feature/analysis to support sub-graph for TRT engine (#11538) 7 years ago
pass_manager.h feature/analysis to support sub-graph for TRT engine (#11538) 7 years ago
pass_manager_tester.cc inference analyzer as bin (#12450) 7 years ago
subgraph_splitter.cc mapping the variable name inside the subgraph 7 years ago
subgraph_splitter.h Move sync_mode device ctx from grpc server (#10881) 7 years ago
subgraph_splitter_tester.cc inference analyzer as bin (#12450) 7 years ago
tensorrt_subgraph_node_mark_pass.cc Fix codesytle (#11836) 7 years ago
tensorrt_subgraph_node_mark_pass.h fix Mac compile errors (#11829) 7 years ago
tensorrt_subgraph_node_mark_pass_tester.cc inference analyzer as bin (#12450) 7 years ago
tensorrt_subgraph_pass.cc bugfix/tensorrt analysis fix subgraph trigger (#12266) 7 years ago
tensorrt_subgraph_pass.h fix Mac compile errors (#11829) 7 years ago
tensorrt_subgraph_pass_tester.cc inference analyzer as bin (#12450) 7 years ago
ut_helper.h inference analyzer as bin (#12450) 7 years ago

README.md

Inference Analysis

The inference/analysis module is used to analyze and optimize the inference program, it references some philosophy from LLVM/analysis, and make the various optimization features be pluggable and co-exist in a pipeline.

We borrowed some concepts from LLVM, such as

  • Passes to implement optimization that traverse the inference program,
  • DataFlowGraph to represent the data flow graph built from a program,
  • PassManager to manage a sequence of Passes over a graph.

There are some other basic concepts here

  • Node, the node in a DataFlowGraph,
    • Function, the Operator in Fluid,
    • Value, the Variable in Fluid;
  • Argument, the argument that treat as the input and output of all Passes in the pipeline,

How it works

The inference/analysis module make all the passes in a pipeline, and works in such way:

  1. Build a DataFlowGraph from a Fluid inference ProgramDesc,
  2. Call the middle passes one by one, the same DataFlowGraph is passed across all the passes,
  3. Transform a new ProgramDesc from the modified DataFlowGraph.

The new optimization features can be added as an independent Pass and controlled by gflags, each pass will generate unified debug information or visualization for better debugging.

Supported Passes

FluidToDataFlowGraphPass

Transform the fluid ProgramDesc to a DataFlowGraph to give an abstract representation for all the middle passes, this should be the first pass of the pipeline.

DataFlowGraphToFluidPass

Generate a final ProgramDesc from a data flow graph, this should be the last pass of the pipeline.

TensorRTSubgraphNodeMarkPass

Mark the Node that are supported by TensorRT, this pass will generate a visualization file which can be used for debugging.

TensorRTSubGraphPass

Split the sub-graph that are can be accelerated by TensorRT.

DFG_GraphvizDrawPass

This pass is just for debug, it will visualize the DataFlowGraph using the graphviz tool.

It can be used as a helper class that draws the modified graph after each pass.

Utilities

There is some helper legacy/function/class for analysis.

  • dot.h give a easy to use interface for generating DOT codes,
  • graph_traits.h contains the interfaces of the graph traversal algorithms, it uses iteratorto make the algorithms easy to share across different passes, there are some implementations in data_flow_graph.cc , such as BFS and DFS..