CN103076992A - Memory data buffering method and device - Google Patents
Memory data buffering method and device Download PDFInfo
- Publication number
- CN103076992A CN103076992A CN2012105786153A CN201210578615A CN103076992A CN 103076992 A CN103076992 A CN 103076992A CN 2012105786153 A CN2012105786153 A CN 2012105786153A CN 201210578615 A CN201210578615 A CN 201210578615A CN 103076992 A CN103076992 A CN 103076992A
- Authority
- CN
- China
- Prior art keywords
- cache
- data
- directory
- information
- hit
- 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
Links
- 238000000034 method Methods 0.000 title claims abstract description 40
- 230000003139 buffering effect Effects 0.000 title claims abstract description 31
- 239000003795 chemical substances by application Substances 0.000 claims abstract description 94
- 238000010586 diagram Methods 0.000 description 17
- 230000006870 function Effects 0.000 description 5
- 230000004044 response Effects 0.000 description 5
- 230000006399 behavior Effects 0.000 description 3
- 230000009286 beneficial effect Effects 0.000 description 1
- 238000004590 computer program Methods 0.000 description 1
- 230000003287 optical effect Effects 0.000 description 1
Images
Landscapes
- Memory System Of A Hierarchy Structure (AREA)
Abstract
本发明实施例公开了一种内存数据缓冲的方法,包括在内存代理HomeAgent的存储器中开辟至少包括目录缓存和数据缓存的组合缓存区,所述目录缓存中的缓存行和所述数据缓存中的缓存行一一对应;接收缓存代理Cache Agent发出的操作地址,根据所述操作地址判断所述组合缓存区是否命中且有效,若为是,则直接对所述组合缓存区执行相应的操作。采用本发明,减少访问内存的次数,降低数据获得的延迟。
The embodiment of the present invention discloses a method for memory data buffering, which includes opening a combined buffer area including at least a directory cache and a data cache in the memory of the memory agent HomeAgent, the cache lines in the directory cache and the cache lines in the data cache One-to-one correspondence of cache lines; receiving the operation address issued by the cache agent Cache Agent, judging whether the combined cache area is hit and valid according to the operation address, and if so, directly performing the corresponding operation on the combined cache area. By adopting the invention, the times of accessing the memory are reduced, and the delay of data acquisition is reduced.
Description
技术领域technical field
本发明涉及计算机领域,尤其涉及一种内存数据缓冲方法及装置。The invention relates to the field of computers, in particular to a memory data buffering method and device.
背景技术Background technique
现代的高级计算机系统都有多个CPU组成,为了提高CPU的访问数据的速率,降低访存延迟,都会在CPU上实现Cache功能,它的访问速度一般都比直接访问内存快一个数量级以上的。由于每个CPU都会实现一块Cache,因此同一地址的内存会被缓存到不同的CPU Cache上,如果某个CPU对该地址进行写操作,必须使其他CPU中的缓存失效,如果缓存中有脏数据必须回写到内存。为了完成上述功能,现代多处理器计算机在内存总线上实现了缓存一致性协议(Cache Coherence Protocol),比如Intel CPU平台上的QPI总线、AMT CPU平台上的HT总线都实现了缓存一致性协议。常见的典型缓存一致性协议包括Source Snoop和Home Snoop两种类型。为了实现缓存一致性协议,一般在CPU侧实现缓存代理(Cache Agent)功能,在内存侧实现内存代理(Home Agent)功能,两者配合实现缓存一致性协议。Cache Agent主要实现CPU Cache的管理,并且发起对内存的访问功能,并且响应其他请求的侦听请求。Home Agent主要实现多个CA对同一地址的串行化访问和对不同地址的并行化访问。Modern advanced computer systems are composed of multiple CPUs. In order to increase the data access rate of the CPU and reduce the memory access delay, the Cache function will be implemented on the CPU. Its access speed is generally more than an order of magnitude faster than direct access to memory. Since each CPU will implement a cache, the memory at the same address will be cached in different CPU caches. If a CPU writes to this address, the cache in other CPUs must be invalidated. If there is dirty data in the cache must be written back to memory. In order to complete the above functions, modern multiprocessor computers implement the Cache Coherence Protocol (Cache Coherence Protocol) on the memory bus. For example, the QPI bus on the Intel CPU platform and the HT bus on the AMT CPU platform both implement the Cache Coherence Protocol. Common typical cache coherence protocols include Source Snoop and Home Snoop. In order to implement the cache coherence protocol, the cache agent (Cache Agent) function is generally implemented on the CPU side, and the memory agent (Home Agent) function is implemented on the memory side, and the two cooperate to implement the cache coherence protocol. Cache Agent mainly realizes the management of CPU Cache, and initiates the access function to memory, and responds to the listening request of other requests. The Home Agent mainly realizes the serialized access of multiple CAs to the same address and the parallelized access to different addresses.
Home Snoop缓存一致性协议,所有的侦听请求都是由内存代理发送。为了减少侦听发送的数量,一般会在内存中存储一个目录,用于表示该地址内存在各个缓存代理中的状态。当内存代理接收一个缓存代理的请求时,就会从内存中读取该内存数据和对应的目录,如果内存目录表示没有缓存代理拥有该内存数据,内存代理直接把数据发送给请求者缓存代理;如果表示有一个或者多个缓存代理拥有该内存数据,内存会发送侦听到目录表示的缓存代理去,等待所有的侦听响应完毕后发送请求响应给请求者缓存代理。The Home Snoop cache coherence protocol, all snooping requests are sent by the memory proxy. In order to reduce the number of listening and sending, a directory is generally stored in the memory, which is used to represent the state of each cache agent in the address. When the memory proxy receives a cache proxy request, it will read the memory data and the corresponding directory from the memory. If the memory directory indicates that no cache proxy owns the memory data, the memory proxy will directly send the data to the requester cache proxy; If it indicates that one or more caching agents own the memory data, the memory will send the caching agent that listens to the directory, wait for all the listening responses to be completed, and then send the request response to the requester caching agent.
在CPU中的缓存一般有4种状态,Modefied(脏),Exclusive(独占),Shared(共享),Invalid(无效)。为了满足缓存一致性协议,对于同一地址的M/E状态的缓存数据只能在一个缓存代理存在,这两个状态的数据CPU可以进行直接的读写操作;对于同一地址的S状态,可以处于多个CPU的缓存代理中,但是该数据只能被CPU进行读操作;对于无效状态,表示缓存代理中没有该地址的数据。区别于缓存代理中的缓存状态,在内存目录中记录的状态不会区分M/E,都把这两类状态统一为独占状态,有的设计甚至不会区分M/E/S三个状态,只记录是否在缓存代理中是否包含数据。The cache in the CPU generally has 4 states, Modefied (dirty), Exclusive (exclusive), Shared (shared), and Invalid (invalid). In order to meet the cache consistency protocol, the cache data of the M/E state of the same address can only exist in one cache agent, and the data CPU of these two states can perform direct read and write operations; for the S state of the same address, it can be in In the cache proxy of multiple CPUs, but the data can only be read by the CPU; for the invalid state, it means that there is no data at the address in the cache proxy. Different from the cache state in the caching agent, the state recorded in the memory directory does not distinguish between M/E, and these two types of states are unified into an exclusive state, and some designs do not even distinguish between the three states of M/E/S. Only records whether data is contained in a caching proxy.
现有的Home Snoop协议,为了加速对内存目录的读取,会在内存代理处添加一块缓存(注意:此缓存不是CPU缓存代理的缓存),这样做的好处可以对经常访问的内存目录,快速读取,并且尽早发送侦听到缓存代理,降低侦听响应的延迟。但是,如果目录缓存命中,表示的缓存行的状态为无效状态时,虽然可以不发送侦听请求到其他缓存代理,但是还必须往内存进行数据读取,然后把数据发送给请求者缓存代理,这次内存的读取速度往往很慢,影响整个请求缓存的响应时间。The existing Home Snoop protocol, in order to speed up the reading of the memory directory, will add a cache at the memory agent (note: this cache is not the cache of the CPU cache agent). Read, and send the listener to the cache proxy as early as possible to reduce the delay of listening to the response. However, if the directory cache hits and the status of the indicated cache line is invalid, although it is not necessary to send the listening request to other cache agents, it must still read the data from the memory, and then send the data to the requester cache agent. This time the memory reading speed is often very slow, affecting the response time of the entire request cache.
发明内容Contents of the invention
本发明实施例所要解决的技术问题在于,提供一种内存数据缓冲方法装置。可解决现有技术中只对目录信息作优化,当目录缓存命中时,所表示的数据行为无效时,需要从内存中取数据,响应请求的响应时间。The technical problem to be solved by the embodiments of the present invention is to provide a memory data buffering method and device. It can solve the problem that only directory information is optimized in the prior art. When the directory cache hits and the indicated data behavior is invalid, the data needs to be fetched from the memory to respond to the response time of the request.
为了解决上述技术问题,本发明第一方面提供了一种内存数据缓冲方法,包括:In order to solve the above technical problems, the first aspect of the present invention provides a memory data buffering method, including:
在内存代理Home Agent的存储器中开辟至少包括目录缓存和数据缓存的组合缓存区,所述目录缓存中的缓存行和所述数据缓存中的缓存行一一对应;In the memory of the memory agent Home Agent, open up a combined cache area comprising at least a directory cache and a data cache, and the cache lines in the directory cache correspond to the cache lines in the data cache;
接收缓存代理Cache Agent发出的操作地址,根据所述操作地址判断所述组合缓存区是否命中且有效,若为是,则直接对所述组合缓存区执行相应的操作。Receive the operation address sent by the cache agent Cache Agent, judge whether the combined cache area is hit and valid according to the operation address, and if yes, directly perform the corresponding operation on the combined cache area.
在第一种可能的实现方式中,所述组合缓存区包括描述信息,所述描述信息包括:对比字段、目录状态信息、数据状态信息和有效标志位;In a first possible implementation manner, the combined buffer includes description information, and the description information includes: a comparison field, directory status information, data status information, and a valid flag bit;
所述根据所述操作地址判断所述组合缓存区是否命中且有效包括:The judging whether the combination cache is hit and valid according to the operation address includes:
根据所述操作地址查询所述组合缓存区中是否存在匹配的对比字段,若存在,则所述组合缓存区命中;和Query whether there is a matching comparison field in the combined buffer according to the operation address, and if it exists, the combined buffer hits; and
根据所述组合缓存区中命中的缓存行的有效标志位判断所述命中的缓存行是否有效。Whether the hit cache line is valid is judged according to the valid flag bit of the hit cache line in the combined cache area.
结合第一方面和第一方面的第一种可能的实现方式,在第二种可能的实现方式中,所述操作地址为读操作地址,所述直接对所述组合缓存区执行相应的操作包括:In combination with the first aspect and the first possible implementation of the first aspect, in a second possible implementation, the operation address is a read operation address, and the directly performing the corresponding operation on the combined buffer includes :
直接向所述缓存代理返回所述命中的缓存行中的目录信息和数据信息。Directly return the directory information and data information in the hit cache line to the cache proxy.
结合第一方面的第二种可能的实现方式,在第三种可能的实现方式中,所述操作地址为写操作地址,所述直接对所述组合缓存区执行相应的操作包括;With reference to the second possible implementation of the first aspect, in a third possible implementation, the operation address is a write operation address, and the directly performing corresponding operations on the combined buffer area includes;
在所述命中的缓存行中写入新的数据信息和目录信息,更新所述组合缓存区描述信息中的目录状态信息和数据状态信息,并将有效标志位置为有效。Write new data information and directory information in the hit cache line, update the directory status information and data status information in the combined buffer description information, and set the valid flag position as valid.
结合第一方面的第三种可能的实现方式,在第四种可能的实现方式中,接收缓存代理Cache Agent发出的操作地址,根据所述操作地址判断所述组合缓存区未命中时,采用LRU最近最少使用算法选择所述组合缓存区中的待替换缓存行,根据所述待替换缓存行的目录状态信息和数据状态信息判断是否需要将所述待替换缓存行中的目录信息和数据信息写回内存;In combination with the third possible implementation of the first aspect, in the fourth possible implementation, the operation address sent by the cache agent Cache Agent is received, and when it is judged that the combined cache area misses according to the operation address, LRU is used The least recently used algorithm selects the cache line to be replaced in the combined cache area, and judges whether the directory information and data information in the cache line to be replaced need to be written according to the directory state information and data state information of the cache line to be replaced. back to memory;
将所述待替换缓存行的有效标志位置为无效。Setting the effective flag position of the cache line to be replaced as invalid.
本发明第二方面提供了一种内存数据缓冲方法,包括:The second aspect of the present invention provides a memory data buffering method, comprising:
在内存代理Home Agent的存储器中开辟目录缓存和数据缓存,所述目录缓存中的缓存行和所述数据缓存中的缓存行不是一一对应;Open up directory cache and data cache in the memory of memory proxy Home Agent, the cache line in the directory cache and the cache line in the data cache are not one-to-one correspondence;
接收缓存代理Cache Agent发出的操作地址,根据所述操作地址判断所述目录缓存和所述数据缓存是否命中且有效,若为是,则直接对所述目录缓存和所述数据缓存执行相应的操作。Receive the operation address sent by the cache agent Cache Agent, judge whether the directory cache and the data cache are hit and valid according to the operation address, if yes, directly perform corresponding operations on the directory cache and the data cache .
在第一种可能的实现方式中,所述目录缓存包括目录描述信息,所述目录描述信息包括对比字段、目录状态信息、数据信息标识位、数据信息身份标识和目录有效标识位;所述数据缓存包括数据描述信息,所述数据描述信息包括数据状态信息和数据有效标识位;In a first possible implementation manner, the directory cache includes directory description information, and the directory description information includes a comparison field, directory status information, data information identification bits, data information identity identifiers, and directory effective identification bits; the data The cache includes data description information, and the data description information includes data status information and data valid identification bits;
所述接收缓存代理Cache Agent发出的操作地址,根据所述操作地址判断所述目录缓存和所述数据缓存是否命中且有效包括:The operation address sent by the receiving cache agent Cache Agent, judging whether the directory cache and the data cache hit and effectively include:
根据所述操作地址查询所述目录缓存是否存在匹配的对比字段,若存在,则所述目录缓存命中;Query whether there is a matching comparison field in the directory cache according to the operation address, and if it exists, the directory cache hits;
根据所述目录缓存中命中的缓存行的目录有效标志位判断所述命中的缓存行是否有效,若为是,则根据所述被命中的缓存行的数据信息标识位判断所述数据缓存是否命中;Judging whether the hit cache line is valid according to the directory valid flag bit of the hit cache line in the directory cache, if yes, judging whether the data cache is hit according to the data information flag bit of the hit cache line ;
根据命中的所述数据缓的缓存行中的数据有效标识位判断该命中的所述数据缓存中的缓存行是否有效。It is judged whether the hit cache line in the data cache is valid according to the data valid flag in the cache line of the hit data cache.
结合第二方面和第二方面第一种可能的实现方式,在第二种可能的实现方式中,Combining the second aspect with the first possible implementation of the second aspect, in the second possible implementation,
所述操作地址为读操作地址,所述直接对所述目录缓存和所述数据缓存执行相应的操作包括:The operation address is a read operation address, and the direct execution of corresponding operations on the directory cache and the data cache includes:
直接向所述缓存代理返回命中的目录缓存的缓存行中的目录信息和命中的数据缓存的缓存行中的数据信息。The directory information in the cache line of the hit directory cache and the data information in the cache line of the hit data cache are directly returned to the cache proxy.
结合第二方面的第二种可能的实现方式,在第三种可能的实现方式中,所述操作地址为写操作地址,所述直接对所述目录缓存和所述数据缓存执行相应的操作包括:With reference to the second possible implementation of the second aspect, in a third possible implementation, the operation address is a write operation address, and performing corresponding operations directly on the directory cache and the data cache includes :
在所述命中的目录缓存的缓存行中写入新的目录信息和所述命中的数据缓存的缓存行中写入新的数据信息。Writing new directory information into the cache line of the hit directory cache and writing new data information into the cache line of the hit data cache.
结合第二方面的第三种可能的实现方式,在第四种可能的实现方式中,还包括:In combination with the third possible implementation of the second aspect, the fourth possible implementation also includes:
根据所述命中的数据缓存的缓存行的数据信息标识位判断所述数据缓存未命中时,采用LRU最近最少使用算法在所述数据缓存中剔除一个闲置的缓存行。When judging that the data cache misses according to the data information flag of the cache line of the hit data cache, an LRU least recently used algorithm is used to remove an idle cache line from the data cache.
本发明第四方面提供了一种内存数据缓冲装置,包括:A fourth aspect of the present invention provides a memory data buffering device, comprising:
缓存分配模块,用于在内存代理Home Agent的存储器中开辟至少包括目录缓存和数据缓存的组合缓存区,所述目录缓存中的缓存行和所述数据缓存中的缓存行一一对应;The cache allocation module is used to open up a combined cache area including at least a directory cache and a data cache in the memory of the memory agent Home Agent, and the cache lines in the directory cache are in one-to-one correspondence with the cache lines in the data cache;
操作执行模块,用于接收缓存代理Cache Agent发出的操作地址,根据所述操作地址判断所述组合缓存区是否命中且有效,若为是,则直接对所述组合缓存区执行相应的操作。The operation execution module is used to receive the operation address sent by the cache agent Cache Agent, judge whether the combined cache area hits and is valid according to the operation address, and if yes, directly perform the corresponding operation on the combined cache area.
在第一种可能的实现方式中,所述操作执行模块包括:In a first possible implementation manner, the operation execution module includes:
命中有效判断单元,用于根据所述操作地址查询所述组合缓存区中是否存在匹配的对比字段,若存在,则所述组合缓存区命中;和A hit valid judging unit, configured to inquire whether there is a matching comparison field in the combined buffer according to the operation address, and if it exists, the combined buffer hits; and
根据所述组合缓存区中命中的缓存行的有效标志位判断所述命中的缓存行是否有效;其中,所述组合缓存区包括描述信息,所述描述信息包括:对比字段、目录状态信息、数据状态信息和有效标志位。Determine whether the hit cache line is valid according to the valid flag bit of the hit cache line in the combined cache area; wherein, the combined cache area includes description information, and the description information includes: a comparison field, directory status information, data Status information and valid flag bits.
结合第三方面和第三方面的的第一种可能的实现方式,在第二种可能的实现方式中,所述操作执行模块包括;In combination with the third aspect and the first possible implementation manner of the third aspect, in a second possible implementation manner, the operation execution module includes;
读操作执行单元,用于直接向所述缓存代理返回所述命中的缓存行中的目录信息和数据信息。A read operation execution unit, configured to directly return the directory information and data information in the hit cache line to the cache proxy.
结合第三方面的第二种可能的实现方式,在三种可能的实现方式中,所述操作执行模块包括:With reference to the second possible implementation of the third aspect, in three possible implementations, the operation execution module includes:
写操作执行单元,用于在所述命中的缓存行中写入新的数据信息和目录信息,更新所述组合缓存区描述信息中的目录状态信息和数据状态信息,并将有效标志位置为有效。A write operation execution unit, configured to write new data information and directory information in the hit cache line, update the directory status information and data status information in the combined buffer description information, and set the valid flag position as valid .
结合第三方面的第三种可能的实现方式,在第四种可能的实现方式中,还包括:In combination with the third possible implementation of the third aspect, the fourth possible implementation also includes:
替换模块,用于接收缓存代理Cache Agent发出的操作地址,根据所述操作地址判断所述组合缓存区未命中时,采用LRU最近最少使用算法选择所述组合缓存区中的待替换缓存行,根据所述待替换缓存行的目录状态信息和数据状态信息判断是否需要将所述待替换缓存行中的目录信息和数据信息写回内存;The replacement module is used to receive the operation address sent by the cache agent Cache Agent, and when judging that the combined cache area misses according to the operation address, the LRU least recently used algorithm is used to select the cache line to be replaced in the combined cache area, according to The directory state information and data state information of the cache line to be replaced determine whether the directory information and data information in the cache line to be replaced need to be written back to the memory;
将所述待替换缓存行的有效标志位置为无效。Setting the effective flag position of the cache line to be replaced as invalid.
本发明第四方面提供了一种内存数据缓冲装置,包括:A fourth aspect of the present invention provides a memory data buffering device, comprising:
缓存分配模块,用于在内存代理Home Agent的存储器中开辟目录缓存和数据缓存,所述目录缓存中的缓存行和所述数据缓存中的缓存行不是一一对应;The cache distribution module is used to open up a directory cache and a data cache in the memory of the memory agent Home Agent, and the cache lines in the directory cache are not in one-to-one correspondence with the cache lines in the data cache;
操作执行模块,用于接收缓存代理Cache Agent发出的操作地址,根据所述操作地址判断所述目录缓存和所述数据缓存是否命中且有效,若为是,则直接对所述目录缓存和所述数据缓存执行相应的操作。The operation execution module is used to receive the operation address sent by the cache agent Cache Agent, judge whether the directory cache and the data cache are hit and valid according to the operation address, and if so, directly perform the operation on the directory cache and the The data cache performs the corresponding operations.
在第一种可能的实现方式中,所述操作执行模块包括:In a first possible implementation manner, the operation execution module includes:
命中有效判断单元,用于根据所述操作地址查询所述目录缓存是否存在匹配的对比字段,若存在,则所述目录缓存命中;A hit valid judging unit, configured to inquire whether there is a matching comparison field in the directory cache according to the operation address, and if it exists, the directory cache hits;
根据所述目录缓存中命中的缓存行的目录有效标志位判断所述命中的缓存行是否有效,若为是,则根据所述被命中的缓存行的数据信息标识位判断所述数据缓存是否命中;Judging whether the hit cache line is valid according to the directory valid flag bit of the hit cache line in the directory cache, if yes, judging whether the data cache is hit according to the data information flag bit of the hit cache line ;
根据命中的所述数据缓的缓存行中的数据有效标识位判断该命中的所述数据缓存中的缓存行是否有效;所述目录缓存包括目录描述信息,所述目录描述信息包括对比字段、目录状态信息、数据信息标识位、数据信息身份标识和目录有效标识位;所述数据缓存包括数据描述信息,所述数据描述信息包括数据状态信息和数据有效标识位。Judging whether the cache line in the hit data cache is valid according to the data valid flag in the cache line of the hit data cache; the directory cache includes directory description information, and the directory description information includes a comparison field, a directory State information, data information identification, data information identification and directory effective identification; the data cache includes data description information, and the data description information includes data status information and data effective identification.
结合第四方面和第四方面的第一种可能的实现方式,在第二种可能的实现方式中,所述操作执行单元包括;With reference to the fourth aspect and the first possible implementation manner of the fourth aspect, in a second possible implementation manner, the operation execution unit includes;
读操作执行单元,用于直接向所述缓存代理返回命中的目录缓存的缓存行中的目录信息和命中的数据缓存的缓存行中的数据信息。The read operation execution unit is configured to directly return the directory information in the cache line of the hit directory cache and the data information in the cache line of the hit data cache to the caching agent.
结合第四方面的第二种可能的实现方式,在第三种可能的实现方式中,所述操作执行单元包括:With reference to the second possible implementation manner of the fourth aspect, in a third possible implementation manner, the operation execution unit includes:
写操作执行单元,用于在所述命中的目录缓存的缓存行中写入新的目录信息和所述命中的数据缓存的缓存行中写入新的数据信息。A write operation executing unit, configured to write new directory information in the cache line of the hit directory cache and write new data information in the cache line of the hit data cache.
结合第四方面的第三种可能的实现方式,在第四种可能的实现方式中,还包括:In combination with the third possible implementation of the fourth aspect, the fourth possible implementation also includes:
替换模块,用于根据所述被命中的缓存行的数据信息标识位判断所述数据缓存未命中时,采用LRU最近最少使用算法在所述数据缓存中剔除一个闲置的缓存行。The replacement module is configured to use the LRU least recently used algorithm to remove an idle cache line from the data cache when judging that the data cache misses according to the data information flag of the hit cache line.
实施本发明实施例,具有如下有益效果:Implementing the embodiment of the present invention has the following beneficial effects:
通过原有的目录缓存方案,增加对应的数据缓存,减少访问内存的次数,降低数据获得的延迟。Through the original directory cache solution, increase the corresponding data cache, reduce the number of memory accesses, and reduce the delay of data acquisition.
附图说明Description of drawings
为了更清楚地说明本发明实施例或现有技术中的技术方案,下面将对实施例或现有技术描述中所需要使用的附图作简单地介绍,显而易见地,下面描述中的附图仅仅是本发明的一些实施例,对于本领域普通技术人员来讲,在不付出创造性劳动的前提下,还可以根据这些附图获得其他的附图。In order to more clearly illustrate the technical solutions in the embodiments of the present invention or the prior art, the following will briefly introduce the drawings that need to be used in the description of the embodiments or the prior art. Obviously, the accompanying drawings in the following description are only These are some embodiments of the present invention. Those skilled in the art can also obtain other drawings based on these drawings without creative work.
图1是本发明实施例的一种内存数据缓冲方法的第一流程示意图;FIG. 1 is a first schematic flow chart of a memory data buffering method according to an embodiment of the present invention;
图2是本发明实施例的一种内存数据缓冲方法的第二流程示意图;FIG. 2 is a second schematic flowchart of a memory data buffering method according to an embodiment of the present invention;
图3是本发明实施例的一种内存数据缓冲方法的第三流程示意图;Fig. 3 is a third schematic flowchart of a memory data buffering method according to an embodiment of the present invention;
图4是本发明实施例的一种内存数据缓冲方法的第四流程示意图;Fig. 4 is a fourth schematic flow chart of a memory data buffering method according to an embodiment of the present invention;
图5是图4中替换操作的流程示意图;Fig. 5 is a schematic flow chart of the replacement operation in Fig. 4;
图6是本发明实施例的一种内存数据缓冲装置的第一结构示意图;FIG. 6 is a schematic diagram of a first structure of a memory data buffering device according to an embodiment of the present invention;
图7是本发明实施例的一种内存数据缓冲装置的第二结构示意图;FIG. 7 is a second structural schematic diagram of a memory data buffering device according to an embodiment of the present invention;
图8是图7中操作执行模块的结构示意图;Fig. 8 is a schematic structural diagram of the operation execution module in Fig. 7;
图9是本发明实施例的一种内存数据缓冲装置的第三结构示意图;9 is a schematic diagram of a third structure of a memory data buffering device according to an embodiment of the present invention;
图10是本发明实施例的一种内存数据缓冲装置的第四结构示意图;10 is a schematic diagram of a fourth structure of a memory data buffering device according to an embodiment of the present invention;
图11是本发明实施例的一种内存数据缓冲装置的第五结构示意图;11 is a schematic diagram of a fifth structure of a memory data buffering device according to an embodiment of the present invention;
图12是图11中操作执行模块的结构示意图;Fig. 12 is a schematic structural diagram of the operation execution module in Fig. 11;
图13是本发明实施例的一种内存数据缓冲装置的第六结构示意图。FIG. 13 is a schematic diagram of a sixth structure of a memory data buffering device according to an embodiment of the present invention.
具体实施方式Detailed ways
下面将结合本发明实施例中的附图,对本发明实施例中的技术方案进行清楚、完整地描述,显然,所描述的实施例仅仅是本发明一部分实施例,而不是全部的实施例。基于本发明中的实施例,本领域普通技术人员在没有作出创造性劳动前提下所获得的所有其他实施例,都属于本发明保护的范围。The following will clearly and completely describe the technical solutions in the embodiments of the present invention with reference to the accompanying drawings in the embodiments of the present invention. Obviously, the described embodiments are only some, not all, embodiments of the present invention. Based on the embodiments of the present invention, all other embodiments obtained by persons of ordinary skill in the art without creative efforts fall within the protection scope of the present invention.
参见图1,为本发明实施例的一种内存数据缓冲方法的第一种流程示意图,该流程包括:Referring to Fig. 1, it is a first schematic flow chart of a memory data buffering method according to an embodiment of the present invention, and the flow includes:
步骤101、在内存代理的存储器中开辟至少包括目录缓存和数据缓存的组合缓存区。
具体的,目录缓存为内存中装入到内存代理中的目录信息内存行的副本,目录信息中记录有内存行的状态信息和在缓存中的位置信息,状态信息指的是无效、独占、脏和共享状态,位置信息指的是内存行具体被装入到哪个CPU的缓存中,每一个内存行数据对应一个目录信息,根据局部性原理,目录缓存中只缓冲有部分经常访问到的目录信息,数据缓存中的数据缓存行与目录缓存中的目录缓存行一一对应,即目录缓存行中记录的为对应的数据缓存中的数据缓存行的状态信息和位置信息,由于这种一一对应的关系,可以目录缓存行和数据缓存行关联成一个组合缓存行。Specifically, the directory cache is a copy of the directory information memory line loaded into the memory agent in the memory. The state information of the memory line and the location information in the cache are recorded in the directory information. The state information refers to invalid, exclusive, dirty And shared state, the location information refers to which CPU cache the memory row is loaded into. Each memory row data corresponds to a directory information. According to the principle of locality, only part of the directory information that is frequently accessed is buffered in the directory cache. , the data cache line in the data cache is in one-to-one correspondence with the directory cache line in the directory cache, that is, the state information and location information of the data cache line in the corresponding data cache are recorded in the directory cache line, due to this one-to-one correspondence The relationship between the directory cache line and the data cache line can be associated into a combined cache line.
步骤102、接收缓存代理发出的读操作地址。
具体的,缓存代理发出一个读操作请求,所述读操作请求对应一个读操作地址。Specifically, the cache proxy sends a read operation request, and the read operation request corresponds to a read operation address.
步骤103、组合缓存区是否命中。
具体的,根据读操作地址判断组合缓存区是否命中,所述组合缓存区包括描述信息,所述描述信息包括:对比字段、目录状态信息、数据状态信息和有效标志位,如下表所示的组合缓存区的缓存行的结构为:Specifically, according to the address of the read operation, it is judged whether the combination cache area is hit. The combination cache area includes description information, and the description information includes: comparison field, directory status information, data status information and valid flag bits, as shown in the following table The cache line structure of the cache area is:
表1Table 1
根据操作地址判断所述组合缓存区是否命中且有效的步骤具体包括:The step of judging whether the combination buffer is hit and valid according to the operation address specifically includes:
根据操作地址查询所述组合缓存区中是否存在匹配的对比字段TAG,若存在,则所述组合缓存区命中。Query whether there is a matching comparison field TAG in the combined buffer according to the operation address, and if it exists, the combined buffer hits.
步骤104、组合缓存区的缓存行是否有效。
具体的,根据命中的缓存行中VALID位的数值来判断是否有效,当VALID位置1时标识该缓存行有效。Specifically, it is judged whether it is valid according to the value of the VALID bit in the hit cache line, and when the VALID bit is 1, it indicates that the cache line is valid.
步骤105、发起读操作地址对应内存的读操作。
具体的,当步骤103和步骤104判断为否时,执行步骤105,通过内存通道读取操作地址对应的内存行中的目录信息和数据信息。Specifically, when
步骤106、将从内存获取的目录信息和数据信息写入组合缓存区。
具体的,从组合缓存区中查询一个空闲的缓存行,若存在,则将从内存获取的目录信息和数据信息写入该缓存行,若组合缓存区中的不存在空闲的缓存行,采用LRU最近最少使用或FIFO先进先出等算法剔除一个缓存行,以便目录信息和数据信息的写入。Specifically, a free cache line is queried from the combined cache area. If it exists, the directory information and data information obtained from the memory are written into the cache line. If there is no free cache line in the combined cache area, LRU is used. Algorithms such as least recently used or FIFO first-in-first-out eliminate a cache line to facilitate the writing of directory information and data information.
步骤107、直接向缓存代理返回所述命中的缓存行中的目录信息和数据信息。Step 107: Directly return the directory information and data information in the hit cache line to the cache proxy.
具体的,根据读操作地址确定组合缓存区命中和命中的缓存行有效时,直接将命中的缓存行中的目录信息和数据信息返回至缓存代理。Specifically, when it is determined according to the address of the read operation that the combined cache area hits and the hit cache line is valid, the directory information and data information in the hit cache line are directly returned to the cache proxy.
实施本发明的实施例,通过原有的目录缓存方案,增加对应的数据缓存,减少访问内存的次数,降低数据获得的延迟。In implementing the embodiment of the present invention, the original directory cache solution is used to increase the corresponding data cache, reduce the number of memory accesses, and reduce the delay of data acquisition.
参见图2和图3,为本发明实施例的一种内存数据缓冲方法的第二流程示意图,该流程包括;Referring to FIG. 2 and FIG. 3, it is a schematic diagram of a second process flow of a memory data buffering method according to an embodiment of the present invention. The process includes;
步骤201、在内存代理的存储器中开辟至少包括目录缓存和数据缓存的组合缓存区。
具体的,目录缓存为内存中装入到CPU缓存中的目录信息内存行的副本,目录信息中记录有内存行的状态信息和在缓存中的位置信息,状态信息指的是无效、独占、脏和共享状态,位置信息指的是内存行具体被装入到哪个CPU的缓存中,每一个内存行数据对应一个目录信息,根据局部性原理,目录缓存中只缓冲有部分经常访问到的目录信息,数据缓存中的数据缓存行与目录缓存中的目录缓存行一一对应,即目录缓存行中记录的为对应的数据缓存中的数据缓存行的状态信息和位置信息,由于这种一一对应的关系,可以目录缓存行和数据缓存行关联成一个组合缓存行。Specifically, the directory cache is a copy of the directory information memory line loaded into the CPU cache in the memory. The state information of the memory line and the location information in the cache are recorded in the directory information. The state information refers to invalid, exclusive, dirty And shared state, the location information refers to which CPU cache the memory row is loaded into. Each memory row data corresponds to a directory information. According to the principle of locality, only part of the directory information that is frequently accessed is buffered in the directory cache. , the data cache line in the data cache is in one-to-one correspondence with the directory cache line in the directory cache, that is, the state information and location information of the data cache line in the corresponding data cache are recorded in the directory cache line, due to this one-to-one correspondence The relationship between the directory cache line and the data cache line can be associated into a combined cache line.
步骤202、接收缓存代理发出的写操作地址。
具体的,缓存代理发出一个写操作请求,所述写操作请求对应一个写操作地址。Specifically, the cache proxy sends a write operation request, and the write operation request corresponds to a write operation address.
步骤203、组合缓存区是否命中。
具体的,根据写操作地址判断组合缓存区的缓存行中是否有匹配的对比字段,若存在,则组合缓存区命中,执行步骤204,若不存在,则组合缓存区不命中,执行步骤205。根据表1中的例子,根据写操作地址判断组合缓存区中是否存在匹配的TAG,若存在,则组合缓存区命中。Specifically, according to the address of the write operation, it is judged whether there is a matching comparison field in the cache line of the combined buffer area. If it exists, the combined buffer area hits, and step 204 is performed; if not, the combined buffer area misses, and step 205 is performed. According to the example in Table 1, it is judged according to the address of the write operation whether there is a matching TAG in the combined buffer, and if so, the combined buffer hits.
步骤204,组合缓存区的缓存行是否有效。
具体的,根据命中的缓存行的有效标识位判断是否有效,若有效,执行步骤206,若无效,执行步骤205。如表1的例子,VALID为有效标识位,VALID置1标识命中的缓存行有效,置0标识命中的缓存行无效。Specifically, judge whether it is valid according to the validity flag of the hit cache line, if valid, perform
步骤205、组合缓存区中查询到空闲的缓存行或采用预置的算法查询到一条闲置的缓存行进行替换操作。In
具体的,当步骤203和/或步骤204判断为否时,即组合缓存区未命中和/或命中的缓存行无效时,执行替换操作。替换操作具体为,查询组合缓存区中是否存在空闲的缓存行,若存在,选取其中一条空闲的缓存行进行替换操作;若组合缓存区中的缓存行已装满,无空闲的缓存行,则采用LRU或FIFO算法选择一条闲置的缓存行进行替换操作,替换算法本发明不作限制。具体的替换过程参见图3,包括:Specifically, when the determination in
步骤2051、内存代理发起组合缓存区缓存行的替换操作。
具体的,在组合缓存区中无空闲的缓存行时,发起替换操作。Specifically, when there is no free cache line in the combined cache area, a replacement operation is initiated.
步骤2052、采用最近最少使用算法选择一条缓存行。Step 2052: Select a cache line using the least recently used algorithm.
具体的,LRU最近最少使用算法,符合时间局部性的原则,能有效的提高缓存命中率。Specifically, the least recently used LRU algorithm conforms to the principle of time locality and can effectively improve the cache hit rate.
步骤2053、根据目录状态信息和数据状态信息判断是否需要写回内存。
具体的,执行替换操作之前,判断选中的缓存行的目录状态信息和数据状态信息是否为脏,若为脏,则说明存储在缓存行中的数据位最新的,需要写回内存。如表1的例子,用DIR_DIRTY置1标识缓存行中目录信息为脏,用DATA_DIRTY置1标识缓存行中数据信息为脏,当然也可采用其他的标识方法,本发明不作限制。Specifically, before performing the replacement operation, it is judged whether the directory state information and data state information of the selected cache line are dirty. If it is dirty, it means that the data stored in the cache line is the latest and needs to be written back to the memory. As shown in the example in Table 1, DIR_DIRTY is set to 1 to indicate that the directory information in the cache line is dirty, and DATA_DIRTY is set to 1 to indicate that the data information in the cache line is dirty. Of course, other identification methods can also be used, which are not limited by the present invention.
步骤2054、将待替换缓存行中的目录信息和数据信息写回内存。
具体的,当步骤2053判断为是时,执行本步骤,确保内存中的数据为最新的。Specifically, when
步骤2055、所述待替换缓存行的有效标识位置为无效。
具体的,替换后的缓存行中的目录信息和数据信息被重写,不是有效的数据,为了避免读取到错误的数据,将待替换缓存行的有效标识为置为无效。Specifically, the directory information and data information in the replaced cache line are rewritten, and are not valid data. In order to avoid reading wrong data, the valid identifier of the cache line to be replaced is set as invalid.
步骤206、在命中的缓存行中写入新的数据信息和目录信息,更新所述组合缓存区描述信息中的目录状态信息和数据状态信息,并将有效标识位置为有效。例如,表1所示,将DIR_DIRTY、VALID和DATA_DIRTY均置1。Step 206: Write new data information and directory information in the hit cache line, update the directory status information and data status information in the combined cache description information, and set the valid flag position as valid. For example, as shown in Table 1, set DIR_DIRTY, VALID, and DATA_DIRTY to 1.
实施本发明的实施例,通过原有的目录缓存方案,增加对应的数据缓存,减少访问内存的次数,降低数据获得的延迟。In implementing the embodiment of the present invention, the original directory cache solution is used to increase the corresponding data cache, reduce the number of memory accesses, and reduce the delay of data acquisition.
参见图3,为本发明的一种内存数据缓冲方法的第三流程示意图,该流程包括:Referring to FIG. 3 , it is a schematic diagram of a third process flow of a memory data buffering method of the present invention, which process includes:
步骤301、在内存代理的存储器重开辟目录缓存和数据缓存。
具体的,目录缓存为内存中装入到内存代理中的部分目录信息的副本,目录信息中记录有内存行的状态信息和在缓存中的位置信息,数据缓存为内存中装入内存代理中的部分数据信息的副本,根据程序局部性原理,装入的目录缓存和数据缓存为经常访问到的数据。此处目录缓存的缓存行与数据缓存的缓存行不是一一对应的关系,目录缓存的缓存行通过数据信息标识位和数据信息身份标识与数据缓存中的缓存行关联。目录缓存的缓存行结构如下表:Specifically, the directory cache is a copy of part of the directory information loaded into the memory agent in the memory. For the copy of some data information, according to the principle of program locality, the loaded directory cache and data cache are frequently accessed data. Here, there is not a one-to-one correspondence relationship between the cache lines of the directory cache and the cache lines of the data cache, and the cache lines of the directory cache are associated with the cache lines in the data cache through the data information identification bit and the data information identifier. The cache line structure of the directory cache is as follows:
表2Table 2
数据缓存的缓存行结构如下表:The cache line structure of the data cache is as follows:
表3table 3
目录缓存中的缓存行通过数据信息标识位DATA_VALID来表示数据缓存是否命中,同时通过数据信息身份标识DATA_ID查询数据缓存的缓存行。,由上表可以看出,当数据缓存未命中,即存放数据信息的缓存行不存在于数据缓存中时,就不会分配数据信息身份标识DATA_ID。The cache line in the directory cache uses the data information identification bit DATA_VALID to indicate whether the data cache is hit, and at the same time, queries the cache line of the data cache through the data information identifier DATA_ID. , it can be seen from the above table that when the data cache misses, that is, when the cache line storing the data information does not exist in the data cache, the data information ID DATA_ID will not be allocated.
步骤302、接收缓存代理发出的读操作地址。
具体的,缓存代理发出一个读操作请求,所述读操作请求对应一个读操作地址。Specifically, the cache proxy sends a read operation request, and the read operation request corresponds to a read operation address.
步骤303、目录缓存是否命中且有效。
具体的,根据操作地址查询目录缓存中是否存在匹配的对比字段,如表2中的是否存在一个TAG与操作地址匹配,若存在,则目录缓存命中,找到命中的目录缓存中的缓存行,查询该缓存行中的有效标识位VALID来确定该缓存行是否有效,假设VALID置1为有效,VALID置0为无效,则当查询到VALID为1时,对应的缓存行为有效的,执行步骤304,查询到VALID为0时,对应的缓存行为无效的,执行步骤305。Specifically, query whether there is a matching comparison field in the directory cache according to the operation address, such as whether there is a TAG matching the operation address in Table 2, if it exists, the directory cache hits, find the cache line in the directory cache that hits, and query The valid identification bit VALID in the cache line is used to determine whether the cache line is valid, assuming that VALID is set to 1 to be valid, and VALID is set to 0 to be invalid, then when the query finds that VALID is 1, the corresponding cache behavior is valid, and step 304 is executed. When the VALID is found to be 0, the corresponding cache behavior is invalid, and step 305 is executed.
步骤305、发起操作地址对应的内存的读操作。
具体的,目录缓存未命中,表明目录缓存中不存在缓存代理需要的缓存行,需要通过内存通道从内存中读取。Specifically, the directory cache miss indicates that the cache line required by the caching proxy does not exist in the directory cache, and needs to be read from the memory through a memory channel.
步骤306、将从内存获取的目录信息和数据信息写入内存代理储存器。
具体的,将目录信息写入目录缓存,数据信息写入数据缓存中。Specifically, the directory information is written into the directory cache, and the data information is written into the data cache.
步骤304、数据缓存是否有效。
具体的,步骤303判断为是时,读取命中的目录缓存中的缓存行的数据信息标识位DATA_VALID,通过DATA_VALID的数值确定数据信息是否存在于数据缓存中,假设DATA_VALID置1标识存在于数据缓存中,置0表示不存在数据缓存中,当检测到DATA_VALID置1时,通过目录缓存的数据信息身份标识DATA_ID在数据缓存中找到对应的缓存行。Specifically, when
步骤307、直接向缓存代理返回命中缓存行中的目录信息和数据信息。
具体的,通过数据缓存中的数据有效标识位VALID的值确定数据缓存的缓存行也为有效时,直接返回目录信息和数据信息,提高访问速度。Specifically, when it is determined by the value of the valid data identification bit VALID in the data cache that the cache line of the data cache is also valid, the directory information and data information are directly returned to improve the access speed.
实施本发明的实施例,通过原有的目录缓存方案,增加对应的数据缓存,减少访问内存的次数,降低数据获得的延迟。In implementing the embodiment of the present invention, the original directory cache solution is used to increase the corresponding data cache, reduce the number of memory accesses, and reduce the delay of data acquisition.
参见图5,为本发明的一种内存数据缓冲方法的第四流程示意图,该流程包括:Referring to FIG. 5, it is a schematic diagram of a fourth process flow of a memory data buffering method of the present invention, which process includes:
步骤401、在内存代理的存储器中开辟目录缓存和数据缓存。
具体的,目录缓存为内存中装入到内存代理中的部分目录信息的副本,目录信息中记录有内存行的状态信息和在缓存中的位置信息,数据缓存为内存中装入内存代理中的部分数据信息的副本,根据程序局部性原理,装入的目录缓存和数据缓存为经常访问到的数据。此处目录缓存的缓存行与数据缓存的缓存行不是一一对应的关系,目录缓存的缓存行通过数据信息标识位和数据信息身份标识与数据缓存中的缓存行关联。Specifically, the directory cache is a copy of part of the directory information loaded into the memory agent in the memory. For the copy of some data information, according to the principle of program locality, the loaded directory cache and data cache are frequently accessed data. Here, there is not a one-to-one correspondence relationship between the cache lines of the directory cache and the cache lines of the data cache, and the cache lines of the directory cache are associated with the cache lines in the data cache through the data information identification bit and the data information identifier.
步骤402、接收缓存代理发出的写操作地址。
具体的,缓存代理发出一个写操作请求,所述读操作请求对应一个写操作地址。Specifically, the cache proxy sends a write operation request, and the read operation request corresponds to a write operation address.
步骤403、目录缓存命中且有效。
具体的,根据目录缓存的对比字段和目录有效标识位确定目录缓存命中且有效,方法上面以作描述。Specifically, it is determined that the directory cache hits and is valid according to the comparison field of the directory cache and the valid identifier bit of the directory, and the method is described above.
步骤404、更新命中的目录缓存的缓存行。
步骤405、数据缓存中的缓存行是否需要更新。
具体的,若写操作请求涉及到数据缓存的缓存行的更新,则继续执行该步骤406,若不涉及到数据缓存的缓存行的更新,则执行步骤409。Specifically, if the write operation request involves the update of the cache lines of the data cache, then continue to perform
步骤406、对应的缓存行是否在数据缓存中。
根据目录缓存的数据信息标识位确定对应的数据缓存的缓存行是否存在于数据缓存中,若存在,执行步骤408,若不存在,执行步骤409。Determine whether the cache line of the corresponding data cache exists in the data cache according to the data information identification bit of the directory cache. If yes, perform
步骤408、根据数据信息身份标识写入对应的缓存行。
具体的,根据目录缓存中的数据信息身份标识查询到数据缓存中需要写操作的缓存行,将更新的数据写入该缓存行中。Specifically, the cache line in the data cache that needs to be written is queried according to the data information identifier in the directory cache, and the updated data is written into the cache line.
步骤407、数据缓存中查询到空闲的缓存行或采用预置算法查询到一条闲置的缓存行进行替换操作。In
具体的,替换操作上面以作描述,此处不再敖述。当对目录缓存或数据缓存进行替换操作之前,首先要检测目录状态信息和数据状态信息,即表2中的DIR_DIRTY和DATA_DIRTY是否为脏,若为脏,则进行写回内存操作,再进行替换操作。Specifically, the replacement operation is described above, and will not be described here. Before replacing the directory cache or data cache, first check the directory status information and data status information, that is, whether the DIR_DIRTY and DATA_DIRTY in Table 2 are dirty, and if they are dirty, write back to the memory operation, and then perform the replacement operation .
步骤409、更新数据状态信息和目录状态信息。
具体的,目录缓存和数据缓存中的缓存行被修改过,将数据状态信息和目录状态信息置为脏。Specifically, the cache lines in the directory cache and the data cache are modified, and the data status information and the directory status information are set as dirty.
实施本发明的实施例,通过原有的目录缓存方案,增加对应的数据缓存,减少访问内存的次数,降低数据获得的延迟。In implementing the embodiment of the present invention, the original directory cache solution is used to increase the corresponding data cache, reduce the number of memory accesses, and reduce the delay of data acquisition.
参见图6,为本发明的一种内存数据缓冲装置的第一结构示意图,该装置包括:Referring to Fig. 6, it is a schematic diagram of the first structure of a memory data buffering device of the present invention, which device includes:
缓存分配模块11,用于在内存代理Home Agent的存储器中开辟至少包括目录缓存和数据缓存的组合缓存区,所述目录缓存中的缓存行和所述数据缓存中的缓存行一一对应。The
具体的,目录缓存为内存中装入到内存代理中的目录信息内存行的副本,目录信息中记录有内存行的状态信息和在缓存中的位置信息,状态信息指的是无效、独占、脏和共享状态,位置信息指的是内存行具体被装入到哪个CPU的缓存中,每一个内存行数据对应一个目录信息,根据局部性原理,目录缓存中只缓冲有部分经常访问到的目录信息,缓存分配模块11将数据缓存中的数据缓存行与目录缓存中的目录缓存行一一对应,即目录缓存行中记录的为对应的数据缓存中的数据缓存行的状态信息和位置信息,由于这种一一对应的关系,可以目录缓存行和数据缓存行关联成一个组合缓存行。Specifically, the directory cache is a copy of the directory information memory line loaded into the memory agent in the memory. The state information of the memory line and the location information in the cache are recorded in the directory information. The state information refers to invalid, exclusive, dirty And shared state, the location information refers to which CPU cache the memory row is loaded into. Each memory row data corresponds to a directory information. According to the principle of locality, only part of the directory information that is frequently accessed is buffered in the directory cache. , the
操作执行模块12,用于接收缓存代理Cache Agent发出的操作地址,根据所述操作地址判断所述组合缓存区是否命中且有效,若为是,则直接对所述组合缓存区执行相应的操作。The
实施本发明的实施例,通过原有的目录缓存方案,增加对应的数据缓存,减少访问内存的次数,降低数据获得的延迟。In implementing the embodiment of the present invention, the original directory cache solution is used to increase the corresponding data cache, reduce the number of memory accesses, and reduce the delay of data acquisition.
进一步的,参见图7和图8,为本发明的一种内存数据缓冲装置的第二结构示意图,除缓存分配模块11和操作执行模块12之外,还包括:Further, referring to FIG. 7 and FIG. 8 , it is a second structural schematic diagram of a memory data buffering device of the present invention, in addition to the
替换模块13,替换模块,用于接收缓存代理Cache Agent发出的操作地址,根据所述操作地址判断所述组合缓存区未命中时,采用LRU最近最少使用算法选择所述组合缓存区中的待替换缓存行,根据所述待替换缓存行的目录状态信息和数据状态信息判断是否需要将所述待替换缓存行中的目录信息和数据信息写回内存;将所述待替换缓存行的有效标志位置为无效。
其中,操作执行模块12包括:Wherein, the
命中有效判断单元121,用于根据所述操作地址查询所述组合缓存区中是否存在匹配的对比字段,若存在,则所述组合缓存区命中;和A hit
根据所述组合缓存区中命中的缓存行的有效标志位判断所述命中的缓存行是否有效;其中,所述组合缓存区包括描述信息,所述描述信息包括:对比字段、目录状态信息、数据状态信息和有效标志位。Determine whether the hit cache line is valid according to the valid flag bit of the hit cache line in the combined cache area; wherein, the combined cache area includes description information, and the description information includes: a comparison field, directory status information, data Status information and valid flag bits.
操作执行模块12还包括;The
读操作执行单元122,用于直接向所述缓存代理返回所述命中的缓存行中的目录信息和数据信息。The read
操作执行模块还包括:The operation execution module also includes:
写操作执行单元123,用于在所述命中的缓存行中写入新的数据信息和目录信息,更新所述组合缓存区描述信息中的目录状态信息和数据状态信息,并将有效标志位置为有效。The write
实施本发明的实施例,通过原有的目录缓存方案,增加对应的数据缓存,减少访问内存的次数,降低数据获得的延迟。In implementing the embodiment of the present invention, the original directory cache solution is used to increase the corresponding data cache, reduce the number of memory accesses, and reduce the delay of data acquisition.
参见图9、为本发明的一种内存数据缓冲装置的第三结构示意图,包括处理器61和存储器62,装置1中的处理器61的数量可以是一个或多个,图9以一个处理器为例。本发明的一些实施例中,处理器61和存储器62可通过总线或其他方式连接,图10中以总线连接为例。Referring to FIG. 9 , it is a schematic diagram of the third structure of a memory data buffering device of the present invention, including a
其中,存储器62中存储一组程序代码,且处理器61用于调用存储器62中存储的程序代码,用于执行以下操作:Wherein, a set of program codes are stored in the
在内存代理Home Agent的存储器中开辟至少包括目录缓存和数据缓存的组合缓存区,所述目录缓存中的缓存行和所述数据缓存中的缓存行一一对应;In the memory of the memory agent Home Agent, open up a combined cache area comprising at least a directory cache and a data cache, and the cache lines in the directory cache correspond to the cache lines in the data cache;
接收缓存代理Cache Agent发出的操作地址,根据所述操作地址判断所述组合缓存区是否命中且有效,若为是,则直接对所述组合缓存区执行相应的操作。Receive the operation address sent by the cache agent Cache Agent, judge whether the combined cache area is hit and valid according to the operation address, and if yes, directly perform the corresponding operation on the combined cache area.
在本发明的一些实施例中,处理器具体用于执行:In some embodiments of the present invention, the processor is specifically configured to perform:
根据所述操作地址查询所述组合缓存区中是否存在匹配的对比字段,若存在,则所述组合缓存区命中;和Query whether there is a matching comparison field in the combined buffer according to the operation address, and if it exists, the combined buffer hits; and
根据所述组合缓存区中命中的缓存行的有效标志位判断所述命中的缓存行是否有效;其中,所述组合缓存区包括描述信息,所述描述信息包括:对比字段、目录状态信息、数据状态信息和有效标志位。Determine whether the hit cache line is valid according to the valid flag bit of the hit cache line in the combined cache area; wherein, the combined cache area includes description information, and the description information includes: a comparison field, directory status information, data Status information and valid flag bits.
进一步的,处理器61还具体用于执行:Further, the
直接向所述缓存代理返回所述命中的缓存行中的目录信息和数据信息。Directly return the directory information and data information in the hit cache line to the cache proxy.
进一步的,处理器61具体用于执行:Further, the
在所述命中的缓存行中写入新的数据信息和目录信息,更新所述组合缓存区描述信息中的目录状态信息和数据状态信息,并将有效标志位置为有效。Write new data information and directory information in the hit cache line, update the directory status information and data status information in the combined buffer description information, and set the valid flag position as valid.
进一步的,处理器61还用于执行:Further, the
接收缓存代理Cache Agent发出的操作地址,根据所述操作地址判断所述组合缓存区未命中时,采用LRU最近最少使用算法选择所述组合缓存区中的待替换缓存行,根据所述待替换缓存行的目录状态信息和数据状态信息判断是否需要将所述待替换缓存行中的目录信息和数据信息写回内存;Receive the operating address sent by the cache agent Cache Agent, and when judging that the combined buffer area misses according to the operating address, adopt the LRU least recently used algorithm to select the cache line to be replaced in the combined buffer area, according to the cache line to be replaced The directory status information and data status information of the line determine whether the directory information and data information in the cache line to be replaced need to be written back to the memory;
将所述待替换缓存行的有效标志位置为无效。Setting the effective flag position of the cache line to be replaced as invalid.
实施本发明的实施例,通过原有的目录缓存方案,增加对应的数据缓存,减少访问内存的次数,降低数据获得的延迟。In implementing the embodiment of the present invention, the original directory cache solution is used to increase the corresponding data cache, reduce the number of memory accesses, and reduce the delay of data acquisition.
参见图10、为本发明的一种内存数据缓冲装置的第四结构示意图,包括:Referring to FIG. 10 , it is a schematic diagram of the fourth structure of a memory data buffering device of the present invention, including:
缓存分配模块21,用于在内存代理Home Agent的存储器中开辟目录缓存和数据缓存,所述目录缓存中的缓存行和所述数据缓存中的缓存行不是一一对应。The
操作执行模块22,用于接收缓存代理Cache Agent发出的操作地址,根据所述操作地址判断所述目录缓存和所述数据缓存是否命中且有效,若为是,则直接对所述目录缓存和所述数据缓存执行相应的操作。The
实施本发明的实施例,通过原有的目录缓存方案,增加对应的数据缓存,减少访问内存的次数,降低数据获得的延迟。In implementing the embodiment of the present invention, the original directory cache solution is used to increase the corresponding data cache, reduce the number of memory accesses, and reduce the delay of data acquisition.
进一步的,参见图11-12,为本发明的一种内存数据缓冲装置的第五结构示意图,除缓存分配模块21和操作执行模块22外,还包括:Further, referring to FIGS. 11-12 , it is a schematic diagram of the fifth structure of a memory data buffering device of the present invention, in addition to the
替换模块23,用于根据所述被命中的缓存行的数据信息标识位判断所述数据缓存未命中时,采用LRU最近最少使用算法在所述数据缓存中剔除一个闲置的缓存行。The
其中,操作执行模块22包括:Wherein, the
命中有效判断单元221,用于根据所述操作地址查询所述目录缓存是否存在匹配的对比字段,若存在,则所述目录缓存命中;A hit
根据所述目录缓存中命中的缓存行的目录有效标志位判断所述命中的缓存行是否有效,若为是,则根据所述被命中的缓存行的数据信息标识位判断所述数据缓存是否命中;Judging whether the hit cache line is valid according to the directory valid flag bit of the hit cache line in the directory cache, if yes, judging whether the data cache is hit according to the data information flag bit of the hit cache line ;
根据命中的所述数据缓的缓存行中的数据有效标识位判断该命中的所述数据缓存中的缓存行是否有效;所述目录缓存包括目录描述信息,所述目录描述信息包括对比字段、目录状态信息、数据信息标识位、数据信息身份标识和目录有效标识位;所述数据缓存包括数据描述信息,所述数据描述信息包括数据状态信息和数据有效标识位。Judging whether the cache line in the hit data cache is valid according to the data valid flag in the cache line of the hit data cache; the directory cache includes directory description information, and the directory description information includes a comparison field, a directory State information, data information identification, data information identification and directory effective identification; the data cache includes data description information, and the data description information includes data status information and data effective identification.
操作执行单元22包括;The
读操作执行单元222,用于直接向所述缓存代理返回命中的目录缓存的缓存行中的目录信息和命中的数据缓存的缓存行中的数据信息。The read
操作执行单元22包括:The
写操作执行单元223,用于在所述命中的目录缓存的缓存行中写入新的目录信息和所述命中的数据缓存的缓存行中写入新的数据信息。The write
实施本发明的实施例,通过原有的目录缓存方案,增加对应的数据缓存,减少访问内存的次数,降低数据获得的延迟。In implementing the embodiment of the present invention, the original directory cache solution is used to increase the corresponding data cache, reduce the number of memory accesses, and reduce the delay of data acquisition.
参见图13,为本发明的一种内存数据缓冲方法的第六结构示意图,包括处理器71和存储器72,装置1中的处理器71的数量可以是一个或多个,图13以一个处理器为例。本发明的一些实施例中,处理器71和存储器72可通过总线或其他方式连接,图13中以总线连接为例。Referring to FIG. 13 , it is a sixth structural diagram of a memory data buffering method of the present invention, including a processor 71 and a memory 72. The number of processors 71 in the
其中,存储器72中存储一组程序代码,且处理器71用于调用存储器72中存储的程序代码,用于执行以下操作:Wherein, a set of program codes are stored in the memory 72, and the processor 71 is used to call the program codes stored in the memory 72 to perform the following operations:
在内存代理Home Agent的存储器中开辟目录缓存和数据缓,所述目录缓存中的缓存行和所述数据缓存中的缓存行不是一一对应;Open up directory cache and data cache in the memory of memory proxy Home Agent, the cache line in the directory cache and the cache line in the data cache are not one-to-one correspondence;
接收缓存代理Cache Agent发出的操作地址,根据所述操作地址判断所述目录缓存和所述数据缓存是否命中且有效,若为是,则直接对所述目录缓存和所述数据缓存执行相应的操作。Receive the operation address sent by the cache agent Cache Agent, judge whether the directory cache and the data cache are hit and valid according to the operation address, if yes, directly perform corresponding operations on the directory cache and the data cache .
进一步的,处理器71具体用于执行:Further, the processor 71 is specifically configured to execute:
根据所述操作地址查询所述目录缓存是否存在匹配的对比字段,若存在,则所述目录缓存命中;Query whether there is a matching comparison field in the directory cache according to the operation address, and if it exists, the directory cache hits;
根据所述目录缓存中命中的缓存行的目录有效标志位判断所述命中的缓存行是否有效,若为是,则根据所述被命中的缓存行的数据信息标识位判断所述数据缓存是否命中;Judging whether the hit cache line is valid according to the directory valid flag bit of the hit cache line in the directory cache, if yes, judging whether the data cache is hit according to the data information flag bit of the hit cache line ;
根据命中的所述数据缓的缓存行中的数据有效标识位判断该命中的所述数据缓存中的缓存行是否有效;所述目录缓存包括目录描述信息,所述目录描述信息包括对比字段、目录状态信息、数据信息标识位、数据信息身份标识和目录有效标识位;所述数据缓存包括数据描述信息,所述数据描述信息包括数据状态信息和数据有效标识位。Judging whether the cache line in the hit data cache is valid according to the data valid flag in the cache line of the hit data cache; the directory cache includes directory description information, and the directory description information includes a comparison field, a directory State information, data information identification, data information identification and directory effective identification; the data cache includes data description information, and the data description information includes data status information and data effective identification.
进一步的,处理器71具体用于执行:Further, the processor 71 is specifically configured to execute:
直接向所述缓存代理返回命中的目录缓存的缓存行中的目录信息和命中的数据缓存的缓存行中的数据信息。The directory information in the cache line of the hit directory cache and the data information in the cache line of the hit data cache are directly returned to the cache proxy.
进一步的,处理器71具体用于执行:Further, the processor 71 is specifically configured to execute:
在所述命中的目录缓存的缓存行中写入新的目录信息和所述命中的数据缓存的缓存行中写入新的数据信息。Writing new directory information into the cache line of the hit directory cache and writing new data information into the cache line of the hit data cache.
在本发明的一些实施例中,处理器71还用于执行:In some embodiments of the present invention, the processor 71 is also used to execute:
根据所述命中的数据缓存的缓存行的数据信息标识位判断所述数据缓存未命中时,采用LRU最近最少使用算法在所述数据缓存中剔除一个闲置的缓存行。When judging that the data cache misses according to the data information flag of the cache line of the hit data cache, an LRU least recently used algorithm is used to remove an idle cache line from the data cache.
实施本发明的实施例,通过原有的目录缓存方案,增加对应的数据缓存,减少访问内存的次数,降低数据获得的延迟。In implementing the embodiment of the present invention, the original directory cache solution is used to increase the corresponding data cache, reduce the number of memory accesses, and reduce the delay of data acquisition.
本领域普通技术人员可以理解实现上述实施例方法中的全部或部分流程,是可以通过计算机程序来指令相关的硬件来完成,所述的程序可存储于一计算机可读取存储介质中,该程序在执行时,可包括如上述各方法的实施例的流程。其中,所述的存储介质可为磁碟、光盘、只读存储记忆体(Read-OnlyMemory,ROM)或随机存储记忆体(Random Access Memory,RAM)等。Those of ordinary skill in the art can understand that all or part of the processes in the methods of the above embodiments can be implemented through computer programs to instruct related hardware, and the programs can be stored in a computer-readable storage medium. During execution, it may include the processes of the embodiments of the above-mentioned methods. Wherein, the storage medium may be a magnetic disk, an optical disk, a read-only memory (Read-Only Memory, ROM) or a random access memory (Random Access Memory, RAM), etc.
以上所揭露的仅为本发明一种较佳实施例而已,当然不能以此来限定本发明之权利范围,本领域普通技术人员可以理解实现上述实施例的全部或部分流程,并依本发明权利要求所作的等同变化,仍属于发明所涵盖的范围。What is disclosed above is only a preferred embodiment of the present invention, and of course it cannot limit the scope of rights of the present invention. Those of ordinary skill in the art can understand all or part of the process for realizing the above embodiments, and according to the rights of the present invention The equivalent changes required still belong to the scope covered by the invention.
Claims (20)
Priority Applications (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN201210578615.3A CN103076992B (en) | 2012-12-27 | 2012-12-27 | A kind of internal storage data way to play for time and device |
Applications Claiming Priority (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN201210578615.3A CN103076992B (en) | 2012-12-27 | 2012-12-27 | A kind of internal storage data way to play for time and device |
Publications (2)
Publication Number | Publication Date |
---|---|
CN103076992A true CN103076992A (en) | 2013-05-01 |
CN103076992B CN103076992B (en) | 2016-09-28 |
Family
ID=48153532
Family Applications (1)
Application Number | Title | Priority Date | Filing Date |
---|---|---|---|
CN201210578615.3A Active CN103076992B (en) | 2012-12-27 | 2012-12-27 | A kind of internal storage data way to play for time and device |
Country Status (1)
Country | Link |
---|---|
CN (1) | CN103076992B (en) |
Cited By (10)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
WO2014206234A1 (en) * | 2013-06-25 | 2014-12-31 | 华为技术有限公司 | Caching method and device |
CN104331377A (en) * | 2014-11-12 | 2015-02-04 | 浪潮(北京)电子信息产业有限公司 | Management method for directory cache of multi-core processor system |
CN107992357A (en) * | 2016-10-26 | 2018-05-04 | 华为技术有限公司 | Memory pool access method and multicomputer system |
CN108108312A (en) * | 2016-11-25 | 2018-06-01 | 华为技术有限公司 | A kind of cache method for cleaning and processor |
CN109669897A (en) * | 2017-10-13 | 2019-04-23 | 华为技术有限公司 | Data transmission method and device |
CN111339210A (en) * | 2018-12-18 | 2020-06-26 | 杭州海康威视数字技术股份有限公司 | Data clustering method and device |
CN112114756A (en) * | 2020-09-27 | 2020-12-22 | 海光信息技术有限公司 | Storage system and electronic device |
CN112698968A (en) * | 2020-12-28 | 2021-04-23 | 艾体威尔电子技术(北京)有限公司 | Method for processing received data between asynchronous communications |
WO2021103020A1 (en) * | 2019-11-29 | 2021-06-03 | 华为技术有限公司 | Cache memory and method for allocating write operation |
CN114036084A (en) * | 2021-11-17 | 2022-02-11 | 海光信息技术股份有限公司 | Data access method, shared cache, chip system and electronic equipment |
Citations (3)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
JPH01125639A (en) * | 1987-11-11 | 1989-05-18 | Fujitsu Ltd | Disk cache control system |
JP2010165151A (en) * | 2009-01-15 | 2010-07-29 | Mitsubishi Electric Corp | Data access device and data access program |
CN102063264B (en) * | 2009-11-18 | 2012-08-29 | 成都市华为赛门铁克科技有限公司 | Data processing method, equipment and system |
-
2012
- 2012-12-27 CN CN201210578615.3A patent/CN103076992B/en active Active
Patent Citations (3)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
JPH01125639A (en) * | 1987-11-11 | 1989-05-18 | Fujitsu Ltd | Disk cache control system |
JP2010165151A (en) * | 2009-01-15 | 2010-07-29 | Mitsubishi Electric Corp | Data access device and data access program |
CN102063264B (en) * | 2009-11-18 | 2012-08-29 | 成都市华为赛门铁克科技有限公司 | Data processing method, equipment and system |
Cited By (13)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
WO2014206234A1 (en) * | 2013-06-25 | 2014-12-31 | 华为技术有限公司 | Caching method and device |
CN104331377A (en) * | 2014-11-12 | 2015-02-04 | 浪潮(北京)电子信息产业有限公司 | Management method for directory cache of multi-core processor system |
CN104331377B (en) * | 2014-11-12 | 2018-06-26 | 浪潮(北京)电子信息产业有限公司 | A kind of Directory caching management method of multi-core processor system |
CN107992357A (en) * | 2016-10-26 | 2018-05-04 | 华为技术有限公司 | Memory pool access method and multicomputer system |
CN108108312A (en) * | 2016-11-25 | 2018-06-01 | 华为技术有限公司 | A kind of cache method for cleaning and processor |
CN109669897A (en) * | 2017-10-13 | 2019-04-23 | 华为技术有限公司 | Data transmission method and device |
CN111339210A (en) * | 2018-12-18 | 2020-06-26 | 杭州海康威视数字技术股份有限公司 | Data clustering method and device |
CN111339210B (en) * | 2018-12-18 | 2023-04-28 | 杭州海康威视数字技术股份有限公司 | Data clustering method and device |
WO2021103020A1 (en) * | 2019-11-29 | 2021-06-03 | 华为技术有限公司 | Cache memory and method for allocating write operation |
CN112114756A (en) * | 2020-09-27 | 2020-12-22 | 海光信息技术有限公司 | Storage system and electronic device |
CN112698968A (en) * | 2020-12-28 | 2021-04-23 | 艾体威尔电子技术(北京)有限公司 | Method for processing received data between asynchronous communications |
CN112698968B (en) * | 2020-12-28 | 2024-06-11 | 艾体威尔电子技术(北京)有限公司 | Received data processing method between asynchronous communication |
CN114036084A (en) * | 2021-11-17 | 2022-02-11 | 海光信息技术股份有限公司 | Data access method, shared cache, chip system and electronic equipment |
Also Published As
Publication number | Publication date |
---|---|
CN103076992B (en) | 2016-09-28 |
Similar Documents
Publication | Publication Date | Title |
---|---|---|
CN103076992B (en) | A kind of internal storage data way to play for time and device | |
US9665486B2 (en) | Hierarchical cache structure and handling thereof | |
US10346302B2 (en) | Systems and methods for maintaining the coherency of a store coalescing cache and a load cache | |
JP4737691B2 (en) | Exclusive ownership snoop filter | |
Elver et al. | TSO-CC: Consistency directed cache coherence for TSO | |
US8015365B2 (en) | Reducing back invalidation transactions from a snoop filter | |
US9170946B2 (en) | Directory cache supporting non-atomic input/output operations | |
TWI676891B (en) | Translation lookaside buffer management | |
CN113342709B (en) | Method for accessing data in multiprocessor system and multiprocessor system | |
US20140143493A1 (en) | Bypassing a Cache when Handling Memory Requests | |
US20070226424A1 (en) | Low-cost cache coherency for accelerators | |
US20120102273A1 (en) | Memory agent to access memory blade as part of the cache coherency domain | |
US10339058B2 (en) | Automatic cache coherency for page table data | |
JP2018504694A5 (en) | ||
JP2018504694A (en) | Cache accessed using virtual address | |
US20090216947A1 (en) | System, method and processor for accessing data after a translation lookaside buffer miss | |
CN108089995A (en) | Method for refreshing cache contents in computing system and system for refreshing cache contents | |
US10552334B2 (en) | Systems and methods for acquiring data for loads at different access times from hierarchical sources using a load queue as a temporary storage buffer and completing the load early | |
US20140006716A1 (en) | Data control using last accessor information | |
CN106339330A (en) | Method and system for cache refresh | |
US8489822B2 (en) | Providing a directory cache for peripheral devices | |
US20150052293A1 (en) | Hidden core to fetch data | |
CN108268384A (en) | Read the method and device of data | |
WO2017016427A1 (en) | Method and device for maintaining cache data consistency according to directory information | |
CN114303135A (en) | Facilitating Page Table Entry (PTE) maintenance in a processor-based device |
Legal Events
Date | Code | Title | Description |
---|---|---|---|
C06 | Publication | ||
PB01 | Publication | ||
C10 | Entry into substantive examination | ||
SE01 | Entry into force of request for substantive examination | ||
C14 | Grant of patent or utility model | ||
GR01 | Patent grant | ||
TR01 | Transfer of patent right |
Effective date of registration: 20200423 Address after: 518129 Bantian HUAWEI headquarters office building, Longgang District, Guangdong, Shenzhen Patentee after: HUAWEI TECHNOLOGIES Co.,Ltd. Address before: 301, A building, room 3, building 301, foreshore Road, No. 310053, Binjiang District, Zhejiang, Hangzhou Patentee before: Hangzhou Huawei Digital Technology Co.,Ltd. |
|
TR01 | Transfer of patent right | ||
TR01 | Transfer of patent right |
Effective date of registration: 20211227 Address after: 450046 Floor 9, building 1, Zhengshang Boya Plaza, Longzihu wisdom Island, Zhengdong New Area, Zhengzhou City, Henan Province Patentee after: xFusion Digital Technologies Co., Ltd. Address before: 518129 Bantian HUAWEI headquarters office building, Longgang District, Guangdong, Shenzhen Patentee before: HUAWEI TECHNOLOGIES Co.,Ltd. |
|
TR01 | Transfer of patent right | ||
TR01 | Transfer of patent right |
Effective date of registration: 20250306 Address after: 450046, 10th Floor, North Chuangzhi Tiandi Building, Dongshigeng Street, Longzihu Wisdom Island Middle Road East, Zhengdong New District, Zhengzhou City, Henan Province Patentee after: Henan Kunlun Technology Co.,Ltd. Country or region after: China Patentee after: xFusion Digital Technologies Co., Ltd. Address before: 450046 Floor 9, building 1, Zhengshang Boya Plaza, Longzihu wisdom Island, Zhengdong New Area, Zhengzhou City, Henan Province Patentee before: xFusion Digital Technologies Co., Ltd. Country or region before: China |
|
TR01 | Transfer of patent right |