A method, device, equipment and medium for convolution calculation of a large-scale matrix

By determining the initial matrix blocks in the input matrix and generating the extended matrix, and using the local cache space for boundary padding and convolution calculation, the problems of memory overflow and bandwidth waste in large-scale matrix convolution calculation are solved, and independent processing and efficient computation of the computing core are achieved.

CN123048900APending Publication Date: 2026-11-06SHANGHAI SMARTLOGIC TECHNOLOGY LTD
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202611179512.8
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2026-08-05
Publication Date
2026-11-06

AI Technical Summary

Technical Problem

Existing technologies suffer from problems such as memory overflow due to excessively large padding regions, serious waste of global memory access bandwidth, and waiting issues in large-scale matrix convolution calculations, especially with strong timing dependencies in multi-core parallel processing.

Method used

By determining the initial matrix blocks of the computing core in the input matrix and generating an expanded matrix according to the preset position type partitioning rules, the local cache space is used for boundary padding and convolution calculation, reducing global memory storage and read/write operations, and enabling independent processing of each computing core.

Benefits of technology

It effectively avoids memory overflow of ultra-large-scale matrices, reduces memory bandwidth waste, and realizes independent boundary padding and convolution calculation of computing cores without global synchronization, thereby improving computing efficiency and memory utilization.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN123048900A_ABST
    Figure CN123048900A_ABST
Patent Text Reader

Abstract

This invention discloses a method, apparatus, device, and medium for convolution calculation of large-scale matrices. The method is executed in parallel by multiple computing cores, including: determining the initial matrix block to be processed by the computing core in the input matrix, and determining the target position type of the initial matrix block; determining the matrix block to be read in the input matrix, and determining the missing boundary direction of the matrix block to be read; determining the write position of the matrix block to be read and the reserved position in the missing boundary direction in the local cache space, and sequentially performing the write operation and boundary padding operation of the matrix block to be read to generate an expanded matrix for calculation; performing convolution calculation based on the convolution kernel matrix and the expanded matrix, and writing the calculation result to the corresponding position in the result storage area. Using the above technical solution, memory usage can be reduced, the number of global memory read / write operations and the total amount of data transferred can be reduced, and each computing core can independently perform boundary padding and convolution calculations, avoiding global synchronization dependencies.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This invention relates to the field of large-scale data processing technology, and in particular to a method, apparatus, device and medium for convolution calculation of large-scale matrices. Background Technology

[0002] In two-dimensional convolution calculations, to ensure that the output matrix has the same size as the input matrix and that boundary pixels participate in the complete calculation, it is necessary to pad the edges of the input matrix.

[0003] In existing technologies, an expanded matrix containing the padding region can be generated in global memory first, and then the expanded matrix can be loaded into blocks and loaded into each computing core to perform convolution.

[0004] In existing solutions, when the input matrix size is large, the filling region also increases accordingly, resulting in an excessively large expanded matrix and causing memory overflow. Furthermore, when multiple computing cores process in parallel, each computing core needs to extract each row of the input matrix, perform the filling operation, and then write it back. Finally, it reads the expanded matrix in blocks to perform convolution calculations. Each computing core needs to perform multiple global memory accesses, resulting in significant bandwidth waste. Moreover, each computing core must wait for the complete expanded matrix to be generated before it can start computing, which results in strong timing dependencies. Summary of the Invention

[0005] This invention provides a method, apparatus, device, and medium for convolution calculation of large-scale matrices, which can effectively reduce the storage overhead of filling matrices, reduce memory usage, reduce the number of global memory read / write operations and total data transfer, reduce bandwidth waste, and enable each computing core to independently perform boundary padding and convolution calculations, avoiding global synchronization dependencies.

[0006] According to one aspect of the present invention, a method for convolution calculation of large-scale matrices is provided, which is executed in parallel by multiple computing cores in a parallel computing device, comprising: The initial matrix block to be processed by the computing core is determined in the input matrix, and the target position type to which the initial matrix block belongs is determined according to the preset position type division rules; Based on the initial matrix block division, the target position type, and the padding width, determine the matrix block to be read in the input matrix, and determine the missing boundary direction of the matrix block to be read; Based on the padding width and the missing boundary direction of the matrix block to be read, the write position of the matrix block to be read and the reserved position in the missing boundary direction are determined in the local cache space. Based on the write position and the reserved position, the write operation and boundary padding operation of the matrix block to be read are executed in sequence to generate an expanded matrix for calculation. Convolution is performed based on the kernel matrix and the augmented matrix, and the calculation result is written to the corresponding position in the result storage area.

[0007] According to another aspect of the present invention, a convolution calculation apparatus for large-scale matrices is provided, which is executed in parallel by multiple computing cores in a parallel computing device, comprising: The location type determination module is used to determine the initial matrix block to be processed by the computing core in the input matrix, and to determine the target location type to which the initial matrix block belongs according to the preset location type division rules; The matrix analysis module is used to determine the matrix block to be read in the input matrix based on the initial matrix block, the target position type, and the padding width, and to determine the missing boundary direction of the matrix block to be read; The boundary expansion module is used to determine the write position of the matrix block to be read and the reserved position in the missing boundary direction in the local cache space according to the filling width and the missing boundary direction of the matrix block to be read, and to execute the write operation and boundary filling operation of the matrix block to be read in sequence according to the write position and the reserved position to generate an expansion matrix for calculation. The convolution calculation module is used to perform convolution calculations based on the convolution kernel matrix and the expanded matrix, and write the calculation results to the corresponding positions in the result storage area.

[0008] According to another aspect of the present invention, an electronic device is provided, the electronic device comprising: At least one processor; and A memory communicatively connected to the at least one processor; wherein, The memory stores a computer program that can be executed by the at least one processor, which enables the at least one processor to perform the large-scale matrix convolution calculation method according to any embodiment of the present invention.

[0009] According to another aspect of the present invention, a computer-readable storage medium is provided, the computer-readable storage medium storing computer instructions for causing a processor to execute and implement the large-scale matrix convolution calculation method according to any embodiment of the present invention.

[0010] The technical solution of this invention determines the initial matrix block to be processed by the computing core in the input matrix, and determines the target position type of the initial matrix block according to the preset position type division rules; determines the matrix block to be read in the input matrix according to the initial matrix block, the target position type, and the padding width, and determines the missing boundary direction of the matrix block to be read; determines the write position of the matrix block to be read and the reserved position in the missing boundary direction in the local cache space according to the padding width and the missing boundary direction of the matrix block to be read, and sequentially performs the write operation and boundary padding operation of the matrix block to be read according to the write position and the reserved position to generate an expanded matrix for calculation; performs convolution calculation according to the convolution kernel matrix and the expanded matrix, and writes the calculation result to the corresponding position in the result storage area, so that the global memory only stores the original input matrix and does not need to save the global padding matrix, effectively avoiding the memory overflow problem of ultra-large-scale matrices. Each computing core only reads the minimum original data range required for its own calculation, and there is no redundant boundary data repeated transmission, which greatly alleviates the memory bandwidth bottleneck. Each computing core performs padding and calculation completely independently, without the time dependence of global padding, and has strong versatility.

