A method for mapping a network-on-chip task based on a recurrent neural network

By using a training method based on recurrent neural networks, the functional relationship between the mapping sequence and the communication cost is fitted, which solves the problem of high communication cost in on-chip network task mapping, achieves high-performance mapping solutions, and reduces communication costs.

CN116185944BActive Publication Date: 2026-11-24SUN YAT SEN UNIV
View PDF 2 Cites 0 Cited by

Patent Information

Application Number
CN202310101442.4
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2023-02-08
Publication Date
2026-11-24
Estimated Expiration
2043-02-08

AI Technical Summary

Technical Problem

Existing technologies cannot effectively solve the problem of on-chip network task mapping, resulting in high communication costs and the inability to obtain high-performance mapping solutions.

Method used

A recurrent neural network-based approach is adopted. By constructing a training set and training a recurrent neural network, and using the mapping sequence as input, the neural network is trained to fit the functional relationship between the mapping sequence and the communication cost, thereby obtaining a high-performance mapping solution.

Benefits of technology

With sufficient data and time, communication costs are reduced by approximately 30%, improving the performance of the on-chip network computing system.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN116185944B_ABST
    Figure CN116185944B_ABST
Patent Text Reader

Abstract

This invention discloses an on-chip network task mapping method based on a recurrent neural network, comprising the following steps: S1: Randomly constructing multiple mapping sequences as a training set, wherein the mapping sequence is a vector mapping the IP core bound to the corresponding task to the corresponding router in the on-chip network; S2: Constructing a recurrent neural network according to the total number of tasks; S3: Training the recurrent neural network of step S2 using the training set of step S1 to obtain a trained recurrent neural network; S4: Sequentially confirming the input values ​​of the trained recurrent neural network, maximizing the performance estimate corresponding to each input value, and ensuring that each input value is different; S5: Sorting the input values ​​according to the input order to obtain the mapping sequence corresponding to the application. This invention, with sufficient training data and training time, can reduce communication costs by approximately 30% compared to the traditional NMAP algorithm.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This invention relates to the fields of electronic technology and deep learning technology, and more specifically, to an on-chip network task mapping method based on recurrent neural networks. Background Technology

[0002] With the advancement of semiconductor technology, the number of processor units that can be integrated onto a single chip has increased dramatically. This brings with it significant challenges to existing bus architectures in terms of long interconnect lengths, latency, throughput, power consumption, clock synchronization, parallelism, and scalability. Therefore, researchers have introduced computer network technology into multiprocessor systems-on-a-chip (SoCs), leading to the development of Network on Chip (NoC). NoC borrows the structure of computer interconnect networks, solving the communication bottleneck problems of traditional SoC bus architectures. However, task scheduling in NoC is a typical NP-hard problem with high time complexity, requiring simultaneous consideration of performance metrics such as communication power consumption and communication time.

[0003] Network-on-a-Chip (NAT) borrows communication methods from distributed computing systems, employing routing and packet switching technologies instead of traditional buses. This results in more efficient inter-core communication capabilities, making it a key component of multi-core computing. Assigning multiple tasks to multiple cores involves NAT task scheduling methods. A good task scheduling method can improve the performance of a NAT computing system, with performance metrics including communication power consumption and communication time, which can be represented by the parameter of communication cost. Mapping application task nodes to NAT IP cores is an NP-hard problem. Existing research shows that effective mapping algorithms can reduce communication cost, thereby reducing system communication power consumption and latency.

[0004] Recurrent Neural Networks (RNNs) are a commonly used neural network architecture. Their unique recurrent nature makes them excellent at processing and predicting sequential data. Just as convolutional neural networks are specifically designed for processing two-dimensional data (such as images), recurrent neural networks are specifically designed for processing sequential information. RNNs can scale to longer sequences; most RNNs can handle sequences of variable length. The advent of RNNs overcame the limitations of traditional neural networks in processing sequential information.

