A memory access method and device
By configuring DMAA and sending bandwidth and delay information to the traffic shaper, the problem of low memory access request scheduling efficiency in mobile terminals is solved, and more efficient memory access scheduling and resource utilization are achieved.
Patent Information
- Application Number
- CN201880094152.9
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2018-09-30
- Publication Date
- 2024-10-11
- Estimated Expiration
- 2038-09-30
AI Technical Summary
The memory access request scheduling efficiency in mobile terminals is low, and the existing QoS information cannot truly reflect the memory access resource requirements of the IP module, resulting in low scheduling efficiency.
By configuring DMAA, including the bandwidth information and delay information of the memory access request, the processor sends the memory access request carrying DMAA to the traffic shaper, so that the traffic shaper schedules the memory access request according to DMAA, improving scheduling efficiency.
It significantly improves the scheduling efficiency of memory access requests, ensures the stability of scheduling and avoids congestion, and more truly reflects memory access requirements.
Smart Images

Figure CN112236755B_ABST
Abstract
Description
Technical Field
[0001] The embodiments of the present invention relate to the computer field, and in particular to a memory access method and device. Background Art
[0002] The mobile terminal can use a system on chip (SOC) as its main processing system. During the operation of the SoC, the various functional modules integrated on the SOC, also known as intellectual property (IP) modules (such as application processors, video processors, image processors, neural network processors, modems, etc.), can read and write access operations to the dynamic random access memory (DRAM) to achieve caching and interaction of programs and data.
[0003] At present, when each IP module in a mobile terminal processes a service, the IP module can send a memory access request to the system bus, and then the system bus aggregates and schedules the memory access request, and then sends the memory access request to the memory controller, and the memory controller sends the memory access request to the DRAM to achieve read and write access. Specifically, when the above-mentioned IP module performs read and write access, the memory access request carries the quality of service (QoS) information of the memory access request, and the QoS information can indicate the priority of the memory access request. When the system bus receives multiple memory access requests from the above-mentioned IP module, the multiple memory access requests are scheduled according to the QoS information in the memory access request, for example, the memory access request with a higher priority is scheduled first.
[0004] However, since the IP module has different resource requirements for memory access when processing different services or different stages of the same service, the above QoS information cannot truly reflect the resource requirements for memory access of the IP module. Therefore, it may lead to low scheduling efficiency of memory access requests. Summary of the invention
[0005] The present application provides a memory access method and device, which can significantly improve the scheduling efficiency of memory access requests.
[0006] In a first aspect, the present application provides a memory access method, which may include: a processor configuring a DMAA, the DMAA including bandwidth information of a memory access request; and the processor sending a memory access request to a traffic shaper, the memory access request including the DMAA, the traffic shaper being used to adjust the scheduling bandwidth of the memory access request.
[0007] The memory access method provided by the present application is that the processor of the mobile terminal can configure a DMAA including bandwidth information of the memory access request, and can send a memory access request carrying the DMAA to the traffic shaper, so that the traffic shaper can implement scheduling of the memory access request according to the DMAA. In this way, the scheduling efficiency of the memory access request can be significantly improved.
[0008] In one embodiment, the bandwidth information of the above-mentioned memory access request includes a maximum access bandwidth and a minimum access bandwidth. In the present application, the maximum bandwidth and the minimum bandwidth in the DMAA can be determined based on the read and write bandwidth that can be provided by the system memory of the mobile terminal and the actual demand for the read and write bandwidth of the processor to access the system memory. Since the bandwidth information can reflect the bandwidth demand of the memory access request, the scheduling efficiency of the memory access request can be improved by scheduling the memory access request based on the bandwidth information.
[0009] In one embodiment, the DMAA also includes delay information, which is used to indicate the delay requirement of the memory access request. In the present application, the delay information in the DMAA can be determined according to the actual requirements of the processor for read and write delays, and scheduling the memory access request according to the delay information can improve the scheduling efficiency of the memory access request.
[0010] In one embodiment, the memory access method provided by the present application also includes: after the processor sends a memory access request to the traffic shaper, the processor updates the DMAA. In the present application, after the processor sends the memory access request to the traffic shaper, since the business processed by the processor may change, different businesses may have different requirements for memory access, that is, different businesses may have different corresponding DMAAs; or when the processor processes the same business, the requirements for memory access are also different at different processing stages of the business, that is, different business processing stages may have different corresponding DMAAs, so if the business processed by the processor changes or the business stage of the processor changes, the processor can update the DMAA, so that the DMAA carried in the memory access request sent by the processor can more truly reflect the memory access requirements.
[0011] In one embodiment, the DMAA includes a DMAA for program space access and a DMAA for data space access. In the present application, since the processor's access to the system memory may include access to the program and access to the data, the DMAA is divided into a DMAA for program space access and a DMAA for data space access. When the memory access is an access to the program space, the memory access request carries the DMAA for program space access, and when the memory access is an access to the data space, the memory access request carries the DMAA for data space access.
[0012] In one embodiment, the method for configuring the DMAA of the memory access request by the processor may include: the processor configures the DMAA to the DAMM register of the processor by running software instructions. In the present application, when the processor is a programmable processor (i.e., supports the user to control the processor through program programming), a DMAA register for storing DMAA may be newly defined in the register file of the processor, and the processor performs a storage / access operation on the DMAA register by running the software instructions written by the user, and stores the DMAA in the DMAA register, so as to flexibly implement the configuration of DMAA.
[0013] In one embodiment, the method for configuring the DMAA of the memory access request by the processor may include: the processor configures the DMAA to the DMAA register of the processor by running an operating system program or a system management program. In the present application, when the processor in the SOC of the mobile terminal is a non-programmable processor, the processor may run the operating system program or the system management program of the mobile terminal to configure the DMAA to the DMAA register of the processor.
[0014] In one embodiment, certain processors or IP modules (such as externally purchased processors, hardware accelerators, etc.) in the SOC of the mobile terminal do not support the definition of a DMAA register for storing DMAA inside the processor. In this case, a DMAA register for storing DMAA is defined in a configuration space external to the processor (such as a peripheral address space), including an iDMAA register and a dDMAA register. The processor can configure the DMAA accessed by the program space to the iDMAA register through a program access interface by running an operating system program or a processor driver, and configure the DMAA accessed by the data space to the iDMAA register through a data access interface.
[0015] In one embodiment, the processor provided by the present application may be a multi-core multi-threaded processor, so that subtasks of the same task or different tasks can be processed in parallel through multiple cores or multiple threads. In this case, since different tasks may be processed based on different cores or threads, an independent register for storing DMAA is defined for each core or thread to store different DMAA.
[0016] In a second aspect, the present application provides a memory access method, which may include: a traffic shaper receives a memory access request, the memory access request includes a DMAA, and the DMAA includes bandwidth information of the memory access request; and the traffic shaper schedules the memory access request to a memory controller according to the DMAA in the memory access request.
[0017] The memory access method provided in the present application includes a DMAA in the memory access request received by the traffic shaper, and the DMAA includes bandwidth information of the memory access request. Therefore, the traffic shaper implements scheduling of the memory access request according to the DMAA, thereby significantly improving the scheduling efficiency of the memory access request.
[0018] In one embodiment, the bandwidth information of the above-mentioned memory access request includes a maximum access bandwidth and a minimum access bandwidth. In the present application, the maximum bandwidth and the minimum bandwidth in the DMAA can be determined based on the read and write bandwidth that can be provided by the system memory of the mobile terminal and the actual demand for the read and write bandwidth of the processor to access the system memory. Since the bandwidth information can reflect the bandwidth demand of the memory access request, the scheduling efficiency of the memory access request can be improved by scheduling the memory access request based on the bandwidth information.
[0019] In one embodiment, the DMAA also includes delay information, which is used to indicate the delay requirement of the memory access request. In the present application, the delay information in the DMAA can be determined according to the actual requirements of the processor for read and write delays, and scheduling the memory access request according to the delay information can improve the scheduling efficiency of the memory access request.
[0020] In one embodiment, the method for the above-mentioned traffic shaper to schedule a memory access request to a memory controller according to the DMAA in the memory access request may include: the traffic shaper determines the scheduling bandwidth of the traffic shaper according to the DMAA in the memory access request; and the traffic shaper schedules the memory access request to the memory controller according to the scheduling bandwidth of the traffic shaper. In the present application, the scheduling bandwidth of the traffic shaper refers to the average access bandwidth of the memory access request sent by the traffic shaper to the system bus. The scheduling bandwidth of the traffic shaper should be greater than or equal to the minimum access bandwidth in the DMAA, and less than or equal to the maximum access bandwidth in the DMAA, and the traffic shaper can also adaptively adjust the scheduling bandwidth of the traffic shaper according to the delay information in the DMAA, so that the traffic shaper can schedule the memory access request more smoothly to avoid congestion.
[0021] In one embodiment, the memory access method provided by the present application also includes: when the number of memory access requests cached in the traffic shaper is greater than or equal to the preset number of memory access requests, the traffic shaper instructs the processor to stop sending memory access requests. In the present application, when the number of memory access requests cached in the traffic shaper is greater than or equal to the preset number of memory access requests, the traffic shaper instructs the processor to stop sending memory access requests, that is, when the traffic shaper has too many memory access requests in its cache queue, it generates back pressure flow control to the processor connected to it, instructing the processor that the traffic shaper no longer receives new memory access requests, so that the processor stops sending memory access requests to the traffic shaper, so that congestion can be avoided to a certain extent.
[0022] In one embodiment, the memory access method provided by the present application also includes: after the traffic shaper schedules the memory access request to the memory controller according to the DMAA in the memory access request, the traffic shaper receives the cache status information of the memory controller, and the traffic shaper adjusts the scheduling bandwidth of the traffic shaper according to the cache status information of the memory controller and the DMAA carried in the memory access request received by the traffic shaper. In the present application, the cache status information of the memory controller may include the number of cached memory access requests in the memory controller or the cache level of the cache queue of the memory controller. In the present application, the traffic shaper can adjust the scheduling bandwidth of the traffic shaper in combination with the cache status of the memory controller and the DMAA in the memory access request received by the traffic shaper, so as to maintain a smoother scheduling of the memory access request during the memory access process, avoid congestion, and access the system memory more efficiently.
[0023] In one embodiment, when the cache level of the cache queue of the memory controller received by the traffic shaper is that the cache queue is almost empty, the traffic shaper can determine the maximum access bandwidth in the DMAA as the scheduling bandwidth, that is, to achieve over-scheduling; when the cache level received by the traffic shaper is that the cache queue is almost full, the traffic shaper can determine the minimum access bandwidth in the DMAA as the scheduling bandwidth, that is, to achieve under-scheduling; or when the cache state of the memory controller received by the traffic shaper is an intermediate state (that is, the number of cached memory access requests is moderate), the scheduling bandwidth can be adjusted between the maximum access bandwidth and the minimum access bandwidth according to the delay information in the DMAA, so that the delay of the memory access request is guaranteed.
[0024] In one embodiment, the above DMAA includes DMAA for program space access and DMAA for data space access. In the present application, since the processor's access to system memory may include access to programs and access to data, DMAA is divided into DMAA for program space access and DMAA for data space access. When the memory access is access to the program space, the memory access request carries the DMAA for program space access, and when the memory access is access to the data space, the memory access request carries the DMAA for data space access.
[0025] In one embodiment, the traffic shaper provided by the present application can receive multiple memory access requests, and the multiple memory access requests can be sent by one or more processors. Specifically, when a processor is connected to a traffic shaper, the memory access requests received by the traffic shaper come from the same processor. When multiple processors are connected to a traffic shaper, when the traffic shaper receives multiple memory access requests, the multiple memory access requests may come from multiple processors.
[0026] In one embodiment, for an IP module with a relatively high access bandwidth requirement for system memory, a single bus interface may not be able to meet the access bandwidth. Therefore, the IP module can be connected to a traffic shaper through multiple bus interfaces (the traffic shaper provides two input interfaces to connect to the IP module), and then the traffic shaper is connected to the system bus through one output interface or through multiple output interfaces. When the traffic shaper receives a large number of memory access requests, the traffic shaper can cache the memory access requests first.
[0027] In one embodiment, for a traffic shaper, the number of its input interfaces or the number of its output interfaces needs to match the number of interfaces and bandwidth of the module connected to it, that is, after the number of input interfaces of the traffic shaper is determined, the input bandwidth of the traffic shaper needs to be greater than or equal to the bandwidth of the memory access requests it receives, and after the number of output interfaces of the traffic shaper is determined, the output bandwidth of the traffic shaper needs to be less than or equal to the bandwidth of the memory access requests provided by the system bus connected to its output interfaces.
[0028] In one embodiment, if the system bus on the SOC of the mobile terminal can support the identification and processing of DMAA, then the memory access request scheduled to the system bus by the traffic shaper can still carry DMAA (that is, the traffic shaper will pass the memory access request carrying DMAA to the system bus), so that the system bus can also schedule the memory access request to the memory controller according to the DMAA carried in the memory access request. It can be seen that the system bus can also further schedule the memory access request to the memory controller according to DMAA, thereby further improving the scheduling efficiency of the memory access request.
[0029] If the system bus on the SOC of the mobile terminal does not support the identification and processing of DMAA, but supports the identification of QoS information, the traffic shaper can convert the DMAA in the memory access request scheduled by the traffic shaper into QoS information, thereby sending the memory access request carrying the QoS information to the system bus, so that the system bus schedules the memory access request to the memory controller according to the QoS information. Specifically, the traffic shaper can convert the DMAA into the corresponding QoS information according to the preset mapping relationship between the DMAA and the QoS information. It can be seen that the system bus can also further schedule the memory access request to the memory controller according to the QoS information after the DMAA conversion, so that the scheduling efficiency of the memory access request can be further improved.
[0030] In a third aspect, the present application provides a memory access device, including a configuration module and a sending module. The configuration module is used to configure a DMAA, the DMAA including bandwidth information of a memory access request; the sending module is used to send a memory access request to a traffic shaper, the memory access request including the DMAA, and the traffic shaper is used to adjust the scheduling bandwidth of the memory access request.
[0031] The memory access device provided in the present application can configure a DMAA including bandwidth information of a memory access request because the configuration module of the memory access device can configure the DMAA, and the sending module of the memory access device can send a memory access request carrying the DMAA to a traffic shaper, thereby enabling the traffic shaper to implement scheduling of the memory access request according to the DMAA. In this way, the scheduling efficiency of the memory access request can be significantly improved.
[0032] In one embodiment, the bandwidth information of the above-mentioned memory access request includes a maximum access bandwidth and a minimum access bandwidth. In the present application, the maximum bandwidth and the minimum bandwidth in the DMAA can be determined based on the read and write bandwidth that can be provided by the system memory of the mobile terminal and the actual demand for the read and write bandwidth of the memory access device to access the system memory. Since the bandwidth information can reflect the bandwidth demand of the memory access request, the scheduling efficiency of the memory access request can be improved by scheduling the memory access request based on the bandwidth information.
[0033] In one embodiment, the DMAA also includes delay information, which is used to indicate the delay requirement of the memory access request. In the present application, the delay information in the DMAA can be determined according to the actual requirements of the memory access device for read and write delays, and scheduling the memory access request according to the delay information can improve the scheduling efficiency of the memory access request.
[0034] In one embodiment, the memory access device provided by the present application further includes an update module; the update module is used to update the DMAA after sending a memory access request to the traffic shaper. In the present application, after the above-mentioned sending module sends a memory access request to the traffic shaper, since the business processed by the memory access device may change, different businesses may have different requirements for memory access, that is, different businesses may correspond to different DMAAs; or when the memory access device processes the same business, the requirements for memory access are also different at different processing stages of the business, that is, different business processing stages may correspond to different DMAAs, so if the business processed by the memory access device changes or the business stage of the memory access device changes, the update module of the memory access device can update the DMAA, so that the DMAA carried in the memory access request sent by the sending module can more truly reflect the memory access requirements.
[0035] In one embodiment, the DMAA includes a DMAA for program space access and a DMAA for data space access. In the present application, since the memory access device's access to the system memory may include access to the program and access to the data, the DMAA is divided into a DMAA for program space access and a DMAA for data space access. When the memory access is an access to the program space, the memory access request carries the DMAA for program space access, and when the memory access is an access to the data space, the memory access request carries the DMAA for data space access.
[0036] In one embodiment, the configuration module is specifically used to configure DMAA to the DAMM register of the memory access device by running software instructions. In the present application, when the memory access device is a programmable processor (i.e., supports the user to control the processor through program programming), a DMAA register for storing DMAA can be newly defined in the register file of the memory access device, and the memory access device performs storage / access operations on the DMAA register by running software instructions written by the user, and stores DMAA in the DMAA register, so as to flexibly realize the configuration of DMAA.
[0037] In one embodiment, the configuration module is specifically used to configure DMAA to the DMAA register of the memory access device by running an operating system program or a system management program. In the present application, when the memory access device in the SOC of the mobile terminal is a non-programmable processor, the memory access device can run the operating system program or the system management program of the mobile terminal to configure DMAA to the DMAA register of the memory access device.
[0038] In one embodiment, certain memory access devices in the SOC of the mobile terminal (such as externally purchased processors, hardware accelerators, etc.) do not support defining a DMAA register for storing DMAA inside the memory access device. In this case, a DMAA register for storing DMAA is defined in a configuration space outside the memory access device (such as a peripheral address space), including an iDMAA register and a dDMAA register. The memory access device can configure the DMAA accessed by the program space to the iDMAA register through a program access interface by running an operating system program or a processor driver, and configure the DMAA accessed by the data space to the iDMAA register through a data access interface.
[0039] In one embodiment, the memory access device provided by the present application is a processor. If the processor can be a multi-core multi-threaded processor, subtasks of the same task or different tasks can be processed in parallel through multiple cores or multiple threads. In this case, since different tasks may be processed based on different cores or threads, an independent register for storing DMAA is defined for each core or thread to store different DMAA.
[0040] In a fourth aspect, the present application provides a traffic shaper, comprising a receiving module and a scheduling module. The receiving module is used to receive a memory access request, wherein the memory access request includes a DMAA, and the DMAA includes bandwidth information of the memory access request; and the scheduling module is used to schedule the memory access request to a memory controller according to the DMAA in the memory access request.
[0041] The traffic shaper provided in the present application, since the memory access request that can be received by the receiving module of the traffic shaper includes DMAA, and the DMAA includes bandwidth information of the memory access request, the scheduling module of the traffic shaper can implement the scheduling of the memory access request according to the DMAA, thereby significantly improving the scheduling efficiency of the memory access request.
[0042] In one embodiment, the bandwidth information of the above-mentioned memory access request includes a maximum access bandwidth and a minimum access bandwidth. In the present application, the maximum bandwidth and the minimum bandwidth in the DMAA can be determined based on the read and write bandwidth that can be provided by the system memory of the mobile terminal and the actual demand for the read and write bandwidth of the processor to access the system memory. Since the bandwidth information can reflect the bandwidth demand of the memory access request, the scheduling efficiency of the memory access request can be improved by scheduling the memory access request based on the bandwidth information.
[0043] In one embodiment, the DMAA also includes delay information, which is used to indicate the delay requirement of the memory access request. In the present application, the delay information in the DMAA can be determined according to the actual requirements of the processor for read and write delays, and scheduling the memory access request according to the delay information can improve the scheduling efficiency of the memory access request.
[0044] In one embodiment, the above-mentioned scheduling module is specifically used to determine the scheduling bandwidth of the traffic shaper according to the DMAA in the memory access request; and according to the scheduling bandwidth of the traffic shaper, schedule the memory access request to the memory controller. In this application, the scheduling bandwidth of the traffic shaper refers to the average access bandwidth of the memory access request sent by the traffic shaper to the system bus. The scheduling bandwidth of the traffic shaper should be greater than or equal to the minimum access bandwidth in the DMAA, and less than or equal to the maximum access bandwidth in the DMAA, and the adjustment module of the traffic shaper can also adaptively adjust the scheduling bandwidth of the traffic shaper according to the delay information in the DMAA. In this way, the traffic shaper can schedule the memory access request more smoothly to avoid congestion.
[0045] In one embodiment, the traffic shaper provided by the present application further includes an indication module; the indication module is used to instruct the processor to stop sending memory access requests when the number of memory access requests cached in the traffic shaper is greater than or equal to the preset number of memory access requests. In the present application, when the number of memory access requests cached in the traffic shaper is greater than or equal to the preset number of memory access requests, the indication module of the traffic shaper can instruct the processor to stop sending memory access requests, that is, when the traffic shaper has too many memory access requests in its cache queue, it generates back pressure flow control to the processor connected to it, instructing the processor that the traffic shaper no longer receives new memory access requests, so that the processor stops sending memory access requests to the traffic shaper, so that congestion can be avoided to a certain extent.
[0046] In one embodiment, the traffic shaper provided in the present application also includes an adjustment module. The above-mentioned receiving module is also used to receive the cache status information of the memory controller after the scheduling module schedules the memory access request to the memory controller according to the DMAA in the memory access request; the adjustment module is used to adjust the scheduling bandwidth of the traffic shaper according to the cache status information of the memory controller and the DMAA carried in the memory access request received by the receiving module. In the present application, the cache status information of the memory controller may include the number of cached memory access requests in the memory controller or the cache level of the cache queue of the memory controller. In the present application, the adjustment module of the traffic shaper can adjust the scheduling bandwidth of the traffic shaper in combination with the cache status of the memory controller and the DMAA in the memory access request received by the receiving module of the traffic shaper, so as to maintain a smoother scheduling of the memory access request during the memory access process, avoid congestion, and access the system memory more efficiently.
[0047] In one embodiment, when the cache level of the cache queue of the memory controller received by the above-mentioned receiving module is that the cache queue is almost empty, the above-mentioned adjustment module can determine the maximum access bandwidth in DMAA as the scheduling bandwidth, that is, to achieve over-scheduling; when the cache level received by the traffic shaper is that the cache queue is almost full, the above-mentioned adjustment module can determine the minimum access bandwidth in DMAA as the scheduling bandwidth, that is, to achieve under-scheduling; or when the cache state of the memory controller received by the traffic shaper is an intermediate state (that is, the number of cached memory access requests is moderate), the scheduling bandwidth can be adjusted between the maximum access bandwidth and the minimum access bandwidth according to the delay information in DMAA, so that the delay of the memory access request is guaranteed.
[0048] In one embodiment, the above DMAA includes DMAA for program space access and DMAA for data space access. In the present application, since the processor's access to system memory may include access to programs and access to data, DMAA is divided into DMAA for program space access and DMAA for data space access. When the memory access is access to the program space, the memory access request carries the DMAA for program space access, and when the memory access is access to the data space, the memory access request carries the DMAA for data space access.
[0049] In a fifth aspect, a computer-readable storage medium is provided, which may include computer instructions. When the computer instructions are executed on a computer, a memory access device executes the memory access method described in any one of the first aspect and various embodiments thereof.
[0050] In the present application, since the memory access device can run the computer instructions in the above-mentioned computer-readable storage medium to configure the DMAA including the bandwidth information of the memory access request, and can send the memory access request carrying the DMAA to the traffic shaper, the traffic shaper can implement the scheduling of the memory access request according to the DMAA. In this way, the scheduling efficiency of the memory access request can be significantly improved.
[0051] In a sixth aspect, a computer program product comprising computer instructions is provided, which, when executed on a computer, enables a memory access device to execute the memory access method described in the first aspect and any one of its various embodiments.
[0052] In the present application, since the memory access device can run the above-mentioned computer program product to configure the DMAA including the bandwidth information of the memory access request, and can send the memory access request carrying the DMAA to the traffic shaper, the traffic shaper can implement the scheduling of the memory access request according to the DMAA. In this way, the scheduling efficiency of the memory access request can be significantly improved.
[0053] In the seventh aspect, the present application provides a data processing device, including a processor and a memory coupled to the processor; the memory is used to store a computer program, and the processor is used to call the computer program. When the computer program is executed, the processor executes the memory access method described in any one of the above-mentioned second aspect and its various embodiments.
[0054] In the present application, since the processor of the data processing device can call the computer program in the memory to receive a memory access request including a DMAA, and the DMAA includes the bandwidth information of the memory access request, the traffic shaper implements the scheduling of the memory access request according to the DMAA. In this way, the scheduling efficiency of the memory access request can be significantly improved.
[0055] In an eighth aspect, a computer-readable storage medium is provided, which may include computer instructions. When the computer instructions are executed on a computer, a traffic shaper executes the memory access method described in any one of the second aspect and various optional implementations thereof.
[0056] In the present application, since the traffic shaper can run the computer instructions in the above-mentioned computer-readable storage medium to receive a memory access request including a DMAA, and the DMAA includes the bandwidth information of the memory access request, the traffic shaper implements the scheduling of the memory access request according to the DMAA, thereby significantly improving the scheduling efficiency of the memory access request.
[0057] In a ninth aspect, a computer program product comprising computer instructions is provided, which, when executed on a computer, enables a traffic shaper to execute the memory access method described in any one of the second aspect and its various optional implementations.
[0058] In the present application, since the traffic shaper can run the above-mentioned computer program product, the received memory access request includes a DMAA, and the DMAA includes the bandwidth information of the memory access request, so that the traffic shaper implements the scheduling of the memory access request according to the DMAA, thereby significantly improving the scheduling efficiency of the memory access request. BRIEF DESCRIPTION OF THE DRAWINGS
[0059] Figure 1 A schematic diagram of the architecture of a SOC of a mobile terminal provided by an embodiment of the present invention Figure 1 ;
[0060] Figure 2 A schematic diagram of the architecture of a SOC of a mobile terminal provided by an embodiment of the present invention Figure 2 ;
[0061] Figure 3 A memory access method provided by an embodiment of the present invention is schematically shown Figure 1 ;
[0062] Figure 4 A memory access method provided by an embodiment of the present invention is schematically shown Figure 2 ;
[0063] Figure 5 A DMAA configuration method provided by an embodiment of the present invention is shown in FIG. Figure 1 ;
[0064] Figure 6 A DMAA configuration method provided by an embodiment of the present invention is shown in FIG. Figure 2 ;
[0065] Figure 7 A memory access method provided by an embodiment of the present invention is schematically shown Figure 3 ;
[0066] Figure 8 A DMAA configuration method provided by an embodiment of the present invention is shown in FIG. Figure 3 ;
[0067] Fig. 9 A schematic diagram of the structure of a memory access device provided by an embodiment of the present invention;
[0068] Fig.10 A schematic diagram of a flow shaper provided in an embodiment of the present invention Figure 1 ;
[0069] Fig.11 A schematic diagram of a flow shaper provided in an embodiment of the present invention Figure 2 . DETAILED DESCRIPTION
[0070] The term "and / or" in this article is merely a description of the association relationship of associated objects, indicating that three relationships may exist. For example, A and / or B can mean: A exists alone, A and B exist at the same time, and B exists alone.
[0071] In the embodiments of the present invention, words such as "exemplary" or "for example" are used to indicate examples, illustrations or explanations. Any embodiment or design described as "exemplary" or "for example" in the embodiments of the present invention should not be interpreted as being more preferred or more advantageous than other embodiments or designs. Specifically, the use of words such as "exemplary" or "for example" is intended to present related concepts in a specific way.
[0072] In the description of the embodiments of the present invention, unless otherwise specified, the meaning of "multiple" refers to two or more than two. For example, multiple processing units refer to two or more processing units; multiple systems refer to two or more systems.
[0073] First, some concepts involved in a memory access method and device provided in an embodiment of the present invention are explained.
[0074] Memory access bandwidth: refers to the amount of access per unit time, such as the number of bytes or bits accessed per unit time. In an embodiment of the present invention, when a mobile terminal processes certain services, different memory read and write bandwidth requirements (i.e., memory access bandwidth requirements) are required at different stages of service processing. For example, when processing an artificial intelligence service related to image content recognition through a neural network processor, the processing of the convolution layer requires very high computing performance, and there are no strict requirements for the access bandwidth of the system memory; when processing the fully connected layer, the computing performance requirements are lower, and in this case, the larger the access bandwidth to the system memory, the better.
[0075] Delay requirement for memory access: refers to the delay between when the IP module sends a read / write access request to when the IP module receives a read / write access response when the IP module reads and writes to the system memory. In the embodiment of the present invention, when the mobile terminal processes various types of services, some services are real-time services, and the delay requirement is relatively high (that is, the delay is required to be as low as possible). For example, when the modem performs wireless data transmission services, the processing and storage of link control information are required to be completed in real time, otherwise the link may be interrupted. For another example, in the virtual reality (VR) service scenario, asynchronous time distortion processing is performed, and real-time processing is required according to the frame rate, otherwise it will have an adverse effect on the user experience. In summary, when processing such services, the read / write access delay to the system memory is required to be as low as possible. For some non-real-time services, such as data downloading and storage in wireless data transmission services, image post-processing in photo scenes, etc., there are no strict requirements for the read / write access delay to the system memory.
[0076] Based on the problems existing in the background technology, an embodiment of the present invention provides a memory access method and device, and the processor in the main processing system of the mobile terminal can obtain the dynamic memory access attribute (dynamic random accessing attributes, DMAA) information of the memory access request. The DMAA is the real-time attribute information of the business currently processed by the processor, and the DMAA includes the maximum access bandwidth, the minimum access bandwidth and the delay information corresponding to the memory access request; and the processor can send a memory access request carrying the DMAA to the traffic shaper; so that when the traffic shaper receives at least one memory access request, it can schedule the at least one memory access request to the memory controller according to the DMAA in the memory access request, wherein each memory access request includes the DMAA. Since the processor can send the DMAA reflecting the business currently processed by the processor to the traffic shaper, the traffic shaper implements the scheduling of the memory access request according to the DMAA, so that the scheduling efficiency of the memory access request can be significantly improved.
[0077] An embodiment of the present invention provides a memory access system, which is a SOC on a mobile terminal. The SOC of the mobile terminal may include multiple IP modules, such as Figure 1 As shown, the SOC 100 of the mobile terminal may include multiple IP modules such as an application processor 101, a video processor 102, an audio processor 103, a camera system 104, a display system 105, an image processor 106, a neural network processor 107, and a modem 108. The SOC 100 of the mobile terminal also includes at least one memory controller ( Figure 1In the example of two memory controllers, including memory controller 109a and memory controller 109b), each of the above IP modules can be connected to the system bus 111 in the mobile terminal SOC 100 through one or more bus interfaces. It should be noted that the above video processor 102, audio processor 103, camera system 104, and display system 105 can form a multimedia subsystem. These IP modules are first connected to the multimedia subsystem bus 110 through the bus interface, and then the multimedia subsystem bus 110 is connected to the system bus 111. The system bus 111 is connected to the memory controller 109a and the memory controller 109b respectively. Each memory controller is connected to a DRAM. Figure 1 In the embodiment, the memory controller 109a is connected to the DRAM 112a, and the memory controller 109b is connected to the DRAM 112b.
[0078] The above-mentioned application processor 101 is used for general computing, business control and other transaction processing; the video processor 102 is used to complete the processing of video data, such as video encoding or video decoding; the audio processing 103 is used to complete the processing of audio data, such as recording, playing audio, etc.; the camera system 104 is used to take pictures or record videos; the display system 105 is used to present text, images or videos to the user; the image processor 106 is used to process the image obtained by the mobile terminal, such as cropping, sharpening, filtering, etc.; the neural network processor 107 is used to process some complex artificial intelligence services, such as face recognition, etc.; the modem 108 is used to modulate or demodulate data during wireless data transmission.
[0079] In the embodiment of the present invention, when the mobile terminal processes a certain service, it usually requires multiple IP modules to cooperate to process the service. For example, for a large aperture photo service in a preview scenario, the above IP modules are required. Figure 1 The camera system 104, application processor 101, image processor 106 and display system 105 in the system work together to complete the task. In addition, there are scenarios where multiple services coexist concurrently, for example, in an online video playback service, the modem 108 accesses network data in parallel with the video processor 102 decoding video data.
[0080] It should be noted that, in the embodiment of the present invention, the above-mentioned DRAM is collectively referred to as system memory, and reading and writing access to the DRAM can be described as reading and writing access to the system memory.
[0081] Combined with the above Figure 1 The SOC of the mobile terminal shown in FIG. Figure 2As shown, the embodiment of the present invention further provides another SOC 200 of a mobile terminal, and the SOC 200 of the mobile terminal may include an IP module 201, an IP module 202, an IP module 203, an IP module 204, an IP module 205, an IP module 206, and an IP module 207, etc. Figure 1 The SOC 100 of the mobile terminal shown is different in that Figure 2 In the embodiment, at least one traffic shaper is also included between each IP module and the system bus 208 (in Figure 2 In the example of four traffic shapers, including traffic shaper 209a, traffic shaper 209b, traffic shaper 209c and traffic shaper 209d) and at least one memory controller ( Figure 2 In the example of two memory controllers, including memory controller 210a and memory controller 210b). Each traffic shaper can be connected to one or more IP modules. Specifically, Figure 2 In the example, the IP module 201 is connected to the traffic shaper 209a through two output interfaces, and the IP modules 202, 203 and 204 are connected to the traffic shaper 209b (specifically, as shown in FIG. Figure 2 It can be seen that the IP module 203 is connected to the traffic shaper 209b via two output interfaces, the IP module 205 is connected to the traffic shaper 209c via two output interfaces, and the IP module 207 is connected to the traffic shaper 209d.
[0082] It should be noted that, in the embodiment of the present invention, some IP modules (such as audio processors) with relatively little access traffic to the system memory or some IP modules working in non-concurrent service scenarios do not need to be connected to the traffic shaper, but are directly connected to the system bus, for example Figure 2 The IP module 206 in.
[0083] and Figure 1 The SOC 100 of the mobile terminal shown is similar in that the memory controller is connected to the corresponding DRAM, for example, the memory controller 210a is correspondingly connected to the DRAM 211a, and the memory controller 210b is correspondingly connected to the DRAM 211b.
[0084] It should be noted that, in the embodiment of the present invention, the IP module may not be connected to the system bus through the traffic shaper, and the IP module may be directly connected to the system bus. Figure 2 In the example, the IP module 205 is directly connected to the system bus 208 .
[0085] Optionally, in an embodiment of the present invention, the above-mentioned traffic shaper can be a hardware device, which is arranged between the IP module and the system bus. The traffic processor can also be in software form, and its functions are integrated into the system bus or the IP module (such as a processor). The specific details can be determined according to actual usage requirements and are not limited by the embodiment of the present invention.
[0086] In the embodiment of the present invention, each of the above IP modules can interact with the traffic shaper and the memory controller to realize read and write access to the system memory. In the following embodiment, an IP module in the SOC of the above mobile terminal is taken as an example, and the IP module is considered to be a processor. Figure 3 The SOC of the mobile terminal shown in the figure, an embodiment of the present invention provides a memory access method, which may include S101-S106:
[0087] S101. The processor configures a DMAA, where the DMAA includes bandwidth information of a memory access request.
[0088] The DMAA may indicate resource requirements of a memory access request, and the bandwidth information of the memory access request may include a maximum access bandwidth and a minimum access bandwidth.
[0089] Optionally, the DMAA may further include delay information, where the delay information is used to indicate a delay requirement of a memory access request.
[0090] In an embodiment of the present invention, the maximum bandwidth and the minimum bandwidth in the DMAA can be determined based on the read and write bandwidth that can be provided by the system memory of the mobile terminal and the actual requirements of the read and write bandwidth of the processor to access the system memory, and 4 binary bits can be used as access bandwidth indication information to indicate the access bandwidth. The access bandwidth can be the maximum access bandwidth or the minimum access bandwidth. For example, binary numbers 0000-1111 can be used to indicate different access bandwidths in sequence. The following Table 1 is an example of the relationship between the 4-bit binary access bandwidth indication information and the access bandwidth it indicates.
[0091] Table 1
[0092]
[0093]
[0094] The delay information in the above DMAA can be determined based on the actual requirements of the processor for read and write delays. In an embodiment of the present invention, the delay information can be defined as four levels, including, for example, very low, low, medium, and unconstrained. Very low means that read and write access requires very low delay, and unconstrained means that read and write access has no strict requirements for delay. Similar to the above access bandwidth, a 2-bit binary bit can be used as delay indication information to indicate the delay information. The following Table 2 shows an example of the delay indication information of the 2-bit binary and the delay information it indicates.
[0095] Table 2
[0096] Delay Indication Delay Information 00 Very low 01 Low 10 medium 11 No constraints
[0097] Optionally, in the embodiment of the present invention, the DMAA may further include other user-defined DMAAs. For example, the SOC of the mobile terminal includes a system cache (ie, system cache), the customized DMAA may be a DMAA related to the system cache. Exemplarily, the customized DMAA may be the read and write access policy of the system cache. Specifically, a 1-bit binary bit may be used as the indication information of the read and write access policy of the system cache to indicate the read and write access policy of the system cache. For example, 0 is used to indicate that when the processor initiates a memory access request, the memory access request does not need to be sent to the system cache, that is, there is no need to perform read and write access to the system cache, but the memory access request is sent to the system memory (i.e., DRAM) to perform read and write access to the system memory; 1 is used to indicate that when the processor initiates a memory access request, the memory access request needs to be sent to the system cache first. If the system cache does not satisfy the read and write access request, the memory access request is sent to the system memory. For example, if the memory access request is a memory read access request, the read access request is first sent to the system cache. If the system cache does not contain the program or data required to be read by the read access request, the read access request is sent to the system memory to read the program or data.
[0098] The above-mentioned customized DMAA and the indication information of the customized DMAA can be determined according to actual conditions, and the embodiment of the present invention does not specifically limit them.
[0099] Optionally, in an embodiment of the present invention, the types of memory access requests initiated by the processor may include program access requests to the program space of the system memory and data access requests to the data space. Based on this situation, DMAA may also include DMAA for program space access and DMAA for data space access.
[0100] In the embodiment of the present invention, the processor in the above S101 may be the above Figure 1 or Figure 2 At least one processor in the SOC can initiate read and write access to the system memory when the mobile terminal is processing a business. Each time the processor initiates a memory access request, the processor can carry the DMAA of the memory access request.
[0101] Optional, combined Figure 3 ,like Figure 4 As shown, the above S101 may specifically include S101a:
[0102] S101a, the processor configures DMAA to the DAMM register of the processor by running software instructions.
[0103] In the embodiment of the present invention, for the processor in the SOC of the mobile terminal, if the processor is a programmable processor (i.e., supports the user to control the processor through program programming), a register for storing DMAA can be newly defined in the register file of the processor, for example, it can be called a DMAA special purpose register (DMAA specialpurpose register, DMAA SPR), and the processor performs storage / access operations on the DMAA SPR by running software instructions written by the user, and stores the DMAA in the DMAA SPR. Specifically, the user (such as a programmer) can configure the corresponding DMAA to the DMAA SPR of the processor through software programming (for example, through the "STDMAA Rt" instruction) according to the requirements of the business processed by the processor or the access bandwidth and delay of the system memory at each stage of business processing.
[0104] Optionally, based on the description of S101, since DMAA may include DMAA for program space access and DMAA for data space access, the above DMAA SPR may include DMAA SPR for storing DMAA for program space access (referred to as iDMAA SPR), and DMAA SPR for storing DMAA for data space access (referred to as dDMAA SPR). For example, Figure 5 As shown, the register file 301 in the processor 300 includes an iDMAA SPR 302 and a dDMAA SPR 303 .
[0105] Optionally, in an embodiment of the present invention, the processor in the SOC of the mobile terminal may be a single-core single-thread processor or a multi-core multi-thread processor. For a multi-core multi-thread processor, the business processed by the processor may be divided into multiple subtasks, and different subtasks may be processed in parallel by different cores or threads. For example, for a Gaussian difference pyramid image processing algorithm, a task may be divided into multiple subtasks according to tasks such as an image pyramid constructed by multiple downsampling iterations and Gaussian convolution operations using different Sigma parameters for each layer of the pyramid image. Based on a multi-core multi-thread processor, subtasks of the same task (e.g., Gaussian convolution operations with different Sigma parameters) may be processed in parallel, or different tasks (e.g., Gaussian difference pyramid processing of multiple images at the same time) may be processed in parallel, and multiple cores or multiple threads may be used to implement parallel processing. In this case, since the tasks processed may be different based on different cores or threads, an independent register for storing DMAA is defined for each core or thread to store different DMAA.
[0106] For example, Figure 6 As shown, the multi-core multi-thread processor 400 is a processor with 4 cores and 4 threads, each core corresponds to one thread, and the 4 cores are respectively recorded as core 401a, core 401b, core 401c and core 401d. iDMAA SPR 402a and dDMAA SPR 403a are defined in core 401a, iDMAA SPR 402b and dDMAA SPR 403b are defined in core 401b, iDMAA SPR 402c and dDMAA SPR 403c are defined in core 401c, and iDMAA SPR 402d and dDMAASPR 403d are defined in core 401d.
[0107] Optional, combined Figure 3 ,like Figure 7 As shown, the above S101 may specifically include S101b:
[0108] S101b: The processor configures DMAA to the DMAA register of the processor by running an operating system program or a system management program.
[0109] In the embodiment of the present invention, when the processor in the SOC of the mobile terminal is a non-programmable processor, the processor may run an operating system program or a system management program of the mobile terminal to configure DMAA into a DMAA register of the processor.
[0110] Optionally, in the embodiment of the present invention, some processors or IP modules (such as externally purchased processors, hardware accelerators, etc.) in the SOC of the mobile terminal do not support the definition of a DMAA register for storing DMAA inside the processor. In this case, a DMAA register for storing DMAA is defined in a configuration space outside the processor (such as a peripheral address space). Figure 8 As shown, DMAA registers are defined in the peripheral address space 501 of the processor 500, including an iDMAA register 502 and a dDMAA register 503. The processor can configure DMAA to the DMAA register by running an operating system program or a processor driver. Specifically, the DMAA accessed by the program space is configured to the iDMAA register 502 through a program access interface, and the DMAA accessed by the data space is configured to the iDMAA register 503 through a data access interface.
[0111] S102: The processor sends a memory access request to the traffic shaper, where the memory access request includes a DMAA.
[0112] The traffic shaper is used to adjust the scheduling bandwidth of the memory access request.
[0113] In the embodiment of the present invention, the processor may send multiple memory access requests to the traffic shaper, and each memory access request carries a DMAA corresponding to the memory access request.
[0114] Specifically, when the processor needs to access the system memory (including program access and / or data access) during the process of processing business, the processor can read the DMAA in the above-mentioned DMAA register (including the various DMAA registers described in S101) and carry the DMAA in the memory access request and send it to the next-hop device of the processor (such as a traffic shaper).
[0115] For a multi-core and multi-threaded processor, when a service runs on a certain core or thread, the DMAA can be read from the DMAA register and carried in a memory access request and sent to the traffic shaper.
[0116] It should be noted that, in the embodiment of the present invention, if the multi-core multi-threaded processor supports dynamic thread switching, that is, multiple threads are scheduled to run on multiple cores in time-sharing, that is, one thread runs on different cores in different time periods, since each thread corresponds to a DMAA register, it is necessary to perform relevant processing on the DMAA in the DMAA register when the thread is switched. Exemplarily, when a new thread is created on core 1, DMAA is configured by running an operating system program or a system management program. If a thread that is executed on core 1 and has not yet been completed is suspended, the DMAA corresponding to the thread is pushed together with other information of the thread (such as the state of the thread and the register file information corresponding to the thread). When the thread that has not yet been completed is switched to core 2 for execution, the DMAA corresponding to the thread stored in the stack is popped from the stack and loaded into the DMAA register corresponding to core 2.
[0117] Optionally, in an embodiment of the present invention, after the processor sends a memory access request to the traffic shaper, since the business processed by the processor may change, different businesses may have different requirements for memory access, that is, the DMAA corresponding to different businesses may be different; or when the processor is processing the same business, the memory access requirements are also different in different processing stages of the business, that is, the DMAA corresponding to different business processing stages may be different. Therefore, if the business processed by the processor changes or the business stage of the processor changes, the processor can update the DMAA in the DMAA register. Specifically, the processor configures the new DMAA to the DMAA register through the above-mentioned methods (for example, S101a or S101b).
[0118] Exemplarily, after the above-mentioned processor configures the first DMAA, the processor sends a first memory access request carrying the first DMAA to the traffic shaper. If the business processed by the processor changes (the DMAA also changes), the processor can modify the DMAA in the DMAA register. For example, the processor updates the first DMAA to the second DMAA, and sends a second memory access request carrying the second DMAA to the traffic shaper.
[0119] S103: The traffic shaper receives a memory access request, where the memory access request includes a DMAA.
[0120] In the embodiment of the present invention, the traffic shaper can receive multiple memory access requests, which can be sent by one or more processors. Specifically, when a processor is connected to a traffic shaper, the memory access requests received by the traffic shaper come from the same processor. For example, Figure 2In FIG. 1 , the memory access request received by the traffic shaper 209a includes only the memory access request sent by the IP module 201. When multiple processors are connected to one traffic shaper, when the traffic shaper receives multiple memory access requests, the multiple memory access requests may come from multiple processors, for example, Figure 2 In the example, the memory access request received by the traffic shaper 209 b may include the memory access request sent by the IP module 202 , the IP module 203 , or the IP module 204 .
[0121] It should be noted that, in the embodiment of the present invention, since different processors may process different services, or different processors participate in different processing stages of the same service, the DMAAs included in the memory access requests sent by different processors may be different, that is, different processors have different requirements for memory access bandwidth and / or latency. It should also be noted that a processor may have different requirements for memory access bandwidth and / or latency in different time periods, so the DMAAs carried in multiple memory access requests sent by a processor may be the same or different.
[0122] Optionally, in an embodiment of the present invention, for an IP module with a relatively high access bandwidth requirement for the system memory, one bus interface may not be able to meet the access bandwidth, so the IP module can be connected to the traffic shaper through multiple bus interfaces (the traffic shaper provides two input interfaces to connect to the IP module), and then the traffic shaper is connected to the system bus through an output interface (for example, Figure 2 The IP module 205 in the example is connected to the traffic shaper 209c via two bus interfaces, and the traffic shaper 209c is connected to the system bus 208 via one output interface) or is connected to the system bus via multiple output interfaces (e.g. Figure 2 The IP module 201 is connected to the traffic shaper 209c through two bus interfaces, and the traffic shaper 209a is connected to the system bus 208 through two output interfaces. When the traffic shaper receives a large number of memory access requests, the traffic shaper can cache the memory access requests first.
[0123] It should be noted that for a traffic shaper, the number of its input interfaces or the number of its output interfaces needs to match the number of interfaces and bandwidth of the module connected to it, that is, after the number of input interfaces of the traffic shaper is determined, the input bandwidth of the traffic shaper needs to be greater than or equal to the bandwidth of the memory access requests it receives; after the number of output interfaces of the traffic shaper is determined, the output bandwidth of the traffic shaper needs to be less than or equal to the bandwidth of the memory access requests provided by the system bus connected to its output interfaces.
[0124] S104: The traffic shaper schedules the memory access request to the memory controller according to the DMAA carried in the memory access request.
[0125] In the embodiment of the present invention, the traffic shaper may schedule the memory access request to a corresponding memory controller on the SOC of the mobile terminal according to the access address (read-write address) carried in the memory access request.
[0126] Optionally, the above S104 may be implemented specifically through S104a-S104b:
[0127] S104a: The traffic shaper determines a scheduling bandwidth of the traffic shaper according to the DMAA carried in the memory access request.
[0128] In the embodiment of the present invention, the scheduling bandwidth of the above-mentioned traffic shaper refers to the average access bandwidth of the memory access request sent by the traffic shaper to the system bus. The scheduling bandwidth of the traffic shaper should be greater than or equal to the minimum access bandwidth in the DMAA, and less than or equal to the maximum access bandwidth in the DMAA. Specifically, the traffic shaper can determine the scheduling bandwidth according to some existing mature traffic scheduling algorithms, such as weighted fair queuing (WFQ), deficit weighted round-robin (DWRR) and other scheduling algorithms, which will not be described in detail in the embodiment of the present invention.
[0129] Optionally, in an embodiment of the present invention, the traffic shaper may also adaptively adjust the scheduling bandwidth of the traffic shaper according to the delay information in the DMAA. For example, in combination with the above Table 2, for memory access requests whose delay information in the DMAA is "very low", the traffic shaper adjusts its scheduling bandwidth to the maximum access bandwidth in the DMAA; for memory access requests whose delay information in the DMAA is "unconstrained", the traffic shaper adjusts its scheduling bandwidth to the minimum access bandwidth in the DMAA.
[0130] S104b: The traffic shaper schedules the memory access request to the memory controller according to the scheduling bandwidth of the traffic shaper.
[0131] In the embodiment of the present invention, the traffic shaper sending a memory access request to the memory controller according to the scheduling bandwidth may specifically include: the traffic shaper sending the memory access request to the system bus, and then the system bus forwarding the memory access request to the memory controller.
[0132] Optionally, the memory access method provided by the embodiment of the present invention may further include: when the number of memory access requests cached in the traffic shaper is greater than or equal to a preset number of memory access requests, the traffic shaper instructs the processor to stop sending memory access requests, that is, when the traffic shaper has too many memory access requests in its cache queue, it generates back pressure flow control to the processor connected to it, instructing the processor that the traffic shaper no longer receives new memory access requests, so that the processor stops sending memory access requests to the traffic shaper. In this way, congestion can be avoided to a certain extent.
[0133] For example, when multiple IP modules are connected to a traffic shaper (e.g. Figure 2 The IP module 202, IP module 203 and IP module 204 in the flow shaper are connected to the traffic shaper 209b), there are multiple input interfaces on the traffic shaper connected to multiple IP modules (for example, the traffic shaper has 4 input interfaces, wherein the IP module 202 is connected to one input interface of the traffic shaper 209b through one bus interface, the IP module 203 is connected to two input interfaces of the traffic shaper 209b through two bus interfaces, and the IP module 204 is connected to one input interface of the traffic shaper 209b through one bus interface), and the traffic shaper is connected to the system bus through fewer output interfaces (for example, the traffic shaper 209b is connected to the system bus through two output interfaces). In this scenario, the traffic shaper may receive a large number of memory access requests, so a cache queue is set on the traffic shaper. In one implementation, an independent cache queue can be set for each IP module connected to the traffic shaper, and when the number of memory access requests in one or more cache queues is greater than or equal to the preset number of memory access requests corresponding to the cache queue, the traffic shaper instructs the corresponding IP module to stop sending memory access requests. In another implementation, a shared cache queue can be set for all IP modules connected to the traffic shaper, and a logical cache queue corresponding to each IP module can be formed by a linked list, so that when the number of memory access requests in one or more logical cache queues is greater than or equal to the preset number of memory access requests corresponding to the logical cache queue, the traffic shaper instructs the corresponding IP module to stop sending memory access requests.
[0134] In an embodiment of the present invention, after the traffic shaper instructs the processor to stop sending memory access requests, when the number of memory access requests cached in the traffic shaper is less than the preset number of memory access requests, the traffic shaper instructs the processor to start sending memory access requests, that is, the traffic shaper releases the back pressure flow control on the processor.
[0135] It should be noted that the IP modules on the SOC of the mobile terminal that have less access traffic to the system memory or the IP modules that work in non-concurrent scenarios (such as the above Figure 2 The IP module 206 in the system does not need to be connected to a traffic shaper, that is, no traffic shaping is required to schedule the memory access request, and the IP module directly sends the memory access request to the system bus.
[0136] S105: The memory controller receives a memory access request.
[0137] S106: The memory controller sends the memory access request to the system memory.
[0138] In the embodiment of the present invention, each memory controller on the SOC of the mobile terminal sends the received memory access request to the system memory to perform read access or write access to the system memory, so that the system memory returns a memory access response to the processor through the memory controller, the system bus, and the traffic shaper. Exemplarily, assuming that the memory access request is a read data request, the system memory returns the read data to the processor, and assuming that the memory access request is a write data request, the system memory returns a response to the processor that the write data is completed.
[0139] In the memory access method provided by the embodiment of the present invention, the processor of the mobile terminal can be configured with DMAA, and the processor can send a memory access request carrying DMAA to the traffic shaper; so that when the traffic shaper receives the memory access request, it can schedule the memory access request to the memory controller according to the DMAA in the memory access request. Since the processor can carry the DMAA including the bandwidth information of the memory access request when sending the memory access request, the traffic shaper can implement the scheduling of the memory access request according to the DMAA, thus significantly improving the scheduling efficiency of the memory access request.
[0140] Optionally, the memory access method provided by the embodiment of the present invention may further include S107-S108:
[0141] S107: The memory controller sends cache status information of the memory controller to the traffic shaper.
[0142] The cache status information of the memory controller includes the number of memory access requests cached in the memory controller or the cache level of the cache queue of the memory controller. In an embodiment of the present invention, the cache level of the cache queue can be divided according to the number of cached memory access requests, for example, the cache level can include cache queue full, cache queue almost full, cache queue almost empty, cache queue empty, etc.
[0143] S108. The traffic shaper receives cache status information of the memory controller sent by the memory controller.
[0144] S109: The traffic shaper adjusts the scheduling bandwidth of the traffic shaper according to the cache status information of the memory controller and the DMAA carried in the memory access request received by the traffic shaper.
[0145] In an embodiment of the present invention, the traffic shaper can adjust the scheduling bandwidth of the traffic shaper in combination with the cache status of the memory controller and the DMAA in the memory access request received by the traffic shaper, thereby maintaining a smoother scheduling of the memory access request during the memory access process, avoiding congestion, and accessing the system memory more efficiently.
[0146] Exemplarily, when the cache level of the cache queue of the memory controller received by the traffic shaper is that the cache queue is almost empty, the traffic shaper can determine the maximum access bandwidth in DMAA as the scheduling bandwidth, that is, to achieve over-scheduling; when the cache level received by the traffic shaper is that the cache queue is almost full, the traffic shaper can determine the minimum access bandwidth in DMAA as the scheduling bandwidth, that is, to achieve under-scheduling; or when the cache state of the memory controller received by the traffic shaper is an intermediate state (that is, the number of cached memory access requests is moderate), the scheduling bandwidth can be adjusted between the maximum access bandwidth and the minimum access bandwidth according to the delay information in DMAA, so that the delay of the memory access request is guaranteed.
[0147] Optionally, in the embodiment of the present invention, if the system bus on the SOC of the mobile terminal (i.e., the above Figure 2 If the system bus 208 in the system bus can support the identification and processing of DMAA, then the memory access request dispatched to the system bus by the traffic shaper can still carry DMAA (that is, the traffic shaper transparently transmits the memory access request carrying DMAA to the system bus), so that the system bus can also dispatch the memory access request to the memory controller according to the DMAA carried in the memory access request, and the system bus can also update DMAA. The method of scheduling memory access requests by the system bus is similar to the method of scheduling memory access requests by the traffic shaper. For details, please refer to the relevant description in the above embodiment, which will not be repeated here.
[0148] Optionally, in an embodiment of the present invention, if the system bus on the SOC of the mobile terminal does not support the identification and processing of DMAA, but supports the identification of QoS information, the traffic shaper can convert the DMAA in the memory access request scheduled by the traffic shaper into QoS information, thereby sending the memory access request carrying the QoS information to the system bus, so that the system bus schedules the memory access request to the memory controller according to the QoS information. Specifically, the traffic shaper can convert the DMAA into corresponding QoS information according to the mapping relationship between the preset DMAA and QoS information. Exemplarily, the following Table 3 is an example of the mapping relationship between the preset DMAA and QoS information.
[0149] Table 3
[0150]
[0151] The above-mentioned traffic shaper schedules the memory access request to the system bus according to DMAA, and the system bus can further schedule the memory access request to the memory controller according to DMAA or the converted QoS information, so that the scheduling efficiency of the memory access request can be further improved.
[0152] The above mainly introduces the solution provided by the embodiment of the present invention from the perspective of the interaction between various devices. It can be understood that in order to realize the above functions, various devices, such as memory access devices (i.e., processors), traffic shapers, etc., include hardware structures and / or software modules corresponding to the execution of various functions. Those skilled in the art should easily realize that, in combination with the units and algorithm steps of each example described in the embodiments disclosed herein, the embodiments of the present invention can be implemented in the form of hardware or a combination of hardware and computer software. Whether a function is executed in the form of hardware or computer software driving hardware depends on the specific application and design constraints of the technical solution. Professional and technical personnel can use different methods to implement the described functions for each specific application, but such implementation should not be considered to exceed the scope of this application.
[0153] The embodiment of the present invention can divide the functional modules of the memory access device, traffic shaper, etc. according to the above method example. For example, each functional module can be divided according to each function, or two or more functions can be integrated into one processing module. The above integrated module can be implemented in the form of hardware or in the form of software functional modules. It should be noted that the division of modules in the embodiment of the present invention is schematic and is only a logical function division. There may be other division methods in actual implementation.
[0154] Fig. 9 FIG. 1 shows a possible structural diagram of the memory access device 1000 involved in the above embodiment. Fig. 9 As shown, the memory access device 1000 may include a configuration module 1001 and a sending module 1002. The configuration module 1001 is used to support the memory access device 1000 to perform S101 (including S101a or S101b) in the above method embodiment, and the sending module 1002 is used to support the memory access device 1000 to perform step S102. Fig. 9 As shown, the memory access device 1000 may further include an update module 1003, which is used to support the memory access device 1000 to execute S105 in the above method embodiment. Among them, all relevant contents of each step involved in the above method embodiment can be referred to the functional description of the corresponding functional module, which will not be repeated here.
[0155] In the case of dividing each functional module into corresponding functional modules, Fig.10 FIG. 2 shows a possible structural diagram of the flow shaper 2000 involved in the above embodiment. Fig.10 As shown, the traffic shaper 2000 may include a receiving module 2001 and a scheduling module 2002. The receiving module 2001 is used to support the traffic shaper 2000 to perform S103 and S108 in the above method embodiment, and the scheduling module 2002 is used to support the traffic shaper 2000 to perform step S104 (including S104a-S104b). Optionally, as Fig.10 As shown, the traffic shaper 2000 may further include an indication module 2003 and an adjustment module 2004. The indication module 2003 is used to support the traffic shaper 2000 to instruct the processor to stop sending memory access requests when determining that the number of memory access requests cached in the traffic shaper is greater than or equal to the preset number of memory access requests; the adjustment module 2004 is used to support the traffic shaper 2000 to execute S109 in the above method embodiment. Among them, all relevant contents of each step involved in the above method embodiment can be referred to the functional description of the corresponding functional module, and will not be repeated here.
[0156] In the case of an integrated unit, Fig.11 FIG. 1 shows a possible structural diagram of the flow shaper 3000 involved in the above embodiment. Fig.11As shown, the traffic shaper 3000 may include: a processing module 3001 and a communication module 3002. The processing module 3001 may be used to control and manage the actions of the traffic shaper 3000. For example, the processing module 3001 may be used to support the traffic shaper 3000 to execute S104 (including S104a-S104b) and S109 in the above method embodiment; the communication module 3002 may be used to support the traffic shaper 3000 to communicate with other network entities. For example, the communication module 3002 may be used to support the traffic shaper 3000 to execute S103 and S108 in the above method embodiment. Optionally, Fig.11 As shown, the traffic shaper 3000 may also include a storage module 3003 for storing program codes and data of the traffic shaper 3000 .
[0157] Among them, the processing module 3001 can be a processor or a controller, for example, a central processing unit (CPU), a general processor, a digital signal processor (DSP), an application-specific integrated circuit (ASIC), a field programmable gate array (FPGA) or other programmable logic devices, transistor logic devices, hardware components or any combination thereof. It can implement or execute various exemplary logic boxes, modules and circuits described in conjunction with the disclosure of the embodiments of the present invention. The above-mentioned processor can also be a combination that implements a computing function, such as a combination of one or more microprocessors, a combination of a DSP and a microprocessor, and the like. The communication module 3002 can be a transceiver, a transceiver circuit or a communication interface, etc. Exemplarily, the communication module 3002 is a radio frequency transceiver circuit, which is used to mix up the signal to be transmitted when transmitting and mix down the received signal when receiving. The storage module 3003 can be a memory.
[0158] When the processing module 3001 is a processor, the communication module 3002 is a transceiver, and the storage module 3003 is a memory, the processor, the transceiver, and the memory may be connected via a bus. The bus may be a peripheral component interconnect (PCI) bus or an extended industry standard architecture (EISA) bus, etc. The bus may be divided into an address bus, a data bus, a control bus, etc.
[0159] When receiving a signal, the processing module 3001 and the communication module 3002 jointly implement the signal reception. Specifically, the processing module 3001 controls or calls the communication module 3002 to receive. The processing module 3001 is the determiner and controller of the receiving behavior, and the communication module 3002 is the executor of the receiving behavior.
[0160] In the above embodiments, it can be implemented in whole or in part by software, hardware, firmware or any combination thereof. When implemented using a software program, it can be implemented in whole or in part in the form of a computer program product. The computer program product includes one or more computer instructions. When the computer instruction is loaded and executed on a computer, the process or function in accordance with the embodiment of the present invention is generated in whole or in part. The computer can be a general-purpose computer, a special-purpose computer, a computer network or other programmable device. The computer instruction can be stored in a computer-readable storage medium, or transmitted from one computer-readable storage medium to another computer-readable storage medium. For example, the computer instruction can be transmitted from a website site, computer, server or data center by wired (e.g., coaxial cable, optical fiber, digital subscriber line (digital subscriber line, DSL)) mode or wireless (e.g., infrared, wireless, microwave, etc.) mode to another website site, computer, server or data center. The computer-readable storage medium can be any available medium that a computer can access or a data storage device such as a server, data center, etc. that includes one or more available media integrated. The available medium may be a magnetic medium (eg, a floppy disk, a magnetic disk, a magnetic tape), an optical medium (eg, a digital video disc (DVD)), or a semiconductor medium (eg, a solid state drive (SSD)).
[0161] Through the description of the above implementation methods, technicians in the relevant field can clearly understand that for the convenience and simplicity of description, only the division of the above functional modules is used as an example. In actual applications, the above functions can be assigned to different functional modules as needed, that is, the internal structure of the device is divided into different functional modules to complete all or part of the functions described above. The specific working process of the system, device and unit described above can refer to the corresponding process in the aforementioned method embodiment, and will not be repeated here.
[0162] In the several embodiments provided in the present application, it should be understood that the disclosed systems, devices and methods can be implemented in other ways. For example, the device embodiments described above are only schematic. For example, the division of the modules or units is only a logical function division. There may be other division methods in actual implementation, such as multiple units or components can be combined or integrated into another system, or some features can be ignored or not executed. Another point is that the mutual coupling or direct coupling or communication connection shown or discussed can be an indirect coupling or communication connection through some interfaces, devices or units, which can be electrical, mechanical or other forms.
[0163] The units described as separate components may or may not be physically separated, and the components shown as units may or may not be physical units, that is, they may be located in one place or distributed on multiple network units. Some or all of the units may be selected according to actual needs to achieve the purpose of the solution of this embodiment.
[0164] In addition, each functional unit in each embodiment of the present application may be integrated into one processing unit, or each unit may exist physically separately, or two or more units may be integrated into one unit. The above-mentioned integrated unit may be implemented in the form of hardware or in the form of software functional units.
[0165] If the integrated unit is implemented in the form of a software functional unit and sold or used as an independent product, it can be stored in a computer-readable storage medium. Based on this understanding, the technical solution of the present application can be essentially or partly embodied in the form of a software product that contributes to the prior art, or all or part of the technical solution. The computer software product is stored in a storage medium, including several instructions for a computer device (which can be a personal computer, server, or network device, etc.) or a processor to perform all or part of the steps of the method described in each embodiment of the present application. The aforementioned storage medium includes: flash memory, mobile hard disk, read-only memory, random access memory, disk or optical disk, and other media that can store program codes.
[0166] The above is only a specific implementation of the present application, but the protection scope of the present application is not limited thereto. Any changes or substitutions within the technical scope disclosed in the present application should be included in the protection scope of the present application. Therefore, the protection scope of the present application should be based on the protection scope of the claims.
Claims
1. A memory access method, It is characterized in that include: The processor configures a dynamic memory access attribute DMAA, wherein the DMAA includes bandwidth information of a memory access request; The bandwidth information is used to reflect the bandwidth requirement of the memory access request; The processor sends a memory access request to the traffic shaper, where the memory access request includes the DMAA, and the traffic shaper is used to adjust a scheduling bandwidth of the memory access request.
2. The memory access method according to claim 1, It is characterized in that The bandwidth information of the memory access request includes a maximum access bandwidth and a minimum access bandwidth.
3. The memory access method according to claim 1 or 2, It is characterized in that The DMAA further includes latency information, where the latency information is used to indicate a latency requirement of the memory access request.
4. The memory access method according to claim 1 or 2, It is characterized in that The method further comprises: After the processor sends the memory access request to the traffic shaper, the processor updates the DMAA.
5. The memory access method according to claim 1 or 2, It is characterized in that The DMAA includes a DMAA for program space access and a DMAA for data space access.
6. The memory access method according to claim 1 or 2, It is characterized in that The processor configures the DMAA of the memory access request, including: The processor configures the DMAA to the DAMM register of the processor by executing software instructions.
7. The memory access method according to claim 1 or 2, It is characterized in that The processor configures the DMAA of the memory access request, including: The processor configures the DMAA into a DMAA register of the processor by running an operating system program or a system management program.
8. A memory access method, It is characterized in that include: The traffic shaper receives a memory access request, wherein the memory access request includes a dynamic memory access attribute DMAA, and the DMAA includes bandwidth information of the memory access request; The bandwidth information is used to reflect the bandwidth requirement of the memory access request; The traffic shaper schedules the memory access request to the memory controller according to the DMAA in the memory access request.
9. The memory access method according to claim 8, It is characterized in that The bandwidth information of the memory access request includes a maximum access bandwidth and a minimum access bandwidth.
10. The memory access method according to claim 8 or 9, It is characterized in that The DMAA further includes latency information, where the latency information is used to indicate a latency requirement of the memory access request.
11. The memory access method according to claim 8 or 9, It is characterized in that The traffic shaper schedules the memory access request to the memory controller according to the DMAA in the memory access request, including: The traffic shaper determines a scheduling bandwidth of the traffic shaper according to the DMAA in the memory access request; The traffic shaper schedules the memory access request to the memory controller according to a scheduling bandwidth of the traffic shaper.
12. The memory access method according to claim 8 or 9, It is characterized in that The method further comprises: When the number of memory access requests cached in the traffic shaper is greater than or equal to a preset number of memory access requests, the traffic shaper instructs the processor to stop sending memory access requests.
13. The memory access method according to claim 8 or 9, It is characterized in that The method further comprises: After the traffic shaper schedules the memory access request to the memory controller according to the DMAA in the memory access request, the traffic shaper receives cache status information of the memory controller; The traffic shaper adjusts the scheduling bandwidth of the traffic shaper according to the cache status information of the memory controller and the DMAA carried in the memory access request received by the traffic shaper.
14. The memory access method according to claim 8 or 9, It is characterized in that The DMAA includes a DMAA for program space access and a DMAA for data space access.
15. A memory access device, It is characterized in that Includes configuration module and sending module; The configuration module is used to configure a dynamic memory access attribute DMAA, wherein the DMAA includes bandwidth information of a memory access request; the bandwidth information is used to reflect a bandwidth requirement of the memory access request; The sending module is used to send a memory access request to a traffic shaper, where the memory access request includes the DMAA, and the traffic shaper is used to adjust a scheduling bandwidth of the memory access request.
16. The memory access device according to claim 15, It is characterized in that The bandwidth information of the memory access request includes a maximum access bandwidth and a minimum access bandwidth.
17. The memory access device according to claim 15 or 16, It is characterized in that The DMAA further includes latency information, where the latency information is used to indicate a latency requirement of the memory access request.
18. The memory access device according to claim 15 or 16, It is characterized in that The memory access device also includes an update module; The updating module is used to update the DMAA after sending the memory access request to the traffic shaper.
19. The memory access device according to claim 15 or 16, It is characterized in that The DMAA includes a DMAA for program space access and a DMAA for data space access.
20. The memory access device according to claim 15 or 16, It is characterized in that The configuration module is specifically used to configure the DMAA to the DAMM register of the memory access device by running software instructions.
21. The memory access device according to claim 15 or 16, It is characterized in that The configuration module is specifically used to configure the DMAA to the DMAA register of the memory access device by running an operating system program or a system management program.
22. A traffic shaper, It is characterized in that It includes a receiving module and a scheduling module; The receiving module is used to receive a memory access request, wherein the memory access request includes a dynamic memory access attribute DMAA, and the DMAA includes bandwidth information of the memory access request; the bandwidth information is used to reflect the bandwidth requirement of the memory access request; The scheduling module is used to schedule the memory access request to the memory controller according to the DMAA in the memory access request.
23. The flow shaper according to claim 22, It is characterized in that The bandwidth information of the memory access request includes a maximum access bandwidth and a minimum access bandwidth.
24. The flow shaper according to claim 22 or 23, It is characterized in that The DMAA further includes latency information, where the latency information is used to indicate a latency requirement of the memory access request.
25. The flow shaper according to claim 22 or 23, It is characterized in that The scheduling module is specifically configured to determine a scheduling bandwidth of the traffic shaper according to the DMAA in the memory access request; and schedule the memory access request to the memory controller according to the scheduling bandwidth of the traffic shaper.
26. The flow shaper according to claim 22 or 23, It is characterized in that The traffic shaper also includes an indication module; The instructing module is used to instruct the processor to stop sending memory access requests when the number of memory access requests cached in the traffic shaper is greater than or equal to a preset number of memory access requests.
27. The flow shaper according to claim 22 or 23, It is characterized in that The flow shaper also includes an adjustment module; The receiving module is further configured to receive cache status information of the memory controller after the scheduling module schedules the memory access request to the memory controller according to the DMAA in the memory access request; The adjustment module is used to adjust the scheduling bandwidth of the traffic shaper according to the cache status information of the memory controller and the DMAA carried in the memory access request received by the receiving module.
28. The flow shaper according to claim 22 or 23, It is characterized in that The DMAA includes a DMAA for program space access and a DMAA for data space access.
29. A data processing device, It is characterized in that comprising a processor and a memory coupled to the processor; The memory is used to store a computer program, and the processor is used to call the computer program. When the computer program is executed, the processor executes the memory access method according to any one of claims 8 to 14.
