Cache data block power-off method, device and integrated circuit chip
By transferring dirty data blocks to non-dirty data blocks in the cache, the problem of slow power-off speed of the cache is solved, achieving rapid power-off and reduced power consumption.
Patent Information
- Application Number
- CN202010954892.4
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2020-09-11
- Publication Date
- 2024-09-10
- Estimated Expiration
- 2040-09-11
AI Technical Summary
In the existing technology, dirty data needs to be written into the memory before the cache is powered off, which causes the cache to be powered off slowly and affects the reduction of power consumption.
By transferring the dirty data blocks in the data blocks to be powered off to the corresponding non-dirty data blocks in the data blocks that are not powered off, and replacing the non-dirty data blocks, the data transfer is quickly completed within the cache and avoids the conflict between the cache and the memory. slow data write operations.
It improves the speed of cache power-off, reduces power consumption, retains the integrity of dirty data, and improves data transfer efficiency.
Smart Images

Figure CN114169017B
Abstract
Description
Technical Field
[0001] The present application relates to the field of electronic technology, and in particular to a method and device for powering off a cache data block, and an integrated circuit chip. Background Art
[0002] In modern integrated circuit chips, high-speed, large-capacity caches are often used to store frequently accessed data and reduce access latency. Large-capacity caches consume more power, so partial cache power-off technology is gradually being adopted. Partial cache power-off technology refers to the technology of powering off part of the large-capacity cache to reduce power consumption when the chip system load is light and the demand for cache capacity is not large.
[0003] Currently, before powering off a portion of the cache, dirty data in the cache is written to the memory so that the portion of the cache can be powered off. However, writing from the cache to the memory takes a long time, resulting in a slow power-off of the cache. Summary of the invention
[0004] The embodiments of the present application provide a method, device and integrated circuit chip for powering off a cache data block, which can speed up the powering off of the cache.
[0005] The embodiment of the present application provides a method for powering off a cache data block, wherein the method for powering off a cache data block includes:
[0006] Receive a cache data block power-off request;
[0007] Based on the cache data block power-off request, determine the data blocks to be powered off and the data blocks not to be powered off in the cache;
[0008] Transferring dirty data blocks in the to-be-powered-off data blocks to positions of corresponding non-dirty data blocks in the non-powered-off data blocks to replace the non-dirty data blocks;
[0009] After all dirty data blocks in the data blocks to be powered off are transferred, all the data blocks to be powered off are powered off.
[0010] The embodiment of the present application further provides a cache data block power-off device, wherein the cache data block power-off device comprises:
[0011] A receiving module, used for receiving a cache data block power-off request;
[0012] A first determining module, configured to determine data blocks to be powered off and data blocks not to be powered off in the cache based on the power-off request of the cache data blocks;
[0013] A transfer module, used for transferring dirty data blocks in the to-be-powered-off data blocks to positions of corresponding non-dirty data blocks in the non-powered-off data blocks, so as to replace the non-dirty data blocks;
[0014] The power-off module is used to power off all the data blocks to be powered off after all dirty data blocks in the data blocks to be powered off have been transferred.
[0015] The embodiment of the present application also provides an integrated circuit chip, wherein the integrated circuit chip includes the cache data block power-off device provided in the embodiment of the present application, and can execute the steps in any cache data block power-off method provided in the embodiment of the present application.
[0016] In the embodiment of the present application, a cache data block power-off request is first received, and then based on the cache data block power-off request, the data blocks to be powered off and the data blocks that are not powered off in the cache are determined, and the dirty data blocks in the data blocks to be powered off are transferred to the positions of the non-dirty data blocks that can be replaced in the data blocks that are not powered off to replace the non-dirty data blocks, and after all the dirty data blocks in the data blocks to be powered off are transferred, all the data blocks to be powered off are powered off. In the embodiment of the present application, by transferring the dirty data blocks in the data blocks to be powered off to the data blocks that are not powered off, the slow operation of writing dirty data back to the memory is replaced by fast data transfer within the cache, thereby improving the transfer efficiency of dirty data while retaining the dirty data, thereby speeding up the power-off of the cache. BRIEF DESCRIPTION OF THE DRAWINGS
[0017] In order to more clearly illustrate the technical solutions in the embodiments of the present application, the following briefly introduces the drawings required for use in the description of the embodiments. Obviously, the drawings described below are only some embodiments of the present application, and those skilled in the art can obtain other drawings based on these drawings without creative work.
[0018] Figure 1 A first flow chart of the method for powering off a cache data block provided in an embodiment of the present application.
[0019] Figure 2 A second flow chart of the method for powering off a cache data block provided in an embodiment of the present application.
[0020] Figure 3 A third flow chart of the method for powering off a cache data block provided in an embodiment of the present application.
[0021] Figure 4 A first schematic diagram of a data block architecture of a cache data block power-off method provided in an embodiment of the present application.
[0022] Figure 5 A second schematic diagram of a data block architecture of the cache data block power-off method provided in an embodiment of the present application.
[0023] Figure 6A first structural schematic diagram of a cache data block power-off device provided in an embodiment of the present application.
[0024] Figure 7 A second structural schematic diagram of the cache data block power-off device provided in an embodiment of the present application.
[0025] Figure 8 A schematic diagram of the structure of an integrated circuit chip provided in an embodiment of the present application. DETAILED DESCRIPTION
[0026] The technical solutions in the embodiments of the present application will be described clearly and completely below in conjunction with the drawings in the embodiments of the present application. Obviously, the described embodiments are only part of the embodiments of the present application, rather than all of the embodiments. Based on the embodiments in the present application, all embodiments obtained by those skilled in the art without creative work are within the scope of protection of the present application.
[0027] The terms "first", "second", "third", etc. (if any) in the specification and claims of this application and the above-mentioned drawings are used to distinguish similar objects, and are not necessarily used to describe a specific order or sequence. It should be understood that the objects described in this way can be interchanged where appropriate. In addition, the terms "including" and "having" and any variations thereof are intended to cover non-exclusive inclusions. For example, a process, method comprising a series of steps, or a device, electronic device, or system comprising a series of modules or units is not necessarily limited to those steps or modules and units clearly listed, and may also include steps or modules or units that are not clearly listed, and may also include other steps or modules or units inherent to these processes, methods, devices, electronic devices, or systems.
[0028] The embodiment of the present application provides a cache data block power-off method, which is applied to an integrated circuit chip. The execution subject of the cache data block power-off method can be a cache data block power-off device provided in the embodiment of the present application, or an integrated circuit chip integrating the cache data block power-off device.
[0029] Please refer to Figure 1 , Figure 1 A first flow chart of a method for powering off a cache data block provided in an embodiment of the present application. The method for powering off a cache data block can be applied to an integrated circuit chip provided in an embodiment of the present application. The method for powering off a cache data block provided in an embodiment of the present application may include the following steps:
[0030] 110, receiving a cache data block power-off request.
[0031] In modern integrated circuits, high-speed, large-capacity caches are often used to store frequently accessed data to reduce access delays. However, at the same time, large-capacity caches will result in greater power consumption. When the integrated circuit is in a working state that does not require high performance, a request to power off the cache data block can be initiated. The cache data block power-off device receives the cache data block power-off request, and then powers off some of the data blocks in the cache, which can reduce the number of cache data blocks that are powered on, thereby achieving the purpose of reducing cache power consumption.
[0032] The cache data block power-off request may be automatically triggered when the integrated circuit chip detects that the workload is reduced to a preset threshold, or may be triggered when the integrated circuit chip runs a specific software program.
[0033] 120 . Determine data blocks to be powered off and data blocks not to be powered off in the cache based on the cache data block power off request.
[0034] Before powering off the corresponding proportion of data blocks, the data blocks to be powered off and the data blocks not to be powered off in the cache are determined according to the power-off proportion included in the cache data block power-off request. The data blocks corresponding to the power-off proportion are selected from the cache to be determined as the data blocks to be powered off, and the data blocks in the cache other than the data blocks to be powered off are determined as the data blocks not to be powered off.
[0035] 130 , transferring dirty data blocks in the data blocks to be powered off to positions of corresponding non-dirty data blocks in the data blocks that are not powered off, so as to replace the non-dirty data blocks.
[0036] Dirty data refers to the data content in the cache being inconsistent with the data content in the memory, and non-dirty data refers to the data content in the cache being consistent with the data content in the memory. Accordingly, a data block containing dirty data is a dirty data block, and a data block containing non-dirty data is a non-dirty data block.
[0037] Integrated circuit chips are often equipped with caches. To improve the performance of caches, when the upstream device of the cache service writes data to the cache and a write hit occurs, this part of the write data can be directly stored in the cache without the need to update it to the memory slowly, thereby enabling high-speed data interaction. However, after the write operation, the data blocks in the cache have changed relative to the data content in the memory and become dirty data blocks. Therefore, before the cache data blocks are powered off or the cache is replaced, these dirty data blocks need to be transferred.
[0038] If there are dirty data blocks in the data blocks to be powered off, all dirty data blocks need to be transferred before powering off, otherwise these dirty data blocks will be lost after powering off, and there will be no backup in the memory. For example, before powering off, the dirty data in the cache can be written back to the memory through the data path between the cache and the memory. Once the dirty data in the dirty data blocks has been written to the memory before part of the cache is powered off, it means that the corresponding data blocks in the memory have been successfully updated and the data can be saved.
[0039] However, the data path between the cache and the memory is very slow, and it takes a long time to write dirty data to the memory, especially when the capacity of the cache to be powered off is large and a lot of dirty data needs to be transferred. If you have to wait until all the dirty data is written to the memory before you can power off that part of the cache, then the cache power-off will not be completed in a short time, affecting the speed of cache power-off and causing the cache power consumption to be unable to be reduced.
[0040] In one embodiment, dirty data blocks in the data blocks to be powered off are transferred to the positions of non-dirty data blocks available for replacement in the data blocks that are not powered off, so as to replace the non-dirty data blocks. Fast data transfer within the cache replaces the slow operation of writing dirty data back to the memory, thereby improving the transfer efficiency of dirty data while retaining the dirty data, thereby speeding up the power-off of the cache.
[0041] The replaceable non-dirty data block refers to a non-dirty data block in the same group as the dirty data block in a cache with a classic set associative structure.
[0042] Before transferring the dirty data blocks in the data blocks to be powered off to the positions of the corresponding non-dirty data blocks in the data blocks that are not powered off, it is necessary to first determine whether each data block to be powered off is a dirty data block or a non-dirty data block. For example, first determine whether a flag bit of each data block in the cache has a preset flag, and determine the data block whose flag bit has the preset flag as a dirty data block, and determine the data block whose flag bit does not have the preset flag as a non-dirty data block.
[0043] In one embodiment, the flag of the bit flag can be used as a standard for determining whether a data block is a dirty data block. When the data content in the cache has not been changed and is still consistent with the data content in the memory, the bit flag of the data block is marked as "0". When the upstream device of the cache service writes data to the cache and a write hit occurs, the data content in the cache is changed, and the data block becomes a dirty data block, and the bit flag of the data block is set to "1". By detecting whether the flag of the bit flag of the data block in the cache is "1", it can be determined whether the data block is a dirty data block.
[0044] In one embodiment, if it is determined that the dirty data block has no non-dirty data block available for replacement in the non-powered-off data blocks, the dirty data block is transferred to the memory.
[0045] Please continue reading Figure 2 , Figure 2 This is a second flow chart of the cache data block power-off method provided in an embodiment of the present application. After receiving a cache data block power-off request, for each data block to be powered off, the integrated circuit chip determines whether it is a dirty data block. If so, it continues to determine whether there is a non-dirty data block available for replacement in the cache block that is not powered off. If not, it determines whether all the data blocks to be powered off have been checked. If all the data blocks to be powered off have been checked, partial cache power-off is performed. If all the data blocks to be powered off have not been checked, the next data block to be powered off is checked.
[0046] For the data block to be powered off that is a dirty data block, if it is determined that there is a non-dirty data block available for replacement in the cache block that will not be powered off, the dirty data block is transferred to the position of the non-dirty data block that can be replaced; if it is determined that there is no non-dirty data block available for replacement in the cache block that will not be powered off, the dirty data block is directly transferred to the memory. After the dirty data block is transferred, it is determined whether all the data blocks to be powered off have been checked. If all the data blocks to be powered off have been checked, a partial cache power-off is performed; if all the data blocks to be powered off have not been checked, the next data block to be powered off is checked.
[0047] 140 , after all dirty data blocks in the data blocks to be powered off are transferred, power off all the data blocks to be powered off.
[0048] In one implementation, if a data block among non-dirty data blocks is being read or written, the data block being read or written is not used as a transfer location or a target for replacement of the dirty data block.
[0049] Please refer to Figure 3 , Figure 3 The third flow diagram of the cache data block power-off method provided in the embodiment of the present application is shown in FIG. The cache data block power-off method can be applied to the integrated circuit chip provided in the embodiment of the present application. The cache data block power-off method provided in the embodiment of the present application may include the following steps:
[0050] 210. Receive a cache data block power-off request, where the cache data block power-off request includes a power-off ratio.
[0051] The cache data block power-off request may be automatically triggered when the integrated circuit chip detects that the workload is reduced to a preset threshold, or may be triggered when the integrated circuit chip runs a specific software program.
[0052] 220. Determine the number of switches that need to be disconnected based on the power-off ratio;
[0053] Each data block in the cache is controlled by a switch, and each switch controls multiple data blocks. That is, each switch in the cache independently controls multiple data blocks.
[0054] In one embodiment, the number of switches in the cache is first obtained, and the number of switches in the cache is multiplied by the power-off ratio to obtain the number of switches that need to be disconnected.
[0055] For example, see also Figure 4 and Figure 5 , Figure 4 and Figure 5 are the first schematic diagram and the second schematic diagram of the data block architecture of the data block power-off method provided in the embodiment of the present application, Figure 4 and Figure 5 It can have a completely identical data block architecture. There are 16 data blocks in the cache, namely data block 0 to data block 15, and the 16 data blocks constitute a data block array of 4 rows and 4 columns. There are also 4 switches in the cache, each of which independently controls the 4 data blocks in each column. When the power-off ratio contained in the cache data block power-off request received by the integrated circuit chip is 25%, since there are 4 switches in the cache, 4*25%=1, therefore, it is determined that the number of switches that need to be disconnected is 1.
[0056] It should be noted that Figure 4 and Figure 5 The number of data blocks, the number of switches, and the number of data blocks controlled by each switch are merely examples and should not be considered as limitations of the present invention. It should be understood by those skilled in the art that the number of data blocks, the number of switches, and the number of data blocks controlled by each switch in the cache can be changed according to the actual situation of the integrated circuit chip.
[0057] 230. Select switches of a corresponding number of switches from all switches as power-off switches.
[0058] After determining the number of switches that need to be disconnected, select switches of the corresponding number from all switches as power-off switches. Figure 4 and Figure 4 In the example, it is determined that the number of switches that need to be disconnected is 1. Figure 4 and Figure 4 Only the case where switch 1 is used as the power-off switch is shown in the figure, but those skilled in the art can understand that any one of switch 1, switch 2, switch 3 and switch 4 can be used as the power-off switch.
[0059] 240. Determine all data blocks controlled by the power-off switch as data blocks to be powered off, and determine other data blocks in the cache except the data blocks to be powered off as data blocks that will not be powered off.
[0060] Please continue reading Figure 4and Figure 4 , where switch 1 controls data blocks 0 to 3, switch 2 controls data blocks 4 to 7, switch 3 controls data blocks 8 to 11, and switch 4 controls data blocks 12 to 15.
[0061] When switch 1 is a switch to be powered off, data blocks 0 to 3 controlled by switch 1 are determined as data blocks to be powered off, and all data blocks controlled by switches 2, 3, and 4 are determined as data blocks that will not be powered off; when switch 2 is a switch to be powered off, data blocks 4 to 7 controlled by switch 2 are determined as data blocks to be powered off, and all data blocks controlled by switches 1, 3, and 4 are determined as data blocks that will not be powered off; when switch 3 is a switch to be powered off, data blocks 8 to 11 controlled by switch 3 are determined as data blocks to be powered off, and all data blocks controlled by switches 1, 2, and 4 are determined as data blocks that will not be powered off; when switch 4 is a switch to be powered off, data blocks 12 to 15 controlled by switch 4 are determined as data blocks to be powered off, and all data blocks controlled by switches 1, 2, and 3 are determined as data blocks that will not be powered off.
[0062] 250. For each dirty data block in the data blocks to be powered off, determine whether there is a non-dirty data block in the data blocks that are not powered off that can be replaced by the dirty data block; if so, proceed to step 260; if not, proceed to step 270.
[0063] Dirty data refers to the data content in the cache being inconsistent with the data content in the memory, and non-dirty data refers to the data content in the cache being consistent with the data content in the memory. Accordingly, a data block containing dirty data is a dirty data block, and a data block containing non-dirty data is a non-dirty data block.
[0064] If there are dirty data blocks in the data blocks to be powered off, all dirty data blocks to be powered off need to be transferred before powering off, otherwise these dirty data blocks will be lost after powering off, and there will be no backup in the memory.
[0065] In one embodiment, it is first determined whether each data block to be powered off is a dirty data block or a non-dirty data block. The method for determining whether a data block is a dirty data block or a non-dirty data block may be: judging whether a flag bit of each data block in the cache has a preset flag, determining a data block with a preset flag as a dirty data block, and determining a data block with no preset flag as a non-dirty data block.
[0066] For example, the flag of the bit flag can be used as a standard for determining whether a data block is a dirty data block. When the data content in the cache has not been changed and is still consistent with the data content in the memory, the bit flag of the data block is marked as "0". When the upstream device of the cache service writes data to the cache and a write hit occurs, the data content in the cache is changed, and the data block becomes a dirty data block, and the bit flag of the data block is set to "1". By detecting whether the bit flag of the data block in the cache is marked as "1", it can be determined whether the data block is a dirty data block.
[0067] exist Figure 4 In the example, before powering off data blocks 0 to 3, dirty data blocks 1, 2, and 3 are written back to the memory through the data path between the cache and the memory, and data blocks 1, 2, and 3 in the memory are updated from the original old data content to the new data content.
[0068] However, the data path between the cache and the memory is very slow, and it takes a long time to write dirty data to the memory, especially when the capacity of the cache to be powered off is large and a lot of dirty data needs to be transferred. If you have to wait until all the dirty data is written to the memory before you can power off that part of the cache, then the cache power-off will not be completed in a short time, affecting the speed of cache power-off and causing the cache power consumption to be unable to be reduced.
[0069] Therefore, in one embodiment, we adopt Figure 5 In the manner shown, the dirty data blocks in the data blocks to be powered off are transferred to the positions of the corresponding non-dirty data blocks in the data blocks that are not powered off, so as to replace the non-dirty data blocks. Since the dirty data is not written back to the memory, the old data content exists in the memory. The dirty data will be gradually updated to the memory when the non-powered cache is used later. Since the slow operation of writing dirty data back to the memory is replaced by the fast data transfer inside the cache, the transfer efficiency of the dirty data is improved while retaining the dirty data, thereby speeding up the power-off of the cache.
[0070] Before transferring the dirty data blocks in the waiting power-off data blocks to the corresponding non-dirty data blocks in the power-on data blocks, it is necessary to first determine whether there are non-dirty data blocks in the power-on data blocks that can be replaced. The non-dirty data blocks that can be replaced refer to the non-dirty data blocks in the same group as the dirty data blocks in the classic set-associative structure cache. Figure 5 Take this as an example to illustrate:
[0071] exist Figure 5In the figure, some data blocks in the cache are gray data blocks, indicating that the data blocks are dirty data, such as data blocks 1, 2, 3, 5, 6, 9, 11, and 12. The remaining data blocks are white data blocks, indicating that the data blocks are non-dirty data blocks, such as data blocks 0, 4, 5, 8, 10, 13, 14, and 15. The dirty data blocks that are to be powered off are data blocks 1, 2, and 3 under the control of the power-off switch (switch 1). Therefore, in Figure 5 In the process, it is necessary to determine whether dirty data blocks 1, 2, and 3 have non-dirty data blocks that can be replaced in the non-power-off data blocks 4 to 15.
[0072] In one embodiment, the non-dirty data block that can be replaced with a dirty data block is a non-dirty data block in the same row as the dirty data in the data block array. The position of each data block determines the position where it can be transferred. When a data block is transferred, it can only be transferred to the position of the data block in the same row as the data block in the data block array. Therefore, the step of determining whether the dirty data block has a corresponding non-dirty data block in the non-power-off data block can be: determining whether there is a non-dirty data block in the non-power-off data block that is in the same row as the dirty data block.
[0073] exist Figure 5 In the figure, dirty data block 1 has non-dirty data blocks 5 and 13 available for replacement in the power-on data blocks, dirty data block 2 has non-dirty data blocks 10 and 14 available for replacement in the power-on data blocks, and dirty data block 3 has non-dirty data block 15 available for replacement in the power-on data blocks.
[0074] 260. Transfer the dirty data block to a position of a replaceable non-dirty data block in the non-power-off data block to replace the non-dirty data block;
[0075] by Figure 5 For example, dirty data block 1 can be transferred to the position of non-dirty data block 5 or 13, dirty data block 2 can be transferred to the position of non-dirty data block 10 or 14, and dirty data block can be transferred to the position of non-dirty data block 15 to replace the corresponding non-dirty data block. Since the data content in the memory of the non-dirty data block is consistent with the data content in the cache, even if the position is occupied by the dirty data block, the data will not be lost, and these replaced non-dirty data blocks can still be read from the memory when they are needed.
[0076] When a dirty data block in the data block to be powered off has multiple non-dirty data blocks available for replacement in the data block not to be powered off, the dirty data is transferred to the position of the nearest non-dirty data block.
[0077] 270. Transfer dirty data blocks to memory.
[0078] If there is no non-dirty data block in the cache to replace a dirty data block, that is, in the classic set-associative cache, there is no non-dirty data block in the same group as the dirty data block, then the dirty data block is transferred to the memory.
[0079] Although the dirty data block has been transferred to the memory, there are still many dirty data blocks in the data blocks to be powered off. The fast data transfer inside the cache replaces the slow operation of writing dirty data back to the memory. Therefore, even if not all data blocks are transferred inside the cache, it still greatly saves the time of transferring all dirty data blocks and improves the speed of cache power-off. When there is no non-dirty data block to replace the dirty data block in the data blocks to be powered off, the dirty data block is transferred to the memory to ensure that the data content of the dirty data block is not lost.
[0080] 280. After all dirty data blocks in the data blocks to be powered off are transferred, turn off the power-off switch to power off all the data blocks to be powered off.
[0081] In one embodiment, the transfer of dirty data in the data block to be powered off is monitored in real time. If the dirty data block in the data block to be powered off has not been transferred, the next dirty data block is transferred; if all dirty data blocks in the data block to be powered off have been transferred, when the data block to be powered off is powered off, the power-off switch is turned off, and all data blocks controlled by the power-off switch are powered off, while the data content of the dirty data block is retained because it has been transferred in advance.
[0082] As can be seen from the above, the cache data block power-off method provided in the embodiment of the present application first receives a cache data block power-off request, and then determines the data blocks to be powered off and the data blocks that are not powered off in the cache based on the cache data block power-off request, and transfers the dirty data blocks in the data blocks to be powered off to the positions of the corresponding non-dirty data blocks in the data blocks that are not powered off to replace the non-dirty data blocks, and after all the dirty data blocks in the data blocks to be powered off are transferred, all the data blocks to be powered off are powered off. In the embodiment of the present application, by transferring the dirty data blocks in the data blocks to be powered off to the data blocks that are not powered off, the slow operation of writing dirty data back to the memory is replaced by fast data transfer inside the cache, thereby improving the transfer efficiency of dirty data while retaining the dirty data, thereby speeding up the cache power-off.
[0083] The present application also provides a cache data block power-off device. Figure 6 , Figure 6 The first structural diagram of the cache data block power-off device provided in the embodiment of the present application. The cache data block power-off device 300 can be applied to an integrated circuit chip, and the cache data block power-off device includes a receiving module 301, a first determining module 302, a transfer module 303 and a power-off module 304, as follows:
[0084] A receiving module 301 is used to receive a cache data block power-off request;
[0085] A first determining module 302 is used to determine the data blocks to be powered off and the data blocks not to be powered off in the cache based on the cache data block power-off request;
[0086] A transfer module 303 is used to transfer dirty data blocks in the data blocks to be powered off to the positions of corresponding non-dirty data blocks in the data blocks that are not powered off, so as to replace the non-dirty data blocks;
[0087] The power-off module 304 is configured to power off all the data blocks to be powered off after all dirty data blocks in the data blocks to be powered off have been transferred.
[0088] In one embodiment, when transferring dirty data blocks in the to-be-powered-down data blocks to positions of corresponding non-dirty data blocks in the non-powered-down data blocks to replace the non-dirty data blocks, the transfer module 303 may be used to:
[0089] For each dirty data block in the data blocks to be powered off, determine whether the dirty data block has a non-dirty data block that can be replaced in the data blocks that are not powered off;
[0090] If so, the dirty data block is transferred to a position of a replaceable non-dirty data block in the non-power-off data block to replace the non-dirty data block.
[0091] If the dirty data block has no non-dirty data block available for replacement in the non-power-off data blocks, the dirty data block is transferred to the memory.
[0092] Please also read Figure 7 , Figure 7 A second structural diagram of the cache data block power-off device 300 provided in an embodiment of the present application. In one embodiment, the cache data block power-off device 300 further includes a judgment module 305 and a second determination module 306:
[0093] A determination module 305 is used to determine whether a bit flag of each data block in the cache has a preset flag;
[0094] The second determination module 306 is configured to determine a data block whose bit flag has a preset flag as a dirty data block, and determine a data block whose bit flag does not have a preset flag as a non-dirty data block.
[0095] In one embodiment, each data block in the cache is controlled by a switch, each switch controls multiple data blocks, and when determining the data blocks to be powered off and the data blocks not to be powered off in the cache based on the power-off request of the cache data blocks, the first determination module 302 may be used to:
[0096] Based on the cache data block power-off request, determine the power-off switch from all switches;
[0097] All data blocks controlled by the power-off switch are determined as data blocks to be powered off, and other data blocks in the cache except the data blocks to be powered off are determined as data blocks that will not be powered off.
[0098] When determining the power-off switches from all switches, the number of switches to be disconnected is determined according to the power-off ratio, and switches of a corresponding number are selected from all switches as the power-off switches.
[0099] In one embodiment, when all data blocks to be powered off are powered off, the power-off module 304 may be used to:
[0100] Turn off all power-off switches to power off all data blocks to be powered off.
[0101] The specific implementation of each of the above modules can be found in the previous embodiments and will not be described in detail here.
[0102] As can be seen from the above, the cache data block power-off method provided in the embodiment of the present application is that the receiving module 301 first receives the cache data block power-off request, and then the first determination module 302 determines the data blocks to be powered off and the data blocks that are not powered off in the cache based on the cache data block power-off request, and the transfer module 303 transfers the dirty data blocks in the data blocks to be powered off to the positions of the corresponding non-dirty data blocks in the data blocks that are not powered off to replace the non-dirty data blocks, and the power-off module 304 powers off all the data blocks to be powered off after all the dirty data blocks in the data blocks to be powered off have been transferred. In the embodiment of the present application, by transferring the dirty data blocks in the data blocks to be powered off to the data blocks that are not powered off, the slow operation of writing dirty data back to the memory is replaced by the fast data transfer inside the cache, the transfer efficiency of the dirty data is improved while retaining the dirty data, thereby speeding up the power-off of the cache.
[0103] The present application also provides an integrated circuit chip. The integrated circuit chip can be used in smart phones, tablet computers, gaming devices, AR (Augmented Reality) devices, cars, vehicle peripheral obstacle detection devices, audio playback devices, video playback devices, notebooks, desktop computing devices, wearable devices such as watches, glasses, helmets, electronic bracelets, electronic necklaces, and other devices.
[0104] refer to Figure 8 , Figure 8 The schematic diagram of the structure of the integrated circuit chip 400 provided in the embodiment of the present application includes a processor 401, a memory 402, a cache 403 and a cache data block power-off device 404. The processor 401, the cache 403 and the memory 402 are electrically connected.
[0105] The processor 401 is the control center of the integrated circuit chip 400. It uses various interfaces and lines to connect various parts of the entire integrated circuit chip, monitors the working status of the integrated circuit chip, and initiates a request to power off some cached data blocks when the workload of the integrated circuit chip is reduced and the demand for cache capacity is reduced.
[0106] In this embodiment, the cache data block power-off device 404 located in the cache 403 is responsible for implementing the steps in the cache data block power-off method described above, for example:
[0107] Receive a cache data block power-off request;
[0108] Based on the cache data block power-off request, determine the data blocks to be powered off and the data blocks not to be powered off in the cache;
[0109] Transferring dirty data blocks in the data blocks to be powered off to the positions of corresponding non-dirty data blocks in the data blocks that are not powered off, so as to replace the non-dirty data blocks;
[0110] After all dirty data blocks in the data blocks to be powered off are transferred, all the data blocks to be powered off are powered off.
[0111] As can be seen from the above, an embodiment of the present application provides an integrated circuit chip, and a cache data block power-off device in the integrated circuit chip performs the following steps: receiving a cache data block power-off request; determining the data blocks to be powered off and the data blocks not to be powered off in the cache based on the cache data block power-off request; transferring the dirty data blocks in the data blocks to be powered off to the positions of the corresponding non-dirty data blocks in the data blocks not to be powered off to replace the non-dirty data blocks; after all the dirty data blocks in the data blocks to be powered off have been transferred, powering off all the data blocks to be powered off. In the embodiment of the present application, by transferring the dirty data blocks in the data blocks to be powered off to the data blocks not to be powered off, the slow operation of writing dirty data back to the memory is replaced by fast data transfer within the cache, thereby improving the transfer efficiency of dirty data while retaining the dirty data, thereby speeding up the power-off of the cache.
[0112] In the above embodiments, the description of each embodiment has its own emphasis. For the part that is not described in detail in a certain embodiment, please refer to the detailed description of the translation method above, and will not be repeated here.
[0113] The above is a detailed introduction to the cache data block power-off method, device and integrated circuit chip provided in the embodiments of the present application. This article uses specific examples to illustrate the principles and implementation methods of the present application. The description of the above embodiments is only used to help understand the method and core ideas of the present application; at the same time, for those skilled in the art, according to the ideas of the present application, there will be changes in the specific implementation methods and application scopes. In summary, the content of this specification should not be understood as a limitation on the present application.
Claims
1. A method for powering off a cache data block, characterized in that: include: Receive a cache data block power-off request; Based on the cache data block power-off request, determine the data blocks to be powered off and the data blocks not to be powered off in the cache; Transferring the dirty data blocks in the to-be-powered-down data blocks to the positions of the corresponding non-dirty data blocks in the non-powered-down data blocks to replace the non-dirty data blocks, wherein the non-dirty data blocks available for replacement are non-dirty data blocks in the same group and the same row as the dirty data blocks; After all dirty data blocks in the data blocks to be powered off are transferred, all the data blocks to be powered off are powered off.
2. The cache data block power-off method according to claim 1, characterized in that: The process of transferring the dirty data blocks in the to-be-powered-off data blocks to the positions of the corresponding non-dirty data blocks in the non-powered-off data blocks to replace the non-dirty data blocks includes: For each dirty data block in the data blocks to be powered off, determining whether the dirty data block has a non-dirty data block available for replacement in the data blocks that are not powered off; If yes, the dirty data block is transferred to a position of a replaceable non-dirty data block in the non-power-off data block to replace the non-dirty data block.
3. The cache data block power-off method according to claim 2, characterized in that: After determining whether the dirty data block has a non-dirty data block that can be replaced in the non-power-off data block, the method further includes: If not, the dirty data block is transferred to the memory.
4. The cache data block power-off method according to any one of claims 1 to 3, characterized in that: Before transferring the dirty data blocks in the to-be-powered-off data blocks to the positions of the replaceable non-dirty data blocks in the non-powered-off data blocks to replace the non-dirty data blocks, the method further includes: Determine whether a preset flag exists in the flag bit of each data block in the cache; A data block whose flag bit has a preset flag is determined as a dirty data block, and a data block whose flag bit does not have a preset flag is determined as a non-dirty data block.
5. The cache data block power-off method according to any one of claims 1 to 3, characterized in that: Each data block in the cache is controlled by a switch, each switch controls a plurality of data blocks, and determining the data blocks to be powered off and the data blocks not to be powered off in the cache based on the power-off request of the cache data blocks comprises: Based on the cache data block power-off request, determining a power-off switch from all switches; All data blocks controlled by the power-off switch are determined as data blocks to be powered off, and other data blocks in the cache except the data blocks to be powered off are determined as data blocks not to be powered off.
6. The cache data block power-off method according to claim 5, characterized in that: The cache data block power-off request includes a power-off ratio, and determining the power-off switch from all switches based on the cache data block power-off request includes: Determining the number of switches that need to be disconnected according to the power-off ratio; Select switches corresponding to the number of switches from all switches as power-off switches.
7. The cache data block power-off method according to claim 6, characterized in that: The step of powering off all the data blocks to be powered off includes: Turn off all power-off switches to power off all data blocks to be powered off.
8. A cache data block power-off device, characterized in that: include: A receiving module, used for receiving a power-off request of a cache data block; A first determining module, configured to determine data blocks to be powered off and data blocks not to be powered off in the cache based on the power-off request of the cache data blocks; A transfer module, used for transferring dirty data blocks in the data blocks to be powered off to positions of corresponding non-dirty data blocks in the data blocks not to be powered off, so as to replace the non-dirty data blocks, wherein the non-dirty data blocks available for replacement are non-dirty data blocks in the same group and the same row as the dirty data blocks; The power-off module is used to power off all the data blocks to be powered off after all dirty data blocks in the data blocks to be powered off have been transferred.
9. An integrated circuit chip, wherein: The integrated circuit chip includes the cache data block power-off device according to claim 8, and can execute the steps in the cache data block power-off method according to any one of claims 1 to 7.
