CN104346404A - Method, equipment and system for accessing data - Google Patents

Method, equipment and system for accessing data Download PDF

Info

Publication number
CN104346404A
CN104346404A CN201310344166.0A CN201310344166A CN104346404A CN 104346404 A CN104346404 A CN 104346404A CN 201310344166 A CN201310344166 A CN 201310344166A CN 104346404 A CN104346404 A CN 104346404A
Authority
CN
China
Prior art keywords
data
domain
group
tag
accessed
Prior art date
Legal status (The legal status 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 status listed.)
Granted
Application number
CN201310344166.0A
Other languages
Chinese (zh)
Other versions
CN104346404B (en
Inventor
黄永兵
陈明宇
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Huawei Technologies Co Ltd
Institute of Computing Technology of CAS
Original Assignee
Huawei Technologies Co Ltd
Institute of Computing Technology of CAS
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 Huawei Technologies Co Ltd, Institute of Computing Technology of CAS filed Critical Huawei Technologies Co Ltd
Priority to CN201310344166.0A priority Critical patent/CN104346404B/en
Publication of CN104346404A publication Critical patent/CN104346404A/en
Application granted granted Critical
Publication of CN104346404B publication Critical patent/CN104346404B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

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
    • G06F12/0802Addressing of a memory level in which the access to the desired data or data block requires associative addressing means, e.g. caches
    • G06F12/0875Addressing of a memory level in which the access to the desired data or data block requires associative addressing means, e.g. caches with dedicated cache, e.g. instruction or stack
    • 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
    • G06F12/0802Addressing of a memory level in which the access to the desired data or data block requires associative addressing means, e.g. caches
    • G06F12/0804Addressing of a memory level in which the access to the desired data or data block requires associative addressing means, e.g. caches with main memory updating
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F2212/00Indexing scheme relating to accessing, addressing or allocation within memory systems or architectures
    • G06F2212/20Employing a main memory using a specific memory technology
    • G06F2212/202Non-volatile memory
    • G06F2212/2022Flash memory

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)
  • Information Retrieval, Db Structures And Fs Structures Therefor (AREA)

Abstract

The embodiment of the invention discloses a method, equipment and system for accessing data, relates to the field of communication, and aims to achieve the purpose that the attribute of a label field in a cache memory is expanded, and then the label field can correspond to the data field of the group and also can correspond to the data field of other groups, so that the utilization rate of the data field in the cache memory can be increased. The method provided by the embodiment of the invention comprises the following steps: receiving to-be-accessed data accessing request information sent by a processor, wherein the request information includes the physical address information of to-be-accessed data; acquiring the label field corresponding to the physical address information of the to-be-accessed data according to the physical address information of the to-be-accessed data; acquiring the data field corresponding to the label field according to group identification information, and intra-group data field offset information in label field information corresponding to the physical address information.

Description

