WO2019127104A1 - 高速缓存中资源调整方法、数据访问方法及装置 - Google Patents

高速缓存中资源调整方法、数据访问方法及装置 Download PDF

Info

Publication number
WO2019127104A1
WO2019127104A1 PCT/CN2017/119013 CN2017119013W WO2019127104A1 WO 2019127104 A1 WO2019127104 A1 WO 2019127104A1 CN 2017119013 W CN2017119013 W CN 2017119013W WO 2019127104 A1 WO2019127104 A1 WO 2019127104A1
Authority
WO
WIPO (PCT)
Prior art keywords
flag
cache
data
rows
row
Prior art date
Application number
PCT/CN2017/119013
Other languages
English (en)
French (fr)
Inventor
罗日新
李渊
程捷
Original Assignee
华为技术有限公司
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by 华为技术有限公司 filed Critical 华为技术有限公司
Priority to PCT/CN2017/119013 priority Critical patent/WO2019127104A1/zh
Priority to CN201780097989.4A priority patent/CN111602377B/zh
Publication of WO2019127104A1 publication Critical patent/WO2019127104A1/zh

Links

Images

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F12/00Accessing, addressing or allocating within memory systems or architectures
    • G06F12/02Addressing or allocation; Relocation
    • G06F12/08Addressing or allocation; Relocation in hierarchically structured memory systems, e.g. virtual memory systems

