Space accelerator-oriented multi-subgraph storage allocation method and device

By constructing an integer linear programming model to optimize the multi-subgraph storage allocation of the spatial accelerator, the problem of the failure to fully consider the influencing factors in the existing technology is solved, access conflicts are minimized and bank resources are optimized, thereby improving the execution performance of the accelerator.

CN117312179BActive Publication Date: 2026-11-24CHONGQING UNIV
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202310635869.2
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2023-05-31
Publication Date
2026-11-24
Estimated Expiration
2043-05-31

AI Technical Summary

Technical Problem

Existing space accelerators fail to effectively consider all influencing factors during multi-subgraph mapping, leading to performance degradation, memory access conflicts, and wasted bank resources.

Method used

Construct an integer linear programming model, define relevant variables and constraints, optimize storage allocation to minimize access conflicts and the number of unused banks, and improve pipeline performance.

Benefits of technology

It achieves global optimization of multi-subgraph storage allocation, reduces access conflicts and bank resource consumption, and improves the execution performance of the space accelerator.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN117312179B_ABST
    Figure CN117312179B_ABST
Patent Text Reader

Abstract

The application provides a multi-subgraph storage allocation method for a spatial accelerator, the spatial accelerator comprising a processing unit array and at least one group of on-chip banks, the method comprising: obtaining a data flow graph to be processed by the spatial accelerator and performing division, defining relevant variables of an ILP model for subgraph storage allocation according to the divided subgraphs; constructing constraint conditions of the ILP model according to the relevant variables, and constructing an objective function of the ILP model with the minimum access conflict and the maximum number of unused banks as the target; driving an ILP solver to solve based on the constraint conditions and the objective function of the ILP model, and obtaining an optimal allocation scheme; and storing the data flow graph into the corresponding banks according to the optimal allocation scheme through the processing unit array. The application adopting the above scheme can reduce the consumption of the number of on-chip storage banks, thereby improving the execution performance of the multi-subgraph application on the spatial accelerator.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This application relates to the field of memory allocation technology, and in particular to a method and apparatus for multi-subgraph memory allocation for space accelerators. Background Technology

[0002] Space accelerators, as a promising computing architecture, offer high performance while maintaining extremely low power consumption, making them a focus of attention in modern computing. In recent years, numerous researchers and companies have invested heavily in developing various types of space accelerators, including systolic arrays and coarse-grained reconfigurable arrays (CGRAs). These accelerators are all aimed at achieving high-performance computing in different scenarios. Both systolic arrays and coarse-grained reconfigurable arrays employ coarse-grained processing elements (PEs) and data-path-oriented interconnects. This design strategy gives space accelerators significant performance advantages when handling highly parallel and data-intensive tasks. Simultaneously, the flexibility of the coarse-grained processing elements allows space accelerators to quickly adapt to different application requirements, thus providing energy-efficient solutions for a wide range of applications.

[0003] Space accelerators typically consist of a Processing Element Array (PEA), a flexible on-chip network, and multiple on-chip banks, working alongside traditional general-purpose processors. Typically, a data flow graph (DFG) extracted from compute-intensive applications is mapped onto the processing element array for acceleration. External memory can exchange data with on-chip data memory via Direct Memory Access (DMA) operations. On-chip data memory is usually organized in banks, allowing PEs to access data in parallel via load-store units (LSUs). Each PE contains a Function Unit (FU), a Local Register File (LRF), and an output register. For area and power considerations, only neighboring or nearest-neighbor PEs are interconnected.

[0004] While spatial accelerators support dynamic reconfiguration of time mappings, for low-power considerations, the data paths formed in the PEA should not be frequently changed after configuration. In this case, if the DFG size is larger than the PEA size, we need to split the input DFG into several subgraphs. Therefore, each subgraph can be executed multiple times on the PEA without changing the PEA's data paths, only requiring reconfiguration when switching subgraphs. However, graph partitioning inevitably introduces intermediate data arrays that need to be stored in and loaded from data memory. Ideally, each subgraph can be fully pipelined, i.e., reaching an initialization interval (II) of 1, meaning all data in the subgraph, including intermediate data, needs to be accessed simultaneously. Due to the limited number of banks, access conflicts are more likely to occur after graph partitioning.

[0005] There is a complex optimization problem in memory allocation in space accelerators. This problem is mainly constrained by the number of banks, bank capacity and given data size. Currently, most memory allocation strategies on CGRA[1][2] focus on time mapping. This means that a large DFG is directly mapped to a time-extended CGRA without partitioning. These methods attempt to minimize the II of large DFGs through joint optimization of operator scheduling and bank allocation to improve pipeline performance. However, if we try to extend the single graph allocation method directly to the case of multiple subgraphs, this method called sequential allocation (SA) will process from the first subgraph to the last subgraph. If there is no global view of future subgraphs during processing, it is easy to generate conflicts during data access in subsequent subgraphs. Memory allocation in multi-core embedded systems is a hot research topic. Existing graph coloring-based allocation methods (GCA) aim to minimize access conflicts. GCA first constructs a conflict graph by identifying data that needs to be accessed simultaneously. Then, heuristic algorithms such as variable neighborhood search are used to find the solution with the lowest cost. Although the GCA-based method is global, the life cycle of data is not considered when constructing the conflict graph. This results in the storage space for expired data not being released in a timely manner, leading to access conflicts and wasted memory blocks.

