KR20210086490A - Method for optimizing program using reinforcement learning - Google Patents
Method for optimizing program using reinforcement learning Download PDFInfo
- Publication number
- KR20210086490A KR20210086490A KR1020200176308A KR20200176308A KR20210086490A KR 20210086490 A KR20210086490 A KR 20210086490A KR 1020200176308 A KR1020200176308 A KR 1020200176308A KR 20200176308 A KR20200176308 A KR 20200176308A KR 20210086490 A KR20210086490 A KR 20210086490A
- Authority
- KR
- South Korea
- Prior art keywords
- program
- variable parameter
- performance
- source program
- learning model
- Prior art date
Links
Images
Classifications
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06F—ELECTRIC DIGITAL DATA PROCESSING
- G06F8/00—Arrangements for software engineering
- G06F8/40—Transformation of program code
- G06F8/41—Compilation
- G06F8/44—Encoding
- G06F8/443—Optimisation
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06N—COMPUTING ARRANGEMENTS BASED ON SPECIFIC COMPUTATIONAL MODELS
- G06N3/00—Computing arrangements based on biological models
- G06N3/02—Neural networks
- G06N3/08—Learning methods
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06N—COMPUTING ARRANGEMENTS BASED ON SPECIFIC COMPUTATIONAL MODELS
- G06N5/00—Computing arrangements using knowledge-based models
- G06N5/04—Inference or reasoning models
Landscapes
- Engineering & Computer Science (AREA)
- Theoretical Computer Science (AREA)
- General Engineering & Computer Science (AREA)
- Physics & Mathematics (AREA)
- Software Systems (AREA)
- General Physics & Mathematics (AREA)
- Data Mining & Analysis (AREA)
- Mathematical Physics (AREA)
- Computing Systems (AREA)
- Artificial Intelligence (AREA)
- Evolutionary Computation (AREA)
- Computational Linguistics (AREA)
- Biophysics (AREA)
- Biomedical Technology (AREA)
- General Health & Medical Sciences (AREA)
- Molecular Biology (AREA)
- Life Sciences & Earth Sciences (AREA)
- Health & Medical Sciences (AREA)
- Debugging And Monitoring (AREA)
- Stored Programmes (AREA)
Abstract
Description
본 발명은 강화 학습 기반의 프로그램 최적화 방법에 관한 것이다. 구체적으로, 프로그램의 성능을 지속적으로 향상시키는 강화 학습 기반의 프로그램 자동 최적화 방법 및 컴퓨터 프로그램에 관한 것이다.The present invention relates to a program optimization method based on reinforcement learning. Specifically, it relates to a method for automatically optimizing a program based on reinforcement learning and a computer program for continuously improving program performance.
한정된 자원, 에너지, 리소스 등으로 다양한 프로그램 실행 또는 작업을 수행하기 위해, 컴퓨터 프로그램을 최적화하는 것은 중요할 수 있다. 여기서, 프로그램 최적화란 주어진 프로그램이 주어진 입력에 대해 더 높은 성능으로 동일한 결과를 출력하도록 프로그램을 변경하는 일련의 과정을 의미할 수 있다.It can be important to optimize a computer program to perform various program executions or tasks with limited resources, energy, resources, and the like. Here, program optimization may refer to a series of processes of changing a program so that a given program outputs the same result with higher performance for a given input.
일반적으로, 프로그램 최적화는 하드웨어 시스템과 프로그램의 구조를 동시에 이해하고 있는 숙련된 프로그래머가 여러 차례에 걸쳐 프로그램을 수정, 컴파일 및 실행함으로써 수행될 수 있다. 그러나, 이와 같은 일련의 과정은 숙련된 프로그래머의 투입을 위한 비용이 요구되며, 시간이 오래 소요될 수 있다.In general, program optimization can be performed by modifying, compiling, and executing the program several times by an experienced programmer who simultaneously understands the hardware system and the structure of the program. However, such a series of processes requires a cost for input of an experienced programmer and may take a long time.
본 개시는 상기와 같은 문제점을 해결하기 위한 강화 학습을 기초하여 프로그램을 자동으로 최적화하는 방법 및 컴퓨터 프로그램을 제공한다.The present disclosure provides a method and a computer program for automatically optimizing a program based on reinforcement learning to solve the above problems.
본 개시는 방법, 시스템, 장치 또는 명령어들을 저장하는 컴퓨터 판독가능 저장 매체, 컴퓨터 프로그램을 포함한 다양한 방식으로 구현될 수 있다.The present disclosure may be embodied in various ways, including a method, a system, an apparatus, or a computer-readable storage medium storing instructions, a computer program.
본 개시의 일 실시예에 따르면, 강화 학습에 기초하여 프로그램을 자동으로 최적화하는 방법은, (a) 고정 파라미터와 가변 파라미터를 포함하는 소스 프로그램을 위한 입력을 수신하는 단계, (b) 수신된 입력을 기초로 소스 프로그램을 생성하는 단계, (c) 소스 프로그램을 목적 프로그램으로 변환하는 단계, (d) 변환된 목적 프로그램을 실행함으로써, 실행된 목적 프로그램의 성능을 측정하는 단계 및 (e) 가변 파라미터 및 측정된 성능을 기계학습 모델에 입력하여, 가변 파라미터 변화량을 출력하는 단계 및 (f) 가변 파라미터 변화량을 반영한 소스 프로그램을 재생성하는 단계를 포함한다.According to an embodiment of the present disclosure, a method for automatically optimizing a program based on reinforcement learning comprises the steps of: (a) receiving an input for a source program comprising fixed parameters and variable parameters; (b) the received input generating a source program based on (c) converting the source program into an object program, (d) measuring the performance of the executed object program by executing the converted object program, and (e) variable parameters and inputting the measured performance into the machine learning model, outputting a variable parameter change amount, and (f) regenerating a source program reflecting the variable parameter change amount.
본 개시의 일 실시예에 따르면, (f) 단계는, 가변 파라미터 변화량을 가변 파라미터에 적용하는 단계 및 가변 파라미터 변화량이 적용된 가변 파라미터 및 고정 파라미터를 이용하여 재생성된 소스 프로그램을 출력하는 단계를 포함한다.According to an embodiment of the present disclosure, step (f) includes applying a variable parameter change amount to a variable parameter, and outputting a regenerated source program using the variable parameter and the fixed parameter to which the variable parameter change amount is applied. .
본 개시의 일 실시예에 따르면, (f) 단계 이후에, (g) 재생성된 소스 프로그램을 소스 프로그램으로 설정하여, (c) 내지 (f) 단계를 다시 수행하는 단계를 더 포함한다.According to an embodiment of the present disclosure, after step (f), (g) setting the regenerated source program as the source program, further comprising the step of performing steps (c) to (f) again.
본 개시의 일 실시예에 따르면, 미리 결정된 배치 크기에 도달될 때까지, (g) 단계를 반복적으로 수행함으로써, 기계학습 모델을 학습시키는 단계를 더 포함한다.According to an embodiment of the present disclosure, the method further includes training the machine learning model by repeatedly performing step (g) until a predetermined batch size is reached.
본 개시의 일 실시예에 따르면, (c) 내지 (f) 단계를 실행하되, 목표 성능에 도달할 때까지, (c) 내지 (f) 단계 중 적어도 일부를 반복적으로 실행하는 단계 및 목표 성능에 도달한 경우, 최고 성능에 대응하는 소스 프로그램을 최적화된 소스 프로그램으로 결정하는 단계를 더 포함한다.According to an embodiment of the present disclosure, executing steps (c) to (f), repeatedly executing at least some of steps (c) to (f) until the target performance is reached, and the target performance If reached, the method further includes determining a source program corresponding to the highest performance as an optimized source program.
본 개시의 일 실시예에 따르면, (e) 단계는, 가변 파라미터, 측정된 성능 및 소스 프로그램을 기계학습 모델에 입력하여 가변 파라미터 변화량을 출력하는 단계를 포함한다.According to an embodiment of the present disclosure, step (e) includes inputting the variable parameter, the measured performance, and the source program into the machine learning model to output the variable parameter change amount.
본 개시의 일 실시예에 따르면, 기계학습 모델은 딥러닝 모델을 포함한다. 가변 파라미터, 측정된 성능 및 소스 프로그램을 기계학습 모델에 입력하여 가변 파라미터 변화량을 출력하는 단계는, 가변 파라미터, 측정된 성능 및 소스 프로그램을 나타내는 입력 벡터를 생성하는 단계 및 생성된 입력 벡터를 딥러닝 모델에 입력하여 딥러닝 모델을 통해 가변 파라미터 변화량을 나타내는 출력 벡터를 생성하는 단계를 포함한다.According to an embodiment of the present disclosure, the machine learning model includes a deep learning model. The step of inputting the variable parameter, the measured performance and the source program into the machine learning model and outputting the variable parameter variation includes: generating an input vector representing the variable parameter, the measured performance, and the source program; and deep learning the generated input vector. and generating an output vector representing the variable parameter variation through the deep learning model by input to the model.
본 개시의 일 실시예에 따르면, (d) 단계는, 목적 프로그램의 실행 시 목적 프로그램을 통해 결과 값을 출력하는데 걸리는 시간을 측정하는 단계 및 측정된 시간을 성능의 지표로 결정하는 단계를 포함한다.According to an embodiment of the present disclosure, step (d) includes measuring a time taken to output a result value through the target program when the target program is executed, and determining the measured time as an index of performance. .
본 개시의 일 실시예에 따르면, 목적 프로그램의 실행 시 목적 프로그램을 통해 결과 값을 출력하는데 걸리는 시간을 측정하는 단계는, 목적 프로그램에 대한 테스트 세트를 입력하는 단계 및 테스트 세트에 대응하는 결과 값이 목적 프로그램을 통해 출력되는 데 걸리는 시간을 성능의 지표로서 결정하는 단계를 포함한다.According to an embodiment of the present disclosure, the step of measuring the time it takes to output a result value through the target program when the target program is executed includes: inputting a test set for the target program and a result value corresponding to the test set and determining the time taken to be output through the target program as an indicator of performance.
본 개시의 일 실시예에 따른 상술된 강화 학습에 기초하여 프로그램을 자동으로 최적화하는 방법을 컴퓨터에서 실행하기 위해 컴퓨터 판독 가능한 기록 매체에 저장된 컴퓨터 프로그램이 제공된다.A computer program stored in a computer-readable recording medium is provided for executing a method for automatically optimizing a program based on the above-described reinforcement learning according to an embodiment of the present disclosure on a computer.
본 개시의 일부 실시예에 따르면, 프로그램의 프로그래머가 프로그램의 성능 최적화를 위해 직접 가변 파라미터를 매번 변경하거나 수정하지 않고도, 프로세서는 자동적으로 가변 파라미터를 변경하여, 주어진 소스 프로그램으로부터 최적화된 소스 프로그램을 생성할 수 있다.According to some embodiments of the present disclosure, the processor automatically changes the variable parameters to generate an optimized source program from a given source program, without the programmer of the program changing or modifying the variable parameters directly each time for optimizing the performance of the program. can do.
본 개시의 일부 실시예에 따르면, 프로세서가 숙련된 프로그래머의 역할을 대신할 수 있으므로, 프로그래머가 직접 최적화하는 것보다 더 빠른 시간 내에 프로그램 최적화를 완료하거나, 주어진 시간에 더 많은 수의 탐색 범위를 효율적으로 탐색할 수 있다.According to some embodiments of the present disclosure, since the processor can replace the role of an experienced programmer, the program optimization can be completed in a shorter time than the programmer directly optimizing, or a larger number of search ranges can be efficiently searched at a given time. can be explored with
본 개시의 일부 실시예에 따르면, 프로그램 최적화를 수행하는 경우, 프로그램 최적화를 위해 필요한 인적 자원의 투입량이 최소화되어 이윤이 창출될 수 있으며, 향상된 성능의 프로그램을 사용하여 서비스의 품질이 향상될 수 있다.According to some embodiments of the present disclosure, when program optimization is performed, an amount of human resource input required for program optimization can be minimized to generate profits, and service quality can be improved by using a program with improved performance.
본 개시의 일부 실시예에 따르면, 프로그램의 개발자가 직접 가변 파라미터를 변화시켜가며 프로그램을 최적화하지 않고도, 프로세서가 목표 성능에 도달할 때까지 성능 측정을 반복하여, 자동적으로 최적화된 프로그램을 생성할 수 있다.According to some embodiments of the present disclosure, without the developer of the program directly optimizing the program by changing variable parameters, it is possible to automatically generate the optimized program by repeating the performance measurement until the processor reaches the target performance. have.
본 개시의 실시예들은, 이하 설명하는 첨부 도면들을 참조하여 설명될 것이며, 여기서 유사한 참조 번호는 유사한 요소들을 나타내지만, 이에 한정되지는 않는다.
도 1은 본 개시의 일 실시예에 따른 프로세서가 최적화된 소스 프로그램을 생성하는 예시를 나타내는 도면이다.
도 2는 본 개시의 일 실시예에 따른 프로세서의 내부 구성을 나타내는 블록도이다.
도 3은 본 개시의 일 실시예에 따른 강화 학습에 기초하여 프로그램을 자동으로 최적화하는 방법의 예시를 나타내는 흐름도이다.
도 4는 본 개시의 일 실시예에 따라 최적화된 프로그램을 결정하기 위한 과정이 반복적으로 수행되는 예시를 나타내는 블록도이다.
도 5는 본 개시의 일 실시예에 따라 강화 학습 기반의 가변 파라미터 변화량을 출력하는 기계학습 모델의 예시를 나타내는 도면이다.
도 6은 본 개시의 다른 실시예에 따라 강화 학습 기반의 가변 파라미터 변화량을 출력하는 기계학습 모델의 예시를 나타내는 도면이다.
도 7은 본 개시의 일 실시예에 따른 강화 학습 기반의 기계학습 모델을 학습시키는 방법의 예시를 나타내는 흐름도이다.
도 8은 본 개시의 일 실시예에 따른 기계학습 모델을 통한 추론 방법의 예시를 나타내는 흐름도이다.
도 9는 본 개시의 일 실시예에 따라 기계학습 모델에 대한 강화 학습을 수행하는 예시를 나타내는 도면이다.DETAILED DESCRIPTION OF THE PREFERRED EMBODIMENTS Embodiments of the present disclosure will be described with reference to the accompanying drawings described below, wherein like reference numerals denote like elements, but are not limited thereto.
1 is a diagram illustrating an example in which a processor generates an optimized source program according to an embodiment of the present disclosure.
2 is a block diagram illustrating an internal configuration of a processor according to an embodiment of the present disclosure.
3 is a flowchart illustrating an example of a method for automatically optimizing a program based on reinforcement learning according to an embodiment of the present disclosure.
4 is a block diagram illustrating an example in which a process for determining an optimized program is repeatedly performed according to an embodiment of the present disclosure.
5 is a diagram illustrating an example of a machine learning model that outputs a variable parameter variation based on reinforcement learning according to an embodiment of the present disclosure.
6 is a diagram illustrating an example of a machine learning model that outputs a variable parameter variation based on reinforcement learning according to another embodiment of the present disclosure.
7 is a flowchart illustrating an example of a method for training a reinforcement learning-based machine learning model according to an embodiment of the present disclosure.
8 is a flowchart illustrating an example of an inference method through a machine learning model according to an embodiment of the present disclosure.
9 is a diagram illustrating an example of performing reinforcement learning on a machine learning model according to an embodiment of the present disclosure.
이하, 본 개시의 실시를 위한 구체적인 내용을 첨부된 도면을 참조하여 상세히 설명한다. 다만, 이하의 설명에서는 본 개시의 요지를 불필요하게 흐릴 우려가 있는 경우, 널리 알려진 기능이나 구성에 관한 구체적 설명은 생략하기로 한다.Hereinafter, specific contents for carrying out the present disclosure will be described in detail with reference to the accompanying drawings. However, in the following description, if there is a risk of unnecessarily obscuring the subject matter of the present disclosure, detailed descriptions of well-known functions or configurations will be omitted.
첨부된 도면에서, 동일하거나 대응하는 구성요소에는 동일한 참조부호가 부여되어 있다. 또한, 이하의 실시예들의 설명에 있어서, 동일하거나 대응되는 구성요소를 중복하여 기술하는 것이 생략될 수 있다. 그러나, 구성요소에 관한 기술이 생략되어도, 그러한 구성요소가 어떤 실시예에 포함되지 않는 것으로 의도되지는 않는다.In the accompanying drawings, identical or corresponding components are assigned the same reference numerals. In addition, in the description of the embodiments below, overlapping description of the same or corresponding components may be omitted. However, even if description regarding components is omitted, it is not intended that such components are not included in any embodiment.
개시된 실시예의 이점 및 특징, 그리고 그것들을 달성하는 방법은 첨부되는 도면과 함께 후술되어 있는 실시예들을 참조하면 명확해질 것이다. 그러나, 본 개시는 이하에서 개시되는 실시예들에 한정되는 것이 아니라 서로 다른 다양한 형태로 구현될 수 있으며, 단지 본 실시예들은 본 개시가 완전하도록 하고, 본 개시가 통상의 기술자에게 발명의 범주를 완전하게 알려주기 위해 제공되는 것일 뿐이다.Advantages and features of the disclosed embodiments, and methods of achieving them, will become apparent with reference to the embodiments described below in conjunction with the accompanying drawings. However, the present disclosure is not limited to the embodiments disclosed below, but may be implemented in various different forms, and only the present embodiments allow the present disclosure to be complete, and the present disclosure provides those skilled in the art with the scope of the invention. It is provided for complete information only.
본 명세서에서 사용되는 용어에 대해 간략히 설명하고, 개시된 실시예에 대해 구체적으로 설명하기로 한다. 본 명세서에서 사용되는 용어는 본 개시에서의 기능을 고려하면서 가능한 현재 널리 사용되는 일반적인 용어들을 선택하였으나, 이는 관련 분야에 종사하는 기술자의 의도 또는 판례, 새로운 기술의 출현 등에 따라 달라질 수 있다. 또한, 특정한 경우는 출원인이 임의로 선정한 용어도 있으며, 이 경우 해당되는 발명의 설명 부분에서 상세히 그 의미를 기재할 것이다. 따라서, 본 개시에서 사용되는 용어는 단순한 용어의 명칭이 아닌, 그 용어가 가지는 의미와 본 개시의 전반에 걸친 내용을 토대로 정의되어야 한다.Terms used in this specification will be briefly described, and the disclosed embodiments will be described in detail. The terms used in this specification are selected as currently widely used general terms as possible while considering the functions in the present disclosure, but may vary depending on the intention or precedent of a person skilled in the art, the emergence of new technology, and the like. In addition, in a specific case, there is a term arbitrarily selected by the applicant, and in this case, the meaning will be described in detail in the description of the corresponding invention. Therefore, the terms used in the present disclosure should be defined based on the meaning of the term and the contents of the present disclosure, rather than the simple name of the term.
본 명세서에서의 단수의 표현은 문맥상 명백하게 단수인 것으로 특정하지 않는 한, 복수의 표현을 포함한다. 또한, 복수의 표현은 문맥상 명백하게 복수인 것으로 특정하지 않는 한, 단수의 표현을 포함한다. 명세서 전체에서 어떤 부분이 어떤 구성요소를 포함한다고 할 때, 이는 특별히 반대되는 기재가 없는 한 다른 구성요소를 제외하는 것이 아니라 다른 구성요소를 더 포함할 수 있음을 의미한다.References in the singular herein include plural expressions unless the context clearly dictates that the singular is singular. Also, the plural expression includes the singular expression unless the context clearly dictates the plural. When a part includes a certain component throughout the specification, this means that other components may be further included, rather than excluding other components, unless otherwise stated.
또한, 명세서에서 사용되는 '모듈' 또는 '부'라는 용어는 소프트웨어 또는 하드웨어 구성요소를 의미하며, '모듈' 또는 '부'는 어떤 역할들을 수행한다. 그렇지만, '모듈' 또는 '부'는 소프트웨어 또는 하드웨어에 한정되는 의미는 아니다. '모듈' 또는 '부'는 어드레싱할 수 있는 저장 매체에 있도록 구성될 수도 있고 하나 또는 그 이상의 프로세서들을 재생시키도록 구성될 수도 있다. 따라서, 일 예로서, '모듈' 또는 '부'는 소프트웨어 구성요소들, 객체지향 소프트웨어 구성요소들, 클래스 구성요소들 및 태스크 구성요소들과 같은 구성요소들과, 프로세스들, 함수들, 속성들, 프로시저들, 서브루틴들, 프로그램 코드의 세그먼트들, 드라이버들, 펌웨어, 마이크로 코드, 회로, 데이터, 데이터베이스, 데이터 구조들, 테이블들, 어레이들 또는 변수들 중 적어도 하나를 포함할 수 있다. 구성요소들과 '모듈' 또는 '부'들은 안에서 제공되는 기능은 더 작은 수의 구성요소들 및 '모듈' 또는 '부'들로 결합되거나 추가적인 구성요소들과 '모듈' 또는 '부'들로 더 분리될 수 있다.In addition, the term 'module' or 'unit' used in the specification means a software or hardware component, and 'module' or 'unit' performs certain roles. However, 'module' or 'unit' is not meant to be limited to software or hardware. A 'module' or 'unit' may be configured to reside on an addressable storage medium or may be configured to refresh one or more processors. Thus, as an example, a 'module' or 'part' refers to components such as software components, object-oriented software components, class components, and task components, and processes, functions, and properties. , procedures, subroutines, segments of program code, drivers, firmware, microcode, circuitry, data, database, data structures, tables, arrays or at least one of variables. Components and 'modules' or 'units' are the functions provided therein that are combined into a smaller number of components and 'modules' or 'units' or additional components and 'modules' or 'units' can be further separated.
본 개시의 일 실시예에 따르면, '모듈' 또는 '부'는 프로세서 및 메모리로 구현될 수 있다. '프로세서'는 범용 프로세서, 중앙 처리 장치(CPU), 마이크로프로세서, 디지털 신호 프로세서(DSP), 제어기, 마이크로제어기, 상태 머신 등을 포함하도록 넓게 해석되어야 한다. 몇몇 환경에서, '프로세서'는 주문형 반도체(ASIC), 프로그램가능 로직 디바이스(PLD), 필드 프로그램가능 게이트 어레이(FPGA) 등을 지칭할 수도 있다. '프로세서'는, 예를 들어, DSP와 마이크로프로세서의 조합, 복수의 마이크로프로세서들의 조합, DSP 코어와 결합한 하나 이상의 마이크로프로세서들의 조합, 또는 임의의 다른 그러한 구성들의 조합과 같은 처리 디바이스들의 조합을 지칭할 수도 있다. 또한, '메모리'는 전자 정보를 저장 가능한 임의의 전자 컴포넌트를 포함하도록 넓게 해석되어야 한다. '메모리'는 임의 액세스 메모리(RAM), 판독-전용 메모리(ROM), 비-휘발성 임의 액세스 메모리(NVRAM), 프로그램가능 판독-전용 메모리(PROM), 소거-프로그램가능 판독 전용 메모리(EPROM), 전기적으로 소거가능 PROM(EEPROM), 플래쉬 메모리, 자기 또는 광학 데이터 저장장치, 레지스터들 등과 같은 프로세서-판독가능 매체의 다양한 유형들을 지칭할 수도 있다. 프로세서가 메모리로부터 정보를 판독하고/하거나 메모리에 정보를 기록할 수 있다면 메모리는 프로세서와 전자 통신 상태에 있다고 불린다. 프로세서에 집적된 메모리는 프로세서와 전자 통신 상태에 있다.According to an embodiment of the present disclosure, a 'module' or a 'unit' may be implemented with a processor and a memory. 'Processor' should be construed broadly to include general purpose processors, central processing units (CPUs), microprocessors, digital signal processors (DSPs), controllers, microcontrollers, state machines, and the like. In some contexts, a 'processor' may refer to an application specific semiconductor (ASIC), a programmable logic device (PLD), a field programmable gate array (FPGA), or the like. '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 combination with a DSP core, or any other such configurations. You may. Also, 'memory' should be construed broadly to include any electronic component capable of storing electronic information. 'Memory' means random access memory (RAM), read-only memory (ROM), non-volatile random access memory (NVRAM), programmable read-only memory (PROM), erase-programmable read-only memory (EPROM); may 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. A memory is said to be in electronic communication with the processor if the processor is capable of reading information from and/or writing information to the memory. A memory integrated in the processor is in electronic communication with the processor.
본 개시에서, '프로그램을 자동으로 최적화하는' 것 또는 '프로그램의 최적화'는 주어진 프로그램의 주어진 입력에 대해 더 높은 성능으로 동일한 결과를 출력하도록 프로그램을 변경하는 일련의 과정을 지칭할 수 있다.In the present disclosure, 'automatically optimizing a program' or 'optimizing a program' may refer to a series of processes of changing a program to output the same result with higher performance for a given input of a given program.
본 개시에서, '성능'은 프로그램의 종류 및 실행 환경에 따라 다양하게 정의될 수 있는데, 예를 들어, 실행 시간, 에너지 소모, 리소스 사용량 등이 프로그램의 성능을 판정하는 지표로서 사용될 수 있다. 예를 들어, 성능은 주어진 프로그램의 테스트 입력에 응답하여 해당 프로그램을 통해 테스트 입력에 대응하는 결과 값을 출력하는데 걸리는 시간을 기초로 판정될 수 있다.In the present disclosure, 'performance' may be variously defined according to the type of program and the execution environment. For example, execution time, energy consumption, resource usage, etc. may be used as an index for determining the performance of the program. For example, performance may be determined based on the time it takes to respond to a test input of a given program and output a result value corresponding to the test input through the program.
본 개시에서, '프로그램'은, CPU에서 실행되는 일반적인 프로그램(예: C 프로그램, 자바 프로그램, 파이썬 프로그램 등), GPU에서 실행되는 프로그램(예: Open CL, CUDA 등) 및/또는 CPU 및 GPU 이외의 하드웨어에서 실행되는 소프트웨어 일체를 지칭할 수 있다.In this disclosure, a 'program' means a general program (eg, C program, Java program, Python program, etc.) executed on a CPU, a program (eg, Open CL, CUDA, etc.) executed on a GPU and/or other than CPU and GPU It may refer to all software executed on the hardware of
본 개시에서, '고정 파라미터'와 '가변 파라미터'는 프로그램 하나를 구성하기 위해 필요한 일부 또는 모든 정보를 포함할 수 있으며, 프로그램을 생성 또는 구현하는 방법에 따라 다양한 형태로 구체화될 수 있다. 일 실시예에 따르면, 고정 파라미터는 주어진 프로그램을 구성하는데 요구되고 미리 정의된 기초(뼈대) 코드를 지칭할 수 있으며, 가변 파라미터는 상이하게 구현될 수 있는 소스 프로그램의 부분을 수치화한 값을 나타낼 수 있다. 예를 들어, C 매크로 변수를 다수 사용하는 뼈대 코드가 고정 파라미터로 정의되고, C 매크로 변수 선언의 집합이 가변 파라미터로 정의될 수 있다. 다른 예로서, 가변 파라미터는 프로그램 내의 연산(operation)의 각각에 대해 정의될 수 있는데, 딥러닝 프로그램의 경우, 가변 파라미터는 커널을 정의할 때 어떻게 구현할지에 따라 결정되는 파라미터를 지칭할 수 있다. 또 다른 예로서, 가변 파라미터는 GPU의 하나의 스레드 당 몇 개의 입력값(예를 들어, 픽셀)을 계산할지, 루프 한 번에 몇 개의 입력값을 계산할지 등을 나타내는 수치를 지칭할 수 있다.In the present disclosure, 'fixed parameters' and 'variable parameters' may include some or all information necessary to configure one program, and may be embodied in various forms depending on a method of generating or implementing a program. According to an embodiment, the fixed parameter may refer to a predefined basic (skeletal) code required to construct a given program, and the variable parameter may represent a numerical value of a part of a source program that can be implemented differently. have. For example, a skeleton code using a large number of C macro variables may be defined as a fixed parameter, and a set of C macro variable declarations may be defined as a variable parameter. As another example, a variable parameter may be defined for each operation in a program. In the case of a deep learning program, the variable parameter may refer to a parameter determined according to how to implement when defining a kernel. As another example, the variable parameter may refer to a number indicating how many input values (eg, pixels) are calculated per one thread of the GPU, how many input values are calculated at one time in a loop, and the like.
도 1은 본 개시의 일 실시예에 따른 프로세서(100)가 최적화된 소스 프로그램(120)을 생성하는 예시를 나타내는 도면이다. 도시된 바와 같이, 프로세서(100)는 소스 프로그램(110)을 이용하여 최적화된 소스 프로그램(120)을 생성할 수 있다. 여기서, 소스 프로그램(110)은 멀티코어 CPU, GPU, FPGA 등에서 동작 가능한 프로그램(예를 들어, GPU 프로그램)의 소스 코드(source code)를 지칭할 수 있다. 또한, 최적화된 소스 프로그램(120)은 성능이 타 소스 프로그램보다 우수한 소스 프로그램(예를 들어, 가장 우수한 성능을 가진 프로그램)을 지칭할 수 있다.1 is a diagram illustrating an example in which a
일 실시예에 따르면, 프로세서(100)는 고정 파라미터와 가변 파라미터를 포함하는 소스 프로그램을 위한 입력을 수신할 수 있다. 예를 들어, 고정 파라미터는 파라미터의 수, 종류 등이 고정되어 미리 정해진 파라미터를 나타낼 수 있고, 가변 파라미터는 파라미터의 수, 종류 등이 가변적으로 변경될 수 있는 파라미터를 나타낼 수 있다. 소스 프로그램(110)에 대한 입력이 수신된 경우, 프로세서(100)는 수신된 입력을 기초로 소스 프로그램(110)을 생성할 수 있다.According to an embodiment, the
그리고 나서, 프로세서(100)는 소스 프로그램(110)을 목적 프로그램으로 변환할 수 있다. 예를 들어, 프로세서(100)는 컴파일러(compiler), 인터프리터(interpreter), 어셈블러(assembler), 프리프로세서(preprocessor) 등의 번역기를 이용하여, 소스 프로그램(110)을 목적 프로그램으로 변환할 수 있다. 여기서, 목적 프로그램은 컴퓨터에서 즉시 실행될 수 있는 형태의 언어로, 소스 프로그램(110)을 변역하여 생성된 프로그램(예를 들어, 바이너리 코드 등)을 지칭할 수 있다.Then, the
프로세서(100)는 변환된 목적 프로그램을 실행함으로써, 실행된 목적 프로그램의 성능을 측정할 수 있다. 예를 들어, 목적 프로그램의 성능은 동일한 결과를 출력하기까지 소요되는 실행 시간, 에너지 소모량, 리소스 사용량 등을 기초로 측정될 수 있으나, 이에 한정되지 않으며, 프로그램의 성능을 측정할 수 있는 임의의 성능 지표가 사용될 수 있다.The
일 실시예에 따르면, 프로세서(100)는 가변 파라미터 및 측정된 성능을 기계학습 모델에 입력하여, 가변 파라미터 변화량을 출력할 수 있다. 여기서, 기계학습 모델은 강화 학습 등으로 학습되거나 학습 중인 강화 학습의 에이전트(agent)를 지칭할 수 있으며, 예를 들어, 딥 뉴럴 네트워크(Deep neural network)와 같은 딥러닝 모델 등을 포함할 수 있다. 즉, 프로세서(100)는 목적 프로그램의 성능을 향상시킬 수 있는 가변 파라미터 변화량을 출력하도록 학습된 기계학습 모델로부터 주어진 프로그램에 대한 가변 파라미터 변화량을 출력할 수 있다.According to an embodiment, the
가변 파라미터 변화량이 출력된 경우, 프로세서(100)는 가변 파라미터 변화량을 반영한 소스 프로그램을 재생성할 수 있다. 즉, 프로세서(100)는 수신된 가변 파라미터에 가변 파라미터 변화량을 반영하여, 가변 파라미터의 수, 종류 등을 변경할 수 있다. 그리고 나서, 프로세서(100)는 변경된 가변 파라미터 및 고정 파라미터를 이용하여 새로운 소스 프로그램을 생성할 수 있다. 또한, 프로세서(100)는 새로운 소스 프로그램을 목적 프로그램으로 변환하고, 목적 프로그램의 성능을 측정하고, 변경된 가변 파라미터 및 측정된 성능을 기초로 가변 파라미터 변화량을 출력하는 과정을 반복적으로 수행할 수 있다.When the variable parameter change amount is output, the
상술된 것과 같이, 프로세서(100)는 프로그램의 성능을 측정하고, 가변 파라미터 변화량을 출력하고, 출력된 가변 파라미터 변화량에 따라 가변 파라미터를 변경하는 과정을 반복적으로 수행함으로써, 다른 소스 프로그램들보다 성능이 우수한 최적화된 소스 프로그램(120)을 생성 및/또는 결정할 수 있다. 이와 같은 구성에 의해, 프로그램의 프로그래머가 프로그램의 성능 최적화를 위해 직접 가변 파라미터를 매번 변경하거나 수정하지 않고도, 프로세서(100)는 자동적으로 가변 파라미터를 변경하여, 주어진 소스 프로그램(110)으로부터 최적화된 소스 프로그램(120)을 생성할 수 있다.As described above, the
도 2는 본 개시의 일 실시예에 따른 프로세서(100)의 내부 구성을 나타내는 블록도이다. 도시된 바와 같이, 프로세서(100)는 프로그램 생성부(210), 번역기(220), 프로그램 실행부(230), 성능 측정기(240), 기계학습 처리부(250) 등을 포함할 수 있다. 또한, 프로세서(100)는 데이터베이스(260)와 통신하며 프로그램 성능 최적화에 필요한 정보 및/또는 데이터를 주고받을 수 있다.2 is a block diagram illustrating an internal configuration of the
상술된 바와 같이, 프로세서(100)는 고정 파라미터와 가변 파라미터를 포함하는 소스 프로그램을 위한 입력을 수신할 수 있다. 예를 들어, 고정 파라미터와 가변 파라미터는 하나의 프로그램을 생성하기 위해 필요한 모든 정보를 포함할 수 있다. 일 실시예에 따르면, 프로세서(100)는 프로그램의 개발자 또는 사용자로부터 고정 파라미터와 가변 파라미터를 입력받거나, 데이터베이스(260)로부터 특정 프로그램에 대응되는 고정 파라미터와 가변 파라미터를 추출할 수도 있다.As described above, the
일 실시예에 따르면, 프로그램 생성부(210)는 수신되거나 추출된 고정 파라미터와 가변 파라미터를 이용하여 소스 프로그램을 생성할 수 있다. 여기서, 고정 파라미터와 가변 파라미터는, 프로그램 생성부(210)가 소스 프로그램을 생성하기 위한 형태로 표현되거나 구현된 수치 및/또는 코드일 수 있다. 즉, 고정 파라미터와 가변 파라미터는 프로그램 생성부(210)의 구현 방법에 따라 다양한 형태로 구체화될 수 있다.According to an embodiment, the
프로그램 생성부(210)에 의해 생성된 소스 프로그램은 번역기(220)로 전송될 수 있다. 상술된 바와 같이, 번역기(220)는 컴파일러, 인터프리터, 어셈블러, 프리프로세서 등을 포함할 수 있으나, 이에 한정되지 않는다. 이와 같은 번역기(220)는 소스 프로그램을 컴퓨터에서 실행 가능한 목적 프로그램으로 변환할 수 있다.The source program generated by the
번역기(220)에 의해 변환되거나 생성된 목적 프로그램은 프로그램 실행부(230)에 제공될 수 있다. 프로그램 실행부(230)는 목적 프로그램 및 해당 목적 프로그램을 실행시키기 위한 테스트 세트(test set)를 수신할 수 있다. 예를 들어, 테스트 세트(test set)는 테스트 입력 및 테스트 입력에 대응되는 테스트 출력(결과 데이터)을 포함할 수 있다. 즉, 프로그램 실행부(230)는 목적 프로그램에 테스트 입력을 입력하여 결과 값을 출력하도록 구성될 수 있다. 또한, 프로그램 실행부(230)는 출력된 결과 값과 테스트 출력을 비교하여 출력된 결과 값이 정답(즉, 테스트 출력)에 해당하는지 여부를 판정할 수 있다.The target program converted or generated by the
목적 프로그램의 실행 결과에 따라, 성능 측정기(240)는 목적 프로그램의 성능을 측정할 수 있다. 예를 들어, 성능 측정기(240)는 목적 프로그램의 결과가 정답에 해당하는 경우에, 목적 프로그램의 성능을 측정할 수 있다. 다른 예에서, 성능 측정기(240)는 목적 프로그램의 결과가 출력된 경우에, 목적 프로그램의 성능을 측정할 수 있다. 여기서, 성능은 목적 프로그램의 실행 시간, 에너지 소모량, 리소스 사용량 등을 기초로 측정될 수 있으나, 이에 한정되지 않는다.According to the execution result of the target program, the
이렇게 측정된 목적 프로그램의 성능은 기계학습 처리부(250)에 제공될 수 있다. 기계학습 처리부(250)는 기계학습 모델을 이용하여 가변 파라미터 변화량을 출력할 수 있다. 일 실시예에 따르면, 기계학습 처리부(250)는 데이터베이스(260)로부터 해당 목적 프로그램에 대응되는 기계학습 모델을 추출하고, 추출된 기계학습 모델에 가변 파라미터 및 측정된 성능을 입력하여, 가변 파라미터 변화량을 출력할 수 있다. 즉, 기계학습 처리부(250)는 목적 프로그램의 성능이 향상될 수 있도록 가변 파라미터 변화량을 출력할 수 있다. 그리고 나서, 프로세서(100)는 출력된 가변 파라미터 변화량을 반영한 소스 프로그램을 재생성할 수 있다.The performance of the target program measured in this way may be provided to the machine
프로세서(100)는 소스 프로그램을 생성하고, 소스 프로그램을 목적 프로그램으로 변환하고, 목적 프로그램의 성능을 측정하고, 가변 파라미터 변화량을 출력하고, 소스 프로그램을 재생성하는 과정을 반복적으로 수행하여, 해당 프로그램의 성능을 점진적으로 향상시킬 수 있다. 이를 강화 학습 기반의 프로그램 최적화 과정이라고 볼 수 있다. 그리고 나서, 프로그램의 성능이 목표 성능에 도달된 경우, 목표 성능에 도달하기까지 생성된 복수의 프로그램 중 최고 성능에 대응하는 소스 프로그램이, 최적화된 소스 프로그램으로 결정될 수 있다.The
일 실시예에 따르면, 데이터베이스(260)는 프로세서(100)와 하나의 장치에 포함되어 직접 연결될 수 있다. 다른 실시예에 따르면, 데이터베이스(260)는 프로세서(100)에 의해 통신 가능하도록 배치될 수 있다(예를 들어, 클라우드 시스템).According to an embodiment, the
도 2에서는 프로세서(100)의 구성을 각각의 기능별로 구분하여 설명하였으나, 반드시 물리적으로 구분되는 것을 의미하지 않는다. 예를 들어, 프로그램 실행부(230)는 번역기(220) 및/또는 성능 측정기(240)를 포함하도록 구성될 수도 있다. 또한, 도 2에서는 하나의 데이터베이스(260)가 존재하는 것으로 도시되었으나, 이에 한정되지 않으며, 예를 들어, 고정 파라미터 및/또는 가변 파라미터가 저장된 데이터베이스와 하나 이상의 기계학습 모델이 저장된 데이터베이스가 존재할 수도 있다. 이와 같은 구성에 의해, 프로세서(100)가 숙련된 프로그래머의 역할을 대신할 수 있으므로, 프로그래머가 직접 최적화하는 것보다 더 빠른 시간 내에 프로그램 최적화를 완료하거나, 주어진 시간에 더 많은 수의 탐색 범위(즉, 프로그램에 포함된 부분 또는 전부)를 효율적으로 탐색할 수 있다.In FIG. 2 , the configuration of the
도 3은 본 개시의 일 실시예에 따른 강화 학습에 기초하여 프로그램을 자동으로 최적화하는 방법(300)의 예시를 나타내는 흐름도이다. 일 실시예에 따르면, 강화 학습 기반의 프로그램 최적화 방법(300)은 프로그램 최적화를 수행하기 위한 적어도 하나의 프로세서(예를 들어, 프로세서(100))에 의해 수행될 수 있다. 강화 학습에 기초하여 프로그램을 자동으로 최적화하는 방법(300)은 프로세서가 고정 파라미터와 가변 파라미터를 포함하는 소스 프로그램을 위한 입력을 수신함으로써 개시될 수 있다(S310). 예를 들어, 소스 프로그램은 원시 언어(source language)로 기술된 프로그램을 지칭할 수 있다.3 is a flowchart illustrating an example of a
프로세서는 수신된 입력을 기초로 소스 프로그램을 생성할 수 있다(S320). 또한, 프로세서는 소스 프로그램을 목적 프로그램으로 변환할 수 있다(S330). 예를 들어, 목적 프로그램은 목적 언어(object language) 또는 대상 언어(target language)로 기술된 프로그램으로서, 컴퓨터에 의해 실행될 수 있도록 기술된 프로그램을 지칭할 수 있다. 예를 들어, 프로세서는 소스 프로그램에 대응되는 번역기를 이용하여 목적 프로그램을 생성할 수 있다.The processor may generate a source program based on the received input (S320). Also, the processor may convert the source program into the target program (S330). For example, the target program may refer to a program written in an object language or a target language, and described to be executed by a computer. For example, the processor may generate the target program using a translator corresponding to the source program.
프로세서는 변환된 목적 프로그램을 실행함으로써, 실행된 목적 프로그램의 성능을 측정할 수 있다(S340). 일 실시예에 따르면, 프로세서는 목적 프로그램의 실행 시 목적 프로그램을 통해 결과 값을 출력하는데 걸리는 시간을 측정하고, 측정된 시간을 성능의 지표로 결정할 수 있다. 이 경우, 프로세서는 목적 프로그램에 대한 테스트 세트를 입력하고, 테스트 세트에 대응하는 결과 값이 목적 프로그램을 통해 출력되는 데 걸리는 시간을 목적 프로그램의 성능의 지표로서 결정할 수 있다.The processor may measure the performance of the executed object program by executing the converted object program (S340). According to an embodiment, the processor may measure a time taken to output a result value through the target program when the target program is executed, and determine the measured time as an index of performance. In this case, the processor may input a test set for the target program, and determine a time taken for a result value corresponding to the test set to be output through the target program as an index of performance of the target program.
그리고 나서, 프로세서는 가변 파라미터 및 측정된 성능을 기계학습 모델에 입력하여, 가변 파라미터 변화량을 출력할 수 있다(S350). 추가적으로 또는 대안적으로, 프로세서는 가변 파라미터, 측정된 성능 및 소스 프로그램을 기계학습 모델에 입력하여, 가변 파라미터 변화량을 출력할 수 있다. 일 실시예에 따르면, 기계학습 모델은 딥 뉴럴 네트워크 등의 딥러닝 모델을 포함할 수 있다. 기계학습 모델이 딥러닝 모델인 경우, 프로세서는 가변 파라미터, 성능 및 소스 프로그램을 나타내는 입력 벡터를 생성하고, 생성된 입력 벡터를 딥러닝 모델에 입력하여 딥러닝 모델을 통해 가변 파라미터 변화량을 나타내는 출력 벡터를 생성할 수 있다.Then, the processor may input the variable parameter and the measured performance to the machine learning model, and output the variable parameter change amount (S350). Additionally or alternatively, the processor may input the variable parameter, the measured performance, and the source program to the machine learning model, and output the variable parameter variation. According to an embodiment, the machine learning model may include a deep learning model such as a deep neural network. When the machine learning model is a deep learning model, the processor generates an input vector representing variable parameters, performance, and source program, and inputs the generated input vector to the deep learning model to obtain an output vector representing variable parameter variation through the deep learning model. can create
프로세서는 가변 파라미터 변화량을 반영한 소스 프로그램을 재생성할 수 있다(S360). 즉, 프로세서는 가변 파라미터 변화량을 가변 파라미터에 적용하고, 가변 파라미터 변화량이 적용된 가변 파라미터 및 고정 파라미터를 이용하여 재생성된 소스 프로그램을 출력할 수 있다.The processor may regenerate the source program reflecting the variable parameter change amount (S360). That is, the processor may apply the variable parameter change amount to the variable parameter and output the regenerated source program using the variable parameter and the fixed parameter to which the variable parameter change amount is applied.
도 4는 본 개시의 일 실시예에 따라 최적화된 프로그램을 결정하기 위한 과정이 반복적으로 수행되는 예시를 나타내는 블록도이다. 도시된 바와 같이, 프로그램 생성부(210)는 고정 파라미터와 가변 파라미터를 이용하여 소스 프로그램을 생성할 수 있다. 예를 들어, 고정 파라미터와 가변 파라미터는 하나의 프로그램을 생성하기 위해 필요한 적어도 일부 정보를 포함할 수 있다.4 is a block diagram illustrating an example in which a process for determining an optimized program is repeatedly performed according to an embodiment of the present disclosure. As illustrated, the
번역기(220)는 프로그램 생성부(210)에 의해 생성된 소스 프로그램을 목적 프로그램으로 변환할 수 있다. 이와 같이, 번역기(220)에 의해 변환된 목적 프로그램은 프로그램 실행부(230)에 제공될 수 있다. 이 경우, 프로그램 실행부(230)는 목적 프로그램을 실행하여 출력되는 결과를 확인할 수 있다. 또한, 성능 측정기(240)는 목적 프로그램이 실행에 따른 목적 프로그램의 성능을 측정할 수 있다. 또한, 기계학습 처리부(250)는 가변 파라미터 및 측정된 성능을 기계학습 모델에 입력하여, 가변 파라미터 변화량을 출력할 수 있다. 이와 같이, 소스 프로그램을 생성하고, 소스 프로그램을 목적 프로그램으로 변환하고, 목적 프로그램을 실행하고, 목적 프로그램의 성능을 측정하고, 가변 파라미터 변화량을 출력하는 과정/방법은 상술된 것과 동일/유사하게 수행될 수 있다.The
일 실시예에 따르면, 기계학습 모델의 학습의 측면에서, 상술된 과정은 미리 결정된 배치 크기(batch size)에 도달될 때까지 반복적으로 수행될 수 있다. 여기서, 미리 결정된 배치 크기는 전체 기계학습 모델을 학습시키기 위해 필요한 데이터 세트의 크기 또는 개수를 나타낼 수 있다. 즉, 상술된 과정이 반복되며 생성되는, 복수의 가변 파라미터 변화량, 복수의 성능, 복수의 프로그램의 소스 코드 등이 특정 메모리 및/또는 데이터베이스 등에 저장될 수 있으며, 저장된 데이터 복수의 가변 파라미터 변화량, 복수의 성능, 복수의 프로그램의 소스 코드 등이 미리 결정된 배치 크기에 도달하는 경우, 저장된 데이터 및/또는 정보는 기계학습 모델을 학습시키기 위한 학습 데이터로서 사용될 수 있다. 즉, 기계학습 모델이 추론하여 획득된 결과가 다시 기계학습 모델을 학습시키기 위해 사용될 수 있다. 예를 들어, 기계학습 모델이 추론하여 획득된 결과는 복수의 로컬 추론 환경에서 생성되고, 전역 기계학습 모델(예: DNN 모델)에 전달되어 강화학습에 사용될 수 있다.According to an embodiment, in terms of learning the machine learning model, the above-described process may be repeatedly performed until a predetermined batch size is reached. Here, the predetermined batch size may indicate the size or number of data sets required to train the entire machine learning model. That is, a plurality of variable parameter variations, a plurality of performances, source codes of a plurality of programs, etc. generated by repeating the above-described process may be stored in a specific memory and/or a database, and the stored data may be stored in a plurality of variable parameter variations, a plurality of When the performance of , the source code of a plurality of programs, etc. reach a predetermined batch size, the stored data and/or information may be used as training data for training the machine learning model. That is, the result obtained by inferring the machine learning model may be used to train the machine learning model again. For example, a result obtained by inferring a machine learning model may be generated in a plurality of local inference environments and transmitted to a global machine learning model (eg, a DNN model) to be used for reinforcement learning.
최적화된 소스 프로그램의 생성(추론)의 측면에서, 상술된 과정은 목표 성능에 도달할 때까지 반복적으로 실행될 수 있다. 일 실시예에 따르면, 목표 성능은, 상술된 과정이 반복적으로 수행되는 경우에, 더 이상 향상된 성능이 측정되지 않는 경우의 성능을 지칭할 수 있다. 예를 들어, 성능과 연관된 수치가 1.6초로 출력된 후, 반복되는 과정에서 1.6초 이하의 성능 수치만이 미리 결정된 횟수(예를 들어, 1회 또는 복수 회)로 출력되는 경우, 프로세서는 목표 성능에 도달한 것으로 판정할 수 있다. 목표 성능에 도달한 것으로 판정된 경우, 프로세서는 최고 성능에 대응하는 소스 프로그램을 최적화된 소스 프로그램으로 결정할 수 있다. 상술된 예에서, 성능 수치가 1.6초일 때의 가변 파라미터 및 고정 파라미터를 기초로 생성되는 소스 프로그램이 최적화된 소스 프로그램으로 결정될 수 있다. 이와 같은 구성에 의해 프로그램 최적화를 수행하는 경우, 프로그램 최적화를 위해 필요한 인적 자원의 투입량이 최소화되어 이윤이 창출될 수 있으며, 향상된 성능의 프로그램을 사용하여 서비스의 품질이 향상될 수 있다.In terms of generation (inference) of the optimized source program, the above-described process can be repeatedly executed until the target performance is reached. According to an embodiment, the target performance may refer to a performance when the improved performance is no longer measured when the above-described process is repeatedly performed. For example, after a performance-related numerical value is output in 1.6 seconds, if only a performance value of 1.6 seconds or less is output a predetermined number of times (for example, once or multiple times) in the repeated process, the processor sets the target performance can be considered to have been reached. When it is determined that the target performance is reached, the processor may determine a source program corresponding to the highest performance as an optimized source program. In the above-described example, the source program generated based on the variable parameter and the fixed parameter when the performance value is 1.6 seconds may be determined as the optimized source program. When program optimization is performed by such a configuration, the amount of human resource input required for program optimization can be minimized to generate profits, and service quality can be improved by using a program with improved performance.
도 5는 본 개시의 일 실시예에 따라 강화 학습 기반의 가변 파라미터 변화량을 출력하는 기계학습 모델(500)의 예시를 나타내는 도면이다. 일 실시예에 따르면, 기계학습 모델(500)은 인공신경망(artificial neural network)에 해당할 수 있다. 예를 들어, 인공신경망은 DNN(Deep Neural Network)으로 구성될 수 있다. 여기서, 인공신경망은 기계 학습(Machine Learning) 기술과 인지과학에서, 생물학적 신경망의 구조에 기초하여 구현된 통계학적 학습 알고리즘 또는 그 알고리즘을 실행하는 구조를 지칭할 수 있다. 즉, 인공신경망은, 생물학적 신경망에서와 같이 시냅스의 결합으로 네트워크를 형성한 인공 뉴런인 노드(Node)들이 시냅스의 가중치를 반복적으로 조정하여, 특정 입력에 대응한 올바른 출력과 추론된 출력사이의 오차가 감소되도록 학습함으로써, 문제 해결 능력을 가지는 기계학습 모델(500)을 나타낸다.5 is a diagram illustrating an example of a
일반적으로 인공신경망은 다층의 노드들과 이들 사이의 연결로 구성된 다층 퍼셉트론(MLP: multilayer perceptron)으로 구현된다. 본 실시예에 따른 인공신경망은 MLP를 포함하는 다양한 인공신경망 구조들 중의 하나를 이용하여 구현될 수 있다. 인공신경망은 외부로부터 입력 신호 또는 데이터를 수신하는 입력층, 입력 데이터에 대응한 출력 신호 또는 데이터를 출력하는 출력층, 입력층과 출력층 사이에 위치하며 입력층으로부터 신호를 받아 특성을 추출하여 출력층으로 전달하는 n개의 은닉층으로 구성된다. 여기서, 출력층은, 은닉층으로부터 신호를 받아 외부로 출력한다.In general, an artificial neural network is implemented as a multilayer perceptron (MLP) consisting of multiple layers of nodes and connections between them. The artificial neural network according to the present embodiment may be implemented using one of various artificial neural network structures including MLP. An artificial neural network is located between an input layer that receives an input signal or data from the outside, an output layer that outputs an output signal or data corresponding to input data, and an input layer and an output layer. It consists of n hidden layers. Here, the output layer receives a signal from the hidden layer and outputs it to the outside.
프로세서는 이러한 기계학습 모델(500)에 가변 파라미터 및 프로그램의 성능을 입력하여, 가변 파라미터 변화량을 출력할 수 있다. 일 실시예에 따르면, 프로세서는 가변 파라미터 및 측정된 성능을 나타내는 입력 벡터를 생성하고, 생성된 입력 벡터를 기계학습 모델(500)에 입력하여 기계학습 모델(500)을 통해 가변 파라미터 변화량을 나타내는 출력 벡터를 생성할 수 있다. 여기서, 가변 파라미터 변화량은 주어진 프로그램의 성능을 향상시킬 수 있도록 출력된 임의의 값일 수 있다. 즉, 프로세서는 가변 파라미터 변화량을 기존의 가변 파라미터에 적용하고, 가변 파라미터 변화량이 적용된 가변 파라미터 및 고정 파라미터를 이용하여, 새로운 소스 프로그램을 출력할 수 있다.The processor may input the variable parameters and the performance of the program to the
도 6은 본 개시의 다른 실시예에 따라 강화 학습 기반의 가변 파라미터 변화량을 출력하는 기계학습 모델(600)의 예시를 나타내는 도면이다. 일 실시예에 따르면, 기계학습 모델(600)은 인공신경망(artificial neural network)에 해당할 수 있다. 예를 들어, 기계학습 모델(600)은 다층 퍼셉트론으로 구현된 입력층, 은닉층, 출력층 등을 포함할 수 있으며, 예를 들어, 딥 뉴럴 네트워크(DNN) 등을 포함할 수 있다.6 is a diagram illustrating an example of a
일 실시예에 따르면, 기계학습 모델(600)은 가변 파라미터, 프로그램의 성능, 소스 프로그램 등을 이용하여, 가변 파라미터 변화량을 출력하도록 학습(예를 들어, 강화 학습)된 모델일 수 있다. 이 경우, 기계학습 모델(600)이 가변 파라미터, 프로그램의 성능, 소스 프로그램 등으로부터 출력한 가변 파라미터 변화량은 기계학습 모델(600)을 학습시키기 위한 새로운 학습 데이터로서 사용될 수 있다.According to an embodiment, the
일 실시예에 따르면, 프로세서는 가변 파라미터, 프로그램의 성능 및 소스 프로그램을 기계학습 모델(600)에 입력하여 가변 파라미터 변화량을 출력할 수 있다. 예를 들어, 프로세서는 가변 파라미터, 측정된 성능 및 소스 프로그램을 나타내는 입력 벡터를 생성하고, 생성된 입력 벡터를 기계학습 모델(600)에 입력하여 기계학습 모델(600)을 통해 가변 파라미터 변화량을 나타내는 출력 벡터를 생성할 수 있다. 즉, 프로세서는 가변 파라미터 변화량을 나타내는 출력 벡터를 기존의 가변 파라미터에 적용하고, 가변 파라미터 변화량을 나타내는 출력 벡터가 적용된 가변 파라미터 및 고정 파라미터를 이용하여, 새로운 소스 프로그램을 출력할 수 있다.According to an embodiment, the processor may input the variable parameter, the performance of the program, and the source program to the
도 7은 본 개시의 일 실시예에 따른 강화 학습 기반의 기계학습 모델을 학습시키는 방법(700)의 예시를 나타내는 흐름도이다. 일 실시예에 따르면, 강화 학습 기반의 기계학습 모델을 학습시키는 방법(700)은 프로그램 최적화를 수행하거나 학습 데이터를 생성하기 위한 적어도 하나의 프로세서(예를 들어, 프로세서(100))에 의해 수행될 수 있다. 방법(700)은 프로세서가 소스 프로그램을 목적 프로그램으로 변환함으로써 개시될 수 있다(S710). 소스 프로그램은 해당 프로그램 생성을 위해 필요한 모든 정보를 포함하는 고정 파라미터 및 가변 파라미터를 이용하여 생성된 것일 수 있다. 여기서, 가변 파라미터는 프로그래머 또는 데이터베이스로부터 수신될 수 있다. 이와 달리, 가변 파라미터는 기존의 가변 파라미터에 가변 파라미터 변화량이 적용된 파라미터를 지칭할 수 있다.7 is a flowchart illustrating an example of a
프로세서는 변환된 목적 프로그램을 실행함으로써, 실행된 목적 프로그램의 성능을 측정할 수 있다(S720). 일 실시예에 따르면, 프로세서는 목적 프로그램에 따라 미리 정의된 테스트 세트(테스트 입력 및 테스트 출력)를 수신할 수 있다. 그리고 나서, 프로세서는 목적 프로그램에 테스트 입력을 입력하고, 출력되는 결과 값을 확인할 수 있다. 즉, 프로세서는 출력된 결과 값과 테스트 출력이 동일한지 확인하고, 목적 프로그램의 성능을 측정할 수 있다. 예를 들어, 출력된 결과 값과 테스트 출력이 동일하지 않은 경우, 수정된 소스 프로그램이 기존 소스 프로그램과 상이해진 것을 의미하므로, 프로세서는 가변 파라미터를 기본값으로 초기화할 수 있다.The processor may measure the performance of the executed object program by executing the converted object program (S720). According to an embodiment, the processor may receive a predefined test set (test input and test output) according to a target program. Then, the processor may input a test input to the target program and check the output result value. That is, the processor may check whether the output result value and the test output are the same, and measure the performance of the target program. For example, when the output result value and the test output are not the same, since the modified source program is different from the existing source program, the processor may initialize the variable parameter to a default value.
프로세서는 가변 파라미터 및 측정된 성능을 기계학습 모델에 입력하여, 가변 파라미터 변화량을 출력할 수 있다(S730). 또한, 프로세서는 가변 파라미터 변화량을 반영한 소스 프로그램을 재생성할 수 있다(S740). 예를 들어, 프로세서는 가변 파라미터가 프로그램의 성능에 영향을 미친 정도 등을 고려하여, 프로그램의 성능이 향상될 수 있도록 가변 파라미터 변화량을 출력할 수 있다. 그리고 나서, 가변 파라미터 변화량이 반영된 가변 파라미터 및 고정 파라미터를 이용하여 소스 프로그램을 재생성할 수 있다.The processor may input the variable parameter and the measured performance to the machine learning model and output the variable parameter change amount (S730). Also, the processor may regenerate the source program reflecting the variable parameter change amount ( S740 ). For example, the processor may output the variable parameter change amount so that the performance of the program can be improved in consideration of the degree to which the variable parameter affects the performance of the program. Then, the source program may be regenerated using the variable parameter and the fixed parameter to which the variable parameter change amount is reflected.
프로세서는 재생성된 소스 프로그램을 소스 프로그램으로 설정하여, 상술된 과정/단계를 다시 수행할 수 있다(S750). 일 실시예에 따르면, 프로세서는 학습에 사용된 데이터의 누적 크기 또는 실행 횟수가 미리 결정된 배치 크기(batch size)에 도달될 때까지, 상술된 단계를 반복적으로 수행할 수 있다(S760). 즉, 가변 파라미터 변화량을 출력하기 위한 기계학습 모델은 지속적으로 학습될 수 있으며, 학습에 필요한 학습 데이터는 상술된 단계를 미리 결정된 배치 크기에 도달될 때까지 반복하여 수행함으로써 생성되거나 업데이트될 수 있다.The processor may set the regenerated source program as the source program and perform the above-described process/step again (S750). According to an embodiment, the processor may repeatedly perform the above-described steps until the cumulative size or the number of executions of the data used for learning reaches a predetermined batch size ( S760 ). That is, the machine learning model for outputting the variable parameter variation can be continuously learned, and the training data required for learning can be generated or updated by repeatedly performing the above-described steps until a predetermined batch size is reached.
일 실시예에 따르면, 상술된 과정을 반복함에 따라 생성되는 모든 중간 결과물 및 데이터는 임의의 메모리에 저장되거나, 임의의 외부 저장 장치에 저장될 수 있다. 다시 말해, 미리 결정된 배치 크기에 도달될 때까지 상술된 과정을 반복하여 생성되는 가변 파라미터 변화량, 가변 파라미터, 고정 파라미터, 소스 프로그램, 목적 프로그램(예를 들어, 바이너리 코드), 테스트 입력, 테스트 출력, 결과 값 및/또는 성능은 임의의 메모리 또는 외부 저장 장치에 저장될 수 있다. 이와 같이 저장되거나 수집된 데이터 및/또는 정보는 다른 기계학습 모델의 강화 학습(예를 들어, 전역 DNN)을 위한 학습 데이터로서 사용될 수 있다.According to an embodiment, all intermediate results and data generated by repeating the above-described process may be stored in an arbitrary memory or in an arbitrary external storage device. In other words, variable parameter variation, variable parameter, fixed parameter, source program, target program (eg, binary code), test input, test output, The resulting values and/or performance may be stored in any memory or external storage device. The data and/or information stored or collected in this way may be used as training data for reinforcement learning (eg, global DNN) of other machine learning models.
도 8은 본 개시의 일 실시예에 따른 기계학습 모델을 통한 추론 방법(800)의 예시를 나타내는 흐름도이다. 일 실시예에 따르면, 기계학습 모델의 추론 방법(800)은 프로그램 최적화를 수행하기 위한 적어도 하나의 프로세서(예를 들어, 프로세서(100))에 의해 수행될 수 있다. 기계학습 모델의 추론 방법(800)은 프로세서가 가변 파라미터 및 고정 파라미터를 포함하는 소스 프로그램을 위한 입력을 수신함으로써 개시될 수 있다(S810). 예를 들어, 가변 파라미터 및 고정 파라미터는 프로그램 개발자로부터 직접 수신되거나, 가변 파라미터 및 고정 파라미터가 저장된 데이터베이스로부터 추출될 수 있다.8 is a flowchart illustrating an example of an
프로세서는 수신된 입력을 기초로 소스 프로그램을 생성할 수 있다(S820). 또한, 프로세서는 소스 프로그램을 목적 프로그램으로 변환할 수 있다(S830). 여기서, 고정 파라미터 및 가변 파라미터를 기초로 소스 프로그램을 생성하거나, 생성된 소스 프로그램을 목적 프로그램으로 변환하는 과정은 상술된 것과 동일/유사하게 수행될 수 있다.The processor may generate a source program based on the received input (S820). Also, the processor may convert the source program into the target program (S830). Here, the process of generating the source program based on the fixed parameter and the variable parameter or converting the generated source program into the target program may be performed in the same manner as/in the same manner as described above.
프로세서는 변환된 목적 프로그램을 실행함으로써, 실행된 목적 프로그램의 성능을 측정할 수 있다(S840). 예를 들어, 목적 프로그램이 입력으로부터 결과 값을 출력하기까지 소요되는 실행 시간, 에너지 소모량 및/또는 리소스 사용량이 프로그램의 성능을 측정하기 위한 성능 지표로서 사용될 수 있다. 즉, 실행 시간이 짧을수록, 에너지 소모량이 적을수록 및/또는 리소스 사용량이 적을수록 프로그램의 성능이 더 우수한 것으로 판정될 수 있다.The processor may measure the performance of the executed object program by executing the converted object program (S840). For example, the execution time, energy consumption, and/or resource usage required for the target program to output a result value from input may be used as a performance indicator for measuring the performance of the program. That is, the shorter the execution time, the lower the energy consumption, and/or the lower the resource usage, the better the performance of the program may be determined.
프로세서는 프로그램의 측정 성능이 이전 최고 성능보다 높은지 여부를 판정할 수 있다(S850). 다시 말해, 프로세서는 프로그램의 성능이 목표 성능에 도달했는지 여부를 판정할 수 있다. 예를 들어, 프로세서는 상술된 과정 중 적어도 일부를 반복적으로 수행되면서 측정된 프로그램의 성능이 더 이상 향상되지 않는 경우에, 해당 프로그램의 성능이 목표 성능에 도달한 것으로 판정할 수 있다.The processor may determine whether the measured performance of the program is higher than the previous best performance (S850). In other words, the processor may determine whether the performance of the program has reached a target performance. For example, the processor may determine that the performance of the corresponding program has reached the target performance when the measured program performance is no longer improved while at least a part of the above-described process is repeatedly performed.
일 실시예에 따르면, 측정 성능이 이전 최고 성능보다 높은 것으로 판정된 경우, 프로세서는 가변 파라미터 및 측정된 성능을 기계학습 모델에 입력하여, 가변 파라미터 변화량을 출력할 수 있다(S860). 또한, 프로세서는 가변 파라미터 변화량을 반영한 소스 프로그램을 재생성할 수 있다(S870). 즉, 프로세서는 가변 파라미터를 계속적으로 변화시키며, 가변 파라미터의 변화에 따른 프로그램의 성능의 변화를 측정할 수 있다.According to an embodiment, when it is determined that the measured performance is higher than the previous best performance, the processor may input the variable parameter and the measured performance to the machine learning model, and output the variable parameter change amount ( S860 ). In addition, the processor may regenerate the source program reflecting the variable parameter change amount (S870). That is, the processor may continuously change the variable parameter and measure the change in program performance according to the change of the variable parameter.
일 실시예에 따르면, 프로그램의 성능이 목표 성능에 도달한 경우, 프로세서는 최고 성능에 대응하는 소스 프로그램을 최적화된 소스 프로그램으로 결정할 수 있다(S880). 즉, 상술된 과정 전부 또는 일부를 반복적으로 수행하여도, 프로그램의 성능이 이전 최고 성능보다 더 이상 향상되지 않는 경우, 프로세서는 지금까지의 성능 중 가장 성능이 우수한 최고 성능에 대응하는 소스 프로그램(최고 성능에 대응하는 가변 파라미터를 갖는 프로그램)을 최적화된 소스 프로그램으로 결정할 수 있다. 이와 같은 구성에 의해, 프로그램의 개발자가 직접 가변 파라미터를 변화시켜가며 프로그램을 최적화하지 않고도, 프로세서가 목표 성능에 도달할 때까지 성능 측정을 반복하여, 자동적으로 최적화된 프로그램을 생성할 수 있다. 도 8에서는, S850 단계를 통해 프로그램의 성능이 이전 최고 성능보다 1회 향상되지 않은 경우, 이전 최고 성능에 대응하는 프로그램을 최적화된 프로그램으로 생성하는 것으로 도시되어 있으나, 이에 한정되지 않으며, 미리 결정된 복수의 횟수로 S830 내지 S850의 반복된 과정을 통해 측정된 프로그램의 성능이 모두 이전 최고 성능을 넘지 못한 경우, 이전 최고 성능에 대응하는 프로그램이 최적화된 프로그램으로 결정될 수 있다.According to an embodiment, when the performance of the program reaches the target performance, the processor may determine the source program corresponding to the highest performance as the optimized source program ( S880 ). That is, even if all or part of the above-described process is repeatedly performed, if the performance of the program does not improve any more than the previous best performance, the processor returns the source program corresponding to the highest performance with the best performance so far. A program having variable parameters corresponding to performance) may be determined as an optimized source program. With such a configuration, it is possible to automatically generate an optimized program by repeating performance measurement until the processor reaches the target performance without optimizing the program by directly changing variable parameters by the developer of the program. In FIG. 8 , if the performance of the program is not improved once from the previous best performance through step S850, a program corresponding to the previous best performance is generated as an optimized program, but the present invention is not limited thereto, and a plurality of predetermined When the performance of the program measured through the repeated process of S830 to S850 by the number of times does not exceed the previous best performance, the program corresponding to the previous best performance may be determined as the optimized program.
도 9는 본 개시의 일 실시예에 따라 기계학습 모델(910_1, 910_2)에 대한 강화 학습(reinforcement learning)을 수행하는 예시를 나타내는 도면이다. 예를 들어, 도 9는 A3C(Asynchronous Advantage Actor-Critic) 구조의 강화 학습 기법을 사용하여 전역 DNN(940) 및 기계학습 모델(910_1, 910_2)을 학습시키는 구조를 나타낼 수 있다. 여기서, 강화 학습은 DNN에 기반한 에이전트(Agent)가 외부 환경(Environment)에 개입(Action)하여 결과(State)와 보상(Reward)을 받고, 해당 결과와 보상으로부터 다시 DNN을 학습시키는 과정을 반복적으로 실행하는 기법을 지칭할 수 있다. 일 실시예에 따르면, 프로그램의 성능을 측정하고, 가변 파라미터의 변화량을 출력하는 하나 이상의 기계학습 모델(910_1, 910_2)이 존재할 수 있다.9 is a diagram illustrating an example of performing reinforcement learning on the machine learning models 910_1 and 910_2 according to an embodiment of the present disclosure. For example, FIG. 9 may show a structure for learning the
상술된 바와 같이, 기계학습 모델(910_1, 910_2)은 미리 결정된 배치 크기에 도달될 때까지 과정을 반복하며 생성되는 가변 파라미터 변화량, 가변 파라미터, 고정 파라미터, 소스 프로그램, 목적 프로그램(예를 들어, 프로그램 바이너리), 테스트 입력, 테스트 출력, 결과 값, 성능 등을 임의의 메모리 또는 외부 저장 장치에 저장할 수 있다. 이와 같이 임의의 메모리 또는 외부 저장 장치에 저장된 데이터 및/또는 정보는 추론 결과(920_1, 920_2)로서, 전역 DNN 관리자(930)에게 제공될 수 있다. 예를 들어, 추론 결과(920_1, 920_2)는 전역 DNN 관리자(930)에게 비동기적으로 제공될 수 있다.As described above, the machine learning models 910_1 and 910_2 repeat the process until a predetermined batch size is reached, and are generated variable parameter variation, variable parameter, fixed parameter, source program, and target program (eg, program binary), test inputs, test outputs, result values, performance, etc. can be stored in any memory or external storage device. As such, data and/or information stored in an arbitrary memory or external storage device may be provided to the
추론 결과(920_1, 920_2)를 수신한 전역 DNN 관리자(930)는 추론 결과(920_1, 920_2)를 이용하여, 전역 DNN을 학습시키기 위한 학습 데이터를 생성할 수 있다. 그리고 나서, 전역 DNN 관리자(930)는 생성된 학습 데이터를 전역 DNN(940)으로 전송할 수 있다. 즉, 전역 DNN(940)은 하나 이상의 기계학습 모델(910_1, 910_2)에 의해 생성된 추론 결과(920_1, 920_2)를 모두 이용하여, 강화 학습을 수행할 수 있다.The
전역 DNN(940)은 학습 데이터를 이용하여 강화 학습을 수행한 후, 강화 학습의 결과로서, DNN 파라미터(950_1, 950_2)를 생성할 수 있다. 이와 같이, 생성된 DNN 파라미터(950_1, 950_2)는 하나 이상의 기계학습 모델(910_1, 910_2)로 제공될 수 있다. 이 경우, 기계학습 모델(910_1, 910_2)의 파라미터가 수신된 DNN 파라미터(950_1, 950_2)로 치환될 수 있으며, 이에 따라, 기계학습 모델(910_1, 910_2)의 강화 학습이 수행될 수 있다.The
도 9에서는 두 개의 기계학습 모델(910_1, 910_2)이 존재하는 것으로 도시되었으나, 이에 한정되지 않으며, 3 개 이상의 기계학습 모델이 존재할 수 있다. 또한, 도 9에서는 A3C 모델을 이용하여 강화 학습을 수행하는 것으로 상술되었으나, 이에 한정되지 않으며, 임의의 Artor-Critic 모델, DQN(Deep Q Networks) 모델 등이 사용될 수도 있다.Although it is illustrated that two machine learning models 910_1 and 910_2 exist in FIG. 9 , the present invention is not limited thereto, and three or more machine learning models may exist. In addition, although it has been described above that reinforcement learning is performed using the A3C model in FIG. 9 , the present invention is not limited thereto, and any Artor-Critic model, Deep Q Networks (DQN) model, or the like may be used.
상술한 방법은 컴퓨터에서 실행하기 위해 컴퓨터 판독 가능한 기록 매체에 저장된 컴퓨터 프로그램으로 제공될 수 있다. 매체는 컴퓨터로 실행 가능한 프로그램을 계속 저장하거나, 실행 또는 다운로드를 위해 임시 저장하는 것일 수도 있다. 또한, 매체는 단일 또는 수개 하드웨어가 결합된 형태의 다양한 기록수단 또는 저장수단일 수 있는데, 어떤 컴퓨터 시스템에 직접 접속되는 매체에 한정되지 않고, 네트워크 상에 분산 존재하는 것일 수도 있다. 매체의 예시로는, 하드 디스크, 플로피 디스크 및 자기 테이프와 같은 자기 매체, CD-ROM 및 DVD 와 같은 광기록 매체, 플롭티컬 디스크(floptical disk)와 같은 자기-광 매체(magneto-optical medium), 및 ROM, RAM, 플래시 메모리 등을 포함하여 프로그램 명령어가 저장되도록 구성된 것이 있을 수 있다. 또한, 다른 매체의 예시로, 애플리케이션을 유통하는 앱 스토어나 기타 다양한 소프트웨어를 공급 내지 유통하는 사이트, 서버 등에서 관리하는 기록매체 내지 저장매체도 들 수 있다.The above-described method may be provided as a computer program stored in a computer-readable recording medium for execution by a computer. The medium may be to continuously store a computer executable program, or to temporarily store it for execution or download. In addition, the medium may be various recording means or storage means in the form of a single or several hardware combined, it is not limited to a medium directly connected to any computer system, and may exist distributed on a network. Examples of the medium include a hard disk, a magnetic medium such as a floppy disk and a magnetic tape, an optical recording medium such as CD-ROM and DVD, a magneto-optical medium such as a floppy disk, and those configured to store program instructions, including ROM, RAM, flash memory, and the like. In addition, examples of other media may include recording media or storage media managed by an app store that distributes applications, sites that supply or distribute various other software, and servers.
본 개시의 방법, 동작 또는 기법들은 다양한 수단에 의해 구현될 수도 있다. 예를 들어, 이러한 기법들은 하드웨어, 펌웨어, 소프트웨어, 또는 이들의 조합으로 구현될 수도 있다. 본원의 개시와 연계하여 설명된 다양한 예시적인 논리적 블록들, 모듈들, 회로들, 및 알고리즘 단계들은 전자 하드웨어, 컴퓨터 소프트웨어, 또는 양자의 조합들로 구현될 수도 있음을 통상의 기술자들은 이해할 것이다. 하드웨어 및 소프트웨어의 이러한 상호 대체를 명확하게 설명하기 위해, 다양한 예시적인 구성요소들, 블록들, 모듈들, 회로들, 및 단계들이 그들의 기능적 관점에서 일반적으로 위에서 설명되었다. 그러한 기능이 하드웨어로서 구현되는지 또는 소프트웨어로서 구현되는지의 여부는, 특정 애플리케이션 및 전체 시스템에 부과되는 설계 요구사항들에 따라 달라진다. 통상의 기술자들은 각각의 특정 애플리케이션을 위해 다양한 방식들로 설명된 기능을 구현할 수도 있으나, 그러한 구현들은 본 개시의 범위로부터 벗어나게 하는 것으로 해석되어서는 안된다. The method, operation, or techniques of this disclosure may be implemented by various means. For example, these techniques may be implemented in hardware, firmware, software, or a combination thereof. Those of ordinary skill in the art will appreciate that the various illustrative logical blocks, modules, circuits, and algorithm steps described in connection with the disclosure herein may be implemented as electronic hardware, computer software, or combinations of both. To clearly illustrate this interchangeability of hardware and software, various illustrative components, blocks, modules, circuits, and steps have been described above generally in terms of their functionality. Whether such functionality is implemented as hardware or software depends upon the particular application and design requirements imposed on the overall system. Skilled artisans may implement the described functionality in varying ways for each particular application, but such implementations should not be interpreted as causing a departure from the scope of the present disclosure.
하드웨어 구현에서, 기법들을 수행하는 데 이용되는 프로세싱 유닛들은, 하나 이상의 ASIC들, DSP들, 디지털 신호 프로세싱 디바이스들(digital signal processing devices; DSPD들), 프로그램가능 논리 디바이스들(programmable logic devices; PLD들), 필드 프로그램가능 게이트 어레이들(field programmable gate arrays; FPGA들), 프로세서들, 제어기들, 마이크로제어기들, 마이크로프로세서들, 전자 디바이스들, 본 개시에 설명된 기능들을 수행하도록 설계된 다른 전자 유닛들, 컴퓨터, 또는 이들의 조합 내에서 구현될 수도 있다. In a hardware implementation, the processing units used to perform the techniques 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, other electronic units designed to perform the functions described in this disclosure. , a computer, or a combination thereof.
따라서, 본 개시와 연계하여 설명된 다양한 예시적인 논리 블록들, 모듈들, 및 회로들은 범용 프로세서, DSP, ASIC, FPGA나 다른 프로그램 가능 논리 디바이스, 이산 게이트나 트랜지스터 로직, 이산 하드웨어 컴포넌트들, 또는 본원에 설명된 기능들을 수행하도록 설계된 것들의 임의의 조합으로 구현되거나 수행될 수도 있다. 범용 프로세서는 마이크로프로세서일 수도 있지만, 대안으로, 프로세서는 임의의 종래의 프로세서, 제어기, 마이크로제어기, 또는 상태 머신일 수도 있다. 프로세서는 또한, 컴퓨팅 디바이스들의 조합, 예를 들면, DSP와 마이크로프로세서, 복수의 마이크로프로세서들, DSP 코어와 연계한 하나 이상의 마이크로프로세서들, 또는 임의의 다른 구성의 조합으로 구현될 수도 있다. Accordingly, the various illustrative logic blocks, modules, and circuits described in connection with this disclosure are suitable for use in general-purpose processors, DSPs, ASICs, FPGAs or other programmable logic devices, discrete gate or transistor logic, discrete hardware components, or the present disclosure. It may be implemented or performed in any combination of those designed to perform the functions described in 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.
펌웨어 및/또는 소프트웨어 구현에 있어서, 기법들은 랜덤 액세스 메모리(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), 자기 또는 광학 데이터 스토리지 디바이스 등과 같은 컴퓨터 판독가능 매체 상에 저장된 명령어들로 구현될 수도 있다. 명령들은 하나 이상의 프로세서들에 의해 실행 가능할 수도 있고, 프로세서(들)로 하여금 본 개시에 설명된 기능의 특정 양태들을 수행하게 할 수도 있다. In firmware and/or software implementations, the techniques may include random access memory (RAM), read-only memory (ROM), non-volatile random access memory (NVRAM), PROM ( on computer readable media such as programmable read-only memory), erasable programmable read-only memory (EPROM), electrically erasable PROM (EEPROM), flash memory, compact disc (CD), magnetic or optical data storage devices, etc. It may be implemented with stored instructions. The 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.
이상 설명된 실시예들이 하나 이상의 독립형 컴퓨터 시스템에서 현재 개시된 주제의 양태들을 활용하는 것으로 기술되었으나, 본 개시는 이에 한정되지 않고, 네트워크나 분산 컴퓨팅 환경과 같은 임의의 컴퓨팅 환경과 연계하여 구현될 수도 있다. 또 나아가, 본 개시에서 주제의 양상들은 복수의 프로세싱 칩들이나 장치들에서 구현될 수도 있고, 스토리지는 복수의 장치들에 걸쳐 유사하게 영향을 받게 될 수도 있다. 이러한 장치들은 PC들, 네트워크 서버들, 및 휴대용 장치들을 포함할 수도 있다. Although the embodiments described above have been described utilizing aspects of the presently disclosed subject matter in one or more standalone computer systems, the present disclosure is not so limited and may be implemented in connection with any computing environment, such as a network or distributed computing environment. . Still further, aspects of the subject matter in this disclosure may be implemented in a plurality of processing chips or devices, and storage may be similarly affected across the plurality of devices. Such devices may include PCs, network servers, and portable devices.
본 명세서에서는 본 개시가 일부 실시예들과 관련하여 설명되었지만, 본 개시의 발명이 속하는 기술분야의 통상의 기술자가 이해할 수 있는 본 개시의 범위를 벗어나지 않는 범위에서 다양한 변형 및 변경이 이루어질 수 있다. 또한, 그러한 변형 및 변경은 본 명세서에 첨부된 특허청구의 범위 내에 속하는 것으로 생각되어야 한다.Although the present disclosure has been described in connection with some embodiments herein, various modifications and changes may be made without departing from the scope of the present disclosure that can be understood by those skilled in the art to which the present disclosure pertains. Further, such modifications and variations are intended to fall within the scope of the claims appended hereto.
100: 프로세서
110: 소스 프로그램
120: 최적화된 소스 프로그램100: processor 110: source program
120: optimized source program
Claims (10)
(a) 고정 파라미터와 가변 파라미터를 포함하는 소스 프로그램을 위한 입력을 수신하는 단계;
(b) 상기 수신된 입력을 기초로 상기 소스 프로그램을 생성하는 단계;
(c) 상기 소스 프로그램을 목적 프로그램으로 변환하는 단계;
(d) 상기 변환된 목적 프로그램을 실행함으로써, 상기 실행된 목적 프로그램의 성능을 측정하는 단계; 및
(e) 상기 가변 파라미터 및 상기 측정된 성능을 기계학습 모델에 입력하여, 가변 파라미터 변화량을 출력하는 단계; 및
(f) 상기 가변 파라미터 변화량을 반영한 소스 프로그램을 재생성하는 단계
를 포함하는, 강화 학습에 기초하여 프로그램을 자동으로 최적화하는 방법.
A method for automatically optimizing a program based on reinforcement learning, the method comprising:
(a) receiving an input for a source program comprising fixed parameters and variable parameters;
(b) generating the source program based on the received input;
(c) converting the source program into an object program;
(d) measuring the performance of the executed object program by executing the converted object program; and
(e) inputting the variable parameter and the measured performance into a machine learning model, and outputting a variable parameter change amount; and
(f) regenerating the source program reflecting the variable parameter change amount
A method for automatically optimizing a program based on reinforcement learning, comprising:
상기 (f) 단계는,
상기 가변 파라미터 변화량을 상기 가변 파라미터에 적용하는 단계; 및
상기 가변 파라미터 변화량이 적용된 가변 파라미터 및 상기 고정 파라미터를 이용하여 상기 재생성된 소스 프로그램을 출력하는 단계
를 포함하는, 강화 학습에 기초하여 프로그램을 자동으로 최적화하는 방법.
According to claim 1,
The step (f) is,
applying the variable parameter change amount to the variable parameter; and
outputting the regenerated source program using the variable parameter and the fixed parameter to which the variable parameter change amount is applied;
A method for automatically optimizing a program based on reinforcement learning, comprising:
상기 (f) 단계 이후에,
(g) 상기 재생성된 소스 프로그램을 상기 소스 프로그램으로 설정하여, 상기 (c) 내지 (f) 단계를 다시 수행하는 단계를 더 포함하는, 강화 학습에 기초하여 프로그램을 자동으로 최적화하는 방법.
3. The method of claim 2,
After step (f),
(g) setting the regenerated source program as the source program, and performing the steps (c) to (f) again. The method of automatically optimizing a program based on reinforcement learning.
미리 결정된 배치 크기(batch size)에 도달될 때까지, (g) 단계를 반복적으로 수행함으로써, 상기 기계학습 모델을 학습시키는 단계를 더 포함하는, 강화 학습에 기초하여 프로그램을 자동으로 최적화하는 방법.
4. The method of claim 3,
and training the machine learning model by repeatedly performing step (g) until a predetermined batch size is reached.
상기 (c) 내지 상기 (f) 단계를 실행하되, 목표 성능에 도달할 때까지, 상기 (c) 내지 상기 (f) 단계 중 적어도 일부를 반복적으로 실행하는 단계; 및
상기 목표 성능에 도달한 경우, 최고 성능에 대응하는 소스 프로그램을 최적화된 소스 프로그램으로 결정하는 단계
를 더 포함하는, 강화 학습에 기초하여 프로그램을 자동으로 최적화하는 방법.
4. The method of claim 3,
executing steps (c) to (f), but repeatedly executing at least a portion of steps (c) to (f) until a target performance is reached; and
determining a source program corresponding to the highest performance as an optimized source program when the target performance is reached
A method for automatically optimizing a program based on reinforcement learning, further comprising:
상기 (e) 단계는,
상기 가변 파라미터, 상기 측정된 성능 및 상기 소스 프로그램을 상기 기계학습 모델에 입력하여 상기 가변 파라미터 변화량을 출력하는 단계를 포함하는, 강화 학습에 기초하여 프로그램을 자동으로 최적화하는 방법.
According to claim 1,
Step (e) is,
and outputting the variable parameter variation by inputting the variable parameter, the measured performance, and the source program to the machine learning model.
상기 기계학습 모델은 딥러닝 모델을 포함하고,
상기 가변 파라미터, 상기 측정된 성능 및 상기 소스 프로그램을 상기 기계학습 모델에 입력하여 상기 가변 파라미터 변화량을 출력하는 단계는,
상기 가변 파라미터, 상기 측정된 성능 및 상기 소스 프로그램을 나타내는 입력 벡터를 생성하는 단계; 및
상기 생성된 입력 벡터를 상기 딥러닝 모델에 입력하여 상기 딥러닝 모델을 통해 상기 가변 파라미터 변화량을 나타내는 출력 벡터를 생성하는 단계
를 포함하는, 강화 학습에 기초하여 프로그램을 자동으로 최적화하는 방법.
7. The method of claim 6,
The machine learning model includes a deep learning model,
The step of inputting the variable parameter, the measured performance, and the source program to the machine learning model and outputting the variable parameter change amount,
generating an input vector representing the variable parameter, the measured performance and the source program; and
inputting the generated input vector to the deep learning model to generate an output vector representing the variable parameter change amount through the deep learning model
A method for automatically optimizing a program based on reinforcement learning, comprising:
상기 (d) 단계는,
상기 목적 프로그램의 실행 시 상기 목적 프로그램을 통해 결과 값을 출력하는데 걸리는 시간을 측정하는 단계; 및
상기 측정된 시간을 상기 성능의 지표로 결정하는 단계
를 포함하는, 강화 학습에 기초하여 프로그램을 자동으로 최적화하는 방법.
According to claim 1,
Step (d) is,
measuring a time taken to output a result value through the target program when the target program is executed; and
determining the measured time as an indicator of the performance;
A method for automatically optimizing a program based on reinforcement learning, comprising:
상기 목적 프로그램의 실행 시 상기 목적 프로그램을 통해 결과 값을 출력하는데 걸리는 시간을 측정하는 단계는,
상기 목적 프로그램에 대한 테스트 세트를 입력하는 단계; 및
상기 테스트 세트에 대응하는 결과 값이 상기 목적 프로그램을 통해 출력되는 데 걸리는 시간을 상기 성능의 지표로서 결정하는 단계
를 포함하는, 강화 학습에 기초하여 프로그램을 자동으로 최적화하는 방법.
9. The method of claim 8,
Measuring the time it takes to output a result value through the target program when the target program is executed includes:
inputting a test set for the target program; and
determining, as an indicator of the performance, a time taken for a result value corresponding to the test set to be output through the target program;
A method for automatically optimizing a program based on reinforcement learning, comprising:
A computer program stored in a computer-readable recording medium for executing on a computer the method for automatically optimizing a program based on reinforcement learning according to any one of claims 1 to 9.
Priority Applications (2)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
PCT/KR2020/019345 WO2021137601A1 (en) | 2019-12-30 | 2020-12-29 | Program optimization method based on reinforcement learning |
US17/853,028 US12026487B2 (en) | 2019-12-30 | 2022-06-29 | Method for optimizing program using reinforcement learning |
Applications Claiming Priority (2)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
KR20190177761 | 2019-12-30 | ||
KR1020190177761 | 2019-12-30 |
Publications (2)
Publication Number | Publication Date |
---|---|
KR20210086490A true KR20210086490A (en) | 2021-07-08 |
KR102490538B1 KR102490538B1 (en) | 2023-01-19 |
Family
ID=76894270
Family Applications (1)
Application Number | Title | Priority Date | Filing Date |
---|---|---|---|
KR1020200176308A KR102490538B1 (en) | 2019-12-30 | 2020-12-16 | Method for optimizing program using reinforcement learning |
Country Status (1)
Country | Link |
---|---|
KR (1) | KR102490538B1 (en) |
Citations (1)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
KR20190001183A (en) * | 2017-06-26 | 2019-01-04 | 삼성전자주식회사 | Method of compiling a program |
-
2020
- 2020-12-16 KR KR1020200176308A patent/KR102490538B1/en active IP Right Grant
Patent Citations (1)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
KR20190001183A (en) * | 2017-06-26 | 2019-01-04 | 삼성전자주식회사 | Method of compiling a program |
Also Published As
Publication number | Publication date |
---|---|
KR102490538B1 (en) | 2023-01-19 |
Similar Documents
Publication | Publication Date | Title |
---|---|---|
US9754221B1 (en) | Processor for implementing reinforcement learning operations | |
US10878314B2 (en) | System and method for training artificial intelligence systems using a SIMA based processor | |
US10949743B2 (en) | Method and system for implementing reinforcement learning agent using reinforcement learning processor | |
Esmaeilzadeh et al. | Neural acceleration for general-purpose approximate programs | |
US11281832B2 (en) | Device for generating verification vector for circuit design verification, circuit design system, and reinforcement learning method of the device and the circuit design system | |
Falch et al. | Machine learning based auto-tuning for enhanced opencl performance portability | |
Wu et al. | Computation power of asynchronous spiking neural P systems with polarizations | |
US12026487B2 (en) | Method for optimizing program using reinforcement learning | |
Hill et al. | A spike-timing neuromorphic architecture | |
US20220114495A1 (en) | Apparatus, articles of manufacture, and methods for composable machine learning compute nodes | |
Porres et al. | Online GANs for automatic performance testing | |
Ostrau et al. | Benchmarking deep spiking neural networks on neuromorphic hardware | |
US20220147810A1 (en) | Discovery of hardware characteristics of deep learning accelerators for optimization via compiler | |
KR102490538B1 (en) | Method for optimizing program using reinforcement learning | |
US20240020569A1 (en) | Dynamic adaptive thresholding for qubit reset | |
Wang et al. | Chaotic Time Series Prediction of Multi‐Dimensional Nonlinear System Based on Bidirectional LSTM Model | |
Ferro et al. | Predicting runtime in HPC environments for an efficient use of computational resources | |
Huqqani et al. | Parallelized neural networks as a service | |
Falcao et al. | On the evaluation of energy-efficient deep learning using stacked autoencoders on mobile GPUs | |
US20220261287A1 (en) | Method and apparatus for improving processor resource utilization during program execution | |
KR102168882B1 (en) | Neural network hardware | |
KR102187830B1 (en) | Neural network hardware | |
Mankodi et al. | Evaluation of neural network models for performance prediction of scientific applications | |
Nunez-Yanez et al. | Energy-efficient neural networks with near-threshold processors and hardware accelerators | |
Chandrashekhar et al. | Prediction model of an HPC application on CPU-GPU cluster using machine learning techniques |
Legal Events
Date | Code | Title | Description |
---|---|---|---|
N231 | Notification of change of applicant | ||
E902 | Notification of reason for refusal | ||
E701 | Decision to grant or registration of patent right | ||
GRNT | Written decision to grant |