Vector processor and operation method thereof
By utilizing LUT memory for operations beyond function approximation, the vector processor enhances its computational performance and efficiently uses memory space, addressing the inefficiency caused by its large size.
Patent Information
- Application Number
- PCT/KR2023/003191
- Authority / Receiving Office
- WO · WO
- Patent Type
- Applications
- Current Assignee / Owner
- Priority Date
- 2023-03-06
- Filing Date
- 2023-03-08
- Publication Date
- 2024-09-12
AI Technical Summary
Vector processors face inefficiencies due to the large space occupied by Look-Up Table (LUT) memory, which primarily stores coefficients for function approximation, limiting their computational performance for operations other than function approximation.
The LUT memory is utilized to store data corresponding to index values, allowing the vector processor to perform operations beyond function approximation, such as convolution and data reformatting, thereby reducing register pressure and enhancing computational performance.
This approach enables efficient use of LUT memory space, reducing register pressure and improving computational performance by storing data related to various operations within the vector processor.
Smart Images

Figure KR2023003191_12092024_PF_FP_ABST
Abstract
Description
Vector processor and its operating method
[0001] The present disclosure relates to a vector processor and an operating method thereof.
[0002] The LUT memory, which stores data corresponding to an index value, may store coefficients for function approximation. To increase the accuracy of function approximation, the LUT memory may be characterized by occupying a large amount of space in the vector processor. The vector processor of an accelerator can support various operations in addition to function approximation. However, the LUT memory, which occupies a large amount of space in the vector processor, may only store coefficients for function approximation. Therefore, the development of an operating method of a vector processor that utilizes the LUT memory to increase the computational performance of the vector processor when the vector processor performs operations other than function approximation is required.
[0003] The disclosed embodiments disclose a vector processor and its operating method. The technical problems to be solved by the present embodiments are not limited to the technical problems described above, and other technical problems can be inferred from the following embodiments.
[0004] As a technical means for achieving the above-described task, a vector processor according to the first aspect of the present disclosure may include a LUT memory that stores data corresponding to an index value; a processing unit that performs an operation based on the data; and a controller that confirms a first index value based on a command and stores first data in the LUT memory using the first index value.
[0005] According to one embodiment, the vector processor further includes a vector register, and an index value can be extracted from data stored in the vector register.
[0006] According to one embodiment, data stored in the LUT memory may include coefficients for a linear approximation of a given function.
[0007] According to one embodiment, the first index value may be a value specified by a field of the command.
[0008] According to one embodiment, the processing unit includes a first processing unit for MAC (Multiply And Accumulation) operation and a second processing unit that is an ALU (Arithmetic and Logic Unit), and the second processing unit can perform a predetermined operation based on second data identified in an LUT memory based on a second index value.
[0009] According to one embodiment, the first processing unit performs a MAC operation based on fourth data identified in the LUT memory based on third data and a third index value extracted from the third data, and the fourth data may include a coefficient for linear approximation of a given function.
[0010] According to one embodiment, the controller may store first data stored in at least one of a first memory within the accelerator including a vector register, a scalar register, a vector processor, and a second memory located external to the accelerator, in the LUT memory, based on a first index value.
[0011] According to one embodiment, the controller may store the first data stored in the LUT memory based on the fourth index value in at least one of a first memory within the accelerator including a vector register, a scalar register, and a vector processor, and a second memory located external to the accelerator.
[0012] According to one embodiment, the first index value may be a value generated by counter logic or a finite state machine (FSM) operated by an instruction.
[0013] According to one embodiment, the vector processor may include a datapath between the second processing unit and the LUT memory.
[0014] According to one embodiment, the vector processor may include a datapath between an LUT memory and at least one of a vector register, a scalar register, a first memory, and a second memory.
[0015] According to one embodiment, the controller may include a Direct Memory Access (DMA) unit that stores first data stored in a first memory within an accelerator including a vector processor or a second memory located external to the accelerator into an LUT memory, or stores first data stored in the LUT memory into the first memory or the second memory.
[0016] According to one embodiment, the vector processor further includes a vector register, and when the instruction is a loop-unrolled instruction, at least some of the data related to data processing can be stored in an LUT memory, and the remainder of the data related to data processing can be stored in the vector register.
[0017] According to one embodiment, when data processing is data processing related to convolution, at least some of the data may include at least one of a kernel weight and feature data related to the convolution.
[0018] According to one embodiment, the vector processor further includes a vector register, and the controller can perform register spill by storing first data stored in the vector register into an LUT memory.
[0019] According to one embodiment, the controller can store the first data stored in the LUT memory back into the vector register.
[0020] According to one embodiment, the LUT memory may be a memory that simultaneously outputs a plurality of data stored in a plurality of locations within the LUT memory corresponding to a plurality of index values.
[0021] According to one embodiment, data may be stored in a first area of the LUT memory, and the first data may be stored in a second area of the LUT memory.
[0022] A method of operating a vector processor including a LUT memory storing data corresponding to an index value according to a second aspect of the present disclosure and a processing unit performing an operation based on the data may include a step of confirming a first index value based on a command; and a step of storing first data in the LUT memory using the first index value.
[0023] The recording medium according to the third aspect of the present disclosure may be a non-transitory recording medium readable by a computer that records a program for executing the operating method of the above-described vector processor on a computer.
[0024] According to the present disclosure, since the first data can be stored in the LUT memory using the first index value, register pressure can be reduced. In addition, by storing the first data in the LUT memory located within the vector processor, the computational performance of the vector processor can be improved. For example, the LUT memory can store not only data related to coefficients related to function approximation, but also data related to operations other than function approximation, so that the storage space of the LUT memory can be efficiently utilized, register pressure can be reduced, and the computational performance of the vector processor can be improved.
[0025] The effects of the invention are not limited to the effects mentioned above, and other effects not mentioned will be clearly understood by those skilled in the art from the description of the claims.
[0026] Figure 1 illustrates a vector processor according to one embodiment.
[0027] FIG. 2 illustrates an accelerator and a second memory including a vector processor according to one embodiment.
[0028] Figure 3a illustrates a vector processor including a datapath between a second processing unit and an LUT memory.
[0029] FIG. 3b illustrates a vector processor including a datapath between an LUT memory and at least one of a vector register, a scalar register, a first memory, and a second memory.
[0030] Figures 4a and 4b illustrate an embodiment of storing data related to data processing by distributing it in LUT memory and vector registers.
[0031] FIG. 5a illustrates a first embodiment of performing register spill by storing first data stored in a register in an LUT memory.
[0032] FIG. 5b illustrates a second embodiment of performing register spill by storing first data stored in a register in an LUT memory.
[0033] Figure 6 illustrates one embodiment of an electronic device.
[0034] Figure 7 illustrates an operation method of a vector processor according to one embodiment.
[0035] The terms used in the embodiments have been selected from widely used and common terms, taking into account the functions of the present disclosure. However, these terms may vary depending on the intentions of those skilled in the art, precedents, the emergence of new technologies, etc. Furthermore, in certain cases, terms may be arbitrarily selected by the applicant, in which case their meanings will be described in detail in the relevant description. Therefore, the terms used in this disclosure should not be defined simply as names of terms, but rather based on the meanings of the terms and the overall content of the present disclosure.
[0036] When a part of the specification is said to "include" a component, this does not exclude other components, but rather implies the inclusion of other components, unless otherwise specifically stated. Furthermore, terms such as "part" and "module" used in the specification mean a unit that processes at least one function or operation, which may be implemented in hardware, software, or a combination of hardware and software.
[0037] The expression “at least one of a, b, and c” described throughout the specification may encompass ‘a alone’, ‘b alone’, ‘c alone’, ‘a and b’, ‘a and c’, ‘b and c’, or ‘all of a, b, and c’.
[0038] Below, embodiments of the present disclosure are described in detail with reference to the attached drawings so that those skilled in the art can easily implement the present disclosure. However, the present disclosure may be implemented in various different forms and is not limited to the embodiments described herein.
[0039] Hereinafter, embodiments of the present invention will be described in detail with reference to the attached drawings.
[0040] In describing the embodiments, descriptions of technical details that are well-known in the technical field to which the present invention pertains and are not directly related to the present invention will be omitted. This is to avoid obscuring the gist of the present invention by omitting unnecessary explanations and to convey it more clearly.
[0041] For the same reason, some components in the attached drawings are exaggerated, omitted, or schematically depicted. Furthermore, the dimensions of each component do not entirely reflect its actual size. Identical or corresponding components in each drawing are assigned the same reference numbers.
[0042] The advantages and features of the present invention, and the methods for achieving them, will become clearer with reference to the embodiments described in detail below together with the accompanying drawings. However, the present invention is not limited to the embodiments disclosed below and may be implemented in various different forms. These embodiments are provided only to ensure that the disclosure of the present invention is complete and to fully inform those skilled in the art of the scope of the invention, and the present invention is defined only by the scope of the claims. Like reference numerals designate like elements throughout the specification.
[0043] At this time, it will be understood that each block of the processing flow diagrams and combinations of the flow diagrams can be performed by computer program instructions. These computer program instructions can be installed in a processor of a general-purpose computer, a special-purpose computer, or other programmable data processing equipment, so that the instructions executed by the processor of the computer or other programmable data processing equipment create a means for performing the functions described in the flow diagram block(s). These computer program instructions can also be stored in a computer-available or computer-readable memory that can direct a computer or other programmable data processing equipment to implement the functions in a specific manner, so that the instructions stored in the computer-available or computer-readable memory can also produce a manufactured item that includes an instruction means for performing the functions described in the flow diagram block(s). Since the computer program instructions may be installed on a computer or other programmable data processing device, a series of operational steps may be performed on the computer or other programmable data processing device to create a computer-executable process, and the instructions that cause the computer or other programmable data processing device to perform the steps for performing the functions described in the flowchart block(s) may also provide steps for performing the functions described in the flowchart block(s).
[0044] Additionally, each block may represent a module, segment, or portion of code that contains one or more executable instructions for performing a specific logical function(s). It should also be noted that in some alternative implementation examples, the functions described in the blocks may occur out of order. For example, two blocks depicted in succession may actually be executed substantially concurrently, or the blocks may sometimes be executed in reverse order, depending on their respective functions.
[0045] Hereinafter, embodiments of the present disclosure will be described in detail with reference to the drawings.
[0046] Figure 1 illustrates a vector processor according to one embodiment.
[0047] The vector processor (100) may include a LUT memory (110), a processing unit (120), and a controller (130). According to one embodiment, the vector processor (100) may be a vector processor for processing vector operations. More specifically, the vector processor (100) may be a vector processor for processing a plurality of data in vector form, and may be a vector processor located inside an accelerator.
[0048] The vector processor (100) may be characterized by quickly processing various operations including function approximation. For example, the vector processor (100) may process operations such as convolution, depthwise convolution, activation, pooling, normalization, and data reformatting. The vector processor (100) illustrated in FIG. 1 only illustrates components related to the present embodiment. Therefore, it will be understood by those skilled in the art related to the present embodiment that other general-purpose components may be further included in addition to the components illustrated in FIG. 1.
[0049] The LUT memory (110) may be a memory that stores data corresponding to an index value. For example, the LUT memory (110) may be a LUT (Look Up Table) memory characterized by outputting data corresponding to an index value in response to an input of an index value. More specifically, the LUT memory (110) may simultaneously output a plurality of pieces of data stored in a plurality of locations within the LUT memory (110) in response to a plurality of index values. The LUT memory (110) may be a memory that outputs a plurality of pieces of data corresponding to an address including a plurality of index values. The LUT memory (110) that outputs a plurality of pieces of data corresponding to an address including a plurality of index values may have a structure in which a plurality of memories are connected in parallel. Here, each of the plurality of memories may be one of a single-port memory and a dual-port memory. The single-port memory may be a memory that universally uses one port as a read port and a write port, and the dual-port memory may be a memory that each includes a read port and a write port.
[0050] When an index value is input, the LUT memory (110) can output data corresponding to the index value. When the vector processor (100) includes a vector register, the index value can be extracted from data stored in the vector register. For example, the index value can be T bits included in the vector data stored in the vector register. The T bits can be the upper T bits of the vector data.
[0051] The data stored in the LUT memory (110) may include coefficients for function approximation. More specifically, when the vector processor (100) performs an activation operation, the LUT memory (110) may store coefficients for function approximation related to the activation operation. Here, the function approximation may be a piecewise linear approximation that linearly approximates the function for each of a plurality of sections. Alternatively, the function approximation may be a piecewise polynomial approximation that approximates the function in a polynomial form for each of a plurality of sections. At this time, the LUT memory (110) may store coefficients related to the function approximation for each of the plurality of sections.
[0052] For example, when the approximation of a function is a piecewise linear approximation, the coefficients corresponding to the first section among the coefficients stored in the LUT memory (110) may include a first coefficient and a second coefficient. Here, the first coefficient may be a coefficient that is the target of a multiplication operation with vector data, and the second coefficient may be a coefficient that is added to the result value according to the multiplication operation of the vector data and the first coefficient.
[0053] In order to minimize the error of function approximation, the LUT memory (110) needs to be configured as a memory with a large depth. In addition, in order for the vector processor (100) to efficiently process a plurality of data, the LUT memory (110) needs to be configured in a form including a plurality of ports with a structure in which a plurality of memories are connected in parallel. Accordingly, the LUT memory (110) located within the vector processor (100) may be characterized by occupying a large space in the vector processor (100). According to one embodiment, the LUT memory (110) located within the vector processor (100) may occupy about 20 to 30% of the space of the vector processor (100).
[0054] In addition, the larger the vector register within the vector processor (100), the better the performance. However, since the physical size of the vector processor (100) itself also increases, the size of the vector register has physical limitations. Accordingly, using the LUT memory (110) for purposes other than storing coefficients related to function approximation can be of great technical utility.
[0055] In this regard, the disclosed embodiments below may relate to an operating method of a vector processor (100) using an LUT memory (110). The LUT memory (110) may store first data corresponding to a first index value, and the first data stored in the LUT memory (110) may be data related to an operation other than function approximation. Here, the operation other than function approximation may include convolution, depth-wise convolution, pooling, normalization, and data reformatting.
[0056] For example, when performing data reformatting, the controller (130) can store a plurality of vector data to be subjected to data reformatting in the LUT memory (110). The controller (130) can control an operation to transform the arrangement of the plurality of vector data stored in the LUT memory (110) into a row-centered or column-centered operation to be performed in the processing unit (120). In addition, when performing convolution, the controller (130) can store at least some of the plurality of vector data related to convolution in the LUT memory (110). The controller (130) can control a convolution operation to be performed in the processing unit (120) based on the plurality of vector data related to convolution including the vector data stored in the LUT memory (110). Since the LUT memory (110) can store not only data related to coefficients related to approximation of a function, but also data related to operations other than approximation of a function, the storage space of the LUT memory (110) can be efficiently used, the register presser can be reduced, and the operation performance of the vector processor (100) can be increased.
[0057] The processing unit (120) can perform operations based on data. For example, the processing unit (120) can include a first processing unit for MAC (Multiply And Accumulation) operations and a second processing unit that is an ALU (Arithmetic and Logic Unit). The processing unit (120) can perform operations based on at least one of data stored in the LUT memory (110), as well as data stored in a vector register within the vector processor (100), a scalar register, a first memory within the accelerator, and a second memory located outside the accelerator.
[0058] The controller (130) can control the overall operation of the vector processor (100). The controller (130) can check a first index value based on a command and store first data in the LUT memory (110) using the first index value. Here, the first data may be data related to an operation other than function approximation. The controller (130) can check the first index value based on a field of a command received from a program memory within the accelerator. The controller (130) can store first data corresponding to the first index value in the LUT memory (110).
[0059] The instruction may include a command that causes the vector processor (100) to process a predetermined operation. The instruction may include a command that causes data stored in the LUT memory (110) to be stored in another memory or register. Additionally, the instruction may include a command that causes data to be stored in a specific location in the LUT memory (110) corresponding to an index value.
[0060] As the controller (130) stores the first data, which is data related to operations other than function approximation, in the LUT memory (110), the register pressure of the vector processor (100) may be reduced. In the present invention, a high register pressure may mean that the amount of data that must be stored in a register to process an instruction is large. In this regard, a high register pressure may mean that the number of registers required to process an instruction is large. More specifically, a high register pressure may mean that the amount of data that must be stored in a vector register to process an instruction is greater than the amount of data that can be stored in the register. In this case, the number of registers required to process an instruction may be greater than the number of registers in the vector processor.
[0061] FIG. 2 illustrates an accelerator and a second memory including a vector processor according to one embodiment.
[0062] In FIG. 2, the accelerator (200) may include a vector processor (100), a first memory (210), a program memory (213), a DMA unit (221), and a calculation unit (222). According to an embodiment, the accelerator (200) may be hardware dedicated to a neural network for quickly processing operations frequently used in a neural network. According to an embodiment, the accelerator (200) may be a hardware accelerator such as a neural processing unit (NPU), a Tensor Processing Unit (TPU), a Neural Engine, etc., which are dedicated modules for driving a neural network, but are not limited thereto. The accelerator (200) illustrated in FIG. 2 only illustrates components related to the present embodiment. Therefore, a person having ordinary skill in the art related to the present embodiment will understand that other general-purpose components may be further included in addition to the components illustrated in FIG. 2. Descriptions of the overlapping contents with FIG. 1 with respect to the vector processor (100) will be omitted.
[0063] According to one embodiment, the data stored in the LUT memory (110) may vary depending on the point in time at which the command is processed. At a first point in time, the data stored in the LUT memory (110) may be data including coefficients for linear approximation of a function. At a second point in time, the data stored in the LUT memory (110) may be first data related to an operation other than linear approximation of the function. That is, when an operation related to linear approximation of a function is not performed at a specific point in time, the first data related to an operation other than linear approximation of the function may be stored in the LUT memory (110).
[0064] According to another embodiment, the LUT memory (110) may be divided into a first region and a second region. Data including coefficients for linear approximation of a function may be stored in the first region of the LUT memory (110). First data related to operations other than linear approximation of a function may be stored in the second region of the LUT memory (110). That is, when there is free space in the second region of the LUT memory (110), an operation of checking a first index value based on a command and storing the first data in the LUT memory (110) using the first index value may be performed.
[0065] The processing unit (120) may include a first processing unit (121) for MAC (Multiply And Accumulation) operations and a second processing unit (122) which is an ALU (Arithmetic and Logic Unit). More specifically, the second processing unit (122) may be a processing unit that performs operations other than addition and multiplication operations performed in the first processing unit (121). For example, the second processing unit (122) may perform logical operations including shift operations and and operations.
[0066] When performing an operation related to function approximation in a vector processor (100), the first processing unit (121) may perform a MAC operation based on fourth data confirmed in the LUT memory (110) based on third data and a third index value extracted from the third data. The MAC operation of the first processing unit (121) may be expressed by the following mathematical expression 1.
[0067] [Mathematical Formula 1]
[0068] Y = A*X + B
[0069] Here, X may be the third data. In addition, when a third index value extracted from the third data is input, the LUT memory (110) may output the fourth data corresponding to the third index value. For example, the third index value may be the upper T bits of the third data, and the fourth data may be {A, B}. More specifically, the first coefficient A among the fourth data may be a coefficient that is the target of a multiplication operation with the vector data X. In addition, the second coefficient B among the fourth data may be a coefficient that is added to A*X, which is a result value of the multiplication operation of the vector data X and the first coefficient A.
[0070] The second processing unit (122) may perform a predetermined operation based on second data identified in the LUT memory (110) based on the second index value. In this regard, the vector processor (100) may include a data path between the second processing unit (122) and the LUT memory (110). That is, data stored in the LUT memory (110) may be used as an input value of the second processing unit (122). Here, the second data may be data related to function approximation or first data related to an operation other than function approximation.
[0071] The controller (130) can determine the first index value based on a command. The command may be a command related to data processing. Here, the first index value may be a value specified by a field of the command. More specifically, when the command is a command related to reading data stored in the LUT memory (110), the first index value may be characterized by being specified by a field of the command.
[0072] Although not shown in FIG. 2, the vector processor (100) may include a unit related to counter logic or a finite state machine (FSM). In this case, the index value may be a value generated by the counter logic or the finite state machine (FSM) that operates by an instruction.
[0073] 1) The counter logic may be an electronic logic circuit composed of one or more flip-flops and an adder / subtractor, and may be characterized by performing a specific operation a set number of times while increasing or decreasing a value set in the counter logic. 2) The FSM may be a finite state machine that defines a finite number of operating states and defines which value will be output to the outside according to the input value for each operating state and which value the next operating state value will be changed to. In this regard, the FSM may be composed of a flip-flop for storing the operating state and an electronic logic circuit for determining the output value and the next operating state value. The vector processor (100) may check the first index value generated by the counter logic or the FSM-related unit, and check a plurality of data corresponding to the first index value among the data stored in the LUT memory (110).
[0074] That is, the controller (130) of the vector processor (100) can control the LUT memory (110) to output multiple data at once or store multiple data at once in the LUT memory (110) based on the first index value, which is a value generated by a unit related to counter logic or FSM.
[0075] The memory within the accelerator (200) including the vector processor (100) may include a first memory (210) and a program memory (213). In addition, the first memory (210) may include a scalar data memory (211) and a vector data memory (212).
[0076] The scalar data memory (211) can store scalar data. For example, the scalar data memory (211) can store the values of arguments related to operations. The vector data memory (212) can store vector data related to operations in the accelerator (200). For example, when processing an image in the accelerator (200), feature map data can be stored in the vector data memory (212).
[0077] The program memory (213) may be a flash memory typically used to execute programs and commands. The program memory (213) may be a hard drive or a solid state drive (SSD). For example, the program memory (213) may store compiled programs and commands. The controller (130) may check a first index value based on a field of a command received from the program memory (213), thereby storing first data corresponding to the first index value in the LUT memory (110) or controlling the LUT memory (110) to output first data corresponding to the first index value.
[0078] The DMA (Direct Memory Access, hereinafter referred to as DMA) unit (221) may be a unit that allows access to memory independently from the vector processor (100). Here, the memory may include a first memory (210) and a second memory (230). The DMA unit (221) may perform data movement without intervention of the vector processor (100). When accessing memory through the DMA unit (221), fewer interrupts may occur, and when data is moved, the vector processor (100) may perform other operations, so that the computational efficiency of the accelerator (200) may be greatly increased.
[0079] The operation unit (222) may be a dedicated unit for quickly processing specific operations of the accelerator (200), including matrix multiplication, systolic arrays related to data reuse, etc. For example, it may be efficient for pooling operations and activation operations to be performed in the vector processor (100), and convolution operations to be performed in the operation unit (222). However, among the convolution operations, it may be more efficient for the depthwise convolution operation to be performed in the vector processor (100), but the present invention is not limited thereto.
[0080] In FIG. 2, the second memory (230) is a memory located outside the accelerator (200), and can store data stored in a memory located inside the accelerator (200) or data generated according to an operation of the accelerator (200). The second memory (230) may be referred to as an external memory. The external memory may be DRAM.
[0081] Although not shown in FIG. 2, the vector processor (100) may include a vector register and a scalar register. At this time, the controller (130) may store first data stored in at least one of the vector register, the scalar register, the first memory (210) within the accelerator (200) including the vector processor (100), and the second memory (230) located outside the accelerator (200) in the LUT memory (110) based on the first index value. In addition, the controller (130) may store first data stored in the LUT memory (110) based on the fourth index value in at least one of the vector register, the scalar register, the first memory (210) within the accelerator (200) including the vector processor (100), and the second memory (230) located outside the accelerator (200). In relation to this, the vector processor (100) may include a data path between the LUT memory (110) and at least one of a vector register, a scalar register, a first memory (210), and a second memory (230).
[0082] Although not illustrated in FIG. 2, the vector processor (100) may include a vector memory access unit. The vector memory access unit may be a unit that acts as an interface so that vector data generated by operations in the vector processor (100) can be stored in a vector data memory (212) within the accelerator (200). In addition, the vector memory access unit may be a unit that acts as an interface so that vector data generated by operations in the vector processor (100) can be stored in a vector register or the like within the vector processor (100).
[0083] Although not shown in FIG. 2, the vector processor (100) may include a separate DMA unit that is different from the DMA unit (221) and located within the vector processor (100). More specifically, the vector processor (100) may include a DMA unit that stores first data stored in the first memory (210) or the second memory (230) in the LUT memory (110), or stores first data stored in the LUT memory (110) in the first memory (210) or the second memory (230).
[0084] A datapath may be a path along which data including vector data and scalar data moves. In FIG. 3a, the datapath between the second processing unit (122) and the LUT memory (110) will be examined, and in FIG. 3b, the datapath between the LUT memory (110) and at least one of the vector register, the scalar register, the first memory (210), and the second memory (230) will be examined.
[0085] Figure 3a illustrates a vector processor including a datapath between a second processing unit and an LUT memory.
[0086] Referring to FIG. 3A, a first data path (310) may be formed between a second processing unit (122) and an LUT memory (110). More specifically, the first data path (310) may be a data path for data output from the LUT memory (110) to be input to the second processing unit (122). The controller (130) may control data corresponding to an index value to be transferred from the LUT memory (110) to the second processing unit (122) through the first data path (310). Accordingly, the second processing unit (122) may perform a predetermined operation based on the data transferred from the LUT memory (110).
[0087] For example, the second processing unit (122) may perform one of the arithmetic operations including a complement operation and a division operation based on the data. Alternatively, the second processing unit (1220) may perform one of the logical operations including an and operation, an or operation, a not operation, an xor operation, and a shift operation based on the data. That is, the second processing unit (122) may use data transferred from the LUT memory (110) through the first data path (310) as input data for the operation.
[0088] Referring to FIG. 3A, a second data path (320) may be formed between the first processing unit (121) and the LUT memory (110). More specifically, the second data path (320) may be a data path for inputting data output from the LUT memory (110) to the first processing unit (121). The controller (130) may control data corresponding to an index value to be transferred from the LUT memory (110) to the first processing unit (121) through the second data path (320). Accordingly, the first processing unit (121) may perform a MAC operation based on the first data corresponding to the first index value. When performing an operation related to function approximation in the vector processor (100), the first processing unit (121) may perform a MAC operation based on the fourth data confirmed in the LUT memory (110) based on the third data and the third index value extracted from the third data.
[0089] When the third data is data stored in a vector register, the third index value extracted from the third data may be the upper T bits of the third data. For example, if 256 data can be stored in the LUT memory (110), T may be 8. For example, if the third index value is 10000000 (2), the third index value may correspond to the 128th position of the LUT memory (110).
[0090] For example, in relation to the MAC operation expressed by mathematical expression 1, the first processing unit (121) may perform a multiplication operation using the first coefficient among the third data and the fourth data. In addition, the first processing unit (121) may perform a sum operation based on the result value according to the multiplication operation of the first coefficient among the third data and the fourth data and the second coefficient among the fourth data.
[0091] The controller (130) may store data stored in the LUT memory (110) based on a command in a vector register or a scalar register. For example, referring to FIG. 3A, a third data path (330) may be formed between the LUT memory (110) and the vector register. More specifically, the third data path (330) may be a data path for inputting data output from the LUT memory (110) to a vector register within the vector processor (100).
[0092] The data stored in the LUT memory (110) may be stored in a vector register through a vector memory access unit (300). In addition, although not shown in FIG. 3A, the controller (130) may control the data stored in the LUT memory (110) to be transferred to the first memory (210) or the second memory (230) based on a command. The data stored in the LUT memory (110) may be stored in the first memory (210) or the second memory (230) through the vector memory access unit (300). In this regard, the controller (130) may store the first data stored in the LUT memory (110) based on the fourth index value in at least one of the first memory (210) within the accelerator (200) including the vector register, the scalar register, and the vector processor (100), and the second memory (230) located outside the accelerator (200).
[0093] The index value (331) may be an index value extracted from data stored in a vector register. For example, the index value (331) may be the upper T bits of the data stored in the vector register. The index value (331) may be transferred to the LUT memory (110), and the LUT memory (110) may output data corresponding to the index value. The controller (130) may use the index value (331) to control the LUT memory (110) to output data corresponding to the index value (331).
[0094] The first index value confirmed by the controller (130) can be transmitted from the controller (130) to the LUT memory (110), and the LUT memory (110) can output data corresponding to the first index value. In this regard, the first index value can be a value specified by a field of a command. Alternatively, the first index value can be a value generated by a counter logic or FSM operated by the command.
[0095] FIG. 3b illustrates a vector processor including a datapath between an LUT memory and at least one of a vector register, a scalar register, a first memory, and a second memory.
[0096] A data path may be formed between the LUT memory (110) and at least one of a vector register, a scalar register, a first memory (210), and a second memory (230). In this regard, the controller (130) may control, based on a first index value, first data stored in at least one of the first memory (210) within the accelerator (200) including the vector register, the scalar register, the vector processor (100), and the second memory (230) located outside the accelerator (200) to be transferred to the LUT memory (110).
[0097] According to one embodiment, the fourth data path (340) and the fifth data path (350) of FIG. 3B may be data paths formed between the LUT memory (110) and the vector register. More specifically, the fourth data path (340) may be a data path for inputting data stored in the vector register into the LUT memory (110) via the vector memory access unit (300). In addition, the fifth data path (350) may be a data path for inputting data stored in the vector register into the LUT memory (110) via the MUX.
[0098] The controller (130) can control data stored in the vector register to be transferred to the LUT memory (110) via the fourth data path (340) or the fifth data path (350). Accordingly, the LUT memory (110) can store data corresponding to the index value. As some of the data stored in the vector register is stored in the LUT memory (110), the register pressure can be reduced.
[0099] Additionally, the controller (130) can update data stored in the LUT memory (110) based on a command. The controller (130) can identify an index value to be updated and new data based on a command related to updating data stored in the LUT memory (110). The controller (130) can update data stored in a specific location of the LUT memory (110) corresponding to the index value with new data.
[0100] Figures 4a and 4b illustrate an embodiment of storing data related to data processing by distributing it in LUT memory and vector registers.
[0101] First data related to operations other than function approximation may be stored in the LUT memory (110) in correspondence with the first index value. However, when the vector processor (100) reads the first data from the vector data memory (212) in the accelerator (200), a large latency may occur, unlike when the scalar data is read from the scalar data memory (211). With respect to the latency, 1) the vector data memory (212) is connected to a plurality of processors or data processing modules and sequentially processes instructions received from the plurality of processors or data processing modules, so it may take a large amount of time for an instruction received before the instruction to read the first data from the vector data memory (212) to be processed. In addition, 2) the vector data memory (212) is located outside the vector processor (100) and must be connected to a plurality of data processing modules, so it may be placed at a physically distant location from the vector processor (100). Accordingly, it may take a longer physical time for the vector processor (100) to read data from the vector data memory (212). In addition, 3) it may take a long time for the DMA unit (221) to access the first memory (210) or the second memory (230) independently of the vector processor (100) or for a specific operation to be processed through the operation unit (222). That is, for these reasons, the latency for the vector processor (100) to read the first data from the vector data memory (212) in the accelerator (200) may take a long time.
[0102] When the code is compiled, loop unrolling of loop statements such as for statements and while statements related to instructions may be performed together. Here, loop unrolling is a method of reducing the number of loop iterations by replicating the body of the loop multiple times and executing them all at once. When loop unrolling is performed with respect to an instruction when the code is compiled, the instruction may be a loop-unrolled instruction. When processing a loop-unrolled instruction, the operation speed of the vector processor (100) may be boosted as increment operations, comparison operations, etc. for loop control are omitted. However, the number of vector registers required to process the loop-unrolled instruction also increases.
[0103] For example, when the operation is a 3*3 kernel operation and the latency that occurs when the vector processor (100) reads the first data from the vector data memory (212) is N, the number of vector registers required to process the instruction according to one embodiment can be calculated as shown in Table 1 below.
[0104] Number of loop unrolls Number of vector registers Number of cycles 0 20 N + 10 130 N + 20 240 N + 30 350 N + 40
[0105] ⅰ) For example, when the number of loop unrollings is 0 and the vector processor (100) performs a 3*3 kernel operation, 1) there may be 9 kernel weight-related data, 1 bias-related data, 9 feature data, and 1 operation result data according to the kernel operation. That is, the number of data related to the 3*3 kernel operation may be 20. If the number of data that can be stored in each vector register is 1, the number of vector registers required to perform the 3*3 kernel operation may be 20. 2) In addition, the time required to read the bias-related data, the kernel weight-related data, and the feature data from the vector data memory (212) may be N cycles. In addition, the time required to calculate the operation result data according to the kernel operation based on the bias-related data, the kernel weight-related data, and the feature data may be 10 cycles. That is, the total time required to perform a 3*3 kernel operation can be N+10 cycles.
[0106] ⅱ) In addition, for example, when the number of loop unrollings is 1 and the vector processor (100) performs a 3*3 kernel operation, 1) there may be 9 kernel weight-related data, 1 bias-related data, 18 feature data, and 2 operation result data according to the kernel operation. That is, the number of data related to the 3*3 kernel operation may be 30. If the number of data that can be stored in each vector register is 1, the number of vector registers required to perform the 3*3 kernel operation may be 30. In addition, when the number of loop unrollings is 1, the number of kernel operations executed by the instruction may be 2. 2) In addition, the time required to read the bias-related data, the kernel weight-related data, and the feature data from the vector data memory (212) may be N cycles. Additionally, the time required to compute the computational result data according to the kernel operation based on the bias-related data, kernel weight-related data, and feature data may be 20 cycles. In other words, the total time required to perform a 3*3 kernel operation may be N+20 cycles.
[0107] The time required to perform a 3*3 kernel operation twice may vary depending on the number of loop unrollings. 1) When the number of loop unrollings is 0, the time required to perform a 3*3 kernel operation twice may be 2*(N+10) cycles. 2) When the number of loop unrollings is 1, the time required to perform a 3*3 kernel operation twice may be N+20 cycles. The time required when the number of loop unrollings is 0 is 2N+20 cycles, which may be greater than the time required when the number of loop unrollings is 1, which is N+20 cycles. That is, when an operation is performed based on a loop-unrolled instruction, the operation speed of the vector processor (100) may be significantly boosted. More specifically, as the number of loop unrollings increases, the time required to complete data processing decreases, and therefore, the operation speed of the vector processor (100) may be boosted. However, as we have seen, as the number of loop unrolls increases, the number of vector registers required to process instructions may increase.
[0108] At this time, in order to minimize register pressure, the instruction may be defined to store at least some of the data related to data processing in the LUT memory (110) and store the remainder of the data related to data processing except at least some of the data related to data processing in the vector register.
[0109] When the code is compiled, the number of loop unrolling operations can be determined. The number of loop unrolling operations can be characterized as being determined based on the free space of the LUT memory (110). For example, the number of loop unrolling operations can be determined based on whether an operation related to linear approximation of a function is performed at a specific point in time. More specifically, if an operation related to linear approximation of a function is not performed at a specific point in time, the free space of the LUT memory (110) can be determined to be large. In addition, for example, the LUT memory (110) can be divided into a first area where coefficients related to function approximation are stored and a second area where data related to operations other than function approximation are stored, and thus the number of loop unrolling operations can be determined based on the free space of the second area of the LUT memory (110).
[0110] Embodiments 1 to 3 below illustrate a method in which coefficients for linear approximation of a function are stored in an LUT memory (110), and data related to convolution is divided and stored in the LUT memory (110) and a vector register when the controller (130) receives a command for data processing related to convolution. Embodiments 1 to 3 may be embodiments in which the number of vector registers in the vector processor (100) is 32 and a 3*3 kernel operation is performed as shown in Table 1.
[0111] Example 1.
[0112] Embodiment 1 may be an embodiment in which all data related to convolution is stored in a vector register. For example, the vector register may store all data related to convolution, such as bias, kernel weight, feature data, and operation result values, and the LUT memory (110) may store only coefficients for linear approximation of a function.
[0113] The number of loop unrollings corresponding to Example 1 may be 1. Referring to Table 1, when the number of loop unrollings is 2, the number of vector registers required for kernel operation may be 40, which is greater than the number of vector registers in the vector processor (100), which is 32. That is, the optimal number of loop unrollings may be calculated as 1.
[0114] However, if there is free space in the LUT memory (110), at least some of the data related to convolution, as in Examples 2 and 3, may be stored in the LUT memory (110). In this regard, when data processing is data processing related to convolution, the data stored in the LUT memory (110) may be at least one of the kernel weight and feature data related to convolution. Although the kernel weight and bias are described separately herein, the kernel weight may also be used as a concept including the bias.
[0115] Example 2.
[0116] Embodiment 2 corresponding to FIG. 4A may be an embodiment in which a kernel weight (401) among data related to convolution is stored in an LUT memory (110). More specifically, the LUT memory (110) may store not only coefficients (402) for linear approximation of a function but also the kernel weight (401). Although not shown in FIG. 4A, the LUT memory (110) may also store a bias.
[0117] The vector register can store feature data (403) and operation result values (404) related to convolution. At this time, the index value corresponding to the kernel weight (401) stored in the LUT memory (110) may be a value specified by a field of the instruction. Alternatively, the index value corresponding to the kernel weight (401) stored in the LUT memory (110) may be a value generated by a counter logic or FSM operated by the instruction.
[0118] The number of loop unrollings corresponding to Example 2 can increase up to 2. More specifically, when the number of loop unrollings is 0, the number of feature data used in the kernel operation can be 9, and the number of calculation result values according to the kernel operation can be 1. In addition, each time the number of loop unrollings increases by 1, the number of feature data used in the 3*3 kernel operation and the number of calculation result values according to the kernel operation can increase by 9 and 1, respectively. When the number of loop unrollings is 2, the number of vector registers required for the kernel operation can be calculated as 30. The optimal number of loop unrollings in Example 2 can be calculated as 2.
[0119] Example 3.
[0120] Embodiment 3 of FIG. 4b may be an embodiment in which feature data (411) among data related to convolution is stored in an LUT memory (110). More specifically, the LUT memory (110) may store feature data (411) as well as coefficients (412) for linear approximation of a function. Although not illustrated in FIG. 4a, the LUT memory (110) may also store bias.
[0121] The vector register can store kernel weight (413) and operation result value (414), which are data related to convolution. At this time, the index value corresponding to the feature data (411) stored in the LUT memory (110) may be a value specified by a field of the instruction. Alternatively, the index value corresponding to the feature data (411) stored in the LUT memory (110) may be a value generated by a counter logic or FSM operated by the instruction.
[0122] The number of loop unrollings corresponding to Example 3 can increase up to 22. More specifically, when the number of loop unrollings is 0, the kernel weight used in the kernel operation can be 9, and the calculation result value according to the kernel operation can be 1. However, since the kernel weight is a fixed constant value in the kernel operation, only the calculation result value according to the kernel operation can increase by 1 each time the number of loop unrollings increases by 1. When the number of loop unrollings is 22, the kernel weight can be 9, and the calculation result value according to the kernel operation can be 23. At this time, the number of vector registers required for the kernel operation can be equal to 32, which is the number of vector registers in the vector processor (100). That is, the optimal number of loop unrollings in Example 3 can be calculated as 22.
[0123] In addition, based on the free space of the LUT memory (110), the data to be stored in the LUT memory (110) among the data related to data processing can be determined. Specifically, when the code is compiled, the data to be stored in the LUT memory (110) and the number of loop unrollings can be determined based on the free space of the LUT memory (110). For example, when the free space of the LUT memory (110) is large, it may be appropriate to store data with a large amount of data among the data processing related data in the LUT memory (110). In addition, the number of loop unrollings can be set relatively large. Conversely, when the free space of the LUT memory (110) is small, it may be appropriate to store data with a small amount of data among the data processing related data in the LUT memory (110). In addition, the number of loop unrollings can be set relatively small. In a general kernel operation, the feature data may have different values for each kernel operation, while the kernel weight may have a fixed value. That is, the total amount of data in the feature data can be greater than the total amount of data in the kernel weights.
[0124] The data amount of the coefficient (412) stored in the LUT memory (110) of FIG. 4b may be smaller than the data amount of the coefficient (402) stored in the LUT memory (110) of FIG. 4a. That is, it may be efficient to store feature data (411) with a large data amount among data related to kernel operations in the LUT memory (110) of FIG. 4b. Conversely, it may be appropriate to store kernel weights (401) with a relatively small data amount among data related to kernel operations in the LUT memory (110) of FIG. 4a.
[0125] If the amount of data that must be stored in a vector register to handle data processing is greater than the amount of data that can be stored in the vector register, register spill may occur for some of the data stored in the vector register. The controller (130) may perform register spill by storing the first data stored in the vector register in the LUT memory (110) within the vector processor (100). In this regard, an embodiment of performing register spill will be described with reference to FIGS. 5A and 5B below.
[0126] FIG. 5a illustrates a first embodiment of performing register spill by storing first data stored in a register in an LUT memory.
[0127] According to one embodiment, the controller (130) can verify a command. The controller (130) can control a plurality of vector data to be stored in a vector register based on the command. However, if the number of the plurality of vector data is greater than the number of vector registers, register spill may occur in some of the data stored in the vector register.
[0128] In relation to this, the first data may be data stored in a vector register of the vector processor (100) and may be data in which register spill occurs. The first data may be data related to an operation other than function approximation. The first data identified as a target of register spill may be a value corresponding to V[0] of the vector register. Here, V[0] may be data stored in a specific location of the vector register corresponding to the index value 0. Referring to FIG. 5A, V[0] may be X0(501), which is the first data.
[0129] In addition, the controller (130) can check the first index value based on the command. More specifically, the command may be a command related to storing first data in a specific location of the LUT memory (110) corresponding to the first index value. Referring to FIG. 5A, the first index value may be a0. The command may be a command related to storing first data X0 (501) in a specific location of the LUT memory (110) corresponding to the first index value a0.
[0130] Here, the first index value may be a value specified by a field of the command. Alternatively, the first index value may be a value generated by a key-council logic or FSM operated by the command. In this case, the plurality of first index values may be a0, a1, a2, and the plurality of first data may be X0 (501), X1, X2.
[0131] As seen in Fig. 3b, the first data stored in the vector register can be transferred to the LUT memory (110) via the vector memory access unit (300). That is, the vector memory access unit (300) can serve as an interface that transfers the data stored in the vector register to the LUT memory (110).
[0132] According to one embodiment, the controller (130) may store first data corresponding to the first index value in the LUT memory (110). For example, the controller (130) may store first data X0 (501) corresponding to the first index value a0 in the LUT memory (110). LUT[a0] (502) may be data stored in a specific location of the LUT memory (110) corresponding to the first index value a0. Referring to FIG. 5A, LUT[a0] (502) may be the first data X0 (501). In addition, PLw may be the time required for the first data stored in the vector register to be stored in the LUT memory (110).
[0133] When register spill occurs in the first data stored in the vector register, it may be efficient for the first data to be stored in the LUT memory (110). More specifically, since the LUT memory (110) is located within the vector processor (100), the physical distance between the vector register and the LUT memory (110) may be relatively close compared to the distance between the vector register and one of the first memory (210) and the second memory (230). That is, PLw, which is the time required for the first data stored in the vector register to be stored in the LUT memory (110), may be characterized as being shorter than the time N required for the data stored in the vector register to be stored in one of the first memory (210) and the second memory (230) (PLw << N).
[0134] According to one embodiment, the controller (130) can verify the command and control the processing unit (120) to perform operations related to data processing.
[0135] According to one embodiment, the controller (130) can control the processing unit (120) to perform an operation based on first data stored in the LUT memory (110). The operation related to data processing in FIG. 5A can be expressed by mathematical expression 2.
[0136] [Equation 2]
[0137] V[8] = V[1] * LUT[a0]
[0138] In relation to this, the controller (130) can extract V[1] from the vector register and extract LUT[a0](502), which is data stored in the LUT memory (110), using a0 as an index value. That is, the controller (130) can directly check LUT[a0](502) stored in the LUT memory (110) to perform an operation. As seen, LUT[a0](502) can be the first data X0(501).
[0139] The controller (130) can transmit V[1] and LUT[a0](502) to the processing unit (120). The processing unit (120) can calculate V[8] through Equation 2 based on V[1] and LUT[a0](502). Equation 2 represents a multiplication operation, and the operation in FIG. 5A can be performed in the first processing unit (121).
[0140] Although not shown in Fig. 5a, operations related to data processing may also be performed in the second processing unit (122). In this case, LUT[a0](502), which is data extracted from the LUT memory (110) using a0 as an index value, may be directly used as an input value of the second processing unit (122) via the first data path (310).
[0141] According to one embodiment, the controller (130) may store the result value of an operation in a vector register. For example, the controller (130) may store the result value of an operation related to data processing in a vector register. , V[8] may be data stored in a specific location of a vector register corresponding to the index value 8. Referring to FIG. 5a, V[8] may be V [1] * LUT[a0].
[0142] Pwb may be the time required for an operation to perform an operation and an operation to store the result value of the operation in a vector register. As previously discussed, the LUT memory (110) is located within the vector processor (100), and thus the physical distance between the vector register and the LUT memory (110) may be relatively close compared to the distance between the vector register and one of the first memory (210) and the second memory (230). That is, Pwb may be characterized as being shorter than the total time required for an operation to read data stored in one of the first memory (210) and the second memory (230), an operation to perform an operation, and an operation to store the result value of the operation in the vector register.
[0143] FIG. 5b illustrates a second embodiment of performing register spill by storing first data stored in a register in an LUT memory.
[0144] Referring to Fig. 5b, the first data identified as the target of register spill may be X0 (501), which is a value corresponding to V[0] of the vector register. The contents from t0 to t0 + PLw overlap with Fig. 5a, and therefore, description is omitted.
[0145] Unlike FIG. 5A, the controller (130) of FIG. 5B can transfer the first data stored in the LUT memory (110) back to the vector register. In this regard, the controller (130) can check a command. Here, the command may be a command related to storing the corresponding first data, which is a first index value among the data stored in the LUT memory (110), in the vector register. Referring to FIG. 5B, the first index value may be a0. The controller (130) can check the LUT[a0](502) stored in the LUT memory (110) based on the first index value a0. Referring to FIG. 5B, the LUT[a0](502), which is data stored in a specific location of the LUT memory (110) corresponding to the first index value a0, may be the first data X0(501).
[0146] According to one embodiment, the controller (130) may store the first data corresponding to the first index value back into the vector register. The index value related to the first data being stored at a specific location of the vector register may be specified by a field of the instruction. Referring to FIG. 5B, the data corresponding to the index value 7 of the vector register may be the first data X0 (501). Unlike FIG. 5A, the controller (130) of FIG. 5B may be characterized by storing the first data X0 (501) stored in the LUT memory (110) back into the vector register.
[0147] PLr may be the time until the first data stored in the LUT memory (110) is stored again in the vector register. Since the LUT memory (110) is located within the vector processor (100), the physical distance between the vector register and the LUT memory (110) may be relatively close compared to the distance between the vector register and one of the first memory (210) and the second memory (230). That is, PLr may be characterized as being shorter than the time until the data stored in one of the first memory (210) and the second memory (230) is stored in the vector register.
[0148] According to one embodiment, the controller (130) can verify a command and control the processing unit (120) to perform an operation related to data processing. For example, the controller (130) can perform an operation based on first data stored in a vector register. The operation in FIG. 5b can be expressed by mathematical equation 3.
[0149] [Equation 3]
[0150] V[8] = V[1] * V[7]
[0151] In relation to this, the controller (130) can extract V[1] and V[7] from the vector register. The controller (130) can transfer V[1] and V[7] to the processing unit (120). The processing unit (120) can calculate V[8] through mathematical expression 2 based on V[1] and V[7]. The controller (130) can check the first data X0(501) from V[7] stored in the vector register rather than from LUT[a0](502) stored in the LUT memory (110). The operation of the vector processor (100) of FIG. 5A may be more efficient in terms of the time required for the operation than the operation of the vector processor (100) of FIG. 5B. In addition, since mathematical expression 3 also represents a multiplication operation, the operation in FIG. 5B may be performed in the first processing unit (121).
[0152] According to one embodiment, the controller (130) may store the result value of an operation in a vector register. For example, the controller (130) may store the result value of an operation related to data processing in a vector register. In this regard, data corresponding to the index value 8 of the vector register may be V[1] * V[7]. Pwb may be the time required for an operation to perform an operation and an operation to store the result value of the operation in the vector register. As described above, the LUT memory (110) is located within the vector processor (100), and thus, the physical distance between the vector register and the LUT memory (110) may be relatively close compared to the distance between the vector register and one of the first memory (210) and the second memory (230). That is, the total time PLr+Pwb required until the first data stored in the LUT memory (110) is stored again in the vector register and the result value of the operation based on the first data stored in the vector register is stored in the vector register may be shorter than the total time required until the operation of reading the data stored in one of the first memory (210) and the second memory (230), performing the operation, and storing the result value of the operation in the vector register.
[0153] Figure 6 illustrates one embodiment of an electronic device.
[0154] The electronic device (1) may be implemented as various types of devices such as a personal computer (PC), a server device, a mobile device, and an embedded device. According to one embodiment, the electronic device (1) may correspond to a smartphone, a tablet device, an Augmented Reality (AR) device, an Internet of Things (IoT) device, an autonomous vehicle, robotics, a medical device, etc. that perform voice recognition, image recognition, image classification, etc. using a neural network, but is not limited thereto.
[0155] The electronic device (1) may include a host processor (610), an accelerator (200), and storage (620). The host processor (610), the accelerator (200), and the storage (620) may communicate with each other via a bus, a network on a chip (NoC), a peripheral component interconnect express (PCIe), etc. The electronic device (1) illustrated in FIG. 6 only illustrates components related to the present embodiment. Therefore, it will be understood by those skilled in the art related to the present embodiment that other general components may be further included in addition to the components illustrated in FIG. 1.
[0156] The host processor (610) controls the overall functions for executing the electronic device (1). For example, the host processor (610) controls the electronic device (1) overall by executing one or more commands or at least one program stored in the storage (620) within the electronic device (1). The host processor (610) may be implemented as a central processing unit (CPU), a graphics processing unit (GPU), an application processor (AP), etc., provided within the electronic device (1), but is not limited thereto.
[0157] Storage (620) is a hardware that stores various data processed within the electronic device (1). For example, storage (620) can store data processed and data to be processed in the electronic device (1). In addition, storage (620) can store applications, drivers, etc. to be driven by the electronic device (1). In addition, storage (620) can store commands to be executed in the accelerator (200), parameters of a neural network, input data to be inferred, etc. Storage (620) can include random access memory (RAM) such as dynamic random access memory (DRAM), static random access memory (SRAM), read-only memory (ROM), electrically erasable programmable read-only memory (EEPROM), CD-ROM, Blu-ray or other optical disk storage, hard disk drive (HDD), solid state drive (SSD), or flash memory. According to one embodiment, storage (620) can be an off-chip memory. Additionally, the storage (620) may correspond to the second memory (230).
[0158] The accelerator (200) may be the accelerator described above. According to an embodiment, the accelerator (200) may be hardware dedicated to neural networks for quickly processing operations frequently used in neural networks. According to an embodiment, the accelerator (200) may be a hardware accelerator such as a neural processing unit (NPU), a Tensor Processing Unit (TPU), a Neural Engine, etc., which are dedicated modules for operating a neural network, but are not limited thereto. According to an embodiment, the accelerator (200) may include a plurality of accelerators. The accelerator (200) may include a vector processor (100) for processing vector operations.
[0159] According to one embodiment, a vector processor (100) included in an accelerator (200) may include a LUT memory (110) that stores data corresponding to an index value; a processing unit (120) that performs an operation based on the data; and a controller (130) that confirms a first index value based on a command and stores first data in the LUT memory (110) using the first index value. Here, the command received by the vector processor (100) may be a command or program stored in a storage (620) in the electronic device (1) or a program memory (213) in the accelerator (200).
[0160] Figure 7 illustrates an operation method of a vector processor according to one embodiment.
[0161] Since each step of the operating method of Fig. 7 can be performed by the vector processor (100) discussed above, descriptions of overlapping content with Figs. 1 and 2 will be omitted. Here, the vector processor (100) may include a LUT memory (110) that stores data corresponding to an index value and a processing unit (120) that performs an operation based on the data.
[0162] In step S710, the vector processor (100) can check the first index value based on the instruction. More specifically, the controller (130) within the vector processor (100) can check the first index value based on the instruction. The controller (130) may be a unit that controls the overall operation of the vector processor (100). The first index value may be a value specified by a field of the instruction. Additionally, the first index value may be a value generated by counter logic or FSM operated by the instruction.
[0163] In step S720, the vector processor (100) may store first data in the LUT memory (110) using the first index value. The LUT memory (110) may be a memory that stores data corresponding to the index value. For example, the LUT memory (110) may be a LUT (Look Up Table) memory characterized in that it outputs data corresponding to the index value as output data in response to the index value being input as input data. More specifically, the LUT memory (110) may simultaneously output a plurality of pieces of data stored in a plurality of locations within the LUT memory (110) in response to a plurality of index values. The data may include coefficients for linear approximation of a predetermined function. The first data corresponding to the first index value identified based on the command may be data related to a general operation other than function approximation.
[0164] According to one embodiment, the step of storing the first data in the LUT memory (110) using the first index value may further include the step of performing a predetermined operation based on the first data identified in the LUT memory (110) based on the first index value, and the processing unit (120) within the vector processor (100) may include a second processing unit (122) which is an ALU.
[0165] According to one embodiment, the step of storing the first data in the LUT memory (110) using the first index value may include the step of storing the first data stored in at least one of a first memory (210) within an accelerator (200) including a vector register, a scalar register, a vector processor (100), and a second memory (220) located outside the accelerator (200) in the LUT memory (110) based on the first index value.
[0166] According to one embodiment, the step of storing the first data in the LUT memory (110) using the first index value may further include the step of storing the first data stored in the LUT memory (110) based on the fourth index value in at least one of a first memory (210) within an accelerator (200) including a vector register, a scalar register, and a vector processor (100), and a second memory (230) located outside the accelerator (200).
[0167] According to one embodiment, when the vector processor (100) further includes a vector register, the step of storing the first data in the LUT memory (110) using the first index value may include the step of storing at least some of the data related to data processing in the LUT memory (110) and storing the remainder excluding at least some of the data related to data processing in the vector register.
[0168] According to one embodiment, when the vector processor (100) further includes a vector register, the step of storing the first data in the LUT memory (110) using the first index value may include the step of performing register spill by storing the first data stored in the vector register in the LUT memory (110).
[0169] Meanwhile, the present specification and drawings disclose preferred embodiments of the present invention. Although specific terms have been used, they are used in a general sense only to easily explain the technical contents of the present invention and to assist in understanding the invention, and are not intended to limit the scope of the present invention. It will be apparent to those skilled in the art that other modified examples based on the technical concept of the present invention are possible in addition to the embodiments disclosed herein.
[0170] The electronic device or terminal according to the above-described embodiments may include a processor, a memory for storing and executing program data, permanent storage such as a disk drive, a communication port for communicating with an external device, a user interface device such as a touch panel, a key, an icon, etc. The methods implemented as software modules or algorithms may be stored on a computer-readable recording medium as computer-readable codes or program commands executable on the processor. Here, the computer-readable recording medium includes a magnetic storage medium (e.g., read-only memory (ROM), random-access memory (RAM), floppy disk, hard disk, etc.) and an optical reading medium (e.g., CD-ROM, DVD: Digital Versatile Disc)). The computer-readable recording medium may be distributed to computer systems connected to a network, so that the computer-readable code may be stored and executed in a distributed manner. The medium may be readable by a computer, stored in a memory, and executed by a processor.
[0171] The present embodiment may be represented by functional block configurations and various processing steps. These functional blocks may be implemented by various hardware and / or software configurations that perform specific functions. For example, the embodiment may employ direct circuit configurations such as memory, processing, logic, look-up tables, etc., which may perform various functions under the control of one or more microprocessors or other control devices. Similarly, the present embodiment may be implemented in a programming or scripting language such as C, C++, Java, assembler, Python, etc., including various algorithms implemented as a combination of data structures, processes, routines, or other programming configurations. Functional aspects may be implemented as algorithms that execute on one or more processors. Furthermore, the present embodiment may employ conventional techniques for electronic configuration, signal processing, and / or data processing. Terms like "mechanism," "element," "means," and "composition" can be used broadly and are not limited to mechanical or physical components. These terms can also encompass a series of software routines, such as those associated with a processor.
[0172] The above-described embodiments are merely examples, and other embodiments may be implemented within the scope of the claims set forth below.
[0173] [National Research and Development Project supporting this invention]
[0174] [Project ID] 1711152619
[0175] [Assignment Number] 2021-0-00310-004
[0176] [Ministry Name] Ministry of Science and ICT
[0177] [Name of the project (specialized) organization] Information and Communications Technology Planning and Evaluation Institute
[0178] [Research Project Name] Development (Design) of Next-Generation Intelligent Semiconductor Technology
[0179] [Research Project Title] Development of a 2,000 TFLOPS Server-Level AI Deep Learning Processor and Module
[0180] [Contribution rate] 1 / 1
[0181] [Name of the project performing organization] Sapion Korea Co., Ltd.
[0182] Research Period: April 1, 2021 - December 31, 2024
Claims
1. As a vector processor, LUT (Look-Up Table) memory that stores data corresponding to index values; A processing unit that performs operations based on the above data; and A vector processor comprising a controller that checks a first index value based on a command and stores first data in the LUT memory using the first index value.
2. In paragraph 1, Includes more vector registers, A vector processor, wherein the above index value is extracted from data stored in the vector register.
3. In paragraph 1, A vector processor, wherein the above data includes coefficients for linear approximation of a given function.
4. In paragraph 1, A vector processor, wherein the first index value is a value specified by a field of the instruction.
5. In paragraph 1, The above processing unit, It includes a first processing unit for MAC (Multiply And Accumulation) operation and a second processing unit which is an ALU (Arithmetic and Logic Unit), The second processing unit, A vector processor that performs a predetermined operation based on second data confirmed in the LUT memory based on a second index value.
6. In paragraph 5, The above first processing unit, Performing a MAC operation based on the fourth data confirmed in the LUT memory based on the third data and the third index value extracted from the third data, and A vector processor, wherein the fourth data includes coefficients for linear approximation of a given function.
7. In paragraph 1, The above controller, A vector processor that stores the first data stored in at least one of a vector register, a scalar register, a first memory within an accelerator including the vector processor, and a second memory located outside the accelerator, based on the first index value, in the LUT memory.
8. In paragraph 1, The above controller, A vector processor that stores the first data stored in the LUT memory based on the fourth index value in at least one of a vector register, a scalar register, a first memory within an accelerator including the vector processor, and a second memory located outside the accelerator.
9. In paragraph 1, The above first index value is, A vector processor, which is a value generated by counter logic or FSM (Finite State Machine) operated by the above instruction.
10. In paragraph 5, The above vector processor, A vector processor comprising a datapath between the second processing unit and the LUT memory.
11. In paragraph 7, The above vector processor, A vector processor comprising a data path between the LUT memory and at least one of the vector register, the scalar register, the first memory, and the second memory.
12. In paragraph 1, The above controller, A vector processor including a DMA (Direct Memory Access) unit that stores the first data stored in a first memory within an accelerator including the vector processor or a second memory located outside the accelerator in the LUT memory, or stores the first data stored in the LUT memory in the first memory or the second memory.
13. In paragraph 1, Includes more vector registers, and The above controller, A vector processor that stores at least some of the data related to data processing in the LUT memory when the above instruction is a loop-unrolled instruction, and stores the remainder of the data related to data processing except for at least some of the data related to data processing in the vector register.
14. In paragraph 13, A vector processor, wherein when the above data processing is data processing related to convolution, at least a portion of the data includes at least one of a kernel weight and feature data related to the convolution.
15. In paragraph 1, Includes more vector registers, The above controller, A vector processor that performs register spill by storing the first data stored in the vector register in the LUT memory.
16. In paragraph 15, The above controller, A vector processor that stores the first data stored in the LUT memory again in the vector register.
17. In paragraph 1, A vector processor, wherein the LUT memory is a memory that simultaneously outputs a plurality of data stored in a plurality of locations within the LUT memory corresponding to a plurality of index values.
18. In paragraph 1, The above data is stored in the first area of the LUT memory, and A vector processor, wherein the first data is stored in a second area of the LUT memory.
19. A method of operating a vector processor including a LUT memory that stores data corresponding to an index value and a processing unit that performs an operation based on the data, A step of checking the first index value based on the command; and A method of operating a vector processor, comprising the step of storing first data in the LUT memory using the first index value.
20. A non-transitory computer-readable recording medium having recorded thereon a program for executing the method of Article 19 on a computer.
Citation Information
Patent Citations
Vector indexed memory access plus arithmetic and / or logical operation processors, methods, systems, and instructions
KR1020160040623A
A memory access method and apparatus
KR1020160072620A
Low power computational imaging
KR1020170067716A
Method and system for receiving an indexed look-up table and viewing a vector animation sequence
US20110148886A1
KR20200070088A