[0006] In summary, during the mapping process of space accelerators, to meet resource constraints, a large kernel is typically divided into multiple subgraphs. This partitioning method effectively balances the relationship between computational tasks and limited resources, but it also leads to more memory access from intermediate data. To minimize access conflicts among multiple banks in a subgraph space accelerator, researchers have adopted different optimization strategies. However, existing work has certain limitations in addressing this issue. Some studies ignore the interference between multiple subgraphs and do not fully consider their mutual influence, which may lead to lower-than-expected performance. Other studies focus too much on the lifecycle of data in the execution sequence, neglecting the impact of other key factors throughout the accelerator mapping process, thus resulting in access conflicts and bank waste. Summary of the Invention

[0007] This application aims to at least partially address one of the technical problems in the related art.

[0008] Therefore, the first objective of this application is to propose a multi-subgraph memory allocation method for space accelerators, which solves the technical problem that existing methods do not systematically consider all influencing factors, leading to a reduction in the performance of space accelerators. This method can comprehensively consider the impact of all key factors, minimize the consumption of on-chip memory banks, and thus improve the execution performance of multi-subgraph applications on space accelerators.

[0009] The second objective of this application is to propose a multi-subgraph storage allocation device for space accelerators.

[0010] To achieve the above objectives, the first aspect of this application proposes a multi-subgraph storage allocation method for space accelerators, comprising: acquiring and partitioning a data flow graph to be processed in the space accelerator; defining relevant variables for the ILP model during subgraph storage allocation based on the partitioned subgraphs; constructing constraints for the ILP model based on the relevant variables, and constructing an objective function for the ILP model with the objectives of minimizing access conflicts and maximizing the number of unused banks; driving an ILP solver to solve the ILP model based on the constraints and objective function to obtain an optimal allocation scheme; and storing the data flow graph in the corresponding banks according to the optimal allocation scheme through a processing unit array.

[0011] The multi-subgraph storage allocation method for space accelerators in this application describes the storage allocation problem of multi-subgraph mapping on space accelerators as a multi-objective optimization problem by constructing an integer linear programming model, thereby achieving complete exploration in the storage allocation stage and improving pipeline performance.

[0012] Optionally, in one embodiment of this application, the relevant variables of the ILP model include the allocation variable b. i,j,kRelated variables Storage variable u k , where the allocation variable b i,j,k This means assigning the j-th sub-data of the i-th data to the k-th bank, related variables. This means allocating the j1st sub-data of the i1th data and the j2nd sub-data of the i2th data to the kth bank, storing the variable u. k This indicates whether the k-th bank has been used during the entire execution process.

[0013] Optionally, in one embodiment of this application, the constraints include: unique allocation constraint, bank capacity constraint, continuous allocation constraint, branch constraint, and conflict constraint.

[0014] Optionally, in one embodiment of this application, the unique allocation constraint is represented as:

[0015]

[0016] Where K represents the number of storage banks in the target coarse-grained reconfigurable array (CGRA), b i,j,k Let N represent the allocation variable, and let N represent the total number of data points. i This represents the number of data items in the i-th data sub-data item;

[0017] The bank capacity constraint is expressed as:

[0018]

[0019] Where N represents the total number of data points, N i b represents the number of data in the i-th data sub-data. i,j,k Let L(i, t) represent the allocation variable, indicating that the i-th data will be stored in the bank during the t-th execution step. DS i,j BS represents the size of the j-th sub-data in terms of word i, K represents the size of each storage bank in terms of word, T represents the number of storage banks in the target coarse-grained reconfigurable array CGRA, and T represents the number of execution steps after graph partitioning, which is the same as the number of subgraphs.

[0020] The continuous assignment constraint is expressed as:

[0021]

[0022] Where K represents the number of storage banks in the target coarse-grained reconfigurable array (CGRA), b i,j,k Let N represent the allocation variable, and let N represent the total number of data points. i This represents the number of data items in the i-th data sub-data item;

[0023] Branch constraints are expressed as:

[0024] p k +u k =1

[0025] Num k -β·p k ≤0

[0026] Num k -p k ≥0

[0027] k∈[1, K]

[0028] Where, p k Num represents an auxiliary binary variable. k This indicates how much data is allocated to the k-th bank. β represents a given constant, and K represents the number of storage banks of the target coarse-grained reconfigurable array CGRA;

[0029] Conflict constraints are represented as:

[0030]

[0031]

[0032]

[0033]

[0034] in, b represents a related variable. i,j,k This indicates the assignment variable.

[0035] Optionally, in one embodiment of this application, the objective function is expressed as:

[0036]

[0037] Where, N c The number of access conflicts is represented by α, and the total number of banks is represented by u. k Let K represent the number of storage banks in the target coarse-grained reconfigurable array (CGRA), and u represent the storage variable. k N represents the storage variable. c The formula for obtaining it is:

[0038]

[0039] Where A(i,:) represents loading or storing the i-th data at a certain execution step.

[0040] To achieve the above objectives, a second aspect of the present invention provides a multi-subgraph storage allocation device for space accelerators. The space accelerator includes a processing unit array and at least one set of on-chip banks. The device includes a variable definition module, a model building module, a scheme generation module, and a scheme execution module, wherein...

[0041] The variable definition module is used to obtain the data flow graph to be processed in the space accelerator and divide it into subgraphs. Based on the subgraphs, it defines the relevant variables used in the ILP model when allocating subgraph storage.

