Hardware implementation method and system of reconfigurable tensor operation unit
The reconfigurable tensor operation unit addresses the limitations of current hardware by supporting both traditional and generalized tensor operations, enhancing efficiency and flexibility in executing diverse algorithms.
Patent Information
- Application Number
- CN202411329510.3
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2024-09-24
- Publication Date
- 2024-12-03
- Estimated Expiration
- 2044-09-24
AI Technical Summary
Current hardware tensor operation units only support traditional tensor operations, limiting their application scenarios and failing to efficiently utilize resources due to high power consumption and inefficient energy usage, especially in general-purpose computing chips and tensor cores.
A hardware implementation method and system for a reconfigurable tensor operation unit that supports both traditional and generalized tensor operations by analyzing application algorithms, generating a reconfigurable tensor operation array with a homogeneous two-dimensional space array structure, and mapping generalized tensor operations to a chip using generalized multiplication and addition notations.
Enables efficient execution of various algorithms, including dynamic programming, by dynamically supporting traditional and generalized tensor operations, improving resource utilization and reducing power consumption.
Smart Images

Figure CN118860962B_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the technical field of reconfigurable processors, and in particular to a hardware implementation method and system for a reconfigurable tensor operation unit. Background Art
[0002] This section is intended to provide a background or context to the embodiments of the invention recited in the claims. No admission is made that the description herein is prior art by inclusion in this section.
[0003] Tensors, as a high-dimensional generalization of vectors and matrices, are the basic form of data representation and storage in machine learning and high-performance computing. Tensor operations, including convolution operations of convolutional layers and matrix multiplication of fully connected layers, are key technologies for processing tensor data. Traditional tensor operations (i.e., matrix multiplication operations) rely on operators to perform operations on tensors. ,in Implement element-by-element calculations, Implements multi-element reduction.
[0004] In addition to traditional tensor operations, dynamic programming algorithms can also be implemented using this "element-by-element calculation-multi-element reduction" operator combination. For example, the iterative formula of the Needleman-Wunsch algorithm is
[0005]
[0006] can be considered as a vector and Use element-by-element calculations and multi-element reduction Implemented "generalized tensor operations".
[0007] Generalized tensor operations are widely used in dynamic programming, graph computing and other fields. Due to their similarity to traditional tensor operations, generalized tensor operations have the potential for parallel computing and can share data paths with traditional tensor operation accelerator hardware, thereby improving resource utilization efficiency. However, current hardware tensor operation units only support traditional tensor operations but not generalized tensor operations. Current hardware tensor operation units include general-purpose computing chips and tensor computing cores.
[0008] (1) General computing chips
[0009] General-purpose computing chips mainly include instruction set processors (CPUs) and field-programmable devices (FPGAs). Due to the requirements of general-purpose computing, non-computing functions such as instruction fetching and decoding and register stack access in instruction set processors consume more than 80% of the power consumption. The redundant computing and interconnection resources in FPGAs usually occupy about 95% of the area and power consumption, which makes it difficult for general-purpose computing chips to meet the energy efficiency and computing power. In general, the energy efficiency of general-purpose computing chips is three to four orders of magnitude lower than that of domain-customized chips.
[0010] (2) Tensor computing core
[0011] Tensor Core is a hardware accelerator designed specifically for tensor operations in deep learning. The main purpose of the tensor unit is to accelerate matrix operations in deep learning, especially those involving high-dimensional data. In deep learning, matrix operations are computationally intensive and require a large number of multiplication and accumulation operations. The tensor unit improves performance by processing these operations in parallel. However, the tensor core only supports Traditional tensor operations constructed by operator pairs do not support richer operator combinations, so its application scenarios are limited to matrix operations in machine learning.
[0012] In summary, there is currently a lack of a hardware implementation system that supports both traditional tensor operations and generalized tensor operations. Summary of the invention
[0013] An embodiment of the present invention provides a hardware implementation method of a reconfigurable tensor operation unit, which can support both traditional tensor operations and generalized tensor operations. The method includes:
[0014] Obtaining a software program of a typical application set in a target field, analyzing the target application algorithm in the software program, extracting the characteristic operator pairs used in the target application algorithm, and obtaining a characteristic operator pair set;
[0015] Using the characteristic operator pairs in the characteristic operator pair set as basic computing units, generating a hardware description of a reconfigurable tensor operation array with a homogeneous two-dimensional space array structure, and manufacturing a chip corresponding to the reconfigurable tensor operation unit according to the hardware description;
[0016] The target application algorithm is rewritten into the form of generalized tensor operations, the form of generalized tensor operations is described using generalized multiplication and addition notations, and the described generalized multiplication and addition notations are mapped to the chip corresponding to the reconfigurable tensor operation unit to obtain a hardware program that can be executed on the reconfigurable tensor operation unit.
[0017] The embodiment of the present invention further provides a hardware implementation system of a reconfigurable tensor operation unit, which can support both traditional tensor operations and generalized tensor operations. The system includes:
[0018] A feature operator pair set acquisition module is used to acquire a software program of a typical application set in a target field, analyze the target application algorithm in the software program, extract the feature operator pairs used in the target application algorithm, and obtain a feature operator pair set;
[0019] A reconfigurable tensor operation array acquisition module is used to generate a hardware description of a reconfigurable tensor operation array with a homogeneous two-dimensional space array structure using a characteristic operator pair in a characteristic operator pair set as a basic computing unit, and manufacture a chip corresponding to the reconfigurable tensor operation unit according to the hardware description;
[0020] The hardware program acquisition module is used to rewrite the target application algorithm into the form of generalized tensor operations, use generalized multiplication and addition notations to describe the form of generalized tensor operations, map the described generalized multiplication and addition notations to the chip corresponding to the reconfigurable tensor operation unit, and obtain a hardware program that can be executed on the reconfigurable tensor operation unit.
[0021] In an embodiment of the present invention, a software program of a typical application set in a target field is obtained, the target application algorithm in the software program is analyzed, and the characteristic operator pairs used in the target application algorithm are extracted to obtain a characteristic operator pair set; the characteristic operator pairs in the characteristic operator pair set are used as basic computing units to generate a hardware description of a reconfigurable tensor operation array with an isomorphic two-dimensional space array structure, and a chip corresponding to the reconfigurable tensor operation unit is manufactured according to the hardware description; the target application algorithm is rewritten into a form of generalized tensor operation, the form of the generalized tensor operation is described using a generalized multiplication-addition notation, and the described generalized multiplication-addition notation is mapped to a chip corresponding to the reconfigurable tensor operation unit to obtain a hardware program that can be executed on the reconfigurable tensor operation unit. Compared with the prior art solutions, the embodiments of the present invention not only support traditional tensor operations, but also can efficiently implement a variety of target application algorithms including dynamic programming algorithms; in addition, the target application algorithm is rewritten into the form of generalized tensor operations, and the form of generalized tensor operations is described using generalized multiplication and addition notations, and the described generalized multiplication and addition notations are mapped to the chip corresponding to the reconfigurable tensor operation unit to obtain a hardware program that can be executed on the reconfigurable tensor operation unit. This flexible hardware scheduling strategy can dynamically and efficiently support the implementation of a variety of target application algorithms including a variety of dynamic programming algorithms. BRIEF DESCRIPTION OF THE DRAWINGS
[0022] In order to more clearly illustrate the embodiments of the present invention or the technical solutions in the prior art, the following briefly introduces the drawings required for use in the embodiments or the prior art descriptions. Obviously, the drawings described below are only some embodiments of the present invention. For ordinary technicians in this field, other drawings can be obtained based on these drawings without creative work. In the drawings:
[0023] Figure 1 is a flowchart of a hardware implementation method of a reconfigurable tensor operation unit in an embodiment of the present invention;
[0024] Figure 2 A schematic diagram of a hardware description of a reconfigurable tensor operation array for generating a homogeneous two-dimensional spatial array structure in an embodiment of the present invention;
[0025] Figure 3 is a schematic diagram of a generalized tensor operation in an embodiment of the present invention when it is a matrix multiplication;
[0026] Figure 4 It is a schematic diagram of rearranging the calculated values into a matrix form in an embodiment of the present invention;
[0027] Figure 5 Schematic diagram of generalized tensor operation results in an embodiment of the present invention;
[0028] Figure 6 Schematic diagram of a hardware implementation system of a reconfigurable tensor operation unit in an embodiment of the present invention. DETAILED DESCRIPTION
[0029] To make the purpose, technical solution and advantages of the embodiments of the present invention more clear, the embodiments of the present invention are further described in detail below in conjunction with the accompanying drawings. Here, the exemplary embodiments of the present invention and their descriptions are used to explain the present invention, but are not intended to limit the present invention.
[0030] First, the terms involved in the embodiments of the present invention are explained.
[0031] CPU, central processing unit, central processing unit;
[0032] FPGA, field programmable gate array, field programmable gate array.
[0033] The present invention relates to a hardware design method for a reconfigurable tensor operation unit, aiming to improve the efficiency and flexibility of tensor data processing in machine learning and high-performance computing. By utilizing the characteristics of generalized tensor operations, the present invention proposes a hardware design that not only supports traditional tensor operations, but also can efficiently implement a variety of algorithms including dynamic programming. The present invention further proposes a flexible hardware scheduling strategy for dynamic programming algorithms to dynamically and efficiently support the implementation of a variety of dynamic programming algorithms.
[0034] Figure 1 The flowchart of the hardware implementation method of the reconfigurable tensor operation unit in the embodiment of the present invention includes:
[0035] Step 101, obtaining a software program of a typical application set in a target field, analyzing a target application algorithm in the software program, extracting a feature operator pair used in the target application algorithm, and obtaining a feature operator pair set;
[0036] Step 102, using the characteristic operator pairs in the characteristic operator pair set as basic computing units, generating a hardware description of a reconfigurable tensor operation array with a homogeneous two-dimensional space array structure, and manufacturing a chip corresponding to the reconfigurable tensor operation unit according to the hardware description;
[0037] Step 103, rewrite the target application algorithm into the form of generalized tensor operations, use generalized multiplication and addition notations to describe the form of generalized tensor operations, map the described generalized multiplication and addition notations to the chip corresponding to the reconfigurable tensor operation unit, and obtain a hardware program that can be executed on the reconfigurable tensor operation unit.
[0038] Compared with the prior art solutions, the embodiments of the present invention not only support traditional tensor operations, but also can efficiently implement a variety of target application algorithms including dynamic programming algorithms; in addition, the target application algorithm is rewritten into the form of generalized tensor operations, and the form of generalized tensor operations is described using generalized multiplication and addition notations, and the described generalized multiplication and addition notations are mapped to the chip corresponding to the reconfigurable tensor operation unit to obtain a hardware program that can be executed on the reconfigurable tensor operation unit. This flexible hardware scheduling strategy can dynamically and efficiently support the implementation of a variety of target application algorithms including a variety of dynamic programming algorithms.
[0039] Each step is described in detail below.
[0040] In step 101, a software program of a typical application set in a target field is obtained, a target application algorithm in the software program is analyzed, and a feature operator pair used in the target application algorithm is extracted to obtain a feature operator pair set;
[0041] In one embodiment, the target application algorithm includes various types of dynamic programming algorithms, and the core calculation parts in the target application algorithm are composed of two calculation modes: element-by-element calculation and multi-element reduction.
[0042] Various dynamic programming algorithms such as Smith-Waterman algorithm, Needleman-Wunsch algorithm, Floyd-Warshall algorithm, etc.
[0043] In one embodiment, the feature operator pair includes an element-by-element calculation operator and a multi-element reduction operator;
[0044] The characteristic operator pair needs to form a semi-ring structure on the value set.
[0045] For example, a numerical set consisting of integer values On the element-by-element multiplication operator and multi-element reduction operators Form a semi-ring , so can form a pair of operators.
[0046] In step 102, a hardware description of a reconfigurable tensor operation array with a homogeneous two-dimensional space array structure is generated using a characteristic operator pair in the characteristic operator pair set as a basic computing unit, and a chip corresponding to the reconfigurable tensor operation unit is manufactured according to the hardware description;
[0047] In one embodiment, the reconfigurable tensor operation array can implement no less than two operator combinations, and can be dynamically configured to switch between multiple operator combinations in real time.
[0048] For example, reconfigurable tensor operation arrays can achieve and .
[0049] Figure 2 The circuit structure of the reconfigurable tensor operation array in the embodiment of the present invention is as follows: Figure 2 As shown, in one embodiment, the reconfigurable tensor operation array circuit structure is a homogeneous spatial array structure;
[0050] The homogeneous spatial array structure is formed by arranging a plurality of homogeneous basic processing elements (PE) in a horizontal and vertical direction, and the data paths between the basic processing elements are limited to the directions between adjacent basic processing elements and parallel to the horizontal and vertical coordinate axes.
[0051] The above design can reduce the wiring overhead of the data path.
[0052] During specific implementation, the hardware description is done using Verilog, SystemVerilog, Chisel, etc.
[0053] See also Figure 2 In one embodiment, generating a hardware description of a reconfigurable tensor operation array of a homogeneous two-dimensional spatial array structure includes:
[0054] Generate an element-by-element calculation unit (ALU) and a multi-element reduction calculation unit (ALU) according to the types of the characteristic operators in the characteristic operator pair set;
[0055] Generate a hardware description of a single basic operation unit, wherein two input data in the hardware description are input into the element-by-element calculation unit to generate an intermediate result, and the intermediate result and the register (Reg) data in the basic operation unit are input into the multi-element reduction calculation unit, and the generated calculation result is placed into the register through a multiplexer (MUX);
[0056] The basic operation unit is replicated multiple times in the horizontal and vertical dimensions, and a data path parallel to the horizontal and vertical coordinate axes is constructed between adjacent basic operation units.
[0057] It can be seen that after the reconfigurable tensor operation unit is automatically generated, the generated hardware description (language code) can be used for the manufacture of hardware circuits to form chips through the classic digital integrated circuit manufacturing process.
[0058] In step 103, the target application algorithm is rewritten into the form of generalized tensor operations, the form of generalized tensor operations is described using generalized multiplication and addition notations, and the described generalized multiplication and addition notations are mapped to the chip corresponding to the reconfigurable tensor operation unit to obtain a hardware program that can be executed on the reconfigurable tensor operation unit.
[0059] In one embodiment, in the form of the generalized tensor operation, the input is two tensors A and B, the output is a tensor C, each tensor is a multidimensional array, and each element in the output tensor C can be calculated element by element by the corresponding elements in the two input tensors A and B, and then obtained by multi-element reduction.
[0060] Figure 3 is a schematic diagram of a generalized tensor operation in an embodiment of the present invention when it is a matrix multiplication, see Figure 3 In the tensor operation of matrix multiplication, the calculation formula for each element c[i,j] in C can be expressed as ,in form an operator pair.
[0061] In the embodiment of the present invention, the generalized multiplication-addition notation is a customized generalized tensor operation representation method, which is used to simply describe the computational characteristics of the target operation and facilitate automatic mapping tools to perform analysis and automatic exploration and tuning.
[0062] In one embodiment, the form of generalized tensor operations is described using generalized multiply-add notation, including:
[0063] Use tensor subscripts to describe the operational relationship between elements in the tensor;
[0064] Describe the multi-element reduction operator of the characteristic operator on the collection;
[0065] The element-by-element calculation operators in the characteristic operator pair set are described, and the operation relationship, multi-element reduction operator and element-by-element calculation operator are used as a description of the form of generalized tensor operation.
[0066] For example, The calculation process can be used ” This generalized multiply-add notation is used to describe it.
[0067] In one embodiment, mapping the described generalized multiplication-addition notation to a chip corresponding to a reconfigurable tensor operation unit includes:
[0068] According to the described generalized multiplication and addition marking and the sizes of the two input tensors, the generalized tensor operation is divided into multiple tensor operation tasks that meet the size constraints, so that the reconfigurable tensor operation unit can completely execute one tensor operation task each time.
[0069] In one embodiment, the generalized tensor operation is divided into a plurality of tensor operation tasks that meet the size constraint conditions, including:
[0070] According to the described generalized multiplication and addition markings and the sizes of the two input tensors, the calculation of the tensor dimensions in the generalized tensor operation is linearly transformed and mapped to the time dimension and the space dimension to form multiple tensor operation tasks that meet the size constraints. Among them, the space dimension is the calculation arrangement on the reconfigurable tensor operation array, and the time dimension is the scheduling relationship of the calculation order.
[0071] In specific implementation, the calculation of tensor dimensions in generalized tensor operations is linearly transformed, that is, the basis vectors of the data dependency relationship of the tensor operations are rotated, stretched, and so on.
[0072] A specific embodiment is given below to illustrate the specific application of the method proposed in the embodiment of the present invention.
[0073] First, the target application algorithm is clearly defined as matrix multiplication and dynamic programming Smith-Waterman algorithm, where the calculation formula of matrix multiplication is , the iterative formula of the Smith-Waterman algorithm is as follows:
[0074]
[0075]
[0076]
[0077]
[0078] The set of feature operator pairs in the target application algorithm is extracted as follows: .
[0079] Second, based on the set of characteristic operator pairs extracted above, a hardware description of a reconfigurable tensor operation array with a homogeneous two-dimensional spatial array structure is constructed. The hardware structure is as follows: Figure 2 As shown. Each basic computing unit ( Figure 2 PE) can be dynamically configured as Calculated form, or The calculation form of .
[0080] A chip corresponding to the reconfigurable tensor operation unit is manufactured according to the hardware description.
[0081] Third, for matrix multiplication applications, the tensor format does not need to be rearranged, and the generalized multiplication-add notation can be written as .
[0082] After the generalized multiply-add tag and the matrix sizes (16, 8) and (8, 8) are input into the automatic mapping process, the automatic mapping process will configure the calculation function of the array according to the generalized multiply-add tag as , and split the first input tensor into two (8,8) tensors by row, generating two 8×8 tensor operation subtasks, which are multiplication operation subtasks, mapped to the array in sequence for execution.
[0083] For the Smith-Waterman dynamic programming algorithm, the numerical values in the algorithm calculation process are first rearranged into tensor form. Figure 4 FIG. 1 is a schematic diagram of rearranging values into tensor form in an embodiment of the present invention. Then, the iterative form of the dynamic programming algorithm is rewritten into the form of generalized tensor operations, such as Figure 5 It is a schematic diagram showing an iterative rewriting of a dynamic programming algorithm into a generalized tensor operation in an embodiment of the present invention.
[0084] According to the iteration of the original Smith-Waterman dynamic programming algorithm, each element of the output tensor in the transformed generalized tensor operation is . Thus, the transformed operation can be rewritten in generalized multiply-add notation: .
[0085] Next, the above generalized multiply-add tag and the dimensions of the two input tensors (8,6) and (6,6) are input into the automatic mapping process, which will configure the calculation function of the array according to the generalized multiply-add tag as , and the two input tensors are sequentially input into the reconfigurable tensor computing unit from the horizontal and vertical directions for calculation.
[0086] The generalized tensor operation output of the two is calculated, which completes one round of iteration in the Smith-Waterman dynamic programming algorithm. Repeating this calculation can complete the entire algorithm process.
[0087] The embodiment of the present invention further proposes a hardware implementation system of a reconfigurable tensor operation unit, the principle of which is similar to the hardware implementation method of the reconfigurable tensor operation unit, and will not be repeated here.
[0088] Figure 6 Schematic diagram of a hardware implementation system of a reconfigurable tensor operation unit in an embodiment of the present invention, including:
[0089] The feature operator pair set acquisition module 601 is used to acquire a software program of a typical application set in a target field, analyze the target application algorithm in the software program, extract the feature operator pairs used in the target application algorithm, and obtain a feature operator pair set;
[0090] A reconfigurable tensor operation array obtaining module 602 is used to generate a hardware description of a reconfigurable tensor operation array with a homogeneous two-dimensional space array structure using a characteristic operator pair in a characteristic operator pair set as a basic computing unit, and manufacture a chip corresponding to the reconfigurable tensor operation unit according to the hardware description;
[0091] The hardware program acquisition module 603 is used to rewrite the target application algorithm into the form of generalized tensor operations, use generalized multiplication and addition notations to describe the form of generalized tensor operations, map the described generalized multiplication and addition notations to the chip corresponding to the reconfigurable tensor operation unit, and obtain a hardware program that can be executed on the reconfigurable tensor operation unit.
[0092] In one embodiment, the target application algorithm includes various types of dynamic programming algorithms, and the core calculation parts in the target application algorithm are composed of two calculation modes: element-by-element calculation and multi-element reduction.
[0093] In one embodiment, the feature operator pair includes an element-by-element calculation operator and a multi-element reduction operator;
[0094] The characteristic operator pair needs to form a semi-ring structure on the value set.
[0095] In one embodiment, the reconfigurable tensor operation array can implement no less than two operator combinations, and can be dynamically configured to switch between multiple operator combinations in real time.
[0096] In one embodiment, the reconfigurable tensor operation array circuit structure is a homogeneous spatial array structure;
[0097] The isomorphic spatial array structure is formed by arranging a plurality of isomorphic basic operation units in a replicated manner in the horizontal and vertical directions, and the data paths between the basic operation units are limited to the directions between adjacent basic operation units and parallel to the horizontal and vertical coordinate axes.
[0098] In one embodiment, the reconfigurable tensor operation array acquisition module 602 is used to:
[0099] Generate an element-by-element calculation unit and a multi-element reduction calculation unit according to the types of the characteristic operators in the characteristic operator pair set;
[0100] Generate a hardware description of a single basic operation unit, wherein two input data in the hardware description are input into an element-by-element calculation unit to generate an intermediate result, and the intermediate result and register data in the basic operation unit are input into a multi-element reduction calculation unit, and the generated calculation result is placed into a register through a multiplexer;
[0101] The basic operation unit is replicated multiple times in the horizontal and vertical dimensions, and a data path parallel to the horizontal and vertical coordinate axes is constructed between adjacent basic operation units.
[0102] In one embodiment, in the form of the generalized tensor operation, the input is two tensors, the output is a tensor, each tensor is a multidimensional array, and each element in the output tensor can be calculated element by element by the corresponding elements in the two input tensors, and then obtained by multi-element reduction.
[0103] In one embodiment, the hardware program obtaining module 603 is used to:
[0104] Use tensor subscripts to describe the operational relationship between elements in the tensor;
[0105] Describe the multi-element reduction operator of the characteristic operator on the collection;
[0106] The element-by-element calculation operators in the characteristic operator pair set are described, and the operation relationship, multi-element reduction operator and element-by-element calculation operator are used as a description of the form of generalized tensor operation.
[0107] In one embodiment, the hardware program obtaining module 603 is used to:
[0108] According to the described generalized multiplication and addition marking and the sizes of the two input tensors, the generalized tensor operation is divided into multiple tensor operation tasks that meet the size constraints, so that the reconfigurable tensor operation unit can completely execute one tensor operation task each time.
[0109] In one embodiment, the hardware program obtaining module 603 is used to:
[0110] According to the described generalized multiplication and addition markings and the sizes of the two input tensors, the calculation of the tensor dimensions in the generalized tensor operation is linearly transformed and mapped to the time dimension and the space dimension to form multiple tensor operation tasks that meet the size constraints. Among them, the space dimension is the calculation arrangement on the reconfigurable tensor operation array, and the time dimension is the scheduling relationship of the calculation order.
[0111] In summary, in the method and system proposed in the embodiments of the present invention, the embodiments of the present invention not only support traditional tensor operations, but also can efficiently implement a variety of target application algorithms including dynamic programming algorithms; in addition, the target application algorithm is rewritten into the form of generalized tensor operations, and the form of generalized tensor operations is described using generalized multiplication and addition notations, and the described generalized multiplication and addition notations are mapped to the chip corresponding to the reconfigurable tensor operation unit to obtain a hardware program that can be executed on the reconfigurable tensor operation unit. This flexible hardware scheduling strategy can dynamically and efficiently support the implementation of a variety of target application algorithms including a variety of dynamic programming algorithms.
[0112] The specific embodiments described above further illustrate the objectives, technical solutions and beneficial effects of the present invention in detail. It should be understood that the above description is only a specific embodiment of the present invention and is not intended to limit the scope of protection of the present invention. Any modifications, equivalent substitutions, improvements, etc. made within the spirit and principles of the present invention should be included in the scope of protection of the present invention.
Claims
1. A hardware implementation method of a reconfigurable tensor operation unit, It is characterized in that include: Obtaining a software program of a typical application set in a target field, analyzing the target application algorithm in the software program, extracting the characteristic operator pairs used in the target application algorithm, and obtaining a characteristic operator pair set; Using the characteristic operator pairs in the characteristic operator pair set as basic computing units, generating a hardware description of a reconfigurable tensor operation array with a homogeneous two-dimensional space array structure, and manufacturing a chip corresponding to the reconfigurable tensor operation unit according to the hardware description; The target application algorithm is rewritten into the form of generalized tensor operations, the form of generalized tensor operations is described using generalized multiplication and addition notations, and the described generalized multiplication and addition notations are mapped to the chip corresponding to the reconfigurable tensor operation unit to obtain a hardware program that can be executed on the reconfigurable tensor operation unit.
2. The method according to claim 1, It is characterized in that The target application algorithms include various dynamic programming algorithms. The core calculation parts of the target application algorithms are composed of two calculation modes: element-by-element calculation and multi-element reduction.
3. The method according to claim 1, It is characterized in that The characteristic operator pair includes an element-by-element operator and a multi-element reduction operator; The characteristic operator pair needs to form a semi-ring structure on the value set.
4. The method according to claim 1, It is characterized in that The reconfigurable tensor operation array can realize no less than two operator combinations and can be dynamically configured to switch between multiple operator combinations in real time.
5. The method according to claim 1, It is characterized in that The circuit structure of the reconfigurable tensor operation array is a homogeneous spatial array structure; The isomorphic spatial array structure is formed by arranging a plurality of isomorphic basic operation units in a replicated manner in the horizontal and vertical directions, and the data paths between the basic operation units are limited to the directions between adjacent basic operation units and parallel to the horizontal and vertical coordinate axes.
6. The method according to claim 5, It is characterized in that Generate a hardware description of a reconfigurable tensor operation array with a homogeneous two-dimensional spatial array structure, including: Generate an element-by-element calculation unit and a multi-element reduction calculation unit according to the types of the characteristic operators in the characteristic operator pair set; Generate a hardware description of a single basic operation unit, wherein two input data in the hardware description are input into an element-by-element calculation unit to generate an intermediate result, and the intermediate result and register data in the basic operation unit are input into a multi-element reduction calculation unit, and the generated calculation result is placed into a register through a multiplexer; The basic operation unit is replicated multiple times in the horizontal and vertical dimensions, and a data path parallel to the horizontal and vertical coordinate axes is constructed between adjacent basic operation units.
7. The method according to claim 1, It is characterized in that In the form of the generalized tensor operation, the input is two tensors, the output is a tensor, each tensor is a multidimensional array, and each element in the output tensor can be calculated element by element by the corresponding elements in the two input tensors, and then multi-element reduction is obtained.
8. The method according to claim 7, It is characterized in that The generalized tensor operations are described using the generalized multiply-add notation, including: Use tensor subscripts to describe the operational relationship between elements in the tensor; Describe the multi-element reduction operator of the characteristic operator on the collection; The element-by-element calculation operators in the characteristic operator pair set are described, and the operation relationship, multi-element reduction operator and element-by-element calculation operator are used as a description of the form of generalized tensor operation.
9. The method according to claim 8, It is characterized in that Mapping the described generalized multiplication-addition notation to the chip corresponding to the reconfigurable tensor operation unit includes: According to the described generalized multiplication and addition marking and the sizes of the two input tensors, the generalized tensor operation is divided into multiple tensor operation tasks that meet the size constraints, so that the reconfigurable tensor operation unit can completely execute one tensor operation task each time.
10. The method according to claim 9, It is characterized in that Divide generalized tensor operations into multiple tensor operation tasks that meet size constraints, including: According to the described generalized multiplication and addition markings and the sizes of the two input tensors, the calculation of the tensor dimensions in the generalized tensor operation is linearly transformed and mapped to the time dimension and the space dimension to form multiple tensor operation tasks that meet the size constraints. Among them, the space dimension is the calculation arrangement on the reconfigurable tensor operation array, and the time dimension is the scheduling relationship of the calculation order.
11. A hardware implementation system of a reconfigurable tensor operation unit, It is characterized in that include: A feature operator pair set acquisition module is used to acquire a software program of a typical application set in a target field, analyze the target application algorithm in the software program, extract the feature operator pairs used in the target application algorithm, and obtain a feature operator pair set; A reconfigurable tensor operation array acquisition module is used to generate a hardware description of a reconfigurable tensor operation array with a homogeneous two-dimensional space array structure using a characteristic operator pair in a characteristic operator pair set as a basic computing unit, and manufacture a chip corresponding to the reconfigurable tensor operation unit according to the hardware description; The hardware program acquisition module is used to rewrite the target application algorithm into the form of generalized tensor operations, use generalized multiplication and addition notations to describe the form of generalized tensor operations, map the described generalized multiplication and addition notations to the chip corresponding to the reconfigurable tensor operation unit, and obtain a hardware program that can be executed on the reconfigurable tensor operation unit.
