Memory management method, device and equipment and computer readable storage medium

Through shared memory management of local resource pools and allocation queues, the problems of low memory resource utilization and bus competition in the existing technology are solved, and efficient memory resource allocation and service quality improvement are achieved.

CN118733276APending Publication Date: 2024-10-01SHANDONG YUNHAI GUOCHUANG CLOUD COMPUTING EQUIP IND INNOVATION CENT CO LTD
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202410946344.5
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2024-07-15
Publication Date
2024-10-01

AI Technical Summary

Technical Problem

Existing memory management technology results in low memory resource utilization in diversified hardware application scenarios, bus competition leads to low resource service quality, and cannot meet application scenarios where memory resources are tight.

Method used

Use local resource pools and allocation queues for memory management. Memory resources are obtained through bus read operations, stored in the output cache, and managed in the form of queue elements. Memory resources are allocated based on the write handshake protocol, and the concept of private resource pools is abandoned to achieve shared resources. Open management of pools and allocation queues.

Benefits of technology

It improves memory resource utilization, eliminates bus competition, improves resource service quality, makes memory management more flexible and accurate, and adapts to the memory needs of different functional modules.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN118733276A_ABST
    Figure CN118733276A_ABST
Patent Text Reader

Abstract

The invention relates to a memory management method and device, equipment and a computer readable storage medium, and the method comprises the steps: carrying out the bus reading operation of a memory resource pool through a local resource pool, so as to obtain a first memory resource of the memory resource pool; storing the first memory resource in an output cache of the local resource pool; second memory resources in the output cache are obtained through an allocation queue, the second memory resources are stored in the form of queue elements, and each queue element corresponds to one independent memory resource; and based on a write-in handshake protocol, allocating the third memory resource in the allocation queue for the target function module with successful handshake. According to the technical scheme provided by one or more embodiments, the utilization rate of memory resources can be effectively improved.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present disclosure relates to the field of computer science and technology, and in particular to a memory management method, apparatus, device and computer-readable storage medium. Background Art

[0002] Memory management is a technology that can allocate and use memory resources, and can also release and recycle memory resources after task processing is completed.

[0003] In the existing memory management technology, in order to reduce management costs, the memory is usually divided into independent memory units such as blocks, pages, and segments, and the corresponding characteristic information is used as the entry to access the memory unit, which is called the memory entry. Memory management takes the memory entry as the management object, and stores the memory entry in a memory such as a double data rate (DDR) memory or a static random access memory (SRAM) memory to form a memory resource pool. Memory management is achieved by managing the resource pool.

[0004] With the development of hardware technology and the diversification of chip functions, the amount and timing of memory resources required by each functional module vary in different application scenarios. This requires the memory management solution to optimize the utilization of memory resources as much as possible under the premise of limited memory resources and improve the resource service quality provided to the functional modules. Summary of the invention

[0005] In view of this, one or more embodiments of the present disclosure provide a memory management method, apparatus, device, and computer-readable storage medium, which can effectively improve the utilization rate of memory resources.

[0006] On the one hand, the present disclosure provides a memory management method, characterized in that the method includes: using a local resource pool to perform a bus read operation on the memory resource pool to obtain a first memory resource of the memory resource pool; saving the first memory resource in an output cache of the local resource pool; using an allocation queue to obtain a second memory resource in the output cache, and saving the second memory resource in the form of a queue element, each of the queue elements corresponding to an independent memory resource; based on a write handshake protocol, allocating a third memory resource in the allocation queue to a target functional module that has successfully handshaked.

[0007] On the other hand, the present disclosure also provides a memory management device, which includes: a first acquisition unit, used to use a local resource pool to perform a bus read operation on the memory resource pool to obtain a first memory resource of the memory resource pool; an output cache unit, used to save the first memory resource in the output cache of the local resource pool; a second acquisition unit, used to use an allocation queue to acquire a second memory resource in the output cache, and save the second memory resource in the form of a queue element, each of the queue elements corresponding to a memory resource; an allocation unit, used to allocate a third memory resource in the allocation queue to a target functional module that succeeds in handshake based on a write handshake protocol.

[0008] On the other hand, the present disclosure further provides an electronic device, which includes a memory and a processor, wherein the memory is used to store a computer program, and when the computer program is executed by the processor, the above-mentioned memory management method is implemented.

[0009] On the other hand, the present disclosure further provides a computer-readable storage medium, wherein the computer-readable storage medium is used to store a computer program, and when the computer program is executed by a processor, the above-mentioned memory management method is implemented.

[0010] The technical solution provided by one or more embodiments of the present disclosure performs memory management based on a local resource pool and an allocation queue. The constructed local resource pool and allocation queue are both shared resources. There is no need to allocate a dedicated resource pool for each functional module, thereby improving memory resource utilization.

