A method and system for realizing memory super-resolution of an acceleration device
By backing up the cold pages in the device memory to the system memory, the problem of application crash caused by the exhaustion of the accelerated device memory is solved, and memory oversegment is achieved to ensure the correct operation of the application and the full utilization of resources.
Patent Information
- Application Number
- CN202510014123.9
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2025-01-06
- Publication Date
- 2025-04-18
- Estimated Expiration
- 2045-01-06
AI Technical Summary
The prior art cannot effectively allocate sufficient memory when the memory of the acceleration device is exhausted, resulting in application crashes and cannot fully utilize the computing resources of the acceleration device.
By obtaining and backing up the cold pages in the acceleration device memory into the system memory, more allocations for acceleration device memory are reserved, and quickly restore the backed up cold pages to the acceleration device memory when the application is accessed.
It realizes that sufficient memory can be allocated when the accelerated device is exhausted, avoid application crashes, ensure application runs correctly, and expands the scale of application processing problems.
Smart Images

Figure CN119415269B_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the technical field of memory management of computing devices, and in particular to a method and system for implementing memory super-resolution of an acceleration device. Background Art
[0002] With the rapid development of big data, artificial intelligence, high-performance computing and other fields, acceleration devices have become key computing resources due to their powerful parallel processing capabilities. The computing power of acceleration devices is becoming more and more powerful, and the demand for the memory capacity of acceleration devices is also increasing. However, the local memory resources of acceleration devices are limited. When executing large-scale and complex tasks, the size of the acceleration device memory directly affects the scale of the task. When the acceleration device memory is exhausted, the existing technology often cannot solve the problem of application crash and exit due to the inability to allocate enough acceleration device memory, resulting in the inability to fully utilize the computing resources on the acceleration device. Summary of the invention
[0003] Technical problem to be solved by the present invention: In view of the above-mentioned problems in the prior art, a method and system for realizing super-resolution of acceleration device memory are provided. The present invention aims to solve the problem in the prior art that when the acceleration device memory is exhausted, the application cannot allocate enough acceleration device memory, resulting in application crash and inability to fully utilize the computing resources on the acceleration device.
[0004] In order to solve the above technical problems, the technical solution adopted by the present invention is:
[0005] A method for realizing super-resolution of acceleration device memory comprises: when allocating acceleration device memory to an application, if the free memory of the acceleration device cannot meet the allocation demand of the application, then obtaining cold pages in the acceleration device memory and backing up the cold pages in the acceleration device memory to the system memory to reserve more acceleration device memory for application allocation; when the application accesses the memory page backed up to the system memory, restoring the memory page from the system memory to the acceleration device memory to ensure the correct operation of the application.
[0006] Optionally, the accelerating device memory allocation for the application includes:
[0007] S101, check whether the free memory of the acceleration device meets the allocation requirements of the application. If so, directly allocate the acceleration device memory to the application, end and exit; otherwise, jump to step S102;
[0008] S102, notifying the kernel backup thread to execute to obtain the cold pages in the acceleration device memory and back up the cold pages in the acceleration device memory to the system memory to reserve more acceleration device memory for application allocation, entering the backup result of the kernel backup thread that is conditionally waiting, and jumping to step S103 after receiving the backup result;
[0009] S103, detecting whether the received backup result is a successful backup, if so, continuing to wait for the next round of acceleration device memory allocation; otherwise, determining that the acceleration device memory allocation has failed, ending and exiting.
[0010] Optionally, the kernel backup thread obtains cold pages in the acceleration device memory and backs up the cold pages in the acceleration device memory to the system memory to reserve more acceleration device memory for application allocation, including:
[0011] S201, obtaining the backup memory size of the notification request;
[0012] S202, obtaining a required backup memory size according to the backup memory size requested by the notification and a preset backup strategy;
[0013] S203, obtaining cold pages in the acceleration device memory according to the required backup memory size;
[0014] S204, allocate the same size of system memory according to the required backup memory size and set the resident memory, call the hardware acceleration engine in the acceleration device to start backing up the acquired cold pages in the acceleration device memory to the allocated system memory, and return the backup result of backup success or backup failure.
[0015] Optionally, the backup strategy preset in step S202 is a minimum memory backup strategy, under which the required backup memory size is equal to the backup memory size requested by the notification; or the backup strategy preset in step S202 is a default memory size backup strategy, under which the required backup memory size is equal to a specified percentage of the total size of the acceleration device memory.
[0016] Optionally, it also includes using a hot page list, a cold page list and an unrecyclable page list to manage the hot pages, cold pages and unrecyclable pages in the acceleration device memory. When the device memory is tight, the pages at the end of the cold page list are first backed up to the system memory; if the device memory allocation demand cannot be met, the pages at the end of the hot page list are continued to be backed up to the system memory; when the application is accelerated to allocate device memory, the newly allocated page will be added to the head of the hot page list, and the memory page at the end of the hot page list will be added to the head of the cold page list after timeout, and the unrecyclable page list will record the unrecyclable memory page; if the memory pages in the hot page list and the cold page list are accessed again, Set this memory page to an active state. When reclaiming the memory page, first detect the active state of the memory page. If it is displayed as an active state, do not reclaim this memory page, and simultaneously set this memory page to an inactive state. If it is detected that this memory page is in an inactive state, directly reclaim it. In step S203, obtaining the cold page in the acceleration device memory according to the required backup memory size includes: first, select a memory page of the required backup memory size from the end of the cold page linked list. If the cold page size in the cold page linked list exceeds the required backup memory size, return and exit; otherwise, continue to select memory pages from the end of the hot page linked list until a memory page of the required backup memory size is selected.
[0017] Optionally, in step S204, when allocating the same size of system memory and setting the resident memory according to the required backup memory size, the host where the acceleration device is located is a server of the numa architecture, and allocating the same size of system memory and setting the resident memory according to the required backup memory size on the server of the numa architecture includes: creating a new N×M array in advance when the system is initialized, wherein N represents the number of devices that need to support memory super-resolution, and M represents the number of numa nodes, and then abstracting a distance according to the communication delay from each device to different numa nodes and filling it into the N×M array; when allocating system memory, by searching the N×M array, preferentially allocating system memory to the numa node closest to the acceleration device, and when the system memory of the numa node at the closest distance is insufficient for allocation, searching the N×M array to continue allocating system memory to the numa node at the next closest distance, and so on, until the system memory allocation of the required backup memory size is completed on each numa node according to the priority of the distance.
[0018] Optionally, when the application accesses a memory page backed up in the system memory, restoring the memory page from the system memory to the acceleration device memory to ensure correct operation of the application includes:
[0019] S301, when the acceleration device accesses the memory data of the acceleration device, the memory management unit integrated in the acceleration device translates the accessed virtual address into a physical address;
[0020] S302, determine whether the physical address is the acceleration device memory, if the physical address is the acceleration device memory, directly read the data of the acceleration device memory, end and exit; otherwise jump to step S303;
[0021] S303, notifying the kernel recovery thread to restore the memory page from the system memory to the acceleration device memory through the kernel recovery thread to ensure correct operation of the application;
[0022] S304, entering the conditional waiting kernel recovery thread recovery result, after receiving the recovery result, jump to step S305;
[0023] S305, detecting whether the received recovery result is a successful backup, if so, continuing to wait for the next round of acceleration device access to the acceleration device memory data; otherwise, determining that the recovery has failed, returning an error, ending and exiting.
[0024] In addition, the present invention also provides an acceleration device memory super-resolution implementation system, including a microprocessor and a memory connected to each other, and the microprocessor is programmed or configured to execute the acceleration device memory super-resolution implementation method.
[0025] In addition, the present invention also provides a computer-readable storage medium, in which a computer program or instruction is stored. The computer program or instruction is programmed or configured to execute the acceleration device memory super-resolution implementation method through a processor.
[0026] In addition, the present invention also provides a computer program product, including a computer program or instructions, which are programmed or configured to execute the acceleration device memory super-resolution implementation method through a processor.
[0027] Compared with the prior art, the present invention mainly has the following advantages: the memory super-resolution implementation method of the present invention migrates the cold page to the system memory to reserve more acceleration device memory space for application use. When it is necessary to access the cold page that has been backed up to the system memory, the backup cold page can be quickly restored to the computing acceleration device memory to ensure the correct operation of the application, so that the application can use the memory capacity exceeding the size of the acceleration device memory itself. When the system memory is sufficient, the application will not crash due to the inability to allocate acceleration device memory, so that the memory super-resolution implementation method of the present invention can effectively solve the problem that when the acceleration device memory is exhausted, the application will abnormally exit because it cannot continue to allocate acceleration device memory. BRIEF DESCRIPTION OF THE DRAWINGS
[0028] Figure 1 Schematic diagram of the basic flow of the method of the embodiment of the present invention.
[0029] Figure 2 Schematic diagram of the system architecture in an embodiment of the present invention.
[0030] Figure 3 This is a flowchart of memory allocation for an acceleration device in an embodiment of the present invention.
[0031] Figure 4 The figure is a flowchart of memory backup of an acceleration device in an embodiment of the present invention.
[0032] Figure 5 The figure is a flow chart of memory access of an acceleration device in an embodiment of the present invention.
[0033] Figure 6 The figure is a flowchart of memory recovery of an acceleration device in an embodiment of the present invention. DETAILED DESCRIPTION
[0034] The embodiments of the present invention are described in detail below with reference to the accompanying drawings. In the description process, unnecessary details and functions for the present invention are omitted to avoid confusion in understanding the present invention.
[0035] like Figure 1 As shown, this embodiment provides a method for implementing over-resolution of acceleration device memory, including: when allocating acceleration device memory to an application, if the free memory of the acceleration device cannot meet the allocation requirements of the application, obtaining the cold pages in the acceleration device memory and backing up the cold pages in the acceleration device memory to the system memory to reserve more acceleration device memory for application allocation; when the application accesses the memory page backed up to the system memory, restoring the memory page from the system memory to the acceleration device memory to ensure the correct operation of the application.
[0036] See also Figure 2, the implementation method of accelerating device memory super-resolution in this embodiment involves memory management functions in the system such as host memory allocation, device (acceleration device) cold page acquisition, device cold page backup, data recovery, host memory release, etc., while accelerating device memory management involves related cold page acquisition, cold page backup, data recovery and hardware accelerated transmission, aiming to cooperate with the memory management function in the system to realize accelerated device memory super-resolution. The two parts jointly constitute the device memory super-resolution system in this embodiment. The main functions of the implementation method of accelerating device memory super-resolution in this embodiment include the backup and recovery mechanism of device memory, and the main functions are as follows: 1. Cold data application backup: back up device cold data to system memory; 2. Data recovery: restore the cold data backed up to system memory to device memory. The implementation method of accelerating device memory super-resolution in this embodiment mainly realizes device memory backup and device memory recovery methods. The device memory super-resolution system is compatible with different devices, and the device memory super-resolution system accesses the device memory by calling the API registered by the device driver. In order to speed up the backup and recovery speed, a hardware acceleration engine is integrated on the device to control high-speed data transmission. In addition, the acceleration device needs to support instruction replay, that is, when the virtual address accessed by the device or CPU does not have a corresponding physical address, the program will suspend and initiate an interrupt until the data is restored.
[0037] like Figure 3 As shown, in this embodiment, accelerating device memory allocation for applications includes:
[0038] S101, check whether the free memory of the acceleration device meets the allocation requirements of the application. If so, directly allocate the acceleration device memory to the application, end and exit; otherwise, jump to step S102;
[0039] S102, notifying the kernel backup thread to execute to obtain the cold pages in the acceleration device memory and back up the cold pages in the acceleration device memory to the system memory to reserve more acceleration device memory for application allocation, entering the backup result of the kernel backup thread that is conditionally waiting, and jumping to step S103 after receiving the backup result;
[0040] S103, detecting whether the received backup result is a successful backup, if so, continuing to wait for the next round of acceleration device memory allocation; otherwise, determining that the acceleration device memory allocation has failed, ending and exiting.
[0041] like Figure 4 As shown in the figure, the kernel backup thread obtains the cold pages in the acceleration device memory and backs up the cold pages in the acceleration device memory to the system memory to reserve more acceleration device memory for application allocation, including:
[0042] S201, obtaining the backup memory size of the notification request;
[0043] S202, obtaining a required backup memory size according to the backup memory size requested by the notification and a preset backup strategy;
[0044] S203, obtaining cold pages in the acceleration device memory according to the required backup memory size;
[0045] S204, allocates the same size of system memory according to the required backup memory size and sets the resident memory, calls the hardware acceleration engine in the acceleration device to start backing up the cold pages in the acquired acceleration device memory to the allocated system memory, and returns the backup result of the backup success or backup failure. After the kernel backup thread completes the backup, wake up the thread waiting for the backup to be completed, and enter the sleep state, waiting for the next notification event. When notifying the kernel backup thread, first enter the conditional waiting, when the kernel backup thread wakes up the waiting condition, detects the backup result, and enters the memory allocation stage again if successful.
[0046] The backup strategy preset in step S202 can be selected according to actual needs, and it may be related to the required backup memory size or may be unrelated to the required backup memory size. For example, as an optional implementation, the backup strategy preset in step S202 of this embodiment is a minimum memory backup strategy. Under the minimum memory backup strategy, the required backup memory size is equal to the backup memory size requested by the notification. For example, as another optional implementation, the backup strategy preset in step S202 of this embodiment is a default memory size backup strategy. Under the default memory size backup strategy, the required backup memory size is equal to a specified percentage of the total size of the acceleration device memory, such as a value of 40%. Undoubtedly, the backup strategy preset in step S202 is not limited to the above two backup strategy examples.
[0047] In order to obtain cold pages, the hot and cold page management strategy in this embodiment is as follows:
[0048] a. Use hot page list, cold page list and non-recyclable page list to manage hot pages, cold pages and non-recyclable pages in the acceleration device memory;
[0049] b. When the device memory is tight, first start backing up the pages at the end of the cold page list to the system memory; if this still cannot meet the device memory allocation requirements, then continue backing up the pages at the end of the hot page list to the system memory;
[0050] c. When allocating memory to the accelerated device for an application, the newly allocated page will be added to the head of the hot page list. The memory page at the end of the hot page list will be added to the head of the cold page list after a timeout. The unreclaimable page list will record unreclaimable memory pages.
[0051] d. If a memory page in the hot page list or cold page list is accessed again, the memory page is set to the active state. When reclaiming a memory page, the active state of the memory page is first detected. If it is displayed as active, the memory page is not reclaimed and is set to the inactive state at the same time. If the memory page is detected to be inactive, it is directly reclaimed;
[0052] In step S203, obtaining the cold pages in the acceleration device memory according to the required backup memory size includes: first, selecting the memory pages of the required backup memory size from the end of the cold page list; if the cold page size in the cold page list exceeds the required backup memory size, return and exit; otherwise, continue to select memory pages from the end of the hot page list until the memory pages of the required backup memory size are selected.
[0053] In step S204 of this embodiment, when allocating the same size of system memory and setting the resident memory according to the required backup memory size, the host where the acceleration device is located is a server of the numa architecture, and allocating the same size of system memory and setting the resident memory according to the required backup memory size on the server of the numa architecture includes: creating an N×M array in advance when the system is initialized, wherein N represents the number of devices that need to support memory super-resolution, and M represents the number of numa nodes, and then abstracting a distance according to the communication delay from each device to different numa nodes and filling it into the N×M array; when allocating system memory, by searching the N×M array, preferentially allocating system memory to the numa node closest to the acceleration device, and when the system memory of the numa node closest to the acceleration device is insufficient for allocation, the system memory is continuously allocated to the numa node with the next closest distance by searching the N×M array, and so on, until the system memory allocation of the required backup memory size is completed on each numa node according to the priority of the distance.
[0054] In this embodiment, the memory management unit integrated on the acceleration device translates the accessed virtual address into a physical address. If the accessed physical page is not in the device memory, the kernel recovery thread is notified to restore the memory page that needs to be accessed. When the kernel recovery thread receives the notification event, it is awakened and obtains the memory page information that needs to be restored by parsing the notification information. Then, it determines whether the device memory can accommodate the recovery page. If it can accommodate the recovery page, a memory page of the corresponding size is allocated. If it cannot accommodate the recovery page, the kernel backup thread is notified. The hardware acceleration engine on the device is called to start restoring the device memory, and the relevant threads are notified. After receiving the wake-up notification of the recovery thread, the device memory data is accessed again. The memory management unit integrated on the acceleration device translates the accessed virtual address into a physical address. If the accessed physical page is not in the device memory, the kernel recovery thread is notified to restore the memory page that needs to be accessed.
[0055] like Figure 5As shown, in this embodiment, when an application accesses a memory page backed up in the system memory, restoring the memory page from the system memory to the acceleration device memory to ensure the correct operation of the application includes:
[0056] S301, when the acceleration device accesses the memory data of the acceleration device, the memory management unit integrated in the acceleration device translates the accessed virtual address into a physical address;
[0057] S302, determine whether the physical address is the acceleration device memory, if the physical address is the acceleration device memory, directly read the data of the acceleration device memory, end and exit; otherwise jump to step S303;
[0058] S303, notifying the kernel recovery thread to restore the memory page from the system memory to the acceleration device memory through the kernel recovery thread to ensure correct operation of the application;
[0059] S304, entering the conditional waiting kernel recovery thread recovery result, after receiving the recovery result, jump to step S305;
[0060] S305, detecting whether the received recovery result is a successful backup, if so, continuing to wait for the next round of acceleration device access to the acceleration device memory data; otherwise, determining that the recovery has failed, returning an error, ending and exiting.
[0061] like Figure 6 As shown, the memory page is restored from the system memory to the acceleration device memory through the kernel recovery thread to ensure the correct operation of the application. The memory page is restored from the system memory to the acceleration device memory through the kernel recovery thread to ensure the correct operation of the application includes:
[0062] S401, receiving a notification event;
[0063] S402, obtaining a memory page that needs to be restored;
[0064] S403, determining whether the acceleration device memory can accommodate the restored memory page, if it can accommodate the restored memory page, allocating the acceleration device memory that can accommodate the memory page to be restored, and jumping to step S405; otherwise, jumping to step S404;
[0065] S404, notifying the kernel backup thread, conditionally waiting for the backup result of the kernel backup thread, if the backup result is successful, jump to step S405; otherwise, notify the result to the relevant thread and exit;
[0066] S405, calling the hardware acceleration engine to start recovery, and notifying the relevant thread of the result after the recovery is successful. After receiving the wake-up notification of the recovery thread, re-access the device memory data.
[0067] In summary, the device memory super-resolution system of the method for accelerating device memory super-resolution in this embodiment is compatible with different devices, and the device memory super-resolution system accesses the device memory by calling the API registered by the device driver. When the device memory is exhausted and the device memory cannot be allocated to the application, the method for accelerating device memory super-resolution in this embodiment migrates the cold pages of the device memory back to the system memory to reserve more device memory for application allocation; when it is necessary to access the cold pages that have been backed up to the system memory, the backed-up cold pages can be quickly restored to the computing device memory to ensure the correct operation of the application. The advantages of the method for accelerating device memory super-resolution in this embodiment are: (1) the originality of the implementation method. By utilizing the accelerated device memory backup and accelerated device memory recovery mechanisms, the application can allocate resources that exceed the actual physical memory size of the device to achieve the purpose of memory super-resolution; (2) the implementation effect is obvious. When the accelerated device memory resources required by the application exceed the actual physical memory resources of the device, the application will not crash due to the inability to allocate accelerated device memory, which expands the scale of application processing problems and lowers the device resource threshold.
[0068] In addition, this embodiment also provides an acceleration device memory super-resolution implementation system, including a microprocessor and a memory connected to each other, and the microprocessor is programmed or configured to execute the acceleration device memory super-resolution implementation method.
[0069] In addition, this embodiment also provides a computer-readable storage medium, in which a computer program or instruction is stored. The computer program or instruction is programmed or configured to execute the acceleration device memory super-resolution implementation method through a processor.
[0070] In addition, this embodiment also provides a computer program product, including a computer program or instructions, which are programmed or configured to execute the acceleration device memory super-resolution implementation method through a processor.
[0071] Those skilled in the art should understand that the technical solutions provided by the embodiments of the present application may be in the form of methods, systems, or computer program products. Therefore, the present application may take the form of a complete hardware embodiment, a complete software embodiment, or an embodiment combining software and hardware. Moreover, the present application may take the form of a computer program product implemented on one or more computer-readable storage media (including but not limited to disk storage, CD-ROM, optical storage, etc.) containing computer-usable program codes. The present application is described with reference to the flowcharts and / or block diagrams of the methods, devices (systems), and computer program products according to the embodiments of the present application. It should be understood that each process and / or box in the flowchart and / or block diagram, as well as the combination of the processes and / or boxes in the flowchart and / or block diagram, can be implemented by computer program instructions. These computer program instructions can be provided to a processor of a general-purpose computer, a special-purpose computer, an embedded processor, or other programmable data processing device to produce a machine, so that the instructions executed by the processor of the computer or other programmable data processing device generate instructions for implementing the processes in the process Figure 1 A process or multiple processes and / or boxes Figure 1 These computer program instructions can also be stored in a computer-readable memory that can guide a computer or other programmable data processing device to work in a specific way, so that the instructions stored in the computer-readable memory produce a product including an instruction device, which implements the functions specified in the process. Figure 1 A process or multiple processes and / or boxes Figure 1 These computer program instructions can also be loaded onto a computer or other programmable data processing device, so that a series of operation steps are executed on the computer or other programmable device to produce a computer-implemented process, so that the instructions executed on the computer or other programmable device provide for implementing the process in the process. Figure 1 A process or multiple processes and / or boxes Figure 1 The steps for the functions specified in one or more boxes.
[0072] The above is only a preferred embodiment of the present invention, and the protection scope of the present invention is not limited to the above embodiments. All technical solutions under the concept of the present invention belong to the protection scope of the present invention. It should be pointed out that for ordinary technicians in this technical field, some improvements and modifications without departing from the principle of the present invention should also be regarded as the protection scope of the present invention.
Claims
1. A method for implementing memory super-resolution of an acceleration device, characterized in that: include: When allocating acceleration device memory to an application, if the free memory of the acceleration device cannot meet the allocation requirements of the application, obtain the cold pages in the acceleration device memory and back up the cold pages in the acceleration device memory to the system memory to reserve more acceleration device memory for application allocation; When an application accesses a memory page backed up to the system memory, the memory page is restored from the system memory to the acceleration device memory to ensure the correct operation of the application. The host where the acceleration device is located is a server with the numa architecture. A new N×M array is created in advance during system initialization, where N represents the number of devices that need to support memory super-resolution and M represents the number of numa nodes. Then, a distance is abstracted based on the communication delay from each device to different numa nodes and filled into the N×M array. When backing up the cold pages in the acceleration device memory to the system memory, it includes: allocating the system memory in the numa node closest to the acceleration device by searching the N×M array, and when the system memory of the numa node closest to the acceleration device is insufficient, allocating the system memory in the numa node next closest to the acceleration device by searching the N×M array, and so on, until the system memory allocation of the required backup memory size is completed on each numa node according to the priority of the distance.
2. The method for implementing memory super-resolution of an acceleration device according to claim 1, characterized in that: The accelerating device memory allocation for the application comprises: S101, check whether the free memory of the acceleration device meets the allocation requirements of the application. If so, directly allocate the acceleration device memory to the application, end and exit; otherwise, jump to step S102; S102, notifying the kernel backup thread to execute to obtain the cold pages in the acceleration device memory and back up the cold pages in the acceleration device memory to the system memory to reserve more acceleration device memory for application allocation, entering the backup result of the kernel backup thread that is conditionally waiting, and jumping to step S103 after receiving the backup result; S103, detecting whether the received backup result is a successful backup, if so, continuing to wait for the next round of acceleration device memory allocation; otherwise, determining that the acceleration device memory allocation has failed, ending and exiting.
3. The method for implementing memory super-resolution of an acceleration device according to claim 2, characterized in that: The kernel backup thread obtains cold pages in the acceleration device memory and backs them up to the system memory to reserve more acceleration device memory for application allocation, including: S201, obtaining the backup memory size of the notification request; S202, obtaining a required backup memory size according to the backup memory size requested by the notification and a preset backup strategy; S203, obtaining cold pages in the acceleration device memory according to the required backup memory size; S204, allocate the same size of system memory according to the required backup memory size and set the resident memory, call the hardware acceleration engine in the acceleration device to start backing up the acquired cold pages in the acceleration device memory to the allocated system memory, and return the backup result of backup success or backup failure.
4. The method for implementing memory super-resolution of an acceleration device according to claim 3, characterized in that: The backup strategy preset in step S202 is a minimum memory backup strategy, under which the required backup memory size is equal to the backup memory size requested by the notification; or the backup strategy preset in step S202 is a default memory size backup strategy, under which the required backup memory size is equal to a specified percentage of the total size of the acceleration device memory.
5. The method for implementing memory super-resolution of an acceleration device according to claim 3, characterized in that: It also includes using a hot page list, a cold page list and an unrecyclable page list to manage hot pages, cold pages and unrecyclable pages in the acceleration device memory. When the device memory is tight, the pages at the end of the cold page list are first backed up to the system memory; if the device memory allocation demand cannot be met, the pages at the end of the hot page list are continued to be backed up to the system memory; when the application is accelerated to allocate device memory, the newly allocated page will be added to the head of the hot page list, and the memory page at the end of the hot page list will be added to the head of the cold page list after timeout, and the unrecyclable page list will record the unrecyclable memory page; if the memory page in the hot page list and the cold page list is accessed again, the memory page is set to an active state. When the memory page is recycled, the active state of the memory page is first detected. If it is displayed as an active state, the memory page is not recycled and the memory page is set to an inactive state at the same time. If the memory page is detected to be in an inactive state, it is directly recycled; In step S203, obtaining the cold pages in the acceleration device memory according to the required backup memory size includes: first, selecting the memory pages of the required backup memory size from the end of the cold page list; if the cold page size in the cold page list exceeds the required backup memory size, return and exit; otherwise, continue to select memory pages from the end of the hot page list until the memory pages of the required backup memory size are selected.
6. The method for implementing memory super-resolution of an acceleration device according to claim 1, characterized in that: When the application accesses the memory page backed up in the system memory, restoring the memory page from the system memory to the acceleration device memory to ensure the correct operation of the application includes: S301, when the acceleration device accesses the memory data of the acceleration device, the memory management unit integrated in the acceleration device translates the accessed virtual address into a physical address; S302, determine whether the physical address is the acceleration device memory, if the physical address is the acceleration device memory, directly read the data of the acceleration device memory, end and exit; otherwise jump to step S303; S303, notifying the kernel recovery thread to restore the memory page from the system memory to the acceleration device memory through the kernel recovery thread to ensure correct operation of the application; S304, entering the conditional waiting kernel recovery thread recovery result, after receiving the recovery result, jump to step S305; S305, detecting whether the received recovery result is a successful backup, if so, continuing to wait for the next round of acceleration device access to the acceleration device memory data; otherwise, determining that the recovery has failed, returning an error, ending and exiting.
7. A system for implementing memory super-resolution in an acceleration device, comprising a microprocessor and a memory connected to each other, characterized in that: The microprocessor is programmed or configured to execute the acceleration device memory super-resolution implementation method described in any one of claims 1 to 6.
8. A computer-readable storage medium having a computer program or instruction stored therein, characterized in that: The computer program or instruction is programmed or configured to execute the acceleration device memory super-resolution implementation method described in any one of claims 1 to 6 through a processor.
9. A computer program product comprising a computer program or instructions, characterized in that The computer program or instruction is programmed or configured to execute the acceleration device memory super-resolution implementation method described in any one of claims 1 to 6 through a processor.
Citation Information
Patent Citations
Memory exchange method and device, computer equipment and storage medium
CN116204309A
Graphics processing unit video memory processing method, server, product, equipment and medium
CN118279126A