[0011] It should be understood that the description in this section is not intended to identify key or essential features of the embodiments of the present invention, nor is it intended to limit the scope of the invention. Other features of the invention will become readily apparent from the following description. Attached Figure Description

[0012] To more clearly illustrate the technical solutions in the embodiments of the present invention, the accompanying drawings used in the description of the embodiments will be briefly introduced below. Obviously, the accompanying drawings described below are only some embodiments of the present invention. For those skilled in the art, other drawings can be obtained based on these drawings without creative effort.

[0013] Figure 1 This is a flowchart of a method for calculating the convolution of a large-scale matrix according to Embodiment 1 of the present invention; Figure 2 This is a schematic diagram of a location type division according to an embodiment of the present invention; Figure 3 This is a flowchart of another method for calculating the convolution of a large-scale matrix according to Embodiment 2 of the present invention; Figure 4 This is a schematic diagram of expanding an initial matrix block of the upper left corner type in a first position type according to an embodiment of the present invention; Figure 5 This is a schematic diagram illustrating the expansion of an initial matrix block of the top middle type in a second position type according to an embodiment of the present invention; Figure 6 This is a schematic diagram illustrating the expansion of an initial matrix block of a third position type according to an embodiment of the present invention; Figure 7 This is a schematic diagram of the structure of a large-scale matrix convolution calculation device provided in Embodiment 3 of the present invention; Figure 8 This is a schematic diagram of the structure of an electronic device that implements the large-scale matrix convolution calculation method of the present invention. Detailed Implementation

[0014] To enable those skilled in the art to better understand the present invention, the technical solutions of the present invention will be clearly and completely described below with reference to the accompanying drawings of the embodiments of the present invention. Obviously, the described embodiments are only some embodiments of the present invention, and not all embodiments. Based on the embodiments of the present invention, all other embodiments obtained by those skilled in the art without creative effort should fall within the scope of protection of the present invention.

[0015] It should be noted that the terms "first," "second," etc., in the specification, claims, and accompanying drawings of this invention are used to distinguish similar objects and are not necessarily used to describe a specific order or sequence. It should be understood that such terms can be used interchangeably where appropriate so that embodiments of the invention described herein can be implemented in orders other than those illustrated or described herein. Furthermore, the terms "comprising" and "having," and any variations thereof, are intended to cover a non-exclusive inclusion; for example, a process, method, system, product, or apparatus that comprises a series of steps or units is not necessarily limited to those steps or units explicitly listed, but may include other steps or units not explicitly listed or inherent to such processes, methods, products, or apparatus.

[0016] Example 1 Figure 1 This is a flowchart of a large-scale matrix convolution calculation method provided in Embodiment 1 of the present invention. This embodiment is applicable to situations where large-scale matrices are convolutionally processed using a single-machine multi-core computing device. The method can be executed by a large-scale matrix convolution calculation device, which can be implemented in hardware and / or software and is generally configured within a computing core with data processing capabilities. Figure 1 As shown, the method includes: S110. Determine the initial matrix block to be processed in the input matrix, and determine the target position type to which the initial matrix block belongs according to the preset position type division rules.

[0017] Optionally, the input matrix can refer to the original two-dimensional data to be used for convolution calculation. When the input matrix data is large, it may be necessary to perform block parallel processing through multiple computing cores. The input matrix can be stored in global memory, and each computing core can access the input matrix in global memory. The size of the input matrix can be represented by the number of rows H and the number of columns W of the input matrix.

[0018] Optionally, a computing core refers to an execution unit in a parallel computing device that independently performs computations and reads and writes data, and each computing core is equipped with an independent local cache.

[0019] Optionally, an initial matrix block refers to a matrix region that is divided from the input matrix and is computed by a computing core. Each computing core can be responsible for computing one initial matrix block. When the number of initial matrix blocks is greater than the number of computing cores, one computing core can process multiple initial matrix blocks in sequence. The size of the initial matrix block can be represented by the number of rows Block_H and the number of columns Block_W.

[0020] Optionally, the location type may include a first location type, a second location type, and a third location type.

[0021] The first position type includes top left corner, bottom left corner, top right corner and bottom right corner; The second position type includes top center type, bottom center type, left center type, and right center type; The third location type includes the internal region type.

[0022] Figure 2 This is a diagram illustrating one possible location type. For example... Figure 2 As shown, if the input matrix is ​​divided into 16 4×4 matrix blocks, I is used to represent the four corner blocks belonging to the first position type, II is used to represent the eight intermediate blocks (excluding the corners) belonging to the second position type, and III is used to represent the four middle blocks belonging to the third position type. According to... Figure 2 It can be seen that the first position type block in the upper left corner is specifically the upper left corner type, the first position type block in the upper right corner is specifically the upper right corner type, and the other two corner blocks are similar; the two second position type blocks at the top of the input matrix, located between the upper left and upper right corners, are specifically the top middle type, and the other middle type blocks are similar; the four third position type blocks inside the input matrix are specifically the internal region type.

[0023] according to Figure 2It can be seen that, since the first position type blocks are distributed in the four corners of the input matrix, the first position type blocks have two adjacent edges that coincide with the global boundary of the input matrix; since the second position type blocks are distributed on the sides but not in the corners, the second position type blocks have one edge that coincides with the global boundary of the input matrix; since the third position type blocks are distributed inside the input matrix, the third position type blocks have no edges that coincide with the global boundary of the input matrix.

[0024] Optionally, the position type partitioning rule refers to the rule for classifying the initial matrix blocks based on whether each boundary of the initial matrix block coincides with the global boundary of the input matrix.

[0025] Optionally, the target location type refers to the location category determined by dividing the current initial matrix into blocks according to the location type division rules.

[0026] Specifically, determining the initial matrix block to be processed by the computational core within the input matrix, and determining the target position type to which the initial matrix block belongs according to a preset position type division rule, may include: Based on the pre-loaded block configuration information in the computing core, the initial matrix block to be processed is determined in the input matrix; wherein, the block configuration information includes the starting address of the initial matrix block, the size of the initial matrix block, and the size of the input matrix; Each computing core can determine at least one initial matrix block, and the initial matrix blocks corresponding to each computing core do not overlap with each other and together cover the input matrix; Determine whether the upper, lower, left, and right boundaries of the initial matrix block coincide with the global boundary of the input matrix, and determine the target position type to which the initial matrix block belongs based on the determination result and the position type division rule.

