Address conversion method and device, electronic equipment and storage medium

By using multiple sets of conversion buffers and dynamic update mapping algorithms in the address conversion device, the problem of low TLB resource utilization is solved, and the address conversion efficiency and system performance are improved.

CN119046191AActive Publication Date: 2024-11-29HYGON INFORMATION TECH CO LTD

Patent Information

Application Number
CN202411142514.0
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2024-08-19
Publication Date
2024-11-29
Estimated Expiration
2044-08-19

AI Technical Summary

Technical Problem

When existing address conversion devices face a large number of irregular memory access modes, the TLB resource utilization rate is low, resulting in a reduced address conversion efficiency and system performance.

Method used

Multiple groups of conversion buffers are used, each group of buffers stores the first page table information, determines the target buffer according to the virtual address conversion request, and determines whether to update the mapping algorithm by obtaining access frequency information, and dynamically adjusts the mapping strategy of TLB resources.

Benefits of technology

It improves the utilization rate of TLB resources, reduces page table read requests to physical memory, reduces address conversion delay, and improves system performance.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119046191A_ABST
    Figure CN119046191A_ABST
Patent Text Reader

Abstract

The invention discloses an address conversion method and device, electronic equipment and a storage medium. The method is applied to an address translation device, the device comprises a plurality of groups of translation buffers, and each group is configured to store page table information for translating a virtual address into a physical address. The method comprises the steps that in response to an obtained first virtual address conversion request, a target conversion buffer is determined from multiple groups of conversion buffers according to a first mapping algorithm, and the first virtual address conversion request comprises an object virtual address; page table information in the target translation buffer is accessed to convert the object virtual address into an object physical address, and the method further comprises the steps that access frequency information of each group of the translation buffers is acquired; determining whether a first mapping algorithm needs to be updated according to the access frequency information; and in response to the need of updating the first mapping algorithm, updating the mapping algorithm into a second mapping algorithm. According to the method, uneven resource allocation of the virtual address translation request translation buffer can be relieved, and the utilization rate of the translation buffer resources is improved.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] Embodiments of the present disclosure relate to an address conversion method, device, electronic device, and storage medium. Background Art

[0002] Currently, devices that require virtual addressing, such as central processing unit (CPU) chips and graphics processing unit (GPU), usually have specific address translation devices responsible for converting virtual addresses to physical addresses. For example, the CPU's memory management unit (MMU) is responsible for converting virtual addresses to physical addresses. Summary of the invention

[0003] At least one embodiment of the present disclosure provides an address conversion method, which is applied to an address conversion device, wherein the address conversion device includes multiple groups of conversion buffers, each group of conversion buffers includes first page table information for converting a virtual address into a physical address, the method includes: in response to obtaining a first virtual address conversion request, determining a target conversion buffer from the multiple groups of conversion buffers according to a first mapping algorithm, the first virtual address conversion request including an object virtual address; and accessing the first page table information in the target conversion buffer to convert the object virtual address into an object physical address, the method also includes: obtaining access frequency information for each group of the multiple groups of conversion buffers; determining whether the first mapping algorithm needs to be updated based on the access frequency information; and updating the first mapping algorithm to a second mapping algorithm in response to the need to update the first mapping algorithm.

[0004] For example, in the address conversion method provided in some embodiments of the present disclosure, the address conversion device also includes a multi-level page table query module, the multi-level page table query module includes second page table information, accesses the first page table information in the target conversion buffer to convert the object virtual address into the object physical address, including: accessing the first page table information in the target conversion buffer, and determining whether there is first target page table information in the first page table information that matches the first virtual address conversion request; in response to the absence of the first target page table information in the target conversion buffer, providing the first virtual address conversion request to the multi-level page table query module; judging whether there is second target page table information in the second page table information that matches the first virtual address conversion request; and in response to the absence of second target page table information in the second page table information that matches the first virtual address conversion request, converting the object virtual address into the object physical address based on the conversion information provided by the external memory.

[0005] For example, in the address conversion method provided in some embodiments of the present disclosure, the first page table information includes multiple page table entries, each page table entry corresponds to a physical page, and the second page table information includes a multi-level page table, each level of the page table includes multiple page directory entries, each page directory entry is used to point to the physical address of the next level page table, and each page directory entry in the last level page table in the multi-level page table is used to point to the page table entry in the first page table information.

[0006] For example, in the address conversion method provided in some embodiments of the present disclosure, determining whether the second page table information contains second target page table information that matches the first virtual address conversion request includes: obtaining a first page table read address of at least one level page table in the multi-level page table based on the object virtual address and the base address; and determining whether the second page table information contains second target page table information that matches the first virtual address conversion request based on the first page table read address.

[0007] For example, in the address conversion method provided in some embodiments of the present disclosure, in response to the second target page table information not existing in the second page table information that matches the first virtual address conversion request, the object virtual address is converted into the object physical address based on the conversion information provided by the external memory, including: in response to the second target page table information not existing in the second page table information that matches the first virtual address conversion request, determining whether a merge signal is valid; in response to the merge signal being valid, comparing whether the first page table read address and the second page table read address of the second virtual address conversion request that precedes the first virtual address conversion request are the same; in response to the first page table read address and the second page table read address being the same, merging the first virtual address conversion request with the second virtual address conversion request, waiting for the conversion information provided by the external memory in response to the second virtual address conversion request; and converting the object virtual address into the object physical address based on the conversion information.

[0008] For example, in the address conversion method provided in some embodiments of the present disclosure, in response to the second target page table information not matching the first virtual address conversion request existing in the second page table information, converting the object virtual address into the object physical address based on the conversion information provided by the external memory, and also including: in response to the first page table read address and the second page table read address being different, providing a page table read request based on the first virtual address conversion request to the external memory to obtain the conversion information from the external memory; and updating the merge signal to invalid.

[0009] For example, in the address conversion method provided in some embodiments of the present disclosure, in response to the second target page table information not matching the first virtual address conversion request existing in the second page table information, converting the object virtual address into the object physical address based on the conversion information provided by the external memory, and also including: in response to the merge signal being invalid, providing a page table read request based on the first virtual address conversion request to the external memory to obtain the conversion information from the external memory; and updating the merge signal to be valid.

[0010] For example, in the address conversion method provided in some embodiments of the present disclosure, in response to the second target page table information not matching the first virtual address conversion request does not exist in the second page table information, the object virtual address is converted into the object physical address based on the conversion information provided by the external memory, and also includes: in response to receiving the conversion information provided by the external memory in response to the second virtual address conversion request, updating the merge signal to invalid.

[0011] For example, in the address conversion method provided in some embodiments of the present disclosure, the page table read request includes: the page table read address of the virtual address conversion request, the object virtual address and the hardware access unit identifier providing the virtual address conversion request, and the page table read address is obtained based on the base address and the page directory entry data of at least one level page table in the multi-level page table.

[0012] For example, in the address conversion method provided in some embodiments of the present disclosure, the first page table information in the target conversion buffer is accessed to convert the object virtual address into the object physical address, including: accessing the first page table information in the target conversion buffer to determine whether there is a target page table entry in the first page table information that matches the object virtual address conversion request; in response to the presence of a target page table entry in the first page table information that matches the object virtual address conversion request, determining the object physical address corresponding to the object virtual address based on the target page table entry and the in-page offset indicated by the object virtual address.

[0013] For example, in the address conversion method provided in some embodiments of the present disclosure, the conversion information includes the target page table entry.

[0014] For example, in the address conversion method provided in some embodiments of the present disclosure, obtaining the access frequency information of each of the multiple groups of conversion buffers includes: counting the number of accesses to each of the multiple groups of conversion buffers to obtain the count value of each of the multiple groups of conversion buffers within a preset time period.

[0015] For example, in the address conversion method provided in some embodiments of the present disclosure, whether the first mapping algorithm needs to be updated is determined based on the access frequency information, including: calculating the average access value of the multiple groups of conversion buffer count values ​​based on the count values ​​of each group of the multiple groups of conversion buffers; obtaining the allowed access deviation; calculating the effective access rate of the multiple groups of conversion buffers based on the allowed access deviation and the average access value; and determining whether the first mapping algorithm needs to be updated based on the effective access rate.

[0016] For example, in the address conversion method provided in some embodiments of the present disclosure, the effective access rate of the multiple groups of conversion buffers is calculated based on the allowed access deviation and the average access value, including: calculating the access deviation value of each group of the multiple groups of conversion buffers based on the allowed access deviation; calculating the effective utilization indication value of each group of the multiple groups of conversion buffers based on the access deviation value, for each group of the multiple groups of conversion buffers, in response to the sum of the access deviation value and the count value being greater than or equal to the average access value, setting the effective utilization indication value of the conversion buffer to a first preset value, and in response to the sum of the access deviation value and the count value being less than the average access value, setting the effective utilization indication value of the conversion buffer to a second preset value; and taking the average value of the effective utilization indication values ​​of the multiple groups of conversion buffers as the effective access rate.

[0017] For example, in the address conversion method provided in some embodiments of the present disclosure, based on the effective access rate, determining whether the first mapping algorithm needs to be updated includes: in response to the effective access rate being greater than or equal to the preset access rate, determining that the first mapping algorithm does not need to be updated; in response to the effective access rate being less than the preset access rate, determining that the first mapping algorithm needs to be updated.

[0018] For example, in the address conversion method provided in some embodiments of the present disclosure, the first mapping algorithm includes: determining the target conversion buffer according to the first target bit of the object virtual address in the virtual address conversion request, and the second mapping algorithm includes: determining the target conversion buffer according to the second target bit of the object virtual address in the virtual address conversion request, and the first target bit and the second target bit are different.

[0019] For example, in the address conversion method provided in some embodiments of the present disclosure, the first target bit includes a plurality of consecutive first bits in the object virtual address, and the second target bit includes a plurality of consecutive second bits in the object virtual address.

[0020] At least some embodiments of the present disclosure also provide an address conversion device, comprising: an address conversion module, comprising multiple groups of conversion buffers; an arbitration module, configured to determine a target conversion buffer from the multiple groups of conversion buffers according to a first mapping algorithm in response to obtaining a first virtual address conversion request, wherein the first virtual address conversion request includes an object virtual address; each group of the multiple groups of conversion buffers is configured to store first page table information for converting the object virtual address into an object physical address, the address conversion module is configured to: access the first page table information in the target conversion buffer to convert the object virtual address into an object physical address, and the address conversion device also includes: an address conversion performance monitoring module, configured to: obtain access frequency information for each group of the multiple groups of conversion buffers; determine whether the first mapping algorithm needs to be updated based on the access frequency information; and update the mapping algorithm to a second mapping algorithm in response to the need to update the first mapping algorithm.

[0021] For example, in the address conversion device provided in some embodiments of the present disclosure, it also includes: a multi-level page table query module, the multi-level page table query module includes second page table information, and the address conversion module is configured to: access the first page table information in the target conversion buffer to determine whether there is first target page table information matching the first virtual address conversion request in the first page table information; in response to the absence of the first target page table information in the target conversion buffer, provide the first virtual address conversion request to the multi-level page table query module; the multi-level page table query module is configured to: receive the first virtual address conversion request provided by the address conversion module; determine whether there is second target page table information matching the first virtual address conversion request in the second page table information; and in response to the absence of second target page table information matching the first virtual address conversion request in the second page table information, obtain conversion information provided by an external memory, and the conversion information is used to convert the object virtual address into the object physical address.

