Compiler program, determination method and information processing device

By analyzing intermediate code metrics like data dependence distance and resource usage rate, the compiler program optimally assigns operations to sequential or parallel units, addressing inefficiencies in heterogeneous systems and reducing compilation time.

JP2024165013AInactive Publication Date: 2024-11-28FUJITSU LTD
View PDF 2 Cites 0 Cited by

Patent Information

Application Number
JP2023080815
Authority / Receiving Office
JP · JP
Patent Type
Applications
Current Assignee / Owner
Filing Date
2023-05-16
Publication Date
2024-11-28
Estimated Expiration
Not applicable · inactive patent

AI Technical Summary

Technical Problem

In heterogeneous computer systems, determining the optimal computing unit for task assignment during compilation can be inefficient, leading to increased compilation time, particularly in Just-In-Time (JIT) compilation scenarios.

Method used

A compiler program that analyzes intermediate code to determine data dependence distance, stride amount, and resource usage rate, allowing it to assign operations to either sequential or data parallel arithmetic units based on these metrics, using equations to optimize resource allocation.

Benefits of technology

This approach enables efficient determination of operation destinations, reducing compilation time and providing clear reasons for the allocation decisions, thus facilitating faster execution and automated task assignment in heterogeneous systems.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure 2024165013000001_ABST
    Figure 2024165013000001_ABST
Patent Text Reader

Abstract

To efficiently determine an assignment destination of calculation.SOLUTION: On the basis of an intermediate code 11a, a processing unit 12 acquires a data-dependent distance between data, and a stride amount as a change amount of an index value used for loop control. The processing unit 12 calculates a resource use ratio indicating the number of nodes to be activated per unit time for each path of a data flow graph 20 corresponding to the intermediate code 11a on the basis of a path length and a vector length of the data. The processing unit 12 calculates the number of average execution resources as an index of the number of calculation resources that can execute in parallel respective instructions in the path on the basis of the data-dependent distance, the stride amount and the resource use ratio for each path. The processing unit 12 determines whether the calculation corresponding to the intermediate code 11a is assigned to a first computing element that performs sequential calculation or is assigned to a second computing element that performs data parallel calculation on the basis of the number of average execution resources calculated for each path.SELECTED DRAWING: Figure 1
Need to check novelty before this filing date? Find Prior Art

Description

[Technical field]

[0001] The present invention relates to a compiler program, a determination method, and an information processing device. [Background technology]

[0002] Computer systems having heterogeneous environments in which different types of computing units coexist are being used. The computer systems may include computing units such as a central processing unit (CPU) that performs sequential operations and a coarse grained reconfigurable array (CGRA) that performs data parallel operations.

[0003] For example, in a heterogeneous multiprocessor system that integrates processors with different instruction sets, a compiler has been proposed that assigns a task to either a general-purpose processor group or an accelerator group depending on the task's execution cost. The proposed compiler calculates the execution cost of a task as the sum of the data transfer time and the task processing time for each processor in the general-purpose processor group and the accelerator group.

[0004] Also, a parallelization method has been proposed in which a computer uses the execution time of each task constituting a sequential program as a judgment value, and if the judgment value is equal to or greater than a certain value, classifies the task as a provisional parallel task, and if it is less than the certain value, classifies the task as a sequential task. In the proposed parallelization method, the computer further adopts as a parallel task those of the provisional parallel tasks that are unlikely to be interfered with by handler processing, and does not adopt as a parallel task those that are likely to be interfered with, but classifies them as sequential tasks. [Prior art documents] [Patent documents]

[0005] [Patent Document 1] JP 2007-328415 A [Patent Document 2] JP 2020-181407 A Summary of the Invention [Problem to be solved by the invention]

[0006] As described above, in a heterogeneous computer system, a process of determining which arithmetic unit is to be assigned to an operation may be performed during compilation. The efficiency of the process of determining affects the time required for compilation. For example, when run-time compilation (JIT (Just-In-Time) compilation) is performed, if the process of determining takes time, the time required to complete the operation may be delayed.

[0007] In one aspect, the present invention aims to enable efficient determination of the allocation destination of an operation. [Means for solving the problem]

[0008] In one embodiment, a compiler program is provided. This compiler program causes a computer to execute the following process. Based on an intermediate code generated from a source program, the computer acquires a data dependency distance between data used in the operation of the intermediate code and a stride amount, which is a change amount of an index value used for loop control in the intermediate code. For each of one or more paths in a data flow graph including a plurality of nodes corresponding to a plurality of instructions included in the intermediate code, the computer calculates a resource usage rate indicating the number of nodes included in the path that are active per unit time, based on a path length of the path and a vector length of data used in the path. For each of one or more paths, the computer calculates an average number of execution resources, which is an index of the number of operation resources that can execute each instruction in parallel on the path, based on the data dependency distance, the stride amount, and the resource usage rate corresponding to the path. Based on the average number of execution resources calculated for each of the one or more paths, the computer determines whether to assign an operation corresponding to the intermediate code to a first operation unit that performs sequential operation or a second operation unit that performs data parallel operation.

[0009] In one embodiment, a determination method executed by a computer is provided.In another embodiment, an information processing device having a storage unit and a processing unit is provided. Effect of the Invention

[0010] On the one hand, it allows efficient determination of where to assign operations. [Brief description of the drawings]

[0011] [Figure 1] FIG. 1 is a diagram illustrating an information processing apparatus according to a first embodiment. [Diagram 2] FIG. 1 illustrates an example of a computer system according to a second embodiment. [Diagram 3] FIG. 2 illustrates an example of hardware of an information processing device. [Figure 4] FIG. 2 is a diagram illustrating an example of functions of an information processing device. [Diagram 5] FIG. 1 illustrates an example of a data flow graph. [Figure 6] FIG. 2 is a diagram illustrating an example of a source program of an MVM kernel. [Figure 7] FIG. 1 illustrates an example of a control flow graph of an MVM kernel. [Figure 8] FIG. 13 illustrates an example of a data flow graph of the MVM kernel. [Figure 9] FIG. 13 is a diagram illustrating an example of index values ​​and stride amounts. [Figure 10] FIG. 13 is a diagram illustrating an example of write and read access to array elements. [Figure 11] FIG. 1 is a diagram illustrating an example of an MVM kernel representation. [Figure 12] FIG. 13 is a diagram showing an example in which the data dependence distance is 2. [Figure 13] 13 is a flowchart illustrating an example of a map destination determination process. [Figure 14] FIG. 2 is a diagram illustrating a first example of a data flow graph. [Figure 15] FIG. 11 illustrates an example of the transition of data allocation to each node. [Figure 16] FIG. 13 is a diagram showing a transition example (continuation) of data allocation to each node. [Figure 17] FIG. 13 is a diagram showing a transition example (continuation) of data allocation to each node. [Figure 18] FIG. 13 is a diagram showing a transition example (continuation) of data allocation to each node. [Figure 19] FIG. 13 is a diagram showing an example of nodes that become active in each step. [Figure 20] FIG. 13 is a diagram showing examples of nodes that become active at each step (continuation). [Figure 21] FIG. 13 is a diagram showing examples of nodes that become active at each step (continuation). [Figure 22] FIG. 13 is a diagram showing examples of nodes that become active at each step (continuation). [Figure 23] FIG. 13 is a diagram showing examples of nodes that become active at each step (continuation). [Figure 24] FIG. 13 is a diagram showing examples of nodes that become active at each step (continuation). [Diagram 25] FIG. 13 is a diagram showing examples of nodes that become active at each step (continuation). [Figure 26] FIG. 13 is a diagram showing examples of nodes that become active at each step (continuation). [Figure 27] FIG. 13 is a diagram illustrating a second example of a data flow graph. DETAILED DESCRIPTION OF THE PREFERRED EMBODIMENTS