[0042] The model building module is used to construct the constraints of the ILP model based on relevant variables, and to construct the objective function of the ILP model with the goals of minimizing access conflicts and maximizing the number of unused banks.

[0043] The scheme generation module is used to drive the ILP solver to solve the optimal allocation scheme based on the constraints and objective function of the ILP model.

[0044] The scheme execution module is used to store the data flow graph into the corresponding bank according to the optimal allocation scheme through the processing unit array.

[0045] Optionally, in one embodiment of this application, the relevant variables of the ILP model include the allocation variable b. i,j,k Related variables Storage variable u k , where the allocation variable b i,j,k This means assigning the j-th sub-data of the i-th data to the k-th bank, related variables. This means allocating the j1st sub-data of the i1th data and the j2nd sub-data of the i2th data to the kth bank, storing the variable u. k This indicates whether the k-th bank has been used during the entire execution process.

[0046] Optionally, in one embodiment of this application, the constraints include: unique allocation constraint, bank capacity constraint, continuous allocation constraint, branch constraint, and conflict constraint.

[0047] Optionally, in one embodiment of this application, the unique allocation constraint is represented as:

[0048]

[0049] Where K represents the number of storage banks in the target coarse-grained reconfigurable array (CGRA), b i,j,k Let N represent the allocation variable, and let N represent the total number of data points. i This represents the number of data items in the i-th data sub-data item;

[0050] The bank capacity constraint is expressed as:

[0051]

[0052] Where N represents the total number of data points, N i b represents the number of data in the i-th data sub-data. i,j,k Let L(i, t) represent the allocation variable, indicating that the i-th data will be stored in the bank during the t-th execution step. DS i,j BS represents the size of the j-th sub-data in terms of word i, K represents the size of each storage bank in terms of word, T represents the number of storage banks in the target coarse-grained reconfigurable array CGRA, and T represents the number of execution steps after graph partitioning, which is the same as the number of subgraphs.

[0053] The continuous assignment constraint is expressed as:

[0054]

[0055] Where K represents the number of storage banks in the target coarse-grained reconfigurable array (CGRA), b i,j,k Let N represent the allocation variable, and let N represent the total number of data points. i This represents the number of data items in the i-th data sub-data item;

[0056] Branch constraints are expressed as:

[0057] p k +u k =1

[0058] Num k -β·p k ≤0

[0059] Num k -p k ≥0

[0060] k∈[1, K]

[0061] Where, p k Num represents an auxiliary binary variable. k This indicates how much data is allocated to the k-th bank. β represents a given constant, and K represents the number of storage banks of the target coarse-grained reconfigurable array CGRA;

[0062] Conflict constraints are represented as:

[0063]

[0064]

[0065]

[0066]

[0067] in, b represents a related variable. i,j,k This indicates an assignment variable.

[0068] Optionally, in one embodiment of this application, the objective function is expressed as:

[0069]

[0070] Where, N c The number of access conflicts is represented by α, and the total number of banks is represented by u. k Let K represent the number of storage banks in the target coarse-grained reconfigurable array (CGRA), and u represent the storage variable. k N represents the storage variable. c The formula for obtaining it is:

[0071]

[0072] Where A(i,:) represents loading or storing the i-th data at a certain execution step.

[0073] Additional aspects and advantages of this application will be set forth in part in the description which follows, and in part will be obvious from the description, or may be learned by practice of this application. Attached Figure Description

[0074] The above and / or additional aspects and advantages of this application will become apparent and readily understood from the following description of the embodiments taken in conjunction with the accompanying drawings, wherein:

[0075] Figure 1 This is a flowchart illustrating a multi-subgraph storage allocation method for space accelerators provided in Embodiment 1 of this application;

[0076] Figure 2 This is a flowchart of the integer linear programming algorithm according to an embodiment of this application;

[0077] Figure 3 This is a schematic diagram of DFG storage according to an embodiment of this application;

[0078] Figure 4 This is a schematic diagram of a multi-subgraph storage allocation device for space accelerators provided in an embodiment of this application. Detailed Implementation

[0079] The embodiments of this application are described in detail below. Examples of these embodiments are shown in the accompanying drawings, wherein the same or similar reference numerals denote the same or similar elements or elements having the same or similar functions throughout. The embodiments described below with reference to the accompanying drawings are exemplary and intended to explain this application, and should not be construed as limiting this application.

[0080] The following description, with reference to the accompanying drawings, describes a multi-subgraph storage allocation method and apparatus for space accelerators according to embodiments of this application.

[0081] Figure 1 This is a flowchart illustrating a multi-subgraph storage allocation method for space accelerators provided in Embodiment 1 of this application.

[0082] like Figure 1 As shown, the multi-subgraph storage allocation method for space accelerators includes the following steps:

[0083] Step 101: Obtain the data flow graph to be processed in the space accelerator and divide it. Define the relevant variables used in the ILP model when allocating the subgraph storage based on the divided subgraph.

[0084] Step 102: Construct constraints for the ILP model based on relevant variables, and construct the objective function of the ILP model with the goals of minimizing access conflicts and maximizing the number of unused banks.

[0085] Step 103: Based on the constraints and objective function of the ILP model, drive the ILP solver to solve the problem and obtain the optimal allocation scheme;

[0086] Step 104: The data flow graph is stored in the corresponding bank according to the optimal allocation scheme by the processing unit array.