[0022] For example, in the address conversion device provided in some embodiments of the present disclosure, the first page table information includes multiple page table entries, each page table entry corresponds to a physical page, the second page table information includes a multi-level page table, each level of the page table includes multiple page directory entries, each page directory entry is used to point to the physical address of the next level page table, and each page directory entry in the last level page table of the multi-level page table is used to point to the page table entry in the first page table information.

[0023] For example, in the address conversion device provided in some embodiments of the present disclosure, the multi-level page table query module is configured to: obtain the first page table read address of at least one level page table in the multi-level page table based on the object virtual address and the base address; and determine, based on the first page table read address, whether there is second target page table information in the second page table information that matches the first virtual address conversion request.

[0024] For example, in the address conversion device provided in some embodiments of the present disclosure, the multi-level page table query module includes a same read address merging unit and a conversion information cache unit, and the same read address merging unit is configured to: in response to the second page table information not having the second target page table information matching the first virtual address conversion request, determine whether the merge signal is valid; in response to the merge signal being valid, compare whether the first page table read address and the second page table read address of the second virtual address conversion request located before the first virtual address conversion request are the same; in response to the first page table read address and the second page table read address being the same, merge the first virtual address conversion request with the second virtual address conversion request, and wait for the conversion information provided by the external memory in response to the second virtual address conversion request, and the conversion information cache unit is configured to: cache the conversion information, and when the address conversion module is in an idle state, provide the conversion information to the address conversion module.

[0025] At least some embodiments of the present disclosure also provide an electronic device, comprising: a processor; a memory, comprising one or more computer program instructions; the one or more computer program instructions are stored in the memory, and when executed by the processor, implement the address conversion method provided by any embodiment of the present disclosure.

[0026] For example, at least some embodiments of the present disclosure further provide a computer-readable storage medium that non-temporarily stores computer-readable instructions, and when the computer-readable instructions are executed by a processor, the address conversion method provided by any embodiment of the present disclosure is implemented. BRIEF DESCRIPTION OF THE DRAWINGS

[0027] In order to more clearly illustrate the technical solutions of the embodiments of the present disclosure, the drawings of the embodiments will be briefly introduced below. Obviously, the drawings in the following description only relate to some embodiments of the present disclosure, but are not intended to limit the present disclosure.

[0028] Figure 1A A schematic diagram of a system for connecting an address translation device, a hardware access unit and an external memory is shown;

[0029] Figure 1B A schematic diagram of a 4-level page table structure is shown;

[0030] Figure 2A and Figure 2B A flowchart of an address conversion method provided by at least one embodiment of the present disclosure is shown;

[0031] Figure 3 A schematic block diagram of an address conversion device provided by at least one embodiment of the present disclosure is shown;

[0032] Figure 4A At least one embodiment of the present disclosure provides a Figure 2A The method flow chart of step S202 in FIG.

[0033] Figure 4B At least one embodiment of the present disclosure provides a Figure 3 A schematic block diagram of an arbitration module;

[0034] Figure 5 At least one embodiment of the present disclosure provides a Figure 3 A schematic block diagram of the L2 TLB in FIG.

[0035] Figure 6 A schematic diagram showing the principle of querying a page table through a virtual address and a page table base address in a four-level page table structure provided by some embodiments of the present disclosure is shown;

[0036] Figure 7 At least one embodiment of the present disclosure provides a Figure 3 A schematic block diagram of a multi-level page table query module;

[0037] Fig. 8A At least one embodiment of the present disclosure provides a Figure 2B The method flow chart of step S204 in FIG.

[0038] Figure 8B At least one embodiment of the present disclosure provides a Figure 3 A schematic block diagram of an address translation performance monitoring module;

[0039] Figure 8C A flowchart of another address conversion method provided by at least one embodiment of the present disclosure is shown;

[0040] Fig. 9 A schematic diagram of an address conversion device provided by at least one embodiment of the present disclosure is shown;

[0041] Fig. 10A A schematic block diagram of an electronic device provided for some embodiments of the present disclosure;

[0042] Fig. 10B A schematic block diagram of another electronic device provided for some embodiments of the present disclosure; and

[0043] Fig.11 A schematic diagram of a storage medium provided by some embodiments of the present disclosure is shown. DETAILED DESCRIPTION

[0044] In order to make the purpose, technical solution and advantages of the embodiments of the present disclosure clearer, the technical solution of the embodiments of the present disclosure will be clearly and completely described below in conjunction with the drawings of the embodiments of the present disclosure. Obviously, the described embodiments are part of the embodiments of the present disclosure, not all of the embodiments. Based on the described embodiments of the present disclosure, all other embodiments obtained by ordinary technicians in this field without creative work are within the scope of protection of the present disclosure.

[0045] Unless otherwise defined, the technical terms or scientific terms used in the present disclosure should be understood by people with ordinary skills in the field to which the present disclosure belongs. The "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. Similarly, similar words such as "one", "one" or "the" do not indicate quantity restrictions, but indicate that there is at least one. Similar words such as "include" or "comprise" mean that the elements or objects appearing before the word cover the elements or objects listed after the word and their equivalents, without excluding other elements or objects. Similar words such as "connect" or "connected" are not limited to physical or mechanical connections, but can include electrical connections, whether direct or indirect. "Up", "down", "left", "right" and the like are only used to indicate relative positional relationships. When the absolute position of the described object changes, the relative positional relationship may also change accordingly.

[0046] Figure 1A A schematic diagram of a system for connecting an address translation device, a hardware access unit and an external memory is shown; Figure 1B A schematic diagram of a 4-level page table structure is shown.

[0047] like Figure 1A As shown, the system includes an address translation device 101, n hardware access units and an external memory 102. The address translation device 101 is, for example, an MMU in a CPU. The n hardware access units include, for example, hardware access unit 1, hardware access unit 2, ..., hardware access unit n. The external memory 102 may include, for example, a physical memory.

[0048] An executable program can only use virtual memory addresses, which must be converted into physical memory addresses to access the corresponding data in the physical memory, and this conversion is very necessary. Most mainstream address translation devices complete the conversion from virtual addresses to physical addresses through a multi-level page table structure.

[0049] like Figure 1B As shown, each of the first three levels of page tables stores a page directory entry (PDE), and the directory entry is used to obtain the physical address of the next level of page table. The first three levels of page tables include, for example, the first level page table PDE2, the second level page table PDE1, and the third level page table PDE0. The last level of page table (i.e., the fourth level page table PTE0) stores page table entries (PTE). The page table entry is used to obtain the actual physical address in the memory. In this example, the complete address translation process requires reading the page table four times, and the page table is usually stored in the physical memory. The entire address translation process has a large delay, so the address translation device usually uses a translation lookaside buffer (TLB) to reduce the impact of read delay on performance. Each level of PDE and PTE in the multi-level page table structure has a corresponding TLB for storing related page table information. If there is a PDE or PTE in the TLB that matches the virtual address translation request, it is called a "hit", otherwise it is called a "miss". If the TLB misses, it is necessary to read the PDE or PTE information that matches the virtual address translation request in the multi-level page table structure from the physical memory and update the TLB. A TLB hit can avoid the process of re-reading the PDE or PTE from the physical memory, and the actual translation speed will be much faster. Therefore, the performance of the TLB is particularly important.

[0050] like Figure 1A As shown, the address translation device 101 includes n first-level (L1) TLBs, namely L1 TLB1, L1TLB2, ..., L1 TLBn and a second-level TLB (L2 TLB). The n first-level TLBs correspond to n hardware access units one by one. Compared with the L1 TLB, the L2TLB has a larger capacity and can store more PTEs and PDEs. The address translation device 101 also includes a multi-level page table query module and a bus.

[0051] When any of the hardware access units 1 to n needs to perform address translation, a virtual address translation request is sent to the corresponding L1 TLB. When the L1 TLB receives the virtual address translation request from the hardware access unit, it determines whether the L1 TLB is hit based on the virtual address in the virtual address translation request. If the L1 TLB is hit, the physical memory address is determined based on the physical address field in the hit L1TLB and the offset of the corresponding virtual address, and then sent to the hardware access unit. If the L1TLB is not hit, a page table read request is sent to the L2 TLB through the bus 121. If the L2 TLB is hit, it is transmitted to the L1 TLB through the bus 121, and then the L1 TLB determines the physical memory address based on the physical address field in the PTE plus the offset of the corresponding virtual address, and then sends it to the hardware access unit, and updates the L1 TLB at the same time. If the L2 TLB does not hit, the virtual address and other information are sent to the multi-level page table query module 111. There are M TLB modules in the multi-level page table query module 111 for storing PDE and PTE information of the M-level page table structure, where M is an integer greater than or equal to 1. For example, for a 4-level page table structure, M=4. When the multi-level page table query module 111 receives a virtual address translation request from the L2 TLB, it queries the PDE and PTE matching the virtual address translation request from the M TLB modules level by level. If there is no PDE or PTE information matching the virtual address translation request in the M TLB modules, a read request is sent to the external memory 102 to read the PDE or PTE information in the multi-level page table stored in the external memory 102, and the corresponding TLB is updated; until a PTE matching the virtual address translation request is found, the PTE is returned to the L2 TLB and L1 TLB in sequence, and the data of the L2 TLB and L1 TLB are updated at the same time. The L1 TLB determines the physical memory address based on the physical address field in the matching PTE and the offset of its corresponding virtual address, and then sends it to the hardware access unit, and the entire address translation process ends.

[0052] At present, the data cached inside the address translation device includes PTE and PDE. When the previous level TLB misses, it will go to the next level TLB to query level by level until a PTE matching the virtual address translation request is obtained, and the physical address field in the PTE is extracted. The extracted physical memory page base address is added to the corresponding offset in the virtual address to obtain the actual physical address, and the physical address and other information are returned to the hardware access unit, and the data that missed the TLB in the address translation device is updated at the same time.

[0053] The TLB capacity of the address conversion device 101 is limited. When a large number of threads are executed in parallel instantaneously, especially in an irregular memory access mode, the data stored in the TLB will be frequently replaced, and the hit rate of the TLB will drop significantly. In this case, the address conversion device 101 needs to frequently send page table read requests to the physical memory to read the PDE or PTE in the multi-level page table stored in the physical memory. A large number of read requests may cause serious obstruction in the module between the address conversion device and the physical memory, and increase the delay of reading back the PDE or PTE. At this time, a faster processor core or higher physical memory may not be of much help, and increasing the TLB capacity of the address conversion device 101 may also lead to problems such as increased chip area and increased power consumption.

[0054] Therefore, the current TLB cache resource allocation is unreasonable, and when faced with a large number of virtual address translation requests with irregular memory access patterns, TLB resources cannot be fully utilized, the address translation efficiency is greatly reduced, the delay of the entire address translation process is increased, and the system performance is reduced.

[0055] The present disclosure provides an address conversion method, which is applied to an address conversion device, wherein the address conversion device includes multiple groups of conversion buffers, each group of conversion buffers is configured to store first page table information for converting a virtual address into a physical address, and the method includes: in response to obtaining a first virtual address conversion request, determining a target conversion buffer from multiple groups of conversion buffers according to a first mapping algorithm, wherein the first virtual address conversion request includes an object virtual address; and accessing the first page table information in the target conversion buffer to convert the object virtual address into an object physical address, and the method also includes: obtaining access frequency information of each group of the multiple groups of conversion buffers; determining whether it is necessary to update the first mapping algorithm according to the access frequency information; and updating the mapping algorithm to a second mapping algorithm in response to the need to update the first mapping algorithm. The method can alleviate the uneven allocation of conversion buffer resources for virtual address conversion requests and improve the utilization rate of conversion buffer resources.

