Data management method and data management system
By dividing the memory copy operation between the host and the device into multiple data blocks and executing them in parallel, the problem of low data interaction efficiency between the host and the device is solved, achieving efficient data copying and reducing the need for temporary storage memory.
Patent Information
- Application Number
- CN202410756229.1
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2024-06-13
- Publication Date
- 2026-01-27
- Estimated Expiration
- 2044-06-13
AI Technical Summary
In existing technologies, data interaction between the host and device is inefficient and requires a large amount of temporary memory, making it impossible to perform data copying operations in parallel.
By dividing the memory copy operations on the host and device sides into multiple data blocks and executing them in parallel, parallel copying of temporary memory on the host side to memory on the device side and swappable memory on the host side to temporary memory can be achieved, thereby reducing the size requirement of temporary memory.
It improves data copying efficiency, reduces the size requirement of temporary storage memory, and realizes parallel data copying in both hardware and software.
Smart Images

Figure CN118312464B_ABST
Abstract
Description
Technical Field
[0001] This application relates to the field of data processing technology, and more specifically, to a data management method and a data management system. Background Technology
[0002] The CPU (Central Processing Unit) is the main processing unit in a computer system, responsible for executing program instructions. The GPU (Graphics Processing Unit) was initially designed for handling graphics and image-related tasks, but due to its highly parallelized architecture, it is also widely used in scientific computing and artificial intelligence. To further focus on general-purpose computing, the General-Purpose Graphics Processing Unit (GPGPU) emerged. GPGPUs remove the graphics display portion of the GPU, dedicating the rest entirely to general-purpose computing, making them the core of AI accelerators. GPGPUs refer to the technology of using GPUs for general-purpose computing, allowing developers to leverage the parallel processing capabilities of GPUs to accelerate various types of applications, not just graphics-related ones. The TPU (Tensor Processing Unit) is a processor specifically designed to accelerate artificial intelligence workloads, especially in deep learning tasks. TPUs focus on efficiently performing tensor operations, giving them an advantage over general-purpose CPUs and GPUs when handling large-scale neural networks. In other words, GPUs, GPGPUs, TPUs, and similar chips can be considered artificial intelligence chips, and like CPUs, they are important components of modern computing. They each play a crucial role in different application scenarios and are often used in conjunction to improve computational performance.
[0003] In practical applications, artificial intelligence chips (such as GPU chips, GPGPU chips, and TPU chips) need to interact with the CPU to complete various tasks. Typically, the CPU is considered to be associated with the host, and the artificial intelligence chip is considered to be associated with the device. Both the host and the device have various types of storage devices, and data exchange is required between them.
[0004] Therefore, a data management method is needed for data interaction between the host and the device. Summary of the Invention
[0005] According to one aspect of this application, a data management method is provided, applied to a host device. The method may include: allocating temporary storage memory on the host device, the temporary storage memory being divided into two temporary storage partitions of a preset size for temporary data storage; determining data to be copied from the host device's memory to the device's memory, and dividing the data to be copied based on the preset size to obtain multiple data blocks; and sequentially copying the multiple data blocks from the host device's memory to the device's memory via the two temporary storage partitions, wherein: for each data block, when the data block is copied to one of the two temporary storage partitions and the other temporary storage partition is idle, the operations of copying the data block from the one temporary storage partition to the device's memory and copying another data block to the other temporary storage partition are performed in parallel.
[0006] According to an embodiment of this application, copying the plurality of data blocks sequentially from the host-side memory to the device-side memory via the two temporary storage partitions includes: copying a first data block among the plurality of data blocks to a first temporary storage partition among the two temporary storage partitions; and performing the operation of copying the first data block from the first temporary storage partition to the device-side memory and the operation of copying a second data block among the plurality of data blocks to a second temporary storage partition among the two temporary storage partitions in parallel.
[0007] According to an embodiment of this application, copying the plurality of data blocks sequentially from the host-side memory to the device-side memory via the two temporary storage partitions may further include: in response to the first data block being copied from the first temporary storage partition to the device-side memory, determining that the first temporary storage partition has become free, and performing the operations of copying the second data block from the second temporary storage partition to the device-side memory and copying the third data block among the plurality of data blocks to the first temporary storage partition in parallel.
[0008] According to an embodiment of this application, copying the plurality of data blocks sequentially from the host-side memory to the device-side memory via the two temporary storage partitions may further include: in response to the second data block being copied from the second temporary storage partition to the device-side memory and the third data block being copied from the host-side memory to the first temporary storage partition, performing the operation of copying the third data block from the first temporary storage partition to the device-side memory and the operation of copying the fourth data block among the plurality of data blocks to the second temporary storage partition in parallel.
[0009] According to an embodiment of this application, the operation of copying the first data block from the first temporary partition to the memory of the device includes: generating indication information in response to the first data block being copied to the first temporary partition, and sending the indication information to the device, so that the device can access the first temporary partition using its direct memory access module to realize the copying of the first data block.
[0010] According to an embodiment of this application, for each of the two temporary storage partitions, a new data block is copied to the corresponding temporary storage partition only if the data block in the corresponding temporary storage partition has already been copied to the device.
[0011] According to an embodiment of this application, the host side includes a central processing unit, and the device side includes an artificial intelligence chip, and the data to be copied includes data on the swappable memory of the host side, and the temporary storage memory serves as the non-swappable memory of the host side.
[0012] According to another aspect of this application, a data management method is also provided, applied to a device. The method may include: determining data to be copied from the device's memory to the host's memory; dividing the data to be copied into multiple data blocks based on a preset size of two temporary storage partitions divided in the host's temporary storage memory for temporary data storage; and sequentially copying the multiple data blocks from the device's memory to the host's memory via the two temporary storage partitions, wherein: for each data block, when the data block is copied to one of the two temporary storage partitions and the other temporary storage partition is idle, in parallel with the copying of the data block from the first temporary storage partition to the host's memory, another data block is copied to the other temporary storage partition.
[0013] According to an embodiment of this application, copying the plurality of data blocks sequentially from the memory on the device side to the memory on the host side via the two temporary storage partitions includes: copying a first data block among the plurality of data blocks to a first temporary storage partition among the two temporary storage partitions; and, relative to the copying of the first data block from the first temporary storage partition on the host side to the memory on the host side, copying a second data block among the plurality of data blocks to a second temporary storage partition among the two temporary storage partitions in parallel.
[0014] According to an embodiment of this application, the copying of the first data block from the first temporary partition on the host side to the host side memory is performed in response to the first data block being copied to the first temporary partition and the second data block being copied to the second temporary partition.
[0015] According to an embodiment of this application, copying the plurality of data blocks sequentially from the memory on the device side to the memory on the host side via the two temporary storage partitions includes: further including: in response to the first data block being copied from the first temporary storage partition to the memory on the host side, copying a third data block among the plurality of data blocks to the first temporary storage partition in parallel, relative to copying the second data block from the second temporary storage partition to the memory on the host side.
[0016] According to an embodiment of this application, wherein the plurality of data blocks are sequentially copied from the memory on the device side to the memory on the host side via the two temporary storage partitions, and in the case where the second data block is copied from the second temporary storage partition to the memory on the host side and the third data block is copied from the memory on the device side to the first temporary storage partition, relative to the operation of copying the third data block from the first temporary storage partition to the memory on the host side, the fourth data block among the plurality of data blocks is copied to the second temporary storage partition.
[0017] According to an embodiment of this application, the method may further include: obtaining from the host terminal a message indicating that the host terminal's temporary memory is divided into two temporary partitions with a preset size.
[0018] According to an embodiment of this application, copying a first data block from the plurality of data blocks to a first temporary partition from the two temporary partitions includes: in response to determining the existence of the first data block, accessing the first temporary partition on the host side using a direct memory access module to copy the first data block to the first temporary partition.
[0019] According to an embodiment of this application, the host side includes a central processing unit, and the device side includes an artificial intelligence chip, and the data to be copied includes data on the swappable memory of the host side, and the temporary storage memory serves as the non-swappable memory of the host side.
[0020] According to another aspect of this application, a data management system is provided, including a host and a device. The host allocates temporary storage memory, which is divided into two temporary storage partitions of a preset size for temporary data storage. In the case of copying data from the host to the device: the host determines the data to be copied and segments it based on the preset size to obtain multiple data blocks; and the host sequentially copies the multiple data blocks from the host's memory to the device's memory via the two temporary storage partitions, wherein: for each data block, when the data block is copied to one of the two temporary storage partitions and the other temporary storage partition is idle, the host performs the operation of copying the data block from the one temporary storage partition to the device's memory and the operation of copying another data block to the other temporary storage partition in parallel.
[0021] According to an embodiment of this application, in the case of copying data from the device to the host: the host sends an instruction to the device indicating the temporary storage memory; the device determines the data to be copied and divides the data to be copied based on the preset size to obtain multiple data blocks; the device copies the multiple data blocks sequentially from the device's memory to the host's memory via the two temporary storage partitions, wherein: for each data block, when the data block is copied to one of the two temporary storage partitions and the other temporary storage partition is idle, relative to the copying of the data block from the one temporary storage partition on the host to the host's memory, the device copies another data block in parallel to the other temporary storage partition.
[0022] According to another aspect of this application, a computing device is provided, comprising: one or more processors; and one or more memory storing computer-readable instructions that, when executed by the one or more processors, perform the method as described above.
[0023] In the embodiments of this application, by executing the data copying operation between the device's memory and the host's temporary storage memory (which is non-removable memory) in parallel with the data copying operation between the host's swappable memory and the host's temporary storage memory, the data copying efficiency can be improved and the requirement for the size of the temporary storage memory can be reduced. Specifically, the data to be copied in memory is divided into blocks. For copying data from the host to the device, the copying operations from the host's temporary storage memory to the device's memory and from the host's swappable memory to the temporary storage memory are executed in parallel. For copying data from the device to the host, the data copying operations between the device's memory and the host's temporary storage memory and between the host's temporary storage memory and the host's swappable memory are executed in parallel, thus achieving hardware and software parallelism. Attached Figure Description
[0024] To more clearly illustrate the technical solutions in the embodiments of this application or the prior art, the drawings used in the description of the embodiments of this application or the prior art will be briefly introduced below. Obviously, the drawings described below are only some embodiments recorded in this application. For those skilled in the art, other drawings can be obtained based on these drawings of the embodiments of this application.
[0025] Figure 1A An example application architecture diagram of a general-purpose graphics processing unit (GPGPU) is shown.
[0026] Figure 1B It shows Figure 1A This is a diagram illustrating the memory settings on the host and device sides in an example application.
[0027] Figure 2 An example process diagram is shown when a host and a device perform data copying according to an embodiment of this application.
[0028] Figure 3 A flowchart illustrating a data management method according to an embodiment of this application is shown.
[0029] Figure 4 A flowchart illustrating another data management method according to an embodiment of this application is shown.
[0030] Figure 5 A flowchart illustrating a data management method according to an embodiment of this application is shown.
[0031] Figure 6 A flowchart illustrating another data management method according to an embodiment of this application is shown.
[0032] Figure 7A sample process diagram is shown for data interaction between the host and device sides, in which data is copied from the swappable memory on the host side to the memory on the device side.
[0033] Figure 8 A sample process diagram is shown for data interaction between the host and device sides, where data is copied from the device's memory to the host's swappable memory. Detailed Implementation
[0034] The technical solutions of the embodiments of this disclosure will be clearly and completely described below with reference to the accompanying drawings. Obviously, the described embodiments are only some, not all, of the embodiments of this disclosure. All other embodiments obtained by those skilled in the art based on the embodiments of this disclosure without creative effort are within the scope of protection of this disclosure.
[0035] Figure 1A An example application architecture diagram of a general-purpose graphics processing unit (GPGPU) is shown.
[0036] like Figure 1A As shown, architecture 100 may include a host side 110 and a device side 120, wherein the host side includes a central processing unit (CPU) and the device side 120 may include a general-purpose graphics processing unit (GPGPU). Both the host side 110 and the device side 120 include memory. Memory stores data; for example, before a computer program can be executed, it needs to be loaded into memory before it can be processed by the CPU or GPGPU. Memory acts as an intermediary, mitigating the speed conflict between the CPU and the hard drive. It should be noted that in the context of this application, the device side and a GPGPU chip as an artificial intelligence chip have been described in detail. However, those skilled in the art will understand that the device side may include other types of artificial intelligence chips, such as GPU chips or TPU chips, etc., and this application does not impose any limitations on this.
[0037] The memory on the host side can be divided into swappable memory and non-swappable memory based on its nature. Figure 1B This diagram illustrates the memory settings on both the host and device sides. Examples of host-side configurations could include desktop computers or servers, etc.
[0038] like Figure 1BAs shown, the host-side 10's memory (physical memory, such as memory modules) corresponds to a virtual memory (the size of the virtual memory is generally larger than the size of the physical memory, thus creating a larger perceived memory for the user), and this virtual memory can be divided into swappable memory and non-swappable memory. Based on the mapping from virtual memory to physical memory, data stored on the physical memory corresponding to the swappable memory can be dynamically swapped out to, for example, a hard disk (e.g., a solid-state drive, SSD) to save physical memory space (the swapping-in process is similar). On the other hand, although the non-swappable memory also corresponds to physical memory, this corresponding physical memory is resident physical memory, and the data stored on it will not be swapped out to the hard disk. Furthermore, the device-side 120 has independent physical memory (e.g., graphics memory, examples include High Bandwidth Memory (HDM) or Graphics Double Data Rate (GDDR) memory, etc.), and generally can only access the host-side 110's non-swappable memory (e.g., through Direct Memory Addressing (DMA)) to read or write data. Therefore, the temporary storage memory mentioned in the context, as an intermediary between the host-side swappable memory and the device-side memory, is non-swappable memory, and the host 110 can allocate the required size of temporary storage memory according to actual needs.
[0039] Furthermore, both the host side 110 and the device side 120 may each include one or more processors and one or more memories. The processor at the host side 110 may include the aforementioned central processing unit (CPU) and / or other processors, for executing computer-readable instructions to drive corresponding hardware circuitry or, in conjunction with it, perform data copy operations. The memory at the host side 110 may include various types of memory, such as RAM (removable and non-removable RAM) and non-volatile storage media. The processor at the device side 120 may include the aforementioned general-purpose graphics processing unit (GPGPU) and / or other processors, for executing computer-readable instructions to drive corresponding hardware circuitry or, in conjunction with it, perform data copy operations. The memory at the device side 120 may also include various types of memory, such as RAM (e.g., graphics card memory) and non-volatile storage media.
[0040] For example, the aforementioned processor may include a general-purpose processor, a digital signal processor (DSP), an application-specific integrated circuit (ASIC), an off-the-shelf programmable gate array (FPGA), or other programmable logic devices, discrete gate or transistor logic devices, or discrete hardware components, for implementing or executing the methods, steps, and logic block diagrams disclosed in the embodiments of this application. The non-volatile storage medium may store an operating system, and may also store various data, instructions, and / or computer-executable programs, which, when executed, can implement the various operations described in this application. Memory may also store various data, instructions, and / or computer-executable programs, which, when executed, can implement the various operations described in this application.
[0041] Non-volatile memory can be read-only memory (ROM), programmable read-only memory (PROM), erasable programmable read-only memory (EPROM), electrically erasable programmable read-only memory (EEPROM), or flash memory. It should be noted that the memory used in the methods described in this application is intended to include, but is not limited to, these and any other suitable categories of memory.
[0042] In practical applications, data needs to be copied between the host-side swappable memory and the device-side memory. The common practice is to utilize the host-side staging memory, which can be part of the host-side non-swappable memory. Specifically, for example... Figure 2 As shown, when data needs to be copied from the memory of host 110 to the memory of device 110, the data to be copied must first be copied from the swappable memory of host 110 to the temporary memory of host 110. After the copy operation is completely completed, the data is then copied from the temporary memory of host 110 to the memory of device 110. Although not shown, when data needs to be copied from device 120 to host 110, the data to be copied must first be copied from the memory of device 120 to the temporary memory of host 110. After the copy operation is completely completed, the data is then copied from the temporary memory of host 110 to the swappable memory of host 110.
[0043] However, using this approach, such as Figure 2 As shown, when copying data from the memory of host 110 to the memory of device, the copy operation from the temporary memory of host 110 to the memory of device 120 (staging memory to device, S2D) can only be executed after the copy operation from the swappable memory of host 120 to the temporary memory of host 110 (Host to Staging memory, H2S) is completed. This cannot be done in parallel, resulting in low efficiency.
[0044] Similarly, when copying data from the memory of device 120 to the memory of host 110, the copy operation from the temporary memory of host 110 to the swappable memory of host 120 (staging memory to host, S2H) can only be executed after the copy operation from the memory of device 120 to the temporary memory of host 110 (Device to Staging memory, H2S) is completed. This cannot be done in parallel and also presents an efficiency problem.
[0045] In addition, in this case, the size of the temporary memory needs to meet the size of the data to be copied, so a large amount of storage resources need to be allocated to the temporary memory.
[0046] Therefore, to address the aforementioned issues, embodiments of this application propose a data management method. By executing data copying operations between device-side memory and host-side temporary storage in parallel with data copying operations between host-side swappable memory and host-side temporary storage, data copying efficiency can be improved and the size requirement for temporary storage can be reduced. Specifically, the data to be copied in memory is divided into blocks. For copying data from host-side memory to device-side memory, copying operations from host-side temporary storage to device-side memory and from host-side swappable memory to temporary storage are executed in parallel. For copying data from device-side memory to host-side memory, data copying operations between device-side memory and host-side temporary storage and from host-side temporary storage to host-side swappable memory are executed in parallel, thus achieving hardware and software parallelism.
[0047] Figure 3 A flowchart illustrating a data management method according to an embodiment of this application is shown. This method can be applied to... Figure 1A-1B or Figure 2 The host side is shown, and it is used to copy memory data from the host side to the device side.
[0048] like Figure 3 As shown, in step S310, temporary storage memory is allocated on the host side, and the temporary storage memory is divided into two temporary storage partitions of a preset size for temporary storage of data.
[0049] In this scenario, the host can allocate temporary memory, which is divided into two temporary partitions of a preset size. For example, the host may pre-allocate temporary memory during system startup, comprising two temporary partitions of a preset size, for temporarily storing a portion of the data to be copied from the host. The preset size of each temporary partition can be 1MB.
[0050] In step S320, the data to be copied from the host memory to the device memory is determined, and the data to be copied is divided into multiple data blocks based on the preset size.
[0051] When the device's memory needs to access data from the host's swappable memory, as mentioned earlier, the device cannot directly access the data on the swappable memory. Therefore, the data from the host's swappable memory needs to be temporarily stored in temporary memory (which is non-swappable memory). In the context of this application, the data to be copied between the host's memory and the device's memory refers to the data to be copied between the host's swappable memory and the device's memory.
[0052] Optionally, the data to be copied can be divided based on a preset size for each temporary partition. For example, whether to divide the data depends on the memory size occupied by the data to be copied. When the memory size occupied is greater than the preset size of each temporary partition (e.g., 1MB), it can be divided into multiple data blocks, each no larger than 1MB. Optionally, the sizes of the multiple data blocks obtained from the division can be the same or different. Furthermore, when the memory size occupied is less than or equal to the preset size of each temporary partition, the data to be copied is treated as a single data block without division. The parallel scheme of the embodiments of this application mainly addresses the case of multiple data blocks.
[0053] In step S330, the plurality of data blocks are sequentially copied from the host-side memory to the device-side memory via the two temporary storage partitions, wherein: for each data block, when the data block is copied to one of the two temporary storage partitions and the other temporary storage partition is idle, the operation of copying the data block from the one temporary storage partition to the device-side memory and the operation of copying another data block to the other temporary storage partition are performed in parallel.
[0054] For example, when the data to be copied is divided into multiple data blocks, these blocks can be copied sequentially into temporary memory. Each data block can have its own index and can be ordered in any way to be copied one by one. For example, the first data block is copied to the first temporary partition, and the second data block is copied to the second temporary partition. After the first temporary partition is free (e.g., the copy operation of the first data block to the device's memory has been completed), the third data block can be copied to the first temporary partition. Similarly, after the second temporary partition is free (e.g., the copy operation of the second data block to the device's memory has been completed), the fourth data block is copied to the second temporary partition, and so on.
[0055] Optionally, the host and device can exchange various instructions or information to assist in the data exchange process. In some cases, during the copying of the current data block from the host's first temporary storage partition to the device's memory, the host can generate indication information (e.g., a hardware instruction) in response to the data block being copied to the first temporary storage partition and send the indication information to the device. This allows the device to access the host's first temporary storage partition using its Direct Memory Access (DMA) module to copy the data block. DMA is a method by which a computer processor accesses system memory, allowing data to be transferred directly between memory and devices without intervention from the central processing unit (CPU). Additionally, the host can determine whether the data block copying operation from the temporary storage partition to the device is complete by detecting the idle state of its temporary storage partition or based on at least one of messages from the device, and proceed with subsequent operations accordingly.
[0056] It can be seen that, by reference Figure 3 The described method performs the operations of copying one data block from the first temporary partition to the device's memory and copying another data block to the second temporary partition of the two temporary partitions in parallel, thus improving data copying efficiency. Furthermore, based on this method, the preset size of each temporary memory can be set relatively small, thereby saving system resources.
[0057] Optionally, for more details on the sequential copying process of multiple data blocks obtained from the data to be copied, please refer to [link / reference]. Figure 4 .
[0058] Figure 4 An embodiment according to this application is shown. Figure 3 The various sub-steps of step S330 shown.
[0059] For example, in step S330-1, the first data block among the plurality of data blocks is copied to the first temporary partition of the temporary memory, and the operation of copying the first data block from the first temporary partition to the memory on the device side and the operation of copying the second data block among the plurality of data blocks to the second temporary partition among the two temporary partitions are performed in parallel.
[0060] Additionally, when the plurality of data blocks includes at least three data blocks, for example, in step S330-2, in response to the first data block being copied from the first temporary partition to the memory on the device side, the operation of copying the second data block from the second temporary partition to the memory on the device side and the operation of copying the third data block from the plurality of data blocks to the first temporary partition are performed in parallel.
[0061] Typically, to avoid process chaos, for each temporary partition, subsequent operations on it (copying data from it or copying data into it) need to wait for the current operation to complete. For example, reading data from a temporary partition for copying requires waiting for the data to be completely copied to the temporary partition, or copying data into a temporary partition requires waiting for the previous data stored in the temporary partition to have been copied.
[0062] For example, when a third data block needs to be copied to the device's memory, the third data block can be copied to the first temporary storage partition after the first temporary storage partition containing the first data block becomes free (after the copy operation of the first data block from the first temporary storage partition to the device's memory is complete). Simultaneously, a copy operation of the second data block from the second temporary storage partition to the device's memory can also be performed. For instance, the host can determine whether the data block copy operation from the temporary storage partition to the device is complete by detecting the free status of its temporary storage partition or based on at least one of the messages from the device, and proceed with subsequent operations accordingly. Therefore, parallel processing of the two copy operations is achieved, improving processing efficiency.
[0063] Additionally, if there is a fourth data block, in step S330-3, in response to the second data block being copied from the second temporary partition to the memory on the device side and the third data block being copied from the memory on the host side to the first temporary partition, the operation of copying the third data block from the first temporary partition to the memory on the device side (e.g., generating hardware instructions and sending hardware instructions to the device side) and the operation of copying the fourth data block from the plurality of data blocks to the second temporary partition are performed in parallel.
[0064] Similarly, if the second scratch partition is already free (i.e., the second data block has been completely copied from the second scratch partition to the memory on the device side), the fourth data block can be copied to the second scratch partition in parallel with the copying of the third data block from the first scratch partition to the memory on the second side, and so on.
[0065] In other words, the operations of sequentially copying the data blocks obtained from the data to be copied from the host's memory to one of the two temporary storage partitions (considered as the first execution process flow (i.e., the host execution process flow)) and the operations of sequentially copying the data blocks from the two temporary storage partitions to the device's memory (considered as the second execution process flow (i.e., the device execution process flow)) are parallel. Furthermore, the corresponding data block is only copied from a temporary storage partition after it has been completely copied to that partition. Additionally, a new data block can only be stored in that temporary storage partition after the corresponding data block has been completely copied out. Therefore, there may be a certain waiting time between operations in the first execution process flow, and similarly, there may be a certain waiting time between operations in the second execution process flow.
[0066] In other cases, it is necessary to copy memory data from the device to the host. Figure 5 A flowchart illustrating a data management method according to an embodiment of this application is shown. This method can be applied to... Figure 1A-1B or Figure 2 The device shown is used to copy memory data from the device to the host.
[0067] like Figure 5 As shown, in step S510, the data to be copied from the memory on the device side to the memory on the host side is determined, and the data to be copied is divided into multiple data blocks based on the preset size of the two temporary storage partitions of the temporary storage memory on the host side used for temporary storage of data.
[0068] Optionally, the allocation of temporary storage memory is performed on the host side. Therefore, for the device side, the preset size can be a default value or a stored value on the device side. Alternatively, in other cases, the device side can also obtain a message from the host side indicating that the host side's temporary storage memory has been divided into two temporary storage partitions with a preset size, thereby determining the preset size based on the message, and then using it to split the data to be copied.
[0069] In step S520, the plurality of data blocks are sequentially copied from the memory on the device side to the memory on the host side via the two temporary storage partitions, wherein: for each data block, when the data block is copied to one of the two temporary storage partitions and the other of the two temporary storage partitions is idle, in parallel with the copying of the data block from the one temporary storage partition on the host side to the memory on the host side, another data block is copied to the other temporary storage partition on the two temporary storage partitions.
[0070] For example, as mentioned above, in response to determining the existence of data blocks, i.e., the existence of data blocks into which the data to be copied is divided, the device can also use its DMA module to copy each data block sequentially to one of the two temporary storage partitions.
[0071] For example, when the data to be copied is divided into multiple data blocks, these blocks can be copied sequentially to temporary storage on the host. For instance, the first data block is copied to the first temporary storage section, and the second data block is copied to the second temporary storage section. After the first temporary storage section is idle (e.g., the first data block has been copied), the third data block can be copied to the first temporary storage section. Similarly, after the second temporary storage section is idle (e.g., the second data block has been copied), the fourth data block is copied to the second temporary storage section, and so on. For example, the host can send an indication message to the device indicating that the first temporary storage section is idle, or use other signaling methods to notify the device, so that the device can copy the third data block it obtained there to the host's first temporary storage section.
[0072] Optionally, for more details on the sequential copying process of multiple data blocks obtained from the data to be copied, please refer to [link / reference]. Figure 6 .
[0073] Figure 6 An embodiment according to this application is shown. Figure 5 The various sub-steps of step S520 shown.
[0074] In step S520-1, the first data block among the plurality of data blocks is copied to the first temporary partition among the two temporary partitions; and relative to the copying of the first data block from the first temporary partition on the host side to the memory on the host side, the second data block among the plurality of data blocks is copied in parallel to the second temporary partition among the two temporary partitions.
[0075] The copying of the first data block from the first temporary storage portion to the host's memory is actually a data copy from the host's non-swapable memory (temporary storage memory) to the swappable memory, which is performed internally on the host side.
[0076] Optionally, in some cases, after the first data block is temporarily stored in the first scratchpad partition on the host, the copying of the first data block from the first scratchpad partition to the host's memory is performed in response to the copying of the first data block to the first scratchpad partition and the copying of the second data block to the second scratchpad partition. Therefore, the parallel execution of "the second data block being copied to the second scratchpad partition" and "the first data block being copied from the first scratchpad partition on the host to the host's memory" in this step is in different execution flows, and there is a temporal order to their execution.
[0077] Of course, in other cases, it can also be referenced from the above. Figures 3-4 Similarly, the copying of a first data block from the first temporary partition on the host side to the host side's memory can be performed in response to the copying of the first data block to the first temporary partition (without needing to also respond to the copying of a second data block to the second temporary partition).
[0078] In step S520-2, in response to the first data block being copied from the first temporary partition to the host memory, the third data block among the plurality of data blocks is copied to the first temporary partition in parallel, relative to the copying of the second data block from the second temporary partition to the host memory.
[0079] As mentioned earlier, the host can send an indication message to the device indicating that the first temporary storage portion is free, or use other signaling methods to notify the device. This allows the device to copy the third data block, which it has segmented, to the host's first temporary storage portion. Alternatively, if the second data block is also fully stored in the second temporary storage partition, since they are in different execution flows, the host can also copy the second data block from the second temporary storage partition to the host's memory. This enables parallel processing of the two copy operations, improving processing efficiency.
[0080] Similarly, in step S520-3, when the second data block is copied from the second temporary storage partition to the host's memory (i.e., the second temporary storage partition is now free) and the third data block is copied from the device's memory to the first temporary storage partition (for example, the device can determine this based on messages sent by the host or by detecting the copy progress to the temporary storage partition), instead of copying the third data block from the first temporary storage partition to the host's memory, the fourth data block among the plurality of data blocks can be copied to the second temporary storage partition. If other data blocks exist subsequently, a similar operation is performed.
[0081] In other words, the operations of sequentially copying the data blocks obtained from the data to be copied from the device's memory to one of the two temporary storage partitions (considered as the first execution process flow (i.e., the host execution process flow)) and the operations of sequentially copying the data blocks from the two temporary storage partitions from the host's memory (swapable memory) (considered as the second execution process flow (i.e., the device execution process flow)) are parallel. Furthermore, the corresponding data block to be copied is only copied from a temporary storage partition after it has been completely copied to that partition. Additionally, a new data block can only be stored in that temporary storage partition after the corresponding data block has been completely copied out. Therefore, there may be a certain waiting time between the operations in the first execution process flow, and similarly, there may be a certain waiting time between the operations in the second execution process flow.
[0082] Figure 7 and Figure 8 Example process diagrams are shown for data interaction on the host and device sides, respectively. Figure 7 It involves copying data from the host's swappable memory to the device's memory, and Figure 8 This involves copying data from the device's memory to the host's swappable memory. Figure 7 and Figure 8 In this context, H2S (Host to Staging memory) represents a data copy operation from the host's swappable memory to the staging memory, S2D (Staging memory to Device) represents a data copy operation from the host's staging memory to the device's memory, D2S (Device to Staging memory) represents a data copy operation from the device's memory to the staging memory, and S2H (Staging memory to Host) represents a data copy operation from the host's staging memory to the host's swappable memory.
[0083] like Figure 7 As shown, the host can pre-allocate temporary memory, for example, by pre-allocating two fixed-size memory blocks during system startup, each serving as a temporary partition for temporarily storing data to be copied from the host. For example, each temporary partition could be 1 MB in size. Optionally, the host can also send information about the temporary memory (e.g., size or address) to the device.
[0084] Then, when the size of the data to be copied exceeds 1MB, the host can divide the data to be copied into multiple data blocks, and the size of each data block shall not exceed 1MB.
[0085] Next, parallel copy operations are performed: First, in the first execution process flow L1, the first data block is copied to the first temporary storage partition. Figure 7 The first temporary partition is represented as H2S (0-1), where 0 represents the first temporary partition and 1 represents the first data block. Hardware instructions are then generated and sent to the device. In the parallel second execution flow L2, the device uses the DMA module to copy the data from the first temporary partition to the device's memory. Figure 7 This is represented as S2D (0-1). On the device side, the DMA module is used to copy the data from the first temporary storage partition to the device's memory. Figure 7 When represented as S2D(0-1)), the copy operation from the second data block to the second temporary partition in the first execution process flow is performed in parallel (H2S(1-2), where 1 represents the second temporary partition and 2 represents the second data block).
[0086] Then, after the second data block has been copied to the second temporary partition ( Figure 7 When represented as H2S (1-2), in order to copy data from the second temporary partition to the device, the host can generate hardware instructions and send them to the device. This allows the device to use the DMA module to copy data from the second temporary partition to its memory during the parallel second execution process flow. Figure 7 This is represented as S2D(1-2)).
[0087] Similarly, on the device side, the DMA module is used to copy the data in the second temporary partition to the device's memory. Figure 7 When represented as S2D(1-2), the copy operation from the third data block in the first execution process flow to the first temporary partition is performed in parallel. Figure 7 This is represented as H2S(0-3), where 0 represents the first scratch partition and 3 represents the third data block. Furthermore, before copying the third data block to the first scratch partition, it is necessary to wait for the first scratch partition to become idle (e.g., wait for the data blocks of the first scratch partition to be completely copied to the device). This is because the DMA module is used on the device to copy the data from the first scratch partition to the device's memory. Figure 7 The operations S2D(0-1) and the copy operation from the second data block to the second temporary partition (H2S(1-2)) are performed in parallel, and some time has passed. Therefore, the waiting time for the first temporary partition to become idle (waiting for S2D(0-1)) will be very short, even negligible. It should be noted that the time span of each operation shown in the various figures is merely illustrative and does not limit the time span of each operation or the relative size relationship between them.
[0088] Then, after the third data block has been copied to the first temporary storage partition ( Figure 7When represented as H2S(0-3), the host can generate hardware instructions and send them to the device to copy data from the second temporary partition. Simultaneously, in the parallel second execution flow, the device waits until it receives the hardware instructions and can use the DMA module to copy the third data block from the first temporary partition to the device's memory. Figure 7 This is represented as S2D(0-3)).
[0089] Similarly, on the device side, the DMA module is used to copy the third data block from the first temporary storage partition to the device's memory. Figure 7 When represented as S2D(0-3), the copy operation from the fourth data block in the first execution process flow to the second temporary partition is performed in parallel. Figure 7 This is represented as H2S(1-4), where 1 represents the second scratch partition and 4 represents the fourth data block. Furthermore, before copying the fourth data block to the second scratch partition, it is necessary to wait for the second scratch partition to become free (e.g., wait for the data blocks of the second scratch partition to be completely copied to the device). This is because the second data block in the second scratch partition is copied to the device's memory using a DMA module on the device side. Figure 7 The operation of copying the third data block to the first temporary partition (H2S(0-3)) is parallel to S2D(1-2) and has been running for some time. Therefore, the waiting time for the second temporary partition to become idle (waiting time S2D(1-2)) will be very short, or even negligible.
[0090] Subsequent parallel copies are performed sequentially, with the same parallel copy operation executed on the remaining host-side data blocks. If a temporary partition is needed, the operation that previously used that partition (copying data from it) must be completed. However, since the two corresponding copy operations S2D and H2S are parallel operations, the waiting time for S2D in the second execution flow within the first execution flow is negligible, thus achieving efficient data transmission.
[0091] akin, Figure 8 This illustrates the copying of data from the device's memory to the host's swappable memory.
[0092] like Figure 8 As shown, the host can also pre-allocate temporary memory, for example, by allocating two fixed-size memory blocks at system startup, each serving as a temporary partition to temporarily store the data to be copied from the host. For example, each temporary partition could be 1 MB in size. Then, the host can send the relevant information about this temporary memory to the device, allowing the device to use it for subsequent data copying operations.
[0093] Then, when the size of the data to be copied exceeds 1MB, the device can divide the data to be copied into multiple data blocks, and the size of each data block shall not exceed 1MB.
[0094] Next, a parallel copy operation is performed: First, the device generates hardware instructions, and in the first execution process flow L1, the first data block is copied to the first temporary storage partition on the host side. Figure 8 In this representation, D2S (0-1), where 0 represents the first temporary partition and 1 represents the first data block, the second data block is copied to the second temporary partition on the host side. Figure 8 This is represented as D2S(1-2), where 1 represents the second temporary partition and 2 represents the second data block. Then, in the parallel second execution process flow L2, the host waits for the first data block to be copied to the host's first temporary partition, and then copies the data from the host's first temporary partition to the host's swappable memory through internal data exchange. Figure 8 This is represented as S2H (0-1). The data in the first temporary partition is copied to the host's swappable memory. Figure 8 When represented as S2H(0-1)), the copy operation from the second data block to the second temporary partition in the first execution process flow is performed in parallel (D2S(1-2), where 1 represents the second temporary partition and 2 represents the second data block). Alternatively, as mentioned above, if the host copies the first data block from the first temporary partition to the host's memory in response to the first data block being copied to the first temporary partition and the second data block being copied to the second temporary partition, then although it is a parallel execution process flow, Figure 8 The copy operation S2H (0-1) shown is performed after the copy operation D2S (1-2) in time. Furthermore, before performing the copy operation of the first data block from the first scratchpad partition to the swappable memory on the host side, it is necessary to wait for the first scratchpad partition to temporarily store the first data block. Figure 8 The first data block is represented as D2S(0-1). Since a copy operation (D2S(1-2)) was performed before the first data block was copied from the first temporary partition to the host's swappable memory, a period of time has already passed. Therefore, the waiting time will be very short and can even be ignored.
[0095] Similarly, when copying data from the second temporary partition to the host's swappable memory... Figure 8 When represented as S2H(1-2)), the copy operation from the third data block in the first execution process flow to the first temporary partition is performed in parallel. Figure 8This is represented as H2S(0-3), where 0 represents the first temporary partition and 3 represents the third data block. Furthermore, before copying data from the second temporary partition to the host's swappable memory, it is necessary to wait for the second temporary partition to temporarily store the second data block. This is because the copy operation from the second data block to the second temporary partition (D2S(1-2)) and the copy operation from the first temporary partition to the host's memory (…) are related. Figure 8 The two are represented as S2H(0-1) and are parallel. A period of time has passed, so the waiting time for storing the second data block in the second temporary partition (waiting for D2S(1-2)) will also be very short.
[0096] Similarly, in the first execution process flow, the host copies the third data block from the first temporary partition to the host's memory. Figure 7 When represented as S2H(0-3), the copy operation of the fourth data block to the second temporary partition is performed in parallel in the second execution process flow. Figure 7 This is represented as H2S(1-4), where 1 represents the second temporary partition and 4 represents the fourth data block. Furthermore, before copying the third data block to the host memory, it is necessary to wait for the third data block to be completely copied to the first temporary partition. This is because the copy operation from the third data block to the first temporary partition (D2S(0-3)) and the copy operation from the second data block in the second temporary partition to the host memory (D2S(0-3)) are related. Figure 8 The expression S2H(1-2) is parallel and a certain amount of time has passed. Therefore, the waiting time for storing the third data block in the first temporary partition (waiting for D2S(0-3)) will be very short, or even negligible.
[0097] Subsequent parallel copies are performed continuously, sequentially executing the same parallel copy operation on the remaining data blocks on the device. If a temporary partition is needed, it is necessary to wait for the previous operation that used the temporary partition (copying data to it) to complete. However, since the two corresponding copy operations S2H and D2S are parallel operations, the waiting time for D2S in the second execution process flow in the first execution process flow can be ignored, thus achieving efficient data transmission.
[0098] By parallelizing the data copying operations between the device and the host's swappable memory with the data copying operations between the host's swappable memory and the host's temporary storage, data copying efficiency can be improved and the requirements for the size of the temporary storage can be reduced. Specifically, for copying data from the host to the device, the copying operations from the host's temporary storage to the device's memory and from the host's swappable memory to the temporary storage are performed in parallel; for copying data from the device to the host, the data copying operations between the device's memory and the host's temporary storage are performed in parallel, as well as between the host's temporary storage and the host's swappable memory, thus achieving hardware and software parallelism.
[0099] According to another aspect of this application, a data management system is also provided. This data management system can have, for example... Figure 1A The architecture shown. (Reference) Figure 1A As shown, the data management system may include a host 110 and a device 120, and data can be copied between the memory of the host and the memory of the device.
[0100] For example, host 110 can allocate temporary memory on the host, which is divided into two temporary partitions of a preset size for temporary data storage.
[0101] When copying data from host 110 to device 120, host 110 can determine the data to be copied and divide the data to be copied into multiple data blocks based on the preset size of the temporary storage partition. Host 110 copies the multiple data blocks from the memory of host 110 to the memory of device 120 sequentially via two temporary storage partitions. For each data block, when the data block is copied to one of the two temporary storage partitions and the other temporary storage partition is idle, host 110 performs the operation of copying the data block from one temporary storage partition to the memory of device 120 and the operation of copying another data block to the other temporary storage partition in parallel.
[0102] In addition, when copying data from device 120 to host 110, host 110 sends a temporary memory instruction to device 120. Device 120 determines the data to be copied and, based on the instruction, segments the data to be copied to obtain multiple data blocks. Device 120 copies the multiple data blocks sequentially from device 120's memory to host 110's memory via two temporary partitions. For each data block, when the data block is copied to one of the two temporary partitions and the other temporary partition is idle, while host 110 copies the data block from one temporary partition to host memory, device 120 copies the other data block to the other temporary partition in parallel.
[0103] For more details on the above operations, please refer to the previous text. Figure 1A-1B as well as Figure 3-8 The description will not be repeated here.
[0104] By parallelizing data copying operations between the device and host's swappable memory and between the host's swappable memory and host's temporary storage, data copying efficiency is improved and the requirement for temporary storage size is reduced. Specifically, for data copying from the host to the device, copying operations from host's temporary storage to device's memory and from host's swappable memory to temporary storage are performed in parallel; for data copying from the device to the host, data copying operations from device's memory to host's temporary storage and from host's temporary storage to host's swappable memory are performed in parallel, thus achieving hardware and software parallelism.
[0105] It should be noted that the flowcharts and block diagrams in the accompanying drawings illustrate the architecture, functions, and operations of possible implementations of the methods and apparatus according to various embodiments of this application. In this regard, each block in a flowchart or block diagram may represent a module, program segment, or portion of code containing at least one executable instruction for implementing the specified logical function. It should also be noted that in some alternative implementations, the functions marked in the blocks may occur in a different order than those shown in the drawings. For example, two consecutively indicated blocks may actually be executed substantially in parallel, and they may sometimes be executed in reverse order, depending on the functions involved. It should also be noted that each block in the block diagrams and / or flowcharts, as well as combinations of blocks in the block diagrams and / or flowcharts, or the various modules mentioned, can be implemented using a dedicated hardware-based system that performs the specified function or operation, or using a combination of dedicated hardware and computer instructions.
[0106] In this application, the terms "first" and "second," etc., are used only to distinguish various elements and do not indicate any order, importance, or priority.
[0107] Even if a particular combination of features is defined in the claims and / or disclosed in the specification, such combinations are not intended to limit the disclosure of aspects. In fact, many of these features can be combined in ways that are not defined in the claims and / or disclosed in the specification. Although each dependent claim listed below may directly depend on only one claim, the disclosure of aspects includes every dependent claim in combination with every other claim in the claim set.
[0108] The embodiments of this application described in detail above are merely illustrative and not restrictive. Those skilled in the art should understand that various modifications and combinations can be made to these embodiments or their features without departing from the principles and spirit of this application, and such modifications should fall within the scope of this application.
Claims
1. A data management method, applied to a host side, comprising: Allocate temporary storage memory on the host side, and divide the temporary storage memory into two temporary storage partitions of a preset size for temporary data storage; The data to be copied from the host's memory to the device's memory is determined, and the data to be copied is divided into multiple data blocks based on the preset size, wherein the size of each data block does not exceed the preset size, and wherein the data to be copied includes data on the host's swappable memory, and the temporary storage memory is the host's non-swappable memory. as well as The plurality of data blocks are copied sequentially from the host-side memory to the device-side memory via the two temporary storage partitions, wherein: For each data block, while the data block is copied to one of the two temporary storage partitions and the other temporary storage partition is idle, the operations of copying the data block from one temporary storage partition to the device's memory using the device's direct memory access module and copying another data block from the host's swappable memory to the other temporary storage partition are performed in parallel, wherein copying the other data block from the swappable memory to the other temporary storage partition does not require the use of the direct memory access module. Specifically, for each of the two temporary partitions, copying data blocks from the corresponding temporary partition only begins when the data blocks have been completely copied to that partition, and copying new data blocks to the corresponding temporary partition only begins when the data blocks have been completely copied out of that partition. The host generates a hardware instruction in response to the data block being copied to the corresponding temporary partition and sends the hardware instruction to the device, causing the device to access the corresponding temporary partition of the host. The host determines whether the data block has been completely copied from the corresponding temporary partition by detecting the idle state of each of the two temporary partitions or based on at least one of the messages from the device.
2. The method according to claim 1, wherein, Copying the plurality of data blocks sequentially from the host-side memory to the device-side memory via the two temporary storage partitions includes: Copy the first data block from the plurality of data blocks to the first temporary partition of the two temporary partitions; and The operations of copying the first data block from the first temporary storage partition to the memory on the device side and copying the second data block from the swappable memory on the host side to the second temporary storage partition of the two temporary storage partitions are performed in parallel.
3. The data management method according to claim 2, wherein, Copying the plurality of data blocks sequentially from the host-side memory to the device-side memory via the two temporary storage partitions further includes: In response to the first data block being copied from the first temporary partition to the memory on the device side, the operation of copying the second data block from the second temporary partition to the memory on the device side and the operation of copying the third data block from the swappable memory on the host side to the first temporary partition are performed in parallel.
4. The data management method according to claim 3, wherein, Copying the plurality of data blocks sequentially from the host-side memory to the device-side memory via the two temporary storage partitions further includes: In response to the second data block being copied from the second scratchpad partition to the memory on the device side and the third data block being copied from the memory on the host side to the first scratchpad partition, the operation of copying the third data block from the first scratchpad partition to the memory on the device side and the operation of copying the fourth data block of the plurality of data blocks from the swappable memory on the host side to the second scratchpad partition are performed in parallel.
5. The data management method according to claim 2, wherein, The operation of copying the first data block from the first temporary storage partition to the memory on the device side includes: In response to the first data block being copied to the first temporary partition, an indication message is generated and sent to the device, enabling the device to access the first temporary partition using its direct memory access module to copy the first data block. The indicated information is the hardware instruction.
6. The data management method according to claim 1, wherein, The host device includes a central processing unit, and the device includes an artificial intelligence chip.
7. A data management method, applied to a device, comprising: The system determines the data to be copied from the device's memory to the host's memory, and divides the data to be copied into multiple data blocks based on a preset size of two temporary storage partitions in the host's temporary storage memory. Each data block's size does not exceed the preset size, and the temporary storage memory serves as the host's non-swapable memory. The plurality of data blocks are copied sequentially from the device's memory to the host's memory via the two temporary storage partitions, wherein: For each data block, when the data block is copied to one of the two temporary partitions and the other temporary partition is idle, in parallel with the copying of the data block from the one temporary partition on the host to the swappable memory on the host, another data block is copied to the other temporary partition using the device's direct memory access module, wherein copying the data block from the one temporary partition to the swappable memory does not require the use of the direct memory access module. Specifically, for each of the two temporary partitions, copying data blocks from the corresponding temporary partition only begins when the data blocks have been completely copied to that partition, and copying new data blocks to the corresponding temporary partition only begins when the data blocks have been completely copied out of that partition. The device generates hardware instructions to copy data blocks to the corresponding temporary storage partitions on the host side, and the device determines whether the data blocks have been completely copied from the corresponding temporary storage partitions based on a message from the host side indicating the idle status of each of the two temporary storage partitions.
8. The method according to claim 7, wherein, Copying the plurality of data blocks sequentially from the device's memory to the host's memory via the two temporary storage partitions includes: Copy the first data block from the plurality of data blocks to the first temporary partition of the two temporary partitions; and In parallel, the second data block from the plurality of data blocks is copied from the first temporary storage partition on the host to the swappable memory on the host.
9. The data management method according to claim 8, wherein, The copying of the first data block from the first scratch partition on the host to the swappable memory on the host is performed in response to the first data block being copied to the first scratch partition and the second data block being copied to the second scratch partition.
10. The data management method according to claim 8, wherein copying the plurality of data blocks sequentially from the memory on the device side to the memory on the host side via the two temporary storage partitions further includes: In response to the first data block being copied from the first scratch partition to the host memory, a third data block from the plurality of data blocks is copied to the first scratch partition in parallel, relative to the second data block being copied from the second scratch partition to the host swappable memory.
11. The data management method according to claim 10, wherein, Copying the plurality of data blocks sequentially from the device's memory to the host's memory via the two temporary storage partitions further includes: In response to the second data block being copied from the second scratchpad partition to the host-side memory and the third data block being copied from the device-side memory to the first scratchpad partition, a fourth data block of the plurality of data blocks is copied to the second scratchpad partition in parallel, relative to the operation of copying the third data block from the first scratchpad partition to the host-side swappable memory.
12. The data management method according to claim 7, further comprising: Obtain a message from the host indicating that the host's temporary memory has been divided into two temporary partitions of a preset size.
13. The data management method according to claim 8, wherein, Copying the first data block from the plurality of data blocks to the first temporary partition of the two temporary partitions includes: In response to determining the existence of the first data block, the direct memory access module is used to access the first temporary partition on the host side to copy the first data block to the first temporary partition.
14. The data management method according to claim 7, wherein, The host device includes a central processing unit (CPU), and the device includes an artificial intelligence chip.
15. A data management system, comprising a host terminal and a device terminal, wherein, The host allocates temporary storage memory, which is divided into two temporary storage partitions of a preset size for temporary data storage. In the case of copying data from the host to the device: The host determines the data to be copied and divides the data to be copied into multiple data blocks based on the preset size, wherein the size of each data block does not exceed the preset size, and wherein the data to be copied includes data on the host's swappable memory, and the temporary storage memory serves as the host's non-swappable memory. as well as The host machine copies the multiple data blocks sequentially from its own memory to the device's memory via the two temporary storage partitions, wherein: For each data block, when the data block is copied to one of the two temporary partitions and the other temporary partition is idle, the host performs in parallel the operations of copying the data block from one temporary partition to the device's memory using the device's direct memory access module and copying the other data block from the host's swappable memory to the other temporary partition, wherein copying the other data block from the swappable memory to the other temporary partition does not require the use of the direct memory access module. Specifically, for each temporary partition, data blocks are only copied from that partition after all data blocks have been completely copied to it, and new data blocks are only copied to that partition after all data blocks have been completely copied out of it. The host generates a hardware instruction in response to the data block being copied to the corresponding temporary partition and sends the hardware instruction to the device, causing the device to access the corresponding temporary partition of the host. The host determines whether the data block has been completely copied from the temporary partition by detecting the idle state of each temporary partition or based on at least one of the messages from the device.
16. The data management system according to claim 15, wherein, In the case of copying data from the device to the host: The host sends an instruction message to the device indicating the temporary memory; The device determines the data to be copied and divides the data to be copied into multiple data blocks based on the preset size, wherein the size of each data block does not exceed the preset size, and wherein the temporary storage memory serves as the non-swapable memory of the host. The device copies the plurality of data blocks sequentially from the device's memory to the host's memory via the two temporary storage partitions, wherein: For each data block, when the data block is copied to one of the two temporary partitions and the other temporary partition is free, the device concurrently copies another data block to the other temporary partition using its direct memory access module, in contrast to the host copying the data block from one temporary partition to the host's swappable memory. The operation of copying the data block from one temporary partition to the swappable memory does not require the use of a direct memory access module. Specifically, for each of the two temporary partitions, copying data blocks from the corresponding temporary partition only begins when the data blocks have been completely copied to that partition, and copying new data blocks to the corresponding temporary partition only begins when the data blocks have been completely copied out of that partition. The device generates hardware instructions to copy data blocks to the corresponding temporary storage partitions on the host side, and the device determines whether the data blocks have been completely copied from the corresponding temporary storage partitions based on a message from the host side indicating the idle status of each of the two temporary storage partitions.
17. A computing device, comprising: One or more processors; as well as One or more memories having computer-readable instructions stored thereon, the computer-readable instructions being executed by the one or more processors according to any one of claims 1-14.
Citation Information
Patent Citations
Optimizing data transfers between heterogeneous memory arenas
US20140223131A1