[0087] The multi-subgraph storage allocation method for space accelerators in this application describes the storage allocation problem of multi-subgraph mapping on space accelerators as a multi-objective optimization problem by constructing an integer linear programming model, thereby achieving complete exploration in the storage allocation stage and improving pipeline performance.

[0088] The technical solution proposed in this application is applied to the multi-word graph storage allocation of space accelerators, and the entire implementation process is as follows: Figure 2 As shown, this is essentially an integer linear programming algorithm. The algorithm first defines all relevant parameters and variables. Next, it obtains a globally optimal solution by constructing a linear objective function. Finally, it constructs all the constraints required by the model based on the defined variables.

[0089] Optionally, in one embodiment of this application, the definition of variables is crucial when solving the ILP problem, as they form the basis of the problem description and solution process. Before constructing the ILP model variables, some key parameters need to be clearly defined to ensure the overall problem structure is clear and easy to understand. The defined parameters are as follows:

[0090] (1) N: N represents the total amount of data, including the original data and the intermediate data generated after graph partitioning.

[0091] (2) K: K represents the number of storage banks of the target CGRA.

[0092] (3) BS: BS represents the size of each storage bank in units of words (4 bytes).

[0093] (4)DS i DS i This represents the size of the i-th data unit, in words (4 bytes).

[0094] (5)N i :N i This represents the number of data items in the i-th data sub-data item. When N... i When the value is greater than 1, it means that the size of the i-th data exceeds the bank size. In this case, to simplify the allocation problem, we pre-split the data into multiple sub-data using modular scheduling.

[0095] (6)DS i,j DS i,j This represents the size of the j-th sub-data element of data i, expressed in words (4 bytes).

[0096] (7)T: ​​T represents the number of execution steps after graph partitioning, which is equal to the number of subgraphs.

[0097] (8) A(i, t): The access indicator A(i, t) indicates that the i-th data is loaded or stored in the t-th execution step. The t-th execution step is determined after the graph is partitioned.

[0098] (9) L(i, t): The lifecycle indicator L(i, t) indicates that the i-th data will be stored in the bank in the t-th execution step, which is also determined after the graph partitioning.

[0099] Based on the above parameters, three sets of binary variables are defined for the ILP model. These three sets of binary variables are used to represent the allocation of data banks, whether two data points are allocated to the same bank, and whether a bank has been used. The specific definitions are as follows:

[0100] (1)b i,j,kThis indicates that the j-th sub-data of the i-th data is assigned to the k-th bank. It helps to clearly describe the specific storage location of each data, thereby optimizing the bank allocation problem in the ILP model.

[0101] (2) This means assigning the j1st sub-data of the i1th data and the j2nd sub-data of the i2th data to the kth bank. Using this set of variables, we can effectively handle the relationships between different data.

[0102] (3)u k : Used to determine whether the k-th bank has been used during the entire execution process.

[0103] In fact, the second set of variables It can be considered an auxiliary variable; its main function is to replace nonlinearity. Equations are transformed from nonlinear equations into linear equations. This transformation simplifies the problem-solving process, reduces computational complexity, and allows for better solutions with limited computational resources.

[0104] Optionally, in one embodiment of this application, after defining the relevant variables and objective function required for the ILP model, it is necessary to define constraints for the model. Then, an ILP solver can be used to solve the model, thereby obtaining the optimal storage bank allocation result. The constraints are discussed in detail below:

[0105] Cl: Unique allocation constraint. The bank allocation result for each sub-data item should be unique. That is, each sub-data item can only be precisely assigned to one storage bank.

[0106] C2: Bank capacity constraint. The total size of data allocated to the same bank should not exceed the bank's capacity. When calculating the total data size, it should be noted that data has a lifecycle at each execution step, and data outside its lifecycle should not be considered.

[0107] C3: Continuous allocation constraint, which involves the continuous allocation of multiple sub-data. To ensure that the addressing of data i is contiguous in the storage space, we should allocate contiguous banks to multiple sub-data of the same data i.

[0108] C4: Branch constraint, representation of unused banks. Utilizing binary variable b. i,j,k To define the unused bank indicator u k To convert this branch representation into the linear form of the ILP, an auxiliary binary variable p is introduced. k This yields branch constraints.

[0109] C5: Conflict constraints, linearization of conflicts. As stated in the variable definition, variables... In fact equals This nonlinear relationship can be represented in linear form. By introducing relevant constraints, this nonlinear relationship can be converted into a linear form.

[0110] Based on the above constraints, the ILP solver is used to solve the storage bank allocation problem. Although ILP has poor scalability, the ILP problem constructed is still of medium size because the problem size is relatively small—generally involving only a few to a few dozen data points, and the number of banks owned by CGRA is also limited. In practical applications, in most cases, the bank allocation problem can be solved in less than one second.

[0111] Optionally, in one embodiment of this application, the unique allocation constraint is represented as:

[0112]

[0113] Where K represents the number of storage banks in the target coarse-grained reconfigurable array (CGRA), b i,j,k Let N represent the allocation variable, and let N represent the total number of data points. i This represents the number of data items in the i-th data sub-data item;

[0114] The bank capacity constraint is expressed as:

[0115]