[0056] Figure 2A and Figure 2B A flowchart of an address conversion method provided by at least one embodiment of the present disclosure is shown.

[0057] like Figure 2A As shown, the address conversion method includes steps S201 and S202; Figure 2B As shown, the address conversion method includes steps S203 to S205 in addition to steps S201 and S202. Figure 2A and Figure 2B The address translation method is applied to an address translation device, which includes a plurality of translation buffers, each of which includes first page table information for translating a virtual address into a physical address.

[0058] Figure 3 A schematic block diagram of an address conversion device provided by at least one embodiment of the present disclosure is shown.

[0059] like Figure 3 As shown, the address translation device 300 includes an L2 TLB 310. For example, the L2 TLB 310 includes a plurality of translation buffers. Figure 2A and Figure 2B The address conversion method shown is applied to the address conversion device 300, that is, the address conversion device 300 can execute Figure 2A and Figure 2B The address conversion method is shown.

[0060] In some embodiments of the present disclosure, each of the multiple groups of translation buffers includes first page table information, where the first page table information includes, for example, multiple page table entries, each of which corresponds to a physical page. For example, the first page table information is Figure 1B The fourth-level page table PTE0 is shown. The fourth-level page table PTE0 includes multiple page table entries, each of which corresponds to an actual physical page. By querying the fourth-level page table PTE0, a virtual address can be converted into an actual physical page.

[0061] Step S201: in response to obtaining a first virtual address translation request, determining a target translation buffer from a plurality of translation buffers according to a first mapping algorithm, the first virtual address translation request including an object virtual address.

[0062] Step S202: Access the first page table information in the target translation buffer to translate the object virtual address into the object physical address.

[0063] Step S203: Obtain access frequency information of each of the multiple conversion buffers.

[0064] Step S204: Determine whether the first mapping algorithm needs to be updated according to the access frequency information.

[0065] Step S205: in response to the need to update the first mapping algorithm, the mapping algorithm is updated to a second mapping algorithm.

[0066] The method enables the address translation device to adaptively adjust the mapping algorithm when facing a large number of irregular virtual address translation requests, thereby avoiding the situation where the virtual address translation request is only mapped to a single TLB, thereby ensuring the utilization rate of TLB resources.

[0067] Regarding step S201 , for example, the address translation device 300 receives a first virtual address translation request provided by hardware access unit 1 to hardware access unit n.

[0068] Hardware access unit 1 to hardware access unit n are, for example, devices in a CPU or GPU that require address translation, such as a smart direct memory access controller (SDMA), a semaphore module (SEM), and a command processor fetcher (CPF).

[0069] The first virtual address translation request includes an object virtual address, and the object virtual address needs to be translated into an object physical address.

[0070] In some embodiments of the present disclosure, the first mapping algorithm is, for example, to determine the target translation buffer according to the object virtual address. The mapping algorithm for selecting the target translation buffer according to the object virtual address is calculated by taking the specified address range in the virtual address. For example, when the L2 TLB 310 includes 8 groups of translation buffers, the 26th to 24th bits of the 48-bit virtual address can be used as the result of selecting 8 groups of translation buffers. It should be noted that which 3 bits of the virtual address are selected as the selected target translation buffer can be changed according to the register configuration.

[0071] In some embodiments of the present disclosure, for example, a plurality of continuous bits are selected as the selection bits of the target conversion buffer, so that multiple groups of conversion buffers can be evenly queried.

[0072] like Figure 3 As shown, the address conversion device 300 further includes an arbitration module 301. Step S201 is executed by the arbitration module 301, for example.

[0073] For step S202, for example, the PTE in the target translation buffer is accessed to obtain the physical page corresponding to the object virtual address.

[0074] For example, step S202 includes accessing the first page table information in the target translation buffer, determining whether there is a target page table entry in the first page table information that matches the object virtual address translation request; in response to the presence of a target page table entry in the first page table information that matches the object virtual address translation request, determining the object physical address corresponding to the object virtual address based on the target page table entry and the page offset indicated by the object virtual address. For example, if there is a target page table entry (PTE) matching the object virtual address in PTE0 in the target translation buffer, the object physical address corresponding to the object virtual address is determined based on the target page table entry and the page offset indicated by the object virtual address. For example, certain consecutive bits of the object virtual address indicate the page offset. For more information about this embodiment, please refer to Figure 6 Description.

[0075] For step S203, the access frequency information is represented by the number of times the conversion buffer is accessed within a preset time period, for example, by counting the number of times each of the multiple conversion buffers is accessed to obtain a count value for each of the multiple conversion buffers within the preset time period.

[0076] For step S204, for example, if the access frequency information indicates that the access frequencies of the multiple groups of conversion buffers differ greatly, the first mapping algorithm needs to be updated. For another example, if the access frequency information indicates that the access frequencies of the multiple groups of conversion buffers differ little, or the multiple groups of conversion buffers are accessed evenly, the first mapping algorithm does not need to be updated.

[0077] For step S205, if the first mapping algorithm needs to be updated, the first mapping algorithm is updated to a second mapping algorithm. The second mapping algorithm is different from the first mapping algorithm. For example, the first mapping algorithm and the second mapping algorithm have different specified address ranges. For example, the first mapping algorithm uses the 26th to 24th bits of the 48-bit virtual address as the result of selecting 8 groups of translation buffers, while the second mapping algorithm uses the 24th to 22nd bits of the virtual address as the result of selecting 8 groups of translation buffers.

[0078] like Figure 3 As shown, the address translation device 300 further includes an address translation performance monitoring module 302. Steps S203 to S205 are executed by the address translation performance monitoring module 302, for example.

[0079] In some embodiments of the present disclosure, the address conversion device 300 further includes a multi-level page table query module 303. The multi-level page table query module 303 includes second page table information. The second page table information includes a multi-level page table, each level of the page table includes a plurality of page directory entries, and each page directory entry is used to point to the physical address of the next level of the page table. For example, the multi-level page table includes Figure 1B The first level page table PDE2, the second level page table PDE1 and the third level page table PDE0 are shown. Each level page table includes multiple PDEs for pointing to the physical address of the next level page table. Each page directory entry in the last level page table in the multi-level page table is used to point to the page table entry in the first page table information. For example, each page directory entry in the last level page table PDE0 in the multi-level page table is used to point to the page table entry in the first page table information PTE0.

[0080] In some embodiments of the present disclosure, the address conversion device 300 further includes a register configuration module 304. The register configuration module 304 is used to perform register configuration on registers of the L2 TLB 310, the arbitration module 301, the multi-level page table query module, and the address conversion performance monitoring module 302, such as providing register configuration values. For example, the value of the register configuration of the mapping algorithm of the arbitration module 301 is set, so as to set the mapping algorithm to the second mapping algorithm. The register configuration module, for example, performs register configuration on the monitoring cycle in the address conversion performance monitoring module 302, etc.

[0081] Figure 4A At least one embodiment of the present disclosure provides a Figure 2A Flow chart of the method for step S202 in FIG.

[0082] like Figure 4A As shown, step S202 may include steps S212 to S242.

[0083] Step S212: access the first page table information in the target translation buffer to determine whether there is first target page table information matching the first virtual address translation request in the first page table information.

[0084] Step S222: In response to the absence of the first target page table information in the target translation buffer, providing a first virtual address translation request to the multi-level page table query module.

[0085] Step S232: Determine whether the second page table information contains second target page table information that matches the first virtual address translation request.

[0086] Step S242: In response to the second page table information not having second target page table information matching the first virtual address translation request, the object virtual address is translated into an object physical address based on translation information provided by the external memory.

[0087] For step S212, for example, the PTE in the target translation buffer is accessed to determine whether the object virtual address hits the PTE in the target translation buffer. If the object virtual address hits the PTE in the target translation buffer, the hit PTE is the first target page table information, that is, the first target page table information indicates the physical page where the object virtual address is located. If the object virtual address does not hit the PTE in the target translation buffer, step S222 is executed.

[0088] For step S222 , for example, if the object virtual address does not hit the PTE in the target translation buffer, the L2 TLB 310 provides the first virtual address translation request to the multi-level page table query module 303 .

[0089] For step S232 , for example, it is determined whether the object virtual address hits the first-level page table PDE2 , the second-level page table PDE1 , and the third-level page table PDE0 in the multi-level page table query module 303 .

[0090] In some embodiments of the present disclosure, step S232, for example, includes: based on the object virtual address and the base address, obtaining the first page table read address of at least one level page table in the multi-level page table; based on the first page table read address, determining whether there is second target page table information in the second page table information that matches the first virtual address conversion request.

[0091] The base address is obtained by configuring the value of the base address register in the register configuration module 304, for example. The base address in the register configuration module 304 specifies the starting address of the first-level page table in the physical memory. The data field stored in the first-level page table PDE2 (as the physical base address of the second-level page table PDE1) specifies the starting address of the second-level page table PDE1 in the physical memory, the data field stored in the second-level page table PDE1 (as the physical base address of the third-level page table PDE0) specifies the starting address of the third-level page table PDE0 in the physical memory, the data field stored in the third-level page table PDE0 (as the physical base address of the fourth-level page table PTE0) specifies the starting address of the fourth-level page table PTE0 in the physical memory, and the data field stored in the fourth-level page table specifies the starting address of the page pointed to by the PTE in the physical memory.

[0092] In some embodiments of the present disclosure, the register configuration module 304 can also be used to configure which level of page table to start the query from, that is, to configure the page table to start the query. For example, the register configuration module 304 is used to set the query to start from the first-level page table PDE2. For example, the multi-level page table query module 303 uses the base address configured by the register plus the 47th to 39th bits of the virtual address as the first-level page table PDE2 read address to query the PDE2 cache resource; if the match is successful, the first-level page table PDE2 field (indicating the second-level page table PDE1 physical address field) plus the 38th to 30th bits of the virtual address is used as the second-level page table PDE1 page table read address to query the second-level page table PDE1 cache resource. If the match is not successful in the first-level page table PDE2 cache resource, the PDE2 data corresponding to the read address is read from the physical memory according to the first-level page table PDE2 page table read address.

[0093] In the above example, the sum of bits 47 to 39 in the object virtual address and the base address in the register configuration module 304 is used as the read address of the first-level page table PDE2 (an example of the first page table read address). If the read address of the first-level page table PDE2 does not hit the first-level page table PDE2, it is determined that the second page table information does not have the second target page table information that matches the first virtual address conversion request. If the read address of the first-level page table PDE2 hits the first-level page table PDE2, the second-level page table PDE1 cache resource is queried for a hit based on the sum of the successfully matched first-level page table PDE2 field and bits 38 to 30 of the upper virtual address as the second-level page table PDE1 page table read address. If not, it is determined that the second page table information does not have the second target page table information that matches the first virtual address conversion request. And so on until the third-level page table PDE0 matches successfully, it is determined that the second page table information has second target page table information that matches the first virtual address conversion request, and the page table information that matches the object virtual address in the third-level page table PDE0 is the second target page table information.