Definitions

  • the present application relates to the field of computer technologies, and in particular, to a resource adjustment method, a data access method, and related devices and devices in a cache.
  • a cache In the hierarchy of computer storage systems, a cache (cache, referred to simply as a cache) is a high-speed, small-capacity memory interposed between a central processor and main memory.
  • the cache is the data in the main memory (memory).
  • main memory main memory
  • the Cache includes a tag field (Tag Ram) and a data field (Date Ram), wherein the flag field includes a plurality of tag entries (Tag Entry), the data field includes a plurality of data rows (Date Entry), a flag row and a data row map. , forming a cache line.
  • the cache line is the smallest unit of Cache and subordinate Cache, or Cache and memory data exchange.
  • In-memory data stores data in units of data blocks, and cache lines exchange data with blocks in memory.
  • the size of data stored in one block of memory is the same as the size of data that can be stored in a cache line in the cache.
  • the data in the main memory is stored in a limited cache, and the main memory address where the data block is located must be mapped to the cache address.
  • Mapping methods include direct mapping, fully connected mapping, group connected mapping, or other mapping methods.
  • the cache line may be deduplicated or compressed.
  • the compressed or deduplicated cache does not have a large number of data lines of the same data, and multiple flag lines may map the same data line.
  • the mapping of the flag domain and the data domain may be implemented by a doubly linked list, a singly linked list, or other implementations.
  • the purpose of the present application is to provide a resource adjustment method, a data access method, and related devices and devices in a cache, which can increase a cached address space of a cache, increase a cache capacity, and improve data processing efficiency.
  • an embodiment of the present invention provides a method for adjusting a resource in a cache, where the cache can implement data deduplication, including a data domain and a flag domain, and the method includes:
  • P idle data lines in the data domain are divided into Q flag lines;
  • the data The domain includes a plurality of data rows, the plurality of data rows including the P idle data rows; P and Q are positive integers;
  • the mapping relationship between the Q flag rows and the in-memory data blocks is configured to multiplex the P idle data rows in the data domain into the Q flag rows.
  • the data domain is reused as a flag domain, thereby increasing the address space of the cache, increasing the capacity of the cache, and improving the data processing efficiency.
  • mapping relationship between the Q flag rows and the in-memory data blocks is based on a cache and memory mapping manner, including:
  • mapping relationship between the Q flag rows and the data blocks in the memory is stored by using a mapping relationship table according to a mapping manner between the cache and the memory;
  • the mapping relationship table includes address information of the first flag row; the address information includes a cache block number and an intra-block number; the cache block number is used to indicate that the data row of the first flag row belongs to An address in the data field, the intra-block number is used to indicate an address of the first flag row in a data row to which the first flag row belongs; the first flag acts as any one of the Q flag rows Flag line.
  • mapping of Q label lines and memory in the data domain can be realized by mapping the relationship table.
  • the Cache can locate the flag line by accessing the mapping relationship table.
  • mapping manner between the cache and the memory is a fully-connected mapping;
  • the storage space of the mapping relation table includes at least Q storage units; and the storing the Q by using the mapping relationship table.
  • the mapping relationship between the flag line and the in-memory data block includes:
  • the address information of the Q flag rows are respectively written into the Q memory cells.
  • the above method provides a storage structure of the mapping relation table in a fully connected mapping mode.
  • the mapping manner between the cache and the memory is an N-way group connection mapping
  • the cache line of the cache is divided into M groups, and M and N are positive integers
  • the method further includes: mapping the first flag row to the group number and the block number in the group.
  • mapping between the original cache and the memory is the N-way group connection mapping.
  • the storage structure of the following three mapping relationship tables is provided in the embodiment of the present invention:
  • the first type the storage space of the mapping relationship table includes Q storage units, the Q storage units are arranged in an array of M rows and R columns, and the Q flag rows and in-memory data are stored by the mapping relationship table.
  • the mapping relationship of blocks includes:
  • the group number of the kth flag row is i-1, and the block number of the kth flag row is N+j-1;
  • the above method provides a storage structure of the mapping relationship table in a group connection mapping manner.
  • an idle data line is divided into D*M flag lines, D is a positive integer;
  • the storage space of the mapping relationship table includes at least R storage units, and the R storage units are arranged in R rows and 1 column. Array arrangement, the storage unit includes M+1 storage subunits, R ⁇ Q/M, and R is a positive integer;
  • the mapping relationship between the Q flag rows and the in-memory data blocks by using the mapping relationship table includes:
  • the block number of the kth flag row is N+i-1, and the group number of the kth flag row is j-2;
  • mapping relationship table only stores the cache block number once, and reduces the storage space of the mapping relationship table.
  • the third type H idle data lines are divided into M flag rows, H is a positive integer;
  • the storage space of the mapping relationship table includes at least R storage units, and the R storage units are arranged in an array of R rows and 1 column
  • the mapping relationship between the Q flag rows and the in-memory data blocks by using the mapping relationship table includes:
  • the i-th storage unit includes a cache block number of the data row to which the kth flag row belongs, and the M flag lines in the (i-1)*M+1 to i*M through the kth flag line Sorting indicates the in-block number of the kth flag line;
  • the group block number of the kth flag row is N+i-1, and the group number of the kth flag row is the (kth) flag row at (i-1)*M+1 to i *M is sorted in M flag rows;
  • (i-1)*M+1 ⁇ k ⁇ i*M, i, k are positive integers; R ⁇ Q/M, and R is a positive integer.
  • the method further includes:
  • the storage space of the idle data row in the data domain is greater than the first threshold, and the operation of dividing the P idle data rows in the data domain into Q flag rows is triggered to optimize the cache processing efficiency.
  • the method further includes:
  • the Q flag rows include the S flag rows; S ⁇ Q, T ⁇ P, and S and T are positive integers.
  • the method further includes:
  • the Q flag rows include the S flag rows; S ⁇ Q, T ⁇ P, and S and T are positive integers.
  • the cache and the memory are mapped in a group connection manner, the cache includes multiple cache groups, and the cache line corresponding to the S flag rows in the data domain is Mapping to the S flag lines in the flag domain includes:
  • the second flag acts on any one of the S flag rows in the data domain.
  • an embodiment of the present invention further provides a data access method in a cache, where the method includes:
  • Reading the mapping relationship between the cache and the memory comparing the main memory address with the label field of the cache line, and checking whether the cache line of the request is hit;
  • the cache may implement data deduplication, including a data domain and a flag field; the data domain includes Q flag rows, and the Q flag rows are divided by P idle data rows in the data domain;
  • the mapping relationship between the cache line and the in-memory data block in the cache includes a mapping relationship between the Q flag lines and a data block in the memory.
  • the data field includes Q flag rows
  • the cache compares the main memory address and the tag field of the cache line according to the mapping relationship between the cache and the memory during data access, and determines whether the request is hit, so as to implement partial restoration of the data domain.
  • the data domain is multiplexed into the flag domain, the cached address space of the cache is increased, the capacity of the cache is increased, and the data processing efficiency is improved.
  • the cache and the memory are mapped in a fully connected manner; the comparing the main memory address and the label field of the cache line to check whether there is a cache line that hits the request includes:
  • the main memory address includes a main memory block mark and an intra-block address; the label field of the mark line includes a main memory block mark.
  • the above method provides a method for checking whether a request is hit in a fully connected mapping mode.
  • the cache and the memory are mapped in a group connection manner; the cache is divided into multiple cache groups, and the address of the main memory address and the cache line is compared, and the cache is viewed. Whether there are cache lines that hit the request include:
  • the main memory address includes a main memory block mark, a group number, and an address within the block; the label field of the flag line includes a main memory block mark.
  • the above method provides a method for checking whether a request is hit in a group connection mapping mode.
  • the mapping manner between the cache and the memory is a group connection mapping; after the determining the cache group according to the group number in the main storage address, comparing the main storage address Before the main memory block is marked with the label field of all the flag lines in the cache group, the method further includes:
  • the mapping relationship table is configured to store a mapping relationship between the Q flag rows and an in-memory data block, including address information of the first flag row, a group number corresponding to the first flag row, and an intra-group block.
  • the address information includes a cache block number and an intra-block number; the cache block number is used to indicate an address of the data line to which the first flag line belongs in the data field, and the block number is used to indicate Determining, by the first flag, an address in a data row to which the first flag row belongs; the first flag acts as any one of the Q flag rows.
  • the above method provides a method for locating a cache line in a group number in a group connection mapping mode.
  • mapping manner between the cache and the memory is connected to the N+R way group; and the searching for the flag line corresponding to the group number in the data domain according to the mapping relationship table,
  • the flag line corresponding to the group number in the data field, the flag line in the cache group includes:
  • R flag rows corresponding to the group number in the Q flag rows; the R flags are in the cache group flag row; wherein, R Q/M, R is Integer.
  • the above method provides a method for checking whether a request is hit after the cache line is located in the group number in the group connection mapping mode.
  • the method further includes:
  • the data in the cache line corresponding to the S flag rows in the data domain is returned Write to the memory;
  • the Q flag rows include the S flag rows; S ⁇ Q, T ⁇ P, and S and T are positive integers.
  • the method further includes:
  • the Q flag rows include the S flag rows; S ⁇ Q, T ⁇ P, and S and T are positive integers.
  • the cache and the memory are mapped in a group connection manner, the cache includes multiple cache groups, and the cache line corresponding to the S flag rows in the data domain is Mapping to the S flag lines in the flag domain includes:
  • the second flag acts on any one of the S flag rows in the data domain.
  • an embodiment of the present invention further provides a cache, where the cache can implement data deduplication, including a data storage and a cache controller, where the data storage includes a data domain and a flag domain, and the cache controller include:
  • a dividing unit configured to divide P idle data rows in the data domain into Q flags in a case where data deduplication operation for a cache line is detected and the number of idle data rows in the data domain satisfies a first condition
  • the data field includes a plurality of data rows, the plurality of data rows including the P idle data rows; P and Q are positive integers;
  • a configuration unit configured to map a mapping relationship between the Q flag rows and an in-memory data block, so that the P idle data rows in the data domain are multiplexed into the Q Flag line.
  • the configuration unit is specifically configured to:
  • mapping relationship between the Q flag rows and the data blocks in the memory is stored by using a mapping relationship table according to a mapping manner between the cache and the memory;
  • the mapping relationship table includes address information of the first flag row; the address information includes a cache block number and an intra-block number; the cache block number is used to indicate that the data row of the first flag row belongs to An address in the data field, the intra-block number is used to indicate an address of the first flag row in a data row to which the first flag row belongs; the first flag acts as any one of the Q flag rows Flag line.
  • the cache and the memory are mapped in a per-connected manner;
  • the storage space of the mapping relationship table includes at least Q storage units; and the configuration unit stores the
  • the mapping relationship between the Q flag lines and the data blocks in the memory includes:
  • the address information of the Q flag rows are respectively written into the Q memory cells.
  • the mapping manner between the cache and the memory is an N-way group connection mapping
  • the cache line of the cache is divided into M groups, and M and N are positive integers
  • the method further includes: mapping the first flag row to the group number and the block number in the group.
  • the storage space of the mapping relationship table includes Q storage units, and the Q storage units are arranged in an array of M rows and R columns, and the configuration unit stores the
  • the mapping relationship between the Q flag lines and the data blocks in the memory includes:
  • the group number of the kth flag row is i-1, and the block number of the kth flag row is N+j-1;
  • one idle data row is divided into D*M flag rows, and D is a positive integer;
  • the storage space of the mapping relationship table includes at least R storage units, and the R storage units Arranged in an array of R rows and 1 column, the storage unit includes M+1 storage subunits, R ⁇ Q/M, and R is a positive integer;
  • the configuration unit stores the Q flag rows and memory through a mapping relationship table.
  • the mapping relationship of the data blocks includes:
  • the block number of the kth flag row is N+i-1, and the group number of the kth flag row is j-2;
  • the H idle data lines are divided into M flag rows, and H is a positive integer;
  • the storage space of the mapping relationship table includes at least R storage units, and the R storage units are R Array arrangement of row 1 columns;
  • the configuration unit stores a mapping relationship between the Q flag rows and the data blocks in the memory by using a mapping relationship table, which specifically includes:
  • the i-th storage unit includes a cache block number of the data row to which the kth flag row belongs, and the M flag lines in the (i-1)*M+1 to i*M through the kth flag line Sorting indicates the in-block number of the kth flag line;
  • the group block number of the kth flag row is N+i-1, and the group number of the kth flag row is the (kth) flag row at (i-1)*M+1 to i *M is sorted in M flag rows;
  • (i-1)*M+1 ⁇ k ⁇ i*M, i, k are positive integers; R ⁇ Q/M, and R is a positive integer.
  • the cache controller further includes:
  • the cache controller further includes:
  • a write-back unit configured to: correspond to S flag rows in the data domain if the number of data rows that are idle in the cache is less than a second threshold or the cache miss rate is greater than a third threshold The data in the cache line is written back to the memory;
  • a first recovery unit configured to restore the S flag rows to T data rows, and clear a mapping relationship between the S flag rows and the in-memory data blocks;
  • the Q flag rows include the S flag rows; S ⁇ Q, T ⁇ P, and S and T are positive integers.
  • the cache controller further includes:
  • mapping unit configured to cache the S flag rows in the data domain if the number of data rows that are idle in the cache is less than a second threshold or the cache miss rate is greater than a third threshold The row is mapped to the cache line corresponding to the S flag rows in the flag domain;
  • a second recovery unit configured to restore the S flag rows to T data rows, and clear a mapping relationship between the S flag rows and the in-memory data blocks
  • the Q flag rows include the S flag rows; S ⁇ Q, T ⁇ P, and S and T are positive integers.
  • the cache and the memory are mapped in a group connection manner
  • the cache includes multiple cache groups
  • the mapping unit corresponds to the S flag rows in the data domain.
  • the cache line is mapped to the cache line corresponding to the S flag lines in the flag domain, and specifically includes:
  • the second flag acts on any one of the S flag rows in the data domain.
  • an embodiment of the present invention further provides a data access method in a cache, where the cache can implement data deduplication, including a data storage and a cache controller, where the data storage includes a data domain and a flag domain.
  • the cache controller includes:
  • a receiving unit configured to receive a request sent by the processor to carry a main memory address
  • a hit determination unit configured to read a mapping relationship between the cache and the memory, compare the main storage address with a label field of the cache line, and check whether the cache line of the request is hit;
  • a first response unit configured to access data in the cache line that is hit when there is a cache line that hits the request; or a second response unit, configured to allocate a cache line when there is no cache line that hits the request Reading the data corresponding to the main memory address in the memory to the allocated cache line, and accessing the data in the allocated cache line;
  • the data field includes Q flag rows, and the Q flag rows are divided by P idle data rows in the data domain; the mapping relationship between the cache line and the in-memory data block in the cache includes The mapping relationship between the Q flag rows and the data blocks in the memory is described.
  • the cache and the memory are mapped in a fully connected manner; the hit determination unit compares the main memory address with a label field of the cache line to check whether there is a hit request.
  • Cache line specifically:
  • the main memory address includes a main memory block mark and an intra-block address; the label field of the mark line includes a main memory block mark.
  • the cache and memory are mapped in a group connection manner; the cache is divided into multiple cache groups, and the hit determination unit compares the main storage address and the cache line. Address to see if there is a cache line that hits the request, including:
  • the main memory address includes a main memory block mark, a group number, and an address within the block; the label field of the flag line includes a main memory block mark.
  • mapping manner between the cache and the memory is a group connection mapping; the cache controller further includes:
  • a searching unit configured to compare the main memory block mark of the main memory address with all the flag lines in the cache group after the hit determining unit determines the cache group according to the group number in the main memory address Before the label field, the flag row corresponding to the group number in the data domain is searched according to the mapping relationship table, and the flag corresponding to the group number in the data domain acts as a flag row in the cache group;
  • the mapping relationship table is configured to store a mapping relationship between the Q flag rows and an in-memory data block, including address information of the first flag row, a group number corresponding to the first flag row, and an intra-group block.
  • the address information includes a cache block number and an intra-block number; the cache block number is used to indicate an address of the data line to which the first flag line belongs in the data field, and the block number is used to indicate Determining, by the first flag, an address in a data row to which the first flag row belongs; the first flag acts as any one of the Q flag rows.
  • mapping manner between the cache and the memory is connected to an N+R way group; and the searching unit is specifically configured to:
  • R flag rows corresponding to the group number in the Q flag rows; the R flags are in the cache group flag row; wherein, R Q/M, R is Integer.
  • the cache controller further includes:
  • a write-back unit configured to: correspond to S flag rows in the data domain if the number of data rows that are idle in the cache is less than a first threshold or the cache miss rate is greater than a second threshold The data in the cache line is written back to the memory;
  • a first recovery unit configured to restore the S flag rows to T data rows, and clear a mapping relationship between the S flag rows and the in-memory data blocks;
  • the Q flag rows include the S flag rows; S ⁇ Q, T ⁇ P, and S and T are positive integers.
  • the cache controller further includes:
  • mapping unit configured to: corresponding to the S flag rows in the data domain, where the number of data rows that are idle in the cache is less than a first threshold or the cache miss rate is greater than a second threshold The cache line is mapped to the cache line corresponding to the S flag lines in the flag domain;
  • a second recovery unit configured to restore the S flag rows to T data rows, and clear a mapping relationship between the S flag rows and the in-memory data blocks
  • the Q flag rows include the S flag rows; S ⁇ Q, T ⁇ P, and S and T are positive integers.
  • the cache and the memory are mapped in a group connection manner
  • the cache includes multiple cache groups
  • the mapping unit corresponds to the S flag rows in the data domain.
  • the cache line is mapped to the cache line corresponding to the S flag lines in the flag domain, and specifically includes:
  • the second flag acts on any one of the S flag rows in the data domain.
  • an embodiment of the present invention further provides a computing device, where the computing device includes: at least one processor and a memory, the processor includes at least one cache; the memory includes a memory; The function of the computing device is performed by the cache invoking data and programs in the memory, the cache being used to perform some or all of the processes as described in the first aspect.
  • the embodiment of the present invention further provides a computing device, where the computing device includes: at least one processor and a memory, the processor includes at least one cache; the memory includes a memory; The functions of the computing device are performed by the cache invoking data and programs in the memory, the cache being used to perform some or all of the processes as described in the second aspect.
  • FIG. 1 is a schematic block diagram of a computer processing system according to an embodiment of the present invention.
  • FIG. 2 is a schematic diagram of a framework of a cache provided by an embodiment of the present invention.
  • FIG. 3A is a schematic explanatory diagram of a direct mapping between a memory and a cache according to an embodiment of the present invention
  • FIG. 3B is a schematic explanatory diagram of a main memory address and a cache address in a direct mapping according to an embodiment of the present invention
  • FIG. 3C is a schematic explanatory diagram of a memory and cache fully connected mapping according to an embodiment of the present invention.
  • FIG. 3D is a schematic explanatory diagram of a main memory address and a cache address in a fully connected mapping according to an embodiment of the present invention
  • FIG. 3E is a schematic explanatory diagram of a connection mapping between a memory and a cache group according to an embodiment of the present invention.
  • FIG. 3F is a schematic explanatory diagram of a main memory address and a cache address in a group connection mapping according to an embodiment of the present invention.
  • FIG. 4 is a schematic diagram of a data structure of a cache according to an embodiment of the present invention.
  • FIG. 5 is a schematic flowchart of a method for resource adjustment in a cache according to an embodiment of the present invention
  • FIG. 6A is a schematic diagram of a storage structure of a mapping relationship table in a fully connected mapping shown in FIG. 6A;
  • FIG. 6B is a schematic diagram of a storage structure of a mapping relationship table in a fully connected mapping shown in FIG. 6B;
  • FIG. 6C is a schematic diagram of a storage structure of a mapping relation table in a fully connected mapping shown in FIG. 6C;
  • FIG. 6D is a schematic diagram of a storage structure of a mapping relationship table in a group connection map shown in FIG. 6D;
  • FIG. 6E is a schematic diagram of a storage structure of a mapping relationship table in a group connection mapping shown in FIG. 6E;
  • FIG. 6F is a schematic diagram of a storage structure of a mapping relationship table in a group connection mapping shown in FIG. 6F;
  • 6G is a schematic explanatory diagram of a flag line in a cache according to an embodiment of the present invention.
  • FIG. 7 is a schematic diagram of a 4-way group connected to a 5-way group connected according to an embodiment of the present invention.
  • FIG. 8 is a schematic flowchart of a data access method in a cache according to an embodiment of the present invention.
  • FIG. 9 is a schematic structural diagram of a cache provided by an embodiment of the present invention.
  • FIG. 10 is a schematic structural diagram of a cache controller according to an embodiment of the present invention.
  • FIG. 11 is a schematic structural diagram of a cache provided by an embodiment of the present invention.
  • FIG. 12 is a schematic structural diagram of a cache controller according to an embodiment of the present invention.
  • CPU central processing unit
  • cache cache
  • main memory also referred to as a main memory
  • the CPU, the Cache, and the memory involved in the present invention can be applied to a computing device.
  • the computing device can include a processor and a memory.
  • the electronic terminal can include a computer, a smart phone, a tablet, a smart TV, a smart bracelet, and a VR glasses.
  • a wearable device such as a smart watch, an in-vehicle terminal, or the like is not limited in the present invention.
  • FIG. 1 is a schematic block diagram of a computer processing system including a processor, a cache memory, and a memory according to an embodiment of the present invention. It will be appreciated that the computer processing system illustrated in Figure 1 can also be located in a single computing device.
  • the processor may be a single-core processor or a multi-core processor, that is, includes a first core CPU and a second core CPU, and the processor may include three levels of cache memory, which are respectively a level 1 cache (also referred to as L1Cache). ), two-level cache (also known as L2Cache) and three-level cache (also known as L3Cache).
  • L1Cache consists of an instruction cache and a data cache.
  • the L2Cache or L3Cache can include data and instructions.
  • L1Cache and L2Cache are unique to each core, and L3Cache is shared by all cores in the same CPU.
  • the Cache is divided into multiple cache lines. Each cache line can be 64 bits, 126 bits, or other values.
  • the cache line is the minimum unit of the Cache and the lower level cache, or the Cache and memory data exchange.
  • In-memory data stores data in units of data blocks, and cache lines exchange data with blocks in memory.
  • the size of data stored in one block of memory is the same as the size of data that can be stored in a cache line in the cache.
  • the data in the main memory is stored in a limited cache, and the main memory address where the data block is located must be mapped to the cache address.
  • Mapping methods include but are not limited to direct mapping, fully connected mapping, group connected mapping, or other mapping methods.
  • FIG. 2 is a schematic diagram of a framework of a cache according to an embodiment of the present invention.
  • the Cache includes two parts: a cache controller 210 and a cache memory 220.
  • the cache memory includes a tag field (Tag Ram) 221 and a data field (Date Ram) 222.
  • the flag field includes a plurality of tag entries (Tag Entry), the data field includes a plurality of data rows (Date Entry), a flag row and a data row map to form a cache line.
  • the cache is a cache that can be compressed or deduplicated. A large number of data rows of the same data do not exist in the cache, and multiple flag rows can map one data row.
  • the implementation of the mapping of the flag field and the data field may include, but is not limited to, a doubly linked list, a singly linked list, or other implementations, and the present invention is not limited thereto.
  • the cache controller 210 is configured to receive a request for carrying a main memory address sent by the CPU, search for a cache line that is hit in the cache, and if so, a cache hit, and the cache controller reads the cache line in the hit.
  • the data (in the case of the request type is read request), and returned to the CPU; otherwise, the cache miss, the cache controller reads the data in the memory 240 to the idle cache line, and then from the cache line
  • the read data is returned to the CPU to implement the processing of the request.
  • the cache controller communicates with the memory via the bus 230.
  • the cache controller 210 also counts the hit rate of the request sent by the CPU, and can also implement data deduplication. When the data stored in multiple cache lines is consistent, the data rows can be shared, and the data rows can be mapped to multiple flag rows to implement data deduplication.
  • the memory is divided into a plurality of data blocks, and each data block is distinguished by a main memory block mark.
  • the data field in the cache is divided into a plurality of cache blocks (also referred to herein as data lines), and each cache block is distinguished by a cache block mark (also referred to herein as a cache block number).
  • FIG. 3A is a schematic explanatory diagram of a direct mapping between a memory and a cache according to an embodiment of the present invention.
  • Direct mapping is a many-to-one mapping relationship, that is, data blocks in main memory can only be mapped to unique cache lines, and multiple data blocks can map the same cache line.
  • FIG. 3B is a schematic explanatory diagram of a main memory address and a cache address in a direct mapping according to an embodiment of the present invention.
  • the main memory address includes the main memory block mark, the cache block mark, and the address within the block.
  • the Cache address includes the cache block tag and the address within the block.
  • main memory block mark can be a main memory block number
  • cache block mark can be a cache block number
  • the cache line is found according to the "cache block mark" field in the middle of the main memory address, for example, the cache behavior is the first cache line, and then the label of the first cache line is compared ( Whether the Tag field matches the "main memory block tag” bit of the main memory address, if it is consistent, it indicates that the first cache line has been associated with the data block to be accessed by the request in the main memory, the first cache line Hit the request sent by the CPU.
  • FIG. 3C is a schematic explanatory diagram of a memory and cache fully connected mapping according to an embodiment of the present invention.
  • a fully connected mapping is a many-to-many mapping. Any data block in main memory can be mapped to any cache line in the cache.
  • FIG. 3D is a schematic explanatory diagram of a main memory address and a cache address in a fully connected mapping according to an embodiment of the present invention.
  • the main memory address includes the main memory block mark and the address within the block.
  • the Cache address includes the cache block tag and the address within the block.
  • main memory block mark can be a main memory block number
  • cache block mark can be a cache block number
  • the "main memory block tag" in the main memory address is compared with the tag field of each cache line in the cache, and if found in the main memory address "main” If the cache line of the same tag is marked, the cache line of the same tag as the "main memory block tag" in the main memory address hits the request sent by the CPU.
  • FIG. 3E is a schematic explanatory diagram of a memory and cache group connection mapping according to an embodiment of the present invention.
  • Group-linked mapping means that both main memory and cache are grouped, direct mapping is used between groups, and fully connected mapping is used in the group. For example, a block buffer block in a cache is divided into M groups, and each group includes an R block cache line. If there are n cache lines in each group, the mapping mode is also called n-way group association.
  • the mapping relationship shown in FIG. 3E is a 2-way set associative.
  • FIG. 3F is a schematic explanatory diagram of a main memory address and a cache address in a group connection mapping according to an embodiment of the present invention.
  • the main memory address includes an s-bit main memory block flag, a q-bit group number, and an address within the b-bit word block.
  • the Cache address includes the q-bit group number, the block number within the e-bit group, and the address within the b-bit block.
  • the cache When the cache receives the request for carrying the main memory address sent by the CPU, it first finds the group where the cache line is located by the “group number” in the main memory address, and then passes the “main memory block” in the main memory address according to the fully associative mapping mode. The "mark” field is compared with the Tag field of each cache line in the group. If a cache line with the same mark as the "main memory block mark” in the main memory address is found, the "main memory block mark” in the main memory address. The cache line of the same tag hits the request sent by the CPU, determines the block number corresponding to the cache line of the hit according to the mapping relationship between the cache and the memory, and further determines the hit cache line based on the group number and the block number in the group.
  • Sc is the size of the cache line
  • Ns is the number of groups in the cache
  • the main memory block is marked.
  • the number of groups is unchanged, and the number of blocks in the group (that is, the number of cache lines in the group) is increased.
  • the length of the block number in the group is e>log 2 n , and e is a positive integer, where n is the number of connected paths of the group.
  • the size of the cache is 4Mb
  • the length of the cache line is 64b
  • the main memory address is 32 bits.
  • the length b of the address in the block is 8 bits
  • the length q of the group number is 12 bits.
  • the length s of the main memory block mark is 12 bits. Due to the need for resource adjustment, the minimum length e of the block number in the group is at least 3 bits, and the length of the address in the group can be expanded to 4 or 5 bits, etc., to adapt to the requirement of the block number in the group after resource adjustment.
  • FIG. 4 is a schematic diagram of a data structure of a cache according to an embodiment of the present invention.
  • the Cache can implement data deduplication, and can include a flag field and a data field.
  • the cache can also include a hash table. This hash table is not shown in FIG.
  • the flag field includes multiple flag lines of the Cache, such as the flag lines T0, T1, T2, etc. in FIG. 4; the data field includes multiple data lines of the Cache, and the data fields in FIG. 4 are marked as d0, d1, d2, etc. Wait for the data line.
  • the hash table is used to store the hash value of the newly stored data and is used to determine whether the data is duplicated.
  • the marker arrays are arranged in a 4-way group connection.
  • the flag line includes a tag field, a data pointer (Tptr) field, a tag index field, and the like.
  • the flag line may also include an elimination algorithm identification field or other fields, which is not limited by the present invention.
  • the Tag field includes a main memory block mark field, a state field, a valid bit, and the like of the cache line.
  • the Tag field may also include an elimination algorithm identifier field or other fields, and the like.
  • the main memory block mark field of the flag line may be a main memory block mark corresponding to the data block in the main memory where the data is stored.
  • the status field is used to store the consistency status of the cache line.
  • the consistency status of the cache line may include, but is not limited to, a modified state (also referred to as an M state), an exclusive state (also referred to as an E state), and a share (The shared state (also known as the S state) and the invalid state (also known as the I state).
  • a valid field is used to indicate whether the stored data of the cache line is valid.
  • the revoked algorithm identifier field is used to indicate the culling algorithm used by the cache line, and may be an LRU (Least Recently Used) tag or other tag, which is not limited by the present invention.
  • the Tptr field indicates the address of the data line corresponding to the flag line.
  • the tag index field indicates an index of a plurality of flag rows that map the same data row.
  • the manner of indexing may be a doubly linked list, a singly linked list or other forms, which is not limited by the present invention.
  • the mark index field includes a forward linked list and a backward linked list, wherein the forward linked list indicates an index of the previous marked row, when the newly stored cache line is consistent with the data in the data row corresponding to the plurality of flag rows
  • the backward linked list saves the index of the flag row corresponding to the newly added cache line, otherwise it is empty. Multiple flag rows in a doubly linked list or a singly linked list map the same data row.
  • the data line may include a header (Dptr) field, a data (Data Frame) field, a pointer (Ctr) field, and the like.
  • the data line may also include a flag field or other fields, etc., which are not limited in the present invention.
  • the Dptr field indicates an index of the flag row, which may be a header of a doubly linked list or a singly linked list, where the doubly linked list or the singly linked list is a linked list of all the marked rows corresponding to the data row.
  • the Data Frame field stores data, the length of the cache line, and so on.
  • the Ctr field indicates the number of flag lines to which the data line is shared, that is, there are several flag lines that share the data line.
  • Ctr When a newly added flag line is added, Ctr is increased, and vice versa. When Ctr is 0, it indicates that the data line is not used, and other data can be reallocated for storage.
  • the flag field is used to indicate whether the data line has been deduplicated.
  • the data line may also include other fields, such as an error-correcting code (ECC) field, which is not limited by the present invention.
  • ECC error-correcting code
  • the cache can implement data deduplication, including data fields and flag fields.
  • data deduplication including data fields and flag fields.
  • the cache can divide some idle data rows into multiple flag rows, thereby realizing multiplexing of the data domain into a flag domain, thereby increasing the address space of the cache. Increase the cache capacity and improve data processing efficiency.
  • FIG. 5 is a schematic flowchart of a method for resource adjustment in a cache according to an embodiment of the present invention. Each step in the method may be performed by a computer device or a cache or cache controller in a computer device.
  • the cache in the computer device is used as an example to introduce a method for resource adjustment in the cache, and the method includes all or part of the following steps:
  • Step S500 The cache divides P idle data rows in the data domain into Q flag rows in a case where the data de-duplication operation for the cache line is detected and the number of idle data rows in the data domain satisfies the first condition; the data domain includes A plurality of data rows including P idle data rows; P and Q are positive integers.
  • the cache can detect the number of idle data rows in the data domain, and perform resource adjustment when the number of idle data rows in the data domain satisfies the first condition, that is, the data domain
  • the P idle data lines are divided into Q flag lines.
  • the flag field composed of the Q flag lines is a new flag field.
  • Q P*Sc/St, where Sc is the length of one data line, and St is the length of one flag line; optionally, when Sc/St is a non-integer, Sc/St can Take the quotient and avoid a flag line that spans two rows of data.
  • P idle data lines may be data rows with consecutive cache block numbers, or data rows with cache block numbers not associated.
  • the invention is defined.
  • Step S501 Based on the mapping manner between the cache and the memory, the cache establishes a mapping relationship between the Q flag rows and the data blocks in the memory, so that P idle data rows in the data domain are multiplexed into Q flag rows.
  • the data structure of the Q flag lines in the data field is the same as the data structure of the flag lines in the flag field.
  • For the data structure of the flag line refer to the related description in the data structure of the above cache, and the present invention will not be described again.
  • the data row multiplexed into the flag row is no longer a data row, and cannot be used to cache data, and can be used as a flag row; when the data row multiplexed into the flag row is demultiplexed, the data row is demultiplexed.
  • the data line restores the data cache function.
  • the method before the step S500, further includes: when the storage space of the idle data row in the data domain is greater than the first threshold, the number of idle data rows in the data domain satisfies the first condition; otherwise, the data domain The number of idle data lines does not satisfy the first condition, and the cache may end the process of resource adjustment, and may perform other operations, which are not limited by the present invention.
  • the first threshold may be a preset number of flag row storage spaces, or may be a storage space of a preset number of data rows, which is not limited in the present invention.
  • the preset number may be greater than the number of data rows required to divide the M flag lines.
  • first condition may also include other forms, which are not limited by the present invention.
  • an implementation manner of step S501 may include: storing, according to a mapping manner between a cache and a memory, a mapping relationship between the Q flag rows and the data blocks in the memory by using the mapping relationship table.
  • the mapping relationship table includes address information of the first flag row; the address information includes a cache block number and an intra-block number; the cache block number is used to indicate an address of the data row to which the first flag row belongs in the data domain, the block The inner number is used to indicate the address of the first flag line in the data line to which the first flag line belongs; the first flag acts on any one of the Q flag lines.
  • the data field includes a plurality of data rows, and each data row is numbered according to the order of its address, and the number is a cache block number. Generally, the length of the data line is much larger than the length of the flag line.
  • one data line is divided into a plurality of flag lines, and the flag lines divided in each data line can be based on the address thereof. The numbers are numbered sequentially, which is the number within the block.
  • mapping table in the fully connected map and the group connected map:
  • the storage space of the mapping relation table includes at least Q storage units, and the at least Q storage units may be in the A row.
  • the array of columns B is stored in a manner.
  • the address information of the Q flag rows may be respectively written into the Q memory cells to store the mapping relationship between the Q flag rows and the data blocks in the memory, where A and B are positive integers, and A*B ⁇ Q.
  • the respective storage units are configured to store address information of the flag row, including a cache block number field and an in-block number field.
  • the storage space of the mapping relationship table includes at least P storage units, and the P storage units are arranged in an array of P rows and 1 column, and each storage unit includes C+1 storage subunits.
  • Cache may write the cache block number of the data row to which the kth flag row belongs in the first storage subunit of the i th row storage unit, and write in the jth storage subunit of the i th row storage unit The number within the block of the kth flag line in the Q flag lines.
  • the storage space of the mapping relation table includes at least P storage units, and the P storage units are P rows 1
  • the array of columns is arranged or arranged in an array of 1 row and P columns. If an idle data line is divided into Y flag lines, Y is a positive integer, P*Y ⁇ Q, and Cache can write the (i-1)*Y+1 to i*Y Y in the i-th row storage unit.
  • the i-th row storage unit includes the cache block number of the data row to which the k-th flag row belongs, and the k-th flag row is in the Y flag rows of the (i-1)*Y+1 to i*Y. Sorting to determine the in-block number of the kth flag row to store the mapping relationship between the Q flag rows and the in-memory data block through the mapping relationship table. Wherein, (i-1)*Y+1 ⁇ k ⁇ i*Y, i, k are positive integers.
  • mapping relationship table in the embodiment of the present invention only stores the cache block number, and determines the order of the kth flag row in the Y flag rows of (i-1)*Y+1 to i*Y.
  • the number within the block of the kth flag line greatly saves the storage space of the mapping relation table.
  • mapping relationship table may also be stored in other forms of storage structure, which is not limited in the present invention.
  • the following is a mapping between the cache and the memory connected by the N-way group.
  • the cached flag field is divided into M group flag lines, and each group includes N flag behavior examples to illustrate the mapping between the Q flag lines and the in-memory data blocks. relationship. Where M and N are positive integers.
  • the mapping relationship table further includes: a mapping relationship between the first flag row and the group number, the block number in the group, and the first flag behavior is any one of the Q flag rows.
  • the storage space of the mapping relationship table includes Q storage units, and the Q storage units are arranged in M rows and R columns.
  • the cache can write the address information of the kth flag row in the Q flag rows in the storage channel of the i th row and the j th column, to store the mapping relationship between the Q flag rows and the data blocks in the memory through the mapping relationship table.
  • the group number of the flag line may be indicated by the line number of the flag line, and the group number or the number of channels in the block of the flag line is indicated by the column of the flag line.
  • the group number of the kth flag line is i-1
  • the number of paths of the kth flag line is N+j-1
  • the block number of the kth flag line is N+j-1.
  • mapping relationship table can quickly locate the flag row according to the address information of the flag row, thereby improving data processing efficiency.
  • the storage space of the relation table includes at least R storage units arranged in an array of R rows and 1 column, each storage unit including M+1 storage subunits, R ⁇ Q/M, and R is a positive integer.
  • Cache may write the cache block number of the data row to which the kth flag row belongs in the first storage subunit of the i th row storage unit; and write in the jth storage subunit of the i th row storage unit The intra-block number of the kth flag row in the Q flag rows, to store the mapping relationship between the Q flag rows and the in-memory data blocks through the mapping relationship table.
  • D*P R.
  • the group number of the flag line of the flag line may be indicated by the serial number of the storage unit where the flag line is located, and the group number of the flag line is indicated by the sequence number in the sub-storage unit where the flag line is located.
  • the block number of the kth flag line is N+i-1
  • the group number of the kth flag line is j-2.
  • the first data row, the second data row, the third data row, and the like may be the same data row or different data rows.
  • one data line is divided into M flag lines, and M flag lines are allocated to different groups, so that the group connection structure is increased by one way.
  • the first data line and the second data behave the same data line, and one data line is divided into 2M flag lines.
  • the first M flag lines are assigned to different groups, so that the group connection structure is increased by one way; the last M flag lines are allocated to different groups, and the group connection structure is also increased by one way.
  • mapping relationship table in the embodiment of the present invention only stores the cache block number, and indicates the group number of the flag row by the sequence number in the sub-storage unit where the flag row is located, thereby saving the storage space of the mapping relationship table.
  • the H idle data lines are divided into M flag rows, and H is a positive integer. See the schematic diagram of the storage structure of the mapping relationship table in the group connection mapping shown in FIG. 6F, and the storage of the mapping relationship table.
  • the space includes at least R memory cells arranged in an array of R rows and 1 column.
  • the Cache may write the cache block number of the data row to which the M flag lines of the (i-1)*M+1 to i*M belong in the i-th row storage unit. It can be understood that the i-th storage unit includes the k-th flag.
  • the cache block number of the data row to which the row belongs, and the sorting in the M flag rows of the (i-1)*M+1 to i*M by the kth flag row indicates the kth flag row
  • the number within the block is used to store the mapping relationship between the Q flag rows and the data blocks in the memory through the mapping relationship table. among them.
  • the block number of the kth flag row is N+i-1
  • the group number of the kth flag row is the (kth)th flag row at (i-1)*M+1 to i*M Sorting in M flag rows.
  • (i-1)*M+1 ⁇ k ⁇ i*M, i, k are positive integers
  • R ⁇ Q/M and R is a positive integer.
  • each storage unit includes H storage sub-units respectively for storing cache block numbers of H data rows.
  • two data rows can be divided into M flag rows, and the first storage unit stores the cache block number of the first data row and the cache block number of the second data row among the P idle data rows; the second storage unit stores P The cache block number of the third data line and the cache block number of the fourth data line in the idle data row, and so on, the i-th storage unit stores the cache block number of the 2*i-1 data line in the P idle data lines And the cache block number of the 2*i data line.
  • i R.
  • the H data rows are only divided into M data rows. Flag lines to avoid dividing the same data line into the flag lines with different block numbers in the group.
  • mapping relationship table in the embodiment of the present invention only stores the cache block number, and determines the order of the kth flag row in the M flag rows of (i-1)*M+1 to i*M.
  • the group number of the kth flag line greatly saves the storage space of the mapping relation table.
  • FIG. 6G is a schematic explanatory diagram of a flag line in a cache according to an embodiment of the present invention.
  • the flag row of the N path in the flag domain together with the newly added R path flag row in the data domain form a cache with an N+R way group connection mapping manner.
  • the flag row in FIG. 6G may include a Tag field, a Tptr field, a tag index field, or other fields.
  • the Tag field may include, but is not limited to, a main memory block tag field, a state field, a valid field, or other fields, and the like, which is not limited by the present invention.
  • mapping relationship table may also be stored in other forms of storage structure, which is not limited by the present invention.
  • FIG. 7 is a schematic diagram of a 4-way group connected to a 5-way group connected according to an embodiment of the present invention.
  • the Cache is divided into 16 data lines and 16 flag lines, which are mapped to the memory in a 4-way group connection manner.
  • the flag lines in the flag field are divided into 4 groups, and each group includes 4 flag lines.
  • the data rows in the data domain adopt a deduplication structure, and the data stored in each data row may be different from each other, and the flag rows in the flag domain are mapped to the data rows in a linked list to form a cache row.
  • the flag rows in the same linked list correspond to the same data row, that is, the data stored in each cache row under the same linked list is the same.
  • the idle data row (the data row with the cache block number 15 as shown in FIG. 7) is divided into four flag rows, and the (group number, group block number) of the four flag rows are in turn ( 0, 4), (1, 4), (2, 4), (3, 4).
  • the cache may correspond to the S flag rows in the data domain.
  • the data in the cache line is written back to the memory; further, the S flag lines are restored to T data lines, and the mapping relationship between the S flag lines and the data blocks in the memory is cleared; wherein the Q flag lines include S flag lines; S ⁇ Q, T ⁇ P, and S and T are positive integers.
  • the cache checks whether the data rows in the data domain are multiplexed into the flag row, and if so, the proxy first cache line A write back instruction is sent to the memory controller, the write back instruction carrying data in the first cache line.
  • the first cache acts as S cache lines corresponding to the S flag lines.
  • the second threshold may be 1, 4, 6, 10, 16, or other values, etc., which are not limited in the present invention.
  • the third threshold may be 0.1, 0.2, 0.25, 0.4 or other values, which is not limited in the present invention.
  • the cache may set the S flag lines in the data domain.
  • the corresponding cache line is mapped to the S flag lines in the flag domain; further, the S flag lines are restored to T data lines, and the mapping relationship between the S flag lines and the data blocks in the memory is cleared; wherein, the Q flags are
  • the row includes the S flag rows; S ⁇ Q, T ⁇ P, and S and T are positive integers.
  • the S flag lines in the flag domain may be any S flag lines whose status is invalid in the flag domain, or may be in a non-inactive state in the flag domain (eg, M state, E state) Any S flag lines of the S state may also include S flag lines in an invalid state and flag lines in a non-inactive state.
  • the flag line of the M state the data of the cache line corresponding to the flag row of the M state needs to be written back to the memory to maintain the consistency of the data in the cache.
  • the S flag rows in the data domain include a second flag row, and the second flag acts on any one of the S flag rows in the data domain.
  • An embodiment of the cache mapping the cache lines corresponding to the S flag rows in the data domain to the S flag rows in the flag domain may be: the cache maps the cache line corresponding to the second flag row to the second flag row in the flag domain.
  • the flag row in the buffer group where the second flag row is located in the flag field may be any S flag rows whose states are in an invalid state, or may be in a non-inactive state (eg, M state, E state, S State flag).
  • M state M state
  • E state E state
  • S State flag e.g, S State flag
  • the S flag rows in the data domain are divided by T data rows; the T data behavior resources adjust the data rows in the pre-data domain.
  • the cache can determine the S flag rows belonging to the same or multiple data rows according to the mapping relationship table, thereby releasing the S flag rows, and clearing the address information in the storage unit corresponding to the S flag rows in the mapping relationship table. .
  • the cache can implement data deduplication, including a data domain and a flag domain.
  • the cache detects data deduplication operation for the cache line and the number of idle data rows in the data domain satisfies the first condition, the data is P idle data rows in the domain are divided into Q flag rows. Further, based on the mapping manner between cache and memory, a mapping relationship between Q flag rows and in-memory data blocks is established to implement P idle data rows in the data domain. Multiplexing into Q flag lines, thereby increasing the cached address space of the cache, increasing the capacity of the cache, and improving data processing efficiency.
  • the cache may implement data deduplication, including a data domain and a flag field, and the cache detects a data deduplication operation for the cache line and the number of idle data rows in the data domain satisfies the first condition.
  • the P idle data rows in the data domain are divided into Q flag rows; and based on the mapping manner of the cache and the memory, the mapping relationship between the Q flag rows and the data blocks in the memory is configured to
  • the P idle data lines in the data domain are multiplexed into the Q flag lines, and the data domain is multiplexed into a flag domain, thereby increasing the cached address space of the cache, increasing the capacity of the cache, and improving data processing. effectiveness.
  • the execution body of the data access method may be a cache or a cache controller in a computer device.
  • This application uses a cache as an example to introduce a data access method in a cache.
  • the method may include some or all of the following steps:
  • the cache can implement data deduplication, including a data domain and a flag domain.
  • the cache may divide a part of the idle data (also referred to as P idle data lines or P data lines in the embodiment of the present invention) into a plurality of flag lines (
  • the mapping relationship between the cache line and the in-memory data block in the cache includes the mapping relationship between the Q flag lines and the data blocks in the memory, thereby implementing data domain multiplexing into the flag domain. , thereby increasing the cached address space of the cache, increasing the capacity of the cache, and improving data processing efficiency.
  • Step S800 The cache receives a request sent by the processor to carry a main memory address.
  • the type of request includes a read request and a write request
  • the main memory address includes a main memory block mark and an address within the block.
  • Step S801 The cache reads the mapping relationship between the cache and the memory, compares the main memory address with the label field of the cache line, and checks whether the cache line of the request is hit.
  • step S801 may be: cache comparing the main memory block mark of the main memory address with the label field of all the flag lines in the cache to check whether there is a flag corresponding to the main memory block mark of the main memory address.
  • Line, that is, whether there is a mark field in the mark field included in all the mark lines, and the main memory block mark of the main memory block mark is the same as the main memory block mark of the main memory address, and the mark field includes the main memory block mark and the main memory address.
  • the cache line corresponding to the same mark line of the main memory block mark is the cache line of the hit.
  • all the flag lines in the cache include Q flag lines in the data domain.
  • the cache can find the locations of the Q flag rows according to the mapping relationship table or other forms of mapping relationship as shown in FIG. 6A or FIG. 6B.
  • the mapping relationship table is configured to indicate a mapping relationship between the Q flag rows and the in-memory data block, and includes address information of the first flag row; the address information includes a cache block number and an intra-block number; the cache block number is used to indicate the first An address of a data row in the data field, the number in the block is used to indicate the address of the first flag row in the data row to which the first flag row belongs; the first flag acts on any one of the Q flag rows .
  • the label field of the flag row further includes a valid field.
  • the content of the valid field is 1, the data in the cache line corresponding to the flag row is valid.
  • the content of the valid field is 1 and the tag field includes a cache line in which the main memory block tag is the same as the main memory block tag of the main memory address.
  • the cache is divided into multiple cache groups, each cache group includes multiple flag rows, and Q flag rows are included in the data domain of the resource-adjusted cache.
  • the main memory address includes a main memory block mark, a group number, and an address within the block, and the label field of the flag line includes a main memory block mark.
  • An implementation manner of step S801 may be: the cache determines the cache group according to the group number in the main memory address, compares the main memory block mark of the main memory address with the label field of all the flag lines in the determined cache group, and checks whether the existence exists.
  • the flag line corresponding to the main memory block mark of the main memory address that is, whether there is a mark field included in all the flag lines in the cache group, and the main memory block mark included in the main memory block mark of the main memory address is the same mark as the main memory block mark of the main memory address.
  • the cache line included in the tag field is the cache line corresponding to the tag line of the main memory block tag of the main memory address.
  • the cache may be based on the mapping relationship before comparing the main memory block of the main memory address with the label field of all the flag lines in the determined cache group.
  • the table searches for a flag line corresponding to the group number in the data field, and the flag field corresponding to the group number in the data field caches the flag line in the group.
  • the cache can find the location of the flag row in the cache group according to the mapping relationship table or other forms of mapping relationship table as shown in FIG. 6C or FIG. 6D.
  • the mapping relationship table is used to indicate the mapping relationship between the Q flag rows and the data blocks in the memory, including the address information of the first flag row and the group number corresponding to the first flag row, and the block number in the group; the address information includes a cache block number and an intra-block number; the cache block number is used to indicate an address of the data line to which the first flag line belongs in the data field, and the block number is used to indicate that the first flag line belongs to the data line of the first flag line The address in the first flag acts on any of the Q flag lines.
  • the mapping between the cache and the main memory is connected to the N-way group.
  • the N-way group is connected to the N+R way group.
  • R Q / M and R is an integer.
  • the newly added R route is formed by Q flag lines.
  • the cache may search for the flag row corresponding to the group number in the data domain according to the mapping relationship table, and the cache may search, according to the mapping relationship table, R flag rows corresponding to the group number in the Q flag rows, and the data domain searches.
  • the R flag lines that arrive are the identified flag lines in the cache group.
  • the label field of the flag row further includes a valid field.
  • the content of the valid field is 1, the data in the cache line corresponding to the flag row is valid.
  • the content of the valid field is 1 and the tag field includes a cache line in which the main memory block tag is the same as the main memory block tag of the main memory address.
  • Step S802 When there is a cache line of the hit request, access the data in the cache line of the hit.
  • the cache For a read request, when there is a cache line that hits the read request, that is, a cache hit, the cache reads the data corresponding to the mark in the block in the main memory address of the hit cache line, and sends the data to the processor.
  • the write request also carries the request data.
  • the cache When there is a cache line that hits the read request, that is, when the cache hits, the cache writes the requested data to the location corresponding to the mark in the block in the main memory address of the hit cache line.
  • Step S803 When there is no cache line of the hit request, allocate a cache line, read data corresponding to the main memory address in the memory to the allocated cache line, and access the data in the allocated cache line;
  • the cache For a read request, when there is no cache line of the hit request, that is, when the cache misses, the cache allocates the cache line, and reads the data corresponding to the main memory address in the memory to the allocated cache line, and the main cache line to be allocated The corresponding data is marked in the block in the address, and the data is sent to the processor.
  • the write request also carries the request data.
  • the cache allocates the cache line, and reads the data corresponding to the main memory address in the memory to the allocated cache line, and the cache writes the carried request data to the allocated The location corresponding to the mark in the block in the main memory address in the cache.
  • the cache can also modify the status field in the flag line corresponding to the cache line, and can also perform the deduplication operation on the allocated cache line, and can perform other operations, which are not limited in the present invention.
  • the allocated cache acts as a cache line in the cache group determined by the group number of the main memory address.
  • the allocated cache line can be either a free cache line in the cache or any cache line.
  • the cache when the number of free data rows in the cache is less than the first threshold; or the cache miss rate is greater than the second threshold, or before the cache allocates the cache line, the cache In the case that there is no free data row in the cache, the cache can write back the data in the cache line corresponding to the S flag rows in the data domain to the memory; and restore the S flag rows to T data rows. , and clear the mapping relationship between the S flag lines and the data blocks in the memory.
  • the Q flag rows include the S flag rows; S ⁇ Q, T ⁇ P, and S and T are positive integers.
  • the cache when the miss rate is greater than the second threshold, the data rows in the cache are frequently replaced; or, when the cache needs to allocate the cache line, the cache may also have no idle data rows in the cache, at this time, the cache It is checked whether there is a data row in the data domain that is multiplexed into a flag row. If so, the proxy first cache line sends a write back instruction to the memory controller, the write back instruction carrying the data in the first cache line.
  • the cache line corresponding to the first flag row of the S flag lines may include one or more cache lines.
  • the first threshold may be 1, 4, 6, 10, 16, or other values, etc., which are not limited in the present invention.
  • the second threshold may be 0.1, 0.2, 0.25, 0.4 or other values, which is not limited in the present invention.
  • the cache may map the cache line corresponding to the S flag rows in the data domain to the S flag rows in the flag domain; and further, restore the S flag rows to T.
  • the S flag lines in the flag domain may be any S flag lines whose status is invalid in the flag domain, or may be in a non-inactive state in the flag domain (eg, M state, E state) Any S flag lines of the S state may also include S flag lines in an invalid state and flag lines in a non-inactive state.
  • the cache line data corresponding to the flag row needs to be written back to the memory to maintain the consistency of the data in the cache.
  • the S flag rows in the data domain include a second flag row, and the second flag acts on any one of the S flag rows in the data domain.
  • An embodiment of the cache mapping the cache lines corresponding to the S flag rows in the data domain to the S flag rows in the flag domain may be: the cache maps the cache line corresponding to the second flag row to the second flag row in the flag domain.
  • the flag row in the buffer group where the second flag row is located in the flag field may be any S flag rows whose states are in an invalid state, or may be in a non-inactive state (eg, M state, E state, S State flag).
  • M state M state
  • E state E state
  • S State flag e.g, S State flag
  • the first threshold may be 1, 4, 6, 10, 16, or other values, etc., which are not limited in the present invention.
  • the second threshold may be 0.1, 0.2, 0.25, 0.4 or other values, which is not limited in the present invention.
  • the S flag rows in the data domain are divided by T data rows; the T data behavior resources adjust the data rows in the pre-data domain.
  • the cache can determine the S flag rows belonging to the same or multiple data rows according to the mapping relationship table, thereby releasing the S flag rows, and clearing the address information in the storage unit corresponding to the S flag rows in the mapping relationship table. .
  • FIG. 6A-6F refers to the storage structure of the mapping relationship table shown in FIG. 6A-6F, which is not described in detail in the present invention.
  • the cache receives the request sent by the processor carrying the main memory address; reads the mapping relationship between the cache and the memory, compares the main memory address with the label field of the cache line, and checks whether the cache line of the request is hit; When there is a cache line of the hit request, access the data in the cache line of the hit; or, when there is no cache line of the hit request, allocate the cache line, read the data corresponding to the main memory address in the memory to the allocated cache line, and access the allocation
  • the cache can realize data deduplication, including the data domain and the flag domain, thereby realizing multiplexing of P idle data rows in the data domain into Q flag rows, thereby increasing the cached address space of the cache, increasing the capacity of the cache, and improving Data processing efficiency.
  • FIG. 9 is a schematic structural diagram of a cache according to an embodiment of the present invention
  • FIG. 10 is a schematic structural diagram of a cache controller according to an embodiment of the present invention.
  • the cache 90 can implement data deduplication, including a data store 91 and a cache controller 92, the data store 91 including a data field 911 and a flag field 912.
  • the data field 911 includes a plurality of data lines and divided Q flag lines.
  • the flag field includes a plurality of flag lines, and one flag line may form a cache line corresponding to one data line. Wherein, multiple flag rows can correspond to the same data row to implement data deduplication of the cache line.
  • the cache controller 92 includes some or all of the following units:
  • a dividing unit 921 configured to divide P idle data rows in the data domain into Q if the data deduplication operation for the cache line is detected and the number of idle data rows in the data domain satisfies the first condition a flag row;
  • the data field includes a plurality of data rows, the plurality of data rows including the P idle data rows;
  • P, Q are positive integers;
  • the configuration unit 922 is configured to configure a mapping relationship between the Q flag rows and the in-memory data blocks based on a cache and memory mapping manner, so that the P idle data rows in the data domain are multiplexed into the Q Flag lines.
  • the configuration unit 922 is specifically configured to:
  • mapping relationship between the Q flag rows and the data blocks in the memory is stored by using a mapping relationship table according to a mapping manner between the cache and the memory;
  • the mapping relationship table includes address information of the first flag row; the address information includes a cache block number and an intra-block number; the cache block number is used to indicate that the data row of the first flag row belongs to An address in the data field, the intra-block number is used to indicate an address of the first flag row in a data row to which the first flag row belongs; the first flag acts as any one of the Q flag rows Flag line.
  • the cache and the memory are mapped in a fully connected manner;
  • the storage space of the mapping relationship table includes at least Q storage units; and the configuration unit 922 stores the location through the mapping relationship table.
  • the mapping relationship between the Q flag rows and the data blocks in the memory includes:
  • the address information of the Q flag rows are respectively written into the Q memory cells.
  • the mapping manner between the cache and the memory is an N-way group connection mapping
  • the cache line of the cache is divided into M groups, and M and N are positive integers
  • the method further includes: mapping the first flag row to the group number and the block number in the group.
  • the storage space of the mapping relationship table includes Q storage units, and the Q storage units are arranged in an array of M rows and R columns, and the configuration unit 922 stores the location through the mapping relationship table.
  • the mapping relationship between the Q flag rows and the data blocks in the memory includes:
  • the group number of the kth flag row is i-1, and the block number of the kth flag row is N+j-1;
  • one idle data row is divided into D*M flag rows, and D is a positive integer;
  • the storage space of the mapping relationship table includes at least R storage units, and the R storage units Arranged in an array of R rows and 1 column, the storage unit includes M+1 storage subunits, R ⁇ Q/M, and R is a positive integer;
  • the configuration unit 922 stores the Q flag rows by using a mapping relationship table.
  • the mapping relationship of data blocks in memory including:
  • the block number of the kth flag row is N+i-1, and the group number of the kth flag row is j-2;
  • the H idle data lines are divided into M flag rows, and H is a positive integer;
  • the storage space of the mapping relationship table includes at least R storage units, and the R storage units are R Array arrangement of row 1 columns;
  • the configuration unit 922 stores the mapping relationship between the Q flag rows and the data blocks in the memory through the mapping relationship table, which specifically includes:
  • the i-th storage unit includes a cache block number of the data row to which the kth flag row belongs, and the M flag lines in the (i-1)*M+1 to i*M through the kth flag line Sorting indicates the in-block number of the kth flag line;
  • the group block number of the kth flag row is N+i-1, and the group number of the kth flag row is the (kth) flag row at (i-1)*M+1 to i *M is sorted in M flag rows;
  • (i-1)*M+1 ⁇ k ⁇ i*M, i, k are positive integers; R ⁇ Q/M, and R is a positive integer.
  • the cache controller 92 further includes:
  • the determining unit 923 is configured to: when the storage space of the idle data row in the data domain is greater than the first threshold, determine that the number of idle data rows in the data domain satisfies the first condition.
  • the cache controller 92 further includes:
  • the write back unit 924 is configured to: when the number of data rows that are idle in the cache is less than a second threshold or the cache miss rate is greater than a third threshold, the S flag rows in the data domain are The data in the corresponding cache line is written back to the memory;
  • a first restoring unit 925 configured to restore the S flag rows to T data rows, and clear a mapping relationship between the S flag rows and the in-memory data block;
  • the Q flag rows include the S flag rows; S ⁇ Q, T ⁇ P, and S and T are positive integers.
  • the cache controller further includes:
  • the mapping unit 926 if the number of data rows that are idle in the cache is less than a second threshold or the cache miss rate is greater than a third threshold, the S flag rows in the data domain are corresponding.
  • the cache line is mapped to the cache line corresponding to the S flag lines in the flag domain;
  • a second recovery unit 927 configured to restore the S flag rows to T data rows, and clear a mapping relationship between the S flag rows and the in-memory data block;
  • the Q flag rows include the S flag rows; S ⁇ Q, T ⁇ P, and S and T are positive integers.
  • the mapping manner between the cache and the memory is a group connection mapping
  • the cache includes a plurality of cache groups
  • the mapping unit 926 corresponds to the S flag rows in the data domain.
  • the cache line is mapped to the cache line corresponding to the S flag lines in the flag domain, and specifically includes:
  • the second flag acts on any one of the S flag rows in the data domain.
  • mapping relationship table may be located in the data storage 91, which is a storage domain different from the data domain 911 and the flag domain 912; or may be located in the cache controller 92, and the cache controller 92 may further include A memory that can be used to store mapping tables.
  • the cache may implement data deduplication, including a data domain and a flag field, and the cache detects a data deduplication operation for the cache line and the number of idle data rows in the data domain satisfies the first condition.
  • the P idle data rows in the data domain are divided into Q flag rows; and based on the mapping manner of the cache and the memory, the mapping relationship between the Q flag rows and the data blocks in the memory is configured to
  • the P idle data lines in the data domain are multiplexed into the Q flag lines, and the data domain is multiplexed into a flag domain, thereby increasing the cached address space of the cache, increasing the capacity of the cache, and improving data processing. effectiveness.
  • FIG. 11 is a schematic structural diagram of another cache according to an embodiment of the present invention.
  • the cache 110 can implement data deduplication, including a data memory 111 and a cache controller 112, where the data memory 111 includes data.
  • the domain 1111 and the flag field 1112, the cache controller 112 includes:
  • the receiving unit 1121 is configured to receive, by the processor, a request for carrying a main memory address
  • the hit determining unit 1122 is configured to read a mapping relationship between the cache and the memory, compare the main memory address with a label field of the cache line, and check whether the cache line of the request is hit;
  • a first response unit 1123 configured to access data in the cache line that is hit when there is a cache line that hits the request; or a second response unit 1124, configured to allocate when there is no cache line that hits the request Cache line, reading data corresponding to the main memory address in the memory to the allocated cache line, accessing the data in the allocated cache line;
  • the data field includes Q flag rows, and the Q flag rows are divided by P idle data rows in the data domain; the mapping relationship between the cache line and the in-memory data block in the cache includes The mapping relationship between the Q flag rows and the data blocks in the memory is described.
  • the mapping manner between the cache and the memory is a fully-connected mapping; the hit determining unit 1122 compares the label fields of the main memory address and the cache line to check whether there is a hit request.
  • the cache line specifically includes:
  • the main memory address includes a main memory block mark and an intra-block address; the label field of the mark line includes a main memory block mark.
  • the cache and memory mapping manner is a group connection mapping; the cache is divided into multiple cache groups, and the hit determination unit 1122 compares the main storage address and the cache line. Address to see if there is a cache line that hits the request, specifically:
  • the main memory address includes a main memory block mark, a group number, and an address within the block; the label field of the flag line includes a main memory block mark.
  • mapping manner between the cache and the memory is a group-connected mapping; the cache controller 112 further includes:
  • the searching unit 1125 is configured to compare the main memory block mark of the main memory address with all the flag lines in the cache group after the hit determination unit determines the cache group according to the group number in the main memory address. Before the label field, the flag row corresponding to the group number in the data domain is searched according to the mapping relationship table, and the flag corresponding to the group number in the data domain acts as the flag row in the cache group;
  • the mapping relationship table is configured to store a mapping relationship between the Q flag rows and an in-memory data block, including address information of the first flag row, a group number corresponding to the first flag row, and an intra-group block.
  • the address information includes a cache block number and an intra-block number; the cache block number is used to indicate an address of the data line to which the first flag line belongs in the data field, and the block number is used to indicate Determining, by the first flag, an address in a data row to which the first flag row belongs; the first flag acts as any one of the Q flag rows.
  • mapping between the cache and the memory is connected to the N+R way group; the searching unit 1125 is specifically configured to:
  • R flag rows corresponding to the group number in the Q flag rows; the R flags are in the cache group flag row; wherein, R Q/M, R is Integer.
  • the cache controller 112 further includes:
  • the write back unit 1126 is configured to: when the number of data rows that are idle in the cache is less than a first threshold or the cache miss rate is greater than a second threshold, the S flag rows in the data domain are The data in the corresponding cache line is written back to the memory;
  • a first recovery unit 1127 configured to restore the S flag rows to T data rows, and clear a mapping relationship between the S flag rows and the in-memory data blocks;
  • the Q flag rows include the S flag rows; S ⁇ Q, T ⁇ P, and S and T are positive integers.
  • the cache controller further includes:
  • the mapping unit 1128 is configured to: when the number of data rows that are idle in the cache is less than a first threshold or the cache miss rate is greater than a second threshold, corresponding to the S flag rows in the data domain The cache line is mapped to the cache line corresponding to the S flag lines in the flag domain;
  • a second recovery unit 1129 configured to restore the S flag rows to T data rows, and clear a mapping relationship between the S flag rows and the in-memory data blocks;
  • the Q flag rows include the S flag rows; S ⁇ Q, T ⁇ P, and S and T are positive integers.
  • the cache and the memory are mapped in a group connection manner
  • the cache includes multiple cache groups
  • the mapping unit 1128 corresponds to the S flag rows in the data domain.
  • the cache line is mapped to the cache line corresponding to the S flag lines in the flag domain, and specifically includes:
  • the second flag acts on any one of the S flag rows in the data domain.
  • mapping relationship table may be located in the data storage 111, which is a storage domain different from the data domain 1111 and the flag domain 1112; or may be located in the cache controller 112, and the cache controller 112 may further include A memory that can be used to store mapping tables.
  • the cache receives the request sent by the processor carrying the main memory address; reads the mapping relationship between the cache and the memory, compares the main memory address with the label field of the cache line, and checks whether the cache line of the request is hit; When there is a cache line of the hit request, access the data in the cache line of the hit; or, when there is no cache line of the hit request, allocate the cache line, read the data corresponding to the main memory address in the memory to the allocated cache line, and access the allocation
  • the cache can realize data deduplication, including the data domain and the flag domain, thereby realizing multiplexing of P idle data rows in the data domain into Q flag rows, thereby increasing the cached address space of the cache, increasing the capacity of the cache, and improving Data processing efficiency.

Landscapes

  • Engineering & Computer Science (AREA)
  • Theoretical Computer Science (AREA)
  • Physics & Mathematics (AREA)
  • General Engineering & Computer Science (AREA)
  • General Physics & Mathematics (AREA)
  • Memory System Of A Hierarchy Structure (AREA)

Abstract

本发明实施例公开了一种高速缓存中资源调整方法及装置,该高速缓存可实现数据去重,包括数据域和标志域,该方法包括:在检测针对缓存行的数据去重操作且所述数据域中空闲数据行的数量满足第一条件的情况下,将所述数据域中P个空闲数据行划分出Q个标志行,基于高速缓存与内存的映射方式,配置所述Q个标志行与内存中数据块的映射关系,以使所述数据域中的所述P个空闲数据行复用为所述Q个标志行。本发明实施例公开了一种高速缓存中数据访问方法及装置。实施本发明实施例可以实现数据域复用为标志域,进而增大cache的可访地址空间,增大cache的容量,提升数据处理效率。

Description

高速缓存中资源调整方法、数据访问方法及装置 技术领域
本申请涉及计算机技术领域,尤其涉及一种高速缓存中资源调整方法、数据访问方法及相关装置、设备。
背景技术
在计算机存储系统的层次结构中,高速缓冲存储器(Cache,简称为高速缓存)是介于中央处理器和主存储器之间的高速小容量存储器。Cache中缓存的是主存储器(内存)中的数据。高速缓存和主存储器之间信息的调度和传送是由硬件自动进行的。
Cache包括标志域(Tag Ram)和数据域(Date Ram),其中,标志域包括多个标志行(Tag Entry),数据域包括多个数据行(Date Entry),一个标志行和一个数据行映射,形成一个缓存行。缓存行是Cache与下级Cache,或Cache与内存数据交换的最小单位。内存中数据以数据块为单位存储数据,缓存行与内存中数据块进行数据交换,内存中一个数据块存储的数据大小与Cache中一个缓存行可存储数据的大小相一致。主存中的数据存储到有限的cache中,数据块所在的主存地址必须映射到cache地址。映射方式包括直接映射、全相连映射、组相连映射或其他映射方式等。
为增大cache可缓存的数据量,可以对缓存行进行去重或压缩操作,压缩或去重后的cache中不存在大量相同数据的数据行,多个标志行可以映射同一个数据行。标志域和数据域的映射的实现方式可以是双向链表、单向链表或其他实现方式等。
然而,去重在一定程度上增加了cache访问的命中率,然而当数据冗余度较大时,由于标志域资源的限制,cache中依然会存在大量相同数据的数据行,限制了cache中数据的压缩率以及cache的命中率。
发明内容
本申请的目的在于,提供一种高速缓存中资源调整方法、数据访问方法及相关装置、设备,可以增大cache的可访地址空间,增大cache的容量,提升数据处理效率。
第一方面,本发明实施例提供了一种高速缓存中资源调整方法,所述高速缓存可实现数据去重,包括数据域和标志域,所述方法包括:
在检测针对缓存行的数据去重操作且所述数据域中空闲数据行的数量满足第一条件的情况下,将所述数据域中P个空闲数据行划分出Q个标志行;所述数据域包括多个数据行,所述多个数据行包括所述P个空闲数据行;P、Q为正整数;
基于高速缓存与内存的映射方式,配置所述Q个标志行与内存中数据块的映射关系,以使所述数据域中的所述P个空闲数据行复用为所述Q个标志行。
通过执行上述方法,通过将所述数据域中P个空闲数据行划分出Q个标志行,以及基于高速缓存与内存的映射方式,配置所述Q个标志行与内存中数据块的映射关系,实现数据域复用为标志域,进而增大cache的可访地址空间,增大cache的容量,提升数据处理效率。
在又一种可能的实现方式中,所述基于高速缓存与内存的映射方式,建立所述Q个标志行与内存中数据块的映射关系包括:
基于高速缓存与内存的映射方式,通过映射关系表存储所述Q个标志行与内存中数据块的映射关系;
其中,所述映射关系表包括所述第一标志行的地址信息;所述地址信息包括缓存块号和块内编号;所述缓存块号用于指示所述第一标志行所属数据行在所述数据域中的地址,所述块内编号用于指示所述第一标志行在所述第一标志行所属数据行中的地址;所述第一标志行为所述Q个标志行中任意一个标志行。
通过执行上述方法,可实现通过映射关系表来实现数据域中Q个标注行与内存的映射。Cache可以通过访问映射关系表,定位到标志行。
在又一种可能的实现方式中,所述高速缓存与内存的映射方式为全相连映射;所述映射关系表的存储空间包括至少Q个存储单元;所述通过映射关系表存储所述Q个标志行与内存中数据块的映射关系包括:
将所述Q个标志行的地址信息分别写入所述Q个存储单元。
上述方法提供了一种全相连映射方式下,映射关系表的存储结构。
在又一种可能的实现方式中,所述高速缓存与内存的映射方式为N路组相连映射,所述高速缓存的缓存行划分为M组,M、N为正整数;所述映射关系表还包括:所述第一标志行与组号、组内块号的映射关系。
对应原高速缓存与内存的映射方式为N路组相连映射,在本发明实施例提供了以下三种映射关系表的存储结构:
第一种:所述映射关系表的存储空间包括Q个存储单元,所述Q个存储单元以M行R列的阵列排列,所述通过映射关系表存储所述Q个标志行与内存中数据块的映射关系包括:
在第i行第j列存储单元存储中写入所述Q个标志行中第k个标志行的地址信息;
所述第k个标志行的组号为i-1,所述第k个标志行的组内块号为N+j-1;
其中,R为Q/M的商,R为整数;k=(i-1)*M+j,i、j、k为正整数。
上述方法提供了一种组相连映射方式下,映射关系表的存储结构。
第二种:一个空闲数据行被划分为D*M个标志行,D为正整数;所述映射关系表的存储空间包括至少R个存储单元,所述R个存储单元以R行1列的阵列排列,所述存储单元包括M+1个存储子单元,R≥Q/M,R为正整数;所述通过映射关系表存储所述Q个标志行与内存中数据块的映射关系包括:
在第i行存储单元的第一个存储子单元中写入第k个标志行所属的数据行的缓存块号;以及,
在第i行存储单元的第j个存储子单元中写入所述Q个标志行中第k个标志行的块内编号;
所述第k个标志行的组内块号为N+i-1,所述第k个标志行的组号为j-2;
其中,i≤R,2≤j≤M+1,k=(i-1)*M+j,i、j、k为正整数。
通过执行上述方法,映射关系表的仅仅只存储一次缓存块号,减少映射关系表的存储空间。
第三种:H个空闲数据行划分出M个标志行,H为正整数;所述映射关系表的存储空间包括至少R个存储单元,所述R个存储单元以R行1列的阵列排列;所述通过映射关系表存储所述Q个标志行与内存中数据块的映射关系包括:
第i个存储单元包括第k个标志行所属的数据行的缓存块号,以及通过所述第k个标志行在第(i-1)*M+1至i*M的M个标志行中的排序指示所述第k标志行的块内编号;
所述第k个标志行的组内块号为N+i-1,所述第k个标志行的组号为所述第k个标志行在第(i-1)*M+1至i*M的M个标志行中的排序;
其中,(i-1)*M+1≤k≤i*M,i、k为正整数;R≥Q/M,R为正整数。
通过执行上述方法,映射关系表的仅仅存储缓存块号,极大的减少映射关系表的存储空间。
在又一种可能的实现方式中,所述方法还包括:
在所述数据域中空闲数据行的存储空间大于第一阈值时,则判断为所述数据域中空闲数据行的数量满足第一条件。
通过执行上述方法,在数据域中空闲数据行的存储空间大于第一阈值,才触发将数据域中P个空闲数据行划分出Q个标志行的操作,优化cache处理效率。
在又一种可能的实现方式中,所述建立所述Q个标志行与内存中数据块的映射关系之后,所述方法还包括:
在所述高速缓存内空闲的数据行的数量小于第二阈值或所述高速缓存的未命中率大于第三阈值的情况下,将所述数据域中S个标志行对应的缓存行内的数据回写到所述内存;
将所述S个标志行恢复为T个数据行,并清除所述S个标志行与所述内存中数据块的映射关系;
其中,所述Q个标志行包括所述S个标志行;S≤Q、T≤P,S、T为正整数。
通过执行上述方法,可实现在数据行数量紧张时,数据域中标志行恢复至数据行,提高cache的命中率。
在又一种可能的实现方式中,所述建立所述Q个标志行与内存中数据块的映射关系之后,所述方法还包括:
在所述高速缓存内空闲的数据行的数量小于第二阈值或所述高速缓存的未命中率大于第三阈值的情况下,将所述数据域中S个标志行对应的缓存行映射到标志域中S个标志行对应的缓存行;
将所述S个标志行恢复为T个数据行,并清除所述S个标志行与所述内存中数据块的映射关系;
其中,所述Q个标志行包括所述S个标志行;S≤Q、T≤P,S、T为正整数。
通过执行上述方法,可实现在数据行数量紧张时,数据域中标志行恢复至数据行,且不需要进行回写操作,提高cache的处理效率。
在又一种可能的实现方式中,所述高速缓存与内存的映射方式为组相连映射,所述高速缓存包括多个缓存组,所述将所述数据域中S个标志行对应的缓存行映射到标志域中S个标志行包括:
将第二标志行对应的缓存行映射到所述标志域中所述第二标志行所在的缓存组内的标 志行;
所述第二标志行为所述数据域中S个标志行中任意一个标志行。
第二方面,本发明实施例还提供了一种高速缓存中数据访问方法,所述方法包括:
接收处理器发送的携带主存地址的请求;
读取高速缓存与内存的映射关系,比较所述主存地址与缓存行的标签字段,查看是否在命中所述请求的缓存行;
在存在命中所述请求的缓存行时,访问命中的缓存行内的数据;或者,在不存在命中所述请求的缓存行时,分配缓存行,读取内存中所述主存地址对应的数据到分配的缓存行,访问所述分配的缓存行中数据;
其中,所述高速缓存可实现数据去重,包括数据域和标志域;所述数据域中包括Q个标志行,所述Q个标志行由所述数据域中P个空闲数据行划分得到;所述高速缓存中缓存行与内存中数据块的映射关系包括所述Q个标志行与内存中数据块的映射关系。
通过执行上述方法,数据域中包括Q个标志行,cache在数据访问时根据高速缓存与内存的映射关系,比较主存地址与缓存行的标签字段,判断请求是否命中,以实现数据域部分复用为标志域的cache中数据的访问,数据域复用为标志域,增大cache的可访地址空间,增大cache的容量,提升数据处理效率。
在一种可能的实现方式中,所述高速缓存与内存的映射方式为全相连映射;所述比较所述主存地址与缓存行的标签字段,查看是否存在命中所述请求的缓存行包括:
比较所述主存地址的主存字块标记与所述高速缓存中所有的标志行的标签字段,查看是否存在与所述主存地址的主存字块标记相符合的标志行;所述高速缓存中所有的标志行包括所述数据域中Q个标志行;
所述与所述主存地址的主存字块标记相符合的标志行对应的缓存行为命中的缓存行;
其中,所述主存地址包括主存字块标记以及字块内地址;标志行的标签字段包括主存字块标记。
上述方法提供了一种全相连映射方式下,查看请求是否存命中的方法。
在又一种可能的实现方式中,所述高速缓存与内存的映射方式为组相连映射;所述高速缓存划分为多个缓存组,所述比较所述主存地址与缓存行的地址,查看是否存在命中所述请求的缓存行包括:
根据所述主存地址中组号确定缓存组;
比较所述主存地址的主存字块标记与确定的缓存组中所有的标志行的标签字段,查看是否存在与主存地址的主存字块标记相符合的标志行;
所述与主存地址的主存字块标记相符合的标志行对应的缓存行为命中的缓存行;
其中,所述主存地址包括主存字块标记、组号以及字块内地址;标志行的标签字段包括主存字块标记。
上述方法提供了一种组相连映射方式下,查看请求是否存命中的方法。
在又一种可能的实现方式中,,所述高速缓存与内存的映射方式为组相连映射;所述根据所述主存地址中组号确定缓存组之后,所述比较所述主存地址的主存字块标记与所述缓 存组中所有的标志行的标签字段之前,所述方法还包括:
根据映射关系表查找所述数据域中与所述组号对应的标志行,所述数据域中与所述组号对应的标志行为所述缓存组内标志行;
其中,所述映射关系表用于存储所述Q个标志行与内存中数据块的映射关系,包括所述第一标志行的地址信息以及所述第一标志行对应的组号、组内块号;所述地址信息包括缓存块号和块内编号;所述缓存块号用于指示所述第一标志行所属数据行在所述数据域中的地址,所述块内编号用于指示所述第一标志行在所述第一标志行所属数据行中的地址;所述第一标志行为所述Q个标志行中任意一个标志行。
上述方法提供了一种组相连映射方式下,定位到组号内缓存行的方法。
在又一种可能的实现方式中,所述高速缓存与内存的映射方式为N+R路组相连;所述根据映射关系表查找所述数据域中与所述组号对应的标志行,所述数据域中与所述组号对应的标志行为所述缓存组内标志行包括:
根据所述映射关系表查找所述Q个标志行中与所述组号对应的R个标志行;所述R个标志行为所述缓存组内标志行;其中,R=Q/M,R为整数。
上述方法提供了一种组相连映射方式下,定位到组号内缓存行之后,查看请求是否存命中的方法。
在又一种可能的实现方式中,所述方法还包括:
在所述高速缓存内空闲的数据行的数量小于第一阈值或所述高速缓存的未命中率大于第二阈值的情况下,将所述数据域中S个标志行对应的缓存行内的数据回写到所述内存;
将所述S个标志行恢复为T个数据行,并清除所述S个标志行与所述内存中数据块的映射关系;
其中,所述Q个标志行包括所述S个标志行;S≤Q、T≤P,S、T为正整数。
通过执行上述方法,可实现在数据行数量紧张时,数据域中标志行恢复至数据行,提高cache的命中率。
在又一种可能的实现方式中,所述方法还包括:
在所述高速缓存内空闲的数据行的数量小于第一阈值或所述高速缓存的未命中率大于第二阈值的情况下,将所述数据域中S个标志行对应的缓存行映射到标志域中S个标志行对应的缓存行;
将所述S个标志行恢复为T个数据行,并清除所述S个标志行与所述内存中数据块的映射关系;
其中,所述Q个标志行包括所述S个标志行;S≤Q、T≤P,S、T为正整数。
通过执行上述方法,可实现在数据行数量紧张时,数据域中标志行恢复至数据行,且不需要进行回写操作,提高cache的处理效率。
在又一种可能的实现方式中,所述高速缓存与内存的映射方式为组相连映射,所述高速缓存包括多个缓存组,所述将所述数据域中S个标志行对应的缓存行映射到标志域中S个标志行包括:
将第二标志行对应的缓存行映射到所述标志域中所述第二标志行所在的缓存组内的标志行;
所述第二标志行为所述数据域中S个标志行中任意一个标志行。
第三方面,本发明实施例还提供了一种高速缓存,所述高速缓存可实现数据去重,包括数据存储器和缓存控制器,所述数据存储器包括数据域和标志域,所述缓存控制器包括:
划分单元,用于在检测针对缓存行的数据去重操作且所述数据域中空闲数据行的数量满足第一条件的情况下,将所述数据域中P个空闲数据行划分出Q个标志行;所述数据域包括多个数据行,所述多个数据行包括所述P个空闲数据行;P、Q为正整数;
配置单元,基于高速缓存与内存的映射方式,配置所述Q个标志行与内存中数据块的映射关系,以使所述数据域中的所述P个空闲数据行复用为所述Q个标志行。
在一种可能的实现方式中,所述配置单元,具体用于:
基于高速缓存与内存的映射方式,通过映射关系表存储所述Q个标志行与内存中数据块的映射关系;
其中,所述映射关系表包括所述第一标志行的地址信息;所述地址信息包括缓存块号和块内编号;所述缓存块号用于指示所述第一标志行所属数据行在所述数据域中的地址,所述块内编号用于指示所述第一标志行在所述第一标志行所属数据行中的地址;所述第一标志行为所述Q个标志行中任意一个标志行。
在又一种可能的实现方式中,所述高速缓存与内存的映射方式为全相连映射;所述映射关系表的存储空间包括至少Q个存储单元;所述配置单元通过映射关系表存储所述Q个标志行与内存中数据块的映射关系,具体包括:
将所述Q个标志行的地址信息分别写入所述Q个存储单元。
在又一种可能的实现方式中,所述高速缓存与内存的映射方式为N路组相连映射,所述高速缓存的缓存行划分为M组,M、N为正整数;所述映射关系表还包括:所述第一标志行与组号、组内块号的映射关系。
在又一种可能的实现方式中,所述映射关系表的存储空间包括Q个存储单元,所述Q个存储单元以M行R列的阵列排列,所述配置单元通过映射关系表存储所述Q个标志行与内存中数据块的映射关系,具体包括:
在第i行第j列存储单元存储中写入所述Q个标志行中第k个标志行的地址信息;
所述第k个标志行的组号为i-1,所述第k个标志行的组内块号为N+j-1;
其中,R为Q/M的商,R为整数;k=(i-1)*M+j,i、j、k为正整数。
在又一种可能的实现方式中,一个空闲数据行被划分为D*M个标志行,D为正整数;所述映射关系表的存储空间包括至少R个存储单元,所述R个存储单元以R行1列的阵列排列,所述存储单元包括M+1个存储子单元,R≥Q/M,R为正整数;所述配置单元通过映射关系表存储所述Q个标志行与内存中数据块的映射关系,具体包括:
在第i行存储单元的第一个存储子单元中写入第k个标志行所属的数据行的缓存块号;以及,
在第i行存储单元的第j个存储子单元中写入所述Q个标志行中第k个标志行的块内编号;
所述第k个标志行的组内块号为N+i-1,所述第k个标志行的组号为j-2;
其中,i≤R,2≤j≤M+1,k=(i-1)*M+j,i、j、k为正整数。
在又一种可能的实现方式中,H个空闲数据行划分出M个标志行,H为正整数;所述映射关系表的存储空间包括至少R个存储单元,所述R个存储单元以R行1列的阵列排列;所述配置单元通过映射关系表存储所述Q个标志行与内存中数据块的映射关系,具体包括:
第i个存储单元包括第k个标志行所属的数据行的缓存块号,以及通过所述第k个标志行在第(i-1)*M+1至i*M的M个标志行中的排序指示所述第k标志行的块内编号;
所述第k个标志行的组内块号为N+i-1,所述第k个标志行的组号为所述第k个标志行在第(i-1)*M+1至i*M的M个标志行中的排序;
其中,(i-1)*M+1≤k≤i*M,i、k为正整数;R≥Q/M,R为正整数。
在又一种可能的实现方式中,所述缓存控制器还包括:
判断单元,用于在所述数据域中空闲数据行的存储空间大于第一阈值时,则判断为所述数据域中空闲数据行的数量满足第一条件。
在又一种可能的实现方式中,所述配置所述Q个标志行与内存中数据块的映射关系之后,所述缓存控制器还包括:
回写单元,用于在所述高速缓存内空闲的数据行的数量小于第二阈值或所述高速缓存的未命中率大于第三阈值的情况下,将所述数据域中S个标志行对应的缓存行内的数据回写到所述内存;
第一恢复单元,用于将所述S个标志行恢复为T个数据行,并清除所述S个标志行与所述内存中数据块的映射关系;
其中,所述Q个标志行包括所述S个标志行;S≤Q、T≤P,S、T为正整数。
在又一种可能的实现方式中,所述配置所述Q个标志行与内存中数据块的映射关系之后,所述缓存控制器还包括:
映射单元,用户在所述高速缓存内空闲的数据行的数量小于第二阈值或所述高速缓存的未命中率大于第三阈值的情况下,将所述数据域中S个标志行对应的缓存行映射到标志域中S个标志行对应的缓存行;
第二恢复单元,用于将所述S个标志行恢复为T个数据行,并清除所述S个标志行与所述内存中数据块的映射关系;
其中,所述Q个标志行包括所述S个标志行;S≤Q、T≤P,S、T为正整数。
在又一种可能的实现方式中,所述高速缓存与内存的映射方式为组相连映射,所述高速缓存包括多个缓存组,所述映射单元将所述数据域中S个标志行对应的缓存行映射到标志域中S个标志行对应的缓存行,具体包括:
将第二标志行对应的缓存行映射到所述标志域中所述第二标志行所在的缓存组内的标志行对应的缓存行;
所述第二标志行为所述数据域中S个标志行中任意一个标志行。
第四方面,本发明实施例还提供了一种高速缓存中数据访问方法,所述高速缓存可实现数据去重,包括数据存储器和缓存控制器,所述数据存储器包括数据域和标志域,所述缓存控制器包括:
接收单元,用于接收处理器发送的携带主存地址的请求;
命中判断单元,用于读取高速缓存与内存的映射关系,比较所述主存地址与缓存行的标签字段,查看是否在命中所述请求的缓存行;
第一响应单元,用于在存在命中所述请求的缓存行时,访问命中的缓存行内的数据;或者,第二响应单元,用于在不存在命中所述请求的缓存行时,分配缓存行,读取内存中所述主存地址对应的数据到分配的缓存行,访问所述分配的缓存行中数据;
其中,所述数据域中包括Q个标志行,所述Q个标志行由所述数据域中P个空闲数据行划分得到;所述高速缓存中缓存行与内存中数据块的映射关系包括所述Q个标志行与内存中数据块的映射关系。
在又一种可能的实现方式中,所述高速缓存与内存的映射方式为全相连映射;所述命中判断单元比较所述主存地址与缓存行的标签字段,查看是否存在命中所述请求的缓存行,具体包括:
比较所述主存地址的主存字块标记与所述高速缓存中所有的标志行的标签字段,查看是否存在与所述主存地址的主存字块标记相符合的标志行;所述高速缓存中所有的标志行包括所述数据域中Q个标志行;
所述与所述主存地址的主存字块标记相符合的标志行对应的缓存行为命中的缓存行;
其中,所述主存地址包括主存字块标记以及字块内地址;标志行的标签字段包括主存字块标记。
在又一种可能的实现方式中,所述高速缓存与内存的映射方式为组相连映射;所述高速缓存划分为多个缓存组,所述命中判断单元比较所述主存地址与缓存行的地址,查看是否存在命中所述请求的缓存行,具体包括:
根据所述主存地址中组号确定缓存组;
比较所述主存地址的主存字块标记与确定的缓存组中所有的标志行的标签字段,查看是否存在与主存地址的主存字块标记相符合的标志行;
所述与主存地址的主存字块标记相符合的标志行对应的缓存行为命中的缓存行;
其中,所述主存地址包括主存字块标记、组号以及字块内地址;标志行的标签字段包括主存字块标记。
在又一种可能的实现方式中,所述高速缓存与内存的映射方式为组相连映射;所述缓存控制器还包括:
查找单元,用于在所述命中判断单元根据所述主存地址中组号确定缓存组之后,所述比较所述主存地址的主存字块标记与所述缓存组中所有的标志行的标签字段之前,根据映射关系表查找所述数据域中与所述组号对应的标志行,所述数据域中与所述组号对应的标志行为所述缓存组内标志行;
其中,所述映射关系表用于存储所述Q个标志行与内存中数据块的映射关系,包括所述第一标志行的地址信息以及所述第一标志行对应的组号、组内块号;所述地址信息包括缓存块号和块内编号;所述缓存块号用于指示所述第一标志行所属数据行在所述数据域中的地址,所述块内编号用于指示所述第一标志行在所述第一标志行所属数据行中的地址;所述第一标志行为所述Q个标志行中任意一个标志行。
在又一种可能的实现方式中,所述高速缓存与内存的映射方式为N+R路组相连;所述查找单元具体用于:
根据所述映射关系表查找所述Q个标志行中与所述组号对应的R个标志行;所述R个标志行为所述缓存组内标志行;其中,R=Q/M,R为整数。
在又一种可能的实现方式中,所述缓存控制器还包括:
回写单元,用于在所述高速缓存内空闲的数据行的数量小于第一阈值或所述高速缓存的未命中率大于第二阈值的情况下,将所述数据域中S个标志行对应的缓存行内的数据回写到所述内存;
第一恢复单元,用于将所述S个标志行恢复为T个数据行,并清除所述S个标志行与所述内存中数据块的映射关系;
其中,所述Q个标志行包括所述S个标志行;S≤Q、T≤P,S、T为正整数。
在又一种可能的实现方式中,所述缓存控制器还包括:
映射单元,用于在所述高速缓存内空闲的数据行的数量小于第一阈值或所述高速缓存的未命中率大于第二阈值的情况下,将所述数据域中S个标志行对应的缓存行映射到标志域中S个标志行对应的缓存行;
第二恢复单元,用于将所述S个标志行恢复为T个数据行,并清除所述S个标志行与所述内存中数据块的映射关系;
其中,所述Q个标志行包括所述S个标志行;S≤Q、T≤P,S、T为正整数。
在又一种可能的实现方式中,所述高速缓存与内存的映射方式为组相连映射,所述高速缓存包括多个缓存组,所述映射单元将所述数据域中S个标志行对应的缓存行映射到标志域中S个标志行对应的缓存行,具体包括:
将第二标志行对应的缓存行映射到所述标志域中所述第二标志行所在的缓存组内的标志行对应的缓存行;
所述第二标志行为所述数据域中S个标志行中任意一个标志行。
第五方面,本发明实施例还提供了一种计算设备,所述计算设备包括:至少一个处理器以及存储器,所述处理器包括至少一个高速缓存;所述存储器包括内存;所述处理器用于通过所述高速缓存调用所述存储器中的数据和程序执行所述计算设备的功能,所述高速缓存用于执行如第一方面所述的部分或全部流程。
第六方面,本发明实施例还提供了一种计算设备,所述计算设备包括:至少一个处理器以及存储器,所述处理器包括至少一个高速缓存;所述存储器包括内存;所述处理器用于通过所述高速缓存调用所述存储器中的数据和程序执行所述计算设备的功能,所述高速缓存用于执行如第二方面所述的部分或全部流程。
附图说明
图1是本发明实施例提供的一种计算机处理系统的示意性框架图;
图2是本发明实施例提供的一种cache的框架示意图;
图3A是本发明实施例提供的一种内存与cache直接映射的示意性说明图;
图3B是本发明实施例提供的一种直接映射中主存地址和cache地址的示意性说明图;
图3C是本发明实施例提供的一种内存与cache全相连映射的示意性说明图;
图3D是本发明实施例提供的一种全相连映射中主存地址和cache地址的示意性说明图;
图3E是本发明实施例提供的一种内存与cache组相连映射的示意性说明图;
图3F是本发明实施例提供的一种组相连映射中主存地址和cache地址的示意性说明图;
图4是本发明实施例提供的一种cache的数据结构的示意图;
图5是本发明实施例提供的一种cache中资源调整的方法的流程示意图;
图6A所示的全相连映射中映射关系表的存储结构的示意图;
图6B所示的全相连映射中映射关系表的存储结构的示意图;
图6C所示的全相连映射中映射关系表的存储结构的示意图;
图6D所示的组相连映射中映射关系表的存储结构的示意图;
图6E所示的组相连映射中映射关系表的存储结构的示意图;
图6F所示的组相连映射中映射关系表的存储结构的示意图;
图6G是本发明实施例提供的一种cache中标志行的示意性说明图;
图7是本发明实施例提供的一种4路组相连转变为5路组相连的原理示意图;
图8是本发明实施例提供的一种cache中数据访问方法的流程示意图;
图9是本发明实施例提供的一种cache结构示意图;
图10是本发明实施例提供的一种缓存控制器的结构示意图;
图11是本发明实施例提供的一种cache结构示意图;
图12是本发明实施例提供的一种缓存控制器结构示意图。
具体实施方式
下面将结合本发明实施例中的附图,对本发明实施例中的技术方案进行清楚、完整地描述。
下面介绍本发明涉及的处理器(central processing unit,CPU)、高速缓冲存储器(Cache,简称高速缓存)、内存(也称主存储器(main memory))之间的关系。
可以理解,本发明涉及的CPU、Cache和内存可以应用于计算设备中,计算设备可以包括处理器和内存,该电子终端可以包括计算机,智能手机,平板电脑,智能电视,智能手环、VR眼镜、智能手表等可穿戴设备,车载终端等,本发明不作限制。
高速缓冲存储器是介于CPU与内存之间的高速小容量的存储器,由静态存储芯片(static random access memory,SRAM)组成,其速度接近CPU的速度,存在多级的分层架构。请参阅图1,图1是本发明实施例提供的一种处理器、高速缓冲存储器以及内存所组成的计算机处理系统的示意性框架图。可以理解,图1所述的计算机处理系统也可以位于单一的计算设备中。处理器可以是单核处理器也可以是多核处理器,即包括第一核CPU、第二核CPU,处理器可以包括三个级别的高速缓存存储器,分别为一级高速缓冲存储器(也称L1Cache)、二级高速缓冲存储器(也称L2Cache)和三级高速缓冲存储器(也称L3Cache)。其中,L1Cache由指令Cache和数据Cache组成,L2Cache或L3Cache可以包括数据和指 令,L1Cache和L2Cache为每个核独有,L3Cache为同一个CPU中所有的核共享。
Cache被分为多个缓存行(Cache line),每个缓存行可以是64比特(byte)、126比特或其他数值等,缓存行是Cache与下级Cache,或Cache与内存数据交换的最小单位。内存中数据以数据块为单位存储数据,缓存行与内存中数据块进行数据交换,内存中一个数据块存储的数据大小与Cache中一个缓存行可存储数据的大小相一致。主存中的数据存储到有限的cache中,数据块所在的主存地址必须映射到cache地址。映射方式包括但不限于直接映射、全相连映射、组相连映射或其他映射方式等。
请参阅图2,图2是本发明实施例提供的一种cache的框架示意图,Cache包括了两部分:缓存控制器210和缓存存储器220。其中,缓存存储器包括标志域(Tag Ram)221、数据域(Date Ram)222。其中,标志域包括多个标志行(Tag Entry),数据域包括多个数据行(Date Entry),一个标志行和一个数据行映射,形成一个缓存行。本发明各实施例中cache是可压缩或去重的cache,cache中不存在大量相同数据的数据行,多个标志行可以映射一个数据行。标志域和数据域的映射的实现方式可以包括但不限于双向链表、单向链表或其他实现方式等,本发明不作限定。
其中,缓存控制器210用于接收CPU发送的携带主存地址的请求,在cache中查找是否命中的缓存行,如果是,则命中(cache hit),缓存控制器读取该命中的缓存行中的数据(请求的类型为读请求的情况下),并返回给CPU;否者,则未命中(cache miss),缓存控制器读取内存240中的数据到空闲的缓存行,再从缓存行中读取数据返回给CPU,进而实现对请求的处理。缓存控制器与内存之间通过总线230进行通信。
缓存控制器210还统计CPU下发的请求的命中率,还可以实现数据去重。当多个缓存行内存储的数据一致时,可以共用数据行,该数据行可以映射到多个标志行,以实现数据去重。
下面介绍本发明实施例涉及的内存中与cache的映射方式:
内存被划分为多个数据块,通过主存字块标记来区分各个数据块。高速缓存中数据域被划分为多个缓存块(本申请中也称数据行),通过缓存字块标记(本申请中也称缓存块号)来区分各个缓存块。
直接映射:
请参阅图3A,图3A是本发明实施例提供的一种内存与cache直接映射的示意性说明图。
直接映射是一种多对一的映射关系,即主存中的数据块只能映射到唯一的缓存行,多个数据块可以映射同一缓存行。
请参阅图3B,图3B是本发明实施例提供的一种直接映射中主存地址和cache地址的示意性说明图。
主存地址包括主存字块标记、缓存块标记、字块内地址。
Cache地址包括缓存块标记和字块内地址。
可以理解,主存字块标记可以是主存块号,缓存块标记可以是缓存块号。
当cache接收到CPU发送的携带主存地址的请求后,根据主存地址中间“缓存字块标 记”字段找到缓存行,比如该缓存行为第一缓存行,然后比较该第一缓存行的标签(Tag)字段是否与主存地址的“主存字块标记”位相符合,若符合,则表示该第一缓存行已经和主存中的该请求所要访问数据块配置了对应关系,第一缓存行命中CPU发送的请求。
全相连映射:
请参阅图3C,图3C是本发明实施例提供的一种内存与cache全相连映射的示意性说明图。
全相连映射是一种多对多的映射关系,主存中任一数据块都可以映射到cache中任一缓存行。
请参阅图3D,图3D是本发明实施例提供的一种全相连映射中主存地址和cache地址的示意性说明图。
主存地址包括主存字块标记、字块内地址。
Cache地址包括缓存块标记和字块内地址。
可以理解,主存字块标记可以是主存块号,缓存块标记可以是缓存块号。
当cache接收到CPU发送的携带主存地址的请求后,将主存地址中的“主存字块标记”与cache中每个缓存行的Tag字段进行比较,如果找到与主存地址中“主存字块标记”相同标记的缓存行,则该与主存地址中“主存字块标记”相同标记的缓存行命中CPU发送的请求。
组相连映射:
请参阅图3E,图3E是本发明实施例提供的一种内存与cache组相连映射的示意性说明图。
组相连映射,指主存和cache都分组,组间采用直接映射,组内采用全相连映射。例如,cache中块缓块分为M组,每个组中包括R块缓存行。若每组内有n块缓存行,则该种映射方式又称为n路组相联。如图3E所示的映射关系为2路组相联。
请参阅图3F,图3F是本发明实施例提供的一种组相连映射中主存地址和cache地址的示意性说明图。
主存地址包括s位主存字块标记、q位组号,b位字块内地址。
Cache地址包括q位组号、e位组内块号和b位字块内地址。
当cache接收到CPU发送的携带主存地址的请求后,首先通过主存地址中“组号”找到缓存行所在的组,之后按照全相联映射方式,通过主存地址中“主存字块标记”字段与该组内各个缓存行的Tag字段进行比较,如果找到与主存地址中“主存字块标记”相同标记的缓存行,则该与主存地址中“主存字块标记”相同标记的缓存行命中CPU发送的请求,根据cache与内存的映射关系确定该命中的缓存行对应的组内块号,进而基于组号和组内块号确定的命中的缓存行。
其中,字块内地址的长度b=log 2 (Sc),Sc为缓存行的大小;组号的长度q=log 2 (Ns),Ns为cache中组的个数,主存字块标记的长度s=l-b-q,l为主存地址的长度。
本发明实施例中,资源调整后,组的个数不变,组内块数(即组内缓存行)的数量增加。因而,组内块号的长度e>log 2 n,且e为正整数,其中,n为组相连路数。
例如,以4路组相连为例,cache的大小为4Mb,缓存行的长度为64b,主存地址为32 位,则字块内地址的长度b为8位,组号的长度q为12位,主存字块标记的长度s为12位。由于需要进行资源调整,组内块号的最小长度e最小为3位,组内地址的长度可以扩充到4位或5位等,以适应资源调整后组内块号的要求。
需要说明的是,关于Tag字段的描述请参阅图4中相关描述,本申请不再赘述。
下面介绍本发明实施例涉及的cache的数据结构:
请参阅图4,图4是本发明实施例提供的一种cache的数据结构的示意图。该Cache可实现数据去重,可以包括标志域和数据域,cache还可以包括哈希表(Hash Table)。图4中未示出该哈希表。其中,标志域包括Cache的多个标志行,如图4中标志行T0、T1、T2等等;数据域包括Cache的多个数据行,如图4中数据字段标记为d0、d1、d2等等的数据行。哈希表用于存储新存储的数据的哈希值,用于判断数据是否重复。图4中,标志阵列采用4路组相连的方式进行排列。标志行包括标签(Tag)字段、数据指针(Tptr)字段、标记索引字段等。标志行还可以包括淘汰算法标识字段或其他字段,本发明不作限制。
其中,Tag字段包括该缓存行的主存字块标记字段、状态(State)字段、有效位(Valid)等,Tag字段还可以包括淘汰算法标识字段或其它字段等,本发明不做限制。
若标志行对应的缓存行包括有效数据,则该标志行的主存字块标记字段可以是该主存中存储该数据的数据块对应主存字块标记。
状态字段用于存储缓存行的一致性状态,缓存行的一致性状态可以包括但不限于修改(modified)态(也称M态)、专有(exclusive)态(也称E态)、共享(shared)态(也称S态)以及无效(invalid)态(也称I态)等。
有效字段用于指示缓存行的存储的数据是否有效。
淘汰算法标识字段用于指示该缓存行所使用的淘汰算法,可以是LRU(英文:Least Recently Used)标记或其他标记,本发明不作限定。
Tptr字段指示该标志行对应的数据行的地址。
标记索引字段指示多个标志行的索引,该多个标志行映射同一数据行。索引的方式可以是双向链表、单向链表或其他形式,本发明不作限定。对于双向链表来说,标记索引字段包括前向链表和后向链表,其中,前向链表指示前一个标志行的索引,当新存储的缓存行与该多个标志行对应的数据行内数据一致时,后向的链表保存新增缓存行对应的标志行的索引,否则为空。双向链表或单向链表中多个标志行映射同一数据行。
如图4所示,数据行可以包括表头(Dptr)字段、数据(Data Frame)字段、指针(Ctr)字段等。数据行还可以包括去重(flag)字段或其他字段等,本发明不作限制。Dptr字段指示标志行的索引,可以是双向链表或单向链表的表头,其中,双向链表或单向链表为该数据行对应的所有标志行组成的链表。Data Frame字段存储数据、缓存行的长度等。Ctr字段指示该数据行被共享的标志行的数量,也就是说有几个标志行共享了该数据行,当新增共享的标志行时,Ctr至则增加,反之,则减少。当Ctr为0时,表明该数据行未被使用,可以重新分配其他的数据进行存储。flag字段用于表明该数据行是否已经进行了去重判断。
可以理解,数据行还可以包括其他字段比如错误纠正码(error-correcting code,ECC)字段,本发明不作限定。
下面介绍本发明实施例涉及的cache中资源调整的方法:
本申请中,cache可实现数据去重,包括数据域和标志域。当cache进行去重操作后,cache中存在大量的空闲数据行,cache可以将部分空闲数据行划分出多个标志行,实现数据域复用为标志域,进而增大cache的可访地址空间,增大cache的容量,提升数据处理效率。
请参阅图5,图5是本发明实施例提供的一种cache中资源调整的方法的流程示意图,该方法中各个步骤可以由计算机设备、或计算机设备中cache或缓存控制器执行,本申请以计算机设备中cache为例来介绍cache中资源调整的方法,该方法包括以下全部或部分步骤:
步骤S500:cache在检测针对缓存行的数据去重操作且数据域中空闲数据行的数量满足第一条件的情况下,将数据域中P个空闲数据行划分出Q个标志行;数据域包括多个数据行,该多个数据行包括P个空闲数据行;P、Q为正整数。
可以理解,在cache检测到针对缓存行的数据去重操作后,cache可以检测数据域中空闲数据行的数量,当数据域中空闲数据行的数量满足第一条件时进行资源调整,即将数据域中P个空闲数据行划分出Q个标志行。该Q个标志行组成的标志域即为新增标志域。
本发明一实施例中,Q=P*Sc/St,其中,Sc为一个数据行的长度,St为一个标志行的长度;可选地,当Sc/St为非整数时,Sc/St可以取其商,进而避免一个标志行跨越两个数据行。
可以理解,P个空闲的数据行可以是缓存块号连续的数据行,也可以是缓存块号不联系的数据行。本发明作限定。
步骤S501:基于高速缓存与内存的映射方式,cache建立Q个标志行与内存中数据块的映射关系,以使数据域中的P个空闲数据行复用为Q个标志行。
数据域中Q个标志行的数据结构与标志域中标志行的数据结构相同,标志行的数据结构可以参见上述cache的数据结构中相关描述,本发明不再赘述。
可以理解,被复用为标志行的数据行不再是数据行,不能用来缓存数据,可以作为标志行;当被复用为标志行的数据行通过解复用后,该被解复用数据行恢复数据缓存功能。
本法一实施例中,步骤S500之前,该方法还包括:在数据域中空闲数据行的存储空间大于第一阈值时,数据域中空闲数据行的数量满足第一条件;否则,数据域中空闲数据行的数量不满足第一条件,cache可以结束资源调整的流程,也可以执行其他操作,本发明不作限制。可以理解,第一阈值可以是预设个数的标志行存储空间,也可以是预设个数的数据行的存储空间,本发明不作限定。
可选地,对于N路组相连映射,若cache包括M个缓存组,则该预设个数可以大于划分M个标志行所需要的数据行的个数。
需要说明的是,该第一条件还可以包括其它形式,本发明不做限定。
本发明一实施例中,步骤S501的一种实施方式可以包括:基于高速缓存与内存的映射方式,通过映射关系表存储Q个标志行与内存中数据块的映射关系。其中,该映射关系表包括第一标志行的地址信息;该地址信息包括缓存块号和块内编号;该缓存块号用于指示 第一标志行所属数据行在数据域中的地址,该块内编号用于指示第一标志行在该第一标志行所属数据行中的地址;第一标志行为Q个标志行中任意一个标志行。
其中,数据域包括多个数据行,各个数据行根据其地址的顺序进行编号,该编号即为缓存块号。通常,数据行的长度远大于标志行的长度,在数据域内数据行复用为标志行时,一个数据行被划分为多个标志行,各个数据行中被划分的标志行可以基于其地址的顺序进行编号,该编号即为块内编号。
下面分别介绍全相连映射和组相连映射中映射关系表的存储结构:
高速缓存与内存的映射方式为全相连映射:
在一种实施方式中,请参阅图6A所示的全相连映射中映射关系表的存储结构的示意图,映射关系表的存储空间包括至少Q个存储单元,该至少Q个存储单元可以以A行B列的阵列的方式存储。可以将Q个标志行的地址信息分别写入Q个存储单元以存储Q个标志行与内存中数据块的映射关系,其中,A、B为正整数,A*B≥Q。该各个存储单元用于存储标志行的地址信息,包括缓存块号字段和块内编号字段。
可选地,cache可以在第i行第j列存储单元存储中写入Q个标志行中第k个标志行的地址信息;其中,k=(i-1)*B+j,i≤A、j≤B、k≤Q,i、j、k为正整数。
在另一种实施方式中,请参阅图6B所示的全相连映射中映射关系表的存储结构的示意图。映射关系表的存储空间包括至少P个存储单元,该P个存储单元以P行1列的阵列排列,各个存储单元包括C+1个存储子单元。cache可以在第i行存储单元的第一个存储子单元中写入第k个标志行所属的数据行的缓存块号,以及,在第i行存储单元的第j个存储子单元中写入Q个标志行中第k个标志行的块内编号。其中,i≤P、2≤j≤C、k=(i-1)*(C-1)+j-1,i、j、k为正整数。可以理解,一个数据行可以被划分为C-1个标志行。
在又一种实施方式中,请参阅图6C所示的全相连映射中映射关系表的存储结构的示意图,映射关系表的存储空间包括至少P个存储单元,该P个存储单元以P行1列的阵列排列或以1行P列的阵列排列。若一个空闲数据行被划分为Y个标志行,Y为正整数,P*Y≥Q,Cache可以在第i行存储单元写入第(i-1)*Y+1至i*Y的Y个标志行所属数据行的缓存块号。
可以理解,第i行存储单元包括第k个标志行所属的数据行的缓存块号,通过第k个标志行在第(i-1)*Y+1至i*Y的Y个标志行中的排序来确定第k标志行的块内编号,以通过映射关系表存储该Q个标志行与内存中数据块的映射关系。其中,(i-1)*Y+1≤k≤i*Y,i、k为正整数。
可以理解,本发明实施例所述的映射关系表仅仅存储缓存块号,通过第k个标志行在第(i-1)*Y+1至i*Y的Y个标志行中的排序来确定第k标志行的块内编号,极大的节省了映射关系表的存储空间。
需要说明的是,映射关系表还可以以其他形式的存储结构进行存储,本发明不作限定。
高速缓存与内存的映射方式为组相连映射:
以下以高速缓存与内存以N路组相连的方式映射,高速缓存的标志域被划分为M组标志行,每组中包括N个标志行为例来说明Q个标志行与内存中数据块的映射关系。其中, M、N为正整数。对应组相连映射,映射关系表还包括:第一标志行与组号、组内块号的映射关系,第一标志行为Q个标志行中任意一个标志行。
在一种实施方式中,请参阅图6D所示的组相连映射中映射关系表的存储结构的示意图,该映射关系表的存储空间包括Q个存储单元,Q个存储单元以M行R列的阵列排列,cache可以在第i行第j列存储单元存储中写入Q个标志行中第k个标志行的地址信息,以通过映射关系表存储Q个标志行与内存中数据块的映射关系。其中,R为Q/M的商,R为正整数;k=(i-1)*M+j,i、j、k为正整数。
其中,可以通过标志行所在的行号来指示标志行的组号,通过标志行所在列来指示标志行的块内组号或路数。例如第k个标志行的组号为i-1,第k个标志行的路数为N+j-1,第k个标志行的组内块号为N+j-1。
可以理解,上述映射关系表的存储结构可以根据标志行的地址信息快速定位该标志行,提高数据处理效率。
在另一种实施方式中,请参阅图6E所示的组相连映射中映射关系表的存储结构的示意图,若一个空闲数据行被划分为D*M个标志行,D为正整数;该映射关系表的存储空间包括至少R个存储单元,该R个存储单元以R行1列的阵列排列,各个存储单元包括M+1个存储子单元,R≥Q/M,R为正整数。cache可以在第i行存储单元的第一个存储子单元中写入第k个标志行所属的数据行的缓存块号;以及,在第i行存储单元的第j个存储子单元中写入Q个标志行中第k个标志行的块内编号,以通过映射关系表存储Q个标志行与内存中数据块的映射关系。其中,i≤R,2≤j≤M+1,k=(i-1)*M+j,i、j、k为正整数,D*P=R。
其中,可以通过标志行所在的存储单元的序号来指示标志行的块内组号,通过标志行所在子存储单元中的序号来指示标志行的组号。例如,例如第k个标志行的组内块号为N+i-1,第k个标志行的组号为j-2。
需要说明的是,在图6E中,第1数据行、第2数据行、第3数据行等可以是同一数据行,也可以是不同数据行。
例如,当D=1时,R=P,一个数据行被划分为M个标志行,M个标志行分配到不同的组中,使得组相连结构增加1路。
又例如,当D=2时,第1数据行与第2数据行为同一数据行,一个数据行被划分为2M个标志行。前M个标志行被分配到不同的组中,使得组相连结构增加1路;后M个标志行被分配到不同的组中,也使得组相连结构增加1路。
可以理解,本发明实施例所述的映射关系表仅仅存储缓存块号,通过标志行所在子存储单元中的序号来指示标志行的组号,节省了映射关系表的存储空间。
在又一种实施方式中,H个空闲数据行划分出M个标志行,H为正整数,请参阅图6F所示的组相连映射中映射关系表的存储结构的示意图,映射关系表的存储空间包括至少R个存储单元,该R个存储单元以R行1列的阵列排列。Cache可以在第i行存储单元写入第(i-1)*M+1至i*M的M个标志行所属数据行的缓存块号,可以理解,第i个存储单元包括第k个标志行所属的数据行的缓存块号,并通过所述第k个标志行在第(i-1)*M+1至i*M的M个标志行中的排序指示所述第k标志行的块内编号,以通过映射关系表存储该Q个标志行与内存中数据块的映射关系。其中。该第k个标志行的组内块号为N+i-1,该第k个标 志行的组号为该第k个标志行在第(i-1)*M+1至i*M的M个标志行中的排序。其中,(i-1)*M+1≤k≤i*M,i、k为正整数;R≥Q/M,R为正整数。可以理解,各个存储单元分别包括H个存储子单元,分别用于存储H个数据行的缓存块号。
例如,两个数据行可划分为M个标志行,则第1存储单元存储P个空闲数据行中第1数据行的缓存块号和第2数据行的缓存块号;第2存储单元存储P个空闲数据行中第3数据行的缓存块号和第4数据行的缓存块号,以此类推,第i存储单元存储P个空闲数据行中第2*i-1数据行的缓存块号和第2*i数据行的缓存块号。其中,i≤R。
需要说明的是,本发明实施例中,当M个标志行需要H个数据行来划分,且H个数据行可划分的标志行数据大于M的情况下,H个数据行仅划分出M个标志行,以避免同一数据行划分出组内块号不同的标志行。
可以理解,本发明实施例所述的映射关系表仅仅存储缓存块号,通过第k个标志行在第(i-1)*M+1至i*M的M个标志行中的排序来确定第k标志行的组号,极大的节省了映射关系表的存储空间。
可以理解,对应组相连映射,资源调整后,高速缓存与内存的映射方式为由N组相连映射转变为N+R路组相连。请参阅图6G,图6G是本发明实施例提供的一种cache中标志行的示意性说明图。标志域中N路的标志行与数据域中新增加的R路标志行一起形成具有N+R路组相连映射方式的cache。
需要说明的是,图6G中标志行可以包括Tag字段、Tptr字段、标记索引字段或其他字段等。Tag字段可以包括但不限于主存字块标记字段、state字段、valid字段或其他字段等,本发明不作限定。
需要说明的是,若Q为M的非整数倍,例如,Q大于M*R,小于M*(R+1),则高速缓存与内存的映射方式为由N组相连映射转变部分组N+R路组相连,部分组N+R+1路组相连。
还需要说明的是,映射关系表还可以以其他形式的存储结构进行存储,本发明不作限定。
例如,请参阅图7,图7是本发明实施例提供的一种4路组相连转变为5路组相连的原理示意图。Cache中划分为16个数据行和16个标志行,采用4路组相连的方式映射到内存。标志域中标志行被划分为4组(Set),每个组内包括4个标志行。数据域中数据行采用去重结构,各个数据行内存储的数据可以互不相同,标志域中标志行以链表的方式映射到数据行中形成缓存行。位于同一的链表的标志行对应同一数据行,即同一的链表下各个缓存行内存储的数据相同。进行资源调整后,将空闲数据行(如图7所示的缓存块号为15的数据行)划分出4个标志行,该4个标志行的(组号,组内块号)依次是(0,4)、(1,4)、(2,4)、(3,4)。
本发明一实施例中,步骤S501之后,在cache内空闲的数据行的数量小于第二阈值或cache的未命中率大于第三阈值的情况下,cache可以将数据域中S个标志行对应的缓存行内的数据回写到内存;进而,将S个标志行恢复为T个数据行,并清除S个标志行与内存中数据块的映射关系;其中,Q个标志行包括S个标志行;S≤Q、T≤P,S、T为正整数。
具体地,当未命中率大于第三阈值,则cache中数据行存在频繁的替换,此时,cache 查看是否存在数据域中数据行被复用为标志行,如果是,则代理第一缓存行向内存控制器发送回写指令,该回写指令携带第一缓存行中的数据。该第一缓存行为S个标志行对应的S个缓存行。可以理解,该第二阈值可以是1、4、6、10、16或其他数值等,本发明不作限定。第三阈值可以是0.1、0.2、0.25、0.4或其他数值,本发明不作限定。
本发明一实施例中,步骤S501之后,在高速缓存内空闲的数据行的数量小于第二阈值或高速缓存的未命中率大于第三阈值或情况下,cache可以将数据域中S个标志行对应的缓存行映射到标志域中S个标志行;进而,将该S个标志行恢复为T个数据行,并清除该S个标志行与内存中数据块的映射关系;其中,Q个标志行包括该S个标志行;S≤Q、T≤P,S、T为正整数。
对于全相连映射方式来说,该标志域中S个标志行可以是标志域中状态为无效态的任意S个标志行,也可以是标志域中状态为非无效态(如M态、E态、S态)的任意S个标志行,还可以既包括无效态的S个标志行又包括非无效态的标志行。对于M态的标志行,还需要将该M态的标志行对应的缓存行内数据回写到内存,以维持高速缓存内数据的一致性。
对于组相连映射方式来说,数据域中S个标志行包括第二标志行,该第二标志行为数据域中S个标志行中任意一个标志行。cache将数据域中S个标志行对应的缓存行映射到标志域中S个标志行的一种实施方式可以是:cache将第二标志行对应的缓存行映射到标志域中该第二标志行所在的缓存组内的标志行。同理,该标志域中该第二标志行所在的缓存组内的标志行可以是状态为无效态的任意S个标志行,也可以是状态为非无效态(如M态、E态、S态)的个标志行。对于M态的标志行,还需要将该M态的标志行对应的缓存行内数据回写到内存,以维持高速缓存内数据的一致性。
本发明一实施例中,数据域中S个标志行由T个数据行划分;T个数据行为资源调整前数据域中的数据行。可以理解,cache可以根据映射关系表确定属于同一个或多个数据行的S个标志行,进而释放该S个标志行,并清除该映射关系表中S个标志行对应的存储单元中地址信息。具体可参阅上述图6A-6F所示的映射关系表的存储结构,本发明不再赘述。本发明实施例中,cache可实现数据去重,包括数据域和标志域,cache在检测针对缓存行的数据去重操作且数据域中空闲数据行的数量满足第一条件的情况下,将数据域中P个空闲数据行划分出Q个标志行,进而,基于高速缓存与内存的映射方式,建立Q个标志行与内存中数据块的映射关系,以实现数据域中的P个空闲数据行复用为Q个标志行,进而增大cache的可访地址空间,增大cache的容量,提升数据处理效率。
本发明实施例中,所述高速缓存可实现数据去重,包括数据域和标志域,cache在检测针对缓存行的数据去重操作且所述数据域中空闲数据行的数量满足第一条件的情况下,将所述数据域中P个空闲数据行划分出Q个标志行;并基于高速缓存与内存的映射方式,配置所述Q个标志行与内存中数据块的映射关系,以使所述数据域中的所述P个空闲数据行复用为所述Q个标志行,实现数据域复用为标志域,进而增大cache的可访地址空间,增大cache的容量,提升数据处理效率。
下面介绍本发实施涉及的一种高速缓存中数据访问方法,请参阅图8所示的cache中 数据访问方法的流程示意图,该数据访问方法的执行主体可以是计算机设备中cache或者缓存控制器,本申请以cache为例来介绍高速缓存中数据访问方法,该方法可以包括以下部分或全部步骤:
需要说明的是,本申请中,cache可实现数据去重,包括数据域和标志域。当cache进行去重操作后,cache中存在大量的空闲数据行,cache可以将部分空闲数据(本发明实施例中也称P个空闲数据行或P个数据行)行划分出多个标志行(本发明实施例中也称Q个标志行),高速缓存中缓存行与内存中数据块的映射关系包括该Q个标志行与内存中数据块的映射关系,进而实现数据域复用为标志域,进而增大cache的可访地址空间,增大cache的容量,提升数据处理效率。
步骤S800:cache接收处理器发送的携带主存地址的请求。
可以理解,请求的类型包括读请求和写请求,主存地址包括主存字块标记以及字块内地址。
步骤S801:cache读取高速缓存与内存的映射关系,比较主存地址与缓存行的标签字段,查看是否在命中请求的缓存行。
对于高速缓存与内存的映射方式为全相连映射来说,主存地址包括主存字块标记以及字块内地址;标志行中标签字段中包括主存字块标记。步骤S801的一种实现方式可以是:cache比较主存地址的主存字块标记与高速缓存中所有的标志行的标签字段,查看是否存在与主存地址的主存字块标记相符合的标志行,即查看所有的标志行中是否存在标记字段包括的主存字块标记与主存地址的主存字块标记相同的标记行,该标记字段包括的主存字块标记与主存地址的主存字块标记相同的标记行对应的缓存行即为命中的缓存行。其中,高速缓存中所有的标志行包括数据域中Q个标志行。
可以理解,cache可以根据如图6A或图6B所示的映射关系表或其它形式的映射关系来查找Q个标志行的位置。该映射关系表用于指示Q个标志行与内存中数据块的映射关系,包括第一标志行的地址信息;该地址信息包括缓存块号和块内编号;该缓存块号用于指示该第一标志行所属数据行在数据域中的地址,该块内编号用于指示第一标志行在第一标志行所属数据行中的地址;第一标志行为该Q个标志行中任意一个标志行。
可选地,标志行的标签字段还包括有效字段,当有效字段的内容为1时,该标志行对应的缓存行内数据有效。有效字段的内容为1且标记字段包括的主存字块标记与主存地址的主存字块标记相同的标记行对应的缓存行为命中的缓存行。
对于高速缓存与内存的映射方式为组相连映射来说,cache划分为多个缓存组,各个缓存组内包括多个标志行,在资源调整后的cache的数据域中包括Q个标志行,假定资源调整后,组相连映射的路数增加。主存地址包括主存字块标记、组号以及字块内地址,标志行的标签字段包括主存字块标记。步骤S801的一种实现方式可以是:cache根据主存地址中组号确定缓存组,比较主存地址的主存字块标记与该确定的缓存组中所有的标志行的标签字段,查看是否存在与主存地址的主存字块标记相符合的标志行,即查看缓存组中所有的标志行中是否存在标记字段包括的主存字块标记与主存地址的主存字块标记相同的标记行,该标记字段包括的主存字块标记与主存地址的主存字块标记相同的标记行对应的缓存行即为命中的缓存行。
可选地,cache在根据主存地址中组号确定缓存组之后,在比较主存地址的主存字块标记与该确定的缓存组中所有的标志行的标签字段之前,cache可以根据映射关系表查找数据域中与组号对应的标志行,该数据域中与组号对应的标志行为缓存组内标志行。
可以理解,cache可以根据如图6C或图6D所示的映射关系表或其它形式的映射关系表来查找缓存组内标志行的位置。其中,映射关系表用于指示所述Q个标志行与内存中数据块的映射关系,包括第一标志行的地址信息以及第一标志行对应的组号、组内块号;该地址信息包括缓存块号和块内编号;该缓存块号用于指示第一标志行所属数据行在数据域中的地址,该块内编号用于指示第一标志行在所述第一标志行所属数据行中的地址;第一标志行为该Q个标志行中任意一个标志行。
例如,资源调整后cache与主存的映射方式为N路组相连,在资源调整后,N路组相连转变为N+R路组相连。其中,R=Q/M,R为整数。新增的R路由Q个标志行形成。
cache根据映射关系表查找数据域中与组号对应的标志行的一种实现方式可以是cache根据映射关系表查找该Q个标志行中与组号对应的R个标志行,该数据域中查找到的R个标志行即为确定的缓存组内标志行。
可选地,标志行的标签字段还包括有效字段,当有效字段的内容为1时,该标志行对应的缓存行内数据有效。有效字段的内容为1且标记字段包括的主存字块标记与主存地址的主存字块标记相同的标记行对应的缓存行为命中的缓存行。
步骤S802:在存在命中请求的缓存行时,访问命中的缓存行内的数据。
对于读请求,在存在命中读请求的缓存行时,即cache命中时,cache读取该命中的缓存行内主存地址中字块内标记对应的数据,并将该数据发送给处理器。
对于写请求,写请求还携带请求数据。在存在命中读请求的缓存行时,即cache命中时,cache将携带的请求数据写入到命中的缓存行内主存地址中字块内标记对应的位置。
步骤S803:在不存在命中请求的缓存行时,分配缓存行,读取内存中主存地址对应的数据到分配的缓存行,访问分配的缓存行中数据;
对于读请求,在不存在命中请求的缓存行时,即cache未命中时,cache分配缓存行,并读取内存中该主存地址对应的数据到分配的缓存行,在将分配的缓存行内主存地址中字块内标记对应的数据,并将该数据发送给处理器。
对于写请求,写请求还携带请求数据。在不存在命中请求的缓存行时,即cache未命中时,cache分配缓存行,并读取内存中该主存地址对应的数据到分配的缓存行,cache将携带的请求数据写入到分配的缓存行内主存地址中字块内标记对应的位置。
可以理解,cache还可以修改还缓存行对应的标志行中状态字段,也可以对该分配的缓存行进行去重操作等,还可以执行其它操作,本发明不作限制。
还需要说明的是,对于组相连映射方式来说,分配的缓存行为该主存地址的组号所确定的缓存组内的缓存行。对于全相连映射方式来说,分配的缓存行可以是cache中空闲缓存行,也可以是任意一个缓存行。
本发明一实施例中,在高速缓存内空闲的数据行的数量小于第一阈值的情况下;或高速缓存的未命中率大于第二阈值的情况下,或,在cache分配缓存行之前,cache还可以在cache内不存在空闲的数据行的情况下,cache可以将数据域中S个标志行对应的缓存行内 的数据回写到内存;以及,将该S个标志行恢复为T个数据行,,并清除该S个标志行与内存中数据块的映射关系。其中,该Q个标志行包括该S个标志行;S≤Q、T≤P,S、T为正整数。
具体地,当未命中率大于第二阈值,则cache中数据行存在频繁的替换;或,在cache需要分配缓存行时,cache还可以在cache内不存在空闲的数据行时,此时,cache查看是否存在数据域中数据行被复用为标志行,如果是,则代理第一缓存行向内存控制器发送回写指令,该回写指令携带第一缓存行中的数据。该第一缓存行为S个标志行对应的缓存行,可以包括是一个或多个缓存行。可以理解,该第一阈值可以是1、4、6、10、16或其他数值等,本发明不作限定。第二阈值可以是0.1、0.2、0.25、0.4或其他数值,本发明不作限定。
本发明一实施例中,在高速缓存内空闲的数据行的数量小于第一阈值的情况下;或高速缓存的未命中率大于第二阈值的情况下,或,在cache分配缓存行之前,cache还可以在cache内不存在空闲的数据行的情况下,cache可以将数据域中S个标志行对应的缓存行映射到标志域中S个标志行;进而,将该S个标志行恢复为T个数据行,并清除该S个标志行与内存中数据块的映射关系;其中,Q个标志行包括S个标志行;S≤Q、T≤P,S、T为正整数。
对于全相连映射方式来说,该标志域中S个标志行可以是标志域中状态为无效态的任意S个标志行,也可以是标志域中状态为非无效态(如M态、E态、S态)的任意S个标志行,还可以既包括无效态的S个标志行又包括非无效态的标志行。对于M态的标志行,还需要将该标志行对应的缓存行内数据回写到内存,以维持高速缓存内数据的一致性。
对于组相连映射方式来说,数据域中S个标志行包括第二标志行,该第二标志行为数据域中S个标志行中任意一个标志行。cache将数据域中S个标志行对应的缓存行映射到标志域中S个标志行的一种实施方式可以是:cache将第二标志行对应的缓存行映射到标志域中该第二标志行所在的缓存组内的标志行。同理,该标志域中该第二标志行所在的缓存组内的标志行可以是状态为无效态的任意S个标志行,也可以是状态为非无效态(如M态、E态、S态)的个标志行。对于M态的标志行,还需要将该M态的标志行对应的缓存行内数据回写到内存,以维持高速缓存内数据的一致性。
可以理解,该第一阈值可以是1、4、6、10、16或其他数值等,本发明不作限定。第二阈值可以是0.1、0.2、0.25、0.4或其他数值,本发明不作限定。
本发明一实施例中,数据域中S个标志行由T个数据行划分;T个数据行为资源调整前数据域中的数据行。可以理解,cache可以根据映射关系表确定属于同一个或多个数据行的S个标志行,进而释放该S个标志行,并清除该映射关系表中S个标志行对应的存储单元中地址信息。具体可参阅上述图6A-6F所示的映射关系表的存储结构,本发明不再赘述。
本发明实施例中,cache接收处理器发送的携带主存地址的请求;读取高速缓存与内存的映射关系,比较主存地址与缓存行的标签字段,查看是否在命中请求的缓存行;在存在命中请求的缓存行时,访问命中的缓存行内的数据;或,在不存在命中请求的缓存行时,分配缓存行,读取内存中主存地址对应的数据到分配的缓存行,访问分配的缓存行中数据;其中,cache可实现数据去重,包括数据域和标志域,且数据域中包括Q个标志行,该Q 个标志行由数据域中P个空闲数据行划分得到;高速缓存可实现数据去重,包括数据域和标志域,进而实现数据域中的P个空闲数据行复用为Q个标志行,进而增大cache的可访地址空间,增大cache的容量,提升数据处理效率。
下面介绍本发明实施例涉及的一种cache:
请参阅图9和图10,图9是本发明实施例提供的一种cache的结构示意图,图10是本发明实施例提供的一种缓存控制器的结构示意图。所述高速缓存90可实现数据去重,包括数据存储器91和缓存控制器92,所述数据存储器91包括数据域911和标志域912,
数据域911包括多个数据行以及划分的Q个标志行,标志域包括多个标志行,一个标志行可以对应到一个数据行形成一个缓存行。其中,多个标志行可以对应同一数据行,来实现缓存行的数据去重。
其中,所述缓存控制器92包括以下部分或全部单元:
划分单元921,用于在检测针对缓存行的数据去重操作且所述数据域中空闲数据行的数量满足第一条件的情况下,将所述数据域中P个空闲数据行划分出Q个标志行;所述数据域包括多个数据行,所述多个数据行包括所述P个空闲数据行;P、Q为正整数;
配置单元922,基于高速缓存与内存的映射方式,配置所述Q个标志行与内存中数据块的映射关系,以使所述数据域中的所述P个空闲数据行复用为所述Q个标志行。
在一种可能的实现方式中,所述配置单元922,具体用于:
基于高速缓存与内存的映射方式,通过映射关系表存储所述Q个标志行与内存中数据块的映射关系;
其中,所述映射关系表包括所述第一标志行的地址信息;所述地址信息包括缓存块号和块内编号;所述缓存块号用于指示所述第一标志行所属数据行在所述数据域中的地址,所述块内编号用于指示所述第一标志行在所述第一标志行所属数据行中的地址;所述第一标志行为所述Q个标志行中任意一个标志行。
在又一种可能的实现方式中,所述高速缓存与内存的映射方式为全相连映射;所述映射关系表的存储空间包括至少Q个存储单元;所述配置单元922通过映射关系表存储所述Q个标志行与内存中数据块的映射关系,具体包括:
将所述Q个标志行的地址信息分别写入所述Q个存储单元。
在又一种可能的实现方式中,所述高速缓存与内存的映射方式为N路组相连映射,所述高速缓存的缓存行划分为M组,M、N为正整数;所述映射关系表还包括:所述第一标志行与组号、组内块号的映射关系。
在又一种可能的实现方式中,所述映射关系表的存储空间包括Q个存储单元,所述Q个存储单元以M行R列的阵列排列,所述配置单元922通过映射关系表存储所述Q个标志行与内存中数据块的映射关系,具体包括:
在第i行第j列存储单元存储中写入所述Q个标志行中第k个标志行的地址信息;
所述第k个标志行的组号为i-1,所述第k个标志行的组内块号为N+j-1;
其中,R为Q/M的商,R为整数;k=(i-1)*M+j,i、j、k为正整数。
在又一种可能的实现方式中,一个空闲数据行被划分为D*M个标志行,D为正整数; 所述映射关系表的存储空间包括至少R个存储单元,所述R个存储单元以R行1列的阵列排列,所述存储单元包括M+1个存储子单元,R≥Q/M,R为正整数;所述配置单元922通过映射关系表存储所述Q个标志行与内存中数据块的映射关系,具体包括:
在第i行存储单元的第一个存储子单元中写入第k个标志行所属的数据行的缓存块号;以及,
在第i行存储单元的第j个存储子单元中写入所述Q个标志行中第k个标志行的块内编号;
所述第k个标志行的组内块号为N+i-1,所述第k个标志行的组号为j-2;
其中,i≤R,2≤j≤M+1,k=(i-1)*M+j,i、j、k为正整数。
在又一种可能的实现方式中,H个空闲数据行划分出M个标志行,H为正整数;所述映射关系表的存储空间包括至少R个存储单元,所述R个存储单元以R行1列的阵列排列;所述配置单元922通过映射关系表存储所述Q个标志行与内存中数据块的映射关系,具体包括:
第i个存储单元包括第k个标志行所属的数据行的缓存块号,以及通过所述第k个标志行在第(i-1)*M+1至i*M的M个标志行中的排序指示所述第k标志行的块内编号;
所述第k个标志行的组内块号为N+i-1,所述第k个标志行的组号为所述第k个标志行在第(i-1)*M+1至i*M的M个标志行中的排序;
其中,(i-1)*M+1≤k≤i*M,i、k为正整数;R≥Q/M,R为正整数。
在又一种可能的实现方式中,所述缓存控制器92还包括:
判断单元923,用于在所述数据域中空闲数据行的存储空间大于第一阈值时,则判断为所述数据域中空闲数据行的数量满足第一条件。
在又一种可能的实现方式中,所述配置所述Q个标志行与内存中数据块的映射关系之后,所述缓存控制器92还包括:
回写单元924,用于在所述高速缓存内空闲的数据行的数量小于第二阈值或所述高速缓存的未命中率大于第三阈值的情况下,将所述数据域中S个标志行对应的缓存行内的数据回写到所述内存;
第一恢复单元925,用于将所述S个标志行恢复为T个数据行,并清除所述S个标志行与所述内存中数据块的映射关系;
其中,所述Q个标志行包括所述S个标志行;S≤Q、T≤P,S、T为正整数。
在又一种可能的实现方式中,所述配置所述Q个标志行与内存中数据块的映射关系之后,所述缓存控制器还包括:
映射单元926,用户在所述高速缓存内空闲的数据行的数量小于第二阈值或所述高速缓存的未命中率大于第三阈值的情况下,将所述数据域中S个标志行对应的缓存行映射到标志域中S个标志行对应的缓存行;
第二恢复单元927,用于将所述S个标志行恢复为T个数据行,并清除所述S个标志行与所述内存中数据块的映射关系;
其中,所述Q个标志行包括所述S个标志行;S≤Q、T≤P,S、T为正整数。
在又一种可能的实现方式中,所述高速缓存与内存的映射方式为组相连映射,所述高 速缓存包括多个缓存组,所述映射单元926将所述数据域中S个标志行对应的缓存行映射到标志域中S个标志行对应的缓存行,具体包括:
将第二标志行对应的缓存行映射到所述标志域中所述第二标志行所在的缓存组内的标志行对应的缓存行;
所述第二标志行为所述数据域中S个标志行中任意一个标志行。
需要说明的是,映射关系表的存储空间可以位于数据存储器91内,为不同于数据域911和标志域912的存储域;也可以位于缓存控制器92内,此时缓存控制器92还可包括可用于存储映射关系表的存储器。
本发明实施例中,所述高速缓存可实现数据去重,包括数据域和标志域,cache在检测针对缓存行的数据去重操作且所述数据域中空闲数据行的数量满足第一条件的情况下,将所述数据域中P个空闲数据行划分出Q个标志行;并基于高速缓存与内存的映射方式,配置所述Q个标志行与内存中数据块的映射关系,以使所述数据域中的所述P个空闲数据行复用为所述Q个标志行,实现数据域复用为标志域,进而增大cache的可访地址空间,增大cache的容量,提升数据处理效率。
请参阅图11,图11是本发明实施例提供的另一种cache的结构示意图,所述高速缓存110可实现数据去重,包括数据存储器111和缓存控制器112,所述数据存储器111包括数据域1111和标志域1112,所述缓存控制器112包括:
接收单元1121,用于接收处理器发送的携带主存地址的请求;
命中判断单元1122,用于读取高速缓存与内存的映射关系,比较所述主存地址与缓存行的标签字段,查看是否在命中所述请求的缓存行;
第一响应单元1123,用于在存在命中所述请求的缓存行时,访问命中的缓存行内的数据;或者,第二响应单元1124,用于在不存在命中所述请求的缓存行时,分配缓存行,读取内存中所述主存地址对应的数据到分配的缓存行,访问所述分配的缓存行中数据;
其中,所述数据域中包括Q个标志行,所述Q个标志行由所述数据域中P个空闲数据行划分得到;所述高速缓存中缓存行与内存中数据块的映射关系包括所述Q个标志行与内存中数据块的映射关系。
在又一种可能的实现方式中,所述高速缓存与内存的映射方式为全相连映射;所述命中判断单元1122比较所述主存地址与缓存行的标签字段,查看是否存在命中所述请求的缓存行,具体包括:
比较所述主存地址的主存字块标记与所述高速缓存中所有的标志行的标签字段,查看是否存在与所述主存地址的主存字块标记相符合的标志行;所述高速缓存中所有的标志行包括所述数据域中Q个标志行;
所述与所述主存地址的主存字块标记相符合的标志行对应的缓存行为命中的缓存行;
其中,所述主存地址包括主存字块标记以及字块内地址;标志行的标签字段包括主存字块标记。
在又一种可能的实现方式中,所述高速缓存与内存的映射方式为组相连映射;所述高速缓存划分为多个缓存组,所述命中判断单元1122比较所述主存地址与缓存行的地址,查 看是否存在命中所述请求的缓存行,具体包括:
根据所述主存地址中组号确定缓存组;
比较所述主存地址的主存字块标记与确定的缓存组中所有的标志行的标签字段,查看是否存在与主存地址的主存字块标记相符合的标志行;
所述与主存地址的主存字块标记相符合的标志行对应的缓存行为命中的缓存行;
其中,所述主存地址包括主存字块标记、组号以及字块内地址;标志行的标签字段包括主存字块标记。
在又一种可能的实现方式中,所述高速缓存与内存的映射方式为组相连映射;所述缓存控制器112还包括:
查找单元1125,用于在所述命中判断单元根据所述主存地址中组号确定缓存组之后,所述比较所述主存地址的主存字块标记与所述缓存组中所有的标志行的标签字段之前,根据映射关系表查找所述数据域中与所述组号对应的标志行,所述数据域中与所述组号对应的标志行为所述缓存组内标志行;
其中,所述映射关系表用于存储所述Q个标志行与内存中数据块的映射关系,包括所述第一标志行的地址信息以及所述第一标志行对应的组号、组内块号;所述地址信息包括缓存块号和块内编号;所述缓存块号用于指示所述第一标志行所属数据行在所述数据域中的地址,所述块内编号用于指示所述第一标志行在所述第一标志行所属数据行中的地址;所述第一标志行为所述Q个标志行中任意一个标志行。
在又一种可能的实现方式中,所述高速缓存与内存的映射方式为N+R路组相连;所述查找单元1125具体用于:
根据所述映射关系表查找所述Q个标志行中与所述组号对应的R个标志行;所述R个标志行为所述缓存组内标志行;其中,R=Q/M,R为整数。
在又一种可能的实现方式中,所述缓存控制器112还包括:
回写单元1126,用于在所述高速缓存内空闲的数据行的数量小于第一阈值或所述高速缓存的未命中率大于第二阈值的情况下,将所述数据域中S个标志行对应的缓存行内的数据回写到所述内存;
第一恢复单元1127,用于将所述S个标志行恢复为T个数据行,并清除所述S个标志行与所述内存中数据块的映射关系;
其中,所述Q个标志行包括所述S个标志行;S≤Q、T≤P,S、T为正整数。
在又一种可能的实现方式中,所述缓存控制器还包括:
映射单元1128,用于在所述高速缓存内空闲的数据行的数量小于第一阈值或所述高速缓存的未命中率大于第二阈值的情况下,将所述数据域中S个标志行对应的缓存行映射到标志域中S个标志行对应的缓存行;
第二恢复单元1129,用于将所述S个标志行恢复为T个数据行,并清除所述S个标志行与所述内存中数据块的映射关系;
其中,所述Q个标志行包括所述S个标志行;S≤Q、T≤P,S、T为正整数。
在又一种可能的实现方式中,所述高速缓存与内存的映射方式为组相连映射,所述高速缓存包括多个缓存组,所述映射单元1128将所述数据域中S个标志行对应的缓存行映射 到标志域中S个标志行对应的缓存行,具体包括:
将第二标志行对应的缓存行映射到所述标志域中所述第二标志行所在的缓存组内的标志行对应的缓存行;
所述第二标志行为所述数据域中S个标志行中任意一个标志行。
需要说明的是,映射关系表的存储空间可以位于数据存储器111内,为不同于数据域1111和标志域1112的存储域;也可以位于缓存控制器112内,此时缓存控制器112还可包括可用于存储映射关系表的存储器。
本发明实施例中,cache接收处理器发送的携带主存地址的请求;读取高速缓存与内存的映射关系,比较主存地址与缓存行的标签字段,查看是否在命中请求的缓存行;在存在命中请求的缓存行时,访问命中的缓存行内的数据;或,在不存在命中请求的缓存行时,分配缓存行,读取内存中主存地址对应的数据到分配的缓存行,访问分配的缓存行中数据;其中,cache可实现数据去重,包括数据域和标志域,且数据域中包括Q个标志行,该Q个标志行由数据域中P个空闲数据行划分得到;高速缓存可实现数据去重,包括数据域和标志域,进而实现数据域中的P个空闲数据行复用为Q个标志行,进而增大cache的可访地址空间,增大cache的容量,提升数据处理效率。
以上所述,仅为本发明的具体实施方式,但本发明的保护范围并不局限于此,任何熟悉本技术领域的技术人员在本发明揭露的技术范围内,可轻易想到变化或替换,都应涵盖在本发明的保护范围之内。因此,本发明的保护范围应以所述权利要求的保护范围为准。

Claims (38)

  1. 一种高速缓存中资源调整方法,其特征在于,所述高速缓存可实现数据去重,包括数据域和标志域,所述方法包括:
    在检测针对缓存行的数据去重操作且所述数据域中空闲数据行的数量满足第一条件的情况下,将所述数据域中P个空闲数据行划分出Q个标志行;所述数据域包括多个数据行,所述多个数据行包括所述P个空闲数据行;P、Q为正整数;
    基于高速缓存与内存的映射方式,配置所述Q个标志行与内存中数据块的映射关系,以使所述数据域中的所述P个空闲数据行复用为所述Q个标志行。
  2. 根据权利要求1所述的方法,其特征在于,所述基于高速缓存与内存的映射方式,建立所述Q个标志行与内存中数据块的映射关系包括:
    基于高速缓存与内存的映射方式,通过映射关系表存储所述Q个标志行与内存中数据块的映射关系;
    其中,所述映射关系表包括所述第一标志行的地址信息;所述地址信息包括缓存块号和块内编号;所述缓存块号用于指示所述第一标志行所属数据行在所述数据域中的地址,所述块内编号用于指示所述第一标志行在所述第一标志行所属数据行中的地址;所述第一标志行为所述Q个标志行中任意一个标志行。
  3. 根据权利要求2所述的方法,其特征在于,所述高速缓存与内存的映射方式为全相连映射;所述映射关系表的存储空间包括至少Q个存储单元;所述通过映射关系表存储所述Q个标志行与内存中数据块的映射关系包括:
    将所述Q个标志行的地址信息分别写入所述Q个存储单元。
  4. 根据权利要求2所述的方法,其特征在于,所述高速缓存与内存的映射方式为N路组相连映射,所述高速缓存的缓存行划分为M组,M、N为正整数;所述映射关系表还包括:所述第一标志行与组号、组内块号的映射关系。
  5. 根据权利要求4所述的方法,其特征在于,所述映射关系表的存储空间包括Q个存储单元,所述Q个存储单元以M行R列的阵列排列,所述通过映射关系表存储所述Q个标志行与内存中数据块的映射关系包括:
    在第i行第j列存储单元存储中写入所述Q个标志行中第k个标志行的地址信息;
    所述第k个标志行的组号为i-1,所述第k个标志行的组内块号为N+j-1;
    其中,R为Q/M的商,R为整数;k=(i-1)*M+j,i、j、k为正整数。
  6. 根据权利要求4所述的方法,其特征在于,一个空闲数据行被划分为D*M个标志行,D为正整数;所述映射关系表的存储空间包括至少R个存储单元,所述R个存储单元以R行1列的阵列排列,所述存储单元包括M+1个存储子单元,R≥Q/M,R为正整数; 所述通过映射关系表存储所述Q个标志行与内存中数据块的映射关系包括:
    在第i行存储单元的第一个存储子单元中写入第k个标志行所属的数据行的缓存块号;以及,
    在第i行存储单元的第j个存储子单元中写入所述Q个标志行中第k个标志行的块内编号;
    所述第k个标志行的组内块号为N+i-1,所述第k个标志行的组号为j-2;
    其中,i≤R,2≤j≤M+1,k=(i-1)*M+j,i、j、k为正整数。
  7. 根据权利要求4所述的方法,其特征在于,H个空闲数据行划分出M个标志行,H为正整数;所述映射关系表的存储空间包括至少R个存储单元,所述R个存储单元以R行1列的阵列排列;所述通过映射关系表存储所述Q个标志行与内存中数据块的映射关系包括:
    第i个存储单元包括第k个标志行所属的数据行的缓存块号,以及通过所述第k个标志行在第(i-1)*M+1至i*M的M个标志行中的排序指示所述第k标志行的块内编号;
    所述第k个标志行的组内块号为N+i-1,所述第k个标志行的组号为所述第k个标志行在第(i-1)*M+1至i*M的M个标志行中的排序;
    其中,(i-1)*M+1≤k≤i*M,i、k为正整数;R≥Q/M,R为正整数。
  8. 根据权利要求1-7任意一项权利要求所述的方法,其特征在于,所述方法还包括:
    在所述数据域中空闲数据行的存储空间大于第一阈值时,则判断为所述数据域中空闲数据行的数量满足所述第一条件。
  9. 根据权利要求1-8任意一项权利要求所述的方法,其特征在于,所述建立所述Q个标志行与内存中数据块的映射关系之后,所述方法还包括:
    在所述高速缓存内空闲的数据行的数量小于第二阈值或所述高速缓存的未命中率大于第三阈值的情况下,将所述数据域中S个标志行对应的缓存行内的数据回写到所述内存;
    将所述S个标志行恢复为T个数据行,并清除所述S个标志行与所述内存中数据块的映射关系;
    其中,所述Q个标志行包括所述S个标志行;S≤Q、T≤P,S、T为正整数。
  10. 根据权利要求1-8任意一项权利要求所述的方法,其特征在于,所述建立所述Q个标志行与内存中数据块的映射关系之后,所述方法还包括:
    在所述高速缓存内空闲的数据行的数量小于第二阈值或所述高速缓存的未命中率大于第三阈值的情况下,将所述数据域中S个标志行对应的缓存行映射到标志域中S个标志行对应的缓存行;
    将所述S个标志行恢复为T个数据行,并清除所述S个标志行与所述内存中数据块的映射关系;
    其中,所述Q个标志行包括所述S个标志行;S≤Q、T≤P,S、T为正整数。
  11. 根据权利要求10所述的方法,其特征在于,所述高速缓存与内存的映射方式为组相连映射,所述高速缓存包括多个缓存组,所述将所述数据域中S个标志行对应的缓存行映射到标志域中S个标志行对应的缓存行包括:
    将第二标志行对应的缓存行映射到所述标志域中所述第二标志行所在的缓存组内的标志行对应的缓存行;
    所述第二标志行为所述数据域中S个标志行中任意一个标志行。
  12. 一种高速缓存中数据访问方法,其特征在于,所述方法包括:
    接收处理器发送的携带主存地址的请求;
    读取高速缓存与内存的映射关系,比较所述主存地址与缓存行的标签字段,查看是否在命中所述请求的缓存行;
    在存在命中所述请求的缓存行时,访问命中的缓存行内的数据;或者,在不存在命中所述请求的缓存行时,分配缓存行,读取内存中所述主存地址对应的数据到分配的缓存行,访问所述分配的缓存行中数据;
    其中,所述高速缓存可实现数据去重,包括数据域和标志域;所述数据域中包括Q个标志行,所述Q个标志行由所述数据域中P个空闲数据行划分得到;所述高速缓存中缓存行与内存中数据块的映射关系包括所述Q个标志行与内存中数据块的映射关系。
  13. 根据权利要求12所述的方法,其特征在于,所述高速缓存与内存的映射方式为全相连映射;所述比较所述主存地址与缓存行的标签字段,查看是否存在命中所述请求的缓存行包括:
    比较所述主存地址的主存字块标记与所述高速缓存中所有的标志行的标签字段,查看是否存在与所述主存地址的主存字块标记相符合的标志行;所述高速缓存中所有的标志行包括所述数据域中Q个标志行;
    所述与所述主存地址的主存字块标记相符合的标志行对应的缓存行为命中的缓存行;
    其中,所述主存地址包括主存字块标记以及字块内地址;标志行的标签字段包括主存字块标记。
  14. 根据权利要求12所述的方法,其特征在于,所述高速缓存与内存的映射方式为组相连映射;所述高速缓存划分为多个缓存组,所述比较所述主存地址与缓存行的地址,查看是否存在命中所述请求的缓存行包括:
    根据所述主存地址中组号确定缓存组;
    比较所述主存地址的主存字块标记与确定的缓存组中所有的标志行的标签字段,查看是否存在与主存地址的主存字块标记相符合的标志行;
    所述与主存地址的主存字块标记相符合的标志行对应的缓存行为命中的缓存行;
    其中,所述主存地址包括主存字块标记、组号以及字块内地址;标志行的标签字段包括主存字块标记。
  15. 根据权利要求14所述的方法,其特征在于,所述高速缓存与内存的映射方式为组相连映射;所述根据所述主存地址中组号确定缓存组之后,所述比较所述主存地址的主存字块标记与所述缓存组中所有的标志行的标签字段之前,所述方法还包括:
    根据映射关系表查找所述数据域中与所述组号对应的标志行,所述数据域中与所述组号对应的标志行为所述缓存组内标志行;
    其中,所述映射关系表用于存储所述Q个标志行与内存中数据块的映射关系,包括所述第一标志行的地址信息以及所述第一标志行对应的组号、组内块号;所述地址信息包括缓存块号和块内编号;所述缓存块号用于指示所述第一标志行所属数据行在所述数据域中的地址,所述块内编号用于指示所述第一标志行在所述第一标志行所属数据行中的地址;所述第一标志行为所述Q个标志行中任意一个标志行。
  16. 根据权利要求15所述的方法,其特征在于,所述高速缓存与内存的映射方式为N+R路组相连;所述根据映射关系表查找所述数据域中与所述组号对应的标志行,所述数据域中与所述组号对应的标志行为所述缓存组内标志行包括:
    根据所述映射关系表查找所述Q个标志行中与所述组号对应的R个标志行;所述R个标志行为所述缓存组内标志行;其中,R=Q/M,R为整数。
  17. 根据权利要求12-16任意一项权利要求所述的方法,其特征在于,所述方法还包括:
    在所述高速缓存内空闲的数据行的数量小于第一阈值或所述高速缓存的未命中率大于第二阈值的情况下,将所述数据域中S个标志行对应的缓存行内的数据回写到所述内存;
    将所述S个标志行恢复为T个数据行,并清除所述S个标志行与所述内存中数据块的映射关系;
    其中,所述Q个标志行包括所述S个标志行;S≤Q、T≤P,S、T为正整数。
  18. 根据权利要求12-16任意一项权利要求所述的方法,其特征在于,所述方法还包括:
    在所述高速缓存内空闲的数据行的数量小于第一阈值或所述高速缓存的未命中率大于第二阈值的情况下,将所述数据域中S个标志行对应的缓存行映射到标志域中S个标志行对应的缓存行;
    将所述S个标志行恢复为T个数据行,并清除所述S个标志行与所述内存中数据块的映射关系;
    其中,所述Q个标志行包括所述S个标志行;S≤Q、T≤P,S、T为正整数。
  19. 根据权利要求18所述的方法,其特征在于,所述高速缓存与内存的映射方式为组相连映射,所述高速缓存包括多个缓存组,所述将所述数据域中S个标志行对应的缓存行映射到标志域中S个标志行对应的缓存行包括:
    将第二标志行对应的缓存行映射到所述标志域中所述第二标志行所在的缓存组内的标志行对应的缓存行;
    所述第二标志行为所述数据域中S个标志行中任意一个标志行。
  20. 一种高速缓存,其特征在于,所述高速缓存可实现数据去重,包括数据存储器和缓存控制器,所述数据存储器包括数据域和标志域,所述缓存控制器包括:
    划分单元,用于在检测针对缓存行的数据去重操作且所述数据域中空闲数据行的数量满足第一条件的情况下,将所述数据域中P个空闲数据行划分出Q个标志行;所述数据域包括多个数据行,所述多个数据行包括所述P个空闲数据行;P、Q为正整数;
    配置单元,基于高速缓存与内存的映射方式,配置所述Q个标志行与内存中数据块的映射关系,以使所述数据域中的所述P个空闲数据行复用为所述Q个标志行。
  21. 根据权利要求20所述的高速缓存,其特征在于,所述配置单元,具体用于:
    基于高速缓存与内存的映射方式,通过映射关系表存储所述Q个标志行与内存中数据块的映射关系;
    其中,所述映射关系表包括所述第一标志行的地址信息;所述地址信息包括缓存块号和块内编号;所述缓存块号用于指示所述第一标志行所属数据行在所述数据域中的地址,所述块内编号用于指示所述第一标志行在所述第一标志行所属数据行中的地址;所述第一标志行为所述Q个标志行中任意一个标志行。
  22. 根据权利要求21所述的高速缓存,其特征在于,所述高速缓存与内存的映射方式为全相连映射;所述映射关系表的存储空间包括至少Q个存储单元;所述配置单元通过映射关系表存储所述Q个标志行与内存中数据块的映射关系,具体包括:
    将所述Q个标志行的地址信息分别写入所述Q个存储单元。
  23. 根据权利要求21所述的高速缓存,其特征在于,所述高速缓存与内存的映射方式为N路组相连映射,所述高速缓存的缓存行划分为M组,M、N为正整数;所述映射关系表还包括:所述第一标志行与组号、组内块号的映射关系。
  24. 根据权利要求23所述的高速缓存,其特征在于,所述映射关系表的存储空间包括Q个存储单元,所述Q个存储单元以M行R列的阵列排列,所述配置单元通过映射关系表存储所述Q个标志行与内存中数据块的映射关系,具体包括:
    在第i行第j列存储单元存储中写入所述Q个标志行中第k个标志行的地址信息;
    所述第k个标志行的组号为i-1,所述第k个标志行的组内块号为N+j-1;
    其中,R为Q/M的商,R为整数;k=(i-1)*M+j,i、j、k为正整数。
  25. 根据权利要求23所述的高速缓存,其特征在于,一个空闲数据行被划分为D*M个标志行,D为正整数;所述映射关系表的存储空间包括至少R个存储单元,所述R个存 储单元以R行1列的阵列排列,所述存储单元包括M+1个存储子单元,R≥Q/M,R为正整数;所述配置单元通过映射关系表存储所述Q个标志行与内存中数据块的映射关系,具体包括:
    在第i行存储单元的第一个存储子单元中写入第k个标志行所属的数据行的缓存块号;以及,
    在第i行存储单元的第j个存储子单元中写入所述Q个标志行中第k个标志行的块内编号;
    所述第k个标志行的组内块号为N+i-1,所述第k个标志行的组号为j-2;
    其中,i≤R,2≤j≤M+1,k=(i-1)*M+j,i、j、k为正整数。
  26. 根据权利要求23所述的高速缓存,其特征在于,H个空闲数据行划分出M个标志行,H为正整数;所述映射关系表的存储空间包括至少R个存储单元,所述R个存储单元以R行1列的阵列排列;所述配置单元通过映射关系表存储所述Q个标志行与内存中数据块的映射关系,具体包括:
    第i个存储单元包括第k个标志行所属的数据行的缓存块号,以及通过所述第k个标志行在第(i-1)*M+1至i*M的M个标志行中的排序指示所述第k标志行的块内编号;
    所述第k个标志行的组内块号为N+i-1,所述第k个标志行的组号为所述第k个标志行在第(i-1)*M+1至i*M的M个标志行中的排序;
    其中,(i-1)*M+1≤k≤i*M,i、k为正整数;R≥Q/M,R为正整数。
  27. 根据权利要求20-26任意一项权利要求所述的高速缓存,其特征在于,所述缓存控制器还包括:
    判断单元,用于在所述数据域中空闲数据行的存储空间大于第一阈值时,则判断为所述数据域中空闲数据行的数量满足第一条件。
  28. 根据权利要求20-27任意一项权利要求所述的高速缓存,其特征在于,所述配置所述Q个标志行与内存中数据块的映射关系之后,所述缓存控制器还包括:
    回写单元,用于在所述高速缓存内空闲的数据行的数量小于第二阈值或所述高速缓存的未命中率大于第三阈值的情况下,将所述数据域中S个标志行对应的缓存行内的数据回写到所述内存;
    第一恢复单元,用于将所述S个标志行恢复为T个数据行,并清除所述S个标志行与所述内存中数据块的映射关系;
    其中,所述Q个标志行包括所述S个标志行;S≤Q、T≤P,S、T为正整数。
  29. 根据权利要求20-27任意一项权利要求所述的高速缓存,其特征在于,所述配置所述Q个标志行与内存中数据块的映射关系之后,所述缓存控制器还包括:
    映射单元,用户在所述高速缓存内空闲的数据行的数量小于第二阈值或所述高速缓存的未命中率大于第三阈值的情况下,将所述数据域中S个标志行对应的缓存行映射到标志 域中S个标志行对应的缓存行;
    第二恢复单元,用于将所述S个标志行恢复为T个数据行,并清除所述S个标志行与所述内存中数据块的映射关系;
    其中,所述Q个标志行包括所述S个标志行;S≤Q、T≤P,S、T为正整数。
  30. 根据权利要求29所述的高速缓存,其特征在于,所述高速缓存与内存的映射方式为组相连映射,所述高速缓存包括多个缓存组,所述映射单元将所述数据域中S个标志行对应的缓存行映射到标志域中S个标志行对应的缓存行,具体包括:
    将第二标志行对应的缓存行映射到所述标志域中所述第二标志行所在的缓存组内的标志行对应的缓存行;
    所述第二标志行为所述数据域中S个标志行中任意一个标志行。
  31. 一种高速缓存,其特征在于,所述高速缓存可实现数据去重,包括数据存储器和缓存控制器,所述数据存储器包括数据域和标志域,所述缓存控制器包括:
    接收单元,用于接收处理器发送的携带主存地址的请求;
    命中判断单元,用于读取高速缓存与内存的映射关系,比较所述主存地址与缓存行的标签字段,查看是否在命中所述请求的缓存行;
    第一响应单元,用于在存在命中所述请求的缓存行时,访问命中的缓存行内的数据;或者,第二响应单元,用于在不存在命中所述请求的缓存行时,分配缓存行,读取内存中所述主存地址对应的数据到分配的缓存行,访问所述分配的缓存行中数据;
    其中,所述数据域中包括Q个标志行,所述Q个标志行由所述数据域中P个空闲数据行划分得到;所述高速缓存中缓存行与内存中数据块的映射关系包括所述Q个标志行与内存中数据块的映射关系。
  32. 根据权利要求31所述的高速缓存,其特征在于,所述高速缓存与内存的映射方式为全相连映射;所述命中判断单元比较所述主存地址与缓存行的标签字段,查看是否存在命中所述请求的缓存行,具体包括:
    比较所述主存地址的主存字块标记与所述高速缓存中所有的标志行的标签字段,查看是否存在与所述主存地址的主存字块标记相符合的标志行;所述高速缓存中所有的标志行包括所述数据域中Q个标志行;
    所述与所述主存地址的主存字块标记相符合的标志行对应的缓存行为命中的缓存行;
    其中,所述主存地址包括主存字块标记以及字块内地址;标志行的标签字段包括主存字块标记。
  33. 根据权利要求31所述的高速缓存,其特征在于,所述高速缓存与内存的映射方式为组相连映射;所述高速缓存划分为多个缓存组,所述命中判断单元比较所述主存地址与缓存行的地址,查看是否存在命中所述请求的缓存行,具体包括:
    根据所述主存地址中组号确定缓存组;
    比较所述主存地址的主存字块标记与确定的缓存组中所有的标志行的标签字段,查看是否存在与主存地址的主存字块标记相符合的标志行;
    所述与主存地址的主存字块标记相符合的标志行对应的缓存行为命中的缓存行;
    其中,所述主存地址包括主存字块标记、组号以及字块内地址;标志行的标签字段包括主存字块标记。
  34. 根据权利要求33所述的高速缓存,其特征在于,所述高速缓存与内存的映射方式为组相连映射;所述缓存控制器还包括:
    查找单元,用于在所述命中判断单元根据所述主存地址中组号确定缓存组之后,所述比较所述主存地址的主存字块标记与所述缓存组中所有的标志行的标签字段之前,根据映射关系表查找所述数据域中与所述组号对应的标志行,所述数据域中与所述组号对应的标志行为所述缓存组内标志行;
    其中,所述映射关系表用于存储所述Q个标志行与内存中数据块的映射关系,包括所述第一标志行的地址信息以及所述第一标志行对应的组号、组内块号;所述地址信息包括缓存块号和块内编号;所述缓存块号用于指示所述第一标志行所属数据行在所述数据域中的地址,所述块内编号用于指示所述第一标志行在所述第一标志行所属数据行中的地址;所述第一标志行为所述Q个标志行中任意一个标志行。
  35. 根据权利要求34所述的高速缓存,其特征在于,所述高速缓存与内存的映射方式为N+R路组相连;所述查找单元具体用于:
    根据所述映射关系表查找所述Q个标志行中与所述组号对应的R个标志行;所述R个标志行为所述缓存组内标志行;其中,R=Q/M,R为整数。
  36. 根据权利要求31-35任意一项权利要求所述的高速缓存,其特征在于,所述缓存控制器还包括:
    回写单元,用于在所述高速缓存内空闲的数据行的数量小于第一阈值或所述高速缓存的未命中率大于第二阈值的情况下,将所述数据域中S个标志行对应的缓存行内的数据回写到所述内存;
    第一恢复单元,用于将所述S个标志行恢复为T个数据行,并清除所述S个标志行与所述内存中数据块的映射关系;
    其中,所述Q个标志行包括所述S个标志行;S≤Q、T≤P,S、T为正整数。
  37. 根据权利要求31-36任意一项权利要求所述的高速缓存,其特征在于,所述缓存控制器还包括:
    映射单元,用于在所述高速缓存内空闲的数据行的数量小于第一阈值或所述高速缓存的未命中率大于第二阈值的情况下,将所述数据域中S个标志行对应的缓存行映射到标志域中S个标志行对应的缓存行;
    第二恢复单元,用于将所述S个标志行恢复为T个数据行,并清除所述S个标志行与 所述内存中数据块的映射关系;
    其中,所述Q个标志行包括所述S个标志行;S≤Q、T≤P,S、T为正整数。
  38. 根据权利要求37所述的高速缓存,其特征在于,所述高速缓存与内存的映射方式为组相连映射,所述高速缓存包括多个缓存组,所述映射单元将所述数据域中S个标志行对应的缓存行映射到标志域中S个标志行对应的缓存行,具体包括:
    将第二标志行对应的缓存行映射到所述标志域中所述第二标志行所在的缓存组内的标志行对应的缓存行;
    所述第二标志行为所述数据域中S个标志行中任意一个标志行。
PCT/CN2017/119013 2017-12-27 2017-12-27 高速缓存中资源调整方法、数据访问方法及装置 WO2019127104A1 (zh)

Priority Applications (2)

Application Number Priority Date Filing Date Title
PCT/CN2017/119013 WO2019127104A1 (zh) 2017-12-27 2017-12-27 高速缓存中资源调整方法、数据访问方法及装置
CN201780097989.4A CN111602377B (zh) 2017-12-27 2017-12-27 高速缓存中资源调整方法、数据访问方法及装置

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
PCT/CN2017/119013 WO2019127104A1 (zh) 2017-12-27 2017-12-27 高速缓存中资源调整方法、数据访问方法及装置

Publications (1)

Publication Number Publication Date
WO2019127104A1 true WO2019127104A1 (zh) 2019-07-04

Family

ID=67064289

Family Applications (1)

Application Number Title Priority Date Filing Date
PCT/CN2017/119013 WO2019127104A1 (zh) 2017-12-27 2017-12-27 高速缓存中资源调整方法、数据访问方法及装置

Country Status (2)

Country Link
CN (1) CN111602377B (zh)
WO (1) WO2019127104A1 (zh)

Cited By (7)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN111241009A (zh) * 2019-12-31 2020-06-05 西安翔腾微电子科技有限公司 一种数据反馈方法及装置
CN112579481A (zh) * 2020-12-07 2021-03-30 海光信息技术股份有限公司 数据处理方法、数据处理装置和计算装置
CN112948437A (zh) * 2021-03-03 2021-06-11 苏州合数科技有限公司 一种大数据高并发下全域频控系统及方法
CN113297211A (zh) * 2021-03-03 2021-08-24 苏州合数科技有限公司 一种大数据高并发下人群画像存储及定向系统及方法
CN113778912A (zh) * 2021-08-25 2021-12-10 深圳市中科蓝讯科技股份有限公司 cache映射架构动态调整方法及cache控制器
CN113791989A (zh) * 2021-09-15 2021-12-14 深圳市中科蓝讯科技股份有限公司 基于cache的缓存数据处理方法、存储介质及芯片
WO2023066124A1 (zh) * 2021-10-18 2023-04-27 上海壁仞智能科技有限公司 缓存管理方法、缓存管理装置、处理器

Families Citing this family (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN112037119A (zh) * 2020-09-09 2020-12-04 绍兴埃瓦科技有限公司 一种基于高速缓冲存储器结构的图像处理方法及系统
CN115794675B (zh) * 2023-01-19 2023-05-16 北京象帝先计算技术有限公司 写数据方法、装置、图形处理系统、电子组件及电子设备
CN117453423B (zh) * 2023-12-25 2024-04-19 北京趋动智能科技有限公司 Gpu显存管理方法和系统,存储介质和电子设备

Citations (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US20080133843A1 (en) * 2006-11-30 2008-06-05 Ruchi Wadhawan Cache Used Both as Cache and Staging Buffer
US20130246696A1 (en) * 2012-03-16 2013-09-19 Infineon Technologies Ag System and Method for Implementing a Low-Cost CPU Cache Using a Single SRAM
CN104050098A (zh) * 2013-03-13 2014-09-17 国际商业机器公司 优化的数据去重复的动态高速缓存模块选择的方法和系统
CN105144121A (zh) * 2013-03-14 2015-12-09 微软技术许可有限责任公司 高速缓存内容可寻址数据块以供存储虚拟化

Family Cites Families (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN1499382A (zh) * 2002-11-05 2004-05-26 华为技术有限公司 廉价冗余磁盘阵列系统中高效高速缓存的实现方法
CN103150269B (zh) * 2011-12-06 2017-07-14 广东新岸线计算机系统芯片有限公司 一种数据缓存控制方法和系统
CN104346404B (zh) * 2013-08-08 2018-05-18 华为技术有限公司 一种访问数据的方法、设备及系统
CN107291630B (zh) * 2016-03-30 2020-08-25 华为技术有限公司 一种高速缓冲存储器处理方法及装置
CN106227676B (zh) * 2016-09-22 2019-04-19 大唐微电子技术有限公司 一种高速缓存以及从高速缓存中读取数据的方法和装置

Patent Citations (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US20080133843A1 (en) * 2006-11-30 2008-06-05 Ruchi Wadhawan Cache Used Both as Cache and Staging Buffer
US20130246696A1 (en) * 2012-03-16 2013-09-19 Infineon Technologies Ag System and Method for Implementing a Low-Cost CPU Cache Using a Single SRAM
CN104050098A (zh) * 2013-03-13 2014-09-17 国际商业机器公司 优化的数据去重复的动态高速缓存模块选择的方法和系统
CN105144121A (zh) * 2013-03-14 2015-12-09 微软技术许可有限责任公司 高速缓存内容可寻址数据块以供存储虚拟化

Cited By (13)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN111241009B (zh) * 2019-12-31 2023-05-16 西安翔腾微电子科技有限公司 一种数据反馈方法及装置
CN111241009A (zh) * 2019-12-31 2020-06-05 西安翔腾微电子科技有限公司 一种数据反馈方法及装置
CN112579481B (zh) * 2020-12-07 2023-01-20 海光信息技术股份有限公司 数据处理方法、数据处理装置和计算装置
CN112579481A (zh) * 2020-12-07 2021-03-30 海光信息技术股份有限公司 数据处理方法、数据处理装置和计算装置
CN113297211A (zh) * 2021-03-03 2021-08-24 苏州合数科技有限公司 一种大数据高并发下人群画像存储及定向系统及方法
CN112948437A (zh) * 2021-03-03 2021-06-11 苏州合数科技有限公司 一种大数据高并发下全域频控系统及方法
CN112948437B (zh) * 2021-03-03 2023-12-19 苏州合数科技有限公司 一种大数据高并发下全域频控系统及方法
CN113297211B (zh) * 2021-03-03 2023-12-22 苏州合数科技有限公司 一种大数据高并发下人群画像存储及定向系统及方法
CN113778912A (zh) * 2021-08-25 2021-12-10 深圳市中科蓝讯科技股份有限公司 cache映射架构动态调整方法及cache控制器
CN113778912B (zh) * 2021-08-25 2024-05-07 深圳市中科蓝讯科技股份有限公司 cache映射架构动态调整方法及cache控制器
CN113791989A (zh) * 2021-09-15 2021-12-14 深圳市中科蓝讯科技股份有限公司 基于cache的缓存数据处理方法、存储介质及芯片
CN113791989B (zh) * 2021-09-15 2023-07-14 深圳市中科蓝讯科技股份有限公司 基于cache的缓存数据处理方法、存储介质及芯片
WO2023066124A1 (zh) * 2021-10-18 2023-04-27 上海壁仞智能科技有限公司 缓存管理方法、缓存管理装置、处理器

Also Published As

Publication number Publication date
CN111602377A (zh) 2020-08-28
CN111602377B (zh) 2021-12-24

Similar Documents

Publication Publication Date Title
WO2019127104A1 (zh) 高速缓存中资源调整方法、数据访问方法及装置
KR102190403B1 (ko) 물리적 메모리 크기보다 큰 메모리 용량을 가능하게 하기 위한 방법 및 장치
US9639278B2 (en) Set-associative hash table organization for efficient storage and retrieval of data in a storage system
US10169232B2 (en) Associative and atomic write-back caching system and method for storage subsystem
Debnath et al. BloomFlash: Bloom filter on flash-based storage
JP6928123B2 (ja) メモリシステム内のページマイグレーションのオーバヘッドを低減するメカニズム
US20170212845A1 (en) Region migration cache
JP6356675B2 (ja) 集約/グループ化動作:ハッシュテーブル法のハードウェア実装
US7552286B2 (en) Performance of a cache by detecting cache lines that have been reused
CN1940892A (zh) 逐出高速缓存的行的电路布置、数据处理系统和方法
US10223005B2 (en) Performing multiple write operations to a memory using a pending write queue/cache
US10678704B2 (en) Method and apparatus for enabling larger memory capacity than physical memory size
WO2019128958A1 (zh) 缓存替换技术
US20160291881A1 (en) Method and apparatus for improving disk array performance
US20120054427A1 (en) Increasing data access performance
US11151039B2 (en) Apparatus and method for maintaining cache coherence data for memory blocks of different size granularities using a snoop filter storage comprising an n-way set associative storage structure
US10528284B2 (en) Method and apparatus for enabling larger memory capacity than physical memory size
US7606994B1 (en) Cache memory system including a partially hashed index
WO2021008552A1 (zh) 数据读取方法和装置、计算机可读存储介质
KR101976320B1 (ko) 라스트 레벨 캐시 메모리 및 이의 데이터 관리 방법
US10942860B2 (en) Computing system and method using bit counter
US20220405253A1 (en) Mechanism for managing a migration of data with mapped page and dirty page bitmap sections
Park et al. Design of a High-Performance, High-Endurance Key-Value SSD for Large-Key Workloads
KR20230147545A (ko) 연산 스토리지 장치를 이용한 교차 계층 키-값 저장소를 위한 시스템들 및 방법들
WO2019052442A1 (zh) 一种内容填充方法和存储器

Legal Events

Date Code Title Description
121 Ep: the epo has been informed by wipo that ep was designated in this application

Ref document number: 17936202

Country of ref document: EP

Kind code of ref document: A1

NENP Non-entry into the national phase

Ref country code: DE

122 Ep: pct application non-entry in european phase

Ref document number: 17936202

Country of ref document: EP

Kind code of ref document: A1