[0012] The present embodiment will be described below with reference to the drawings. [First embodiment] A first embodiment will be described.

[0013] FIG. 1 is a diagram illustrating an information processing apparatus according to a first embodiment. The information processing device 10 compiles a source program. Candidates for allocation of an operation related to the source program include a first arithmetic unit that performs sequential operations and a second arithmetic unit that performs data parallel operations. When compiling, the information processing device 10 determines whether the operation is to be allocated to the first arithmetic unit or the second arithmetic unit. The first arithmetic unit is, for example, a CPU or a GPU (Graphics Processing Unit). The second arithmetic unit is, for example, a CGRA or an FPGA (Field Programmable Gate Array). Note that the first arithmetic unit and the second arithmetic unit are omitted from FIG. 1.

[0014] The information processing device 10 has a storage unit 11 and a processing unit 12. The storage unit 11 may be a volatile semiconductor memory such as a random access memory (RAM), or may be a non-volatile storage such as a hard disk drive (HDD) or a flash memory. The processing unit 12 is a processor such as a CPU, a GPU, or a digital signal processor (DSP). However, the processing unit 12 may include an electronic circuit for a specific purpose such as an application specific integrated circuit (ASIC) or an FPGA. The processor executes a program stored in a memory such as a RAM (which may be the storage unit 11). A set of multiple processors may be called a "multiprocessor" or simply a "processor."

[0015] The following processing in the processing unit 12 is executed between a compiler front end that generates an intermediate code from a source program and a compiler back end that generates executable codes corresponding to the first and second computing units from the intermediate code.

[0016] The processing unit 12 obtains, based on the intermediate code 11a, a data dependence distance between data used in the calculation of the intermediate code 11a and a stride amount, which is an amount of change in an index value used for loop control in the intermediate code (step S1). Specifically, the processing unit 12 obtains the data dependence distance as a difference between an index value indicating target data of a load instruction in the intermediate code 11a and an index value indicating target data of a store instruction.

[0017] Here, the processing unit 12 can calculate the data level parallelism DLP from the data dependent distance D and the stride amount Δi using equation (1).

[0018]

number

[0019] Data-level parallelism (DLP) is an index that indicates the parallelism that can be used to simultaneously perform operations on multiple data. The larger the data-level parallelism (DLP), the greater the potential for simultaneous parallel operations.

[0020] The processing unit 12 acquires one or more paths in a data flow graph 20 including a plurality of nodes corresponding to a plurality of instructions included in the intermediate code 11a, the path being one or more paths from a node of a load instruction to a node of a store instruction. For example, the data flow graph 20 includes nodes 21, 22, 23, 24, 25, and 26 and directed edges connecting the nodes. Each of the nodes 21, 22, 23, 24, 25, and 26 corresponds to an arithmetic resource that executes an instruction, and is associated with any of the instructions in the intermediate code 11a. The directed edges indicate the flow of data between the nodes. The nodes 21 and 23, which are the starting points of the paths, correspond to the load instruction. The node 26, which is the end point of the path, corresponds to the store instruction. For example, the data flow graph 20 has paths A and B. The path A is a path that starts from the node 21 and reaches the node 26 via the nodes 22 and 25. The path B is a path that starts from the node 23 and reaches the node 26 via the nodes 24 and 25.

[0021] For each acquired path, the processing unit 12 calculates a resource usage rate indicating the number of nodes included in the path that become active per unit time based on the path length of the path and the vector length of the data used in the path (step S2). As will be described in detail later, when data flows from a node of a load instruction to a node of a store instruction, a node becoming active means a state in which data is assigned to the node. Note that a node represents a computation resource that executes an instruction as described above. Therefore, a node becoming active can also be said to be a computation resource becoming active.

[0022] Specifically, the processing unit 12 calculates the total number of steps P in which data appears on the path in question, based on the path length L of the path and the vector length l of the data, using equation (2).

[0023]

number

[0024] Then, the processing unit 12 calculates the sum Σ k P The resource usage rate U can be calculated by dividing n(k) by the product of the total number of steps P and the total number of nodes N of the path. Here, k indicates the graph level (hierarchy) in the data flow graph 20. In the example of the data flow graph 20, there are a total of four hierarchies. However, the processing unit 12 calculates the average path length L avg and the average active rate of each node in the data flow graph 20, n avg The resource usage rate U can also be approximately calculated by dividing the product of by the total number of steps P. That is, the processing unit 12 can calculate the resource usage rate U by equation (3).

[0025]

number

[0026] For example, the processing unit 12 calculates the resource usage rate U for each of the paths A and B of the data flow graph 20. Note that the order of execution of steps S1 and S2 may be reversed. The processing unit 12 calculates an average number of execution resources, which is an index of the number of computing resources that can execute each instruction in parallel on each path, based on the data dependence distance, the stride amount, and the resource usage rate for each path (step S3). Specifically, the processing unit 12 calculates the average number of execution resources R for the corresponding path by dividing the data dependence distance D by the product of the resource usage rate U and the stride amount Δi. That is, the processing unit 12 can calculate the average number of execution resources R for each of paths A and B using formula (4).

[0027]

number

[0028] Here, the nodes in the data flow graph 20 represent the computing resources that execute instructions as described above. Therefore, the average number of execution resources R corresponds to the average number of computing resources that actually execute instructions from reading to writing data.

[0029] Then, based on the average number of execution resources calculated for each path, the processing unit 12 determines whether to assign the operation corresponding to the intermediate code 11a to a first arithmetic unit that performs sequential operation or to a second arithmetic unit that performs data parallel operation (step S4).

[0030] Specifically, the processing unit 12 determines whether a first product of the number of paths whose average number of execution resources is equal to or greater than a threshold and a positive coefficient value is equal to or greater than a second product of the number of load instructions and the number of store instructions in the data flow graph 20. If the first product is less than the second product, the processing unit 12 determines that the operation is to be assigned to the first arithmetic unit. If the first product is equal to or greater than the second product, the processing unit 12 determines that the operation is to be assigned to the second arithmetic unit. The determination equations for the first product and the second product are expressed by equations (5) and (6).

[0031]

number

[0032]

number

[0033] Here, s in equation (5) i is a variable (s i ∈S). For example, the paths included in the data flow graph 20 are paths A and B. r is a threshold for determination and is a real number equal to or greater than 1.

[0034] R s_iis the average number of execution resources corresponding to the i-th route. Here, the notation “_i” is a convenient expression and indicates a subscript. That is, “s_i” is “s i " Also, N spawn is a positive real number (N spawn >0). N st is the number of store instructions in the data flow graph 20 (N st >0). N ld is the number of load instructions in the data flow graph 20 (N ld >0). N st and N ld The product of these corresponds to a rough estimate of the total number of paths in the data flow graph 20. i corresponds to the majority vote. spawn The value of is given in advance.