[0027] Optionally, the global boundary can refer to the physical boundary of the input matrix itself.

[0028] Optionally, the starting address of the initial matrix block refers to the address of the top-left element in the initial matrix block in the storage space of the input matrix. The starting address can be determined by the base address of the input matrix, the starting row position and the starting column position of the initial matrix block, the row step size of the input matrix, and the number of bytes of the matrix elements.

[0029] Optionally, based on the starting address of the initial matrix block, the size of the initial matrix block, and the size of the input matrix, the actual range of elements occupied by the initial matrix block in the input matrix can be determined.

[0030] In one specific implementation, if the upper and left boundaries of the initial matrix block coincide with the global boundary of the input matrix, then the initial matrix block belongs to the top-left corner type of the first position type; if the upper and right boundaries of the initial matrix block coincide with the global boundary of the input matrix, then the initial matrix block belongs to the top-right corner type of the first position type; if the lower and left boundaries of the initial matrix block coincide with the global boundary of the input matrix, then the initial matrix block belongs to the bottom-left corner type of the first position type; if the lower and right boundaries of the initial matrix block coincide with the global boundary of the input matrix, then the initial matrix block belongs to the bottom-right corner type of the first position type.

[0031] In one specific implementation, if the upper boundary of the initial matrix block coincides with the global boundary of the input matrix, then the initial matrix block belongs to the top middle type of the second position type; if the lower boundary of the initial matrix block coincides with the global boundary of the input matrix, then the initial matrix block belongs to the bottom middle type of the second position type; if the left boundary of the initial matrix block coincides with the global boundary of the input matrix, then the initial matrix block belongs to the left middle type of the second position type; if the right boundary of the initial matrix block coincides with the global boundary of the input matrix, then the initial matrix block belongs to the right middle type of the second position type.

[0032] In one specific implementation, if the initial matrix block does not have an edge that coincides with the global boundary of the input matrix, then the initial matrix block belongs to the third position type, that is, the internal region type.

[0033] S120. Based on the initial matrix block division, target position type, and padding width, determine the matrix block to be read in the input matrix and determine the missing boundary direction of the matrix block to be read.

[0034] Optionally, the padding width can refer to the width of the matrix data that needs to be added or read outside the boundary of the initial matrix block during the convolution calculation. For an odd-sized convolution kernel matrix with size K×K, the padding width r can be determined as: r=(K-1) / 2. For example, for a 3×3 convolution kernel matrix, the padding width is 1; for a 5×5 convolution kernel matrix, the padding width is 2.

[0035] Optionally, the matrix block to be read can refer to the actual matrix data region that the computational core needs to read from the input matrix and write to the local cache space to complete the convolution calculation of the initial matrix block. The matrix block to be read includes the initial matrix block itself, as well as multiple adjacent element rows and / or element columns located within the input matrix that meet the padding width.

[0036] Optionally, the missing boundary direction is used to indicate that the matrix block to be read does not have real matrix data that can be read from the input matrix in a certain direction, and boundary padding needs to be performed in the local cache space for that direction.

[0037] Optionally, the missing boundary direction can be specifically the direction in which the initial matrix block coincides with the global boundary.

[0038] Optionally, if the initial matrix block belongs to the third position type, then there are no missing boundary directions.

[0039] In one specific implementation, if the initial matrix block belongs to the top-left corner type of the first position type, the missing boundary direction includes the upward and left directions; if the initial matrix block belongs to the top-right corner type of the first position type, the missing boundary direction includes the upward and right directions; if the initial matrix block belongs to the bottom-left corner type of the first position type, the missing boundary direction includes the downward and left directions; if the initial matrix block belongs to the bottom-right corner type of the first position type, the missing boundary direction includes the downward and right directions.

[0040] In one specific implementation, if the initial matrix block belongs to the top middle type of the second position type, the missing boundary direction includes the upward direction; if the initial matrix block belongs to the bottom middle type of the second position type, the missing boundary direction includes the downward direction; if the initial matrix block belongs to the left middle type of the second position type, the missing boundary direction includes the left direction; if the initial matrix block belongs to the right middle type of the second position type, the missing boundary direction includes the right direction.

[0041] S130. Based on the padding width and the missing boundary direction of the matrix block to be read, determine the write position of the matrix block to be read and the reserved position in the missing boundary direction in the local cache space, and execute the write operation and boundary padding operation of the matrix block to be read in sequence according to the write position and the reserved position to generate the extended matrix for calculation.

[0042] Optionally, local cache space refers to storage space that can be directly accessed by the corresponding computing core and used to temporarily store convolution calculation data.

[0043] Optionally, the write position refers to the target storage location of the matrix block to be read in the pre-divided extended matrix storage area within the local cache space. The write position is used to ensure that the matrix block to be read is directly in its corresponding position in the extended matrix after being written, avoiding the overall movement of the matrix block to be read before and after boundary padding.

[0044] Optionally, a reserved location refers to a storage area in the local cache space that is reserved in advance for padding data corresponding to the missing boundary direction. For the first location type, two reserved areas can be set in the missing boundary direction. For the second location type, one reserved area can be set in the missing boundary direction. For the third location type, it is not necessary to set a reserved area for boundary padding.

[0045] Optionally, the augmented matrix refers to the matrix formed after the matrix block to be read is written into the local cache space and the boundary is filled in the reserved position in the direction of the missing boundary, which can be used by the convolution kernel matrix to perform convolution calculation.

[0046] Optionally, for the third position type, since the matrix block to be read already contains all the real matrix data required for convolution calculation, the matrix block to be read after being written to the local cache space can directly form the extended matrix.

[0047] Optionally, boundary filling operation refers to the operation of writing filling data to the reserved position in the direction of the missing boundary according to the preset boundary filling method. The boundary filling method may include, but is not limited to, constant filling, zero filling, mirror filling, etc.

[0048] S140. Perform convolution calculation based on the convolution kernel matrix and the expansion matrix, and write the calculation result to the corresponding position in the result storage area.

[0049] Optionally, the convolution kernel matrix refers to the weight matrix used to slide on the extended matrix and perform weighted calculations on the matrix elements within the convolution window.

[0050] Optionally, convolution calculation refers to the operation of multiplying and adding based on the local matrix windows in the convolution kernel matrix and the expanded matrix. After the calculation core performs convolution calculation based on the convolution kernel matrix and the expanded matrix, it can obtain the output matrix data corresponding to the blocks of the initial matrix.

