Method implemented by a processor of an electronic device and processor operating the electronic device
The program code is divided and distributed to heterogeneous processors through heterogeneous compilers, which solves the problem of operation mapping complexity in heterogeneous processor systems and achieves efficient operation and performance optimization of heterogeneous processor systems.
Patent Information
- Application Number
- CN202010009248.X
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Priority Date
- 2019-01-25
- Filing Date
- 2020-01-06
- Publication Date
- 2024-09-13
- Estimated Expiration
- 2040-01-06
AI Technical Summary
In heterogeneous processor systems, designing program code and instructions to take full advantage of the features and configurations of each processor is a complex problem. Existing technologies have difficulty in effectively mapping operations to the most appropriate processor, resulting in insufficient performance optimization.
By receiving program code, library information and system information, use a heterogeneous compiler to divide the program code into sub-parts, compile and distribute them to each heterogeneous processor respectively according to the attributes and characteristics of the processor, and generate optimized compiler output , so that each processor processes operations in parallel.
It achieves efficient operation of heterogeneous processor systems, improves processor performance and efficiency, optimizes processor allocation and resource usage based on actual operating conditions, and improves the overall performance of the system.
Smart Images

Figure CN111488153B_ABST
Abstract
Description
[0001] CROSS-REFERENCE TO RELATED APPLICATIONS
[0002] This application claims the priority of Korean Patent Application No. 10-2019-0009814 filed on January 25, 2019 in the Korean Intellectual Property Office, the disclosure of which is incorporated herein by reference in its entirety. Technical Field
[0003] The present disclosure relates to a processor of an electronic device, and more particularly, to an operation of a processor for heterogeneous processors. Background Art
[0004] Nowadays, various types of electronic devices are being used. The electronic devices perform unique functions according to the various electronic circuits included in the electronic devices and / or the operations of the various electronic devices. For example, a processor circuit or device is configured to process various arithmetic / logic / special operations for the purpose of providing the functions of the electronic device.
[0005] As information processing technology develops, a large amount of data is generated and various types of data are used. In this regard, various types of processors have been developed to properly process information and data, and electronic devices use different types of processors (i.e., heterogeneous processors) to provide services that optimize performance. Heterogeneous processors can be dedicated to processing general operations or special operations, and therefore have different configurations and support different operations.
[0006] Certain types of processors are configured to execute software and instructions for processing operations. Developers can compile program code written to process the intended operations to generate outputs including executable instructions, and the processor can execute instructions based on the outputs. At the same time, with the diversification of various processors, it is an important issue to design program codes and instructions taking into account the characteristics and configurations of all heterogeneous processors. Summary of the invention
[0007] An embodiment of the present disclosure provides a method implemented by a processor and a processor that operates by using the method, wherein the method implemented by the processor is to generate a compiler output executable by the heterogeneous processor by referring to information associated with the heterogeneous processor.
[0008] In some embodiments, a method implemented by a processor of an electronic device may include: receiving program code that directs operations to be processed by a heterogeneous processor; receiving a library to be referenced by the heterogeneous processor for the purpose of processing the operation; receiving library information, the library information including information associated with the operation to be processed based on the library and information associated with properties of the operation processed based on the library; referencing the library information to determine a processor that will process the operation from heterogeneous processors so that each processor in the heterogeneous processors processes one or more assigned operations in the operation; and compiling sub-portions divided from the entire portion of the program code to correspond to the determined processors respectively in a state where the sub-portions respectively correspond to some libraries, among which some libraries will be referenced by the determined processor to process the assigned operations.
[0009] In some embodiments, a processor for operating an electronic device may execute instructions of a heterogeneous compiler stored in a memory to perform the following steps: mapping operations onto heterogeneous processors taking into account properties of the operations processed by the heterogeneous processors so that each of the operations is processed by a mapped processor in the heterogeneous processors; dividing an entire portion of a program code into sub-portions, wherein the program code guides the operations to be processed by the heterogeneous processors, and the sub-portions correspond to the heterogeneous processors respectively based on one or more operations mapped to each heterogeneous processor in the heterogeneous processors; and compiling the divided sub-portions in a state where the divided sub-portions correspond to libraries respectively so as to be referenced by the heterogeneous processors for the purpose of processing the operations.
[0010] In some embodiments, a method implemented by a processor of an electronic device may include: receiving program code that directs operations to be processed by a heterogeneous processor; compiling sub-portions divided from the entire portion of the program code to correspond to the heterogeneous processors based on one or more operations among the operations that are allocated to each heterogeneous processor in the heterogeneous processors in a state where the sub-portions correspond in a first manner to a library to be referenced by the heterogeneous processor for the purpose of processing the operation, so that each processor in the heterogeneous processors processes one or more allocated operations in the operation; and compiling the sub-portions in a state where the sub-portions correspond in a first manner to the library, so as to produce a first compiler output so that at least a portion of the heterogeneous processors operate in parallel for the purpose of processing the operation.
[0011] In some embodiments, a method implemented by a processor of an electronic device may: receive program code directing operations to be processed by a heterogeneous processor; receive library information associated with attributes of the operations to be processed by the heterogeneous processor; and compile sub-portions by referencing the library information in a state where the sub-portions respectively correspond to libraries to be referenced by the heterogeneous processor for the purpose of processing the operations, the sub-portions being divided from the entire portion of the program code to respectively correspond to the heterogeneous processors, based on one or more operations among the operations that are assigned to each of the heterogeneous processors, so that each of the heterogeneous processors processes one or more assigned operations among the operations to generate compiler output.
[0012] The compiler output may include a correspondence between the library and data referenced for purposes of executing the instructions of the library on each of the heterogeneous processors.
[0013] In some embodiments, a method performed by a processor includes: receiving program code;
[0014] and compiling the program code into a compiled code, wherein the compiled code includes instructions for directing a first processor to execute a first portion of the compiled code and for directing a second processor that is heterogeneous with the first processor to execute a second portion of the compiled code. BRIEF DESCRIPTION OF THE DRAWINGS
[0015] The above and other objects and features of the present disclosure will become apparent by describing in detail example embodiments of the present disclosure with reference to the attached drawings.
[0016] Figure 1 is a block diagram illustrating an example configuration of an electronic system including heterogeneous processors according to some embodiments.
[0017] Figure 2 Is used to describe Figure 1 A block diagram of an example configuration and operation of a heterogeneous processor.
[0018] Figure 3 and Figure 4 is used to describe the generation of Figure 1 A conceptual diagram of an example manner in which a compiler outputs instructions that can be executed by heterogeneous processors.
[0019] Figure 5 It is used to describe the Figure 3 or Figure 4 A block diagram of an example operation of a heterogeneous compiler.
[0020] Figure 6 and Figure 7 It is shown Figure 5 A conceptual diagram of an example of program code.
[0021] Figure 8 It is shown Figure 5 A conceptual diagram of an example of a library and library information.
[0022] Fig. 9 It is shown Figure 5 A block diagram of an example of system information.
[0023] Fig.10 Is used to describe Figure 5 Flowchart of an example operation of a heterogeneous compiler.
[0024] Figures 11 to 15 is used to describe the Figure 5 A conceptual diagram of an example operation-level optimization for a heterogeneous compiler.
[0025] Fig.16 is used to describe the Figure 5 Conceptual diagram of example resource allocation for a heterogeneous compiler.
[0026] Fig.17 and Fig.18 is used to describe the Figure 5 Conceptual diagram of an example of processor-level optimizations for a heterogeneous compiler.
[0027] Fig.19 and Fig. 20 is used to describe the Figure 5 A conceptual diagram of an exemplary compilation of a heterogeneous compiler.
[0028] Fig.21 It is shown from Figure 5 Conceptual diagram of an example configuration of compiler output produced by a heterogeneous compiler.
[0029] Fig. 22 Is used to describe Fig.21 A flowchart of an example operation of a compiler output to modify or update a control instruction.
[0030] Fig.23 Is a description Figure 5 Flowchart of an exemplary recompilation of a heterogeneous compiler.
[0031] Fig.24 Is a description for Figure 5 Flowchart of an example training of a heterogeneous compiler. DETAILED DESCRIPTION
[0032] Hereinafter, some embodiments will be described in detail and clearly with reference to the accompanying drawings to the extent that those skilled in the art can easily implement the present disclosure.
[0033] I. Heterogeneous Processors
[0034] Figure 1110 is a block diagram illustrating an example configuration of an electronic system 1000 including heterogeneous processors 1110 , 1120 , 1130 , and 1140 according to some embodiments.
[0035] For example, the electronic system 1000 may include a main processor 1110, a graphics processor 1120, a neural processor 1130, a digital signal processor 1140, a working memory 1200, a storage device 1300, a communication block 1400, a user interface 1500, and a bus 1900. For example, the electronic system 1000 may be one of electronic devices such as a desktop computer, a laptop computer, a tablet computer, a smart phone, a wearable device, a video game console, a workstation, a server, an electric vehicle, a home appliance, a medical device, etc.
[0036] The main processor 1110 may control the overall operation of the electronic system 1000. The main processor 1110 may include one or more processor cores configured to process various arithmetic / logic operations. The main processor 1110 may be implemented using a general-purpose processor such as a central processing unit (CPU) or an application processor (AP).
[0037] Graphics processor 1120 may be implemented using a dedicated processor such as a graphics processing unit (GPU) that can quickly process large amounts of graphics data. Graphics processor 1120 may be configured to perform various graphics-related operations (e.g., shaders, super sampling, and spatial conversion) on graphics data in a parallel pipeline manner.
[0038] The neural processor 1130 may be implemented using a dedicated processor such as a neural processing unit (NPU) that is dedicated to quickly processing large amounts of data associated with a neural network. For example, the neural processor 1130 may be implemented using an architecture optimized for processing operations (e.g., convolution and merging) for convolutional neural networks.
[0039] The digital signal processor 1140 may be designed to be optimized to perform various logic operations on digital signals. For example, the digital signal processor 1140 may be implemented using a general purpose processor that can provide various signal processing or a dedicated processor such as an image signal processor (ISP) or a video encoder / decoder (CODEC).
[0040] The working memory 1200 may store data to be used for the operation of the electronic system 1000. For example, the working memory 1200 may temporarily store data processed by or to be processed by the processors 1110, 1120, 1130, and 1140. For example, the working memory 1200 may include a volatile memory such as a static random access memory (SRAM), a dynamic RAM (DRAM), or a synchronous DRAM (SDRAM) and / or a nonvolatile memory such as a phase change RAM (PRAM), a magnetoresistive RAM (MRAM), a resistive RAM (ReRAM), or a ferroelectric RAM (FRAM).
[0041] The storage device 1300 can store data regardless of whether power is supplied. For example, the storage device 1300 may include a nonvolatile memory such as flash memory, PRAM, MRAM, ReRAM, or FRAM. For example, the storage device 1300 may include a storage medium such as a solid state drive (SSD), a card memory, or an embedded memory.
[0042] The communication block 1400 may communicate with an external device / system of the electronic system 1000 according to at least one of various wired / wireless communication protocols. The user interface 1500 may include various input / output interfaces (e.g., a keyboard, a touch screen, and a display device) for the purpose of arbitrating communication between a user and the electronic system 1000.
[0043] The bus 1900 may provide a communication path between components of the electronic system 1000. The components of the electronic system 1000 may exchange data with each other according to the bus format of the bus 1900. For example, the bus format may include one or more of the following various interface protocols: such as Universal Serial Bus (USB), Small Computer System Interface (SCSI), Peripheral Component Interconnect Express (PCIe), Mobile PCIe (M-PCIe), Advanced Technology Attachment (ATA), Parallel ATA (PATA), Serial ATA (SATA), Serial Attached SCSI (SAS), Non-Volatile Memory Express (NVMe), Universal Flash Storage (UFS), and Firewire.
[0044] As reference Figure 1As described, the electronic system 1000 may employ different types of processors or heterogeneous processors 1110, 1120, 1130, and 1140. The processors 1110, 1120, 1130, and 1140 may be configured differently and may operate differently. For example, the processors 1110, 1120, 1130, and 1140 may be implemented to support different architectures (e.g., different ISAs (instruction set architectures)). For example, the processors 1110, 1120, 1130, and 1140 may operate with different performances.
[0045] Some of the processors 1110, 1120, 1130, and 1140 may be dedicated to processing general operations, and others may be dedicated to processing special operations. The processors 1110, 1120, 1130, and 1140 may respectively process given operations in an optimal manner, and thus the electronic system 1000 may provide services with optimized performance.
[0046] However, the processors 1110, 1120, 1130, and 1140 are provided for better understanding and are not intended to limit the present disclosure. The electronic system 1000 may not include one or more of the processors 1110, 1120, 1130, and 1140, or may further include any other processors in addition to the processors 1110, 1120, 1130, and 1140. The heterogeneous processors may be variously changed or modified according to the implementation of the electronic system 1000.
[0047] For example, the non-volatile memory of the working memory 1200 and / or the storage device 1300 may store the instruction IST. The instruction IST may be executed by all or part of the processors 1110, 1120, 1130, and 1140 for the purpose of processing the intended operation. Figures 2 to 4 To describe the instruction IST.
[0048] Figure 2 Is used to describe Figure 1 A block diagram of an example configuration and operation of heterogeneous processors 1110, 1120, 1130, and 1140.
[0049] The processors 1110, 1120, 1130, and 1140 may execute the instruction IST to process the operation. For example, the instruction IST may include an instruction sequence, instruction-related data, and setting parameters.
[0050] For example, the instruction sequence may instruct whether to execute any instruction set of the processors 1110, 1120, 1130, and 1140 to process the intended operation, or instruct whether any circuit of the processors 1110, 1120, 1130, and 1140 operates to process the intended operation.
[0051] For example, instruction-related data may include data (eg, constant values and global common values) to be used by processors 1110 , 1120 , 1130 , and 1140 while processing the intended operation.
[0052] For example, the setting parameters may include values for setting operating conditions of the processors 1110, 1120, 1130, and 1140 (eg, circuit enable / disable, connection / disconnection between circuits, and iteration operation count), which are suitable for processing expected operations.
[0053] However, the above description is provided for better understanding, and the configuration of the instruction IST is not intended to limit the above description. The instruction IST may be variously changed or modified to be applicable to the processing operations performed by the processors 1110 , 1120 , 1130 , and 1140 .
[0054] The processors 1110, 1120, 1130, and 1140 may process the expected operation based on the instruction IST. For example, referring to the data about the instruction, the processors 1110, 1120, 1130, and 1140 may execute the instruction set directed by the instruction sequence, or may operate the circuit directed by the instruction sequence. For example, the processors 1110, 1120, 1130, and 1140 may operate under the operating conditions provided based on the values of the set parameters.
[0055] The processors 1110, 1120, 1130, and 1140 may include internal memories 1111, 1121, 1131, and 1141, respectively. Each of the internal memories 1111, 1121, 1131, and 1141 may be used as a buffer memory or a cache memory, and may be implemented using various types of memory devices such as a read-only memory (ROM), a RAM, and a register. The internal memories 1111, 1121, 1131, and 1141 may store data used by the processors 1110, 1120, 1130, and 1140.
[0056] For example, the processors 1110, 1120, 1130, and 1140 may share the working memory 1200 through a direct memory access (DMA) function. The working memory 1200 may store data transferred or shared between the processors 1110, 1120, 1130, and 1140.
[0057] For example, data output from the main processor 1110 may be stored in the working memory 1200. The graphic processor 1120 may read data of the working memory 1200 and may store the read data in the internal memory 1121, and thus the graphic processor 1120 may use the data output from the main processor 1110.
[0058] II. Implementation of Heterogeneous Compilers
[0059] Figure 3 and Figure 4 is used to describe the generation of Figure 1 A conceptual diagram of an example manner in which a compiler output of an instruction IST may be executed by heterogeneous processors 1110, 1120, 1130, and 1140.
[0060] Reference Figure 3 For example, a designer or developer may use the development system 2000 for the purpose of providing operations to be processed in the electronic system 1000. For example, the development system 2000 may be one of a desktop computer, a laptop computer, a tablet computer, a smart phone, a workstation, and the like.
[0061] For example, the development system 2000 may include a CPU 2110 that can execute instructions of software and / or firmware. However, the type of processor included in the development system 2000 may be variously changed or modified, and is not limited to the CPU 2110. The CPU 2110 may execute instructions of the heterogeneous compiler 3000a in response to a command of a designer or developer. The instructions of the heterogeneous compiler 3000a may be stored in a memory of the development system 2000.
[0062] The heterogeneous compiler 3000a can compile compiler inputs inputted to the heterogeneous compiler 3000a by a designer or developer, and can generate compiler outputs. Here, compiling can mean the process of converting compiler inputs that can be understood by a designer or developer into compiler outputs having a format executable by a machine (e.g., an electronic device such as the electronic system 1000 or the development system 2000).
[0063] The compiler output generated from the heterogeneous compiler 3000a may include the instruction IST. The instruction IST may be provided to the electronic system 1000 and may be executed by the heterogeneous processors 1110, 1120, 1130, and 1140 of the electronic system 1000. Figure 3 In the example of FIG. 1 , the instruction IST may be generated based on the heterogeneous compiler 3000 a at the development system 2000 independently of the electronic system 1000 in which the instruction IST is to be executed.
[0064] Reference Figure 4 For example, the main processor 1110 may execute the instructions of the heterogeneous compiler 3000b in response to a request of a user of the electronic system 1000 or in response to a request based on an operation policy of the electronic system 1000. However, the processor that executes the instructions of the heterogeneous compiler 3000b may be variously changed or modified without being limited to the main processor 1110.
[0065] For example, the heterogeneous compiler 3000b may be an embedded compiler stored in a memory of the electronic system 1000. The heterogeneous compiler 3000b may compile compiler input input to the heterogeneous compiler 3000b by a user or the electronic system 1000, and may generate compiler output.
[0066] The compiler output generated from the heterogeneous compiler 3000b may include the instruction IST. The instruction IST may be executed by the heterogeneous processors 1110, 1120, 1130, and 1140 of the electronic system 1000. Figure 4 In the example of FIG. 1 , the instruction IST may be generated based on the heterogeneous compiler 3000 b in the electronic system 1000 in which the instruction IST is to be executed. Figure 3 and Figure 4 In addition to the description given, various changes or modifications may be made to the way the instruction IST is generated.
[0067] Considering only a single processor, some compilers may compile compiler input to produce compiler output, which may include only instructions optimized for a single processor. However, in an electronic system 1000 including heterogeneous processors 1110, 1120, 1130, and 1140, using compiler output optimized for a single processor may not be advantageous and effective.
[0068] Therefore, in an embodiment, the heterogeneous compiler 3000a or 3000b may compile compiler input to generate compiler output, taking into account the characteristics and properties of all heterogeneous processors 1110, 1120, 1130, and 1140. In an embodiment, the compiler output may include instructions optimized for each of the heterogeneous processors 1110, 1120, 1130, and 1140, and may allow the electronic system 1000 to operate efficiently.
[0069] In addition, in order to generate compiler output, the heterogeneous compiler 3000a or 3000b may receive compiler input including information associated with the heterogeneous processors 1110, 1120, 1130, and 1140. Therefore, even if the heterogeneous processors 1110, 1120, 1130, and 1140 are not designed according to a unified specification or protocol, the heterogeneous compiler 3000a or 3000b may refer to the compiler input to generate compiler output applicable to all heterogeneous processors 1110, 1120, 1130, and 1140.
[0070] Will refer to Figures 5 to 24 1 and 10 to describe examples associated with compiler input, operation of heterogeneous compiler 3000a or 3000b, and compiler output.
[0071] Figure 5 It is used to describe the Figure 3 or Figure 4 A block diagram of example operations of a heterogeneous compiler 3000a or 3000b.
[0072] Figure 5 The Heterogeneous Compiler 3000 can be used with Figure 3 The Heterogeneous Compiler 3000a and / or Figure 4 The heterogeneous compiler 3000b corresponds to the heterogeneous compiler 3000b of the electronic device. The heterogeneous compiler 3000 can be implemented by a processor of the electronic device (e.g., processors 1110, 1120, 1130, 1140, and / or 2110). It can be well understood that the operations described with respect to the heterogeneous compiler 3000 in the present disclosure can be regarded as operations associated with a processor (e.g., processors 1110, 1120, 1130, 1140, and / or 2110) for operating an electronic device.
[0073] In some embodiments, heterogeneous compiler 3000 may receive one or more of program code 3100, library 3300, library information 3350, and system information 3500 as compiler input. However, the present disclosure is not limited thereto, and compiler input may be variously changed or modified to be applicable to heterogeneous compiler 3000. Heterogeneous compiler 3000 may compile compiler input, and may generate compiler output 3700 as a result of the compilation.
[0074] III. Compiler Input to Heterogeneous Compilers
[0075] Figure 6 and Figure 7 It is shown Figure 5 A conceptual diagram of an example of program code.
[0076] Program code 3100 may direct operations to be processed by heterogeneous processors 1110, 1120, 1130, and 1140. Heterogeneous compiler 3000 may receive program code 3100 as compiler input.
[0077] For example, a designer or developer may write program code 3100 in a language understandable to the designer or developer. The designer or developer may input program code 3100 to heterogeneous compiler 3000a through development system 2000 or may input program code 3100 to heterogeneous compiler 3000b through user interface 1500.
[0078] Reference Figure 6 For example, the program code 3100 may include a program code 3100a written in a high-level language such as C. For example, the program code 3100a may be written to describe modules such as variables, classes, and functions associated with operations to be processed by the heterogeneous processors 1110, 1120, 1130, and 1140.
[0079] Alternatively, refer to Figure 7 , the program code 3100 may be written in a graph-based language (e.g., TensorFlow) that can provide visualization of the graph structure 3100b. For example, the graph structure 3100b may include nodes N1 to N9 and edges E11, E12, E21, E22, E3, E41 to E43, and E5 to E8.
[0080] Each of the nodes N1 to N9 may correspond to a unit operation directed by the program code 3100 visualized as a graph structure 3100b. For example, where the graph structure 3100b is intended to represent the construction of a convolutional neural network and the heterogeneous processors 1110, 1120, 1130, and 1140 are intended to process operations for the convolutional neural network, each of the nodes N1 to N9 may correspond to a convolution operation or a pooling operation.
[0081] Each of the edges E11, E12, E21, E22, E3, E41 to E43, and E5 to E8 may represent an input-output relationship between unit operations. For example, the edge E11 may represent that the output of the operation corresponding to the node N1 is used as the input of the operation corresponding to the node N2.
[0082] Figure 6 and Figure 7 The program code 3100 is shown only as an example and is not intended to limit the present disclosure. Figure 6 and Figure 7 The example shown in FIG. 300 may be modified or altered differently for the purpose of directing operations to be processed by the heterogeneous processors 1110, 1120, 1130, and 1140. However, for better understanding, the processing for processing by the heterogeneous processors 1110, 1120, 1130, and 1140 is described below. Figure 7 The operation of the convolutional neural network represented by the graph structure 3100b may be described as follows.
[0083] Figure 8 It is shown Figure 5 A conceptual diagram of an example of a library 3300 and library information 3350.
[0084] Heterogeneous processors 1110, 1120, 1130, and 1140 may reference library 3300 for the purpose of processing operations directed by program code 3100. Heterogeneous compiler 3000 may receive library 3300 as compiler input.
[0085] For example, the library 3300 may include libraries 3301, 3302, 3303, and 3304. The libraries 3301, 3302, 3303, and 3304 may be provided to correspond to the heterogeneous processors 1110, 1120, 1130, and 1140, respectively. Each of the libraries 3301, 3302, 3303, and 3304 may include instructions executed by one of the heterogeneous processors 1110, 1120, 1130, and 1140 for the purpose of processing operations directed by the program code 3100.
[0086] For example, library 3301 may include instructions executed by host processor 1110 for the purpose of processing a convolution operation. In addition, library 3301 may include data (e.g., constant values and global common values) used by host processor 1110 while processing a convolution operation. In some cases, library 3301 may include parameters for setting operating conditions of host processor 1110 that are suitable for processing a convolution operation.
[0087] Each of the libraries 3302, 3303, and 3304 may be configured similarly to the library 3301. For example, the processors 1120, 1130, and 1140 may refer to instructions, data related to the instructions, and setting parameters of the libraries 3302, 3303, and 3304 for the purpose of processing a convolution operation.
[0088] As such, the libraries 3301, 3302, 3303, and 3304 may instruct the processors 1110, 1120, 1130, and 1140 whether to execute any instructions for the purpose of performing a convolution operation. The libraries 3301, 3302, 3303, and 3304 may be prepared in advance before the compilation of the heterogeneous compiler 3000 is performed.
[0089] For example, libraries 3301, 3302, 3303, and 3304 may be target programs (e.g., binary codes and assembly codes) compiled in advance before being input to heterogeneous compiler 3000. Alternatively, libraries 3301, 3302, 3303, and 3304 may be source programs written in a language understandable by a designer or developer and not compiled.
[0090] For example, where an operating system or framework for development system 2000 or electronic system 1000 includes separate compilers for each of processors 1110, 1120, 1130, and 1140, it is acceptable to provide each of libraries 3301, 3302, 3303, and 3304 in the form of an uncompiled source program.
[0091] In contrast, in the case where the operating system or framework of the development system 2000 or the electronic system 1000 does not include a separate compiler, each of the libraries 3301 , 3302 , 3303 , and 3304 may be provided in the form of a compiled object program.
[0092] Heterogeneous compiler 3000 may receive library information 3350 as compiler input. For example, library information 3350 may include library information 3351, 3352, 3353, and 3354. Library information 3351, 3352, 3353, and 3354 may be received to correspond to libraries 3301, 3302, 3303, and 3304 in a one-to-one relationship.
[0093] The library information 3351, 3352, 3353, and 3354 may include information associated with operations to be processed based on the libraries 3301, 3303, 3302, and 3304. For example, the library information 3350 may include information on the type of operation to be processed by the main processor 1110 with reference to the library 3301. For example, the library information 3350 may instruct that a convolution operation is processed based on the library 3301.
[0094] The library information 3351, 3352, 3353, and 3354 may include information associated with properties of processing operations based on the libraries 3301, 3302, 3303, and 3304. For example, the library information 3351 may include information about the amount of power that will be consumed by the main processor 1110 referencing the library 3301 to process a convolution operation, information about the time required for the main processor 1110 to referencing the library 3301 to process a convolution operation, and the like.
[0095] For example, the library information 3351 may include information about the amount of power expected to be consumed by the main processor 1110 referencing the library 3301 to process a convolution operation, information about the expected time required by the main processor 1110 to referencing the library 3301 to process a convolution operation, etc. For example, the information about power and time may be collected during experiments, tests, and / or simulations for the heterogeneous processors 1110, 1120, 1130, and 1140, or may be collected during actual operation of the electronic system 1000.
[0096] The present disclosure is not limited to the above description, and the library information 3351 may include various information in addition to information about power and time. The library information 3351 may include various descriptions about operations to be processed based on the library 3301 for the purpose of explaining the library 3301.
[0097] The library information 3352, 3353, and 3354 may be configured similarly to the library information 3351. For example, the library information 3352, 3353, and 3354 may include various descriptions about operations to be processed based on the libraries 3302, 3303, and 3304 for the purpose of explaining the libraries 3302, 3303, and 3304.
[0098] The library information 3351, 3352, 3353, and 3354 may be prepared in advance before executing the compilation of the heterogeneous compiler 3000. For example, the library information 3351, 3352, 3353, and 3354 may be input to the heterogeneous compiler 3000 in advance before the actual execution time of the heterogeneous processors 1110, 1120, 1130, and 1140.
[0099] For example, library information 3351, 3352, 3353, and 3354 may be data written by a designer or developer. Alternatively, library information 3351, 3352, 3353, and 3354 may be generated by development system 2000 or electronic system 1000 based on experiments, tests, and / or simulations for heterogeneous processors 1110, 1120, 1130, and 1140 or based on information collected during actual operation of electronic system 1000.
[0100] Reference Figure 8 to describe the convolution operation, but can also provide a reference to another type of operation Figure 8 The described library 3300 and library information 3350. For example, the library 3300 may also include a library to be referenced by the processors 1110, 1120, 1130, and 1140 for the purpose of processing the pooling operation. For example, the library information 3350 may include various descriptions associated with processing the pooling operation, which is processed based on the library associated with the pooling operation.
[0101] The library 3300 and the library information 3350 may be provided to be applicable to the heterogeneous processors 1110, 1120, 1130, and 1140. For example, in the case where the design of any processor among the heterogeneous processors 1110, 1120, 1130, and 1140 is changed or modified, the designer, developer, development system 2000, and / or electronic system 1000 may modify the library 3300 and the library information 3350 to be applicable to the changed or modified design of the processor.
[0102] For example, in the event that any of the heterogeneous processors 1110, 1120, 1130, and 1140 is removed or replaced with any other processor, the designer, developer, development system 2000, and / or electronic system 1000 may modify library 3300 and library information 3350 to apply to the changed heterogeneous processor.
[0103] In addition, when a new processor is added to the heterogeneous processors 1110, 1120, 1130 and 1140 or when a new type of operation is added, the designer, developer, development system 2000 and / or electronic system 1000 can also input libraries and library information applicable to the new requirements into the heterogeneous compiler 3000.
[0104] In this way, the library and library information can be newly generated, or the library and library information can be modified / updated, so that the design flexibility and scalability for the heterogeneous processors 1110, 1120, 1130, and 1140 can be provided. The heterogeneous compiler 3000 can refer to the library and library information suitable for the given system conditions to perform the compilation described below. According to an embodiment, even if the heterogeneous compiler 3000 is not modified, the changes of the heterogeneous processors 1110, 1120, 1130, and 1140 can be flexibly coped with by appropriately configuring the library and library information.
[0105] Fig. 9 It is shown Figure 5 A block diagram of an example of system information 3500.
[0106] The system information 3500 may include information associated with properties of the heterogeneous processors 1110, 1120, 1130, and 1140. The heterogeneous compiler 3000 may receive the system information 3500 as compiler input.
[0107] For example, the system information 3500 may include information on the number of heterogeneous processors included in the electronic system 1000. For example, the system information 3500 may include various information such as the type, characteristics (e.g., performance, operating frequency, or operating voltage), and size of an internal memory of each of the heterogeneous processors 1110, 1120, 1130, and 1140. The present disclosure is not limited thereto, and the system information 3500 may include various information to be referenced for the purpose of identifying the properties of the heterogeneous processors 1110, 1120, 1130, and 1140.
[0108] The system information 3500 may be prepared in advance before executing the compilation of the heterogeneous compiler 3000. For example, the system information 3500 may be data written by a designer or developer. To this end, the designer or developer may know in advance the information associated with the heterogeneous processors 1110, 1120, 1130, and 1140 to be adopted to the electronic system 1000. Alternatively, the system information 3500 may be generated by the electronic system 1000 during startup or initialization of the electronic system 1000.
[0109] Reference Figures 6 to 9 The compiler input to the heterogeneous compiler 3000 is described below. Figures 10 to 20 1000 based on compiler input to describe an example compilation performed by heterogeneous compiler 3000.
[0110] IV. Operation of Heterogeneous Compilers
[0111] Fig.10 Is a description Figure 5 Flowchart of example operations of the heterogeneous compiler 3000. Figures 11 to 15 is used to describe the Figure 5 A conceptual diagram of exemplary operation-level optimizations of heterogeneous compiler 3000. Fig.16 is used to describe the Figure 5 A conceptual diagram of an exemplary resource allocation for a heterogeneous compiler 3000. Fig.17 and Fig.18 is used to describe the Figure 5 A conceptual diagram of an exemplary processor-level optimization of the heterogeneous compiler 3000. Fig.19 and Fig. 20 is used to describe the Figure 5 A conceptual diagram of an exemplary compilation of the heterogeneous compiler 3000.
[0112] The development system 2000 or the electronic system 1000 may execute the heterogeneous compiler 3000 in response to a request of a designer, developer, or user or a request based on an operation policy. For example, the CPU 2110 or the main processor 1110 may execute the heterogeneous compiler 3000, but the present disclosure is not limited to this example.
[0113] When executing the heterogeneous compiler 3000, the heterogeneous compiler 3000 may receive one or more of the program code 3100, the library 3300, the library information 3350, and the system information 3500. Fig.10 S110). Figures 6 to 9 As described, program code 3100 , library 3300 , library information 3350 , and system information 3500 may be prepared in advance as compiler inputs before executing heterogeneous compiler 3000 .
[0114] The heterogeneous compiler 3000 can parse the received compiler input ( Fig.10 In the case where the program code 3100, the library information 3350, and the system information 3500 are written in a language understandable to the designer or developer, the heterogeneous compiler 3000 may parse the compiler input for the purpose of understanding the program code 3100, the library information 3350, and the system information 3500. In the case where the library 3300 is not compiled in form, the heterogeneous compiler 3000 may also parse the library 3300.
[0115] In some embodiments, the heterogeneous compiler 3000 can optimize the operation level ( Fig.10 The operation level may be optimized to more efficiently process the operation and to more efficiently operate the heterogeneous processors 1110, 1120, 1130, and 1140 during runtime when the heterogeneous processors 1110, 1120, 1130, and 1140 actually process the operation directed by the program code 3100.
[0116] For example, refer to Figure 7 and Fig.11 , the outputs of the operations corresponding to nodes N2 and N4 can be used as inputs of the operations corresponding to nodes N5 and N6. In other words, the operations corresponding to nodes N5 and N6 can use the same inputs or related inputs. For example, the operations corresponding to nodes N5 and N6 can be convolution operations based on the same kernel, the same padding size, and the same step size.
[0117] For example, refer to Fig.12 , the output data DAT1 of the operation corresponding to the nodes N2 and N4 may be stored in the working memory 1200. For example, in the case where the graphics processor 1120 is selected to process the operation corresponding to the nodes N5 and N6, in order to use the data DAT1, the graphics processor 1120 may read the data DAT1 from the working memory 1200 and may store the read data DAT1 in the internal memory 1121.
[0118] Meanwhile, the size of the internal memory 1121 may be limited, and a memory area whose memory size is "S" may be allowed to store the data DAT1. Conversely, the size of the data DAT1 may be ten times the memory size of the allowed memory area (i.e., "10×S"). In this case, 10 memory accesses may occur between the graphics processor 1120 and the working memory 1200, and in each memory access, part of the data DAT1 may be transferred from the working memory 1200 to the internal memory 1121.
[0119] The graphics processor 1120 may process operations corresponding to the nodes N5 and N6 based on the portion of the data DAT1 stored in the internal memory 1121. Fig.13 , in the case where an operation corresponding to the node N6 is processed after the operation corresponding to the node N5 is completed based on partial data of the data DAT1 , 20 memory accesses may occur between the graphics processor 1120 and the working memory 1200 .
[0120] On the contrary, refer to Fig.14 , when operations corresponding to nodes N5 and N6 are processed by sharing the same memory access (for example, when the next portion of data DAT1 is read after operations corresponding to nodes N5 and N6 are performed based on each portion of data DAT1), 10 memory accesses may occur between the graphics processor 1120 and the working memory 1200.
[0121] In the case of a reduced number of memory accesses, the efficiency of the operation can be improved. For example, operations for a convolutional neural network can be processed by using a relatively large amount of data. In the case of a large amount of data, reducing the number of memory accesses can help improve the efficiency of the operation.
[0122] Therefore, refer to Fig.15 , the heterogeneous compiler 3000 may reconfigure the operations corresponding to the nodes N5 and N6 so that the operations corresponding to the nodes N5 and N6 are processed by sharing the same memory access (operation-level optimization). For example, the heterogeneous compiler 3000 may arrange the processing order of the operations corresponding to the nodes N5 and N6 so that the operations corresponding to the nodes N5 and N6 are processed based on the second part of the data DAT1 after the operations corresponding to the nodes N5 and N6 are processed based on the first part of the data DAT1.
[0123] In this example, you can modify or change Figure 7 The graph structure of , makes the edge E20 connected to the nodes N5 and N6, and the edge E40 is connected from the node N4 to the nodes N5 and N6. At the same time, even if the operations corresponding to the nodes N5 and N6 are reconfigured, the relationship between the edges E5 and E6 and the nodes N8 and N9 may not be changed.
[0124] The heterogeneous compiler 3000 may configure the operations corresponding to the nodes N5 and N6 so that the result of the operation corresponding to the node N5 and the result of the operation corresponding to the node N6 are stored independently of each other in the internal memory 1121. Therefore, the operation corresponding to the node N8 may be processed by using the result of the operation corresponding to the node N5, and the operation corresponding to the node N9 may be processed by using the result of the operation corresponding to the node N6.
[0125] The heterogeneous compiler 3000 can allocate resources of the electronic system 1000 for the purpose of processing each operation directed by the program code 3100 ( Fig.10 For example, the heterogeneous compiler 3000 may determine whether any processor among the heterogeneous processors 1110, 1120, 1130, and 1140 processes each operation, whether any memory area of the working memory 1200 stores data for each operation, and the like.
[0126] For example, refer to Fig.16 , the heterogeneous compiler 3000 may determine a processor that will process an operation from the heterogeneous processors 1110, 1120, 1130, and 1140. Therefore, in the heterogeneous processors 1110, 1120, 1130, and 1140, each processor may be selected to process one or more operations allocated among the plurality of operations.
[0127] For example, operations corresponding to nodes N1, N8, and N9 may be assigned to be processed by the digital signal processor 1140, and operations corresponding to nodes N2 and N7 may be assigned to be processed by the main processor 1110. Operations corresponding to nodes N3 and N4 may be assigned to be processed by the neural processor 1130, and operations corresponding to nodes N5 and N6 may be assigned to be processed by the graphics processor 1120.
[0128] In an embodiment, the heterogeneous compiler 3000 may determine the processor that will process each operation by referencing the library information 3350 (thus, taking into account the properties of the operations processed by the heterogeneous processors 1110, 1120, 1130, and 1140). The heterogeneous compiler 3000 may determine the processor that will process each operation based on the information obtained from the library information 3350, so that one or more processing conditions for the operation are optimized.
[0129] For example, the heterogeneous compiler 3000 may find out the time required for each processor to process each operation based on the library information 3350. In this example, the heterogeneous compiler 3000 may determine the processor that will process each operation based on optimizing the total time required to process the operations corresponding to the nodes N1 to N9.
[0130] For example, heterogeneous compiler 3000 may find out the amount of power consumed by each processor to process each operation based on library information 3350. In this example, heterogeneous compiler 3000 may determine a processor that will process each operation based on minimizing the total amount of power consumed to process operations corresponding to nodes N1 to N9.
[0131] However, the above examples are provided for better understanding and are not intended to limit the present disclosure. The heterogeneous compiler 3000 may determine a processor that will process each operation based on various optimization conditions that allow the heterogeneous processors 1110 , 1120 , 1130 , and 1140 to process the operation in an optimized manner.
[0132] For example, in order to determine whether the optimization condition is satisfied (e.g., whether the total time or total power consumption is minimized), the heterogeneous compiler 3000 may calculate the cost required to allocate each operation to each processor by referring to the library information 3350. In some cases, the heterogeneous compiler 3000 may determine the processor that will process each operation based on the weighted sum of the costs calculated for various optimization conditions.
[0133] In some embodiments, the heterogeneous compiler 3000 may determine the processor that will process each operation so that at least a portion of the heterogeneous processors 1110, 1120, 1130, and 1140 operate in parallel for the purpose of processing the operation. For example, even if the graphics processor 1120 is able to process the operation corresponding to the node N7 in the shortest time, the total time is minimized when the operation corresponding to the node N7 is allocated to the main processor 1110, and the main processor 1110 and the graphics processor 1120 operate in parallel to process the operations corresponding to the nodes N5, N6, and N7.
[0134] In this way, the heterogeneous compiler 3000 can also consider the parallel operation of the heterogeneous processors 1110, 1120, 1130, and 1140 for the purpose of determining the processor that will process each operation. The heterogeneous compiler 3000 can pre-schedule the processor that will process each operation before the runtime at which the operation is actually processed by the heterogeneous processors 1110, 1120, 1130, and 1140. In this case, the processing of the operation can be distributed to the heterogeneous processors 1110, 1120, 1130, and 1140 so that the operation is processed efficiently. As a result, in the actual runtime, the performance and efficiency of the heterogeneous processors 1110, 1120, 1130, and 1140 can be improved.
[0135] In some embodiments, the heterogeneous compiler 3000 may not consider the properties (e.g., processing time and power consumption) associated with the operations of the heterogeneous processors 1110, 1120, 1130, and 1140 in actual runtime. Instead, the heterogeneous compiler 3000 may reference the library information 3350 prepared in advance before the actual runtime to determine the processor that will process each operation. Therefore, the heterogeneous compiler 3000 can provide compiler output that is pre-optimized before the actual runtime.
[0136] At the same time, some operations can be processed only by specific processors. These operations can be assigned to be processed by specific processors.
[0137] The heterogeneous compiler 3000 can reference the library information 3350 to map each operation to a determined processor among the heterogeneous processors 1110, 1120, 1130, and 1140. Therefore, in actual runtime, each operation can be processed by the mapped processor. The mapping between each operation and the processors 1110, 1120, 1130, and 1140 can be referenced to generate the compiler output 3700 described below.
[0138] In addition to processor allocation, heterogeneous compiler 3000 may allocate a memory area of working memory 1200 in which data for each operation will be stored. Data for each operation may be stored in the allocated memory area and thus may be accessed in the allocated memory area to be used as input for any other operation. In addition, heterogeneous compiler 3000 may allocate various resources (e.g., buses and caches) to be used to process the operation.
[0139] In some embodiments, the heterogeneous compiler 3000 can optimize the processor level ( Fig.10 S150). For example, the properties of the heterogeneous processors 1110, 1120, 1130, and 1140 (e.g., the number of cores, performance, size of internal memory, operating frequency, operating voltage, hardware circuit structure, and architecture) may be different. The heterogeneous compiler 3000 may reference the library information 3350 to reconfigure operations (processor-level optimization) based on the properties of the heterogeneous processors 1110, 1120, 1130, and 1140.
[0140] For example, refer to Fig.17 , the operation corresponding to the node N2 may be allocated to be processed by the main processor 1110. The operation corresponding to the node N2 may be reconfigured based on the properties of the main processor 1110 (eg, performance and memory size).
[0141] For example, the operation corresponding to the node N2 may use data whose size is larger than the memory size of the internal memory 1111. In this case, the heterogeneous compiler 3000 may tile the operation corresponding to the node N2 so that the operation corresponding to the node N2 is processed based on a portion of the data whose size is allowable according to the memory size of the internal memory 1111. Here, tile may mean scheduling an operation so that the operation may be repeatedly processed by using data of a smaller size, which may be understood as referring to Figure 12 to Figure 14 The descriptions given are similar.
[0142] For example, the main processor 1110 may include four cores 1113a to 1113d. In this case, the operations corresponding to the node N2 may be processed in parallel on the cores 1113a to 1113d. The heterogeneous compiler 3000 may reconfigure the operations corresponding to the node N2 so that the fragmented operations are processed in parallel.
[0143] For example, the internal memory 1111 may store data associated with an operation corresponding to the node N2. When the operation corresponding to the node N2 is completed, the data of the internal memory 1111 may be transferred to the working memory 1200. Afterwards, the memory area of the internal memory 1111 may become free or may be reused to store data for any other operation. The heterogeneous compiler 3000 may schedule the allocation of the internal memory 1111.
[0144] For example, refer to Fig.18 , the working memory 1200 may be used to exchange data between the heterogeneous processors 1110, 1120, 1130, and 1140. Here, in the case where the heterogeneous processors 1110, 1120, 1130, and 1140 can access the working memory 1200 through DMA without intervention of the main processor 1110, efficiency may be improved.
[0145] For example, the digital signal processor 1140 may process an operation corresponding to the node N1 (operation [1]), and data DAT2 corresponding to the result of the processed operation may be stored in the working memory 1200 through DMA (operation [2]). The neural processor 1130 may read the data DAT2 from the working memory 1200 through DMA (operation [3]), and may process an operation corresponding to the node N3 based on the read data DAT2 (operation [4]).
[0146] The heterogeneous compiler 3000 may provide instructions and settings to enable DMA. For example, before processing the operation corresponding to the node N3 and after completing the operation corresponding to the node N1, the heterogeneous compiler 3000 may schedule memory allocation and memory access so that DMA between the processors 1130 and 1140 and the working memory 1200 is enabled.
[0147] In addition, the heterogeneous compiler 3000 may optimize operations to be suitable for various properties of each of the heterogeneous processors 1110, 1120, 1130, and 1140. The processor-level optimization may be based on the library information 3350 prepared in advance before the heterogeneous compiler 3000 is compiled.
[0148] The heterogeneous compiler 3000 can be based on reference Figures 11 to 18 The result of the operations described is to produce compiler output 3700 ( Fig.10The heterogeneous compiler 3000 may compile the program code 3100 together with all or part of the library 3300 for the purpose of generating a compiler output 3700.
[0149] Reference Fig.19 , the heterogeneous compiler 3000 may divide the program code 3100 for the purpose of compiling the program code 3100. For example, the heterogeneous compiler 3000 may divide the entire portion of the program code 3100 into sub-portions DV1 to DV4. The sub-portions DV1 to DV4 may be divided from the entire portion of the program code 3100 to correspond to the heterogeneous processors 1110, 1120, 1130, and 1140, respectively.
[0150] Each of sub-portions DV1 to DV4 may direct one or more operations allocated to be processed by each of heterogeneous processors 1110, 1120, 1130, and 1140. For example, sub-portion DV1 may direct operations corresponding to nodes N2 and N7 allocated to be processed by main processor 1110.
[0151] When the heterogeneous compiler 3000 subdivides the program code 3100, the entire portion of the program code 3100 may be divided into sub-portions DV1 to DV4 corresponding to the heterogeneous processors 1110, 1120, 1130, and 1140, respectively, based on one or more operations mapped to each of the heterogeneous processors 1110, 1120, 1130, and 1140.
[0152] Reference Fig. 20 , the heterogeneous compiler 3000 may compile the sub-portions DV1 to DV4 so that the sub-portions DV1 to DV4 correspond to some libraries among the libraries 3300 that will be referenced by the heterogeneous processors 1110, 1120, 1130, and 1140 for the purpose of processing operations. For example, the heterogeneous compiler 3000 may compile the sub-portion DV1 so that the sub-portion DV1 corresponds to one or more libraries that will be referenced by the main processor 1110 for the purpose of processing operations corresponding to nodes N2 and N7, which are allocated to be processed by the main processor 1110.
[0153] For example, the digital signal processor 1140 may reference the first bank for the purpose of processing a convolution operation, and may reference the second bank for the purpose of processing a pooling operation. The neural processor 1130 may reference the third bank for the purpose of processing a convolution operation, and may reference the fourth bank for the purpose of processing a pooling operation.
[0154] For example, in a case where the operation corresponding to node N1 is associated with a convolution operation and the operation corresponding to node N3 is associated with a pooling operation and there is no second library and a third library, the heterogeneous compiler 3000 can compile sub-portion DV4 that guides the convolution operation so that sub-portion DV4 corresponds to the first library, and can compile sub-portion DV3 that guides the pooling operation so that sub-portion DV3 corresponds to the fourth library.
[0155] In an embodiment, the compilation of the heterogeneous compiler 3000 may use only some libraries that will be referenced by the heterogeneous processors 1110, 1120, 1130, and 1140 for the purpose of processing operations, rather than using all of the libraries 3300. The heterogeneous compiler 3000 may generate a compiler output 3700 by compiling the sub-parts DV1 to DV4 so that the sub-parts DV1 to DV4 correspond to the libraries that will be referenced. Therefore, the compiler output 3700 may include only the optimized results and may have a small data size.
[0156] V. Compiler Output from Heterogeneous Compilers
[0157] Fig.21 It is shown from Figure 5 A conceptual diagram of an example configuration of compiler output 3700 produced by heterogeneous compiler 3000.
[0158] Compiler output 3700 may be a data structure including information required for processing operations by heterogeneous processors 1110, 1120, 1130, and 1140. The information included in compiler output 3700 may be represented in a format understandable by heterogeneous processors 1110, 1120, 1130, and 1140.
[0159] The compiler output 3700 may include a library to be referenced by each processor processing operation. The compiler output 3700 may include data about instructions to be referenced to execute the instructions of the library. For example, the data about instructions may include various constant values or global public values (e.g., kernel weight values, padding size, or stride size for convolution operations). The compiler output 3700 may include a correspondence between the library and the data about instructions for each of the heterogeneous processors 1110, 1120, 1130, and 1140.
[0160] In some cases, the operating system or framework of the electronic system 1000 may include all or part of the library 3300 to be referenced by the heterogeneous processors 1110, 1120, 1130, and 1140. In this case, the compiler output 3700 may be generated without the library, and the heterogeneous compiler 3000 may not receive the library included in the operating system or framework of the electronic system 1000.
[0161] The compiler output 3700 may include setting parameters of the heterogeneous processors 1110, 1120, 1130, and 1140 required for processing operations. For example, the compiler output 3700 may include parameters for setting operating conditions (e.g., circuit enable / disable, connection / disconnection between circuits, and iteration operation count) of a processor implemented with a hardware accelerator (e.g., digital signal processor 1140).
[0162] For example, compiler output 3700 may include setting parameters for supporting DMA for each processor. For example, DMA setting parameters may include various information for supporting DMA, such as a flag for guiding the permission of DMA, the timing when the DMA is permitted, and the address of the memory area for permitting DMA.
[0163] Some processors may operate based on control instructions such as firmware. Firmware may be used to operate a processor. For example, firmware may be provided to set operating conditions for a processor or to control the operation of a processor.
[0164] In some cases, the firmware for the processor may not be installed, and the firmware may need to be newly installed. In some cases, it may be necessary to improve or change the operating conditions or operation of the processor, which is achieved by modifying or updating the firmware.
[0165] Compiler output 3700 may include load instructions and processor control instructions. The processor control instructions may include new or changed instructions for installing, modifying, or updating the control instructions of the firmware. The load instructions may be inserted to trigger the installation, modification, or updating of the control instructions of the firmware based on the processor control instructions.
[0166] Fig. 22 Is used to describe Fig.21 A flowchart of example operations of compiler output 3700 to modify or update a control instruction.
[0167] The electronic system 1000 may receive the compiler output 3700 (S210). The processor of the electronic system 1000 (eg, the main processor 1110) may execute instructions of the compiler output 3700 (S220). First, the main processor 1110 may determine whether a load instruction is detected from the compiler output 3700 (S230).
[0168] When the load instruction is detected ("Yes" of S230), the main processor 1100 can recognize that the compiler output 3700 includes a program control instruction for installing, modifying or updating software / firmware (SW / FW). In response to the detection of the load instruction, the main processor 1110 can install, modify or update the software / firmware based on the processor control instruction of the compiler output 3700.
[0169] Therefore, the heterogeneous processors 1110, 1120, 1130 and 1140 can process operations based on the new software / firmware under the installation or update condition (S250). That is, in order to allow the heterogeneous processors 1110, 1120, 1130 and 1140 to process operations under the new condition, the main processor 1110 can detect the load instruction to first complete the installation, modification or update of the software / firmware.
[0170] In contrast, when the load instruction is not detected (“No” of S230 ), the software / firmware may not be installed, modified, or updated. Therefore, the heterogeneous processors 1110 , 1120 , 1130 , and 1140 may process the operation under the given conditions ( S260 ).
[0171] Reference Fig.21 and Fig. 22 3700 is described as an example configuration of compiler output 3700, but the present disclosure is not limited thereto. The configuration of compiler output 3700 may be variously changed or modified so that compiler output 3700 may be used to efficiently process operations by heterogeneous processors 1110, 1120, 1130, and 1140.
[0172] In addition, refer to Figures 10 to 22 Describes the Figure 7 , but the present disclosure is not limited thereto. It is well understood that, in addition to the graph structure 3100b, the embodiments may be changed or modified with reference to any other program code (e.g., program code 3100a written in a high-level language) to be applied. For example, the heterogeneous compiler 3000 may analyze the input-output relationship between modules (e.g., variables, classes, and functions) of the program code 3100a, and may perform reference based on the analysis result. Figures 10 to 22 Describes the operation.
[0173] In addition, the above description may provide examples associated with operations for convolutional neural networks, but the present disclosure is not limited thereto. Embodiments may be used in any field requiring heterogeneous processors.
[0174] VI. Additional Implementations
[0175] Fig.23 Is a description Figure 5 A flowchart of an exemplary recompilation of the heterogeneous compiler 3000.
[0176] For example, a user application that operates based on the first program code may be installed in the electronic system 1000 (S310). Afterwards, the electronic system 1000 may determine whether to update or modify the first program code to the second program code (S320), for example, under the control of the main processor 1110. For example, in the case where the user downloads a higher version of the user application, the first program code may be updated or modified to the second program code.
[0177] When the first program code is updated or modified to the second program code ("Yes" of S320), the heterogeneous compiler 3000 may compile (recompile) the new second program code together with the relevant input (e.g., the new library and the new library information) (S330). Therefore, the electronic system 1000 may update the user application based on the second program code, for example, under the control of the main processor 1110 (S340). On the contrary, when the first program code is not updated or modified to the second program code ("No" of S320), the heterogeneous compiler 3000 may not perform recompilation.
[0178] A description is given of the heterogeneous compiler 3000 performing recompilation when the first program code is updated or modified to the second program code, but the present disclosure is not limited thereto. When new processing conditions are required for an operation (for example, when the pattern of data input to the convolutional neural network changes or when the configuration of the heterogeneous processor changes), recompilation may be performed with various changes or modifications.
[0179] Fig.24 Is a description for Figure 5 Flowchart of an exemplary training of the heterogeneous compiler 3000.
[0180] The heterogeneous compiler 3000 may compile the program code 3100 together with the related input in a first manner (S410), and may generate a compiler output 3700. The heterogeneous processors 1110, 1120, 1130, and 1140 of the electronic system 1000 may execute the instructions of the compiler output 3700 (S420). The electronic system 1000 may monitor the execution status of the instructions of the compiler output 3700, for example, under the control of the main processor 1110 (S430).
[0181] The heterogeneous compiler 3000 may determine the score of the monitored execution state according to a given standard (S440). For example, the heterogeneous compiler 3000 may determine the score based on whether the operation is processed within a reference time or whether the operation consumes less power than a reference power.
[0182] When the score is not acceptable (No of S450), heterogeneous compiler 3000 may compile program code 3100 together with the relevant input in a second manner different from the first manner (S460). Thereafter, operations S420 to S450 may be performed on the new compiler output.
[0183] When the score is acceptable ("Yes" of S450), heterogeneous compiler 3000 may learn the way of generating compiler output 3700 (S470). For example, heterogeneous compiler 3000 may store information of the learned way in a memory (e.g., non-volatile memory of working memory 1200 or storage device 1300) so that the information of the learned way can be referenced later. Through learning, heterogeneous compiler 3000 can gradually improve the compiler way.
[0184] In an embodiment, the processor can refer to the library and library information configured to be suitable for the heterogeneous processor to implement the heterogeneous compiler to generate a compiler output that can perform appropriate operations under given system conditions. According to the embodiment, the library and library information can be newly written or the library and library information can be modified / updated, so the changes of the heterogeneous processor can be flexibly coped with without modifying the heterogeneous compiler, and the flexibility and scalability for the heterogeneous processor can be provided.
[0185] As traditional in the art, embodiments can be described and illustrated in view of the block of the function or multiple functions of the execution description.These blocks (which may be referred to as units or modules, etc.) are physically implemented by analog and / or digital circuits (such as logic gates, integrated circuits, microprocessors, microcontrollers, memory circuits, passive electronic components, active electronic components, optical components, hard-wired circuits, etc.), and can be selectively driven by firmware and / or software.For example, the circuit can be implemented in one or more semiconductor chips or on substrate supports such as printed circuit boards.The circuit constituting the block can be implemented by dedicated hardware, or by a processor (for example, one or more programmed microprocessors and associated circuits) or by a combination of dedicated hardware for executing some functions of the block and a processor for executing other functions of the block.Without departing from the scope of disclosure, each block of the embodiment can be physically separated into two or more interactive and discrete blocks.Similarly, without departing from the scope of disclosure, the blocks of the embodiment can be physically combined into more complex blocks.The aspects of the embodiment can be realized by instructions stored in a non-transitory storage medium and executed by a processor.
[0186] The above description is intended to provide example configurations and operations for implementing the present disclosure. In addition to the embodiments described above, the present disclosure may include implementations that can be obtained by simply changing or modifying the above description. In addition, the present disclosure may include implementations that can be easily changed or modified in the future.
Claims
1. A method implemented by a processor of an electronic device, the method comprising the steps of: receiving program code directing respective operations to be processed by the heterogeneous processor; receiving respective libraries to be referenced by the heterogeneous processor to process the respective operations; receiving library information, the library information comprising information associated with the respective operations to be processed based on the respective libraries and information associated with properties of processing the respective operations based on the respective libraries; Referencing the library information to determine a processor from the heterogeneous processors that will process the respective operations, so that each processor in the heterogeneous processors processes one or more allocated operations among the respective operations; as well as Compile the sub-portions so that the sub-portions correspond to some libraries respectively, the sub-portions are divided from the entire part of the program code to correspond to the determined processors respectively, and among the libraries, some libraries will be referenced by the determined processor to process the assigned operations.
2. The method according to claim 1, in, The various operations include convolution operations and pooling operations for convolutional neural networks.
3. The method according to claim 1, in, Each of the respective libraries includes instructions that are executed by one of the heterogeneous processors to perform one of the respective operations.
4. The method according to claim 1, in, Receiving the library information includes receiving the library information in a one-to-one correspondence with each of the respective libraries.
5. The method according to claim 1, in, The library information includes information on the type of operation to be processed by referring to each of the respective libraries, information on the amount of power to be consumed by referring to each processing operation in the respective libraries, and information on the time to be taken by referring to each processing operation in the respective libraries.
6. The method according to claim 5, in, The step of determining a processor from the heterogeneous processors that will process the respective operation is based on: taking into account the amount of power consumed while referencing each processing operation in the respective libraries, minimizing the total amount of power consumed while processing the respective operations, or Taking into account the time it takes for each processing operation to reference the respective libraries, the total time it takes to process the respective operations is minimized.
7. The method according to claim 1, in, The step of determining a processor that will process the respective operations from the heterogeneous processors includes mapping each of the respective operations to one of the heterogeneous processors by referring to the library information, so that each of the respective operations is processed by the mapped processor among the heterogeneous processors.
8. The method according to claim 1, in, The step of determining a processor from among the heterogeneous processors that will process the respective operations is based on the library information without considering properties associated with the operations of the heterogeneous processors at actual runtime.
9. The method according to claim 1, further comprising the steps of: receiving system information including information associated with properties of the heterogeneous processors; and The system information is referenced to reconfigure the respective operations based on the determined properties of the processor.
10. The method according to claim 9, in, The system information includes information on the type, performance, and size of an internal memory of each of the heterogeneous processors.
11. The method according to claim 9, in, The step of reconfiguring the respective operations includes slicing the allocated operations so that the allocated operations are processed based on data having an allowable size according to a size of an internal memory of each of the heterogeneous processors.
12. The method according to claim 1, in, Each of the respective sub-portions directs the one or more assigned operations assigned to be processed by each of the determined processors.
13. The method according to claim 1, in, The step of compiling each sub-part so that the sub-parts respectively correspond to some libraries includes: compiling each sub-part of the sub-parts so that each sub-part corresponds to one or more libraries, and the one or more libraries are referenced by each processor among the determined processors to process the one or more assigned operations, and the one or more assigned operations are assigned to be processed by each processor among the determined processors.
14. The method according to claim 1, further comprising the steps of: Compiling the sub-parts to generate compiler output, so that the sub-parts correspond to the libraries respectively, in, The compiler output includes the libraries, data to be referenced to execute instructions of the libraries, and setting parameters for the determined processor to process the respective operations.
15. A processor for operating an electronic device, in, The processor executes instructions of the heterogeneous compiler stored in the memory to perform the following steps: Mapping each operation onto the heterogeneous processors taking into account properties of the operations being processed by the heterogeneous processors, such that each of the operations is processed by a mapped processor in the heterogeneous processors; dividing the entire portion of program code into respective sub-portions, the program code directing the respective operations to be processed by the heterogeneous processors, the respective sub-portions corresponding to the heterogeneous processors based on one or more operations, the one or more operations being mapped to each of the heterogeneous processors; as well as The sub-parts are compiled so that the sub-parts correspond to libraries respectively, and the libraries will be referenced by the heterogeneous processor to process the operations.
16. The processor according to claim 15, in, The step of mapping the respective operations onto the heterogeneous processor is based on library information input to the processor prior to actual runtime without considering properties associated with the operations of the heterogeneous processor at the actual runtime.
17. The processor according to claim 16, in, The library information includes information on an amount of power expected to be consumed by the heterogeneous processor to process the respective operations and information on an amount of time expected to be taken by the heterogeneous processor to process the respective operations.
18. The processor according to claim 15, in: A first processor among the heterogeneous processors references a first library and a second library to process a first operation and a second operation among the respective operations. A second processor among the heterogeneous processors references a third library and a fourth library to process the first operation and the second operation, and When mapping the first operation onto the first processor and mapping the second operation onto the second processor, in the absence of the second library and the third library, the processor compiles a first sub-portion of the program code such that the first sub-portion corresponds to the first library and the first sub-portion directs the first operation, and the processor compiles a second sub-portion of the program code such that the second sub-portion corresponds to the fourth library and the second sub-portion directs the second operation.
19. A method implemented by a processor of an electronic device, the method comprising the steps of: receiving program code directing respective operations to be processed by the heterogeneous processor; Compiling the sub-portions so that the sub-portions correspond to the libraries in a first manner, the libraries will be referenced by the heterogeneous processors to process the operations, the sub-portions are divided from the entire portion of the program code so as to correspond to the heterogeneous processors based on one or more operations among the operations, respectively, the one or more operations are allocated to each of the heterogeneous processors so that each of the heterogeneous processors processes the allocated one or more operations among the operations; as well as The respective sub-parts are compiled so that the respective sub-parts correspond to the respective libraries in the first manner, respectively, to generate a first compiler output, so that at least a part of the heterogeneous processors operate in parallel to process the respective operations.
20. The method according to claim 19, in, The first compiler output includes: a first instruction for modifying or updating a control instruction for operating one or more processors among the heterogeneous processors, and A second instruction for triggering a modification or update of the control instruction, the modification or update being based on the first instruction.
Citation Information
Patent Citations
Mask with pressure-sensitive adhesive tape
KR1020190009814A
User description based programming design method on embedded heterogeneous multi-core processor
CN102707952A
Heterogeneous multiprocessor program compilation targeting programmable integrated circuits
IN201747019583A
Multi-Processing System for including a large number of heterogeneous Processor and Driving Method of the Same
KR1020100032778A
Prefetch for systems with heterogeneous architectures
US20100153934A1