[0035] When the processing unit 12 determines that the allocation destination is the first arithmetic unit, it outputs the intermediate code 11a to, for example, a first compiler backend that generates executable code corresponding to the first arithmetic unit. When the processing unit 12 determines that the allocation destination is the second arithmetic unit, it outputs the intermediate code 11a to, for example, a second compiler backend that generates executable code corresponding to the second arithmetic unit.

[0036] In this way, the information processing device 10 executes the following process. Based on the intermediate code 11a generated from the source program, a data dependency distance between data used in the operation of the intermediate code and a stride amount, which is a change amount of an index value used for loop control in the intermediate code, are acquired. A resource usage rate is calculated for each of one or more paths in a data flow graph corresponding to an instruction sequence included in the intermediate code, the path being from a node of a load instruction to a node of a store instruction. The resource usage rate indicates the number of nodes that are active per unit time among multiple nodes included in the path, based on the path length of the path and the vector length of data used in the path. For each of one or more paths, an average number of execution resources, which is an index of the number of operation resources that can execute each instruction in parallel on the path, is calculated based on the data dependency distance, the stride amount, and the resource usage rate corresponding to the path. Based on the average number of execution resources calculated for each of one or more paths, it is determined whether the destination of the operation corresponding to the intermediate code is a first operation unit that performs sequential operation or a second operation unit that performs data parallel operation.

[0037] This allows the information processing device 10 to efficiently determine the allocation destination of the operation. Specifically, the information used in the above processing of the information processing device 10 can be easily acquired from the intermediate code 11a. Furthermore, the information processing device 10 can determine the allocation destination arithmetic unit by simple calculation using this information. That is, the information processing device 10 can determine the allocation destination arithmetic unit by simple analysis of the intermediate code 11a, and the processing cost for this determination can be reduced. For example, the information processing device 10 can quickly determine the allocation destination of the operation. For this reason, the function of the information processing device 10 is expected to be applied to, for example, JIT compilation.

[0038] Moreover, the information processing device 10 inputs a source program and enables end-to-end compilation up to generation of executable code. This eliminates the need for a user to perform work to determine the allocation destination. Furthermore, according to the information processing device 10, the determination of the allocation destination is a quantitative determination as shown in equations (2) to (6). Therefore, for example, the information processing device 10 can present the reason for the determination to the user in an easy-to-understand manner by outputting each value calculated for determining the allocation destination. Since the determination of the allocation destination by the information processing device 10 is a formalized method, the reason for the determination is also clear. Therefore, the information processing device 10 may provide the reason for the determination to the user, to assist the user in smoothly making the final determination of the allocation destination.

[0039] [Second embodiment] Next, a second embodiment will be described. FIG. 2 illustrates an example of a computer system according to the second embodiment.

[0040] The computer system 1 is a heterogeneous computer system in which different types of computing units are mixed. The computer system 1 may be a HPC (High Performance Computing) system having a heterogeneous environment. The computer system 1 has an interconnection network 30, information processing devices 100, a CPU-A group 200, a CPU-B group 300, a GPU group 400, a CGRA group 500, and a storage node group 600. The information processing devices 100, the CPU-A group 200, the CPU-B group 300, the GPU group 400, the CGRA group 500, and the storage node group 600 are connected to the interconnection network 30. For example, InfiniBand or the like is used for the interconnection network 30.

[0041] The information processing device 100 is a computer that compiles a source program and assigns operations to computing units belonging to the CPU-A group 200, the CPU-B group 300, the GPU group 400, and the CGRA group 500.

[0042] The CPU-A group 200 is a group of CPU-A. The CPU-B group 300 is a group of CPU-B. For example, the notation "A" or "B" at the end of CPU-A or CPU-B indicates the type of instruction set, such as x86 or ARM (registered trademark). The GPU group 400 is a group of GPUs. The CGRA group 500 is a group of CGRAs. The storage node group 600 is a group of storage nodes. The storage nodes provide storage devices such as RAM and SSDs (Solid State Drives). Each computing unit of the CPU-A group 200, the CPU-B group 300, the GPU group 400, and the CGRA group 500 executes a computation using a storage node included in the storage node group 600. For example, the connection relationship between each computing unit and the storage node is controlled by the information processing device 100.

[0043] FIG. 3 is a diagram illustrating an example of hardware of an information processing device. The information processing device 100 has a processor 101, a RAM 102, a HDD 103, a GPU 104, an input interface 105, a medium reader 106, and communication interfaces 107 and 108. These units of the information processing device 100 are connected to a bus inside the information processing device 100. The processor 101 corresponds to the processing unit 12 of the first embodiment. The RAM 102 or the HDD 103 corresponds to the storage unit 11 of the first embodiment.

[0044] The processor 101 is an arithmetic device that executes program instructions. The processor 101 is, for example, a CPU. The processor 101 loads at least a part of the program and data stored in the HDD 103 into the RAM 102 and executes the program. The processor 101 may include multiple processor cores. The information processing device 100 may have multiple processors. The processing described below may be executed in parallel using multiple processors or processor cores. A set of multiple processors may also be called a "multiprocessor" or simply a "processor."

[0045] The RAM 102 is a volatile semiconductor memory that temporarily stores programs executed by the processor 101 and data used in calculations by the processor 101. Note that the information processing device 100 may include a type of memory other than a RAM, or may include multiple memories.

[0046] The HDD 103 is a non-volatile storage device that stores software programs such as an OS (Operating System), middleware, and application software, as well as data. The information processing device 100 may include other types of storage devices, such as a flash memory or an SSD, or may include multiple non-volatile storage devices.

[0047] The GPU 104 outputs an image to a display 111 connected to the information processing device 100 in accordance with an instruction from the processor 101. As the display 111, any type of display can be used, such as a CRT (Cathode Ray Tube) display, a liquid crystal display (LCD: Liquid Crystal Display), a plasma display, or an organic EL (OEL: Organic Electro-Luminescence) display.

[0048] The input interface 105 acquires an input signal from an input device 112 connected to the information processing device 100, and outputs the signal to the processor 101. The input device 112 may be a pointing device such as a mouse, a touch panel, a touch pad, or a trackball, a keyboard, a remote controller, or a button switch. In addition, a plurality of types of input devices may be connected to the information processing device 100.

[0049] The medium reader 106 is a reading device that reads programs and data recorded on a recording medium 113. For example, a magnetic disk, an optical disk, a magneto-optical disk (MO: Magneto-Optical disk), a semiconductor memory, etc. can be used as the recording medium 113. Magnetic disks include flexible disks (FD: Flexible Disks) and HDDs. Optical disks include compact discs (CDs) and digital versatile discs (DVDs).

[0050] The medium reader 106 copies, for example, the program or data read from the recording medium 113 to another recording medium such as the RAM 102 or the HDD 103. The read program is executed, for example, by the processor 101. Note that the recording medium 113 may be a portable recording medium, and may be used for distributing the program or data. Also, the recording medium 113 and the HDD 103 may be referred to as computer-readable recording media.

[0051] The communication interface 107 is connected to a network 114 and communicates with other information processing devices via the network 114. The network 114 may include a local area network (LAN), a wide area network (WAN), the Internet, etc. The communication interface 107 may be a wired communication interface connected to a wired communication device such as a switch or a router, or a wireless communication interface connected to a wireless communication device such as a base station or an access point.

