Data transmission method and device, electronic equipment, readable storage medium and product
By introducing a data preprocessing module between the processor and memory, data transmission can be performed directly, solving the problem of low data transmission efficiency in existing technologies and achieving optimization of system resources and improvement of efficiency.
Patent Information
- Application Number
- CN202210194469.8
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2022-03-01
- Publication Date
- 2026-01-30
- Estimated Expiration
- 2042-03-01
AI Technical Summary
In existing technologies, data transmission methods are inefficient, leading to a waste of system resources, especially bus bandwidth and memory storage resources, which affects system operating speed and power consumption.
By introducing a data preprocessing module between the processor and the memory, the processor connects to the bus through the data preprocessing module and directly transmits data with the memory. The data preprocessing module performs preprocessing operations on the target data and then sends it to the receiving end, thus avoiding data transmission through the bus and memory.
The data transmission process has been optimized, reducing the waste of bus bandwidth and memory storage resources and improving the overall system efficiency.
Smart Images

Figure CN116743523B_ABST
Abstract
Description
Technical Field
[0001] This application relates to the field of data technology, and more specifically, to a data transmission method, apparatus, electronic device, computer-readable medium, and product. Background Technology
[0002] Currently, with the rapid development of semiconductor and chip technologies, chips are integrating more and more processing units. These processing units need to transmit data, including acquiring data for processing or storing processed data. However, current data transmission methods are inefficient and easily lead to a waste of system resources. Summary of the Invention
[0003] This application discloses a data transmission method, apparatus, electronic device, computer-readable medium, and product.
[0004] In a first aspect, embodiments of this application provide a data transmission method applied to a data preprocessing module of an electronic device. The electronic device further includes a processor, a memory, and a bus. The processor is connected to the bus through the data preprocessing module, and the bus is connected to the memory. The method includes: obtaining a data processing request for corresponding target data sent by the processor, wherein the receiving end corresponding to the data processing request is the processor or the memory; responding to the data processing request, performing a preprocessing operation on the target data, and sending the target data after performing the preprocessing operation to the receiving end corresponding to the data processing request.
[0005] Secondly, embodiments of this application also provide a data transmission device, applied to a data preprocessing module of an electronic device. The electronic device further includes a processor, a memory, and a bus. The processor is connected to the bus through the data preprocessing module, and the bus is connected to the memory. The device includes: an acquisition unit, configured to acquire a data processing request for corresponding target data sent by the processor, wherein the receiving end corresponding to the data processing request is the processor or the memory; and a processing unit, configured to respond to the data processing request, perform a preprocessing operation on the target data, and send the target data after the preprocessing operation to the receiving end corresponding to the data processing request.
[0006] Thirdly, embodiments of this application also provide an electronic device, including: a processor, a data preprocessing module, a memory, and a bus, wherein the processor is connected to the bus through the data preprocessing module, the bus is connected to the memory, and the data preprocessing module is used to execute the above-described method.
[0007] Fourthly, embodiments of this application also provide a computer-readable medium storing processor-executable program code, which, when executed by the processor, causes the processor to perform the above-described method.
[0008] Fifthly, embodiments of this application also provide a computer program product, including a computer program / instructions that, when executed by a processor, implement the above-described method.
[0009] This application provides a data transmission method, apparatus, electronic device, computer-readable medium, and product. The method enables a processor to connect to a bus via a processing module, and then transmit data with a memory connected to the bus. Specifically, a data preprocessing module receives a data processing request for target data sent by the processor, then responds to the data processing request, performs preprocessing operations on the target data, and sends the preprocessed target data to the receiving end corresponding to the data processing request. This application enables the processor to connect to the bus via a data preprocessing module, and then to a memory connected to the bus. This allows the processor to directly obtain the data processed by the data preprocessing module, optimizing the data transmission process. It avoids, to some extent, the need for data transmission between the processor and the data preprocessing module to pass through the bus and be relayed through the memory, thereby avoiding waste of bandwidth on the bus and storage resources in the memory, and improving the overall system efficiency.
[0010] Other features and advantages of the embodiments of this application will be set forth in the following description, and will be apparent in part from the description, or may be learned by practicing the embodiments of this application. The objects and other advantages of the embodiments of this application may be realized and obtained by means of the structures particularly pointed out in the written description, claims, and drawings. Attached Figure Description
[0011] To more clearly illustrate the technical solutions in the embodiments of this application, the accompanying drawings used in the description of the embodiments will be briefly introduced below. Obviously, the accompanying drawings described below are only some embodiments of this application. For those skilled in the art, other drawings can be obtained based on these drawings without creative effort.
[0012] Figure 1 A flowchart illustrating a data transmission method is shown.
[0013] Figure 2 The illustration shows a scenario in which the data transmission method provided in the embodiments of this application is applied;
[0014] Figure 3 A flowchart of the data transmission method provided in an embodiment of this application is shown;
[0015] Figure 4 A flowchart of a data transmission method according to another embodiment of this application is shown;
[0016] Figure 5 It shows Figure 4 A diagram illustrating one embodiment of step S420;
[0017] Figure 6 It shows Figure 4 Another embodiment of step S420 is shown in the figure;
[0018] Figure 7 It shows Figure 4 Another embodiment of step S420 is shown in the figure.
[0019] Figure 8 A flowchart of a data transmission method provided in another embodiment of this application is shown;
[0020] Figure 9 It shows Figure 8 A diagram illustrating one embodiment of step S830;
[0021] Figure 10 It shows Figure 9 A diagram illustrating one embodiment of step S831;
[0022] Figure 11 A unit block diagram of the data transmission apparatus provided in an embodiment of this application is shown;
[0023] Figure 12 A block diagram of the electronic device structure provided in an embodiment of this application is shown;
[0024] Figure 13 This illustration shows another electronic device structure block diagram provided in an embodiment of this application;
[0025] Figure 14 A block diagram of another electronic device structure provided in an embodiment of this application is shown;
[0026] Figure 15 This paper shows a block diagram of another electronic device structure provided in an embodiment of the present application;
[0027] Figure 16 A structural block diagram of a computer-readable storage medium provided in an embodiment of this application is shown;
[0028] Figure 17 A structural block diagram of a computer program product provided in an embodiment of this application is shown. Detailed Implementation
[0029] To enable those skilled in the art to better understand the present application, the technical solutions in the embodiments of the present application will be clearly and completely described below with reference to the accompanying drawings. Obviously, the described embodiments are only a part of the embodiments of the present application, and not all of them. The components of the embodiments of the present application described and shown in the accompanying drawings can generally be arranged and designed in various different configurations. Therefore, the following detailed description of the embodiments of the present application provided in the accompanying drawings is not intended to limit the scope of the claimed application, but merely represents selected embodiments of the present application. All other embodiments obtained by those skilled in the art based on the embodiments of the present application without inventive effort are within the scope of protection of the present application.
[0030] It should be noted that similar reference numerals and letters in the following figures indicate similar items; therefore, once an item is defined in one figure, it does not need to be further defined and explained in subsequent figures. Furthermore, in the description of this application, terms such as "first," "second," etc., are used only to distinguish descriptions and should not be construed as indicating or implying relative importance.
[0031] Currently, with the rapid development of semiconductor and chip technologies, chips are integrating more and more processing units. These processing units need to transmit data, including acquiring data for processing or storing processed data. As the performance of these processing units improves, their demand for data transmission is increasing. Therefore, optimizing the data transmission process to minimize the waste of system resources during data transmission has become an urgent problem to be solved.
[0032] For an example, please refer to Figure 1 , Figure 1 A schematic diagram of a data transmission process is shown. Figure 1 The system includes processor 1, processor 2, processor 3, a data processing module, a bus, and memory. The bus connects to processor 1, processor 2, processor 3, the data processing module, and memory. For example, when any processor needs to write processed data to memory, it first writes the data to memory via the bus. Then, the data processing module retrieves the data via the bus, processes it (e.g., compresses it), and writes the processed data back to memory. Conversely, when any processor needs to read data from memory, it first transmits the data from memory to the data processing module via the bus. The data processing module processes the data (e.g., decompresses it), stores the processed data back to memory via the bus, and then the processor retrieves the pre-processed data from memory via the bus.
[0033] However, the inventors discovered during their research that the above Figure 1In the method described above, data transmission needs to be transferred from the memory via the bus, which will occupy the bus bandwidth, affect the running speed of other processes running on the bus, and also waste the storage resources in the memory. The data transmission time is long and the power consumption is high.
[0034] Therefore, to overcome the above-mentioned shortcomings, this application provides a data transmission method, apparatus, electronic device, computer-readable medium, and product. The method enables a processor to connect to the bus via a processing module, and then transmit data with a memory connected to the bus. Specifically, a data preprocessing module receives a data processing request for corresponding target data sent by the processor, then responds to the data processing request, performs preprocessing operations on the target data, and sends the preprocessed target data to the receiving end corresponding to the data processing request. This application enables the processor to connect to the bus via a data preprocessing module, and then to a memory connected to the bus, allowing the processor to directly obtain the data processed by the data preprocessing module. This optimizes the data transmission process and, to a certain extent, avoids the need for data transmission between the processor and the data preprocessing module to pass through the bus and be relayed through the memory. This avoids wasting bandwidth on the bus and storage resources in the memory, thereby improving the overall system efficiency.
[0035] Please see Figure 2 , Figure 2 This paper illustrates an application scenario of the data transmission method provided in an embodiment of this application. This data transmission method can be applied to an electronic device 200, which includes a processor 210, a data preprocessing module 220, a memory 230, and a bus 240. The processor 210 is connected to the bus 240 via the preprocessing module 210, and the bus 240 is connected to the memory 230.
[0036] In some implementations, processor 210 can send a data processing request corresponding to the target data to data preprocessing module 220 based on the target data. For example, processor 210 can send a storage request corresponding to the target data to data preprocessing module 220, and processor 210 can also send a read request corresponding to the target data to data preprocessing module 220. The processor 210 can be a central processing unit (CPU), graphics processing unit (GPU), neural network processing unit (NPU), digital signal processing unit (DSP), optical processor, quantum processor, etc., or it can be a processing engine in a neural network processing unit (NPU), such as a tensor processing engine or vector processing engine, for example.
[0037] In some implementations, the data preprocessing module 220 can be used to receive a data processing request for corresponding target data sent by the processor 210, and respond to the data processing request by performing a preprocessing operation on the target data, and then send the target data after performing the preprocessing operation to the receiving end corresponding to the data processing request.
[0038] The memory 230 can be used to perform different operations based on data processing requests. Specifically, the memory 230 can have multiple memory addresses, each corresponding to a memory space. Data can be stored into the corresponding memory space based on the memory address; data can also be retrieved from the memory space corresponding to the memory address based on the memory address. The memory 230 can be a Double Data Rate Synchronous Dynamic Random Access Memory (DDR).
[0039] Bus 240 can directly connect to data preprocessing module 220 and memory 230, enabling data preprocessing module 220 to transmit data with memory 230 via bus 240. It is easily understood that the electronic device 200 may also include more than one processor 210, each processor 210 corresponding to one data preprocessing module 220, and each data preprocessing module 220 can be connected to bus 240 for data transmission with memory 230, which is also connected to bus 240.
[0040] Please see Figure 3 , Figure 3This application illustrates a data transmission method provided by an embodiment of the present application. This method can be applied to the electronic device 200 in the foregoing embodiments. The electronic device 200 includes a processor 210, a data preprocessing module 220, a memory 230, and a bus 240. The data preprocessing module 220 can be the main execution body of the method. Specifically, the method includes steps S310 and S320.
[0041] Step S310: Obtain the data processing request corresponding to the target data sent by the processor, wherein the receiving end corresponding to the data processing request is the processor or the memory.
[0042] In some implementations, the data preprocessing module can acquire data processing requests for corresponding target data sent by the processor. It is readily understood that these data processing requests can include data storage requests and data read requests, and different receiving ends correspond to different data processing requests. For example, if the data processing request is a data storage request, the receiving end can be a memory; if the data processing request is a data read request, the receiving end can be a processor. The target data can be the data that the processor needs to process.
[0043] Optionally, the data processing request can be initiated by software within the electronic device, which then sends the data processing request for the target data to the data preprocessing module. For example, the software could be the operating system running the electronic device. When the operating system needs to process certain data, it sends a request to the processor, which then sends the data processing request for the target data to the data preprocessing module. Alternatively, the software could be an application running on the electronic device, such as a video playback application. This application sends a request to the processor, which then sends the data processing request for the target data to the data preprocessing module. The data processing request can also be initiated by other processors within the electronic device. For instance, the electronic device may include two processors: a digital signal processing (DSP) and a tensor engine. When the DSP performs a task, it may need to use the tensor engine to process data. In this case, the DSP can send a request to the tensor engine, which then sends the data processing request for the target data to the data preprocessing module.
[0044] Step S320: In response to the data processing request, perform a preprocessing operation on the target data, and send the target data after the preprocessing operation to the receiving end corresponding to the data processing request.
[0045] In some implementations, the data preprocessing module can respond to the data processing request and perform preprocessing operations on the target data. It is readily understood that, as described above, since data processing requests can include data storage requests and data reading requests, different preprocessing operations can be performed for different data processing requests. For example, if the data processing request is a data storage request, the preprocessing operation can be a data compression operation; if the data processing request is a data reading request, the preprocessing operation can be a data decompression operation.
[0046] Furthermore, after receiving a data processing request, the preset processing module can determine whether preprocessing is required. If preprocessing is required, the module performs preprocessing on the data and then sends the preprocessed target data to the receiving end corresponding to the data processing request. If preprocessing is not required, the module sends the unprocessed target data to the receiving end corresponding to the data processing request.
[0047] Optionally, as can be seen from the foregoing embodiments, if the data processing request is a data storage request, the receiving end can be a memory, and the preprocessing operation can be a compression operation. If it is determined that a compression operation needs to be performed, the data is compressed, and then the target data after the compression operation is performed is sent to the memory; if it is determined that a compression operation does not need to be performed, the target data without the compression operation can be sent to the memory. If the data processing request is a data reading request, the receiving end can be a processor, and the preprocessing operation can be a decompression operation. If it is determined that a decompression operation needs to be performed, the data is decompressed, and then the target data after the decompression operation is performed is sent to the memory; if it is determined that a decompression operation does not need to be performed, the target data without the decompression operation can be sent to the memory.
[0048] Furthermore, the memory can include multiple storage addresses, each corresponding to a data type, which includes compressed and uncompressed types. Therefore, the data type of the data corresponding to a given storage address can be determined. The data preprocessing module can also determine the data type based on the received data processing request.
[0049] This application provides a data transmission method, apparatus, electronic device, computer-readable medium, and product. The method enables a processor to connect to a bus via a processing module, and then transmit data with a memory connected to the bus. Specifically, a data preprocessing module receives a data processing request for target data sent by the processor, then responds to the data processing request, performs preprocessing operations on the target data, and sends the preprocessed target data to the receiving end corresponding to the data processing request. This application enables the processor to connect to the bus via a data preprocessing module, and then to a memory connected to the bus. This allows the processor to directly obtain the data processed by the data preprocessing module, optimizing the data transmission process. It avoids, to some extent, the need for data transmission between the processor and the data preprocessing module to pass through the bus and be relayed through the memory, thereby avoiding waste of bandwidth on the bus and storage resources in the memory, and improving the overall system efficiency.
[0050] Please see Figure 4 , Figure 4 This application illustrates a data transmission method provided by an embodiment of the present application. This method can be applied to the electronic device 200 in the foregoing embodiments. The electronic device 200 includes a processor 210, a data preprocessing module 220, a memory 230, and a bus 240. The data preprocessing module 220 can be the main execution entity of the method. Specifically, the method includes steps S410 to S430.
[0051] Step S410: Obtain the data processing request corresponding to the target data sent by the processor, wherein the receiving end corresponding to the data processing request is the processor or the memory.
[0052] Step S410 has been described in detail in the foregoing embodiments and will not be repeated here.
[0053] Step S420: If the first data meets the compression conditions, then compress the first data.
[0054] In some implementations, the target data is first data, the data processing request is a data storage request, and the receiving end corresponding to the data storage request is the memory.
[0055] Optionally, the data processing module can determine whether the first data meets the compression conditions based on the first storage address corresponding to the first data, wherein the first storage address is the storage address allocated by the memory to the processor. Specifically, in some embodiments, the first data processing request may include first data, and the data preprocessing module can determine the first storage address corresponding to the first data based on the first data, and then determine the first data type corresponding to the first data based on the first storage address, thereby determining whether the first data meets the compression conditions based on the first data type. In other embodiments, the first data processing request may also include the first storage address corresponding to the first data. In this case, the data preprocessing module can directly determine the first data type corresponding to the first data based on the first storage address, thereby determining whether the first data meets the compression conditions based on the first data type.
[0056] Optionally, the data processing module can determine whether the first data meets the compression conditions based on whether specified information has been obtained. For example, the first data processing request may also include specified information, which can be used to instruct the first data to be compressed. In this case, the data preprocessing module can directly perform the compression operation on the first data according to the specified information. For detailed execution methods, please refer to the following embodiments.
[0057] Furthermore, if the first data meets the compression conditions, it can be compressed using the compression module in the data preprocessing module.
[0058] Please see Figure 5 , Figure 5 One implementation of step S420 is shown. Specifically, Figure 5 This includes steps S421 to S423.
[0059] Step S421: Obtain the first storage address of the first data, wherein the first storage address is the storage address allocated by the memory to the processor.
[0060] Step S422: Based on the multiple storage addresses of the memory and the data type corresponding to each storage address obtained in advance, look up the data type corresponding to the first storage address in the identification table, wherein the data type includes compressed type and uncompressed type.
[0061] Step S423: If the data type corresponding to the first storage address is a compressed type, then compress the first data.
[0062] In some implementations, the data storage request includes first data. After obtaining the first data, the data preprocessing module can look up the first storage address corresponding to the first data. This first storage address is the storage address allocated by the memory to the processor, and it is used to store the first data. As an example, the data preprocessing module can obtain the first storage address corresponding to the first data from the memory via a bus.
[0063] Furthermore, since the memory can include multiple memory addresses, each memory address corresponds to a memory type, the memory addresses and the memory types corresponding to each memory address can be pre-stored in an identification table. When the data preprocessing module obtains the first memory address, it can look up the data type corresponding to the first data in the identification table based on the first memory address. The data type can include compressed type and uncompressed type.
[0064] For example, the memory may include storage address 1, storage address 2 and storage address 3, wherein the storage type corresponding to storage address 1 is compressed, the storage type corresponding to storage address 2 is uncompressed, and the storage type corresponding to storage address 3 is uncompressed. Then the identification table can store the above storage addresses and the storage types corresponding to the storage addresses. For example, it can be stored in the form of a matrix or an array, which is not limited here.
[0065] Furthermore, storage address 1, storage address 2, and storage address 3 in the memory in the above example can be an address space. For example, storage address 1 corresponds to 0x0001, storage address 2 corresponds to 0x0002, and storage address 3 corresponds to 0x0003. Then, the storage type corresponding to 0x0001 is compressed, the storage type corresponding to 0x0002 is uncompressed, and the storage type corresponding to 0x0003 is uncompressed.
[0066] It's easy to understand that the type of data can be used to determine whether it needs to be compressed. For example, code-type data or control variable-type data generally have smaller capacities and therefore do not need compression, while image-type data generally have larger capacities and therefore can be compressed. Therefore, a specific memory address can be allocated to store data of a particular type. Optionally, memory addresses 1, 2, and 3 in the above example can also be a memory space. For example, memory address 1 corresponds to 0x0001 to 0x000a and is used to store image data; memory address 2 corresponds to 0x0010 to 0x00a0 and is used to store code data; and memory address 3 corresponds to 0x0100 to 0x0a00 and is used to store control variable data. In this case, the storage type corresponding to 0x0001 to 0x000a is compressed, the storage type corresponding to 0x0010 to 0x00a0 is uncompressed, and the storage type corresponding to 0x0100 to 0x0a00 is also uncompressed.
[0067] Furthermore, in some implementations, after obtaining the first storage address, the data preprocessing module can determine the data type of the first data corresponding to that first storage address by looking up the aforementioned identification table. First data with a storage type data type is compressed, while first data with a non-storage type data type is not compressed. Specifically, it can determine which storage address in the identification table the first storage address matches; the data type corresponding to that storage address is the storage type of the first data. For example, if the first storage address is 0x0002, and the data type corresponding to storage address 1 (0x0001) in the identification table is a compressed data type, storage address 2 (0x0002) is an uncompressed data type, and storage address 3 (0x0003) is also an uncompressed data type, then the first storage address 0x0002 and storage address 2 are the same, so the first data corresponding to the first storage address should be an uncompressed data type.
[0068] Please see Figure 6 , Figure 6 One implementation of step S420 is shown. Specifically, Figure 6 This includes step S424.
[0069] Step S424: If the data storage request is detected to include specified information, then the first data is determined to meet the compression conditions, and the first data is compressed, wherein the specified information is used to instruct the data preprocessing module to compress the first data.
[0070] In some implementations, the data storage request may also include specified information. If the data storage request obtained by the data preprocessor includes specified information, it is determined that the first data meets the compression conditions, and the first data is compressed.
[0071] Optionally, the specified information is only used to instruct the data preprocessing module to compress the first data obtained. The specified information can be in different forms, such as integer, floating-point, or string, without any further limitation.
[0072] Specifically, when the processor sends a data storage request to the data preprocessing module, it can determine whether compression is required based on the current first data type. If compression is required, the processor can add specified information to the data storage request and send it to the data preprocessing module together. For example, if the first data is image data, it can be compressed, and the processor can add specified information to the data storage request and send it to the data preprocessing module together. If the first data is code data, it does not need to be compressed, and the processor can send only the data storage request containing the first data to the data preprocessing module.
[0073] Optionally, the software executing the task in the electronic device can directly inform the processor whether the current first data needs to be compressed, and the processor then determines whether to send a specific message to the data preprocessing module. For example, if a video application is executing the current task, the first data is very likely image data. In this case, the video application can inform the processor that the first data needs to be compressed, and the processor directly generates an instruction message, adds it to the data storage request, and sends it to the data preprocessing module. If a code compilation application is executing the current task, the first data is very likely code data. In this case, the code compilation software can inform the processor that the first data does not need to be compressed, and the processor can choose not to generate an instruction message, but simply send a storage request including the first data to the data preprocessing module.
[0074] Please see Figure 7 , Figure 7 One implementation of step S420 is shown. Specifically, Figure 7 This includes steps S425 and S426.
[0075] Step S425: Based on the multiple storage addresses of the memory obtained in advance and the data type corresponding to each storage address, search for the data type corresponding to the first storage address in the identification table, wherein the data type includes compressed type and uncompressed type.
[0076] Step S426: If the data type corresponding to the first storage address is a compressed type, then compress the first data.
[0077] In some implementations, the data storage request obtained by the data preprocessing module may include first data and a first storage address corresponding to the first data. That is, the processor can send the first data and the first storage address together as a data storage request to the data preprocessing module. The data preprocessing module searches for the data type corresponding to the first storage address in the identification table based on multiple pre-acquired storage addresses of the memory and the data type corresponding to each storage address. The method for obtaining the identification table and the specific search method have been described in detail in the foregoing embodiments and will not be repeated here.
[0078] Specifically, the processor can pre-obtain the first storage address corresponding to the first data. For example, the application executing the current task in the electronic device can determine the specific storage address, i.e., the first storage address, where the first data will be stored based on its data type, and then inform the processor of this first storage address. The storage space corresponding to this first storage address may be empty or may already contain other data. In this case, writing the first data to the first storage space will overwrite existing data. Whether to write to an empty storage space or overwrite existing data is determined by the application of the electronic device and is not restricted here.
[0079] Furthermore, after obtaining the data type corresponding to the first storage address, if the data type corresponding to the first storage address is a compressed type, then the first data is compressed. The detailed method has been described in the foregoing embodiments and will not be repeated here.
[0080] Step S430: Send the compressed first data to the memory so that the memory stores the compressed target data.
[0081] In some implementations, the compressed first data can be sent to a memory, which can then store the compressed first data at the first address corresponding to the first data.
[0082] In some other implementations, the first data may not meet the compression conditions. In this case, the data preprocessing module will not compress the first data and can directly send the uncompressed first data to the memory. The memory stores the uncompressed first data according to the first storage address corresponding to the first data.
[0083] Optionally, the first storage address corresponding to the first data acquired by the memory can come from the data preprocessing module, or it can come from the processor sending the first storage address corresponding to the first data to the memory at the same time when sending the data storage request to the data preprocessing module.
[0084] The data transmission method, apparatus, electronic device, computer-readable medium, and product provided in this application enable a processor to connect to a bus via a processing module and then transmit data with a memory connected to the bus. Specifically, a data preprocessing module receives a data storage request for corresponding first data sent by the processor. If the first data meets compression conditions, the first data is compressed; the compressed first data is then sent to the memory so that the memory stores the compressed target data. If first data that does not need compression is also compressed before storage, it will increase the system's computing power consumption and reduce system efficiency. In this embodiment, the data preprocessing module determines whether the first data needs to be compressed based on the received data storage request, performs compression only on the first data that needs compression, and directly stores the first data that does not need compression into the memory, saving system computing power and improving efficiency.
[0085] Please see Figure 8 , Figure 8 This application illustrates a data transmission method provided by an embodiment of the present application. This method can be applied to the electronic device 200 in the foregoing embodiments. The electronic device 200 includes a processor 210, a data preprocessing module 220, a memory 230, and a bus 240. The data preprocessing module 220 can be the main execution entity of the method. Specifically, the method includes steps S810 to S850.
[0086] Step S810: Obtain the data processing request corresponding to the target data sent by the processor, wherein the receiving end corresponding to the data processing request is the processor or the memory.
[0087] Step S810 has been described in detail in the foregoing embodiments and will not be repeated here.
[0088] Step S820: Obtain the identifier of the second data, wherein the second data is stored in the memory.
[0089] Step S830: Determine whether the second data is compressed and stored based on the identifier of the second data.
[0090] In some implementations, the data processing request can be a data read request, and the receiving end corresponding to the data read request is the processor. In this case, the corresponding target data is the second data, and the data preprocessing module can obtain the data read request.
[0091] Specifically, the second data is stored in memory. The data preprocessing module can obtain the identifier of the second data and then determine whether the second data is stored in compressed form based on this identifier. For example, the identifier can be used to characterize the data type of the second data. For instance, image data can generally be stored in compressed form, while code data can be stored uncompressed. The data preprocessing module determines whether the second data is stored in compressed form based on the data type. Another example is that the identifier can also be used to characterize the storage address of the second data in memory, and the determination of whether the second data is stored in compressed form is based on this storage address. Yet another example is that the identifier can also be used to characterize whether the second data stored in memory is stored in compressed form; that is, the processor can directly inform the data preprocessing module whether the second data is stored in compressed form, and the data preprocessing module can directly perform subsequent steps based on this identifier.
[0092] Optional, please refer to Figure 9 When performing step S830, steps S831 and S832 may also be included.
[0093] Step S831: Based on the target storage address, determine the target data type of the second data stored at the target storage address in the memory.
[0094] Step S832: If the target data type is compressed data, then it is determined that the second data is compressed and stored.
[0095] In one embodiment provided in this application, the identifier of the second data is the target storage address of the second data within the memory. In this case, the data preprocessing module can determine the target data type of the second data stored at the target storage address based on the target storage address. Specifically, please refer to... Figure 10 This may include steps S833 and S834.
[0096] Step S833: Obtain an identification table, which includes multiple memory addresses and the data type corresponding to each memory address. The data type includes compressed type and uncompressed type.
[0097] Step S834: In the identification table, find the target data type corresponding to the target storage address.
[0098] Optionally, an identification table can be obtained in advance. This identification table includes multiple memory addresses and the data type corresponding to each memory address. The data type includes compressed and uncompressed types. A detailed description of this identification table can be found in the foregoing embodiments, and will not be repeated here.
[0099] Furthermore, based on the target storage address corresponding to the second data obtained above, the data type corresponding to the target storage address can be searched in the identification table. If the target data type is compressed data, then it is determined that the second data is stored in compressed form. Specifically, the method for finding the data type of the second data corresponding to the target storage address through the identification table is similar to the method for finding the data type of the first data corresponding to the first storage address through the identification table as described in the foregoing embodiments, and will not be repeated here.
[0100] Step S840: If the second data is stored in compressed form, then when the second data is obtained, the second data is decompressed.
[0101] Step S850: Send the decompressed second data to the processor.
[0102] Furthermore, in some implementations, if it is determined based on the aforementioned steps that the second data is stored in compressed form, the second data can be decompressed using the data preprocessing module. This ensures that the second data obtained by the processor is decompressed, allowing the processor to directly use the second data to execute tasks, optimizing the data transmission process and improving work efficiency. Therefore, when the data preprocessing module obtains the second data, it can decompress the second data and then send the decompressed second data to the processor. Specifically, the second data can be decompressed using the decompression module within the data preprocessing module.
[0103] Optionally, if the second data is not compressed and stored, the data preprocessing module can also directly send the second data to the processor.
[0104] This application provides a data transmission method, apparatus, electronic device, computer-readable medium, and product. The method enables a processor to connect to a bus via a processing module and then transmit data with a memory connected to the bus. Specifically, a data preprocessing module receives a data read request for corresponding second data sent by the processor. If the second data is compressed, it decompresses the second data and sends the decompressed second data to the processor so that the processor can directly use the uncompressed second data to perform tasks. If the storage method of the second data is not determined and the second data is directly transmitted to the processor, the processor needs to perform a decompression operation on the received second data, consuming processor processing time and reducing efficiency. Furthermore, performing decompression on every piece of second data, including uncompressed second data, wastes system resources and reduces efficiency. This application determines the data type of the second data, decompressing only compressed second data and directly sending uncompressed second data to the processor. This ensures that the processor receives uncompressed second data without wasting excessive resources on decompression operations, thus improving system efficiency.
[0105] Please see Figure 11 The diagram illustrates a structural block diagram of a data transmission device 1100 provided in an embodiment of this application. It is applied to a data preprocessing module of an electronic device. The electronic device also includes a processor, a memory, and a bus. The processor is connected to the bus through the preprocessing module, and the bus is connected to the memory. The device includes an acquisition unit 1110 and a processing unit 1120.
[0106] The acquisition unit 1110 is used to acquire a data processing request for corresponding target data sent by the processor, wherein the receiving end corresponding to the data processing request is the processor or the memory.
[0107] The processing unit 1120 is configured to respond to the data processing request, perform a preprocessing operation on the target data, and send the target data after the preprocessing operation to the receiving end corresponding to the data processing request.
[0108] Furthermore, the processing unit 1120 is also configured to: compress the first data if the first data meets the compression conditions; and send the compressed first data to the memory so that the memory stores the compressed target data.
[0109] Furthermore, the processing unit 1120 is also configured to: obtain a first storage address of the first data, wherein the first storage address is a storage address allocated by the memory to the processor; based on a plurality of storage addresses of the memory obtained in advance and the data type corresponding to each storage address, search in an identification table for the data type corresponding to the first storage address, wherein the data type includes compressed type and uncompressed type; if the data type corresponding to the first storage address is a compressed type, then compress the first data.
[0110] Furthermore, the processing unit 1120 is also configured to, if it detects that the data storage request includes specified information, determine that the first data meets the compression conditions and compress the first data, wherein the specified information is used to instruct the data preprocessing module to compress the first data.
[0111] Furthermore, the processing unit 1120 is also configured to, based on a plurality of storage addresses of the memory and the data type corresponding to each storage address, search for the data type corresponding to the first storage address in the identification table, wherein the data type includes compressed type and uncompressed type; if the data type corresponding to the first storage address is a compressed type, then the first data is compressed.
[0112] Furthermore, the processing unit 1120 is also configured to: acquire the identifier of the second data, wherein the second data is stored in the memory; determine whether the second data is compressed based on the identifier of the second data; if the second data is compressed, decompress the second data when the second data is acquired; and send the decompressed second data to the processor.
[0113] Furthermore, the processing unit 1120 is also configured to determine the target data type of the second data stored at the target storage address in the memory based on the target storage address; if the target data type is compressed data, then determine that the second data is stored in compressed form.
[0114] Furthermore, the processing unit 1120 is also configured to: obtain an identification table, the identification table including multiple memory addresses and data types corresponding to each memory address, the data types including compressed and uncompressed types; and search for the target data type corresponding to the target memory address within the identification table.
[0115] Those skilled in the art will understand that, for the sake of convenience and brevity, the specific working process of the above-described apparatus and unit can be referred to the corresponding process in the foregoing method embodiments, and will not be repeated here.
[0116] In the several embodiments provided in this application, the coupling between the units can be electrical, mechanical or other forms of coupling.
[0117] Furthermore, the functional units in the various embodiments of this application can be integrated into one processing unit, or each unit can exist physically separately, or two or more units can be integrated into one unit. The integrated unit can be implemented in hardware or as a software functional unit.
[0118] Please see Figure 12 , Figure 12 A structural block diagram of an electronic device 200 in the data transmission method provided in this application is shown. The electronic device 200 includes a processor 210, a data preprocessing module 220, a memory 230, and a bus 240. The data preprocessing module 220 includes an identification table 223 and a compression module 221. The processor 210 is electrically connected to the identification table 223 and the bus 240, respectively. The identification table 223 is electrically connected to the processor 210 and the compression module 221, respectively. The bus 240 is electrically connected to the compression module 221 and the memory 230, respectively.
[0119] In some implementations, the processor 210 is configured to send a data storage request to the data preprocessing module 220, the data storage request including the first data; the data preprocessing module 220 is configured to compress the first data if the first data meets the compression conditions; send the compressed first data to the memory 230; the memory 230 is configured to store the compressed first data.
[0120] Optionally, in other implementations, the data storage request further includes a first storage address of the first data, where the first storage address is the storage address allocated by the memory 230 to the processor 210; the processor 210 is further configured to send the first storage address to the memory 230; the data preprocessing module 220 is further configured to search for the data type corresponding to the first storage address in the identification table 223 based on a plurality of pre-acquired storage addresses of the memory 230 and the data type corresponding to each storage address, wherein the data type includes compressed and uncompressed types; if the data type corresponding to the first storage address is a compressed type, then the first data is compressed, and the compressed first data is sent to the memory 230; the memory 230 is further configured to store the compressed first data based on the received first storage address. Specifically, the data processing module can search for the data type corresponding to the first storage address through the identification table 223, and the compression module 221 compresses the first data of the compressed type.
[0121] In one exemplary manner, the processor 210 can obtain the storage address corresponding to the first data from the software executing the task in the electronic device 200. For example, if the software currently executing the task is a video recording application, the video recording application sends the first data and the first storage address corresponding to the first data to the processor 210 simultaneously. After obtaining the first data and the first storage address, the processor 210 sends the first data and the first storage address corresponding to the first data as a data storage request to the data preprocessing module 220. In another exemplary manner, the processor 210 can also obtain the first data only from the software executing the task in the electronic device 200, and then determine which location in the memory 230, i.e., the first storage address, can be stored based on the type of the first data. For example, if the processor 210 obtains the first data and the first data is image data, then the first data can be compressed. The processor 210 can allocate a corresponding first storage address for the first data based on the type of image data, and send the first data and the first storage address corresponding to the first data as a data storage request to the data preprocessing module 220.
[0122] Furthermore, as described above, after the data preprocessing module 220 compresses the first data, the memory 230 can obtain the compressed first data sent by the data preprocessing module 220 and the first storage address corresponding to the first data, and store the first data based on the first storage address. Alternatively, the memory 230 can also obtain the compressed first data sent by the data preprocessing module 220, and then obtain the first storage address corresponding to the first data sent by the processor 210, and store the first data based on the first storage address.
[0123] Optional, please refer to Figure 13 , Figure 13 A structural block diagram of an electronic device 200 in the data transmission method provided in this application is shown. Figure 13 The data preprocessing module 220 in the illustrated electronic device 200 is in Figure 12 In addition, it also includes a selection module 224. The selection module 224 is electrically connected to the bus 240, the compression module 221, the identification table 223 and the processor 210 respectively.
[0124] Specifically, when the processor 210 sends a data storage request to the identification table 223, it can send the first data to the selection module 224. After obtaining the result of whether the first data needs to be compressed based on the identification table, the processor 210 sends the result to the selection module 224. The compression module 221 then sends the compressed first data to the selection module 224. The selection module 224 can select the input first data based on the result sent by the identification table 223. For example, if the result indicates that the first data needs to be compressed, the selection module 224 can send the compressed first data sent by the compression module 221 to the bus 240 and then store it in the first storage location in the memory 230. If the result indicates that the first data does not need to be compressed, the selection module 224 can send the uncompressed first data sent by the processor 210 to the bus 240 and then store it in the first storage location in the memory 230. The selection module 224 can be a data selector (multiplexer), such as a 2-to-1 data selector, a 4-to-1 data selector, an 8-to-1 data selector, etc., which are not limited here.
[0125] The specific process of the data transmission method is similar to that of the aforementioned embodiments, and will not be repeated here.
[0126] Please see Figure 14 , Figure 14 A structural block diagram of an electronic device 200 in the data transmission method provided in this application is shown. The electronic device 200 includes a processor 210, a data preprocessing module 220, a memory 230, and a bus 240. The data preprocessing module 220 includes an identification table 223 and a decompression module 222. The processor 210 is electrically connected to the identification table 223 and the bus 240, respectively. The identification table 223 is electrically connected to the processor 210 and the compression module 221, respectively. The bus 240 is electrically connected to the decompression module 222 and the memory 230, respectively.
[0127] In some implementations, the processor 210 is used to send the target storage address of the second data to the memory 230 and to send a data read request to the data preprocessing module 220, the data read request including the target storage address of the second data; the data preprocessing module 220 is used to determine whether the second data is compressed based on the target storage address of the second data; if so, the data preprocessing module 220 is further used to decompress the acquired second data and send the decompressed second data to the processor 210.
[0128] Specifically, the data preprocessing module 220 can obtain the data type corresponding to the target storage address of the second data through the identification table 223, and then determine whether the second data is compressed and stored. The decompression module 222 can decompress the compressed and stored second data, and send the decompressed second data to the processor 210.
[0129] Please see Figure 15 , Figure 15 A structural block diagram of an electronic device 200 in the data transmission method provided in this application is shown. Figure 13 The data preprocessing module 220 in the illustrated electronic device 200 is in Figure 14 The diagram also includes a selection module 224. The selection module 224 is electrically connected to the bus 240, the decompression module 222, the identification table 223, and the processor 210.
[0130] Specifically, when the processor 210 sends a data read request to the identification table 223, it can instruct the memory 230 to send the second data to the selection module 224 via the bus 240. The identification table 223 obtains the target storage address of the second data based on the data read request and instructs the decompression module 222 to decompress the compressed second data, sending the decompressed second data to the selection module 224. The identification table 223 also sends a message indicating whether the second data is compressed to the selection module 224. The selection module 224 selects the data to be sent to the processor 210 based on whether the second data is compressed. For example, if the second data is compressed, the selection module 224 can select the decompressed second data sent from the decompression module 222 to send to the processor 210; if the second data is not compressed, the selection module 224 can select the undecompressed second data transmitted from the memory 230 via the bus 240 to send to the processor 210.
[0131] The specific process of the data transmission method is similar to that of the aforementioned embodiments, and will not be repeated here.
[0132] Specifically, the processor 210 may include one or more processing cores. The processor 210 may be the processing engine in a neural network processor (NPU) or a digital signal processor (DSP). The memory 230 may include double data rate synchronous dynamic random access memory (DDR) and static random access memory (SRAM). Optionally, the memory 230 may also include external storage, which may be a hard disk drive (HDD), a solid-state drive (SSD), a USB flash drive, a flash memory card, etc.
[0133] Please refer to Figure 16This diagram illustrates a structural block diagram of a computer-readable storage medium provided in an embodiment of this application. The computer-readable medium 1600 stores program code that can be called by a processor to execute the methods described in the above method embodiments.
[0134] The computer-readable storage medium 1600 may be an electronic memory such as flash memory, EEPROM (Electrically Erasable Programmable Read-Only Memory), EPROM, hard disk, or ROM. Optionally, the computer-readable storage medium 1600 includes a non-transitory computer-readable storage medium. The computer-readable storage medium 1600 has storage space for program code 1610 that performs any of the method steps described above. This program code can be read from or written to one or more computer program products. The program code 1610 may, for example, be compressed in a suitable form.
[0135] Please refer to Figure 17 The diagram illustrates a structural block diagram 1700 of a computer program product provided in an embodiment of this application. The computer program product 1700 includes a computer program / instructions 1710, which, when executed by a processor, implements the steps of the aforementioned method.
[0136] Finally, it should be noted that the above embodiments are only used to illustrate the technical solutions of this application, and are not intended to limit them. Although this application has been described in detail with reference to the foregoing embodiments, those skilled in the art should understand that modifications can still be made to the technical solutions described in the foregoing embodiments, or equivalent substitutions can be made to some of the technical features. Such modifications or substitutions do not cause the essence of the corresponding technical solutions to deviate from the spirit and scope of the technical solutions of the embodiments of this application.
Claims
1. A data transmission method, characterized by, The application discloses a data preprocessing module applied to an electronic device, wherein the electronic device further comprises a processor and a memory and a bus, the processor is connected with the bus through the preprocessing module, the bus is connected with the memory, and the method comprises the following steps: Obtaining a data processing request corresponding to target data sent by the processor, wherein the receiving end corresponding to the data processing request is the processor or the memory; In response to the data processing request, performing a preprocessing operation on the target data, and sending the target data after the preprocessing operation to the receiving end corresponding to the data processing request; In the case that the target data is first data, the data processing request is a data storage request, the receiving end corresponding to the data storage request is the memory, and the data storage request comprises the first data, the response to the data processing request, the preprocessing operation on the target data, and the sending of the target data after the preprocessing operation to the receiving end corresponding to the data processing request comprise the following steps: If the first data meets the compression condition, the first data is compressed; The compressed first data is sent to the memory, so that the memory stores the compressed target data; If the first data meets the compression condition, the first data is compressed, comprising: If the data storage request comprises specified information, it is determined that the first data meets the compression condition, and the first data is compressed, wherein the specified information is used to indicate that the first data is compressed by the data preprocessing module, and the specified information is added to the data storage request by the processor according to the type of the first data when it is determined that the compression operation needs to be performed.
2. The method of claim 1, wherein, If the first data meets the compression condition, the first data is compressed, comprising: Obtaining a first storage address of the first data, wherein the first storage address is a storage address allocated to the processor by the memory; Based on the plurality of storage addresses of the memory and the data type corresponding to each storage address obtained in advance, the data type corresponding to the first storage address is found in the mark table, wherein the data type comprises a compression type and a non-compression type; If the data type corresponding to the first storage address is the compression type, the first data is compressed.
3. The method of claim 2, wherein, The data storage request further comprises the first storage address of the first data, and if the first data meets the compression condition, the first data is compressed, comprising: Based on the plurality of storage addresses of the memory and the data type corresponding to each storage address obtained in advance, the data type corresponding to the first storage address is found in the mark table, wherein the data type comprises a compression type and a non-compression type; If the data type corresponding to the first storage address is the compression type, the first data is compressed.
4. The method of claim 1, wherein, The target data is second data, the data processing request is a data reading request, a receiving end corresponding to the data reading request is the processor, and in response to the data processing request, a preprocessing operation is performed on the target data, and the target data after the preprocessing operation is sent to the receiving end corresponding to the data processing request, including: Obtaining an identifier of the second data, wherein the second data is stored in the memory; Determine whether the second data is compressed based on the identifier of the second data; If the second data is compressed, the second data is decompressed when the second data is obtained; The decompressed second data is sent to the processor.
5. The method of claim 4, wherein, The identifier of the second data is a target storage address of the second data in the memory, and the determination of whether the second data is compressed based on the identifier of the second data includes: Based on the target storage address, determine the target data type of the second data stored in the memory at the target storage address; If the target data type is compressed data, it is determined that the second data is compressed.
6. The method of claim 5, wherein, The target data type of the second data stored in the memory at the target storage address based on the target storage address includes: Obtain a mark table, the mark table includes a plurality of storage addresses of the memory and a data type corresponding to each storage address, and the data type includes a compressed type and a non-compressed type; In the mark table, find the target data type corresponding to the target storage address.
7. A data transmission apparatus, characterized by comprising: The data preprocessing module applied to the electronic device, the electronic device further includes a processor and a memory and a bus, the processor is connected with the bus through the preprocessing module, the bus is connected with the memory, and the device includes: An obtaining unit is configured to obtain a data processing request corresponding to target data sent by the processor, and a receiving end corresponding to the data processing request is the processor or the memory; The processing unit is configured to perform a preprocessing operation on the target data in response to the data processing request, and send the target data after the preprocessing operation to a receiving end corresponding to the data processing request; in a case where the target data is first data, the data processing request is a data storage request, the receiving end corresponding to the data storage request is the storage, and the data storage request includes the first data, the response to the data processing request, the performance of the preprocessing operation on the target data, and the sending of the target data after the preprocessing operation to the receiving end corresponding to the data processing request include: if the first data meets a compression condition, the first data is compressed; and the compressed first data is sent to the storage, so that the storage stores the compressed target data; and the compression of the first data if the first data meets the compression condition includes: if the data storage request includes specified information, it is determined that the first data meets the compression condition, and the first data is compressed, where the specified information is used to instruct the data preprocessing module to compress the first data, and the specified information is added to the data storage request by the processor according to a type of the first data when it is determined that a compression operation needs to be performed.
8. An electronic device, comprising: Comprise: A processor, a data preprocessing module, a storage, and a bus, the processor is connected with the bus through the preprocessing module, the bus is connected with the storage, the preprocessing module is used to perform the method of any one of claims 1-6.
9. The electronic device of claim 8, wherein, The processor is configured to send a data storage request to the data preprocessing module, and the data storage request includes first data; The data preprocessing module is configured to compress the first data if the first data meets a compression condition, and send the compressed first data to the storage; The storage is configured to store the compressed first data.
10. The electronic device of claim 9, wherein, The data storage request further includes a first storage address of the first data, and the first storage address is a storage address allocated to the processor by the storage; The processor is further configured to send the first storage address to the storage; The data preprocessing module is further configured to find a data type corresponding to the first storage address in an indication table based on a plurality of storage addresses of the storage and a data type corresponding to each storage address that are acquired in advance, where the data type includes a compression type and a non-compression type; if the data type corresponding to the first storage address is the compression type, the first data is compressed, and the compressed first data is sent to the storage; The storage is further configured to store the compressed first data based on the received first storage address.
11. The electronic device of claim 8, wherein, The processor is configured to send a target storage address of second data to the storage, and send a data reading request to the data preprocessing module, and the data reading request includes the target storage address of the second data; The data preprocessing module is configured to determine whether the second data is compressed based on a target storage address of the second data. If yes, the data preprocessing module is further configured to decompress the obtained second data and send the decompressed second data to the processor.
12. A computer-readable storage medium, characterized in that, The computer readable storage medium stores program codes, which can be invoked by the processor to execute the method of any one of claims 1-6.
13. A computer program product, characterised in that, The computer program / instruction is executed by the processor to implement the method of any one of claims 1-6.
Citation Information
Patent Citations
Data storage and access method, nodes and server cluster
CN106951190A
Data compression method and device and computer readable storage medium
CN111984610A
Method and system for adding compressed page tables to an operating system
US20020178333A1