Method, equipment and system for accessing data
Technical Field
The present invention relates to the field of communications, and in particular, to a method, device, and system for accessing data.
Background
Cache memory (cache) is a key component that improves the performance of memory systems in processors. The organization of cache memories is generally divided into three categories, direct associative, set associative, and fully associative. In the existing cache memory design of a processor, a set associative implementation method is generally adopted, as shown in fig. 1, which is a schematic diagram of a structure of an N-way (wav) set associative cache memory, where the set associative cache memory includes a plurality of sets (sets), each set includes a plurality of cache memory lines, each cache memory includes a tag field and a data field corresponding to the tag field, one data field includes two attributes, i.e., a tag bit and a valid bit, a physical address corresponding to each access data request can uniquely determine a set, and in the set, the physical address can be mapped to any one of the cache memory lines.
In the prior art, the tag field and the data field are in a fixed one-to-one correspondence and are stored separately, when a processor accesses a cache memory, if none of the cache memory lines in a set in the cache memory corresponds to an access request of the processor, the access request is mapped to different sets of different ways at the same time, an item that is actually replaced is selected according to the utilization rate of the cache memory lines in the different sets, and then the access request is allocated to a cache memory line with a low utilization rate. For example, as shown in fig. 2, in the 3-way cache, the request Y is mapped to a of way 0, D of way 1 and M of way 2 by 3 different hash algorithms H0, H1 and H2 respectively, A, D, M each represents a cache line in the cache and the tag bits in the tag field respectively corresponding to each of A, D, M are equal, at the time of replacement, Y can select A, D, M to replace any one of them, and A, D, M can map to other groups in the same way, for example, a can map to V of way 1 and X of way 2, if a is the replaced item of Y, the utilization rate of a and the utilization rates of V and X can be compared, and if the utilization rate of a is high and the utilization rate of V is lowest, a can be stored at the position of V, and V is the replaced item. Looping through this, the cache line replacement with the lowest utilization of the set can be found from the entire cache.
The inventor finds that at least the following problems exist in the prior art: because the tag field and the data field in the cache are in a fixed one-to-one correspondence and are stored separately, the utilization rate of the data field in the cache is low.
Disclosure of Invention
Embodiments of the present invention provide a method, an apparatus, and a system for accessing data, which extend attributes of a tag field in a cache memory, so that the tag field may correspond to a data field of a current group or to data fields of other groups, thereby improving a utilization rate of the data field in the cache memory.
In order to achieve the above purpose, the embodiment of the invention adopts the technical proposal that,
in a first aspect, a method for accessing data is provided, including:
receiving request information for accessing to-be-accessed data sent by a processor, wherein the request information comprises physical address information of the to-be-accessed data;
acquiring a label domain corresponding to the physical address information of the data to be accessed according to the physical address information of the data to be accessed;
acquiring a data domain corresponding to the tag domain according to the group identification information and the offset information of the data domain in the group in the tag domain information corresponding to the physical address information, wherein each group comprises N tag fields and M data fields, the tag fields correspond to the data fields one to one, and the tag fields and the data fields corresponding to one are in the same group or different groups, n is a natural number greater than or equal to 1, M is a natural number greater than or equal to 1 and N is greater than M, each tag field information includes group identification information of the data field corresponding to the tag field, and intra-group data field offset information, the group identification information is used for indicating a group where the data domain corresponding to the tag domain is located, and the data offset information in the group is used for indicating an offset of the data domain in the group where the data domain is located.
In a first possible implementation manner, according to the first aspect, each of the tag field information further includes tag bit information, data field validity information, "isptr" information,
wherein the tag bit information is used to indicate a physical address corresponding to the data field corresponding to the tag field, the data field validity information is used to indicate whether the data field corresponding to the tag field is accessed by the processor or not accessed by the processor, and the 'isptr' information is used to indicate whether the data stored in the data field corresponding to the tag field originates from the group corresponding to the data to be accessed or originates from another group except the group corresponding to the data to be accessed,
accordingly, the method can be used for solving the problems that,
the acquiring the tag domain corresponding to the physical address information of the data to be accessed according to the physical address information of the data to be accessed includes:
acquiring a first group and tag bit information corresponding to the physical address information of the data to be accessed according to the physical address information of the data to be accessed;
if a tag domain with a valid state bit exists in a first group of a storage system according to the first group corresponding to the physical address information of the data to be accessed and if a tag domain with a valid state bit equal to the tag bit information corresponding to the physical address information of the data to be accessed exists in the tag domain with a valid state bit according to the tag bit information corresponding to the physical address information of the data to be accessed, a first tag domain with a valid state bit in the tag domain in the storage system is acquired, wherein the tag domain with the valid state bit contains a tag field which indicates that the data domain is accessed by the processor and indicates that the data stored in the data domain corresponding to the tag field is from the group corresponding to the data to be accessed.
In a second possible implementation manner, with reference to the first aspect, each of the tag field information further includes tag bit information, information on whether the data field is valid, "isptr" information,
wherein the tag bit information is used to indicate a physical address corresponding to the data field corresponding to the tag field, the data field validity information is used to indicate whether the data field corresponding to the tag field is accessed by the processor or not accessed by the processor, and the 'isptr' information is used to indicate whether the data stored in the data field corresponding to the tag field originates from the group corresponding to the data to be accessed or originates from another group except the group corresponding to the data to be accessed,
accordingly, the method can be used for solving the problems that,
the acquiring the tag domain corresponding to the physical address information of the data to be accessed according to the physical address information of the data to be accessed includes:
acquiring a first group and tag bit information corresponding to the physical address information of the data to be accessed according to the physical address information of the data to be accessed;
if a tag domain with an effective state bit does not exist in a first group in a storage system according to the first group corresponding to the physical address information of the data to be accessed, or if a tag domain with an effective state bit exists in the first group in the storage system according to the first group corresponding to the physical address information of the data to be accessed and if a tag domain with an effective state bit does not exist in the tag domain with an effective state bit in the first group according to the tag bit information corresponding to the physical address information of the data to be accessed, acquiring offset information of the group and the intra-group data domain which are allocated with the data to be accessed and allocating the offset information to the data to be accessed, wherein the tag domain with the effective state bit does not include a data domain which indicates that the data domain corresponding to the tag domain is not accessed by the processor and indicates that the data stored in the data domain corresponding to the tag domain is from the group corresponding to the data to be accessed Or, the data field corresponding to the tag field is indicated to be accessed by the processor and the data stored in the data field corresponding to the tag field is indicated to be derived from a group other than the group corresponding to the data to be accessed, or the data field corresponding to the tag field is indicated to be not accessed by the processor and the data stored in the data field corresponding to the tag field is indicated to be derived from a group other than the group corresponding to the data to be accessed.
In a third possible implementation manner, with reference to the second possible implementation manner, the acquiring and allocating the group of the data to be accessed and the offset information of the data domain in the group and allocating the offset information to the data to be accessed includes:
if the utilization rate corresponding to the first group is determined to be smaller than a first utilization rate threshold value according to the utilization rate corresponding to each group in the storage system, selecting the data domain with the lowest utilization rate in the data domains corresponding to each label domain in the first group according to the utilization rate of the data domain corresponding to each label domain in the first group;
and allocating the data domain with the lowest utilization rate in the data domains corresponding to the first group and each label domain in the first group to the data to be accessed.
In a fourth possible implementation manner, with reference to the second possible implementation manner, the acquiring and allocating the group of the data to be accessed and the offset information of the data domain in the group and allocating the offset information to the data to be accessed includes:
if the utilization rate corresponding to the first group is determined to be larger than or equal to the first utilization rate threshold value according to the utilization rate corresponding to each group in the storage system, selecting a second group with the lowest utilization rate in all the groups except the first group in the storage system;
selecting the data domain with the lowest utilization rate in the data domains respectively corresponding to each label domain in the second group according to the utilization rate of the data domain respectively corresponding to each label domain in the second group;
and allocating the data domain with the lowest utilization rate in the data domains corresponding to each label domain in the second group and the second group to the data to be accessed.
In a fifth possible implementation manner, with reference to the first aspect or the first possible implementation manner, each tag field further includes start address information and end address information of the data field corresponding to the tag field,
the start address information is used for indicating a start bit address of the data field corresponding to the tag field, the end address information is used for indicating an end bit address of the data field corresponding to the tag field,
the request information also contains granularity information of the data to be accessed,
accordingly, the method can be used for solving the problems that,
acquiring a data domain corresponding to the tag domain according to the group identification information and the in-group data domain offset information in the tag domain information corresponding to the physical address information, including:
reading a start bit address and an end bit address of a data field corresponding to the first tag field in the first tag field;
if all data corresponding to the data to be accessed are determined to be stored in the data domain corresponding to the first tag domain according to the physical address information of the data to be accessed and the granularity information of the data to be accessed, the position of the data domain corresponding to the first tag domain is obtained according to the group identification information in the first tag domain and the offset information of the data domain in the group;
and acquiring the data domain corresponding to the first label domain according to the position of the data domain corresponding to the first label domain.
In a sixth possible implementation manner, with reference to the first aspect or the first possible implementation manner, each tag field further includes start address information and end address information of the data field corresponding to the tag field,
the start address information is used for indicating a start bit address of the data field corresponding to the tag field, the end address information is used for indicating an end bit address of the data field corresponding to the tag field,
the request information also contains granularity information of the data to be accessed,
accordingly, the method can be used for solving the problems that,
acquiring a data domain corresponding to the tag domain according to the group identification information and the in-group data domain offset information in the tag domain information corresponding to the physical address information, including:
if all data corresponding to the data to be accessed are determined not to be stored in the data domain corresponding to the first tag domain according to the physical address information of the data to be accessed and the granularity information of the data to be accessed, acquiring a replaced data domain which allocates the data to be accessed and allocating the replaced data domain to the data to be accessed, wherein the replaced data domain comprises a data domain which has granularity larger than and closest to the granularity information of the request to be accessed and is corresponding to each tag domain in the first group and has different granularity.
In a seventh possible implementation manner, in combination with the sixth possible implementation manner,
the acquiring and allocating the replaced data field of the data to be accessed and the data to be accessed includes:
if the utilization rate of the replaced data domain in the first group is larger than or equal to a second utilization rate threshold and the utilization rates of a plurality of second data domains in all the data domains with different granularities except the replaced data domain in the first group are smaller than a second access threshold according to the utilization rates of the data domains with different granularities respectively corresponding to each label domain in the first group, merging the plurality of second data domains into the replaced data domain and distributing the replaced data domain to the data to be accessed, wherein the second data domain comprises the data domains with the granularity smaller than the granularity of the replaced data domain in all the data domains with different granularities except the replaced data domain in the first group;
or,
if the utilization rate of the replaced data domain in the first group is larger than or equal to the second utilization rate threshold and the utilization rate of a third data domain in all data domains with different granularities except the replaced data domain in the first group is smaller than the second access threshold according to the utilization rate of the data domain with different granularities corresponding to each label domain in the first group, splitting the third data domain into one or more replaced data domains and distributing the replaced data domains to the data to be accessed, wherein the third data domain comprises the data domain with the granularity larger than the granularity of the replaced data domain in all the data domains with different granularities except the replaced data domain in the first group;
or,
and if the utilization rate of the replaced data domain in the first group is determined to be smaller than the second utilization rate threshold value according to the utilization rate of the data domain with different granularity corresponding to each label domain in the first group, the replaced data domain is allocated to the data to be accessed.
In an eighth possible implementation manner, with reference to the first aspect, the first possible implementation manner, the second possible implementation manner, the third possible implementation manner, the fourth possible implementation manner, the fifth possible implementation manner, the sixth possible implementation manner, or the seventh possible implementation manner,
the method further comprises the following steps:
and updating the label domain corresponding to the data domain allocated to the data to be accessed.
In a second aspect, a cache memory is provided, comprising:
the device comprises a receiving unit, a processing unit and a processing unit, wherein the receiving unit is used for receiving request information for accessing data to be accessed, which is sent by a processor, and the request information comprises physical address information of the data to be accessed;
the acquisition unit is used for acquiring a label domain corresponding to the physical address information of the data to be accessed according to the physical address information of the data to be accessed; acquiring a data domain corresponding to the tag domain according to the group identification information and the offset information of the data domain in the group in the tag domain information corresponding to the physical address information, wherein each group comprises N tag fields and M data fields, the tag fields correspond to the data fields one to one, and the tag fields and the data fields corresponding to one are in the same group or different groups, n is a natural number greater than or equal to 1, M is a natural number greater than or equal to 1 and N is greater than M, each tag field information includes group identification information of the data field corresponding to the tag field, and intra-group data field offset information, the group identification information is used for indicating a group where the data domain corresponding to the tag domain is located, and the data offset information in the group is used for indicating an offset of the data domain in the group where the data domain is located.
In a first possible implementation manner, with reference to the second aspect, each of the tag field information further includes tag bit information, data field validity information, "isptr" information,
wherein the tag bit information is used to indicate a physical address corresponding to the data field corresponding to the tag field, the data field validity information is used to indicate whether the data field corresponding to the tag field is accessed by the processor or not accessed by the processor, and the 'isptr' information is used to indicate whether the data stored in the data field corresponding to the tag field originates from the group corresponding to the data to be accessed or originates from another group except the group corresponding to the data to be accessed,
accordingly, the method can be used for solving the problems that,
the acquisition unit is further configured to: acquiring a first group and tag bit information corresponding to the physical address information of the data to be accessed according to the physical address information of the data to be accessed;
if a tag domain with a valid state bit exists in a first group of a storage system according to the first group corresponding to the physical address information of the data to be accessed and if a tag domain with a valid state bit equal to the tag bit information corresponding to the physical address information of the data to be accessed exists in the tag domain with a valid state bit according to the tag bit information corresponding to the physical address information of the data to be accessed, a first tag domain with a valid state bit in the tag domain in the storage system is acquired, wherein the tag domain with the valid state bit contains a tag field which indicates that the data domain is accessed by the processor and indicates that the data stored in the data domain corresponding to the tag field is from the group corresponding to the data to be accessed.
In a second possible implementation manner, with reference to the second aspect, each of the tag field information further includes tag bit information, data field validity information, "isptr" information,
wherein the tag bit information is used to indicate a physical address corresponding to the data field corresponding to the tag field, the data field validity information is used to indicate whether the data field corresponding to the tag field is accessed by the processor or not accessed by the processor, and the 'isptr' information is used to indicate whether the data stored in the data field corresponding to the tag field originates from the group corresponding to the data to be accessed or originates from another group except the group corresponding to the data to be accessed,
accordingly, the method can be used for solving the problems that,
the acquisition unit is further configured to: acquiring a first group and tag bit information corresponding to the physical address information of the data to be accessed according to the physical address information of the data to be accessed;
if a tag domain with an effective state bit does not exist in a first group in a storage system according to the first group corresponding to the physical address information of the data to be accessed, or if a tag domain with an effective state bit exists in the first group in the storage system according to the first group corresponding to the physical address information of the data to be accessed and if a tag domain with an effective state bit does not exist in the tag domain with an effective state bit in the first group according to the tag bit information corresponding to the physical address information of the data to be accessed, acquiring offset information of the group and the intra-group data domain which are allocated with the data to be accessed and allocating the offset information to the data to be accessed, wherein the tag domain with the effective state bit does not include a data domain which indicates that the data domain corresponding to the tag domain is not accessed by the processor and indicates that the data stored in the data domain corresponding to the tag domain is from the group corresponding to the data to be accessed Or, the data field corresponding to the tag field is indicated to be accessed by the processor and the data stored in the data field corresponding to the tag field is indicated to be derived from a group other than the group corresponding to the data to be accessed, or the data field corresponding to the tag field is indicated to be not accessed by the processor and the data stored in the data field corresponding to the tag field is indicated to be derived from a group other than the group corresponding to the data to be accessed.
In a third possible implementation, in combination with the second possible implementation,
the acquisition unit further includes:
a selecting module, configured to select, according to the utilization rates respectively corresponding to each group of tag domains in the first group, a data domain with a lowest utilization rate among the data domains respectively corresponding to each tag domain in the first group if it is determined that the utilization rate corresponding to the first group is smaller than a first utilization rate threshold according to the utilization rate respectively corresponding to each group of tag domains in the storage system;
and the allocation module is used for allocating the data domain with the lowest utilization rate in the data domains corresponding to the first group and each label domain in the first group to the data to be accessed.
In a fourth possible implementation, in combination with the second possible implementation,
the selection module is further configured to: if the utilization rate corresponding to the first group is determined to be larger than or equal to the first utilization rate threshold value according to the utilization rate corresponding to each group in the storage system, selecting a second group with the lowest utilization rate in all the groups except the first group in the storage system; selecting the data domain with the lowest utilization rate in the data domains respectively corresponding to each label domain in the second group according to the utilization rate of the data domain respectively corresponding to each label domain in the second group;
the allocation module is further configured to: and allocating the data domain with the lowest utilization rate in the data domains corresponding to each label domain in the second group and the second group to the data to be accessed.
In a fifth possible implementation manner, in combination with the second aspect or the first possible implementation manner,
each of the tag fields further includes start address information and end address information of the data field corresponding to the tag field,
the start address information is used for indicating a start bit address of the data field corresponding to the tag field, the end address information is used for indicating an end bit address of the data field corresponding to the tag field,
the request information also contains granularity information of the data to be accessed,
accordingly, the method can be used for solving the problems that,
the acquisition unit further includes:
a reading module, configured to read a start bit address and an end bit address of a data field corresponding to the first tag field in the first tag field;
the acquisition unit is further configured to: if all data corresponding to the data to be accessed are determined to be stored in the data domain corresponding to the first tag domain according to the physical address information of the data to be accessed and the granularity information of the data to be accessed, the position of the data domain corresponding to the first tag domain is obtained according to the group identification information in the first tag domain and the offset information of the data domain in the group; and acquiring the data domain corresponding to the first label domain according to the position of the data domain corresponding to the first label domain.
In a sixth possible implementation manner, with reference to the second aspect or the first possible implementation manner, each tag field further includes start address information and end address information of the data field corresponding to the tag field,
the start address information is used for indicating a start bit address of the data field corresponding to the tag field, the end address information is used for indicating an end bit address of the data field corresponding to the tag field,
the request information also contains granularity information of the data to be accessed,
accordingly, the method can be used for solving the problems that,
the read module is further to: reading a start bit address and an end bit address of a data field corresponding to the first tag field in the first tag field;
the acquisition unit is further configured to: if all data corresponding to the data to be accessed are determined not to be stored in the data domain corresponding to the first tag domain according to the physical address information of the data to be accessed and the granularity information of the data to be accessed, acquiring a replaced data domain which allocates the data to be accessed and allocating the replaced data domain to the data to be accessed, wherein the replaced data domain comprises a data domain which has granularity larger than and closest to the granularity information of the request to be accessed and is corresponding to each tag domain in the first group and has different granularity.
In a seventh possible implementation manner, with reference to the sixth possible implementation manner, the obtaining unit further includes:
a merging module, configured to merge the plurality of second data fields into the replaced data field and allocate the replaced data field to the data to be accessed if it is determined that the utilization of the replaced data field in the first group is greater than or equal to a second utilization threshold and the utilization of the plurality of second data fields in all data fields with different granularities except the replaced data field in the first group is less than the second access threshold according to the utilization of the data field with different granularities corresponding to each tag field in the first group, where the second data field includes the data field with a granularity less than the granularity of the replaced data field in all data fields with different granularities except the replaced data field in the first group;
or,
the acquisition unit further includes:
a splitting module, configured to, if it is determined that the utilization rate of the replaced data domain in the first group is greater than or equal to the second utilization rate threshold and the utilization rate of a third data domain in all data domains with different granularities except the replaced data domain in the first group is less than the second access threshold according to the utilization rate of the data domain with different granularities corresponding to each tag domain in the first group, split the third data domain into one or more replaced data domains and allocate the replaced data domains to the data to be accessed, where the third data domain includes data domains with granularities greater than the granularity of the replaced data domain in all data domains with different granularities except the replaced data domain in the first group;
or,
the allocation module is further configured to: and if the utilization rate of the replaced data domain in the first group is determined to be smaller than the second utilization rate threshold according to the utilization rate of the data domain with different granularity corresponding to each label domain in the first group, the replaced data domain is allocated to the data to be accessed.
In an eighth possible implementation manner, with reference to the first aspect, the first possible implementation manner, the second possible implementation manner, the third possible implementation manner, the fourth possible implementation manner, the fifth possible implementation manner, the sixth possible implementation manner, or the seventh possible implementation manner,
the cache memory further comprises:
and the updating unit is used for updating the label domain corresponding to the data domain distributed to the data to be accessed.
The method, the device and the system for accessing data provided by the embodiments of the present invention expand the attributes of the tag fields in the cache memory, so that the tag fields can correspond to the data fields of the group and also correspond to the data fields of other groups, thereby improving the utilization rate of the data fields in the cache memory, and solving the problem in the prior art that the utilization rate of the data fields in the cache memory is low because the tag fields and the data fields in the cache memory are in a fixed one-to-one correspondence and are stored separately.
Drawings
In order to more clearly illustrate the embodiments of the present invention or the technical solutions in the prior art, the drawings used in the description of the embodiments or the prior art will be briefly described below, it is obvious that the drawings in the following description are only some embodiments of the present invention, and for those skilled in the art, other drawings can be obtained according to the drawings without creative efforts.
FIG. 1 is a block diagram of an embodiment of an N-way set associative cache memory;
FIG. 2 is a diagram illustrating a cache miss according to an embodiment of the present invention;
fig. 3 is a schematic flowchart of a method for accessing data according to an embodiment of the present invention;
FIG. 4 is a flow chart illustrating another method for accessing data according to an embodiment of the present invention;
FIG. 5 is a block diagram illustrating an exemplary cache organization according to the present invention;
FIG. 6 is a flow chart illustrating another method for accessing data according to an embodiment of the present invention;
FIG. 7A is a block diagram of a cache miss processing module according to an embodiment of the present invention;
FIG. 7B is a diagram of another cache miss processing module according to an embodiment of the present invention;
FIG. 8 is a flowchart illustrating another method for accessing data according to an embodiment of the present invention;
FIG. 9 is a diagram illustrating a variable-granularity cache according to an embodiment of the present invention;
FIG. 10 is a diagram illustrating an embodiment of a cache memory;
FIG. 11 is a schematic diagram of an alternative cache memory according to an embodiment of the present invention;
FIG. 12 is a diagram illustrating a cache memory according to an embodiment of the present invention;
FIG. 13 is a diagram illustrating an alternative cache memory according to an embodiment of the present invention.
Detailed Description
The technical solutions in the embodiments of the present invention will be clearly and completely described below with reference to the drawings in the embodiments of the present invention, and it is obvious that the described embodiments are only a part of the embodiments of the present invention, and not all of the embodiments. All other embodiments, which can be derived by a person skilled in the art from the embodiments given herein without making any creative effort, shall fall within the protection scope of the present invention.
In one aspect, an embodiment of the present invention provides a method for accessing data, and referring to fig. 3, the method may include the following steps:
301: receiving request information for accessing to-be-accessed data sent by a processor, wherein the request information comprises physical address information of the to-be-accessed data;
for example, the main body of the request message for accessing the data to be accessed sent by the receiving processor may be a cache memory, a memory, or another storage system, which is not limited in this embodiment of the present invention. The following embodiment will be specifically described taking a cache memory as an example.
302: acquiring a label domain corresponding to the physical address information of the data to be accessed according to the physical address information of the data to be accessed;
illustratively, each tag field information also contains tag bit information, data field validity information, "isptr" information,
wherein, the tag bit information is used to indicate the physical address corresponding to the data field corresponding to the tag field, whether the valid information of the data field is used to indicate that the data field corresponding to the tag field is accessed by the processor or not, the "isptr" information is used to indicate whether the data stored in the data field corresponding to the tag field is from the group corresponding to the data to be accessed or from other groups except the group corresponding to the data to be accessed,
accordingly, the method can be used for solving the problems that,
acquiring a label domain corresponding to the physical address information of the data to be accessed according to the physical address information of the data to be accessed, wherein the label domain comprises:
acquiring a first group and tag bit information corresponding to the physical address information of the data to be accessed according to the physical address information of the data to be accessed;
if the label domain with the valid state bit exists in the first group of the storage system according to the first group corresponding to the physical address information of the data to be accessed, and if the label domain with the valid state bit exists in the label domain with the valid state bit and is equal to the label domain corresponding to the physical address information of the data to be accessed according to the label bit information corresponding to the physical address information of the data to be accessed, the first label domain with the valid state bit in the label domain and the label domain corresponding to the physical address information of the data to be accessed is obtained, wherein the label domain with the valid state bit contains the group which indicates that the data domain is accessed by the processor and indicates that the data stored in the data domain corresponding to the label domain comes from the data to be accessed.
Illustratively, each tag field information also contains tag bit information, data field validity information, "isptr" information,
wherein, the tag bit information is used to indicate the physical address corresponding to the data field corresponding to the tag field, whether the valid information of the data field is used to indicate that the data field corresponding to the tag field is accessed by the processor or not, the "isptr" information is used to indicate whether the data stored in the data field corresponding to the tag field is from the group corresponding to the data to be accessed or from other groups except the group corresponding to the data to be accessed,
accordingly, the method can be used for solving the problems that,
acquiring a label domain corresponding to the physical address information of the data to be accessed according to the physical address information of the data to be accessed, wherein the label domain comprises:
acquiring a first group and tag bit information corresponding to the physical address information of the data to be accessed according to the physical address information of the data to be accessed;
if the first group corresponding to the physical address information of the data to be accessed does not have a tag field with a valid status bit, or if the first group corresponding to the physical address information of the data to be accessed determines that the tag field with a valid status bit exists in the first group in the storage system, and if the tag field with a valid status bit does not exist in the tag field corresponding to the physical address information of the data to be accessed, the tag field with the valid status bit is equal to the tag field corresponding to the physical address information of the data to be accessed, the offset information of the data field in the group and the data field in the group are acquired and allocated to the data to be accessed, wherein the tag field without valid status bit contains an indication that the data field corresponding to the tag field is not accessed by the processor and an indication that the data stored in the data field corresponding to the tag field is from the group corresponding to the data to be accessed, or the data domain corresponding to the indication label domain is accessed by the processor and the data stored in the data domain corresponding to the indication label domain is from other groups except the group corresponding to the data to be accessed, or the data domain corresponding to the indication label domain is not accessed by the processor and the data stored in the data domain corresponding to the indication label domain is from other groups except the group corresponding to the data to be accessed.
Illustratively, acquiring and allocating a group of data to be accessed and intra-group data domain offset information to the data to be accessed includes:
if the utilization rate corresponding to the first group is determined to be smaller than the first utilization rate threshold value according to the utilization rate corresponding to each group in the storage system, selecting the data domain with the lowest utilization rate in the data domains corresponding to each label domain in the first group according to the utilization rate of the data domain corresponding to each label domain in the first group;
and allocating the data fields with the lowest utilization rate in the data fields respectively corresponding to the tag fields in the first group and the first group to the data to be accessed.
Illustratively, acquiring and allocating a group of data to be accessed and intra-group data domain offset information to the data to be accessed includes:
if the utilization rate corresponding to the first group is determined to be larger than or equal to the first utilization rate threshold value according to the utilization rate corresponding to each group in the storage system, selecting a second group with the lowest utilization rate in all the groups except the first group in the storage system;
selecting the data domain with the lowest utilization rate in the data domains respectively corresponding to each label domain in the second group according to the utilization rate of the data domain respectively corresponding to each label domain in the second group;
and allocating the data domain with the lowest utilization rate in the data domains corresponding to each label domain in the second group and the second group to the data to be accessed.
303: the method comprises the steps of obtaining data domains corresponding to tag domains according to group identification information and in-group data domain offset information in tag domain information corresponding to physical address information, wherein each group comprises N tag domains and M data domains, the tag domains correspond to the data domains one to one, the tag domains and the data domains corresponding to the tag domains are in the same group or different groups, N is a natural number greater than or equal to 1, M is a natural number greater than or equal to 1, N is greater than M, each tag domain information comprises group identification information and in-group data domain offset information of the data domains corresponding to the tag domains, the group identification information is used for indicating the group where the data domains corresponding to the tag domains are located, and the in-group data offset information is used for indicating the offset of the data domains in the group where the data domains are located.
Illustratively, each tag field further contains start address information, end address information of the data field corresponding to the tag field,
the start address information is used for indicating the start bit address of the data field corresponding to the tag field, the end address information is used for indicating the end bit address of the data field corresponding to the tag field,
the request information also contains granularity information of the data to be accessed,
accordingly, the method can be used for solving the problems that,
acquiring a data domain corresponding to a tag domain according to group identification information and in-group data domain offset information in tag domain information corresponding to physical address information, wherein the data domain comprises:
reading a start bit address and an end bit address indicating a data field corresponding to the first tag field in the first tag field;
if all data corresponding to the data to be accessed are determined to be stored in the data domain corresponding to the first tag domain according to the physical address information of the data to be accessed and the granularity information of the data to be accessed, the position of the data domain corresponding to the first tag domain is obtained according to the group identification information in the first tag domain and the offset information of the data domain in the group;
and acquiring the data domain corresponding to the first label domain according to the position of the data domain corresponding to the first label domain.
Illustratively, each tag field further contains start address information, end address information of the data field corresponding to the tag field,
the start address information is used for indicating the start bit address of the data field corresponding to the tag field, the end address information is used for indicating the end bit address of the data field corresponding to the tag field,
the request information also contains granularity information of the data to be accessed,
accordingly, the method can be used for solving the problems that,
acquiring a data domain corresponding to a tag domain according to group identification information and in-group data domain offset information in tag domain information corresponding to physical address information, wherein the data domain comprises:
reading a start bit address and an end bit address indicating a data field corresponding to the first tag field in the first tag field;
if all data corresponding to the data to be accessed are determined not to be stored in the data domain corresponding to the first tag domain according to the physical address information of the data to be accessed and the granularity information of the data to be accessed, a replaced data domain for distributing the data to be accessed is obtained and distributed to the data to be accessed, wherein the replaced data domain comprises a data domain, the granularity of which is greater than and closest to the granularity information of the request to be accessed, of the data domains with different granularities corresponding to each tag domain in the first group.
Illustratively, obtaining the replaced data field for allocating the data to be accessed and allocating the replaced data field to the data to be accessed comprises:
if the utilization rate of the replaced data domain in the first group is larger than or equal to a second utilization rate threshold value and the utilization rates of a plurality of second data domains in all the data domains with different granularities except the replaced data domain in the first group are smaller than a second access threshold value according to the utilization rates of the data domains with different granularities respectively corresponding to each label domain in the first group, combining the plurality of second data domains into the replaced data domain and distributing the replaced data domain to the data to be accessed, wherein the second data domain comprises the data domains with the granularity smaller than the granularity of the replaced data domain in all the data domains with different granularities except the replaced data domain in the first group;
or,
if the utilization rate of the replaced data domain in the first group is larger than or equal to a second utilization rate threshold and the utilization rate of a third data domain in all data domains with different granularities except the replaced data domain in the first group is smaller than a second access threshold according to the utilization rate of the data domain with different granularities corresponding to each label domain in the first group, splitting the third data domain into one or more replaced data domains and distributing the data domains to be accessed, wherein the third data domain comprises the data domains with the granularity larger than that of the replaced data domain in all the data domains with different granularities except the replaced data domain in the first group;
or,
and if the utilization rate of the replaced data domain in the first group is determined to be smaller than the second utilization rate threshold value according to the utilization rate of the data domain with different granularity corresponding to each label domain in the first group, the replaced data domain is distributed to the data to be accessed.
Illustratively, the method may further comprise:
and updating the label domain corresponding to the data domain allocated to the data to be accessed.
The method for accessing data provided by the embodiment of the invention expands the attribute of the tag field in the cache memory, so that the tag field can correspond to the data field of the group and also can correspond to the data fields of other groups, thereby improving the utilization rate of the data field in the cache memory, and solving the problem of low utilization rate of the data field in the cache memory due to the fact that the tag field and the data field in the cache memory are in a fixed one-to-one correspondence relationship and are stored separately in the prior art.
The above method examples are described below by way of specific examples.
Illustratively, an application scenario of an embodiment of the present invention includes a host comprising at least one processor comprising a plurality of levels of set associative cache memory.
Example one
Referring to fig. 4, a schematic flow chart of another method for accessing data according to an embodiment of the present invention is shown, which includes the following steps:
401: the cache memory receives request information for accessing the data to be accessed, which is sent by the processor, wherein the request information comprises physical address information of the data to be accessed and granularity information of the data to be accessed:
illustratively, the physical address information of the data to be accessed is an address that is not aligned according to the cache line size.
402: the cache memory acquires a first group and tag bit information corresponding to the physical address information of the data to be accessed according to the physical address information of the data to be accessed, wherein the tag bit information is used for indicating a physical address corresponding to a data field corresponding to a tag field;
for example, the physical address information of the data to be accessed may be obtained by mapping the first group and the tag bit information corresponding to the physical address information of the data to be accessed through a hash algorithm in the prior art, or obtaining the first group and the tag bit information corresponding to the physical address information of the data to be accessed through other methods, which is not limited in this embodiment of the present invention.
403: the cache memory judges whether a label domain with a valid state bit exists in a first group in the cache memory according to the first group corresponding to the physical address information of the data to be accessed, wherein each group comprises N label domains and M data domains, the label domains correspond to the data domains one by one, the label domains and the data domains corresponding to one by one are in the same group or different groups, N is a natural number which is greater than or equal to 1, M is a natural number which is greater than or equal to 1 and N is greater than M, each label domain information comprises group identification information of the data domain corresponding to the label domain, in-group data domain offset information, label bit information, valid information of the data domain, "isptr" information, information whether the data domain is updated, data domain size information, "PtrS" information, start address information and end address information, the group identification information is used for indicating the group in which the data domain corresponding to the label domain is located, the data offset information in the group is used for indicating the offset of the data field in the group where the data field is located, whether the valid information of the data field is used for indicating that the data field corresponding to the tag field is accessed or not accessed by the processor, whether the data stored in the data field corresponding to the tag field is from the group corresponding to the data to be accessed or from other groups except the group corresponding to the data to be accessed, whether the data field is updated or not, and whether the data field size information is used for indicating the size of the data field corresponding to the tag field, if the 'isptr' information is used for indicating that the data stored in the data field corresponding to the tag field is from the group corresponding to the data to be accessed, the 'PtrS' information is null, if the 'isptr' information is used for indicating that the data stored in the data field corresponding to the tag field is from other groups except the group corresponding to the data to be accessed, the information of 'PtrS' is used for indicating that the data stored in the data field comes from the corresponding data field on the other group except the group corresponding to the data to be accessed, the start address information is used for indicating the start bit address of the data field corresponding to the label field, and the end address information is used for indicating the end bit address of the data field corresponding to the label field;
for example, in the embodiment of the present invention, the group identification information, the intra-group data domain offset information, the information whether the data domain is valid, the "isPtr" information, the tag bit information, the information whether the data domain is updated, the "PtrS" information, the data domain start address information, the data domain end address information, and the data domain size information of the data domain corresponding to the tag domain included in each tag domain information may be respectively identified by "set", "off", "valid", "isPtr", "tag", "dirty", "PtrS", "start", "end", and "size", or may be respectively identified by other identifiers, which is not limited in this embodiment of the present invention.
Referring to fig. 5, a schematic diagram of an organization structure in a cache according to an embodiment of the present invention is shown, where in the organization structure of the cache, tag fields and data fields are not in a fixed one-to-one correspondence relationship, and a tag field may point to any one data field in the same group as the tag field and may also point to other groups of data fields in different groups from the tag field, so that the number N of tag fields in the cache is greater than or equal to the number of data fields; in the physical implementation of the cache memory, the attributes of the tag field, such as "set", "off", "isPtr", "PtrS", "start", "end", and "size", are extended.
For example, in the prior art, the tag field includes three attributes "tag", "valid", and "dirty", where the tag bits and the physical address information of the data bits corresponding to the tag bits are in one-to-one correspondence, the "valid" is used to indicate whether the data field corresponding to the tag field is valid, and the "dirty" is used to indicate whether the data field corresponding to the tag field is updated.
For example, in the embodiment of the present invention, "tag", "valid" and "dirty" in the tag field are the same as those indicated by "tag", "valid" and "dirty" in the cache design in the prior art, and for the physical implementation of the attribute of the tag field of the cache in the prior art, the attribute information of the tag field is extended, and "set", "off", "isPtr", "PtrS", "start", "end" and "size" may be added in the tag field, and some other attributes related to the cache replacement policy may also be added in the tag field, for example, "accessCount" information may be added to indicate the frequency of statistics on which the data field corresponding to each tag field is accessed, which is not limited by the embodiment of the present invention.
For example, "set" in the tag field is used to indicate a position of a group where a data field corresponding to the tag field is stored, where the position may be the present group or other groups; the "off" in the tag field information is used to specify the offset of the data field within the set in which the data field is located, e.g., a way in a cache design. Illustratively, in the cache design in the prior art, the location of the data field in the cache is addressed according to the set and way number of the data field where the data field currently locates, but in the embodiment of the present invention, because the organization structure and physical implementation of the cache are different from those in the prior art, the location of the data field in the cache needs to determine the set and way number of the data field according to the values of "set" and "off" of the tag field corresponding to the data field, so as to obtain the location of the data field according to the set and way number of the data field, and if the value of "set" is not the set where the data field currently locates, "set" and "off" can be used as tag fields pointing to other sets, and the data field corresponding to the tag field stores the data of the address corresponding to the tag field.
"start" and "end" in the tag field are used to identify the start and end addresses to which the data in the data field corresponding to the tag field corresponds, which are offsets within the maximum granularity of a relative cache line. For example, if the maximum granularity of a cache line is 64 bytes, and the data length in the data field is only 8 bytes and the 8 bytes are just the first 8 bytes of the 64 bytes, then the start address of the data is 0 and the end address is 7.
Illustratively, the tag field in which the presence status bit is valid includes whether the data field is valid or not and the "isPtr" information is valid, and if the data field in the tag field is valid or not, the "isPtr" information is denoted by "isPtr", the "valid" is valid for indicating that the data field is accessed by the processor, the "valid" is valid by "is", the "valid" is invalid for indicating that the data field is not accessed by the processor, and the "valid" is invalid by "no"; "isPtr" valid indicates that the data stored in the data field corresponding to the tag field is from the group corresponding to the data to be accessed, "isPtr" valid "may be represented by" no, "and" isPtr "invalid indicates that the data stored in the data field corresponding to the tag field is from the other group except the group corresponding to the data to be accessed, and" isPtr "invalid may be represented by" is. Thus, the tag field with the presence status bit valid may contain a "valid" to "is" and an "isPtr" bit to "no".
The tag field for which the status bit is valid includes "valid" as "no" and "isPtr" as "no", or "valid" as "is" and "isPtr" as "is", or "valid" as "no" and "isPtr" as "is".
404: if the first group in the cache memory is determined to have the label domain with the valid state bit, the cache memory judges whether the label domain with the valid state bit in the cache memory has the label domain equal to the label domain corresponding to the physical address information of the data to be accessed according to the label bit information corresponding to the physical address information of the data to be accessed;
405: if the tag field with the valid state bit in the cache memory is determined to be a first tag field with tag bit information equal to the tag bit information corresponding to the physical address information of the data to be accessed, the cache memory reads a start bit address and an end bit address of a data field corresponding to the first tag field in the first tag field;
406: the cache memory judges whether all data corresponding to the data to be accessed are stored in a data domain corresponding to a first data domain according to the physical address information of the data to be accessed and the granularity information of the data to be accessed;
for example, when determining whether the data to be accessed is stored in the data field corresponding to the first data field, the physical address of the data to be accessed may be aligned with the start address bit in the first data field, and then determining whether the data to be accessed is stored in the data field corresponding to the first data field according to the granularity information of the data to be accessed, for example, 9 bytes of data with a start address bit of 0 and an end address bit of 8 in the first data field, where the start address of the physical address information of the data to be accessed is 3 and the granularity information is 10, the start address 3 of the physical address of the data to be accessed is aligned with the start address bit 0 of the data field corresponding to the first data field, and one of the data is checked, and when the data field corresponding to the first data field reaches the end address 8, the physical address of the data to be accessed reaches 11, only 9 bytes, and the granularity of the information to be accessed is 10 bytes, therefore, it can be determined that the data to be accessed cannot be stored in the data field corresponding to the first data field.
407: if all the data corresponding to the data to be accessed are stored in the data domain corresponding to the first data domain, the cache memory acquires the position of the data domain corresponding to the first tag domain according to the group identification information in the first tag domain and the offset information of the data domain in the group;
408: the cache memory acquires a data field corresponding to the first label field according to the position of the data field corresponding to the first data field;
409: if the first group corresponding to the physical address information of the data to be accessed determines whether a tag field with a valid status bit exists in the first group in the cache memory, or if the first group corresponding to the physical address information of the data to be accessed determines that the tag field with a valid status bit exists in the first group in the storage system and if the tag field with a valid status bit exists in the tag field corresponding to the physical address information of the data to be accessed, the tag field with a valid status bit is determined that the tag field with a valid status bit exists in the tag field equal to the tag field corresponding to the physical address information of the data to be accessed, acquiring offset information of the data field in the group and allocating the offset information of the data field to be accessed and allocating the offset information to the data to be accessed, wherein the tag field with a valid status bit contains an indication that the data field corresponding to the tag field is not accessed by the processor and indicates that the data stored in the data field corresponding, or, the data domain corresponding to the tag domain is indicated to be accessed by the processor and the data stored in the data domain corresponding to the tag domain is indicated to be from a group other than the group corresponding to the data to be accessed, or the data domain corresponding to the tag domain is indicated to be not accessed by the processor and the data stored in the data domain corresponding to the tag domain is indicated to be from a group other than the group corresponding to the data to be accessed;
for example, the cache memory may obtain, according to the utilization rate of the data field corresponding to each tag field in the first group, the group to which the data to be accessed is allocated and the offset information of the data field in the group, and allocate the group to which the data to be accessed is allocated and the offset information of the data field in the group, and may also obtain, by another method, the group to which the data to be accessed is allocated and the offset information of the data field in the group, and allocate the offset information to the data to be accessed.
410: and if determining whether all data corresponding to the data to be accessed are stored in the data domain corresponding to the first tag domain according to the physical address information of the data to be accessed and the granularity information of the data to be accessed, acquiring a replaced data domain for distributing the data to be accessed and distributing the replaced data domain to the data to be accessed, wherein the replaced data domain comprises a data domain, the granularity of which is greater than and closest to the granularity information of the request to be accessed, of the data domains with different granularities corresponding to each tag domain in the first group.
For example, the cache memory may obtain and allocate a replaced data field of the data to be accessed to the data to be accessed according to the granularity information of the data to be accessed and the utilization rate of the data field corresponding to each tag field in the first group, or may also obtain and allocate the replaced data field of the data to be accessed to the data to be accessed by adopting other methods, which is not limited in the embodiment of the present invention.
411: and updating the label domain corresponding to the data domain allocated to the data to be accessed.
For example, in step 409, if the cache memory obtains the group to which the data to be accessed is allocated and the offset information of the data field in the group according to the utilization rate of the data field corresponding to each tag field in the first group and allocates the offset information to the data to be accessed, the obtained group to which the data to be accessed is allocated is the first group, and therefore, it is necessary to change "tag" in the tag field corresponding to the data field to be accessed to each attribute information in the tag bit information corresponding to the data to be accessed to update the attribute information corresponding to the data to be accessed.
In step 410, if the cache memory can obtain the replaced data field allocated with the data to be accessed according to the granularity information of the data to be accessed and the utilization rate of the data field corresponding to each tag field in the first group and allocate the replaced data field to the data to be accessed, the "tag" in the tag field corresponding to the data field allocated to the data to be accessed needs to be changed into each attribute information in the tag bit information corresponding to the data to be accessed, and the attribute information is updated to the attribute information corresponding to the data to be accessed.
The method for accessing data provided by the embodiment of the invention expands the attribute of the tag field in the cache memory, so that the tag field can correspond to the data field of the group and also can correspond to the data fields of other groups, thereby improving the utilization rate of the data field in the cache memory, and solving the problem of low utilization rate of the data field in the cache memory due to the fact that the tag field and the data field in the cache memory are in a fixed one-to-one correspondence relationship and are stored separately in the prior art.
Example two
Referring to fig. 6, a schematic flow chart of another method for accessing data according to an embodiment of the present invention is shown, which includes the following steps:
601: the cache memory receives request information for accessing the data to be accessed, which is sent by the processor, wherein the request information comprises physical address information of the data to be accessed and granularity information of the data to be accessed;
illustratively, the physical address information of the data to be accessed is an address that is not aligned according to the cache line size.
602: the cache memory acquires a first group and tag bit information corresponding to the physical address information of the data to be accessed according to the physical address information of the data to be accessed, wherein the tag bit information is used for indicating a physical address corresponding to a data field corresponding to a tag field;
for example, the physical address information of the data to be accessed may be obtained by mapping the first group and the tag bit information corresponding to the physical address information of the data to be accessed through a hash algorithm in the prior art, or obtaining the first group and the tag bit information corresponding to the physical address information of the data to be accessed through other methods, which is not limited in this embodiment of the present invention.
603: the cache memory judges whether a label domain with a valid state bit exists in a first group in the cache memory according to the first group corresponding to the physical address information of the data to be accessed, wherein each group comprises N label domains and M data domains, the label domains correspond to the data domains one by one, the label domains and the data domains corresponding to one by one are in the same group or different groups, N is a natural number which is greater than or equal to 1, M is a natural number which is greater than or equal to 1 and N is greater than M, each label domain information comprises group identification information of the data domain corresponding to the label domain, in-group data domain offset information, label bit information, valid information of the data domain, "isptr" information, information whether the data domain is updated, data domain size information, "PtrS" information, start address information and end address information, the group identification information is used for indicating the group in which the data domain corresponding to the label domain is located, the data offset information in the group is used for indicating the offset of the data field in the group where the data field is located, whether the valid information of the data field is used for indicating that the data field corresponding to the tag field is accessed or not accessed by the processor, whether the data stored in the data field corresponding to the tag field is from the group corresponding to the data to be accessed or from other groups except the group corresponding to the data to be accessed, whether the data field is updated or not, and whether the data field size information is used for indicating the size of the data field corresponding to the tag field, if the 'isptr' information is used for indicating that the data stored in the data field corresponding to the tag field is from the group corresponding to the data to be accessed, the 'PtrS' information is null, if the 'isptr' information is used for indicating that the data stored in the data field corresponding to the tag field is from other groups except the group corresponding to the data to be accessed, the information of 'PtrS' is used for indicating that the data stored in the data field comes from the corresponding data field on the other group except the group corresponding to the data to be accessed, the start address information is used for indicating the start bit address of the data field corresponding to the label field, and the end address information is used for indicating the end bit address of the data field corresponding to the label field;
for example, in the embodiment of the present invention, the group identification information, the intra-group data domain offset information, the information whether the data domain is valid, the "isPtr" information, the tag bit information, the information whether the data domain is updated, the "PtrS" information, the data domain start address information, the data domain end address information, and the data domain size information of the data domain corresponding to the tag domain included in each tag domain information may be respectively identified by "set", "off", "valid", "isPtr", "tag", "dirty", "PtrS", "start", "end", and "size", or may be respectively identified by other identifiers, which is not limited in this embodiment of the present invention.
Referring to fig. 5, a schematic diagram of an organization structure in a cache according to an embodiment of the present invention is shown, where in the organization structure of the cache, tag fields and data fields are not in a fixed one-to-one correspondence relationship, and a tag field may point to any one data field in the same group as the tag field and may also point to other groups of data fields in different groups from the tag field, so that the number N of tag fields in the cache is greater than or equal to the number of data fields; in the physical implementation of the cache memory, the attributes of the tag field, such as "set", "off", "isPtr", "PtrS", "start", "end", and "size", are extended.
For example, in the prior art, the tag field includes three attributes "tag", "valid", and "dirty", where the tag bits and the physical address information of the data bits corresponding to the tag bits are in one-to-one correspondence, the "valid" is used to indicate whether the data field corresponding to the tag field is valid, and the "dirty" is used to indicate whether the data field corresponding to the tag field is updated.
For example, in the embodiment of the present invention, "tag", "valid" and "dirty" in the tag field are the same as those indicated by "tag", "valid" and "dirty" in the cache design in the prior art, and for the physical implementation of the attribute of the tag field of the cache in the prior art, the attribute information of the tag field is extended, and "set", "off", "isPtr", "PtrS", "start", "end" and "size" may be added in the tag field, and some other attributes related to the cache replacement policy may also be added in the tag field, for example, "accessCount" information may be added to indicate the frequency of statistics on which the data field corresponding to each tag field is accessed, which is not limited by the embodiment of the present invention.
For example, "set" in the tag field is used to indicate a position of a group where a data field corresponding to the tag field is stored, where the position may be the present group or other groups; the "off" in the tag field information is used to specify the offset of the data field within the set in which the data field is located, e.g., a way in a cache design. Illustratively, in the cache design in the prior art, the location of the data field in the cache is addressed according to the set and way number of the data field where the data field currently locates, but in the embodiment of the present invention, because the organization structure and physical implementation of the cache are different from those in the prior art, the location of the data field in the cache needs to determine the set and way number of the data field according to the values of "set" and "off" of the tag field corresponding to the data field, so as to obtain the location of the data field according to the set and way number of the data field, and if the value of "set" is not the set where the data field currently locates, "set" and "off" can be used as tag fields pointing to other sets, and the data field corresponding to the tag field stores the data of the address corresponding to the tag field.
"start" and "end" in the tag field are used to identify the start and end addresses to which the data in the data field corresponding to the tag field corresponds, which are offsets within the maximum granularity of a relative cache line. For example, if the maximum granularity of a cache line is 64 bytes, and the data length in the data field is only 8 bytes and the 8 bytes are just the first 8 bytes of the 64 bytes, then the start address of the data is 0 and the end address is 7.
Illustratively, the tag field in which the presence status bit is valid includes whether the data field is valid or not and the "isPtr" information is valid, and if the data field in the tag field is valid or not, the "isPtr" information is denoted by "isPtr", the "valid" is valid for indicating that the data field is accessed by the processor, the "valid" is valid by "is", the "valid" is invalid for indicating that the data field is not accessed by the processor, and the "valid" is invalid by "no"; "isPtr" valid indicates that the data stored in the data field corresponding to the tag field is from the group corresponding to the data to be accessed, "isPtr" valid "may be represented by" no, "and" isPtr "invalid indicates that the data stored in the data field corresponding to the tag field is from the other group except the group corresponding to the data to be accessed, and" isPtr "invalid may be represented by" is. Thus, the tag field with the presence status bit valid may contain a "valid" to "is" and an "isPtr" bit to "no".
Tag fields in which the no-present status bit is valid include "valid" as "no" and "isPtr" as "no", or "valid" as "is" and "isPtr" as "is", or "valid" as "no" and "isPtr" as "is".
604: if the first group in the cache memory is determined to have the label domain with the valid state bit, the cache memory judges whether the label domain with the valid state bit in the cache memory has the label domain equal to the label domain corresponding to the physical address information of the data to be accessed according to the label bit information corresponding to the physical address information of the data to be accessed;
605: if the tag field with the valid state bit in the cache memory is determined to be a first tag field with tag bit information equal to the tag bit information corresponding to the physical address information of the data to be accessed, the cache memory reads a start bit address and an end bit address of a data field corresponding to the first tag field in the first tag field;
606: the cache memory judges whether all data corresponding to the data to be accessed are stored in a data domain corresponding to a first data domain according to the physical address information of the data to be accessed and the granularity information of the data to be accessed;
for example, when determining whether the data to be accessed is stored in the data field corresponding to the first data field, the physical address of the data to be accessed may be aligned with the start address bit in the first data field, and then determining whether the data to be accessed is stored in the data field corresponding to the first data field according to the granularity information of the data to be accessed, for example, 9 bytes of data with a start address bit of 0 and an end address bit of 8 in the first data field, where the start address of the physical address information of the data to be accessed is 3 and the granularity information is 10, the start address 3 of the physical address of the data to be accessed is aligned with the start address bit 0 of the data field corresponding to the first data field, and one of the data is checked, and when the data field corresponding to the first data field reaches the end address 8, the physical address of the data to be accessed reaches 11, only 9 bytes, and the granularity of the information to be accessed is 10 bytes, therefore, it can be determined that the data to be accessed cannot be stored in the data field corresponding to the first data field.
607: if all the data corresponding to the data to be accessed are stored in the data domain corresponding to the first data domain, the cache memory acquires the position of the data domain corresponding to the first tag domain according to the group identification information in the first tag domain and the offset information of the data domain in the group;
608: the cache memory acquires a data field corresponding to the first label field according to the position of the data field corresponding to the first data field;
609: if the first group corresponding to the physical address information of the data to be accessed determines whether a tag domain with an effective state bit exists in the first group in the cache memory or not, or if the first group corresponding to the physical address information of the data to be accessed determines that the tag domain with the effective state bit exists in the first group in the storage system and if the tag domain with the effective state bit in the first group corresponding to the tag domain corresponding to the physical address information of the data to be accessed determines whether a tag domain with the effective state bit equal to the tag bit information corresponding to the physical address information of the data to be accessed exists in the tag domain corresponding to the physical address information of the data to be accessed, whether the utilization rate corresponding to the first group is greater than or equal to a first utilization rate threshold value or not is judged according to the utilization;
for example, the first utilization threshold may be obtained according to utilization ratios with utilization imbalance among groups in the cache memory and utilization ratios of the groups, or may be obtained by other methods, which is not limited by the embodiment of the present invention.
For example, the utilization rate may be obtained by counting the number of access requests of each set, or may be obtained by other methods, which is not limited in this embodiment of the present invention.
Illustratively, in the prior art, only the in-set cache replacement module is present in the cache miss processing module, and referring to fig. 7A, the cache miss processing module utilizes an in-set cache replacement policy to select a replacement entry for the data to be accessed, for example, a Least Recently Used (LRU) algorithm, to select an appropriate data field as the replaced entry according to the utilization of the data field corresponding to each tag field in the set corresponding to the data to be accessed. In the prior art, only the utilization rate of the data field corresponding to each tag field in the group corresponding to the data to be accessed is considered, and it is not considered that if the utilization rate of the group is very high, the utilization rate of the data field corresponding to each tag field in the group is also very high, and if the utilization rates of other groups in the cache memory are very low, the physical implementation manner of the cache memory miss processing module may cause the unbalanced utilization rate among the groups in the cache memory.
In view of the above problems in the prior art, the embodiment of the present invention adopts a cache miss processing module to which groups of utilization statistics modules are added, and referring to fig. 7B, a schematic diagram of the cache miss processing module according to the embodiment of the present invention includes the groups of utilization statistics modules and an intra-group cache replacement module. The main function of the group utilization counting module is to count the utilization of different groups in the cache memory, and accordingly determine whether there is an imbalance between the groups, for example, if the difference between the utilization of the most utilized group and the lowest utilized group in the cache memory exceeds a certain threshold, the imbalance between the groups can be determined. Thus, the prior art phenomenon of utilization imbalance among banks in a cache memory is overcome.
610: if the utilization rate of the first group is determined to be larger than or equal to the first utilization rate threshold value, the cache memory selects the data field with the lowest utilization rate in the first group according to the utilization rate of the data field corresponding to each label field in the first group;
611: the cache memory allocates the first group and the data field with the lowest utilization rate in the data fields respectively corresponding to each label field in the first group to the data to be accessed;
612: if the utilization rate of the first group is determined to be greater than or equal to the first utilization rate threshold value, the cache memory selects a second group with the lowest utilization rate in all the groups except the first group in the cache memory;
613: the cache memory selects the data domain with the lowest utilization rate in the data domain corresponding to each label domain in the second group according to the utilization rate of the data domain corresponding to each label domain in the second group;
614: the cache memory allocates the data domain with the lowest utilization rate in the data domains respectively corresponding to each label domain in the second group and the second group to the data to be accessed;
615: and if determining whether all data corresponding to the data to be accessed are stored in the data domain corresponding to the first tag domain according to the physical address information of the data to be accessed and the granularity information of the data to be accessed, acquiring a replaced data domain for distributing the data to be accessed and distributing the replaced data domain to the data to be accessed, wherein the replaced data domain comprises a data domain, the granularity of which is greater than and closest to the granularity information of the request to be accessed, of the data domains with different granularities corresponding to each tag domain in the first group.
For example, the cache memory may obtain and allocate a replaced data field of the data to be accessed to the data to be accessed according to the granularity information of the data to be accessed and the utilization rate of the data field corresponding to each tag field in the first group, or may also obtain and allocate the replaced data field of the data to be accessed to the data to be accessed by adopting other methods, which is not limited in the embodiment of the present invention.
616: the cache memory updates the tag field corresponding to the data field assigned to the data to be accessed.
For example, if the selected data domain group allocated to the data to be accessed is the group where the data domain is located, the "tag" in the tag domain corresponding to the data domain allocated to the data to be accessed needs to be changed into each attribute information in the tag bit information corresponding to the data to be accessed, and the attribute information is updated to the attribute information corresponding to the data to be accessed. And judging whether the data in the current data field needs to be written back to the next-level cache memory or the memory according to the attribute of the dirtv in the tag field. And then changing the tag in the tag field corresponding to the data field allocated to the data to be accessed into each attribute information in the tag bit information corresponding to the data to be accessed, and updating the attribute information into the attribute information corresponding to the data to be accessed.
If the selected group is not the first group corresponding to the request to be accessed, the tag fields in the first group and the tag fields in the selected group are both required to be updated according to the attribute of the data to be accessed.
The method for accessing data provided by the embodiment of the invention expands the attribute of the tag field in the cache memory, so that the tag field can correspond to the data field of the group and also can correspond to the data fields of other groups, thereby improving the utilization rate of the data field in the cache memory, and solving the problem of low utilization rate of the data field in the cache memory due to the fact that the tag field and the data field in the cache memory are in a fixed one-to-one correspondence relationship and are stored separately in the prior art.
EXAMPLE III
Referring to fig. 8, a schematic flow chart of another method for accessing data according to an embodiment of the present invention is shown, which includes the following steps:
801: the cache memory receives request information for accessing the data to be accessed, which is sent by the processor, wherein the request information comprises physical address information of the data to be accessed and granularity information of the data to be accessed;
illustratively, the physical address information of the data to be accessed is an address that is not aligned according to the cache line size.
802: the cache memory acquires a first group and tag bit information corresponding to the physical address information of the data to be accessed according to the physical address information of the data to be accessed, wherein the tag bit information is used for indicating a physical address corresponding to a data field corresponding to a tag field;
for example, the physical address information of the data to be accessed may be obtained by mapping the first group and the tag bit information corresponding to the physical address information of the data to be accessed through a hash algorithm in the prior art, or obtaining the first group and the tag bit information corresponding to the physical address information of the data to be accessed through other methods, which is not limited in this embodiment of the present invention.
803: the cache memory judges whether a label domain with a valid state bit exists in a first group in the cache memory according to the first group corresponding to the physical address information of the data to be accessed, wherein each group comprises N label domains and M data domains, the label domains correspond to the data domains one by one, the label domains and the data domains corresponding to one by one are in the same group or different groups, N is a natural number which is greater than or equal to 1, M is a natural number which is greater than or equal to 1 and N is greater than M, each label domain information comprises group identification information of the data domain corresponding to the label domain, in-group data domain offset information, label bit information, valid information of the data domain, "isptr" information, information whether the data domain is updated, data domain size information, "PtrS" information, start address information and end address information, the group identification information is used for indicating the group in which the data domain corresponding to the label domain is located, the data offset information in the group is used for indicating the offset of the data field in the group where the data field is located, whether the valid information of the data field is used for indicating that the data field corresponding to the tag field is accessed or not accessed by the processor, whether the data stored in the data field corresponding to the tag field is from the group corresponding to the data to be accessed or from other groups except the group corresponding to the data to be accessed, whether the data field is updated or not, and whether the data field size information is used for indicating the size of the data field corresponding to the tag field, if the 'isptr' information is used for indicating that the data stored in the data field corresponding to the tag field is from the group corresponding to the data to be accessed, the 'PtrS' information is null, if the 'isptr' information is used for indicating that the data stored in the data field corresponding to the tag field is from other groups except the group corresponding to the data to be accessed, the information of 'PtrS' is used for indicating that the data stored in the data field comes from the corresponding data field on the other group except the group corresponding to the data to be accessed, the start address information is used for indicating the start bit address of the data field corresponding to the label field, and the end address information is used for indicating the end bit address of the data field corresponding to the label field;
for example, in the embodiment of the present invention, the group identification information, the intra-group data domain offset information, the information whether the data domain is valid, the "isPtr" information, the tag bit information, the information whether the data domain is updated, the "PtrS" information, the data domain start address information, the data domain end address information, and the data domain size information of the data domain corresponding to the tag domain included in each tag domain information may be respectively identified by "set", "off", "valid", "isPtr", "tag", "dirty", "PtrS", "start", "end", and "size", or may be respectively identified by other identifiers, which is not limited in this embodiment of the present invention.
Referring to fig. 5, a schematic diagram of an organization structure in a cache according to an embodiment of the present invention is shown, where in the organization structure of the cache, tag fields and data fields are not in a fixed one-to-one correspondence relationship, and a tag field may point to any one data field in the same group as the tag field and may also point to other groups of data fields in different groups from the tag field, so that the number N of tag fields in the cache is greater than or equal to the number of data fields; in the physical implementation of the cache memory, the attributes of the tag field, such as "set", "off", "isPtr", "PtrS", "start", "end", and "size", are extended.
For example, in the prior art, the tag field includes three attributes "tag", "valid", and "dirty", where the tag bits and the physical address information of the data bits corresponding to the tag bits are in one-to-one correspondence, the "valid" is used to indicate whether the data field corresponding to the tag field is valid, and the "dirty" is used to indicate whether the data field corresponding to the tag field is updated.
For example, in the embodiment of the present invention, "tag", "valid" and "dirty" in the tag field are the same as those indicated by "tag", "valid" and "dirty" in the cache design in the prior art, and for the physical implementation of the attribute of the tag field of the cache in the prior art, the attribute information of the tag field is extended, and "set", "off", "isPtr", "PtrS", "start", "end" and "size" may be added in the tag field, and some other attributes related to the cache replacement policy may also be added in the tag field, for example, "accessCount" information may be added to indicate the frequency of statistics on which the data field corresponding to each tag field is accessed, which is not limited by the embodiment of the present invention.
For example, "set" in the tag field is used to indicate a position of a group where a data field corresponding to the tag field is stored, where the position may be the present group or other groups; the "off" in the tag field information is used to specify the offset of the data field within the set in which the data field is located, e.g., a way in a cache design. Illustratively, in the cache design in the prior art, the location of the data field in the cache is addressed according to the set and way number of the data field where the data field currently locates, but in the embodiment of the present invention, because the organization structure and physical implementation of the cache are different from those in the prior art, the location of the data field in the cache needs to determine the set and way number of the data field according to the values of "set" and "off" of the tag field corresponding to the data field, so as to obtain the location of the data field according to the set and way number of the data field, and if the value of "set" is not the set where the data field currently locates, "set" and "off" can be used as tag fields pointing to other sets, and the data field corresponding to the tag field stores the data of the address corresponding to the tag field.
"start" and "end" in the tag field are used to identify the start and end addresses to which the data in the data field corresponding to the tag field corresponds, which are offsets within the maximum granularity of a relative cache line. For example, if the maximum granularity of a cache line is 64 bytes, and the data length in the data field is only 8 bytes and the 8 bytes are just the first 8 bytes of the 64 bytes, then the start address of the data is 0 and the end address is 7.
Illustratively, the tag field in which the presence status bit is valid includes whether the data field is valid or not and the "isPtr" information is valid, and if the data field in the tag field is valid or not, the "isPtr" information is denoted by "isPtr", the "valid" is valid for indicating that the data field is accessed by the processor, the "valid" is valid by "is", the "valid" is invalid for indicating that the data field is not accessed by the processor, and the "valid" is invalid by "no"; "isPtr" valid indicates that the data stored in the data field corresponding to the tag field is from the group corresponding to the data to be accessed, "isPtr" valid "may be represented by" no, "and" isPtr "invalid indicates that the data stored in the data field corresponding to the tag field is from the other group except the group corresponding to the data to be accessed, and" isPtr "invalid may be represented by" is. Thus, the tag field with the presence status bit valid may contain a "valid" to "is" and an "isPtr" bit to "no".
Tag fields in which the no-present status bit is valid include "valid" as "no" and "isPtr" as "no", or "valid" as "is" and "isPtr" as "is", or "valid" as "no" and "isPtr" as "is".
804: if the first group in the cache memory is determined to have the label domain with the valid state bit, the cache memory judges whether the label domain with the valid state bit in the cache memory has the label domain equal to the label domain corresponding to the physical address information of the data to be accessed according to the label bit information corresponding to the physical address information of the data to be accessed;
805: if the tag field with the valid state bit in the cache memory is determined to be a first tag field with tag bit information equal to the tag bit information corresponding to the physical address information of the data to be accessed, the cache memory reads a start bit address and an end bit address of a data field corresponding to the first tag field in the first tag field;
806: the cache memory judges whether all data corresponding to the data to be accessed are stored in a data domain corresponding to a first data domain according to the physical address information of the data to be accessed and the granularity information of the data to be accessed;
for example, when determining whether the data to be accessed is stored in the data field corresponding to the first data field, the physical address of the data to be accessed may be aligned with the start address bit in the first data field, and then determining whether the data to be accessed is stored in the data field corresponding to the first data field according to the granularity information of the data to be accessed, for example, 9 bytes of data with a start address bit of 0 and an end address bit of 8 in the first data field, where the start address of the physical address information of the data to be accessed is 3 and the granularity information is 10, the start address 3 of the physical address of the data to be accessed is aligned with the start address bit 0 of the data field corresponding to the first data field, and one of the data is checked, and when the data field corresponding to the first data field reaches the end address 8, the physical address of the data to be accessed reaches 11, only 9 bytes, and the granularity of the information to be accessed is 10 bytes, therefore, it can be determined that the data to be accessed cannot be stored in the data field corresponding to the first data field.
807: if all the data corresponding to the data to be accessed are stored in the data domain corresponding to the first data domain, the cache memory acquires the position of the data domain corresponding to the first tag domain according to the group identification information in the first tag domain and the offset information of the data domain in the group;
808: the cache memory acquires a data field corresponding to the first label field according to the position of the data field corresponding to the first data field;
809: if the first group corresponding to the physical address information of the data to be accessed determines whether a tag field with a valid state bit exists in the first group in the cache memory, or if the first group corresponding to the physical address information of the data to be accessed determines that the tag field with a valid state bit exists in the first group in the storage system and if the tag field with a valid state bit exists in the tag field corresponding to the physical address information of the data to be accessed, the cache memory acquires a group for allocating the data to be accessed and offset information of the data field in the group and allocates the offset information to the data to be accessed, wherein the tag field with a valid state bit contains a group indicating that the data field corresponding to the tag field is not accessed by the processor and indicating that the data stored in the data field corresponding to the tag field is from the group corresponding to the data to be accessed, or, the data domain corresponding to the tag domain is indicated to be accessed by the processor and the data stored in the data domain corresponding to the tag domain is indicated to be from a group other than the group corresponding to the data to be accessed, or the data domain corresponding to the tag domain is indicated to be not accessed by the processor and the data stored in the data domain corresponding to the tag domain is indicated to be from a group other than the group corresponding to the data to be accessed;
for example, the cache memory may obtain, according to the utilization rate of the data field corresponding to each tag field in the first group, the group to which the data to be accessed is allocated and the offset information of the data field in the group, and allocate the group to which the data to be accessed is allocated and the offset information of the data field in the group, and may also obtain, by another method, the group to which the data to be accessed is allocated and the offset information of the data field in the group, and allocate the offset information to the data to be accessed.
810: if all data corresponding to the data to be accessed are determined not to be stored in the data domain corresponding to the first tag domain according to the physical address information of the data to be accessed and the granularity information of the data to be accessed, judging whether the utilization rate of a replaced data domain in the first group is greater than or equal to a second utilization rate threshold value, wherein the replaced data domain comprises a data domain, the granularity of which is greater than and closest to the granularity information of the request to be accessed, of data domains with different granularities corresponding to each tag domain in the first group;
for example, the second utilization threshold may be obtained according to a utilization rate of utilization imbalance among data fields corresponding to each tag field in each group in the cache memory, and a utilization rate of a data field corresponding to each tag field, or may be obtained by other manners, which is not limited in this embodiment of the present invention.
For example, the utilization rate may be obtained by counting the number of access requests in the data field, or may be obtained by other methods, which is not limited in this embodiment of the present invention.
811: if the utilization rate of the replaced data domain in the first group is determined to be larger than or equal to a second utilization rate threshold value according to the utilization rate of the data domain with different granularities corresponding to each label domain in the first group respectively, and the utilization rates of a plurality of second data domains in all the data domains with different granularities except the replaced data domain in the first group are smaller than a second access threshold value, the cache memory merges the plurality of second data domains into the replaced data domain and distributes the replaced data domain to the data to be accessed, wherein the second data domain comprises the data domains with the granularity smaller than the granularity of the replaced data domain in all the data domains with different granularities except the replaced data domain in the first group;
illustratively, in the prior art, the size of the data field in the cache memory line is the size of the data field to be accessed, which is allocated according to the granularity information of the data to be accessed sent and accessed by the processor. Thus, the size of the data field is directly related to the data to be accessed and is arbitrary. To improve efficiency, data with consecutive addresses but in different cache lines are merged into one large cache line. To implement a variable-granularity cache line, the tag field and the data field of the cache line are stored together and sequentially in the same cache, with each location in the cache storing both the tag field and possibly the data field. The size of each cache line is determined by the granularity information of the data to be accessed, and each tag field is added with additional attributes, such as the number of bytes at the beginning and the number of bytes at the end. The method can ensure that the contents in the cache memory line are all really accessed effectively, no idle data which are not accessed exists, but because each memory cell can be a tag field, and the cache memory needs to compare whether a tag bit in the tag field is equal to a tag bit corresponding to the data to be accessed when each processor sends a request for accessing the data to be accessed, a comparator needs to be added to every two adjacent memory cells, so that the structure of the whole cache memory needs to be greatly modified, and the delay and the power consumption are obviously increased.
In view of the above problems in the prior art, an embodiment of the present invention provides an implementation manner of a variable-granularity cache, and referring to fig. 9, a schematic diagram of a variable-granularity cache according to an embodiment of the present invention is provided, as shown in the figure, a cache includes data fields with multiple granularities, and the length of the data fields is variable. A request granularity counting module and a data field merging and splitting module are added in a cache memory to realize variable granularity data fields, and the request granularity counting module is mainly used for counting the utilization rate of requests with different granularities; the data domain merging and splitting module is mainly used for splitting a data domain with large granularity into a plurality of data domains with small granularity and merging the data domains with small granularity into a data domain with large granularity. When the data domain merging and splitting module merges adjacent small-granularity data blocks into a large-granularity data block, the attributes of start, end and size in a label domain corresponding to each small-granularity data block need to be modified simultaneously and respectively, and redundant data domains are set to be invalid; when the data domain merging and splitting module splits a large-granularity data domain into a plurality of small-granularity data domains, the 'start' bit, the 'end' bit and the 'size' in the tag bit corresponding to the large-granularity data domain need to be modified simultaneously, the tag bit corresponds to one of the split small-granularity data domains, and an additional tag domain needs to be allocated to correspond to the other split data domains.
812: if the utilization rate of the replaced data domain in the first group is determined to be larger than or equal to a second utilization rate threshold value according to the utilization rate of the data domain with different granularities corresponding to each label domain in the first group, and the utilization rate of a third data domain in all the data domains with different granularities except the replaced data domain in the first group is smaller than a second access threshold value, the cache memory divides the third data domain into one or more replaced data domains and distributes the replaced data domains to the data to be accessed, wherein the third data domain comprises the data domain with the granularity larger than that of the replaced data domain in all the data domains with different granularities except the replaced data domain in the first group;
813: and if the utilization rate of the replaced data field in the first group is determined to be larger than or equal to the second utilization rate threshold value according to the utilization rate of the data field with different granularities corresponding to each label field in the first group, the cache memory allocates the replaced data field to the data to be accessed.
814: the cache memory updates the tag field corresponding to the data field assigned to the data to be accessed.
Illustratively, the updating of the attribute information of the tag field corresponding to the data field assigned to the data to be accessed by the cache memory is specifically described in step 811.
The method for accessing data provided by the embodiment of the invention expands the attribute of the tag field in the cache memory, so that the tag field can correspond to the data field of the group and also can correspond to the data fields of other groups, thereby improving the utilization rate of the data field in the cache memory, and solving the problem of low utilization rate of the data field in the cache memory due to the fact that the tag field and the data field in the cache memory are in a fixed one-to-one correspondence relationship and are stored separately in the prior art.
Illustratively, an application scenario of an embodiment of the present invention includes a host comprising at least one processor comprising a plurality of levels of set associative cache memory.
In another aspect, an embodiment of the present invention provides a cache memory 10, as shown in fig. 10 or 11, which may include:
a receiving unit 1001, configured to receive request information for accessing to-be-accessed data sent by a processor, where the request information includes physical address information of the to-be-accessed data;
an obtaining unit 1002, configured to obtain, according to physical address information of data to be accessed, a tag field corresponding to the physical address information of the data to be accessed; the method comprises the steps of obtaining data domains corresponding to tag domains according to group identification information and in-group data domain offset information in tag domain information corresponding to physical address information, wherein each group comprises N tag domains and M data domains, the tag domains correspond to the data domains one to one, the tag domains and the data domains corresponding to the data domains one to one are in the same group or different groups, N is a natural number greater than or equal to 1, M is a natural number greater than or equal to 1 and N is greater than M, each tag domain information comprises group identification information and in-group data domain offset information of the data domains corresponding to the tag domains, the group identification information is used for indicating the group where the data domains corresponding to the tag domains are located, and the in-group data offset information is used for indicating the offset of the data domains in the group where the data domains are located.
Illustratively, each tag field information also contains tag bit information, data field validity information, "isptr" information,
wherein, the tag bit information is used to indicate the physical address corresponding to the data field corresponding to the tag field, whether the valid information of the data field is used to indicate that the data field corresponding to the tag field is accessed by the processor or not, the "isptr" information is used to indicate whether the data stored in the data field corresponding to the tag field is from the group corresponding to the data to be accessed or from other groups except the group corresponding to the data to be accessed,
accordingly, the method can be used for solving the problems that,
the obtaining unit 1002 is further configured to: acquiring a first group and tag bit information corresponding to the physical address information of the data to be accessed according to the physical address information of the data to be accessed;
if the label domain with the valid state bit exists in the first group of the storage system according to the first group corresponding to the physical address information of the data to be accessed, and if the label domain with the valid state bit exists in the label domain with the valid state bit and is equal to the label domain corresponding to the physical address information of the data to be accessed according to the label bit information corresponding to the physical address information of the data to be accessed, the first label domain with the valid state bit in the label domain and the label domain corresponding to the physical address information of the data to be accessed is obtained, wherein the label domain with the valid state bit contains the group which indicates that the data domain is accessed by the processor and indicates that the data stored in the data domain corresponding to the label domain comes from the data to be accessed.
Illustratively, each tag field information also contains tag bit information, data field validity information, "isptr" information,
wherein, the tag bit information is used to indicate the physical address corresponding to the data field corresponding to the tag field, whether the valid information of the data field is used to indicate that the data field corresponding to the tag field is accessed by the processor or not, the "isptr" information is used to indicate whether the data stored in the data field corresponding to the tag field is from the group corresponding to the data to be accessed or from other groups except the group corresponding to the data to be accessed,
accordingly, the method can be used for solving the problems that,
the obtaining unit 1002 is further configured to: acquiring a first group and tag bit information corresponding to the physical address information of the data to be accessed according to the physical address information of the data to be accessed;
if the first group corresponding to the physical address information of the data to be accessed does not have a tag field with a valid status bit, or if the first group corresponding to the physical address information of the data to be accessed determines that the tag field with a valid status bit exists in the first group in the storage system, and if the tag field with a valid status bit does not exist in the tag field corresponding to the physical address information of the data to be accessed, the tag field with the valid status bit is equal to the tag field corresponding to the physical address information of the data to be accessed, the offset information of the data field in the group and the data field in the group are acquired and allocated to the data to be accessed, wherein the tag field without valid status bit contains an indication that the data field corresponding to the tag field is not accessed by the processor and an indication that the data stored in the data field corresponding to the tag field is from the group corresponding to the data to be accessed, or the data domain corresponding to the indication label domain is accessed by the processor and the data stored in the data domain corresponding to the indication label domain is from other groups except the group corresponding to the data to be accessed, or the data domain corresponding to the indication label domain is not accessed by the processor and the data stored in the data domain corresponding to the indication label domain is from other groups except the group corresponding to the data to be accessed.
Illustratively, the obtaining unit 1002 further includes:
a selecting module 10001, configured to select, according to the utilization rate of each tag domain in the first group, a data domain with a lowest utilization rate in the data domains corresponding to each tag domain in the first group if it is determined that the utilization rate corresponding to the first group is smaller than the first utilization rate threshold according to the utilization rate corresponding to each group in the storage system;
an allocating module 10002 is configured to allocate the first group and the data field with the lowest utilization rate in the data fields corresponding to each tag field in the first group to the data to be accessed.
Illustratively, the selection module 10001 is further configured to: if the utilization rate corresponding to the first group is determined to be larger than or equal to the first utilization rate threshold value according to the utilization rate corresponding to each group in the storage system, selecting a second group with the lowest utilization rate in all the groups except the first group in the storage system; selecting the data domain with the lowest utilization rate in the data domains respectively corresponding to each label domain in the second group according to the utilization rate of the data domain respectively corresponding to each label domain in the second group;
the assignment module 10002 is further configured to: and allocating the data domain with the lowest utilization rate in the data domains corresponding to each label domain in the second group and the second group to the data to be accessed.
Illustratively, each tag field further contains start address information, end address information of the data field corresponding to the tag field,
the start address information is used for indicating the start bit address of the data field corresponding to the tag field, the end address information is used for indicating the end bit address of the data field corresponding to the tag field,
the request information also contains granularity information of the data to be accessed,
accordingly, the method can be used for solving the problems that,
the acquisition unit 1002 further includes:
a reading module 10003, configured to read a start bit address and an end bit address of a data field corresponding to the first tag field in the first tag field;
the obtaining unit 1002 is further configured to: if all data corresponding to the data to be accessed are determined to be stored in the data domain corresponding to the first tag domain according to the physical address information of the data to be accessed and the granularity information of the data to be accessed, the position of the data domain corresponding to the first tag domain is obtained according to the group identification information in the first tag domain and the offset information of the data domain in the group; and acquiring the data domain corresponding to the first label domain according to the position of the data domain corresponding to the first label domain.
Illustratively, each tag field further contains start address information, end address information of the data field corresponding to the tag field,
the start address information is used for indicating the start bit address of the data field corresponding to the tag field, the end address information is used for indicating the end bit address of the data field corresponding to the tag field,
the request information also contains granularity information of the data to be accessed,
accordingly, the method can be used for solving the problems that,
the read module 10003 is further configured to: reading a start bit address and an end bit address indicating a data field corresponding to the first tag field in the first tag field;
the obtaining unit 1002 is further configured to: if all data corresponding to the data to be accessed are determined not to be stored in the data domain corresponding to the first tag domain according to the physical address information of the data to be accessed and the granularity information of the data to be accessed, a replaced data domain for distributing the data to be accessed is obtained and distributed to the data to be accessed, wherein the replaced data domain comprises a data domain, the granularity of which is greater than and closest to the granularity information of the request to be accessed, of the data domains with different granularities corresponding to each tag domain in the first group.
Illustratively, the obtaining unit 1002 further includes:
a merging module 10004, configured to, if it is determined that the utilization rate of the replaced data domain in the first group is greater than or equal to the second utilization rate threshold according to the utilization rate of the data domain with different granularity corresponding to each tag domain in the first group, and the utilization rates of the plurality of second data domains in all the data domains with different granularities in the first group except the replaced data domain are all smaller than the second access threshold, merge the plurality of second data domains into the replaced data domain and allocate the replaced data domain to the data to be accessed, where the second data domain includes the data domain with the granularity smaller than the granularity of the replaced data domain in all the data domains with different granularities in the first group except the replaced data domain;
or,
the acquisition unit 1002 further includes:
a splitting module 10005, configured to, if it is determined that the utilization rate of the replaced data domain in the first group is greater than or equal to the second utilization rate threshold according to the utilization rate of the data domain with different granularity corresponding to each tag domain in the first group, and the utilization rate of a third data domain in all data domains with different granularities in the first group except the replaced data domain is smaller than the second access threshold, split the third data domain of the third data domain into one or more replaced data domains and allocate the one or more replaced data domains to the data to be accessed, where the third data domain of the third data domain includes data domains with granularity greater than that of the replaced data domain corresponding to all data domains with different granularities in the first group except the replaced data domain;
or,
the assignment module 10002 is further configured to: and if the utilization rate of the replaced data domain in the first group is determined to be smaller than the second utilization rate threshold according to the utilization rate of the data domain with different granularity corresponding to each label domain in the first group, the replaced data domain is allocated to the data to be accessed.
The cache memory 10 may further include:
an updating unit 1003, configured to update the tag field corresponding to the data field allocated to the data to be accessed.
The cache memory 10 provided in the embodiment of the present invention expands the attributes of the tag fields in the cache memory 10, so that the tag fields can correspond to the data fields of the group and also correspond to the data fields of other groups, thereby improving the utilization rate of the data fields in the cache memory 10, and solving the problem in the prior art that the utilization rate of the data fields in the cache memory 10 is low because the tag fields and the data fields in the cache memory 10 are in a fixed one-to-one correspondence and are stored separately.
In another aspect, an embodiment of the present invention provides a cache memory 10, which may include a receiver 1201, a memory 1202, and at least one communication bus 1203 for connecting devices inside the cache memory 10, so as to implement connection and intercommunication between these devices.
The communication bus 1203 may be an Industry Standard Architecture (ISA) bus, a Peripheral Component Interconnect (PCI) bus, an Extended ISA (EISA) bus, or the like. The bus 1203 may be divided into an address bus, a data bus, a control bus, etc. For ease of illustration, only one thick line is shown in fig. 12 or 13, but this does not indicate only one bus or one type of bus.
Memory 1202 may include both read-only memory and random access memory, and provides instructions and data to processor 1002.
As shown in fig. 12 or 13, the cache memory 10 may include:
a receiver 1201, configured to receive request information for accessing to-be-accessed data sent by a processor, where the request information includes physical address information of the to-be-accessed data;
the cache memory 10 may also be used for: acquiring a label domain corresponding to the physical address information of the data to be accessed according to the physical address information of the data to be accessed; the method comprises the steps of obtaining data domains corresponding to tag domains according to group identification information and in-group data domain offset information in tag domain information corresponding to physical address information, wherein each group comprises N tag domains and M data domains, the tag domains correspond to the data domains one to one, the tag domains and the data domains corresponding to the data domains one to one are in the same group or different groups, N is a natural number greater than or equal to 1, M is a natural number greater than or equal to 1 and N is greater than M, each tag domain information comprises group identification information and in-group data domain offset information of the data domains corresponding to the tag domains, the group identification information is used for indicating the group where the data domains corresponding to the tag domains are located, and the in-group data offset information is used for indicating the offset of the data domains in the group where the data domains are located.
Illustratively, each tag field information also contains tag bit information, data field validity information, "isptr" information,
wherein, the tag bit information is used to indicate the physical address corresponding to the data field corresponding to the tag field, whether the valid information of the data field is used to indicate that the data field corresponding to the tag field is accessed by the processor or not, the "isptr" information is used to indicate whether the data stored in the data field corresponding to the tag field is from the group corresponding to the data to be accessed or from other groups except the group corresponding to the data to be accessed,
accordingly, the method can be used for solving the problems that,
the cache memory 10 may also be used for: acquiring a first group and tag bit information corresponding to the physical address information of the data to be accessed according to the physical address information of the data to be accessed;
if the label domain with the valid state bit exists in the first group of the storage system according to the first group corresponding to the physical address information of the data to be accessed, and if the label domain with the valid state bit exists in the label domain with the valid state bit and is equal to the label domain corresponding to the physical address information of the data to be accessed according to the label bit information corresponding to the physical address information of the data to be accessed, the first label domain with the valid state bit in the label domain and the label domain corresponding to the physical address information of the data to be accessed is obtained, wherein the label domain with the valid state bit contains the group which indicates that the data domain is accessed by the processor and indicates that the data stored in the data domain corresponding to the label domain comes from the data to be accessed.
Illustratively, each tag field information also contains tag bit information, data field validity information, "isptr" information,
wherein, the tag bit information is used to indicate the physical address corresponding to the data field corresponding to the tag field, whether the valid information of the data field is used to indicate that the data field corresponding to the tag field is accessed by the processor or not, the "isptr" information is used to indicate whether the data stored in the data field corresponding to the tag field is from the group corresponding to the data to be accessed or from other groups except the group corresponding to the data to be accessed,
accordingly, the method can be used for solving the problems that,
the cache memory 10 may also be used for: acquiring a first group and tag bit information corresponding to the physical address information of the data to be accessed according to the physical address information of the data to be accessed;
if the first group corresponding to the physical address information of the data to be accessed does not have a tag field with a valid status bit, or if the first group corresponding to the physical address information of the data to be accessed determines that the tag field with a valid status bit exists in the first group in the storage system, and if the tag field with a valid status bit does not exist in the tag field corresponding to the physical address information of the data to be accessed, the tag field with the valid status bit is equal to the tag field corresponding to the physical address information of the data to be accessed, the offset information of the data field in the group and the data field in the group are acquired and allocated to the data to be accessed, wherein the tag field without valid status bit contains an indication that the data field corresponding to the tag field is not accessed by the processor and an indication that the data stored in the data field corresponding to the tag field is from the group corresponding to the data to be accessed, or the data domain corresponding to the indication label domain is accessed by the processor and the data stored in the data domain corresponding to the indication label domain is from other groups except the group corresponding to the data to be accessed, or the data domain corresponding to the indication label domain is not accessed by the processor and the data stored in the data domain corresponding to the indication label domain is from other groups except the group corresponding to the data to be accessed.
Illustratively, the cache memory 10 may further include: a cache miss module 1204 for a processing module in the event of a processor access miss, the cache miss module 1204 further comprising: the intra-group cache replacement module 12001 and the group utilization statistics module 12002 are respectively used for counting the utilization of the data fields corresponding to the tag fields in each group in the cache and for counting the utilization of each group in the cache.
Illustratively, the cache memory 10 may also be used for: if it is determined that the utilization rate corresponding to the first group is smaller than the first utilization rate threshold according to the group utilization rate statistic module 12002 in the cache memory 10, the cache memory 10 is configured to select, according to the intra-group cache memory replacement module 12001, a data field with the lowest utilization rate among the data fields corresponding to each tag field in the first group, respectively; and allocating the data fields with the lowest utilization rate in the data fields respectively corresponding to the tag fields in the first group and the first group to the data to be accessed.
Illustratively, the cache memory 10 may also be used for: if it is determined that the utilization rate corresponding to the first group is greater than or equal to the first utilization rate threshold according to the utilization rate statistics module 12002 of each group in the cache memory 10, selecting a second group with the lowest utilization rate from all the groups except the first group in the cache memory 10; selecting the data field with the lowest utilization rate in the data fields respectively corresponding to each tag field in the second group according to the intra-group cache replacement module 12001; and allocating the data domain with the lowest utilization rate in the data domains corresponding to each label domain in the second group and the second group to the data to be accessed.
Illustratively, each tag field further contains start address information, end address information of the data field corresponding to the tag field,
the start address information is used for indicating the start bit address of the data field corresponding to the tag field, the end address information is used for indicating the end bit address of the data field corresponding to the tag field,
the request information also contains granularity information of the data to be accessed,
accordingly, the cache memory 10 may also be used for: reading a start bit address and an end bit address indicating a data field corresponding to the first tag field in the first tag field; if all data corresponding to the data to be accessed are determined to be stored in the data domain corresponding to the first tag domain according to the physical address information of the data to be accessed and the granularity information of the data to be accessed, the position of the data domain corresponding to the first tag domain is obtained according to the group identification information in the first tag domain and the offset information of the data domain in the group; and acquiring the data domain corresponding to the first label domain according to the position of the data domain corresponding to the first label domain.
Illustratively, each tag field further contains start address information, end address information of the data field corresponding to the tag field,
the start address information is used for indicating the start bit address of the data field corresponding to the tag field, the end address information is used for indicating the end bit address of the data field corresponding to the tag field,
the request information also contains granularity information of the data to be accessed,
accordingly, the method can be used for solving the problems that,
the cache memory 10 may also be used for: reading a start bit address and an end bit address indicating a data field corresponding to the first tag field in the first tag field; if all data corresponding to the data to be accessed are determined not to be stored in the data domain corresponding to the first tag domain according to the physical address information of the data to be accessed and the granularity information of the data to be accessed, a replaced data domain for distributing the data to be accessed is obtained and distributed to the data to be accessed, wherein the replaced data domain comprises a data domain, the granularity of which is greater than and closest to the granularity information of the request to be accessed, of the data domains with different granularities corresponding to each tag domain in the first group.
Illustratively, the cache memory 10 may further include a data field merging and splitting module 1205 and a request granularity counting module 1206, where the data field merging and splitting module 1205 is used for merging or splitting data fields with different granularities in the cache memory 10, and the request granularity counting module 1206 is used for counting utilization rates of the data fields with different granularities.
Illustratively, the data domain merging and splitting module 1205 may be further configured to: if it is determined by the request granularity statistics module 1206 that the utilization of the replaced data field in the first group is greater than or equal to the second utilization threshold and the utilization of the second data fields in all the data fields with different granularities in the first group except the replaced data field is less than the second access threshold, the data field merging and splitting module 1205 is configured to merge the second data fields into the replaced data field and allocate the replaced data field to the data to be accessed, where the second data field includes the data fields in the first group except the replaced data field with the granularity less than the granularity of the replaced data field;
or,
the data domain merge and split module 1205 may also be configured to: if it is determined by the request granularity statistics module 1206 that the utilization of the replaced data field in the first group is greater than or equal to the second utilization threshold and the utilization of a third data field in all data fields with different granularities except the replaced data field in the first group is smaller than the second access threshold, the data field merging and splitting module 1205 is configured to split the third data field into one or more replaced data fields and allocate the one or more replaced data fields to the data to be accessed, where the third data field includes data fields with granularities larger than the granularity of the replaced data field in corresponding data fields in all data fields with different granularities except the replaced data field in the first group;
or,
the data domain merge and split module 1205 may also be configured to: if it is determined by the request granularity statistics module 1206 that the utilization of the replaced data field in the first group is smaller than the second utilization threshold, the data field merging and splitting module 1205 is configured to allocate the replaced data field to the data to be accessed.
The cache memory 10 provided in the embodiment of the present invention expands the attributes of the tag fields in the cache memory 10, so that the tag fields can correspond to the data fields of the group and also correspond to the data fields of other groups, thereby improving the utilization rate of the data fields in the cache memory 10, and solving the problem in the prior art that the utilization rate of the data fields in the cache memory 10 is low because the tag fields and the data fields in the cache memory 10 are in a fixed one-to-one correspondence and are stored separately.
It is clear to those skilled in the art that, for convenience and brevity of description, the specific working processes of the above-described systems, apparatuses and units may refer to the corresponding processes in the foregoing method embodiments, and are not described herein again.
In the several embodiments provided in the present application, it should be understood that the disclosed system, apparatus and method may be implemented in other manners. For example, the above-described apparatus embodiments are merely illustrative, and for example, the division of the units is only one logical division, and other divisions may be realized in practice, for example, a plurality of units or components may be combined or integrated into another system, or some features may be omitted, or not executed. In addition, the shown or discussed mutual coupling or direct coupling or communication connection may be an indirect coupling or communication connection through some interfaces, devices or units, and may be in an electrical, mechanical or other form.
The units described as separate parts may or may not be physically separate, and parts displayed as units may or may not be physical units, may be located in one place, or may be distributed on a plurality of network units. Some or all of the units can be selected according to actual needs to achieve the purpose of the solution of the embodiment.
In addition, functional units in the embodiments of the present invention may be integrated into one processing unit, or each unit may be physically included alone, or two or more units may be integrated into one unit. The integrated unit can be realized in a form of hardware, or in a form of hardware plus a software functional unit.
The integrated unit implemented in the form of a software functional unit may be stored in a computer readable storage medium. The software functional unit is stored in a storage medium and includes several instructions for causing a computer device (which may be a personal computer, a server, or a network device) to execute some steps of the methods according to the embodiments of the present invention. And the aforementioned storage medium includes: various media capable of storing program codes, such as a usb disk, a removable hard disk, a Read-Only Memory (ROM), a Random Access Memory (RAM), a magnetic disk, or an optical disk.
Finally, it should be noted that: the above examples are only intended to illustrate the technical solution of the present invention, but not to limit it; although the present invention has been described in detail with reference to the foregoing embodiments, it will be understood by those of ordinary skill in the art that: the technical solutions described in the foregoing embodiments may still be modified, or some technical features may be equivalently replaced; and such modifications or substitutions do not depart from the spirit and scope of the corresponding technical solutions of the embodiments of the present invention.