[0052] The communication interface 108 is connected to the interconnection network 30. As described above, the communication interface 108 may be, for example, InfiniBand.

[0053] FIG. 4 is a diagram illustrating an example of functions of the information processing device. The information processing device 100 functions as a compiler. The information processing device 100 has a storage unit 120, a compiler front-end 130, a mapping determination unit 140, and compiler back-ends 150, 160, 170, and 180. The storage unit 120 uses storage areas of a RAM 102 and an HDD 103. The compiler front-end 130, the mapping determination unit 140, and the compiler back-ends 150, 160, 170, and 180 are realized by the CPU 101 executing a program stored in the RAM 102.

[0054] The storage unit 120 stores IR (Intermediate Representation) code 121. The IR code 121 is generated by a compiler front end 130. The IR code 121 may be referred to as intermediate code.

[0055] The compiler front end 130 generates the IR code 121 based on a source program (source code). The compiler front end 130 may be software called LLVM (Low Level Virtual Machine), for example.

[0056] The map destination determination unit 140 determines the arithmetic unit to which the operation related to the IR code 121 is assigned based on the IR code 121. The map destination determination unit 140 outputs the IR code 121 to the compiler backend corresponding to the arithmetic unit determined as the assignment destination. The map destination determination unit 140 first analyzes the IR code 121 to determine whether the assignment destination is a first arithmetic unit such as a CPU or GPU that performs sequential operations, or a second arithmetic unit that performs data parallel operations such as a CGRA or FPGA. It can be said that the first arithmetic unit and the second arithmetic unit are different types of arithmetic units. Here, in the example of the computer system 1, the first arithmetic unit also includes multiple arithmetic units that handle different instruction sets, such as CPU-A and CPU-B. Therefore, the map destination determination unit 140 selects one of the multiple first arithmetic units as the assignment destination of the operation according to the instruction set used.

[0057] The compiler backends 150, 160, 170, and 180 generate executable codes corresponding to the respective computing units from the IR code input from the map destination determination unit 140. For example, the compiler backends 150, 160, 170, and 180 correspond to CPU-A, CPU-B, GPU, and CGRA, respectively. Then, the executable codes generated by any of the compiler backends are used to execute operations by the computing units to which the operations are assigned.

[0058] Next, the analysis of the IR code 121 by the map destination determining unit 140 will be described. FIG. 5 is a diagram illustrating an example of a data flow graph. The data flow graph 40 includes an operation node and an edge connecting two operation nodes. An operation node corresponds to an operation resource used to execute an instruction, and corresponds to any instruction in the instruction sequence of the IR code 121. The edges are directed edges. The direction of the arrow of the edge indicates the flow of data. An operation node may be simply referred to as a node. Furthermore, an operation resource may include, for example, a processor element (PE: Processing Element).

[0059] The source program is converted into a data flow graph in units of basic blocks by the compiler front end 130. For example, the map destination determination unit 140 can acquire information on the data flow graph from the compiler front end 130. The map destination determination unit 140 stores the acquired information on the data flow graph in the storage unit 120.

[0060] Here, a description will be given of an example of a source program that is the source of generating the IR code 121. As an example, a source program of an MVM kernel that calculates matrix-vector multiplications (MVM) will be described.

[0061] FIG. 6 is a diagram illustrating an example of a source program of the MVM kernel. The source program 50 is an example of an MVM kernel written in the C language. In the source program 50, a two-dimensional array represented by M[R][C] and one-dimensional arrays represented by V[C] and Y[R] are defined. The result of multiplying M[R][C], which represents a matrix, and V[C], which represents a vector, is stored in Y[R], which represents a vector. The source program 50 is parsed by the compiler front end 130 and converted into an IR instruction sequence in units of basic blocks.

[0062] FIG. 7 is a diagram illustrating an example of a control flow graph of the MVM kernel. The control flow graph 60 shows the execution order of basic blocks in the MVM kernel represented by the source program 50. The control flow graph 60 includes nodes corresponding to basic blocks and edges connecting two nodes, which show the execution order of the basic blocks. The nodes include basic block IDs (IDentifiers), which are the identification numbers of the basic blocks. For example, a basic block with basic block ID "a" is represented as basic block "a".

[0063] For example, basic block "4" is a determination as to whether row index r has reached R. Basic block "12" is a determination as to whether column index c has reached C. In particular, basic block "15" corresponds to the calculation of an element of Y[r].

[0064] FIG. 8 is a diagram illustrating an example of a data flow graph of the MVM kernel. Dataflow graph 70 is a dataflow graph for basic block "15" in control flow graph 60. Dataflow graph 70 has multiple operation nodes corresponding to each instruction in the instruction sequence of basic block "15". The operation nodes are connected by edges indicating the flow of data. The data flow is from the top to the bottom of FIG. 8. Dataflow graph 70 also has multiple paths (six paths in the example of FIG. 8) leading from the operation node at the start of the data flow to the operation node at the end of the data flow. The operation node at the start of the data flow corresponds to a load instruction. The node at the end of the data flow corresponds to a store instruction.

[0065] The data flow graph 70 has operation node groups G1, G2, and G3 and operation nodes 71, 72, 73, 74, 75, and 76. The operation node group G1 corresponds to the calculation of index values ​​of a one-dimensional array V. The operation node group G2 corresponds to the calculation of index values ​​of a two-dimensional array M. The operation node group G3 corresponds to the calculation of index values ​​of a one-dimensional array Y.

[0066] Operation node 71 corresponds to loading an element of V. Operation node 72 corresponds to loading an element of M. Operation node 73 corresponds to multiplication of an element of V and an element of M. Operation node 74 corresponds to loading an element of Y. Operation node 75 corresponds to addition of an element of Y and a product of an element of V and an element of M. Operation node 76 corresponds to storing an element of Y that is a result of the addition. Operation nodes 73 to 76 are repeatedly executed for each value of index c, thereby calculating Y[r] as a cumulative sum.

[0067] Here, in determining the allocation destination of the operation corresponding to the MVM kernel, the map destination determination unit 140 may focus on the basic block "15" corresponding to the operation body in the above control flow graph 60. For example, the map destination determination unit 140 may identify the basic block "15" of the operation body as follows. First, the map destination determination unit 140 checks two loops in the MVM kernel in the control flow graph 60. Specifically, it is the first loop corresponding to the basic block IDs "12", "15", and "33", and the second loop corresponding to the basic block IDs "4", "7", "12", "36", and "37". All operation nodes obtain values ​​by immediate values ​​or load instructions, perform operations, etc., and store them at the end. Then, the map destination determination unit 140 can distinguish the operation body from others (i.e., index operations) by checking the connection from store to load (i.e., the number of the register storing the memory address) between the operation nodes traversing the loop.

[0068] Here, the index value and the stride amount will be described. FIG. 9 is a diagram showing an example of index values ​​and stride amounts. FIG. 9 shows an example of index values ​​and strides in the source program 50 of the MVM kernel described above. The index is a variable that holds the number of loop iterations up to now. The index value is an actual value that points to a specific array element. The index value may be expressed as an expression. The stride is the amount of change in the index value (Δi). It is calculated as Δi=current index value-previous index value.