[0005] Existing technology discloses an on-chip network mapping method for AI applications. The method involves: acquiring the physical network information within the chip and the neural network application processing information mounted on the on-chip network; mapping the computing units within the on-chip network based on the physical network and application information; the on-chip network sending convolution weights to the multiplication units; calculating the convolution result corresponding to the current convolution window; determining whether the calculation of all convolutional layers in the neural network application has been completed; determining whether all convolution calculations of the current convolutional layer have been completed; determining whether all convolution calculations corresponding to the current convolution window have been completed; and determining whether the fourth adder outside the on-chip network has completed its accumulation operation, thus ending the mapping. This method cannot achieve a high-performance mapping solution. Summary of the Invention

[0006] This invention provides an on-chip network task mapping method based on recurrent neural networks, which can obtain high-performance mapping solutions when there is sufficient training data and training time.

[0007] To solve the above-mentioned technical problems, the technical solution of the present invention is as follows:

[0008] A method for on-chip network task mapping based on recurrent neural networks includes the following steps:

[0009] S1: Randomly construct multiple mapping sequences as a training set, wherein the mapping sequence is a vector that maps the IP core bound to the corresponding task to the corresponding router in the on-chip network;

[0010] S2: Construct a recurrent neural network based on the total number of tasks;

[0011] S3: Use the training set from step S1 to train the recurrent neural network from step S2, and obtain the trained recurrent neural network.

[0012] S4: Sequentially confirm the input values ​​of the trained recurrent neural network, and maximize the performance estimate corresponding to each input value, with each input value being different;

[0013] S5: Sort the input values ​​in the order of input to obtain the mapping sequence corresponding to the application.

[0014] Preferably, the mapping sequence is as follows:

[0015] X = (x1, x2, ..., x N-1 ,x N )

[0016] In the formula, x i Represents task t xi The bound IP core c xi Router r mapped to on-chip network i , 1≤i≤N, where N is the total number of tasks.

[0017] Preferably, the performance evaluation Q of the mapping sequence X is defined as a comparison between the communication cost of the mapping sequence X and the average communication cost, specifically:

[0018]

[0019] In the formula, Aver_CC is the average communication cost, F(A,X) is the communication cost of the mapping sequence X, and the higher the performance estimate corresponding to each input value in step S4, the higher the performance evaluation Q.

[0020] Preferably, the communication cost F(A,X) of the mapping sequence X is specifically:

[0021]

[0022] In the formula, r i r j They represent IP cores c i c j Mapped router location, a i,j Represents IP core c i c j The communication requirements between them, where A represents the adjacency matrix corresponding to the application.

[0023] Preferably, the adjacency matrix A corresponding to the application is specifically:

[0024] Given an application, its corresponding task graph is represented by its n-dimensional adjacency matrix A, where each vertex of the task graph represents the corresponding task t. i The bound IP core c i Each edge e i,j Indicates from c i to c j Communication needs, e i,j weight value a i,j The value of adjacency matrix A in the i-th row and j-th column represents the communication requirements for communication transmission. i,j .

[0025] Preferably, the average communication cost Aver_CC refers to the average communication cost for a large number of randomly constructed mapping sequences X, estimated using 100,000 random sequences:

[0026]

[0027] Where Xn represents an arbitrarily constructed mapping sequence.

[0028] Preferably, in step S2, a recurrent neural network is constructed based on the total number of tasks, specifically as follows:

[0029] A recurrent neural network consists of N single-layer Ellmann RNN modules of the same type, where N is the total number of tasks. The training parameters of the nth single-layer Ellmann RNN module are an h×h matrix Whn and an i×h matrix WXn, where i = N and h = 2N. The inputs of the nth single-layer Ellmann RNN module are hn and Xn, where hn is a 1×h matrix, hn represents the output of the previous single-layer Ellmann RNN module, and except for h1, which is a default zero input matrix, the rest are used to represent the hidden state. The parameters are not trainable. Xn is the one-hot encoded representation of the input symbol at the corresponding position.

[0030] Preferably, the one-hot encoding representation is specifically as follows:

[0031] One-hot encoding is represented as a 1×N matrix, where the x-th... i The value of one bit is 1, and the rest are 0.

[0032] Preferably, the calculation formula for a single-layer Ellmann RNN module is as follows:

[0033]

[0034] Preferably, the performance estimate P(X) corresponding to each input value in step S4 is... t |A), specifically:

[0035] P(X t |A)=sum(h t+1 )

[0036] In the formula, sum(h) t+1 ) represents h t+1 The sum of all elements in the matrix.

[0037] Compared with the prior art, the beneficial effects of the technical solution of the present invention are:

[0038] This invention uses a large number of mapping sequences as a training set and the performance index reflected by communication cost as a label. Given sufficient data, the parameters in the neural network can be trained well to fit the functional relationship between the mapping sequence and the communication cost. Given any mapping sequence as input to the neural network, the estimated communication cost can be output. If the fitting error of the neural network is small enough, a mapping sequence with sufficiently low communication cost can be constructed by querying the network parameters, thus obtaining a high-performance mapping solution. Compared to the traditional algorithm NMAP, this invention can reduce the communication cost by approximately 30% when the training set data and training time are sufficient. Attached Figure Description

[0039] Figure 1 This is a schematic diagram of the method flow of the present invention.

[0040] Figure 2 The application task graph and its equivalent n-dimensional adjacency matrix provided in the embodiments are as follows: Figure 2 The left side shows the application task diagram. Figure 2 The right side is an n-dimensional adjacency matrix.

[0041] Figure 3 A 2D-mesh topology diagram of the on-chip network provided for an embodiment.

[0042] Figure 4 This is a schematic diagram of the mapping results provided for an example.

[0043] Figure 5 A schematic diagram of a recurrent neural network structure provided for an embodiment.

[0044] Figure 6 This is a schematic diagram of one-hot encoding provided for an embodiment.

[0045] Figure 7 This is a schematic diagram illustrating the fitting result of the global solution space after training with 100,000 randomly constructed mapping sequences as the training set, as provided in the example. Detailed Implementation

[0046] The accompanying drawings are for illustrative purposes only and should not be construed as limiting the scope of this patent.

[0047] To better illustrate this embodiment, some parts in the accompanying drawings may be omitted, enlarged, or reduced, and do not represent the actual product dimensions;

[0048] It will be understood by those skilled in the art that certain well-known structures and their descriptions may be omitted in the accompanying drawings.

[0049] The technical solution of the present invention will be further described below with reference to the accompanying drawings and embodiments.

[0050] Example 1

[0051] This embodiment provides an on-chip network task mapping method based on recurrent neural networks, such as... Figure 1 As shown, it includes the following steps:

[0052] S1: Randomly construct multiple mapping sequences as a training set, wherein the mapping sequence is a vector that maps the IP core bound to the corresponding task to the corresponding router in the on-chip network;

[0053] S2: Construct a recurrent neural network based on the total number of tasks;

[0054] S3: Use the training set from step S1 to train the recurrent neural network from step S2, and obtain the trained recurrent neural network.

[0055] S4: Sequentially confirm the input values ​​of the trained recurrent neural network, and maximize the performance estimate corresponding to each input value, with each input value being different;

[0056] S5: Sort the input values ​​in the order of input to obtain the mapping sequence corresponding to the application.

[0057] Example 2

[0058] This embodiment, based on Embodiment 1, continues to disclose the following content:

[0059] The mapping sequence is specifically as follows:

[0060] X = (x1, x2, ..., x) N-1 x N )

[0061] In the formula, x i Represents task t xi The bound IP core c xi Router r mapped to on-chip network i , 1≤i≤N, where N is the total number of tasks. In a specific implementation, such as X=(2,4,1,3), Figure 4 This represents the mapping result of the mapping sequence X = (2, 4, 1, 3), which maps 4 task cores to 4 routers.

[0062] The 2D-mesh topology of on-chip networks can be represented as follows: Figure 3 As shown, ri represents the router at the corresponding location.

[0063] The performance evaluation Q of the mapping sequence X is defined as a comparison between the communication cost of the mapping sequence X and the average communication cost, specifically:

[0064]

[0065] In the formula, Aver_CC is the average communication cost, F(A, X) is the communication cost of the mapping sequence X, and the higher the performance estimate corresponding to each input value in step S4, the higher the performance evaluation Q.