[0051] Optionally, the result storage area refers to a designated memory area pre-allocated in global memory for storing the computation results output by each computing core.

[0052] Optionally, the result storage areas corresponding to different initial matrix blocks do not overlap. Based on the position of the initial matrix block in the input matrix, the corresponding position of the calculation result in the result storage area can be determined.

[0053] Optionally, for convolution computations that maintain the same input and output dimensions, the row and column positions of the initial matrix blocks in the input matrix can correspond to the row and column positions of their computation results in the result storage area.

[0054] The technical solution of this invention determines the initial matrix block to be processed by the computing core in the input matrix, and determines the target position type of the initial matrix block according to the preset position type division rules; determines the matrix block to be read in the input matrix according to the initial matrix block, the target position type, and the padding width, and determines the missing boundary direction of the matrix block to be read; determines the write position of the matrix block to be read and the reserved position in the missing boundary direction in the local cache space according to the padding width and the missing boundary direction of the matrix block to be read, and sequentially performs the write operation and boundary padding operation of the matrix block to be read according to the write position and the reserved position to generate an expanded matrix for calculation; performs convolution calculation according to the convolution kernel matrix and the expanded matrix, and writes the calculation result to the corresponding position in the result storage area, so that the global memory only stores the original input matrix and does not need to save the global padding matrix, effectively avoiding the memory overflow problem of ultra-large-scale matrices. Each computing core only reads the minimum original data range required for its own calculation, and there is no redundant boundary data repeated transmission, which greatly alleviates the memory bandwidth bottleneck. Each computing core performs padding and calculation completely independently, without the time dependence of global padding, and has strong versatility.

[0055] Example 2 Figure 3 This is a flowchart illustrating a method for calculating the convolution of a large-scale matrix according to Embodiment 2 of the present invention. Based on the above embodiments, this embodiment specifically describes a method for calculating the convolution of a large-scale matrix. Figure 3 As shown, the method includes: S210. Based on the pre-loaded block configuration information in the computing core, determine the initial matrix block to be processed in the input matrix.

[0056] The block configuration information includes the starting address of the initial matrix block, the size of the initial matrix block, and the size of the input matrix.

[0057] Each computing core can determine at least one initial matrix block, and the initial matrix blocks corresponding to each computing core do not overlap with each other and together cover the input matrix.

[0058] S220. Determine whether the upper, lower, left, and right boundaries of the initial matrix block coincide with the global boundary of the input matrix, and determine the target position type to which the initial matrix block belongs based on the judgment result and the position type division rules.

[0059] Specifically, determining whether the upper, lower, left, and right boundaries of the initial matrix block coincide with the global boundary of the input matrix, and determining the target position type to which the initial matrix block belongs based on the determination result and the position type division rule, may include any of the following: If the initial matrix block has two adjacent boundaries that coincide with the global boundary of the input matrix, then the target location type to which the initial matrix block belongs is determined to be the first location type; If the initial matrix block has a boundary that coincides with the global boundary of the input matrix, then the target position type to which the initial matrix block belongs is determined to be the second position type. If the initial matrix block does not have a boundary that coincides with the global boundary of the input matrix, then the target position type to which the initial matrix block belongs is determined to be the third position type.

[0060] Optionally, location can be classified according to the number of overlapping boundaries. The logic is simple and clear, and the determination can be completed with only simple comparison. The computational load is minimal, and the classification framework can be flexibly adapted to different padding strategies and convolution kernel sizes, making it highly scalable.

[0061] S230. Based on the initial matrix block division, target position type, and padding width, determine the matrix block to be read in the input matrix and determine the missing boundary direction of the matrix block to be read.

[0062] The process of determining the matrix block to be read in the input matrix based on the initial matrix block division, the target position type, and the padding width, and determining the missing boundary direction of the matrix block to be read, may include any of the following: If the target location type is the first location type, then based on the initial matrix block, the fill width is extended into the interior of the input matrix along the directions corresponding to the two boundaries that do not coincide with the global boundary of the input matrix. The initial matrix block and the extended matrix region are jointly determined as the matrix block to be read, and the directions corresponding to the two boundaries that coincide with the global boundary of the input matrix are determined as the missing boundary directions. If the target location type is the second location type, then based on the initial matrix block, the fill width is extended into the interior of the input matrix along the directions corresponding to the three boundaries that do not coincide with the global boundary of the input matrix. The initial matrix block and the extended matrix region are jointly determined as the matrix block to be read, and the direction corresponding to the boundary of the initial matrix block that coincides with the global boundary of the input matrix is ​​determined as the missing boundary direction. If the target location type is the third location type, then based on the initial matrix block, the fill width is extended along the upper boundary direction, lower boundary direction, left boundary direction and right boundary direction respectively, and the initial matrix block and the extended matrix region are jointly determined as the matrix block to be read, and it is determined that the matrix block to be read does not have a missing boundary direction.

[0063] Optionally, based on the location type of the initial matrix block, the padding width can be extended in the direction of the original data to obtain the range of the matrix block to be read.

[0064] Optionally, for the first position type, taking the top-left corner type as an example, if the initial matrix block occupies a row range of 0 to Block_H and a column range of 0 to Block_W in the input matrix, when the fill width is r, the matrix block to be read occupies a row range of 0 to Block_H+r and a column range of 0 to Block_W+r in the input matrix.

[0065] Optionally, for the second position type, taking the top middle type as an example, if the initial matrix block occupies a row range of 0 to Block_H and a column range of Block_W to 2×Block_W in the input matrix, when the fill width is r, the matrix block to be read occupies a row range of 0 to Block_H+r and a column range of Block_W-r to 2×Block_W+r in the input matrix.

[0066] Optionally, for the third position type, if the initial matrix block occupies a row range of Block_H to 2×Block_H and a column range of Block_W to 2×Block_W in the input matrix, when the padding width is r, the matrix block to be read occupies a row range of Block_H-r to 2×Block_H+r and a column range of Block_W-r to 2×Block_W+r in the input matrix.

[0067] S240. Based on the padding width and the missing boundary direction of the matrix block to be read, determine the write position of the matrix block to be read and the reserved position in the missing boundary direction in the local cache space, and execute the write operation and boundary padding operation of the matrix block to be read in sequence according to the write position and the reserved position to generate the extended matrix for calculation.

