KR20190089521A - Compile Apparatus and Method for Program Include Nested Loop Structure, and Recording Medium Thereof - Google Patents

Compile Apparatus and Method for Program Include Nested Loop Structure, and Recording Medium Thereof Download PDF

Info

Publication number
KR20190089521A
KR20190089521A KR1020180008143A KR20180008143A KR20190089521A KR 20190089521 A KR20190089521 A KR 20190089521A KR 1020180008143 A KR1020180008143 A KR 1020180008143A KR 20180008143 A KR20180008143 A KR 20180008143A KR 20190089521 A KR20190089521 A KR 20190089521A
Authority
KR
South Korea
Prior art keywords
loop structure
instructions
program including
program
loop
Prior art date
Application number
KR1020180008143A
Other languages
Korean (ko)
Other versions
KR102051206B1 (en
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 KR1020180008143A priority Critical patent/KR102051206B1/en
Publication of KR20190089521A publication Critical patent/KR20190089521A/en
Application granted granted Critical
Publication of KR102051206B1 publication Critical patent/KR102051206B1/en

Links

Images

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F8/00Arrangements for software engineering
    • G06F8/40Transformation of program code
    • G06F8/41Compilation
    • G06F8/44Encoding

Landscapes

  • Engineering & Computer Science (AREA)
  • General Engineering & Computer Science (AREA)
  • Theoretical Computer Science (AREA)
  • Software Systems (AREA)
  • Physics & Mathematics (AREA)
  • General Physics & Mathematics (AREA)
  • Devices For Executing Special Programs (AREA)
  • Complex Calculations (AREA)

Abstract

Disclosed are a compiling device for a program including a nested loop structure, and a method and a recording medium thereof. According to the present invention, the compiling device for converting a program including a nested loop structure into a single loop structure comprises: a loop cancelation unit canceling all loop structures of the program including the nested loop structure; an isomorphic operation classification unit classifying instructions performing an isomorphic operation in the program in which the loop structure is canceled; a vector conversion unit grouping the instruction performing the isomorphic operation into a plurality of groups, and converting each group into vector; and a loop conversion unit using the converted vector to convert the program included in the nested loop structure into a single loop structure. Accordingly, a vectorization technique is applied to the program including the nested loop structure, thereby providing an advantage of reducing the number and the execution time of executed instructions.

Description

내포된 루프 구조를 포함하는 프로그램을 위한 컴파일 장치 및 방법과 이에 관한 기록매체{Compile Apparatus and Method for Program Include Nested Loop Structure, and Recording Medium Thereof}BACKGROUND OF THE INVENTION 1. Field of the Invention [0001] The present invention relates to a compiling apparatus and method for a program including a nested loop structure,

본 발명은 내포된 루프 구조를 포함하는 프로그램을 위한 컴파일 장치 및 방법과 이에 관한 기록매체에 관한 것이다.The present invention relates to a compiling apparatus and method for a program including a nested loop structure, and a recording medium therefor.

루프(loop) 구조를 포함하는 프로그램은, 동형의 연산을 반복해서 수행하게 될 때 주로 사용하게 되는 구조이다.A program including a loop structure is a structure that is mainly used when it is required to perform the same operation repeatedly.

하나의 마이크로프로세서에서 여러 개의 연산 유닛을 동시에 사용할 수 있는 경우, 루프 구조를 포함하는 프로그램을 보다 빠르게 처리하기 위하여 벡터화 기법(Vectorization method)이 사용된다.When multiple computing units can be used simultaneously in a microprocessor, a vectorization method is used to process a program containing a loop structure more quickly.

그런데, 내포된 루프 구조를 포함하는 프로그램, 즉 하나의 루프 구조 안에 하나이상의 루프가 더 포함된 프로그램의 경우에는, 벡터화 기법을 사용하기가 어려운 문제점이 있다.However, in the case of a program including an embedded loop structure, that is, a program including one or more loops in one loop structure, there is a problem that it is difficult to use the vectorization technique.

상기한 바와 같은 종래기술의 문제점을 해결하기 위해, 본 발명은 내포된 루프 구조를 포함하는 프로그램에 벡터화 기법을 적용하여 실행 명령어의 개수 및 실행 시간을 감소시킬 수 있는 내포된 루프 구조를 포함하는 프로그램을 위한 컴파일 장치 및 방법과 이에 관한 기록매체를 제공한다.In order to solve the problems of the conventional art as described above, the present invention provides a program including a nested loop structure capable of reducing the number of execution instructions and execution time by applying a vectorization technique to a program including a nested loop structure And a recording medium therefor.

상기한 목적을 달성하기 위해 본 발명의 바람직한 실시예에 따르면, 내포된 루프 구조를 포함하는 프로그램을 단일 루프 구조로 변환하기 위한 컴파일 장치로서, 상기 내포된 루프 구조를 포함하는 프로그램의 모든 루프 구조를 해제하는 루프 해제부; 상기 루프 구조가 해제된 프로그램 중 동형의 연산이 수행되는 명령어들을 분류하는 동형 연산 분류부; 상기 동형의 연산이 수행되는 명령어들을 다수의 그룹으로 묶는 그룹화를 수행하고, 각 그룹을 벡터로 변환하는 벡터 변환부; 및 상기 변환된 벡터를 이용하여 상기 내포된 루프 구조를 포함하는 프로그램을 단일 루프 구조로 변환하는 루프 변환부를 포함하는 것을 특징으로 하는 내포된 루프 구조를 포함하는 프로그램을 위한 컴파일 장치가 제공된다.In order to accomplish the above object, according to a preferred embodiment of the present invention, there is provided a compiling apparatus for converting a program including a nested loop structure into a single loop structure, A loop releasing part for releasing the loop; A homomorphic operation classifying unit for classifying the instructions for which the same type of operation is performed among the programs whose loop structure is released; A vector conversion unit for grouping the instructions for performing the same operation into a plurality of groups and converting the groups into vectors; And a loop transformer for transforming the program including the nested loop structure into a single loop structure using the transformed vector. The apparatus for compiling for a program including an embedded loop structure is provided.

상기 동형 연산 분류부는, 각 명령어가 저장 명령어를 기준으로 분류된 저장 그룹 지도를 이용하여 동형의 연산이 수행되는 명령어들을 분류하는 것을 특징으로 한다.The isomorphism classifying unit classifies the instructions for which the same operation is performed using the storage group map in which each instruction is classified based on the storage instruction word.

상기 내포된 루프 구조를 포함하는 프로그램의 루프 내부에 조건문이 포함되는 경우, 선형화 작업을 수행하는 선형화부를 더 포함하는 것을 특징으로 한다.And a linearization unit for performing a linearization operation when a conditional statement is included in a loop of a program including the nested loop structure.

상기 루프 구조가 해제된 프로그램의 반복되는 명령어들을 통합하여 먼저 실행되도록 최적화하는 최적화부를 더 포함하는 것을 특징으로 한다.And an optimization unit for optimizing the loop structure to be executed first by integrating repeated instructions of the released program.

또한, 본 발명의 다른 실시예에 따르면, 내포된 루프 구조를 포함하는 프로그램을 단일 루프 구조로 변환하기 위한 컴파일 방법으로서, (a)상기 내포된 루프 구조를 포함하는 프로그램의 모든 루프 구조를 해제하는 단계; (b)상기 루프 구조가 해제된 프로그램 중 동형의 연산이 수행되는 명령어들을 분류하는 단계; (c)상기 동형의 연산이 수행되는 명령어들을 다수의 그룹으로 묶는 그룹화를 수행하고, 각 그룹을 벡터로 변환하는 단계; 및 (d)상기 변환된 벡터를 이용하여 상기 내포된 루프 구조를 포함하는 프로그램을 단일 루프 구조로 변환하는 단계를 포함하는 것을 특징으로 하는 내포된 루프 구조를 포함하는 프로그램을 위한 컴파일 방법이 제공된다.According to another embodiment of the present invention, there is provided a compiling method for converting a program including a nested loop structure into a single loop structure, comprising the steps of: (a) releasing all loop structures of a program including the nested loop structure step; (b) classifying instructions among the programs for which the loop structure has been released to perform operations of the same type; (c) performing a grouping operation of grouping the instructions for which the same operation is performed into a plurality of groups, and converting each group into a vector; And (d) converting the program including the nested loop structure into a single loop structure using the transformed vector. A method of compiling for a program including a nested loop structure is provided .

상기 (b)단계는, 각 명령어가 저장 명령어를 기준으로 분류된 저장 그룹 지도를 이용하여 동형의 연산이 수행되는 명령어들을 분류하는 것을 특징으로 한다.The step (b) classifies the instructions for which the same type of operation is performed by using a storage group map in which each instruction is classified based on a storage instruction word.

상기 (a)단계 이전에, (a1)상기 내포된 루프 구조를 포함하는 프로그램의 루프 내부에 조건문이 포함되는 경우, 선형화 작업을 수행하는 단계를 더 포함하는 것을 특징으로 한다.The method may further include, before the step (a), (a1) performing a linearization operation when a conditional statement is included in a loop of a program including the embedded loop structure.

상기 (a)단계 이후에, (a2)상기 루프 구조가 해제된 프로그램의 반복되는 명령어들을 통합하여 먼저 실행되도록 최적화하는 단계를 더 포함하는 것을 특징으로 한다.Further comprising the step of: (a2) after the step (a2), optimizing the loop structure to be executed first by integrating repeated instructions of the released program.

또한, 본 발명의 또다른 실시예에 따르면, 상기의 내포된 루프 구조를 포함하는 프로그램을 위한 컴파일 방법을 수행하는 프로그램이 기록된 컴퓨터 판독 가능한 기록매체가 제공된다.According to still another embodiment of the present invention, there is provided a computer-readable recording medium on which a program for performing a compiling method for a program including the embedded loop structure is recorded.

본 발명은 내포된 루프 구조를 포함하는 프로그램에 벡터화 기법을 적용하여 실행 명령어의 개수 및 실행 시간을 감소시킬 수 있는 장점이 있다.The present invention is advantageous in that the number of execution instructions and the execution time can be reduced by applying a vectorization technique to a program including a nested loop structure.

도 1은 벡터화 기법을 설명하기 위한 도면이다.
도 2는 본 발명의 바람직한 일 실시예에 따른 내포된 루프 구조를 포함하는 프로그램을 위한 컴파일 장치의 컴파일 과정을 설명하기 위한 도면이다.
도 3은 본 발명의 바람직한 일 실시예에 따른 내포된 루프 구조를 포함하는 프로그램을 위한 컴파일 장치의 구조도이다.
도 4는 본 발명의 바람직한 일 실시예에 따른 선형화 작업을 예시한 도면이다.
도 5는 본 발명의 바람직한 일 실시예에 따른 명령어와 저장 명령어를 예시한 도면이다.
도 6은 본 발명의 바람직한 일 실시예에 따른 저장 명령 지도 및 저장 그룹 지도를 예시한 도면이다.
도 7은 본 발명의 바람직한 일 실시예에 따라 분류된 동형 연산을 예시한 도면이다.
도 8은 본 발명의 바람직한 일 실시예에 따른 내포된 루프 구조를 포함하는 프로그램을 위한 컴파일 방법을 도시한 순서도이다.
1 is a diagram for explaining a vectorization technique.
2 is a diagram for explaining a compiling process of a compiling apparatus for a program including a nested loop structure according to a preferred embodiment of the present invention.
3 is a structural diagram of a compiling apparatus for a program including a nested loop structure according to a preferred embodiment of the present invention.
4 is a diagram illustrating a linearization operation according to a preferred embodiment of the present invention.
5 is a diagram illustrating an instruction word and a storage instruction word according to a preferred embodiment of the present invention.
FIG. 6 is a diagram illustrating a storage instruction map and a storage group map according to a preferred embodiment of the present invention.
7 is a diagram illustrating an isomorphous operation classified according to a preferred embodiment of the present invention.
8 is a flowchart showing a compiling method for a program including a nested loop structure according to a preferred embodiment of the present invention.

본 발명은 다양한 변경을 가할 수 있고 여러 가지 실시예를 가질 수 있는 바, 특정 실시예들을 도면에 예시하고 상세한 설명에 자세히 설명하고자 한다. 그러나, 이는 본 발명을 특정한 실시 형태에 대해 한정하려는 것이 아니며, 본 발명의 사상 및 기술 범위에 포함되는 모든 변경, 균등물 내지 대체물을 포함하는 것으로 이해되어야 한다. 각 도면을 설명하면서 유사한 참조부호를 유사한 구성요소에 대해 사용하였다. While the invention is susceptible to various modifications and alternative forms, specific embodiments thereof are shown by way of example in the drawings and will herein be described in detail. It should be understood, however, that the invention is not intended to be limited to the particular embodiments, but includes all modifications, equivalents, and alternatives falling within the spirit and scope of the invention. Like reference numerals are used for like elements in describing each drawing.

제1, 제2 등의 용어는 다양한 구성요소들을 설명하는데 사용될 수 있지만, 상기 구성요소들은 상기 용어들에 의해 한정되어서는 안 된다. 상기 용어들은 하나의 구성요소를 다른 구성요소로부터 구별하는 목적으로만 사용된다. 예를 들어, 본 발명의 권리 범위를 벗어나지 않으면서 제1 구성요소는 제2 구성요소로 명명될 수 있고, 유사하게 제2 구성요소도 제1 구성요소로 명명될 수 있다. 이하에서, 본 발명에 따른 실시예들을 첨부된 도면을 참조하여 상세하게 설명한다.The terms first, second, etc. may be used to describe various components, but the components should not be limited by the terms. The terms are used only for the purpose of distinguishing one component from another. For example, without departing from the scope of the present invention, the first component may be referred to as a second component, and similarly, the second component may also be referred to as a first component. Hereinafter, embodiments according to the present invention will be described in detail with reference to the accompanying drawings.

루프(loop) 구조는 프로그램 알고리즘에서 동형의 연산을 반복해서 수행하게 될 때 주로 사용하게 되는 구조이다. 일반적으로, 어떠한 조건이 만족될 때까지 변수를 변경해가며 명령어들을 반복 실행시키게 된다.A loop structure is a structure that is mainly used when a program algorithm performs repetitive operations of the same type. Generally, you change the variable until the condition is satisfied, and it executes the commands repeatedly.

하나의 마이크로프로세서에서 여러 개의 연산 유닛을 동시에 사용할 수 있는 경우, 전술한 루프 구조를 벡터화하는 벡터화 기법(Vectorization method)을 사용하여 데이터를 처리하게 된다.When a plurality of operation units can be used simultaneously in one microprocessor, the data is processed using a vectorization method for vectorizing the loop structure described above.

도 1은 벡터화 기법을 설명하기 위한 도면이다.1 is a diagram for explaining a vectorization technique.

도 1을 참조하면, 32비트의 각각의 피연산자 변수(int a1 ~ int a4, int b1 ~ int b4)에 대해 동형의 덧셈 연산을 4번 수행해야 하는 경우에, 벡터화 기법을 사용하면 128비트의 피연산자(m128ia, m128ib)를 이용하여 한 번의 연산만으로 처리할 수 있게 된다.Referring to FIG. 1, when it is necessary to perform the same addition operation four times for each of the 32-bit operand variables (int a 1 to int a 4 , int b 1 to int b 4 ), using the vectorization technique It is possible to process only one operation using the 128-bit operand (m128ia, m128ib).

그러나 이러한 방법은 단일 루프 구조에만 사용 가능하며, 프로그램이 내포된 루프 구조를 가질 경우, 즉 하나의 루프 구조 내부에 또다른 루프 구조가 하나 이상 존재하는 경우에는 벡터화 기법을 사용하여 연산을 수행하기가 어려웠다.However, this method can be used only for a single loop structure. In the case where a program has a loop structure embedded therein, that is, one or more loop structures exist within one loop structure, It was difficult.

본 발명은, 내포된 루프 구조를 포함하는 프로그램에서도 벡터화 기법을 사용하여 연산 과정을 최소화할 수 있는 내포된 루프 구조를 포함하는 프로그램을 위한 컴파일 장치를 제안한다.The present invention proposes a compiling apparatus for a program including a nested loop structure that can minimize a computation process using a vectorization technique even in a program including a nested loop structure.

도 2는 본 발명의 바람직한 일 실시예에 따른 내포된 루프 구조를 포함하는 프로그램을 위한 컴파일 장치의 컴파일 과정을 설명하기 위한 도면이다.2 is a diagram for explaining a compiling process of a compiling apparatus for a program including a nested loop structure according to a preferred embodiment of the present invention.

도 3은 본 발명의 바람직한 일 실시예에 따른 내포된 루프 구조를 포함하는 프로그램을 위한 컴파일 장치의 구조도이다.3 is a structural diagram of a compiling apparatus for a program including a nested loop structure according to a preferred embodiment of the present invention.

도 3을 참조하면, 본 발명의 바람직한 일 실시예에 따른 내포된 루프 구조를 포함하는 프로그램을 위한 컴파일 장치는 선형화부(110), 루프 해제부(120), 최적화부(130), 동형 연산 분류부(140), 벡터 변환부(150) 및 루프 변환부(160)를 포함할 수 있다.3, a compiling apparatus for a program including a nested loop structure according to a preferred embodiment of the present invention includes a linearizer 110, a loop canceler 120, an optimizer 130, A transform unit 140, a vector transform unit 150, and a loop transform unit 160.

선형화부(110)는 프로그램의 루프 구조 내부에 가지 명령어(branch instruction), 즉 조건문에 따른 연산이 포함된 경우, 직접적으로 벡터화 기법을 적용하기 어려우므로, 먼저 선형화 작업을 수행할 수 있다.If the linearization unit 110 includes a branch instruction, that is, an operation according to a conditional statement, within the loop structure of the program, it is difficult to directly apply the vectorization technique, so that the linearization operation can be performed first.

도 2를 참조하면, 선형화부(110)는 도 2의 (a)는 내포된 루프 구조를 포함하는 프로그램에 선형화 작업을 수행하여 도 2의 (b)와 같은 상태로 변환할 수 있다.Referring to FIG. 2, the linearization unit 110 may convert a state of FIG. 2 (a) into a state of FIG. 2 (b) by performing a linearization operation on a program including a nested loop structure.

도 4는 본 발명의 바람직한 일 실시예에 따른 선형화 작업을 예시한 도면이다.4 is a diagram illustrating a linearization operation according to a preferred embodiment of the present invention.

도 4의 (a)를 참조하면, 프로그램의 루프 구조 내부에 조건문에 따른 연산이 포함되어 있다. 선형화부(110)는 도 4의 (a)와 같은 프로그램을 도 4의 (b)와 같이 선형화함으로 선형화 작업을 수행할 수 있다.Referring to FIG. 4A, an operation according to a conditional statement is included in the loop structure of the program. The linearization unit 110 can perform a linearization operation by linearizing the program as shown in FIG. 4 (a) as shown in FIG. 4 (b).

루프 해제부(120)는 내포된 루프 구조를 포함하는 프로그램의 모든 루프 구조를 해제한다. 이러한 과정을 Unroll 이라고도 한다.The loop release unit 120 releases all the loop structures of the program including the nested loop structure. This process is also called Unroll.

도 2를 참조하면, 루프 해제부(120)는 선형화 작업이 완료된 도 2의 (b)를 도 2의 (c)와 같은 상태로 변환함으로 루프 구조를 해제하는 작업을 수행하게 된다. 즉, 루프 해제부(120)는 루프 구조로 단순화된 프로그램을 해체하여 실제 실행되는 연산들을 나열할 수 있다.Referring to FIG. 2, the loop release unit 120 performs an operation of releasing the loop structure by converting the state of FIG. 2 (b) in which the linearization operation is completed to the state of FIG. 2 (c). That is, the loop cancellation unit 120 can disassemble the simplified program into a loop structure to list operations that are actually executed.

최적화부(130)는 도 2의 (c)에 나열된 연산들 중, 중복되는 연산 명령어들은 실행과정 초기에 수행되도록 도 2의 (d)와 같이 변환하므로 최적화 작업을 수행할 수 있다. 일례로, 중복되는 연산 명령어에는 상수값 선언과 같은 연산이 포함될 수 있다. 최적화 작업을 거치면, 프로그램에서 사용되는 실행 명령어가 감소하게 될 수 있다.The optimization unit 130 may perform the optimization operation because the redundant operation instructions among the operations listed in FIG. 2 (c) are transformed as shown in FIG. 2 (d) so as to be performed at the beginning of the execution process. For example, a duplicate operation instruction may include an operation such as a constant value declaration. After optimization, the execution instructions used in the program may be reduced.

동형 연산 분류부(140)는 루프가 해제된 프로그램에서 벡터화가 가능한 연산, 즉 동형 연산을 분류할 수 있다.The homomorphic operation classifying unit 140 can classify an operation that can be vectorized in the program in which the loop is released, that is, the homomorphic operation.

일례로, 동형 연산 분류부(140)는 저장 명령 지도(store instruction map) 및 저장 그룹 지도(store group map)를 이용하여 동형 연산을 분류할 수 있다.For example, the isomorphic operation classifier 140 may classify an isomorphic operation using a store instruction map and a store group map.

저장 명령 지도 및 저장 그룹 지도는 각 명령어(instruction)를 저장 명령어(store)에 따라 분류하는 방법이다.A storage instruction map and a storage group map are methods of classifying each instruction according to a store instruction.

도 5는 본 발명의 바람직한 일 실시예에 따른 명령어와 저장 명령어를 예시한 도면이다.5 is a diagram illustrating an instruction word and a storage instruction word according to a preferred embodiment of the present invention.

도 5를 참조하면, 도 5의 (a)는 명령어들을 예시하고 있고, 도 5의 (b)는 저장 명령어들을 예시하고 있다. 즉, 명령어는 저장 명령어를 포함한 모든 명령어들을 의미할 수 있다.Referring to FIG. 5, FIG. 5 (a) illustrates the instructions, and FIG. 5 (b) illustrates the store instructions. That is, an instruction may refer to all instructions including a store instruction.

일반적으로, 각 명령어들이 순차적으로 수행될 때, 마지막에는 저장 명령어가 수행된다. 그러므로, 저장 명령 지도(store instruction map) 및 저장 그룹 지도(store group map)를 이용하여 저장 명령어를 기준으로 연산을 분류하면 벡터화 기법을 수행하기 용이할 수 있다.In general, when each instruction is executed sequentially, the store instruction is executed at the end. Therefore, it is easy to perform the vectorization technique by classifying the operations based on the store instruction word using the store instruction map and the store group map.

도 6은 본 발명의 바람직한 일 실시예에 따른 저장 명령 지도 및 저장 그룹 지도를 예시한 도면이다. 보다 자세하게, 도 6의 (a)는 저장 명령 지도를 예시한 도면이고, 도 6의 (b)는 저장 그룹 지도를 예시한 도면이다.FIG. 6 is a diagram illustrating a storage instruction map and a storage group map according to a preferred embodiment of the present invention. More specifically, FIG. 6A is a diagram illustrating a storage instruction map, and FIG. 6B is a diagram illustrating a storage group map.

도 6의 (a)를 참조하면, 저장 명령 지도는 각 명령어들이 어느 저장 명령어와 연결되는지를 나타낸 지도이다. 한편, 도 6의 (b)를 참조하면, 저장 그룹 지도는 각 저장 명령어에 연결된 모든 명령어들을 나타낸 지도이다.Referring to FIG. 6A, a storage instruction map is a map showing which storage instruction each instruction is connected to. Meanwhile, referring to FIG. 6B, the storage group map is a map showing all the commands associated with each storage command.

그러므로, 동형 연산 분류부(140)는 저장 명령 지도 및 저장 그룹 지도를 이용하여 벡터화가 가능한 동형 연산을 분류할 수 있다.Therefore, the isomorphization classifier 140 can classify isomorphisms that can be vectorized using a storage instruction map and a storage group map.

도 7은 본 발명의 바람직한 일 실시예에 따라 분류된 동형 연산을 예시한 도면이다.7 is a diagram illustrating an isomorphous operation classified according to a preferred embodiment of the present invention.

도 7을 참조하면, 연관된 명령어들은 실행 순서에 따라 화살표로 연결되도록 표시되었고, 각 명령어들 중 저장 명령어는 붉은색 외곽선으로 표시되었으며, 벡터화가 가능한 동형의 연산들은 노란색 외곽선으로 표시되었고, 벡터화가 불가능한 연산은 검은색 외곽선으로 표시되었다.Referring to FIG. 7, the associated instructions are displayed so as to be connected by an arrow according to the execution order. Among the instructions, the stored instructions are indicated by a red outline. Equivalent operations that can be vectorized are indicated by a yellow outline, The operation is marked with a black outline.

즉, 동형 연산 분류부(140)는 프로그램을 도 2의 (d)상태에서 저장 명령 지도 및 저장 그룹 지도를 이용하여 동형의 연산을 분류해 내므로, 도 2의 (e)와 같은 상태로 변환할 수 있다.In other words, the same operation classification unit 140 classifies the program into the same type of operation using the storage instruction map and the storage group map in the state (d) of FIG. 2, can do.

벡터 변환부(160)는 분류된 동형의 연산들을 벡터화 기법을 이용하여 동시에 연산할 수 있도록 동시에 연산할 연산의 개수에 따라 그룹화를 수행할 수 있다. 일례로, 32 비트의 데이터에 대한 연산을 수행할 때, 128 비트의 폭을 가진 시스템을 이용한다면, 4개의 동형 연산을 하나의 그룹으로 그룹화할 수 있다.The vector conversion unit 160 may perform grouping according to the number of operations to be simultaneously computed so that the classified identical operations can be simultaneously computed using the vectorization technique. For example, when performing an operation on 32-bit data, if a system having a width of 128 bits is used, four isomorphous operations can be grouped into one group.

도 2의 (f)는 도 2의 (e)의 프로그램이 벡터 변환부에 의해 그룹화가 수행된 상태를 나타낸다.Fig. 2 (f) shows a state in which the program of Fig. 2 (e) is grouped by the vector conversion unit.

루프 변환부(170)는 도 2의 (f) 상태의 프로그램을 단일 루프 구조를 포함하는 도 2의 (g) 상태로 변환할 수 있다.The loop conversion unit 170 can convert the program in the state (f) in Fig. 2 into the state in Fig. 2 (g) including the single loop structure.

도 2의 (f)상태의 프로그램은 루프 구조가 해체된 상태로 사이즈가 필요 이상으로 크므로, 루프 변환부(170)는 단일 루프 구조를 갖도록 프로그램을 도 2의 (g)와 같이 변환할 수 있다.Since the size of the program in the state (f) of FIG. 2 is larger than necessary in a state where the loop structure is disassembled, the loop conversion unit 170 can convert the program as shown in FIG. 2 (g) have.

전술한 바와 같이, 본 발명의 바람직한 일 실시예에 따른 내포된 루프 구조를 포함하는 프로그램을 위한 컴파일 장치는 도 2의 (a)와 같은 내포된 루프 구조를 포함하는 프로그램을 도 2의 (g)와 같은 단일 루프 구조로 변환하므로, 결과적으로 실행 명령어의 수를 감소시킬 수 있을 뿐만 아니라 실행 시간 또한 감소될 수 있다.As described above, a compiling apparatus for a program including a nested loop structure according to a preferred embodiment of the present invention includes a program including the nested loop structure as shown in Fig. 2 (a) Such that the number of execution instructions can be reduced and the execution time can be reduced as well.

도 8은 본 발명의 바람직한 일 실시예에 따른 내포된 루프 구조를 포함하는 프로그램을 위한 컴파일 방법을 도시한 순서도이다.8 is a flowchart showing a compiling method for a program including a nested loop structure according to a preferred embodiment of the present invention.

도 8을 참조하면, 본 발명의 바람직한 일 실시예에 따른 내포된 루프 구조를 포함하는 프로그램을 위한 컴파일 방법은 선형화 단계(S810), 루프 해제 단계(S820), 최적화 단계(S830), 동형 연산 분류 단계(S840), 벡터 변환 단계(S850) 및 루프 변환 단계(S860)를 포함할 수 있다.8, a compilation method for a program including a nested loop structure according to a preferred embodiment of the present invention includes a linearization step S810, a loop release step S820, an optimization step S830, Step S840, vector transformation step S850, and loop transformation step S860.

선형화 단계(S810)는 선형화부(110)가 선형화 작업을 수행하는 단계이다.The linearization step S810 is a step in which the linearization unit 110 performs a linearization operation.

루프 해제 단계(S820)는 루프 해제부(120)가 루프 구조를 해제하는 단계이다.The loop release step S820 is a step in which the loop release unit 120 releases the loop structure.

최적화 단계(S830)는 최적화부(130)가 최적화 작업을 수행하는 단계이다.The optimizing step S830 is a step in which the optimizing unit 130 performs optimization.

동형 연산 분류 단계(S840)는 동형 연산 분류부(140)가 동형 연산을 분류하는 단계이다.The homogeneous operation classification step S840 is a step in which the homogeneous operation classification unit 140 classifies homogeneous operations.

벡터 변환 단계(S850)는 벡터 변환부(150)가 그룹화를 수행하는 단계이다.The vector conversion step S850 is a step in which the vector conversion unit 150 performs grouping.

루프 변환 단계(S860)는 루프 변환부(160)가 프로그램을 단일 루프 구조로 변환하는 단계이다.The loop conversion step S860 is a step in which the loop conversion unit 160 converts the program into a single loop structure.

앞서 설명한 기술적 내용들은 다양한 컴퓨터 수단을 통하여 수행될 수 있는 프로그램 명령 형태로 구현되어 컴퓨터 판독 가능 매체에 기록될 수 있다. 상기 컴퓨터 판독 가능 매체는 프로그램 명령, 데이터 파일, 데이터 구조 등을 단독으로 또는 조합하여 포함할 수 있다. 상기 매체에 기록되는 프로그램 명령은 실시예들을 위하여 특별히 설계되고 구성된 것들이거나 컴퓨터 소프트웨어 당업자에게 공지되어 사용 가능한 것일 수도 있다. 컴퓨터 판독 가능 기록 매체의 예에는 하드 디스크, 플로피 디스크 및 자기 테이프와 같은 자기 매체(magnetic media), CD-ROM, DVD와 같은 광기록 매체(optical media), 플롭티컬 디스크(floptical disk)와 같은 자기-광 매체(magneto-optical media), 및 롬(ROM), 램(RAM), 플래시 메모리 등과 같은 프로그램 명령을 저장하고 수행하도록 특별히 구성된 하드웨어 장치가 포함된다. 프로그램 명령의 예에는 컴파일러에 의해 만들어지는 것과 같은 기계어 코드뿐만 아니라 인터프리터 등을 사용해서 컴퓨터에 의해서 실행될 수 있는 고급 언어 코드를 포함한다. 하드웨어 장치는 실시예들의 동작을 수행하기 위해 하나 이상의 소프트웨어 모듈로서 작동하도록 구성될 수 있으며, 그 역도 마찬가지이다.The above-described technical features may be implemented in the form of program instructions that can be executed through various computer means and recorded in a computer-readable medium. The computer-readable medium may include program instructions, data files, data structures, and the like, alone or in combination. The program instructions recorded on the medium may be those specially designed and constructed for the embodiments or may be available to those skilled in the art of computer software. Examples of computer-readable media include magnetic media such as hard disks, floppy disks and magnetic tape; optical media such as CD-ROMs and DVDs; magnetic media such as floppy disks; Magneto-optical media, and hardware devices specifically configured to store and execute program instructions such as ROM, RAM, flash memory, and the like. Examples of program instructions include machine language code such as those produced by a compiler, as well as high-level language code that can be executed by a computer using an interpreter or the like. The hardware device may be configured to operate as one or more software modules to perform the operations of the embodiments, and vice versa.

이상과 같이 본 발명에서는 구체적인 구성 요소 등과 같은 특정 사항들과 한정된 실시예 및 도면에 의해 설명되었으나 이는 본 발명의 보다 전반적인 이해를 돕기 위해서 제공된 것일 뿐, 본 발명은 상기의 실시예에 한정되는 것은 아니며, 본 발명이 속하는 분야에서 통상적인 지식을 가진 자라면 이러한 기재로부터 다양한 수정 및 변형이 가능하다는 것을 이해할 것이다. 따라서, 본 발명의 사상은 설명된 실시예에 국한되어 정해져서는 아니되며, 후술하는 특허청구범위뿐 아니라 이 특허청구범위와 균등하거나 등가적 변형이 있는 모든 것들은 본 발명 사상의 범주에 속한다고 할 것이다.As described above, the present invention has been described with reference to particular embodiments, such as specific elements, and specific embodiments and drawings. However, it should be understood that the present invention is not limited to the above- Those skilled in the art will appreciate that various modifications and changes may be made thereto without departing from the scope of the present invention. Accordingly, the spirit of the present invention should not be construed as being limited to the embodiments described, and all of the equivalents or equivalents of the claims, as well as the following claims, belong to the scope of the present invention .

110: 선형화부
120: 루프 해제부
130: 최적화부
140: 도형 연산 분류부
150: 벡터 변환부
160: 루프 변환부
110: linearization unit
120: Loop release section
130:
140: Graphic operation classification unit
150: vector conversion unit
160:

Claims (9)

내포된 루프 구조를 포함하는 프로그램을 단일 루프 구조로 변환하기 위한 컴파일 장치로서,
상기 내포된 루프 구조를 포함하는 프로그램의 모든 루프 구조를 해제하는 루프 해제부;
상기 루프 구조가 해제된 프로그램 중 동형의 연산이 수행되는 명령어들을 분류하는 동형 연산 분류부;
상기 동형의 연산이 수행되는 명령어들을 다수의 그룹으로 묶는 그룹화를 수행하고, 각 그룹을 벡터로 변환하는 벡터 변환부; 및
상기 변환된 벡터를 이용하여 상기 내포된 루프 구조를 포함하는 프로그램을 단일 루프 구조로 변환하는 루프 변환부를 포함하는 것을 특징으로 하는 내포된 루프 구조를 포함하는 프로그램을 위한 컴파일 장치.
1. A compiling device for converting a program including a nested loop structure into a single loop structure,
A loop release unit for releasing all loop structures of a program including the nested loop structure;
A homomorphic operation classifying unit for classifying the instructions for which the same type of operation is performed among the programs whose loop structure is released;
A vector conversion unit for grouping the instructions for performing the same operation into a plurality of groups and converting the groups into vectors; And
And a loop transformer for transforming the program including the nested loop structure into a single loop structure using the transformed vector.
제1항에 있어서,
상기 동형 연산 분류부는,
각 명령어가 저장 명령어를 기준으로 분류된 저장 그룹 지도를 이용하여 동형의 연산이 수행되는 명령어들을 분류하는 것을 특징으로 하는 내포된 루프 구조를 포함하는 프로그램을 위한 컴파일 장치.
The method according to claim 1,
The isomorphic operation classifying unit classifies,
Wherein the instructions are classified into instructions for which the same instruction is performed using the stored group map classified based on the stored instruction.
제1항에 있어서,
상기 내포된 루프 구조를 포함하는 프로그램의 루프 내부에 조건문이 포함되는 경우, 선형화 작업을 수행하는 선형화부를 더 포함하는 것을 특징으로 하는 내포된 루프 구조를 포함하는 프로그램을 위한 컴파일 장치.
The method according to claim 1,
Further comprising a linearization unit for performing a linearization operation when a conditional statement is included in a loop of a program including the nested loop structure.
제1항에 있어서,
상기 루프 구조가 해제된 프로그램의 반복되는 명령어들을 통합하여 먼저 실행되도록 최적화하는 최적화부를 더 포함하는 것을 특징으로 하는 내포된 루프 구조를 포함하는 프로그램을 위한 컴파일 장치.
The method according to claim 1,
Further comprising an optimizer for optimizing the loop structure to be executed first by integrating repeated instructions of the released program.
내포된 루프 구조를 포함하는 프로그램을 단일 루프 구조로 변환하기 위한 컴파일 방법으로서,
(a)상기 내포된 루프 구조를 포함하는 프로그램의 모든 루프 구조를 해제하는 단계;
(b)상기 루프 구조가 해제된 프로그램 중 동형의 연산이 수행되는 명령어들을 분류하는 단계;
(c)상기 동형의 연산이 수행되는 명령어들을 다수의 그룹으로 묶는 그룹화를 수행하고, 각 그룹을 벡터로 변환하는 단계; 및
(d)상기 변환된 벡터를 이용하여 상기 내포된 루프 구조를 포함하는 프로그램을 단일 루프 구조로 변환하는 단계를 포함하는 것을 특징으로 하는 내포된 루프 구조를 포함하는 프로그램을 위한 컴파일 방법.
A compilation method for converting a program including a nested loop structure into a single loop structure,
(a) releasing all loop structures of a program including the nested loop structure;
(b) classifying instructions among the programs for which the loop structure has been released to perform operations of the same type;
(c) performing a grouping operation of grouping the instructions for which the same operation is performed into a plurality of groups, and converting each group into a vector; And
(d) converting the program including the nested loop structure into a single loop structure using the transformed vector. < Desc / Clms Page number 19 >
제5항에 있어서,
상기 (b)단계는,
각 명령어가 저장 명령어를 기준으로 분류된 저장 그룹 지도를 이용하여 동형의 연산이 수행되는 명령어들을 분류하는 것을 특징으로 하는 내포된 루프 구조를 포함하는 프로그램을 위한 컴파일 방법.
6. The method of claim 5,
The step (b)
Wherein the instructions are classified into instructions for which an instruction of the same type is performed using a storage group map classified based on a storage instruction word.
제5항에 있어서,
상기 (a)단계 이전에,
(a1)상기 내포된 루프 구조를 포함하는 프로그램의 루프 내부에 조건문이 포함되는 경우, 선형화 작업을 수행하는 단계를 더 포함하는 것을 특징으로 하는 내포된 루프 구조를 포함하는 프로그램을 위한 컴파일 방법.
6. The method of claim 5,
Before the step (a)
(a1) if the conditional statement is included in a loop of a program including the nested loop structure, performing a linearization operation.
제5항에 있어서,
상기 (a)단계 이후에,
(a2)상기 루프 구조가 해제된 프로그램의 반복되는 명령어들을 통합하여 먼저 실행되도록 최적화하는 단계를 더 포함하는 것을 특징으로 하는 내포된 루프 구조를 포함하는 프로그램을 위한 컴파일 방법.
6. The method of claim 5,
After the step (a)
(a2) optimizing the loop structure to be executed first by integrating the repeated instructions of the released program. < Desc / Clms Page number 13 >
제5항 내지 제8항 중 어느 한 항의 내포된 루프 구조를 포함하는 프로그램을 위한 컴파일 방법을 수행하는 프로그램이 기록된 컴퓨터 판독 가능한 기록매체.9. A computer-readable recording medium on which a program for performing a compiling method for a program including an embedded loop structure according to any one of claims 5 to 8 is recorded.
KR1020180008143A 2018-01-23 2018-01-23 Compile Apparatus and Method for Program Include Nested Loop Structure, and Recording Medium Thereof KR102051206B1 (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
KR1020180008143A KR102051206B1 (en) 2018-01-23 2018-01-23 Compile Apparatus and Method for Program Include Nested Loop Structure, and Recording Medium Thereof

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
KR1020180008143A KR102051206B1 (en) 2018-01-23 2018-01-23 Compile Apparatus and Method for Program Include Nested Loop Structure, and Recording Medium Thereof

Publications (2)

Publication Number Publication Date
KR20190089521A true KR20190089521A (en) 2019-07-31
KR102051206B1 KR102051206B1 (en) 2019-12-02

Family

ID=67473913

Family Applications (1)

Application Number Title Priority Date Filing Date
KR1020180008143A KR102051206B1 (en) 2018-01-23 2018-01-23 Compile Apparatus and Method for Program Include Nested Loop Structure, and Recording Medium Thereof

Country Status (1)

Country Link
KR (1) KR102051206B1 (en)

Citations (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US5742783A (en) * 1990-12-21 1998-04-21 Inmos Limited System for grouping instructions for multiple issue using plural decoders having forward and backward propagation of decoding information
US7945768B2 (en) * 2008-06-05 2011-05-17 Motorola Mobility, Inc. Method and apparatus for nested instruction looping using implicit predicates

Patent Citations (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US5742783A (en) * 1990-12-21 1998-04-21 Inmos Limited System for grouping instructions for multiple issue using plural decoders having forward and backward propagation of decoding information
US7945768B2 (en) * 2008-06-05 2011-05-17 Motorola Mobility, Inc. Method and apparatus for nested instruction looping using implicit predicates

Non-Patent Citations (1)

* Cited by examiner, † Cited by third party
Title
Darin S. Petkov, "Efficient Pipelining of Nested Loops: Unroll-and-Squash"(2001.02.)* *

Also Published As

Publication number Publication date
KR102051206B1 (en) 2019-12-02

Similar Documents

Publication Publication Date Title
US11048502B1 (en) Systems, devices, and methods for source code generation from binary files
JPH10228382A (en) Compiling system
US5067068A (en) Method for converting an iterative loop of a source program into parellelly executable object program portions
WO2017035748A1 (en) Code compiling method and code complier
US11693638B2 (en) Compiler program, compiling method, information processing device
US10346144B2 (en) Methods and apparatus to map single static assignment instructions onto a data flow graph in a data flow architecture
KR20190089521A (en) Compile Apparatus and Method for Program Include Nested Loop Structure, and Recording Medium Thereof
KR102520240B1 (en) Apparatus and method for data augmentation using non-negative matrix factorization
US9158511B2 (en) Scalable partial vectorization
Forster et al. Towards a library of formalised undecidable problems in Coq: The undecidability of intuitionistic linear logic
JP5843449B2 (en) Electronic circuit optimization method, electronic circuit optimization device, and program
JP2016170707A (en) Control program division apparatus, control program division method, computer program, and division source code production method
JP7513080B2 (en) Processing system and processing method
JP3196625B2 (en) Parallel compilation method
US20170249131A1 (en) Compilation apparatus and compiling method
US5437035A (en) Method and apparatus for compiling a program incending a do-statement
US10572233B2 (en) Vectorization device, vectorization method, and recording medium on which vectorization program is stored
JP6810380B2 (en) Source program conversion system, source program conversion method, and source program conversion program
WO2020066375A1 (en) Information processing device, information processing method, and program
WO2024195359A1 (en) Compiling devide, compiling method, and compiling program
JP5966801B2 (en) Language converter, program
US11829754B2 (en) Compile device, compile method, and non-transitory computer readable medium for increasing a speed of a program
Singh PyKaldi: A Kaldi Wrapper in Python
KR20240030078A (en) Blockchain smart contract vulnerability location detection method and device
JP2020135464A (en) Program conversion device, program conversion method, and program for program conversion

Legal Events

Date Code Title Description
A201 Request for examination
E902 Notification of reason for refusal
E701 Decision to grant or registration of patent right
GRNT Written decision to grant