[0069] Next, the data-dependent distance D will be described. The data dependency distance D is an index that represents the interval between input and output timings in a loop. The input and output timings are the timings of the write array (assignment destination element) and the read array (reference source element). For example, the map destination determination unit 140 verifies all index values ​​for the array variables on the left and right sides of an assignment expression. If multiple loops have n index variables, there are at least n Ds for the input and output timings. When there are multiple Ds, the map destination determination unit 140 can use the smallest value other than 0 (a bottleneck where reference assignments are frequently made).

[0070] FIG. 10 is a diagram showing an example of write and read access to array elements. Access example 80 shows how writing and reading occurs for each of multiple array elements when D=2. Access example 80 shows that there is a series of accesses shown by solid lines and a series of accesses shown by dashed lines. In this way, for example, when D=2, there are two independent accessibilities for the multiple array elements.

[0071] The map destination determination unit 140 calculates the data dependence distance D by focusing on the index value of the array. The data dependence distance D is the difference between the index values ​​of the read source array and the write destination array. When D=0, there is no data dependence between the two. In this way, the map destination determination unit 140 applies D used in the systolic array to general compilation problems.

[0072] Next, we explain the calculation of the data-dependent distance D for the MVM kernel. FIG. 11 is a diagram showing an example of an expression of an MVM kernel. Source program 51 is a description of the loop portion in the MVM kernel. Source program 52 is an example of an expression that combines all dimensions, equivalent to source program 51. In the examples of source programs 51 and 52, X is a two-dimensional array, and Y and Z are one-dimensional arrays. The product of matrix X and vector Y is stored in Z. The accumulation in the innermost loop uses Δi (=j+1-j=1) in the innermost loop as an offset. If there is accumulation at each level, Δi at that level is used as the offset.

[0073] The map destination determination unit 140 obtains the data-dependent distance D for the MVM kernel as follows. First, the D value between Z and X is ii=0 for i. That is, Z and X are independent for row index. Also, the D value between Z and X is jj=0 for j. That is, Z and X are independent for column index.

[0074] Next, the D value between ZY is ii=0 for i. That is, Z and Y are independent for row index. Also, the D value between ZY is jj=0 for j. That is, Z and Y are independent for column index.

[0075] Furthermore, the D value of Z itself is ii=0 for i. That is, Z itself is independent for row index. Also, the D value of Z itself is j-(j-1)=1 for j. This is equal to the stride amount Δi. Therefore, the map destination determination unit 140 obtains D=1 for the MVM kernel as the minimum value other than 0 among the above D values.

[0076] Next, as another example, a case where the data dependent distance D=2 will be described. FIG. 12 is a diagram showing an example in which the data dependence distance is 2. In the source program 53, the D value between Z and X can be calculated as D=i-(i-2)=2. Also, the D value between other data is 0. Therefore, the data dependency distance D=2. Here, FIG. 12 illustrates access sequences 81 and 82 to a plurality of array elements corresponding to the source program 53. The sequences 81 and 82 show a case where i is incremented by one for a loop controlled by index i. The sequence 81 illustrates the reading of an element of X from an array element by the system F1 that performs calculations and stores, and the writing of an element of Z to the array element. The sequence 82 illustrates the reading of an element of X from an array element by the system F2 that performs calculations and stores, and the writing of an element of Z to the array element. The systems F1 and F2 may each be considered to correspond to a calculation resource. Here, the solid arrows from the array element to the systems F1 and F2 respectively indicate the reading of an element of X. Also, the dashed arrows pointing from systems F1 and F2 to the array elements indicate the writing of elements of Z.

[0077] These two independent accessibilities are expressed by an index called data-level parallelism (DLP). Data-level parallelism (DLP) is calculated by the above formula (1). For example, when D=2 and Δi=1, DLP=2 / 1=2. It can be said that the larger the data-level parallelism (DLP), the greater the potential for simultaneous parallel operations.

[0078] Next, the procedure of the mapping destination determination process performed by the information processing device 100 will be described. FIG. 13 is a flowchart illustrating an example of a map destination determination process. (S10) The map destination determining unit 140 acquires the IR code 121 generated by the compiler front end 130.

[0079] (S11) The map destination determination unit 140 calculates the average number of execution resources R for each path of the data flow graph corresponding to the IR code 121 using formula (4). Specifically, the map destination determination unit 140 acquires the above-mentioned data-dependent distance D and stride amount Δi based on the IR code 121. The map destination determination unit 140 also calculates the total number of steps P in which data appears on the corresponding path using formula (2) based on the path length L of the path to be calculated and the vector length l of the data. Furthermore, the map destination determination unit 140 uses the total number of steps P to calculate the resource usage rate U of the path using formula (3). The resource usage rate U indicates the number of active resources (corresponding to the number of operation nodes) per unit time (step). The map destination determination unit 140 then assigns each value of the resource usage rate U, data-dependent distance D, and stride amount Δi of the path to formula (4) to obtain the average number of execution resources R of the path. The average number of executed resources R indicates the average number of resources actually executed from reading to writing for a certain piece of data.

[0080] (S12) The map destination determination unit 140 calculates the average number of execution resources R for each path. s_i Based on this, the decision value s for each route is calculated using equation (5). i Here, we calculate the path s i In the notation, i is a number that identifies the route. s_i denotes the average number of execution resources for the i-th path.

[0081] (S13) The map destination determination unit 140 calculates the determination value s i The judgement value s is determined as follows: i If the sum of the judgment value s satisfies the conditional expression, the process proceeds to step S14. i If the sum does not satisfy the conditional expression, the process proceeds to step S15.

[0082] (S14) The map destination determination unit 140 determines the arithmetic unit that performs the data parallel operation as the allocation destination. That is, the map destination determination unit 140 determines to map to the space. The map destination determination unit 140 outputs the IR code 121 to the compiler backend corresponding to the arithmetic unit that is the allocation destination, and generates executable code. Then, the map destination determination process ends.

[0083] (S15) The map determination unit 140 determines the arithmetic unit that performs sequential arithmetic as the allocation destination. That is, the map determination unit 140 determines to map to the time axis. Then, the map determination unit 140 outputs the IR code 121 to the compiler backend corresponding to the arithmetic unit that is the allocation destination, and generates executable code. Then, the map determination process ends.

[0084] In this way, in steps S12 and S13, the map determination unit 140 assigns the corresponding operation to an arithmetic unit in the data-parallel operation system when the utilization efficiency of the operation resources corresponding to the operation node for data-level parallelism is expected to be higher than a predetermined standard. On the other hand, in other cases, the map determination unit 140 assigns the corresponding operation to an arithmetic unit in the sequential operation system. This allows the map determination unit 140 to appropriately determine the allocation destination. For example, the map determination unit 140 can control so that the utilization efficiency of the arithmetic units in the data-parallel operation system does not decrease when the operation is executed. Here, the above-mentioned predetermined standard is the thresholds r and N in equations (5) and (6) spawn ,N ld ,N st It is determined by.

[0085] As described above, in the computer system 1, for example, a computing unit that performs sequential operations may include a plurality of computing units that handle different instruction sets, such as CPU-A and CPU-B. In this case, in steps S14 and S15, the map destination determination unit 140 further selects one of the plurality of computing units as an allocation destination of the operation according to the instruction set used.