[0068] Specifically, based on the padding width and the missing boundary direction of the matrix block to be read, the write position of the matrix block to be read and the reserved position in the missing boundary direction are determined in the local cache space. Then, based on the write position and the reserved position, the write operation and boundary padding operation of the matrix block to be read are executed sequentially to generate an expanded matrix for calculation. This process may include: If the target location type is a first location type or a second location type, the size of the reserved space in each missing boundary direction is determined according to the fill width, and the size of the expanded matrix is ​​determined according to the matrix block to be read and the size of the reserved space in each missing boundary direction; The expansion matrix storage area is determined in the local cache space according to the expansion matrix size, and the write position of the matrix block to be read and the reserved position in the missing boundary direction are determined in the expansion matrix storage area according to the reserved space size in each missing boundary direction and the size of the matrix block to be read. The matrix block to be read is written to the write position, and the reserved position is filled with boundary to generate the expanded matrix.

[0069] Optionally, the reserved space size refers to the number of matrix rows and columns contained in the reserved position corresponding to the missing boundary direction.

[0070] Optionally, if Block_H represents the number of rows in the initial matrix block, Block_W represents the number of columns in the initial matrix block, and r represents the padding width, then the number of rows in the expanded matrix is ​​Block_H+2r, and the number of columns in the expanded matrix is ​​Block_W+2r.

[0071] Optionally, the extended matrix storage area refers to a contiguous or row-organized storage area allocated in the local cache space for the extended matrix. In order to adapt to extended matrices of different sizes, a large storage space can be pre-allocated in the local cache space to store the extended matrix generated in each convolution calculation. In each convolution calculation, based on the size of the extended matrix determined this time, the extended matrix storage area for storing the currently generated extended matrix is ​​determined in the pre-allocated storage space.

[0072] Optionally, the write location of the matrix block to be read and the reserved location in the direction of the missing boundary can jointly cover the expanded matrix storage area.

[0073] Figure 4 This is a schematic diagram illustrating an optional expansion of the initial matrix block of the top-left corner type in the first position type. For example... Figure 4 As shown in the matrix on the left, if the input matrix is ​​divided into 16 blocks arranged in a 4×4 pattern, B11 is the initial matrix block in the upper left corner. The upper and left boundaries of this initial matrix block coincide with the global boundary of the input matrix. Therefore, its missing boundary direction is the upper and left boundaries. Furthermore, the fill width expands into the input matrix along the right and lower boundaries, which do not coincide with the global boundary. Figure 4 The region covered by dense points in the left-hand matrix, along with the initial matrix block B11, is used as the matrix block to be read.

[0074] After determining the matrix block to be read, write the matrix block to be read as follows: Figure 4In the expanded matrix storage area shown on the right, it can be seen that after the matrix block to be read is written, the areas represented by the diagonal shading on the upper and left boundaries are the reserved positions in the direction of the missing boundary. The width between the upper boundary of the expanded matrix storage area and the upper boundary of the matrix block to be read is equal to the padding width, and the width between the left boundary of the expanded matrix storage area and the left boundary of the matrix block to be read is also equal to the padding width. Figure 4 The fill width is represented by r. After determining the reserved position, the reserved position can be expanded.

[0075] Figure 5 This is a schematic diagram illustrating an optional expansion of the initial matrix block of the top middle type in the second positional type. For example... Figure 5 As shown in the matrix on the left, if the input matrix is ​​divided into 16 blocks arranged in a 4×4 pattern, B12 is the initial matrix block of the top middle type. The upper boundary of this initial matrix block coincides with the global boundary of the input matrix. Therefore, its missing boundary direction is the upper boundary, and then the fill width is extended into the input matrix along the left, right, and lower boundaries that do not coincide with the global boundary, that is, ... Figure 5 The region covered by dense points in the left-hand matrix, along with the initial matrix block B12, is used as the matrix block to be read.

[0076] After determining the matrix block to be read, write the matrix block to be read as follows: Figure 5 As shown in the expanded matrix storage area on the right, after the matrix block to be read is written, the area represented by the diagonal shading on its upper boundary is the reserved position in the direction of the missing boundary. The width between the upper boundary of the expanded matrix storage area and the upper boundary of the matrix block to be read is equal to the fill width. After determining the reserved position, the reserved position can be expanded.

[0077] The process includes determining the write position and reserved position along the missing boundary direction of the matrix block to be read in the local cache space based on the padding width and the missing boundary direction of the matrix block to be read. Then, based on the write position and the reserved position, the write operation and boundary padding operation of the matrix block to be read are executed sequentially to generate an expanded matrix for calculation. This process may further include: If the target location type is a third location type, then an extended matrix storage area is determined in the local cache space according to the size of the matrix block to be read; The matrix block to be read is written into the extended matrix storage area, and the written matrix block to be read is determined as the extended matrix.

[0078] Figure 6This is a schematic diagram illustrating an optional approach to expanding an initial matrix of a third position type. For example... Figure 6 As shown in the matrix on the left, if the input matrix is ​​divided into 16 blocks arranged in a 4×4 pattern, B22 is the initial matrix block of the third position type. This initial matrix block has no edges that coincide with the global boundary, therefore, it has no missing boundary directions. Consequently, the fill width expands into the input matrix along the four boundary directions, that is... Figure 6 The region covered by dense points in the left-hand matrix, along with the region covered by the dense points in the initial matrix block B22, is used as the matrix block to be read.

[0079] After determining the matrix block to be read, write the matrix block to be read as follows: Figure 6 In the expanded matrix storage area shown on the right, since the matrix block to be read does not need to be expanded in this case, it can be written directly without any expansion operation.

[0080] S250. Perform convolution calculation based on the convolution kernel matrix and the expansion matrix, and write the calculation result to the corresponding position in the result storage area.

[0081] The technical solution of this invention determines the initial matrix block to be processed by the computing core in the input matrix, and determines the target position type of the initial matrix block according to the preset position type division rules; determines the matrix block to be read in the input matrix according to the initial matrix block, the target position type, and the padding width, and determines the missing boundary direction of the matrix block to be read; determines the write position of the matrix block to be read and the reserved position in the missing boundary direction in the local cache space according to the padding width and the missing boundary direction of the matrix block to be read, and sequentially performs the write operation and boundary padding operation of the matrix block to be read according to the write position and the reserved position to generate an expanded matrix for calculation; performs convolution calculation according to the convolution kernel matrix and the expanded matrix, and writes the calculation result to the corresponding position in the result storage area, so that the global memory only stores the original input matrix and does not need to save the global padding matrix, effectively avoiding the memory overflow problem of ultra-large-scale matrices. Each computing core only reads the minimum original data range required for its own calculation, and there is no redundant boundary data repeated transmission, which greatly alleviates the memory bandwidth bottleneck. Each computing core performs padding and calculation completely independently, without the time dependence of global padding, and has strong versatility.

[0082] Example 3 Figure 7 This is a schematic diagram of the structure of a large-scale matrix convolution calculation device provided in Embodiment 3 of the present invention. Figure 7 As shown, the device includes: a position type determination module 310, a matrix analysis module 320, a boundary expansion module 330, and a convolution calculation module 340.

