CN112416436B - Information processing method, information processing device and electronic equipment - Google Patents
Information processing method, information processing device and electronic equipment Download PDFInfo
- Publication number
- CN112416436B CN112416436B CN202011403652.1A CN202011403652A CN112416436B CN 112416436 B CN112416436 B CN 112416436B CN 202011403652 A CN202011403652 A CN 202011403652A CN 112416436 B CN112416436 B CN 112416436B
- Authority
- CN
- China
- Prior art keywords
- address
- predicted
- virtual address
- level cache
- historical
- 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.)
- Active
Links
Images
Classifications
-
- G—PHYSICS
- G06—COMPUTING OR CALCULATING; COUNTING
- G06F—ELECTRIC DIGITAL DATA PROCESSING
- G06F9/00—Arrangements for program control, e.g. control units
- G06F9/06—Arrangements for program control, e.g. control units using stored programs, i.e. using an internal store of processing equipment to receive or retain programs
- G06F9/30—Arrangements for executing machine instructions, e.g. instruction decode
- G06F9/38—Concurrent instruction execution, e.g. pipeline or look ahead
- G06F9/3802—Instruction prefetching
- G06F9/3814—Implementation provisions of instruction buffers, e.g. prefetch buffer; banks
-
- G—PHYSICS
- G06—COMPUTING OR CALCULATING; COUNTING
- G06F—ELECTRIC DIGITAL DATA PROCESSING
- G06F12/00—Accessing, addressing or allocating within memory systems or architectures
- G06F12/02—Addressing or allocation; Relocation
- G06F12/08—Addressing or allocation; Relocation in hierarchically structured memory systems, e.g. virtual memory systems
- G06F12/0802—Addressing of a memory level in which the access to the desired data or data block requires associative addressing means, e.g. caches
- G06F12/0862—Addressing of a memory level in which the access to the desired data or data block requires associative addressing means, e.g. caches with prefetch
-
- Y—GENERAL TAGGING OF NEW TECHNOLOGICAL DEVELOPMENTS; GENERAL TAGGING OF CROSS-SECTIONAL TECHNOLOGIES SPANNING OVER SEVERAL SECTIONS OF THE IPC; TECHNICAL SUBJECTS COVERED BY FORMER USPC CROSS-REFERENCE ART COLLECTIONS [XRACs] AND DIGESTS
- Y02—TECHNOLOGIES OR APPLICATIONS FOR MITIGATION OR ADAPTATION AGAINST CLIMATE CHANGE
- Y02D—CLIMATE CHANGE MITIGATION TECHNOLOGIES IN INFORMATION AND COMMUNICATION TECHNOLOGIES [ICT], I.E. INFORMATION AND COMMUNICATION TECHNOLOGIES AIMING AT THE REDUCTION OF THEIR OWN ENERGY USE
- Y02D10/00—Energy efficient computing, e.g. low power processors, power management or thermal management
Landscapes
- Engineering & Computer Science (AREA)
- Theoretical Computer Science (AREA)
- Software Systems (AREA)
- Physics & Mathematics (AREA)
- General Engineering & Computer Science (AREA)
- General Physics & Mathematics (AREA)
- Memory System Of A Hierarchy Structure (AREA)
Abstract
一种信息处理方法、信息处理装置、电子设备。该信息处理方法包括:获取历史读取请求的读取信息,历史读取请求指示在历史时刻处理器核请求读取的第一存储信息,读取信息包括第一存储信息的历史虚拟地址和历史物理地址;根据历史虚拟地址,预测处理器核在未来时刻请求读取的第二存储信息所在的预测虚拟地址;判断预测虚拟地址与历史虚拟地址是否在同一个虚拟地址页中;响应于预测虚拟地址与历史虚拟地址在同一个虚拟地址页中,根据历史虚拟地址、历史物理地址和预测虚拟地址确定第一预测物理地址。该信息处理方法可以提高预先提取信息的时效性。
An information processing method, an information processing device, and electronic equipment. The information processing method includes: acquiring read information of a historical read request, where the historical read request indicates the first stored information requested to be read by the processor core at historical moments, and the read information includes the historical virtual address and the historical virtual address of the first stored information Physical address; according to the historical virtual address, predict the predicted virtual address where the processor core requests to read the second storage information at a future moment; judge whether the predicted virtual address and the historical virtual address are in the same virtual address page; respond to the predicted virtual address The address and the historical virtual address are in the same virtual address page, and the first predicted physical address is determined according to the historical virtual address, the historical physical address and the predicted virtual address. The information processing method can improve the timeliness of pre-extracting information.
Description
技术领域technical field
本公开的实施例涉及一种信息处理方法、信息处理装置和电子设备。Embodiments of the present disclosure relate to an information processing method, an information processing device, and electronic equipment.
背景技术Background technique
指令数据预取是提升高性能中央处理单元(CPU)的性能的关键技术之一。缓存只能保存CPU核最近访问过的数据。当读取从未被访问的数据或是由于缓存大小限制被踢出的数据时,CPU核仍然需要等待数十甚至上百个时钟周期,造成性能损失。指令与数据预取能够根据数据访问规律来提前预取即将被使用的数据,从而减少CPU核等待数据的时钟周期,并提升CPU整体性能。Instruction data prefetching is one of the key technologies for improving the performance of a high-performance central processing unit (CPU). The cache can only hold data that has been recently accessed by the CPU core. When reading data that has never been accessed or data that has been kicked out due to cache size limitations, the CPU core still needs to wait for tens or even hundreds of clock cycles, resulting in performance loss. Instruction and data prefetching can prefetch the data to be used in advance according to the data access rules, thereby reducing the clock cycle of the CPU core waiting for data and improving the overall performance of the CPU.
发明内容Contents of the invention
本公开至少一个实施例提供一种信息处理方法,包括:获取历史读取请求的读取信息,历史读取请求由处理器的处理器核发送,历史读取请求指示在历史时刻处理器核请求读取第一存储信息,读取信息包括第一存储信息的历史虚拟地址和历史物理地址,历史物理地址与历史虚拟地址相对应;根据历史虚拟地址,预测处理器核在未来时刻请求读取的第二存储信息所在的预测虚拟地址;判断预测虚拟地址与历史虚拟地址是否在同一个虚拟地址页中;响应于预测虚拟地址与历史虚拟地址在同一个虚拟地址页中,根据历史虚拟地址、历史物理地址和预测虚拟地址确定第一预测物理地址,第一预测物理地址与预测虚拟地址相对应。At least one embodiment of the present disclosure provides an information processing method, including: acquiring read information of a historical read request, the historical read request is sent by the processor core of the processor, and the historical read request indicates that the processor core requested at a historical time Read the first storage information, the read information includes the historical virtual address and historical physical address of the first storage information, the historical physical address corresponds to the historical virtual address; according to the historical virtual address, predict the processor core to request to read at a future moment The predicted virtual address where the second storage information is located; judge whether the predicted virtual address and the historical virtual address are in the same virtual address page; in response to the predicted virtual address and the historical virtual address being in the same virtual address page, according to the historical virtual address, historical The physical address and the predicted virtual address determine a first predicted physical address, the first predicted physical address corresponding to the predicted virtual address.
例如,在本公开一实施例提供的信息处理方法中,响应于预测虚拟地址与历史虚拟地址在同一个虚拟地址页中,根据历史虚拟地址、历史物理地址和预测虚拟地址确定第一预测物理地址,包括:响应于预测虚拟地址与历史虚拟地址在同一个虚拟地址页中,将预测虚拟地址与历史虚拟地址之间的偏移量与历史物理地址的和作为第一预测物理地址。For example, in the information processing method provided by an embodiment of the present disclosure, in response to the predicted virtual address and the historical virtual address being in the same virtual address page, the first predicted physical address is determined according to the historical virtual address, historical physical address and predicted virtual address , comprising: in response to the predicted virtual address and the historical virtual address being in the same virtual address page, taking the sum of the offset between the predicted virtual address and the historical virtual address and the historical physical address as the first predicted physical address.
例如,在本公开一实施例提供的信息处理方法中,处理器包括多级缓存,多级缓存至少包括第一级缓存和第二级缓存,第一级缓存为多级缓存中与处理器核电连接并且与处理器核直接传输数据的缓存,第二级缓存为与第一级缓存电连接并且通过第一级缓存与处理器核传输数据的缓存,方法还包括:确定第二存储信息的目标缓存,目标缓存包括第一级缓存或者第二级缓存;判断预测虚拟地址与历史虚拟地址是否在同一个虚拟地址页中,包括:响应于目标缓存为第二级缓存,判断预测虚拟地址与历史虚拟地址是否在同一个虚拟地址页中。For example, in the information processing method provided by an embodiment of the present disclosure, the processor includes a multi-level cache, and the multi-level cache includes at least a first-level cache and a second-level cache, and the first-level cache is a A cache that is connected and directly transmits data with the processor core, and the second-level cache is a cache that is electrically connected with the first-level cache and transmits data with the processor core through the first-level cache. The method also includes: determining the target of the second storage information Cache, the target cache includes a first-level cache or a second-level cache; judging whether the predicted virtual address and the historical virtual address are in the same virtual address page, including: in response to the target cache being the second-level cache, judging the predicted virtual address and the historical virtual address Whether the virtual address is in the same virtual address page.
例如,在本公开一实施例提供的信息处理方法中,处理器还包括预取器,方法还包括:预取器根据第一预测物理地址,生成第一预取请求,第一预取请求用于请求将第一预测物理地址中存储的第二存储信息存储到第二级缓存;预取器向第二级缓存发送第一预取请求;以及第二级缓存响应于第一预取请求,将第一预测物理地址对应的第二存储信息缓存于到第二级缓存。For example, in the information processing method provided in an embodiment of the present disclosure, the processor further includes a prefetcher, and the method further includes: the prefetcher generates a first prefetch request according to the first predicted physical address, and the first prefetch request uses requesting to store the second storage information stored in the first predicted physical address into the second-level cache; the prefetcher sends the first prefetch request to the second-level cache; and the second-level cache responds to the first prefetch request, Cache the second storage information corresponding to the first predicted physical address in the second-level cache.
例如,在本公开一实施例提供的信息处理方法中,第二级缓存响应于第一预取请求,将第一预测物理地址对应的第二存储信息缓存于到第二级缓存,包括:第二级缓存响应于第一预取请求,确定第二级缓存中是否已经了缓存第一预测物理地址对应的第二存储信息;响应于第二级缓存已经了缓存第一预测物理地址对应的第二存储信息,丢弃第一预取请求;以及响应于第二级缓存未缓存第一预测物理地址对应的第二存储信息,第二级缓存向下一级缓存或者内存提取第一预测物理地址对应的第二存储信息,并且存储第二存储信息于第二级缓存中。For example, in the information processing method provided by an embodiment of the present disclosure, the second-level cache caches the second storage information corresponding to the first predicted physical address in the second-level cache in response to the first prefetch request, including: The second level cache determines whether the second storage information corresponding to the first predicted physical address has been cached in the second level cache in response to the first prefetch request; in response to the second storage information corresponding to the first predicted physical address has been cached in the second level cache 2. Store information, discard the first prefetch request; and in response to the second level cache not caching the second storage information corresponding to the first predicted physical address, the second level cache fetches the first predicted physical address corresponding to the next level cache or memory the second storage information, and store the second storage information in the second-level cache.
例如,在本公开一实施例提供的信息处理方法中,预取器向第二级缓存发送第一预取请求,包括:预取器向预取队列发送第一预取请求,以通过预取队列存储第一预取请求;以及响应于第二级缓存存在空闲空间,预取队列向第二级缓存发送第一预取请求。For example, in the information processing method provided in an embodiment of the present disclosure, the prefetcher sends the first prefetch request to the second-level cache, including: the prefetcher sends the first prefetch request to the prefetch queue, so as to pass the prefetch The queue stores the first prefetch request; and in response to the free space in the second level cache, the prefetch queue sends the first prefetch request to the second level cache.
例如,在本公开一实施例提供的信息处理方法中,预取器向第二级缓存发送第一预取请求,还包括:响应于预取队列的存储空间被占满,丢弃第一预取请求,或者用第一预取请求替换预取队列中的其他预取请求。For example, in the information processing method provided by an embodiment of the present disclosure, the prefetcher sends the first prefetch request to the second-level cache, and further includes: in response to the storage space of the prefetch queue being full, discarding the first prefetch request request, or replace other prefetch requests in the prefetch queue with the first prefetch request.
例如,本公开一实施例提供的信息处理方法中,处理器还包括地址翻译流水线,方法还包括:响应于预测虚拟地址与历史虚拟地址不在同一个虚拟地址页中,通过地址翻译流水线对预测虚拟地址进行地址翻译而获得第二预测物理地址。For example, in the information processing method provided by an embodiment of the present disclosure, the processor further includes an address translation pipeline, and the method further includes: responding to the fact that the predicted virtual address and the historical virtual address are not in the same virtual address page, using the address translation pipeline to pair the predicted virtual address The address is translated to obtain the second predicted physical address.
例如,在本公开一实施例提供的信息处理方法中,该信息处理方法还包括:地址翻译流水线根据第二预测物理地址生成第二预取请求,并向预取队列发送第二预取请求;预取队列响应于第二预取请求,向第二级缓存发送第二预取请求;第二级缓存响应于第二预取请求,确定第二级缓存中是否已经缓存了第二预测物理地址对应的第二存储信息;响应于第二级缓存中已经缓存了第二预测物理地址对应的第二存储信息,丢弃第二预取请求;响应于第二级缓存中未缓存第二预测物理地址对应的第二存储信息,第二级缓存向下一级缓存或者内存提取第二预测物理地址对应的第二存储信息,并且存储第二存储信息于第二级缓存中。For example, in the information processing method provided in an embodiment of the present disclosure, the information processing method further includes: the address translation pipeline generates a second prefetch request according to the second predicted physical address, and sends the second prefetch request to the prefetch queue; The prefetch queue sends a second prefetch request to the second-level cache in response to the second prefetch request; the second-level cache determines whether the second predicted physical address has been cached in the second-level cache in response to the second prefetch request Corresponding second storage information; in response to the second storage information corresponding to the second predicted physical address has been cached in the second-level cache, discarding the second prefetch request; in response to the second predicted physical address not being cached in the second-level cache Corresponding to the second storage information, the second-level cache fetches the second storage information corresponding to the second predicted physical address from the next-level cache or memory, and stores the second storage information in the second-level cache.
例如,在本公开一实施例提供的信息处理方法中,在预测虚拟地址为多个,并且多个预测虚拟地址在同一个虚拟地址页内的情形,响应于预测虚拟地址与历史虚拟地址不在同一个虚拟地址页中,通过地址翻译流水线对预测虚拟地址进行地址翻译而获得第二预测物理地址,包括:响应于多个预测虚拟地址均不与历史虚拟地址在同一个虚拟地址页中,通过地址翻译流水线对多个预测虚拟地址中被选择的预测虚拟地址进行地址翻译而获得第二预测物理地址;以及根据被选择的预测虚拟地址对应的第二预测物理地址,确定多个预测虚拟地址中除被选择的预测虚拟地址之外的其他预测虚拟地址对应的第二预测物理地址。For example, in the information processing method provided by an embodiment of the present disclosure, when there are multiple predicted virtual addresses and the multiple predicted virtual addresses are in the same virtual address page, in response to the fact that the predicted virtual address and the historical virtual address are not in the same In a virtual address page, performing address translation on the predicted virtual address through an address translation pipeline to obtain a second predicted physical address includes: responding to multiple predicted virtual addresses not being in the same virtual address page as the historical virtual address, passing the address The translation pipeline performs address translation on a selected predicted virtual address among the multiple predicted virtual addresses to obtain a second predicted physical address; A second predicted physical address corresponding to other predicted virtual addresses other than the selected predicted virtual address.
例如,在本公开一实施例提供的信息处理方法中,被选择的预测虚拟地址为预取器预测的多个预测虚拟地址中最先被处理器核访问的预测虚拟地址。For example, in the information processing method provided by an embodiment of the present disclosure, the selected predicted virtual address is the predicted virtual address that is first accessed by the processor core among the multiple predicted virtual addresses predicted by the prefetcher.
例如,在本公开一实施例提供的信息处理方法中,预取队列与地址翻译流水线共用地址缓存的同一个接口,或者预取队列和地址翻译流水线分别占用地址缓存中不同的接口。For example, in the information processing method provided by an embodiment of the present disclosure, the prefetch queue and the address translation pipeline share the same interface of the address cache, or the prefetch queue and the address translation pipeline respectively occupy different interfaces in the address cache.
例如,在本公开一实施例提供的信息处理方法中,该信息处理方法还包括:响应于目标缓存为第一级缓存,向地址翻译流水线发送第三预取请求,使得第三预取请求到达地址翻译流水线,第三预取请求包括预测虚拟地址;地址翻译流水线响应于第三预取请求,将预测虚拟地址翻译为第三预测物理地址,并且根据第三预测物理地址生成第四预取请求;确定第一级缓存中是否已经缓存了第三预测物理地址对应的第二存储信息;响应于第一级缓存中已经缓存了第三预测物理地址对应的第二存储信息,丢弃第四预取请求;响应于第一级缓存中未缓存第三预测物理地址对应的第二存储信息,向地址缓存发送第四预取请求,使得地址缓存向第二级缓存发送第四预取请求;第二级缓存响应于来自地址缓存的第四预取请求提取第三预测物理地址对应的第二存储信息,并且向地址缓存发送提取的第二存储信息,使得地址缓存向第一级缓存发送提取的第二存储信息。For example, in the information processing method provided in an embodiment of the present disclosure, the information processing method further includes: in response to the target cache being the first-level cache, sending a third prefetch request to the address translation pipeline, so that the third prefetch request arrives The address translation pipeline, the third prefetch request includes a predicted virtual address; the address translation pipeline responds to the third prefetch request, translates the predicted virtual address into a third predicted physical address, and generates a fourth prefetch request according to the third predicted physical address ; Determine whether the second storage information corresponding to the third predicted physical address has been cached in the first-level cache; in response to the second storage information corresponding to the third predicted physical address has been cached in the first-level cache, discarding the fourth prefetch request; in response to the second storage information corresponding to the third predicted physical address not being cached in the first-level cache, sending a fourth prefetch request to the address cache, so that the address cache sends a fourth prefetch request to the second-level cache; the second The level cache extracts the second storage information corresponding to the third predicted physical address in response to the fourth prefetch request from the address cache, and sends the extracted second storage information to the address cache, so that the address cache sends the extracted second storage information to the first level cache. 2. Store information.
例如,在本公开一实施例提供的信息处理方法中,判断预测虚拟地址与历史虚拟地址是否在同一个虚拟地址页中,包括:确定历史虚拟地址所在的虚拟地址页的页面的大小;以及基于虚拟地址页的页面的大小,判断预测虚拟地址与历史虚拟地址是否在同一个虚拟地址页中。For example, in the information processing method provided by an embodiment of the present disclosure, judging whether the predicted virtual address and the historical virtual address are in the same virtual address page includes: determining the page size of the virtual address page where the historical virtual address is located; and based on The page size of the virtual address page determines whether the predicted virtual address and the historical virtual address are in the same virtual address page.
本公开至少一个实施例还提供一种信息处理装置,包括:获取单元,配置为获取历史读取请求的读取信息,历史读取请求由处理器的处理器核发送,历史读取请求指示在历史时刻处理器核请求读取第一存储信息,读取信息包括第一存储信息的历史虚拟地址和历史物理地址,历史物理地址与历史虚拟地址相对应;预测单元,配置为根据历史虚拟地址,预测处理器核在未来时刻请求读取的第二存储信息所在的预测虚拟地址;判断单元,配置为判断预测虚拟地址与历史虚拟地址是否在同一个虚拟地址页中;以及地址确定单元,配置为响应于预测虚拟地址与历史虚拟地址在同一个虚拟地址页中,根据历史虚拟地址、历史物理地址和预测虚拟地址确定第一预测物理地址,第一预测物理地址与预测虚拟地址相对应。At least one embodiment of the present disclosure further provides an information processing device, including: an acquisition unit configured to acquire read information of a historical read request, the historical read request is sent by the processor core of the processor, and the historical read request indicates that the The processor core requests to read the first storage information at the historical moment, and the read information includes the historical virtual address and the historical physical address of the first storage information, and the historical physical address corresponds to the historical virtual address; the prediction unit is configured to, according to the historical virtual address, Predicting the predicted virtual address where the processor core requests to read the second storage information at a future moment; the judging unit is configured to judge whether the predicted virtual address and the historical virtual address are in the same virtual address page; and the address determining unit is configured to In response to the predicted virtual address being in the same virtual address page as the historical virtual address, a first predicted physical address is determined according to the historical virtual address, the historical physical address, and the predicted virtual address, the first predicted physical address corresponding to the predicted virtual address.
本公开至少一个实施例还提供一种电子设备,包括:处理器,处理器用于实现本公开任一实施例提供的信息处理方法的指令。At least one embodiment of the present disclosure further provides an electronic device, including: a processor configured to implement instructions of the information processing method provided by any embodiment of the present disclosure.
附图说明Description of drawings
为了更清楚地说明本公开实施例的技术方案,下面将对实施例的附图作简单地介绍,显而易见地,下面描述中的附图仅仅涉及本公开的一些实施例,而非对本公开的限制。In order to illustrate the technical solutions of the embodiments of the present disclosure more clearly, the accompanying drawings of the embodiments will be briefly introduced below. Obviously, the accompanying drawings in the following description only relate to some embodiments of the present disclosure, rather than limiting the present disclosure .
图1示出了CPU核读取指令或者数据的示意性流程图;FIG. 1 shows a schematic flowchart of a CPU core reading instructions or data;
图2示出了一种利用预取器预取数据信息的示意性流程图;FIG. 2 shows a schematic flow chart of prefetching data information by using a prefetcher;
图3示出了本公开至少一个实施例提供的一种信息处理方法的流程图;Fig. 3 shows a flowchart of an information processing method provided by at least one embodiment of the present disclosure;
图4A示出了本公开至少一实施例提供的另一种信息处理方法的流程图;Fig. 4A shows a flowchart of another information processing method provided by at least one embodiment of the present disclosure;
图4B示出了本公开至少一个实施例提供的信息处理方法的示意性流程图;Fig. 4B shows a schematic flowchart of an information processing method provided by at least one embodiment of the present disclosure;
图5示出了本公开至少一个实施例提供的另一种信息处理方法的流程图;Fig. 5 shows a flowchart of another information processing method provided by at least one embodiment of the present disclosure;
图6示出了本公开至少一个实施例提供的另一种信息处理方法的流程图;Fig. 6 shows a flowchart of another information processing method provided by at least one embodiment of the present disclosure;
图7示出了本公开至少一个实施例提供的一种信息处理装置的示意框图;Fig. 7 shows a schematic block diagram of an information processing device provided by at least one embodiment of the present disclosure;
图8为本公开一些实施例提供的一种电子设备的示意框图;以及Fig. 8 is a schematic block diagram of an electronic device provided by some embodiments of the present disclosure; and
图9为本公开一些实施例提供的另一种电子设备的示意框图。Fig. 9 is a schematic block diagram of another electronic device provided by some embodiments of the present disclosure.
具体实施方式Detailed ways
为使本公开实施例的目的、技术方案和优点更加清楚,下面将结合本公开实施例的附图,对本公开实施例的技术方案进行清楚、完整地描述。显然,所描述的实施例是本公开的一部分实施例,而不是全部的实施例。基于所描述的本公开的实施例,本领域普通技术人员在无需创造性劳动的前提下所获得的所有其他实施例,都属于本公开保护的范围。In order to make the purpose, technical solutions and advantages of the embodiments of the present disclosure clearer, the technical solutions of the embodiments of the present disclosure will be clearly and completely described below in conjunction with the accompanying drawings of the embodiments of the present disclosure. Apparently, the described embodiments are some of the embodiments of the present disclosure, not all of them. Based on the described embodiments of the present disclosure, all other embodiments obtained by persons of ordinary skill in the art without creative effort fall within the protection scope of the present disclosure.
除非另外定义,本公开使用的技术术语或者科学术语应当为本公开所属领域内具有一般技能的人士所理解的通常意义。本公开中使用的“第一”、“第二”以及类似的词语并不表示任何顺序、数量或者重要性,而只是用来区分不同的组成部分。同样,“一个”、“一”或者“该”等类似词语也不表示数量限制,而是表示存在至少一个。“包括”或者“包含”等类似的词语意指出现该词前面的元件或者物件涵盖出现在该词后面列举的元件或者物件及其等同,而不排除其他元件或者物件。“连接”或者“相连”等类似的词语并非限定于物理的或者机械的连接,而是可以包括电性的连接,不管是直接的还是间接的。“上”、“下”、“左”、“右”等仅用于表示相对位置关系,当被描述对象的绝对位置改变后,则该相对位置关系也可能相应地改变。Unless otherwise defined, the technical terms or scientific terms used in the present disclosure shall have the usual meanings understood by those skilled in the art to which the present disclosure belongs. "First", "second" and similar words used in the present disclosure do not indicate any order, quantity or importance, but are only used to distinguish different components. Likewise, words like "a", "an" or "the" do not denote a limitation of quantity, but mean that there is at least one. "Comprising" or "comprising" and similar words mean that the elements or items appearing before the word include the elements or items listed after the word and their equivalents, without excluding other elements or items. Words such as "connected" or "connected" are not limited to physical or mechanical connections, but may include electrical connections, whether direct or indirect. "Up", "Down", "Left", "Right" and so on are only used to indicate the relative positional relationship. When the absolute position of the described object changes, the relative positional relationship may also change accordingly.
在通常的CPU架构中,程序的指令与数据都保存在内存中,而CPU核运行频率远远高于内存运行频率。因此,从内存获取数据或者指令需要上百个CPU核时钟,这往往会造成CPU核由于无法继续运行相关指令而空转,造成性能损失。因此,现代高性能CPU核都包含多级缓存架构来保存最近被访问的数据,同时利用预取器发现CPU数据访问的规律,来提前预取即将被访问的数据、指令到缓存中。如果预取的是指令,则称为指令预取器,如果预取的是数据,则称为数据预取器。L1(第一级)缓存预取器可以将指令或者数据预取到第一级缓存。然而,由于L1缓存容量有限,过分激进的L1缓存预取会将L1缓存中原本有用的指令或者数据替换掉,反而造成整体性能损失。为了应对如上情况,由于L2(第二级)缓存的容量要比L1缓存的容量大很多,L2缓存预取器或者L1/L2合成预取器可以选择将这些指令或者数据先预取到L2缓存中,之后再预取到L1缓存中。L2缓存预取器可以将指令或者数据预取到第二级缓存,L1/L2合成预取器可以选择将这些指令或者数据先预取到L2缓存中或者将这些指令或者数据预取到L1缓存中。In a typical CPU architecture, program instructions and data are stored in memory, and the operating frequency of the CPU core is much higher than that of the memory. Therefore, obtaining data or instructions from the memory requires hundreds of CPU core clocks, which often causes the CPU core to idle because it cannot continue to run related instructions, resulting in performance loss. Therefore, modern high-performance CPU cores include a multi-level cache architecture to store recently accessed data, and at the same time use the prefetcher to discover the rules of CPU data access to prefetch the data and instructions to be accessed into the cache in advance. If it prefetches instructions, it is called an instruction prefetcher, and if it prefetches data, it is called a data prefetcher. The L1 (first level) cache prefetcher can prefetch instructions or data to the first level cache. However, due to the limited capacity of the L1 cache, excessively aggressive L1 cache prefetch will replace the original useful instructions or data in the L1 cache, causing overall performance loss instead. In order to cope with the above situation, since the capacity of the L2 (second level) cache is much larger than that of the L1 cache, the L2 cache prefetcher or the L1/L2 composite prefetcher can choose to prefetch these instructions or data to the L2 cache first. , and then prefetched into the L1 cache. The L2 cache prefetcher can prefetch instructions or data to the second-level cache, and the L1/L2 composite prefetcher can choose to prefetch these instructions or data into the L2 cache first or prefetch these instructions or data into the L1 cache middle.
例如,L1预取器可以包括L1I(L1 Instruction,L1指令)预取器和L1D(L1 Data,L1数据)预取器。L1I预取器用于预取指令,L1D预取器用于预取数据。需要理解的是,在本文中的预取器可以是L1I预取器,也可以是L1D预取器。For example, the L1 prefetcher may include an L1I (L1 Instruction, L1 instruction) prefetcher and an L1D (L1 Data, L1 data) prefetcher. The L1I prefetcher is used to prefetch instructions and the L1D prefetcher is used to prefetch data. It should be understood that the prefetcher in this paper may be an L1I prefetcher or an L1D prefetcher.
另外,现代操作系统往往支持多个进程同时运行。为了简化多进程管理与增强安全性,应用程序使用的是一段完整的虚拟地址,比如32比特应用程序最多有2^32=4GB的虚拟地址空间可供使用。虚拟地址空间会被映射为多个内存页面,每个内存页面有自己的物理存储地址。例如一段连续的虚拟地址被映射到一个内存页面,在本公开中,这段连续的虚拟地址被称为虚拟地址页面。In addition, modern operating systems often support multiple processes running at the same time. In order to simplify multi-process management and enhance security, the application program uses a complete virtual address. For example, a 32-bit application program has a maximum of 2^32=4GB of virtual address space available. The virtual address space is mapped into multiple memory pages, and each memory page has its own physical storage address. For example, a segment of continuous virtual addresses is mapped to a memory page, and in this disclosure, the segment of continuous virtual addresses is called a virtual address page.
程序访问指令、数据时,必须先将它们的虚拟地址翻译为物理地址,并检测程序的访问是否合法,然后去内存或者缓存中获得相应数据传递给CPU核。从虚拟地址到物理地址的转换过程称为地址翻译。虚拟地址到物理地址的映射关系存储于内存的表格中,访问这些内存中的表格同样需要上百个时钟。为了减少这些内存访问,CPU核内部使用多级的缓存来保存最近被使用的映射,这些特定的缓存被称为表格后备缓存(Table LookasideBuffer,TLB)。When a program accesses instructions and data, it must first translate their virtual addresses into physical addresses, and check whether the program's access is legal, and then go to the memory or cache to obtain the corresponding data and pass it to the CPU core. The process of converting from a virtual address to a physical address is called address translation. The mapping relationship between virtual addresses and physical addresses is stored in memory tables, and accessing these tables in memory also requires hundreds of clocks. In order to reduce these memory accesses, the CPU core uses a multi-level cache to store recently used mappings. These specific caches are called Table LookasideBuffer (TLB).
图1示出了CPU核读取指令或者数据的示意性流程图。FIG. 1 shows a schematic flow chart of reading instructions or data by a CPU core.
如图1所示,CPU核读取指令或者数据包括步骤S110~S180。As shown in FIG. 1 , reading instructions or data by the CPU core includes steps S110-S180.
步骤S110:CPU核给出需要读取的指令或数据的虚拟地址。Step S110: The CPU core provides the virtual address of the instruction or data to be read.
步骤S120:利用地址翻译流水线将虚拟地址翻译为物理地址,并且确定第一级缓存是否缓存有该物理地址对应的指令或数据。在CPU中可以包括将虚拟地址翻译为物理地址的地址翻译流水线。地址翻译流水线例如可以包括按照运算逻辑执行操作的逻辑电路,逻辑电路按照运算逻辑执行一系列操作可以将虚拟地址翻译为物理地址。Step S120: Use the address translation pipeline to translate the virtual address into a physical address, and determine whether the instruction or data corresponding to the physical address is cached in the first-level cache. An address translation pipeline that translates virtual addresses into physical addresses may be included in the CPU. The address translation pipeline may include, for example, a logic circuit that performs operations according to the operation logic, and the logic circuit performs a series of operations according to the operation logic to translate a virtual address into a physical address.
例如,地址翻译流水线可以通过访问TLB缓存的虚拟地址到物理地址的映射关系将虚拟地址翻译为物理地址。For example, the address translation pipeline can translate a virtual address into a physical address by accessing a mapping relationship between a virtual address and a physical address cached in the TLB.
例如,可以是地址翻译流水线向第一级缓存发送获取第一级缓存中多个标签的请求,该多个标签中的每个标签可以是对第一级缓存中缓存的物理地址进行哈希运算得到的。然后,地址翻译流水线可以将该物理地址进行哈希运算得到哈希值,并且将哈希值与从第一级缓存中获取的多个标签进行对比。如果多个标签中包含该哈希值,则表明第一级缓存中缓存有该物理地址对应的指令或数据。如果多个标签中不包含该哈希值,则表明第一级缓存未缓存有该物理地址对应的指令或数据。For example, the address translation pipeline may send a request to the first-level cache to acquire multiple tags in the first-level cache, and each of the multiple tags may perform a hash operation on the physical address cached in the first-level cache owned. Then, the address translation pipeline can perform a hash operation on the physical address to obtain a hash value, and compare the hash value with multiple tags obtained from the first-level cache. If multiple tags contain the hash value, it indicates that the instruction or data corresponding to the physical address is cached in the first-level cache. If the hash value is not included in multiple tags, it indicates that the instruction or data corresponding to the physical address is not cached in the first-level cache.
如果第一级缓存中缓存了该物理地址对应的指令或数据,则执行步骤S130和步骤S140。如果第一级缓存未缓存该物理地址对应的指令或数据,则执行步骤S150~S180。If the instruction or data corresponding to the physical address is cached in the first-level cache, step S130 and step S140 are executed. If the first-level cache does not cache the instruction or data corresponding to the physical address, execute steps S150-S180.
步骤S130:向第一级缓存发送读取请求。Step S130: Send a read request to the first-level cache.
步骤S140:第一级缓存响应于读取请求,从第一级缓存中取出该物理地址对应的指令或数据,并且向CPU核发送该物理地址对应的指令或数据,以响应上述读取请求。Step S140: In response to the read request, the first-level cache fetches the instruction or data corresponding to the physical address from the first-level cache, and sends the instruction or data corresponding to the physical address to the CPU core in response to the read request.
步骤S150:向地址缓存申请一个存储空间,该存储空间用于存储读取请求的相关信息。地址缓存,例如可以是Missing Address Buffer(简称为MAB)或者Missing StatusHandling Register(简称为MSHR)。Step S150: apply for a storage space from the address cache, and the storage space is used to store relevant information of the read request. The address cache may be, for example, a Missing Address Buffer (abbreviated as MAB) or a Missing Status Handling Register (abbreviated as MSHR).
MAB或者MSHR可以用于在第一级缓存未缓存读取请求或者预取请求所请求读取的指令或数据的情况下,缓存该读取请求的相关信息。也就是,当一个读取请求或者预取请求所请求的指令或数据不在第一级缓存中的情况下,需要向下一级缓存请求时,该读取请求或者预取请求的相关信息可以被保存在MAB中,直到下一级缓存返回该读取请求或者预取请求的数据信息。The MAB or MSHR may be used to cache relevant information of the read request when the first level cache does not cache the instruction or data requested by the read request or the prefetch request. That is, when a read request or a prefetch request requests an instruction or data that is not in the first level cache and needs to be requested to the next level cache, the relevant information of the read request or prefetch request can be obtained by Stored in the MAB until the next level of cache returns the data information of the read request or prefetch request.
例如在步骤S150,可以是向MAB申请MAB项,使得MAB分配一个存储空间,并且向MAB发送上述读取请求。For example, in step S150, it may be to apply for a MAB item from the MAB, so that the MAB allocates a storage space, and sends the above-mentioned read request to the MAB.
步骤S160:MAB向第二级缓存发送读取请求。Step S160: MAB sends a read request to the second-level cache.
步骤S170:第二级缓存获取该物理地址对应的指令或者数据,并将该物理地址对应的指令或者数据返回给MAB。Step S170: the second-level cache obtains the instruction or data corresponding to the physical address, and returns the instruction or data corresponding to the physical address to the MAB.
步骤S180:MAB向第一级缓存发送该物理地址对应的指令或者数据,使得该物理地址对应的指令或者数据到达第一级缓存,以便第一级缓存执行步骤S40,即向CPU核发送该物理地址对应的指令或者数据。Step S180: MAB sends the instruction or data corresponding to the physical address to the first-level cache, so that the instruction or data corresponding to the physical address reaches the first-level cache, so that the first-level cache executes step S40, that is, sends the physical address to the CPU core. The instruction or data corresponding to the address.
图2示出了一种利用预取器预取数据信息的示意性流程图。该预取器例如可以是L1/L2合成预取器。Fig. 2 shows a schematic flowchart of prefetching data information by using a prefetcher. The prefetcher may be, for example, an L1/L2 composite prefetcher.
如图2所示,利用L1/L2合成预取器预取数据信息可以包括步骤S210~S240、步骤S251~S254、步骤S261~S262以及步骤S270~S280。As shown in FIG. 2 , prefetching data information by using the L1/L2 composite prefetcher may include steps S210-S240, steps S251-S254, steps S261-S262, and steps S270-S280.
步骤S210:CPU核给出需要读取的指令或数据的虚拟地址。Step S210: The CPU core provides the virtual address of the instruction or data to be read.
步骤S220:利用地址翻译流水线将虚拟地址翻译为物理地址,并且向第一级缓存和L1/L2合成预取器发送包括物理地址的读取请求,使得L1/L2合成预取器将虚拟地址作为历史虚拟地址并利用历史虚拟地址进行训练而得到预测虚拟地址,以及使得第一级缓存响应读取请求,向CPU核返回该物理地址对应的指令或者数据。Step S220: Use the address translation pipeline to translate the virtual address into a physical address, and send a read request including the physical address to the first-level cache and the L1/L2 composite prefetcher, so that the L1/L2 composite prefetcher uses the virtual address as The historical virtual address is trained by using the historical virtual address to obtain the predicted virtual address, and the first-level cache responds to the read request, and returns the instruction or data corresponding to the physical address to the CPU core.
步骤S230:L1/L2合成预取器对所有历史虚拟地址或者部分历史虚拟地址进行训练,从而预测出CPU核未来获取的指令或者数据的预测虚拟地址。Step S230: the L1/L2 composite prefetcher trains all or part of the historical virtual addresses, so as to predict the predicted virtual addresses of instructions or data to be acquired by the CPU core in the future.
步骤S240:对预测虚拟地址进行地址翻译而得到预测物理地址,从而根据预测物理地址生成预取请求,并且确定第一级缓存是否缓存有该预测物理地址对应的指令或数据。该步骤S240与上文参考图1描述的步骤S120类似,在此不再赘述。Step S240: performing address translation on the predicted virtual address to obtain a predicted physical address, thereby generating a prefetch request according to the predicted physical address, and determining whether the first-level cache caches instructions or data corresponding to the predicted physical address. This step S240 is similar to the step S120 described above with reference to FIG. 1 , and will not be repeated here.
在第一级缓存中缓存了该预测物理地址对应的指令或数据的情况下,丢弃预取请求。If the instruction or data corresponding to the predicted physical address is cached in the first-level cache, the prefetch request is discarded.
在第一级缓存未缓存该物理地址对应的指令或数据的情况下,如果该预取请求是L1预取请求,那么执行步骤S251~S254,用于将指令或数据预取到L1缓存中。如果该预取请求是L2预取请求,那么执行步骤S261~S263,用于将指令或数据预取到L2缓存中。If the first-level cache does not cache the instruction or data corresponding to the physical address, if the prefetch request is an L1 prefetch request, then perform steps S251-S254 to prefetch the instruction or data into the L1 cache. If the prefetch request is an L2 prefetch request, then execute steps S261-S263 for prefetching instructions or data into the L2 cache.
步骤S251:向地址缓存MAB申请一个MAB项,使得MAB分配MAB项,并且向MAB发送上述L1预取请求。Step S251: Apply for a MAB entry from the address buffer MAB, so that the MAB allocates the MAB entry, and send the above-mentioned L1 prefetch request to the MAB.
步骤S252:MAB向第二级缓存发送L1预取请求。Step S252: the MAB sends an L1 prefetch request to the second-level cache.
步骤S253:第二级缓存获取该预测物理地址对应的指令或者数据,并将该预测物理地址对应的指令或者数据返回给MAB。第二级缓存,例如可以从下一级缓存或者自身获取该预测物理地址对应的指令或者数据。第二级缓存例如可以执行步骤S270和步骤S280来从下一级缓存例如最后一级缓存获取该预测物理地址对应的指令或者数据。Step S253: the second-level cache acquires the instruction or data corresponding to the predicted physical address, and returns the instruction or data corresponding to the predicted physical address to the MAB. The second-level cache, for example, may obtain the instruction or data corresponding to the predicted physical address from the next-level cache or itself. The second-level cache, for example, may perform step S270 and step S280 to obtain the instruction or data corresponding to the predicted physical address from the next-level cache, such as the last-level cache.
步骤S254:MAB向第一级缓存发送该物理地址对应的指令或者数据,使得该预测物理地址对应的指令或者数据缓存于第一级缓存中。Step S254: The MAB sends the instruction or data corresponding to the physical address to the first-level cache, so that the instruction or data corresponding to the predicted physical address is cached in the first-level cache.
步骤S261:向预取队列发送该L2预取请求,以由预取队列向第二级缓存发送L2预取请求。Step S261: Send the L2 prefetch request to the prefetch queue, so that the prefetch queue sends the L2 prefetch request to the second-level cache.
步骤S262:预取队列向第二级缓存发送L2预取请求。Step S262: the prefetch queue sends an L2 prefetch request to the second-level cache.
步骤S263:第二级缓存判断L2预取请求中的预测物理地址对应的指令或数据是否已经缓存在自身中。若缓存在自身中,则丢弃该L2预取请求。如果未缓存在自身中,则执行步骤S270和步骤S280,从而将L2预取请求中的预测物理地址对应的指令或者数据缓存在第二级缓存中。Step S263: the second-level cache judges whether the instruction or data corresponding to the predicted physical address in the L2 prefetch request has been cached in itself. If the cache is in itself, the L2 prefetch request is discarded. If it is not cached in itself, step S270 and step S280 are executed, so as to cache the instruction or data corresponding to the predicted physical address in the L2 prefetch request in the second-level cache.
步骤S270:向下一级缓存例如最后一级缓存发送预取请求,以由下一级缓存获取预测物理地址对应的指令或数据。Step S270: Send a prefetch request to the next-level cache, such as the last-level cache, so that the next-level cache can obtain the instruction or data corresponding to the predicted physical address.
步骤S280:最后一级缓存向第二级缓存发送获取到的指令或数据。Step S280: the last level cache sends the acquired instruction or data to the second level cache.
如图1和图2所示,在高性能CPU中,预取器预测出的预测虚拟地址对应的指令或者数据的预取过程(以下简称“预取”)与CPU核发出的虚拟地址对应的指令或者数据的正常读取过程(以下简称“正常读取”)共享地址翻译流水线。在高频率、高性能CPU中,该地址翻译流水线可能是多级的。由于预取比正常读取的优先级低,一个预取有可能需要等待多个时钟周期才能够进入地址翻译流水线,并且地址翻译自身也需要多个流水时钟周期,这样一个预取需要多个时钟才能够发给下一级缓存。而预取往往是有时效性的,相对应的CPU核访问往往很快就会发生,地址翻译造成的时延往往会造成预取数据过晚到达第一级缓存,从而造成预取无效。As shown in Figures 1 and 2, in a high-performance CPU, the prefetching process of instructions or data corresponding to the predicted virtual address predicted by the prefetcher (hereinafter referred to as "prefetching") corresponds to the virtual address issued by the CPU core. The normal reading process of instructions or data (hereinafter referred to as "normal reading") shares the address translation pipeline. In high-frequency, high-performance CPUs, the address translation pipeline may be multi-stage. Since prefetching has a lower priority than normal reading, a prefetch may need to wait for multiple clock cycles before it can enter the address translation pipeline, and the address translation itself also requires multiple pipeline clock cycles, so a prefetch requires multiple clocks Only then can it be sent to the next level cache. However, prefetching is often time-sensitive, and the corresponding CPU core access often occurs soon. The delay caused by address translation often causes the prefetched data to arrive at the first-level cache too late, resulting in invalid prefetching.
本公开至少一实施例提供一种信息处理方法、信息处理装置和电子设备。该信息处理方法可以根据历史物理地址确定预测物理地址,而无需通过地址翻译流水线来得到预测物理地址,从而可以降低地址翻译对预取造成的时延,提高预取的时效性。At least one embodiment of the present disclosure provides an information processing method, an information processing device, and an electronic device. The information processing method can determine the predicted physical address according to the historical physical address without obtaining the predicted physical address through an address translation pipeline, thereby reducing the time delay caused by address translation to prefetching and improving the timeliness of prefetching.
图3示出了本公开至少一个实施例提供的一种信息处理方法的流程图。如图3所示,该信息处理方法包括步骤S310-步骤S340。Fig. 3 shows a flowchart of an information processing method provided by at least one embodiment of the present disclosure. As shown in FIG. 3, the information processing method includes step S310-step S340.
步骤S310:获取历史读取请求的读取信息。历史读取请求由处理器的处理器核发送,历史读取请求指示在历史时刻处理器核请求读取的第一存储信息,读取信息包括第一存储信息的历史虚拟地址和历史物理地址,历史物理地址与历史虚拟地址相对应。Step S310: Obtain the read information of the historical read request. The history read request is sent by the processor core of the processor, the history read request indicates the first storage information that the processor core requests to read at the historical moment, and the read information includes the historical virtual address and the historical physical address of the first storage information, Historical physical addresses correspond to historical virtual addresses.
步骤S320:根据历史虚拟地址,预测处理器核在未来时刻请求读取的第二存储信息所在的预测虚拟地址。Step S320: According to the historical virtual address, predict the predicted virtual address where the second storage information that the processor core requests to read in the future is located.
步骤S330:判断预测虚拟地址与历史虚拟地址是否在同一个虚拟地址页中。Step S330: Determine whether the predicted virtual address and the historical virtual address are in the same virtual address page.
步骤S340:响应于预测虚拟地址与历史虚拟地址在同一个虚拟地址页中,根据历史虚拟地址、历史物理地址和预测虚拟地址确定第一预测物理地址。第一预测物理地址与预测虚拟地址相对应。Step S340: In response to the fact that the predicted virtual address and the historical virtual address are in the same virtual address page, determine a first predicted physical address according to the historical virtual address, the historical physical address, and the predicted virtual address. The first predicted physical address corresponds to the predicted virtual address.
在预测虚拟地址与历史虚拟地址在同一个虚拟地址页的情形下,该信息处理方法可以根据历史虚拟地址对应的历史物理地址来确定预测虚拟地址对应的第一预测物理地址,这样不需要对预测虚拟地址进行地址翻译,从而至少部分地避免了地址翻译带来的时延,提高了预取的有效性。另外,由于正常指令和数据读取往往需要与预取共享地址翻译流水线,因此该信息处理方法在减少预取的地址翻译的同时也减少了正常读取的地址读取时延,并且降低了预取地址翻译所需要的功耗。In the case that the predicted virtual address and the historical virtual address are in the same virtual address page, the information processing method can determine the first predicted physical address corresponding to the predicted virtual address according to the historical physical address corresponding to the historical virtual address. Address translation is performed on the virtual address, thereby at least partially avoiding the delay caused by address translation and improving the effectiveness of prefetching. In addition, since normal instruction and data reading often need to share the address translation pipeline with prefetching, this information processing method not only reduces the address translation of prefetching, but also reduces the address reading delay of normal reading, and reduces the prefetch Get the power consumption required for address translation.
对于步骤S310,历史读取请求,例如可以是CPU核在历史时刻发出的包括历史虚拟地址的读取请求。历史读取请求的读取信息,例如可以包括历史虚拟地址和历史物理地址。历史物理地址例如可以是通过对历史虚拟地址进行地址翻译而得到的。For step S310, the historical reading request may be, for example, a reading request including historical virtual addresses issued by the CPU core at historical moments. The read information of the historical read request may include, for example, a historical virtual address and a historical physical address. The historical physical address may be obtained, for example, by performing address translation on the historical virtual address.
例如,可以是CPU核将每一个读取请求发给地址翻译流水线,地址翻译流水线依次处理每一个读取请求,以将每一个读取请求中的虚拟地址翻译为物理地址。然后地址翻译流水线向预取器发送每一个读取请求对应的虚拟地址、物理地址以及其他信息。这些读取请求作为历史读取请求,读取请求对应的虚拟地址作为历史虚拟地址,历史虚拟地址翻译得到的物理地址作为历史物理地址,以便预取器利用历史虚拟地址进行训练。在步骤S310中,例如可以是由预取器接收来自地址翻译流水线的读取信息。预取器可以是L1缓存预取器,也可以是L2缓存预取器,也可以是L1/L2合成预取器,也可以是其他预取器,预取器可以是预取指令的指令预取器也可以是预取数据的数据预取器,总之,本公开对缓存预取器的类型不做限定,本公开的方法适用于任何预取器。For example, the CPU core may send each read request to the address translation pipeline, and the address translation pipeline processes each read request in turn, so as to translate the virtual address in each read request into a physical address. Then the address translation pipeline sends the virtual address, physical address and other information corresponding to each read request to the prefetcher. These read requests are used as historical read requests, the virtual address corresponding to the read request is used as the historical virtual address, and the physical address translated from the historical virtual address is used as the historical physical address, so that the prefetcher uses the historical virtual address for training. In step S310, for example, the read information from the address translation pipeline may be received by the prefetcher. The prefetcher can be an L1 cache prefetcher, an L2 cache prefetcher, an L1/L2 composite prefetcher, or other prefetchers. The prefetcher can be an instruction prefetcher for prefetching instructions. The fetcher may also be a data prefetcher for prefetching data. In short, the present disclosure does not limit the type of cache prefetcher, and the method of the present disclosure is applicable to any prefetcher.
第一存储信息,例如可以是CPU核在历史时刻请求读取的指令或者数据。The first storage information may be, for example, instructions or data requested to be read by the CPU core at historical moments.
对于步骤S320,例如可以是预取器对历史虚拟地址进行训练而得到历史虚拟地址的规律,从而根据规律预测CPU核即将访问的预测虚拟地址,该预测虚拟地址对应的预测物理地址中存储有第二存储信息。For step S320, for example, the prefetcher may train the historical virtual address to obtain the rule of the historical virtual address, so as to predict the predicted virtual address that the CPU core will access according to the rule, and the predicted physical address corresponding to the predicted virtual address stores the first 2. Store information.
例如,历史虚拟地址包括0X0000 0000、0X0000 0002、0X0000 0004、0X0000 0006,那么预取器可以预测CPU核即将访问的预测虚拟地址为0X0000 0008。For example, the historical virtual address includes 0X0000 0000, 0X0000 0002, 0X0000 0004, 0X0000 0006, then the prefetcher can predict that the predicted virtual address that the CPU core will access is 0X0000 0008.
对预取器而言,使用历史虚拟地址训练而获得CPU核的访问规律相对于使用历史物理地址有以下好处。1、虚拟地址无需经过地址翻译就可以被预取器使用。2、使用虚拟地址来训练预取器可以发现跨内存页面的读取规律。而由于虚拟地址连续的两个虚拟地址页面有可能被分配为不连续的物理地址,使用物理地址训练的预取器只能检测一个内存页面内的读取规律,从而限制了其发现的规律的准确性与有效性。3、预取器使用虚拟地址进行训练可以生成跨内存页面的预取。而使用物理地址进行训练的预取器无法生成一个未被训练到的内存页面的物理地址。For the prefetcher, using historical virtual address training to obtain CPU core access rules has the following advantages compared to using historical physical addresses. 1. The virtual address can be used by the prefetcher without address translation. 2. Using virtual addresses to train the prefetcher can discover the reading patterns across memory pages. Since two virtual address pages with consecutive virtual addresses may be allocated as discontinuous physical addresses, the prefetcher trained with physical addresses can only detect the reading pattern in one memory page, thus limiting the scope of the patterns it discovers. Accuracy and Validity. 3. The prefetcher is trained using virtual addresses to generate prefetch across memory pages. A prefetcher trained using physical addresses cannot generate a physical address for a memory page that has not been trained.
对于步骤S330,例如可以确定历史虚拟地址所在的虚拟地址页的页面的大小,以及基于虚拟地址页的页面的大小,判断预测虚拟地址与历史虚拟地址是否在同一个虚拟地址页中。For step S330, for example, the page size of the virtual address page where the historical virtual address is located may be determined, and based on the page size of the virtual address page, it is determined whether the predicted virtual address and the historical virtual address are in the same virtual address page.
例如可以根据虚拟地址页的页面大小,确定每个虚拟地址页的地址范围,从而判断历史虚拟地址与预测虚拟地址是否在同一个地址范围内。若在同一个地址范围内,则判断预测虚拟地址和历史虚拟地址在同一个虚拟地址页中。For example, the address range of each virtual address page may be determined according to the page size of the virtual address page, so as to determine whether the historical virtual address and the predicted virtual address are within the same address range. If they are in the same address range, it is judged that the predicted virtual address and the historical virtual address are in the same virtual address page.
例如,虚拟地址从0开始编号,可以根据虚拟地址页的页面大小确定右移的参考位数,从而根据右移的参考位数,将预测虚拟地址右移并将历史虚拟地址右移。若预测虚拟地址右移和历史虚拟地址右移后得到的两个值相同,那么预测虚拟地址和历史虚拟地址在同一个虚拟地址页中。For example, virtual addresses are numbered from 0, and the reference number of right-shifted bits can be determined according to the page size of the virtual address page, so that the predicted virtual address is right-shifted and the historical virtual address is right-shifted according to the right-shifted reference number of bits. If the two values obtained after the right shift of the predicted virtual address and the right shift of the historical virtual address are the same, then the predicted virtual address and the historical virtual address are in the same virtual address page.
例如,虚拟地址从0开始编号,并且虚拟地址页的页面大小为4KB,由于2的12次方等于4KB,因此可以比较预测虚拟地址右移12位和历史虚拟地址右移12位得到的值是否相等来确定预测虚拟地址与历史虚拟地址是否在同一个虚拟地址页中。若预测虚拟地址右移12位和历史虚拟地址右移12位得到的值相等,则可以确定预测虚拟地址与历史虚拟地址在同一个虚拟地址页中。For example, virtual addresses are numbered starting from 0, and the page size of the virtual address page is 4KB. Since 2 to the 12th power is equal to 4KB, you can compare whether the value obtained by shifting the predicted virtual address by 12 bits to the right and the historical virtual address by shifting 12 bits to the right equal to determine whether the predicted virtual address and the historical virtual address are in the same virtual address page. If the values obtained by right shifting the predicted virtual address by 12 bits and the right shifted 12 bits of the historical virtual address are equal, it can be determined that the predicted virtual address and the historical virtual address are in the same virtual address page.
需要理解的是,虽然在上述实施例中虚拟地址页的页面大小为4KB,但是本公开不局限于4KB的虚拟地址页面。如果一个系统可以支持多个虚拟地址页面的页面大小,那么可以在训练预取器时,将相应页面的大小发送给预取器,使得预取器根据该页面大小来判断历史虚拟地址和预测虚拟地址是否在同一个虚拟地址页面中,这样可以进一步地增加不需要进行地址翻译的预取请求的百分比,提高本公开提供的信息处理方法的应用范围和性能。It should be understood that although the page size of the virtual address page is 4KB in the above embodiment, the present disclosure is not limited to the virtual address page of 4KB. If a system can support the page size of multiple virtual address pages, then the size of the corresponding page can be sent to the prefetcher when training the prefetcher, so that the prefetcher can judge the historical virtual address and predict the virtual address based on the page size. Whether the address is in the same virtual address page, this can further increase the percentage of prefetch requests that do not require address translation, and improve the application range and performance of the information processing method provided by the present disclosure.
对于步骤S340,如果预测虚拟地址与历史虚拟地址在同一个虚拟地址页中,则可以根据历史虚拟地址、历史物理地址和预测虚拟地址确定第一预测物理地址。For step S340, if the predicted virtual address and the historical virtual address are in the same virtual address page, the first predicted physical address may be determined according to the historical virtual address, historical physical address and predicted virtual address.
在本公开的一些实施例中,例如可以将所述预测虚拟地址与所述历史虚拟地址之间的偏移量与所述历史物理地址的和作为所述第一预测物理地址。即,可以根据如下的公式来计算得到第一预测物理地址。In some embodiments of the present disclosure, for example, a sum of an offset between the predicted virtual address and the historical virtual address and the historical physical address may be used as the first predicted physical address. That is, the first predicted physical address may be calculated according to the following formula.
PPA=HPA+(PVA-HVA)PPA=HPA+(PVA-HVA)
其中,PPA表示第一预测物理地址,HPA表示历史物理地址,PVA表示预测虚拟地址,HVA表示历史虚拟地址。Wherein, PPA represents the first predicted physical address, HPA represents the historical physical address, PVA represents the predicted virtual address, and HVA represents the historical virtual address.
利用上述公式可以非常简单地计算出预测虚拟地址的第一预测物理地址,从而至少部分地省去了地址翻译的过程。The first predicted physical address of the predicted virtual address can be calculated very simply by using the above formula, thereby at least partly omitting the process of address translation.
在本公开的一些实施例中,处理器可以包括多级缓存,多级缓存至少包括第一级缓存和第二级缓存。第一级缓存可以是与CPU核电连接,并且可以与CPU核直接传输数据的缓存。第二级缓存例如为与所述第一级缓存电连接并且通过所述第一级缓存与所述处理器核传输数据的缓存。例如,处理器包括第一级缓存、第二级缓存、……、最后一级缓存,第一级缓存、第二级缓存、……、最后一级缓存的存储容量可以依次递增,读取速度依次递减,到CPU核的距离也依次递增。例如第一级缓存可以在位置上最接近CPU核、存储容量最小以及读取速度最快。In some embodiments of the present disclosure, the processor may include a multi-level cache, and the multi-level cache includes at least a first-level cache and a second-level cache. The first-level cache may be a cache that is electrically connected to the CPU core and can directly transmit data with the CPU core. The second-level cache is, for example, a cache that is electrically connected to the first-level cache and transmits data with the processor core through the first-level cache. For example, the processor includes a first-level cache, a second-level cache, ..., a last-level cache, and the storage capacity of the first-level cache, the second-level cache, ..., and the last-level cache can be sequentially increased, and the reading speed Decrease in turn, and the distance to the CPU core also increases in turn. For example, the first-level cache can be located closest to the CPU core, with the smallest storage capacity and the fastest read speed.
在本公开的一些实施例中,信息处理方法在前述实施例的基础上还可以包括确定第二存储信息的目标缓存,目标缓存包括第一级缓存或者第二级缓存,则步骤S330可以是响应于目标缓存为第二级缓存,判断预测虚拟地址与历史虚拟地址是否在同一个虚拟地址页中。即,如果目标缓存为第二级缓存,那么判断预测虚拟地址与历史虚拟地址是否在同一个虚拟地址页中,从而根据步骤S340提供的方法来计算存储第二存储信息的第一预测物理地址。In some embodiments of the present disclosure, on the basis of the foregoing embodiments, the information processing method may further include determining the target cache of the second storage information, and the target cache includes the first-level cache or the second-level cache, and step S330 may be a response If the target cache is a second-level cache, it is determined whether the predicted virtual address and the historical virtual address are in the same virtual address page. That is, if the target cache is the second-level cache, it is judged whether the predicted virtual address and the historical virtual address are in the same virtual address page, so as to calculate the first predicted physical address for storing the second storage information according to the method provided in step S340.
在本公开的另一些实施例中,如果目标缓存为第一级缓存,那么可以通过地址翻译流水线来得到存储第二存储信息的第三预测物理地址,并且从第三预测物理地址中获取第二存储信息,并且将第二存储信息缓存到第一级缓存中。下文图6示出了该实施例的实施方式,具体请参考图6和相应的描述部分,在此不再赘述。In some other embodiments of the present disclosure, if the target cache is a first-level cache, the address translation pipeline may be used to obtain the third predicted physical address for storing the second storage information, and the second predicted physical address may be obtained from the third predicted physical address. The information is stored, and the second stored information is cached in the first-level cache. FIG. 6 below shows the implementation of this embodiment. For details, please refer to FIG. 6 and the corresponding description, and details will not be repeated here.
例如,若预取器为L1/L2合成预取器,那么该L1/L2合成预取器可以是对于目标缓存为第二级缓存的预取,根据步骤S340提供的方法来计算存储第二存储信息的第一预测物理地址,而对于目标缓存为第一级缓存的预取,可以以通过地址翻译流水线来得到存储第二存储信息的第三预测物理地址。For example, if the prefetcher is an L1/L2 composite prefetcher, then the L1/L2 composite prefetcher may be a prefetcher for the second-level cache for the target cache, and calculate and store the second storage according to the method provided in step S340. The first predicted physical address of the information, and for the prefetch where the target cache is the first-level cache, the third predicted physical address for storing the second storage information can be obtained through an address translation pipeline.
在本公开的另一些实施例中,无论目标缓存是第一级缓存还是第二级缓存都可以根据步骤S340提供的方法来计算存储第二存储信息的第一预测物理地址。In some other embodiments of the present disclosure, regardless of whether the target cache is the first-level cache or the second-level cache, the first predicted physical address for storing the second storage information may be calculated according to the method provided in step S340.
例如,在目标缓存为第一级缓存并且根据步骤S340提供的方法来计算存储第二存储信息的第一预测物理地址的实施例中,上文参考图3描述的信息处理方法还可以包括:预取器可以根据第一预测物理地址生成预取请求,并且发送预取请求以使预取请求到达MAB,MAB向第二级缓存发送预取请求,第二级缓存响应于预取请求,确定第一级缓存中是否已经缓存了第一预测物理地址对应的第二存储信息。响应于第一级缓存已经缓存了第一预测物理地址对应的第二存储信息,第二级缓存通知地址缓存丢弃第一预取请求。响应于第一级缓存未缓存第一预测物理地址对应的第二存储信息,第二级缓存提取第一预测物理地址对应的第二存储信息,并且向MAB发送提取的第二存储信息,使得MAB向第一级缓存发送提取的第二存储信息以使第二存储信息缓存在第一级缓存中。For example, in an embodiment where the target cache is the first-level cache and the first predicted physical address for storing the second storage information is calculated according to the method provided in step S340, the information processing method described above with reference to FIG. 3 may further include: The fetcher can generate a prefetch request according to the first predicted physical address, and send the prefetch request so that the prefetch request reaches the MAB, and the MAB sends the prefetch request to the second-level cache, and the second-level cache determines the second-level cache in response to the prefetch request. Whether the second storage information corresponding to the first predicted physical address has been cached in the level-1 cache. In response to the fact that the first-level cache has cached the second storage information corresponding to the first predicted physical address, the second-level cache notifies the address cache to discard the first prefetch request. In response to the fact that the first-level cache does not cache the second storage information corresponding to the first predicted physical address, the second-level cache extracts the second storage information corresponding to the first predicted physical address, and sends the extracted second storage information to the MAB, so that the MAB Sending the extracted second storage information to the first-level cache so that the second storage information is cached in the first-level cache.
在上述实施例中,第二级缓存,例如可以是包含缓存(Inclusive cache),从而可以根据第二级缓存中的状态信息来确定第一级缓存中是否已经缓存了第一预测物理地址对应的第二存储信息。第二级缓存为包含缓存,即,第二级缓存中存储的第二级存储信息至少包括第一级缓存存储的第一级存储信息,并且第二级缓存中还包括状态信息。例如,第一级缓存中包括的第一级存储信息为存储信息A和存储信息B,若第二级缓存为包含缓存,则第二级存储信息至少包括存储信息A、存储信息B。第二级存储信息在包括存储信息A、存储信息B的基础上,例如还可以包括存储信息C、存储信息D等。In the above-mentioned embodiment, the second-level cache, for example, may be an Inclusive cache, so that it can be determined according to the state information in the second-level cache whether the first predicted physical address corresponding to the first-level cache has been cached. Second storage information. The second-level cache is an inclusive cache, that is, the second-level storage information stored in the second-level cache includes at least the first-level storage information stored in the first-level cache, and the second-level cache also includes state information. For example, the first-level storage information included in the first-level cache includes storage information A and storage information B, and if the second-level cache includes storage information, then the second-level storage information includes at least storage information A and storage information B. In addition to including storage information A and storage information B, the second-level storage information may also include storage information C and storage information D, for example.
状态信息指示第二级存储信息是否位于第一级缓存中,第二存储信息位于多级缓存中或者内存中。例如,第二级存储信息包括存储信息A、存储信息B和存储信息C,则第二级缓存中包括存储信息A、存储信息B和存储信息C各自的状态信息,该状态信息可以指示存储信息A、存储信息B和存储信息C是否缓存在第一级缓存中。The status information indicates whether the second-level storage information is located in the first-level cache, and whether the second-level storage information is located in the multi-level cache or in the internal memory. For example, if the second-level storage information includes storage information A, storage information B, and storage information C, then the second-level cache includes status information for each of storage information A, storage information B, and storage information C, and the status information may indicate that storage information A. Whether the storage information B and storage information C are cached in the first-level cache.
在本公开的一些实施例中,第二级缓存例如可以包括逻辑电路,该逻辑电路可以获取第二级缓存中的状态信息,并且判断第二存储信息的状态信息或者第一预测物理地址的状态信息是否等于参考值。该参考值可以是本领域技术人员根据实际需求而设定的,例如可以为0或1等。以参考值为1表示第二级存储信息位于第一级缓存中为例来举例说明步骤S355。例如逻辑电路可以从第二级缓存中确定第二存储信息的状态信息,然后逻辑电路可以将状态信息与参考值1进行比较,若状态信息等于1,则确定第一级缓存中已经缓存了第二存储信息,若状态信息不等于1,则确定第一级缓存中未缓存第二存储信息。In some embodiments of the present disclosure, the second-level cache may include, for example, a logic circuit, and the logic circuit may obtain state information in the second-level cache, and judge the state information of the second storage information or the state of the first predicted physical address Whether the information is equal to the reference value. The reference value may be set by those skilled in the art according to actual requirements, for example, it may be 0 or 1. Step S355 is illustrated by taking a reference value of 1 indicating that the second-level storage information is in the first-level cache as an example. For example, the logic circuit can determine the state information of the second storage information from the second-level cache, and then the logic circuit can compare the state information with the reference value 1, and if the state information is equal to 1, it is determined that the first-level cache has cached the state information. Second storage information, if the state information is not equal to 1, it is determined that the second storage information is not cached in the first level cache.
在本公开的一些实施例中,第二存储信息可以是数据也可以是指令。第二存储信息可以存储在处理器的多级缓存中的任意一级缓存,第二存储信息也可能存储在内存中。例如,若第二存储信息存储于第二级缓存中,则从第二级缓存中提取第二存储信息并缓存到第一级缓存。若第二存储信息存储于第三级缓存中,则第二级缓存从第三级缓存中提取第二存储信息并缓存到第一级缓存。In some embodiments of the present disclosure, the second storage information may be data or instructions. The second storage information may be stored in any level-1 cache in the multi-level cache of the processor, and the second storage information may also be stored in the memory. For example, if the second storage information is stored in the second-level cache, the second storage information is extracted from the second-level cache and cached in the first-level cache. If the second storage information is stored in the third-level cache, the second-level cache extracts the second storage information from the third-level cache and caches it in the first-level cache.
在本公开的一些实施例中,若目标缓存为第二级缓存,处理器还包括预取器,那么信息处理方法在前述实施例的基础上还可以包括下文参考图4A描述的步骤。In some embodiments of the present disclosure, if the target cache is a second-level cache and the processor further includes a prefetcher, then the information processing method may further include the steps described below with reference to FIG. 4A on the basis of the foregoing embodiments.
图4A示出了本公开至少一实施例提供的另一种信息处理方法的流程图。Fig. 4A shows a flowchart of another information processing method provided by at least one embodiment of the present disclosure.
如图4A所示,该信息处理方法在前述实施例的基础上还可以包括步骤S350~S370。As shown in FIG. 4A , the information processing method may further include steps S350 to S370 on the basis of the foregoing embodiments.
步骤S350:预取器根据第一预测物理地址生成第一预取请求。第一预取请求用于请求将第一预测物理地址中存储的第二存储信息存储到第二级缓存。Step S350: the prefetcher generates a first prefetch request according to the first predicted physical address. The first prefetch request is used to request to store the second storage information stored in the first predicted physical address into the second-level cache.
预取器,例如可以是L2缓存预取器或者L1/L2合成预取器,用于将预取得到的数据信息缓存到L2缓存中。The prefetcher, for example, may be an L2 cache prefetcher or an L1/L2 composite prefetcher, and is used to cache the prefetched data information into the L2 cache.
步骤S360:预取器向第二级缓存发送第一预取请求。Step S360: the prefetcher sends the first prefetch request to the second-level cache.
步骤S370:第二级缓存响应于第一预取请求,将第一预测物理地址对应的第二存储信息缓存于到第二级缓存。Step S370: the second-level cache caches the second storage information corresponding to the first predicted physical address in the second-level cache in response to the first prefetch request.
例如,第二级缓存响应于第一预取请求,确定第二级缓存中是否已经了缓存第一预测物理地址对应的第二存储信息。响应于第二级缓存已经了缓存第一预测物理地址对应的第二存储信息,丢弃第一预取请求。响应于第二级缓存未缓存第一预测物理地址对应的第二存储信息,第二级缓存向下一级缓存或者内存提取第一预测物理地址对应的第二存储信息,并且存储第二存储信息于第二级缓存。For example, in response to the first prefetch request, the second-level cache determines whether the second storage information corresponding to the first predicted physical address has been cached in the second-level cache. In response to the fact that the second level cache has cached the second storage information corresponding to the first predicted physical address, discarding the first prefetch request. In response to the fact that the second-level cache does not cache the second storage information corresponding to the first predicted physical address, the second-level cache fetches the second storage information corresponding to the first predicted physical address from the next-level cache or memory, and stores the second storage information in the second level cache.
在本公开的一些实施例中,在步骤S360中,预取器向第二级缓存发送所述第一预取请求可以包括:预取器向预取队列发送第一预取请求,以通过预取队列存储第一预取请求,以及响应于第二级缓存存在空闲空间,预取队列向第二级缓存发送所述第一预取请求。In some embodiments of the present disclosure, in step S360, the prefetcher sending the first prefetch request to the second-level cache may include: the prefetcher sends the first prefetch request to the prefetch queue to pass the prefetch The fetch queue stores the first prefetch request, and in response to the free space in the second level cache, the prefetch queue sends the first prefetch request to the second level cache.
该信息处理方法在预取器与第二级缓存之间增加了一个预取队列。预取队列可以缓存无需地址翻译的预取,待第二级缓存可以接收时再把这些预取发送过去,从而至少部分地避免了由于第二级缓存存储空间被占满而造成的预取丢失。In the information processing method, a prefetching queue is added between the prefetcher and the second-level cache. The prefetch queue can cache the prefetch that does not require address translation, and then send these prefetches when the second-level cache can receive them, thus at least partially avoiding the loss of prefetch caused by the full storage space of the second-level cache .
在本公开的一些实施例中,本领域技术人员可以根据实际情况来设置预取队列的大小。In some embodiments of the present disclosure, those skilled in the art can set the size of the prefetch queue according to actual conditions.
在本公开的一些实施例中,预取器向第二级缓存发送第一预取请求还包括:响应于预取队列的存储空间被占满,丢弃第一预取请求,或者用第一预取请求替换预取队列中的其他预取请求。In some embodiments of the present disclosure, the prefetcher sending the first prefetch request to the second-level cache further includes: in response to the storage space of the prefetch queue being full, discarding the first prefetch request, or using the first prefetch The fetch request replaces other prefetch requests in the prefetch queue.
例如,可以用第一预取请求替换排在预取队列末尾的至少一个其他预取请求。For example, at least one other prefetch request queued at the end of the prefetch queue may be replaced with the first prefetch request.
在本公开的另一些实施例中,预取器也可以不通过预取队列向第二级缓存发送第一预取请求,而是预取器直接向第二级缓存发送第一预取请求。In other embodiments of the present disclosure, the prefetcher may not send the first prefetch request to the second-level cache through the prefetch queue, but the prefetcher directly sends the first prefetch request to the second-level cache.
图4B示出了本公开至少一实施例提供的信息处理方法的示意性流程图。下面结合图4B对上文参考图3和图4A描述的信息处理方法进行说明。Fig. 4B shows a schematic flowchart of an information processing method provided by at least one embodiment of the present disclosure. The information processing method described above with reference to FIG. 3 and FIG. 4A will be described below with reference to FIG. 4B .
如图4B所示,该信息处理方法可以包括如下操作。As shown in FIG. 4B , the information processing method may include the following operations.
步骤S410:CPU核给出需要读取的指令或数据的虚拟地址。该虚拟地址例如为前述的历史虚拟地址。Step S410: The CPU core gives the virtual address of the instruction or data to be read. The virtual address is, for example, the aforementioned historical virtual address.
步骤S420:利用地址翻译流水线将虚拟地址翻译为物理地址,并且向预取器发送包括物理地址的读取请求,使得预取器对将所述虚拟地址作为历史虚拟地址并利用历史虚拟地址进行训练而得到预测虚拟地址。该物理地址可以作为前述的历史物理地址使用。Step S420: Use the address translation pipeline to translate the virtual address into a physical address, and send a read request including the physical address to the prefetcher, so that the prefetcher uses the virtual address as a historical virtual address and uses the historical virtual address to train And get the predicted virtual address. This physical address can be used as the aforementioned historical physical address.
步骤S410和步骤S420可以为预取器获取历史读取请求的读取信息的过程。例如可以按照上文图3描述的步骤S310来执行,在此不再赘述。Step S410 and step S420 may be a process for the prefetcher to obtain read information of historical read requests. For example, it may be performed according to the step S310 described in FIG. 3 above, which will not be repeated here.
步骤S430:预取器对所有历史物理地址或者部分历史物理地址进行训练,从而预测出CPU核在未来时刻获取的指令或者数据的预测虚拟地址。例如可以按照上文图3描述的步骤S320来执行,在此不再赘述。Step S430: the prefetcher trains all or part of the historical physical addresses, so as to predict the predicted virtual addresses of instructions or data to be acquired by the CPU core at a future time. For example, it may be performed according to the step S320 described in FIG. 3 above, which will not be repeated here.
步骤S440:判断预测虚拟地址与历史虚拟地址是否在同一个虚拟地址页中。例如可以按照上文图3描述的步骤S330来执行,在此不再赘述。Step S440: Determine whether the predicted virtual address and the historical virtual address are in the same virtual address page. For example, it may be performed according to the step S330 described in FIG. 3 above, which will not be repeated here.
步骤S450:响应于预测虚拟地址与所述历史虚拟地址在同一个虚拟地址页中,根据历史虚拟地址、历史物理地址和预测虚拟地址确定第一预测物理地址。例如可以按照上文图3描述的步骤S340来执行,在此不再赘述。Step S450: In response to the predicted virtual address being in the same virtual address page as the historical virtual address, determine a first predicted physical address according to the historical virtual address, the historical physical address and the predicted virtual address. For example, it may be performed according to the step S340 described in FIG. 3 above, which will not be repeated here.
步骤S460:预取器根据第一预测物理地址生成第一预取请求,并且向预取队列发送该第一预取请求。例如可以执行上文图4A描述的步骤S350,在此不再赘述。Step S460: the prefetcher generates a first prefetch request according to the first predicted physical address, and sends the first prefetch request to the prefetch queue. For example, step S350 described above in FIG. 4A may be performed, and details are not repeated here.
步骤S470:预取队列向第二级缓存发送第一预取请求。例如可以执行上文图4A描述的步骤S360,在此不再赘述。Step S470: the prefetch queue sends the first prefetch request to the second-level cache. For example, step S360 described above in FIG. 4A may be performed, and details are not repeated here.
步骤S480:第二级缓存响应于所述第一预取请求,第二级缓存响应于第一预取请求,将第一预测物理地址对应的第二存储信息缓存于到第二级缓存。例如可以执行上文图4A描述的步骤S370。第二级缓存响应于第一预取请求将第一预测物理地址对应的第二存储信息缓存于到第二级缓存,例如可以包括确定第二级缓存中是否已经缓存了第一预测物理地址对应的第二存储信息,如果第二级缓存确定自身已经缓存了第二存储信息,则第二级缓存丢弃第一预取请求。或者,如果第二级缓存确定自身未缓存第二存储信息,第二级缓存可以从下一级缓存或者内存提取第二存储信息,以将第二存储信息存储于自身。例如第二级缓存可以从最后一级缓存中提取第二存储信息。Step S480: the second-level cache responds to the first prefetch request, and the second-level cache caches the second storage information corresponding to the first predicted physical address in the second-level cache in response to the first prefetch request. For example, step S370 described above in FIG. 4A may be performed. The second-level cache caches the second storage information corresponding to the first predicted physical address in the second-level cache in response to the first prefetch request, for example, it may include determining whether the first predicted physical address has been cached in the second-level cache. The second storage information, if the second-level cache determines that it has cached the second storage information, the second-level cache discards the first prefetch request. Or, if the second-level cache determines that it does not cache the second storage information, the second-level cache may extract the second storage information from the next-level cache or memory, so as to store the second storage information in itself. For example, the second-level cache can extract the second storage information from the last-level cache.
图5示出了本公开至少一个实施例提供的另一种信息处理方法的流程图。Fig. 5 shows a flowchart of another information processing method provided by at least one embodiment of the present disclosure.
如图5所示,该信息处理方法在前述图3描述的方法的基础上还可以包括步骤S510。As shown in FIG. 5 , the information processing method may further include step S510 on the basis of the method described in FIG. 3 .
步骤S510:响应于预测虚拟地址与历史虚拟地址不在同一个虚拟地址页中,通过地址翻译流水线对预测虚拟地址进行地址翻译而获得第二预测物理地址。Step S510: In response to the fact that the predicted virtual address and the historical virtual address are not in the same virtual address page, perform address translation on the predicted virtual address through the address translation pipeline to obtain a second predicted physical address.
如图4B所示,例如在预取器确定预测虚拟地址与历史虚拟地址不在同一个虚拟地址页中的情况下,预取器可以执行步骤S401。步骤S401例如可以包括向地址翻译流水线发送该预测虚拟地址,使得地址翻译流水线对预测虚拟地址进行翻译。As shown in FIG. 4B , for example, when the prefetcher determines that the predicted virtual address and the historical virtual address are not in the same virtual address page, the prefetcher may execute step S401 . Step S401 may include, for example, sending the predicted virtual address to an address translation pipeline, so that the address translation pipeline translates the predicted virtual address.
在本公开的一些实施例中,向地址翻译流水线发送该预测虚拟地址,例如可以是预取器根据预测虚拟地址生成包含预测虚拟地址的预取请求,并且向地址翻译流水线发送该包含预测虚拟地址的预取请求,以由地址翻译流水线对预测虚拟地址进行地址翻译。In some embodiments of the present disclosure, the predicted virtual address is sent to the address translation pipeline, for example, the prefetcher may generate a prefetch request containing the predicted virtual address according to the predicted virtual address, and send the predicted virtual address to the address translation pipeline The prefetch request of , to perform address translation on the predicted virtual address by the address translation pipeline.
在本公开的另一些实施例中,如图5所示,该信息处理方法还可以包括步骤S520~S550。In some other embodiments of the present disclosure, as shown in FIG. 5 , the information processing method may further include steps S520-S550.
步骤S520:地址翻译流水线根据第二预测物理地址生成第二预取请求,并向预取队列发送第二预取请求。Step S520: the address translation pipeline generates a second prefetch request according to the second predicted physical address, and sends the second prefetch request to the prefetch queue.
例如,地址翻译流水线在将预测虚拟地址翻译为第二预测物理地址,根据第二预测物理地址生成第二预取请求,以及向预取队列发送第二预取请求。For example, the address translation pipeline translates the predicted virtual address into the second predicted physical address, generates the second prefetch request according to the second predicted physical address, and sends the second prefetch request to the prefetch queue.
步骤S530:预取队列响应于第二预取请求,向第二级缓存发送第二预取请求。Step S530: the prefetch queue sends the second prefetch request to the second level cache in response to the second prefetch request.
第二级缓存响应于第二预取请求,确定第二级缓存中是否已经缓存了第二预测物理地址对应的第二存储信息。In response to the second prefetch request, the second-level cache determines whether the second storage information corresponding to the second predicted physical address has been cached in the second-level cache.
步骤S540:响应于第二级缓存中已经缓存了第二预测物理地址对应的第二存储信息,丢弃第二预取请求。Step S540: In response to the fact that the second storage information corresponding to the second predicted physical address has been cached in the second-level cache, discard the second prefetch request.
步骤S550:响应于第二级缓存中未缓存第二预测物理地址对应的第二存储信息,第二级缓存向下一级缓存或者内存提取第二预测物理地址对应的第二存储信息,并且存储第二存储信息于第二级缓存。Step S550: In response to the fact that the second storage information corresponding to the second predicted physical address is not cached in the second-level cache, the second-level cache fetches the second storage information corresponding to the second predicted physical address from the next-level cache or memory, and stores The second storage information is in the second level cache.
下面结合图4B对上文参考图5中的步骤S520~S550进行说明。Steps S520 to S550 in FIG. 5 above will be described below in conjunction with FIG. 4B .
如图4B所示,例如在预取器确定预测虚拟地址与历史虚拟地址不在同一个虚拟地址页中的情况下,预取器执行步骤S401,即,向地址翻译流水线发送包含预测虚拟地址的预取请求,使得地址翻译流水线对预测虚拟地址进行翻译。As shown in FIG. 4B, for example, when the prefetcher determines that the predicted virtual address and the historical virtual address are not in the same virtual address page, the prefetcher executes step S401, that is, sends the prefetcher containing the predicted virtual address to the address translation pipeline. Fetch requests, so that the address translation pipeline translates the predicted virtual address.
地址翻译流水线响应于接收到来自预取器包含预测虚拟地址的预取请求,可以执行步骤S402,对该预测虚拟地址进行翻译而得到第二预测物理地址,并且根据第二预测物理地址生成第二预取请求,以及向预取队列发送第二预取请求。In response to receiving a prefetch request containing a predicted virtual address from the prefetcher, the address translation pipeline may execute step S402, translate the predicted virtual address to obtain a second predicted physical address, and generate a second predicted physical address according to the second predicted physical address. A prefetch request, and sending a second prefetch request to the prefetch queue.
接下来,预取队列响应于第二预取请求,执行步骤S470。步骤S470可以是预取队列向第二级缓存发送第二预取请求。Next, the prefetch queue executes step S470 in response to the second prefetch request. Step S470 may be that the prefetch queue sends a second prefetch request to the second-level cache.
第二级缓存响应于第二预取请求,确定第二级缓存中是否已经缓存了第二预测物理地址对应的第二存储信息。响应于第二级缓存中已经缓存了第二预测物理地址对应的第二存储信息,丢弃第二预取请求。响应于第二级缓存中未缓存第二预测物理地址对应的第二存储信息,第二级缓存向下一级缓存或者内存提取第二预测物理地址对应的第二存储信息,并且存储第二存储信息于第二级缓存。例如可以执行上文参考图5描述的步骤S540或者步骤S550,在此不再赘述。In response to the second prefetch request, the second-level cache determines whether the second storage information corresponding to the second predicted physical address has been cached in the second-level cache. In response to the fact that the second storage information corresponding to the second predicted physical address has been cached in the second-level cache, the second prefetch request is discarded. In response to the fact that the second storage information corresponding to the second predicted physical address is not cached in the second-level cache, the second-level cache fetches the second storage information corresponding to the second predicted physical address from the next-level cache or memory, and stores the second storage information Information is stored in the second level cache. For example, step S540 or step S550 described above with reference to FIG. 5 may be executed, which will not be repeated here.
在本公开的一些实施例中,在预测虚拟地址为多个并且多个预测虚拟地址在同一个虚拟地址页内的情形中,响应于预测虚拟地址与历史虚拟地址不在同一个虚拟地址页中,对所述预测虚拟地址进行地址翻译而获得所述第二预测物理地址,包括:响应于多个预测虚拟地址均不与历史虚拟地址在同一个虚拟地址页中,对多个预测虚拟地址中被选择的预测虚拟地址进行地址翻译而获得第二预测物理地址,以及根据被选择的预测虚拟地址对应的第二预测物理地址,确定多个预测虚拟地址中除被选择的预测虚拟地址之外的其他预测虚拟地址对应的第二预测物理地址。In some embodiments of the present disclosure, when there are multiple predicted virtual addresses and the multiple predicted virtual addresses are in the same virtual address page, in response to the predicted virtual address not being in the same virtual address page as the historical virtual address, Performing address translation on the predicted virtual address to obtain the second predicted physical address includes: in response to none of the multiple predicted virtual addresses being in the same virtual address page as the historical virtual address, performing the address translation on the multiple predicted virtual addresses performing address translation on the selected predicted virtual address to obtain a second predicted physical address, and determining other than the selected predicted virtual address among the plurality of predicted virtual addresses according to the second predicted physical address corresponding to the selected predicted virtual address A second predicted physical address corresponding to the predicted virtual address is predicted.
如果多个连续预取对应的预测虚拟地址都在同一虚拟地址页面中,但是不和任何历史虚拟地址在同一页面,那么可以只对该多个连续预取中的第一个预取进行地址翻译,并将该请求的预测物理地址发送给预取器,这样之后访问该虚拟地址页面的预取则无需再次进行地址翻译。If the predicted virtual addresses corresponding to multiple consecutive prefetches are all in the same virtual address page, but not in the same page as any historical virtual address, then only the first prefetch in the multiple consecutive prefetches can be addressed. , and send the predicted physical address of the request to the prefetcher, so that the prefetch accessing the virtual address page does not need to perform address translation again.
例如,预取器预测出CPU核未来要读取的预测虚拟地址包括0X0000 0008、0X0000000B和0X0000 000D,并且可以确定0X0000 0008、0X0000 000B和0X0000 000D在同一个虚拟地址页中,那么可以从0X0000 0008、0X0000 000B和0X0000 000D中选择一个预测虚拟地址进行地址翻译而获得被选择的预测虚拟地址的第二预测物理地址。例如被选择的预测虚拟地址为0X0000 0008,可以利用地址翻译流水线对0X0000 0008进行地址翻译而得到0X0000 0008对应的物理地址。然后根据0X0000 0008对应的物理地址来计算0X0000 000B和0X0000 000D分别对应的物理地址。例如可以计算目标预测虚拟地址与被选择的预测虚拟地址之间的偏移量,将该偏移量与被选择的预测物理地址的和作为目标预测虚拟地址对应的物理地址。以目标预测虚拟地址为0X0000 000B,被选择的预测虚拟地址为0X00000008为例来说明上述计算方法。0X0000 000B的物理地址等于0X0000 000B与0X0000 0008之间的偏移量加上0X0000 0008对应的物理地址。For example, the prefetcher predicts that the predicted virtual addresses that the CPU core will read in the future include 0X0000 0008, 0X0000000B, and 0X0000 000D, and it can be determined that 0X0000 0008, 0X0000 000B, and 0X0000 000D are in the same virtual address page, then it can be read from 0X0000 0008 , 0X0000 000B and 0X0000 000D to select a predicted virtual address for address translation to obtain the second predicted physical address of the selected predicted virtual address. For example, the selected predicted virtual address is 0X0000 0008, and the address translation pipeline for 0X0000 0008 can be used to obtain the corresponding physical address of 0X0000 0008. Then calculate the physical addresses corresponding to 0X0000 000B and 0X0000 000D according to the physical address corresponding to 0X0000 0008. For example, an offset between the target predicted virtual address and the selected predicted virtual address may be calculated, and the sum of the offset and the selected predicted physical address may be used as the physical address corresponding to the target predicted virtual address. Take the target predicted virtual address as 0X0000 000B and the selected predicted virtual address as 0X00000008 as an example to illustrate the above calculation method. The physical address of 0X0000 000B is equal to the offset between 0X0000 000B and 0X0000 0008 plus the physical address corresponding to 0X0000 0008.
在本公开的一些实施例中,被选择的预测虚拟地址可以为该多个预测虚拟地址中的任意一个。在本公开的另一些实施例中,被选择的预测虚拟地址为预取器预测的多个预测虚拟地址中最先被处理器核访问的预测虚拟地址,或者是多个预测虚拟地址中,预取器第一个预测到的预测虚拟地址。In some embodiments of the present disclosure, the selected predicted virtual address may be any one of the plurality of predicted virtual addresses. In some other embodiments of the present disclosure, the selected predicted virtual address is the predicted virtual address that is first accessed by the processor core among the multiple predicted virtual addresses predicted by the prefetcher, or the predicted virtual address among the multiple predicted virtual addresses, the prefetcher Fetcher first predicted predicted virtual address.
图6示出了本公开至少一个实施例提供的另一种信息处理方法的流程图。Fig. 6 shows a flowchart of another information processing method provided by at least one embodiment of the present disclosure.
如图6所示,该信息处理方法在前述实施例的基础上还可以包括步骤S610~S660。As shown in FIG. 6 , the information processing method may further include steps S610 to S660 on the basis of the foregoing embodiments.
步骤S610:响应于目标缓存为第一级缓存,向地址翻译流水线发送第三预取请求,使得第三预取请求到达地址翻译流水线,第三预取请求包括预测虚拟地址。Step S610: In response to the fact that the target cache is the first-level cache, send a third prefetch request to the address translation pipeline, so that the third prefetch request reaches the address translation pipeline, and the third prefetch request includes the predicted virtual address.
例如预取器确定目标缓存为第一级缓存,可以向地址翻译流水线发送第三预取请求。该第三预取请求包括预测虚拟地址。For example, the prefetcher determines that the target cache is the first-level cache, and may send a third prefetch request to the address translation pipeline. The third prefetch request includes a predicted virtual address.
步骤S620:地址翻译流水线响应于第三预取请求,将预测虚拟地址翻译为第三预测物理地址,并且根据第三预测物理地址生成第四预取请求。Step S620: The address translation pipeline translates the predicted virtual address into a third predicted physical address in response to the third prefetch request, and generates a fourth prefetch request according to the third predicted physical address.
第四预取请求为包括第三预测物理地址的预取请求。The fourth prefetch request is a prefetch request including the third predicted physical address.
步骤S630:确定第一级缓存中是否已经缓存了第三预测物理地址对应的第二存储信息。Step S630: Determine whether the second storage information corresponding to the third predicted physical address has been cached in the first-level cache.
例如可以是地址翻译流水线确定第一级缓存中是否已经缓存了第三预测物理地址对应的第二存储信息。For example, the address translation pipeline may determine whether the second storage information corresponding to the third predicted physical address has been cached in the first-level cache.
步骤S640:响应于第一级缓存中已经缓存了第三预测物理地址对应的第二存储信息,丢弃第四预取请求。Step S640: Discard the fourth prefetch request in response to the fact that the second storage information corresponding to the third predicted physical address has been cached in the first-level cache.
如果第一级缓存中已经缓存了第三预测物理地址对应的第二存储信息,地址翻译流水线可以直接丢弃第四预取请求。If the second storage information corresponding to the third predicted physical address has been cached in the first-level cache, the address translation pipeline may directly discard the fourth prefetch request.
步骤S650:响应于第一级缓存中未缓存第三预测物理地址对应的第二存储信息,向地址缓存发送第四预取请求,使得地址缓存向第二级缓存发送第四预取请求。Step S650: In response to the fact that the second storage information corresponding to the third predicted physical address is not cached in the first level cache, send a fourth prefetch request to the address cache, so that the address cache sends the fourth prefetch request to the second level cache.
例如,如果第一级缓存中未缓存第三预测物理地址对应的第二存储信息,地址翻译流水线可以向MAB发送第四预取请求,使得MAB向第二缓存发送第四预取请求。For example, if the second storage information corresponding to the third predicted physical address is not cached in the first-level cache, the address translation pipeline may send the fourth prefetch request to the MAB, so that the MAB sends the fourth prefetch request to the second cache.
步骤S660:第二级缓存响应于来自地址缓存的第四预取请求提取第三预测物理地址对应的第二存储信息,并且向地址缓存发送提取的第二存储信息,使得地址缓存向第一级缓存发送提取的第二存储信息。Step S660: the second-level cache extracts the second storage information corresponding to the third predicted physical address in response to the fourth prefetch request from the address cache, and sends the extracted second storage information to the address cache, so that the address cache sends the first-level The cache sends the extracted second storage information.
例如,第二级缓存接收来自MAB的第四预取请求,从下一级缓存或者自身提取预测物理地址对应的第二存储信息,并且向MAB返回第二存储信息,使得MAB向第一级缓存发送提取的第二存储信息。For example, the second-level cache receives the fourth prefetch request from the MAB, extracts the second storage information corresponding to the predicted physical address from the next-level cache or itself, and returns the second storage information to the MAB, so that the MAB sends the second storage information to the first-level cache The extracted second stored information is sent.
下面结合图4B对图6所描述的信息处理方法进行进一步说明。如图4B所示,该实施例在包括前述步骤的基础上还可以包括步骤S401~S406。The information processing method described in FIG. 6 will be further described below in conjunction with FIG. 4B. As shown in FIG. 4B , this embodiment may further include steps S401 to S406 on the basis of including the foregoing steps.
如图4B所示,如果目标缓存为第一级缓存,预取器可以执行步骤S401。步骤S401:向地址翻译流水线发送包含预测虚拟地址的第三预取请求。例如可以执行上文参考图6描述的操作S610。As shown in FIG. 4B , if the target cache is a first-level cache, the prefetcher may execute step S401. Step S401: Send the third prefetch request including the predicted virtual address to the address translation pipeline. For example, operation S610 described above with reference to FIG. 6 may be performed.
步骤S403:地址翻译流水线响应于第三预取请求,将预测虚拟地址翻译为第三预测物理地址,并且根据第三预测物理地址生成第四预取请求。Step S403: The address translation pipeline translates the predicted virtual address into a third predicted physical address in response to the third prefetch request, and generates a fourth prefetch request according to the third predicted physical address.
地址翻译流水线还判断第一级缓存中是否已经缓存了第三预测物理地址对应的第二存储信息。响应于第一级缓存中已经缓存了第三预测物理地址对应的第二存储信息,丢弃第四预取请求。响应于第一级缓存中未缓存第三预测物理地址对应的第二存储信息,向MAB发送第四预取请求,使得MAB向第二级缓存发送第四预取请求。例如可以执行上文参考图6描述的操作S620~S650。The address translation pipeline also judges whether the second storage information corresponding to the third predicted physical address has been cached in the first-level cache. In response to the fact that the second storage information corresponding to the third predicted physical address has been cached in the first level cache, the fourth prefetch request is discarded. In response to the fact that the second storage information corresponding to the third predicted physical address is not cached in the first-level cache, a fourth prefetch request is sent to the MAB, so that the MAB sends the fourth prefetch request to the second-level cache. For example, operations S620˜S650 described above with reference to FIG. 6 may be performed.
步骤S404:MAB向第二级缓存发送第四预取请求。Step S404: the MAB sends a fourth prefetch request to the second-level cache.
步骤S405:第二级缓存响应于来自MAB的第四预取请求提取第三预测物理地址对应的第二存储信息,并且向MAB发送提取的第二存储信息。例如可以执行上文参考图6描述的操作S660。Step S405: the second-level cache extracts the second storage information corresponding to the third predicted physical address in response to the fourth prefetch request from the MAB, and sends the extracted second storage information to the MAB. For example, operation S660 described above with reference to FIG. 6 may be performed.
步骤S406:MAB向第一级缓存发送提取的第二存储信息。Step S406: the MAB sends the extracted second storage information to the first-level cache.
在本公开的一些实施例中,预取队列与地址翻译流水线共用地址缓存的同一个接口,从而可以节约接口资源。或者,在本公开的另一些实施例中,预取队列和地址翻译流水线分别占用地址缓存中不同的接口。例如可以在处理器中增加一个预取队列独占的MAB接口,以降低预取时延。In some embodiments of the present disclosure, the prefetch queue and the address translation pipeline share the same interface of the address cache, thereby saving interface resources. Or, in some other embodiments of the present disclosure, the prefetch queue and the address translation pipeline respectively occupy different interfaces in the address cache. For example, a MAB interface exclusive to the prefetch queue may be added to the processor to reduce the prefetch delay.
图7示出了本公开至少一个实施例提供的一种信息处理装置700的示意框图。Fig. 7 shows a schematic block diagram of an
例如,如图7所示,该信息处理装置700包括获取单元710、预测单元720、判断单元730和地址确定单元740。For example, as shown in FIG. 7 , the
获取单元710配置为获取历史读取请求的读取信息。历史读取请求由处理器的处理器核发送。历史读取请求指示在历史时刻处理器核请求读取第一存储信息。读取信息包括第一存储信息的历史虚拟地址和历史物理地址,历史物理地址与历史虚拟地址相对应。获取单元710例如可以执行图3描述的步骤S310,在此不再赘述。The acquiring
预测单元720配置为根据历史虚拟地址,预测处理器核在未来时刻请求读取的第二存储信息所在的预测虚拟地址。第二确定单元720例如可以执行图3描述的步骤S320,在此不再赘述。The predicting
判断单元730配置判断预测虚拟地址与历史虚拟地址是否在同一个虚拟地址页中。判断单元730例如可以执行图3描述的步骤S330。The judging
地址确定单元740配置为响应于预测虚拟地址与历史虚拟地址在同一个虚拟地址页中,根据历史虚拟地址、历史物理地址和预测虚拟地址确定第一预测物理地址。第一预测物理地址与预测虚拟地址相对应。地址确定单元740例如可以执行图3描述的步骤S340,在此不再赘述。The
例如,获取单元710、预测单元720、判断单元730、地址确定单元740可以为硬件、软件、固件以及它们的任意可行的组合。例如,获取单元710、预测单元720、判断单元730、地址确定单元740可以为专用或通用的电路、芯片或装置等,也可以为处理器和存储器的结合。关于上述各个单元的具体实现形式,本公开的实施例对此不作限制。For example, the acquiring
需要说明的是,本公开的实施例中,信息处理装置700的各个单元与前述的信息处理方法的各个步骤对应,关于信息处理装置700的具体功能可以参考关于信息处理方法的相关描述,此处不再赘述。图7所示的信息处理装置700的组件和结构只是示例性的,而非限制性的,根据需要,该信息处理装置700还可以包括其他组件和结构。It should be noted that, in the embodiments of the present disclosure, each unit of the
本公开的至少一个实施例还提供了一种电子设备,该电子设备包括处理器,处理器用于实现上述的信息处理方法。该电子设备可以至少部分地避免地址翻译带来的时延,提高了预取的有效性。另外,由于正常指令和数据读取往往需要与预取共享地址翻译流水线,因此该信息处理方法在减少预取的地址翻译的同时也减少了正常读取的地址读取时延,并且降低了预取地址翻译所需要的功耗。At least one embodiment of the present disclosure further provides an electronic device, where the electronic device includes a processor, and the processor is configured to implement the above information processing method. The electronic device can at least partially avoid the time delay caused by address translation, thereby improving the effectiveness of prefetching. In addition, since normal instruction and data reading often need to share the address translation pipeline with prefetching, this information processing method not only reduces the address translation of prefetching, but also reduces the address reading delay of normal reading, and reduces the prefetch Get the power consumption required for address translation.
图8为本公开一些实施例提供的一种电子设备的示意框图。如图8所示,该电子设备800包括处理器810。处理器810运行时可以执行上文所述的信息处理方法中的一个或多个步骤。Fig. 8 is a schematic block diagram of an electronic device provided by some embodiments of the present disclosure. As shown in FIG. 8 , the electronic device 800 includes a processor 810 . When running, the processor 810 may execute one or more steps in the information processing method described above.
例如,处理器810可以是中央处理单元(CPU)或者具有数据处理能力和/或程序执行能力的其它形式的处理单元。例如,中央处理单元(CPU)可以为X86或ARM架构等。处理器810可以为通用处理器或专用处理器,可以控制电子设备800中的其它组件以执行期望的功能。For example, processor 810 may be a central processing unit (CPU) or other form of processing unit having data processing capabilities and/or program execution capabilities. For example, the central processing unit (CPU) may be of X86 or ARM architecture or the like. The processor 810 may be a general-purpose processor or a special-purpose processor, and may control other components in the electronic device 800 to perform desired functions.
需要说明的是,本公开的实施例中,电子设备800的具体功能和技术效果可以参考上文中关于信息处理方法的描述,此处不再赘述。It should be noted that, in the embodiment of the present disclosure, for the specific functions and technical effects of the electronic device 800, reference may be made to the above description about the information processing method, which will not be repeated here.
图9为本公开一些实施例提供的另一种电子设备的示意框图。该电子设备900例如适于用来实施本公开实施例提供的信息处理方法。电子设备900可以是终端设备等。需要注意的是,图9示出的电子设备900仅仅是一个示例,其不会对本公开实施例的功能和使用范围带来任何限制。Fig. 9 is a schematic block diagram of another electronic device provided by some embodiments of the present disclosure. The
如图9所示,电子设备900可以包括处理装置(例如中央处理器)910,其可以根据存储在只读存储器(ROM)920中的程序或者从存储装置980加载到随机访问存储器(RAM)930中的程序而执行各种适当的动作和处理。在RAM 930中,还存储有电子设备900操作所需的各种程序和数据。处理装置910、ROM 920以及RAM 930通过总线940彼此相连。输入/输出(I/O)接口950也连接至总线940。As shown in FIG. 9 , an
通常,以下装置可以连接至I/O接口950:包括例如触摸屏、触摸板、键盘、鼠标、摄像头、麦克风、加速度计、陀螺仪等的输入装置960;包括例如液晶显示器(LCD)、扬声器、振动器等的输出装置970;包括例如磁带、硬盘等的存储装置980;以及通信装置990。通信装置990可以允许电子设备900与其他电子设备进行无线或有线通信以交换数据。虽然图9示出了具有各种装置的电子设备900,但应理解的是,并不要求实施或具备所有示出的装置,电子设备900可以替代地实施或具备更多或更少的装置。In general, the following devices can be connected to the I/O interface 950:
例如,根据本公开的实施例,处理装置910可以执行上述信息处理方法,可以实现本公开实施例提供的信息处理方法中限定的功能。For example, according to the embodiments of the present disclosure, the
有以下几点需要说明:The following points need to be explained:
(1)本公开实施例附图只涉及到本公开实施例涉及到的结构,其他结构可参考通常设计。(1) Embodiments of the present disclosure The drawings only relate to the structures involved in the embodiments of the present disclosure, and other structures may refer to common designs.
(2)在不冲突的情况下,本公开的实施例及实施例中的特征可以相互组合以得到新的实施例。(2) In the case of no conflict, the embodiments of the present disclosure and the features in the embodiments can be combined with each other to obtain new embodiments.
以上所述,仅为本公开的具体实施方式,但本公开的保护范围并不局限于此,本公开的保护范围应以所述权利要求的保护范围为准。The above description is only a specific implementation manner of the present disclosure, but the protection scope of the present disclosure is not limited thereto, and the protection scope of the present disclosure should be based on the protection scope of the claims.
Claims (16)
Priority Applications (1)
| Application Number | Priority Date | Filing Date | Title |
|---|---|---|---|
| CN202011403652.1A CN112416436B (en) | 2020-12-02 | 2020-12-02 | Information processing method, information processing device and electronic equipment |
Applications Claiming Priority (1)
| Application Number | Priority Date | Filing Date | Title |
|---|---|---|---|
| CN202011403652.1A CN112416436B (en) | 2020-12-02 | 2020-12-02 | Information processing method, information processing device and electronic equipment |
Publications (2)
| Publication Number | Publication Date |
|---|---|
| CN112416436A CN112416436A (en) | 2021-02-26 |
| CN112416436B true CN112416436B (en) | 2023-05-09 |
Family
ID=74830461
Family Applications (1)
| Application Number | Title | Priority Date | Filing Date |
|---|---|---|---|
| CN202011403652.1A Active CN112416436B (en) | 2020-12-02 | 2020-12-02 | Information processing method, information processing device and electronic equipment |
Country Status (1)
| Country | Link |
|---|---|
| CN (1) | CN112416436B (en) |
Families Citing this family (3)
| Publication number | Priority date | Publication date | Assignee | Title |
|---|---|---|---|---|
| CN114358179B (en) * | 2021-12-31 | 2024-09-17 | 海光信息技术股份有限公司 | Processor pre-fetch training method, processing device, processor and computing equipment |
| CN114924797B (en) * | 2022-05-24 | 2025-07-11 | 海光信息技术股份有限公司 | Method for prefetching instructions, information processing device, equipment and storage medium |
| CN117931693B (en) * | 2024-03-22 | 2025-04-04 | 摩尔线程智能科技(北京)股份有限公司 | A memory management method and a memory management unit |
Citations (9)
| Publication number | Priority date | Publication date | Assignee | Title |
|---|---|---|---|---|
| US5392410A (en) * | 1992-04-30 | 1995-02-21 | International Business Machines Corporation | History table for prediction of virtual address translation for cache access |
| CN1636194A (en) * | 2001-11-30 | 2005-07-06 | 英特尔公司 | Method and apparatus for identifying candidate virtual addresses in a content-aware prefetcher |
| CN1896972A (en) * | 2005-07-14 | 2007-01-17 | 中国科学院计算技术研究所 | Method and device for converting virtual address, reading and writing high-speed buffer memory |
| CN102722451A (en) * | 2012-06-25 | 2012-10-10 | 杭州中天微系统有限公司 | Device for accessing cache by predicting physical address |
| CN103984526A (en) * | 2013-02-07 | 2014-08-13 | 上海芯豪微电子有限公司 | Instruction processing system and method |
| CN104133780A (en) * | 2013-05-02 | 2014-11-05 | 华为技术有限公司 | Cross-page prefetching method, device and system |
| CN104239236A (en) * | 2013-06-17 | 2014-12-24 | 华为技术有限公司 | Translation lookaside buffer and method for handling translation lookaside buffer deficiency |
| CN108139981A (en) * | 2016-08-11 | 2018-06-08 | 华为技术有限公司 | The access method and processing chip of list item in a kind of page table cache TLB |
| CN110389911A (en) * | 2018-04-23 | 2019-10-29 | 珠海全志科技股份有限公司 | A kind of forecasting method, the apparatus and system of device memory administrative unit |
Family Cites Families (1)
| Publication number | Priority date | Publication date | Assignee | Title |
|---|---|---|---|---|
| GB2576528B (en) * | 2018-08-22 | 2021-06-23 | Advanced Risc Mach Ltd | Performing address translation on predicted virtual memory address |
-
2020
- 2020-12-02 CN CN202011403652.1A patent/CN112416436B/en active Active
Patent Citations (9)
| Publication number | Priority date | Publication date | Assignee | Title |
|---|---|---|---|---|
| US5392410A (en) * | 1992-04-30 | 1995-02-21 | International Business Machines Corporation | History table for prediction of virtual address translation for cache access |
| CN1636194A (en) * | 2001-11-30 | 2005-07-06 | 英特尔公司 | Method and apparatus for identifying candidate virtual addresses in a content-aware prefetcher |
| CN1896972A (en) * | 2005-07-14 | 2007-01-17 | 中国科学院计算技术研究所 | Method and device for converting virtual address, reading and writing high-speed buffer memory |
| CN102722451A (en) * | 2012-06-25 | 2012-10-10 | 杭州中天微系统有限公司 | Device for accessing cache by predicting physical address |
| CN103984526A (en) * | 2013-02-07 | 2014-08-13 | 上海芯豪微电子有限公司 | Instruction processing system and method |
| CN104133780A (en) * | 2013-05-02 | 2014-11-05 | 华为技术有限公司 | Cross-page prefetching method, device and system |
| CN104239236A (en) * | 2013-06-17 | 2014-12-24 | 华为技术有限公司 | Translation lookaside buffer and method for handling translation lookaside buffer deficiency |
| CN108139981A (en) * | 2016-08-11 | 2018-06-08 | 华为技术有限公司 | The access method and processing chip of list item in a kind of page table cache TLB |
| CN110389911A (en) * | 2018-04-23 | 2019-10-29 | 珠海全志科技股份有限公司 | A kind of forecasting method, the apparatus and system of device memory administrative unit |
Also Published As
| Publication number | Publication date |
|---|---|
| CN112416436A (en) | 2021-02-26 |
Similar Documents
| Publication | Publication Date | Title |
|---|---|---|
| CN112416437B (en) | Information processing method, information processing device and electronic equipment | |
| CN112416817B (en) | Prefetching method, information processing apparatus, device, and storage medium | |
| CN112416436B (en) | Information processing method, information processing device and electronic equipment | |
| US9280474B2 (en) | Adaptive data prefetching | |
| CN108139981B (en) | Access method for page table cache TLB table entry and processing chip | |
| US9563562B2 (en) | Page crossing prefetches | |
| CN112527395B (en) | Data prefetching method and data processing apparatus | |
| CN114238167B (en) | Information prefetching method, processor and electronic equipment | |
| US8055805B2 (en) | Opportunistic improvement of MMIO request handling based on target reporting of space requirements | |
| CN113407119B (en) | Data prefetching method, data prefetching device and processor | |
| CN115292214A (en) | Page table prediction method, memory access operation method, electronic device and electronic equipment | |
| US11061820B2 (en) | Optimizing access to page table entries in processor-based devices | |
| CN114238176B (en) | Processor, address translation method for processor and electronic equipment | |
| CN103221995A (en) | Streaming translation in display pipe | |
| CN101868786A (en) | Address translation cache and I/O cache performance improvements in virtualized environments | |
| CN116680214A (en) | Data access method, readable storage medium and electronic equipment | |
| CN114925001B (en) | Processor, page table prefetching method, and electronic device | |
| CN114637700B (en) | Address translation method for target virtual address, processor and electronic equipment | |
| CN114218132B (en) | Information prefetching method, processor and electronic equipment | |
| US11048637B2 (en) | High-frequency and low-power L1 cache and associated access technique | |
| CN120111107A (en) | Intelligent network card and distributed object access method based on intelligent network card | |
| CN100552647C (en) | Processing module with multi-level cache architecture | |
| CN114281720B (en) | Processor, address translation method for processor and electronic equipment | |
| CN115080464B (en) | Data processing method and data processing device | |
| CN113760783B (en) | Joint offset prefetching method and device, computing device and readable storage medium |
Legal Events
| Date | Code | Title | Description |
|---|---|---|---|
| PB01 | Publication | ||
| PB01 | Publication | ||
| SE01 | Entry into force of request for substantive examination | ||
| SE01 | Entry into force of request for substantive examination | ||
| GR01 | Patent grant | ||
| GR01 | Patent grant |