FPGA-based sparse matrix four-way parallel LDL T Decomposition accelerator
Patent Information
- Application Number
- CN202611292856.X
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2026-08-25
- Publication Date
- 2026-11-20
AI Technical Summary
[0004]然而,现有基于硬件加速的稀疏矩阵分解方案仍存在诸多电路实现层面的局限性:其一,算法实现多为软件代码的简单硬件移植,未从电路并行性本质出发进行进行运算时序的流水线化改造,导致电路结构与运算逻辑不匹配,硬件资源无法被高效利用,运算单元闲置时间占比高;其二,针对稀疏矩阵零元素与非零元素交错分布的非规律特性,传统存储电路设计未优化索引与数据的存储映射关系,难以支持多端口并行存取,数据读写冲突频发,形成性能瓶颈;其三,分解过程中加法、乘法、倒数运算等存在固有延迟差异,现有电路未设计针对性的流水线调度机制,各类运算按顺序执行导致延迟叠加,整体计算延迟无法有效降低
Smart Images

Figure CN123138557A_ABST
Abstract
Description
Technical Field
[0001] This invention relates to the field of data processing and hardware acceleration technology, and in particular to a sparse matrix four-way parallel LDL based on FPGA. T The decomposition accelerator is suitable for scenarios requiring efficient linear algebraic operations on sparse matrices in fields such as scientific computing, engineering simulation, signal processing, and artificial intelligence model training. It is especially suitable for embedded and edge computing devices with strict requirements on computing latency and hardware resource utilization. Background Technology
[0002] In modern scientific computing and engineering applications, sparse matrices are widely used in fields such as fluid mechanics, structural mechanics, power system simulation, and machine learning. Their decomposition operation, as a core computational step, directly determines the overall system efficiency. Traditional sparse matrix decomposition often employs software implementation, with algorithms based on serial computation logic. This results in high computational latency and insufficient throughput when processing large-scale matrices, making it difficult to meet the demands of real-time applications.
[0003] To improve decomposition efficiency, hardware acceleration solutions have become a hot research topic in the industry. Their core objective is to achieve parallelization and efficiency of the computation process through circuit-level optimization. On the one hand, it requires pipelining optimization of the decomposition algorithm's timing based on the characteristics of parallel computing, and designing computational logic adapted to hardware execution. On the other hand, it requires designing dedicated storage architectures for data storage and access to solve the problem of parallel access to irregular data. Simultaneously, it requires balancing the inherent latency differences of various operations through pipeline scheduling and computational co-design. FPGAs, with their strong programmability, flexible configuration of parallel computing resources, and controllable power consumption, have become the preferred platform for these hardware acceleration solutions.
[0004] However, existing hardware-accelerated sparse matrix factorization schemes still have many limitations at the circuit implementation level: First, the algorithm implementation is mostly a simple hardware porting of software code, without pipelined modification of the operation timing based on the essence of circuit parallelism, resulting in a mismatch between circuit structure and operation logic, inefficient use of hardware resources, and a high proportion of idle time of operation units; Second, for the irregular distribution of zero and non-zero elements in sparse matrices, traditional storage circuit design has not optimized the storage mapping relationship between index and data, making it difficult to support multi-port parallel access, resulting in frequent data read and write conflicts and forming a performance bottleneck; Third, there are inherent latency differences in addition, multiplication, and reciprocal operations during the factorization process, and existing circuits have not designed targeted pipeline scheduling mechanisms, so the sequential execution of various operations leads to the superposition of latency, and the overall computational latency cannot be effectively reduced.
[0005] Specifically, traditional right-vision LDL TIn the decomposition algorithm, the reciprocal operation, inner product operation, and update operation are executed sequentially, and the inherent latency of specific operations is directly added to the total latency. Simultaneously, due to the irregularity of the sparse matrix, data storage access conflicts easily occur during data updates, further exacerbating computational congestion. These issues make it difficult for existing hardware accelerators to balance parallelism, latency, and resource utilization, failing to meet the high-efficiency processing requirements of ultra-large-scale sparse matrix decomposition. Therefore, there is an urgent need to propose a four-way parallel LDL for sparse matrices based on FPGA. T Decompose the accelerator to address the aforementioned technical shortcomings. Summary of the Invention
[0006] The purpose of this invention is to provide a sparse matrix four-way parallel LDL based on FPGA. T The decomposition accelerator solves the problems of high computational latency, low data throughput, and insufficient hardware resource utilization in sparse matrix decomposition by integrating hardware pipeline scheduling optimization, storage optimization, parallel scheduling, and data update process design. It achieves efficient and low-latency decomposition of sparse matrices on the FPGA platform.
[0007] To address the aforementioned technical problems, this invention provides a sparse matrix four-way parallel LDL based on FPGA. T Decomposition accelerator, including: The PC preprocessing module is used to perform symmetric reordering and symbolization on the input original symmetric sparse matrix to generate the non-zero element count array Lnz_count, the level sort array Level_sort, the level task count array Level_count, the column pointer array Ap_new, and the combined data array Ax_Ai. The task allocation unit is used to read the hierarchical sorting array Level_sort and the layer task count array Level_count, and allocate column tasks that have no direct data dependency between them in the same level decomposition operation stage to the four-way decomposition operation unit according to the hierarchical counter Level_cnt. An improved storage module is used to provide parallel memory access data for the four-way decomposition arithmetic unit based on the column pointer array Ap_new and the combined data array Ax_Ai; The four-way decomposition operation unit is used to perform reciprocal preprocessing, inner product operation, column decomposition operation and submatrix update operation on the received column tasks respectively, so as to output the data to be updated; Two data update units are used to cache and determine the address of the output data to be updated, so as to write it back to the improved storage module, thereby completing the data update in the matrix decomposition process; The result output interface is used to output the final decomposition result that has been iteratively updated in the improved storage module to a specified storage location in the PC preprocessing module.
[0008] Preferably, each data unit in the combined data array Ax_Ai contains a non-zero element value and its corresponding row index, and the column pointer array Ap_new is used to indicate the start and end addresses of each column of data in the combined data array Ax_Ai.
[0009] Preferably, the four-way decomposition operation unit adopts a right-look LDL for FPGA pipeline execution. T The decomposition algorithm includes the following steps: Preprocessing of the reciprocal of the main diagonal element; obtaining the main diagonal element D of the current k-th column. kk Calculate its reciprocal and preprocess and store it to obtain the reciprocal R of the diagonal elements. kk =1 / D kk ; Synchronous inner product parallel operation; during the reciprocal operation, synchronously call the original unscaled vector elements L in the i-th and j-th rows of the lower triangular part of the k-th column. ik L jk Perform the inner product operation to obtain the intermediate variable M of the inner product. ij =L ik ×L jk ; Column decomposition results are generated; based on the preprocessed reciprocal R kk Perform column decomposition on the current column to obtain the updated element L in the k-th column. ik =L ik ×R kk ; Submatrix pipeline iterative update; utilizing the inner product intermediate variable M ij and the reciprocal R kk For the sub-column element L that depends on the k-th column ij Perform iterative updates, with the iterative update formula being L. ij =L ij -M ij ×R kk ; where L ij ′ for L ij The values are updated iteratively; the final matrix is obtained by completing the full matrix decomposition through iterative loops.
[0010] Preferably, each of the four decomposition operation units includes an adder, a multiplier, a reciprocal operator, and a pipeline control module; each type of operator has a fixed input / output delay characteristic; the pipeline control module is used to schedule the parallel execution of various operations in a specific time order to hide the delay of the reciprocal operation.
[0011] Preferably, the adder is a 3-stage pipelined adder, the multiplication is a 6-stage pipelined multiplication, and the reciprocal is a 16-stage pipelined reciprocal.
[0012] Preferably, the processing procedure of the data update unit includes: The process sequentially executes the following steps: cached data to be updated, retrieved data to be updated, determines the uniqueness of the target address of the data to be updated, performs a subtraction update operation on the data that meets the current write-back conditions, and feeds back the update result to the decomposition operation unit. When the target address of the data to be updated is the same as the address of the data that has not yet been written back in the current pipeline, or when the storage area corresponding to the target address is busy, the data to be updated is determined to not meet the current write-back condition, and the data to be updated is written to the conflict temporary queue. At the same time, its target address, the value to be updated and the source number of the four-way decomposition operation unit are recorded. After the current update operation of the corresponding target address is completed, the arbitration logic rereads the data to be updated in the conflict temporary queue and performs the address uniqueness judgment again. When it meets the current write-back condition, it enters the subtraction update pipeline and writes back the corresponding cache address.
[0013] Preferably, the processing procedure of the task allocation unit includes: A signal-driven hierarchical task loop is implemented using a level counter, Level_cnt. After receiving an update end signal indicating that the current level has been completed, it is determined whether the level counter, Level_cnt, has reached the maximum level, Level_max. If the level counter Level_cnt has not reached the maximum level Level_max, then the level counter Level_cnt is incremented and the next level task is started. When the level counter Level_cnt reaches the maximum level Level_max, the current matrix decomposition task loop ends.
[0014] Preferably, the task scheduling of the task allocation unit specifically includes: After the accelerator starts working, the task allocation unit reads the level sorting array Level_sort and the level task count array Level_count, and uses the current level control variable as the scheduling basis. When the system enters level 0, the task allocation unit determines the number of column tasks in the current level that have no direct data dependency on each other. According to the order given by the hierarchical sorting array Level_sort, the task allocation unit will allocate the four columns of reordered tasks to the four-way decomposition and operation units respectively, forming the first round of four-way parallel scheduling at level 0. After any decomposition and operation unit completes the task of the current column, the task allocation unit continues to extract the next column from the remaining column tasks in this layer and reassign it to the idle decomposition and operation unit until all column tasks in this layer are completed. Once the task at level 0 is completed, the task allocation unit starts the next level of tasks based on the level task count array Level_count and the level sort array Level_sort, so that the system gradually advances from level 0 to the last level.
[0015] Preferably, the improved storage module is used to store the column pointer array Ap_new and the combined data array Ax_Ai. The controller determines the start address and end address of the current column in the combined data array Ax_Ai based on the column pointer array Ap_new, and then distributes the non-zero element value and its row index corresponding to the current column to the corresponding four-way decomposition operation unit to reduce read and write conflicts in the four-way parallel memory access process.
[0016] This invention also provides a sparse matrix four-way parallel LDL based on FPGA. T The decomposition acceleration method executes a four-way parallel LDL based on an FPGA, as described above. T Decomposition accelerator, including: System initialization; performs initialization operations on the system and each hardware module, and configures initial parameters; Data loading and hardware module configuration; waiting for the host computer to complete the symbolization process and send the feature information and hierarchical information of the L matrix to the task allocation unit to complete the preprocessing and output of the data to be processed; Hierarchical loop and termination condition determination: The task allocation unit determines whether the current level counter Level_cnt is equal to the maximum level Level_max based on the obtained update end signal. If the determination result is yes, it means that the decomposition tasks of all levels have been completed, and the process jumps to the decomposition end step, terminating the entire algorithm process. If the determination result is no, it means that the current level has not been processed, and the parallel processing stage of the current level is entered. The current level is in the parallel processing phase; if the maximum level (Level_max) has not been reached, the operations at this level are triggered, including parallel data decomposition and data update operations. Data decomposition and calculation; the task allocation unit starts sending task instructions for the current level based on the hierarchical information sent by the host computer; after receiving the task instructions, it performs data decomposition and calculation on the column; during the data decomposition and calculation process, it continuously judges whether the calculation is finished. If it is not finished, it waits or executes the calculation repeatedly until the calculation is finished. Data update operation; receiving intermediate data generated by the data decomposition operation, reading the historical data to be updated, and performing calculations in combination with the intermediate data to obtain the updated data; continuously determining whether the update is finished during the data update operation, and if not finished, waiting or repeatedly executing the update operation until the update is finished; Level count update and feedback; once the data decomposition and data update operations are completed, the current level counter Level_cnt will be incremented by one, and then the process will jump to the next level of level loop and termination condition determination. Decomposition complete; once all levels have been processed, the system outputs the final result and terminates the algorithm.
[0017] Compared with the prior art, the present invention has the following advantages: This invention designs an integrated architecture encompassing task allocation, storage optimization, parallel computation, and data updating. This is achieved through the right-view LDL... T The decomposition algorithm is optimized through hardware-based pipeline scheduling, preprocessing critical long-path operations to enable parallel execution of reciprocal preprocessing, inner product operations, and update operations. A four-way parallel decomposition architecture supporting pipelined parallelism is constructed, optimizing the data update algorithm and physical structure. Through hierarchical task allocation, independent column tasks within the same level can be executed collaboratively in the four-way decomposition operation units. Storage format optimization and address resolution mechanisms improve parallel memory access efficiency and enhance adaptability to large-scale sparse matrix decomposition tasks, adapting to the irregular data distribution characteristics of sparse matrices and reducing the probability of memory access failures. This invention significantly reduces hardware resource idle time, improves the processing efficiency and data throughput of sparse matrix decomposition, and reduces computational latency. Attached Figure Description
[0018] Figure 1 This is a schematic diagram of the overall architecture of the accelerator of the present invention.
[0019] Figure 2 This is a flowchart of the core algorithm of this invention.
[0020] Figure 3 This is a flowchart of the data update unit of the present invention.
[0021] Figure 4 This is a timing diagram of the single-column decomposition operation pipeline of the present invention. Detailed Implementation
[0022] The present invention will be further described in detail below with reference to the accompanying drawings and specific embodiments. The advantages and features of the present invention will become clearer from the following description. It should be noted that the drawings are all in a very simplified form and use non-precise proportions, and are only used to facilitate and clarify the illustration of the embodiments of the present invention.
[0023] like Figure 1 As shown, this embodiment of the invention specifically provides a sparse matrix four-way parallel LDL based on FPGA. T Decomposition accelerator, including PC preprocessing module and LDL T Decomposition accelerator; The PC preprocessing module, acting as the host computer, is used to perform symmetric reordering and symbolization on the input original symmetric sparse matrix to generate the non-zero element count array Lnz_count, the level sort array Level_sort, the level task count array Level_count, the column pointer array Ap_new, and the combined data array Ax_Ai. LDL T The decomposition accelerator, configured on an FPGA platform, includes: The task allocation unit is used to read the hierarchical sorting array Level_sort and the layer task count array Level_count, and allocate column tasks that have no direct data dependency between them in the same level decomposition operation stage to the four-way decomposition operation unit according to the hierarchical counter Level_cnt. An improved storage module is used to provide parallel memory access data for the four-way decomposition operation units based on the column pointer array Ap_new and the combined data array Ax_Ai. Specifically, it uses the column pointer array Ap_new and the combined data array Ax_Ai to establish a storage structure that is parsed by column. The column pointer array Ap_new is used to parse the address range of the current column in the combined data array Ax_Ai, and the non-zero element value and its row index are provided to the corresponding decomposition operation unit. This allows the four-way decomposition operation units to read their respective address ranges according to the current column number, thereby reducing read and write conflicts during parallel memory access. The four-way decomposition operation unit is used to perform reciprocal preprocessing, inner product operation, column decomposition operation and submatrix update operation on the received column tasks to output the data to be updated; for the single-way decomposition operation unit, a 3-stage pipelined adder, a 6-stage pipelined multiplier and a 16-stage pipelined reciprocal operator can be configured, and the pipeline control module performs timing scheduling of various operations to reduce the impact of the long path of reciprocal preprocessing on the total operation delay; Two data update units are used to cache and determine the address of the output data to be updated, so as to write it back to the improved storage module, thereby completing the data update in the matrix decomposition process; The result output interface is used to output the final decomposition result that has been iteratively updated in the improved storage module to a specified storage location in the PC preprocessing module.
[0024] As a further description of the embodiments of the present invention, the embodiments of the present invention specifically use a 727-order sparse matrix, which can illustrate the complete process of PC preprocessing, hierarchical partitioning, task scheduling, parallel memory access, four-way decomposition operation, data update and result verification on the same data main line.
[0025] The PC preprocessing module's processing includes: selecting a 727-order real symmetric sparse matrix B as the input matrix. This matrix has 2009 non-zero elements, including 727 diagonal non-zero elements and 1282 off-diagonal non-zero elements, which can reflect the four-way parallel LDL of this invention. T The working process of the decomposition accelerator in large-scale sparse matrix scenarios includes the following steps: ①The PC preprocessing module first reorders the input matrix B to obtain the reordered matrix C=PBPᵀ, where P is the permutation matrix.
[0026] ②Then, symbolic decomposition is performed on matrix C to obtain the non-zero element count array Lnz_count, the elimination tree Parent, the level information Level, the level task count array Level_count, and the level sort array Level_sort.
[0027] ③ Based on this, a column pointer array Ap_new and a combined data array Ax_Ai are generated according to the column compression storage result of the reordered matrix. The above array combination is denoted as data A, and the above data is converted into an encoding format that can be directly read by the FPGA platform.
[0028] For the 727-order matrix used in this embodiment, a total of 61 levels are obtained after preprocessing. The number of tasks in the first few levels are 348, 91, 52, 37, 29, 13, 12, 11, 8, 8, 6, 5, 5, 5, 5, 5, 5, 4, 4, 4. It can be seen that there are no fewer than 4 mutually independent column tasks in multiple levels, so the four-way decomposition operation unit can continuously carry out parallel decomposition in these levels.
[0029] In this embodiment, the first 8 column indices of the hierarchical sort array Level_sort are 0, 683, 1, 682, 2, 681, 3, 677, respectively; the first few items of the column pointer array Ap_new are 0, 2, 4, 6, 8, 13, 15, 18, respectively.
[0030] As can be seen from the above array, the address range of the 0th column after reordering in the combined data array Ax_Ai is [0,2), the address range of the 1st column is [2,4), the address range of the 2nd column is [4,6), the address range of the 682nd column is [3180,3185), and the address range of the 683rd column is [3185,3190).
[0031] The task allocation unit performs the following task scheduling: ① After the accelerator starts working, the task allocation unit first reads the level sort array Level_sort and the level task count array Level_count, and uses the current level control variable as the scheduling basis.
[0032] ② When the system enters level 0, the task allocation unit determines that the current level contains 348 column tasks that have no direct data dependency on each other during the decomposition operation phase.
[0033] It should be noted that the phrase "no direct data dependency" here specifically means that there is no data dependency relationship such as read-after-write (RAW) between the tasks in the decomposition operation stage (including reciprocal preprocessing, inner product operation and column decomposition operation), so they can be executed in parallel by the four-way decomposition operation units. However, in the subsequent data update stage, the data to be updated generated by different tasks may point to the same target write-back address after address mapping, thus generating write-back address conflicts (i.e., structural conflicts). Such conflicts are handled by the two-way data update units through a conflict temporary queue and arbitration logic, and do not affect the parallelism of the tasks in the decomposition operation stage.
[0034] ③ According to the order given by the hierarchical sort array Level_sort, the task allocation unit can allocate the reordered columns 0, 683, 1 and 682 to the first, second, third and fourth decomposition operation units respectively, forming the first round of four-way parallel scheduling of the 0th level.
[0035] ④ After any decomposition and operation unit completes the task of the current column, the task allocation unit continues to extract the next column from the remaining column tasks in this layer and reassign it to the idle operation unit until all 348 column tasks in this layer are processed.
[0036] ⑤ After the task at level 0 is completed, the task allocation unit starts the next level of tasks based on the level task count array Level_count and the level sort array Level_sort, so that the system gradually advances from level 0 to level 60.
[0037] The improved storage module performs the following data loading: Each data unit in the combined data array Ax_Ai contains a non-zero element value and its corresponding row index, so the data output in the preprocessing stage can be directly correlated with the hardware memory access process.
[0038] For example, address 0 and address 1 correspond to two data units in column 0, and their contents can be represented as (row=0,val=-1.0) and (row=234,val=1.0); where row represents the row index of the non-zero element and val represents the element value; address 2 and address 3 correspond to two data units in column 1, and their contents can be represented as (row=1,val=-1.0) and (row=234,val=-1.0).
[0039] For example, the data units in column 683 corresponding to addresses 3185 to 3188 can be represented as (row=683,val=-7×10^-8), (row=684,val=1.0), (row=685,val=1.0), and (row=692,val=1.5).
[0040] After the task allocation unit issues a column task, the improved storage module parses the start and end addresses of the target column based on the column pointer array Ap_new, and extracts the non-zero element value val and row index row of the corresponding column from the combined data array Ax_Ai.
[0041] For example, after receiving the task for column 0, the first decomposition unit reads the data for that column based on the address range [0,2); after receiving the task for column 683, the second decomposition unit reads the data for that column based on the address range [3185,3190); and the third and fourth decomposition units perform the same data loading process based on the address ranges corresponding to columns 1 and 682, respectively.
[0042] In this way, the column tasks output by the task allocation unit, the address boundaries given by the column pointer array Ap_new, and the column data in the combined data array Ax_Ai form a complete data chain in the same embodiment.
[0043] The four-way decomposition unit performs the following parallel decomposition calculations: Each decomposition unit executes the LDL of the current column according to the same process. T break down.
[0044] ① The decomposition operation unit first performs reciprocal preprocessing on the main diagonal elements of the current column to obtain the intermediate quantities required for subsequent column decomposition and update operations.
[0045] ② Subsequently, the inner product operation related to this column is performed in parallel during the reciprocal preprocessing.
[0046] ③ After the reciprocal preprocessing result is available, continue to perform the column decomposition operation of the current column to obtain the relevant elements in the column vector corresponding to the L factor and the diagonal elements corresponding to the D factor.
[0047] ④ Finally, the data to be updated is generated by combining the inner product operation result and the reciprocal preprocessing result.
[0048] The aforementioned four-way decomposition operation unit adopts a right-look LDL for FPGA pipelined execution. T The decomposition algorithm, which differs from the traditional right-view LDL in its mathematical calculation process, T The improvement of the decomposition consistency lies in the timing scheduling at the hardware execution level. Specifically, it utilizes the fixed-latency pipeline cycle of the reciprocal operator to arrange the originally sequential reciprocal operations and inner product operations into overlapping execution, thus hiding the long latency of the reciprocal operation. The algorithm steps include: Preprocessing of the reciprocal of the main diagonal element; obtaining the main diagonal element D of the current k-th column. kk Calculate its reciprocal and preprocess and store it to obtain the reciprocal R of the diagonal elements. kk =1 / D kk ; Synchronous inner product parallel operation; during the reciprocal operation, synchronously call the original unscaled vector elements L in the i-th and j-th rows of the lower triangular part of the k-th column. ik L jk Perform the inner product operation to obtain the intermediate variable M of the inner product. ij =L ik ×L jk ; Column decomposition results are generated; based on the preprocessed reciprocal R kk Perform column decomposition on the current column to obtain the updated element L in the k-th column. ik =L ik ×R kk ; Submatrix pipeline iterative update; utilizing the inner product intermediate variable M ij and the reciprocal R kk For the sub-column element L that depends on the k-th column ij Perform iterative updates, with the iterative update formula being L. ij =L ij -M ij ×R kk ; where L ij ′ for L ij The values are updated iteratively; the final matrix is obtained by completing the full matrix decomposition through iterative loops.
[0049] Taking the first round of scheduling at level 0 as an example, the first decomposition operation unit performs preprocessing of the main diagonal elements, multiplication and addition within the column, and column decomposition on column 0; the second decomposition operation unit simultaneously performs the same type of operation on column 683; the third decomposition operation unit simultaneously processes column 1; and the fourth decomposition operation unit simultaneously processes column 682.
[0050] Since the four column tasks mentioned above are at the same level, there is no sequential dependency relationship between them that blocks each other in the current decomposition stage. Therefore, the four-way decomposition operation units can work in parallel at the same time, thus demonstrating the four-way parallel technology feature of this invention.
[0051] Combination Figure 4 The four-way decomposition unit performs inverse preprocessing, inner product operation, column decomposition operation (operation of intermediate variables to be updated) and update operation in parallel for different column tasks. When a single column decomposition enters the inverse preprocessing stage, the inverse operator performs a fixed-delay pipeline. During this period, the multiplier and adder can perform inner product operation in parallel without relying on the inverse result. After the inverse result is generated, the column decomposition and subsequent update operation that depend on the result are then executed.
[0052] Data update and result output: ① Data Update: After receiving the intermediate results output by the four-way decomposition and calculation unit, the data update unit, such as... Figure 3 As shown, the process follows a closed loop: "caching data to be updated, extracting address and numerical information, determining the uniqueness of the target address, performing a subtraction update operation, and writing back to the input cache".
[0053] Taking the first round of scheduling at level 0 of a 727-order matrix in this embodiment as an example, the four-way decomposition operation units process columns 0, 683, 1, and 682 respectively. According to the column pointer array Ap_new, the address range of column 0 in the combined data array Ax_Ai is [0, 2), and its data units include address 0 (row=0, val=-1.0) and address 1 (row=234, val=1.0); the address range of column 1 is [2, 4), and its data units include address 2 (row=1, val=-1.0) and address 3 (row=234, val=-1.0); the address range of column 682 is [3180, 3185), and its data units include address 3180 (row=682, val=-7×10^-8) and address 3181 (row=684, val=1.0). The addresses 3182, 3183, and 3184 correspond to row=691, val=1.0, 6184, and 3185 respectively. The address range of column 683 is [3185, 3190), and its data units include the addresses 3185, 3186, 3187, 3188, and 3189 respectively.
[0054] When a decomposition unit generates data to be updated, the data update unit determines the target write-back address in Ax_Ai based on the target column number and target row number carried by the data to be updated, combined with Ap_new. For example, when the second decomposition unit processes column 683, if it generates an update result for data cell (row=684), its target write-back address can be located at address 3186 in Ax_Ai; when the fourth decomposition unit processes column 682, if it generates an update result for data cell (row=684), its target write-back address can be located at address 3181 in Ax_Ai. Although both have row number 684, they belong to different columns and have different write-back addresses, so they can enter the update process at their respective addresses.
[0055] It should be noted that although tasks at the same level have no direct data dependency during the decomposition and operation phase, during the data update and write-back phase, due to the distribution characteristics of non-zero elements in the sparse matrix, the data to be updated generated by different tasks may point to the same target address after address mapping, thus causing write-back address conflicts. When the target address of the data to be updated is unique and the target storage area is not occupied, the data update unit directly sends it to the subtraction update pipeline and writes the update result back to the corresponding cache address. When two or more data to be updated point to the same target address after address mapping, for example, if they all request to write back the same Ax_Ai address, the data that arrives first enters the subtraction update pipeline, and the data that arrives later is written to the conflict temporary queue, and the target address, the value to be updated, and the source operation unit number are recorded. After the update operation of the current target address is completed, the arbitration logic rereads the data in the conflict temporary queue and performs address judgment again. If the write-back condition is met, it enters the subtraction update pipeline and writes back the corresponding address; if it is still not met, it continues to be retained in the conflict temporary queue to wait for the next round of arbitration.
[0056] ②Results output: As the system progresses from level 0 to level 60, all 61 levels of corresponding column tasks are decomposed in sequence. Finally, the accelerator outputs the corresponding results of the L factor and D factor, and can further cooperate with the previous and back substitution processes to obtain the solution results of the linear equation system.
[0057] ③ Solution result verification: To verify the effectiveness of this embodiment in completing LDL TThe overall correctness of the solution after decomposition and back-substitution can be verified by inverse permutation of the hardware output and comparison with the software calculation results. Verification results for a 727-order matrix show that the average error of the solution vector is approximately 4.66640309306469 × 10⁻¹⁰, the maximum absolute value of the residual is approximately 7.50387139092368 × 10⁻⁸, and the average absolute value of the residual is approximately 2.81290489036879 × 10⁻⁹. These indicators demonstrate the correctness of the overall output results after matrix decomposition and solving of the linear equation system.
[0058] like Figure 2 As shown, this embodiment of the invention provides a sparse matrix four-way parallel LDL based on FPGA. T The decomposition acceleration method includes the following steps: System initialization; performs initialization operations on the system and each hardware module, and configures initial parameters; Data loading and hardware module configuration; waiting for the host computer to complete the symbolization process and send the feature information of the L matrix and the Level hierarchical information to the task allocation unit to complete the preprocessing and output of the data to be processed; Hierarchical loop and termination condition determination: The task allocation unit determines whether the current level counter Level_cnt is equal to the maximum level Level_max based on the obtained update end signal. If the determination result is yes, it means that the decomposition tasks of all levels have been completed, and the process jumps to the decomposition end step, terminating the entire algorithm process. If the determination result is no, it means that the current level has not been processed, and the parallel processing stage of the current level is entered. The current level is in the parallel processing phase; if the maximum level (Level_max) has not been reached, the operations at this level are triggered, including parallel data decomposition and data update operations. Data decomposition and calculation; the task allocation unit starts sending task instructions for the current level based on the hierarchical information sent by the host computer; after receiving the task instructions, it performs data decomposition and calculation on the column; during the data decomposition and calculation process, it continuously judges whether the calculation is finished. If it is not finished, it waits or executes the calculation repeatedly until the calculation is finished. Data update operation; receiving intermediate data generated by the data decomposition operation, reading the historical data to be updated, and performing calculations in combination with the intermediate data to obtain the updated data; continuously determining whether the update is finished during the data update operation, and if not finished, waiting or repeatedly executing the update operation until the update is finished; Level count update and feedback; once the data decomposition and data update operations are completed, the current level counter Level_cnt will be incremented by one, i.e., Level_cnt = Level_cnt + 1. Then the process will jump to the next level of level loop and termination condition determination. Decomposition complete; once all levels have been processed, the system outputs the final result and terminates the algorithm.
[0059] To further illustrate the technical advantages of this invention over existing methods, the following verification is conducted by considering the processing time and decomposition accuracy under the same matrix data volume. The decomposition accelerator is implemented on a Xilinx XC7Z045FFG900 FPGA platform with a working frequency of 250MHz, and is compared with UMFPACK-4.2.1 from the open-source software library SuiteSparse for sparse matrix computation as an existing software method.
[0060] ①Accelerated performance: Under the same matrix data volume and the same matrix structure, the method of the present invention is significantly shorter in processing time compared with the existing UMFPACK software method. Taking a 727_12 matrix as an example, the UMFPACK time is 1210µs, while the FPGA decomposition accelerator of this invention takes 52.62µs, resulting in a processing time reduction of approximately 95.65% and a speedup ratio of 22.99. Taking a 685_bus matrix as an example, the UMFPACK time is 830µs, while the FPGA decomposition accelerator of this invention takes 43.97µs, resulting in a processing time reduction of approximately 94.70% and a speedup ratio of 18.88. Taking a 662_bus matrix as an example, the UMFPACK time is 570µs, while the FPGA decomposition accelerator of this invention takes 27.69µs, resulting in a processing time reduction of approximately 95.14% and a speedup ratio of 20.59. Taking a 494_bus matrix as an example, the UMFPACK time is 350µs, while the FPGA decomposition accelerator of this invention takes 13.76µs, resulting in a processing time reduction of approximately 96.07% and a speedup ratio of 25.44.
[0061] For matrices with relatively low hierarchical ratios and weak parallelization potential, the method of this invention still exhibits significant acceleration effects. For example, on the Bcsstk20 matrix, UMFPACK takes 360µs, while the FPGA decomposition accelerator of this invention takes 92.68µs, resulting in a processing time reduction of approximately 74.26% and a speedup ratio of 3.89. On the mhdb416 matrix, UMFPACK takes 260µs, while the FPGA decomposition accelerator of this invention takes 31.87µs, resulting in a processing time reduction of approximately 87.74% and a speedup ratio of 8.16. This demonstrates that the higher the matrix hierarchical ratio, the more parallelizable tasks within each layer, and the more significant the acceleration effect. Even on matrices with low parallelization potential, the method of this invention can reduce the overall processing time through hardware pipelining and decoupling update mechanisms.
[0062] ② Accuracy Verification: To further verify the accuracy of the FPGA decomposition accelerator in the numerical decomposition stage, the L and D matrices output by the FPGA decomposition accelerator were compared with the standard solution of MATLAB 2024a. Experimental results show that the maximum absolute error of the L matrix of the 727_12 matrix is 7.03 × 10^-11, and the maximum absolute error of the D matrix is 5.98 × 10^-10; the maximum absolute error of the L matrix of the Bcsstk20 matrix is 3.23 × 10^-10, and the maximum absolute error of the D matrix is 2.17 × 10^-8; the maximum absolute errors of the L and D matrices of other test matrices also remain at a low level. The above results demonstrate that the method of the present invention can maintain the numerical accuracy required for sparse matrix decomposition applications while significantly shortening the processing time.
[0063] In summary, this embodiment uses a 727-order matrix to establish a complete data mainline from the input matrix, preprocessing array, task allocation, address resolution, four-way parallel decomposition to result verification. This directly corresponds to the overall architecture, task scheduling method, and hardware implementation logic of this invention, demonstrating the four-way parallel LDL. T The practical application scenarios and technical effects of the decomposition accelerator. Compared with the existing UMFPACK software implementation, the method of this invention improves upon the right-view LDL. T The decomposition algorithm optimizes pipeline scheduling to hide the reciprocal equal-length delay operation, discovers parallelizable tasks within the same level through hierarchical task scheduling, and alleviates the bottleneck of irregular memory access in sparse matrices through address-based storage and branched update mechanisms. Therefore, it can significantly shorten the decomposition processing time with the same amount of data, while maintaining low decomposition errors of L and D matrices.
[0064] The above description is merely a description of preferred embodiments of the present invention and is not intended to limit the scope of the present invention in any way. Any changes or modifications made by those skilled in the art based on the above disclosure shall fall within the protection scope of the claims.
Claims
1. A sparse matrix four-way parallel LDL based on FPGA T Decomposition accelerator, characterized in that, include: The PC preprocessing module is used to perform symmetric reordering and symbolization on the input original symmetric sparse matrix to generate the non-zero element count array Lnz_count, the level sort array Level_sort, the level task count array Level_count, the column pointer array Ap_new, and the combined data array Ax_Ai. The task allocation unit is used to read the hierarchical sorting array Level_sort and the layer task count array Level_count, and allocate column tasks that have no direct data dependency between them in the same level decomposition operation stage to the four-way decomposition operation unit according to the hierarchical counter Level_cnt. An improved storage module is used to provide parallel memory access data for the four-way decomposition arithmetic unit based on the column pointer array Ap_new and the combined data array Ax_Ai; The four-way decomposition operation unit is used to perform reciprocal preprocessing, inner product operation, column decomposition operation and submatrix update operation on the received column tasks respectively, so as to output the data to be updated; Two data update units are used to cache and determine the address of the output data to be updated, so as to write it back to the improved storage module, thereby completing the data update in the matrix decomposition process; The result output interface is used to output the final decomposition result that has been iteratively updated in the improved storage module to a specified storage location in the PC preprocessing module.
2. The FPGA-based sparse matrix four-way parallel LDL as described in claim 1 T Decomposition accelerator, characterized in that, Each data unit in the combined data array Ax_Ai contains a non-zero element value and its corresponding row index, and the column pointer array Ap_new is used to indicate the start and end addresses of each column of data in the combined data array Ax_Ai.
3. The FPGA-based sparse matrix four-way parallel LDL as described in claim 1 T Decomposition accelerator, characterized in that, The four-way decomposition unit adopts a right-look LDL for FPGA pipeline execution. T The decomposition algorithm includes the following steps: Preprocessing of the reciprocal of the main diagonal element; obtaining the main diagonal element D of the current k-th column. kk Calculate its reciprocal and preprocess and store it to obtain the reciprocal R of the diagonal elements. kk =1 / D kk ; Synchronous inner product parallel operation; during the reciprocal operation, synchronously call the original unscaled vector elements L in the i-th and j-th rows of the lower triangular part of the k-th column. ik L jk Perform the inner product operation to obtain the intermediate variable M of the inner product. ij =L ik ×L jk ; Column decomposition results are generated; based on the preprocessed reciprocal R kk Perform column decomposition on the current column to obtain the updated element L in the k-th column. ik =L ik ×R kk ; Submatrix pipeline iterative update; utilizing the inner product intermediate variable M ij and the reciprocal R kk For the sub-column element L that depends on the k-th column ij Perform iterative updates, with the iterative update formula being L. ij =L ij -M ij ×R kk ; where L ij ′ for L ij The values are updated iteratively; the final matrix is obtained by completing the full matrix decomposition through iterative loops.
4. The FPGA-based sparse matrix four-way parallel LDL as described in claim 1 T Decomposition accelerator, characterized in that, Each of the four decomposition operation units includes an adder, a multiplier, a reciprocal operator, and a pipeline control module; each type of operator has a fixed input / output delay characteristic; the pipeline control module is used to schedule the parallel execution of various operations in a specific time order to hide the delay of the reciprocal operation.
5. A sparse matrix four-way parallel LDL based on FPGA as described in claim 4 T Decomposition accelerator, characterized in that, The addition unit is a 3-stage pipelined addition unit, the multiplication unit is a 6-stage pipelined multiplication unit, and the reciprocal unit is a 16-stage pipelined reciprocal unit.
6. The FPGA-based sparse matrix four-way parallel LDL as described in claim 1 T Decomposition accelerator, characterized in that, The processing procedure of the data update unit includes: The process sequentially executes the following steps: cached data to be updated, retrieved data to be updated, determines the uniqueness of the target address of the data to be updated, performs a subtraction update operation on the data that meets the current write-back conditions, and feeds back the update result to the decomposition operation unit. When the target address of the data to be updated is the same as the address of the data that has not yet been written back in the current pipeline, or when the storage area corresponding to the target address is busy, the data to be updated is determined to not meet the current write-back condition, and the data to be updated is written to the conflict temporary queue. At the same time, its target address, the value to be updated and the source number of the four-way decomposition operation unit are recorded. After the current update operation of the corresponding target address is completed, the arbitration logic rereads the data to be updated in the conflict temporary queue and performs the address uniqueness judgment again. When it meets the current write-back condition, it enters the subtraction update pipeline and writes back the corresponding cache address.
7. A sparse matrix four-way parallel LDL based on FPGA as described in claim 1 T Decomposition accelerator, characterized in that, The processing procedure of the task allocation unit includes: A signal-driven hierarchical task loop is implemented using a level counter, Level_cnt. After receiving an update end signal indicating that the current level has been completed, it is determined whether the level counter, Level_cnt, has reached the maximum level, Level_max. If the level counter Level_cnt has not reached the maximum level Level_max, then the level counter Level_cnt is incremented and the next level task is started. When the level counter Level_cnt reaches the maximum level Level_max, the current matrix decomposition task loop ends.
8. A sparse matrix four-way parallel LDL based on FPGA as described in claim 7 T Decomposition accelerator, characterized in that, The task scheduling of the task allocation unit specifically includes: After the accelerator starts working, the task allocation unit reads the level sorting array Level_sort and the level task count array Level_count, and uses the current level control variable as the scheduling basis. When the system enters level 0, the task allocation unit determines the number of column tasks in the current level that have no direct data dependency on each other. According to the order given by the hierarchical sorting array Level_sort, the task allocation unit will allocate the four columns of reordered tasks to the four-way decomposition and operation units respectively, forming the first round of four-way parallel scheduling at level 0. After any decomposition and operation unit completes the task of the current column, the task allocation unit continues to extract the next column from the remaining column tasks in this layer and reassign it to the idle decomposition and operation unit until all column tasks in this layer are completed. Once the task at level 0 is completed, the task allocation unit starts the next level of tasks based on the level task count array Level_count and the level sort array Level_sort, so that the system gradually advances from level 0 to the last level.
9. A sparse matrix four-way parallel LDL based on FPGA as described in claim 1 T Decomposition accelerator, characterized in that, The improved storage module is used to store the column pointer array Ap_new and the combined data array Ax_Ai. The controller determines the start and end addresses of the current column in the combined data array Ax_Ai based on the column pointer array Ap_new, and then distributes the non-zero element values and row indices of the current column to the corresponding four-way decomposition operation units to reduce read and write conflicts during the four-way parallel memory access process.
10. A sparse matrix four-way parallel LDL based on FPGA T The decomposition acceleration method executes the FPGA-based sparse matrix four-way parallel LDL as described in any one of claims 1 to 9. T Decomposition accelerator, characterized in that, include: System initialization; Perform system and hardware module initialization operations and configure initial parameters; Data loading and hardware module configuration; Wait for the host computer to complete the symbolization process and send the feature information and hierarchical information of the L matrix to the task allocation unit to complete the preprocessing and output of the data to be processed. Hierarchical loops and termination condition determination; The task allocation unit determines whether the current level counter Level_cnt is equal to the maximum level Level_max based on the obtained update end signal. If the result is yes, it means that all levels of decomposition tasks have been completed, and the process jumps to the decomposition end step, terminating the entire algorithm process. If the result is negative, it indicates that the current level has not been completed and the parallel processing stage of the current level will begin. The current level is in the parallel processing phase; if the maximum level (Level_max) has not been reached, the operations at this level are triggered, including parallel data decomposition and data update operations. Data decomposition and calculation; the task allocation unit starts sending task instructions for the current level based on the hierarchical information sent by the host computer; after receiving the task instructions, it performs data decomposition and calculation on the column; during the data decomposition and calculation process, it continuously judges whether the calculation is finished. If it is not finished, it waits or executes the calculation repeatedly until the calculation is finished. Data update operation; receiving intermediate data generated by the data decomposition operation, reading the historical data to be updated, and performing calculations in combination with the intermediate data to obtain the updated data; continuously determining whether the update is finished during the data update operation, and if not finished, waiting or repeatedly executing the update operation until the update is finished; Level count update and feedback; once the data decomposition and data update operations are completed, the current level counter Level_cnt will be incremented by one, and then the process will jump to the next level of level loop and termination condition determination. Decomposition complete; Once all levels have been processed, the system outputs the final result and terminates the algorithm.