Claims (18)

1. A method of accessing data, comprising:
receiving request information for accessing to-be-accessed data sent by a processor, wherein the request information comprises physical address information of the to-be-accessed data;
acquiring a label domain corresponding to the physical address information of the data to be accessed according to the physical address information of the data to be accessed;
acquiring a data domain corresponding to the tag domain according to the group identification information and the offset information of the data domain in the group in the tag domain information corresponding to the physical address information, wherein each group comprises N tag fields and M data fields, the tag fields correspond to the data fields one to one, and the tag fields and the data fields corresponding to one are in the same group or different groups, n is a natural number greater than or equal to 1, M is a natural number greater than or equal to 1 and N is greater than M, each tag field information includes group identification information of the data field corresponding to the tag field, and intra-group data field offset information, the group identification information is used for indicating a group where the data domain corresponding to the tag domain is located, and the data offset information in the group is used for indicating an offset of the data domain in the group where the data domain is located.
2. The method of claim 1, wherein each of the tag field information further includes tag bit information, data field validity information, "isptr" information,
wherein the tag bit information is used to indicate a physical address corresponding to the data field corresponding to the tag field, the data field validity information is used to indicate whether the data field corresponding to the tag field is accessed by the processor or not accessed by the processor, and the 'isptr' information is used to indicate whether the data stored in the data field corresponding to the tag field originates from the group corresponding to the data to be accessed or originates from another group except the group corresponding to the data to be accessed,
accordingly, the method can be used for solving the problems that,
the acquiring the tag domain corresponding to the physical address information of the data to be accessed according to the physical address information of the data to be accessed includes:
acquiring a first group and tag bit information corresponding to the physical address information of the data to be accessed according to the physical address information of the data to be accessed;
if a tag domain with a valid state bit exists in a first group of a storage system according to the first group corresponding to the physical address information of the data to be accessed and if a tag domain with a valid state bit equal to the tag bit information corresponding to the physical address information of the data to be accessed exists in the tag domain with a valid state bit according to the tag bit information corresponding to the physical address information of the data to be accessed, a first tag domain with a valid state bit in the tag domain in the storage system is acquired, wherein the tag domain with the valid state bit contains a tag field which indicates that the data domain is accessed by the processor and indicates that the data stored in the data domain corresponding to the tag field is from the group corresponding to the data to be accessed.
3. The method of claim 1, wherein each of the tag field information further includes tag bit information, data field validity information, "isptr" information,
wherein the tag bit information is used to indicate a physical address corresponding to the data field corresponding to the tag field, the data field validity information is used to indicate whether the data field corresponding to the tag field is accessed by the processor or not accessed by the processor, and the 'isptr' information is used to indicate whether the data stored in the data field corresponding to the tag field originates from the group corresponding to the data to be accessed or originates from another group except the group corresponding to the data to be accessed,
accordingly, the method can be used for solving the problems that,
the acquiring the tag domain corresponding to the physical address information of the data to be accessed according to the physical address information of the data to be accessed includes:
acquiring a first group and tag bit information corresponding to the physical address information of the data to be accessed according to the physical address information of the data to be accessed;
if a tag domain with an effective state bit does not exist in a first group in a storage system according to the first group corresponding to the physical address information of the data to be accessed, or if a tag domain with an effective state bit exists in the first group in the storage system according to the first group corresponding to the physical address information of the data to be accessed and if a tag domain with an effective state bit does not exist in the tag domain with an effective state bit in the first group according to the tag bit information corresponding to the physical address information of the data to be accessed, acquiring offset information of the group and the intra-group data domain which are allocated with the data to be accessed and allocating the offset information to the data to be accessed, wherein the tag domain with the effective state bit does not include a data domain which indicates that the data domain corresponding to the tag domain is not accessed by the processor and indicates that the data stored in the data domain corresponding to the tag domain is from the group corresponding to the data to be accessed Or, the data field corresponding to the tag field is indicated to be accessed by the processor and the data stored in the data field corresponding to the tag field is indicated to be derived from a group other than the group corresponding to the data to be accessed, or the data field corresponding to the tag field is indicated to be not accessed by the processor and the data stored in the data field corresponding to the tag field is indicated to be derived from a group other than the group corresponding to the data to be accessed.
4. The method of claim 3,
the acquiring and distributing the group of the data to be accessed and the offset information of the data domain in the group to the data to be accessed comprises the following steps:
if the utilization rate corresponding to the first group is determined to be smaller than a first utilization rate threshold value according to the utilization rate corresponding to each group in the storage system, selecting the data domain with the lowest utilization rate in the data domains corresponding to each label domain in the first group according to the utilization rate of the data domain corresponding to each label domain in the first group;
and allocating the data domain with the lowest utilization rate in the data domains corresponding to the first group and each label domain in the first group to the data to be accessed.
5. The method of claim 3,
the acquiring and distributing the group of the data to be accessed and the offset information of the data domain in the group to the data to be accessed comprises the following steps:
if the utilization rate corresponding to the first group is determined to be larger than or equal to the first utilization rate threshold value according to the utilization rate corresponding to each group in the storage system, selecting a second group with the lowest utilization rate in all the groups except the first group in the storage system;
selecting the data domain with the lowest utilization rate in the data domains respectively corresponding to each label domain in the second group according to the utilization rate of the data domain respectively corresponding to each label domain in the second group;
and allocating the data domain with the lowest utilization rate in the data domains corresponding to each label domain in the second group and the second group to the data to be accessed.
6. The method according to claim 1 or 2,
each of the tag fields further includes start address information and end address information of the data field corresponding to the tag field,
the start address information is used to indicate the start bit address of the data field corresponding to the tag field, the end address information is used to indicate the end bit address of the data field corresponding to the tag field,
the request information also contains granularity information of the data to be accessed,
accordingly, the method can be used for solving the problems that,
acquiring a data domain corresponding to the tag domain according to the group identification information and the in-group data domain offset information in the tag domain information corresponding to the physical address information, including:
reading a start bit address and an end bit address of a data field corresponding to the first tag field in the first tag field;
if all data corresponding to the data to be accessed are determined to be stored in the data domain corresponding to the first tag domain according to the physical address information of the data to be accessed and the granularity information of the data to be accessed, the position of the data domain corresponding to the first tag domain is obtained according to the group identification information in the first tag domain and the offset information of the data domain in the group;
and acquiring the data domain corresponding to the first label domain according to the position of the data domain corresponding to the first label domain.
7. The method according to claim 1 or 2,
each of the tag fields further includes start address information and end address information of the data field corresponding to the tag field,
the start address information is used for indicating a start bit address of the data field corresponding to the tag field, the end address information is used for indicating an end bit address of the data field corresponding to the tag field,
the request information also contains granularity information of the data to be accessed,
accordingly, the method can be used for solving the problems that,
acquiring a data domain corresponding to the tag domain according to the group identification information and the in-group data domain offset information in the tag domain information corresponding to the physical address information, including:
reading a start bit address and an end bit address of a data field corresponding to the first tag field in the first tag field;
if all data corresponding to the data to be accessed are determined not to be stored in the data domain corresponding to the first tag domain according to the physical address information of the data to be accessed and the granularity information of the data to be accessed, acquiring a replaced data domain which allocates the data to be accessed and allocating the replaced data domain to the data to be accessed, wherein the replaced data domain comprises a data domain which has granularity larger than and closest to the granularity information of the request to be accessed and is corresponding to each tag domain in the first group and has different granularity.
8. The method of claim 7,
the acquiring and allocating the replaced data field of the data to be accessed and the data to be accessed includes:
if the utilization rate of the replaced data domain in the first group is larger than or equal to a second utilization rate threshold and the utilization rates of a plurality of second data domains in all the data domains with different granularities except the replaced data domain in the first group are smaller than a second access threshold according to the utilization rates of the data domains with different granularities respectively corresponding to each label domain in the first group, merging the plurality of second data domains into the replaced data domain and distributing the replaced data domain to the data to be accessed, wherein the second data domain comprises the data domains with the granularity smaller than the granularity of the replaced data domain in all the data domains with different granularities except the replaced data domain in the first group;
or,
if the utilization rate of the replaced data domain in the first group is larger than or equal to the second utilization rate threshold and the utilization rate of a third data domain in all data domains with different granularities except the replaced data domain in the first group is smaller than the second access threshold according to the utilization rate of the data domain with different granularities corresponding to each label domain in the first group, splitting the third data domain into one or more replaced data domains and distributing the replaced data domains to the data to be accessed, wherein the third data domain comprises the data domain with the granularity larger than the granularity of the replaced data domain in all the data domains with different granularities except the replaced data domain in the first group;
or,
and if the utilization rate of the replaced data domain in the first group is determined to be smaller than the second utilization rate threshold value according to the utilization rate of the data domain with different granularity corresponding to each label domain in the first group, the replaced data domain is allocated to the data to be accessed.
9. The method according to any one of claims 1-8, further comprising:
and updating the label domain corresponding to the data domain allocated to the data to be accessed.
10. A cache memory, comprising:
the device comprises a receiving unit, a processing unit and a processing unit, wherein the receiving unit is used for receiving request information for accessing data to be accessed, which is sent by a processor, and the request information comprises physical address information of the data to be accessed;
the acquisition unit is used for acquiring a label domain corresponding to the physical address information of the data to be accessed according to the physical address information of the data to be accessed; acquiring a data domain corresponding to the tag domain according to the group identification information and the offset information of the data domain in the group in the tag domain information corresponding to the physical address information, wherein each group comprises N tag fields and M data fields, the tag fields correspond to the data fields one to one, and the tag fields and the data fields corresponding to one are in the same group or different groups, n is a natural number greater than or equal to 1, M is a natural number greater than or equal to 1 and N is greater than M, each tag field information includes group identification information of the data field corresponding to the tag field, and intra-group data field offset information, the group identification information is used for indicating a group where the data domain corresponding to the tag domain is located, and the data offset information in the group is used for indicating an offset of the data domain in the group where the data domain is located.
11. The cache memory of claim 10 wherein each of said tag field information further comprises tag bit information, data field valid or not information, "isptr" information,
wherein the tag bit information is used to indicate a physical address corresponding to the data field corresponding to the tag field, the data field validity information is used to indicate whether the data field corresponding to the tag field is accessed by the processor or not accessed by the processor, and the 'isptr' information is used to indicate whether the data stored in the data field corresponding to the tag field originates from the group corresponding to the data to be accessed or originates from another group except the group corresponding to the data to be accessed,
accordingly, the method can be used for solving the problems that,
the acquisition unit is further configured to: acquiring a first group and tag bit information corresponding to the physical address information of the data to be accessed according to the physical address information of the data to be accessed;
if a tag domain with a valid state bit exists in a first group of a storage system according to the first group corresponding to the physical address information of the data to be accessed and if a tag domain with a valid state bit equal to the tag bit information corresponding to the physical address information of the data to be accessed exists in the tag domain with a valid state bit according to the tag bit information corresponding to the physical address information of the data to be accessed, a first tag domain with a valid state bit in the tag domain in the storage system is acquired, wherein the tag domain with the valid state bit contains a tag field which indicates that the data domain is accessed by the processor and indicates that the data stored in the data domain corresponding to the tag field is from the group corresponding to the data to be accessed.
12. The cache memory of claim 10 wherein each of said tag field information further comprises tag bit information, data field valid or not information, "isptr" information,
wherein the tag bit information is used to indicate a physical address corresponding to the data field corresponding to the tag field, the data field validity information is used to indicate whether the data field corresponding to the tag field is accessed by the processor or not accessed by the processor, and the 'isptr' information is used to indicate whether the data stored in the data field corresponding to the tag field originates from the group corresponding to the data to be accessed or originates from another group except the group corresponding to the data to be accessed,
accordingly, the method can be used for solving the problems that,
the acquisition unit is further configured to: acquiring a first group and tag bit information corresponding to the physical address information of the data to be accessed according to the physical address information of the data to be accessed;
if a tag domain with an effective state bit does not exist in a first group in a storage system according to the first group corresponding to the physical address information of the data to be accessed, or if a tag domain with an effective state bit exists in the first group in the storage system according to the first group corresponding to the physical address information of the data to be accessed and if a tag domain with an effective state bit does not exist in the tag domain with an effective state bit in the first group according to the tag bit information corresponding to the physical address information of the data to be accessed, acquiring offset information of the group and the intra-group data domain which are allocated with the data to be accessed and allocating the offset information to the data to be accessed, wherein the tag domain with the effective state bit does not include a data domain which indicates that the data domain corresponding to the tag domain is not accessed by the processor and indicates that the data stored in the data domain corresponding to the tag domain is from the group corresponding to the data to be accessed Or, the data field corresponding to the tag field is indicated to be accessed by the processor and the data stored in the data field corresponding to the tag field is indicated to be derived from a group other than the group corresponding to the data to be accessed, or the data field corresponding to the tag field is indicated to be not accessed by the processor and the data stored in the data field corresponding to the tag field is indicated to be derived from a group other than the group corresponding to the data to be accessed.
13. The cache memory according to claim 12,
the acquisition unit further includes:
a selecting module, configured to select, according to the utilization rates respectively corresponding to each group of tag domains in the first group, a data domain with a lowest utilization rate among the data domains respectively corresponding to each tag domain in the first group if it is determined that the utilization rate corresponding to the first group is smaller than a first utilization rate threshold according to the utilization rate respectively corresponding to each group of tag domains in the storage system;
and the allocation module is used for allocating the data domain with the lowest utilization rate in the data domains corresponding to the first group and each label domain in the first group to the data to be accessed.
14. The cache memory according to claim 12,
the selection module is further configured to: if the utilization rate corresponding to the first group is determined to be larger than or equal to the first utilization rate threshold value according to the utilization rate corresponding to each group in the storage system, selecting a second group with the lowest utilization rate in all the groups except the first group in the storage system; selecting the data domain with the lowest utilization rate in the data domains respectively corresponding to each label domain in the second group according to the utilization rate of the data domain respectively corresponding to each label domain in the second group;
the allocation module is further configured to: and allocating the data domain with the lowest utilization rate in the data domains corresponding to each label domain in the second group and the second group to the data to be accessed.
15. The cache memory according to claim 10 or 11,
each of the tag fields further includes start address information and end address information of the data field corresponding to the tag field,
the start address information is used for indicating a start bit address of the data field corresponding to the tag field, the end address information is used for indicating an end bit address of the data field corresponding to the tag field,
the request information also contains granularity information of the data to be accessed,
accordingly, the method can be used for solving the problems that,
the acquisition unit further includes:
a reading module, configured to read a start bit address and an end bit address of a data field corresponding to the first tag field in the first tag field;
the acquisition unit is further configured to: if all data corresponding to the data to be accessed are determined to be stored in the data domain corresponding to the first tag domain according to the physical address information of the data to be accessed and the granularity information of the data to be accessed, the position of the data domain corresponding to the first tag domain is obtained according to the group identification information in the first tag domain and the offset information of the data domain in the group; and acquiring the data domain corresponding to the first label domain according to the position of the data domain corresponding to the first label domain.
16. The cache memory according to claim 10 or 11,
each of the tag fields further includes start address information and end address information of the data field corresponding to the tag field,
the start address information is used for indicating a start bit address of the data field corresponding to the tag field, the end address information is used for indicating an end bit address of the data field corresponding to the tag field,
the request information also contains granularity information of the data to be accessed,
accordingly, the method can be used for solving the problems that,
the read module is further to: reading a start bit address and an end bit address of a data field corresponding to the first tag field in the first tag field;
the acquisition unit is further configured to: if all data corresponding to the data to be accessed are determined not to be stored in the data domain corresponding to the first tag domain according to the physical address information of the data to be accessed and the granularity information of the data to be accessed, acquiring a replaced data domain which allocates the data to be accessed and allocating the replaced data domain to the data to be accessed, wherein the replaced data domain comprises a data domain which has granularity larger than and closest to the granularity information of the request to be accessed and is corresponding to each tag domain in the first group and has different granularity.
17. The cache memory according to claim 16,
the acquisition unit further includes:
a merging module, configured to merge the plurality of second data fields into the replaced data field and allocate the replaced data field to the data to be accessed if it is determined that the utilization of the replaced data field in the first group is greater than or equal to a second utilization threshold and the utilization of the plurality of second data fields in all data fields with different granularities except the replaced data field in the first group is less than the second access threshold according to the utilization of the data field with different granularities corresponding to each tag field in the first group, where the second data field includes the data field with a granularity less than the granularity of the replaced data field in all data fields with different granularities except the replaced data field in the first group;
or,
the acquisition unit further includes:
a splitting module, configured to, if it is determined that the utilization rate of the replaced data domain in the first group is greater than or equal to the second utilization rate threshold and the utilization rate of a third data domain in all data domains with different granularities except the replaced data domain in the first group is less than the second access threshold according to the utilization rate of the data domain with different granularities corresponding to each tag domain in the first group, split the third data domain into one or more replaced data domains and allocate the replaced data domains to the data to be accessed, where the third data domain includes data domains with granularities greater than the granularity of the replaced data domain in all data domains with different granularities except the replaced data domain in the first group;
or,
the allocation module is further configured to: and if the utilization rate of the replaced data domain in the first group is determined to be smaller than the second utilization rate threshold according to the utilization rate of the data domain with different granularity corresponding to each label domain in the first group, the replaced data domain is allocated to the data to be accessed.
18. The cache memory according to any one of claims 10 to 17,
the cache memory further comprises:
and the updating unit is used for updating the label domain corresponding to the data domain distributed to the data to be accessed.
CN201310344166.0A 2013-08-08 2013-08-08 A kind of method, equipment and system for accessing data Active CN104346404B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN201310344166.0A CN104346404B (en) 2013-08-08 2013-08-08 A kind of method, equipment and system for accessing data

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN201310344166.0A CN104346404B (en) 2013-08-08 2013-08-08 A kind of method, equipment and system for accessing data