[0116] Where N represents the total number of data points, N i b represents the number of data in the i-th data sub-data. i,j,k Let L(i, t) represent the allocation variable, indicating that the i-th data will be stored in the bank during the t-th execution step. DS i,j BS represents the size of the j-th sub-data in terms of word i, K represents the size of each storage bank in terms of word, T represents the number of storage banks in the target coarse-grained reconfigurable array CGRA, and T represents the number of execution steps after graph partitioning, which is the same as the number of subgraphs.

[0117] The continuous assignment constraint is expressed as:

[0118]

[0119] Where K represents the number of storage banks in the target coarse-grained reconfigurable array (CGRA), b i,j,k Let N represent the allocation variable, and let N represent the total number of data points. iThis represents the number of data items in the i-th data sub-data item;

[0120] Branch constraints are expressed as:

[0121] p k +u k =1

[0122] Num k -β·p k ≤0

[0123] Num k -p k ≥0

[0124] k∈[1, K]

[0125] Where, p k Num represents an auxiliary binary variable. k This indicates how much data is allocated to the k-th bank. β represents a given constant, and K represents the number of storage banks of the target coarse-grained reconfigurable array CGRA;

[0126] The linear form of conflict constraints is expressed as:

[0127]

[0128]

[0129]

[0130]

[0131] in, b represents a related variable. i,j,k This indicates the assignment variable.

[0132] Optionally, in one embodiment of this application, the objective function takes into account both memory access conflicts and the number of used banks to minimize access conflicts and maximize the number of unused banks. Access conflicts mainly occur between two memory access operations that meet the following two conditions: (1) the data corresponding to the two access operations are allocated to the same bank; (2) the two operations are executed in the same execution step.

[0133] To represent these conditions, the first condition is indicated by a binary variable `c`. The second condition can be represented by calculating the dot product of the vector-like access indicators A(i, :) of the two data points. Furthermore, the number of access conflicts, N, is defined. c for:

[0134]

[0135] This formula yields the specific number of access conflicts.

[0136] To simultaneously minimize access conflicts and maximize the number of unused banks, the overall objective function can be expressed as:

[0137]

[0138] In this objective function, the second term represents the number of all unused banks. The symbol α represents the total number of banks, with the aim of minimizing access conflicts having a higher priority.

[0139] This application constructs an integer linear programming model to solve the storage bank allocation problem by defining relevant variables, objective function, and constraints. i,j,k This indicates that the j-th sub-data of the i-th data is assigned to the k-th bank. It helps to clearly describe the specific storage location of each data point. After solving the integer linear programming problem, CGRA can be used based on b... i,j,k By allocating bank storage locations for each piece of data, access conflicts are minimized and the number of unused banks is maximized, thereby improving memory access performance.

[0140] This application uses integer linear programming to precisely describe the memory allocation problem of multi-subgraph mapping on a space accelerator as a bi-objective optimization problem, and finally finds a solution that minimizes conflicts while moderately consuming the bank. At the same time, lifecycle analysis is introduced into the memory allocation of multi-subgraph mapping, so that the storage space of expired data can be reclaimed in a timely manner, thereby reducing access conflicts and bank consumption.

[0141] Figure 3 This is an example diagram of a DFG according to an embodiment of this application. The following is in conjunction with... Figure 3 The multi-subgraph storage allocation method for space accelerators proposed in this application is described in detail.

[0142] Step 1: As Figure 3 (a) shows a DFG containing 15 operator nodes. After graph partitioning, it becomes 5 subgraphs, and 15 store-load operators are added, requiring a total of 7 data items to be stored and loaded. Consider a CGRA with 4 banks, each bank having a capacity of 5KB.

[0143] Step 2: After analyzing Step 1, the following relevant variables can be defined.

[0144] N=7

[0145] K = 4

[0146] BS=5

[0147] T=5

[0148] Define the size of the data as

[0149] DS1=3

[0150] DS2=6

[0151] DS3=2

[0152] DS4=2

[0153] DS s =3

[0154] DS6=2

[0155] DS7=3

[0156] Since the size of data 2 exceeds the size of the bank, data 2 is split into two sub-data sets, with sizes of [sizes to be filled in].

[0157] DS 2,1 =5

[0158] DS 2,2 =1

[0159] Based on the graph partitioning results, the access indicator for each data item is:

[0160] A(1, :) = [1, 0, 0, 0, 1]

[0161] A(2,:) = [1, 1, 1, 0, 0]

[0162] A(3,:) = [0, 1, 0, 1, 0]

[0163] A(4,:) = [0, 0, 1, 1, 0]

[0164] A(5,:) = [0, 0, 1, 0, 1]

[0165] A(6,:) = [0, 0, 0, 1, 1]

[0166] A(7,:) = [0, 0, 0, 0, 1]

[0167] The lifecycle of each data item is...

[0168] L(1,:) = [1, 1, 1, 1, 1]

[0169] L(2,:) = [1, 1, 1, 0, 0]

[0170] L(3,:) = [0, 1, 1, 1, 0]

[0171] L(4,:) = [0, 0, 1, 1, 0]

[0172] L(5,:) = [0, 0, 1, 1, 1]

[0173] L(6,:) = [0, 0, 0, 1, 1]

[0174] L(7,:) = [0, 0, 0, 0, 1]

[0175] Step 3: Based on all the variables defined in Step 2, all the constraints required for solving the integer linear programming model can be constructed. The specific constraint construction is as follows:

[0176] exist Figure 3 In (b), except for data 2 which is divided into two sub-data, the other data do not need to be divided. Therefore, the following expression applies to constraint C1:

[0177]

[0178]

[0179] according to Figure 3 (c) Analyzing the lifecycle of data in each execution step yields an expression for the C2 constraint. For each execution step, the following constraints apply:

[0180] ES 1 contains two data sets (data 1 and data 2), i.e., L(1, 1) = L(2, 1) = 1. Therefore, for each bank (e.g., bank 4), it should satisfy the following condition:

[0181] b i,1,4 *DS1+b 2,1,4 *DS 2,1 +b 2,2,4 *DS 2,2 ≤BS

[0182] ES2 contains three data sets (data 1, data 2, and data 3), i.e., L(1,2) = L(2,2) = L(3,2) = 1. Therefore, for each bank (e.g., bank 4), it should satisfy the following condition:

[0183] b i,1,4 *DS1+b 2,1,4 *DS 2,1 +b 2,2,4 *DS 2,2 +b 3,1,4 *DS3≤BS

[0184] ES 3 contains 5 data points (data 1, data 2, data 3, data 4, and data 5), ​​i.e., L(1,3) = L(2,3) = L(3,3) = L(4,3) = L(5,3) = 1. Therefore, for each bank (e.g., bank 4), it should satisfy the following condition:

[0185] b i,1,4 *DS1+b 2,1,4 *DS 2,1 +b 2,2,4 *DS 2,2 +b 3,1,4 *DS3+b 4,1,4 *DS4+b 5,1,4 *DS4

[0186] ≤BS

[0187] ES 4 contains 5 data points (data 1, data 3, data 4, data 5, and data 6), i.e., L(1,4) = L(3,4) = L(4,4) = L(5,4) = L(6,4) = 1. Therefore, for each bank (e.g., bank 4), it should satisfy the following condition:

[0188] b i,1,4 *DS1+b 3,1,4 *DS3+b 4,1,4 *DS4+b 5,1,4 *DS S +b 6,1,4 *DS6≤BS

[0189] ES 5 contains four data points (data 1, data 5, data 6, and data 7), i.e., L(1,5) = L(5,5) = L(6,5) = L(7,5) = 1. Therefore, for each bank (e.g., bank 4), it should satisfy the following condition:

[0190] b i,1,4 *DS1+b 5,1,4 *DS s +b 6,1,4 *DS6+b 7,1,4 *DS7≤BS

[0191] Since data 2 is divided into two sub-data, in order to ensure that the addressing of data 2 is contiguous in the storage space, the following expression applies to constraint C3:

[0192]

[0193] Since no memory access variables are defined, the defined constraints C4 and C5 are not included.

[0194] Step 4: In Step 3, all constraints for model solving were established. To obtain the optimal scheduling scheme, a linear evaluation function needs to be constructed according to Step 3 in the invention description. Therefore, the final objective function can be expressed as:

[0195]

[0196] in,

[0197] In the above formula, the coefficient of α is 4, which equals the total number of banks. This setting gives a higher weight to minimizing the number of conflicts. Through ILP, we finally obtained the following... Figure 3 The solution shown in (d) uses 4 banks and has a bank conflict number of [missing information].

[0198]

[0199] Specifically, in ES1, data 1 needs to be loaded and data 2 needs to be stored. At this point, they are assigned to different banks, so there is no conflict. In ES2, data 2 needs to be loaded and data 3 needs to be stored. Again, they are assigned to different banks, so there is no conflict. In ES3, data 2 needs to be loaded, and data 4 and data 5 need to be stored. Again, they are assigned to different banks, so there is no conflict. In ES4, data 3 and data 4 need to be loaded, and data 6 needs to be stored. Again, they are assigned to different banks, so there is no conflict. In ES5, data 1, data 5, and data 6 need to be loaded, and data 7 needs to be stored. Again, they are assigned to different banks, so there is no conflict.

[0200] To implement the above embodiments, this application also proposes a multi-subgraph storage allocation device for space accelerators.

[0201] Figure 4 This is a schematic diagram of a multi-subgraph storage allocation device for a space accelerator provided in an embodiment of this application. The space accelerator includes a processing unit array and at least one set of on-chip banks.

[0202] like Figure 4 As shown, the device includes a variable definition module, a model building module, a solution generation module, and a solution execution module, wherein...

[0203] The variable definition module is used to obtain the data flow graph to be processed in the space accelerator and divide it into subgraphs. Based on the subgraphs, it defines the relevant variables used in the ILP model when allocating subgraph storage.

[0204] The model building module is used to construct the constraints of the ILP model based on relevant variables, and to construct the objective function of the ILP model with the goals of minimizing access conflicts and maximizing the number of unused banks.

[0205] The scheme generation module is used to drive the ILP solver to solve the optimal allocation scheme based on the constraints and objective function of the ILP model.

[0206] The scheme execution module is used to store the data flow graph into the corresponding bank according to the optimal allocation scheme through the processing unit array.

[0207] Optionally, in one embodiment of this application, the relevant variables of the ILP model include the allocation variable b. i,j,k Related variables Storage variable u k , where the allocation variable b i,j,k This means assigning the j-th sub-data of the i-th data to the k-th bank, related variables. This means allocating the j1st sub-data of the i1th data and the j2nd sub-data of the i2th data to the kth bank, storing the variable u. k This indicates whether the k-th bank has been used during the entire execution process.