[0083] The position type determination module 310 is used to determine the initial matrix block to be processed by the computing core in the input matrix, and to determine the target position type to which the initial matrix block belongs according to the preset position type division rules.

[0084] The matrix analysis module 320 is used to determine the matrix block to be read in the input matrix based on the initial matrix block, the target position type, and the fill width, and to determine the missing boundary direction of the matrix block to be read.

[0085] The boundary expansion module 330 is used to determine the write position of the matrix block to be read and the reserved position in the missing boundary direction in the local cache space according to the filling width and the missing boundary direction of the matrix block to be read, and to sequentially execute the write operation and boundary filling operation of the matrix block to be read according to the write position and the reserved position to generate an expansion matrix for calculation.

[0086] The convolution calculation module 340 is used to perform convolution calculations based on the convolution kernel matrix and the expansion matrix, and write the calculation results to the corresponding positions in the result storage area.

[0087] The technical solution of this invention determines the initial matrix block to be processed by the computing core in the input matrix, and determines the target position type of the initial matrix block according to the preset position type division rules; determines the matrix block to be read in the input matrix according to the initial matrix block, the target position type, and the padding width, and determines the missing boundary direction of the matrix block to be read; determines the write position of the matrix block to be read and the reserved position in the missing boundary direction in the local cache space according to the padding width and the missing boundary direction of the matrix block to be read, and sequentially performs the write operation and boundary padding operation of the matrix block to be read according to the write position and the reserved position to generate an expanded matrix for calculation; performs convolution calculation according to the convolution kernel matrix and the expanded matrix, and writes the calculation result to the corresponding position in the result storage area, so that the global memory only stores the original input matrix and does not need to save the global padding matrix, effectively avoiding the memory overflow problem of ultra-large-scale matrices. Each computing core only reads the minimum original data range required for its own calculation, and there is no redundant boundary data repeated transmission, which greatly alleviates the memory bandwidth bottleneck. Each computing core performs padding and calculation completely independently, without the time dependence of global padding, and has strong versatility.

[0088] Based on the above embodiments, the location type determination module 310 may include: An initial matrix block positioning unit is used to determine the initial matrix block to be processed in the input matrix according to the block configuration information pre-loaded in the computing core; wherein, the block configuration information includes the starting address of the initial matrix block, the size of the initial matrix block, and the size of the input matrix; Each computing core can determine at least one initial matrix block, and the initial matrix blocks corresponding to each computing core do not overlap with each other and together cover the input matrix; The boundary recognition unit is used to determine whether the upper boundary, lower boundary, left boundary and right boundary of the initial matrix block coincide with the global boundary of the input matrix, and to determine the target location type to which the initial matrix block belongs based on the judgment result and the location type division rule.

[0089] Based on the above embodiments, the boundary recognition unit can be specifically used for: If the initial matrix block has two adjacent boundaries that coincide with the global boundary of the input matrix, then the target location type to which the initial matrix block belongs is determined to be the first location type; If the initial matrix block has a boundary that coincides with the global boundary of the input matrix, then the target position type to which the initial matrix block belongs is determined to be the second position type. If the initial matrix block does not have a boundary that coincides with the global boundary of the input matrix, then the target position type to which the initial matrix block belongs is determined to be the third position type.

[0090] Based on the above embodiments, the matrix analysis module 320 can be used to perform any of the following: If the target location type is the first location type, then based on the initial matrix block, the fill width is extended into the interior of the input matrix along the directions corresponding to the two boundaries that do not coincide with the global boundary of the input matrix. The initial matrix block and the extended matrix region are jointly determined as the matrix block to be read, and the directions corresponding to the two boundaries that coincide with the global boundary of the input matrix are determined as the missing boundary directions. If the target location type is the second location type, then based on the initial matrix block, the fill width is extended into the interior of the input matrix along the directions corresponding to the three boundaries that do not coincide with the global boundary of the input matrix. The initial matrix block and the extended matrix region are jointly determined as the matrix block to be read, and the direction corresponding to the boundary of the initial matrix block that coincides with the global boundary of the input matrix is ​​determined as the missing boundary direction. If the target location type is the third location type, then based on the initial matrix block, the fill width is extended along the upper boundary direction, lower boundary direction, left boundary direction and right boundary direction respectively, and the initial matrix block and the extended matrix region are jointly determined as the matrix block to be read, and it is determined that the matrix block to be read does not have a missing boundary direction.

[0091] Based on the above embodiments, the first position type includes top left corner type, bottom left corner type, top right corner type and bottom right corner type; The second position type includes top center type, bottom center type, left center type, and right center type; The third location type includes the internal region type.

[0092] Based on the above embodiments, the boundary expansion module 330 can be specifically used for: If the target location type is a first location type or a second location type, the size of the reserved space in each missing boundary direction is determined according to the fill width, and the size of the expanded matrix is ​​determined according to the matrix block to be read and the size of the reserved space in each missing boundary direction; The expansion matrix storage area is determined in the local cache space according to the expansion matrix size, and the write position of the matrix block to be read and the reserved position in the missing boundary direction are determined in the expansion matrix storage area according to the reserved space size in each missing boundary direction and the size of the matrix block to be read. The matrix block to be read is written to the write position, and the reserved position is filled with boundary to generate the expanded matrix.

[0093] Based on the above embodiments, the boundary expansion module 330 can also be specifically used for: If the target location type is a third location type, then an extended matrix storage area is determined in the local cache space according to the size of the matrix block to be read; The matrix block to be read is written into the extended matrix storage area, and the written matrix block to be read is determined as the extended matrix.

[0094] The large-scale matrix convolution calculation device provided in the embodiments of the present invention can execute the large-scale matrix convolution calculation method provided in any embodiment of the present invention, and has the corresponding functional modules and beneficial effects of the execution method.

[0095] Example 4 Figure 8A schematic diagram of an electronic device 10, which can be used to implement embodiments of the present invention, is shown. The electronic device is intended to represent various forms of digital computers, such as laptop computers, desktop computers, workstations, personal digital assistants, servers, blade servers, mainframe computers, and other suitable computers. The electronic device can also represent various forms of mobile devices, such as personal digital processors, cellular phones, smartphones, wearable devices (e.g., helmets, glasses, watches, etc.), and other similar computing devices. The components shown herein, their connections and relationships, and their functions are merely illustrative and are not intended to limit the implementation of the invention described and / or claimed herein.

