Inference processing engine selection device, inference processing engine selection method, and inference processing engine selection program

The inference processing engine selection device optimizes engine allocation across layers by considering computation and data transfer times, addressing inefficiencies in conventional methods and improving processing speed in AI inference tasks.

WO2024214304A1PCT designated stage expired Publication Date: 2024-10-17NT T INC
View PDF 1 Cites 0 Cited by

Patent Information

Application Number
PCT/JP2023/015242
Authority / Receiving Office
WO · WO
Patent Type
Applications
Current Assignee / Owner
Filing Date
2023-04-14
Publication Date
2024-10-17

AI Technical Summary

Technical Problem

Conventional methods for allocating processing layers across multiple inference processing engines in AI inference processing, such as CNNs, do not effectively consider data transfer times, leading to reduced throughput due to inefficient data movement and transfer delays, especially in large data handling processes.

Method used

An inference processing engine selection device and method that dynamically selects and adjusts the engine for each layer based on the specifications of available engines, calculating and minimizing the sum of computation and data transfer times to optimize processing efficiency by reassigning engines between layers.

Benefits of technology

This approach significantly reduces overall processing time by minimizing unnecessary data transfer and optimizing engine allocation, thereby enhancing the throughput of AI inference processing tasks.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure JP2023015242_17102024_PF_FP_ABST
    Figure JP2023015242_17102024_PF_FP_ABST
Patent Text Reader

Abstract

This inference processing engine selection device comprises: a selection unit that selects, from among a plurality of inference processing engines that process layers during inference processing which uses a convolutional neural network (CNN), an inference processing engine for a target layer and a layer before or after the target layer on the basis of the details of each inference processing engine; and an adjustment unit that again selects the inference processing engine for the target layer on the basis of the inference processing engine selection result obtained as a result of selection by the selection unit, the calculation period when the target layer is processed by each candidate inference processing engine, and the data transfer period required when the inference processing engine is switched between the target layer and the layer before or after the target layer.
Need to check novelty before this filing date? Find Prior Art

Description

Inference processing engine selection device, inference processing engine selection method, and inference processing engine selection program

[0001] The disclosed technology relates to an inference processing engine selection device, an inference processing engine selection method, and an inference processing engine selection program.

[0002] Artificial intelligence (AI) processing such as object detection is performed using various inference processing engines, such as a central processing unit (CPU), a graphics processing unit (GPU), a field-programmable gate array (FPGA), and a dedicated application-specific integrated circuit (ASIC). These AI processes are primarily trained in an environment using a GPU to create a model, which is then converted into a model format suitable for operation on each platform during inference.

[0003] In recent years, advances in hardware technology have made it possible to perform AI processing more efficiently by using a heterogeneous processing platform equipped with multiple inference processing engines. An example of the configuration of an inference processing device using such a processing platform is shown in Figure 12.

[0004] As shown in Figure 12, each inference processing engine is connected via an external memory and executes processing instructed by the control unit. The inference model is converted to be optimized for each inference processing engine. A means for converting an inference model to enable AI inference processing is generally called a deep neural network (DNN) compiler, but when multiple inference processing engines are used, the challenge is how to allocate the processing of each layer of the convolutional neural network (CNN) to each inference processing engine.

[0005] TVM, an open-source DNN compiler (see, for example, Non-Patent Document 1), provides a mechanism called BYOC (Bring Your Own Codegen) to easily support new inference processing engines prepared by users when utilizing multiple inference processing engines. TVM's BYOC provides a mechanism for assigning which layers in a CNN model to an inference processing engine, for example, in units of layer operators such as "Conv2D" and "Relu." Depending on the parameters assigned to the same operator, some engines may be able to process it, while others may not. Therefore, it is possible to select and assign an inference processing engine based on such conditions. An example of code for the inference processing engine assignment process is shown in FIG. 13 (see, for example, Non-Patent Document 2).

[0006] Furthermore, if the inference processing engine is optimized to process frequently occurring patterns such as some patterns (e.g., Conv+Add+Relu) with a single command, it is possible to register these patterns as a group and assign them to an inference processing engine that can process them. An example of code for pattern registration is shown in Figure 14 (see, for example, Non-Patent Document 2).

[0007] Apache TVM (https: / / tvm.apache.org / ) How to Bring Your Own Codegen to TVM (https: / / tvm.apache.org / 2020 / 07 / 15 / how-to-bring-your-own-codegen-to-tvm)

[0008] However, while the conventional configuration can assign which layer operators each inference processing engine will be responsible for processing, this assignment is based solely on the original model structure and does not take into account the movement and transfer of data when processing is shuttled between engines. As a result, in processes that handle large amounts of data, such as CNN, data transfer time cannot be ignored, and waiting for data transfer can sometimes cause a decrease in overall throughput.