[0011] The technical solution provided by one or more embodiments of the present disclosure performs bus read operations on the memory resource pool only through the local resource pool, and there is no problem of bus competition, which improves the memory management efficiency, thereby improving the resource service quality provided to the functional module. Moreover, on the basis of a successful handshake, memory resources are allocated to the corresponding target functional module, making the solution more flexible and accurate. BRIEF DESCRIPTION OF THE DRAWINGS

[0012] The features and advantages of the present disclosure will be more clearly understood by referring to the accompanying drawings, which are schematic and should not be construed as limiting the present disclosure in any way. In the accompanying drawings:

[0013] Figure 1 A functional architecture diagram of a memory management solution in the related art is shown;

[0014] Figure 2 A resource allocation timing diagram of a memory management solution in the related art is shown;

[0015] Figure 3 The following is a schematic diagram showing the steps of a memory management method in one embodiment of the present disclosure;

[0016] Figure 4 A schematic diagram of the hardware architecture of a memory management method in one embodiment of the present disclosure is shown;

[0017] Figure 5 A schematic diagram of the management logic of allocating queues in one embodiment of the present disclosure is shown;

[0018] Figure 6 A resource allocation timing diagram of a memory management method in one embodiment of the present disclosure is shown;

[0019] Figure 7 A schematic diagram of an execution process of a memory management method in one embodiment of the present disclosure is shown;

[0020] Figure 8 Another schematic diagram of the execution process of the memory management method in one embodiment of the present disclosure is shown;

[0021] Fig. 9 A schematic diagram of an execution process of a memory management method in one embodiment of the present disclosure is shown;

[0022] Fig.10 A schematic diagram of functional units of a memory management device in one embodiment of the present disclosure is shown;

[0023] Fig.11 A schematic structural diagram of an electronic device in one embodiment of the present disclosure is shown. DETAILED DESCRIPTION

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

[0025] In related technologies, memory resources are generally divided into shared resource pools and private resource pools. Figure 1 , memory management can reserve an input buffer and an output buffer for each functional module, which is the private resource pool of the functional module. Memory management can keep the remaining memory resources in the memory as a shared resource pool. Among them, the input or output buffer can realize the first in first out (FIFO) of memory resources.

[0026] In the related technology, the output buffer can provide memory resources for the functional module, and the private memory management can pre-fetch memory resources from the shared resource pool through the bus and store them in the output buffer. This pre-fetching behavior may be independent of whether the corresponding functional module has resource requirements. Through the restrictions of the high threshold and the low threshold of the output buffer, the private memory management can independently complete the management of each private resource pool. For a certain private resource pool, when the amount of memory in the output buffer is lower than the low threshold, the private memory management can apply for and obtain memory resources from the shared resource pool through the bus until the high threshold is reached. Similarly, for a certain private resource pool, the input buffer can recycle idle memory resources released by the functional module, and the private memory management can return the memory resources of the input buffer to the shared resource pool through the bus.

[0027] In the related art, the private resource pool is privately owned by each functional module, and the behavior of pre-fetching memory resources by the private resource pool may have nothing to do with the actual functional requirements of each functional module. When memory resources enter the private resource pool of a functional module, they may not be fully used by this functional module, while other functional modules cannot use them. Therefore, when judging whether the memory resources are sufficient, it is necessary not only to consider the remaining memory of the shared resource pool, but also to consider the possibility that it may be read by other functional modules and converted into private resources. In other words, it is often necessary to reserve the memory resources that each private memory manager pre-fetches to the output buffer area for managing the private resource pool in the remaining memory of the shared resource pool.

[0028] In the related art, as shown in formula (1), sh remain The remaining memory resources in the shared resource pool, private i The amount of memory resources pre-fetched for each private resource pool (usually calculated based on the output buffer high threshold), num req The amount of memory resources requested for a certain functional module at the moment. Only when the conditions of formula (1) are met can the computer system's memory resources be considered sufficient. Such a solution will inevitably lead to the inability to fully use the computer system's memory resources, reduce memory utilization, and fail to meet application scenarios with tight memory resources. It can be seen that the amount of wasted memory resources mainly depends on the amount of memory resources pre-fetched by the private resource pool.

[0029]

[0030] In the related art, the private memory management corresponding to each private resource pool uses the same bus to access the shared resource pool, which is a bus competition relationship. When a private resource pool is in an emergency, its private memory management needs to read the memory resources of the shared resource pool. Because the bus is occupied by other private memory managements, it needs to wait for bus arbitration, and the private resource pool cannot replenish memory resources in time. If the functional module corresponding to the private resource pool is in a state of needing memory resources at this time, the waiting time for the bus and the access delay of the bus will be converted into a memory acquisition delay for the functional module, resulting in a decrease in the quality of resource services provided to the functional module.

