Method and system for determining optimization applicability on intermediate representation from program
Methods, systems, apparatuses, and computer-readable media are disclosed for identifying optimization opportunities for subgraphs representing programs that perform operations on data. Tests may be performed on the subgraph to identify opportunities for fusing one or more nodes, such as more data nodes and/or one or more operations nodes, of the subgraph. For instance, optimization through node fusion may be possible where the subgraph comprises all nodes and all edges in a path between two operations nodes in the subgraph. Based on such identified optimization opportunities, steps such as node fusion may be performed, and these operations may allow for the program to be run in a manner that preserves computing resources without introducing data processing errors.
1 . A method executed by one or more processors, the method comprising:
receiving, as a query, a subgraph of an intermediate representation that is a subject of a determination of optimization applicability,
wherein the intermediate representation is an intermediate representation of a program executable by one or more computing devices,
wherein the program comprises data and a plurality of operations, and,
wherein the intermediate representation comprises:
a plurality of data nodes;
a plurality of operation nodes; and
a plurality of edges each representing an input/output relationship between at least one of the plurality of data nodes and at least one of the plurality of operation nodes;
determining that the subgraph may be optimized through operation fusion by determining a possibility that the program will access intermediate data nodes at a future time; and
performing, based on the determining that the query may be optimized through operation fusion, optimization on the subgraph by fusing at least two of the plurality of operation nodes;
wherein the determining that the query may be optimized through operation fusion further comprises: determining a possibility that the program will access intermediate data nodes at a future time.
2 . The method according to claim 1 ,
wherein the program comprises at least one of:
a program associated with tensors; or
a deep learning program, and
wherein the data comprises at least one of:
tensor type data, or
data of the deep learning program.
3 . The method according to claim 1 , wherein the performing the optimization comprises:
generating a modified subgraph by removing, from the subgraph, one or more nodes.
4 . The method according to claim 1 , further comprising:
generating the intermediate representation from the program; and
storing, in a database, a corresponding relationship between at least a portion of the data of the program and the data nodes of the intermediate representation.
5 . The method according to claim 4 , wherein the storing, in the database, the corresponding relationship comprises:
storing, in the database, the at least a portion of the data of the program and pointer information in which the at least a portion of the data of the program points to at least one data node of the plurality of data nodes.
6 . The method according to claim 1 , wherein the determining that the subgraph may be optimized through operation fusion comprises:
determining whether at least one operation node associated with the program is not included in the subgraph.
7 . The method according to claim 1 , wherein the determining that the subgraph may be optimized through operation fusion comprises:
determining that, for every data node of the plurality of data nodes in the subgraph, the subgraph comprises all operation nodes adjacent to the data node and all edges connecting the data node to any other node; and
determining that, for every path between at least two operation nodes of the plurality of operation nodes, the subgraph comprises all nodes and all edges in the path.
8 . An information processing system, comprising:
memory; and
one or more processors coupled to the memory and configured to execute one or more computer-readable programs stored in the memory,
wherein the memory stores instructions that, when executed by the one or more processors, cause the information processing system to:
receive, as a query, a subgraph of an intermediate representation that is a subject of a determination of optimization applicability, wherein the intermediate representation is an intermediate representation of a program executable by one or more computing devices, wherein the program comprises data and a plurality of operations, and, wherein the intermediate representation comprises:
a plurality of data nodes;
a plurality of operation nodes; and
a plurality of edges each representing an input/output relationship between at least one of the plurality of data nodes and at least one of the plurality of operation nodes;
determine that the subgraph may be optimized through operation fusion; and
perform, based on the determining that the query may be optimized through operation fusion, optimization on the subgraph by fusing at least two of the plurality of operation nodes.
9 . The information processing system according to claim 8 ,
wherein the program comprises at least one of:
a program associated with tensors; or
a deep learning program, and
wherein the data comprises at least one of:
tensor type data, or
data of the deep learning program.
10 . The information processing system according to claim 8 , wherein the instructions, when executed by the one or more processors, cause the information processing system to perform the optimization by causing the information processing system to:
generate a modified subgraph by removing, from the subgraph, one or more nodes.
11 . The information processing system according to claim 8 , wherein the instructions, when executed by the one or more processors, cause the information processing system to:
generate the intermediate representation from the program; and
store, in a database, a corresponding relationship between at least a portion of the data of the program and the data nodes of the intermediate representation.
12 . The information processing system according to claim 11 , wherein the instructions, when executed by the one or more processors, cause the information processing system to store, in the database, the corresponding relationship by causing the information processing system to:
store, in the database, the at least a portion of the data of the program and pointer information in which the at least a portion of the data of the program points to at least one data node of the plurality of data nodes.
13 . The information processing system according to claim 8 , wherein the instructions, when executed by the one or more processors, cause the information processing system to determine that the subgraph may be optimized through operation fusion by causing the information processing system to:
determine whether at least one operation node associated with the program is not included in the subgraph.
14 . The information processing system according to claim 8 , wherein the instructions, when executed by the one or more processors, cause the information processing system to determine that the subgraph may be optimized through operation fusion by causing the information processing system to:
determine that, for every data node of the plurality of data nodes in the subgraph, the subgraph comprises all operation nodes adjacent to the data node and all edges connecting the data node to any other node; and
determine that, for every path between at least two operation nodes of the plurality of operation nodes, the subgraph comprises all nodes and all edges in the path.
15 . One or more non-transitory computer-readable media storing instructions that, when executed by one or more processors of an information processing system, cause the information processing system to:
receive, as a query, a subgraph of an intermediate representation that is a subject of a determination of optimization applicability, wherein the intermediate representation is an intermediate representation of a program executable by one or more computing devices, wherein the program comprises data and a plurality of operations, and, wherein the intermediate representation comprises:
a plurality of data nodes;
a plurality of operation nodes; and
a plurality of edges each representing an input/output relationship between at least one of the plurality of data nodes and at least one of the plurality of operation nodes;
determine that the subgraph may be optimized through operation fusion; and
perform, based on the determining that the query may be optimized through operation fusion, optimization on the subgraph by fusing at least two of the plurality of operation nodes.
16 . The one or more non-transitory computer-readable media according to claim 15 ,
wherein the program comprises at least one of:
a program associated with tensors; or
a deep learning program, and
wherein the data comprises at least one of:
tensor type data, or
data of the deep learning program.
17 . The one or more non-transitory computer-readable media according to claim 15 , wherein the instructions, when executed by the one or more processors, cause the information processing system to perform the optimization by causing the information processing system to:
generate a modified subgraph by removing, from the subgraph, one or more nodes.