[0009] The disclosed technology has been made in consideration of the above points, and aims to provide an inference processing engine selection device, an inference processing engine selection method, and an inference processing engine selection program that can shorten the overall processing time required for inference processing when multiple inference processing engines are selectively used.

[0010] A first aspect of the present disclosure is an inference processing engine selection device comprising: a selection unit that selects an inference processing engine for a target layer and layers before and after the target layer from among a plurality of inference processing engines that process each layer in inference processing using a convolutional neural network, based on specifications of each inference processing engine; and an adjustment unit that reselects an inference processing engine for the target layer based on the selection result of the inference processing engine selected by the selection unit, the calculation time required to process the target layer with each candidate inference processing engine, and the data transfer time required to switch the inference processing engine between the target layer and the layers before and after the target layer.

[0011] A second aspect of the present disclosure is an inference processing engine selection method, which selects an inference processing engine for a target layer and layers before and after the target layer based on specifications of each inference processing engine from among a plurality of inference processing engines that process each layer in inference processing using a convolutional neural network, and reselects an inference processing engine for the target layer based on the selection result of the inference processing engine obtained by the selection, the calculation time required to process the target layer with each candidate inference processing engine, and the data transfer time required to switch inference processing engines between the target layer and the layers before and after the target layer.

[0012] A third aspect of the present disclosure is an inference processing engine selection program that causes a computer to execute a process of selecting an inference processing engine for a target layer and layers before and after the target layer based on specifications of each inference processing engine from among a plurality of inference processing engines that process each layer in inference processing using a convolutional neural network, and reselecting an inference processing engine for the target layer based on the selection result of the inference processing engine obtained by the selection, the calculation time required to process the target layer with each candidate inference processing engine, and the data transfer time required to switch inference processing engines between the target layer and the layers before and after the target layer.

[0013] The disclosed technology has the effect of reducing the overall processing time required for inference processing when multiple inference processing engines are selectively used.

[0014] 1 is a block diagram showing an example of the hardware configuration of an inference processing engine selection device according to a first embodiment. FIG. 2 is a block diagram showing an example of the functional configuration of an inference processing engine selection device according to the first embodiment. FIG. 3 is a block diagram showing the functional configuration of an inference processing engine selection device according to a comparative example. FIG. 4 is a diagram showing an example of a pattern table according to an embodiment. FIG. 5 is a diagram showing an example of selection of an inference processing engine for each layer operator in a CNN structure according to the first embodiment. FIG. 6 is a flowchart showing an example of the flow of inference processing engine selection processing by an inference processing engine selection program according to the first embodiment. FIG. 7 is a diagram showing an example of the structure of a CNN inference model according to a second embodiment. FIG. 8 is a flowchart showing an example of the flow of inference processing engine selection processing by an inference processing engine selection program according to the second embodiment. FIG. 9 is a diagram showing an example of the adjustment result of an inference processing engine according to the second embodiment. FIG. 10 is a diagram showing another example of the adjustment result of an inference processing engine according to the second embodiment. FIG. 11 is a diagram showing a conventional technique. FIG. 12 is a diagram showing a conventional technique.

[0015] An example of an embodiment of the disclosed technology will be described below with reference to the drawings. Note that in each drawing, the same or equivalent components and parts are given the same reference numerals. Also, the dimensional proportions in the drawings are exaggerated for the convenience of explanation and may differ from the actual proportions.

[0016] The inference processing engine selection device of this embodiment provides specific improvements over conventional methods of allocating inference processing engines to each layer based on the structure of the inference processing engine, and represents an advancement in the technical field of allocating inference processing engines to each layer based on the structure of the inference processing engine.

[0017] For example, assume that an inference processing engine A processes a certain Lth layer, and an inference processing engine B processes the adjacent (L-1)th and (L+1)th layers. The inference processing engine selection device according to this embodiment is configured so that if inference processing engine B is also capable of processing the Lth layer and the data transfer cost between inference processing engine A and inference processing engine B is high, then inference processing engine B also processes the Lth layer. In other words, it is possible to select the inference processing engine that results in the smallest total of the calculation time and data transfer time for each layer, thereby shortening the overall processing time for inference processing.

[0018] First Embodiment FIG. 1 is a block diagram showing an example of the hardware configuration of an inference processing engine selection device 10 according to a first embodiment.

[0019] 1, the inference processing engine selection device 10 includes a CPU (Central Processing Unit) 11, a ROM (Read Only Memory) 12, a RAM (Random Access Memory) 13, a storage 14, an input unit 15, a display unit 16, and a communication interface (I / F) 17. Each component is connected to each other via a bus 18 so as to be able to communicate with each other.