[0208] Optionally, in one embodiment of this application, the constraints include: unique allocation constraint, bank capacity constraint, continuous allocation constraint, branch constraint, and conflict constraint.

[0209] Optionally, in one embodiment of this application, the unique allocation constraint is represented as:

[0210]

[0211] Where K represents the number of storage banks in the target coarse-grained reconfigurable array (CGRA), b i,i,k Let N represent the allocation variable, and let N represent the total number of data points. i This represents the number of data items in the i-th data sub-data item;

[0212] The bank capacity constraint is expressed as:

[0213]

[0214] Where N represents the total number of data points, N i b represents the number of data in the i-th data sub-data. i,j,k Let L(i, t) represent the allocation variable, indicating that the i-th data will be stored in the bank during the t-th execution step. DS i,jBS represents the size of the j-th sub-data in terms of word i, K represents the size of each storage bank in terms of word, T represents the number of storage banks in the target coarse-grained reconfigurable array CGRA, and T represents the number of execution steps after graph partitioning, which is the same as the number of subgraphs.

[0215] The continuous assignment constraint is expressed as:

[0216]

[0217] Where K represents the number of storage banks in the target coarse-grained reconfigurable array (CGRA), b i,j,k Let N represent the allocation variable, and let N represent the total number of data points. i This represents the number of data items in the i-th data sub-data item;

[0218] Branch constraints are expressed as:

[0219] p k +u k =1

[0220] Num k -β·p k ≤0

[0221] Num k -p k ≥0

[0222] k∈[1, K]

[0223] Where, p k Num represents an auxiliary binary variable. k This indicates how much data is allocated to the k-th bank. β represents a given constant, and K represents the number of storage banks of the target coarse-grained reconfigurable array CGRA;

[0224] Conflict constraints are represented as:

[0225]

[0226]

[0227]

[0228]

[0229] in, b represents a related variable. i,j,k This indicates the assignment variable.

[0230] Optionally, in one embodiment of this application, the objective function is expressed as:

[0231]

[0232] Where, N c The number of access conflicts is represented by α, and the total number of banks is represented by u. k Let K represent the number of storage banks in the target coarse-grained reconfigurable array (CGRA), and u represent the storage variable. k N represents the storage variable. c The formula for obtaining it is:

[0233]

[0234] Where A(i,:) represents loading or storing the i-th data at a certain execution step.

[0235] It should be noted that the foregoing explanation of the multi-subgraph storage allocation method embodiment for space accelerators also applies to the multi-subgraph storage allocation device for space accelerators in this embodiment, and will not be repeated here.

[0236] In the description of this specification, the references to terms such as "one embodiment," "some embodiments," "example," "specific example," or "some examples," etc., indicate that a specific feature, structure, material, or characteristic described in connection with that embodiment or example is included in at least one embodiment or example of this application. In this specification, the illustrative expressions of the above terms do not necessarily refer to the same embodiment or example. Furthermore, the specific features, structures, materials, or characteristics described may be combined in any suitable manner in one or more embodiments or examples. Moreover, without contradiction, those skilled in the art can combine and integrate the different embodiments or examples described in this specification, as well as the features of different embodiments or examples.

[0237] Furthermore, the terms "first" and "second" are used for descriptive purposes only and should not be construed as indicating or implying relative importance or implicitly specifying the number of technical features indicated. Thus, a feature defined as "first" or "second" may explicitly or implicitly include at least one of that feature. In the description of this application, "multiple" means at least two, such as two, three, etc., unless otherwise explicitly specified.

[0238] Any process or method description in the flowchart or otherwise herein can be understood as representing a module, segment, or portion of code comprising one or more executable instructions for implementing custom logic functions or processes, and the scope of the preferred embodiments of this application includes additional implementations in which functions may be performed not in the order shown or discussed, including substantially simultaneously or in reverse order depending on the functions involved, as should be understood by those skilled in the art to which embodiments of this application pertain.

[0239] The logic and / or steps represented in the flowchart or otherwise described herein, for example, can be considered as a sequenced list of executable instructions for implementing logical functions, and can be embodied in any computer-readable medium for use by, or in conjunction with, an instruction execution system, apparatus, or device (such as a computer-based system, a processor-included system, or other system that can fetch and execute instructions from, an instruction execution system, apparatus, or device). For the purposes of this specification, "computer-readable medium" can be any means that can contain, store, communicate, propagate, or transmit programs for use by, or in conjunction with, an instruction execution system, apparatus, or device. More specific examples (a non-exhaustive list) of computer-readable media include: an electrical connection having one or more wires (electronic device), a portable computer disk drive (magnetic device), random access memory (RAM), read-only memory (ROM), erasable and editable read-only memory (EPROM or flash memory), fiber optic devices, and portable optical disc read-only memory (CDROM). Alternatively, the computer-readable medium may be paper or other suitable media on which the program can be printed, since the program can be obtained electronically, for example, by optically scanning the paper or other medium, followed by editing, interpreting, or otherwise processing as necessary, and then stored in a computer memory.

[0240] It should be understood that various parts of this application can be implemented using hardware, software, firmware, or a combination thereof. In the above embodiments, multiple steps or methods can be implemented using software or firmware stored in memory and executed by a suitable instruction execution system. For example, if implemented in hardware as in another embodiment, it can be implemented using any one or a combination of the following techniques known in the art: discrete logic circuits having logic gates for implementing logical functions on data signals, application-specific integrated circuits (ASICs) having suitable combinational logic gates, programmable gate arrays (PGAs), field-programmable gate arrays (FPGAs), etc.