[0086] Next, a specific example of the process of determining the map destination by the map destination determining unit 140 will be described. FIG. 14 is a diagram illustrating a first example of a data flow graph. Dataflow graph 90 shows an example of a single path from an operation node corresponding to a load instruction to an operation node corresponding to a store instruction, i.e., an example of a linear topology. In dataflow graph 90, the operation node located on the leftmost side of the figure is the operation node corresponding to a load instruction. Also, the operation node located on the rightmost side of the figure is the operation node corresponding to a store instruction. In dataflow graph 90, the number of nodes N=6. Also, the path length L of the single path is L=N-1=5.

[0087] The total number of steps P in which data appears on the path is calculated as follows. FIG. 15 illustrates an example of a transition of data allocation to each node. The vector length of the data, that is, the data length l=8, is assumed. Here, the data length is often an immediate value of the load instruction and the store instruction. Therefore, the map destination determination unit 140 can obtain the data length l from the load instruction and the store instruction. If the data length cannot be handled as an immediate value, a register is referenced, and the map destination determination unit 140 can obtain the data length l by checking the source register of the reference instruction.

[0088] In addition, each data element in the diagram is numbered 1 to 8 and loaded in numerical order. The direction of movement of each data element at each step is from the operation node of the load instruction to the operation node of the store instruction in data flow graph 90, that is, from the left side to the right side of the diagram.

[0089] First, data element "1" is read out (step ST1). In this case, data element "1" is assigned to the operation node of the load instruction. When a data element is assigned to an operation node, that operation node is said to be active. Next, data element "2" is read out (step ST2). In this case, data element "1" is assigned to the operation node next to the load instruction. Data element "2" is also assigned to the operation node of the load instruction. Thereafter, data elements "3" to "5" are sequentially read out in a similar manner (steps ST3 to ST5).

[0090] FIG. 16 illustrates a continuation of an example of transition of data allocation to each node. Furthermore, data elements "6" to "8" are read out in sequence (steps ST6 to ST8). For example, at the stage of step ST7, storing of the first data element "1" is completed. Data element "8" is the last data element.

[0091] FIG. 17 illustrates a continuation of an example of transition of data allocation to each node. Each data element is assigned to the next operation node every time the step progresses (steps ST9 to ST11).

[0092] FIG. 18 illustrates a continuation of an example of a transition of data allocation to each node. Furthermore, the data element "7" is stored (step ST12). The data element "8" is stored (step ST13). The storage of the data element "8" is completed (step ST14).

[0093] In this way, when any data element is assigned to each operation node, the operation node becomes active. For data flow graph 90, when data length l=8, the total number of steps in which data appears on the path corresponding to data flow graph 90 is P=N+l=6+8=14.

[0094] Next, an example of calculation of the resource usage rate U for the data flow graph 90 will be described. FIG. 19 is a diagram showing an example of nodes that become active at each step. In the example of data flow graph 90, the total number of graph levels (graph hierarchies) is 6. The six hierarchies are identified by hierarchical numbers k=1, 2, ..., 6, from the hierarchical level of the operation node of the load instruction to the hierarchical level of the operation node of the store instruction. In each of steps ST1 to ST14 illustrated in Figs. 15 to 18, the number n(k) of active operation nodes in each hierarchical level is as follows:

[0095] In step ST1, n(1) = 1, and in other hierarchical layers, n(k) = 0. In step ST2, n(1) = n(2) = 1, and in other hierarchical layers, n(k) = 0. In step ST3, n(1) = n(2) = n(3) = 1, and in other hierarchical layers, n(k) = 0.

[0096] In FIG. 19 and subsequent figures, the history of an active operation node at each step is represented by a black rectangle written below the operation node. FIG. 20 is a diagram showing an example (continuation) of nodes that become active at each step.

[0097] In step ST4, n(1) = n(2) = n(3) = n(4) = 1, and in other hierarchical layers, n(k) = 0. In step ST5, n(1) = n(2) = n(3) = n(4) = n(5) = 1, and in other hierarchical layers, n(k) = 0. In the figure, notations such as "n(1) = 1" are omitted.

[0098] FIG. 21 is a diagram showing an example (continuation) of nodes that become active at each step. In steps ST6 and ST7, for k=1 to 6, n(k)=1. FIG. 22 is a diagram showing an example (continuation) of nodes that become active at each step.

[0099] In step ST8, n(k) = 1 for k = 1 to 6. In step ST9, n(2) = n(3) = n(4) = n(5) = n(6) = 1. Also, in step ST9, the operation node in the k = 1 hierarchical level becomes inactive, so n(1) = 0. In the figure, the history of operation nodes that have transitioned from active to inactive is represented by a white rectangle written below the operation node in question.

[0100] FIG. 23 is a diagram showing an example (continuation) of nodes that become active at each step. In step ST10, n(3) = n(4) = n(5) = n(6) = 1. Also, in step ST10, the operation nodes in the k=2 hierarchical layer are inactive, so n(1) = n(2) = 0.

[0101] In step ST11, n(4) = n(5) = n(6) = 1. Also, in step ST10, the operation nodes in the k=3 hierarchical layer are inactive, so n(1) = n(2) = n(3) = 0.

[0102] FIG. 24 is a diagram showing an example (continuation) of nodes that become active at each step. In step ST12, n(5) = n(6) = 1. Also, in step ST12, the operation nodes in the k=4 hierarchical layer are inactive, so n(1) = n(2) = n(3) = n(4) = 0.

[0103] FIG. 25 is a diagram showing an example (continuation) of nodes that become active at each step. In step ST13, n(6) = 1. Also, in step ST13, the operation nodes in the k=5 hierarchical layer are inactive, so n(1) = n(2) = n(3) = n(4) = n(5) = 0.

[0104] FIG. 26 is a diagram showing an example (continuation) of nodes that become active at each step. In step ST14, n(k)=0 for k=1 to 6. However, the white rectangles for step ST14 are omitted from the illustration.

[0105] In this case, the map destination determination unit 140 calculates the number of operation nodes that become active in each layer of the data flow graph 90 during the total number of steps P as follows: Σn(1)=Σn(2)=Σn(3)=Σn(4)=Σn(5)=Σn(6)=8. Here, Σ indicates that the sum is taken over the number of steps from 1 to 14. In addition, the average active rate n, which is the total number of active times per layer, avg is 6×8 / 6=8. The average active rate may also be called the average active count.

[0106] For example, the resource utilization rate U is calculated as U = (average path length x average active rate) / (time) = (average path length x total active times) / (number of nodes * time). Time corresponds to the total number of steps P. Note that 1 / U = (number of nodes per path) x (time required to be active).

[0107] 26, the average path length is 5, the total number of active times is 6×8, the number of nodes is 6, and the time (total number of steps P) is 14. Therefore, the map destination determining unit 140 calculates U=(average path length×total number of active times) / (number of nodes*time)=(5×6×8) / (6×14)=20 / 7.

[0108] For example, it is assumed that the map destination determination unit 140 acquires a data dependence distance D=1 and a stride amount Δi=1 based on the IR code corresponding to the data flow graph 90. In this case, the map destination determination unit 140 calculates the average number of execution resources R=1 / U=0.35 for one path of the data flow graph 90 based on equation (4).

