WO2022265410A1 - 중간표현을 생성하는 방법 및 시스템 - Google Patents

중간표현을 생성하는 방법 및 시스템 Download PDF

Info

Publication number
WO2022265410A1
WO2022265410A1 PCT/KR2022/008505 KR2022008505W WO2022265410A1 WO 2022265410 A1 WO2022265410 A1 WO 2022265410A1 KR 2022008505 W KR2022008505 W KR 2022008505W WO 2022265410 A1 WO2022265410 A1 WO 2022265410A1
Authority
WO
WIPO (PCT)
Prior art keywords
data
place operation
place
information
intermediate expression
Prior art date
Application number
PCT/KR2022/008505
Other languages
English (en)
French (fr)
Inventor
이재진
박정호
조강원
김희훈
김진표
Original Assignee
주식회사 모레
서울대학교산학협력단
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by 주식회사 모레, 서울대학교산학협력단 filed Critical 주식회사 모레
Priority to CN202280043438.0A priority Critical patent/CN117581237A/zh
Priority to EP22825333.2A priority patent/EP4357982A1/en
Publication of WO2022265410A1 publication Critical patent/WO2022265410A1/ko
Priority to US18/537,683 priority patent/US20240126790A1/en

Links

Images

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F16/00Information retrieval; Database structures therefor; File system structures therefor
    • G06F16/20Information retrieval; Database structures therefor; File system structures therefor of structured data, e.g. relational data
    • G06F16/28Databases characterised by their database models, e.g. relational or object models
    • G06F16/284Relational databases
    • G06F16/285Clustering or classification
    • G06F16/287Visualization; Browsing
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F16/00Information retrieval; Database structures therefor; File system structures therefor
    • G06F16/90Details of database functions independent of the retrieved data types
    • G06F16/901Indexing; Data structures therefor; Storage structures
    • G06F16/9024Graphs; Linked lists
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F16/00Information retrieval; Database structures therefor; File system structures therefor
    • G06F16/20Information retrieval; Database structures therefor; File system structures therefor of structured data, e.g. relational data
    • G06F16/23Updating
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F16/00Information retrieval; Database structures therefor; File system structures therefor
    • G06F16/20Information retrieval; Database structures therefor; File system structures therefor of structured data, e.g. relational data
    • G06F16/25Integrating or interfacing systems involving database management systems
    • G06F16/254Extract, transform and load [ETL] procedures, e.g. ETL data flows in data warehouses
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F16/00Information retrieval; Database structures therefor; File system structures therefor
    • G06F16/90Details of database functions independent of the retrieved data types
    • G06F16/904Browsing; Visualisation therefor
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06NCOMPUTING ARRANGEMENTS BASED ON SPECIFIC COMPUTATIONAL MODELS
    • G06N3/00Computing arrangements based on biological models
    • G06N3/02Neural networks
    • G06N3/04Architecture, e.g. interconnection topology
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06NCOMPUTING ARRANGEMENTS BASED ON SPECIFIC COMPUTATIONAL MODELS
    • G06N3/00Computing arrangements based on biological models
    • G06N3/02Neural networks
    • G06N3/06Physical realisation, i.e. hardware implementation of neural networks, neurons or parts of neurons
    • G06N3/063Physical realisation, i.e. hardware implementation of neural networks, neurons or parts of neurons using electronic means
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06NCOMPUTING ARRANGEMENTS BASED ON SPECIFIC COMPUTATIONAL MODELS
    • G06N3/00Computing arrangements based on biological models
    • G06N3/02Neural networks
    • G06N3/08Learning methods
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06NCOMPUTING ARRANGEMENTS BASED ON SPECIFIC COMPUTATIONAL MODELS
    • G06N5/00Computing arrangements using knowledge-based models
    • G06N5/02Knowledge representation; Symbolic representation