[0031] In an example of related technology, the total amount of memory resources of a computer system is 2000 (the number of memory units), and the memory resource management corresponds to 4 functional modules, and each functional module reserves 1 private memory management. An output buffer and an input buffer are set in the private memory management. The high threshold of the buffer is 32, and the low threshold is 16. The memory in the output buffer and the input buffer constitutes the private resource pool of the corresponding functional module. The private memory management accesses the shared resource pool through a bus based on the Advanced eXtensible Interface (AXI) protocol. The AXI bus has access delays, and bus arbitration is achieved by equal polling arbitration. Calculated based on the high threshold of the output buffer, the amount of wasted memory resources in this scenario is 128, and the memory resource utilization rate is 93.6% in the optimistic case. In addition, the amount of memory waste will change with the high threshold. As the high threshold increases, the amount of memory resources pre-fetched by each private resource pool increases, and the memory utilization rate will drop sharply.

[0032] In the above example, when all four functional modules have memory requirements, the corresponding private memory management needs to apply for the AXI bus to replenish its output buffer area, and the bus competition is fierce. Figure 2 , the solid line part is the resource application and acquisition process of functional module 1, and the dotted line part is the polling arbitration and delay of the AXI bus. In the M0~M1 period, the control right of the AXI bus belongs to the private memory management 2; in the M1~M2 period, the control right of the AXI bus belongs to the private memory management 3; in the M2~M3 period, the control right of the AXI bus belongs to the private memory management 4; in the M3~M4 period, the control right of the AXI bus belongs to the private memory management 1.

[0033] Specifically, at time node t1, the amount of memory resources stored in the output buffer corresponding to function module 1 is 16, which does not need to be replenished because it meets the low threshold. Subsequently, function module 1 may initiate a resource application, and the amount of memory resources applied for is 20.

[0034] At time t2, the shared resource pool management determines that the memory resources that can be allocated are sufficient, and functional module 1 begins to obtain memory resources from the corresponding output buffer. As the amount of resources in the output buffer is less than 16, private memory management 1 applies for control of the AXI bus, thereby reading the memory resources of the shared resource pool and replenishing the output buffer. Since the current bus control belongs to private memory management 2, it needs to wait for bus control.

[0035] At time node t3, the original resource amount in the output buffer is fully acquired by functional module 1. At this moment, functional module 1 starts to wait for memory resources, and its subsequent processes are blocked.

[0036] At time node t4, that is, moment M3, private memory management 1 obtains bus control, initiates an AXI read operation, and reads the shared resource pool to obtain memory resources.

[0037] At time node t5, private memory management 1 adds the read shared memory resources to the output buffer area and converts them into private resources, so that functional module 1 can continue to obtain memory resources from the output buffer area.

[0038] At time node t6, functional module 1 obtains the 20 memory resources it has applied for.

[0039] From the above, it can be seen that when the number of memory resource requests issued by functional module 1 is 20, although the memory resources in the computer system are sufficient, the total service time is t1-t6, which includes nearly 4 times the AXI bus delay, resulting in low resource service quality.

[0040] In summary, the memory management solution provided by the related technology has low memory resource utilization of the entire computer system due to the division of private resource pools and the bus competition relationship between private memory management, and the resource service quality provided by the computer system to each functional module is not high.

[0041] In view of this, the technical solution provided by one or more embodiments of the present disclosure can effectively improve the utilization rate of memory resources. Figure 3 , a memory management method provided by an embodiment of the present disclosure may include the following steps.

[0042] S1: Using a local resource pool, performing a bus read operation on a memory resource pool to obtain a first memory resource in the memory resource pool.

[0043] In this embodiment, the local resource pool can exclusively use the bus, eliminating the problem of service quality degradation caused by bus competition and bus delay. The bus read operation can be implemented using the AXI bus protocol. The memory resource pool can represent the currently available memory resources of the computer system. The local resource pool can be a shared resource pool that can be used by all functional modules.

[0044] S2: Save the first memory resource in the output cache of the local resource pool.

[0045] In this implementation, the output cache may store the first memory resource acquired by the local resource pool, and may receive access from a subsequent allocation queue.

[0046] In some implementations, if the amount of memory resources in the output cache is lower than a preset low threshold, the local resource pool may be used to perform a bus read operation on the memory resource pool, thereby acquiring new memory resources to supplement the output cache.

[0047] In some implementations, a reasonable value of the low threshold can be determined based on the latency of the local resource pool performing bus read operations on the memory resource pool and the average time for the target functional module to obtain memory resources. Optionally, the rationality of the low threshold can be evaluated by modeling, simulation, etc., and the value of the low threshold can be tuned.

[0048] S3: using the allocation queue to obtain the second memory resource in the output buffer, and save the second memory resource in the form of a queue element, each of the queue elements corresponding to an independent memory resource.

[0049] In this embodiment, the allocation queue can adopt an open address space management concept, so that each functional module can obtain memory resources in a random parallel manner. After the allocation queue obtains a portion of memory resources from the output buffer, these memory resources can be split into memory elements, and each memory element can correspond to an independent memory resource. The split memory elements are saved in the vacant position in the allocation queue to form queue elements.