[0109] For example, when the threshold value r in formula (5) is 1.0, R=0.35<1.0. Therefore, in this case, the map destination determining unit 140 obtains s=0 based on formula (5). Furthermore, for the data flow graph 90, the number of load instructions N ld = 1, and the number of store instructions is N st = 1. Therefore, N d =Nst ×N ld =1×1=1. Also, N spawn In this case, the map destination determination unit 140 sets Σs=s <N d Therefore, it is determined that the formula (6) is not satisfied. Therefore, the map determination unit 140 determines that the operation related to the corresponding IR code should be assigned to a computing unit that performs sequential operations, such as a CPU.

[0110] Next, another example of a data flow graph will be described. FIG. 27 is a diagram illustrating a second example of a data flow graph. The data flow graph 91 has operation nodes corresponding to two load instructions, and includes two paths a and b leading from the two operation nodes to an operation node corresponding to a store instruction. The total number of operation nodes N in the data flow graph 91 is 6. The total number of layers in the graph is 4. Furthermore, the number of operation nodes included in each of the paths a and b is 4. The path length L of each of the paths a and b is L = L avg = 3. Also, for example, assume that the data length is l = 16.

[0111] In this case, for each of the routes a and b, P = L-1 + l = 2 + 16 = 18. Also, the average number of active times n avg =16(=l). Therefore, the mapping determination unit 140 calculates the resource usage rate U=L based on the formula (3). avg ×n avg / (N×P)=3×16 / (6×18)=4 / 9. In this way, the map destination determination unit 140 calculates L avg ×n avg By calculating the above, the numerator Σ for the denominator (N × P) of equation (3) k P An approximation of n(k) may be calculated and used to calculate the resource utilization rate U.

[0112] Here, it is assumed that the map destination determining unit 140 obtains the data dependent distance D=1 and the stride amount Δi=1 based on the IR code corresponding to the data flow graph 91. Then, the map destination determining unit 140 calculates the average number of execution resources R=2.25 for each of the routes a and b based on the formula (4). Also, assume that the threshold value r=1. In this case, the map destination determining unit 140 calculates s=1 for each of the routes a and b based on the formula (5).

[0113] In Data Flow Graph 91, N ld = 2, and N st = 1. Also, N spawn In this case, the map destination determining unit 140 determines, based on the formula (6), that Σs=2=N ld ×N st = 2 × 1, and it is determined that formula (6) is satisfied. Therefore, the map determination unit 140 determines that the destination of the operation related to the IR code is to be a computing unit that performs data parallel operations, such as a CGRA.

[0114] Incidentally, when deciding where to allocate operations, for example, if the data is scalar, the operation nodes in the data flow graph are hardly used, so the decision may be made subjectively, such as "it would be better to handle it on the time axis (CPU)." For example, when mapping a data flow graph to an arithmetic unit array, the user may decide that in the case of vectors or scalar values ​​with short data length, the larger the graph scale is, the fewer the number of times the arithmetic units are used, so it is acceptable to execute the operations on a processor such as a CPU. In this way, there are times when it is necessary to decide whether to map an operation to a data parallel execution system such as an arithmetic unit array, or to a sequential execution system such as a processor.

[0115] In contrast, the information processing device 100 can efficiently determine the allocation destination of the operation. Specifically, the information used in the above processing of the information processing device 100 can be easily acquired from the IR code. Furthermore, the information processing device 100 can determine the allocation destination arithmetic unit by simple calculation using the information. That is, the information processing device 100 can determine the allocation destination arithmetic unit by simple analysis of the IR code, and the processing cost for the determination can be reduced. For example, the information processing device 100 can quickly determine the allocation destination of the operation. For this reason, the function of the information processing device 100 can be expected to be applied to, for example, JIT compilation. By applying it to JIT compilation, the compilation time can be reduced, and the delay until the execution of the operation is completed can be reduced.

[0116] Moreover, the information processing device 100 allows end-to-end compilation up to generation of executable code, using a source program as input. That is, the information processing device 100 can automate the determination of the allocation of the task to a resource by formalizing the characteristics of the task corresponding to the calculation related to the IR code. This eliminates the need for a user to perform an operation to determine the allocation destination. Furthermore, according to the information processing device 100, the determination of the allocation destination is a quantitative determination as shown in equations (2) to (6). Therefore, for example, the information processing device 100 can present the reason for the determination to the user in an easy-to-understand manner by outputting each value calculated for determining the allocation destination (for example, each value used in equations (1) to (6)). Since the determination of the allocation destination by the information processing device 100 is a formalized method, the reason for the determination is also clear. Therefore, the information processing device 100 may provide the reason for the determination to the user, to assist the user in smoothly making the final determination of the allocation destination.

[0117] As described above, the information processing device 100 executes, for example, the following process. The processor 101 acquires, based on an intermediate code (IR code) generated from a source program, a data dependency distance between data used in the operation of the intermediate code and a stride amount, which is a change amount of an index value used for loop control in the intermediate code. The processor 101 identifies one or more paths in a data flow graph including a plurality of nodes corresponding to a plurality of instructions included in the intermediate code, from a node of a load instruction to a node of a store instruction. The processor 101 calculates, for each of the one or more paths, a resource usage rate indicating the number of nodes that become active per unit time among the plurality of nodes included in the path, based on the path length of the path and the vector length of data used in the path. The processor 101 calculates, for each of the one or more paths, an average number of execution resources, which is an index of the number of operation resources that can execute each instruction in parallel on the path, based on the data dependency distance, the stride amount, and the resource usage rate corresponding to the path. Based on the average number of execution resources calculated for each of the one or more paths, the processor 101 determines whether to assign the operation corresponding to the intermediate code to a first arithmetic unit that performs sequential operation or to a second arithmetic unit that performs data parallel operation.

[0118] This allows the information processing device 100 to efficiently determine the allocation destination of the operation. For example, the information processing device 100 can determine the allocation destination arithmetic unit by a simple analysis of the intermediate code, reducing the processing cost for the determination and enabling the allocation destination of the operation to be determined quickly when compiling the source program.

[0119] Furthermore, the processor 101 acquires the difference between the index value indicating the target data of the load instruction and the index value indicating the target data of the store instruction as the data dependence distance. This allows the information processing device 100 to appropriately acquire the data dependence distance. Note that, when there are multiple candidate values ​​for the data dependence distance, the processor 101 may acquire the minimum value other than 0 among the multiple candidate values ​​as the data dependence distance.

[0120] Furthermore, for a route for which resource usage is to be calculated, the processor 101 calculates the total number of steps in which data appears on the route based on the route length of the route and the vector length of the data. The processor 101 then calculates the resource usage by dividing the sum of the number of times data is assigned to each node on the route by the product of the total number of steps and the total number of nodes on the route.

[0121] This allows the information processing device 100 to efficiently calculate resource usage. The sum of the number of times data is assigned to each node of a path corresponds to the number of times vector data appears on the path, and more specifically, it can be said to be the sum of the number of times data elements of the data are assigned to each node from the time the data is loaded to the time it is stored. In addition, the processor 101 calculates the average path length (L avg ) and the average number of nodes active between data load and store for each path in the data flow graph (n avg ) may be multiplied by the average path length (L avg ) and the mean (n avg ) by the product of the total number of steps (P) and the total number of nodes (N) of the path, thereby calculating the resource usage rate (U). This allows the information processing device 100 to efficiently calculate the resource usage rate through simpler calculations.