[0094] For step S242, if the object virtual address does not hit the multi-level page table query module 303, the first virtual address conversion request is provided to the external memory to obtain conversion information for converting the object virtual address to the object physical address from the external memory. The external memory is, for example, Figure 3 For example, a complete 4-level page table is stored in the physical memory, and the 4-level page table is, for example, Figure 1B In the structure shown, the physical memory responds to the first virtual address translation request and queries the 4-level page table to obtain translation information such as the PTE hit by the object virtual address, that is, the target page table entry that matches the object virtual address.

[0095] In some embodiments of the present disclosure, step S242 may obtain conversion information based on whether the merge request signal is valid. Figure 7 303 for the description of the multi-level page table query module.

[0096] Combine the following Figure 3 The specific implementation of the address conversion method provided by the present disclosure is illustrated by the embodiments.

[0097] like Figure 3 As shown, the address translation device 300 can process virtual address translation requests of n hardware access units (for example, hardware access unit 1 to hardware access unit n), and the virtual address translation request includes key information such as virtual address and hardware access unit identifier, where n is an integer greater than or equal to 1. In some embodiments of the present disclosure, n first-level TLBs can be set in each hardware translation unit, such as Figure 3As shown. Each of the hardware access units 1 to n includes a first level (L1) TLB. In other embodiments of the present disclosure, n first level TLBs may be provided in the address translation device 300, such as Figure 1A The embodiment of the present disclosure does not limit the first-level TLB.

[0098] The arbitration module 301 is configured to receive virtual address translation requests from n hardware access units to the cache inside the arbitration module 301, and process the virtual address translation requests in sequence through the arbitration algorithm. The processing process includes determining which group of the k groups of TLBs inside the L2 TLB 310 (i.e., the target TLB) the virtual address translation request is mapped to through the mapping algorithm, and determining the target TLB address index (index) and comparison tag information (tag) according to the virtual address, and sending this information together with the virtual address translation request to the L2 TLB 310; after receiving the virtual address translation result returned from the L2 TLB 310, the virtual address translation result is sent to the corresponding hardware access unit according to the hardware access unit identifier in the virtual address translation result. n, k are integers greater than or equal to 1.

[0099] The arbitration module 301 selects the mapping algorithm of the target TLB according to the virtual address by taking the specified address range in the virtual address to calculate and obtain. For example, when the L2 TLB 310 includes 8 groups of TLBs, the 26th to 24th bits of the 48-bit virtual address can be used as the result of selecting 8 groups of TLBs. The 3 bits of the virtual address can be changed according to the register configuration; selecting a continuous 3-bit address as the target TLB selection bit can make the continuous virtual address evenly query the 8 groups of TLBs.

[0100] The arbitration module 301 obtains the index bit of the target TLB according to the specified address range in the virtual address. For example, when the depth of the target TLB is 64, the 20th to 15th bits of the 48-bit virtual address can be used as the index bit of the target TLB. Select which 6 bits of the virtual address can be changed according to the register configuration; query the PTE data of the target TLB depth index through the value of the index bit for matching. Whether it matches is determined by tag comparison; the arbitration module 301 obtains tag information according to the specified address range in the virtual address, for example, the 47th to 12th bits of the 48-bit virtual address can be sent to the L2 TLB 310 as the tag value to compare with the tag value of the target TLB depth index; if the same, the match is successful, otherwise, the match fails.

[0101] Figure 4B At least one embodiment of the present disclosure provides a Figure 3 Schematic block diagram of the arbitration module.

[0102] like Figure 4B As shown, the arbitration module 301 includes a conversion request input arbitration module 311, a conversion result output arbitration module 321, n hardware input FIFO buffers and n hardware output FIFO buffers. The n hardware input FIFO buffers correspond one-to-one to the n hardware access units, and the n hardware output FIFO buffers correspond one-to-one to the n hardware access units. The n hardware input FIFO buffers include, for example, hardware 1 input FIFO buffer to hardware n input FIFO buffer. The n hardware output FIFO buffers include, for example, hardware 1 output FIFO buffer to hardware n output FIFO buffer.

[0103] The hardware x input FIFO buffer is used to buffer virtual address translation requests from the hardware access unit x, where x is an integer greater than or equal to 1 and less than or equal to n.

[0104] The conversion request input arbitration module 311 is used to process virtual address conversion requests, for example, by using a round-robin algorithm to determine whether n hardware input FIFO buffers are empty in turn. If not empty, the virtual address conversion request (an example of the first virtual address conversion request) in the hardware input FIFO buffer is read for processing, and the target TLB, tag, and index information corresponding to the virtual address are calculated by the virtual address and TLB mapping algorithm, and the above information is sent to the L2 TLB 310 module together with the virtual address conversion request; the TLB mapping algorithm can be adjusted through the register configuration module 304. Please refer to the relevant information in this field for the polling scheduling algorithm, which will not be described in detail here. It should be noted that other scheduling algorithms in this field can also be used to determine whether n hardware input FIFO buffers are empty in turn. The present disclosure does not limit the scheduling algorithm, and those skilled in the art can select a suitable scheduling algorithm according to their needs.

[0105] The conversion result output arbitration module 321 is used to receive the virtual address conversion result from the L2 TLB 310, and send the virtual address conversion result to the corresponding hardware x output FIFO buffer through the hardware access unit identifier in the virtual address conversion result.

[0106] The hardware x output FIFO buffer is used to buffer the virtual address conversion result of the hardware access unit x. When the hardware access unit x is in the "idle" state, the virtual address conversion result is sent to the hardware access unit x, where x is an integer greater than or equal to 1 and less than or equal to n.

[0107] Figure 5 At least one embodiment of the present disclosure provides a Figure 3 Schematic block diagram of the L2 TLB in .

[0108] like Figure 5 As shown, L2 TLB 310 includes k TLB input caches, k groups of TLBs, PTE check unit 312, address translation unit 322, and virtual address translation result output cache 332. The k TLB input caches correspond to the k groups of TLBs one by one, and k is an integer greater than or equal to 1. The k TLB input caches are TLB1 input cache, TLB2 input cache, ..., TLBk input cache, and the k groups of TLBs include TLB1, TLB2, ..., TLBk.

[0109] L2 TLB 310 includes, for example, k groups of TLBs, all of which are used to store data in the last-level page table in the M-level page table structure, i.e., PTE data; wherein M and k are both integers greater than or equal to 1; for example, if the M-level page table structure is a 3-level page table structure, then the k groups of TLBs all store PTE data in the 3rd-level page table; if the M-level page table structure is a 4-level page table structure, then the k groups of TLBs all store PTE data in the 4th-level page table. Placing all cache resources for storing PTEs in the L2 TLB module can improve the L2 TLB query hit rate. Such a design can more reasonably utilize PTE cache resources and improve address conversion efficiency.

[0110] For example, k groups of TLB input caches adopt a set-associative cache structure, and may also adopt a fully-associative cache structure. For the set-associative cache structure and the fully-associative cache structure, please refer to relevant materials in the art, which will not be described in detail here.

[0111] The TLBy input buffer is used to buffer virtual address translation requests from the arbitration module 301 with the target TLB being y, where y is an integer greater than or equal to 1 and less than or equal to k. The virtual address translation request includes a virtual address, a hardware access unit identifier, target TLB information, index and tag information, and the like.

[0112] TLBy is used to fetch the virtual address translation request from the TLBy input cache and match it in TLBy, where y is an integer greater than or equal to 1 and less than or equal to k. For example, TLBy finds the tag stored in the index line in TLBy according to the index in the virtual address translation request, and compares it with the tag in the virtual address translation request; if they are the same, the match is successful, and the PTE data stored in the index line in TLBy is sent to the PTE check unit; if they are not the same, TLBy misses, and the virtual address translation request is sent to the multi-level page table query module 303.

[0113] The PTE check unit 312 is used to perform error checking on the PTEs that hit the k groups of TLBs and the PTEs returned from the multi-level page table query module 303. The PTE check unit 312 determines whether the PTE can be used as a normal PTE by, for example, checking the specific field information in the matching PTE. For example, check whether the valid bit (V bit for short) of the PTE is valid. If it is invalid, it means that the PTE is invalid and cannot be used as a normal PTE. At this time, the default address configured by the register is sent to the address conversion unit as the physical address field of the PTE, and the error indication signal is pulled high to indicate that there is a problem with the result of this virtual address conversion. If the V bit of the PTE is valid, the physical address field information of the PTE is sent to the address conversion unit 322.

[0114] After the address conversion unit 322 reads the physical address information in the PTE field from the PTE check unit 312, it adds the corresponding offset in the virtual address to the physical address information to obtain the physical memory address corresponding to the virtual address conversion request, and sends the physical memory address together with the virtual address and the hardware access unit identifier as the virtual address conversion result to the virtual address conversion result output cache 332.

[0115] The virtual address translation result output buffer 332 is used to store the virtual address translation result. When the arbitration module 301 is in the “idle” state, the virtual address translation result output buffer 332 sends the virtual address translation result to the arbitration module 301 .

[0116] For example, L2 TLB 310 is used to receive a virtual address translation request from arbitration module 301, and compares the tag in the virtual address translation request with the tag information stored in the index line according to the target TLB, index, and tag information in the virtual address translation request to the index line in the target TLB. If the tag in the virtual address translation request is the same as the tag information stored in the index line, the match is successful, and the PTE data stored in the index line is read; and the PTE data is sent to the address translation unit 322 in L2 TLB 310 after PTE verification. The address translation unit 322 reads the physical address field in the PTE, and obtains the physical memory address corresponding to the virtual address translation request after adding the corresponding offset in the virtual address. The physical memory address is sent to arbitration module 301 together with the virtual address and the hardware access unit identifier as the virtual address translation result. If the tag in the virtual address translation request is different from the tag information stored in the index line, and the match is not successful, the virtual address translation request is sent to the multi-level page table query module 303. The multi-level page table query module 303 returns the PTE and virtual address, hardware access unit identifier, target TLB information, index, tag information, etc. that match the virtual address request to the L2 TLB 310. The L2 TLB 310 updates the PTE data and tag data of the index row in the target TLB according to the target TLB information and index. At the same time, the L2 TLB 310 verifies the returned PTE data, virtual address and hardware access unit identifier through the PTE verification unit 312 and sends them to the address conversion unit 322. After the address conversion unit 322 calculates the physical memory address, it sends them together with the virtual address and hardware access unit identifier as the virtual address conversion result to the arbitration module 301.

[0117] The multi-level page table query module 303 is used to cache the PDE data of the other level page tables except the last level page table in the M-level page table structure, so as to Figure 1B Taking the four-level page table structure of as an example, the multi-level page table query module 303 caches the data of PDE2, PDE1 and PDE0. When the multi-level page table query module 303 receives the virtual address conversion request from the L2 TLB 310, it queries from the PDE data cached by itself level by level. If there is no matching PDE data of the corresponding level, it is necessary to determine the address of the PDE data stored in the physical memory through the virtual address offset and the base address of the target level page table, read the target PDE from the physical memory, and update the TLB data based on the read-back PDE data; until the PDE0 data is matched, according to the base address information of the PTE table in PDE0 plus the corresponding offset of the virtual address, read back the PTE data from the physical memory and write it back to the L2 TLB 310.