[0050] In this embodiment, the allocation queue can be a shared resource queue that can be used by all functional modules. The two-level open and shared memory management solution based on the local resource pool and the allocation queue can abandon the concept of private resource pool used in the above related technologies for managing memory. In this way, the memory resources of the memory resource pool are fully utilized, the memory utilization rate of the entire computer system is improved, and it has strong engineering value and implementation value.

[0051] In some embodiments, the allocation queue can be used to obtain storage entries containing the same amount of memory resources from the output cache. Independent memory resources can be obtained by splitting the storage entries. The independent memory resources obtained by splitting can be stored in the allocation queue in the form of queue elements. The use of storage entries can ensure that the allocation queue obtains the same amount of memory resources each time, which facilitates the management of the output cache and the allocation queue and improves the efficiency of memory management.

[0052] In some implementations, the element capacity of the allocation queue may be determined based on the resource capacity of the storage entries in the output cache and the number of target functional modules. Optionally, the rationality of the element capacity may be evaluated by modeling, simulation, etc., and the value of the element capacity may be tuned.

[0053] S4: Based on the write handshake protocol, allocating the third memory resource in the allocation queue to the target functional module with successful handshake.

[0054] In this embodiment, when the target functional module requests memory resources from the allocation queue, the completion of the handshake protocol can be determined to ensure the stability and reliability of resource allocation.

[0055] For example, after receiving a memory acquisition request, the allocation queue may first send a ready signal to the target functional module. After the target functional module receives the ready signal, the allocation queue may feedback a valid response signal. After confirming receipt of the valid response signal, the allocation queue begins to allocate its own stored memory resources to the target functional module. If the allocation queue does not receive the valid response signal, indicating an abnormality, the allocation queue will not allocate its own stored memory resources to the target functional module.

[0056] In some embodiments, the allocation queue is managed by a head pointer and a tail pointer. The head pointer can indicate the head position of the valid element queue in the allocation queue. The tail pointer can indicate the head position of the empty element queue in the allocation queue. Based on the write handshake protocol, the third memory resource in the allocation queue is allocated to the target functional module that successfully handshakes, which can specifically include the following process.

[0057] 1. Based on the tail position of the allocation queue and the position indicated by the tail pointer, determine the number of empty elements in the allocation queue.

[0058] 2. If the number of empty elements exceeds the number of memory resources contained in a storage entry, obtain a storage entry from the output cache, split the obtained storage entry, write the memory resources obtained by splitting into the current queue position pointed to by the tail pointer, and update the current queue position pointed to by the tail pointer.

[0059] 3. Determine the number of valid elements in the allocation queue through the position indicated by the head pointer and the position indicated by the tail pointer.

[0060] 4. By comparing the number of valid elements with the number of target functional modules, the mode for establishing the handshake protocol can be determined.

[0061] 5. If the number of valid elements is not less than the number of target functional modules, the handshake protocol is established uniformly with the target functional modules. For the target functional modules that have successfully handshaked using the preset handshake protocol, the memory resources corresponding to the queue position currently pointed to by the head pointer are allocated, and the current queue position pointed to by the head pointer is updated.

[0062] 6. If the number of valid elements is lower than the number of target function modules, a handshake protocol is established with the polling function modules in the target function modules in turn. For the polling function modules that have successfully handshaked using the preset handshake protocol, the memory resources corresponding to the queue position currently pointed to by the head pointer are allocated, and the current queue position pointed to by the head pointer is updated.

[0063] It should be noted that the memory management method provided in this embodiment can not only allocate the memory of the memory resource pool to the target functional module, but also receive the restricted memory resources released by some functional modules. Specifically, an input cache corresponding to the output cache can be set, and a recycling queue corresponding to the allocation queue can be set. Through a reverse data transmission process similar to the above steps S1 to S4, memory recycling can be completed based on the two-level structure of the allocation queue and the recycling queue.

[0064] In some implementations, a fourth memory resource released by a recycling function module that successfully performs a handshake can be received based on a recycling handshake protocol. The fourth memory resource can be stored in a recycling queue in the form of a queue element. Using the recycling queue, the fifth memory resource in the recycling queue can be written into an input cache of a local resource pool. Using the local resource pool, a bus write operation can be performed on the memory resource pool to release the sixth memory resource in the input cache to the memory resource pool.

[0065] See also Figure 4 The memory management method provided by an embodiment of the present disclosure can be implemented by the hardware architecture in the figure. The hardware architecture can include functional units such as local resource pool management, local output cache, local input cache, resource judgment, and bidirectional open address queue management. The specific introduction of each functional unit is as follows.

[0066] Local resource pool management: This module is responsible for managing the writing of local output cache, reading of local input cache, and writing and reading of resource pool. Set the output cache low threshold. When the cache memory is lower than the low threshold, local resource management initiates a bus read operation to obtain memory from the resource pool to replenish the output cache. Similarly, set the input cache high threshold. When the cache memory is higher than the high threshold, local resource management initiates a bus write operation to read the local input cache and write it to the resource pool to provide available space for recycling. The local resource pool management has exclusive access to the bus, and the requested bus control can be obtained immediately.