[0122] Moreover, the processor 101 calculates the average number of execution resources by dividing the data dependence distance by the product of the resource usage rate and the stride amount. This allows the information processing device 100 to easily calculate the average number of execution resources. The calculation of the average number of execution resources (R) corresponds to formula (4).

[0123] In determining the allocation destination of the operation, the processor 101 may determine whether a first product of the number of paths whose average number of execution resources is equal to or greater than a threshold and a positive real value is equal to or greater than a second product of the number of load instructions and the number of store instructions in the data flow graph. In this case, if the first product is less than the second product, the processor 101 determines that the allocation destination is to be the first arithmetic unit. On the other hand, if the first product is equal to or greater than the second product, the processor 101 determines that the allocation destination is to be the second arithmetic unit.

[0124] This allows the information processing device 100 to efficiently determine the allocation destination of operations. The number of paths whose average number of execution resources is equal to or greater than the threshold (r) is calculated by Σs i In addition, the positive real value is equivalent to N in equation (6). spawn The number of load instructions is N in equation (6). ld The number of store instructions is N in formula (6). st In addition, by using formula (6) as the judgment formula, the threshold value (r) and the positive real value (N spawn ) also makes it possible to adjust the arithmetic unit selected as the allocation destination.

[0125] Furthermore, when the processor 101 determines that the allocation destination is the first arithmetic unit, the processor 101 may output the intermediate code to a first compiler backend that generates executable code corresponding to the first arithmetic unit. Also, when the processor 101 determines that the allocation destination is the second arithmetic unit, the processor 101 may output the intermediate code to a second compiler backend that generates executable code corresponding to the second arithmetic unit. This enables the information processing device 100 to perform end-to-end compilation from the compiler front end 130 to the compiler back ends 150, 160, 170, and 180.

[0126] The information processing of the first embodiment can be realized by causing the processing unit 12 to execute a program. The information processing of the second embodiment can be realized by causing the processor 101 to execute a program. The program can be recorded in a computer-readable recording medium 113.

[0127] For example, the program can be distributed by distributing recording medium 113 on which the program is recorded. Alternatively, the program may be stored in another computer and distributed via a network. The computer may store (install) the program recorded in recording medium 113 or a program received from another computer in a storage device such as RAM 102 or HDD 103, and read and execute the program from the storage device. [Explanation of symbols]

[0128] 10. Information processing device 11 Storage section 11a Intermediate Code 12 Processing section 20 Data Flow Graph 21, 22, 23, 24, 25, 26 nodes S1, S2, S3, S4 steps

Claims

1. On the computer, Based on an intermediate code generated from a source program, a data dependency distance between data used in the operation of the intermediate code and a stride amount which is an amount of change in an index value used in loop control in the intermediate code are obtained; calculating a resource usage rate indicating the number of nodes that are active per unit time among the nodes included in one or more paths in a data flow graph that includes a plurality of nodes corresponding to a plurality of instructions included in the intermediate code, the one or more paths being from a node of a load instruction to a node of a store instruction, based on a path length of the path and a vector length of data used in the path; calculating an average number of execution resources for each of the one or more paths, the average number being an index of the number of computing resources capable of executing each instruction in parallel on the path, based on the data dependence distance, the stride amount, and the resource usage rate corresponding to the path; determining whether an operation corresponding to the intermediate code is to be assigned to a first arithmetic unit that performs a sequential operation or to a second arithmetic unit that performs a data parallel operation, based on the average number of execution resources calculated for each of the one or more paths; A compiler program that executes the process.

2. acquiring, as the data dependency distance, a difference between the index value indicating the target data of the load instruction and the index value indicating the target data of the store instruction; 2. The compiler program according to claim 1, which causes the computer to execute a process.

3. Calculating the total number of steps in which data appears on the corresponding path based on the path length and the vector length, and calculating the resource usage rate by dividing the sum of the number of times data is assigned to each node of the path by the product of the total number of steps and the total number of nodes of the path; 2. The compiler program according to claim 1, which causes the computer to execute a process.

4. Calculating the average number of execution resources by dividing the data dependency distance by the product of the resource usage rate and the stride amount; 2. The compiler program according to claim 1, which causes the computer to execute a process.

5. the determining includes determining whether a first product of a number of paths in which the average number of execution resources is equal to or greater than a threshold and a positive real value is equal to or greater than a second product of a number of the load instructions and a number of the store instructions in the data flow graph; If the first product is less than the second product, determining that the allocation destination is the first computing unit; if the first product is equal to or greater than the second product, determining that the second computing unit is to be the allocation destination; 2. The compiler program according to claim 1, which causes the computer to execute a process.

6. When it is determined that the allocation destination is the first arithmetic unit, the intermediate code is output to a first compiler backend that generates executable code corresponding to the first arithmetic unit; When it is determined that the destination of the allocation is the second arithmetic unit, the intermediate code is output to a second compiler backend that generates an executable code corresponding to the second arithmetic unit.

2. The compiler program according to claim 1, which causes the computer to execute a process.

7. The computer Based on an intermediate code generated from a source program, a data dependency distance between data used in the operation of the intermediate code and a stride amount which is an amount of change in an index value used in loop control in the intermediate code are obtained; calculating a resource usage rate indicating the number of nodes that are active per unit time among the nodes included in one or more paths in a data flow graph that includes a plurality of nodes corresponding to a plurality of instructions included in the intermediate code, the one or more paths being from a node of a load instruction to a node of a store instruction, based on a path length of the path and a vector length of data used in the path; calculating an average number of execution resources for each of the one or more paths, the average number being an index of the number of computing resources capable of executing each instruction in parallel on the path, based on the data dependence distance, the stride amount, and the resource usage rate corresponding to the path; determining whether an operation corresponding to the intermediate code is to be assigned to a first arithmetic unit that performs a sequential operation or to a second arithmetic unit that performs a data parallel operation, based on the average number of execution resources calculated for each of the one or more paths; Judgment method.

8. a storage unit that stores an intermediate code generated from a source program; a processing unit that acquires, based on the intermediate code, a data dependency distance between data used in an operation of the intermediate code and a stride amount which is an amount of change in an index value used for loop control in the intermediate code, calculates, for each of one or more paths in a data flow graph including a plurality of nodes corresponding to a plurality of instructions included in the intermediate code, the one or more paths being from a node of a load instruction to a node of a store instruction, based on a path length of the path and a vector length of data used in the path, calculates, for each of the one or more paths, an average number of execution resources which is an index of the number of operation resources capable of executing each instruction in parallel on the path, based on the data dependency distance, the stride amount, and the resource usage corresponding to the path, and determines, based on the average number of execution resources calculated for each of the one or more paths, whether an operation corresponding to the intermediate code should be assigned to a first arithmetic unit which performs sequential operation or a second arithmetic unit which performs data parallel operation; An information processing device having the above configuration.

Citation Information

Patent Citations

  • Control method of heterogeneous multiprocessor system, and multigrain parallelization compiler

    JP2007328415A

  • Parallelization method, semiconductor control device, and on-vehicle control device

    JP2020181407A