[0118] If M is an integer greater than or equal to 2, the multi-level page table query module 303 is also used to determine whether the matched PDE item can be used directly as a PTE when querying PDE data. For example, a certain bit of the PDE is selected as a flag bit. When the flag bit is valid, the PDE can be used as a PTE. If the flag bit is invalid, it is necessary to query the next level page table. When the PDE can be used directly as a PTE, the PDE is directly returned to the L2 TLB 310 as PTE data, and the physical address in the PDE field is directly used as the physical memory page base address. The physical address obtained by adding the corresponding offset in the virtual address is the actual physical address after the virtual address is converted.

[0119] Considering that even in the M-level page table structure, not all virtual address translation requests are based on the M-level page table for address translation. For example, if M is 4, Figure 1B Under the four-level page table structure shown, some requests are based only on the level 1 page table structure, that is, only on Figure 1B The PTE page table in the L2 TLB 310 performs virtual address to physical address conversion. At this time, when the L2 TLB 310 misses, there is no need to query the PDE page table in the multi-level page table query module. The physical memory read request is directly sent to the physical memory through the multi-level page table query module 303 to read the matching PTE data. Some requests are based on the 2-level page table structure, that is, only Figure 1B In the case where the PDE0 page table and the PTE page table in the L2 TLB 310 are not hit, the multi-level page table query module 303 directly queries whether the PDE0 page table caches TLB resources, without querying the PDE2 page table and the PDE1 page table. The multi-level page table query module 303 can determine which level of PDE page table (target level PDE page table) to start querying each time through register configuration.

[0120] Figure 6 A schematic diagram showing the principle of querying a page table through a virtual address and a page table base address in a four-level page table structure provided by some embodiments of the present disclosure is shown.

[0121] by Figure 6 Taking the four-level page table in as an example, the first-level page table stores PDE2 data, the second-level page table stores PDE1 data, the third-level page table stores PDE0 data, and the fourth-level page table stores PTE data.

[0122] Figure 6The figure shows the meaning of the offset represented by each field of the virtual address under the 4-level page table structure. Bits 47 to 39 of the virtual address represent the offset in the 1st level page table in the 4-level page table, bits 38 to 30 represent the offset in the 2nd level page table in the 4-level page table, bits 29 to 21 represent the offset in the 3rd level page table in the 4-level page table, bits 20 to 12 represent the offset in the 4th level page table in the 4-level page table, and bits 11 to 0 represent the page offset of the page pointed to by the PTE internal page physical address. The virtual address field added to the address translation unit in the L2 TLB310 is bits 11 to 0 of the virtual address to obtain the actual physical memory address.

[0123] If the register configuration requires querying from the PDE2 cache at this time, the multi-level page table query module 303 uses the base address configured by the register plus the 47th to 39th bits of the virtual address as the PDE2 page table read address to query the PDE2 cache resource. If the match is successful in the PDE2 cache resource, the PDE1 page table physical address field in the successfully matched PDE2 field plus the 38th to 30th bits of the virtual address are used as the PDE1 page table read address to query the PDE1 cache resource. If the match is not successful in the PDE2 cache resource, the PDE2 page table read address is used to read the PDE2 data corresponding to the read address from the physical memory. The offsets corresponding to the remaining page tables in the virtual address are used in a similar manner and will not be repeated here. The base address configured by the register specifies the starting address of the first-level page table in physical memory, the physical base address of the PDE1 page table in the PDE2 data field stored in the first-level page table specifies the starting address of the second-level page table in physical memory, the physical base address of the PDE0 page table in the PDE1 data field stored in the second-level page table specifies the starting address of the third-level page table in physical memory, the physical base address of the PTB page table in the PDE0 data field stored in the third-level page table specifies the starting address of the fourth-level page table in physical memory, and the physical address segment in the PTE data field stored in the fourth-level page table specifies the starting address of the page pointed to by the PTE in physical memory.

[0124] Figure 7 At least one embodiment of the present disclosure provides a Figure 3 Schematic block diagram of the multi-level page table query module.

[0125] like Figure 7 As shown, the multi-level page table query module 303 includes a virtual address translation request cache module 313, a translation information cache module 323, a virtual address translation request query selection module 333, a PDE2 cache TLB, a PDE1 cache TLB, a PDE0 cache TLB and a same read address merging module 343. The PDE2 cache TLB, the PDE1 cache TLB, and the PDE0 cache TLB adopt, for example, a set associative cache structure or a fully associative cache structure.

[0126] In some embodiments of the present disclosure, the multi-level page table query module 303 can merge the page table read requests with the same read address sent to the physical memory through the same read address merging module 343, and the page table read request includes the page table read address of the virtual address conversion request, the virtual address, and the hardware access unit identifier that provides the virtual address conversion request. The hardware access unit identifier is, for example, the number of the hardware access unit. The page table read address is obtained based on the base address and the page directory entry data of at least one level of the page table in the multi-level page table. The page table read address is, for example, the sum of the base address configured by the register and the page directory entry data in the first-level page table PDE2. For another example, the page table read address is, for example, the page directory entry data in the second-level page table PDE1 obtained by the sum of the base address configured by the register and the page directory entry data in the first-level page table PDE2.

[0127] Step S242 can obtain conversion information based on whether the merge request signal is valid. For example, in response to the second page table information not having the second target page table information that matches the first virtual address conversion request, determine whether the merge signal is valid; in response to the merge signal being valid, compare whether the first page table read address and the second page table read address of the second virtual address conversion request that is located before the first virtual address conversion request are the same; in response to the first page table read address and the second page table read address being the same, merge the first virtual address conversion request with the second virtual address conversion request, and wait for the external memory to respond to the conversion information provided by the second virtual address conversion request; and convert the object virtual address into the object physical address based on the conversion information. This embodiment can effectively merge the same read address requests in the request initiated by the address conversion device to the physical memory, and optimize the congestion problem without reducing the hit rate of the address conversion device for the virtual address conversion request.

[0128] For example, if the second target page table information matching the object virtual address does not exist in the multi-level page table query module 303, it is determined whether the merge signal in the same read address merge module 343 is valid.

[0129] For example, when the multi-level page table query module 303 sends a page table read request to the physical memory, the same read address merge module 343 records the page table read address data, virtual address and hardware access unit identifier corresponding to the read request, and enables the merge signal. When the next page table read request (the first page table read address example of the first virtual address conversion request) is sent to the physical memory, if the merge signal is valid, the page table read address in the page table read request is compared with the page table read address in the previous page table read request (the second page table read address example of the second virtual address conversion request) to see if they are the same.

[0130] If the page table read request is consistent with the previous page table read address, a merge signal, a virtual address and a hardware access unit identifier are sent to the virtual address translation request query selection module 333, and the page table read request is no longer sent to the physical memory, waiting for the physical memory to respond to the translation information provided by the second virtual address translation request.

[0131] In some embodiments of the present disclosure, in response to the first page table read address and the second page table read address being different, a page table read request based on the first virtual address translation request is provided to the external memory to obtain translation information from the external memory; and the merge signal is updated to be invalid. For example, if the page table read request in the above embodiment is inconsistent with the previous page table read address, the page table read request is sent to the physical memory, and the merge signal is invalidated.

[0132] In some embodiments of the present disclosure, in response to the absence of second target page table information matching the first virtual address translation request in the second page table information, converting the object virtual address into the object physical address based on translation information provided by an external memory, and also including: in response to receiving translation information provided by the external memory in response to the second virtual address translation request, updating the merge signal to invalid.

[0133] In this embodiment, for example, if data is fed back from the physical memory, the merge signal is pulled low (i.e., updated to invalid). Because if the data is returned, it is necessary to determine which requests are merged, and give the read data to these merged requests so that subsequent virtual address translation requests can be issued.

[0134] For example, the PDE2 cache TLB in the multi-level page table query module 303 needs to continuously send three read requests with the same page table read address and one read request with a page table read address different from the first three to the physical memory through the same read address merging module 343. When the PDE2 cache TLB sends the first page table read request to the same read address merging module 343, the merge signal is invalid. At this time, the same read address merging module 343 records the page table read address of the first page table read request, and sends the page table read request to the physical memory, and makes the merge signal valid at the same time; when the PDE2 cache TLB sends the second page table read request to the same read address merging module 343, the same read address merging module 343 determines whether the merge signal is valid. At this time, the merge signal is valid, and the same read address merging module 343 will compare the request with the page table read address of the first page table read request. If the comparison finds consistency, the merge signal, virtual address and hardware access unit identifier will be sent to the virtual address conversion request query selection module 333. If the first page table read request reads back PDE or PTE data from the physical memory before the PDE2 cache TLB sends the third page table read request to the same read address merge module, the same read address merge module 343 determines whether the merge signal is valid at this time, and if it is valid, the merge signal is changed to an invalid state. At this time, when the PDE2 cache TLB sends the third read request of the same page table read address to the same read address, since the merge signal is invalid, the page table read request is sent to the physical memory, and the address merge signal is made valid at the same time. When the PDE2 cache TLB sends the fourth page table read request to the same read address merge module 343, since the merge signal is valid, it is necessary to determine whether the address of the page table read request is consistent with the recorded page table read request address. If the comparison finds that it is inconsistent, the merge signal is invalidated, and the page table read request is sent to the physical memory at the same time. If the PTE or PDE data has not been returned before the third page table read request is sent, the same read address merge module 343 merges the first page table read request, the second page table read request and the third page table read request.

[0135] The virtual address translation request cache module 313 is used to cache the virtual address translation requests from the L2 TLB 310 .

[0136] The virtual address translation request query selection module 333 is used to process the virtual address translation request. After obtaining the virtual address translation request data from the virtual address translation request, it is determined according to the register configuration which level of PDE cache TLB the virtual address translation request starts matching from. Taking the matching from the PDE2 cache TLB as an example, the virtual address translation request query selection module 333 first obtains the PDE2 page table read address according to the base address configured by the register plus the 47th to 39th bits in the virtual address; and then obtains the index bit and tag bit of the PDE2 cache TLB according to the specified address range in the PDE2 page table read address. For example, when the depth of the target TLB is 128, the 12th to 6th bits of the 48-bit PDE2 read address can be used as the index bit of the PDE2 cache TLB, and the 47th to 6th bits can be used as the tag bit. The specific selection of which bits of the PDE2 read address are used as the index and tag can be changed according to the register configuration. After calculating the PDE2 read address, index and tag bit, they are sent to the PDE2 cache TLB together with the virtual address and the hardware access unit identifier. The virtual address translation request query selection module 333 receives the PDE2 data from the PDE2 cache TLB or receives the PDE2 data returned from the physical memory. If the virtual address translation request query selection module 333 receives the PDE2 data returned from the physical memory, the PDE2 data and the corresponding PDE2 cache TLB index and tag information are sent to the PDE2 cache TLB to update the data in the PDE2 cache TLB.

[0137] The virtual address translation request query selection module 333 responds to receiving the PDE2 data from the PDE2 cache TLB or returned from the physical memory, and determines whether the PDE2 data can be used as a PTE. If the PDE2 data can be used as a PTE, the PDE2 data and the corresponding virtual address and hardware access unit identifier are sent to the translation information cache module 323. If the PDE2 data cannot be used directly, the PDE1 read address is obtained by adding the 38th to 30th bits of the virtual address to the PDE1 page table physical base address field information in the PDE2 data, and the index and tag corresponding to the virtual address translation request in the PDE1 cache TLB are calculated based on the PDE1 read address. The subsequent process is similar to the above process; until the PTE is read back from the physical memory, the PTE data and the virtual address matching the PTE data, the hardware access unit identifier (including the merged valid virtual address and hardware access unit identifier) ​​are sent to the translation information cache module 323.