[0066] The communication cost F(A, X) of the mapping sequence X is specifically:

[0067]

[0068] In the formula, r i r j They represent IP cores c i c j Mapped router location, a i,j Represents IP core c i c jThe communication requirements between them, where A represents the adjacency matrix corresponding to the application.

[0069] The adjacency matrix A corresponding to the application is specifically as follows:

[0070] Given an application, its corresponding task graph is represented by its n-dimensional adjacency matrix A, where... Figure 2 As shown on the left, each vertex of the task graph represents the corresponding task t. i The bound IP core c i Each edge e i,j Indicates from c i to c j Communication needs, e i,j weight value a i,j Indicates the communication requirements for communication transmission, such as Figure 2 As shown on the right, the value of the i-th row and j-th column of the adjacency matrix A is a. i,j .

[0071] The average communication cost Aver_CC refers to the average communication cost estimated using 100,000 random sequences for a large number of randomly constructed mapping sequences X.

[0072]

[0073] Where Xn represents an arbitrarily constructed mapping sequence.

[0074] The goal of the mapping problem is to find an X such that its communication cost is as low as possible, even if its Q(X) is as high as possible.

[0075] In step S2, a recurrent neural network is constructed based on the total number of tasks, specifically as follows:

[0076] A recurrent neural network consists of N single-layer Ellmann RNN modules of the same type, where N is the total number of tasks. The training parameters of the nth single-layer Ellmann RNN module are an h×h matrix Whn and an i×h matrix WXn, where i = N and h = 2N. The inputs of the nth single-layer Ellmann RNN module are hn and Xn, where hn is a 1×h matrix, hn represents the output of the previous single-layer Ellmann RNN module, and except for h1, which is a default zero input matrix, the rest are used to represent the hidden state. The parameters are not trainable. Xn is the one-hot encoded representation of the input symbol at the corresponding position.

[0077] The one-hot encoding is specifically represented as follows:

[0078] One-hot encoding is represented as a 1×N matrix, where the x-th... i The value of one bit is 1, and the rest are 0.

[0079] The calculation formula for a single-layer Ellmann RNN module is as follows:

[0080]

[0081] The performance estimate P(X) for each input value in step S4 t |A), specifically:

[0082] P(X t |A)=sum(h t+1 )

[0083] In the formula, sum(h) t+1 ) represents h t+1 The sum of all elements in the matrix.

[0084] In a specific implementation, taking N=4 as an example, an RNN model is constructed as follows: Figure 5 As shown, XU = [X1, X2, X3, X4] is the one-hot encoded representation of the original mapping sequence X. XN is equivalent to X. Xi is the one-hot encoded representation of the input symbol at the corresponding position.

[0085] One-hot encoding, also known as one-bit valid encoding, allows only combinations of "1" and "0" for the encoded value, where all bits except for one "1" are "0". For example... Figure 6 As shown. In machine learning, one-hot encoding is commonly used to convert numerical values ​​of categories into an easily usable array format. For example, in this problem, the numerical values ​​of N different tasks are converted into N arrays.

[0086] This RNN model consists of N = 4 single-layer Ellmann RNN modules of the same category. In this problem, the input feature size (input_size) is i = N, and the hidden feature size (hidden_size) is assumed to be h = 2N. (At this point, WX is a matrix of size i × h, and Wh is a matrix of size h × h. wx1 to wx4 and wh1 to wh4 each represent four different matrices, which learn different parameters during training.)

[0087] Furthermore, in this RNN model, h1 to h4 are all matrices of size 1×h. Except for h1, which is the default input matrix of 0, the rest are used to represent the hidden state, and the parameters are not trainable.

[0088] The calculation rules are the same for each single-layer Ellmann RNN module, and the calculation formula is as follows:

[0089] (Xi is an N-dimensional input vector, which can also be viewed as a 1×i matrix that participates in matrix multiplication.)

[0090]

[0091] For example, when t = 2, we have: In addition, P(X1|A) = sum(h2), which represents the sum of all elements in the h2 matrix, and P(X1|A) is a scalar value.

