WO2016114532A1 - 프로그램 컴파일 장치 및 프로그램 컴파일 방법 - Google Patents
프로그램 컴파일 장치 및 프로그램 컴파일 방법 Download PDFInfo
- Publication number
- WO2016114532A1 WO2016114532A1 PCT/KR2016/000228 KR2016000228W WO2016114532A1 WO 2016114532 A1 WO2016114532 A1 WO 2016114532A1 KR 2016000228 W KR2016000228 W KR 2016000228W WO 2016114532 A1 WO2016114532 A1 WO 2016114532A1
- Authority
- WO
- WIPO (PCT)
- Prior art keywords
- circuit
- unit circuit
- loop
- unit
- syntax
- Prior art date
Links
Images
Classifications
-
- G—PHYSICS
- G06—COMPUTING OR CALCULATING; COUNTING
- G06F—ELECTRIC DIGITAL DATA PROCESSING
- G06F9/00—Arrangements for program control, e.g. control units
- G06F9/06—Arrangements for program control, e.g. control units using stored programs, i.e. using an internal store of processing equipment to receive or retain programs
- G06F9/30—Arrangements for executing machine instructions, e.g. instruction decode
- G06F9/38—Concurrent instruction execution, e.g. pipeline or look ahead
Definitions
- the present invention relates to a program compilation device and a program compilation method, and more particularly, to an apparatus and method for compiling an OpenCL program for an FPGA.
- OpenCL Open Computing Language
- the OpenCL platform consists of a host processor and one or more compute devices connected to it.
- CUs compute units
- PEs processing elements
- the host processor corresponds to a CPU, and the operating system runs on the host processor.
- the computing device corresponds to a multicore CPU or accelerator (GPU, Intel Xeon Phi coprocessor, FPGA, etc.).
- the CPU becomes a host processor and the FPGA becomes a computing device.
- the FPGA processes several work items processed in the computing device in parallel according to the instructions of the host program executed in the CPU.
- a circuit corresponding to one work item is created, and then, using a pipelining technique, the circuit is divided into several pipeline stages, each of which is different from each other. There is a way to process work items at the same time.
- a plurality of circuits corresponding to one work item (hereinafter, referred to as “unit circuits” for convenience) may be manufactured, and different work items may be independently processed in each unit circuit.
- the number of work items that can be processed simultaneously in a unit circuit is reduced to the number of pipeline stages that execute the contents in the loop, not the total number of pipeline stages. As long as the pipeline stage of the loop is not terminated, the application is stalled without processing the work item, thereby decreasing the utilization of the FPGA.
- Korean Patent Laid-Open No. 10-2014-0097548 relates to a software library for a heterogeneous parallel processing platform.
- the library source code is compiled into an intermediate representation and distributed to the end user computing system.
- the CPU of the computer system compiles the intermediate representation of the library into binaries that run on the GPU, runs the host application that calls the kernel, and sends the kernel retrieved from the binaries to the GPU.
- the prior art document also does not solve the problem as described above.
- the background art described above is technical information that the inventors possess for the derivation of the present invention or acquired in the derivation process of the present invention, and is not necessarily a publicly known technique disclosed to the general public before the application of the present invention. .
- One embodiment of the present invention is to provide an apparatus and method for compiling an OpenCL program for an FPGA.
- an embodiment of the present invention has an object to minimize unnecessary circuitry.
- a program compilation device for compiling an OpenCL program, syntax for separating the OpenCL kernel into a statement before the loop, the statement inside the loop and the statement after the loop It may include a separation unit, a circuit generation unit for generating a circuit corresponding to each syntax, and a language generation unit for expressing the generated circuit in a hardware description language.
- a method of compiling an OpenCL program by a program compiling device comprising: separating an OpenCL kernel into a statement before a loop, a statement within a loop, and a statement after a loop, and generating a circuit corresponding to each statement. And expressing the generated circuit in a hardware description language.
- a computer-readable recording medium having recorded thereon a program for executing a program compilation method, wherein the program compilation method comprises: separating the OpenCL kernel into a statement before a loop, a statement inside a loop, and a statement after a loop.
- the method may include generating a circuit corresponding to each syntax, and expressing the generated circuit in a hardware description language.
- a computer program executed by a program compilation device and stored in a recording medium for performing a program compilation method may include: After the loop statement, the method may include separating into syntaxes, generating circuits corresponding to the syntaxes, and expressing the generated circuits in a hardware description language.
- an embodiment of the present invention is to provide an apparatus and method for compiling an OpenCL program for an FPGA.
- an embodiment of the present invention by using the FPGA to replicate more circuits for processing the loops included in the kernel called by the host program using OpenCL
- the performance bottleneck of the program by the loop can be reduced to prevent the performance degradation of the system.
- any one of the problem solving means of the present invention instead of copying the circuit for processing the content outside the loop for the OpenCL kernel containing the loop, the performance of the system by replicating more circuits for processing the loop Can increase.
- any one of the problem solving means of the present invention by minimizing unnecessary circuitry, it is possible to efficiently use the hardware of the FPGA, resulting in lower power consumption and higher performance.
- FIG. 1 is a block diagram of an OpenCL platform system according to an embodiment of the present invention.
- FIG. 2 is a block diagram illustrating a program compilation apparatus according to an embodiment of the present invention.
- FIG. 3 is a flowchart illustrating a program compilation method according to an embodiment of the present invention.
- 4 to 5 are exemplary views for explaining a program compilation method according to an embodiment of the present invention.
- FIG. 1 is a block diagram of an OpenCL platform system 100 according to an embodiment of the present invention.
- the OpenCL platform system 100 may execute an Open Computing Language (OpenCL) application.
- OpenCL Open Computing Language
- Such a system 100 may include a host processor 10 and one or more compute devices 20.
- the host processor 10 may correspond to a CPU
- the computing device 20 may be a multicore CPU or an accelerator (GPU, Intel Xeon Phi coprocessor, FPGA, etc.).
- the host processor 10 may execute an operating system, execute a host program constituting an OpenCL application, and control the calculation device 20 using OpenCL API functions according to the host program.
- the computing device 20 may be composed of one or more compute units (CUs) 21, and each computation unit may in turn be composed of one or more processing elements (PEs) 22.
- CUs compute units
- PEs processing elements
- the computing device 20 may have three types of memory, namely, a device memory 23, a local memory 24, and a private memory 25.
- the device memory 23 area is composed of global memory and constant memory, and can also be shared by all PEs 22, and the local memory 24 area can be independently assigned to each calculation unit 21,
- the private memory 25 area may be independently allocated to each PE 22.
- the computing device 20 executes the kernel of the OpenCL program by receiving a command of the host program, copies the data of the main memory 11 to the device memory 23, or vice versa. Data can be copied to the main memory 11.
- the OpenCL program constituting the OpenCL application is composed of a number of kernel functions, written in a language called OpenCL C similar to C, and may be executed in the computing device 20.
- the host program executed in the host processor 10 may define an N-dimensional index space called NDRange while giving a command to execute a kernel of the OpenCL program.
- each index of the NDRange may be referred to as a work item, and the work items may be classified into a unit called a work group.
- the computing device 20 may create a kernel instance that is a thread that executes a kernel function for each work item according to a kernel execution command.
- Each work group may each be executed in one or more calculation units 21 constituting the calculation device 20, and various work items included in each work group may be executed in the PE 22 of the calculation unit 21, respectively. .
- the calculation device 20 of the OpenCL platform system 100 is an FPGA
- an FPGA circuit capable of executing an OpenCL program should be implemented.
- an FPGA circuit that receives a kernel function of an OpenCL program, specifically an OpenCL program, as an input and executes parallel work items of the kernel function should be implemented.
- a circuit structure may be expressed in hardware description languages such as Verilog and VHDL, and the circuit structure of the FPGA may be used, which is called a logic synthesis.
- High-level synthesis consists of a process of creating a circuit structure by receiving a program written in a high-level language and applying a logic synthesis technology to change the circuit structure of the FPGA.
- the separated processes are conceptually separated and do not have to be clearly divided into two separate steps.
- high-level synthsis may be performed by a single piece of software.
- the hardware description language in the process of constructing the circuit structure is not a human-readable language such as Verilog or VHDL. It may be an intermediate representation.
- the program compilation device may be any component on the OpenCL platform system 100, and may also be a component located outside the OpenCL platform system 100.
- the host processor 10 will be described as being a program compilation device.
- FIG. 2 is a block diagram illustrating a program compilation device 20 according to an embodiment of the present invention.
- the program compilation apparatus 20 may include a graph generator 210 generating a control flow graph based on the OpenCL kernel.
- the graph generator 210 may represent all paths that the OpenCL kernel can traverse during execution as a control flow graph using graph notation.
- the program compilation device 20 may further include a syntax separation unit 220 for separating the OpenCL kernel into the syntax before the loop, the statement inside the loop and the statement after the loop.
- syntax separator 220 may search for a loop in the control flow graph generated by the graph generator 210, and accordingly, based on the loop, the syntax before the loop, the syntax within the loop, and the loop after the loop. Identify syntax
- the program compilation device 20 may further include a circuit generation unit 230 for generating a circuit corresponding to each of the syntax separated by the syntax separator 220.
- the circuit generation unit 230 may generate a first unit circuit corresponding to the syntax before the loop, a second unit circuit corresponding to the syntax in the loop, and a third unit circuit corresponding to the syntax after the loop.
- the circuit generation unit 230 duplicates the second unit circuit more than a predetermined number of times based on the FPGA capacity.
- the second unit circuit may be generated.
- the circuit generation unit 230 may additionally generate a first control circuit between the first unit circuit and the second unit circuit and combine the first unit circuit and the second unit circuit, respectively.
- the first control circuit may examine the first signal value indicating that a new work item may enter the second unit circuit, and if it is determined that the new work item may enter the second unit circuit, the first unit The calculation result calculated by the circuit may be transmitted to the second unit circuit together with the ID of the corresponding work item.
- the circuit generation unit 230 may additionally generate a second control circuit between the second unit circuit and the third unit circuit and combine it with each of the second unit circuit and the third unit circuit.
- the second control circuit may check a second signal value indicating a state in which the work item exits the loop and should continue to be executed in the third unit circuit, and if it is determined that the work item should exit from the second unit circuit, The calculation result calculated by the two unit circuit may be transmitted to the third unit circuit together with the ID of the corresponding work item.
- the program compilation device 20 may further include a language generator 240 for expressing a circuit generated by the circuit generator 230 in a hardware description language.
- ' ⁇ part' means that to perform certain roles, ' ⁇ part' Means software or a hardware component such as an FPGA or an ASIC, and can also be a CPU, GPU, or the like.
- ' ⁇ ' is not meant to be limited to software or hardware.
- ' ⁇ Portion' may be configured to be in an addressable storage medium or may be configured to play one or more processors.
- ' ⁇ ' means components such as software components, object-oriented software components, class components, and task components, and processes, functions, properties, procedures, and the like. Subroutines, segments of program patent code, drivers, firmware, microcode, circuits, data, databases, data structures, tables, arrays, and variables.
- the functionality provided within the components and 'parts' may be combined into a smaller number of components and 'parts' or separated from additional components and 'parts'.
- components and ' ⁇ ' may be implemented to play one or more CPUs in the device or secure multimedia card.
- FIG. 3 is a flowchart illustrating a program compilation method according to an embodiment of the present invention.
- the program compilation method according to the embodiment shown in FIG. 3 includes steps processed in time series by the program compilation device 10 shown in FIG. 2. Therefore, even if omitted below, the above descriptions of the program compilation device 10 shown in FIG. 2 may be applied to the program compilation method according to the embodiment shown in FIG. 3.
- FIGS. 4 and 5 are each an exemplary view for explaining a program compilation method according to an embodiment of the present invention
- Figure 4 is an illustration of an FPGA implementing an OpenCL kernel including a loop statement according to an embodiment of the present invention
- 5 is an exemplary diagram of an FPGA implementing an OpenCL kernel including a plurality of loops according to an embodiment of the present invention.
- the program compilation device 10 may separate the OpenCL kernel into a loop 40 before, a half wood 41, and a loop 42 (S310).
- the program compilation device 10 may generate a control flow graph (CFG) from the OpenCL kernel, and may search for loops and separate the kernel using the generated control flow graph.
- CFG control flow graph
- the program compilation device 10 may generate a circuit structure for each part of the separated kernel (S320).
- the loop 40 before the OpenCL kernel may be implemented as one first unit circuit 43, and the loop 41 in the OpenCL kernel may be implemented as three second unit circuits 44. After the loop statement of the OpenCL kernel 42, the third unit circuit 45 may be implemented.
- the first to third unit circuits 43, 44, and 45 may simultaneously execute a plurality of work items using a pipelining technique.
- each of the first to third unit circuits illustrated in FIG. 4 is assumed to have two pipeline stages, according to another exemplary embodiment, at least one pipeline stage of the unit circuit may be implemented.
- each of the first to third unit circuits 43, 44, and 45 may be composed of multiple pipeline stages, and each pipeline stage may store an ID and a calculation result of a work item currently being executed in a register. Each time the clock cycle elapses, each pipeline stage can read the ID of the previous pipeline stage and the calculation result to perform calculations on the corresponding work item.
- the execution result of the last pipeline stage of the second unit circuit 44 may include the condition value of the loop statement, for example, if the value is true, the work item is the second unit circuit 44. It is run again from the first pipeline stage of.
- the work item exits the loop, so that the second unit circuit 44 finishes executing the new unit item in the first unit circuit 43. You can then run
- the first unit circuit 43 and the third unit circuit 45 may be made only one pair without duplicating, and the second unit circuit 44 may be duplicated as much as the FPGA capacity allows. Can be generated.
- the number of the first unit circuit 43 and the third unit circuit 45 is minimized and the number of the second unit circuits 44 is maximized. That can maximize the advantages of the present invention.
- the first unit circuit 43 before the loop, the second unit circuit 44 for the loop, and the third unit circuit 45 for the loop after the first to second control circuits 50 and 51 Each can be combined using (S330).
- the control circuits 50 and 51 to be executed may be located, and the first to third unit circuits 43, 44 and 45 may be coupled to the control circuits 50 and 51, respectively.
- the first unit circuit 43 and the second unit circuit 44 are coupled to each other by the first control circuit 50 one by one, and the second unit circuit 44 and the second unit circuit 44 are combined.
- the three unit circuit 45 may be coupled to many by one by the second control circuit 51.
- first to second control circuits 50 and 51 coupled to the first to third unit circuits 43, 44, and 45 may be implemented to operate as follows.
- the first control circuit 50 may receive a first signal indicating that a new work item can enter from the second unit circuit 44.
- the first signal may be, for example, 1 when the condition value is false and 0 when it is true, 0 when the second unit circuit 44 is stalled, and the second unit circuit. If the last pipeline stage of 44 is empty, the value of the first signal may be one.
- the first control circuit 50 may examine the first signal values of all the second unit circuits 44.
- the ID of the corresponding work item and the calculation result may be transmitted to the input of the second unit circuit 44 whose first signal has a value of 1 (that is, a new work item may be executed). If there are a plurality of second unit circuits 44 having the value of the first signal of 1, one of them may be selected in a predetermined order.
- the first control circuit 50 may send a stall signal to the first unit circuit 43 to pause execution of the work item.
- the second control circuit 51 may include a second control circuit 51 indicating that the work item of the last pipeline stage of the second unit circuit 44 exits from the loop. By receiving the two signals, the second signal values of all the second unit circuits 44 can be examined.
- the second control circuit 51 is associated with the work item ID of the last pipeline stage of the second unit circuit 44.
- the calculation result can be transmitted to the input of the third unit circuit 45, and if there are a plurality of second unit circuits 44 having a value of the second signal of 1, one of them can be selected in an arbitrary order.
- a stall signal may be sent to the remaining second unit circuits so as to pause.
- the second signal may be, for example, 1 when the condition value determined in the last pipeline stage of the second unit circuit 44 is false, or 0 when true, and the second unit circuit 44 may be stalled.
- the first signal becomes 0, while the second signal maintains its original value, and when the last pipeline stage of the second unit circuit is empty, the value of the second signal may be 0.
- FIG. 4 assumes that an OpenCL kernel includes one loop, but is not necessarily limited thereto.
- the loop may be divided into several parts based on each loop, and each part may be separated. May be implemented as a unit circuit.
- FIG. 5 is an exemplary diagram of an FPGA implementing an OpenCL kernel including a plurality of loops.
- an OpenCL kernel may be divided based on first to second loops, and before the first loop 500. Can be divided into a first loop (501) and a first loop (502), and also before the second loop (502) and after the second loop (504) based on another second loop (503).
- the control flow graph can be used to search for the first to second iterations and to isolate the kernel.
- program compilation device 10 implements each part divided in the same manner as the method described in step S320 in the FPGA circuit structure, and implements the unit circuits implemented in the step S320 in the first to fourth control circuits 505, 506, and 507. , 508, respectively.
- the program compilation device 10 may express the circuit structure generated in step S330 in a hardware description language (S340).
- the program compilation method according to the embodiment described with reference to FIG. 3 may also be implemented in the form of a recording medium including instructions executable by a computer, such as a program module executed by the computer.
- Computer readable media can be any available media that can be accessed by a computer and includes both volatile and nonvolatile media, removable and non-removable media.
- computer readable media may include both computer storage media and communication media.
- Computer storage media includes both volatile and nonvolatile, removable and non-removable media implemented in any method or technology for storage of information such as computer readable instructions, data structures, program modules or other data.
- Communication media typically includes computer readable instructions, data structures, program modules, or other data in a modulated data signal such as a carrier wave, or other transmission mechanism, and includes any information delivery media.
- the program compilation method may be implemented as a computer program (or computer program product) including instructions executable by a computer.
- the computer program includes programmable machine instructions processed by the processor and may be implemented in a high-level programming language, an object-oriented programming language, an assembly language, or a machine language.
- the computer program may also be recorded on tangible computer readable media (eg, memory, hard disks, magnetic / optical media or solid-state drives, etc.).
- the program compilation method may be implemented by executing the computer program as described above by the computing device.
- the computing device may include at least a portion of a processor, a memory, a storage device, a high speed interface connected to the memory and a high speed expansion port, and a low speed interface connected to the low speed bus and the storage device.
- a processor may include at least a portion of a processor, a memory, a storage device, a high speed interface connected to the memory and a high speed expansion port, and a low speed interface connected to the low speed bus and the storage device.
- Each of these components are connected to each other using a variety of buses and may be mounted on a common motherboard or otherwise mounted in a suitable manner.
- the processor may process instructions within the computing device, such as to display graphical information for providing a graphical user interface (GUI) on an external input, output device, such as a display connected to a high speed interface. Instructions stored in memory or storage. In other embodiments, multiple processors and / or multiple buses may be used with appropriately multiple memories and memory types.
- the processor may also be implemented as a chipset consisting of chips comprising a plurality of independent analog and / or digital processors.
- the memory also stores information within the computing device.
- the memory may consist of a volatile memory unit or a collection thereof.
- the memory may consist of a nonvolatile memory unit or a collection thereof.
- the memory may also be other forms of computer readable media, such as, for example, magnetic or optical disks.
- the storage device can provide a large amount of storage space to the computing device.
- the storage device may be a computer readable medium or a configuration including such a medium, and may include, for example, devices or other configurations within a storage area network (SAN), and may include a floppy disk device, a hard disk device, an optical disk device, Or a tape device, flash memory, or similar other semiconductor memory device or device array.
- SAN storage area network
Landscapes
- Engineering & Computer Science (AREA)
- Software Systems (AREA)
- Theoretical Computer Science (AREA)
- Physics & Mathematics (AREA)
- General Engineering & Computer Science (AREA)
- General Physics & Mathematics (AREA)
- Logic Circuits (AREA)
Abstract
본 발명은 프로그램 컴파일 장치 및 프로그램 컴파일 방법에 관한 것이다. 본 발명의 제 1 측면에 따르면, OpenCL 프로그램을 컴파일하기 위한 프로그램 컴파일 장치로서, OpenCL 커널을 반복문 이전 구문, 반복문 안 구문 및 반복문 이후 구문으로 분리하는 구문분리부, 각 구문에 대응되는 회로를 생성하는 회로생성부, 및 상기 생성된 회로를 하드웨어 기술 언어로 표현하는 언어생성부를 포함할 수 있다.
Description
본 발명은 프로그램 컴파일 장치 및 프로그램 컴파일 방법에 관한 것으로, 보다 상세하게는 FPGA를 위한 OpenCL 프로그램을 컴파일하는 장치 및 방법에 관한 것이다.
OpenCL(Open Computing Language; 오픈씨엘)은 이종 컴퓨팅 환경에서 실행되는 프로그램들을 위한 표준 프로그래밍 모델로서, OpenCL 플랫폼을 정의하고, 정의된 플랫폼 위에서 OpenCL 애플리케이션의 실행을 정의한다.
OpenCL 플랫폼은 호스트 프로세서(host processor) 하나와, 이와 연결된 하나 이상의 계산 디바이스(compute device)로 이루어져 있다.
계산 디바이스에는 하나 이상의 계산 유닛(CU; compute unit)이 있으며, 각 계산 유닛은 다시 하나 이상의 PE(processing element)로 구성된다.
통상적으로 호스트 프로세서는 CPU에 해당하며, 운영체제가 호스트 프로세서에서 실행된다. 계산 디바이스는 멀티코어 CPU 혹은 가속기(GPU, Intel Xeon Phi 코프로세서, FPGA 등)에 해당한다.
이와 같은 OpenCL 플랫폼이 구현되는 시스템이 FPGA(field programmable gate array)가 장착된 이종 시스템인 경우, CPU 는 호스트 프로세서가 되고, FPGA는 계산 디바이스가 된다. 그리고 CPU에서 실행되는 호스트 프로그램의 명령에 따라 계산 디바이스에서 처리되는 여러 개의 워크아이템을 FPGA가 병렬로 처리한다.
여러 개의 워크아이템을 병렬로 실행시키는 방법에는 워크 아이템 하나에 대응하는 회로를 만든 후, 파이프라이닝(pipelining) 기법을 사용하여 회로를 여러 개의 파이프라인 스테이지(pipeline stage)로 나누어, 각 스테이지에서 서로 다른 워크 아이템을 동시에 처리하는 방법이 있다.
또 다른 방법으로는, 워크아이템 하나에 대응하는 회로(이하에서는 편의상 “단위회로”라 칭함)를 여러 벌 만들어서, 각 단위회로에서 독립적으로 서로 다른 워크아이템을 처리하는 방법이 있다.
일반적으로 두 가지 방법을 모두 이용하여 OpenCL 커널을 처리한다. 즉, FPGA의 용량이 허락하는 만큼 단위회로를 여러 벌 복제하고, 각 단위회로에서 다시 파이프라이닝 기법으로 여러 워크 아이템을 동시에 실행한다.
하지만, 커널 내에 반복문이 존재할 경우, 단위회로에서 동시에 처리 가능한 워크아이템의 수가 전체 파이프라인 스테이지 개수가 아닌, 반복문 안의 내용을 실행하는 파이프라인 스테이지 개수로 줄어들며, 반복문 밖의 내용을 실행하는 파이프라인 스테이지는 반복문의 파이프라인 스테이지가 종료되지 않는 한, 워크아이템을 처리하지 않고 스톨(stall)되어 있어 FPGA의 활용도가 떨어지는 문제점이 있다.
관련하여 선행기술문헌인 한국공개특허번호 제10-2014-0097548호는, 이종 병렬 처리 플랫폼을 위한 소프트웨어 라이브러리에 관한 것으로 OpenCL 프레임워크에서 라이브러리 소스 코드는 중간 표현으로 컴파일되어 최종 유저 컴퓨팅 시스템으로 분배되고, 컴퓨터 시스템의CPU는 라이브러리의 중간 표현을 GPU에서 실행되는 바이너리로 컴파일하여, 커널을 호출하는 호스트 애플리케이션을 실행하고, 바이너리로부터 검색된 커널을 GPU 로 전송한다. 하지만 선행기술문헌 또한 상술된 바와 같은 문제점을 해소하지 못한다.
따라서 상술된 문제점을 해결하기 위한 기술이 필요하게 되었다.
한편, 전술한 배경기술은 발명자가 본 발명의 도출을 위해 보유하고 있었거나, 본 발명의 도출 과정에서 습득한 기술 정보로서, 반드시 본 발명의 출원 전에 일반 공중에게 공개된 공지기술이라 할 수는 없다.
본 발명의 일실시예는, FPGA를 위한 OpenCL 프로그램을 컴파일하는 장치 및 방법을 제시하는 데에 목적이 있다.
또한, 본 발명의 일실시예는 불필요한 회로를 최소화하는 데에 목적이 있다.
상술한 기술적 과제를 달성하기 위한 기술적 수단으로서, 본 발명의 제 1 측면에 따르면, OpenCL 프로그램을 컴파일하기 위한 프로그램 컴파일 장치로서, OpenCL 커널을 반복문 이전 구문, 반복문 안 구문 및 반복문 이후 구문으로 분리하는 구문분리부, 각 구문에 대응되는 회로를 생성하는 회로생성부, 및 상기 생성된 회로를 하드웨어 기술 언어로 표현하는 언어생성부를 포함할 수 있다.
또한 본 발명의 제 2 측면에 따르면, 프로그램 컴파일 장치가 OpenCL 프로그램을 컴파일하는 방법으로서, OpenCL 커널을 반복문 이전 구문, 반복문 안 구문 및 반복문 이후 구문으로 분리하는 단계, 각 구문에 대응되는 회로를 생성하는 단계, 및 상기 생성된 회로를 하드웨어 기술 언어로 표현하는 단계를 포함할 수 있다.
또한 본 발명의 제 3 측면에 따르면, 프로그램 컴파일 방법을 수행하는 프로그램이 기록된 컴퓨터 판독가능한 기록매체로서, 상기 프로그램 컴파일 방법은, OpenCL 커널을 반복문 이전 구문, 반복문 안 구문 및 반복문 이후 구문으로 분리하는 단계, 각 구문에 대응되는 회로를 생성하는 단계, 및 상기 생성된 회로를 하드웨어 기술 언어로 표현하는 단계를 포함할 수 있다.
또한 본 발명의 제 4 측면에 따르면, 프로그램 컴파일 장치에 의해 수행되며, 프로그램 컴파일 방법을 수행하기 위해 기록매체에 저장된 컴퓨터 프로그램으로서, 상기 프로그램 컴파일 방법은, OpenCL 커널을 반복문 이전 구문, 반복문 안 구문 및 반복문 이후 구문으로 분리하는 단계, 각 구문에 대응되는 회로를 생성하는 단계, 및 상기 생성된 회로를 하드웨어 기술 언어로 표현하는 단계를 포함할 수 있다.
전술한 본 발명의 과제 해결 수단 중 어느 하나에 의하면, 본 발명의 일실시예는, FPGA를 위한 OpenCL 프로그램을 컴파일하는 장치 및 방법을 제시하는 데에 목적이 있다.
또한 전술한 본 발명의 과제 해결 수단 중 어느 하나에 의하면, 본 발명의 일실시예는, FPGA를 이용하여 OpenCL을 이용한 호스트 프로그램에 의해 호출되는 커널에 포함된 반복문을 처리하는 회로를 더 많이 복제함으로써, 반복문에 의한 프로그램의 성능 병목현상을 줄여 시스템의 성능 저하를 방지할 수 있다.
또한, 본 발명의 과제 해결 수단 중 어느 하나에 의하면, 반복문이 포함된 OpenCL 커널에 대해 상기 반복문 밖의 내용을 처리하는 회로를 적게 복제하는 대신, 상기 반복문을 처리하는 회로를 더 많이 복제함으로써 시스템의 성능을 높일 수 있다.
아울러, 본 발명의 과제 해결 수단 중 어느 하나에 의하면, 불필요한 회로를 최소화함으로써 FPGA의 하드웨어를 효율적으로 사용하며, 결과적으로 전력소모를 낮추고 성능을 높일 수 있다.
본 발명에서 얻을 수 있는 효과는 이상에서 언급한 효과들로 제한되지 않으며, 언급하지 않은 또 다른 효과들은 아래의 기재로부터 본 발명이 속하는 기술분야에서 통상의 지식을 가진 자에게 명확하게 이해될 수 있을 것이다.
도 1은 본 발명의 일실시예에 따른 OpenCL 플랫폼 시스템의 구성도이다.
도 2는 본 발명의 일실시예에 따른 프로그램 컴파일 장치를 도시한 블록도이다.
도 3은 본 발명의 일실시예에 따른 프로그램 컴파일 방법을 설명하기 위한 순서도이다.
도 4 내지 도 5는 본 발명의 일실시예에 따른 프로그램 컴파일 방법을 설명하기 위한 예시도이다.
아래에서는 첨부한 도면을 참조하여 본 발명이 속하는 기술 분야에서 통상의 지식을 가진 자가 용이하게 실시할 수 있도록 본 발명의 실시예를 상세히 설명한다. 그러나 본 발명은 여러 가지 상이한 형태로 구현될 수 있으며 여기에서 설명하는 실시예에 한정되지 않는다. 그리고 도면에서 본 발명을 명확하게 설명하기 위해서 설명과 관계없는 부분은 생략하였으며, 명세서 전체를 통하여 유사한 부분에 대해서는 유사한 도면 부호를 붙였다.
명세서 전체에서, 어떤 부분이 다른 부분과 "연결"되어 있다고 할 때, 이는 "직접적으로 연결"되어 있는 경우뿐 아니라, 그 중간에 다른 소자를 사이에 두고 "전기적으로 연결"되어 있는 경우도 포함한다. 또한 어떤 부분이 어떤 구성요소를 "포함"한다고 할 때, 이는 특별히 반대되는 기재가 없는 한 다른 구성요소를 제외하는 것이 아니라 다른 구성요소를 더 포함할 수 있는 것을 의미한다.
이하 첨부된 도면을 참고하여 본 발명을 상세히 설명하기로 한다.
도 1은 본 발명의 일실시예에 따른 OpenCL 플랫폼 시스템(100)의 구성도이다.
OpenCL 플랫폼 시스템(100)은 OpenCL(Open Computing Language) 애플리케이션을 실행시킬 수 있다.
이와 같은 시스템(100)은, 호스트 프로세서(Host processor)(10)와 하나 이상의 계산 디바이스(Compute Device)(20)를 포함할 수 있다.
예를 들어, 호스트 프로세서(10)는 CPU에 해당하며, 계산 디바이스(20)는 멀티코어 CPU 혹은 가속기(GPU, Intel Xeon Phi 코프로세서, FPGA 등)일 수 있다.
호스트 프로세서(10)는 운영체제를 실행시킬 수 있으며, OpenCL 애플리케이션을 구성하는 호스트 프로그램을 실행시킬 수 있고, 호스트 프로그램에 따라 OpenCL API 함수를 사용해 계산 디바이스(20)를 제어할 수 있다.
그리고 계산 디바이스(20)는 하나 이상의 계산 유닛(CU; compute unit)(21)으로 구성될 수 있고, 각 계산 유닛은 다시 하나 이상의 PE(processing element)(22)로 구성될 수 있다.
계산 디바이스(20)는 세 종류의 메모리 즉, 디바이스 메모리(Device Memory)(23), 로컬 메모리(Local Memory)(24) 및 프라이빗 메모리(Private Memory)(25)를 가질 수 있다.
디바이스 메모리(23) 영역은 글로벌 메모리 및 콘스턴트 메모리로 구성되며, 또한 모든 PE(22)가 공유할 수 있고, 로컬 메모리(24) 영역은 각 계산 유닛(21)마다 독립적으로 할당될 수 있으며, 프라이빗 메모리(25) 영역은 각 PE(22)마다 독립적으로 할당될 수 있다.
이러한 계산 디바이스(20)는 호스트 프로그램의 명령을 받아 OpenCL 프로그램의 커널을 실행시키거나, 메인 메모리(Main Memory)(11)의 데이터를 디바이스 메모리(23)로 복사하거나, 반대로 디바이스 메모리(23)의 데이터를 메인 메모리(11)로 복사할 수 있다.
이때, OpenCL애플리케이션을 구성하는 OpenCL 프로그램은 여러 개의 커널 함수로 이루어져 있으며, C와 유사하게 생긴 OpenCL C라는 언어로 작성되며, 계산 디바이스(20)에서 실행될 수 있다.
이러한 OpenCL 플랫폼 시스템(100)에서 OpenCL 애플리케이션이 실행되면, 호스트 프로세서(10)에서 실행되는 호스트 프로그램은 OpenCL 프로그램의 커널을 실행하라는 명령을 내리면서, NDRange라는 N 차원의 인덱스 공간을 정의할 수 있다.
이때, NDRange의 각 인덱스를 워크 아이템이라 하고, 워크 아이템들은 워크 그룹이라는 단위로 구분될 수 있다.
이후, 계산 디바이스(20)는 커널(kernel) 실행 명령에 따라 각 워크 아이템마다 커널 함수를 실행하는 쓰레드(thread)인 커널 인스턴스를 만들 수 있다.
각 워크 그룹은 계산 디바이스(20)를 구성하는 하나 이상의 계산 유닛(21)에서 각각 실행될 수 있으며, 각 워크 그룹에 포함된 여러 워크 아이템은 계산 유닛(21)의 PE(22)에서 각각 실행될 수 있다.
한편, OpenCL 플랫폼 시스템(100)의 계산 디바이스(20)가 FPGA 인 경우, OpenCL 프로그램을 실행시킬 수 있는 FPGA 회로를 구현하여야 한다.
즉, OpenCL 프로그램, 구체적으로는 OpenCL 프로그램의 커널 함수를 입력으로 받아 상기 커널 함수의 여러 워크 아이템을 병렬 처리하는 FPGA 회로를 구현해야 한다.
이를 위해, FPGA회로를 구현하는 일 기술로서 Verilog, VHDL 등의 하드웨어 기술 언어로 회로 구조를 표현하고, 이를 사용해 FPGA의 회로 구조를 구현할 수 있으며, 이를 로직 신세시스(logic synthesis)라고 칭한다.
반면 C 언어와 같은 일반적인 고수준 언어로 프로그램을 작성하고 이에 맞게 FPGA의 하드웨어 구조를 바꾸는 방법이 있는데 이를 고레벨 신세시스(high-level synthesis)라고 칭한다.
고레벨 신세시스는 고수준 언어로 작성된 프로그램을 입력으로 받아 회로 구조를 만들어 내는 과정과, 로직 신세시스 기술을 적용하여 FPGA의 회로 구조를 바꾸는 과정으로 이루어진다. 이때 구분된 과정은 개념적으로 구분해 놓은 것이며, 이 둘이 반드시 독립된 두 단계로 명확히 나뉘어 실행될 필요가 없다.
예를 들어 고레벨 신세시스는 하나의 소프트웨어에 의해 수행될 수도 있으며, 이 경우 회로 구조를 만들어 내는 과정의 하드웨어 기술 언어는 Verilog, VHDL 등 사람이 알아볼 수 있는 언어가 아니라, 소프트웨어 내부에서 회로 구조를 저장하는 중간 표현(intermediate representation)이 될 수도 있다.
본 발명에서는 고레벨 신세시스를 통해 반복문을 포함하는 OpenCL 커널을 처리하는 FPGA 회로를 구현하기 위한 방법을 설명한다.
이때 본 발명의 일실시예에 따른 프로그램 컴파일 장치는, OpenCL 플랫폼 시스템(100) 상의 임의의 구성요소가 될 수 있으며, 또한 OpenCL 플랫폼 시스템(100) 외부에 위치하는 구성요소가 될 수 있다. 다만 이하에서는 호스트 프로세서(10)가 프로그램 컴파일 장치인 것으로 하여 설명하도록 하겠다.
한편 도 2는 본 발명의 일실시예에 따른 프로그램 컴파일 장치(20)를 도시한 블록도이다.
도 2에서 도시된 바와 같이 본 발명의 일실시예에 따른 프로그램 컴파일 장치(20)는 OpenCL 커널에 기초하여 컨트롤 플로우 그래프를 생성하는 그래프생성부(210)를 포함할 수 있다.
즉 그래프생성부(210)는, OpenCL 커널이 실행 중에 횡단할 수 있는 모든 경로를 그래프 표기법을 사용하여 컨트롤 플로우 그래프로서 표현할 수 있다.
한편, 본 발명의 일실시예에 따른 프로그램 컴파일 장치(20)는, OpenCL 커널을 반복문 이전 구문, 반복문 안 구문 및 반복문 이후 구문으로 분리하는 구문분리부(220)를 더 포함할 수 있다.
또한 구문분리부(220)는 그래프생성부(210)에 의해 생성된 컨트롤 플로우 그래프에서 반복문을 탐색할 수 있고, 그에 따라 반복문을 기준으로, 커널에서 반복문 이전의 구문, 반복문 안 구문 및 반복문 이후의 구문을 구분해낼 수 있다.
한편 본 발명의 일실시예에 따른 프로그램 컴파일 장치(20)는 구문분리부(220)에 의해 분리된 구문 각각에 대응되는 회로를 생성하는 회로생성부(230)를 더 포함할 수 있다.
회로생성부(230)는 반복문 이전 구문에 대응되는 제1단위회로, 반복문 안 구문에 대응되는 제2단위회로, 및 반복문 이후 구문에 대응되는 제3단위회로를 생성할 수 있다.
이때 제1단위회로와 제3단위회로의 수는 최소화하고 제2단위회로의 수를 최대화하기 위해, 회로생성부(230)는 FPGA용량에 기초하여 제2단위회로를 소정의 횟수이상 복제하여 하나 이상의 제2단위회로를 생성할 수 있다.
또한 회로생성부(230)는 제1단위회로 및 제2단위회로 사이에 제1제어회로를 추가적으로 생성하여 제1단위회로 및 제2단위회로 각각과 결합시킬 수 있다. 제1제어회로는, 제2단위회로에 새로운 워크 아이템이 진입할 수 있음을 나타내는 제1시그널 값을 검사할 수 있으며, 제2단위회로에 새로운 워크 아이템이 진입할 수 있음을 판단하면 제1단위회로에 의해 계산된 계산결과를 해당 워크 아이템의 ID와 함께 제2단위회로로 전달할 수 있다.
아울러 회로생성부(230)는 제2단위회로 및 제3단위회로 간의 제2제어회로를 추가적으로 생성하여 제2단위회로 및 제3단위회로 각각과 결합시킬 수 있다. 제2제어회로는, 워크 아이템이 반복문을 빠져 나가 제3단위회로에서 계속 실행되어야 할 상태를 나타내는 제2시그널 값을 검사할 수 있으며, 제2단위회로로부터 워크 아이템이 빠져나가야 함을 판단하면 제2단위회로에 의해 계산된 계산결과를 해당 워크 아이템의 ID와 함께 제3단위회로로 전달할 수 있다.
한편 본 발명의 일실시예에 따른 프로그램 컴파일 장치(20)는, 회로생성부(230)에 의해 생성된 회로를 하드웨어 기술 언어로 표현하는 언어생성부(240)를 더 포함할 수 있다.
관련하여 본 발명의 일실시예에 따른 프로그램 컴파일 장치는 호스트 프로세서에 의해 구현됨을 기술하였으나, 본 실시예에서 사용되는 '~부'라는 용어는 어떤 역할들을 수행하는 것을 의미하는 것이어서, '~부'는 소프트웨어 또는 FPGA 또는 ASIC 와 같은 하드웨어 구성요소를 의미하고, 또한 CPU, GPU 등이 될 수 있다. 그렇지만 '~부'는 소프트웨어 또는 하드웨어에 한정되는 의미는 아니다. '~부'는 어드레싱할 수 있는 저장 매체에 있도록 구성될 수도 있고 하나 또는 그 이상의 프로세서들을 재생시키도록 구성될 수도 있다. 따라서, 일 예로서 '~부'는 소프트웨어 구성요소들, 객체지향 소프트웨어 구성요소들, 클래스 구성요소들 및 태스크 구성요소들과 같은 구성요소들과, 프로세스들, 함수들, 속성들, 프로시저들, 서브루틴들, 프로그램특허 코드의 세그먼트들, 드라이버들, 펌웨어, 마이크로코드, 회로, 데이터, 데이터베이스, 데이터 구조들, 테이블들, 어레이들, 및 변수들을 포함한다.
구성요소들과 '~부'들 안에서 제공되는 기능은 더 작은 수의 구성요소들 및 '~부'들로 결합되거나 추가적인 구성요소들과 '~부'들로부터 분리될 수 있다.
뿐만 아니라, 구성요소들 및 '~부'들은 디바이스 또는 보안 멀티미디어카드 내의 하나 또는 그 이상의 CPU 들을 재생시키도록 구현될 수도 있다
한편 도 3은 본 발명의 일실시예에 따른 프로그램 컴파일 방법을 설명하기 위한 순서도이다.
도 3에 도시된 실시예에 따른 프로그램 컴파일 방법은 도 2에 도시된 프로그램 컴파일 장치(10)에서 시계열적으로 처리되는 단계들을 포함한다. 따라서, 이하에서 생략된 내용이라고 하더라도 도 2에 도시된 프로그램 컴파일 장치(10)에 관하여 이상에서 기술한 내용은 도 3에 도시된 실시예에 따른 프로그램 컴파일 방법에도 적용될 수 있다.
도 3은 도 4 및 도 5를 참조하여 이하에서 후술된다. 도 4 및 도 5 각각은 본 발명의 일실시예에 따른 프로그램 컴파일 방법을 설명하기 위한 예시도로서, 도 4는 본 발명의 일실시예에 따른 반복문이 포함된 OpenCL 커널을 구현한 FPGA의 예시도이며, 도 5는 본 발명의 일실시예에 따른 복수개의 반복문이 포함된 OpenCL 커널을 구현한 FPGA의 예시도이다.
프로그램 컴파일 장치(10)는 OpenCL 커널을 반복문 이전(40)과 반목문 안(41) 그리고 반복문 이후(42)로 분리할 수 있다(S310).
이를 위해 프로그램 컴파일 장치(10)는, OpenCL 커널로부터 컨트롤 플로우 그래프(CFG; Control Flow Graph)를 생성할 수 있으며, 생성된 컨트롤 플로우 그래프를 이용하여 반복문을 탐색하고 커널을 분리할 수 있다.
이후, 프로그램 컴파일 장치(10)는, 분리된 커널의 각 부분에 대한 회로 구조를 생성할 수 있다(S320).
도 4를 참조하면, OpenCL 커널의 반복문 이전(40)은 하나의 제 1 단위회로(43)로 구현될 수 있고, OpenCL 커널의 반복문 안(41)은 3개의 제 2 단위회로(44)로 구현될 수 있으며, OpenCL 커널의 반복문 이후(42)는 하나의 제 3 단위회로(45)로 구현될 수 있다.
이때, 제 1 내지 3 단위회로(43, 44, 45)는 파이프라이닝 기법을 사용하여 복수 개의 워크 아이템을 동시에 실행할 수 있다.
한편, 도 4에서 도시된 제 1 내지 3 단위회로 각각은 2개의 파이프라인 스테이지를 갖는 것으로 가정하나, 또 다른 일 실시예에 따라 단위회로의 파이프라인 스테이지는 적어도 1개 이상으로 구현될 수 있다.
즉 제1내지 3 단위회로(43, 44, 45) 각각은 여러 개의 파이프라인 스테이지로 구성될 수 있고, 각 파이프라인 스테이지는 현재 실행 중인 워크 아이템의 ID와 계산 결과를 레지스터에 저장할 수 있으며, 하나의 클럭 사이클이 지날 때마다, 각 파이프라인 스테이지는 이전 파이프라인 스테이지의 ID와 계산 결과를 읽어와 해당 워크 아이템에 대한 계산 작업을 수행할 수 있다.
제2단위회로(44)의 마지막 파이프라인 스테이지의 실행 결과는 반복문의 조건 값을 포함할 수 있고, 예를 들어 그 값이 참(true)일 경우, 해당 워크 아이템은 제2단위회로(44)의 첫 번째 파이프라인 스테이지에서부터 다시 실행된다.
이와 달리 예를 들어, 반복문의 조건 값이 거짓(false)일 경우, 해당 워크 아이템은 반복문을 빠져나가며, 따라서 제 2 단위회로(44)는 제1단위회로(43)에서 실행을 마친 새로운 워크 아이템을 실행할 수 있게 된다.
실시예에 따라, 제1단위회로(43)와 제3단위회로(45)는 복제하지 않고 1벌씩만 만들 수 있으며, 제2단위회로(44)는 FPGA 용량이 허용하는 한에서 최대한 많이 복제하여 생성할 수 있다.
즉, 워크 아이템이 반복문 안의 내용을 수십 내지 수백 번 이상 반복할 경우, 제1단위회로(43)와 제3단위회로(45)의 수는 최소화하고 제2단위회로(44)의 수를 최대화하는 것이 본 발명의 장점을 극대화할 수 있다.
이후, 반복문 이전에 대한 제 1 단위회로(43)와, 반복문 안에 대한 제 2 단위회로(44), 반복문 이후에 대한 제 3 단위회로(45)를 제 1 내지 2 제어회로(50, 51)를 사용하여 각각 결합할 수 있다(S330).
즉, 제 1 단위회로(43)와 제 2 단위회로(44) 사이, 그리고 제 2 단위회로(44)와 제 3 단위회로(45) 사이에는 이전 단계에서 실행 완료된 워크 아이템을 다음 단계로 보내 계속 실행되도록 하는 제어 회로(50, 51)가 위치할 수 있고, 제 1 내지 3 단위회로(43, 44, 45)는 제어회로(50, 51)에 각각 결합될 수 있다.
도 4를 참조하면, 제1단위회로(43)와 제2단위회로(44)는 제1제어회로(50)에 의해 1대 다(多)로 결합되며, 제2단위회로(44)와 제3단위회로(45)는 제2제어회로(51)에 의해 다(多) 대 1로 결합될 수 있다.
이렇게 제 1 내지 제 3 단위회로(43, 44, 45)와 각각 결합되는 제 1 내지 2 제어회로(50, 51)는 다음과 같이 동작하도록 구현될 수 있다.
즉, 본 발명의 일 실시예에 따르면, 제1제어회로(50)는 제2단위회로(44)로부터 새로운 워크 아이템이 진입할 수 있음을 나타내는 제1시그널을 전달받을 수 있다.
이때, 제1시그널은, 예를 들어 조건 값이 거짓일 경우 1, 참일 경우 0 일 수 있으며, 제2단위회로(44)가 스톨(stall)되어 있을 경우에는 0일 수 있고, 제2단위회로(44)의 마지막 파이프라인 스테이지가 비어 있을 경우, 제1시그널의 값은 1일 수 있다.
예를 들어, 특정 워크 아이템이 제1단위회로(43)의 마지막 파이프라인 스테이지에 도달했을 경우, 제1제어회로(50)는 모든 제2단위회로(44)의 제1시그널 값을 검사할 수 있고, 해당 워크 아이템의 ID와 계산 결과를 제1시그널의 값이 1인(즉, 새로운 워크 아이템이 실행될 수 있는) 제2단위회로(44)의 입력으로 전달할 수 있다. 그리고 제1시그널의 값이 1인 제2단위회로(44)가 복수 개 있다면, 임의로 정한 순서에 따라 그 중 하나를 선택할 수 있다.
이와 달리 예를 들어, 제1시그널의 값이 모두 0이라면, 제 1 제어회로(50)는 제1단위회로(43)에 스톨 신호를 보내 워크 아이템의 실행을 일시 정지하도록 할 수 있다.
그리고 본 발명의 또 다른 실시예에 따르면, 제 2 제어회로(51)는 제2단위회로(44)로부터 제 2 단위회로(44)의 마지막 파이프라인 스테이지의 워크 아이템이 반복문에서 빠져나감을 나타내는 제 2 시그널을 수신하여, 모든 제2단위회로(44)의 제2시그널 값을 검사할 수 있다.
예를 들어, 제2시그널의 값이 1인 제2단위회로(44)가 1개 있다면, 제 2 제어회로(51)는 해당 제2단위회로(44)의 마지막 파이프라인 스테이지의 워크 아이템 ID와 계산 결과를 제3단위회로(45)의 입력으로 전달할 수 있으며, 제2시그널의 값이 1인 제2단위회로(44)가 복수 개 있다면, 임의로 정한 순서에 따라 그 중 하나를 선택할 수 있고, 나머지 제2단위회로에는 스톨 신호를 보내 일시 정지하도록 할 수 있다.
이때, 제 2 시그널은, 예를 들어 제 2 단위회로(44)의 마지막 파이프라인 스테이지에서 결정된 조건 값이 거짓일 경우 1, 참일 경우 0일 수 있으며, 제2단위회로(44)가 스톨되어 있을 경우 제1시그널은 0이 되는 데 반해 제2시그널은 원래의 값을 유지하며, 제2단위회로의 마지막 파이프라인 스테이지가 비어 있을 경우, 제2시그널의 값은 0 일 수 있다.
한편, 도 4는 OpenCL 커널에 하나의 반복문이 포함된 것으로 가정하고 있으나 반드시 이에 한정된 것은 아니고 OpenCL 커널에 하나 이상의 반복문이 포함된 경우, 각 반복문을 기준으로 여러 개의 부분으로 분리될 수 있고, 각 부분은 단위회로로 구현될 수 있다.
도 5는 복수의 반복문이 포함된 OpenCL 커널을 구현한 FPGA의 예시도로서 도 5를 참조하면, S310 에서 OpenCL 커널을 제 1 내지 제 2 반복문을 기준으로 나눌 수 있고, 제 1 반복문 이전(500)과 제 1 반복문 안(501), 제 1 반복문 이후(502)로 나눌 수 있으며, 또한 또 다른 제 2 반복문 안(503)을 기준으로 제2반복문 이전(502)과 제 2 반복문 이후(504)로 나눌 수 있고, 특히, 컨트롤 플로우 그래프를 이용하여 제1 내지 제2반복문을 탐색하고 커널을 분리할 수 있다.
그리고 프로그램 컴파일 장치(10)는, S320단계에서 기재된 방법과 동일하게 나누어진 각 부분을 FPGA 회로구조로 구현하고, S320 단계에서 구현된 단위회로를 제 1 내지 제 4 제어회로(505, 506, 507, 508)에 각각 결합할 수 있다.
마지막으로, 프로그램 컴파일 장치(10)는 S330 단계에서 생성된 회로 구조를 하드웨어 기술 언어로 표현할 수 있다(S340).
도 3을 통해 설명된 실시예에 따른 프로그램 컴파일 방법은 컴퓨터에 의해 실행되는 프로그램 모듈과 같은 컴퓨터에 의해 실행가능한 명령어를 포함하는 기록 매체의 형태로도 구현될 수 있다. 컴퓨터 판독 가능 매체는 컴퓨터에 의해 액세스될 수 있는 임의의 가용 매체일 수 있고, 휘발성 및 비휘발성 매체, 분리형 및 비분리형 매체를 모두 포함한다. 또한, 컴퓨터 판독가능 매체는 컴퓨터 저장 매체 및 통신 매체를 모두 포함할 수 있다. 컴퓨터 저장 매체는 컴퓨터 판독가능 명령어, 데이터 구조, 프로그램 모듈 또는 기타 데이터와 같은 정보의 저장을 위한 임의의 방법 또는 기술로 구현된 휘발성 및 비휘발성, 분리형 및 비분리형 매체를 모두 포함한다. 통신 매체는 전형적으로 컴퓨터 판독가능 명령어, 데이터 구조, 프로그램 모듈, 또는 반송파와 같은 변조된 데이터 신호의 기타 데이터, 또는 기타 전송 메커니즘을 포함하며, 임의의 정보 전달 매체를 포함한다.
또한 본 발명의 일실시예에 따르는 프로그램 컴파일 방법은 컴퓨터에 의해 실행 가능한 명령어를 포함하는 컴퓨터 프로그램(또는 컴퓨터 프로그램 제품)으로 구현될 수도 있다. 컴퓨터 프로그램은 프로세서에 의해 처리되는 프로그래밍 가능한 기계 명령어를 포함하고, 고레벨 프로그래밍 언어(High-level Programming Language), 객체 지향 프로그래밍 언어(Object-oriented Programming Language), 어셈블리 언어 또는 기계 언어 등으로 구현될 수 있다. 또한 컴퓨터 프로그램은 유형의 컴퓨터 판독가능 기록매체(예를 들어, 메모리, 하드디스크, 자기/광학 매체 또는 SSD(Solid-State Drive) 등)에 기록될 수 있다.
따라서 본 발명의 일실시예에 따르는 프로그램 컴파일 방법은 상술한 바와 같은 컴퓨터 프로그램이 컴퓨팅 장치에 의해 실행됨으로써 구현될 수 있다. 컴퓨팅 장치는 프로세서와, 메모리와, 저장 장치와, 메모리 및 고속 확장포트에 접속하고 있는 고속 인터페이스와, 저속 버스와 저장 장치에 접속하고 있는 저속 인터페이스 중 적어도 일부를 포함할 수 있다. 이러한 성분들 각각은 다양한 버스를 이용하여 서로 접속되어 있으며, 공통 머더보드에 탑재되거나 다른 적절한 방식으로 장착될 수 있다.
여기서 프로세서는 컴퓨팅 장치 내에서 명령어를 처리할 수 있는데, 이런 명령어로는, 예컨대 고속 인터페이스에 접속된 디스플레이처럼 외부 입력, 출력 장치상에 GUI(Graphic User Interface)를 제공하기 위한 그래픽 정보를 표시하기 위해 메모리나 저장 장치에 저장된 명령어를 들 수 있다. 다른 실시예로서, 다수의 프로세서 및(또는) 다수의 버스가 적절히 다수의 메모리 및 메모리 형태와 함께 이용될 수 있다. 또한 프로세서는 독립적인 다수의 아날로그 및(또는) 디지털 프로세서를 포함하는 칩들이 이루는 칩셋으로 구현될 수 있다.
또한 메모리는 컴퓨팅 장치 내에서 정보를 저장한다. 일례로, 메모리는 휘발성 메모리 유닛 또는 그들의 집합으로 구성될 수 있다. 다른 예로, 메모리는 비휘발성 메모리 유닛 또는 그들의 집합으로 구성될 수 있다. 또한 메모리는 예컨대, 자기 혹은 광 디스크와 같이 다른 형태의 컴퓨터 판독 가능한 매체일 수도 있다.
그리고 저장장치는 컴퓨팅 장치에게 대용량의 저장공간을 제공할 수 있다. 저장 장치는 컴퓨터 판독 가능한 매체이거나 이런 매체를 포함하는 구성일 수 있으며, 예를 들어 SAN(Storage Area Network) 내의 장치들이나 다른 구성도 포함할 수 있고, 플로피 디스크 장치, 하드 디스크 장치, 광 디스크 장치, 혹은 테이프 장치, 플래시 메모리, 그와 유사한 다른 반도체 메모리 장치 혹은 장치 어레이일 수 있다.
전술한 본 발명의 설명은 예시를 위한 것이며, 본 발명이 속하는 기술분야의 통상의 지식을 가진 자는 본 발명의 기술적 사상이나 필수적인 특징을 변경하지 않고서 다른 구체적인 형태로 쉽게 변형이 가능하다는 것을 이해할 수 있을 것이다. 그러므로 이상에서 기술한 실시예들은 모든 면에서 예시적인 것이며 한정적이 아닌 것으로 이해해야만 한다. 예를 들어, 단일형으로 설명되어 있는 각 구성 요소는 분산되어 실시될 수도 있으며, 마찬가지로 분산된 것으로 설명되어 있는 구성 요소들도 결합된 형태로 실시될 수 있다.
본 발명의 범위는 상기 상세한 설명보다는 후술하는 특허청구범위에 의하여 나타내어지며, 특허청구범위의 의미 및 범위 그리고 그 균등 개념으로부터 도출되는 모든 변경 또는 변형된 형태가 본 발명의 범위에 포함되는 것으로 해석되어야 한다.
Claims (16)
- OpenCL 프로그램을 컴파일하기 위한 프로그램 컴파일 장치로서,OpenCL 커널을 반복문 이전 구문, 반복문 안 구문 및 반복문 이후 구문으로 분리하는 구문분리부;각 구문에 대응되는 회로를 생성하는 회로생성부; 및상기 생성된 회로를 하드웨어 기술 언어로 표현하는 언어생성부를 포함하는, 프로그램 컴파일 장치.
- 제 1 항에 있어서,상기 OpenCL 커널에 기초하여 컨트롤 플로우 그래프를 생성하는 그래프생성부를 더 포함하고,상기 구문분리부는,상기 컨트롤 플로우 그래프에 기초하여 상기 OpenCL 커널을 반복문 이전 구문, 반복문 안 구문 및 반복문 이후 구문으로 분리하는, 프로그램 컴파일 장치.
- 제 1 항에 있어서,상기 회로생성부는,상기 반복문 이전 구문에 대응되는 제1단위회로, 상기 반복문 안 구문에 대응되는 제2단위회로 및 상기 반복문 이후 구문에 대응되는 제3단위회로를 생성하는, 프로그램 컴파일 장치.
- 제 3 항에 있어서,상기 회로생성부는,상기 제2단위회로를 소정의 횟수이상 복제하여 하나 이상의 제2단위회로를 생성하는, 프로그램 컴파일 장치.
- 제 3 항에 있어서,상기 제1단위회로 내지 상기 제3단위회로는 하나 이상의 파이프라인 스테이지로 구성되어 하나 이상의 워크 아이템을 동시에 실행할 수 있는, 프로그램 컴파일 장치.
- 제 3 항에 있어서,상기 회로생성부는,상기 제1단위회로 및 제2단위회로 간의 제1제어회로, 및 상기 제2단위회로 및 상기 제3단위회로 간의 제2제어회로를 추가적으로 생성하여 결합시키는, 프로그램 컴파일 장치.
- 제 6 항에 있어서,상기 제1제어회로는, 상기 제2단위회로에 새로운 워크 아이템이 진입할 수 있음을 나타내는 제1시그널 값을 상기 제2단위회로로부터 전달받아 검사하며,상기 제2제어회로는, 상기 제2단위회로에서의 워크 아이템이 상기 제2단위회로에서 빠져나가야 함을 나타내는 제2시그널 값을 상기 제2단위회로로부터 전달받아 검사하는, 프로그램 컴파일 장치.
- 프로그램 컴파일 장치가 OpenCL 프로그램을 컴파일하는 방법으로서,OpenCL 커널을 반복문 이전 구문, 반복문 안 구문 및 반복문 이후 구문으로 분리하는 단계;각 구문에 대응되는 회로를 생성하는 단계; 및상기 생성된 회로를 하드웨어 기술 언어로 표현하는 단계를 포함하는, 프로그램 컴파일 방법.
- 제 8 항에 있어서,OpenCL 커널에 기초하여 컨트롤 플로우 그래프 생성하는 단계를 더 포함하며,상기 분리하는 단계는,상기 컨트롤 플로우 그래프에 기초하여 상기 OpenCL 커널을 반복문 이전 구문, 반복문 안 구문 및 반복문 이후 구문으로 분리하는 단계를 포함하는, 프로그램 컴파일 방법.
- 제 8 항에 있어서,상기 회로를 생성하는 단계는,상기 반복문 이전 구문에 대응되는 제1단위회로, 상기 반복문 안 구문에 대응되는 제2단위회로 및 상기 반복문 이후 구문에 대응되는 제3단위회로를 생성하는 단계를 포함하는, 프로그램 컴파일 방법.
- 제 10 항에 있어서,상기 회로를 생성하는 단계는,상기 제2단위회로를 소정의 횟수이상 복제하여 하나 이상의 제2단위회로를 생성하는 단계를 더 포함하는, 프로그램 컴파일 방법.
- 제 10 항에 있어서,상기 제1단위회로 내지 상기 제3단위회로는 하나 이상의 파이프라인 스테이지로 구성되어 하나 이상의 워크 아이템을 동시에 실행할 수 있는, 프로그램 컴파일 방법.
- 제 10 항에 있어서,상기 회로를 생성하는 단계는,상기 제1단위회로 및 제2단위회로 간의 제1제어회로 및 상기 제2단위회로 및 상기 제3단위회로 간의 제2제어회로를 추가적으로 생성하여 결합시키는 단계를 더 포함하는, 프로그램 컴파일 방법.
- 제 13 항에 있어서,상기 제1제어회로는, 상기 제2단위회로에 새로운 워크 아이템이 진입할 수 있음을 나타내는 제1시그널 값을 상기 제2단위회로로부터 전달받아 검사하며,상기 제2제어회로는, 상기 제2단위회로에서의 워크 아이템이 상기 제2단위회로에서 빠져나가야 함을 나타내는 제2시그널 값을 상기 제2단위회로로부터 전달받아 검사하는, 프로그램 컴파일 방법.
- 제 8 항에 기재된 방법을 수행하는 프로그램이 기록된 컴퓨터 판독가능한 기록매체.
- 프로그램 컴파일 장치에 의해 수행되며, 제 8 항에 기재된 방법을 수행하기 위해 기록매체에 저장된 컴퓨터 프로그램.
Applications Claiming Priority (4)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
KR20150007904 | 2015-01-16 | ||
KR10-2015-0007904 | 2015-01-16 | ||
KR1020150190701A KR101737785B1 (ko) | 2015-01-16 | 2015-12-31 | 프로그램 컴파일 장치 및 프로그램 컴파일 방법 |
KR10-2015-0190701 | 2015-12-31 |
Publications (1)
Publication Number | Publication Date |
---|---|
WO2016114532A1 true WO2016114532A1 (ko) | 2016-07-21 |
Family
ID=56406035
Family Applications (1)
Application Number | Title | Priority Date | Filing Date |
---|---|---|---|
PCT/KR2016/000228 WO2016114532A1 (ko) | 2015-01-16 | 2016-01-11 | 프로그램 컴파일 장치 및 프로그램 컴파일 방법 |
Country Status (1)
Country | Link |
---|---|
WO (1) | WO2016114532A1 (ko) |
Citations (5)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
US20130036409A1 (en) * | 2011-08-02 | 2013-02-07 | International Business Machines Corporation | Technique for compiling and running high-level programs on heterogeneous computers |
JP2013164847A (ja) * | 2012-02-09 | 2013-08-22 | Altera Corp | 高レベル言語を用いるプログラマブルデバイスの構成 |
US20130346953A1 (en) * | 2012-06-22 | 2013-12-26 | Altera Corporation | Opencl compilation |
KR20140119619A (ko) * | 2013-03-29 | 2014-10-10 | 삼성전자주식회사 | 벡터 코드 생성 장치 및 방법 |
JP2014225194A (ja) * | 2013-05-17 | 2014-12-04 | 国立大学法人 筑波大学 | ハードウェア設計装置,及びハードウェア設計用プログラム |
-
2016
- 2016-01-11 WO PCT/KR2016/000228 patent/WO2016114532A1/ko active Application Filing
Patent Citations (5)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
US20130036409A1 (en) * | 2011-08-02 | 2013-02-07 | International Business Machines Corporation | Technique for compiling and running high-level programs on heterogeneous computers |
JP2013164847A (ja) * | 2012-02-09 | 2013-08-22 | Altera Corp | 高レベル言語を用いるプログラマブルデバイスの構成 |
US20130346953A1 (en) * | 2012-06-22 | 2013-12-26 | Altera Corporation | Opencl compilation |
KR20140119619A (ko) * | 2013-03-29 | 2014-10-10 | 삼성전자주식회사 | 벡터 코드 생성 장치 및 방법 |
JP2014225194A (ja) * | 2013-05-17 | 2014-12-04 | 国立大学法人 筑波大学 | ハードウェア設計装置,及びハードウェア設計用プログラム |
Similar Documents
Publication | Publication Date | Title |
---|---|---|
JP7700167B2 (ja) | 分散ハードウェアトレーシング | |
US11886930B2 (en) | Runtime execution of functions across reconfigurable processor | |
US8495603B2 (en) | Generating an executable version of an application using a distributed compiler operating on a plurality of compute nodes | |
US9569398B2 (en) | Routing data communications packets in a parallel computer | |
US20120216021A1 (en) | Performing An All-To-All Data Exchange On A Plurality Of Data Buffers By Performing Swap Operations | |
US7646721B2 (en) | Locating hardware faults in a data communications network of a parallel computer | |
US8954943B2 (en) | Analyze and reduce number of data reordering operations in SIMD code | |
US11182264B1 (en) | Intra-node buffer-based streaming for reconfigurable processor-as-a-service (RPaaS) | |
WO2019139253A1 (ko) | 딥 뉴럴 네트워크를 위한 gpu 메모리 관리 방법 및 그를 수행하는 연산 장치 | |
US20130151713A1 (en) | Performing An Allreduce Operation On A Plurality Of Compute Nodes Of A Parallel Computer | |
US9720676B2 (en) | Implementing updates to source code executing on a plurality of compute nodes | |
US8533390B2 (en) | Circular buffer in a redundant virtualization environment | |
KR920704231A (ko) | 고도 병렬 스칼라/벡터 멀티프로세서 시스템용 클러스터 구성 | |
WO2016064158A1 (ko) | 재구성 가능 프로세서 및 그 동작 방법 | |
BR112019027531A2 (pt) | processadores de alto rendimento | |
CN112631955A (zh) | 数据处理方法、装置、电子设备以及介质 | |
US8548966B2 (en) | Asynchronous assertions | |
US20080072101A1 (en) | Identifying Failure in a Tree Network of a Parallel Computer | |
CN111176663A (zh) | 应用程序的数据处理方法、装置、设备及存储介质 | |
WO2016114532A1 (ko) | 프로그램 컴파일 장치 및 프로그램 컴파일 방법 | |
US20240273057A1 (en) | Auto-Discovery Module for the Discovery of Reconfigurable Processors in a Pool of Heterogeneous Reconfigurable Processors | |
US9461874B2 (en) | Collective operation management in a parallel computer | |
US8930962B2 (en) | Processing unexpected messages at a compute node of a parallel computer | |
KR101737785B1 (ko) | 프로그램 컴파일 장치 및 프로그램 컴파일 방법 | |
US20140047450A1 (en) | Utilizing A Kernel Administration Hardware Thread Of A Multi-Threaded, Multi-Core Compute Node Of A Parallel Computer |
Legal Events
Date | Code | Title | Description |
---|---|---|---|
121 | Ep: the epo has been informed by wipo that ep was designated in this application |
Ref document number: 16737496 Country of ref document: EP Kind code of ref document: A1 |
|
NENP | Non-entry into the national phase |
Ref country code: DE |
|
122 | Ep: pct application non-entry in european phase |
Ref document number: 16737496 Country of ref document: EP Kind code of ref document: A1 |