[0067] Local output cache: an entity in the output direction of the local resource pool, located between the local resource pool management and the allocation queue management, caching memory resources to be allocated. The local resource pool management controls writing, and the allocation queue management controls reading.

[0068] Local output cache: local resource pool input direction entity, between local resource pool management and recycling queue management, temporarily stores recycled memory resources. Reading is controlled by local resource pool management, and writing is controlled by recycling queue management.

[0069] The above three parts are the overall local resource pool management. Through memory resource pre-fetching, caching of resources to be allocated, temporary storage of recycled resources, etc., the bus delay of resource pool access is invisible to the subsequent queue management and functional modules. In order to achieve better management effect, the preferred settings of local output cache are as follows.

[0070] Low threshold: L≥Latency÷T;

[0071] Cache width: W ≥ Width × Num;

[0072] Among them, Latency is the bus delay, T is the average time for the functional module to obtain the memory, Width is the memory unit entry bit width, and Num is the number of functional modules.

[0073] The local input cache settings are similar to above.

[0074] (4) Bidirectional open address queue management: It is divided into allocation queue management and recycling queue management. Taking allocation queue management as an example, this module is responsible for the management of the head and tail pointers of a memory queue composed of multiple elements and the writing and reading of elements. One queue element corresponds to one memory resource. The number of queue elements Q is preferably set as follows.

[0075] Q≥M+2*Num;