[0096] like Figure 8 As shown, the electronic device 10 includes at least one processor 11 and a memory, such as a read-only memory (ROM) 12 or a random access memory (RAM) 13, communicatively connected to the at least one processor 11. The memory stores computer programs executable by the at least one processor. The processor 11 can perform various appropriate actions and processes based on the computer program stored in the ROM 12 or loaded from storage unit 18 into the RAM 13. The RAM 13 can also store various programs and data required for the operation of the electronic device 10. The processor 11, ROM 12, and RAM 13 are interconnected via a bus 14. An input / output (I / O) interface 15 is also connected to the bus 14.

[0097] Multiple components in electronic device 10 are connected to I / O interface 15, including: input unit 16, such as keyboard, mouse, etc.; output unit 17, such as various types of displays, speakers, etc.; storage unit 18, such as disk, optical disk, etc.; and communication unit 19, such as network card, modem, wireless transceiver, etc. Communication unit 19 allows electronic device 10 to exchange information / data with other devices through computer networks such as the Internet and / or various telecommunications networks.

[0098] Processor 11 can be various general-purpose and / or special-purpose processing components with processing and computing capabilities. Some examples of processor 11 include, but are not limited to, central processing unit (CPU), graphics processing unit (GPU), various special-purpose artificial intelligence (AI) computing chips, various processors running machine learning model algorithms, digital signal processors (DSPs), and any suitable processor, controller, microcontroller, etc. Processor 11 performs the various methods and processes described above, such as the large-scale matrix convolution calculation method described in the embodiments of the present invention. That is: The initial matrix block to be processed by the computing core is determined in the input matrix, and the target position type to which the initial matrix block belongs is determined according to the preset position type division rules; Based on the initial matrix block division, the target position type, and the padding width, determine the matrix block to be read in the input matrix, and determine the missing boundary direction of the matrix block to be read; Based on the padding width and the missing boundary direction of the matrix block to be read, the write position of the matrix block to be read and the reserved position in the missing boundary direction are determined in the local cache space. Based on the write position and the reserved position, the write operation and boundary padding operation of the matrix block to be read are executed in sequence to generate an expanded matrix for calculation. Convolution is performed based on the kernel matrix and the augmented matrix, and the calculation result is written to the corresponding position in the result storage area.

[0099] In some embodiments, the method for calculating the convolution of large-scale matrices can be implemented as a computer program tangibly contained in a computer-readable storage medium, such as storage unit 18. In some embodiments, part or all of the computer program can be loaded and / or mounted on electronic device 10 via ROM 12 and / or communication unit 19. When the computer program is loaded into RAM 13 and executed by processor 11, one or more steps of the method for calculating the convolution of large-scale matrices described above can be performed. Alternatively, in other embodiments, processor 11 can be configured to perform the method for calculating the convolution of large-scale matrices by any other suitable means (e.g., by means of firmware).

[0100] Various embodiments of the systems and techniques described above herein can be implemented in digital electronic circuit systems, integrated circuit systems, field-programmable gate arrays (FPGAs), application-specific integrated circuits (ASICs), application-specific standard products (ASSPs), system-on-a-chip (SoCs), complex programmable logic devices (CPLDs), computer hardware, firmware, software, and / or combinations thereof. These various embodiments may include implementations in one or more computer programs that can be executed and / or interpreted on a programmable system including at least one programmable processor, which may be a dedicated or general-purpose programmable processor, capable of receiving data and instructions from a storage system, at least one input device, and at least one output device, and transmitting data and instructions to the storage system, the at least one input device, and the at least one output device.

[0101] Computer programs used to implement the methods of the present invention may be written in any combination of one or more programming languages. These computer programs may be provided to a processor of a general-purpose computer, a special-purpose computer, or other programmable data processing device, such that when executed by the processor, the computer programs cause the functions / operations specified in the flowcharts and / or block diagrams to be performed. The computer programs may be executed entirely on a machine, partially on a machine, or as a standalone software package, partially on a machine and partially on a remote machine, or entirely on a remote machine or server.

[0102] In the context of this invention, a computer-readable storage medium can be a tangible medium that may contain or store a computer program for use by or in conjunction with an instruction execution system, apparatus, or device. A computer-readable storage medium may include, but is not limited to, electronic, magnetic, optical, electromagnetic, infrared, or semiconductor systems, apparatus, or devices, or any suitable combination thereof. Alternatively, a computer-readable storage medium may be a machine-readable signal medium. More specific examples of machine-readable storage media include electrical connections based on one or more wires, portable computer disks, hard disks, random access memory (RAM), read-only memory (ROM), erasable programmable read-only memory (EPROM or flash memory), optical fibers, portable compact disk read-only memory (CD-ROM), optical storage devices, magnetic storage devices, or any suitable combination thereof.

[0103] To provide interaction with a user, the systems and techniques described herein can be implemented on an electronic device having: a display device (e.g., a CRT (cathode ray tube) or LCD (liquid crystal display) monitor) for displaying information to the user; and a keyboard and pointing device (e.g., a mouse or trackball) through which the user provides input to the electronic device. Other types of devices can also be used to provide interaction with the user; for example, feedback provided to the user can be any form of sensory feedback (e.g., visual feedback, auditory feedback, or tactile feedback); and input from the user can be received in any form (including sound input, voice input, or tactile input).

[0104] The systems and technologies described herein can be implemented in computing systems that include backend components (e.g., as data servers), or middleware components (e.g., application servers), or frontend components (e.g., user computers with graphical user interfaces or web browsers through which users can interact with implementations of the systems and technologies described herein), or any combination of such backend, middleware, or frontend components. The components of the system can be interconnected via digital data communication of any form or medium (e.g., communication networks). Examples of communication networks include local area networks (LANs), wide area networks (WANs), blockchain networks, and the Internet.

[0105] A computing system can include clients and servers. Clients and servers are generally located far apart and typically interact through communication networks. The client-server relationship is created by computer programs running on the respective computers and having a client-server relationship with each other. The server can be a cloud server, also known as a cloud computing server or cloud host, which is a hosting product within the cloud computing service system to address the shortcomings of traditional physical hosts and VPS services, such as high management difficulty and weak business scalability.

[0106] It should be understood that the various forms of processes shown above can be used, with steps reordered, added, or deleted. For example, the steps described in this invention can be executed in parallel, sequentially, or in different orders, as long as the desired result of the technical solution of this invention can be achieved, and this is not limited herein.

[0107] The specific embodiments described above do not constitute a limitation on the scope of protection of this invention. Those skilled in the art should understand that various modifications, combinations, sub-combinations, and substitutions can be made according to design requirements and other factors. Any modifications, equivalent substitutions, and improvements made within the spirit and principles of this invention should be included within the scope of protection of this invention.

Claims

