A DSP multi-core parallel QR decomposition method and device based on a tile algorithm
By using a DSP multi-core parallel QR decomposition method based on tile algorithm, the matrix is divided into tile blocks and combined with Householder transformation, which solves the problem of low efficiency of traditional QR decomposition under multi-core hardware, and realizes efficient and flexible matrix decomposition, which is suitable for multi-core environment.
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- 10TH RES INST OF CETC
- Filing Date
- 2026-02-28
- Publication Date
- 2026-06-02
AI Technical Summary
Traditional serial QR decomposition algorithms struggle to effectively utilize the parallel capabilities of modern multi-core hardware, resulting in low efficiency in large-scale dense matrix processing, especially under multi-core architectures where resources are difficult to fully utilize.
A multi-core parallel QR decomposition method based on tile algorithm is adopted. By dividing the matrix into tile blocks and combining them with Householder transformation, the multi-core architecture of the DSP processor is used for parallel processing, including the decomposition and updating of the main diagonal tile blocks and the coupling matrix.
It achieves efficient and flexible matrix decomposition in a multi-core environment, improves cache utilization and CPU utilization, is applicable to matrices of various shapes and sizes, and enhances computational efficiency and flexibility.
Smart Images

Figure CN122132671A_ABST
Abstract
Description
Technical Field
[0001] This invention relates to the field of digital signal processing technology, and in particular to a DSP multi-core parallel QR decomposition method and apparatus based on tile algorithm. Background Technology
[0002] Digital signal processors (DSPs) can perform numerical calculations, filtering, transformations, modulation, and other computational tasks with extremely high efficiency, while also achieving real-time performance and low power consumption. Over the past five years, the number and variety of products integrating some form of digital signal processing functionality have increased significantly. Digital signal processing has become a key component in many fields, including consumer electronics, communications, medical, and industrial applications.
[0003] Matrix factorization is a core concept in linear algebra, widely applied in fields such as data mining and machine learning. Commonly used matrix factorizations include LU decomposition, QR decomposition, Cholesky decomposition, and singular value decomposition. Among them, QR decomposition decomposes a matrix into the product of an orthogonal matrix Q and an upper triangular matrix. It is frequently used to solve linear least squares problems and eigenvalue problems of general matrices. Traditional QR decomposition mainly has three methods: Givens transformation, Gram-Schmidt orthogonalization, and Householder transformation.
[0004] For typical large-scale matrices, which are often dense matrices in most engineering projects, directly performing traditional QR decomposition on these matrices is often limited by both memory and computational constraints. Using traditional serial decomposition algorithms would only lead to a significant drop in efficiency or even algorithm crashes. Especially now that systems are moving towards multi-core architectures, these traditional algorithms struggle to fully utilize the parallel capabilities of modern hardware. Summary of the Invention
[0005] To address the aforementioned issues, this invention proposes a DSP multi-core parallel QR decomposition method and apparatus based on tile algorithm. Its parallel logic is clear, and its scalability is strong. It can fully utilize the advantages of multi-core processors for parallel processing to achieve inter-core parallel data processing, and can flexibly handle matrices of various shapes and sizes. This solves the problem that traditional QR algorithms cannot effectively utilize multi-core resources, providing a more universal multi-core parallel QR decomposition scheme for matrices of more types and shapes.
[0006] The technical solution adopted in this invention is as follows: A multi-core parallel QR decomposition method for DSP based on tile algorithm, comprising: Based on the number of cores in the DSP processor, the matrix to be decomposed is divided into blocks in the horizontal direction and tile blocks are set. QR decomposition based on Householder transformation is performed on the main diagonal tile blocks, and then all tile blocks to the right of the main diagonal tile blocks are updated in the horizontal direction. Couple the main diagonal tile block to each tile block in the same column perpendicular direction in pairs. Perform QR decomposition on the coupling matrix formed by each pair of couplings. Then update all coupling matrices to the right of the pair of coupling matrices along the horizontal direction until all tiles on the lower right side of the main diagonal tile block are updated. The process of decomposing and updating the main diagonal tile blocks horizontally, decomposing the same column tile blocks in a coupled manner, and updating the right-side coupled matrix is repeated until all main diagonal tile blocks in the matrix to be decomposed are processed, resulting in an upper triangular matrix and completing the QR decomposition of the matrix to be decomposed.
[0007] Furthermore, the step of dividing the matrix to be decomposed horizontally into blocks and setting tile blocks according to the number of DSP processor cores includes: dividing the column dimension of the matrix to be decomposed into column segments equal to the number of DSP processor cores, with each column segment corresponding to a basic processing unit of one core, and then dividing each column segment into several tile blocks according to a preset tile size, so that each core of the DSP processor is responsible for processing all tile blocks in the corresponding column segment and related coupled calculation tasks.
[0008] Furthermore, after QR decomposition of the main diagonal tile block, an upper triangular matrix, a lower triangular matrix containing the Householder reflection vector, and an upper triangular matrix for accumulating changes are generated. The original main diagonal tile block is replaced by the upper triangular matrix, and the lower triangular matrix and the upper triangular matrix for accumulating changes are passed to other cores of the DSP processor.
[0009] Furthermore, when updating all tiles to the right of the main diagonal tile block along the horizontal direction, an orthogonal matrix is calculated using the passed lower triangular matrix and the upper triangular matrix used for cumulative changes. The orthogonal matrix is then multiplied sequentially by each tile to the right of the same row of the main diagonal tile block, and the calculated result is used to replace the original tile block to complete the update.
[0010] Furthermore, after performing QR decomposition on the coupling matrix, an upper triangular matrix, a lower triangular matrix containing the Householder reflection vector, and an upper triangular matrix for accumulating changes are generated. The original coupling matrix is replaced by a matrix composed of the upper triangular matrix and the zero matrix, and the lower triangular matrix and the upper triangular matrix for accumulating changes are passed to other cores of the DSP processor.
[0011] Furthermore, when updating all coupling matrices to the right of the coupling matrix along the horizontal direction, first couple the tile blocks to the right of the main diagonal tile block with the corresponding vertical tile block to form a new coupling matrix. Then, use the transferred matrix to calculate the orthogonal matrix and multiply it by each new coupling matrix in turn. Replace the original coupling matrix with the calculation result to complete the update.
[0012] Furthermore, the cyclic execution of the decomposition and horizontal update of the main diagonal tile block, the coupling decomposition of the same column tile block, and the update of the right-side coupling matrix includes: determining the DSP processor core to which the main diagonal tile block belongs as the startup core, and having the startup core complete the QR decomposition of the main diagonal tile block and the coupling decomposition of the same column tile block; and having all cores of the DSP processor complete the update operation of the tile block or coupling matrix within their respective cores in parallel after receiving the update instruction and related matrix data.
[0013] Furthermore, each core of the DSP processor obtains the matrix data required for updating the tile blocks or coupling matrix by accessing the shared memory unit, and the boot core writes the lower triangular matrix required for updating and the upper triangular matrix used for accumulating changes to the shared memory unit.
[0014] Furthermore, the cyclical execution of the decomposition and horizontal update of the main diagonal tile blocks, and the coupled decomposition and right-side coupled matrix update of the same column tile blocks, also includes: sequentially selecting unprocessed tile blocks as new main diagonal tile blocks along the main diagonal direction, setting all matrix blocks in the lower right of the row and column containing the main diagonal tile block as the layer to be updated, performing decomposition and update operations only on the tile blocks in the layer to be updated, and selecting the next main diagonal tile block to form a new layer to be updated after completing one layer, until all layers to be updated are processed.
[0015] A DSP multi-core parallel QR decomposition device based on tile algorithm, comprising: The first decomposition module is configured to divide the matrix to be decomposed into blocks in the horizontal direction according to the number of cores of the DSP processor and set tile blocks, perform QR decomposition based on Householder transformation on the main diagonal tile blocks, and then update all tile blocks to the right of the main diagonal tile blocks in the horizontal direction. The second decomposition module is configured to couple the main diagonal tile block to each tile block in the same vertical column, perform QR decomposition on the coupling matrix formed by each pair of couplings, and then update all coupling matrices to the right of the pair of coupling matrices along the horizontal direction until the update of all tiles on the lower right side of the main diagonal tile block is completed. The iterative update module is configured to repeatedly perform the decomposition and horizontal update of the main diagonal tile blocks, the coupled decomposition of the same column tile blocks, and the update of the right-side coupled matrix, until all the main diagonal tile blocks in the matrix to be decomposed have been processed, resulting in the upper triangular matrix, thus completing the QR decomposition of the matrix to be decomposed.
[0016] The beneficial effects of this invention are as follows: 1. This invention divides a complete large-scale matrix into blocks, allowing each block to be processed independently. Based on the number of DSP processor cores, the matrix processed by each core is divided into blocks in the horizontal direction. Appropriate tile blocks are set, and each tile block first performs QR decomposition independently. Other blocks receive the data generated by the current tile block decomposition to update the matrix. The data processed within the core is independent of each other, and multi-core parallel computing is achieved by transferring the data generated by tile QR between cores, providing an efficient and flexible multi-core parallel solution for matrix decomposition.
[0017] 2. This invention offers superior performance and efficiency. By employing fine-grained partitioning, large-scale matrices are divided into smaller matrices for computation, improving cache utilization and exhibiting excellent parallelism. It can support the parallel operation of multiple DSP cores, thereby increasing CPU utilization.
[0018] 3. This invention offers high flexibility. The tile algorithm supports various initial matrix shapes, applicable not only to square matrices but also to rectangular matrices. Furthermore, the tile size can be adjusted based on the matrix size and hardware specifications to optimize performance. Attached Figure Description
[0019] Figure 1 This is the multi-core DSP matrix partitioning and tile algorithm execution direction diagram of Embodiment 2 of the present invention.
[0020] Figure 2 This is a flowchart of the DSP multi-core parallel QR decomposition method based on the tile algorithm in Embodiment 2 of the present invention.
[0021] Figure 3 This is a computational block diagram of the multi-core parallel structure in Embodiment 2 of the present invention. Detailed Implementation
[0022] To provide a clearer understanding of the technical features, objectives, and effects of the present invention, specific embodiments are now described. It should be understood that the specific embodiments described herein are merely illustrative of the invention and are not intended to limit the invention; that is, the described embodiments are only a part of the embodiments of the invention, not all of them. All other embodiments obtained by those skilled in the art based on the embodiments of the present invention without inventive effort are within the scope of protection of the present invention.
[0023] Example 1 This embodiment provides a DSP multi-core parallel QR decomposition method based on tile algorithm, including: Based on the number of cores in the DSP processor, the matrix to be decomposed is divided into blocks in the horizontal direction and tile blocks are set. QR decomposition based on Householder transformation is performed on the main diagonal tile blocks, and then all tile blocks to the right of the main diagonal tile blocks are updated in the horizontal direction. Couple the main diagonal tile block to each tile block in the same column perpendicular direction in pairs. Perform QR decomposition on the coupling matrix formed by each pair of couplings. Then update all coupling matrices to the right of the pair of coupling matrices along the horizontal direction until all tiles on the lower right side of the main diagonal tile block are updated. The process of decomposing and updating the main diagonal tile blocks horizontally, decomposing the same column tile blocks in a coupled manner, and updating the right-side coupled matrix is repeated until all main diagonal tile blocks in the matrix to be decomposed are processed, resulting in an upper triangular matrix and completing the QR decomposition of the matrix to be decomposed.
[0024] It should be noted that this method combines the tile algorithm with the multi-core parallel architecture of DSP, adapting to the hardware processing characteristics of DSP processors. It achieves matrix divide-and-conquer processing through matrix partitioning and tile block settings. Combined with coupled decomposition and hierarchical update, it enables the parallel execution of each step of QR decomposition, effectively improving the overall decomposition efficiency. At the same time, the decomposition operation based on Householder transformation can ensure the computational accuracy of QR decomposition.
[0025] Preferably, the matrix to be decomposed is divided into blocks in the horizontal direction according to the number of cores of the DSP processor and tile blocks are set, including: dividing the column dimension of the matrix to be decomposed into column segments equal to the number of cores of the DSP processor, each column segment corresponding to the basic processing unit of one core, and then dividing each column segment into several tile blocks according to a preset tile size, so that each core of the DSP processor is responsible for processing all tile blocks in the corresponding column segment and related coupled calculation tasks.
[0026] Specifically, the number of cores in the DSP processor is first obtained. Based on this, the column dimensions of the matrix to be decomposed are equally divided to form column segments with the same number of cores. Each column segment is assigned to one core of the DSP processor as the basic processing unit of that core. Then, a uniform tile size is set for all column segments. Each column segment is further divided into multiple tile blocks according to the tile size. After the tile block division of the matrix to be decomposed is completed, a corresponding processing task is assigned to each core of the DSP processor. Each core is independently responsible for all kinds of processing operations of all tile blocks in its corresponding column segment, and at the same time undertakes the coupled calculation tasks related to that column segment.
[0027] It should be noted that this step achieves precise adaptation between matrix partitioning and DSP multi-core, allowing the processing tasks of each core to be reasonably allocated, avoiding task redundancy and hardware resource waste between cores. The uniform tile size makes the granularity of matrix processing more regular, which facilitates the orderly conduct of subsequent decomposition and update operations, and improves the rationality and efficiency of multi-core task scheduling.
[0028] Preferably, after QR decomposition of the main diagonal tile block, an upper triangular matrix, a lower triangular matrix containing the Householder reflection vector, and an upper triangular matrix for accumulating changes are generated. The original main diagonal tile block is replaced by the upper triangular matrix, and the lower triangular matrix and the upper triangular matrix for accumulating changes are passed to other cores of the DSP processor.
[0029] Specifically, a QR decomposition operation based on Householder transformation is performed on the main diagonal tile block. During the decomposition process, three types of matrices are generated simultaneously: an upper triangular matrix, a lower triangular matrix containing the Householder reflection vector, and an upper triangular matrix used for cumulative changes. After the matrix generation is completed, the original main diagonal tile block in the matrix to be decomposed is directly replaced by the upper triangular matrix. At the same time, the lower triangular matrix containing the Householder reflection vector and the upper triangular matrix used for cumulative changes are formatted and encapsulated, and then transmitted to the other cores participating in the operation through the inter-core data transmission mechanism of the DSP processor.
[0030] It should be noted that the three types of matrices generated by Householder transformation decomposition can completely preserve the data changes and transformation characteristics during the decomposition process. The instant replacement of the upper triangular matrix enables the step-by-step update of the main diagonal tile blocks. The matrix data transfer between cores provides a complete and accurate calculation basis for subsequent tile block update operations, ensuring the effectiveness of subsequent update steps. At the same time, the encapsulated transmission method improves the efficiency of data interaction between cores.
[0031] Preferably, when updating all tiles to the right of the main diagonal tile block along the horizontal direction, an orthogonal matrix is calculated using the passed lower triangular matrix and the upper triangular matrix used for cumulative changes. The orthogonal matrix is then multiplied by each tile to the right of the same row of the main diagonal tile block, and the calculated result is used to replace the original tile block to complete the update.
[0032] Specifically, each core of the DSP processor receives the lower triangular matrix containing the Householder reflection vector and the upper triangular matrix used for cumulative changes. Based on matrix operation rules, these two matrices are used to solve for the orthogonal matrix. After obtaining the corresponding orthogonal matrix, each tile to the right of the same row is selected sequentially along the horizontal direction, with the main diagonal tile as the reference. The obtained orthogonal matrix is then multiplied by each tile. After completing the right multiplication calculation for each tile, the calculated result matrix directly replaces the original corresponding tile in the matrix to be decomposed. By sequentially replacing all right-side tiles, the horizontal update for this round is achieved.
[0033] It should be noted that the orthogonal matrix is calculated using the feature matrix obtained from the decomposition, which ensures the consistency of the transformation between the update operation and the previous decomposition operation. The tile block update is completed by right multiplication of the orthogonal matrix, which is in line with the core operation logic of QR decomposition and ensures the validity of the updated matrix data. The sequential right multiplication and replacement method allows the horizontal update steps to proceed in an orderly manner and avoids the problem of data disorder.
[0034] Preferably, after performing QR decomposition on the coupling matrix, an upper triangular matrix, a lower triangular matrix containing the Householder reflection vector, and an upper triangular matrix for accumulating changes are generated. The original coupling matrix is replaced by a matrix composed of the upper triangular matrix and the zero matrix, and the lower triangular matrix and the upper triangular matrix for accumulating changes are passed to other cores of the DSP processor.
[0035] Specifically, a QR decomposition operation based on Householder transformation is performed on the coupling matrix formed by pairwise coupling. After decomposition, three types of matrices are generated simultaneously: an upper triangular matrix, a lower triangular matrix containing Householder reflection vectors, and an upper triangular matrix for accumulating changes. Then, a new combined matrix is constructed, which is formed by combining the upper triangular matrix obtained from decomposition with the zero matrix according to a preset matrix concatenation rule. This combined matrix replaces the original coupling matrix in the matrix to be decomposed. At the same time, the lower triangular matrix containing Householder reflection vectors and the upper triangular matrix for accumulating changes are processed and transmitted to other cores through the inter-core transmission channel of the DSP processor.
[0036] It should be noted that, considering the structural characteristics of the coupling matrix, a combination of upper triangular matrix and zero matrix is used for replacement, which adapts to the decomposition and update requirements of the coupling matrix, ensuring the integrity of the overall matrix structure. The feature matrix generated by decomposition is passed to other cores, providing accurate computational data for subsequent updates of the coupling matrix. At the same time, the entire decomposition process conforms to the computational characteristics of Householder transformation, ensuring the computational accuracy of coupling matrix decomposition.
[0037] Preferably, when updating all coupling matrices to the right of the coupling matrix in the horizontal direction, first couple the tile blocks to the right of the main diagonal tile block with the corresponding vertical tile block to form a new coupling matrix, then use the transferred matrix to calculate the orthogonal matrix and multiply it by each new coupling matrix in turn, and replace the original coupling matrix with the calculation result to complete the update.
[0038] Specifically, taking the decomposed diagonal tile block as the benchmark, select each tile block to the right of its row in the horizontal direction, and simultaneously select the tile block corresponding to each tile block in the vertical direction. Couple the two one by one to form a new coupling matrix and complete the construction of all new coupling matrices. After each core of the DSP receives the transmitted matrix data, it uses the data to solve for the orthogonal matrix. Then, select the newly constructed coupling matrix in the horizontal direction in turn, and perform right multiplication operation on each of the orthogonal matrices with each new coupling matrix. Replace the original corresponding coupling matrix with the calculation result of each right multiplication. After all replacements are completed, the horizontal update of the coupling matrix for this round is realized.
[0039] It should be noted that the new matrix is formed by coupling first and then the update operation is performed. This ensures that the update of the coupled matrix is logically connected with the previous tile block coupling decomposition, thus guaranteeing the structural consistency of the updated object. The update is completed by right multiplication of the orthogonal matrix, which continues the unified operation logic of QR decomposition and improves the standardization of the update operation. The sequential update method avoids data conflicts caused by processing multiple coupled matrices at the same time and ensures the stability of the operation process.
[0040] Preferably, the operation of decomposing and updating the main diagonal tile block horizontally, decomposing the same column tile block in a coupled manner, and updating the right-side coupling matrix is performed cyclically, including: determining the DSP processor core to which the main diagonal tile block belongs as the starting core, and having the starting core complete the QR decomposition of the main diagonal tile block and the coupling decomposition of the same column tile block; and having all cores of the DSP processor complete the update operation of the tile block or coupling matrix within their respective cores in parallel after receiving the update instruction and related matrix data.
[0041] Specifically, before each iteration of the decomposition and update operation, the DSP processor core to which the current main diagonal tile belongs is determined and set as the startup core for this operation. The startup core independently executes the QR decomposition operation of the current main diagonal tile and the coupling decomposition operation of the main diagonal tile and each tile in the vertical direction of the same column. After completing the decomposition, the startup core sends update instructions to all cores of the DSP processor and synchronously transmits the relevant matrix data obtained from the decomposition. After receiving the update instructions and complete data, each core simultaneously starts its own operation process and completes the update operation of the tile or coupling matrix it is responsible for in parallel.
[0042] It should be noted that by initiating the core-specific decomposition operation, the remaining cores perform the update operation in parallel, thus separating the decomposition and update tasks. This fully leverages the hardware advantages of DSP multi-core parallelism. The synchronous transmission of instructions and data between cores ensures the timing consistency of the parallel updates of each core, avoiding the problem of asynchronous operation and significantly improving the overall computing efficiency.
[0043] Preferably, each core of the DSP processor obtains the matrix data required for updating the tile block or coupling matrix by accessing the shared memory unit, and the boot core writes the lower triangular matrix required for updating and the upper triangular matrix for accumulating changes to the shared memory unit.
[0044] Specifically, a shared memory unit is built in the hardware architecture of the DSP processor, which serves as a common carrier for data interaction between cores. Before executing the update operation, the boot core writes the decomposed lower triangular matrix containing the Householder reflection vector and the upper triangular matrix used for accumulating changes completely into the shared memory unit. After receiving the update instruction, each core of the DSP processor accesses the shared memory unit through its own memory access channel, reads the matrix data required to complete the tile block or coupling matrix update, and performs subsequent update operations after reading.
[0045] It should be noted that centralized management and reading of data between cores is achieved through shared storage units, replacing point-to-point data transmission between cores. This reduces the hardware overhead of data interaction between cores. The unified writing of data by the starting core ensures the uniqueness and accuracy of the data. Each core can independently access and read data, making data acquisition more efficient. This avoids loss or corruption during data transmission and improves the stability of data interaction between cores.
[0046] Preferably, the operation of cyclically performing the decomposition and horizontal update of the main diagonal tile blocks, and the coupled decomposition and right-side coupled matrix update of the same column tile blocks, further includes: sequentially selecting unprocessed tile blocks as new main diagonal tile blocks along the main diagonal direction, setting all matrix blocks in the lower right of the row and column containing the main diagonal tile block as the layer to be updated, performing decomposition and update operations only on the tile blocks in the layer to be updated, and selecting the next main diagonal tile block to form a new layer to be updated after completing one layer, until all layers to be updated are processed.
[0047] Specifically, during the iterative execution of decomposition and update operations, following the order along the main diagonal, unprocessed tiles are sequentially selected from the matrix to be decomposed as new main diagonal tiles. Using this new main diagonal tile as a reference, all matrix blocks in the lower right of its row and column are designated as the update layer for this operation. In this iteration, only the tiles and coupling matrix within this update layer are subjected to the corresponding decomposition and update operations; matrix blocks outside the update layer are not involved. After all decomposition and update operations for this update layer are completed, the next unprocessed tile is selected along the main diagonal as the new main diagonal tile, and the corresponding update layer is redefined. This layered processing step is repeated until all update layers in the matrix to be decomposed are processed.
[0048] It should be noted that the matrix is processed in a layered manner, and the operation is performed only on the region that needs to be updated. This avoids invalid operations on the matrix blocks that have already been processed, thus effectively reducing the overall amount of computation. The tile blocks are selected in order along the main diagonal and the layers to be updated are defined, so that the QR decomposition operation process forms a clear layered logic, which facilitates the control of the operation process and error detection, and further improves the overall operation efficiency.
[0049] Accordingly, this embodiment also provides a DSP multi-core parallel QR decomposition device based on tile algorithm, including: The first decomposition module is configured to divide the matrix to be decomposed into blocks in the horizontal direction according to the number of cores of the DSP processor and set tile blocks, perform QR decomposition based on Householder transformation on the main diagonal tile blocks, and then update all tile blocks to the right of the main diagonal tile blocks in the horizontal direction. The second decomposition module is configured to couple the main diagonal tile block to each tile block in the same vertical column, perform QR decomposition on the coupling matrix formed by each pair of couplings, and then update all coupling matrices to the right of the pair of coupling matrices along the horizontal direction until the update of all tiles on the lower right side of the main diagonal tile block is completed. The iterative update module is configured to repeatedly perform the decomposition and horizontal update of the main diagonal tile blocks, the coupled decomposition of the same column tile blocks, and the update of the right-side coupled matrix, until all the main diagonal tile blocks in the matrix to be decomposed have been processed, resulting in the upper triangular matrix, thus completing the QR decomposition of the matrix to be decomposed.
[0050] Specifically, the device integrates a first decomposition module, a second decomposition module, and an iterative update module, establishing bidirectional data interaction and command transmission channels between these modules. The first decomposition module first obtains the number of DSP processor cores, then divides the matrix to be decomposed into blocks horizontally and sets the tile blocks. Next, it performs QR decomposition based on Householder transformation on the main diagonal tile blocks, and then updates all tile blocks to the right of the main diagonal tile blocks horizontally. After completing its operation, the first decomposition module transmits the relevant data and completion command to the second decomposition module, which then updates the main diagonal tile blocks. The tile is paired with each tile in the same vertical column. QR decomposition is performed on each pair of coupling matrices. Then, all coupling matrices to the right of the pair are updated horizontally. This process continues until all tiles to the lower right of the main diagonal tile are updated. After the second decomposition module completes, the data is synchronized to the iterative update module. The iterative update module controls the first and second decomposition modules to perform the above decomposition and update operations in a loop until all main diagonal tiles in the matrix to be decomposed have been processed. After the matrix to be decomposed is transformed into an upper triangular matrix, the iterative update module issues a termination command, completing the entire QR decomposition process.
[0051] It should be noted that this device achieves functional separation of each step of QR decomposition through modular architecture design. Each module performs its own function and data interaction is smooth, which can better adapt to the computing needs of DSP multi-core parallelism. The instruction and data linkage between modules enables the entire decomposition process to proceed automatically without manual intervention. At the same time, the modular design facilitates the debugging, maintenance and functional expansion of the device, improving the device's practicality, adaptability and scalability.
[0052] Example 2 This embodiment provides a DSP multi-core parallel QR decomposition method based on tile algorithm, including: Based on the number of DSP processor cores, the matrix processed by each core is divided into blocks horizontally, and appropriate tile blocks are set, that is, matrix blocks with a size much smaller than the original matrix; tiles along the main diagonal direction... Perform a Householder-based QR decomposition, then analyze the tiles along the horizontal direction. The tiles on the right are being updated; Then, the tiles are coupled in pairs in the vertical direction to... Perform QR decomposition on the coupling matrix of the column, then update all coupling matrices on the right side along the horizontal direction until all tiles are updated. All the tiles on the lower right side; This process is repeated until all tiles on the main diagonal are updated, ultimately resulting in an upper triangular matrix R.
[0053] Preferably, when updating tiles in the horizontal direction, by The core sends the data required for updating to other cores. For cores integrated on the DSP, the update matrix can be quickly obtained by accessing the shared memory unit. After receiving the update instruction, different cores can process the tiles within the core in parallel.
[0054] See Figure 1 This invention achieves efficient QR decomposition of large-scale matrices on a multi-core DSP using a tile-based algorithm. In an optional embodiment, on a DSP array platform with at least four cores, the input size is at least M rows and 4N columns, where... The matrix to be decomposed is A. Matrix A is divided by columns. In this embodiment, the DSP has 4 cores, so matrix A is divided into 4 elongated matrices of row M and column N. Then, it is divided by rows, resulting in several N-fold submatrices. N matrix blocks Assuming Then each core can be divided into m 1 matrix block If the matrix Zeros can be padded at the end. The tile algorithm adopts a block-based fine-grained approach, dividing the matrix into multiple small matrix blocks of the same size, i.e., tiles. The entire matrix is updated by QR decomposition of the tiles, thus achieving the QR decomposition of the original matrix. The tile size is divided into b... b, then Using tiles as the unit for updating other matrices, define the horizontal direction to the right as i, the vertical direction downwards as j, and the direction along the main diagonal as k. Then, the tile block in row i and column j is set as... The tiles along the main diagonal are .
[0055] The matrix is divided evenly in the horizontal direction according to the number of kernels. Since the tile algorithm starts from the main diagonal tiles in each iteration... To begin, we will divide the matrix into m rows. 4 N of the same size N square matrix It is easy to see It will definitely fall Within the matrix block. Therefore, through... The loop structure is divided into layers, with the t-th layer defined as containing... The set of all matrix blocks in the lower right corner, including the current row and column, is arranged in layers, with Core0 as the starting core for the first layer, Core1 as the starting core for the second layer, and so on. This ensures that the tile that needs updating is always within the specified range. The right side of the matrix is updated, and after each layer is updated, the entire original matrix does not need to be updated again; only the matrices contained in the current layer need to be updated. Clearly, the matrix size of each layer continuously decreases, so the computation time for each layer decreases. For the startup kernel, it is directly updated. For all tiles in the same row to the right, perform the operation directly on all tiles in the k-th row; for other cores, perform the operation directly on all tiles in the k-th row.
[0056] See Figure 2 The DSP multi-core parallel QR decomposition method based on the tile algorithm in this embodiment includes the following steps: S100, initialize system parameters and partition the matrix. Let... , indicating from the tile start.
[0057] S200, due to tile blocks and Both are square matrices, then It must fall within the matrix block In the middle, judge A matrix block controlled by a certain core is set as the boot core.
[0058] S300, for Perform QR decomposition to produce an upper triangular matrix R, a lower triangular matrix V containing the Householder reflection vector, and an upper triangular matrix T for the WY technique of cumulative change. Replace matrix R with the upper triangular matrix V. Matrix T and matrix V are passed to other kernels.
[0059] S400, using the matrices V and T obtained from S300, calculate the orthogonal matrix P1 according to the formula. Then, for all tiles in the same i-direction... Right-multiply the matrix in sequence The calculated matrix replaces the original This enables the matrix to be updated.
[0060] S500, tile blocks and Coupling as Then perform QR decomposition on it to obtain the matrix. A lower triangular matrix V containing the Householder reflection vector and an upper triangular matrix T for the cumulative change WY technique. Using matrices... replace Matrix T and matrix V are passed to other kernels.
[0061] S600, according to the formula Using the matrix V and matrix T obtained from S500, calculate Then put the tiles and Coupled into Multiply the matrix by the right along the i-th direction. The calculated matrix replaces the original coupling matrix, thus updating the matrix.
[0062] S700, determine if coupling is complete. All tiles in the j-direction. Each core-divided matrix contains m blocks. Each Includes p If there are p tiles, then there are a total of mp tiles. Given p tiles, determine if j is greater than m. p is sufficient. If ,but Back to S500; if This indicates that all coupling is complete.
[0063] S800, determine whether to include all tiles along the main diagonal direction. Processing complete. Since the initial matrix has 4N columns, then... Determine if k is less than That's fine. If ,but Return to S200; if Once all updates are complete, the output will be an upper triangular matrix R.
[0064] S900 outputs the upper triangular matrix R obtained by performing QR decomposition on the original matrix A.
[0065] Preferably, the tile update matrix is mainly implemented through four operations, which are as follows: 1. SGEQRT: Primarily for tiles on the main diagonal. Perform QR decomposition to produce an upper triangular matrix. b Householder transformation matrices and an upper triangular matrix , and A block reflector generated by the WY algorithm, used to compute the update matrix. and Stored in the original tile, Additional space needs to be requested for storage.
[0066] 2. SLARFB: Generated using SGEQRT and Through calculation Update k rows of tile blocks .
[0067] 3. STSSQRT: Tiles on the main diagonal of the coupling. The two tiles in the same column and row j Perform QR decomposition on it to produce an upper triangular matrix. b Householder transformation matrices and an upper triangular matrix . and Stored in the original coupling matrix, Additional storage space is required.
[0068] 4. STSSSMQR: A block reflector generated using STSSQRT. and Through calculation Couple the tiles in the same row as the original coupling matrix into Update all coupling matrices.
[0069] See Figure 3 Tile algorithm from Start by processing along the k direction until... A total of 4p executions are required. Let's choose the k-th execution and assume... The boot core is Core0. The first step is that Core0 performs an SGEQRT operation on the tiles. First, perform QR decomposition. Second, Cores 0 through 3 perform SLARFB in parallel. Core 0 updates the tiles from column k to column p, while the other cores update all tiles in row k. Third, Core 0 uses STSSQRT operations to couple the matrix. and ,in For the coupling matrix Perform QR decomposition. Fourth step: Cores 0 through 3 perform STSSSMQR in parallel to update the coupled matrix blocks. The matrix size for each core is mp. 4p, determine if j is greater than mp, if ,but And repeat steps three and four until... , representing tiles The update is complete. Then proceed to... In the next cycle, for the tiles Perform the above operations.
[0070] Example 3 This embodiment provides a computer device, including a memory and a processor. The memory stores a computer program, and the processor executes the computer program to implement the DSP multi-core parallel QR decomposition method based on the tile algorithm of Embodiment 1 or 2. The computer program can be in the form of source code, object code, executable file, or some intermediate form.
[0071] Example 4 This embodiment provides a computer-readable storage medium storing a computer program that, when executed by a processor, implements the DSP multi-core parallel QR decomposition method based on the tile algorithm of Embodiment 1 or 2. The computer program can be in the form of source code, object code, executable file, or some intermediate form. The storage medium includes any entity or device capable of carrying computer program code, a recording medium, computer memory, read-only memory (ROM), random access memory (RAM), electrical carrier signals, telecommunication signals, and software distribution media, etc.
[0072] The above description is merely a preferred embodiment of the present invention. It should be understood that the present invention is not limited to the forms disclosed herein and should not be construed as excluding other embodiments. It can be used in various other combinations, modifications, and environments, and can be altered within the scope of the concept described herein through the above teachings or related technologies or knowledge. Modifications and variations made by those skilled in the art that do not depart from the spirit and scope of the present invention should be within the protection scope of the appended claims.
[0073] It should be noted that, for the sake of simplicity, the foregoing method embodiments are described as a series of actions. However, those skilled in the art should understand that this application is not limited to the described order of actions, as some steps may be performed in other orders or simultaneously according to this application. Furthermore, those skilled in the art should also understand that the embodiments described in the specification are preferred embodiments, and the actions and modules involved are not necessarily essential to this application.
Claims
1. A DSP multi-core parallel QR decomposition method based on tile algorithm, characterized in that, include: Based on the number of cores in the DSP processor, the matrix to be decomposed is divided into blocks in the horizontal direction and tile blocks are set. QR decomposition based on Householder transformation is performed on the main diagonal tile blocks, and then all tile blocks to the right of the main diagonal tile blocks are updated in the horizontal direction. Couple the main diagonal tile block to each tile block in the same column perpendicular direction in pairs. Perform QR decomposition on the coupling matrix formed by each pair of couplings. Then update all coupling matrices to the right of the pair of coupling matrices along the horizontal direction until all tiles on the lower right side of the main diagonal tile block are updated. The process of decomposing and updating the main diagonal tile blocks horizontally, decomposing the same column tile blocks in a coupled manner, and updating the right-side coupled matrix is repeated until all main diagonal tile blocks in the matrix to be decomposed are processed, resulting in an upper triangular matrix and completing the QR decomposition of the matrix to be decomposed.
2. The DSP multi-core parallel QR decomposition method based on tile algorithm according to claim 1, characterized in that, The step of dividing the matrix to be decomposed horizontally into blocks and setting tile blocks according to the number of DSP processor cores includes: dividing the column dimension of the matrix to be decomposed into column segments equal to the number of DSP processor cores, with each column segment corresponding to a basic processing unit of one core, and then dividing each column segment into several tile blocks according to a preset tile size, so that each core of the DSP processor is responsible for processing all tile blocks in the corresponding column segment and related coupled calculation tasks.
3. The DSP multi-core parallel QR decomposition method based on tile algorithm according to claim 1, characterized in that, After performing QR decomposition on the main diagonal tile block, an upper triangular matrix, a lower triangular matrix containing the Householder reflection vector, and an upper triangular matrix for accumulating changes are generated. The original main diagonal tile block is replaced by the upper triangular matrix, and the lower triangular matrix and the upper triangular matrix for accumulating changes are passed to other cores of the DSP processor.
4. The DSP multi-core parallel QR decomposition method based on tile algorithm according to claim 3, characterized in that, When updating all tiles to the right of the main diagonal tile block in the horizontal direction, an orthogonal matrix is calculated using the passed lower triangular matrix and the upper triangular matrix used for cumulative changes. The orthogonal matrix is then multiplied by each tile to the right of the same row of the main diagonal tile block, and the calculated result is used to replace the original tile block to complete the update.
5. The DSP multi-core parallel QR decomposition method based on tile algorithm according to claim 1, characterized in that, After performing QR decomposition on the coupling matrix, an upper triangular matrix, a lower triangular matrix containing the Householder reflection vector, and an upper triangular matrix for accumulating changes are generated. The original coupling matrix is replaced by a matrix composed of the upper triangular matrix and the zero matrix, and the lower triangular matrix and the upper triangular matrix for accumulating changes are passed to other cores of the DSP processor.
6. The DSP multi-core parallel QR decomposition method based on tile algorithm according to claim 5, characterized in that, When updating all coupling matrices to the right of the coupling matrix in the horizontal direction, first couple the tile blocks on the right side of the main diagonal tile block with the corresponding vertical tile blocks to form new coupling matrices. Then, use the transferred matrix to calculate the orthogonal matrix and multiply it by each new coupling matrix in turn. Replace the original coupling matrix with the calculation result to complete the update.
7. The DSP multi-core parallel QR decomposition method based on tile algorithm according to claim 1, characterized in that, The operation of cyclically executing the decomposition and horizontal update of the main diagonal tile block, the coupling decomposition of the same column tile block, and the update of the right-side coupling matrix includes: determining the DSP processor core to which the main diagonal tile block belongs as the startup core, and having the startup core complete the QR decomposition of the main diagonal tile block and the coupling decomposition of the same column tile block; and having all cores of the DSP processor complete the update operation of the tile block or coupling matrix within their respective cores in parallel after receiving the update instruction and related matrix data.
8. The DSP multi-core parallel QR decomposition method based on tile algorithm according to claim 7, characterized in that, Each core of the DSP processor obtains the matrix data required for updating tile blocks or coupling matrices by accessing the shared memory unit. The boot core writes the lower triangular matrix required for the update and the upper triangular matrix used for accumulating changes to the shared memory unit.
9. A DSP multi-core parallel QR decomposition method based on tile algorithm according to claim 7, characterized in that, The operation of cyclically performing the decomposition and horizontal update of the main diagonal tile blocks, and the coupled decomposition and right-side coupled matrix update of the same column tile blocks, further includes: sequentially selecting unprocessed tile blocks as new main diagonal tile blocks along the main diagonal direction, setting all matrix blocks in the lower right of the row and column containing the main diagonal tile block as the layer to be updated, performing decomposition and update operations only on the tile blocks in the layer to be updated, and selecting the next main diagonal tile block to form a new layer to be updated after completing one layer, until all layers to be updated are processed.
10. A DSP multi-core parallel QR decomposition device based on tile algorithm, characterized in that, include: The first decomposition module is configured to divide the matrix to be decomposed into blocks in the horizontal direction according to the number of cores of the DSP processor and set tile blocks, perform QR decomposition based on Householder transformation on the main diagonal tile blocks, and then update all tile blocks to the right of the main diagonal tile blocks in the horizontal direction. The second decomposition module is configured to couple the main diagonal tile block to each tile block in the same vertical column, perform QR decomposition on the coupling matrix formed by each pair of couplings, and then update all coupling matrices to the right of the pair of coupling matrices along the horizontal direction until the update of all tiles on the lower right side of the main diagonal tile block is completed. The iterative update module is configured to repeatedly perform the decomposition and horizontal update of the main diagonal tile blocks, the coupled decomposition of the same column tile blocks, and the update of the right-side coupled matrix, until all the main diagonal tile blocks in the matrix to be decomposed have been processed, resulting in the upper triangular matrix, thus completing the QR decomposition of the matrix to be decomposed.