[0092] Similarly, when t=5,

[0093] ReLU, short for Rectified Linear Unit, is a commonly used activation function in neural networks. It refers to the ramp function in mathematics, i.e., ReLU(x) = max(0, x).

[0094] A is the adjacency matrix of the application task connection graph given in the original problem. P(X|A) is the performance estimate of the mapping sequence X. The higher the value, the lower the communication cost F(A|X) of the mapping sequence X, that is, the higher the performance evaluation Q(X).

[0095] The workflow is generally referred to as greedy decoding (greedy query), and is explained in detail below:

[0096] Assume that after model training, Wxi and Whi have obtained their respective parameters. However, none of the four tasks have been mapped, so X1 has four possible encoding representations: one-hot encodings corresponding to symbols 1, 2, 3, and 4. Inputting these four possible encodings into the model, the output P(X_1|A) will generally have four different values. Ranking these four values, the value that maximizes P(X_1|A) is selected as the input to X1. Let's assume that the input of symbol 3 maximizes P(X_1|A), therefore X1 = 3.

[0097] After determining the input to X1, we can obtain h2. X2 also has three possible symbol inputs: 1, 2, and 4. Inputting these three corresponding one-hot codes into the model, the output P(X_1, X_2|A) will generally have three different values. Similarly, sorting them, we select the value that maximizes P(X_1, X_2|A) as the input to X2. Let's assume that the input with symbol 1 maximizes the value, therefore X2 = 1.

[0098] After determining the inputs X1 and X2, we can obtain h3. Furthermore, X3 has two other possible symbolic inputs: 2 and 4. Inputting these two corresponding one-hot encodings into the model, the output P(X_1, X_2, X_3|A) will then have two different values. Similarly, sorting them, we select the value that maximizes P(X_1, X_2, X_3|A) as the input for X3. Let's assume that the input with symbol 4 maximizes the value; therefore, X3 = 4.

[0099] The last remaining symbol is used as the input for X4, and X4 = 2.

[0100] That is, X = (3, 1, 4, 2). The above is the decoding process of this RNN model. After decoding, the model gives the solution to the original mapping problem, X = (3, 1, 4, 2). That is, task 3 is mapped to router 1, task 1 is mapped to router 2, task 4 is mapped to router 3, and task 2 is mapped to router 4.

[0101] As a black box for fitting arbitrary functions, the neural network (RNN) in this method fits the functional relationship between the mapping sequence X and its performance evaluation Q(X). If the network fits well enough, a better mapping sequence X can be constructed step by step based on the network parameters, maximizing its Q(X). Specifically, taking N=4 as an example, all possible X1 can be selected as the input of the RNN, and then the value of P(X1|A) is queried for each, selecting the value that maximizes P(X1|A) as the input of X1. After determining the input of X1, all remaining possible X2 are selected as the input of the RNN, and then the value of P(X1,X2|A) is queried for each, selecting the value that maximizes P(X1,X2|A) as the input of X2. Similarly, this process can be repeated to construct the values ​​at each position in the mapping sequence. This greedy query method can quickly construct a mapping sequence X that maximizes its corresponding performance Q(X), i.e., minimizes the communication cost.

[0102] Example 3

[0103] This embodiment uses an MPEG application as an example. This application has 12 tasks, and there are 12! possible mapping sequences when mapped to an on-chip network. The adjacency matrix A of this application is specifically a 12×12 matrix. The method uses 100,000 randomly constructed mapping sequences as a training set, and the fitting result of the global solution space after training is as follows. Figure 7 As shown.

[0104] Each point in the graph represents a solution X. The x-coordinate of the point is the corresponding Q(X) value, and the y-coordinate is the output P(X|A) after X is input into the RNN model.

[0105] It can be seen that for all inputs X in the solution space, the performance estimate of the RNN model output is P(X|A)≈Q(X). Given sufficient training data and training time, greedy decoding is sufficient to obtain a relatively good solution X.

[0106] The same or similar labels correspond to the same or similar parts;

