Method and device for accelerating memory operation
By detecting the size of the memory operation and deciding whether to offload it to the memory device, and generating appropriate instructions for asynchronous or synchronous execution, it solves the problem of existing technology relying on dedicated hardware and complexity, improves the speed and effect of memory operations, and achieves more efficiency. system execution.
Patent Information
- Application Number
- CN202410883132.7
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-07-02
- Publication Date
- 2024-09-27
AI Technical Summary
Existing Intel I/OAT and DSA acceleration technologies rely on dedicated hardware, are complex to use and are opaque to applications, resulting in limited use in general applications, and cannot effectively improve the speed and effect of memory operations.
By detecting the size of the memory operation, deciding whether to offload it to the memory device, and generating corresponding instructions for asynchronous or synchronous execution, the processing mode of the memory operation is optimized to improve efficiency.
It improves the speed and effect of memory operations, reduces the consumption of CPU cycles, enhances the execution efficiency of the system, and provides a more transparent way to accelerate memory operations.
Smart Images

Figure CN118708243A
Abstract
Description
Technical Field
[0001] The present disclosure relates to the field of computer technology, and more specifically, to a method and device for accelerating memory operations. Background Art
[0002] Intel I / O Acceleration Technology ( I / O Acceleration Technology (Intel I / OAT or I / OAT for short) was introduced to servers in 2006. In the 5100 series processors, it consists of a DMA engine in the chipset that is identified, programmed, and operated in the same way as the DMA engine in a PCIe-attached device. I / OAT offloads memory copies (memcpy) to a dedicated chip in asynchronous mode by submitting a request descriptor to the dedicated chip and waiting for an interrupt to return after the memory copy (memcpy) operation is completed. I / OAT can effectively save CPU cycles, but its use in general applications is limited due to its small feature set, high offload cost, and limited programmability.
[0003] Intel Data Streaming Accelerator (DSA) is the fourth generation A high-performance data copy and conversion accelerator native to the scalable processor. DSA not only supports conventional data operations, such as memory copy (memcpy), memory fill, and memory comparison, but also supports advanced conversion operations on memory, such as generating and testing cyclic redundancy checks (CRC). DSA not only provides better processing efficiency and practicality, but also has greater versatility.
[0004] First, both I / OAT and DSA rely on dedicated hardware. Specifically, I / OAT relies on a dedicated DMA engine on the chipset, while DSA is an accelerator integrated into Intel's latest Sapphire Rapids (SPR) Xeon processors.
[0005] Secondly, both I / OAT and DSA are not transparent to applications. When using I / OAT to accelerate memory copy (memcpy), users need to modify the source code of the application. When using DSA to accelerate memory copy (memcpy) and memory setting (memset), users need to use a specific library (libaccel-config library) to determine and configure DSA resources, and then manually link the library. Summary of the invention
[0006] An exemplary embodiment of the present disclosure is to provide a method and apparatus for accelerating memory operations, so as to improve the speed and effect of accelerating memory operations.
[0007] According to an exemplary embodiment of the present disclosure, a method for accelerating memory operations is provided, comprising: in response to detecting a memory operation, determining to offload the memory operation to a memory device based on a memory size of the memory operation; generating an instruction corresponding to the memory operation; sending the instruction corresponding to the memory operation to the memory device; and receiving an execution result of the memory operation from the memory device.
[0008] Optionally, the memory operation may include a compute quick link memory operation, and the memory device may include a compute quick link memory device.
[0009] Optionally, unloading the memory operation to a memory device based on the memory size of the memory operation may include: determining whether the memory size of the memory operation is greater than a first threshold; and unloading the memory operation to a memory device based on the memory size of the memory operation being greater than the first threshold.
[0010] Optionally, the method may further include: determining not to offload the memory operation to a memory device based on a memory size of the memory operation being equal to or smaller than a first threshold.
[0011] Optionally, the generating of the instruction corresponding to the memory operation may include: based on the batch processing flag corresponding to the memory operation being a first flag, determining that the memory operation is to be batch processed, and generating a first processing instruction corresponding to the memory operation; based on the batch processing flag corresponding to the memory operation being a second flag, determining that the memory operation is not to be batch processed, and generating a second processing instruction corresponding to the memory operation; and generating an unload mode flag corresponding to the memory operation.
[0012] Optionally, generating an unload mode flag corresponding to the memory operation may include: determining whether a memory size of the memory operation is greater than a second threshold; based on the memory size of the memory operation being greater than the second threshold, determining to adopt a first unload mode when unloading the memory operation to the memory device, and generating a first unload mode flag corresponding to the memory operation; based on the memory size of the memory operation being equal to or less than the second threshold, determining to adopt a second unload mode when unloading the memory operation to the memory device, and generating a second unload mode flag corresponding to the memory operation.
[0013] Optionally, sending the instruction corresponding to the memory operation to the memory device may include: based on the batch processing flag corresponding to the memory operation being a first flag, sending a first processing instruction and the unload mode flag to the memory device; based on the batch processing flag corresponding to the memory operation being a second flag, sending a second processing instruction and the unload mode flag to the memory device.
[0014] According to an exemplary embodiment of the present disclosure, a method for accelerating memory operations is provided, comprising: receiving an instruction corresponding to a memory operation from a central processing unit; executing the memory operation in an asynchronous mode to obtain an execution result of the memory operation based on the instruction corresponding to the memory operation including a first unload mode flag; executing the memory operation in a synchronous mode to obtain an execution result of the memory operation based on the instruction corresponding to the memory operation including a second unload mode flag; and sending the execution result of the memory operation to the central processing unit.
[0015] Optionally, the method may further include: decoding instructions corresponding to the memory operation to obtain decoded instructions of the memory operation, wherein executing the memory operation in asynchronous mode includes: executing the decoded instructions of the memory operation in asynchronous mode, wherein executing the memory operation in synchronous mode includes: executing the decoded instructions of the memory operation in synchronous mode.
[0016] Optionally, the decoding of the instructions corresponding to the memory operation may include: based on the instructions corresponding to the memory operation including a first processing instruction, batch processing the first processing instruction to obtain the encoded instruction of the memory operation; decoding the encoded instruction of the memory operation to obtain the decoded instruction of the memory operation.
[0017] Optionally, decoding the instruction corresponding to the memory operation may include: based on the instruction corresponding to the memory operation including a second processing instruction, decoding the second processing instruction to obtain a decoded instruction of the memory operation.
[0018] Optionally, the memory operation may include a compute quick link memory operation, and the memory device may include a compute quick link memory device.
[0019] According to an exemplary embodiment of the present disclosure, a method for evaluating the acceleration of memory operations of a system is provided, wherein the system uses the method for accelerating memory operations based on the present disclosure, and the evaluation method comprises: determining a first proportion of the execution time of a system function to the total execution time of the system, and a second proportion of the execution time of an accelerated function to the total execution time of the system functions; obtaining a frequency coefficient of a central processing unit, system memory pressure, and an acceleration coefficient of the accelerated function; determining a third proportion based on the first proportion, the second proportion, and the acceleration coefficient of the accelerated function; and determining the product of the frequency coefficient of the central processing unit, the system memory pressure, and the third proportion as the acceleration ratio of the memory operations of the system.
[0020] Optionally, the memory operation includes a memory copy operation and / or a memory setting operation.
[0021] Optionally, Among them, ratio sys_func Indicates the first ratio, ratio mem_op represents the second ratio, ∝ represents the acceleration coefficient of the accelerated function, t ori_mem_op =t ori -t ori_other , t acc_mem_op =t acc -t acc_other , t acc_other =t ori_other Among them, t ori_mem_op Indicates the execution time of the accelerated function before acceleration, t ori represents the total execution time of the system before acceleration, t ori_other represents the execution time outside the accelerated function before acceleration, t acc_mem_op Represents the execution time of the accelerated function after acceleration, t acc Represents the total execution time of the system after acceleration, t acc_other Execution time outside the accelerated function before acceleration, ratio sys_func ∈[0,1), ratio mem_op ∈[0,1).
[0022] According to an exemplary embodiment of the present disclosure, there is provided an apparatus for accelerating memory operations, comprising: an offload determination unit, configured to, in response to detecting a memory operation, determine to offload the memory operation to a memory device based on a memory size of the memory operation; an instruction generation unit, configured to generate an instruction corresponding to the memory operation; an instruction sending unit, configured to send the instruction corresponding to the memory operation to the memory device; and a result receiving unit, configured to receive an execution result of the memory operation from the memory device.
[0023] Optionally, the memory operation may include a compute quick link memory operation, and the memory device may include a compute quick link memory device.
[0024] Optionally, the offloading determination unit may be configured to: determine whether a memory size of the memory operation is greater than a first threshold; and offload the memory operation to a memory device based on the memory size of the memory operation being greater than the first threshold.
[0025] Optionally, the apparatus may further include: a determination and maintenance unit configured to determine not to offload the memory operation to the memory device based on the memory size of the memory operation being equal to or less than a first threshold.
[0026] Optionally, the instruction generation unit can be configured to: determine to batch process the memory operation based on that the batch flag corresponding to the memory operation is a first flag, and generate a first processing instruction corresponding to the memory operation; determine not to batch process the memory operation based on that the batch flag corresponding to the memory operation is a second flag, and generate a second processing instruction corresponding to the memory operation; and generate an unload mode flag corresponding to the memory operation.
[0027] Optionally, the instruction generation unit can also be configured to: determine whether the memory size of the memory operation is greater than a second threshold; based on the memory size of the memory operation being greater than the second threshold, determine to adopt a first unloading mode when unloading the memory operation to the memory device, and generate a first unloading mode flag corresponding to the memory operation; based on the memory size of the memory operation being equal to or less than the second threshold, determine to adopt a second unloading mode when unloading the memory operation to the memory device, and generate a second unloading mode flag corresponding to the memory operation.
[0028] Optionally, the instruction sending unit may be configured to: send a first processing instruction and the unload mode flag to the memory device based on the batch processing flag corresponding to the memory operation being a first flag; and send a second processing instruction and the unload mode flag to the memory device based on the batch processing flag corresponding to the memory operation being a second flag.
[0029] According to an exemplary embodiment of the present disclosure, there is provided a device for accelerating memory operations, comprising: an instruction receiving unit, configured to receive instructions corresponding to memory operations from a central processing unit; an asynchronous execution unit, configured to perform asynchronous mode execution on the memory operations based on the instructions corresponding to the memory operations including a first unload mode flag, and obtain an execution result of the memory operations; a synchronous execution unit, configured to perform synchronous mode execution on the memory operations based on the instructions corresponding to the memory operations including a second unload mode flag, and obtain an execution result of the memory operations; and a result sending unit, configured to send the execution result of the memory operations to the central processing unit.
[0030] Optionally, the device may also include: an instruction decoding unit, configured to decode the instruction corresponding to the memory operation to obtain the decoded instruction of the memory operation, wherein the asynchronous execution unit is configured to: execute the decoded instruction of the memory operation in asynchronous mode, wherein the synchronous execution unit is configured to: execute the decoded instruction of the memory operation in synchronous mode.
[0031] Optionally, the instruction decoding unit may also be configured to: based on the fact that the instructions corresponding to the memory operation include first processing instructions, batch process the first processing instructions to obtain encoded instructions for the memory operation; and decode the encoded instructions for the memory operation to obtain decoded instructions for the memory operation.
[0032] Optionally, the instruction decoding unit may be further configured to: based on the instruction corresponding to the memory operation including a second processing instruction, decode the second processing instruction to obtain a decoded instruction of the memory operation.
[0033] Optionally, the memory operation may include a compute quick link memory operation, and the memory device may include a compute quick link memory device.
[0034] According to an exemplary embodiment of the present disclosure, there is provided an evaluation device for accelerating the memory operation of a system, wherein the system uses the method for accelerating the memory operation based on the present disclosure, and the evaluation device comprises: a ratio determination unit, configured to determine a first ratio of the execution time of a system function to the total execution time of the system, and a second ratio of the execution time of an accelerated function to the total execution time of the system function; a parameter acquisition unit, configured to acquire a frequency coefficient of a central processing unit, system memory pressure, and an acceleration coefficient of the accelerated function; an intermediate ratio determination unit, configured to determine a third ratio based on the first ratio, the second ratio, and the acceleration coefficient of the accelerated function; and an acceleration ratio determination unit, configured to determine the product of the frequency coefficient of the central processing unit, the system memory pressure, and the third ratio as the acceleration ratio of the memory operation of the system.
[0035] Optionally, the memory operation may include a memory copy operation and / or a memory setting operation.
[0036] Optionally, Among them, ratio sys_func Indicates the first ratio, ratio mem_op represents the second ratio, ∝ represents the acceleration coefficient of the accelerated function, t ori_mem_op =t ori -t ori_other , t acc_mem_op =t acc -t acc_other , t acc_other =t ori_other Among them, t ori_mem_op Indicates the execution time of the accelerated function before acceleration, t ori represents the total execution time of the system before acceleration, t ori_other represents the execution time outside the accelerated function before acceleration, t acc_mem_op Represents the execution time of the accelerated function after acceleration, t acc Represents the total execution time of the system after acceleration, t acc_other Execution time outside the accelerated function before acceleration, ratio sys_func ∈[0,1), ratio mem_op ∈[0,1).
[0037] According to an exemplary embodiment of the present disclosure, a computer-readable storage medium is provided, on which a computer program is stored. When the computer program is executed by a processor, the method for accelerating memory operation according to the exemplary embodiment of the present disclosure is implemented.
[0038] According to an exemplary embodiment of the present disclosure, a computing device is provided, including: at least one processor; and at least one memory storing a computer program, wherein when the computer program is executed by the at least one processor, a method for accelerating memory operations according to an exemplary embodiment of the present disclosure is implemented.
[0039] According to an exemplary embodiment of the present disclosure, a computer program product is provided, and instructions in the computer program product can be executed by a processor of a computer device to implement the method for accelerating memory operations according to an exemplary embodiment of the present disclosure.
[0040] According to the method and apparatus for accelerating memory operations of the exemplary embodiments of the present disclosure, in response to detecting a memory operation, determining to offload the memory operation to a memory device based on the memory size of the memory operation, generating instructions corresponding to the memory operation, sending the instructions corresponding to the memory operation to the memory device, and receiving the execution result of the memory operation from the memory device, the speed and effect of accelerating the memory operation are improved.
[0041] According to the method and device for accelerating memory operations of the exemplary embodiments of the present disclosure, instructions corresponding to memory operations are received from a central processing unit, and based on the instructions corresponding to the memory operations including a first unload mode flag, the memory operations are executed in an asynchronous mode to obtain an execution result of the memory operations, and based on the instructions corresponding to the memory operations including a second unload mode flag, the memory operations are executed in a synchronous mode to obtain an execution result of the memory operations, and the execution result of the memory operations is sent to the central processing unit, thereby improving the speed and effect of accelerating memory operations.
[0042] According to the exemplary embodiments of the present disclosure, an evaluation method and device for acceleration of memory operations of a system are provided. By determining a first proportion of the execution time of a system function to the total execution time of the system and a second proportion of the execution time of an accelerated function to the total execution time of the system functions, the frequency coefficient of the central processing unit, the system memory pressure, and the acceleration coefficient of the accelerated function are obtained. Based on the first proportion, the second proportion, and the acceleration coefficient of the accelerated function, a third proportion is determined. The product of the frequency coefficient of the central processing unit, the system memory pressure, and the third proportion is determined as the acceleration ratio of the memory operations of the system, thereby achieving an evaluation of the acceleration of the memory operations of the system through the acceleration ratio of the memory operations of the system.
[0043] Additional aspects and / or advantages of the present general inventive concept will be set forth in part in the following description and in part will be apparent from the description or may be learned through practice of the present general inventive concept. BRIEF DESCRIPTION OF THE DRAWINGS
[0044] The above and other objects and features of the exemplary embodiments of the present disclosure will become more apparent through the following description in conjunction with the accompanying drawings which exemplarily illustrate the embodiments, in which:
[0045] Figure 1 A flowchart showing a method of accelerating memory operations according to an exemplary embodiment of the present disclosure;
[0046] Figure 2 A flowchart of a method for accelerating memory operation according to an exemplary embodiment of the present disclosure is provided;
[0047] Figure 3 A flowchart of a method for evaluating acceleration of a memory operation of a system according to an exemplary embodiment of the present disclosure is provided;
[0048] Figure 4 A block diagram showing an apparatus for accelerating memory operations according to an exemplary embodiment of the present disclosure;
[0049] Figure 5 A block diagram showing an apparatus for accelerating memory operations according to an exemplary embodiment of the present disclosure;
[0050] Figure 6 A block diagram showing an evaluation device for accelerating memory operations of a system according to an exemplary embodiment of the present disclosure;
[0051] Figure 7 A schematic diagram showing a system including a central processing unit and a computing fast link memory device according to an exemplary embodiment of the present disclosure; and
[0052] Figure 8 A schematic diagram illustrating a computing device according to an exemplary embodiment of the present disclosure. DETAILED DESCRIPTION
[0053] Reference will now be made in detail to exemplary embodiments of the present disclosure, examples of which are shown in the accompanying drawings, wherein like reference numerals refer to like parts throughout. The embodiments will be described below with reference to the drawings in order to explain the present disclosure.
[0054] Figure 1 A flow chart showing a method of accelerating memory operations according to an exemplary embodiment of the present disclosure. Figure 1 The method for accelerating memory operations may be executed by a central processing unit (CPU).
[0055] Reference Figure 1 In step S101, in response to detecting a memory operation, determining to offload the memory operation to a memory device based on a memory size of the memory operation.
[0056] In an exemplary embodiment of the present disclosure, the memory operation may include a computing fast link memory operation, and the memory device includes a computing fast link memory device, thereby improving the speed of the memory operation by computing fast link memory operation and computing fast link memory device.
[0057] In an exemplary embodiment of the present disclosure, offloading the memory operation to a memory device based on the memory size of the memory operation may include: determining whether the memory size of the memory operation is greater than a first threshold; and offloading the memory operation to a memory device based on the memory size of the memory operation being greater than the first threshold. In an exemplary embodiment of the present disclosure, it also includes: determining not to offload the memory operation to a memory device based on the memory size of the memory operation being equal to or less than the first threshold. In this way, the execution efficiency of the system function can be maximized. The first threshold is a threshold of the memory size, which may be, for example, mem_offload_threshold. The first threshold may be set by a user or other external device. If the memory size of the memory operation>mem_offload_threshold, the memory operation is offloaded to a memory device (e.g., a fast link memory device is calculated); if the memory size of the memory operation<=mem_offload_threshold, it is executed on a central processor, and the memory operation is not offloaded to a memory device (e.g., a fast link memory device is calculated).
[0058] In step S102, an instruction corresponding to the memory operation is generated.
[0059] In an exemplary embodiment of the present disclosure, generating an instruction corresponding to the memory operation may include: determining to batch process the memory operation based on that the batch flag corresponding to the memory operation is a first flag, and generating a first processing instruction corresponding to the memory operation; determining not to batch process the memory operation based on that the batch flag corresponding to the memory operation is a second flag, and generating a second processing instruction corresponding to the memory operation; generating an unload mode flag corresponding to the memory operation. In this way, it is determined whether to batch process the memory operation (e.g., computing fast link memory operation) according to the batch flag, thereby minimizing the overhead of unloading memory operation. Here, the batch flag can be set by a user or other external device. The batch flag can be, for example, mem_batch_flag. If mem_batch_flag is set to true (true), the central processor first generates a batch instruction and sends the batch instruction to a memory device (e.g., computing fast link memory device); then the memory device (e.g., computing fast link memory device) performs batch processing to generate a non-batch instruction (also referred to as an ordinary instruction in this article), and then decodes the non-batch instruction (ordinary instruction). If mem_batch_flag is set to false, the central processing unit first generates a normal instruction and sends the normal instruction to a memory device (eg, a computing fast link memory device), and then the memory device (eg, the computing fast link memory device) directly decodes the normal instruction.
[0060] In an exemplary embodiment of the present disclosure, generating an unload mode flag corresponding to the memory operation may include: determining whether the memory size of the memory operation is greater than a second threshold; based on the memory size of the memory operation being greater than the second threshold, determining to adopt a first unload mode (e.g., asynchronous mode) when unloading the memory operation to the memory device, and generating a first unload mode flag corresponding to the memory operation; based on the memory size of the memory operation being equal to or less than the second threshold, determining to adopt a second unload mode (e.g., synchronous mode) when unloading the memory operation to the memory device, and generating a second unload mode flag corresponding to the memory operation. In this way, whether to adopt a synchronous mode or an asynchronous mode when unloading the memory operation to a memory device (e.g., a computing fast link memory device) is determined according to the memory size of the memory operation, thereby maximally saving the resources of the central processing unit. Here, the second threshold is another threshold of the memory size, which may be, for example, mem_mode_threshold. The second threshold may be set by a user or other external device. If the memory size>mem_mode_threshold, the asynchronous mode is used. If the memory size<=mem_mode_threshold, the synchronous mode is used.
[0061] For dynamic random access memory (DRAM) and memory devices (eg, compute fast link memory devices), the performance of memory operations is linearly related to the memory size of the memory operation.
[0062] When the memory size of the memory operation is small, the performance difference of the system functions involving DRAM and memory devices is not much, and they spend much more time on other logic than memory operations, so the acceleration brought by the scheme of accelerating memory operations may not be large. Therefore, whether to offload the memory operation can be determined according to the memory size. The first threshold of the memory size (e.g., mem_offload_threshold) can be set to different values on different operating systems.
[0063] When the memory size of the memory operation is large, the memory operation is offloaded to a memory device (e.g., a computing fast link memory device). If the synchronous mode is used completely, the CPU resources are wasted waiting for the result to return; but if the asynchronous mode is used completely, the context switching overhead introduced by the asynchronous mode is also relatively large. Therefore, the synchronous mode or the asynchronous mode can be determined according to the memory size. The second threshold of the memory size (e.g., mem_mode_threshold) can be set to different values on different operating systems.
[0064] In step S103, an instruction corresponding to the memory operation is sent to the memory device.
[0065] In an exemplary embodiment of the present disclosure, sending the instruction corresponding to the memory operation to the memory device may include: sending a first processing instruction and the unload mode flag to the memory device based on the batch processing flag corresponding to the memory operation being a first flag; sending a second processing instruction and the unload mode flag to the memory device based on the batch processing flag corresponding to the memory operation being a second flag. In this way, the batch processing instruction or the normal instruction is sent, so that the memory device performs the memory operation.
[0066] In step S104, the execution result of the memory operation is received from the memory device.
[0067] Figure 2 A flowchart of a method for accelerating memory operations according to an exemplary embodiment of the present disclosure is shown. Figure 2 The method for accelerating memory operations may be executed by a memory device, or may be executed by a memory operation accelerator in a memory device.
[0068] Reference Figure 2 , in step S201, an instruction corresponding to a memory operation is received from a central processing unit.
[0069] In an exemplary embodiment of the present disclosure, after step S201, the method may further include: decoding an instruction corresponding to the memory operation to obtain a decoded instruction of the memory operation, thereby decoding the received instruction to execute the decoded instruction.
[0070] In an exemplary embodiment of the present disclosure, decoding the instruction corresponding to the memory operation may include: based on the instruction corresponding to the memory operation including the first processing instruction, batch processing the first processing instruction to obtain the encoded instruction of the memory operation; decoding the encoded instruction of the memory operation to obtain the decoded instruction of the memory operation. In this way, whether to perform batch processing is determined according to whether the central processor performs batch processing, thereby improving the execution speed of the memory device.
[0071] In an exemplary embodiment of the present disclosure, decoding the instruction corresponding to the memory operation may include: based on the instruction corresponding to the memory operation including the second processing instruction, decoding the second processing instruction to obtain the decoded instruction of the memory operation. In this way, whether to perform batch processing is determined based on whether the central processor performs batch processing, thereby improving the execution speed of the memory device.
[0072] In an exemplary embodiment of the present disclosure, the memory operation may include a compute fast link memory operation, and the memory device may include a compute fast link memory device. For example, the memory operation may be, for example, but not limited to, a compute fast link memory operation, and the memory device may be, for example, but not limited to, a compute fast link memory device.
[0073] In step S202, based on the fact that the instruction corresponding to the memory operation includes a first offload mode flag, the memory operation is executed in an asynchronous mode to obtain an execution result of the memory operation.
[0074] In an exemplary embodiment of the present disclosure, executing the memory operation in an asynchronous mode may include: executing a decoded instruction of the memory operation in an asynchronous mode, thereby executing the decoded instruction.
[0075] In step S203, based on the fact that the instruction corresponding to the memory operation includes a second unloading mode flag, the memory operation is executed in a synchronous mode to obtain an execution result of the memory operation.
[0076] In an exemplary embodiment of the present disclosure, performing synchronous mode execution on the memory operation may include: performing synchronous mode execution on a decoded instruction of the memory operation, thereby executing the decoded instruction.
[0077] In step S204, the execution result of the memory operation is sent to the central processor, thereby accelerating the memory operation. Based on the offload mode flag determined by the central processor according to the memory size of the memory operation, it is determined whether to use the synchronous mode or the asynchronous mode when offloading the memory operation to the memory device, thereby minimizing the overhead of offloading the memory operation.
[0078] Figure 3 A flowchart of a method for evaluating acceleration of a memory operation of a system according to an exemplary embodiment of the present disclosure is shown. Figure 3 The method for evaluating acceleration of memory operations of a system may be performed by any processor, device, or system.
[0079] Reference Figure 3 In step S301, a first proportion of the execution time of the system function to the total execution time of the system and a second proportion of the execution time of the accelerated function to the total execution time of the system function are determined.
[0080] In step S302, the frequency coefficient of the central processing unit, the system memory pressure, and the acceleration coefficient of the accelerated function are obtained.
[0081] In step S303, a third ratio is determined based on the first ratio, the second ratio, and the acceleration coefficient of the accelerated function.
[0082] In an exemplary embodiment of the present disclosure, Among them, ratio sys_func Indicates the first ratio, ratio mem_op represents the second ratio, ∝ represents the acceleration coefficient of the accelerated function, t ori_mem_op =t ori -t ori_other , t acc_mem_op =t acc -t acc_other , t acc_other =t ori_other Among them, t ori_mem_op Indicates the execution time of the accelerated function before acceleration, t ori represents the total execution time of the system before acceleration, t ori_other represents the execution time outside the accelerated function before acceleration, t acc_mem_op Represents the execution time of the accelerated function after acceleration, t acc Represents the total execution time of the system after acceleration, t acc_other Execution time outside the accelerated function before acceleration, ratio sys_func ∈[0,1), ratio mem_op ∈[0,1).
[0083] In step S304, the product of the CPU frequency coefficient, the system memory pressure, and the third ratio is determined as the acceleration ratio of the system memory operation. The acceleration ratio of the system memory operation is positively correlated with the CPU frequency coefficient and the system memory pressure.
[0084] In an exemplary embodiment of the present disclosure, the memory operation includes a memory copy operation and / or a memory setting operation.
[0085] In the exemplary embodiment of the present disclosure, four variables are first considered: the first ratio of the execution time of the system function to the total execution time of the system (defined as ratio sys_func ∈[0, 1)), the second ratio of the execution time of the accelerated function (i.e., memset and memcpy) to the total execution time of the system function (defined as ratio mem_op ∈[0, 1)) CPU frequency coefficient (defined as f(cpu_freq)), system memory pressure (defined as f(mem)).
[0086] In the exemplary embodiment of the present disclosure, in addition to the above four variables, the acceleration coefficient of the accelerated function (ie, memset and memcpy) is also defined as Total system execution time before acceleration t ori =(t ori_other +t ori_mem_op ), the total execution time of the system after acceleration tacc =(t acc_other +t acc_mem_op ). Since the acceleration is only for the accelerated function (ie, memset and memcpy), in the exemplary embodiment of the present disclosure, it is assumed that t acc_other =t ori_other According to Amdahl's Law, the speedup ratio of the system's memory operations can be defined as follows:
[0087]
[0088] The simplified expression of the above formula is as follows:
[0089]
[0090] Figure 3 The evaluation method for accelerating the memory operation of a system can be applied to accelerating the memory operation of any operating system.
[0091] The above has been combined Figures 1 to 3 A method for accelerating memory operation and an evaluation method for accelerating memory operation of a system according to an exemplary embodiment of the present disclosure are described. Figures 4 to 7 A device and unit for accelerating memory operations according to an exemplary embodiment of the present disclosure, a device and unit for evaluating acceleration of memory operations of a system, and a system including a central processing unit and a compute express link memory device (CXL memory device) are described.
[0092] Figure 4 A block diagram showing an apparatus for accelerating memory operations according to an exemplary embodiment of the present disclosure.
[0093] Reference Figure 4 The device for accelerating memory operation includes an unloading determination unit 41, an instruction generation unit 42, an instruction sending unit 43 and a result receiving unit 44.
[0094] The offloading determination unit 41 is configured to, in response to detecting a memory operation, determine to offload the memory operation to a memory device based on a memory size of the memory operation.
[0095] In an exemplary embodiment of the present disclosure, the memory operation comprises a compute quick link memory operation, and the memory device comprises a compute quick link memory device.
[0096] In an exemplary embodiment of the present disclosure, the offload determination unit 41 may be configured to: determine whether the memory size of the memory operation is greater than a first threshold; and offload the memory operation to a memory device based on the memory size of the memory operation being greater than the first threshold.
[0097] In an exemplary embodiment of the present disclosure, the device for accelerating memory operations may also include: a determination maintenance unit (not shown), configured to determine not to offload the memory operation to the memory device based on the memory size of the memory operation being equal to or less than a first threshold.
[0098] The instruction generation unit 42 is configured to generate instructions corresponding to the memory operation.
[0099] In an exemplary embodiment of the present disclosure, the instruction generation unit 42 may be configured to: determine to batch process the memory operation based on the batch flag corresponding to the memory operation being a first flag, and generate a first processing instruction corresponding to the memory operation; determine not to batch process the memory operation based on the batch flag corresponding to the memory operation being a second flag, and generate a second processing instruction corresponding to the memory operation; and generate an unload mode flag corresponding to the memory operation.
[0100] In an exemplary embodiment of the present disclosure, the instruction generation unit 42 may also be configured to: determine whether the memory size of the memory operation is greater than a second threshold; based on the memory size of the memory operation being greater than the second threshold, determine to adopt a first unloading mode when unloading the memory operation to the memory device, and generate a first unloading mode flag corresponding to the memory operation; based on the memory size of the memory operation being equal to or less than the second threshold, determine to adopt a second unloading mode when unloading the memory operation to the memory device, and generate a second unloading mode flag corresponding to the memory operation.
[0101] The instruction sending unit 43 is configured to send an instruction corresponding to the memory operation to the memory device.
[0102] In an exemplary embodiment of the present disclosure, the instruction sending unit 43 may be configured to: send a first processing instruction and the unload mode flag to the memory device based on the batch processing flag corresponding to the memory operation being a first flag; and send a second processing instruction and the unload mode flag to the memory device based on the batch processing flag corresponding to the memory operation being a second flag.
[0103] The result receiving unit 44 is configured to receive the execution result of the memory operation from the memory device.
[0104] Figure 5 A block diagram showing an apparatus for accelerating memory operations according to an exemplary embodiment of the present disclosure.
[0105] Reference Figure 5 The device for accelerating memory operation includes an instruction receiving unit 51, an asynchronous execution unit 52, a synchronous execution unit 53 and a result sending unit 54.
[0106] The instruction receiving unit 51 is configured to receive instructions corresponding to memory operations from the central processing unit.
[0107] In an exemplary embodiment of the present disclosure, the apparatus for accelerating memory operations may further include: an instruction decoding unit (not shown), configured to decode instructions corresponding to the memory operation to obtain decoded instructions of the memory operation.
[0108] In an exemplary embodiment of the present disclosure, the instruction decoding unit may also be configured to: based on the instructions corresponding to the memory operation including the first processing instruction, batch process the first processing instruction to obtain the encoded instruction of the memory operation; and decode the encoded instruction of the memory operation to obtain the decoded instruction of the memory operation.
[0109] In an exemplary embodiment of the present disclosure, the instruction decoding unit may also be configured to: based on the instruction corresponding to the memory operation including the second processing instruction, decode the second processing instruction to obtain a decoded instruction of the memory operation.
[0110] In an exemplary embodiment of the present disclosure, the memory operation includes computing a quick link memory operation.
[0111] The asynchronous execution unit 52 is configured to execute the memory operation in an asynchronous mode based on the instruction corresponding to the memory operation including a first offload mode flag, to obtain an execution result of the memory operation.
[0112] In an exemplary embodiment of the present disclosure, the asynchronous execution unit 52 may be configured to execute the decoded instruction of the memory operation in an asynchronous mode.
[0113] The synchronous execution unit 53 is configured to execute the memory operation in a synchronous mode based on the instruction corresponding to the memory operation including a second unload mode flag, to obtain an execution result of the memory operation.
[0114] In an exemplary embodiment of the present disclosure, the synchronous execution unit 53 may be configured to: execute the decoded instruction of the memory operation in a synchronous mode.
[0115] The result sending unit 54 is configured to send the execution result of the memory operation to the central processor.
[0116] Figure 6 A block diagram of an evaluation device for accelerating memory operations of a system according to an exemplary embodiment of the present disclosure is shown. Here, the system uses a method for accelerating memory operations based on the present disclosure.
[0117] Reference Figure 6The evaluation device for acceleration of memory operations of a system includes a ratio determination unit 61, a parameter acquisition unit 62, an intermediate ratio determination unit 63 and an acceleration ratio determination unit 64.
[0118] The ratio determination unit 61 is configured to determine a first ratio of the execution time of the system function to the total execution time of the system and a second ratio of the execution time of the accelerated function to the total execution time of the system function.
[0119] The parameter acquisition unit 62 is configured to acquire the frequency coefficient of the central processing unit, the system memory pressure, and the acceleration coefficient of the accelerated function.
[0120] The intermediate ratio determination unit 63 is configured to determine the third ratio based on the first ratio, the second ratio, and the acceleration coefficient of the accelerated function.
[0121] In an exemplary embodiment of the present disclosure, Among them, ratio sys_func Indicates the first ratio, ratio mem_op represents the second ratio, ∝ represents the acceleration coefficient of the accelerated function, t ori_mem_op =t ori -t ori_other , t acc_mem_op =t acc -t acc_other , t acc_other =t ori_other Among them, t ori_mem_op Indicates the execution time of the accelerated function before acceleration, t ori represents the total execution time of the system before acceleration, t ori_other represents the execution time outside the accelerated function before acceleration, t acc_mem_op Represents the execution time of the accelerated function after acceleration, t acc Represents the total execution time of the system after acceleration, t acc_other Execution time outside the accelerated function before acceleration, rattio sys_func ∈[0,1), rαttio mem_op ∈[0,1).
[0122] The acceleration ratio determination unit 64 is configured to determine the product of the frequency coefficient of the central processing unit, the system memory pressure, and the third ratio as the acceleration ratio of the system memory operation.
[0123] In an exemplary embodiment of the present disclosure, the memory operation may include a memory copy operation and / or a memory setting operation.
[0124] Figure 7A schematic diagram showing a system including a central processing unit (CPU) and a compute express link memory device (CXL memory device) according to an exemplary embodiment of the present disclosure is shown.
[0125] like Figure 7 As shown, the central processing unit may include a policy executor for executing the intelligent policy. The central processing unit may execute the method for accelerating memory operations through the policy executor. Figure 7 As shown, the CXL memory device may include a memory operation accelerator. In addition, the CXL memory device may also include an interface, a memory controller, and a dynamic random access memory (DRAM). The CXL memory device may execute a method for accelerating memory operations through the memory operation accelerator. Figure 7 As shown, the memory operation accelerator includes: a controller including a control register and an instruction buffer; and an executor including a memory copy module and a memory setting module. Here, the control register is configured to initialize the memory operation accelerator. Here, the instruction buffer is configured to process batch instructions and decode instructions. Here, the memory copy module is configured to perform memory copy operations in parallel. Here, the memory setting module is configured to perform memory setting operations in parallel. Here, the executor is configured to execute the method of accelerating memory operations in the present disclosure.
[0126] In addition, according to an exemplary embodiment of the present disclosure, a computer-readable storage medium is also provided, on which a computer program is stored. When the computer program is executed, the method of accelerating memory operation according to the exemplary embodiment of the present disclosure is implemented.
[0127] In an exemplary embodiment of the present disclosure, the computer-readable storage medium may carry one or more programs, and when the computer program is executed, the following steps may be implemented: in response to detecting a memory operation, determining to offload the memory operation to a memory device based on the memory size of the memory operation; generating instructions corresponding to the memory operation; sending the instructions corresponding to the memory operation to the memory device; and receiving the execution result of the memory operation from the memory device.
[0128] In an exemplary embodiment of the present disclosure, the computer-readable storage medium may carry one or more programs, and when the computer program is executed, the following steps may be implemented: receiving instructions corresponding to memory operations from a central processing unit; based on the instructions corresponding to the memory operations including a first unload mode flag, executing the memory operations in an asynchronous mode to obtain an execution result of the memory operations; based on the instructions corresponding to the memory operations including a second unload mode flag, executing the memory operations in a synchronous mode to obtain an execution result of the memory operations; and sending the execution result of the memory operations to the central processing unit.
[0129] In an exemplary embodiment of the present disclosure, the computer-readable storage medium may carry one or more programs, and when the computer program is executed, the following steps may be implemented: determining a first proportion of the execution time of the system function to the total execution time of the system, and a second proportion of the execution time of the accelerated function to the total execution time of the system function; obtaining the frequency coefficient of the central processing unit, the system memory pressure, and the acceleration coefficient of the accelerated function; determining a third proportion based on the first proportion, the second proportion, and the acceleration coefficient of the accelerated function; and determining the product of the frequency coefficient of the central processing unit, the system memory pressure, and the third proportion as the acceleration ratio of the system's memory operation.
[0130] The computer-readable storage medium may be, for example, but not limited to, an electrical, magnetic, optical, electromagnetic, infrared, or semiconductor system, device or device, or any combination thereof. More specific examples of computer-readable storage media may include, but are not limited to: an electrical connection with one or more wires, a portable computer disk, a hard disk, a random access memory (RAM), a read-only memory (ROM), an erasable programmable read-only memory (EPROM or flash memory), an optical fiber, a portable compact disk read-only memory (CD-ROM), an optical storage device, a magnetic storage device, or any suitable combination thereof. In an embodiment of the present disclosure, a computer-readable storage medium may be any tangible medium containing or storing a computer program that may be used by or in conjunction with an instruction execution system, device or device. The computer program contained on the computer-readable storage medium may be transmitted using any suitable medium, including but not limited to: wires, optical cables, RF (radio frequency), etc., or any suitable combination thereof. The computer-readable storage medium may be contained in any device; it may also exist alone without being assembled into the device.
[0131] In addition, according to an exemplary embodiment of the present disclosure, a computer program product is also provided, and instructions in the computer program product can be executed by a processor of a computer device to complete the method of accelerating memory operations according to an exemplary embodiment of the present disclosure.
[0132] The above has been combined Figures 4 to 7 The present invention describes an apparatus for accelerating memory operations, an evaluation apparatus for accelerating memory operations of a system, and a system including a central processing unit and a compute express link memory device (CXL memory device) according to an exemplary embodiment of the present invention. Figure 8 A computing device according to an exemplary embodiment of the present disclosure is described.
[0133] Figure 8 A schematic diagram illustrating a computing device according to an exemplary embodiment of the present disclosure.
[0134] Reference Figure 8According to the exemplary embodiment of the present disclosure, the computing device 8 includes a memory 81 and a processor 82. The memory 81 stores a computer program. When the computer program is executed by the processor 82, the method of accelerating memory operations according to the exemplary embodiment of the present disclosure is implemented.
[0135] In an exemplary embodiment of the present disclosure, when the computer program is executed by the processor 82, the following steps can be implemented: in response to detecting a memory operation, determining to offload the memory operation to a memory device based on the memory size of the memory operation; generating instructions corresponding to the memory operation; sending the instructions corresponding to the memory operation to the memory device; and receiving the execution result of the memory operation from the memory device.
[0136] In an exemplary embodiment of the present disclosure, when the computer program is executed by the processor 82, the following steps can be implemented: receiving instructions corresponding to memory operations from a central processing unit; based on the fact that the instructions corresponding to the memory operations include a first unload mode flag, executing the memory operations in an asynchronous mode to obtain an execution result of the memory operations; based on the fact that the instructions corresponding to the memory operations include a second unload mode flag, executing the memory operations in a synchronous mode to obtain an execution result of the memory operations; and sending the execution result of the memory operations to the central processing unit.
[0137] In an exemplary embodiment of the present disclosure, when the computer program is executed by the processor 82, the following steps can be implemented: determining a first proportion of the execution time of the system function to the total execution time of the system, and a second proportion of the execution time of the accelerated function to the total execution time of the system function; obtaining the frequency coefficient of the central processing unit, the system memory pressure, and the acceleration coefficient of the accelerated function; determining a third proportion based on the first proportion, the second proportion, and the acceleration coefficient of the accelerated function; and determining the product of the frequency coefficient of the central processing unit, the system memory pressure, and the third proportion as the acceleration ratio of the system's memory operation.
[0138] The computing device in the embodiments of the present disclosure may include, but is not limited to, devices such as mobile phones, laptop computers, PDAs (personal digital assistants), PADs (tablet computers), desktop computers, and the like. Figure 8 The computing device shown is only an example and should not bring any limitation to the functions and scope of use of the embodiments of the present disclosure.
[0139] The above has been referred to Figures 1 to 8 The method and apparatus for accelerating memory operation according to the exemplary embodiments of the present disclosure are described. However, it should be understood that: Figures 4 to 6The device for accelerating memory operation and its unit, the device for evaluating the acceleration of memory operation of the system and its unit can be configured as software, hardware, firmware or any combination of the above items to perform specific functions, respectively. Figure 8 The computing device shown in is not limited to including the components shown above, but some components may be added or deleted as needed, and the above components may also be combined.
[0140] According to the method and apparatus for accelerating memory operations of the exemplary embodiments of the present disclosure, in response to detecting a memory operation, determining to offload the memory operation to a memory device based on the memory size of the memory operation, generating instructions corresponding to the memory operation, sending the instructions corresponding to the memory operation to the memory device, and receiving the execution result of the memory operation from the memory device, the speed and effect of accelerating the memory operation are improved.
[0141] According to the method and device for accelerating memory operations of the exemplary embodiments of the present disclosure, instructions corresponding to memory operations are received from a central processing unit, and based on the instructions corresponding to the memory operations including a first unload mode flag, the memory operations are executed in an asynchronous mode to obtain an execution result of the memory operations, and based on the instructions corresponding to the memory operations including a second unload mode flag, the memory operations are executed in a synchronous mode to obtain an execution result of the memory operations, and the execution result of the memory operations is sent to the central processing unit, thereby improving the speed and effect of accelerating memory operations.
[0142] According to the exemplary embodiments of the present disclosure, an evaluation method and device for acceleration of memory operations of a system are provided. By determining a first proportion of the execution time of a system function to the total execution time of the system and a second proportion of the execution time of an accelerated function to the total execution time of the system functions, the frequency coefficient of the central processing unit, the system memory pressure, and the acceleration coefficient of the accelerated function are obtained. Based on the first proportion, the second proportion, and the acceleration coefficient of the accelerated function, a third proportion is determined. The product of the frequency coefficient of the central processing unit, the system memory pressure, and the third proportion is determined as the acceleration ratio of the memory operations of the system, thereby achieving an evaluation of the acceleration of the memory operations of the system through the acceleration ratio of the memory operations of the system.
[0143] While the present disclosure has been particularly shown and described with reference to exemplary embodiments thereof, it will be understood by those skilled in the art that various changes in form and details may be made therein without departing from the spirit and scope of the present disclosure as defined by the following claims.
Claims
1. A method to speed up memory operations, include: In response to detecting a memory operation, determining to offload the memory operation to a memory device based on a memory size of the memory operation; generating an instruction corresponding to the memory operation; sending an instruction corresponding to the memory operation to the memory device; A result of executing the memory operation is received from the memory device.
2. The method according to claim 1, in, The memory operation comprises a compute quick link memory operation, and the memory device comprises a compute quick link memory device.
3. The method according to claim 1, in, The step of offloading the memory operation to a memory device based on the memory size of the memory operation comprises: Determining whether a memory size of the memory operation is greater than a first threshold; Based on the memory size of the memory operation being greater than a first threshold, the memory operation is offloaded to a memory device.
4. The method according to claim 3, further comprising: include: Based on the memory size of the memory operation being equal to or smaller than a first threshold, determining not to offload the memory operation to a memory device.
5. The method according to claim 1, in, The generating an instruction corresponding to the memory operation includes: Based on the batch processing flag corresponding to the memory operation being the first flag, determining to perform batch processing on the memory operation, and generating a first processing instruction corresponding to the memory operation; Based on the batch processing flag corresponding to the memory operation being the second flag, determining not to perform batch processing on the memory operation, and generating a second processing instruction corresponding to the memory operation; An offload mode flag corresponding to the memory operation is generated.
6. The method according to claim 5, in, The generating of the uninstall mode flag corresponding to the memory operation includes: Determining whether the memory size of the memory operation is greater than a second threshold; Based on the memory size of the memory operation being greater than a second threshold, determining to adopt a first offload mode when offloading the memory operation to the memory device, and generating a first offload mode flag corresponding to the memory operation; Based on the memory size of the memory operation being equal to or smaller than a second threshold, it is determined that a second offload mode is adopted when the memory operation is offloaded to the memory device, and a second offload mode flag corresponding to the memory operation is generated.
7. The method according to claim 5, in, The step of sending the instruction corresponding to the memory operation to the memory device includes: Based on the batch processing flag corresponding to the memory operation being the first flag, sending a first processing instruction and the offload mode flag to the memory device; Based on the batch processing flag corresponding to the memory operation being a second flag, a second processing instruction and the offload mode flag are sent to the memory device.
8. A method for accelerating memory operations, include: receiving instructions corresponding to memory operations from a central processing unit; Based on the instruction corresponding to the memory operation including a first offload mode flag, executing the memory operation in an asynchronous mode to obtain an execution result of the memory operation; Based on the instruction corresponding to the memory operation including a second offload mode flag, the memory operation is executed in a synchronous mode to obtain an execution result of the memory operation; The execution result of the memory operation is sent to the central processing unit.
9. The method according to claim 8, further comprising: include: Decoding the instruction corresponding to the memory operation to obtain a decoded instruction of the memory operation, The step of executing the memory operation in an asynchronous mode includes: executing the decoded instruction of the memory operation in an asynchronous mode, The step of executing the memory operation in a synchronous mode includes: The decoded instructions of the memory operation are executed in a synchronous mode.
10. The method according to claim 9, in, The decoding of the instruction corresponding to the memory operation includes: Based on the fact that the instructions corresponding to the memory operation include the first processing instructions, batch processing is performed on the first processing instructions to obtain the encoding instructions of the memory operation; The encoded instruction of the memory operation is decoded to obtain a decoded instruction of the memory operation.
11. The method according to claim 9, in, The decoding of the instruction corresponding to the memory operation includes: Based on the fact that the instruction corresponding to the memory operation includes a second processing instruction, the second processing instruction is decoded to obtain a decoded instruction of the memory operation.
12. The method according to claim 8, in, The memory operation comprises a compute quick link memory operation, and the memory device comprises a compute quick link memory device.
13. A method for evaluating the acceleration of memory operations of a system, in, The system uses a method for accelerating memory operations based on any one of claims 1 to 12, and the evaluation method includes: Determine a first proportion of the execution time of the system function to the total execution time of the system, and a second proportion of the execution time of the accelerated function to the total execution time of the system function; Get the CPU frequency coefficient, system memory pressure, and acceleration coefficient of the accelerated function; Determine a third ratio based on the first ratio, the second ratio, and an acceleration coefficient of the accelerated function; The product of the frequency coefficient of the central processing unit, the system memory pressure, and the third ratio is determined as the acceleration ratio of the system memory operation.
14. A device for accelerating memory operations, include: an offloading determination unit, configured to, in response to detecting a memory operation, determine to offload the memory operation to a memory device based on a memory size of the memory operation; An instruction generation unit, configured to generate instructions corresponding to the memory operation; an instruction sending unit, configured to send an instruction corresponding to the memory operation to the memory device; and The result receiving unit is configured to receive the execution result of the memory operation from the memory device.
15. A device for accelerating memory operations, include: An instruction receiving unit, configured to receive instructions corresponding to memory operations from a central processing unit; an asynchronous execution unit, configured to execute the memory operation in an asynchronous mode based on the instruction corresponding to the memory operation including a first offload mode flag, and obtain an execution result of the memory operation; a synchronous execution unit configured to execute the memory operation in a synchronous mode based on the instruction corresponding to the memory operation including a second unload mode flag, and obtain an execution result of the memory operation; The result sending unit is configured to send the execution result of the memory operation to the central processing unit.
16. A computer-readable storage medium storing a computer program, in, When the computer program is executed by a processor, the method according to any one of claims 1 to 13 is implemented.
17. A computing device, include: at least one processor; At least one memory stores a computer program, and when the computer program is executed by the at least one processor, the method according to any one of claims 1 to 13 is implemented.