[0241] Those skilled in the art will understand that all or part of the steps of the methods in the above embodiments can be implemented by a program instructing related hardware. The program can be stored in a computer-readable storage medium, and when executed, the program includes one or a combination of the steps of the method embodiments.

[0242] Furthermore, the functional units in the various embodiments of this application can be integrated into a processing module, or each unit can exist physically separately, or two or more units can be integrated into a module. The integrated module can be implemented in hardware or as a software functional module. If the integrated module is implemented as a software functional module and sold or used as an independent product, it can also be stored in a computer-readable storage medium.

[0243] The storage medium mentioned above can be a read-only memory, a disk, or an optical disk, etc. Although embodiments of this application have been shown and described above, it is understood that the above embodiments are exemplary and should not be construed as limiting this application. Those skilled in the art can make changes, modifications, substitutions, and variations to the above embodiments within the scope of this application.

Claims

1. A multi-subgraph storage allocation method for space accelerators, characterized in that, The space accelerator includes a processing unit array and at least one set of on-chip banks, and the method includes the following steps: Obtain the data flow graph to be processed from the space accelerator and divide it into subgraphs. Define the relevant variables used in the ILP model when allocating subgraph storage based on the divided subgraphs. The constraints of the ILP model are constructed based on the relevant variables, and the objective function of the ILP model is constructed with the goals of minimizing access conflicts and maximizing the number of unused banks. Based on the constraints and objective function of the ILP model, the ILP solver is driven to solve the problem and obtain the optimal allocation scheme. The processing unit array stores the data flow graph into the corresponding bank according to the optimal allocation scheme. Among them, the relevant variables of the ILP model include allocation variables. Related variables Storage variables , wherein the allocation variable Indicates to the first The first data point The sub-data is assigned to the first One bank, the associated variables Indicates to the first The first data point Sub-data and the first The first data point Each sub-data item is assigned to the first... A bank, the storage variable This indicates that during the entire execution process, the first... Has the bank been used? The constraints include: unique allocation constraint, bank capacity constraint, continuous allocation constraint, branch constraint, and conflict constraint. The unique allocation constraint is expressed as: in, This indicates the number of storage banks in the target coarse-grained reconfigurable array (CGRA). Indicates the total quantity of data. Indicates the first The number of data sub-data; The bank capacity constraint is expressed as follows: in, Indicates the first The data will be in the first... Each execution step is stored in the bank. Representing data in units of words The The size of each sub-data item This indicates the size of each storage bank, expressed in words. This indicates the number of execution steps after graph partitioning. Same number as subgraphs; The continuous allocation constraint is expressed as: The branch constraint is expressed as: in, Represents auxiliary binary variables, This indicates how much data is assigned to the first... One bank, , Represents a given constant; The conflict constraint is represented as follows: 。 2. The method as described in claim 1, characterized in that, The objective function is expressed as: in, Indicates the number of access conflicts. This represents the total number of banks, the... The formula for obtaining it is: in, This indicates that the first step of execution is loaded or stored. Data points.

3. A multi-subgraph storage allocation device for space accelerators, characterized in that, The space accelerator includes a processing unit array and at least one set of on-chip banks. The device includes a variable definition module, a model building module, a scheme generation module, and a scheme execution module, wherein... The variable definition module is used to obtain the data flow graph to be processed by the space accelerator and divide it, and define the relevant variables used for the ILP model when the subgraph is stored and allocated according to the divided subgraph. The model building module is used to construct the constraints of the ILP model based on the relevant variables, and to construct the objective function of the ILP model with the goals of minimizing access conflicts and maximizing the number of unused banks. The scheme generation module is used to drive the ILP solver to solve the optimal allocation scheme based on the constraints and objective function of the ILP model. The scheme execution module is used to store the data flow graph into the corresponding bank according to the optimal allocation scheme through the processing unit array; Among them, the relevant variables of the ILP model include allocation variables. Related variables Storage variables , wherein the allocation variable Indicates to the first The first data point The sub-data is assigned to the first One bank, the associated variables Indicates to the first The first data point Sub-data and the first The first data point Each sub-data item is assigned to the first... A bank, the storage variable This indicates that during the entire execution process, the first... Has the bank been used? The constraints include: unique allocation constraint, bank capacity constraint, continuous allocation constraint, branch constraint, and conflict constraint. The unique allocation constraint is expressed as: in, This indicates the number of storage banks in the target coarse-grained reconfigurable array (CGRA). Indicates the total quantity of data. Indicates the first The number of data sub-data; The bank capacity constraint is expressed as follows: in, Indicates the first The data will be in the first... Each execution step is stored in the bank. Representing data in units of words The The size of each sub-data item This indicates the size of each storage bank, expressed in words. This indicates the number of execution steps after graph partitioning. Same number as subgraphs; The continuous allocation constraint is expressed as: The branch constraint is expressed as: in, Represents auxiliary binary variables, This indicates how much data is assigned to the first... One bank, , Represents a given constant; The conflict constraint is represented as follows: 。 4. The apparatus as described in claim 3, characterized in that, The objective function is expressed as: in, Indicates the number of access conflicts. This represents the total number of banks, the... The formula for obtaining it is: in, This indicates that the first step of execution is loaded or stored. Data points.