Publications (2)

Publication Number Publication Date
CN104346404A true CN104346404A (en) 2015-02-11
CN104346404B CN104346404B (en) 2018-05-18

Family

ID=52502017

Family Applications (1)

Application Number Title Priority Date Filing Date
CN201310344166.0A Active CN104346404B (en) 2013-08-08 2013-08-08 A kind of method, equipment and system for accessing data

Country Status (1)

Country Link
CN (1) CN104346404B (en)

Cited By (6)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN106990944A (en) * 2016-01-21 2017-07-28 阿里巴巴集团控股有限公司 A kind of code resource management method, apparatus and system
CN107180001A (en) * 2016-03-10 2017-09-19 华为技术有限公司 Access dynamic RAM DRAM method and bus
CN109194453A (en) * 2017-11-17 2019-01-11 华为技术有限公司 The sending method and device of Phase Tracking reference signal
US10419099B2 (en) 2017-11-17 2019-09-17 Huawei Technologies Co., Ltd. Phase tracking reference signal sending method and apparatus
CN111124951A (en) * 2018-10-31 2020-05-08 伊姆西Ip控股有限责任公司 Method, apparatus and computer program product for managing data access
CN111602377A (en) * 2017-12-27 2020-08-28 华为技术有限公司 Resource adjusting method in cache, data access method and device