[0138] The PDE2 cache TLB, PDE1 cache TLB and PDE0 cache TLB are used to receive PDE read requests and PDE write requests from the virtual address translation request query selection module 333. The PDE read request includes information such as PDE read address, index, tag, virtual address and hardware access unit identification; matching is performed in the cache TLB according to the index and tag bits; if the match is successful, the PDE data and the virtual address and the hardware access unit identification are sent to the virtual address translation request query selection module 333; if the match fails, that is, a miss, the page table read address, virtual address and hardware access unit identification are sent to the same read address merging module 343. When the PDE write request misses the PDE cache TLB, the PDE data read back from the physical memory is combined with the index and tag information to update the data in the PDE cache TLB.

[0139] The same read address merge request module 343 is used to determine whether the page table read requests from the PDE cache TLB can be merged. If they can be merged, the merged virtual address and the hardware access unit identifier are sent to the virtual address translation request query selection module 333; if they cannot be merged, the page table read request is sent to the physical memory. In some embodiments of the present disclosure, for example, the merge function can be turned on or off through register configuration.

[0140] The translation information cache module 323 is used to receive the PTE data and the corresponding virtual address, hardware access unit identification and other information queried from the virtual address translation request query selection module 333, and send these data to the L2 TLB 310 when the L2 TLB 310 is in the "idle" state.

[0141] In some embodiments of the present disclosure, the multi-level page table query module includes a same read address request merging module and a virtual address conversion request query selection module; when the multi-level page table query module sends a page table read request to the physical memory, the same read address merging module records the page table read address data and virtual address corresponding to the read request, the hardware access unit identifier, and makes the merge valid signal valid; when sending the next page table read request to the physical memory, if the merge valid signal is valid, then compare the page table read request with the previous page table read address to see if they are consistent. If the page table read request is consistent with the previous page table read address, then send the merge valid signal, virtual address and hardware access unit identifier to the virtual address conversion request query selection module inside the multi-level page table query module, and no longer send the page table read request to the physical memory; if the current page table read address is inconsistent with the previous page table read address, then send the page table read request to the physical memory, and make the merge valid signal invalid. After reading back the matching PTE from the physical memory, the virtual address translation request arbitration module will send all virtual address translation request information matching the PTE (including merged virtual address translation requests) to the L2 TLB module, thereby effectively merging the same read address requests in the requests initiated by the address translation module to the physical memory, and optimizing the congestion problem without reducing the hit rate of the virtual address translation requests of the address translation module.

[0142] It should be noted that in the above embodiment, the multi-level page table query module does not include a cache for storing the PTE page table, but it can also be like Figure 1A The structure of the PTE page table is added to the multi-level page table query module.

[0143] Fig. 8A At least one embodiment of the present disclosure provides a Figure 2B Flow chart of the method for step S204 in FIG.

[0144] like Fig. 8A As shown, step S204 includes steps S214 to S244.

[0145] Step S214: Calculate average access values ​​of the multiple groups of conversion buffer count values ​​based on the count values ​​of each group of the multiple groups of conversion buffers.

[0146] Step S224: Obtain the allowed access deviation.

[0147] Step S234: Calculate effective access rates of multiple groups of conversion buffers based on the allowed access deviation and the average access value.

[0148] Step S244: Based on the effective access rate, determine whether the first mapping algorithm needs to be updated.

[0149] Combine the following Figure 8B illustrate Fig. 8A Describe the method.

[0150] Figure 8B At least one embodiment of the present disclosure provides a Figure 3 A schematic block diagram of the address translation performance monitoring module in FIG.

[0151] The address translation performance monitoring module 302 is used to record the number of queries of the k groups of TLBs of the L2 TLB module within a fixed clock cycle, and determine whether the TLB mapping algorithm in the arbitration module 301 needs to be adjusted according to the adjustment algorithm, and adaptively adjust the TLB mapping algorithm. The TLB mapping algorithm includes, for example, a first mapping algorithm and a second mapping algorithm.

[0152] like Figure 8B As shown, the address translation performance monitoring module 302 includes k TLB access counters and a TLB mapping algorithm adjustment module 312. Each of the k TLB access counters is, for example, a 48-bit counter, or a counter of other bit numbers. The k TLB access counters include, for example, a TLB1 access counter, a TLB2 access counter, ..., a TLBk access counter.

[0153] The TLBx access counter is used to record the access status of TLBx in the L2 TLB module, where x is less than or equal to k and greater than or equal to 1. For example, at each rising edge of the clock, if the TLBx query enable from the arbitration module 301 is valid, the TLBx access counter is incremented by 1.

[0154] In some embodiments of the present disclosure, the address translation performance monitoring module may also include other types of counters, such as address translation delay, specific PTE error type counters, TLB miss counters, etc.

[0155] For step S214, for example, k groups of TLBs are counted respectively by using k TLB access counters to obtain the count value of each group of k groups of translation buffers.

[0156] The TLB mapping algorithm adjustment module 312 is used to determine whether to adjust the mapping algorithm according to the count value of the TLB access counter, and to adaptively adjust the TLB mapping algorithm when the mapping algorithm adjustment is required.

[0157] For example, the TLB mapping algorithm adjustment module 312 reads the count value of the k-group TLB access counter every F clocks, and calculates the average access value Ave_tlb of accessing the k-group TLB modules in F clock cycles, and clears the value of the k-group TLB access counter. For example, the average access value Ave_tlb can be calculated according to the following formula.

[0158] Ave_tlb=(N TLB0 +NTLB1 +…+N TLBk ) / k,N TLBx Indicates the count value of the TLBx access counter.

[0159] For step S224, for example, the allowed access deviation is Δ, and the allowed access deviation can be set by those skilled in the art as needed, and the present disclosure does not limit the value of the allowed access deviation.

[0160] For step S234, for example, it includes: calculating the access deviation value of each group of multiple conversion buffers based on the allowed access deviation; calculating the effective utilization indication value of each group of multiple conversion buffers based on the access deviation value; and taking the average value of the effective utilization indication values ​​of the multiple groups of conversion buffers as the effective access rate.

[0161] For example, the access deviation value n allowed for each set of TLB accesses is calculated by the following formula: Δ。

[0162] n Δ =Ave_tlb×Δ

[0163] For example, for each of the plurality of conversion buffers, in response to the sum of the access deviation value and the count value being greater than or equal to the average access value, the effective utilization indication value of the conversion buffer is set to a first preset value, and in response to the sum of the access deviation value and the count value being less than the average access value, the effective utilization indication value of the conversion buffer is set to a second preset value. For example, the first preset value is 1, and the second preset value is 0.

[0164] If N TLBx +n Δ ≥Ave_tlb, then TLBx effective utilization indicator value E TLBx is 1, otherwise it is 0. Next, for example, the average value of the TLB effective utilization indicator value can be calculated as the effective access rate TLB_usaget by the following formula.

[0165] TLB_usaget=(E TLB0 +E TLB1 +…+E TLBk ) / k

[0166] For step S244, for example, in response to the effective access rate TLB_usaget being greater than or equal to the preset access rate, it is determined that the first mapping algorithm does not need to be updated; in response to the effective access rate TLB_usaget being less than the preset access rate, it is determined that the first mapping algorithm needs to be updated.

[0167] When TLB_usaget≥α, there is no need to update the first mapping algorithm, and the arbitration module 301 still selects the target translation buffer according to the first mapping algorithm, α is the preset access rate, 0<α≤1, and different values ​​can be set according to the value of k. When TLB_usaget<α, it is necessary to update the first mapping algorithm to the second mapping algorithm, and the arbitration module 301 selects the target translation buffer according to the second mapping algorithm.

[0168] For example, the TLB mapping algorithm adjustment module 312 sends the mapping algorithm for selecting the target register in the arbitration module 301 and the related register configuration adjustment information to the register configuration module 304 .

[0169] In some embodiments of the present disclosure, a first mapping algorithm includes: determining a target translation buffer based on a first target bit of an object virtual address in a virtual address translation request, and a second mapping algorithm includes: determining a target translation buffer based on a second target bit of an object virtual address in a virtual address translation request, wherein the first target bit and the second target bit are different.

[0170] For example, the first target bit includes a plurality of first bits in the object virtual address, and the second target bit includes a plurality of second bits in the object virtual address. For example, bits 26 to 24 of the 48-bit virtual address are used as the plurality of first bits, and bits 25 to 23 of the 48-bit virtual address are used as the plurality of second bits. The first target bit and the second target bit are a plurality of consecutive bits, which enables uniform access to multiple groups of translation buffers.

[0171] For example, k=8 and the arbitration module 301 selects 8 groups of TLB mapping results based on the 26th to 24th bits of the 48-bit virtual address. If after 109 clocks, the TLB_usaget result is less than 0.8 (the value of α is 0.8 at this time), the TLB mapping algorithm adjustment module 312 selects the 25th to 23rd bits of the 48-bit virtual address as the register configuration adjustment information of the TLB mapping and sends it to the register configuration module 304, and then sends it to the arbitration module to adjust the TLB mapping algorithm 314.

[0172] In some other embodiments of the present disclosure, the first target bit or the second target bit may also be a plurality of discontinuous bits.

[0173] It should be noted that, although in the above embodiment, the TLB mapping algorithm is an adjustment for the mapped target translation buffer, the embodiments of the present disclosure are not limited thereto, and may also include an adaptive adjustment algorithm for index and tag.

[0174] Before the TLB mapping algorithm is adjusted, the virtual address conversion request that obtains the target TLB information, tag information and index information through the arbitration module 301 is still queried in the L2 TLB module according to the information obtained before the adjustment. After the TLB mapping algorithm is adjusted, the virtual address conversion request that has not been processed by the arbitration module 301 will obtain the new target TLB information, tag information and index information according to the new TLB mapping algorithm, and then query the L2 TLB module. It should be noted that after the arbitration module 301 receives the register configuration adjustment information from the register configuration module 314, the data in the k groups of TLBs in the L2 TLB will not change. After the TLB mapping algorithm is adjusted, the L2TLB will update the data in the TLB through the virtual address conversion request miss.

[0175] Figure 8C A flowchart of another address conversion method provided by at least one embodiment of the present disclosure is shown.

[0176] like Figure 8C As shown, the address conversion method includes steps S801 to S804.

[0177] Step S801: the arbitration module determines the target translation buffer, index and tag information of the virtual address translation request mapping according to the mapping algorithm.

[0178] For example, after receiving the virtual address translation request from the hardware access unit, the arbitration module selects the virtual address translation request to be processed through the polling algorithm, and determines the target TLB, index, tag and other information corresponding to the virtual address translation request according to the mapping algorithm and the virtual address, and then sends this information together with the virtual address translation request to the L2 TLB module. This step S801 is similar to executing Figure 2A Step S201.

[0179] Step S802: Search the L2 TLB module to see if there is a PTE that matches the virtual address translation request. If there is no PTE that matches the virtual address translation request in the L2 TLB, execute S803. If there is a PTE that matches the virtual address translation request in the L2 TLB, execute S804. The specific implementation process of S802 can be to read the target TLB information, index and tag information in the request, and compare it with the tag information of the index row stored in the target TLB, so as to determine whether there is a PTE that matches the virtual address translation request.

