Method, computing device, medium and program product for performing continuous near-memory computing
By configuring a sub-buffer in the register, selectively reading data from the sub-buffer or static random access memory and updating the results, the problems of high delay and unused bandwidth in traditional methods are solved, and the calculation efficiency and efficiency are improved. Conflicts are reduced and efficient continuous near-memory computing is achieved.
Patent Information
- Application Number
- CN202410653045.2
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2024-05-24
- Publication Date
- 2024-08-23
- Estimated Expiration
- 2044-05-24
AI Technical Summary
The traditional method of performing continuous near-memory computing has the problem of high latency and insufficient utilization of computing unit bandwidth. In particular, the operation latency of static random access memory and data risks on the data path lead to long computing delays and easy A memory bank conflict occurs.
By configuring a sub-cache in the cache, the source data is selected to be read from the sub-cache and the static random access memory according to the calculation request, directly input into the computing unit for calculation, and the results are updated to the sub-cache, avoiding all The need to read data from SRAM reduces latency and collision probability.
It significantly improves the speed of continuous near-memory calculations at the same address, improves the efficiency of the computing unit, reduces conflicts with other requests, reduces memory access delays, and makes full use of the bandwidth of the computing unit.
Smart Images

Figure CN118276943B
Abstract
Description
Technical Field
[0001] Embodiments of the present invention generally relate to the field of artificial intelligence computing, and more specifically to a method, computing device, computer-readable storage medium, and computer program product for performing continuous near-memory computing. Background Art
[0002] In vector or Single Instruction Multiple Data (SIMD) parallel processors, computing modules are added near the memory to achieve parallel computing near the memory, thereby reducing the delay caused by memory access.
[0003] In the traditional method of performing continuous near-memory calculations, the processor sends multiple calculate requests for the same address in order to complete multiple calculations on the same address. In near-memory operations, calculation is a "read-modify-write" operation. Due to the operation latency of the static random-access memory (SRAM) and the data hazards on the data path, the calculation must wait until the previous calculation result is completely written to the SRAM before the next "read-update-write" operation can be performed. As a result, the delay during calculation is very high and the bandwidth of the calculation unit (for example, the arithmetic logic unit, referred to as "ALU") is not fully utilized.
[0004] In summary, the traditional method for performing continuous near-memory calculations has the following shortcomings: the delay during calculation is very high and the bandwidth of the computing unit is not fully utilized. Summary of the invention
[0005] The present invention provides a method, a computing device, a computer-readable storage medium and a computer program product for performing continuous near-memory computing, which can effectively reduce the delay during computing and improve the utilization efficiency of the computing unit.
[0006] According to a first aspect of the present invention, a method for performing continuous near-memory computing is provided. The method comprises: configuring a sub-cache in a cache; determining to read source data required for the computing request from one of the sub-cache and a static random access memory based at least on a computing request; inputting the read source data into a computing unit to perform the computing associated with the computing request, thereby generating a computing result; and updating the computing result into the sub-cache.
[0007] According to a second aspect of the present invention, a computing device is also provided. The computing device comprises: at least one processor; and a memory in communication connection with the at least one processor; wherein the memory stores instructions executable by the at least one processor, and the instructions are executed by the at least one processor so that the computing device can perform the method of the first aspect of the present invention.
[0008] According to a third aspect of the present invention, a computer-readable storage medium is provided, wherein a computer program is stored on the computer-readable storage medium, and when the computer program is executed by a machine, the method of the first aspect of the present invention is executed.
[0009] According to a fourth aspect of the present invention, there is further provided a computer program product, comprising a computer program, wherein when the computer program is executed by a machine, the method of the first aspect of the present invention is performed.
[0010] In some embodiments, at least based on the computing request, determining whether to read source data required for the computing request from one of a sub-cache and a static random access memory includes: determining whether the source data required for the current computing request exists in the sub-cache or in the pipeline before the current computing request enters the pipeline; in response to determining that the source data required for the current computing request exists in the sub-cache or the pipeline, reading the source data required for the current computing request from the sub-cache; and in response to determining that the source data required for the current computing request does not exist in either the sub-cache or the pipeline, reading the source data required for the current computing request from the static random access memory.
[0011] In some embodiments, at least based on the computation request, determining to read source data required for the computation request from one of a sub-cache and a static random access memory includes: determining, via an arbitration module, whether there is a target address of a computation result with the same address related to the current computation request in an address table before the current computation request enters the pipeline, the address table being associated with the sub-cache, and the address table being configured in the arbitration module.
[0012] In some embodiments, based at least on the computation request, determining to read source data required for the computation request from one of a sub-cache and a static random access memory also includes: in response to determining via an arbitration module that there is a target address in an address table with a same-address computation result associated with the current computation request, allowing the source data required for the current computation request to be provided to the pipeline; and determining to read the source data required for the current computation request from the sub-cache.
[0013] In some embodiments, based at least on the computation request, determining to read source data required for the computation request from one of a sub-cache and a static random access memory includes: determining whether there is a related operation on the pipeline in response to determining via an arbitration module that there is no target address in the address table that has the same address calculation result as the current computation request; in response to determining that there is a related operation on the pipeline, allowing the source data required for the current computation request to be provided to the pipeline after the calculation result of the related operation is written to the static random access memory; and determining to read the source data required for the current computation request from the static random access memory.
[0014] In some embodiments, the method for performing continuous near-memory calculations also includes: in response to a calculation request being submitted to an arbitration module, configuring a target address of a same-address calculation result related to the calculation request in an address table, the address table being associated with a sub-cache, and the address table being configured in the arbitration module.
[0015] In some embodiments, configuring the target address of the same-address calculation result associated with the calculation request in the address table includes: updating the flag address in the address table to the target address of the same-address calculation result associated with the calculation request, and the flag address in the address table corresponds to the address in the static random access memory.
[0016] In some embodiments, the method for performing continuous near-memory calculations further includes: updating the calculation results into the static random access memory while updating the calculation results into the sub-cache.
[0017] In some embodiments, the sub-cache is a fully associative cache in write-through mode, the width of each buffer row included in the sub-cache matches the width of the calculation result of the computing unit, and the depth of the buffer rows in the sub-cache does not exceed the depth of the pipeline.
[0018] In some embodiments, the method for performing continuous near-memory calculations also includes: configuring a first pipeline for calculations of a first calculation unit, and configuring a second pipeline for calculations of a second calculation unit; in a current cycle, the first arbitration module determines, based on an address table and a first calculation request, to read source data required for the first calculation request from a sub-cache to input into the first calculation unit for calculation, wherein the address table is shared by the first pipeline and the first pipeline; in the current cycle, the second arbitration module determines, based on the address table and the second calculation request, to read source data required for the second calculation request from a static random access memory to input into the second calculation unit for calculation; and writing the calculation results of the first calculation unit and the calculation results of the second calculation unit into the sub-cache respectively.
[0019] It should be understood that the contents described in this section are not intended to identify the key or important features of the embodiments of the present invention, nor are they intended to limit the scope of the present invention. Other features of the present invention will become easily understood through the following description. BRIEF DESCRIPTION OF THE DRAWINGS
[0020] The above and other features, advantages and aspects of the embodiments of the present invention will become more apparent with reference to the following detailed description in conjunction with the accompanying drawings. In the accompanying drawings, the same or similar reference numerals represent the same or similar elements.
[0021] Figure 1 A schematic diagram of a computing device implementing a method for performing continuous near-memory computing according to an embodiment of the present invention is schematically shown.
[0022] Figure 2 A flow chart of a method for performing continuous near-memory computing according to an embodiment of the present invention is shown.
[0023] Figure 3 A schematic diagram of a method for performing continuous near-memory computing according to an embodiment of the present invention is shown.
[0024] Figure 4 A flow chart of a method for determining source data required for reading a computing request from one of a sub-cache and a static random access memory according to an embodiment of the present invention is shown.
[0025] Figure 5 A schematic diagram of a method for determining source data required for reading a computing request from one of a sub-cache and a static random access memory according to an embodiment of the present invention is shown.
[0026] Figure 6 A schematic diagram of a sub-buffer according to an embodiment of the present invention is shown.
[0027] Figure 7 A flow chart of a method for performing continuous near-memory computation according to some embodiments of the present invention is shown.
[0028] In the various drawings, the same or corresponding reference numerals represent the same or corresponding parts. DETAILED DESCRIPTION
[0029] The preferred embodiments of the present invention will be described in more detail below with reference to the accompanying drawings. Although the preferred embodiments of the present invention are shown in the accompanying drawings, it should be understood that the present invention can be implemented in various forms and should not be limited by the embodiments set forth herein. On the contrary, these embodiments are provided to make the present invention more thorough and complete, and to fully convey the scope of the present invention to those skilled in the art.
[0030] As used herein, the term "including" and its variations mean open inclusion, i.e., "including but not limited to". Unless otherwise stated, the term "or" means "and / or". The term "based on" means "based at least in part on". The terms "an example embodiment" and "an embodiment" mean "at least one example embodiment". The term "another embodiment" means "at least one additional embodiment". The terms "first", "second", etc. may refer to different or the same objects.
[0031] As described above, in the traditional method of performing continuous near-memory calculations, the processor sends multiple calculation requests for the same address in order to complete the function of multiple same-address calculations. In near-memory operations, when a calculation request is detected, for example, the source data in the SRAM is read out based on a read request; then written into the calculation unit (e.g., ALU); after the calculation unit completes the calculation, the calculation result is updated in the SRAM. That is, the "read-update-write" operation is completed. For multiple same-address calculations, due to the read / write delay and the risk on the data path, it is necessary to wait until the previous calculation result is completely written to the SRAM before the next "read-update-write" operation can be performed. For example, if the calculation of A+B+C is performed, after receiving the calculation request, A and B are first read from the SRAM to input into the ALU, and after the ALU completes the calculation of A+B, the calculation result of A+B is written into the SRAM. Since the ALU can only perform one calculation each time, when performing the calculation of A+B+C, it is also necessary to read the calculation results of A+B and C from the SRAM in order to input them into the ALU. After the ALU completes the calculation of A+B+C, the calculation results of A+B+C are written into the SRAM. It can be seen that the traditional method of performing continuous near-memory calculations will cause excessive calculation delays for consecutive identical addresses and fail to fully utilize the bandwidth of the computing unit. In addition, each calculation request needs to access the SRAM once during read / write, that is, it occupies double the SRAM bandwidth and is prone to bank conflicts with other requests. Therefore, the traditional method for performing continuous near-memory calculations has the following shortcomings: the delay during calculation is very high, the bandwidth of the computing unit is not fully utilized, and bank conflicts are prone to occur.
[0032] In order to at least partially solve one or more of the above problems and other potential problems, an exemplary embodiment of the present invention proposes a method for performing continuous near-memory calculations. In this method, by configuring a sub-cache in a cache; and at least based on a calculation request, determining to read the source data required for the calculation request from one of the sub-cache and the static random access memory; thereby at least partially using a sub-cache with a low latency characteristic to read the source data required for the calculation request to input into the calculation unit, and storing the relevant calculation results of the calculation request, the present invention does not need to read all the source data required for the calculation request from the SRAM, therefore, it can significantly improve the speed of continuous near-memory calculations of the same address, improve the efficiency of the calculation unit, and reduce conflicts with other requests.
[0033] Figure 1 A schematic diagram of a computing device 100 for implementing a method for performing continuous near-memory computing according to an embodiment of the present invention is shown schematically. Figure 1 As shown, the computing device 100 may have one or more processing units, including special processing units such as a graphics processing unit (GPU), a field programmable gate array (FPGA), an application-specific integrated circuit (ASIC), a general-purpose graphics processing unit (GPGPU), etc., and a general-purpose processing unit such as a CPU. The computing device 100 also includes at least: a sub-cache configuration unit 102, a source data reading unit 104 required for a computing request, a computing result generation unit 106, and a sub-cache update unit 108.
[0034] The sub-buffer configuration unit 102 is used to configure sub-buffers in a buffer.
[0035] The source data reading unit 104 required for the computing request is used to determine, based at least on the computing request, to read the source data required for the computing request from one of the sub-cache and the static random access memory.
[0036] The calculation result generating unit 106 is used to input the read source data into the calculation unit so as to perform the calculation associated with the calculation request, thereby generating a calculation result.
[0037] The sub-buffer updating unit 108 is used to update the calculation result into the sub-buffer.
[0038] The following will be combined Figure 2 , Figure 3 and Figure 6 A method 200 for performing continuous near-memory computations according to an embodiment of the present invention is described. Figure 2 A flow chart of a method 200 for performing continuous near-memory computation according to an embodiment of the present invention is shown. Figure 3 A schematic diagram of a method 300 for performing continuous near-memory computing according to an embodiment of the present invention is shown. Figure 6 A schematic diagram showing a sub-buffer according to an embodiment of the present invention is shown. It should be understood that the method 200 may be implemented in Figure 1 The method 200 is executed at the described computing device 100. The method 200 may also include additional actions not shown and / or may omit the actions shown, and the scope of the present invention is not limited in this respect.
[0039] At step 202, the computing device 100 configures a sub-cache in a cache.
[0040] About sub-buffers (such as Figure 3 In some embodiments, the sub-cache 310 is a fully associative cache in write-through mode, which is used to store a copy of SRAM data to reduce the latency of accessing SRAM.
[0041] like Figure 6 As shown, the sub-cache includes, for example, a plurality of cache lines 315. Each cache line 315 includes address information (tag) and data. The address information is, for example, an SRAM address (eg, Figure 6 The data of each cache line 315 is, for example, Figure 6 In the example, “sram data” or the reference numeral 313 indicates a copy of the SRAM data block. Typically, each update to the sub-cache will also update the SRAM.
[0042] In some embodiments, the width of each cache line 315 in the sub-cache matches the width of the calculation result of the calculation unit (e.g., is aligned with the width of the calculation result of the calculation unit), and the depth of the cache line in the sub-cache (or the number of cache lines) does not exceed the pipeline (e.g., Figure 3 It should be understood that making the depth of the cache line in the sub-cache not exceed the depth of the pipeline can make the utilization efficiency of the cache of the small cache the highest. In other embodiments, the depth of the cache line in the sub-cache is greater than the depth of the pipeline. For example, the sub-cache is suitable for the situation where multiple pipelines share SRAM and sub-cache.
[0043] At step 204, the computing device 100 determines, based at least on the computing request, to read source data required for the computing request from one of the sub-cache and the static random access memory.
[0044] like Figure 3 As shown, for example, the arbitration module 320 determines based on the address table 322 and the computing request 330 whether to read the source data required for the computing request from one of the sub-cache 310 and the static random access memory 314 .
[0045] Specifically, the method for determining to read the source data required for the computing request from one of the sub-cache and the static random access memory includes multiple ways. In some embodiments, the method for determining to read the source data required for the computing request from one of the sub-cache and the static random access memory includes, for example: before the current computing request 330 enters the pipeline 316, determining whether the source data required for the current computing request 330 exists in the sub-cache 310 or the pipeline 316; in response to determining that the source data required for the current computing request 330 exists in the sub-cache 310 or the pipeline 316, reading the source data required for the current computing request from the sub-cache 310; and in response to determining that the source data required for the current computing request does not exist in both the sub-cache 310 and the pipeline 316, reading the source data required for the current computing request from the static random access memory 314.
[0046] In some other embodiments, the method for determining to read source data required for a computing request from one of a sub-cache and a static random access memory includes, for example: before a current computing request 330 enters the pipeline 316, determining, via an arbitration module 320, whether there is a target address of a computing result with the same address as the current computing request 330 in an address table 322, wherein the address table 322 is associated with the sub-cache 310 and is configured in the arbitration module ( Figure 3 3 shows a case where the address table 322 is configured to be associated with the arbitration module 320. It should be understood that the address table can also be configured in the arbitration module); if the arbitration module 320 determines that the address table 322 has a target address of the same address calculation result related to the current calculation request (for example, Figure 3dst1 shown), allowing the source data required for the current computing request to be provided to the pipeline 316; and determining to read the source data required for the current computing request from the sub-cache 310. In some embodiments, the method for determining to read the source data required for the computing request from one of the sub-cache and the static random access memory, for example, also includes: if it is determined via the arbitration module 320 that there is no target address of the same address calculation result related to the current computing request in the address table 322, determining whether there is a related operation on the pipeline 316; in response to determining that there is a related operation on the pipeline 316, after the calculation result of the related operation is written to the static random access memory 314, allowing the source data required for the current computing request to be provided to the pipeline 316; and determining to read the source data required for the current computing request from the static random access memory 314. The following will be combined with Figure 4 The method 400 for determining to read source data required for a computing request from one of a sub-cache and a static random access memory is described, and will not be described in detail herein.
[0047] At step 206 , the computing device 100 inputs the read source data into the computing unit so as to perform the calculation associated with the computing request, thereby generating a calculation result.
[0048] For example, according to Figure 3 The computing request 330 in the sub-cache determines whether to read the source data required for the computing request from the sub-cache 310 or the static random access memory 314. After obtaining the source data, it is input into the ALU (for example, the computing unit 312) for calculation to obtain the calculation result. The calculation result needs to be updated to the SRAM (for example, the static random access memory 314). If the arbitration condition is met or the cache line in the sub-cache 310 is hit, the calculation result also needs to be updated to the sub-cache 310.
[0049] At step 208, the computing device 100 updates the computing result into the sub-cache.
[0050] It should be understood that the calculation result of the calculation unit is directly updated to the sub-buffer. If the data required for the current calculation request is stored in the sub-buffer, it does not need to be read from the SRAM, but the source data required for the current calculation request is directly read from the sub-buffer, and then updated to the sub-buffer after the calculation is completed.
[0051] For example, for n consecutive calculation requests with the same address, if a sub-cache is not used, due to memory access delay and avoiding data hazards, each calculation request must wait for the previous calculation request to be written to SRAM before entering the pipeline. If the delay of the computing unit is ignored, and there are 4 thread delays (pipe latency) in one cycle, it takes 4*n cycles to completely complete the related calculations of n consecutive calculation requests with the same address. In contrast, by using a sub-cache, the source data required for the calculation can be directly obtained from the sub-cache, and there is no need to consider data hazards. The calculation request can directly enter the pipeline without any intervals, and only (4+n) cycles are needed to completely complete the related calculations of n consecutive calculation requests with the same address. Therefore, the present invention significantly reduces the delay.
[0052] In the above scheme, by at least partially adopting a sub-cache with low latency characteristics to read the source data required for the calculation request to input into the calculation unit, and storing the relevant calculation results of the calculation request, the present invention does not have to read all the source data required for the calculation request from the SRAM. Therefore, it can significantly improve the speed of continuous near-memory calculations at the same address, improve the efficiency of the calculation unit, and reduce conflicts with other requests.
[0053] In some embodiments, the method 200 further includes: updating the calculation result into the static random access memory while updating the calculation result into the sub-cache.
[0054] The following will be combined Figure 3 , Figure 4 A method 400 for determining source data required for reading a computing request from one of a sub-cache and a static random access memory according to an embodiment of the present invention is described. Figure 4 A flow chart of a method 400 for determining source data required for reading a computing request from one of a sub-cache and a static random access memory according to an embodiment of the present invention is shown. Figure 5 FIG. 4 is a schematic diagram showing a method for determining source data required for a computing request to be read from one of a sub-cache and a static random access memory according to an embodiment of the present invention. It should be understood that the method 400 may be used, for example, in Figure 1 The method 400 is executed at the described computing device 100. The method 400 may also include additional actions not shown and / or may omit the actions shown, and the scope of the present invention is not limited in this respect.
[0055] At step 402, before the current calculation request enters the pipeline, an arbitration module determines whether there is a target address of the same address calculation result related to the current calculation request in an address table, wherein the address table is associated with a sub-buffer and configured in the arbitration module.
[0056] Regarding the computing unit (ALU), it is used to perform a calculation based on reading source data required for a computing request from one of the sub-cache and the static random access memory. In some embodiments, the computing device 100 includes a plurality of computing units, such as Figure 5 The computing device 100 includes a first computing unit 312 - 1 (ie, ALU1 ) and a second computing unit 312 - 2 (ie, ALU2 ).
[0057] About pipeline (such as Figure 3 ), which is indicated by mark 316 in the figure, and is used for the operation of the computing unit.
[0058] Regarding arbitration modules (such as Figure 3 ), which is used to determine, based on a computation request 330 to be entered into the pipeline and an address table 322, to read source data required for the computation request from one of the sub-cache and the static random access memory.
[0059] About the address table (such as Figure 3 ), which is, for example, configured to be associated with the arbitration module 320. In some embodiments, the address table is configured in the arbitration module. The address table 322 includes a flag address and a target address of the same-address calculation result associated with the calculation request. The flag address in the address table 322 corresponds to the address in the static random access memory 314. In some embodiments, the address table 322 is configured to: in response to the calculation request being submitted to the arbitration module, configure the target address of the same-address calculation result associated with the calculation request in the address table. For example, in response to the calculation request being submitted to the arbitration module, the flag address (e.g., "dst0") in the address table 322 is updated to the target address of the same-address calculation result associated with the calculation request (e.g., Figure 3 "dst1" in address table 322).
[0060] For example, before the calculation request 330 enters the pipeline 316 , the arbitration module 320 determines whether there is a target address of a calculation result with the same address as the calculation request 330 in the address table 322 .
[0061] At step 404, if it is determined through the arbitration module that there is a target address of a calculation result with the same address as the current calculation request in the address table, the source data required by the current calculation request is allowed to be provided to the pipeline.
[0062] For example, the current calculation request is: add the calculation result "A*B" of the previous calculation request to the source data "C" required by the current calculation request, so as to complete the same-address calculation "A*B+C". When the current calculation request is provided to the pipeline 316, since the previous calculation request for "A*B" has been submitted to the arbitration module 320 before the current calculation request and enters the pipeline 316, the flag address in the address table 322 has been updated to the target address of the same-address calculation result related to the calculation request (for example, Figure 3 Therefore, when the current computing request is submitted to the arbitration module 320, the arbitration module 320 determines that there is a target address (e.g., "dst1") of the same address computing result related to the current computing request in the address table 322, and thus the source data "C" required by the current computing request is allowed to be provided to the pipeline 316.
[0063] At step 406, it is determined to read source data required for the current computing request from the sub-buffer.
[0064] For example, if it is determined via arbitration module 320 that the target address of the same address calculation result as the calculation request exists in address table 322 (eg, Figure 3 The “dst1” in the address table 322 is used to determine that the source data required for the current computing request is read from the sub-cache 310 instead of reading the source data required for the computing request from the static random access memory 314.
[0065] At step 408, if it is determined through the arbitration module that there is no target address of the same address calculation result related to the current calculation request in the address table, it is determined whether there is a related operation on the pipeline.
[0066] For example, if the current calculation request is: "C*D", before the current calculation request is submitted to the arbitration module, there is no calculation request associated with the current calculation request that is submitted to the arbitration module before the current calculation request, and the address table 322 does not contain the target address of the calculation result with the same address related to the current calculation request. At this time, it is necessary to further determine whether there is a related operation on the pipeline 316.
[0067] At step 410 , if it is determined that there are dependent operations on the pipeline, source data required for the current computing request is allowed to be provided to the pipeline after the computation results of the dependent operations are written into the static random access memory.
[0068] If it is determined that there is a dependent operation on the pipeline 316 , after the calculation result of the dependent operation is written into the static random access memory 314 , the source data required by the current calculation request is allowed to be provided to the pipeline 316 .
[0069] At step 412, it is determined to read source data required for the current computing request from the static random access memory.
[0070] It should be understood that after the calculation results of the related operations are written into the static random access memory 314, the source data required for the calculation request is read from the static random access memory, which can reduce the conflict with other related operation calculation requests.
[0071] In the above scheme, the present invention determines to read the source data required for the computing request from one of the sub-cache and the static random access memory based on the computing request and the address table. Therefore, the present invention can reduce the probability of reading the source data required for the computing request from the static random access memory while reducing the probability of storage body conflict.
[0072] The following will be combined Figure 5 and Figure 7 A method 700 for performing continuous near-memory computations according to some embodiments of the present invention is described. Figure 5 A schematic diagram of a method for performing continuous near-memory computing according to an embodiment of the present invention is shown. Figure 7 FIG. 7 is a flowchart of a method 700 for performing continuous near-memory computation according to some embodiments of the present invention. It should be understood that the method 700 may be performed, for example, Figure 1 The method 700 is executed at the described computing device 100. The method 700 may also include additional actions not shown and / or may omit the actions shown, and the scope of the present invention is not limited in this respect.
[0073] At step 702, a first pipeline is configured for calculation of a first calculation unit, and a second pipeline is configured for calculation of a second calculation unit.
[0074] like Figure 5 As shown, in some embodiments, the first calculation unit 312-1 (i.e., ALU1) performs calculations to modify the original address value, for example, ALU1 performs addition and subtraction operations, and the calculation results will modify the value of the original address. The second calculation unit 312-2 (i.e., ALU2) performs calculations that will not modify the original address value, for example, ALU1 performs operations to compare the results, and the comparison results are directly returned without modifying the original address value.
[0075] like Figure 5 As shown, the first pipeline 316-1 is used for the operation of the first computing unit 312-1, and the second pipeline 316-2 is used for the operation of the second computing unit 312-2.
[0076] At step 704, in the current cycle, the first arbitration module determines to read source data required for the first computing request from the sub-cache to input into the first computing unit for computing based on the address table and the first computing request, wherein the address table is shared by the first pipeline and the first pipeline.
[0077] In some embodiments, Figure 5 As shown, the sub-buffer 310 is shared by the first computing unit 312-1 and the second computing unit 312-2. That is, the first computing unit 312-1 and the second computing unit 312-2 can both read data from the sub-buffer and write calculation results to the sub-buffer.
[0078] For example, in the current cycle, the first arbitration module 320 - 1 determines to read source data required for the first computing request from the sub-buffer 310 based on the address table 322 and the first computing request to input into the first computing unit 312 - 1 for computing.
[0079] Regarding the address table 322, it is shared by two pipelines, for example. The first arbitration module 320-1 and the second arbitration module 320-2 can both determine whether there is a copy of the required SRAM data in the sub-cache based at least on the address table and the corresponding calculation request, thereby determining whether to read the source data of the corresponding calculation request from the sub-cache or the static random access memory for the corresponding calculation unit to perform calculation.
[0080] At step 706 , in the current cycle, the second arbitration module determines, based on the address table and the second computing request, to read source data required for the second computing request from the static random access memory to input into the second computing unit for computing.
[0081] For example, in the current cycle, the second arbitration module 320 - 2 determines to read source data required for the second computing request from the static random access memory 314 based on the address table 322 and the second computing request to input into the second computing unit 312 - 2 for computing.
[0082] At step 708, the calculation result of the first calculation unit and the calculation result of the second calculation unit are written into the sub-buffers respectively.
[0083] In some embodiments, for example, the first calculation unit 312-1 mentioned above performs calculations to modify the original address value, and the second calculation unit 312-2 performs calculations that do not modify the original address value, then the calculation results of the first calculation unit will also be written into the static random access memory 314.
[0084] It should be understood that the SRAM bandwidth in a calculation operation generally includes: reading source data, ALU calculation based on source data, and writing calculation results. In each cycle, the SRAM read operation can only be performed once. If the source data of the calculation unit of the current pipeline in the current cycle comes from the sub-buffer, there is no need to perform a read operation on the SRAM. At this time, the SRAM read operation can be shared by other pipelines.
[0085] In the above scheme, by configuring and sharing sub-caches, the delay can be effectively reduced and the utilization efficiency of the computing unit can be improved. In addition, by sharing SRAM between two pipelines, the probability of SRAM read operation is reduced, the probability of conflict is reduced, and the throughput of the pipeline is improved. Furthermore, by sharing sub-caches between two pipelines, the chip area can be effectively reduced.
[0086] The various processes and processing described above, such as methods 200, 400, and 700, may be performed at a computing device. The computing device, for example, includes: at least one processor (at least one graphics processor and at least one central processing unit); and a memory connected to the at least one processor in communication; wherein the memory stores instructions that can be executed by at least one processor, and the instructions are executed by at least one processor. In some embodiments, methods 200, 400, and 700 may be implemented as a computer software program or program product, which is tangibly contained in a machine-readable medium. In some embodiments, part or all of the computer program may be loaded and / or installed on a computing device via a read-only memory (ROM) and / or a communication unit. When the computer program is loaded into a random access memory (RAM) and executed by a GPU and a CPU, one or more actions of methods 200, 400, and 700 described above may be performed.
[0087] The present invention may be a method, an apparatus, a system and / or a computer program product. The computer program product may include a computer-readable storage medium having computer-readable program instructions for executing various aspects of the present invention. The computer-readable storage medium may be a tangible device that can hold and store instructions used by an instruction execution device. The computer-readable storage medium may be, for example, but not limited to, an electrical storage device, a magnetic storage device, an optical storage device, an electromagnetic storage device, a semiconductor storage device, or any suitable combination thereof.
[0088] The computer-readable program instructions described herein can be downloaded from a computer-readable storage medium to various computing / processing devices, or downloaded to an external computer or external storage device via a network, such as the Internet, a local area network, a wide area network, and / or a wireless network. Various aspects of the present invention are described herein with reference to flowcharts and / or block diagrams of methods, devices (systems), and computer program products according to embodiments of the present invention. It should be understood that each box of the flowchart and / or block diagram, and the combination of boxes in the flowchart and / or block diagram, can be implemented by computer-readable program instructions.
[0089] These computer-readable program instructions can be provided to a central processing unit of a general-purpose computer, a special-purpose computer, or other programmable data processing device, thereby producing a machine, so that when these instructions are executed by the central processing unit of the computer or other programmable data processing device, a device that implements the functions / actions specified in one or more boxes in the flowchart and / or block diagram is generated. These computer-readable program instructions can also be stored in a computer-readable storage medium, and these instructions cause the computer, programmable data processing device, and / or other equipment to work in a specific manner, so that the computer-readable medium storing the instructions includes a manufactured product, which includes instructions for implementing various aspects of the functions / actions specified in one or more boxes in the flowchart and / or block diagram.
[0090] The flow chart and block diagram in the accompanying drawings show the possible architecture, function and operation of the system, method and computer program product according to multiple embodiments of the present invention. In this regard, each square box in the flow chart or block diagram can represent a part of a module, program segment or instruction, and a part of a module, program segment or instruction includes one or more executable instructions for realizing the logical function of the specification. In some alternative implementations, the function marked in the square box can also occur in a sequence different from that marked in the accompanying drawings. For example, two continuous square boxes can actually be executed substantially in parallel, and they can sometimes be executed in the opposite order, depending on the function involved. It should also be noted that each square box in the block diagram and / or flow chart, and the combination of the square boxes in the block diagram and / or flow chart can be realized by a special hardware-based system that performs the function or action of the specification, or can be realized by a combination of special hardware and computer instructions.
[0091] It should be understood that the various forms of processes shown above can be used to reorder, add or delete steps. For example, the steps loaded in this application can be executed in parallel, sequentially or in different orders, as long as the expected results of the technical solution disclosed in this application can be achieved, and this document is not limited here.
[0092] The above specific implementations do not constitute a limitation on the protection scope of the present application. It should be understood by those skilled in the art that various modifications, combinations, sub-combinations and substitutions may be made according to design requirements and other factors.
Claims
1. A method for performing continuous near-memory computing, characterized in that: The method comprises: configuring a sub-buffer in a buffer; At least based on the computing request, determining to read source data required for the computing request from one of the sub-buffer and the static random access memory, wherein at least based on the computing request, determining to read source data required for the computing request from one of the sub-buffer and the static random access memory comprises: in response to determining that the source data required for the current computing request exists in the sub-buffer or the pipeline, reading the source data required for the current computing request from the sub-buffer; and in response to determining that the source data required for the current computing request does not exist in both the sub-buffer and the pipeline, reading the source data required for the current computing request from the static random access memory; Inputting the read source data into the computing unit so as to perform the computation associated with the computation request, thereby generating a computation result; and The calculation result is updated into the sub-buffer.
2. The method according to claim 1, characterized in that Based at least on the computing request, determining to read source data required for the computing request from one of the sub-cache and the static random access memory further comprises: Before the current computing request enters the pipeline, it is determined whether there is source data required by the current computing request in the sub-buffer or in the pipeline.
3. The method according to claim 1, characterized in that Based at least on the computing request, determining to read source data required for the computing request from one of the sub-cache and the static random access memory comprises: Before the current calculation request enters the pipeline, the arbitration module determines whether there is a target address of the same address calculation result related to the current calculation request in the address table, the address table is associated with the sub-buffer, and the address table is configured in the arbitration module.
4. The method according to claim 3, characterized in that Based at least on the computing request, determining to read source data required for the computing request from one of the sub-cache and the static random access memory further comprises: In response to determining through the arbitration module that a target address of a same-address calculation result associated with the current calculation request exists in the address table, allowing source data required by the current calculation request to be provided to the pipeline; and Determines the source data needed to read the current computation request from the sub-buffer.
5. The method according to claim 3, characterized in that: Based at least on the computing request, determining to read source data required for the computing request from one of the sub-cache and the static random access memory comprises: In response to determining via the arbitration module that there is no target address of the same-address calculation result associated with the current calculation request in the address table, determining whether there is a related operation on the pipeline; In response to determining that there are dependent operations on the pipeline, allowing source data required for the current computing request to be provided to the pipeline after the computation results of the dependent operations are written to the static random access memory; and Determines the source data needed to read from static random access memory for the current computation request.
6. The method according to claim 1, characterized in that The method further comprises: In response to a calculation request being submitted to the arbitration module, a target address of a same-address calculation result associated with the calculation request is configured in an address table, the address table is associated with the sub-buffer, and the address table is configured in the arbitration module.
7. The method according to claim 6, characterized in that The target address of the same address calculation result related to the calculation request configured in the address table includes: The flag address in the address table is updated to the target address of the same address calculation result related to the calculation request, and the flag address in the address table corresponds to the address in the static random access memory.
8. The method according to claim 1, characterized in that The method further comprises: When the calculation result is updated into the sub-cache, the calculation result is also updated into the static random access memory.
9. The method according to claim 1, characterized in that: The sub-cache is a fully associative cache in write-through mode, the width of each buffer row included in the sub-cache matches the width of the calculation result of the calculation unit, and the depth of the buffer row in the sub-cache does not exceed the depth of the pipeline.
10. The method according to claim 1, characterized in that Also includes: configuring a first pipeline for calculation of a first calculation unit, and configuring a second pipeline for calculation of a second calculation unit; In the current cycle, the first arbitration module determines to read source data required for the first computing request from the sub-cache to input into the first computing unit for computing based on the address table and the first computing request, wherein the address table is shared by the first pipeline and the first pipeline; In the current cycle, the second arbitration module determines, based on the address table and the second computing request, to read source data required for the second computing request from the static random access memory to input into the second computing unit for computing; as well as The calculation result of the first calculation unit and the calculation result of the second calculation unit are written into the sub-buffers respectively.
11. A computing device, characterized in that: include: at least one processor; as well as a memory communicatively coupled to the at least one processor; in The memory stores instructions that can be executed by the at least one processor, and the instructions are executed by the at least one processor to enable the at least one processor to perform the method according to any one of claims 1 to 10.
12. A computer-readable storage medium, characterized in that: The computer-readable storage medium stores a computer program, and when the computer program is executed by a machine, the method according to any one of claims 1 to 10 is performed.
13. A computer program product, characterized in that The invention comprises a computer program, which, when executed by a machine, performs the method according to any one of claims 1 to 10.
