This application claims priority under 35 U.S.C. §119(a) from Korean Patent Application No. 10-2013-0044435, filed on Apr. 22, 2013, the disclosure of which is incorporated herein by reference in its entirety.
1. Field
Methods and apparatuses consistent with exemplary embodiments relate to a processor for batch thread processing, a batch thread processing method using the processor, and a code generation apparatus for supporting the batch thread processing processor.
2. Description of the Related Art
A coarse grain reconfigurable array (CGRA) refers to hardware having a plurality of function units (FU) in the form of an array. The CGRA is used to speed up an operation. Further, the CGRA can maximize throughput even if a dependency is present between data by use of software pipeline technology. However, all scheduling of data processing is performed in a compile stage, which increases a compile time. In addition, when implementing multithreads, hardware overhead is large, so that operation efficiency is degraded when performing an operation having a large, undefined delay time, for example, a memory access.
As another example, a single instruction multiple thread (SIMT) is an architecture including a plurality of function units similar to the CGRA. The SIMT uses a single instruction processed by the plurality of function units while executing a single thread processed by each function unit. According to the SIMT, the plurality of function units process a large amount of data in the same instruction sequence, providing a benefit to a massive parallel data processing application that needs to process a large amount of data in the same process. In addition, the SIMT provides superior processing efficiency through thread switching that executes a different thread when operation latency is high. However, in a case when a dependency between each data is present in the data processing, the thread processing is difficult.
According to an expect of an exemplary embodiment, a processor may include a central register file and a first function unit batch including a first plurality of function units, a first input port through which the first plurality of function units access the central register file, and a first output port through which the first plurality of function units access the central register file; and a second function unit batch including a second plurality of function units, a second input port through which the second plurality of function units access the central register file, and a second output port through which the second plurality of function units access the central register file, wherein the first function unit is configured to receive a first instruction batch including one or more first instructions of a program and sequentially execute the one or more first instructions and the second function unit is configured to receive a second instruction batch including one or more second instructions of the program and sequentially execute the one or more second instructions.
The first function unit batch may further include one or more first local register files configured to store input/output data of the first plurality of function units, and the second function unit batch may further include one or more second local register files configured to store input/output data of the second plurality of function units.
The first function unit batch may be configured to operate as a coarse grained reconfigurable array (CGRA) by use of the first plurality of function units, connections between the first plurality of function units, and the one or more first local register files, and the second function unit batch may be configured to operate as a CGRA by use of the second plurality of function units, connections between the second plurality of function units, and the one or more second local register files.
A structure of the first function unit batch may be the same as a structure of the second function unit batch.
The first plurality of function units may be configured to process the one or more first instructions, and the second plurality of function units may be configured to process the one or more second instructions.
The first function unit batch may be configured to execute, during a certain cycle, at least one of the at least one or more second instructions by use of skewed instruction batch information, and the second function unit batch may be configured to execute, during a certain cycle, at least one of the at least one or more first instructions by use of skewed instruction batch information.
The first instruction batch may include a first plurality of instruction batches and the second instruction batch may include a second plurality of instruction batches, and the first function unit batch, upon receiving the first plurality of instruction batches, may be configured to sequentially execute each of the first plurality of instruction batches in a unit of a thread group including one or more threads and the second function unit batch, upon receiving the second plurality of instruction batches, may be configured to sequentially execute each of the second plurality of instruction batches in the unit of the thread group.
The first function unit batch and the second function unit batch may be configured to execute, if a block occurs at a certain thread during execution of the thread group with respect to an instruction batch and the block continues to a point when executing the thread group with respect to another instruction batch having a dependency on the instruction batch, executes the certain thread, at which the block occurs, with respect to the other instruction batch in a last order in the thread group.
The first function unit batch and the second function unit batch may be configured to, if a conditional branch occurs during execution of the thread group with respect to an instruction batch, divides the thread group into two or more sub-thread groups and executes the divided two or more sub-thread groups with respect to branches for the conditional branch, respectively.
The first function unit batch and the second function unit batch may be configured to, if the branches for the conditional branch end and merge, merge the divided two or more sub-thread groups to the thread group and execute the thread group.
According to an aspect of an exemplary embodiment, a processor may include a first function unit batch including a first plurality of function units, a first input port through which the first plurality of function units access the central register file, and a first output port through which the first plurality of function units access the central register file; a second function unit batch including a second plurality of function units, a second input port through which the second plurality of function units access the central register file, and a second output port through which the second plurality of function units access the central register file; and skewed registers assigned to each of the first plurality of function units and the second plurality of function units, wherein a skewed instruction that is to be executed during a certain cycle is generated by use of an instruction that is stored in a batch instruction memory through one of the skewed registers, and the generated skewed instruction is transmitted to each function unit assigned to the one of the skewed registers.
According to another aspect of an exemplary embodiment, there is provided an apparatus for generating a code including a program analysis unit configured to analyze a predetermined program that is to be processed in a processor including a first function unit batch including a first plurality of function units and a second function unit batch including a second plurality of function units; and an instruction batch generation unit configured to generate a first instruction batch and a second instruction batch, each including one or more instructions, which are to be respectively executed in the first function unit batch and the second function unit batch, based on a result of the analysis.
According to another aspect of an exemplary embodiment, there is provided a method of processing a batch thread by a processor including inputting a first instruction batch and a second instruction batch generated by a code generation apparatus into a first function unit batch including a first plurality of function units and a second function unit batch including a second plurality of function units; and sequentially executing, by first function unit batch and the second function unit batch, the first instruction batch and the second instruction batch, respectively.
The above and other aspects will be apparent from the following detailed description, the drawings, and the claims.
Throughout the drawings and the detailed description, unless otherwise described, the same drawing reference numerals will be understood to refer to the same elements, features, and structures. The relative size and depiction of these elements may be exaggerated for clarity, illustration, and convenience.
The following description is provided to assist the reader in gaining a comprehensive understanding of the methods, apparatuses, and/or systems described herein. Accordingly, various changes, modifications, and equivalents of the methods, apparatuses, and/or systems described herein will suggest themselves to those of ordinary skill in the art. Also, descriptions of well-known functions and constructions may be omitted for increased clarity and conciseness. In addition, terms described below are terms defined in consideration of functions in the present disclosure and may be changed according to the intention of a user or an operator or conventional practice. Therefore, the definitions must be based on contents throughout this disclosure.
Hereinafter, exemplary embodiments of a processor for batch thread processing, a method of processing a batch thread using the processor, and a code generation apparatus for batch thread processing will be described in detail with reference to accompanied drawings.
Referring to
Each of the function unit batches 120a, 120b, 120c, and 120d includes two or more function units FU0, FU1, FU2, and FU3. Each of the function unit batches 120a, 120b, 120c, and 120d includes one or more input ports 130 and one or more output ports 140, and accesses the central register file 110 through the one or more input ports 130 and the one or more output ports 140. The function unit batches 120a, 120b, 120c, and 120d may perform communication, such as data sharing, with one another through the central register file 110.
Each of the function unit batches 120a, 120b, 120c, and 120d may include one or more local register files (LR). The local register file LR may be included in one or more of the function units, and is used as a storage space for input/output data of the function unit, and operate in a first in first output (FIFO) fashion.
The processor 100 in accordance with an exemplary embodiment of the present disclosure may operate as a coarse grain reconfigurable array (CGRA) by use of the function units included in the function unit batches, the connections between the function units, and the local register file LR of the function units. In addition, the processor 100 may operate as a single instruction multiple thread (SIMT) by use of two or more function unit batches 120a, 120b, 120c, and 120d, each of which including two or more function units FU0, FU1, FU2, and FU3.
The function unit batches 120a, 120b, 120c, and 120d may have the same structure. The function units FU0, FU1, FU2, and FU3 included in each of the function unit batches 120a, 120b, 120c, and 120d may have different structures from one another. However, it is not necessary that the function units FU0, FU1, FU2, and FU3 included in each of the function unit batches 120a, 120b, 120c, and 120d have the different structures from one another, and depending on requirement, two or more function units may have the same structure.
For example, the function unit batches 120a, 120b, 120c, and 120d may include the function units FU0, FU1, FU2, and FU3 to have an equal computing power. Here, the computing power may represent an operation that is performed by the function unit, for example add, subtract, multiply, and divide, and each of the function unit batches 120a, 120b, 120c, and 120d may have such computing power by including a function unit that performs the same operation. As such, the processor 100 in accordance with an exemplary embodiment of the present disclosure operates as an SIMT through the function unit batches 120a, 120b, 120c, and 120d each having the same computing power, thereby supporting massive parallel data thread processing.
A general processor has one or more input ports and one or more output ports at an arithmetic logic unit (ALU) of each function unit so as to access a central register file, but the processor 100 in accordance with an exemplary embodiment of the present disclosure has one or more input ports 130 and one or more output ports 140 for each of the function unit batches 120a, 120b, 120c, and 120d so as to access the central register file 110, so that the overhead occurring when accessing the central register file 110 is reduced and thus the performance of the processor 100 is improved.
For example, if a general processor provided with eight function units has two input ports and one output port for each function unit, access to a central register file is achieved through sixteen input ports and eight output ports. In contrast, if the processor 100 in accordance with an exemplary embodiment of the present disclosure includes eight function units in a way that four function units are included in each of the two function unit batches, and each of the function unit batches has two input ports and one output port, access to the central register file is achieved through four input ports and two output ports, thereby reducing the overhead for the input and output operations.
Each of the function unit batches 120a, 120b, 120c, and 120d may execute one or more instruction batches that are generated through compiling. In this case, each of the instruction batches may include one or more instructions, and the respective instructions may be sequentially executed by function units, corresponding to the respective instructions.
Meanwhile, the function unit batches 120a, 120b, 120c, and 120d may execute one or more input instruction batches in units of thread groups each including one or more threads.
In this case, if a block occurs at a certain thread while the function unit batches 120a, 120b, 120c, and 120d are executing a predetermined thread group with respect to a certain instruction batch, and the block is not released until a thread of the predetermined thread group is executed with respect to another instruction batch having a dependency on the instruction batch, at which the block occurs, the function unit batches 120a, 120b, 120c, and 120d do not execute the thread, at which the block occurs, with respect to the other instruction batch such that the thread, at which the block occurs, is executed at the last point of time terminating the execution of all the threads of the predetermined thread group.
In this manner, all the threads connected to a thread that is blocked in the middle of executing an instruction batch are prevented from being blocked, so that the processing efficiency is enhanced.
If a conditional branch occurs while the function unit batches 120a, 120b, 120c, and 120d are executing a thread group with respect to a certain instruction batch, the thread group is divided into two or more sub-thread groups, and the divided sub-thread groups are executed with respect to branches for the conditional branch, respectively. In addition, if the conditional branch for the respective branches ends and the branches merge, the divided sub-thread groups are merged into the original thread group.
In this case, an iteration of the CGRA corresponds to a thread of the SIMT, and 128 iterations are performed to process a total of 128 threads as described in
When a total of 128 threads are processed similar to the matter illustrated in
Referring to
Such skewed instruction information may be generated by a code generation apparatus in a compile stage. The processor 200 accesses a batch instruction memory (BIM) through a program counter (PC) of each function unit batch by use of skewed instruction information, to transmit a corresponding instruction to a corresponding function unit in a function unit batch.
Referring to
The processor 300 in accordance with an exemplary embodiment of the present disclosure includes a skewed register 310 that corresponds to the function unit to more efficiently process the input of the skewed instructions described above. The processor 300 may generate a skewed instruction that is to be executed in one cycle by use of instructions stored in batch instruction memories BIM0, BIM1, BIM2, and BIM3 through the skewed register 310, and transmit the generated skewed instruction to the assigned function unit. Each function unit batch may access the batch instruction memory by use of a program counter (PC) thereof and a skewed register value assigned to each function unit.
In this case, the batch instruction memories BIM0, BIM1, BIM2, and BIM3 are configured to be separated into two or more in order to correspond to the respective function units as shown in
Referring to
Referring to
The program analysis unit 510 analyzes a predetermined program to be processed, and generates a result of analysis. For example, the program analysis unit 510 may analyze a dependency between each data in a program and whether a conditional branch statement is present in a program.
The instruction batch generation unit 520 may generate one or more instruction batches that are to be executed in one or more function unit batches 120a, 120b, 120c, and 120d of the processor 100, based on the result of analysis. In this case, each instruction batch may include one or more instructions.
The instruction batch generation unit 520, based on dependency analysis information of the result of analysis, may generate a code allowing the processor 100 to operate as a CGRA by use of function units included in the function unit batches 120a, 120b, 120c, and 120d. Alternatively, the instruction batch generation unit 520 may generate a code for one or more instruction batches such that function units operate in an SIMT architecture in each function unit batch.
If analyzed that a conditional branch statement is present in a program, the instruction batch generation unit 520 allows an instruction that processes branches of the conditional branch statement to be included in different instruction batches, respectively. For example, when a first path is executed if a condition evaluates to ‘true’, and a second path is executed if a condition evaluates to ‘false’, the instruction batch generation unit 520 may allow an instruction for processing the first path and an instruction for processing the second path to be included in different instruction batches, respectively.
In addition, the code generation apparatus 500 may generate an instruction allowing one of the function unit batches to sequentially execute instruction batches, which are generated by the instruction batch generation unit 520 to process the branches, or allowing different function unit batches to execute the instruction batches, respectively. In this manner, a constraint associated with a conditional branch in a general SIMT or CGRA may be efficiently handled.
The instruction batch generation unit 520 may generate instruction batches such that total latency of each instruction batch is similar to each other. In addition, the instruction batch generation unit 520 may generate instruction batches in consideration of the number of input/output ports for the function unit batches 120a, 120b, 120c, and 120d to access the central register file 110. For example, the instruction batch generation unit 520 may generate instruction batches in a way to prevent the number of requests to read the central register file by a certain instruction batch from exceeding the number of read ports of a function unit batch that executes the certain instruction batch while preventing the number of requests to write by a certain instruction batch from exceeding the number of write ports of a function unit batch that executes the certain instruction batch.
In addition, the instruction batch generation unit 520 may generate instruction batches in a way to prevent the number of instructions included in each instruction batch from exceeding the number of function units included in each function unit batch. Referring to
Meanwhile, the instruction batch generation unit 520 may generate instruction batches such that a result of an operation for which a delay may occur in a certain instruction batch, for example, a result of an operation for which a block may occur is not used as a source in the certain instruction batch. For example, the instruction batch generation unit 520, during a scheduling, may allow an operation, for which a block occurs, to be disposed at the foremost location of an instruction batch, and allow a thread execution result of the operation to be used at the last order of the instruction batch. Alternatively, the instruction batch generation unit 520 may allow an operation, for which a block occurs, to be located at the last location of an instruction batch and to be processed prior to execution of a next instruction batch.
Meanwhile, the code generation apparatus 500 may generate an instruction allowing generated instruction batches to be equally input into all function unit batches, or allowing the generated instruction batches to be divided and input into two or more function unit batches, respectively.
The code generation apparatus 500 may store generated instruction batch information and various instruction information in a configuration memory or a cache memory. Meanwhile, the instruction batch generation unit 520 may generate skewed instruction information as described above with reference to
The batch generation unit 520 has been described above. According to an exemplary embodiment, the batch generation unit 520 does not collect instructions available to be simultaneously executed, but generates a batch instruction by collecting instructions to be sequentially executed, and thus there are no difficulties in generating the batch instruction and it is possible to achieve an increased efficiency. Because multiple data can be simultaneously processed by multiple batch function units, such generation is effective to implement massively parallel data processing.
This is in contrast with Very Long Instruction Word (VLIW) and super-scalar architecture.
VLIW is an architecture in which a compiler creates a very long instruction word, which is composed of multiple instructions available to be simultaneously executed, and multiple functional units (or execution units) process the VLIW within a single clock cycle. VLIW architecture, in wide use in digital signal processing, often fails to find enough instructions that are available to be simultaneously executed, which may result in reduced efficiency. In addition, since all function units should access a central register file at the same time, hardware overhead of the central register file is disadvantageously increased.
Super-scalar is an architecture in which hardware finds instructions that are available for parallel execution at run time, and multiple execution units (or function units) process the found instructions. This architecture also has difficulties in finding instructions available to be simultaneously executed and may result in very complex hardware.
On the other hand, exemplary embodiments may simultaneously process multiple using multiple batch function units, which is effective to implement massively parallel data processing.
First, the processor 100 may input one or more instruction batches generated by the code generation apparatus into one or more function unit batches 120a, 120b, 120c, and 120d (610). In this case, the processor 100 may allocate all the generated instruction batches in units of threads and input the allocated instruction batches into the function unit batches 120a, 120b, 120c, and 120d. That is, all the instruction batches are equally input into each of the function unit batches 120a, 120b, 120c, and 120d so as to be sequentially executed while each function unit batch processes some of all the thread groups that need to be processed, which in turn, the processor 100 operates as an SIMT.
Alternatively, instruction batches may be divided and input into the function unit batches 120a, 120b, 120c, and 120d. For example, when the number of generated instruction batches is four, the four instruction batches may be input into the function unit batches 120a, 120b, 120c, and 120d, respectively, such that threads are processed in an MIMT scheme. Alternatively, the same two instruction batches are input into two function unit batches 120a and 120b, and the remaining two instruction batches are input into the remaining two function unit batches 120c and 120d such that an SIMT and an MIMT are used in combination with each other.
As the instruction batches are divided and input into the function unit batches 120a, 120b, 120c, and 120d, instruction batches that process a conditional branch are input into different function unit batches 120a, 120b, 120c, and 120d, thereby enhancing the efficiency of processing the conditional branch. In addition, because the respective function unit batches 120a, 120b, 120c, and 120d independently operate, even if a block occurs in one of the function unit batches, the remaining function unit batches may perform thread processing regardless of the block.
Thereafter, the respective function unit batches 120a, 120b, 120c, and 120d may sequentially execute the input one or more instruction batches (620). In this case, the respective function unit batches 120a, 120b, 120c, and 120d may execute each instruction batch while switching each thread with respect to the input instruction batch in an interleaved scheme described above.
Meanwhile, if a block occurs at a certain thread while the function unit batches 120a, 120b, 120c, and 120d are executing a predetermined thread group with respect to a certain instruction batch, and the block is not released until a thread of the predetermined thread group is executed with respect to another instruction batch having a dependency on the instruction batch, at which the block occurs, the function unit batches 120a, 120b, 120c, and 120d do not execute the thread, at which the block occurs, with respect to the other instruction batch such that the thread, at which the block occurs, is executed at the last point of time terminating the execution of all the threads of the predetermined thread group.
In addition, if a conditional branch occurs when the function unit batches 120a, 120b, 120c, and 120d are executing a predetermined thread group with respect to a certain instruction batch, the thread group is divided into two or more sub-thread groups and the divided sub-thread groups may be executed with respect to branches for the conditional branch, respectively. In addition, when the conditional branch for the branches ends and the branches merge, the divided sub-thread groups are merged into the original thread group.
The functions of the exemplary embodiments may be embodied as computer-readable codes in a computer-readable recording medium. The computer-readable recording medium includes all types of recording media in which computer-readable data are stored. Examples of the computer-readable recording medium include a ROM, a RAM, a CD-ROM, a magnetic tape, a floppy disk, and an optical data storage. Further, the recording medium may be implemented in the form of carrier waves such as those used in Internet transmission. In addition, the computer-readable recording medium may be distributed to computer systems over a network, in which computer-readable codes may be stored and executed in a distributed manner.
As will also be understood by the skilled artisan, the exemplary embodiments may be implemented by any combination of software and/or hardware components, such as a Field Programmable Gate Array (FPGA) or Application Specific Integrated Circuit (ASIC), which performs certain tasks. A unit or module may advantageously be configured to reside on the addressable storage medium and configured to execute on one or more processors or microprocessors. Thus, a unit or module may include, by way of example, components, such as software components, object-oriented software components, class components and task components, processes, functions, attributes, procedures, subroutines, segments of program code, drivers, firmware, microcode, circuitry, data, databases, data structures, tables, arrays, and variables. The functionality provided for in the components and units may be combined into fewer components and units or modules or further separated into additional components and units or modules.
A number of exemplary embodiments have been described above. Nevertheless, it will be understood that various modifications may be made. For example, suitable results may be achieved if the described techniques are performed in a different order and/or if components in a described system, architecture, device, or circuit are combined in a different manner and/or replaced or supplemented by other components or their equivalents. Accordingly, other implementations are within the scope of the following claims.
Number | Date | Country | Kind |
---|---|---|---|
10-2013-0044435 | Apr 2013 | KR | national |