[0180] Step S803: query the PDE cache from the multi-level page table query module level by level until the PTE matching the virtual address translation request is read back from the physical memory. After receiving the virtual address translation request from step S802, search from the multi-level page table query module level by level to see if there is a PDE matching the virtual address translation request until the PDE0 matching the virtual address translation request is obtained; after reading back the PTE from the physical memory according to the PTB physical base address in the PDE0 field and the corresponding offset in the virtual address field, execute step S804.

[0181] Step S804: The physical memory address is determined based on the offset of the physical address and the virtual address in the matching PTE field, and the conversion from the virtual address to the physical address is completed.

[0182] Steps S802 to S804 are similar to executing Figure 2A Step S202.

[0183] Fig. 9 A schematic diagram of an address conversion device 900 provided by at least one embodiment of the present disclosure is shown. The address conversion device 900 includes an address conversion module 901, an arbitration module 902 and an address conversion performance monitoring module 903.

[0184] The arbitration module 902 is configured to determine a target translation buffer from multiple groups of translation buffers according to a first mapping algorithm in response to obtaining a first virtual address translation request, wherein the first virtual address translation request includes an object virtual address. Figure 3 The arbitration module 902 is similar to the arbitration module 301, please refer to the above description. Figure 2A Step S201.

[0185] The address translation module 901 includes a plurality of translation buffers. Each of the plurality of translation buffers is configured to store first page table information for translating an object virtual address into an object physical address. The address translation module 901 is configured to access the first page table information in the target translation buffer to translate the object virtual address into an object physical address. Figure 3 The address conversion module 901 performs, for example, Figure 2A Step S202.

[0186] The address translation performance monitoring module 903 is configured to: obtain access frequency information of each of the multiple translation buffers; determine whether the first mapping algorithm needs to be updated according to the access frequency information; and update the mapping algorithm to the second mapping algorithm in response to the need to update the first mapping algorithm. Figure 3The address translation performance monitoring module 903 is similar to the address translation performance monitoring module 302 in FIG. Figure 2B Steps S203 to S205.

[0187] When facing a large number of virtual address translation requests with irregular memory access patterns, the address translation device 900 adaptively adjusts the TLB mapping algorithm to avoid the situation where the virtual address translation request is mapped to only a single TLB, thereby ensuring the utilization rate of TLB resources.

[0188] In some embodiments of the present disclosure, Fig. 9 As shown, the address conversion device 900 further includes a multi-level page table query module 904, and the multi-level page table query module 904 includes second page table information.

[0189] The address translation module 901 is configured to: access the first page table information in the target translation buffer, determine whether there is first target page table information matching the first virtual address translation request in the first page table information; in response to the absence of the first target page table information in the target translation buffer, provide the first virtual address translation request to the multi-level page table query module 904. The multi-level page table query module 904 is configured to: receive the first virtual address translation request provided by the address translation module; determine whether there is second target page table information matching the first virtual address translation request in the second page table information; and in response to the absence of second target page table information matching the first virtual address translation request in the second page table information, obtain translation information provided by the external memory, the translation information being used to translate the object virtual address into the object physical address.

[0190] For example, the first page table information includes multiple page table entries, each page table entry corresponds to a physical page, the second page table information includes a multi-level page table, each level of the page table includes multiple page directory entries, each page directory entry is used to point to the physical address of the next level page table, and each page directory entry in the last level page table in the multi-level page table is used to point to the page table entry in the first page table information.

[0191] In some embodiments of the present disclosure, the multi-level page table query module is configured to: obtain the first page table read address of at least one level page table in the multi-level page table based on the object virtual address and the base address; and determine whether there is second target page table information in the second page table information that matches the first virtual address conversion request based on the first page table read address.

[0192] In some embodiments of the present disclosure, the multi-level page table query module 904 includes a same read address merging unit and a conversion information caching unit. The same read address merging unit is configured to: in response to the second page table information not having the second target page table information matching the first virtual address conversion request, determine whether the merge signal is valid; in response to the merge signal being valid, compare whether the first page table read address and the second page table read address of the second virtual address conversion request located before the first virtual address conversion request are the same; in response to the first page table read address and the second page table read address being the same, merge the first virtual address conversion request with the second virtual address conversion request, and wait for the conversion information provided by the external memory in response to the second virtual address conversion request. The conversion information caching unit is configured to: cache the conversion information, and provide the conversion information to the address conversion module when the address conversion module is in an idle state.

[0193] Some embodiments of the present disclosure add a same read address merging module to the multi-level page table query module, which merges the same read page table requests sent to the physical memory without affecting the TLB data update and virtual address conversion of the L2 TLB module, thereby effectively reducing congestion.

[0194] Multi-level page table query module 904 and Figure 3 The multi-level page table query module 303 is similar, please refer to the above description. The function and structure of the address conversion device 900 are referred to Figure 3 The function and structure of the address conversion device 300 are not described in detail.

[0195] For example, the address translation module 901, the arbitration module 902, the address translation performance monitoring module 903 and the multi-level page table query module 904 can be hardware, software, firmware and any feasible combination thereof. For example, the address translation module 901, the arbitration module 902, the address translation performance monitoring module 903 and the multi-level page table query module 904 can be dedicated or general circuits, chips or devices, etc., or can be a combination of a processor and a memory. The embodiments of the present disclosure do not limit the specific implementation forms of the above-mentioned units.

[0196] It should be noted that, in the embodiment of the present disclosure, the various units of the address conversion device 900 and the address conversion device 300 correspond to the various steps of the address conversion method. For the specific functions of the address conversion device 900 and the address conversion device 300, reference can be made to the relevant description of the address conversion method, which will not be repeated here. Fig. 9 The components and structures of the address translation device 900 shown are merely exemplary and non-limiting. The address translation device 900 may further include other components and structures as required.

[0197] At least one embodiment of the present disclosure also provides an electronic device, the electronic device includes a processor and a memory, the memory includes one or more computer program modules. The one or more computer program modules are stored in the memory and are configured to be executed by the processor, and the one or more computer program modules include instructions for implementing the above-mentioned address conversion method. The electronic device can alleviate the uneven allocation of virtual address conversion request conversion buffer resources and improve the utilization rate of conversion buffer resources.

[0198] Fig. 10A A schematic block diagram of an electronic device provided in some embodiments of the present disclosure. Fig. 10A As shown, the electronic device 1000 includes a processor 1010 and a memory 1020. The memory 1020 is used to store non-transitory computer-readable instructions (e.g., one or more computer program modules). The processor 1010 is used to run non-transitory computer-readable instructions, and when the non-transitory computer-readable instructions are run by the processor 1010, one or more steps in the address conversion method described above can be performed. The memory 1020 and the processor 1010 can be interconnected through a bus system and / or other forms of connection mechanisms (not shown).

[0199] For example, the processor 1010 may be a central processing unit (CPU), a graphics processing unit (GPU), or other forms of processing units having data processing capabilities and / or program execution capabilities. For example, the central processing unit (CPU) may be an X86 or ARM architecture, etc. The processor 1010 may be a general-purpose processor or a dedicated processor, and may control other components in the electronic device 1000 to perform desired functions.

[0200] For example, the memory 1020 may include any combination of one or more computer program products, and the computer program product may include various forms of computer-readable storage media, such as volatile memory and / or non-volatile memory. Volatile memory may include, for example, random access memory (RAM) and / or cache memory (cache), etc. Non-volatile memory may include, for example, read-only memory (ROM), hard disk, erasable programmable read-only memory (EPROM), portable compact disk read-only memory (CD-ROM), USB memory, flash memory, etc. One or more computer program modules may be stored on the computer-readable storage medium, and the processor 1010 may run one or more computer program modules to implement various functions of the electronic device 1000. Various applications and various data, as well as various data used and / or generated by the application, etc. may also be stored in the computer-readable storage medium.

[0201] It should be noted that, in the embodiment of the present disclosure, the specific functions and technical effects of the electronic device 1000 can refer to the above description of the address conversion method, which will not be repeated here.

[0202] Fig. 10B This is a schematic block diagram of another electronic device provided in some embodiments of the present disclosure. The electronic device 1100 is suitable for implementing the address conversion method provided in the embodiments of the present disclosure. The electronic device 1100 may be a terminal device, etc. It should be noted that: Fig. 10B The electronic device 1100 shown is merely an example and does not impose any limitation on the functions and scope of use of the embodiments of the present disclosure.

[0203] like Fig. 10B As shown, the electronic device 1100 may include a processing device (e.g., a central processing unit, a graphics processor, etc.) 1110, which can perform various appropriate actions and processes according to a program stored in a read-only memory (ROM) 1120 or a program loaded from a storage device 1180 to a random access memory (RAM) 1130. In the RAM 1130, various programs and data required for the operation of the electronic device 1100 are also stored. The processing device 1110, the ROM 1120, and the RAM 1130 are connected to each other via a bus 1140. An input / output (I / O) interface 1150 is also connected to the bus 1140.

[0204] Typically, the following devices may be connected to the I / O interface 1150: an input device 1160 including, for example, a touch screen, a touch pad, a keyboard, a mouse, a camera, a microphone, an accelerometer, a gyroscope, etc.; an output device 1170 including, for example, a liquid crystal display (LCD), a speaker, a vibrator, etc.; a storage device 1180 including, for example, a magnetic tape, a hard disk, etc.; and a communication device 1190. The communication device 1190 may allow the electronic device 1100 to communicate with other electronic devices wirelessly or by wire to exchange data. Although Fig. 10B The electronic device 1100 is shown to have various devices, but it should be understood that it is not required to implement or possess all the devices shown, and the electronic device 1100 may alternatively implement or possess more or fewer devices.

[0205] For example, according to an embodiment of the present disclosure, the above-mentioned address conversion method can be implemented as a computer software program. For example, an embodiment of the present disclosure includes a computer program product, which includes a computer program carried on a non-transitory computer-readable medium, and the computer program includes a program code for executing the above-mentioned address conversion method. In such an embodiment, the computer program can be downloaded and installed from the network through the communication device 1190, or installed from the storage device 1180, or installed from the ROM 1120. When the computer program is executed by the processing device 1110, the functions defined in the address conversion method provided in the embodiment of the present disclosure can be implemented.

[0206] At least one embodiment of the present disclosure further provides a computer-readable storage medium, which is used to store non-temporary computer-readable instructions, and when the non-temporary computer-readable instructions are executed by a computer, the above-mentioned address conversion method can be implemented. By using the computer-readable storage medium, the uneven allocation of virtual address conversion request conversion buffer resources can be alleviated, and the utilization rate of conversion buffer resources can be improved.

[0207] Fig.11 A schematic diagram of a storage medium provided in some embodiments of the present disclosure. Fig.11 As shown, the storage medium 1200 is used to store non-transitory computer-readable instructions 1210. For example, when the non-transitory computer-readable instructions 1210 are executed by a computer, one or more steps in the address conversion method described above may be performed.

[0208] For example, the storage medium 1200 may be applied to the electronic device 1000. Fig. 10A The memory 1020 in the electronic device 1000 is shown. For example, the relevant description of the storage medium 1200 can refer to Fig. 10A The corresponding description of the memory 1020 in the electronic device 1000 is shown and will not be repeated here.