1. A method for convolution calculation of large-scale matrices, executed in parallel by multiple computing cores in a parallel computing device, characterized in that, include: The initial matrix block to be processed by the computing core is determined in the input matrix, and the target position type to which the initial matrix block belongs is determined according to the preset position type division rules; Based on the initial matrix block division, the target position type, and the padding width, determine the matrix block to be read in the input matrix, and determine the missing boundary direction of the matrix block to be read; Based on the padding width and the missing boundary direction of the matrix block to be read, the write position of the matrix block to be read and the reserved position in the missing boundary direction are determined in the local cache space. Based on the write position and the reserved position, the write operation and boundary padding operation of the matrix block to be read are executed in sequence to generate an expanded matrix for calculation. Convolution is performed based on the kernel matrix and the augmented matrix, and the calculation result is written to the corresponding position in the result storage area.

2. The method according to claim 1, characterized in that, The initial matrix block to be processed by the computational core is determined in the input matrix, and the target position type to which the initial matrix block belongs is determined according to a preset position type division rule, including: Based on the pre-loaded block configuration information in the computing core, the initial matrix block to be processed is determined in the input matrix; wherein, the block configuration information includes the starting address of the initial matrix block, the size of the initial matrix block, and the size of the input matrix; Each computing core can determine at least one initial matrix block, and the initial matrix blocks corresponding to each computing core do not overlap with each other and together cover the input matrix; Determine whether the upper, lower, left, and right boundaries of the initial matrix block coincide with the global boundary of the input matrix, and determine the target position type to which the initial matrix block belongs based on the determination result and the position type division rule.

3. The method according to claim 2, characterized in that, Determine whether the upper, lower, left, and right boundaries of the initial matrix block coincide with the global boundary of the input matrix, and determine the target position type to which the initial matrix block belongs based on the determination result and the position type classification rule, including any one of the following: If the initial matrix block has two adjacent boundaries that coincide with the global boundary of the input matrix, then the target location type to which the initial matrix block belongs is determined to be the first location type; If the initial matrix block has a boundary that coincides with the global boundary of the input matrix, then the target position type to which the initial matrix block belongs is determined to be the second position type. If the initial matrix block does not have a boundary that coincides with the global boundary of the input matrix, then the target position type to which the initial matrix block belongs is determined to be the third position type.

4. The method according to claim 3, characterized in that, Based on the initial matrix block division, the target position type, and the padding width, determine the matrix block to be read in the input matrix, and determine the missing boundary direction of the matrix block to be read, including any of the following: If the target location type is the first location type, then based on the initial matrix block, the fill width is extended into the interior of the input matrix along the directions corresponding to the two boundaries that do not coincide with the global boundary of the input matrix. The initial matrix block and the extended matrix region are jointly determined as the matrix block to be read, and the directions corresponding to the two boundaries that coincide with the global boundary of the input matrix are determined as the missing boundary directions. If the target location type is the second location type, then based on the initial matrix block, the fill width is extended into the interior of the input matrix along the directions corresponding to the three boundaries that do not coincide with the global boundary of the input matrix. The initial matrix block and the extended matrix region are jointly determined as the matrix block to be read, and the direction corresponding to the boundary of the initial matrix block that coincides with the global boundary of the input matrix is ​​determined as the missing boundary direction. If the target location type is the third location type, then based on the initial matrix block, the fill width is extended along the upper boundary direction, lower boundary direction, left boundary direction and right boundary direction respectively, and the initial matrix block and the extended matrix region are jointly determined as the matrix block to be read, and it is determined that the matrix block to be read does not have a missing boundary direction.

5. The method according to claim 3, characterized in that, The first position type includes top left corner, bottom left corner, top right corner, and bottom right corner; The second position type includes top center type, bottom center type, left center type, and right center type; The third location type includes the internal region type.

6. The method according to claim 4, characterized in that, Based on the padding width and the missing boundary direction of the matrix block to be read, the write position of the matrix block to be read and the reserved position in the missing boundary direction are determined in the local cache space. Then, based on the write position and the reserved position, the write operation and boundary padding operation of the matrix block to be read are executed sequentially to generate an expanded matrix for calculation, including: If the target location type is a first location type or a second location type, the size of the reserved space in each missing boundary direction is determined according to the fill width, and the size of the expanded matrix is ​​determined according to the matrix block to be read and the size of the reserved space in each missing boundary direction; The expansion matrix storage area is determined in the local cache space according to the expansion matrix size, and the write position of the matrix block to be read and the reserved position in the missing boundary direction are determined in the expansion matrix storage area according to the reserved space size in each missing boundary direction and the size of the matrix block to be read. The matrix block to be read is written to the write position, and the reserved position is filled with boundary to generate the expanded matrix.

7. The method according to claim 4, characterized in that, Based on the padding width and the missing boundary direction of the matrix block to be read, the write position of the matrix block to be read and the reserved position in the missing boundary direction are determined in the local cache space. Then, based on the write position and the reserved position, the write operation and boundary padding operation of the matrix block to be read are executed sequentially to generate an expanded matrix for calculation. The method also includes: If the target location type is a third location type, then an extended matrix storage area is determined in the local cache space according to the size of the matrix block to be read; The matrix block to be read is written into the extended matrix storage area, and the written matrix block to be read is determined as the extended matrix.

8. A convolution calculation device for large-scale matrices, executed in parallel by multiple computing cores in a parallel computing device, characterized in that, include: The location type determination module is used to determine the initial matrix block to be processed by the computing core in the input matrix, and to determine the target location type to which the initial matrix block belongs according to the preset location type division rules; The matrix analysis module is used to determine the matrix block to be read in the input matrix based on the initial matrix block, the target position type, and the padding width, and to determine the missing boundary direction of the matrix block to be read; The boundary expansion module is used to determine the write position of the matrix block to be read and the reserved position in the missing boundary direction in the local cache space according to the filling width and the missing boundary direction of the matrix block to be read, and to execute the write operation and boundary filling operation of the matrix block to be read in sequence according to the write position and the reserved position to generate an expansion matrix for calculation. The convolution calculation module is used to perform convolution calculations based on the convolution kernel matrix and the expanded matrix, and write the calculation results to the corresponding positions in the result storage area.

9. An electronic device, characterized in that, The electronic device includes: At least one processor; and A memory communicatively connected to the at least one processor; wherein, The memory stores a computer program that can be executed by the at least one processor, the computer program being executed by the at least one processor to enable the at least one processor to perform the convolution calculation method for a large-scale matrix as described in any one of claims 1-7.

10. A computer-readable storage medium, characterized in that, The computer-readable storage medium stores computer instructions that cause a processor to execute the method for calculating the convolution of a large-scale matrix as described in any one of claims 1-7.