[0020] The CPU 11 is a central processing unit that executes various programs and controls each component. That is, the CPU 11 reads programs from the ROM 12 or the storage 14 and executes the programs using the RAM 13 as a work area. The CPU 11 controls the above-described components and performs various arithmetic processing in accordance with the programs stored in the ROM 12 or the storage 14. In this embodiment, the ROM 12 or the storage 14 stores an inference processing engine selection program for selecting an appropriate inference processing engine for each layer of a convolutional neural network (hereinafter referred to as "CNN"). Note that, instead of the CPU, for example, a GPU (Graphics Processing Unit) may be used.

[0021] The ROM 12 stores various programs and various data. The RAM 13 temporarily stores programs or data as a working area. The storage 14 is configured with an HDD (Hard Disk Drive) or an SSD (Solid State Drive) and stores various programs including the operating system and various data.

[0022] The input unit 15 includes a pointing device such as a mouse and a keyboard, and is used to input various information to the device itself.

[0023] The display unit 16 is, for example, a liquid crystal display, and displays various information. The display unit 16 may be a touch panel type and function as the input unit 15.

[0024] The communication interface 17 is an interface for communicating with, for example, other external devices, and may use a wired communication standard such as Ethernet (registered trademark) or FDDI (Fiber Distributed Data Interface), or a wireless communication standard such as 4G, 5G, or Wi-Fi (registered trademark).

[0025] The inference processing engine selection device 10 according to this embodiment is implemented as a general-purpose computer device such as a server computer or a personal computer (PC).

[0026] Next, the functional configuration of the inference processing engine selection device 10 will be described with reference to FIG.

[0027] FIG. 2 is a block diagram showing an example of the functional configuration of the inference processing engine selection device 10 according to the first embodiment.

[0028] The inference processing engine selection device 10 of this embodiment is configured to select an inference processing engine for the target layer by pattern matching based on the layer operator information corresponding to each inference processing engine, and then reselect an inference processing engine for the target layer based on the calculation time in the target layer and the data transfer time between the target layer and the previous and next layers.

[0029] 2, the inference processing engine selection device 10 has, as its functional components, a registration unit 101, an analysis unit 102, a selection unit 103, a calculation unit 104, and an adjustment unit 105. Each functional component is realized when the CPU 11 reads out an inference processing engine selection program stored in the ROM 12 or the storage 14, expands it in the RAM 13, and executes it.

[0030] Fig. 3 is a block diagram showing the functional configuration of an inference processing engine selection device 100 according to a comparative example. Comparing the device configuration of Fig. 2 with the device configuration of Fig. 3, the inference processing engine selection device 10 according to this embodiment differs from the inference processing engine selection device 100 according to the comparative example in that it includes a calculation unit 104 and an adjustment unit 105.

[0031] The registration unit 101 shown in FIG. 2 reads layer operator (Operator) information corresponding to each inference processing engine X (X = 1 to N), which is prepared in advance as an input file, and registers the information in a pattern table. The input layer operator information refers to layer operators that can be processed by the inference processing engine X. Examples of layer operators include two-dimensional convolution operations such as "Conv2D" and "DilatedConv2D," and pooling operations such as "MaxPooling" and "AveragePooling." Layer operator information is generated based on the specifications supported by each inference processing engine, and there are as many layer operator information as there are inference processing engines (= N). Note that, for simplicity of explanation, this embodiment will be described using two inference processing engines A and B, but the number of inference processing engines may be three or more.

[0032] FIG. 4 is a diagram showing an example of a pattern table according to this embodiment. FIG. 4 shows an example of registration of a pattern table when there are two inference processing engines. The pattern table also specifies the priority order for each inference processing engine. In the example of FIG. 4, a smaller priority number indicates a higher priority, and the layer operators corresponding to each inference processing engine A and B are listed. Here, the layer operator "Conv2D" exists in both inference processing engines A and B, but when "Conv2D" appears in the CNN inference model, inference processing engine A will currently be selected with priority.

[0033] The analysis unit 102 reads the input CNN inference model file and analyzes the layer operators that make up the CNN and the connection state of each layer operator. These layer operators and their connection states are stored in the storage 14. Here, the CNN inference model file is a file that is composed of parameters such as a CNN structure and weights when performing CNN inference such as object detection. The CNN structure is composed of multiple layer operators. The weights represent, for example, coefficients and biases that make up the kernel (filter) coefficients when performing two-dimensional convolution Conv2D.

[0034] The selection unit 103 selects an inference processing engine for a target layer and layers before and after the target layer from among a plurality of inference processing engines that process each layer in the CNN inference processing, based on the specifications of each inference processing engine. Specifically, the selection unit 103 selects which inference processing engine will process each layer operator in the CNN inference model, based on the pattern table registered by the registration unit 101.