[0209] There are a few points to note about this disclosure:

[0210] (1) In the drawings of the embodiments of the present disclosure, only the structures related to the embodiments of the present disclosure are involved, and other structures can refer to the general design.

[0211] (2) In the absence of conflict, features in the same embodiment or in different embodiments of the present disclosure may be combined with each other.

[0212] The above are only specific embodiments of the present disclosure, but the protection scope of the present disclosure is not limited thereto. Any technician familiar with the technical field can easily think of changes or substitutions within the technical scope disclosed in the present disclosure, which should be included in the protection scope of the present disclosure. Therefore, the protection scope of the present disclosure should be based on the protection scope of the claims.

Claims

1. An address translation method, applied to an address translation device, wherein the address translation device comprises a plurality of translation buffers, each translation buffer comprising first page table information for converting a virtual address into a physical address, the method comprising: In response to obtaining a first virtual address translation request, determining a target translation buffer from the plurality of translation buffers according to a first mapping algorithm, wherein the first virtual address translation request includes an object virtual address; and accessing first page table information in the target translation buffer to translate the object virtual address into an object physical address, The method further comprises: Acquire access frequency information of each of the plurality of conversion buffers; Determining whether the first mapping algorithm needs to be updated according to the access frequency information; and In response to the need to update the first mapping algorithm, the first mapping algorithm is updated to a second mapping algorithm.

2. The method according to claim 1, wherein: The address conversion device further includes a multi-level page table query module, wherein the multi-level page table query module includes second page table information, Accessing the first page table information in the target translation buffer to translate the object virtual address into the object physical address comprises: Accessing the first page table information in the target translation buffer to determine whether there is first target page table information matching the first virtual address translation request in the first page table information; In response to the first target page table information not existing in the target translation buffer, providing the first virtual address translation request to the multi-level page table query module; Determining whether the second page table information has second target page table information that matches the first virtual address translation request; and In response to the second page table information not having second target page table information matching the first virtual address translation request, the object virtual address is translated into the object physical address based on translation information provided by an external memory.

3. The method according to claim 2, wherein: The first page table information includes a plurality of page table entries, each of which corresponds to a physical page. The second page table information includes a multi-level page table, each level of the page table includes a plurality of page directory entries, each page directory entry is used to point to the physical address of the next level of the page table, Each page directory entry in the last-level page table in the multi-level page table is used to point to a page table entry in the first page table information.

4. The method according to claim 3, wherein: Determining whether the second page table information includes second target page table information that matches the first virtual address translation request includes: Based on the object virtual address and the base address, obtaining a first page table read address of at least one level of page table in the multi-level page table; Based on the first page table read address, it is determined whether the second page table information includes second target page table information that matches the first virtual address translation request.

5. The method according to claim 4, wherein: In response to the second target page table information not having the second target page table information matching the first virtual address translation request, translating the object virtual address into the object physical address based on the translation information provided by the external memory, including: In response to the second page table information not having second target page table information matching the first virtual address translation request, determining whether a merge signal is valid; In response to the merge signal being valid, comparing whether the first page table read address and a second page table read address of a second virtual address translation request located before the first virtual address translation request are the same; In response to the first page table read address and the second page table read address being the same, merging the first virtual address translation request with the second virtual address translation request, and waiting for the translation information provided by the external memory in response to the second virtual address translation request; and The object virtual address is converted into the object physical address based on the conversion information.

6. The method according to claim 5, wherein: In response to the second page table information not having the second target page table information matching the first virtual address translation request, converting the object virtual address to the object physical address based on the translation information provided by the external memory, further comprising: In response to the first page table read address and the second page table read address being different, providing a page table read request based on the first virtual address conversion request to the external memory to obtain the conversion information from the external memory; and Update the merge signal to be invalid.

7. The method according to claim 5, wherein: In response to the second page table information not having the second target page table information matching the first virtual address translation request, converting the object virtual address to the object physical address based on the translation information provided by the external memory, further comprising: In response to the merge signal being invalid, providing a page table read request based on the first virtual address conversion request to the external memory to obtain the conversion information from the external memory; and The merge signal is updated to be valid.

8. The method according to claim 5, wherein: In response to the second page table information not having the second target page table information matching the first virtual address translation request, converting the object virtual address to the object physical address based on the translation information provided by the external memory, further comprising: In response to receiving the translation information provided by the external memory in response to the second virtual address translation request, the merge signal is updated to be invalid.

9. The method according to claim 6 or 7, wherein: The page table read request includes: a page table read address of the virtual address translation request, an object virtual address, and a hardware access unit identifier providing the virtual address translation request, The page table read address is obtained based on a base address and page directory entry data of at least one level of page table in the multi-level page table.

10. The method according to claim 3, wherein: Accessing first page table information in the target translation buffer to translate the object virtual address into the object physical address comprises: Accessing first page table information in the target translation buffer to determine whether there is a target page table entry matching the object virtual address translation request in the first page table information; In response to the presence of a target page table entry matching the object virtual address translation request in the first page table information, an object physical address corresponding to the object virtual address is determined based on the target page table entry and the in-page offset indicated by the object virtual address.

11. The method according to claim 10, wherein: The conversion information includes the target page table entry.

12. The method according to claim 1, wherein: Obtaining access frequency information of each of the plurality of conversion buffers, including: The number of accesses to each of the plurality of conversion buffers is counted to obtain a count value of each of the plurality of conversion buffers within a preset time period.

13. The method according to claim 12, wherein: Determining whether the first mapping algorithm needs to be updated according to the access frequency information includes: Calculating an average access value of the plurality of groups of conversion buffer count values ​​based on the count values ​​of each group of the plurality of groups of conversion buffers; Get the allowed access deviation; Calculating effective access rates of the plurality of groups of conversion buffers based on the allowed access deviation and the average access value; Based on the effective access rate, it is determined whether the first mapping algorithm needs to be updated.

14. The method according to claim 13, wherein: Calculating effective access rates of the plurality of groups of conversion buffers based on the allowed access deviation and the average access value comprises: Calculating an access deviation value of each of the plurality of conversion buffer groups based on the allowed access deviation; Based on the access deviation value, calculating an effective utilization indication value of each of the plurality of groups of conversion buffers, wherein, for each of the plurality of groups of conversion buffers, in response to a sum of the access deviation value and the count value being greater than or equal to the average access value, the effective utilization indication value of the conversion buffer is set to a first preset value, and in response to a sum of the access deviation value and the count value being less than the average access value, the effective utilization indication value of the conversion buffer is set to a second preset value; and An average value of the effective utilization indicator values ​​of the plurality of conversion buffers is used as the effective access rate.

15. The method according to claim 14, wherein: Determining whether the first mapping algorithm needs to be updated based on the effective access rate includes: In response to the effective access rate being greater than or equal to a preset access rate, determining that the first mapping algorithm does not need to be updated; In response to the effective access rate being less than the preset access rate, it is determined that the first mapping algorithm needs to be updated.

16. The method according to claim 1, wherein: The first mapping algorithm comprises: determining the target translation buffer according to the first target bit of the object virtual address in the virtual address translation request, The second mapping algorithm comprises: determining the target translation buffer according to the second target bit of the object virtual address in the virtual address translation request, The first target position and the second target position are different.

17. The method according to claim 16, wherein: The first target bit includes a plurality of consecutive first bits in the object virtual address, and the second target bit includes a plurality of consecutive second bits in the object virtual address.

18. An address conversion device, comprising: An address translation module, comprising a plurality of translation buffers; an arbitration module configured to determine a target translation buffer from the plurality of translation buffers according to a first mapping algorithm in response to obtaining a first virtual address translation request, wherein the first virtual address translation request includes an object virtual address; Each of the plurality of translation buffers is configured to store first page table information for translating the object virtual address into an object physical address. The address translation module is configured to: access the first page table information in the target translation buffer to translate the object virtual address into an object physical address, The address conversion device also includes: Address translation performance monitoring module, configured as: Acquire access frequency information of each of the plurality of conversion buffers; Determining whether the first mapping algorithm needs to be updated according to the access frequency information; and In response to the need to update the first mapping algorithm, the first mapping algorithm is updated to a second mapping algorithm.

19. The address conversion device according to claim 18, further comprising: A multi-level page table query module, wherein the multi-level page table query module includes second page table information, Wherein, the address conversion module is configured as follows: Accessing the first page table information in the target translation buffer to determine whether there is first target page table information matching the first virtual address translation request in the first page table information; In response to the first target page table information not existing in the target translation buffer, providing the first virtual address translation request to the multi-level page table query module; The multi-level page table query module is configured as follows: Receiving the first virtual address translation request provided by the address translation module; Determining whether the second page table information has second target page table information that matches the first virtual address translation request; and In response to the second page table information not having second target page table information matching the first virtual address translation request, translation information provided by an external memory is obtained, where the translation information is used to translate the object virtual address into the object physical address.

20. The address conversion device according to claim 19, wherein: The first page table information includes a plurality of page table entries, each of which corresponds to a physical page. The second page table information includes a multi-level page table, each level of the page table includes a plurality of page directory entries, each page directory entry is used to point to the physical address of the next level of the page table, Each page directory entry in the last-level page table in the multi-level page table is used to point to a page table entry in the first page table information.

21. The address conversion device according to claim 20, wherein: The multi-level page table query module is configured as: Based on the object virtual address and the base address, obtaining a first page table read address of at least one level of page table in the multi-level page table; Based on the first page table read address, it is determined whether the second page table information includes second target page table information that matches the first virtual address translation request.

22. The address conversion device according to claim 21, wherein: The multi-level page table query module includes a same read address merging unit and a conversion information cache unit. The same read address merging unit is configured as follows: In response to the second page table information not having second target page table information matching the first virtual address translation request, determining whether a merge signal is valid; In response to the merge signal being valid, comparing whether the first page table read address and a second page table read address of a second virtual address translation request located before the first virtual address translation request are the same; In response to the first page table read address and the second page table read address being the same, merging the first virtual address translation request with the second virtual address translation request, waiting for the translation information provided by the external memory in response to the second virtual address translation request, The conversion information cache unit is configured to: cache the conversion information, and provide the conversion information to the address conversion module when the address conversion module is in an idle state.

23. An electronic device, comprising: processor; a memory including one or more computer program instructions; The one or more computer program instructions are stored in the memory, and when executed by the processor, implement the address conversion method according to any one of claims 1 to 17.

24. A computer-readable storage medium non-temporarily storing computer-readable instructions, wherein: When the computer-readable instructions are executed by a processor, the address conversion method according to any one of claims 1 to 17 is implemented.

Citation Information

Patent Citations

  • Address conversion system, processor, address conversion method and electronic equipment

    CN116594925A

  • Processor, method and computer program product for fast selective invalidation of translation lookaside buffer

    US20090216994A1

  • External memory based translation lookaside buffer

    US20200097413A1

  • Virtual Memory Management Method and Apparatus Supporting Physical Addresses Larger Than Virtual Addresses

    US20230289295A1

  • Logically partitioning different classes of TLB entries within a single caching structure

    US7293157B1

Cited By

  • Accelerator and request processing method

    CN121434115A

  • Accelerator and request processing method

    CN121434115B

  • Address translation method and apparatus, and electronic device and storage medium

    EP4738130A1

  • Address translation method and apparatus, and electronic device and storage medium

    WO2026040275A1