Citations (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN1165000A (en) * 1996-02-29 1997-11-19 美国辉瑞有限公司 Method of reducing tissue damage associated with ischemia
US6338118B2 (en) * 1999-06-21 2002-01-08 Philips Electronics No. America Corp. Set-associative cache-management method with parallel and single-set sequential reads
CN1165000C (en) * 2001-12-20 2004-09-01 中国科学院计算技术研究所 Microprocessor high speed buffer storage method of dynamic index
CN101470671A (en) * 2008-01-16 2009-07-01 威盛电子股份有限公司 Memory system, memory access method and graphic processing system
CN1770734B (en) * 2004-11-05 2010-09-08 株式会社日立制作所 Traffic control method for network equipment

Patent Citations (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN1165000A (en) * 1996-02-29 1997-11-19 美国辉瑞有限公司 Method of reducing tissue damage associated with ischemia
US6338118B2 (en) * 1999-06-21 2002-01-08 Philips Electronics No. America Corp. Set-associative cache-management method with parallel and single-set sequential reads
CN1165000C (en) * 2001-12-20 2004-09-01 中国科学院计算技术研究所 Microprocessor high speed buffer storage method of dynamic index
CN1770734B (en) * 2004-11-05 2010-09-08 株式会社日立制作所 Traffic control method for network equipment
CN101470671A (en) * 2008-01-16 2009-07-01 威盛电子股份有限公司 Memory system, memory access method and graphic processing system

Non-Patent Citations (1)

* Cited by examiner, † Cited by third party
Title
GEEK_LING: "《对缓存的思考——提高命中率》", 《博客园》 *

Cited By (11)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN106990944A (en) * 2016-01-21 2017-07-28 阿里巴巴集团控股有限公司 A kind of code resource management method, apparatus and system
CN106990944B (en) * 2016-01-21 2020-09-04 阿里巴巴集团控股有限公司 Code resource management method, device and system
CN107180001A (en) * 2016-03-10 2017-09-19 华为技术有限公司 Access dynamic RAM DRAM method and bus
US10452604B2 (en) 2016-03-10 2019-10-22 Huawei Technologies Co., Ltd. Method and bus for accessing dynamic random access memory
CN109194453A (en) * 2017-11-17 2019-01-11 华为技术有限公司 The sending method and device of Phase Tracking reference signal
US10419099B2 (en) 2017-11-17 2019-09-17 Huawei Technologies Co., Ltd. Phase tracking reference signal sending method and apparatus
US11038576B2 (en) 2017-11-17 2021-06-15 Huawei Technologies Co., Ltd. Phase tracking reference signal sending method and apparatus
CN111602377A (en) * 2017-12-27 2020-08-28 华为技术有限公司 Resource adjusting method in cache, data access method and device
CN111124951A (en) * 2018-10-31 2020-05-08 伊姆西Ip控股有限责任公司 Method, apparatus and computer program product for managing data access
US11593272B2 (en) 2018-10-31 2023-02-28 EMC IP Holding Company LLC Method, apparatus and computer program product for managing data access
CN111124951B (en) * 2018-10-31 2023-09-15 伊姆西Ip控股有限责任公司 Method, apparatus and computer program product for managing data access

Also Published As

Publication number Publication date
CN104346404B (en) 2018-05-18

Similar Documents

Publication Publication Date Title
CN104346404B (en) A kind of method, equipment and system for accessing data
US10706101B2 (en) Bucketized hash tables with remap entries
US9223712B2 (en) Data cache method, device, and system in a multi-node system
US9361236B2 (en) Handling write requests for a data array
US8677071B2 (en) Control of processor cache memory occupancy
CN111602377B (en) Resource adjusting method in cache, data access method and device
CN103678169B (en) A kind of method and system of efficiency utilization solid-state disk buffer memory
CN109582600B (en) Data processing method and device
KR102575913B1 (en) Asymmetric set combined cache
CN114860785B (en) Cache data processing system, method, computer device and storage medium
CN104809076A (en) Management method and device of cache
WO2020259082A1 (en) Cache allocation method and device, storage medium, and electronic device
CN117093371B (en) Cache resource allocation method and device, electronic equipment and storage medium
CN111488293B (en) Access method and equipment for data visitor directory in multi-core system
CN116501249A (en) Method for reducing repeated data read-write of GPU memory and related equipment
CN115357196A (en) Dynamically expandable set-associative cache method, apparatus, device and medium
JP2009015509A (en) Cache memory device
CN107577616B (en) Method and system for dividing last-level shared cache
CN107861819B (en) Cache group load balancing method and device and computer readable storage medium
CN107632944B (en) Method and device for reading data
CN109857681B (en) Cache address mapping method and related equipment
CN112231241B (en) Data reading method and device and computer readable storage medium
US9251070B2 (en) Methods and apparatus for multi-level cache hierarchies
CN113010454A (en) Data reading and writing method, device, terminal and storage medium
US20180089106A1 (en) Method and apparatus for replacing data block in cache

Legal Events

Date Code Title Description
C06 Publication
PB01 Publication
C10 Entry into substantive examination
SE01 Entry into force of request for substantive examination
GR01 Patent grant
GR01 Patent grant