Definitions

  • the present disclosure relates to a method and system for generating an intermediate representation, and more particularly, to a method and system for generating an intermediate representation for a program including in-place operations.
  • a program may include data and instructions for performing operations on the data.
  • the simplest way to execute a program is to execute given instructions in sequence, but in this case, optimization techniques that can be applied are limited because it cannot be executed considering operations to be given in the future.
  • an intermediate expression having the same meaning as a program can be constructed, modified by applying an optimization technique to the intermediate expression, and then executed.
  • Some of the operations included in the program may include in-place operations.
  • in-place operations When an in-place operation is expressed in an intermediate expression graph, a cyclic structure may occur, and as the cyclic structure occurs, the algorithm may become complicated, making it difficult to apply optimization.
  • the present disclosure provides a method for generating an intermediate expression, a computer-readable recording medium, and an apparatus (system) to solve the above problems.
  • the present disclosure may be implemented in a variety of ways, including a method, apparatus (system) or computer program stored on a readable storage medium.
  • a method for generating an intermediate expression for a program including an in-place operation includes information about data for input/output and information about operations from a program.
  • the method further includes storing a correspondence between the extracted data for input/output and the data included in the intermediate expression in a database.
  • generating an intermediate expression includes generating an intermediate expression by generating output data of an operation of the intermediate expression, corresponding to output data of the in-place operation, and The data name of the output data of the expression operation is different from the data name of the input data of the in-place operation.
  • the storing in the database may include changing a pointer of input data of an in-place operation to point to output data of an intermediate expression operation corresponding to output data of the in-place operation. , updating the database.
  • the in-place operation includes a first in-place operation and a second in-place operation subsequent to the first in-place operation
  • generating an intermediate expression includes the first in-place operation.
  • generating an intermediate expression by generating output data of an intermediate expression operation corresponding to the output data of the in-place operation and the output data of the second in-place operation;
  • the data name of the data, the data name of the output data of the first in-place operation, and the data name of the output data of the second in-place operation are different from each other.
  • the pointer of the input data of the first in-place operation points to the output data of the operation of the intermediate expression corresponding to the output data of the second in-place operation. and updating the database by making changes to the key.
  • the storing in the database may include, when the first size of the input data of the in-place operation is different from the second size of the output data of the in-place operation, the input data of the in-place operation.
  • the generating of the intermediate expression may include, as a subsequent operation of the in-place operation, if there is an operation using the first size of input data of the in-place operation, the in-place operation and generating an intermediate expression using an operation capable of returning the second size of the input data to the first size.
  • the step of storing in the database may include input data of the in-place operation and output data of the in-place operation, respectively, when a subsequent operation of the in-place operation is a subsequent in-place operation. changing a second size of output data of an in-place operation to a first size by pointing a pointer to output data of an intermediate expression operation corresponding to output data of a subsequent in-place operation; and a step of associating and storing information that can be returned to the second size with output data of the in-place operation.
  • a computer-readable non-transitory storage medium in which instructions for executing a method for generating an intermediate expression for a program including an in-place operation according to an embodiment of the present disclosure are recorded on a computer.
  • An intermediate expression generating system includes 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, wherein the at least one program receives information about data for input/output and information about operations from the program. Extraction, determining whether an in-place operation exists from information on the extracted data and information on the extracted operation, and if there is an in-place operation, information on the extracted data and information on the extracted operation It includes instructions for generating intermediate expressions using information and production rules associated with in-place operations, and input data of in-place is data replaced with output data after in-place operations.
  • an intermediate expression for a program including an in-place operation by generating an intermediate expression for a program including an in-place operation, it is possible to prevent an operation sequence from being unknown due to a circular structure occurring on the intermediate expression.
  • the program optimization technique can be easily applied by preventing the circular structure, the memory usage of the program can be reduced and the execution speed of the program can be increased.
  • FIG. 1 is a diagram illustrating an example of a method for generating an intermediate expression by an information processing system according to an embodiment of the present disclosure.
  • FIG. 2 is a block diagram showing the internal configuration of an information processing system according to an embodiment of the present disclosure.
  • FIG. 3 is a block diagram showing an internal configuration of a processor according to an embodiment of the present disclosure.
  • FIG. 4 is a flowchart illustrating an example of a method for generating an intermediate expression according to an embodiment of the present disclosure.
  • FIG. 5 is a diagram illustrating an example of a database in which intermediate expressions and data generated according to an embodiment of the present disclosure are stored.
  • FIG. 6 is a diagram illustrating an example of an intermediate expression generated for a program according to an embodiment of the present disclosure.
  • FIG. 7 is a diagram illustrating an example of a process of generating an intermediate expression for a program and storing a correspondence between the program and the intermediate expression in a database according to an embodiment of the present disclosure.
  • FIG. 8 illustrates an example of a state in which an intermediate expression for a program including an in-place operation for changing the size of data is generated and a correspondence between the program and the intermediate expression is stored in a database according to an embodiment of the present disclosure. It is a drawing
  • FIG. 9 is a state in which an intermediate expression for a program including an in-place operation for changing the size of two or more data is generated according to an embodiment of the present disclosure, and a correspondence between the program and the intermediate expression is stored in a database. It is a drawing showing an example.
  • a modulee' or 'unit' used in the specification means a software or hardware component, and the 'module' or 'unit' performs certain roles.
  • 'module' or 'unit' is not meant to be limited to software or hardware.
  • a 'module' or 'unit' may be configured to reside in an addressable storage medium and may be configured to reproduce one or more processors.
  • a 'module' or 'unit' includes components such as software components, object-oriented software components, class components, and task components, processes, functions, and attributes. , procedures, subroutines, segments of program code, drivers, firmware, microcode, circuitry, data, databases, data structures, tables, arrays, or variables.
  • a 'module' or 'unit' may be implemented with a processor and a memory.
  • 'Processor' should be interpreted broadly to include general-purpose processors, central processing units (CPUs), microprocessors, digital signal processors (DSPs), controllers, microcontrollers, state machines, and the like.
  • 'processor' may refer to an application specific integrated circuit (ASIC), programmable logic device (PLD), field programmable gate array (FPGA), or the like.
  • ASIC application specific integrated circuit
  • PLD programmable logic device
  • FPGA field programmable gate array
  • 'Processor' refers to a combination of processing devices, such as, for example, a combination of a DSP and a microprocessor, a combination of a plurality of microprocessors, a combination of one or more microprocessors in conjunction with a DSP core, or a combination of any other such configurations. You may. Also, 'memory' should be interpreted broadly to include any electronic component capable of storing electronic information.
  • 'Memory' includes random access memory (RAM), read-only memory (ROM), non-volatile random access memory (NVRAM), programmable read-only memory (PROM), erasable-programmable read-only memory (EPROM), It may also refer to various types of processor-readable media, such as electrically erasable PROM (EEPROM), flash memory, magnetic or optical data storage, registers, and the like.
  • RAM random access memory
  • ROM read-only memory
  • NVRAM non-volatile random access memory
  • PROM programmable read-only memory
  • EPROM erasable-programmable read-only memory
  • a memory is said to be in electronic communication with the processor if the processor can read information from and/or write information to the memory.
  • Memory integrated with the processor is in electronic communication with the processor.
  • a 'system' may include at least one of a server device and a cloud device, but is not limited thereto.
  • a system may consist of one or more server devices.
  • a system may consist of one or more cloud devices.
  • the system may be operated by configuring a server device and a cloud device together.
  • 'each of a plurality of A' or 'each of a plurality of A' may refer to each of all components included in a plurality of A's, or each of some components included in a plurality of A's. .
  • an 'intermediate expression' may refer to a graph having the same meaning as a program and/or information related thereto, which is generated to efficiently execute a program.
  • an intermediate representation may include one or more nodes and one or more edges.
  • 'in-place operation' may refer to an operation in which output data is the same as input data among program operations. In other words, it may refer to an operation in which a value stored in a memory allocated to input data is replaced with a value of output data after the operation.
  • FIG. 1 is a diagram showing an example of a method for generating an intermediate expression 130 by an information processing system 110 according to an embodiment of the present disclosure.
  • the information processing system 110 can extract information from the program 120 to determine whether an in-place operation exists in the program 120 .
  • the information processing system 110 may generate the intermediate expression 130 for the program 120 using a generation rule when an in-place operation exists in the program 120, and the program data and program Corresponding relationships between ? and intermediate expressions may be stored in the database 140 .
  • the information processing system 110 may extract information about data for input/output and information about calculations from the program 120 .
  • the information processing system 110 transmits information about data from the program 120, such as generation of a new variable or constant, definition and change of a variable value or constant value, data type of a variable or constant, and size of a variable or constant. can be extracted.
  • the information processing system 100 may extract information about the operation, such as the type of operation being performed, information on the input/output data of the operation, and parameters of the operation.
  • the program 120 may include a deep learning program, and data may include tensor type data.
  • the information processing system 110 may extract information about a data type, size of each dimension, and the like from tensor type data included in a deep learning program.
  • the information processing system 110 may determine whether an in-place operation exists from information on the extracted data and information on the extracted operation.
  • the in-place operation may refer to an operation in which a value stored in a memory allocated to input data is replaced with a value of output data after the operation.
  • the information processing system 110 uses the information on the extracted data, the information on the extracted operation, and the generation rule associated with the in-place operation to generate an intermediate expression (130). ) can be created (and updated).
  • the intermediate expression 130 may be expressed in the form of a graph including nodes and edges.
  • data and operations extracted from the program 120 may be represented by nodes, and input/output relationships between data and operations may be represented by edges.
  • the generation rule associated with the in-place operation may mean a generation rule for generating/updating a new output data node to be the same as a general operation other than the in-place operation for the in-place operation.
  • the information processing system 110 may store the data for input/output extracted from the program 120 and the correspondence between the data included in the program and the intermediate expression in the database 140 .
  • data for input/output may refer to program variables or tensors.
  • the correspondence between program data and data included in the intermediate expression is a pointer meaning address information about other input/output data that one input/output data has and/or an in-place that changes the size of the input/output data. It can refer to the inverse of an operation.
  • the database 140 stores and updates data for input/output and correspondence between program data and data included in the intermediate expression. It can be.
  • the information processing system 110 may include a memory 210, a processor 220, a communication module 230 and an input/output interface 240. As shown in FIG. 2 , the information processing system 110 may be configured to communicate information and/or data through a network using the communication module 230 .
  • Memory 210 may include any non-transitory computer readable recording medium.
  • the memory 210 is a non-perishable mass storage device (permanent mass storage device) such as random access memory (RAM), read only memory (ROM), disk drive, solid state drive (SSD), flash memory, and the like. mass storage device).
  • a non-perishable mass storage device such as ROM, SSD, flash memory, disk drive, etc. may be included in the information processing system 110 as a separate permanent storage device separate from memory.
  • the memory 210 stores an operating system and at least one program code (for example, a code for determining whether an in-place operation is installed and driven in the information processing system 110, generating and updating an intermediate expression, etc.) It can be.
  • a recording medium readable by such a separate computer may include a recording medium directly connectable to the information processing system 110, for example, a floppy drive, a disk, a tape, a DVD/CD-ROM drive, a memory card, etc. It may include a computer-readable recording medium.
  • software components may be loaded into the memory 210 through the communication module 230 rather than a computer-readable recording medium.
  • at least one program is a computer program installed by developers or files provided by a file distribution system that distributes application installation files through the communication module 230 (eg, in-place operation exists). It may be loaded into the memory 210 based on a program for determining whether or not, generating and updating an intermediate expression, and the like).
  • the processor 220 may be configured to process commands of a computer program by performing basic arithmetic, logic, and input/output operations. Commands may be provided to a user terminal (not shown) or other external system by the memory 210 or the communication module 230 . For example, the processor 220 extracts information on data for input/output and information on operation from the program, and determines whether an in-place operation exists from the information on the extracted data and information on the extracted operation. If there is an in-place operation, an intermediate expression may be generated using information about the extracted data, information about the extracted operation, and a generation rule associated with the in-place operation.
  • the communication module 230 may provide a configuration or function for a user terminal (not shown) and the information processing system 110 to communicate with each other through a network, and the information processing system 110 may provide an external system (for example, a separate configuration or function to communicate with a cloud system, etc.).
  • control signals, commands, data, etc. provided under the control of the processor 220 of the information processing system 110 are transmitted through the communication module 230 and the network to the user terminal and/or the communication module of the external system. It may be transmitted to a terminal and/or an external system.
  • an intermediate representation representing a program generated by a computing device may be transmitted to an external system (eg, a system executing the program, etc.).
  • the input/output interface 240 of the information processing system 110 is connected to the information processing system 110 or means for interface with a device (not shown) for input or output that the information processing system 110 may include.
  • a device not shown
  • the input/output interface 240 is shown as an element configured separately from the processor 220 , but is not limited thereto, and the input/output interface 240 may be included in the processor 220 .
  • the information processing system 110 may include more components than those of FIG. 2 . However, there is no need to clearly show most of the prior art components.
  • the processor 220 of the information processing system 110 may be configured to manage, process, and/or store information and/or data received from a plurality of user terminals and/or a plurality of external systems.
  • the processor 220 may receive a program code including information about data for input/output of a program and information about an operation from a user terminal and/or an external system.
  • the processor extracts information on the data for input/output included in the received code and information on the operation, and determines whether an in-place operation exists from the information on the extracted data and the information on the extracted operation. If there is an in-place operation, an intermediate expression may be generated using information about the extracted data, information about the extracted operation, and a generation rule associated with the in-place operation.
  • FIG. 3 is a block diagram showing an internal configuration of a processor 220 according to an embodiment of the present disclosure.
  • the processor 220 may include a data/operation extraction unit 310, an in-place operation determination unit 320, an intermediate expression generation unit 330, and a database management unit 340.
  • the processor 220 may include a data/operation extraction unit 310, an in-place operation determination unit 320, an intermediate expression generation unit 330, and a database management unit 340.
  • FIG. 3 it is not limited thereto and may be configured with a plurality of processors.
  • the data/operation extractor 310 may extract information about data for input/output and information about operations from a program.
  • the data/arithmetic extraction unit 310 extracts information about data, such as generation of a new variable or constant, definition and change of a variable value or constant value, data type of a variable or constant, and size of a variable or constant, from a program. can do.
  • the data/operation extractor 310 may extract information about the operation, such as the type of operation being performed, information on input/output data of the operation, parameters of the operation, and the like.
  • the program may include a deep learning program, and the data may include tensor type data.
  • the data/arithmetic extraction unit 310 may extract information about a data type, size of each dimension, and the like from tensor-type data included in a deep learning program.
  • the in-place operation determination unit 320 may determine whether an in-place operation exists from information on input/output data and information on operation.
  • the in-place operation may refer to an operation in which a value stored in a memory allocated to input data is replaced with a value of output data after the operation.
  • in-place operations in the case of the deep learning framework PyTorch, are in-place operations that do not change the shape (or size) of tensors (e.g. add_, mul_, etc.), and tensor shapes (or sizes). It may include an in-place operation (eg, view, etc.) that changes, but is not limited thereto.
  • the intermediate expression generation unit 330 uses information about the extracted data, information about the extracted operation, and a generation rule associated with the in-place operation to generate an intermediate expression. can be created/updated.
  • the intermediate expression may be expressed in the form of a graph including nodes representing data and operations and edges representing input/output relationships between data and operations.
  • the generation rule associated with the in-place operation may mean a generation rule for generating/updating a new output data node to be the same as a general operation other than the in-place operation for the in-place operation.
  • the intermediate expression generation unit 330 may generate an intermediate expression by generating output data of an intermediate expression operation corresponding to output data of an in-place operation.
  • the data name of the output data of the intermediate expression operation may be different from the data name of the input data of the in-place operation.
  • the intermediate expression generating unit 330 converts the output data 'A' to the output data having a different data name from the input data 'A'. You can create an intermediate expression with A2'.
  • the intermediate expression generating unit 330 outputs the first in-place operation.
  • An intermediate expression may be generated by generating output data of an operation of an intermediate expression corresponding to data and output data of the second in-place operation.
  • the data name of the input data of the first in-place operation, the data name of the output data of the first in-place operation, and the data name of the output data of the second in-place operation may be different from each other.
  • a second in-place operation e.g.
  • 'D C.add_(B)') from the program
  • the intermediate expression generating unit 330 outputs 'C', which is the output data of the first in-place operation, and output data 'of the operation of the intermediate expression corresponding to 'D', which is the output data of the second in-place operation.
  • Intermediate expressions can be created by generating C' and 'D', respectively.
  • the first size of the input data of the in-place operation is different. If there is an operation using size, the intermediate expression generation unit 330 generates an intermediate expression using an operation that can return the second size of the input data of the in-place operation to the first size (ie, inverse operation). can do.
  • an operation using the first size of the input data of the in-place operation eg, input data 'B' is the first size (2 X 3)
  • 'F If A.add_(B)') exists, the intermediate expression generation unit 330 may generate an intermediate expression using an inverse operation.
  • the database management unit 340 may store a correspondence between information about the extracted data and data included in the intermediate expression in the database.
  • Information about the extracted data may include information about the data name (eg, variable name or tensor name) or the data type and size of the data.
  • the correspondence between the program and the data included in the intermediate expression may include information about a pointer included in the data.
  • information on the previous size of the input/output data may be included in order to perform an inverse operation on the in-place operation for changing the size of the input/output data.
  • the database management unit 340 determines the input data of the first in-place operation.
  • the database may be updated by changing the pointer to indicate the output data of the intermediate expression operation corresponding to the output data of the second in-place operation.
  • the database management unit 340 determines that, according to the result of performing the second in-place operation, the pointer of the input data 'A' of the first in-place operation is the output data 'of the operation of the intermediate expression'. By changing it to point to D', we can update the database.
  • the database management unit 340 determines that the pointer of the input data of the in-place operation is in The database can be updated by changing the output data of the -place operation to indicate the output data of the corresponding intermediate expression operation.
  • the database management unit 340 may associate and store information on an operation that can be returned to the first size (ie, an inverse operation) to the input data of the in-place operation.
  • the database management unit 340 determines the second in According to the result of performing the -place operation, the database may be updated by changing the pointer of the input data 'A' of the first in-place operation to point to the output data 'D' of the intermediate expression operation.
  • the database management unit 340 may associate information on an operation capable of returning to the first size (eg, 2 X 3) to the input data 'A' of the in-place operation and store the information in the database.
  • the first size of the input data of the in-place operation is different.
  • the database management unit 340 points each pointer of the input data and output data of the in-place operation to the output data of the intermediate expression operation corresponding to the output data of the subsequent in-place operation.
  • the database can be updated by changing the second size of the output data of the in-place operation to the first size.
  • the database manager 340 may associate and store information capable of returning to the second size to the output data of the in-place operation.
  • an operation using the first size of the input data of the in-place operation eg, input data 'B' is the first size (2 X 3)
  • 'F If A.add_(B)') exists, each pointer to the input data 'A' of the in-place operation and the output data 'D' of the in-place operation is converted to the output data 'F' of the subsequent in-place operation.
  • the database management unit 340 may associate and store information that can be returned to the second size (eg, view(2,3)) to the output data of the in-place operation.
  • the internal configuration of the processor 220 shown in FIG. 3 is just an example, and in some embodiments, other configurations other than the illustrated internal configuration may be additionally included, some configurations may be omitted, and some processes may be configured with other configurations or This can be done by an external system.
  • the internal components of the processor 220 are separately described according to functions in FIG. 3 , this does not mean that the internal components are necessarily physically separated.
  • FIG. 4 is a flow diagram illustrating an example of a method 400 for generating an intermediate representation according to one embodiment of the present disclosure.
  • Each step of method 400 may be performed by at least one processor.
  • the method 400 may be initiated by a processor extracting information about data for input/output and information about operations from a program (S410).
  • the program may include a deep learning program, and data of the program may include tensor type data.
  • the processor may determine whether an in-place operation exists from information on the extracted data and information on the extracted operation (S420).
  • the in-place operation may refer to an operation in which a value stored in a memory allocated to input data is replaced with a value of output data after the operation.
  • in-place operations in the case of the deep learning framework PyTorch, are in-place operations that do not change the shape (or size) of tensors (e.g. add_, mul_, etc.), and tensor shapes (or sizes). It may include an in-place operation (eg, view, etc.) that changes, but is not limited thereto.
  • the processor may generate an intermediate expression using information about the extracted data, information about the extracted operation, and a generation rule associated with the in-place operation (S430). Additionally, the processor may store a correspondence between the data for the extracted input/output and the data included in the intermediate expression in the database.
  • the processor may generate an intermediate expression by generating output data of an intermediate expression operation corresponding to output data of an in-place operation.
  • the data name of the output data of the intermediate expression operation may be different from the data name of the input data of the in-place operation.
  • the processor may update the database by changing a pointer of input data of the in-place operation to indicate output data of an intermediate expression operation corresponding to output data of the in-place operation.
  • the processor when the in-place operation includes a first in-place operation and a second in-place operation following the first in-place operation, the processor outputs data of the first in-place operation and An intermediate expression may be generated by generating output data of an intermediate expression operation corresponding to output data of the second in-place operation.
  • the data name of the input data of the first in-place operation, the data name of the output data of the first in-place operation, and the data name of the output data of the second in-place operation may be different from each other.
  • the processor may update the database by changing a pointer of input data of the first in-place operation to indicate output data of an intermediate expression operation corresponding to output data of the second in-place operation.
  • the processor determines that the pointer of the input data of the in-place operation is the value of the operation of the intermediate expression. By changing it to point to the output data, we can update the database.
  • the processor may associate information on an operation capable of returning to the first size to input data of the in-place operation and store the information in the database.
  • the processor may generate an intermediate expression using an operation that can return the second size of the input data of the in-place operation to the first size. Additionally, if the subsequent operation of an in-place operation is a subsequent in-place operation, the processor maps respective pointers of the input data of the in-place operation and the output data of the in-place operation to the output data of the subsequent in-place operation.
  • the second size of the output data of the in-place operation may be changed to the first size by pointing to the output data of the operation of the intermediate expression of In this case, information that can be returned to the second size may be associated with the output data of the in-place operation and stored.
  • FIG. 5 is a diagram illustrating an example of a database 530 in which an intermediate expression 510 generated according to an embodiment of the present disclosure and data are stored.
  • the processor extracts information on data for input/output and information on operation from a program, and uses the information on the extracted data, the information on the extracted operation, and a generation rule associated with the in-place operation.
  • Intermediate representation 510 can be created including node 'A' 512, input data node 'B' 514, output data node 'C' 520, and operator node '+' 518.
  • the intermediate expression 510 shows the relationship between the input/output data nodes 512, 514, and 520 and the operator 518 using an edge (eg, the edge 516 between the input data 'A' and the operator node '+').
  • the processor may store in the database 530 a correspondence between extracted data for input/output and data included in the intermediate expression.
  • the correspondence between data included in the intermediate expression may indicate a correspondence between program data and data nodes included in the intermediate expression (eg, the correspondence 454 of data 'A').
  • information 454 on correspondence between input data of the program and input data nodes included in the intermediate expression may be stored in the database.
  • 6 is a diagram illustrating an example of an intermediate expression generated for a program 600 according to an embodiment of the present disclosure.
  • Some of the operations included in the program may include in-place operations.
  • an in-place operation is expressed in an intermediate representation graph, a circular structure may occur.
  • a cyclic structure occurs, an algorithm may become complicated, and thus optimization application becomes difficult.
  • 6 shows a first state 610 in which a cyclic structure occurs for an intermediate expression generated for a program 600 including an in-place operation 602 and a cyclic structure by a production rule associated with the in-place operation.
  • An example of the removed second state 620 is shown.
  • the second state 620 represents an example of an intermediate expression generated according to a production rule associated with an in-place operation.
  • the processor may generate the intermediate expression 622 for the in-place operation by generating the output data 624 of the intermediate expression operation corresponding to the output data of the in-place operation. That is, as shown, the processor may generate output data 'A2' 624 of an intermediate expression operation corresponding to output data 'A' of an in-place operation 602 included in the program 600. .
  • the data name (eg 'A2') of the output data in the intermediate expression and the data name (eg 'A') of the input data of the in-place operation in the program 600 may be generated to be different. .
  • the data value of input data 'A' is input to the input data node 'A' of the operation of the intermediate expression, and the data value of the output data 'A' is input to the output data node 'A2' of the operation of the intermediate expression. It is input to 624, and since a circular structure does not occur, confusion in the calculation order can be prevented.
  • FIG. 7 is a diagram illustrating an example of a process of generating an intermediate expression for a program 700 and storing a correspondence between the program 700 and the intermediate expression in a database according to an embodiment of the present disclosure.
  • the information processing system generates an intermediate expression using data extracted from the program 700 including the in-place operation and a generation rule associated with the in-place operation, and between the extracted data and the intermediate expression Correspondence of can be stored in the database.
  • an intermediate expression of the program 700 may be generated through the first to third states 710, 720, and 730.
  • the first state 710 an intermediate expression of the program 700 is generated based on operations 702 and 704 for generating data included in the program 700, and the correspondence between the program 700 and the intermediate expression is a database.
  • Tensor') and a second operation 704 (eg 'B torch.
  • Tensor') can extract information about the newly created tensor A and tensor B.
  • data nodes eg, 'A' and 'B'
  • information about tensor A and tensor B of the program 700 (712 , 714) and information 716 and 718 indicating that tensors A and tensors B correspond to data node A and data node B of the intermediate expression, respectively, may be stored in the database.
  • an intermediate expression of the program 700 is generated based on the third operation 706, which is the first in-place operation included in the program 700, and the program 700 and the intermediate expression correspond.
  • An intermediate expression can be created by generating output data (eg, data node C 728) of the operation of the intermediate expression corresponding to tensor C).
  • the information processing system corresponds to the pointer of the input data (eg, tensor A) of the third operation 706, which is the first in-place operation, to the output data (eg, tensor C) of the first in-place operation. It can be changed to point to the output data of the operation of the intermediate expression (eg, data node C 728). That is, the information processing system may update the correspondence stored in the database with information 726 indicating that the tensor A of the program 700 corresponds to the data node C of the intermediate expression.
  • the second state 720 information that tensors B and tensors C correspond to data nodes B and data nodes C of the intermediate expression is omitted, but this is only for convenience of explanation, and for each tensor of the database
  • the information may include information corresponding to a specific data node of the intermediate expression.
  • an intermediate expression of the program 700 is generated based on the fourth operation 708, which is the second in-place operation included in the program 700, and the program 700 and the intermediate expression correspond.
  • An intermediate expression may be generated by generating output data (eg, data node D 734) of an intermediate expression operation corresponding to tensor D).
  • the information processing system corresponds to the pointer of the input data (eg, tensor A) of the third operation 706, which is the first in-place operation, to the output data (eg, tensor D) of the second in-place operation. It can be changed to point to the output data (e.g. data node D) of the operation of the intermediate expression.
  • the information processing system determines that the pointer of the input data (eg, tensor C) of the fourth operation 708, which is the second in-place operation, corresponds to the output data (eg, tensor D) of the second in-place operation. You can change the intermediate expression to point to the output data of the operation (e.g. data node D).
  • the information processing system may update the correspondence stored in the database with information 732 and 734 indicating that tensors A and tensors C of the program 700 correspond to the data node D of the intermediate expression.
  • information that tensor B and tensor D correspond to data node B and data node D of the intermediate expression is omitted, but this is only for convenience of description, and for each tensor of the database
  • the information may include information corresponding to a specific data node of the intermediate expression.
  • FIG. 8 shows that an intermediate expression for a program 800 including an in-place operation for changing the size of data is generated according to an embodiment of the present disclosure, and a correspondence between the program 800 and the intermediate expression is stored in a database. It is a diagram showing an example of one state.
  • the information processing system determines that, when the size of the input data of the in-place operation of the program 800 is different from the size of the output data, the pointer of the input data of the in-place operation is the output data of the in-place operation.
  • the database can be updated.
  • an intermediate expression of the program 800 is generated based on the in-place operation 802 that changes the size of data included in the program 800, and a pointer to input data of the in-place operation.
  • the information processing system performs an in-place operation (for example, 3 X 2) of changing the first size (eg, 2 X 3) of the tensor A of the program 800 to the second size (eg, 3 X 2). 802) (e.g.
  • 'D A.view(3,2)'
  • the pointer of the input data of the in-place operation corresponds to the output data of the in-place operation.
  • the information processing system may update the correspondence stored in the database with information 812 indicating that the tensor A of the program 800 corresponds to the data node D(3,2) of the intermediate expression.
  • the information processing system associates information 814 (eg, 'A view (2,3)') on an operation that can be returned to the first size with the input data (eg, tensor A) of the in-place operation, can be saved
  • FIG. 8 Tensor B and Tensor F are omitted from the database and the intermediate expression, but this is for convenience of description.
  • FIG. 8 omits information that tensor C, tensor D, and tensor E correspond to data node C, data node D, and data node E of the intermediate expression, respectively, but this is only for convenience of description, and the database Information on each tensor of may include information corresponding to a specific data node of an intermediate expression.
  • FIG. 9 shows an intermediate expression for a program 800 including an in-place operation for changing the size of two or more data according to an embodiment of the present disclosure, and a correspondence between the program 800 and the intermediate expression. It is a diagram showing an example of the state stored in the database. According to an embodiment, the information processing system, as a subsequent operation of the in-place operation of the program 800, when there is an operation using the first size of the input data of the in-place operation, the input data of the in-place operation An intermediate expression can be created using an operation that can return the second size of to the first size.
  • the information processing system assigns pointers to input data of the in-place operation and output data of the in-place operation to output data of the subsequent in-place operation.
  • the second size of the output data of the in-place operation may be changed to the first size by indicating the output data of the operation of the intermediate expression corresponding to .
  • an intermediate expression for the program 800 including an in-place operation for changing the size of data through the first state 910 and the second state 920 is generated, and the program 800 and the intermediate expression Correspondence of can be updated.
  • the first state 910 is a subsequent operation of the third in-place operation 802 that changes the size of the input data, and when there is a fourth in-place operation 804 using the original size of the input data,
  • An example of a state in which the information processing system has generated an intermediate expression using an inverse operation is shown.
  • the information processing system changes the first size (eg, 2 X 3) of the tensor A of the program 800 to the second size (eg, 3 X 2) in a third in-place
  • Tensor C and Tensor E are omitted in the database and the intermediate expression, but this is for convenience of description.
  • information that tensors B, tensors D, and tensors F correspond to data nodes B, data nodes D, and data nodes F of intermediate expressions, respectively, is omitted, but this is for convenience of description.
  • information about each tensor in the database may include information corresponding to a specific data node of an intermediate expression.
  • the second state 920 shows an example of a state in which the information processing system updated the correspondence between the input/output data of the third in-place operation 802 and the intermediate expression when the fourth in-place operation 804 was performed.
  • the information processing system calculates input data (eg, tensor A) and output data (eg, tensor D) of the third in-place operation 802 respectively.
  • the third in-place operation The database may be updated by changing the second size of the output data (eg, data node D(3,2)) of 802 to the first size. That is, the information processing system may update the correspondence stored in the database with information 924 and 926 indicating that the tensor A and the tensor D of the program 800 correspond to the data node F(2,3) of the intermediate expression.
  • the information processing system adds information 922 (about an operation that can return to the second size) to the output data (eg, tensor D) of the third in-place operation.
  • Example: 'D view(3,2)') can be related and saved.
  • information about an operation that can return to the second size can be used for the fifth in-place operation.
  • Tensor C and Tensor E are omitted from the database and the intermediate expression, but this is for convenience of description.
  • each tensor of the database Information on may include information corresponding to a specific data node of an intermediate expression.
  • the above method may be provided as a computer program stored in a computer readable recording medium to be executed on a computer.
  • the medium may continuously store programs executable by a computer or temporarily store them for execution or download.
  • the medium may be various recording means or storage means in the form of a single or combined hardware, but is not limited to a medium directly connected to a certain computer system, and may be distributed on a network. Examples of the medium include magnetic media such as hard disks, floppy disks and magnetic tapes, optical recording media such as CD-ROM and DVD, magneto-optical media such as floptical disks, and ROM, RAM, flash memory, etc. configured to store program instructions.
  • examples of other media include recording media or storage media managed by an app store that distributes applications, a site that supplies or distributes various other software, and a server.
  • the processing units used to perform the techniques may include one or more ASICs, DSPs, digital signal processing devices (DSPDs), programmable logic devices (PLDs) ), field programmable gate arrays (FPGAs), processors, controllers, microcontrollers, microprocessors, electronic devices, and other electronic units designed to perform the functions described in this disclosure. , a computer, or a combination thereof.
  • a general purpose processor may be a microprocessor, but in the alternative, the processor may be any conventional processor, controller, microcontroller, or state machine.
  • a processor may also be implemented as a combination of computing devices, eg, a combination of a DSP and a microprocessor, a plurality of microprocessors, one or more microprocessors in conjunction with a DSP core, or any other configuration.
  • the techniques include random access memory (RAM), read-only memory (ROM), non-volatile random access memory (NVRAM), PROM (on a computer readable medium, such as programmable read-only memory (EPROM), erasable programmable read-only memory (EPROM), electrically erasable PROM (EEPROM), flash memory, compact disc (CD), magnetic or optical data storage device, or the like. It can also be implemented as stored instructions. Instructions may be executable by one or more processors and may cause the processor(s) to perform certain aspects of the functionality described in this disclosure.

Landscapes

  • Engineering & Computer Science (AREA)
  • Theoretical Computer Science (AREA)
  • Physics & Mathematics (AREA)
  • Databases & Information Systems (AREA)
  • Data Mining & Analysis (AREA)
  • General Engineering & Computer Science (AREA)
  • General Physics & Mathematics (AREA)
  • Software Systems (AREA)
  • Artificial Intelligence (AREA)
  • Mathematical Physics (AREA)
  • Health & Medical Sciences (AREA)
  • Biomedical Technology (AREA)
  • Biophysics (AREA)
  • Computational Linguistics (AREA)
  • Evolutionary Computation (AREA)
  • Life Sciences & Earth Sciences (AREA)
  • Computing Systems (AREA)
  • Molecular Biology (AREA)
  • General Health & Medical Sciences (AREA)
  • Neurology (AREA)
  • Information Retrieval, Db Structures And Fs Structures Therefor (AREA)
  • Stored Programmes (AREA)

Abstract

본 개시는, 적어도 하나의 프로세서에 의해 수행되는 중간표현을 생성하는 방법에 관한 것이다. 중간표현을 생성하는 방법은, 중간표현 생성기에 의해, 프로그램으로부터 입출력을 위한 데이터에 대한 정보 및 연산에 대한 정보를 추출하는 단계, 중간표현 생성기에 의해, 추출된 데이터에 대한 정보 및 추출된 연산에 대한 정보로부터 in-place 연산이 존재하는지 여부를 판정하는 단계 및 중간표현 생성기에 의해, in-place 연산이 존재하는 경우, 추출된 데이터에 대한 정보, 추출된 연산에 대한 정보 및 in-place 연산과 연관된 생성 규칙을 이용하여 중간표현을 생성하는 단계를 포함하고, in-place의 입력 데이터는 in-place 연산 후의 출력 데이터로 대체되는 데이터를 포함한다.

Description

중간표현을 생성하는 방법 및 시스템
본 개시는 중간표현을 생성하는 방법 및 시스템에 관한 것으로, 구체적으로, in-place 연산을 포함한 프로그램에 대한 중간표현을 생성하는 방법 및 시스템에 관한 것이다.
프로그램은 데이터와 데이터에 대해 연산을 실행하는 명령을 포함할 수 있다. 프로그램을 실행하는 가장 간단한 방법은 주어진 명령을 순서대로 실행하는 것이지만, 이 경우, 미래에 주어질 연산을 고려하여 실행할 수 없어 적용할 수 있는 최적화 기법이 제한적이다.
이러한 문제점을 해결하기 위해, 주어진 명령을 순서대로 실행하는 대신에, 프로그램과 동일한 의미를 갖는 중간표현을 구성하고, 중간표현에 최적화 기법을 적용하여 변형한 뒤 이를 실행할 수 있다.
프로그램에 포함된 연산 중 일부는 in-place 연산을 포함할 수 있다. in-place 연산을 중간표현 그래프에 표현하는 경우, 순환 구조가 발생할 수 있고, 순환 구조가 발생함에 따라 알고리즘이 복잡해질 수 있어 최적화 적용이 어려워지는 문제점이 있다.
본 개시는 상기와 같은 문제점을 해결하기 위한 중간표현을 생성하는 방법, 컴퓨터 판독 가능한 기록매체 및 장치(시스템)를 제공한다.
본 개시는 방법, 장치(시스템) 또는 판독 가능 저장 매체에 저장된 컴퓨터 프로그램을 포함한 다양한 방식으로 구현될 수 있다.
본 개시의 일 실시예에 따르면, 적어도 하나의 프로세서에 의해 수행되는, in-place 연산을 포함한 프로그램에 대한 중간표현을 생성하는 방법은, 프로그램으로부터 입출력을 위한 데이터에 대한 정보 및 연산에 대한 정보를 추출하는 단계, 추출된 데이터에 대한 정보 및 추출된 연산에 대한 정보로부터 in-place 연산이 존재하는지 여부를 판정하는 단계 및 in-place 연산이 존재하는 경우, 추출된 데이터에 대한 정보, 추출된 연산에 대한 정보 및 in-place 연산과 연관된 생성 규칙을 이용하여 중간표현을 생성하는 단계를 포함하고, in-place의 입력 데이터는 in-place 연산 후의 출력 데이터로 대체되는 데이터를 포함한다.
본 개시의 일 실시예에 따르면, 추출된 입출력을 위한 데이터 및 중간표현에 포함된 데이터 사이의 대응 관계를 데이터베이스에 저장하는 단계를 더 포함한다.
본 개시의 일 실시예에 따르면, 중간표현을 생성하는 단계는, in-place 연산의 출력 데이터에 대응하는, 중간표현의 연산의 출력 데이터를 생성함으로써, 중간표현을 생성하는 단계를 포함하고, 중간표현의 연산의 출력 데이터의 데이터명은, in-place 연산의 입력 데이터의 데이터명과 상이하다.
본 개시의 일 실시예에 따르면, 데이터베이스에 저장하는 단계는, in-place 연산의 입력 데이터의 포인터가, in-place 연산의 출력 데이터에 대응하는 중간표현의 연산의 출력 데이터를 가리키도록 변경함으로써, 데이터베이스를 업데이트하는 단계를 포함한다.
본 개시의 일 실시예에 따르면, in-place 연산은 제1 in-place 연산 및 제1 in-place 연산에 후속하는 제2 in-place 연산을 포함하고, 중간표현을 생성하는 단계는, 제1 in-place 연산의 출력 데이터 및 제2 in-place 연산의 출력 데이터에 대응하는, 중간표현의 연산의 출력 데이터를 생성함으로써, 중간표현을 생성하는 단계를 포함하고, 제1 in-place 연산의 입력 데이터의 데이터명, 제1 in-place 연산의 출력 데이터의 데이터명 및 제2 in-place 연산의 출력 데이터의 데이터명이 서로 상이하다.
본 개시의 일 실시예에 따르면, 데이터베이스에 저장하는 단계는, 제1 in-place 연산의 입력데이터의 포인터가, 제2 in-place 연산의 출력 데이터에 대응하는 중간표현의 연산의 출력 데이터를 가리키도록 변경함으로써, 데이터베이스를 업데이트하는 단계를 포함한다.
본 개시의 일 실시예에 따르면, 데이터베이스에 저장하는 단계는, in-place 연산의 입력 데이터의 제1 크기가 in-place 연산의 출력 데이터의 제2 크기와 상이한 경우, in-place 연산의 입력 데이터의 포인터가 in-place 연산의 출력 데이터에 대응하는 중간표현의 연산의 출력 데이터를 가리키도록 변경함으로써, 데이터베이스를 업데이트하는 단계 및 in-place 연산의 입력 데이터에 제1 크기로 되돌릴 수 있는 연산에 대한 정보를 연관시켜서 저장하는 단계를 포함한다.
본 개시의 일 실시예에 따르면, 중간표현을 생성하는 단계는, in-place 연산의 후속 연산으로서, in-place 연산의 입력 데이터의 제1 크기를 이용하는 연산이 존재하는 경우, in-place 연산의 입력 데이터의 제2 크기를 제1 크기로 되돌릴 수 있는 연산을 이용하여 중간표현을 생성하는 단계를 포함한다.
본 개시의 일 실시예에 따르면, 데이터베이스에 저장하는 단계는, in-place 연산의 후속 연산이 후속 in-place 연산인 경우, in-place 연산의 입력 데이터 및 in-place 연산의 출력 데이터의 각각의 포인터를 후속 in-place 연산의 출력 데이터에 대응하는 중간표현의 연산의 출력 데이터를 가리킴으로써, in-place 연산의 출력 데이터의 제2 크기를 제1 크기로 변경하는 단계; 및 in-place 연산의 출력 데이터에 제2 크기로 되돌릴 수 있는 정보를 연관시켜서 저장하는 단계를 포함한다.
본 개시의 일 실시예에 따른 in-place 연산을 포함한 프로그램에 대한 중간표현을 생성하는 방법을 컴퓨터에서 실행하기 위한 명령어들을 기록한 컴퓨터 판독 가능한 비일시적 기록 매체가 제공된다.
본 개시의 일 실시예에 따른 중간표현 생성 시스템은, 메모리; 및 메모리와 연결되고, 메모리에 포함된 컴퓨터 판독 가능한 적어도 하나의 프로그램을 실행하도록 구성된 적어도 하나의 프로세서를 포함하고, 적어도 하나의 프로그램은, 프로그램으로부터 입출력을 위한 데이터에 대한 정보 및 연산에 대한 정보를 추출하고, 추출된 데이터에 대한 정보 및 추출된 연산에 대한 정보로부터 in-place 연산이 존재하는지 여부를 판정하고, in-place 연산이 존재하는 경우, 추출된 데이터에 대한 정보, 추출된 연산에 대한 정보 및 in-place 연산과 연관된 생성 규칙을 이용하여 중간표현을 생성하하기 위한 명령어들을 포함하고, in-place의 입력 데이터는 in-place 연산 후의 출력 데이터로 대체되는 데이터다.
본 개시의 일부 실시예에 따르면, in-place 연산을 포함한 프로그램에 대하여 중간표현을 생성함으로써, 중간표현 상에 발생하는 순환 구조로 인하여 연산 순서를 알 수 없는 경우가 발생하는 것을 방지할 수 있다. 또한, 순환 구조를 방지함으로써 프로그램 최적화 기법을 쉽게 적용할 수 있으므로 프로그램의 메모리 사용량이 감소할 수 있고, 프로그램의 실행 속도가 증가할 수 있다.
본 개시의 효과는 이상에서 언급한 효과로 제한되지 않으며, 언급되지 않은 다른 효과들은 청구범위의 기재로부터 본 개시가 속하는 기술분야에서 통상의 지식을 가진 자(“통상의 기술자”라 함)에게 명확하게 이해될 수 있을 것이다.
본 개시의 실시예들은, 이하 설명하는 첨부 도면들을 참조하여 설명될 것이며, 여기서 유사한 참조 번호는 유사한 요소들을 나타내지만, 이에 한정되지는 않는다.
도 1은 본 개시의 일 실시예에 따른 정보 처리 시스템이 중간표현을 생성하는 방법의 예시를 나타내는 도면이다.
도 2는 본 개시의 일 실시예에 따른 정보 처리 시스템의 내부 구성을 나타내는 블록도이다.
도 3은 본 개시의 일 실시예에 따른 프로세서의 내부 구성을 나타내는 블록도이다.
도 4는 본 개시의 일 실시예에 따른 중간표현을 생성하는 방법의 예시를 나타내는 흐름도이다.
도 5는 본 개시의 일 실시예에 따라 생성된 중간표현과 데이터가 저장된 데이터베이스의 예시를 나타내는 도면이다.
도 6은 본 개시의 일 실시예에 따라 프로그램에 대해 생성된 중간표현의 예시를 나타내는 도면이다.
도 7은 본 개시의 일 실시예에 따라 프로그램에 대한 중간표현을 생성하고, 프로그램과 중간표현의 대응관계를 데이터베이스에 저장하는 과정의 예시를 나타내는 도면이다.
도 8은 본 개시의 일 실시예에 따라 데이터의 크기를 변경하는 in-place 연산을 포함하는 프로그램에 대한 중간표현을 생성하고, 프로그램과 중간표현의 대응관계를 데이터베이스에 저장한 상태의 예시를 나타내는 도면이다.
도 9는 본 개시의 일 실시예에 따라 두 개 이상의 데이터의 크기를 변경하는 in-place 연산을 포함하는 프로그램에 대한 중간표현을 생성하고, 프로그램과 중간표현의 대응관계를 데이터베이스에 저장한 상태의 예시를 나타내는 도면이다.
이하, 본 개시의 실시를 위한 구체적인 내용을 첨부된 도면을 참조하여 상세히 설명한다. 다만, 이하의 설명에서는 본 개시의 요지를 불필요하게 흐릴 우려가 있는 경우, 널리 알려진 기능이나 구성에 관한 구체적 설명은 생략하기로 한다.
첨부된 도면에서, 동일하거나 대응하는 구성요소에는 동일한 참조부호가 부여되어 있다. 또한, 이하의 실시예들의 설명에 있어서, 동일하거나 대응되는 구성요소를 중복하여 기술하는 것이 생략될 수 있다. 그러나, 구성요소에 관한 기술이 생략되어도, 그러한 구성요소가 어떤 실시예에 포함되지 않는 것으로 의도되지는 않는다.
개시된 실시예의 이점 및 특징, 그리고 그것들을 달성하는 방법은 첨부되는 도면과 함께 후술되어 있는 실시예들을 참조하면 명확해질 것이다. 그러나, 본 개시는 이하에서 개시되는 실시예들에 한정되는 것이 아니라 서로 다른 다양한 형태로 구현될 수 있으며, 단지 본 실시예들은 본 개시가 완전하도록 하고, 본 개시가 통상의 기술자에게 발명의 범주를 완전하게 알려주기 위해 제공되는 것일 뿐이다.
본 명세서에서 사용되는 용어에 대해 간략히 설명하고, 개시된 실시예에 대해 구체적으로 설명하기로 한다. 본 명세서에서 사용되는 용어는 본 개시에서의 기능을 고려하면서 가능한 현재 널리 사용되는 일반적인 용어들을 선택하였으나, 이는 관련 분야에 종사하는 기술자의 의도 또는 판례, 새로운 기술의 출현 등에 따라 달라질 수 있다. 또한, 특정한 경우는 출원인이 임의로 선정한 용어도 있으며, 이 경우 해당되는 발명의 설명 부분에서 상세히 그 의미를 기재할 것이다. 따라서, 본 개시에서 사용되는 용어는 단순한 용어의 명칭이 아닌, 그 용어가 가지는 의미와 본 개시의 전반에 걸친 내용을 토대로 정의되어야 한다.
본 명세서에서의 단수의 표현은 문맥상 명백하게 단수인 것으로 특정하지 않는 한, 복수의 표현을 포함한다. 또한, 복수의 표현은 문맥상 명백하게 복수인 것으로 특정하지 않는 한, 단수의 표현을 포함한다. 명세서 전체에서 어떤 부분이 어떤 구성요소를 포함한다고 할 때, 이는 특별히 반대되는 기재가 없는 한 다른 구성요소를 제외하는 것이 아니라 다른 구성요소를 더 포함할 수 있음을 의미한다.
또한, 명세서에서 사용되는 '모듈' 또는 '부'라는 용어는 소프트웨어 또는 하드웨어 구성요소를 의미하며, '모듈' 또는 '부'는 어떤 역할들을 수행한다. 그렇지만, '모듈' 또는 '부'는 소프트웨어 또는 하드웨어에 한정되는 의미는 아니다. '모듈' 또는 '부'는 어드레싱할 수 있는 저장 매체에 있도록 구성될 수도 있고 하나 또는 그 이상의 프로세서들을 재생시키도록 구성될 수도 있다. 따라서, 일 예로서, '모듈' 또는 '부'는 소프트웨어 구성요소들, 객체지향 소프트웨어 구성요소들, 클래스 구성요소들 및 태스크 구성요소들과 같은 구성요소들과, 프로세스들, 함수들, 속성들, 프로시저들, 서브루틴들, 프로그램 코드의 세그먼트들, 드라이버들, 펌웨어, 마이크로 코드, 회로, 데이터, 데이터베이스, 데이터 구조들, 테이블들, 어레이들 또는 변수들 중 적어도 하나를 포함할 수 있다. 구성요소들과 '모듈' 또는 '부'들은 안에서 제공되는 기능은 더 작은 수의 구성요소들 및 '모듈' 또는 '부'들로 결합되거나 추가적인 구성요소들과 '모듈' 또는 '부'들로 더 분리될 수 있다.
본 개시의 일 실시예에 따르면, '모듈' 또는 '부'는 프로세서 및 메모리로 구현될 수 있다. '프로세서'는 범용 프로세서, 중앙 처리 장치(CPU), 마이크로프로세서, 디지털 신호 프로세서(DSP), 제어기, 마이크로제어기, 상태 머신 등을 포함하도록 넓게 해석되어야 한다. 몇몇 환경에서, '프로세서'는 주문형 반도체(ASIC), 프로그램가능 로직 디바이스(PLD), 필드 프로그램가능 게이트 어레이(FPGA) 등을 지칭할 수도 있다. '프로세서'는, 예를 들어, DSP와 마이크로프로세서의 조합, 복수의 마이크로프로세서들의 조합, DSP 코어와 결합한 하나 이상의 마이크로프로세서들의 조합, 또는 임의의 다른 그러한 구성들의 조합과 같은 처리 디바이스들의 조합을 지칭할 수도 있다. 또한, '메모리'는 전자 정보를 저장 가능한 임의의 전자 컴포넌트를 포함하도록 넓게 해석되어야 한다. '메모리'는 임의 액세스 메모리(RAM), 판독-전용 메모리(ROM), 비-휘발성 임의 액세스 메모리(NVRAM), 프로그램가능 판독-전용 메모리(PROM), 소거-프로그램가능 판독 전용 메모리(EPROM), 전기적으로 소거가능 PROM(EEPROM), 플래쉬 메모리, 자기 또는 광학 데이터 저장장치, 레지스터들 등과 같은 프로세서-판독가능 매체의 다양한 유형들을 지칭할 수도 있다. 프로세서가 메모리로부터 정보를 판독하고/하거나 메모리에 정보를 기록할 수 있다면 메모리는 프로세서와 전자 통신 상태에 있다고 불린다. 프로세서에 집적된 메모리는 프로세서와 전자 통신 상태에 있다.
본 개시에서, '시스템'은 서버 장치와 클라우드 장치 중 적어도 하나의 장치를 포함할 수 있으나, 이에 한정되는 것은 아니다. 예를 들어, 시스템은 하나 이상의 서버 장치로 구성될 수 있다. 다른 예로서, 시스템은 하나 이상의 클라우드 장치로 구성될 수 있다. 또 다른 예로서, 시스템은 서버 장치와 클라우드 장치가 함께 구성되어 동작될 수 있다.
본 개시에서, '복수의 A의 각각' 또는 '복수의 A 각각'은 복수의 A에 포함된 모든 구성 요소의 각각을 지칭하거나, 복수의 A에 포함된 일부 구성 요소의 각각을 지칭할 수 있다.
본 개시에서, '중간표현'은 프로그램을 효율적으로 실행하기 위해 생성되는, 프로그램과 동일한 의미를 가지는 그래프 및/또는 이와 연관된 정보를 지칭할 수 있다. 일 실시예에서, 중간표현은 하나 이상의 노드 및 하나 이상의 엣지를 포함할 수 있다.
본 개시에서, 'in-place 연산'은 프로그램의 연산 중 출력 데이터가 입력 데이터와 동일한 연산을 의미할 수 있다. 다시 말해, 입력 데이터에 할당된 메모리에 저장된 값이 연산 이후, 출력 데이터의 값으로 대체되는 연산을 의미할 수 있다.
도 1은 본 개시의 일 실시예에 따른 정보 처리 시스템(110)이 중간표현(130)을 생성하는 방법의 예시를 나타내는 도면이다. 정보 처리 시스템(110)은 프로그램(120)으로부터 정보를 추출하여 프로그램(120)에 in-place 연산이 존재하는 여부를 판정할 수 있다. 또한, 정보 처리 시스템(110)은 프로그램(120)에 in-place 연산이 존재하는 경우, 생성 규칙을 이용하여 프로그램(120)에 대한 중간표현(130)을 생성할 수 있고, 프로그램의 데이터 및 프로그램과 중간표현 사이의 대응관계를 데이터베이스(140)에 저장할 수 있다.
일 실시예에 따르면, 정보 처리 시스템(110)은 프로그램(120)으로부터 입출력을 위한 데이터에 대한 정보 및 연산에 대한 정보를 추출할 수 있다. 예를 들어, 정보 처리 시스템(110)은 프로그램(120)으로부터 새로운 변수 또는 상수의 생성, 변수 값 또는 상수 값의 정의 및 변경, 변수 또는 상수의 자료형, 변수 또는 상수의 크기 등 데이터에 대한 정보를 추출할 수 있다. 또한, 정보 처리 시스템(100)은 수행되는 연산의 종류, 연산의 입출력 데이터에 대한 정보, 연산의 파라미터 등 연산에 대한 정보를 추출할 수 있다. 일 실시예에 따르면, 프로그램(120)은 딥 러닝 프로그램을 포함할 수 있고, 데이터는 텐서 타입의 데이터를 포함할 수 있다. 정보 처리 시스템(110)은 딥 러닝 프로그램에 포함된 텐서 타입의 데이터로부터 자료형, 각 차원의 크기 등에 대한 정보를 추출할 수 있다.
일 실시예에 따르면, 정보 처리 시스템(110)은 추출된 데이터에 대한 정보 및 추출된 연산에 대한 정보로부터 in-place 연산이 존재하는지 여부를 판정할 수 있다. 여기서, in-place 연산은 입력 데이터에 할당된 메모리에 저장된 값이 연산 이후, 출력 데이터의 값으로 대체되는 연산을 의미할 수 있다. 프로그램(120)에 in-place 연산이 존재하는 경우, 정보 처리 시스템(110)은 추출된 데이터에 대한 정보, 추출된 연산에 대한 정보 및 in-place 연산과 연관된 생성 규칙을 이용하여 중간표현(130)을 생성(및 갱신)할 수 있다. 중간표현(130)은 노드(nodes)와 엣지(edges)를 포함하는 그래프의 형태로 표현될 수 있다. 그래프의 형태로 표현되는 중간표현(130)에서, 프로그램(120)으로부터 추출된 데이터 및 연산은 노드로 표현될 수 있으며, 데이터와 연산의 입출력 관계는 엣지로 표현될 수 있다. 여기서, in-place 연산과 연관된 생성 규칙은 in-place 연산에 대해 in-place 연산이 아닌 일반 연산과 같아지도록 새로운 출력 데이터 노드를 생성/갱신하는 생성 규칙을 의미할 수 있다.
일 실시예에 따르면, 정보 처리 시스템(110)은 프로그램(120)으로부터 추출된 입출력을 위한 데이터 및 프로그램과 중간표현에 포함된 데이터 사이의 대응관계를 데이터베이스(140)에 저장할 수 있다. 여기서, 입출력을 위한 데이터는 프로그램의 변수 또는 텐서를 지칭할 수 있다. 또한, 프로그램의 데이터와 중간표현에 포함된 데이터 사이의 대응관계는 하나의 입출력 데이터가 갖는 다른 입출력 데이터에 대한 어드레스 정보를 의미하는 포인터(pointer) 및/또는 입출력 데이터의 크기를 변경하는 in-place 연산에 대한 역연산(inverse)을 지칭할 수 있다.
추가적으로, 프로그램에 in-place 연산이 존재하여 중간표현이 생성(및 갱신)된 경우, 데이터베이스(140)에 입출력을 위한 데이터 및 프로그램의 데이터와 중간표현에 포함된 데이터 사이의 대응관계가 저장 및 갱신될 수 있다.
이와 같은 구성을 통해, 프로그램에 in-place 연산이 포함된 경우, 중간표현 생성 시, 순환 구조가 발생하여 연산 순서를 알 수 없는 경우가 발생하는 것을 방지할 수 있다. 또한, 순환 구조가 없어 프로그램 최적화 기법을 쉽게 적용할 수 있으므로 프로그램의 메모리 사용량을 감소시켜 프로그램의 실행 속도를 빠르게 유지할 수 있다.
도 2는 본 개시의 일 실시예에 따른 정보 처리 시스템(110)의 내부 구성을 나타내는 블록도이다. 정보 처리 시스템(110)은 메모리(210), 프로세서(220), 통신 모듈(230) 및 입출력 인터페이스(240)를 포함할 수 있다. 도 2에 도시된 바와 같이, 정보 처리 시스템(110)은 통신 모듈(230)을 이용하여 네트워크를 통해 정보 및/또는 데이터를 통신할 수 있도록 구성될 수 있다.
메모리(210)는 비-일시적인 임의의 컴퓨터 판독 가능한 기록매체를 포함할 수 있다. 일 실시예에 따르면, 메모리(210)는 RAM(random access memory), ROM(read only memory), 디스크 드라이브, SSD(solid state drive), 플래시 메모리(flash memory) 등과 같은 비소멸성 대용량 저장 장치(permanent mass storage device)를 포함할 수 있다. 다른 예로서, ROM, SSD, 플래시 메모리, 디스크 드라이브 등과 같은 비소멸성 대용량 저장 장치는 메모리와는 구분되는 별도의 영구 저장 장치로서 정보 처리 시스템(110)에 포함될 수 있다. 또한, 메모리(210)에는 운영체제와 적어도 하나의 프로그램 코드(예를 들어, 정보 처리 시스템(110)에 설치되어 구동되는 in-place 연산 존재 여부 판정, 중간표현 생성 및 갱신 등을 위한 코드)가 저장될 수 있다.
이러한 소프트웨어 구성요소들은 메모리(210)와는 별도의 컴퓨터에서 판독 가능한 기록매체로부터 로딩될 수 있다. 이러한 별도의 컴퓨터에서 판독 가능한 기록매체는 이러한 정보 처리 시스템(110)에 직접 연결가능한 기록 매체를 포함할 수 있는데, 예를 들어, 플로피 드라이브, 디스크, 테이프, DVD/CD-ROM 드라이브, 메모리 카드 등의 컴퓨터에서 판독 가능한 기록매체를 포함할 수 있다. 다른 예로서, 소프트웨어 구성요소들은 컴퓨터에서 판독 가능한 기록매체가 아닌 통신 모듈(230)을 통해 메모리(210)에 로딩될 수도 있다. 예를 들어, 적어도 하나의 프로그램은 개발자들 또는 어플리케이션의 설치 파일을 배포하는 파일 배포 시스템이 통신 모듈(230)을 통해 제공하는 파일들에 의해 설치되는 컴퓨터 프로그램(예를 들어, in-place 연산 존재 여부 판정, 중간표현 생성 및 갱신 등을 위한 프로그램 등)에 기반하여 메모리(210)에 로딩될 수 있다.
프로세서(220)는 기본적인 산술, 로직 및 입출력 연산을 수행함으로써, 컴퓨터 프로그램의 명령을 처리하도록 구성될 수 있다. 명령은 메모리(210) 또는 통신 모듈(230)에 의해 사용자 단말(미도시) 또는 다른 외부 시스템으로 제공될 수 있다. 예를 들어, 프로세서(220)는 프로그램으로부터 입출력을 위한 데이터에 대한 정보 및 연산에 대한 정보를 추출하고, 추출된 데이터에 대한 정보 및 추출된 연산에 대한 정보로부터 in-place 연산이 존재하는지 여부를 판정하고, in-place 연산이 존재하는 경우, 추출된 데이터에 대한 정보, 추출된 연산에 대한 정보 및 in-place 연산과 연관된 생성 규칙을 이용하여 중간표현을 생성할 수 있다.
통신 모듈(230)은 네트워크를 통해 사용자 단말(미도시)과 정보 처리 시스템(110)이 서로 통신하기 위한 구성 또는 기능을 제공할 수 있으며, 정보 처리 시스템(110)이 외부 시스템(일례로 별도의 클라우드 시스템 등)과 통신하기 위한 구성 또는 기능을 제공할 수 있다. 일례로, 정보 처리 시스템(110)의 프로세서(220)의 제어에 따라 제공되는 제어 신호, 명령, 데이터 등이 통신 모듈(230)과 네트워크를 거쳐 사용자 단말 및/또는 외부 시스템의 통신 모듈을 통해 사용자 단말 및/또는 외부 시스템으로 전송될 수 있다. 예를 들어, 컴퓨팅 장치에 의해 생성된 프로그램을 나타내는 중간표현이 외부 시스템(예: 프로그램을 실행하는 시스템 등)으로 전송될 수 있다.
또한, 정보 처리 시스템(110)의 입출력 인터페이스(240)는 정보 처리 시스템(110)과 연결되거나 정보 처리 시스템(110)이 포함할 수 있는 입력 또는 출력을 위한 장치(미도시)와의 인터페이스를 위한 수단일 수 있다. 도 2에서는 입출력 인터페이스(240)가 프로세서(220)와 별도로 구성된 요소로서 도시되었으나, 이에 한정되지 않으며, 입출력 인터페이스(240)가 프로세서(220)에 포함되도록 구성될 수 있다. 정보 처리 시스템(110)은 도 2의 구성요소들보다 더 많은 구성요소들을 포함할 수 있다. 그러나, 대부분의 종래기술적 구성요소들을 명확하게 도시할 필요성은 없다.
정보 처리 시스템(110)의 프로세서(220)는 복수의 사용자 단말 및/또는 복수의 외부 시스템으로부터 수신된 정보 및/또는 데이터를 관리, 처리 및/또는 저장하도록 구성될 수 있다. 일 실시예에 따르면, 프로세서(220)는 사용자 단말 및/또는 외부 시스템으로부터 프로그램의 입출력을 위한 데이터에 대한 정보 및 연산에 대한 정보를 포함한 프로그램 코드를 수신할 수 있다. 이 경우, 프로세서는 수신된 코드에 포함된 입출력을 위한 데이터에 대한 정보 및 연산에 대한 정보를 추출하고, 추출된 데이터에 대한 정보 및 추출된 연산에 대한 정보로부터 in-place 연산이 존재하는지 여부를 판정하고, in-place 연산이 존재하는 경우, 추출된 데이터에 대한 정보, 추출된 연산에 대한 정보 및 in-place 연산과 연관된 생성 규칙을 이용하여 중간표현을 생성할 수 있다.
도 3은 본 개시의 일 실시예에 따른 프로세서(220)의 내부 구성을 나타내는 블록도이다. 도시된 바와 같이, 프로세서(220)는 데이터/연산 추출부(310), in-place 연산 판정부(320), 중간표현 생성부(330) 및 데이터베이스 관리부(340)를 포함할 수 있다. 도 3에서는 단일 프로세서로 도시되었으나, 이에 한정되지 않으며, 복수의 프로세서로 구성될 수 있다.
일 실시예에 따르면, 데이터/연산 추출부(310)는 프로그램으로부터 입출력을 위한 데이터에 대한 정보 및 연산에 대한 정보를 추출할 수 있다. 예를 들어, 데이터/연산 추출부(310)는 프로그램으로부터 새로운 변수 또는 상수의 생성, 변수 값 또는 상수 값의 정의 및 변경, 변수 또는 상수의 자료형, 변수 또는 상수의 크기 등 데이터에 대한 정보를 추출할 수 있다. 또한, 데이터/연산 추출부(310)는 수행되는 연산의 종류, 연산의 입출력 데이터에 대한 정보, 연산의 파라미터 등 연산에 대한 정보를 추출할 수 있다. 일 실시예에 따르면, 프로그램은 딥 러닝 프로그램을 포함할 수 있고, 데이터는 텐서 타입의 데이터를 포함할 수 있다. 데이터/연산 추출부(310)는 딥 러닝 프로그램에 포함된 텐서 타입의 데이터로부터 자료형, 각 차원의 크기 등에 대한 정보를 추출할 수 있다.
일 실시예에 따르면, in-place 연산 판정부(320)는 입출력 데이터에 대한 정보 및 연산에 대한 정보로부터 in-place 연산이 존재하는지 여부를 판정할 수 있다. 여기서, in-place 연산은 입력 데이터에 할당된 메모리에 저장된 값이 연산 이후, 출력 데이터의 값으로 대체되는 연산을 의미할 수 있다. 예를 들어, in-place 연산은 딥 러닝 프레임워크인 PyTorch의 경우, 텐서의 모양(또는 크기)을 변경하지 않는 in-place 연산(예: add_, mul_ 등), 텐서의 모양(또는 크기)을 변경하는 in-place 연산(예: view 등)을 포함할 수 있으나, 이에 한정되지 않는다.
일 실시예에 따르면, 중간표현 생성부(330)는 in-place 연산이 존재하는 경우, 추출된 데이터에 대한 정보, 추출된 연산에 대한 정보 및 in-place 연산과 연관된 생성 규칙을 이용하여 중간표현을 생성/갱신할 수 있다. 중간표현은 데이터 및 연산을 나타내는 노드와 데이터와 연산의 입출력 관계를 나타내는 엣지를 포함하는 그래프의 형태로 표현될 수 있다. 여기서, in-place 연산과 연관된 생성 규칙은 in-place 연산에 대해 in-place 연산이 아닌 일반 연산과 같아지도록 새로운 출력 데이터 노드를 생성/갱신하는 생성 규칙을 의미할 수 있다.
일 실시예에 따르면, 중간표현 생성부(330)는 in-place 연산의 출력 데이터에 대응하는 중간표현의 연산의 출력 데이터를 생성함으로써 중간표현을 생성할 수 있다. 이 경우, 중간 표현의 연산의 출력 데이터의 데이터명은 in-place 연산의 입력 데이터의 데이터명과 상이할 수 있다. 예를 들어, in-place 연산이 'A = A + B'와 같은 형태인 경우, 중간표현 생성부(330)는 출력 데이터 'A'를 입력 데이터 'A'와 상이한 데이터명을 가진 출력 데이터 'A2'로 중간표현을 생성할 수 있다.
일 실시예에 따르면, 추출된 in-place 연산이 제1 in-place 연산과 이에 후속하는 제2 in-place 연산을 포함하는 경우, 중간표현 생성부(330)는 제1 in-place 연산의 출력 데이터 및 제2 in-place 연산의 출력 데이터에 대응하는, 중간표현의 연산의 출력 데이터를 생성함으로써, 중간표현을 생성할 수 있다. 이 경우, 제1 in-place 연산의 입력 데이터의 데이터명, 제1 in-place 연산의 출력 데이터의 데이터명 및 제2 in-place 연산의 출력 데이터의 데이터명이 서로 상이할 수 있다. 예를 들어, 프로그램으로부터 제1 in-place 연산(예: 'C = A.add_(B)')과 이에 후속하는 제2 in-place 연산(예: 'D = C.add_(B)')을 추출한 경우, 중간표현 생성부(330)는 제1 in-place 연산의 출력 데이터인 'C'와 제2 in-place 연산의 출력 데이터인 'D'에 대응하는 중간표현의 연산의 출력 데이터 'C', 'D'를 각각 생성함으로써, 중간표현을 생성할 수 있다.
일 실시예에 따르면, in-place 연산의 입력 데이터의 제1 크기와 in-place 연산의 출력 데이터의 제2 크기가 상이한 in-place 연산의 후속 연산으로서, in-place 연산의 입력 데이터의 제1 크기를 이용하는 연산이 존재하는 경우, 중간표현 생성부(330)는 in-place 연산의 입력 데이터의 제2 크기를 제1 크기로 되돌릴 수 있는 연산(즉, 역연산)을 이용하여 중간표현을 생성할 수 있다. 예를 들어, 입력 데이터 'A'의 제1 크기(예: 2 X 3)와 출력 데이터 'D'의 제2 크기(예: 3 X 2)가 상이한 in-place 연산(예: 'D = A.view(3,2)')의 후속 연산으로서, in-place 연산의 입력 데이터의 제1 크기를 이용하는 연산(예: 입력 데이터 'B'는 제1 크기(2 X 3)인, 'F = A.add_(B)')이 존재하는 경우, 중간표현 생성부(330)는 역연산을 이용하여 중간표현을 생성할 수 있다.
일 실시예에 따르면, 데이터베이스 관리부(340)는 추출된 데이터에 대한 정보, 중간표현에 포함된 데이터 사이의 대응관계를 데이터베이스에 저장할 수 있다. 추출된 데이터에 대한 정보는 데이터의 이름(예를 들어, 변수명 또는 텐서명) 또는 데이터의 자료형 및 데이터의 크기에 대한 정보 등을 포함할 수 있다. 또한 프로그램과 중간표현에 포함된 데이터 사이의 대응관계는 데이터가 포함하는 포인터에 대한 정보를 포함할 수 있다. 또한, 입출력 데이터의 크기를 변경하는 in-place 연산에 대한 역연산을 수행하기 위해, 입출력 데이터의 이전 크기에 대한 정보를 포함할 수 있다.
일 실시예에 따르면, 데이터베이스 관리부(340)는 in-place 연산의 입력 데이터의 포인터가, in-place 연산의 출력 데이터에 대응하는 중간표현의 연산의 출력 데이터를 가리키도록 변경함으로써, 데이터베이스를 업데이트할 수 있다. 예를 들어, in-place 연산이 'A = A + B'와 같은 형태인 경우, in-place 연산 수행 결과에 따라, 데이터베이스 관리부(340)는 중간표현의 연산의 입력 데이터 'A'를 가리키던 포인터를 중간표현의 연산의 출력 데이터 'A2'로 가리키도록 변경함으로써, 데이터베이스를 업데이트할 수 있다.
일 실시예에 따르면, 추출된 in-place 연산이 제1 in-place 연산과 이에 후속하는 제2 in-place 연산을 포함하는 경우, 데이터베이스 관리부(340)는 제1 in-place 연산의 입력데이터의 포인터가, 제2 in-place 연산의 출력 데이터에 대응하는 중간표현의 연산의 출력 데이터를 가리키도록 변경함으로써, 데이터베이스를 업데이트할 수 있다. 예를 들어, 추출된 in-place 연산이 제1 in-place 연산(예: 'C = A.add_(B)')과 이에 후속하는 제2 in-place 연산(예: 'D = C.add_(B)')을 포함하는 경우, 데이터베이스 관리부(340)는 제2 in-place 연산 수행 결과에 따라, 제1 in-place 연산의 입력데이터 'A'의 포인터가 중간표현의 연산의 출력 데이터 'D'를 가리키도록 변경함으로써, 데이터베이스를 업데이트할 수 있다.
일 실시예에 따르면, in-place 연산의 입력 데이터의 제1 크기와 in-place 연산의 출력 데이터의 제2 크기가 상이한 경우, 데이터베이스 관리부(340)는 in-place 연산의 입력 데이터의 포인터가 in-place 연산의 출력 데이터에 대응하는 중간표현의 연산의 출력 데이터를 가리키도록 변경함으로써, 데이터베이스를 업데이트할 수 있다. 이 경우, 데이터베이스 관리부(340)는 in-place 연산의 입력 데이터에 제1 크기로 되돌릴 수 있는 연산(즉, 역연산)에 대한 정보를 연관시켜서 저장할 수 있다. 예를 들어, 입력 데이터 'A'의 제1 크기(예: 2 X 3)와 출력 데이터 'D'의 제2 크기(예: 3 X 2)가 상이한 경우, 데이터베이스 관리부(340)는 제2 in-place 연산 수행 결과에 따라, 제1 in-place 연산의 입력데이터 'A'의 포인터가 중간표현의 연산의 출력 데이터 'D'를 가리키도록 변경함으로써, 데이터베이스를 업데이트할 수 있다. 이 경우, 데이터베이스 관리부(340)는 in-place 연산의 입력 데이터 'A'에 제1 크기(예, 2 X 3)으로 되돌릴 수 있는 연산에 대한 정보를 연관시켜서 데이터베이스에 저장할 수 있다.
일 실시예에 따르면, in-place 연산의 입력 데이터의 제1 크기와 in-place 연산의 출력 데이터의 제2 크기가 상이한 in-place 연산의 후속 연산으로서, in-place 연산의 입력 데이터의 제1 크기를 이용하는 연산이 존재하는 경우, 데이터베이스 관리부(340)는 in-place 연산의 입력 데이터 및 출력 데이터의 각각의 포인터를 후속 in-place 연산의 출력 데이터에 대응하는 중간표현의 연산의 출력 데이터를 가리킴으로써, in-place 연산의 출력 데이터의 제2 크기를 상기 제1 크기로 변경함으로써, 데이터베이스를 업데이트 할 수 있다. 이 경우, 데이터베이스 관리부(340)는 in-place 연산의 출력 데이터에 제2 크기로 되돌릴 수 있는 정보를 연관시켜서 저장할 수 있다. 예를 들어, 입력 데이터 'A'의 제1 크기(예: 2 X 3)와 출력 데이터 'D'의 제2 크기(예: 3 X 2)가 상이한 in-place 연산(예: 'D = A.view(3,2)')의 후속 연산으로서, in-place 연산의 입력 데이터의 제1 크기를 이용하는 연산(예: 입력 데이터 'B'는 제1 크기(2 X 3)인, 'F = A.add_(B)')이 존재하는 경우, in-place 연산의 입력 데이터 'A'및 in-place 연산의 출력 데이터 'D'의 각각의 포인터를 후속 in-place 연산의 출력 데이터 'F'에 대응하는 중간표현의 연산의 출력 데이터를 가리키도록 변경함으로써, 데이터베이스를 업데이트할 수 있다. 이 경우, 데이터베이스 관리부(340)는 in-place 연산의 출력 데이터에 제2 크기로 되돌릴 수 있는 정보(예: view(2,3))를 연관시켜서 저장할 수 있다.
도 3에서 도시한 프로세서(220)의 내부 구성은 예시일 뿐이며, 일부 실시예에서는 도시한 내부 구성 외 다른 구성을 추가로 포함할 수 있으며, 일부 구성이 생략될 수도 있으며, 일부 과정이 다른 구성 또는 외부 시스템에 의해 수행될 수 있다. 또한, 도 3에서 프로세서(220)의 내부 구성들을 기능별로 구분하여 설명하였으나, 이것은 내부 구성들이 반드시 물리적으로 구분되는 것을 의미하지 않는다.
도 4는 본 개시의 일 실시예에 따른 중간표현을 생성하는 방법(400)의 예시를 나타내는 흐름도이다. 방법(400)의 각 단계는 적어도 하나의 프로세서에 의해 수행될 수 있다. 일 실시예에 따르면, 방법(400)은 프로세서가 프로그램으로부터 입출력을 위한 데이터에 대한 정보 및 연산에 대한 정보를 추출함으로써 개시될 수 있다(S410). 일 실시예에 따르면, 프로그램은 딥 러닝 프로그램을 포함할 수 있고, 프로그램의 데이터는 텐서 타입의 데이터를 포함할 수 있다.
그 후, 프로세서는 추출된 데이터에 대한 정보 및 추출된 연산에 대한 정보로부터 in-place 연산이 존재하는지 여부를 판정할 수 있다(S420). 여기서, in-place 연산은 입력 데이터에 할당된 메모리에 저장된 값이 연산 이후, 출력 데이터의 값으로 대체되는 연산을 의미할 수 있다. 예를 들어, in-place 연산은 딥 러닝 프레임워크인 PyTorch의 경우, 텐서의 모양(또는 크기)을 변경하지 않는 in-place 연산(예: add_, mul_ 등), 텐서의 모양(또는 크기)을 변경하는 in-place 연산(예: view 등)을 포함할 수 있으나, 이에 한정되지 않는다.
in-place 연산이 존재하는 경우, 프로세서는 추출된 데이터에 대한 정보, 추출된 연산에 대한 정보 및 in-place 연산과 연관된 생성 규칙을 이용하여 중간표현을 생성할 수 있다(S430). 추가적으로, 프로세서는 추출된 입출력을 위한 데이터 및 중간표현에 포함된 데이터 사이의 대응관계를 데이터베이스에 저장할 수 있다.
일 실시예에 따르면, 프로세서는 in-place 연산의 출력 데이터에 대응하는, 중간표현의 연산의 출력 데이터를 생성함으로써, 중간표현을 생성할 수 있다. 이 경우, 중간표현의 연산의 출력 데이터의 데이터명은, in-place 연산의 입력 데이터의 데이터명과 상이할 수 있다. 추가적으로, 프로세서는 in-place 연산의 입력 데이터의 포인터가, in-place 연산의 출력 데이터에 대응하는 중간표현의 연산의 출력 데이터를 가리키도록 변경함으로써, 데이터베이스를 업데이트할 수 있다.
일 실시예에 따르면, in-place 연산이 제1 in-place 연산 및 제1 in-place 연산에 후속하는 제2 in-place 연산을 포함하는 경우, 프로세서는 제1 in-place 연산의 출력 데이터 및 제2 in-place 연산의 출력 데이터에 대응하는, 중간표현의 연산의 출력 데이터를 생성함으로써, 중간표현을 생성할 수 있다. 이 경우, 제1 in-place 연산의 입력 데이터의 데이터명, 제1 in-place 연산의 출력 데이터의 데이터명 및 제2 in-place 연산의 출력 데이터의 데이터명이 서로 상이할 수 있다. 추가적으로, 프로세서는 제1 in-place 연산의 입력 데이터의 포인터가, 제2 in-place 연산의 출력 데이터에 대응하는 중간표현의 연산의 출력 데이터를 가리키도록 변경함으로써, 데이터베이스를 업데이트할 수 있다.
일 실시예에 따르면, in-place 연산의 입력 데이터의 제1 크기가 in-place 연산의 출력 데이터의 제2 크기와 상이한 경우, 프로세서는 in-place 연산의 입력 데이터의 포인터가 중간표현의 연산의 출력 데이터를 가리키도록 변경함으로써, 데이터베이스를 업데이트할 수 있다. 이 경우, 프로세서는 in-place 연산의 입력 데이터에 제1 크기로 되돌릴 수 있는 연산에 대한 정보를 연관시켜서 데이터베이스에 저장할 수 있다.
일 실시예에 따르면, in-place 연산의 입력 데이터의 제1 크기와 in-place 연산의 출력 데이터의 제2 크기가 상이한 in-place 연산의 후속 연산으로서, in-place 연산의 입력 데이터의 제1 크기를 이용하는 연산이 존재하는 경우, 프로세서는 in-place 연산의 입력 데이터의 제2 크기를 제1 크기로 되돌릴 수 있는 연산을 이용하여 중간표현을 생성할 수 있다. 추가적으로, 프로세서는 in-place 연산의 후속 연산이 후속 in-place 연산인 경우, in-place 연산의 입력 데이터 및 in-place 연산의 출력 데이터의 각각의 포인터를 후속 in-place 연산의 출력 데이터에 대응하는 중간표현의 연산의 출력 데이터를 가리킴으로써, in-place 연산의 출력 데이터의 제2 크기를 제1 크기로 변경할 수 있다. 이 경우, in-place 연산의 출력 데이터에 제2 크기로 되돌릴 수 있는 정보를 연관시켜서 저장할 수 있다.
도 4에 도시된 흐름도 및 상술한 설명은 하나의 예시일 뿐이며, 일부 실시예에서는 다르게 구현될 수 있다. 예를 들어, 하나 이상의 단계가 생략되거나 다른 구성에 의해 실시될 수 있으며, 각 단계의 순서가 바뀌거나, 하나 이상의 단계가 동시에 또는 중첩되어 수행되거나, 하나 이상의 단계가 여러 번 반복 수행될 수 있다.
도 5는 본 개시의 일 실시예에 따라 생성된 중간표현(510)과 데이터가 저장된 데이터베이스(530)의 예시를 나타내는 도면이다. 일 실시예에 따르면, 프로세서는 프로그램으로부터 입출력을 위한 데이터에 대한 정보 및 연산에 대한 정보를 추출하고, 추출된 데이터에 대한 정보, 추출된 연산에 대한 정보, in-place 연산과 연관된 생성 규칙을 이용하여 중간표현(510)을 생성할 수 있다. 예를 들어, 도시된 바와 같이, 프로그램에 일반 연산인 'C = A + B'가 존재하는 경우, 프로세서는 프로그램의 입력 데이터 'A', 'B' 및 출력 데이터 'C'를 기초로 입력 데이터 노드 'A'(512), 입력 데이터 노드 'B'(514), 출력 데이터 노드 'C'(520) 및 연산자 노드 '+'(518)를 포함한 중간표현(510)을 생성할 수 있다. 또한, 중간표현(510)에는 엣지(예: 입력 데이터 'A'와 연산자 노드 '+' 사이의 엣지(516))를 이용해 입출력 데이터 노드(512, 514, 520) 및 연산자(518)의 관계를 나타낼 수 있다.
일 실시예에 따르면, 프로세서는 추출된 입출력을 위한 데이터 및 중간표현에 포함된 데이터 사이의 대응관계를 데이터베이스(530)에 저장할 수 있다. 여기서, 중간표현에 포함된 데이터 사이의 대응관계는 프로그램의 데이터와 중간표현에 포함된 데이터 노드 사이의 대응관계(예: 데이터 'A'의 대응 관계(454))를 나타낼 수 있다. 또한, 프로그램의 입력 데이터와 중간표현에 포함된 입력 데이터 노드 사이의 대응관계에 대한 정보(454)가 데이터베이스에 저장될 수 있다.
도 6은 본 개시의 일 실시예에 따라 프로그램(600)에 대해 생성된 중간표현의 예시를 나타내는 도면이다. 프로그램에 포함된 연산 중 일부는 in-place 연산을 포함할 수 있다. in-place 연산을 중간표현 그래프에 표현하는 경우, 순환 구조가 발생할 수 있다. 순환 구조가 발생하는 경우, 알고리즘이 복잡해질 수 있어 최적화 적용이 어려워지는 문제점이 있다. 도 6은 in-place 연산(602)이 포함된 프로그램(600)에 대하여 생성된 중간 표현에 대하여 순환 구조가 발생하는 제1 상태(610) 및 in-place 연산과 연관된 생성 규칙에 의해 순환 구조를 제거한 제2 상태(620)의 예시를 나타낸다.
제1 상태(610)는 프로그램(600)에 'A=A * D'와 같은 in-place 연산(602)이 포함된 경우, 순환 구조(612)가 발생하는 중간표현의 예시를 나타낸다. 즉, 데이터 노드 A(614)와 데이터 노드 'D'가 입력 데이터로서 연산자에 입력되고, 이는 다시 데이터 노드 'A' (614)에 입력되어 데이터 노드 'A' (614)와 연산자 사이에 순환 구조가 발생한다.
제2 상태(620)는 in-place 연산과 연관된 생성 규칙에 따라 생성된 중간표현의 예시를 나타낸다. 예를 들어, 프로세서는 in-place 연산의 출력 데이터에 대응하는 중간표현의 연산의 출력 데이터(624)를 생성함으로써, in-place 연산에 대한 중간표현(622)을 생성할 수 있다. 즉, 도시된 바와 같이, 프로세서는 프로그램(600)에 포함된 in-place 연산(602)의 출력 데이터 'A'에 대응하는 중간표현의 연산의 출력 데이터 'A2'(624)를 생성할 수 있다. 이 경우, 중간표현에서의 출력 데이터의 데이터 명(예, 'A2')과 프로그램(600)에서의 in-place 연산의 입력 데이터의 데이터 명(예, 'A')은 상이하도록 생성될 수 있다. 이와 같은 방식에 따라, 입력 데이터 'A'의 데이터 값은 중간표현의 연산의 입력 데이터 노드 'A'에 입력되고, 출력 데이터 'A'의 데이터 값은 중간표현의 연산의 출력 데이터 노드 'A2'(624)에 입력되어, 순환 구조가 발생하지 않으므로 연산 순서의 혼동을 방지할 수 있다.
도 7은 본 개시의 일 실시예에 따라 프로그램(700)에 대한 중간표현을 생성하고, 프로그램(700)과 중간표현의 대응관계를 데이터베이스에 저장하는 과정의 예시를 나타내는 도면이다. 일 실시예에 따르면, 정보 처리 시스템은 in-place 연산이 포함된 프로그램(700)으로부터 추출된 데이터 및 in-place 연산과 연관된 생성 규칙을 이용하여 중간표현을 생성하고, 추출된 데이터 및 중간표현 사이의 대응 관계를 데이터베이스에 저장할 수 있다.
구체적 예로, 제1 상태 내지 제3 상태(710, 720, 730)를 거쳐 프로그램(700)에 대한 중간표현이 생성될 수 있다. 제1 상태(710)는 프로그램(700)에 포함된 데이터를 생성하는 연산(702, 704)을 기초로 프로그램(700)의 중간표현이 생성되고, 프로그램(700)과 중간표현의 대응관계가 데이터베이스에 저장된 상태의 예시를 나타낸다. 예를 들어, 도시된 바와 같이, 정보 처리 시스템은 프로그램(700)의 제1 연산(702)(예: 'A = torch.Tensor') 및 제2 연산(704)(예: 'B = torch.Tensor')으로부터 새롭게 생성된 텐서 A 및 텐서 B에 대한 정보를 추출할 수 있다. 그런 다음, 도시된 바와 같이 중간표현에 텐서 A 및 텐서 B에 대응하는 데이터 노드(예: 'A' 및 'B')를 추가하고, 프로그램(700)의 텐서 A 및 텐서 B에 대한 정보(712, 714) 및 텐서 A 및 텐서 B가 각각 중간표현의 데이터 노드 A 및 데이터 노드 B와 대응된다는 정보(716, 718)를 데이터베이스에 저장할 수 있다.
제2 상태(720)는 프로그램(700)에 포함된 제1 in-place 연산인 제3 연산(706)을 기초로 프로그램(700)의 중간표현이 생성되고, 프로그램(700)과 중간표현의 대응관계가 데이터베이스에 업데이트된 상태의 예시를 나타낸다. 예를 들어, 도시된 바와 같이, 정보 처리 시스템은 프로그램(700)으로부터 추출한 제1 in-place 연산인 제3 연산(706)(예: 'C = A.add_(B)')의 출력 데이터(예: 텐서 C)에 대응하는, 중간표현의 연산의 출력 데이터(예: 데이터 노드 C(728))를 생성함으로써, 중간표현을 생성할 수 있다. 그 후, 정보 처리 시스템은 제1 in-place 연산인 제3 연산(706)의 입력 데이터(예: 텐서 A)의 포인터가, 제1 in-place 연산의 출력 데이터(예: 텐서 C)에 대응하는 중간표현의 연산의 출력 데이터(예: 데이터 노드 C(728))를 가리키도록 변경할 수 있다. 즉, 정보 처리 시스템은 프로그램(700)의 텐서 A가 중간표현의 데이터 노드 C와 대응된다는 정보(726)로 데이터베이스에 저장된 대응관계를 업데이트할 수 있다. 제2 상태(720)는 텐서 B 및 텐서 C가 각각 중간표현의 데이터 노드 B 및 데이터 노드 C에 대응된다는 정보가 생략되어 도시되어 있으나, 이는 설명의 편의를 위한 것일 뿐이며, 데이터베이스의 각 텐서에 대한 정보는 중간표현의 특정 데이터 노드에 대응된다는 정보를 포함할 수 있다.
제3 상태(730)는 프로그램(700)에 포함된 제2 in-place 연산인 제4 연산(708)을 기초로 프로그램(700)의 중간표현이 생성되고, 프로그램(700)과 중간표현의 대응관계가 데이터베이스에 업데이트된 상태의 예시를 나타낸다. 예를 들어, 도시된 바와 같이, 정보 처리 시스템은 프로그램(700)으로부터 추출한 제2 in-place 연산인 제4 연산(708)(예: 'D = C.add_(B)')의 출력 데이터(예: 텐서 D)에 대응하는, 중간표현의 연산의 출력 데이터(예: 데이터 노드 D(734))를 생성함으로써, 중간표현을 생성할 수 있다. 그 후, 정보 처리 시스템은 제1 in-place 연산인 제3 연산(706)의 입력 데이터(예: 텐서 A)의 포인터가, 제2 in-place 연산의 출력 데이터(예: 텐서 D)에 대응하는 중간표현의 연산의 출력 데이터(예: 데이터 노드 D)를 가리키도록 변경할 수 있다. 또한, 정보 처리 시스템은 제2 in-place 연산인 제4 연산(708)의 입력 데이터(예: 텐서 C)의 포인터가, 제2 in-place 연산의 출력 데이터(예: 텐서 D)에 대응하는 중간표현의 연산의 출력 데이터(예: 데이터 노드 D)를 가리키도록 변경할 수 있다. 즉, 정보 처리 시스템은 프로그램(700)의 텐서 A 및 텐서 C가 중간표현의 데이터 노드 D와 대응된다는 정보(732, 734)로 데이터베이스에 저장된 대응관계를 업데이트할 수 있다. 제3 상태(730)는 텐서 B 및 텐서 D가 각각 중간표현의 데이터 노드 B 및 데이터 노드 D에 대응된다는 정보가 생략되어 도시되어 있으나, 이는 설명의 편의를 위한 것일 뿐이며, 데이터베이스의 각 텐서에 대한 정보는 중간표현의 특정 데이터 노드에 대응된다는 정보를 포함할 수 있다.
도 8은 본 개시의 일 실시예에 따라 데이터의 크기를 변경하는 in-place 연산을 포함하는 프로그램(800)에 대한 중간표현을 생성하고, 프로그램(800)과 중간표현의 대응관계를 데이터베이스에 저장한 상태의 예시를 나타내는 도면이다. 일 실시예에 따르면, 정보 처리 시스템은 프로그램(800)의 in-place 연산의 입력 데이터의 크기가 출력 데이터의 크기와 상이한 경우, in-place 연산의 입력 데이터의 포인터가 in-place 연산의 출력 데이터에 대응하는 중간표현의 연산의 출력 데이터를 가리키도록 변경함으로써, 데이터베이스를 업데이트할 수 있다.
제1 상태(810)는 프로그램(800)에 포함된 데이터의 크기를 변경하는 in-place 연산(802)을 기초로 프로그램(800)의 중간표현이 생성되고, in-place 연산의 입력 데이터의 포인터가 in-place 연산의 출력 데이터에 대응하는 중간표현의 연산의 출력 데이터를 가리키도록 데이터베이스에 업데이트된 상태의 예시를 나타낸다. 예를 들어, 도시된 바와 같이, 정보 처리 시스템은 프로그램(800)의 텐서 A의 제1 크기(예: 2 X 3)를 제2 크기(예: 3 X 2)로 변경하는 in-place 연산(802)(예: 'D = A.view(3,2)')을 추출하여 중간 표현을 생성하고, in-place 연산의 입력 데이터의 포인터가 in-place 연산의 출력 데이터에 대응하는 중간표현의 연산의 출력 데이터(예: 데이터 노드 D(3,2))를 가리키도록 변경함으로써, 데이터베이스를 업데이트할 수 있다. 즉, 정보 처리 시스템은 프로그램(800)의 텐서 A가 중간표현의 데이터 노드 D(3,2)와 대응된다는 정보(812)로 데이터베이스에 저장된 대응관계를 업데이트할 수 있다. 또한, 정보 처리 시스템은 in-place 연산의 입력 데이터(예: 텐서 A)에 제1 크기로 되돌릴 수 있는 연산에 대한 정보(814)(예: 'A view(2,3)')를 연관시켜서 저장할 수 있다.
도 8은 데이터베이스 및 중간표현에 텐서 B, 텐서 F가 생략되어 도시되어 있으나, 이는 설명의 편의를 위한 것이다. 또한, 도 8은 텐서 C, 텐서 D 및 텐서 E가 각각 중간표현의 데이터 노드 C, 데이터 노드 D 및 데이터 노드 E에 대응된다는 정보가 생략되어 도시되어 있으나, 이는 설명의 편의를 위한 것일 뿐이며, 데이터베이스의 각 텐서에 대한 정보는 중간표현의 특정 데이터 노드에 대응된다는 정보를 포함할 수 있다.
도 9는 본 개시의 일 실시예에 따라 두 개 이상의 데이터의 크기를 변경하는 in-place 연산을 포함하는 프로그램(800)에 대한 중간표현을 생성하고, 프로그램(800)과 중간표현의 대응관계를 데이터베이스에 저장한 상태의 예시를 나타내는 도면이다. 일 실시예에 따르면, 정보 처리 시스템은 프로그램(800)의 in-place 연산의 후속 연산으로서, in-place 연산의 입력 데이터의 제1 크기를 이용하는 연산이 존재하는 경우, in-place 연산의 입력 데이터의 제2 크기를 제1 크기로 되돌릴 수 있는 연산을 이용하여 중간표현을 생성할 수 있다. 또한, 정보 처리 시스템은 in-place 연산의 후속 연산이 후속 in-place 연산인 경우, in-place 연산의 입력 데이터 및 in-place 연산의 출력 데이터의 각각의 포인터를 후속 in-place 연산의 출력 데이터에 대응하는 중간표현의 연산의 출력 데이터를 가리킴으로써, in-place 연산의 출력 데이터의 제2 크기를 제1 크기로 변경할 수 있다.
구체적 예로, 제1 상태(910) 및 제2 상태(920)를 거쳐 데이터의 크기를 변경하는 in-place 연산을 포함하는 프로그램(800)에 대한 중간표현이 생성되고, 프로그램(800)과 중간표현의 대응관계가 업데이트 될 수 있다. 제1 상태(910)는 입력 데이터의 크기를 변경하는 제3 in-place 연산(802)의 후속 연산으로서, 입력 데이터의 원래의 크기를 이용하는 제4 in-place 연산(804)이 존재하는 경우, 정보 처리 시스템이 역연산을 이용하여 중간표현을 생성한 상태의 예시를 나타낸다. 예를 들어, 도시된 바와 같이, 정보 처리 시스템은 프로그램(800)의 텐서 A의 제1 크기(예: 2 X 3)를 제2 크기(예: 3 X 2)로 변경하는 제3 in-place 연산(802)(예: 'D = A.view(3,2)')의 후속 연산으로서, 텐서 A의 제1 크기(예: 2 X 3)을 이용하는 제4 in-place 연산(804)(예: 'F = A.add_(B)')이 존재하는 경우, 텐서 A의 제2 크기를 제1 크기로 되돌릴 수 있는 연산(914)(예: 'D2 = D.view(2,3)')을 이용하여 중간표현을 생성할 수 있다. 제1 상태(910)은 데이터베이스 및 중간표현에 텐서 C, 텐서 E가 생략되어 도시되어 있으나, 이는 설명의 편의를 위한 것이다. 또한, 제1 상태(910)는 텐서 B, 텐서 D 및 텐서 F가 각각 중간표현의 데이터 노드 B, 데이터 노드 D 및 데이터 노드 F에 대응된다는 정보가 생략되어 도시되어 있으나, 이는 설명의 편의를 위한 것일 뿐이며, 데이터베이스의 각 텐서에 대한 정보는 중간표현의 특정 데이터 노드에 대응된다는 정보를 포함할 수 있다.
제2 상태(920)는 제4 in-place 연산(804)이 수행된 경우, 정보 처리 시스템이 제3 in-place 연산(802)의 입출력 데이터와 중간표현의 대응관계를 업데이트한 상태의 예시를 나타낸다. 예를 들어, 제4 in-place 연산(804)이 수행되면, 정보 처리 시스템이 제3 in-place 연산(802)의 입력 데이터(예: 텐서 A) 및 출력 데이터(예: 텐서 D)의 각각의 포인터를 제4 in-place 연산(804)의 출력 데이터에 대응하는 중간표현의 연산의 출력 데이터(928)(예: 데이터 노드 F(2,3))를 가리킴으로써, 제3 in-place 연산(802)의 출력 데이터(예: 데이터 노드 D(3,2))의 제2 크기를 제1 크기로 변경하여 데이터베이스를 업데이트할 수 있다. 즉, 정보 처리 시스템은 프로그램(800)의 텐서 A 및 텐서 D가 중간표현의 데이터 노드 F(2,3)와 대응된다는 정보(924, 926)로 데이터베이스에 저장된 대응관계를 업데이트할 수 있다. 또한, 제4 in-place 연산(804)이 수행되면, 정보 처리 시스템은 제3 in-place 연산의 출력 데이터(예: 텐서 D)에 제2 크기로 되돌릴 수 있는 연산에 대한 정보(922)(예: 'D view(3,2)')를 연관시켜서 저장할 수 있다. 이를 통해, 제2 크기를 이용하는 제5 in-place 연산이 존재하는 경우, 제2 크기로 되돌릴 수 있는 연산에 대한 정보를 제5 in-place 연산에 이용할 수 있다. 제2 상태(920)은 데이터베이스 및 중간표현에 텐서 C, 텐서 E가 생략되어 도시되어 있으나, 이는 설명의 편의를 위한 것이다. 또한, 제2 상태(920)는 텐서 B 및 텐서 F가 각각 중간표현의 데이터 노드 B 및 데이터 노드 F에 대응된다는 정보가 생략되어 도시되어 있으나, 이는 설명의 편의를 위한 것일 뿐이며, 데이터베이스의 각 텐서에 대한 정보는 중간표현의 특정 데이터 노드에 대응된다는 정보를 포함할 수 있다.
상술한 방법은 컴퓨터에서 실행하기 위해 컴퓨터 판독 가능한 기록 매체에 저장된 컴퓨터 프로그램으로 제공될 수 있다. 매체는 컴퓨터로 실행 가능한 프로그램을 계속 저장하거나, 실행 또는 다운로드를 위해 임시 저장하는 것일 수도 있다. 또한, 매체는 단일 또는 수개 하드웨어가 결합된 형태의 다양한 기록수단 또는 저장수단일 수 있는데, 어떤 컴퓨터 시스템에 직접 접속되는 매체에 한정되지 않고, 네트워크 상에 분산 존재하는 것일 수도 있다. 매체의 예시로는, 하드 디스크, 플로피 디스크 및 자기 테이프와 같은 자기 매체, CD-ROM 및 DVD 와 같은 광기록 매체, 플롭티컬 디스크(floptical disk)와 같은 자기-광 매체(magneto-optical medium), 및 ROM, RAM, 플래시 메모리 등을 포함하여 프로그램 명령어가 저장되도록 구성된 것이 있을 수 있다. 또한, 다른 매체의 예시로, 애플리케이션을 유통하는 앱 스토어나 기타 다양한 소프트웨어를 공급 내지 유통하는 사이트, 서버 등에서 관리하는 기록매체 내지 저장매체도 들 수 있다.
본 개시의 방법, 동작 또는 기법들은 다양한 수단에 의해 구현될 수도 있다. 예를 들어, 이러한 기법들은 하드웨어, 펌웨어, 소프트웨어, 또는 이들의 조합으로 구현될 수도 있다. 본원의 개시와 연계하여 설명된 다양한 예시적인 논리적 블록들, 모듈들, 회로들, 및 알고리즘 단계들은 전자 하드웨어, 컴퓨터 소프트웨어, 또는 양자의 조합들로 구현될 수도 있음을 통상의 기술자들은 이해할 것이다. 하드웨어 및 소프트웨어의 이러한 상호 대체를 명확하게 설명하기 위해, 다양한 예시적인 구성요소들, 블록들, 모듈들, 회로들, 및 단계들이 그들의 기능적 관점에서 일반적으로 위에서 설명되었다. 그러한 기능이 하드웨어로서 구현되는지 또는 소프트웨어로서 구현되는지의 여부는, 특정 애플리케이션 및 전체 시스템에 부과되는 설계 요구사항들에 따라 달라진다. 통상의 기술자들은 각각의 특정 애플리케이션을 위해 다양한 방식들로 설명된 기능을 구현할 수도 있으나, 그러한 구현들은 본 개시의 범위로부터 벗어나게 하는 것으로 해석되어서는 안된다.
하드웨어 구현에서, 기법들을 수행하는 데 이용되는 프로세싱 유닛들은, 하나 이상의 ASIC들, DSP들, 디지털 신호 프로세싱 디바이스들(digital signal processing devices; DSPD들), 프로그램가능 논리 디바이스들(programmable logic devices; PLD들), 필드 프로그램가능 게이트 어레이들(field programmable gate arrays; FPGA들), 프로세서들, 제어기들, 마이크로제어기들, 마이크로프로세서들, 전자 디바이스들, 본 개시에 설명된 기능들을 수행하도록 설계된 다른 전자 유닛들, 컴퓨터, 또는 이들의 조합 내에서 구현될 수도 있다.
따라서, 본 개시와 연계하여 설명된 다양한 예시적인 논리 블록들, 모듈들, 및 회로들은 범용 프로세서, DSP, ASIC, FPGA나 다른 프로그램 가능 논리 디바이스, 이산 게이트나 트랜지스터 로직, 이산 하드웨어 컴포넌트들, 또는 본원에 설명된 기능들을 수행하도록 설계된 것들의 임의의 조합으로 구현되거나 수행될 수도 있다. 범용 프로세서는 마이크로프로세서일 수도 있지만, 대안으로, 프로세서는 임의의 종래의 프로세서, 제어기, 마이크로제어기, 또는 상태 머신일 수도 있다. 프로세서는 또한, 컴퓨팅 디바이스들의 조합, 예를 들면, DSP와 마이크로프로세서, 복수의 마이크로프로세서들, DSP 코어와 연계한 하나 이상의 마이크로프로세서들, 또는 임의의 다른 구성의 조합으로서 구현될 수도 있다.
펌웨어 및/또는 소프트웨어 구현에 있어서, 기법들은 랜덤 액세스 메모리(random access memory; RAM), 판독 전용 메모리(read-only memory; ROM), 비휘발성 RAM(non-volatile random access memory; NVRAM), PROM(programmable read-only memory), EPROM(erasable programmable read-only memory), EEPROM(electrically erasable PROM), 플래시 메모리, 컴팩트 디스크(compact disc; CD), 자기 또는 광학 데이터 스토리지 디바이스 등과 같은 컴퓨터 판독가능 매체 상에 저장된 명령들로서 구현될 수도 있다. 명령들은 하나 이상의 프로세서들에 의해 실행 가능할 수도 있고, 프로세서(들)로 하여금 본 개시에 설명된 기능의 특정 양태들을 수행하게 할 수도 있다.
이상 설명된 실시예들이 하나 이상의 독립형 컴퓨터 시스템에서 현재 개시된 주제의 양태들을 활용하는 것으로 기술되었으나, 본 개시는 이에 한정되지 않고, 네트워크나 분산 컴퓨팅 환경과 같은 임의의 컴퓨팅 환경과 연계하여 구현될 수도 있다. 또 나아가, 본 개시에서 주제의 양상들은 복수의 프로세싱 칩들이나 장치들에서 구현될 수도 있고, 스토리지는 복수의 장치들에 걸쳐 유사하게 영향을 받게 될 수도 있다. 이러한 장치들은 PC들, 네트워크 서버들, 및 휴대용 장치들을 포함할 수도 있다.
본 명세서에서는 본 개시가 일부 실시예들과 관련하여 설명되었지만, 본 개시의 발명이 속하는 기술분야의 통상의 기술자가 이해할 수 있는 본 개시의 범위를 벗어나지 않는 범위에서 다양한 변형 및 변경이 이루어질 수 있다. 또한, 그러한 변형 및 변경은 본 명세서에 첨부된 특허청구의 범위 내에 속하는 것으로 생각되어야 한다.

Claims (11)

  1. 적어도 하나의 프로세서에 의해 수행되는, in-place 연산을 포함한 프로그램에 대한 중간표현을 생성하는 방법에 있어서,
    상기 프로그램으로부터 입출력을 위한 데이터에 대한 정보 및 연산에 대한 정보를 추출하는 단계;
    상기 추출된 데이터에 대한 정보 및 상기 추출된 연산에 대한 정보로부터 in-place 연산이 존재하는지 여부를 판정하는 단계; 및
    상기 in-place 연산이 존재하는 경우, 상기 추출된 데이터에 대한 정보, 상기 추출된 연산에 대한 정보 및 상기 in-place 연산과 연관된 생성 규칙을 이용하여 중간표현을 생성하는 단계
    를 포함하고,
    상기 in-place의 입력 데이터는 in-place 연산 후의 출력 데이터로 대체되는 데이터인,
    중간표현을 생성하는 방법.
  2. 제1항에 있어서,
    상기 추출된 입출력을 위한 데이터 및 상기 중간표현에 포함된 데이터 사이의 대응 관계를 데이터베이스에 저장하는 단계
    를 더 포함하는, 중간표현을 생성하는 방법.
  3. 제2항에 있어서,
    상기 중간표현을 생성하는 단계는,
    상기 in-place 연산의 출력 데이터에 대응하는, 상기 중간표현의 연산의 출력 데이터를 생성함으로써, 상기 중간표현을 생성하는 단계를 포함하고,
    상기 중간표현의 연산의 출력 데이터의 데이터명은, 상기 in-place 연산의 입력 데이터의 데이터명과 상이한,
    중간표현을 생성하는 방법.
  4. 제3항에 있어서,
    상기 데이터베이스에 저장하는 단계는,
    상기 in-place 연산의 입력 데이터의 포인터가, 상기 in-place 연산의 출력 데이터에 대응하는 상기 중간표현의 연산의 출력 데이터를 가리키도록 변경함으로써, 상기 데이터베이스를 업데이트하는 단계를 포함하는,
    중간표현을 생성하는 방법.
  5. 제2항에 있어서,
    상기 in-place 연산은 제1 in-place 연산 및 제1 in-place 연산에 후속하는 제2 in-place 연산을 포함하고,
    상기 중간표현을 생성하는 단계는,
    상기 제1 in-place 연산의 출력 데이터 및 제2 in-place 연산의 출력 데이터에 대응하는, 상기 중간표현의 연산의 출력 데이터를 생성함으로써, 상기 중간표현을 생성하는 단계를 포함하고,
    상기 제1 in-place 연산의 입력 데이터의 데이터명, 상기 제1 in-place 연산의 출력 데이터의 데이터명 및 상기 제2 in-place 연산의 출력 데이터의 데이터명이 서로 상이한,
    중간표현을 생성하는 방법.
  6. 제5항에 있어서,
    상기 데이터베이스에 저장하는 단계는,
    상기 제1 in-place 연산의 입력데이터의 포인터가, 상기 제2 in-place 연산의 출력 데이터에 대응하는 상기 중간표현의 연산의 출력 데이터를 가리키도록 변경함으로써, 상기 데이터베이스를 업데이트하는 단계를 포함하는,
    중간표현을 생성하는 방법.
  7. 제2항에 있어서,
    상기 데이터베이스에 저장하는 단계는,
    상기 in-place 연산의 입력 데이터의 제1 크기가 상기 in-place 연산의 출력 데이터의 제2 크기와 상이한 경우, 상기 in-place 연산의 입력 데이터의 포인터가 상기 in-place 연산의 출력 데이터에 대응하는 상기 중간표현의 연산의 출력 데이터를 가리키도록 변경함으로써, 상기 데이터베이스를 업데이트하는 단계; 및
    상기 in-place 연산의 입력 데이터에 상기 제1 크기로 되돌릴 수 있는 연산에 대한 정보를 연관시켜서 저장하는 단계를 포함하는,
    중간표현을 생성하는 방법.
  8. 제7항에 있어서,
    상기 중간표현을 생성하는 단계는,
    상기 in-place 연산의 후속 연산으로서, 상기 in-place 연산의 입력 데이터의 제1 크기를 이용하는 연산이 존재하는 경우, 상기 in-place 연산의 입력 데이터의 제2 크기를 상기 제1 크기로 되돌릴 수 있는 연산을 이용하여 상기 중간표현을 생성하는 단계를 포함하는,
    중간표현을 생성하는 방법.
  9. 제8항에 있어서,
    상기 데이터베이스에 저장하는 단계는,
    상기 in-place 연산의 후속 연산이 후속 in-place 연산인 경우, 상기 in-place 연산의 입력 데이터 및 상기 in-place 연산의 출력 데이터의 각각의 포인터를 상기 후속 in-place 연산의 출력 데이터에 대응하는 상기 중간표현의 연산의 출력 데이터를 가리킴으로써, 상기 in-place 연산의 출력 데이터의 제2 크기를 상기 제1 크기로 변경하는 단계; 및
    상기 in-place 연산의 출력 데이터에 상기 제2 크기로 되돌릴 수 있는 정보를 연관시켜서 저장하는 단계를 포함하는,
    중간표현을 생성하는 방법.
  10. 제1항에 따른 in-place 연산을 포함한 프로그램에 대한 중간표현을 생성하는 방법을 컴퓨터에서 실행하기 위한 명령어들을 기록한 컴퓨터 판독 가능한 비일시적 기록 매체.
  11. 정보 처리 시스템으로서,
    메모리; 및
    상기 메모리와 연결되고, 상기 메모리에 포함된 컴퓨터 판독 가능한 적어도 하나의 프로그램을 실행하도록 구성된 적어도 하나의 프로세서
    를 포함하고,
    상기 적어도 하나의 프로그램은,
    상기 프로그램으로부터 입출력을 위한 데이터에 대한 정보 및 연산에 대한 정보를 추출하고,
    상기 추출된 데이터에 대한 정보 및 상기 추출된 연산에 대한 정보로부터 in-place 연산이 존재하는지 여부를 판정하고,
    상기 in-place 연산이 존재하는 경우, 상기 추출된 데이터에 대한 정보, 상기 추출된 연산에 대한 정보 및 상기 in-place 연산과 연관된 생성 규칙을 이용하여 중간표현을 생성하하기 위한 명령어들을 포함하고,
    상기 in-place의 입력 데이터는 in-place 연산 후의 출력 데이터로 대체되는 데이터인,
    정보 처리 시스템.
PCT/KR2022/008505 2021-06-16 2022-06-15 중간표현을 생성하는 방법 및 시스템 WO2022265410A1 (ko)

Priority Applications (3)

Application Number Priority Date Filing Date Title
CN202280043438.0A CN117581237A (zh) 2021-06-16 2022-06-15 生成中间表示的方法和系统
EP22825333.2A EP4357982A1 (en) 2021-06-16 2022-06-15 Method and system for generating intermediate representations
US18/537,683 US20240126790A1 (en) 2021-06-16 2023-12-12 Method and system for creating intermediate representation

Applications Claiming Priority (4)

Application Number Priority Date Filing Date Title
KR10-2021-0077963 2021-06-16
KR20210077963 2021-06-16
KR1020220072637A KR102467622B1 (ko) 2021-06-16 2022-06-15 중간표현을 생성하는 방법 및 시스템
KR10-2022-0072637 2022-06-15

Related Child Applications (1)

Application Number Title Priority Date Filing Date
US18/537,683 Continuation US20240126790A1 (en) 2021-06-16 2023-12-12 Method and system for creating intermediate representation

Publications (1)

Publication Number Publication Date
WO2022265410A1 true WO2022265410A1 (ko) 2022-12-22

Family

ID=84233425

Family Applications (1)

Application Number Title Priority Date Filing Date
PCT/KR2022/008505 WO2022265410A1 (ko) 2021-06-16 2022-06-15 중간표현을 생성하는 방법 및 시스템

Country Status (5)

Country Link
US (1) US20240126790A1 (ko)
EP (1) EP4357982A1 (ko)
KR (2) KR102467622B1 (ko)
CN (1) CN117581237A (ko)
WO (1) WO2022265410A1 (ko)

Citations (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
KR20060004953A (ko) * 2003-05-02 2006-01-16 트랜시티브 리미티드 프로그램 코드 변환을 위한 중간 표현들을 발생하기 위한개선된 아키텍쳐
WO2021052391A1 (zh) * 2019-09-18 2021-03-25 华为技术有限公司 一种构建中间表达的方法、编译器和服务器

Patent Citations (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
KR20060004953A (ko) * 2003-05-02 2006-01-16 트랜시티브 리미티드 프로그램 코드 변환을 위한 중간 표현들을 발생하기 위한개선된 아키텍쳐
WO2021052391A1 (zh) * 2019-09-18 2021-03-25 华为技术有限公司 一种构建中间表达的方法、编译器和服务器

Non-Patent Citations (3)

* Cited by examiner, † Cited by third party
Title
GEIFMAN AMNON: "Graph Compilers for Deep Learning: Definition, Pros & Cons, and Popular Examples", DECI, 28 April 2021 (2021-04-28), XP093016101, Retrieved from the Internet <URL:https://deci.ai/blog/graph-compilers/> [retrieved on 20230120] *
MINGZHEN LI; YI LIU; XIAOYAN LIU; QINGXIAO SUN; XIN YOU; HAILONG YANG; ZHONGZHI LUAN; LIN GAN; GUANGWEN YANG; DEPEI QIAN: "The Deep Learning Compiler: A Comprehensive Survey", ARXIV.ORG, CORNELL UNIVERSITY LIBRARY, 201 OLIN LIBRARY CORNELL UNIVERSITY ITHACA, NY 14853, 6 February 2020 (2020-02-06), 201 Olin Library Cornell University Ithaca, NY 14853 , XP081636983 *
REISSMANN NICO NICO.REISSMANN@NTNU.NO; MEYER JAN CHRISTIAN JAN.CHRISTIAN.MEYER@NTNU.NO; BAHMANN HELGE HCB@CHAOTICMIND.NET; SJ&#228: "RVSDG: An Intermediate Representation for Optimizing Compilers", ACM TRANSACTIONS ON EMBEDDED COMPUTING SYSTEMS., ACM, NEW YORK, NY., US, vol. 19, no. 6, 1 December 2020 (2020-12-01), US , pages 1 - 28, XP058491796, ISSN: 1539-9087, DOI: 10.1145/3391902 *

Also Published As

Publication number Publication date
KR102467622B1 (ko) 2022-11-17
KR20220168583A (ko) 2022-12-23
US20240126790A1 (en) 2024-04-18
CN117581237A (zh) 2024-02-20
EP4357982A1 (en) 2024-04-24

Similar Documents

Publication Publication Date Title
WO2017030252A1 (ko) 컨테이너 이미지 보안 검사 방법 및 그 장치
WO2013191458A1 (en) License verification method and apparatus, and computer readable storage medium storing program therefor
US20130275408A1 (en) Presenting Unique Search Result Contexts
JP7212793B2 (ja) 関数ジャンプを実現するための方法、装置及びコンピュータ記憶媒体
WO2019054613A1 (ko) 바이너리 파일에 기초하여 오픈소스 소프트웨어 패키지를 식별하는 방법 및 시스템
WO2018016671A2 (ko) 보안 취약점 점검을 위한 위험성 코드 검출 시스템 및 그 방법
WO2019066222A1 (ko) 바이너리 파일에 기초하여 오픈소스 소프트웨어 패키지를 식별하는 방법 및 시스템
WO2019135425A1 (ko) 오픈소스 소프트웨어의 라이선스를 검증하는 방법 및 시스템
CN116542207A (zh) 电路版图的生成方法、装置、设备及存储介质
WO2011065660A4 (ko) 계산 시뮬레이션 모사 시스템 및 그 방법
US20220244931A1 (en) Image file obtaining method and apparatus
WO2016117739A1 (ko) 인-메모리 데이터베이스 기반의 데이터 관리 시스템 및 그 방법
WO2022265410A1 (ko) 중간표현을 생성하는 방법 및 시스템
WO2018058779A1 (zh) 文件打开方法及系统
WO2021114902A1 (zh) 程序初始化方法、程序初始化装置、终端设备及存储介质
WO2022265412A1 (ko) 프로그램에 대한 중간 표현을 관리하는 방법 및 시스템
WO2016137035A1 (ko) 테스트 케이스 생성 장치와 방법 및 이를 실행하기 위한 프로그램을 기록한 컴퓨터로 판독가능한 기록매체
WO2022265411A1 (ko) 프로그램의 중간표현에 대한 최적화 적용 가능성을 판단하는 방법 및 시스템
CN114116673A (zh) 基于人工智能的数据迁移方法及相关设备
CN111385661A (zh) 语音控制全屏播放的方法及终端
WO2022265413A1 (ko) 가속기에서 실행되는 프로그램에 대한 중간표현을 생성하는 방법 및 시스템
WO2015183016A1 (ko) 데이터 처리 장치 및 데이터 처리 장치의 메모리에 기록된 데이터의 확인 방법
CN109284278B (zh) 基于数据分析技术的计算逻辑迁移方法及终端设备
WO2020184816A1 (ko) 신약 후보 물질 도출을 위한 데이터 처리 방법
WO2020075901A1 (ko) 논리적 연산 알고리즘을 포함한 수학 연산 시스템, 그 알고리즘을 실현하는 프로그램 및 그 프로그램이 기록된 컴퓨터 판독 가능한 저장매체

Legal Events

Date Code Title Description
121 Ep: the epo has been informed by wipo that ep was designated in this application

Ref document number: 22825333

Country of ref document: EP

Kind code of ref document: A1

ENP Entry into the national phase

Ref document number: 2023577900

Country of ref document: JP

Kind code of ref document: A

WWE Wipo information: entry into national phase

Ref document number: 202280043438.0

Country of ref document: CN

WWE Wipo information: entry into national phase

Ref document number: 2022825333

Country of ref document: EP

NENP Non-entry into the national phase

Ref country code: DE

ENP Entry into the national phase

Ref document number: 2022825333

Country of ref document: EP

Effective date: 20240116