Search

US-12625685-B2 - Method and system for compiling applications

US12625685B2US 12625685 B2US12625685 B2US 12625685B2US-12625685-B2

Abstract

A method for compiling an application is executed by one or more processors, and includes acquiring profiling information of a system on which an application is to be executed, generating a cost model based on the profiling information, acquiring an intermediate representation of at least a portion of the application, applying compiler passes to the intermediate representation and generating a compiled graph, and using the cost model, determining an expected execution time for the compiled graph.

Inventors

  • Gangwon Jo
  • Jungho Park

Assignees

  • MOREH CORP.

Dates

Publication Date
20260512
Application Date
20240305
Priority Date
20230306

Claims (9)

  1. 1 . A method performed by at least one first processor, the method comprising: acquiring a first intermediate representation for a first portion of an application program; applying compiler passes to the first intermediate representation; generating, based on the applying compiler passes to the first intermediate representation, a plurality of first candidate compiled graphs associated with the first intermediate representation; based on an expected execution time for each of the plurality of first candidate compiled graphs, selecting one first sub-optimal graph from among the plurality of first candidate compiled graphs; and transmitting the first sub-optimal graph to a second processor, wherein the first sub-optimal graph is executed by the second processor.
  2. 2 . The method according to claim 1 , further comprising: acquiring a second intermediate representation for a second portion of the application program, wherein the second intermediate representation is the same as the first intermediate representation; applying compiler passes to the second intermediate representation; generating, based on the applying compiler passes to the second intermediate representation, a plurality of second candidate compiled graphs associated with the second intermediate representation, wherein the plurality of second candidate compiled graphs are different from the plurality of first candidate compiled graphs; and based on the expected execution time for the first sub-optimal graph and an expected execution time for each of the plurality of second candidate compiled graphs, selecting one second sub-optimal graph from among the first sub-optimal graph or the plurality of second candidate compiled graphs.
  3. 3 . The method according to claim 2 , wherein: a quantity of the generated first candidate compiled graphs corresponds to a predetermined number; and a quantity of the generated second candidate compiled graphs corresponds to the predetermined number.
  4. 4 . The method according to claim 2 , wherein: the generating the plurality of first candidate compiled graphs comprises generating the plurality of first candidate compiled graphs using a predetermined number of first combinations of compiler options; the generating the plurality of second candidate compiled graphs comprises generating the plurality of second candidate compiled graphs using a predetermined number of second combinations of compiler options, wherein the predetermined number of first combinations corresponds to the predetermined number of second combinations; and the first combinations of the compiler options is different from the second combinations of the compiler options.
  5. 5 . The method according to claim 2 , further comprising transmitting the second sub-optimal graph to the second processor, wherein the second sub-optimal graph is executed by the second processor.
  6. 6 . The method according to claim 1 , wherein the selecting the one first sub-optimal graph comprises: using a cost model, determining the expected execution time for each of the plurality of first candidate compiled graphs.
  7. 7 . The method according to claim 1 , wherein the generating the plurality of first candidate compiled graphs comprises: generating the plurality of first candidate compiled graphs by using a plurality of combinations of compiler options.
  8. 8 . A non-transitory computer-readable recording medium storing instructions that, when executed by one or more processors, cause performance of the method according to claim 1 .
  9. 9 . An information processing system, comprising: a 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 one or more computer-readable programs comprise instructions that, when executed by a first processor of the one or more processors, cause the information processing system to: acquire a first intermediate representation for a first portion of an application program; apply compiler passes to the first intermediate representation; generate, based on applying compiler passes to the first intermediate representation, a plurality of first candidate compiled graphs associated with the first intermediate representation; based on an expected execution time for each of the plurality of first candidate compiled graphs, select one first sub-optimal graph from among the plurality of first candidate compiled graphs; and transmit the first sub-optimal graph to a second processor on which the first sub-optimal graph is to be executed.

Description

CROSS-REFERENCE TO RELATED APPLICATIONS This application claims priority to Korean Patent Application No. 10-2023-0029483, filed in the Korean Intellectual Property Office on Mar. 6, 2023, and Korean Patent Application No. 10-2023-0153950, filed in the Korean Intellectual Property Office on Nov. 8, 2023, the entire contents of which are hereby incorporated by reference. TECHNICAL FIELD The disclosure relates to a method and system for compiling an application, and specifically, to a method and system for compiling an application to save resources such as execution time of the application. SUMMARY The present disclosure provides a method for, a non-transitory computer readable recording medium storing instructions for, and an apparatus (system) for compiling an application to save resources such as execution time of the application. The present disclosure may be implemented in a variety of ways, including a method, an apparatus (system), or a non-transitory computer-readable recording medium storing instructions. A method for compiling an application may be performed by at least one first processor and may include acquiring a first intermediate representation for a first portion of the application, applying compiler passes to the first intermediate representation and generating a plurality of first candidate compiled graphs, and based on an expected execution time for each of the plurality of first candidate compiled graphs, selecting one first sub-optimal graph from among the plurality of first candidate compiled graphs. The method may further include transmitting the first sub-optimal graph to a second processor, and the first sub-optimal graph may be executed by the second processor. The method may further include acquiring a second intermediate representation for a second portion of the application, in which the second intermediate representation may be the same as the first intermediate representation, applying the compiler passes to the second intermediate representation and generating a plurality of second candidate compiled graphs, in which the plurality of second candidate compiled graphs may be different from the plurality of first candidate compiled graphs, and based on the expected execution time for the first sub-optimal graph and an expected execution time for each of the plurality of second candidate compiled graphs, selecting one second sub-optimal graph from among the first sub-optimal graph or the plurality of second candidate compiled graphs. The generating the plurality of first candidate compiled graphs may include applying the compiler passes to the first intermediate representation and generating the first candidate compiled graphs as many as a predetermined number, and the generating the plurality of second candidate compiled graphs may include applying the compiler passes to the second intermediate representation and generating the second candidate compiled graphs as many as the predetermined number. The generating the plurality of first candidate compiled graphs may include generating the plurality of first candidate compiled graphs using a predetermined number of first combinations of compiler options, the generating the plurality of second candidate compiled graphs may include generating the plurality of second candidate compiled graphs using the predetermined number of second combinations of compiler options, and the first combination of the compiler options is different from the second combination of the compiler options. The method may further include transmitting the first sub-optimal graph to the second processor, and the first sub-optimal graph may be executed by the second processor. The selecting the one first sub-optimal graph may include, using a cost model, determining an expected execution time for each of the plurality of first candidate compiled graphs. The generating the plurality of first candidate compiled graphs may include generating the plurality of first candidate compiled graphs by using a combination of a plurality of compiler options. There is provided a non-transitory computer-readable recording medium storing instructions for executing the method on a computer. An information processing system is provided, which may include a memory, and at least one processor connected to the memory and configured to execute at least one computer-readable program included in the memory, in which the one or more programs may include instructions for acquiring a first intermediate representation for a first portion of the application, applying compiler passes to the first intermediate representation and generating a plurality of first candidate compiled graphs, and based on an expected execution time for each of the plurality of first candidate compiled graphs, selecting one first sub-optimal graph from among the plurality of first candidate compiled graphs. BRIEF DESCRIPTION OF THE DRAWINGS The above and other objects, features and advantages of the present disclosure wil