[0107] The terms used to describe positional relationships in the accompanying drawings are for illustrative purposes only and should not be construed as limiting this patent.

[0108] Obviously, the above embodiments of the present invention are merely examples for clearly illustrating the present invention, and are not intended to limit the implementation of the present invention. Those skilled in the art can make other variations or modifications based on the above description. It is neither necessary nor possible to exhaustively describe all embodiments here. Any modifications, equivalent substitutions, and improvements made within the spirit and principles of the present invention should be included within the scope of protection of the claims of the present invention.

Claims

1. A method for mapping tasks on a network-on-chip based on a recurrent neural network, characterized in that, Includes the following steps: S1: Randomly construct multiple mapping sequences as a training set, wherein the mapping sequence is a vector that maps the IP core bound to the corresponding task to the corresponding router in the on-chip network; S2: Construct a recurrent neural network based on the total number of tasks; S3: Use the training set from step S1 to train the recurrent neural network from step S2, and obtain the trained recurrent neural network. S4: Sequentially confirm the input values ​​of the trained recurrent neural network, and maximize the performance estimate corresponding to each input value, with each input value being different; S5: Sort the input values ​​in the input order to obtain the corresponding mapping sequence for the application; In step S2, a recurrent neural network is constructed based on the total number of tasks, specifically as follows: The recurrent neural network is composed of N single-layer Elman RNN modules of the same type, N is the total number of tasks, the training parameters of the nth single-layer Elman RNN module are respectively a matrix Whn and a matrix WXn, = N, =2N, the input of the nth single-layer Elman RNN module is hn and Xn, wherein hn is a matrix of size, hn represents the output of the previous single-layer Elman RNN module, and except that h1 is a default 0 input matrix, the rest are used to represent the hidden state, the parameter is not trainable, and Xn is a one-hot encoding representation of the input symbol at the corresponding position; The one-hot encoding is specifically represented as follows: One-hot encoding is represented as a 1 x N matrix, with the x i th bit having a value of 1 and the rest having a value of 0. The calculation formula for a single-layer Ellmann RNN module is as follows: the performance estimate corresponding to each input value in step S4 , in particular: In the formula, express The sum of all elements in the matrix.

2. The on-chip network task mapping method based on recurrent neural networks according to claim 1, characterized in that, The mapping sequence is specifically as follows: X = (x1, x2,..., x N-1 ,x N ) In the formula, x i indicates the task t xi The bound IP core c xi The router r mapped to the network on a chip i , 1≤i≤N, N is the total number of tasks.

3. The on-chip network task mapping method based on recurrent neural networks according to claim 2, characterized in that, The performance evaluation Q of the mapping sequence X is defined as a comparison between the communication cost of the mapping sequence X and the average communication cost, specifically: In the formula, To average communication cost, The higher the performance estimate for each input value in step S4, the higher the performance evaluation Q, representing the communication cost of the mapping sequence X. This represents the adjacency matrix corresponding to the application. Communication cost of mapping sequence X Specifically: In the formula, , They represent IP cores respectively , Mapped router location, Represents IP core , Communication needs between them This represents the adjacency matrix corresponding to the application.

4. The on-chip network task mapping method based on recurrent neural networks according to claim 3, characterized in that, The adjacency matrix corresponding to the application Specifically: Given an application, its corresponding task graph is represented by its n-dimensional adjacency matrix A, where each vertex of the task graph represents the corresponding task t. i The bound IP core c i Each edge e i, j Indicates from c i to c j Communication needs, e i, j weight value a i , j Adjacency matrix represents the communication requirements for communication transmission. The value in the i-th row and j-th column is a i , j .

5. The on-chip network task mapping method based on recurrent neural networks according to claim 4, characterized in that, The average communication cost This refers to the average communication cost estimated using 100,000 random sequences for a large number of randomly constructed mapping sequences X. Where Xn represents an arbitrarily constructed mapping sequence.

Citation Information

Patent Citations

  • NoC mapping method based on improved genetic algorithm

    CN108153592A

  • Network-on-chip autonomous optimal mapping exploration system and method based on reinforcement learning

    CN115470889A