[0076] Where M is the number of memory resources that can be split into an entry in the output cache, M = W ÷ Width, and Num is the number of service function modules. The allocation queue obtains memory resources from the output cache and provides the required memory to the function module in a Ready-Valid (rdy-vld) handshake mode. Figure 5 The allocation queue is managed independently by the head and tail pointers. The head pointer is the first address of the read queue of the allocation queue, and the tail pointer is the first address of the write queue of the allocation queue. The number of valid elements in the queue can be obtained by judging the head and tail pointers (such as Figure 5 The occupied part) and the number of empty elements (such as Figure 5 The empty part of the .

[0077] When the number of empty elements exceeds the number of memory resources that can be split into an output cache, that is, X ≥ M (X is the number of empty elements, M is the number of splits), memory is obtained from the output cache, split, and written to the corresponding queue empty element position. Figure 5 As shown, E is the tail pointer, which is also the location of the first empty element. After reading the output cache, E, E+1 until E+M-1 will be filled synchronously, and the tail pointer will be updated to E+M. According to the number of valid elements in the queue and the current vld situation, the generation of rdy and the change of the head pointer are controlled. When the number of valid elements is not less than the number of functional modules, it can be guaranteed that any functional module can obtain memory and provide it immediately. At this time, all rdy is valid. Conversely, when the number of valid elements is lower than the number of functional modules, according to the vld situation, rdy is controlled to take effect in turn, and the handshake corresponds to the functional module to provide memory resources. At the same time, the head pointer is adjusted according to the handshake situation. Figure 5 As shown, P is the head pointer and also the first valid element position. N functional modules vld are valid. The handshake is completed synchronously to provide valid elements at positions P, P+1 to P+N-1, and the head pointer is updated to P+N.

[0078] The management method of the recycling queue is similar and will not be described here.

[0079] (5) Resource judgment: This module is responsible for resource integration and judging whether the resources meet the requirements of the functional modules. By monitoring the handshake of the allocation queue and the recycling queue, the actual consumption of memory resources and the remaining memory can be mastered. Among them, the remaining memory resources, except for the part requested by each functional module but not obtained in time, are all "free" memory and can be used as much as possible. When the amount of "free" memory resources is not less than the required memory amount submitted by the functional module, it can be considered that the resources are sufficient.

[0080] See also Figure 6, a memory management method provided by an embodiment of the present disclosure, the process of allocating memory resources can be as follows. It should be noted that the process of reclaiming memory resources is similar, and this disclosure will not elaborate on it.

[0081] Specifically, the total number of memory resources in a computer system is 2000. The local resource pool management accesses the resource pool through the AXI bus. The read and write bus width is set to 512 bits, the bus delay is T, and the memory unit entry width is 32 bits. The local output and input caches are both implemented using FIFO, with a depth of 32 and a width of 512 bits. The output cache low threshold is set to 16. The number of allocation queue elements is 32, and there are 4 functional modules in the system.

[0082] At time t1, when initialization is completed, all memory resources are stored in the resource pool, and the local resource pool and the bidirectional queues (allocation queue and recycling queue) have no memory resources.

[0083] At time t2, please refer to Figure 7 , resource pre-fetching is completed within the hardware. The local memory management initiates a read request through the AXI bus to move memory resources to the local output cache, and the number of moved memories is 32*16. The allocation queue obtains, splits and fills the queue from the output cache. The number of valid elements in the queue is 32, the queue position of the tail pointer is 0, the queue position of the head pointer is 0, the queue is full, and the rdy corresponding to the allocation queue is set to valid. The output cache stores 30*16 memory and 30 storage entries. Memory resources are stored in the resource pool, output cache, and allocation queue respectively, but they are all "free" memory and can be used.

[0084] At time t3, the number of memory resources requested by function module 1 is 700, and it is determined that the resources are sufficient. Function module 1 sets vld to be valid to apply for resources, and obtains resources in turn through rdy-vld handshake. The head pointer increases in turn according to the rdy-vld handshake situation.

[0085] For time point t4, please refer to Figure 8 , Functional module 1 obtains the resource quantity 16, the queue position of the head pointer is 16, the queue position of the tail pointer is 0, the number of empty elements in the allocation queue is 16, and the number of valid elements is 16. At this time, the queue management module reads an entry from the output buffer, that is, 16 memories, and fills it to the position of the empty element at the same time, and the queue position of the tail pointer is updated from 0 to 16.

[0086] Subsequently, functional module 1 continues to obtain memory, and the allocation queue replenishes memory from the output buffer.

[0087] At time t5, function module 1 obtains 240 resources, the number of empty elements in the allocation queue is 16, and the number of valid elements is 16, which meets the queue replenishment condition of the queue management module. That is, 16 memories of one entry are read from the output cache, split and filled, similar to t4. However, the number of storage entries in the output cache is updated from 16 to 15 due to the replenishment of the allocation queue, which is lower than the configured low threshold. Therefore, the local resource pool management will read the resource pool through the AXI bus to replenish the output cache.

[0088] For time point t6, please refer to Fig. 9 , AXI bus access ends and local output cache replenishment is completed.

[0089] At time point t7, functional module 1 acquires 700 memory resources, and resource acquisition is completed.

[0090] In summary, during the AXI bus delay T, function module 1 continues to acquire resources, and the delay will not affect it. Similarly, if multiple functions acquire memory at the same time, the tail pointer can be managed by jumping according to the vld-rdy handshake situation. The head pointer and the local output cache management method of the previous stage remain unchanged.

[0091] The local resource pool, allocation queue, and recycling queue constructed in this embodiment are all "free" memories that can be used by any functional module. Compared with the traditional memory management method, the resource utilization rate is improved and can reach 100%. Through two-level memory management and pointer jump management of open queues, without reserving memory, all functional modules are provided with non-delayed memory allocation services in parallel, and the service quality is significantly improved. In addition, the method can adjust the local resource pool size, queue size, and bus access bandwidth according to the number of docking functional modules, memory consumption speed, bus delay, etc., to adapt to different system scenarios.

[0092] As can be seen from the above, the technical solution provided by one or more embodiments of the present disclosure performs memory management based on a local resource pool and an allocation queue. The constructed local resource pool and allocation queue are both shared resources. There is no need to allocate a dedicated resource pool for each functional module, thereby improving memory resource utilization.

[0093] The technical solution provided by one or more embodiments of the present disclosure performs bus read operations on the memory resource pool only through the local resource pool, and there is no problem of bus competition, which improves the memory management efficiency, thereby improving the resource service quality provided to the functional module. Moreover, on the basis of a successful handshake, memory resources are allocated to the corresponding target functional module, making the solution more flexible and accurate.

[0094] See also Fig.10 The present application also provides a memory management device, the device comprising:

[0095] A first acquisition unit 100 is used to perform a bus read operation on a memory resource pool by using a local resource pool to acquire a first memory resource of the memory resource pool;

[0096] An output cache unit 200 is used to store the first memory resource in an output cache of the local resource pool;

[0097] A second acquisition unit 300 is used to acquire the second memory resource in the output buffer by using the allocation queue, and save the second memory resource in the form of a queue element, each of the queue elements corresponding to a memory resource;

[0098] The allocation unit 400 is used to allocate the third memory resource in the allocation queue to the target functional module with which the handshake succeeded based on the write handshake protocol.

[0099] In one embodiment, the first acquisition unit 100 is further configured to use the local resource pool to perform a bus read operation on the memory resource pool if the amount of memory resources in the output cache is lower than a preset low threshold.

[0100] In one embodiment, the value range of the lower threshold includes: L≥Latency÷T; wherein L is the lower threshold, Latency is the delay of a bus read operation on the memory resource pool, and T is the average time for the target functional module to obtain memory resources.

[0101] In one embodiment, the second acquisition unit 300 is specifically used to use the allocation queue to obtain storage entries containing the same number of the second memory resources from the output cache; split the storage entries to obtain independent second memory resources; and save the independent second memory resources in the allocation queue in the form of the queue elements.

[0102] In one embodiment, the element capacity of the allocation queue includes: Q≥M+2*Num; wherein Q is the element capacity, M is the resource capacity of the storage entries in the output cache, and Num is the number of the target functional modules.

[0103] In one embodiment, the allocation queue is managed by a head pointer and a tail pointer, the head pointer is used to indicate the head position of the valid element queue in the allocation queue; the tail pointer is used to indicate the head position of the empty element queue in the allocation queue.

[0104] In one embodiment, the allocation unit 400 is specifically used to determine the number of empty elements in the allocation queue based on the tail position of the allocation queue and the position indicated by the tail pointer; if the number of empty elements exceeds the number of memory resources contained in a storage entry, obtain a storage entry from the output cache; split the storage entry, write the memory resources obtained by the split into the current queue position pointed to by the tail pointer, and update the current queue position pointed to by the tail pointer; determine the number of valid elements in the allocation queue through the position indicated by the head pointer and the position indicated by the tail pointer; compare the number of valid elements with the number of target functional modules to determine to establish the handshake The mode of the protocol; if the number of valid elements is not less than the number of target functional modules, the handshake protocol is established uniformly with the target functional modules; for the target functional modules that have successfully handshaked using the handshake protocol, the memory resources corresponding to the queue position currently pointed to by the head pointer are allocated, and the current queue position pointed to by the head pointer is updated; if the number of valid elements is less than the number of target functional modules, the handshake protocol is established with the polling functional modules in the target functional modules in turn; for the polling functional modules that have successfully handshaked using the handshake protocol, the memory resources corresponding to the queue position currently pointed to by the head pointer are allocated, and the current queue position pointed to by the head pointer is updated.

[0105] In one embodiment, the apparatus comprises:

[0106] The recycling unit 500 is used to receive, based on the recycling handshake protocol, the fourth memory resource released by the recycling function module after the handshake succeeds;

[0107] A first recycling unit 600, configured to store the fourth memory resource in a recycling queue in the form of a queue element;

[0108] The input cache unit 700 is used to write the fifth memory resource in the recycling queue into the input cache of the local resource pool by using the recycling queue;

[0109] The second recycling unit 800 is configured to utilize the local resource pool to perform a bus write operation on the memory resource pool, so as to release the sixth memory resource in the input cache to the memory resource pool.

[0110] Each unit described in the above embodiments may be implemented by a computer chip or a product having a certain function. A typical implementation device is a computer. Specifically, the computer may be, for example, a personal computer, a laptop computer, a cellular phone, a camera phone, a smart phone, a personal digital assistant, a media player, a navigation device, an email device, a game console, a tablet computer, a wearable device, or a combination of any of these devices.

[0111] For the convenience of description, the above devices are described in terms of functions and are described separately in various units. Of course, when implementing the present application, the functions of each unit can be implemented in the same or multiple software and / or hardware.

[0112] See also Fig.11 The present application also provides an electronic device, which includes a memory and a processor, wherein the memory is used to store a computer program, and when the computer program is executed by the processor, the above-mentioned database table aggregation method is implemented.

[0113] The present application also provides a computer-readable storage medium, which is used to store a computer program. When the computer program is executed by a processor, the above-mentioned database table aggregation method is implemented.

[0114] The processor may be a central processing unit (CPU). The processor may also be other general-purpose processors, digital signal processors (DSP), application-specific integrated circuits (ASIC), field-programmable gate arrays (FPGA) or other programmable logic devices, discrete gate or transistor logic devices, discrete hardware components, or a combination of the above chips.

[0115] As a non-transitory computer-readable storage medium, the memory can be used to store non-transitory software programs, non-transitory computer executable programs and modules, such as program instructions / modules corresponding to the method in the embodiment of the present disclosure. The processor executes various functional applications and data processing of the processor by running the non-transitory software programs, instructions and modules stored in the memory, that is, implementing the method in the above method embodiment.

[0116] The memory may include a program storage area and a data storage area, wherein the program storage area may store applications required for operating the computer system and at least one function; the data storage area may store data created by the processor, etc. In addition, the memory may include a high-speed random access memory, and may also include a non-transient memory, such as at least one disk storage device, a flash memory device, or other non-transient solid-state storage device. In some embodiments, the memory may optionally include a memory remotely arranged relative to the processor, and these remote memories may be connected to the processor via a network. Examples of the above-mentioned network include, but are not limited to, the Internet, an intranet, a local area network, a mobile communication network, and combinations thereof.

[0117] Those skilled in the art can understand that all or part of the processes in the above-mentioned embodiments can be implemented by instructing the relevant hardware through a computer program, and the program can be stored in a computer-readable storage medium, and when the program is executed, it can include the processes of the embodiments of the above-mentioned methods. Among them, the storage medium can be a disk, an optical disk, a read-only memory (ROM), a random access memory (RAM), a flash memory, a hard disk drive (HDD) or a solid-state drive (SSD), etc.; the storage medium can also include a combination of the above-mentioned types of memory.

[0118] Each embodiment in this specification is described in a progressive manner, and the same or similar parts between the embodiments can be referred to each other, and each embodiment focuses on the differences from other embodiments. In particular, for the embodiments of the device, electronic device, and storage medium, since they are basically similar to the method embodiments, the description is relatively simple, and the relevant parts can be referred to the partial description of the method embodiments.

[0119] The above is only an embodiment of the present application and is not intended to limit the present application. For those skilled in the art, the present application may have various changes and variations. Any modification, equivalent replacement, improvement, etc. made within the spirit and principle of the present application should be included in the scope of the claims of the present application.

[0120] Although the embodiments of the present disclosure have been described in conjunction with the accompanying drawings, those skilled in the art may make various modifications and variations without departing from the spirit and scope of the present disclosure, and such modifications and variations are all within the scope defined by the appended claims.

Claims

1. A memory management method, characterized in that: The method comprises: Using the local resource pool, performing a bus read operation on the memory resource pool to obtain a first memory resource of the memory resource pool; storing the first memory resource in an output cache of the local resource pool; Using the allocation queue, obtaining the second memory resource in the output buffer, and saving the second memory resource in the form of a queue element, each of the queue elements corresponding to an independent memory resource; Based on the write handshake protocol, the third memory resource in the allocation queue is allocated to the target functional module with successful handshake.

2. The method according to claim 1, characterized in that: The method further comprises: Based on the recycling handshake protocol, receiving the fourth memory resource released by the recycling function module after the handshake succeeds; The fourth memory resource is stored in a recycling queue in the form of a queue element; Using the recycling queue, writing the fifth memory resource in the recycling queue into the input cache of the local resource pool; The local resource pool is used to perform a bus write operation on the memory resource pool to release the sixth memory resource in the input cache to the memory resource pool.

3. The method according to claim 1, characterized in that The method of using the local resource pool to perform a bus read operation on the memory resource pool includes: If the amount of memory resources in the output cache is lower than a preset low threshold, the local resource pool is used to perform a bus read operation on the memory resource pool.

4. The method according to claim 3, characterized in that The value range of the lower threshold includes: L ≥ Latency ÷ T; Wherein, L is the lower threshold, Latency is the delay of performing a bus read operation on the memory resource pool, and T is the average time for the target functional module to obtain memory resources.

5. The method according to claim 1, characterized in that The using the allocation queue to obtain the second memory resource in the output cache and saving the second memory resource in the form of a queue element includes: Using the allocation queue, obtaining storage entries containing the same number of the second memory resources from the output cache; splitting the storage entry to obtain an independent second memory resource; The independent second memory resource is stored in the allocation queue in the form of the queue element.

6. The method according to claim 5, characterized in that The element capacity of the allocation queue includes: Q≥M+2*Num; Among them, Q is the element capacity, M is the resource capacity of the storage entries in the output cache, and Num is the number of the target functional modules.

7. The method according to claim 1, characterized in that The allocation queue is managed by a head pointer and a tail pointer, wherein the head pointer is used to indicate the head position of the valid element queue in the allocation queue; and the tail pointer is used to indicate the head position of the empty element queue in the allocation queue; The method of allocating the third memory resource in the allocation queue to the target functional module that has successfully completed the handshake based on the write handshake protocol includes: Determining the number of empty elements in the allocation queue based on the tail position of the allocation queue and the position indicated by the tail pointer; If the number of empty elements exceeds the number of memory resources contained in one storage entry, obtain one storage entry from the output cache; split the storage entry, write the memory resources obtained by splitting into the current queue position pointed to by the tail pointer, and update the current queue position pointed to by the tail pointer; Determining the number of valid elements in the allocation queue by using the position indicated by the head pointer and the position indicated by the tail pointer; Comparing the number of valid elements with the number of target functional modules to determine a mode for establishing the handshake protocol; If the number of valid elements is not less than the number of target functional modules, the handshake protocol is established uniformly with the target functional modules; for the target functional modules that have successfully handshaked using the handshake protocol, the memory resources corresponding to the queue position currently pointed to by the head pointer are allocated, and the current queue position pointed to by the head pointer is updated; If the number of valid elements is lower than the number of target functional modules, the handshake protocol is established with the polling functional modules in the target functional modules in turn; for the polling functional module that successfully shakes hands using the handshake protocol, the memory resources corresponding to the queue position currently pointed to by the head pointer are allocated, and the current queue position pointed to by the head pointer is updated.

8. A memory management device, characterized in that: The device comprises: A first acquisition unit is used to perform a bus read operation on a memory resource pool by using a local resource pool to acquire a first memory resource of the memory resource pool; An output cache unit, configured to store the first memory resource in an output cache of the local resource pool; A second acquisition unit is used to acquire the second memory resource in the output buffer by using the allocation queue, and save the second memory resource in the form of a queue element, each of the queue elements corresponding to one memory resource; The allocation unit is used to allocate the third memory resource in the allocation queue to the target functional module with successful handshake based on the write handshake protocol.

9. An electronic device, characterized in that: The electronic device comprises a memory and a processor, wherein the memory is used to store a computer program, and when the computer program is executed by the processor, the method according to any one of claims 1 to 7 is implemented.

10. A computer-readable storage medium, characterized in that: The computer-readable storage medium is used to store a computer program, and when the computer program is executed by a processor, the method according to any one of claims 1 to 7 is implemented.