[0035] 5 is a diagram showing an example of inference processing engine selection for each layer operator in a CNN structure according to the first embodiment. For example, in the case of a CNN structure as shown in (A), an inference processing engine is selected for each layer operator as shown in (B). The inference processing engine selection information for the Lth layer is defined as E(L). In this example, E(L) is inference processing engine A or inference processing engine B, and for simplicity, it is expressed as E(L) = #A or E(L) = #B.

[0036] When the selection result of the inference processing engine for the target layer differs from the selection result of the inference processing engine for the previous or next layer, and the inference processing engines for the previous or next layer are the same, the calculation unit 104 calculates the calculation time for each layer and the data transfer time between the inference processing engines required when the inference processing engine for the target layer is made the same as the inference processing engine for the previous or next layer. The calculation unit 104 calculates the calculation time and data transfer time required to process the target CNN inference model. The calculation time for each inference processing engine to process each layer operator is mainly proportional to the feature map data size that is input during calculation. For example, in the case of a convolution calculation, the calculation time for each inference processing engine to process each layer operator is calculated as C x (L), the calculation time is C x (L) is the number of (product-sum) operations N that can be performed in 1 clk ("clk" is an abbreviation for clock). ops , feature map size (W, H), number of input / output channels (iCH, oCH), and kernel size (k * k), it is expressed by the following equation (1).

[0037] C x (L)=W×H×iCH×oCH×k×k / N ops[CLK] (1)

[0038] Here, x represents an inference processing engine, and in this example, x=A or B. Furthermore, L represents a layer number.

[0039] The data transfer time is the time required to transfer the feature map required for inference processing between inference processing engines via external memory (generally DRAM). In other words, the data transfer time is the time required for data to pass through external memory when different inference processing engines are used between layers. When the same inference processing engine is used in consecutive layers, the required data can be stored in internal memory (generally high-speed SRAM) within the inference processing engine, so the data transfer time is not taken into consideration. In this example, the transfer time between inference processing engine A and external memory, and between external memory and inference processing engine B, is calculated from the feature map data size (W x H x iCH x 8 bits) and the external memory transfer rate M [Byte / clk]. The data transfer time from layer L to layer L+1 is set to M L,L+1 Then, the data transfer time M L,L+1 (in the case of 8 bits) is expressed by the following equation (2).

[0040] M L,L+1 =W×H×iCH / M [CLK]...(2)

[0041] The adjustment unit 105 reselects an inference processing engine for the target layer based on the selection result of the inference processing engine obtained by the selection unit 103, the calculation time required to process the target layer with each candidate inference processing engine, and the data transfer time required to switch the inference processing engine between the target layer and the previous and next layers. Specifically, the adjustment unit 105 changes the inference processing engine for the target layer to the inference processing engine for the previous and next layers when the sum of the calculation time for each layer and the data transfer time between the inference processing engines required when the inference processing engine for the target layer is made the same as the inference processing engines for the previous and next layers, calculated by the calculation unit 104, is smaller than the sum of the calculation time for each layer based on the initial selection result of the inference processing engine and the data transfer time between the inference processing engines.

[0042] Next, the operation of the inference processing engine selection device 10 according to the first embodiment will be described with reference to FIG.

[0043] 6 is a flowchart showing an example of the flow of inference processing engine selection processing by the inference processing engine selection program according to the first embodiment. The inference processing engine selection processing by the inference processing engine selection program is realized by the CPU 11 of the inference processing engine selection device 10 writing the inference processing engine selection program stored in the ROM 12 or storage 14 to the RAM 13 and executing it.

[0044] In step S101 of FIG. 6, the CPU 11 receives input of the CNN inference model file and layer operator information shown in FIG. 2 above, as an example.

[0045] In step S102, the CPU 11 reads the CNN inference model file that has been input, analyzes the layer operators that make up the CNN and the connection status of each layer operator, reads the layer operator information that has been input, and registers it in the pattern table shown in Figure 4 above, as an example.

[0046] In step S103, the CPU 11 selects which inference processing engine will process each layer operator in the CNN inference model based on the pattern table registered in step S102, as shown in FIG. 5 above, as an example.

[0047] In step S104, the CPU 11 calculates the calculation time C required to process the target CNN inference model. x (L) and the data transfer time between layers M L,L-1 , M L,L+1 Calculate.

[0048] In steps S105 to S110, the CPU 11 repeats the process for each layer operator in the CNN inference model, from the first layer (L = 0) to the final layer. As described above, the inference processing engine selection information is E(L), the layer number is L, and in this example, E(L) = #A or E(L) = #B.

[0049] In step S106, the CPU 11 determines whether E(L) = #A, E(L-1) = #B, and E(L+1) = #B. "E(L) = #A, E(L-1) = #B, and E(L+1) = #B" indicates that the inference processing engine of the target layer L is different from the inference processing engines of the layers (L-1, L+1) before and after the target layer L, and that the inference processing engines of the layers (L-1, L+1) before and after the target layer L are the same. If it is determined that E(L) = #A, E(L-1) = #B, and E(L+1) = #B (in the case of a positive determination), the process proceeds to step S107. If it is determined that E(L) = #A, E(L-1) = #B, and E(L+1) = #B are not true (in the case of a negative determination), the process proceeds to step S109.

[0050] In step S107, the CPU 11 calculates the calculation time C of the target layer L that would be required if the inference processing engine of the target layer L were made the same as the inference processing engines of the previous and next layers (L−1, L+1). B The sum of the data transfer time between (L) and the inference processing engine is the calculation time C of each layer based on the initial selection result of the inference processing engine. A It is determined whether the time required for data transfer between the inference processing engine and ...

[0051] C A (L) + M L,L-1 +M L,L+1 >C B (L) ... (3)

[0052] The above formula (3) represents the calculation time C when the inference processing engine A of the target layer L is changed to the inference processing engine B in the same way as the previous and next layers, in the case where the inference processing engines of the target layer L and the previous and next layers L-1 and L+1 are different as a result of the conditional branch determination in step S106. B (L) and data transfer time (however, M L,L-1 +M L,L+1 = 0) is the calculation time C based on the initial inference processing engine selection result. A (L) and data transfer time (M L,L-1 +M L,L+1If it is determined that the above formula (3) is satisfied (in the case of a positive determination), the process proceeds to step S108, and if it is determined that the above formula (3) is not satisfied (in the case of a negative determination), the process proceeds to step S109.

[0053] In step S108, the CPU 11 changes the inference processing engine A of the target layer L to the inference processing engine B, as shown in FIG. 7, as in the previous and next layers (L-1, L+1) (E(L)←#B, "←" indicates substitution).

[0054] FIG. 7 is a diagram illustrating an example of a result of adjustment of the inference processing engine according to the first embodiment.

[0055] If both steps S106 and S107 result in a positive judgment, for example, as shown in Figure 7, inference processing engine A (= #A) for L = 2 in the layer structure before adjustment is changed to inference processing engine B (= #B) for L = 2 after adjustment.

[0056] In step S109, when the CPU 11 has completed the determination for the target layer L, it increments the layer number L by one to L+1, and repeats the same process up to the final layer.

[0057] In step S110, when the repeated process up to the final layer is completed and there are three or more inference processing engines, if there are Z inference processing engines, the CPU 11 calculates a total of Z C 2 (C represents a combination) times.

[0058] As described above, according to this embodiment, when selecting which inference processing engine will process each layer in the CNN inference model, the inference processing engine that results in the smallest total of both the calculation time and the data transfer time is selected. As a result, unnecessary data transfer time is cut down, and the overall processing time for the inference process can be shortened.

[0059] [Second Embodiment] In the second embodiment, a form that can shorten the processing time when processing a CNN inference model having a branch-transform-join structure in a CNN structure, such as InceptionNet, will be described.

[0060] The configuration of the inference processing engine selection device according to the second embodiment (hereinafter referred to as the "inference processing engine selection device 10A") is the same as that of the inference processing engine selection device 10 according to the first embodiment (see Figure 2), and the differences will be explained below.

[0061] As an example, when the CNN inference model has a layer structure in which layers branch into two or more and merge again, and when the inference processing engines of each layer in each branch are all the same, or when all of the inference processing engines included in the device are not selected, the calculation unit 104 calculates the calculation time and the data transfer time between the inference processing engines when replacing the inference processing engine of a layer in one branch with an inference processing engine that is not selected in each branch, as shown in Fig. 8. Here, it is desirable that the layer that is a candidate for replacing the inference processing engine of a layer in a branch with an inference processing engine that is not selected in each branch is, for example, the layer that includes the fewest number of layer operators in the branch.

[0062] 8 is a diagram illustrating an example of the structure of a CNN inference model according to the second embodiment. In the example of FIG. 8, the numbers in parentheses for each layer operator indicate the processing order. In this case, processing is performed in the order of "(0) Conv2D" → "(1) Conv2D" → "(2) Conv2D" → "(3) Conv2D" → "(4) Add." In addition, inference processing engine A (=#A) is selected for each layer of L=0 to 4.

[0063] The adjustment unit 105 changes the inference processing engine of a layer in one of the branches to an inference processing engine that is not selected in each branch when the sum of the calculation time and the data transfer time between the inference processing engines calculated by the calculation unit 104 when the inference processing engine of the layer in one of the branches is replaced with an inference processing engine that is not selected in each branch is smaller than the sum of the calculation time of each layer based on the initial inference processing engine selection result and the data transfer time between the inference processing engines.

[0064] In addition, when the CNN inference model has a layer structure in which layers branch into two or more and then merge again, and all of the inference processing engines provided in the device are assigned to process each layer in each branch, the calculation unit 104 may calculate the calculation time and data transfer time between the inference processing engines when the inference processing engine of a layer in one branch is changed to another inference processing engine.

[0065] In this case, the adjustment unit 105 changes the inference processing engine of a layer in one branch to another inference processing engine if the sum of the calculation time and the data transfer time between the inference processing engines calculated by the calculation unit 104 when the inference processing engine of a layer in one branch is changed to another inference processing engine is smaller than the sum of the calculation times of each layer by the inference processing engine originally assigned to the layer in one branch and the layer in a branch other than the one branch and the other inference processing engine.

[0066] Next, the operation of the inference processing engine selection device 10A according to the second embodiment will be described with reference to FIG.

[0067] 9 is a flowchart showing an example of the flow of an inference processing engine selection process using an inference processing engine selection program according to the second embodiment. The inference processing engine selection process using the inference processing engine selection program is realized by the CPU 11 of the inference processing engine selection device 10A writing the inference processing engine selection program stored in the ROM 12 or storage 14 to the RAM 13 and executing it.

[0068] The processing in steps S111 to S114 in FIG. 9 is the same as the processing in steps S101 to S104 shown in FIG. 6, and therefore a repeated description thereof will be omitted.

[0069] 9, the CPU 11 determines whether there is a branch in the layer connections in the CNN structure, and whether the same inference processing engine has been selected to process each layer operator in each branch. If it is determined that there is a branch in the layer connections and that the same inference processing engine has been selected to process each layer operator in each branch (if the determination is positive), the process proceeds to step S116. If it is determined that there is no branch in the layer connections or that the same inference processing engine has not been selected to process each layer operator in each branch (if the determination is negative), the inference processing engine selection process is terminated.

[0070] In step S116, the CPU 11 selects a branch with the fewest number of layer operators in each branch. The layer in the selected branch is a candidate layer when replacing the inference processing engine of the target layer L with an inference processing engine that is not selected in each branch.

[0071] In step S117, the CPU 11 calculates the calculation time C associated with changing (replacing) the inference processing engine of the target layer L included in the branch with the fewest layer operators in each branch to another inference processing engine. B (L) and the inference processing engine data transfer time (M (L’),(L) +M (L),(L’’’) ) is the calculation time C based on the initial inference processing engine selection result. A (L) and the inference processing engine (however, M (L’),(L) +M (L),(L’’’) It is determined whether it is smaller than the sum of (=0).

[0072] For example, in the case of the CNN structure shown in Fig. 8, the determination condition in step S117 is expressed as the following formula (4), where L = 3, L' = 0, and L''' = 4, and the case where inference processing engine A (= #A) for the layer with L = 3 is changed to another inference processing engine B (= #B) is shown.

[0073] C A (L) > C B (L) + M (L’),(L) +M (L),(L’’’) ...(4)

[0074] In step S117, if it is determined that the above formula (4) is satisfied (if the result is a positive judgment), the process proceeds to step S118, and if it is determined that the above formula (4) is not satisfied (if the result is a negative judgment), the inference processing engine selection process is terminated.

[0075] FIG. 10 is a diagram illustrating an example of a result of adjustment of the inference processing engine according to the second embodiment.

[0076] If the judgment in step S117 is affirmative, for example, as shown in FIG. 10, inference processing engine A (=#A) for L=3 in the layer structure before adjustment is changed to inference processing engine B (=#B) for L=3 after adjustment.

[0077] In the above step S115, the first condition is whether or not the inference processing engines that process the layer operators in each branch are all the same when there is a branch. However, instead of this, the condition may be whether or not there is an inference processing engine among the inference processing engines provided in the device that is not assigned (not selected) to process any layer operator according to the priority condition of the inference processing engine. In this case, the inference processing engine to be changed is treated as an unassigned inference processing engine and a similar determination process is performed.

[0078] Furthermore, the reason why the branch containing the fewest number of layer operators is selected in step S116 is that the inference processing engine that processes the layer operators in this branch is essentially an inference processing engine with a lower original priority than the initially selected inference processing engine. If an inference processing engine with a lower priority processes a small number of layer operators, it is more likely to complete the processing while an inference processing engine with a higher priority in another branch is processing layer operators multiple times. In other words, the following formula (5) may be used instead of the above formula (4):

[0079] C A (L') + C A (L'')>C B (L) + M (L’’’),(L) +M (L),(L’’’’) ...(5)

[0080] Even when the above formula (5) is satisfied, by changing the inference processing engine A (= #A) of the target layer L to the inference processing engine B (= #B), it is possible to shorten the overall processing time compared to when no change is made.

[0081] The concept of the above formula (5) can also be applied when there are three or more branch destinations, and when any of the inference processing engines provided in the device itself is selected within each branch layer.

[0082] FIG. 11 is a diagram showing another example of the adjustment result of the inference processing engine according to the second embodiment.

[0083] In FIG. 11, it is assumed that there is a CNN structure shown in (A), and two inference processing engines are selected to process each layer operator. Here, for example, it is assumed that inference processing engine A (=#A) for "(5) Conv2D" where L=5 is changed to inference processing engine B (=#B). Inference processing engine B (=#B) is also used for "(4) DilatedConv2D", but while inference processing engine A processes "(1) Conv2D" to "(3) Conv2D" as processes before "(4) DilatedConv2D", the calculation time C for inference processing engine B to process "(5) Conv2D" is B (5) and the required data transfer time (M (0),(5) +M (5),(6) ), by changing inference processing engine A (=#A) of "(5) Conv2D" to inference processing engine B (=#B), as shown in (B), it is possible to complete the processing time of "(5) Conv2D" within the processing time of "(1) Conv2D" to "(3) Conv2D", thereby shortening the overall processing time.

[0084] In other words, when the following formula (6) is satisfied, the inference processing engine A (=#A) of "(5) Conv2D" may be changed to the inference processing engine B (=#B) as shown in (B) of Figure 11.

[0085] C A (1) + C A (2) + C A (3) + CB (4) + C A (5) > C B (5) + M (0),(5) +M (5),(6) ...(6)

[0086] That is, when the inference processing engine A of “(5) Conv2D” which is a layer in one branch is changed to another inference processing engine, inference processing engine B, the calculation time C B (5) and the data transfer time between the inference processing engine (M (0),(5) +M (5),(6) ) is the sum of the calculation times of each layer by the inference processing engine A and the inference processing engine B initially assigned to the layers in one branch and the layers in the branches other than the one branch (C A (1) + C A (2) + C A (3) + C B (4) + C A If the value is smaller than (5)), the inference processing engine A of "(5) Conv2D" is changed to the inference processing engine B.

[0087] Returning to Figure 9, in step S118, as an example, the CPU 11 changes the inference processing engine A of the target layer L to another inference processing engine B (E(L)←#B, "←" indicates substitution), as shown in Figure 10, and terminates this inference processing engine selection process.

[0088] As described above, according to this embodiment, it is possible to reduce the processing time when processing a CNN inference model having a branch-transform-join structure in a CNN structure, such as InceptionNet.

[0089] The inference processing engine selection process, which the CPU reads and executes the program in the above embodiment, may be executed by various processors other than the CPU. Examples of such processors include programmable logic devices (PLDs) (such as field-programmable gate arrays (FPGAs)) whose circuit configuration can be changed after manufacture, and dedicated electrical circuits, such as application-specific integrated circuits (ASICs), which are processors with circuit configurations designed specifically to execute specific processes. The inference processing engine selection process may be executed by one of these various processors, or by a combination of two or more processors of the same or different types (e.g., multiple FPGAs, or a combination of a CPU and an FPGA). The hardware structure of these various processors is, more specifically, an electrical circuit that combines circuit elements such as semiconductor devices.

[0090] In the above embodiment, the inference processing engine selection program is described as being pre-stored (also referred to as "installed") in a ROM or storage, but this is not limiting. The inference processing engine selection program may be provided in a form stored on a non-transitory storage medium such as a CD-ROM (Compact Disk Read Only Memory), a DVD-ROM (Digital Versatile Disk Read Only Memory), or a USB (Universal Serial Bus) memory. The inference processing engine selection program may also be downloaded from an external device via a network.

[0091] All publications, patent applications, and technical standards mentioned in this specification are herein incorporated by reference to the same extent as if each individual publication, patent application, or technical standard was specifically and individually indicated to be incorporated by reference.

[0092] The following additional notes are provided regarding the above-described embodiments.

[0093] (Supplementary Item 1) An inference processing engine selection device comprising: a memory; and at least one processor connected to the memory, wherein the processor selects an inference processing engine for a target layer and layers before and after the target layer based on specifications of each inference processing engine from among a plurality of inference processing engines that process each layer in inference processing using a convolutional neural network, and reselects an inference processing engine for the target layer based on the selection result of the inference processing engine obtained by the selection, the calculation time when processing the target layer with each candidate inference processing engine, and the data transfer time required when switching inference processing engines between the target layer and the layers before and after.

[0094] (Supplementary Item 2) A non-transitory storage medium storing a program executable by a computer to execute an inference processing engine selection process, wherein the inference processing engine selection process selects an inference processing engine for a target layer and layers before and after the target layer based on specifications of each inference processing engine from among a plurality of inference processing engines that process each layer in inference processing using a convolutional neural network, and re-selects an inference processing engine for the target layer based on the selection result of the inference processing engine obtained by the selection, the calculation time required to process the target layer with each candidate inference processing engine, and the data transfer time required to switch inference processing engines between the target layer and the layers before and after it.

[0095] 10, 10A Inference processing engine selection device 11 CPU 12 ROM 13 RAM 14 Storage 15 Input unit 16 Display unit 17 Communication I / F 18 Bus 101 Registration unit 102 Analysis unit 103 Selection unit 104 Calculation unit 105 Adjustment unit

Claims

1. An inference processing engine selection device comprising: a selection unit which selects an inference processing engine for a target layer and layers before and after the target layer based on the specifications of each inference processing engine from among a plurality of inference processing engines which process each layer in inference processing using a convolutional neural network; and an adjustment unit which reselects an inference processing engine for the target layer based on the selection result of the inference processing engine selected by the selection unit, the calculation time required to process the target layer with each candidate inference processing engine, and the data transfer time required to switch the inference processing engine between the target layer and the layers before and after the target layer.

2. The inference processing engine selection device as described in claim 1, further comprising a calculation unit that calculates the calculation time for each layer and the data transfer time between the inference processing engines required when the inference processing engine for the target layer is made the same as the inference processing engines for the previous and next layers when the selection result of the inference processing engine for the target layer is different from the selection result of the inference processing engine for the previous or next layer and the inference processing engines for the previous or next layer are the same.

3. The inference processing engine selection device of claim 2, wherein the adjustment unit changes the inference processing engine of the target layer to the inference processing engine of the previous or next layer when the sum of the calculation time of each layer and the data transfer time between the inference processing engines calculated by the calculation unit when the inference processing engine of the target layer is made the same as the inference processing engine of the previous or next layer is smaller than the sum of the calculation time of each layer and the data transfer time between the inference processing engines based on the initial inference processing engine selection result.

4. The inference processing engine selection device according to claim 2, wherein the calculation unit calculates the calculation time and data transfer time between the inference processing engines when the inference processing engine of the layer in one of the branches is replaced with an inference processing engine not selected in each branch, when the convolutional neural network model has a layer structure in which layers branch into two or more and merge again, and when all of the inference processing engines of each layer in each branch are the same, or when all of the inference processing engines of the device have not been selected; and the adjustment unit changes the inference processing engine of the layer in one of the branches to the inference processing engine not selected in each branch, when the sum of the calculation time and the data transfer time between the inference processing engines when the inference processing engine of the layer in one of the branches is replaced with an inference processing engine not selected in each branch, calculated by the calculation unit, is smaller than the sum of the calculation time of each layer based on the initial selection result of the inference processing engine and the data transfer time between the inference processing engines.

5. An inference processing engine selection device as claimed in claim 4, wherein a candidate layer for replacing an inference processing engine of a layer within said branch with an inference processing engine not selected in each said branch is a layer containing the smallest number of layer operators within said branch.

6. The inference processing engine selection device according to claim 2, wherein, when the convolutional neural network model has a layer structure in which layers branch into two or more and merge again, and when all of the inference processing engines of the device have been assigned to process each layer in each branch, the calculation unit calculates the calculation time when the inference processing engine of the layer in one of the branches is changed to another inference processing engine and the data transfer time between the inference processing engines; and when the sum of the calculation time when the inference processing engine of the layer in one of the branches is changed to another inference processing engine and the data transfer time between the inference processing engines, calculated by the calculation unit, is smaller than the sum of the calculation times of each layer by the inference processing engine and the other inference processing engine initially assigned in the layer in the one branch and in a layer in a branch other than the one branch.

7. An inference processing engine selection method in which an inference processing engine selection device selects an inference processing engine for a target layer and layers before and after the target layer based on specifications of each inference processing engine from among a plurality of inference processing engines that process each layer in inference processing using a convolutional neural network, and reselects an inference processing engine for the target layer based on the selection result of the inference processing engine obtained by the selection, the calculation time required to process the target layer with each candidate inference processing engine, and the data transfer time required to switch the inference processing engine between the target layer and the layers before and after the target layer.

8. An inference processing engine selection program for causing a computer to execute the following process: from among a plurality of inference processing engines that process each layer in inference processing using a convolutional neural network, an inference processing engine for a target layer and layers before and after the target layer based on the specifications of each inference processing engine; and reselecting an inference processing engine for the target layer based on the selection result of the inference processing engine obtained by the selection, the calculation time required to process the target layer with each candidate inference processing engine, and the data transfer time required to switch the inference processing engine between the target layer and the layers before and after the target layer.

Citation Information

Patent Citations

  • Information processor, information processing program, and information processing method

    JP2020102108A