Data convolution processing methods and system, and electronic device

By constructing data arrangement mapping relationships and performing matrix multiplication and addition operations, the problem of performance degradation and insufficient computing power caused by data filling in convolution processing is solved, and processing efficiency is improved.

WO2024222488A1PCT designated stage expired Publication Date: 2024-10-31ALIBABA CLOUD COMPUTING CO LTD
View PDF 4 Cites 0 Cited by

Patent Information

Application Number
PCT/CN2024/087553
Authority / Receiving Office
WO · WO
Patent Type
Applications
Current Assignee / Owner
Priority Date
2023-04-23
Filing Date
2024-04-12
Publication Date
2024-10-31

AI Technical Summary

Technical Problem

The existing technology has problems in convolution processing, such as increased storage capacity and memory access requirements caused by data filling, reduced processing performance of matrix multipliers, and limited computing power of non-matrix arithmetic units, which makes it impossible to effectively perform convolution processing on data.

Method used

By constructing a mapping relationship between the original data in the memory and the data arrangement information of the input matrix in the processor, the data mapping relationship is called to directly load the data to the processor, and perform matrix multiplication and addition operations, reducing data transfer and calculation overhead, and improving volume. product processing efficiency.

Benefits of technology

It improves the efficiency of data convolution processing, reduces storage space occupation and computing overhead, and solves the technical problem of being unable to effectively convolute data.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN2024087553_31102024_PF_FP_ABST
    Figure CN2024087553_31102024_PF_FP_ABST
Patent Text Reader

Abstract

Disclosed in the present application are data convolution processing methods and system, and an electronic device. A method comprises: acquiring original data loaded onto a memory, wherein the original data is to be used for executing a convolution operation task; invoking a data mapping relationship to load the original data into a processor, so as to obtain an input matrix, the data mapping relationship at least being used for representing a correspondence relationship between the original data in the memory and data arrangement information of the input matrix in the processor; and performing matrix multiplication and addition operation on the input matrix in the processor to obtain a convolution operation result of the original data under the convolution operation task. The present application solves the technical problem that convolution processing cannot be effectively performed on data.
Need to check novelty before this filing date? Find Prior Art

Description

Data convolution processing method, system and electronic device

[0001] This application claims priority to the Chinese patent application filed with the China Patent Office on April 23, 2023, with application number 202310456792.2 and invention name “Convolution processing method, system and electronic device for data”, the entire contents of which are incorporated by reference into this application. Technical Field

[0002] The present application relates to the field of data processing technology, and in particular to a data convolution processing method, system and electronic device. Background Art

[0003] With the rapid development of the artificial intelligence (AI) ecosystem, higher requirements are placed on the processing performance of AI processors.

[0004] In related technologies, matrix multiplication and addition units can be used for convolution calculations, but the data needs to be padded with 0s to a regular size, which introduces additional storage capacity and memory access requirements; non-matrix operation units can also be used for convolution calculations, but their own computing power is limited, and there is a technical problem that they cannot effectively perform convolution processing on data.

[0005] To address the above-mentioned problems, no effective solutions have been proposed so far.

[0006] Summary of the Invention

[0007] The embodiments of the present application provide a method for convolution processing of data to at least solve the technical problem of being unable to effectively perform convolution processing on data.

[0008] According to one aspect of an embodiment of the present application, a method for convolution processing of data is provided. The method may include: collecting raw data loaded into a memory, wherein the raw data is to be used to perform a convolution operation task; calling a data mapping relationship to load the raw data into a processor to obtain an input and output matrix, wherein the data mapping relationship is at least used to represent the corresponding relationship between the raw data in the memory and the data arrangement information of the input matrix in the processor; performing a matrix multiplication and addition operation on the input matrix in the processor to obtain a convolution operation result of the raw data under the convolution operation task.

[0009] According to another aspect of an embodiment of the present application, a data convolution processing device is also provided. The device may include: an acquisition unit for acquiring raw data loaded into a memory, wherein the raw data is to be used to perform a convolution operation task; a calling unit for calling a data mapping relationship to load the raw data into a processor to obtain an input matrix, wherein the data mapping relationship is at least used to represent the correspondence between the raw data in the memory and the data arrangement information of the input matrix in the processor; and an operation unit for performing a matrix multiplication and addition operation on the input matrix in the processor to obtain a convolution operation result of the raw data under the convolution operation task.

[0010] According to another aspect of an embodiment of the present application, a method for convolution processing of data is also provided. The method includes: obtaining raw data input to a data processing model, wherein the raw data is to be used to perform a convolution operation task; calling a data mapping relationship to load the raw data loaded into a memory into a processor to obtain an input matrix, wherein the data mapping relationship is at least used to represent the correspondence between the raw data in the memory and the data arrangement information of the input matrix in the processor; performing a matrix multiplication and addition operation on the input matrix in the processor to obtain a convolution operation result of the raw data under the convolution operation task; and determining an output result of the data processing model based on the convolution operation result.

[0011] According to another aspect of an embodiment of the present application, a data convolution processing device is also provided. The device includes: an acquisition unit for acquiring raw data input to a data processing model, wherein the raw data is to be used to perform a convolution operation task; a calling unit for calling a data mapping relationship to load the raw data loaded into a memory into a processor to obtain an input matrix, wherein the data mapping relationship is at least used to represent the correspondence between the raw data in the memory and the data arrangement information of the input matrix in the processor; an operation unit for performing a matrix multiplication and addition operation on the input matrix in the processor to obtain a convolution operation result of the raw data under the convolution operation task; and a determination unit for determining an output result of the data processing model based on the convolution operation result.

[0012] According to another aspect of an embodiment of the present application, a data convolution processing system is also provided. The system includes: a memory for loading raw data, wherein the raw data is to be used to perform a convolution operation task; a matrix input unit for calling a data mapping relationship to load the raw data into a processor to obtain an input matrix, wherein the data mapping relationship is at least used to represent the correspondence between the raw data in the memory and the data arrangement information of the input matrix in the processor; and a processor for performing a matrix multiplication and addition operation on the input matrix to obtain a convolution operation result of the raw data under the convolution operation task.

[0013] According to another aspect of an embodiment of the present application, a computer-readable storage medium is also provided, which includes a stored program, wherein when the program is executed by a processor, the device where the computer-readable storage medium is located is controlled to execute a convolution processing method for data.

[0014] According to another aspect of an embodiment of the present application, an electronic device is also provided, including a memory and a processor, wherein the memory stores an executable program, and the processor is used to run the program stored in the memory, wherein the program executes a data convolution processing method when running.

[0015] In an embodiment of the present application, raw data loaded into a memory is collected, wherein the raw data is to be used to perform a convolution operation task; a data mapping relationship is called to load the raw data into a processor to obtain an input matrix, wherein the data mapping relationship is at least used to represent the corresponding relationship between the raw data in the memory and the data arrangement information of the input matrix in the processor; a matrix multiplication and addition operation is performed on the input matrix in the processor to obtain a convolution operation result of the raw data under the convolution operation task. That is, in an embodiment of the present application, a mapping relationship is constructed between the raw data stored in the memory and the data arrangement information of the input matrix in the processor. Based on this, the data mapping relationship can be called to directly load the raw data into the processor to obtain an input matrix, and a matrix multiplication and addition operation is performed on the input matrix in the processor and the weight matrix corresponding to the raw data to obtain a convolution operation result of the raw data under the convolution operation task. The data arrangement information corresponding to the raw data can be obtained through the mapping relationship, which reduces the storage space occupied by data transfer and the computational overhead caused by data handling, thereby achieving the technical effect of improving the efficiency of data convolution processing, thereby solving the technical problem of being unable to effectively perform convolution processing on data. BRIEF DESCRIPTION OF THE DRAWINGS

[0016] In the accompanying drawings, unless otherwise specified, the same reference numerals throughout the multiple drawings represent the same or similar components or elements. These drawings are not necessarily drawn to scale. It should be understood that these drawings only depict some embodiments disclosed in this application and should not be construed as limiting the scope of this application.

[0017] FIG1 is a hardware structure block diagram of a computer terminal (or mobile device) for implementing convolution processing of data according to an embodiment of the present application;

[0018] FIG2 is a block diagram of a computing environment according to an embodiment of the present application;

[0019] FIG3 is a structural block diagram of a service grid according to an embodiment of the present application;

[0020] FIG4 is a flow chart of a data convolution method according to an embodiment of the present application;

[0021] FIG5 is a flow chart of a method for convolution processing of data according to an embodiment of the present application;

[0022] FIG6 is a schematic diagram of a data convolution processing system according to an embodiment of the present application;

[0023] FIG7 is a schematic diagram of performing a convolution operation using a matrix multiplication-addition unit according to an embodiment of the present application;

[0024] FIG8 is a schematic diagram of a data convolution processing process according to an embodiment of the present application;

[0025] FIG9 is a schematic diagram of data mapping and data handling according to an embodiment of the present application;

[0026] FIG10 is a flowchart of a method for implementing convolution processing of data on a GPU according to an embodiment of the present application;

[0027] FIG11 is a schematic diagram of a convolution operator of an AI model performing a convolution operation on data according to an embodiment of the present application;

[0028] FIG12 is a schematic diagram of a feature map data array according to an embodiment of the present application;

[0029] FIG13 is a schematic diagram of a data convolution processing device according to an embodiment of the present application;

[0030] FIG14 is a schematic diagram of a data convolution processing device according to an embodiment of the present application;

[0031] FIG15 is a structural block diagram of a computer terminal according to an embodiment of the present application. DETAILED DESCRIPTION

[0032] To make the purpose, technical solutions, and advantages of the embodiments of this application more clear, the technical solutions in the embodiments of this application will be clearly and completely described below in conjunction with the drawings in the embodiments of this application. Obviously, the described embodiments are part of the embodiments of this application, not all of the embodiments. Based on the embodiments in this application, all other embodiments obtained by ordinary technicians in this field without making creative efforts are within the scope of protection of this application.

[0033] In order to enable those skilled in the art to better understand the present invention, the following will clearly and completely describe the technical solutions in the embodiments of the present invention in conjunction with the drawings in the embodiments of the present invention. Obviously, the described embodiments are only part of the embodiments of the present invention, not all of the embodiments. Based on the embodiments in the present invention, all other embodiments obtained by ordinary technicians in this field without making creative efforts should fall within the scope of protection of this application.

[0034] It should be noted that the terms "first", "second", etc. in the specification and claims of the present application and the above-mentioned drawings are used to distinguish similar objects and are not necessarily used to describe a specific order or sequential order. It should be understood that the data used in this way can be interchangeable where appropriate, so that the embodiments of the present application described herein can be implemented in a sequence other than those illustrated or described herein. In addition, the terms "including" and "having" and any of their variations are intended to cover non-exclusive inclusions, for example, a process, method, system, product or device comprising a series of steps or units is not necessarily limited to those steps or units clearly listed, but may include other steps or units that are not clearly listed or inherent to these processes, methods, products or devices.

[0035] First, some nouns or terms that appear in the description of the embodiments of the present application are subject to the following interpretations:

[0036] Convolution, also known as rotation or convolution, is a mathematical operation that generates a third function through functions f and g. It is essentially a special integral transformation that represents the integral of the product of the overlapping function values ​​of functions f and g after flipping and translating them over the overlapping length.

[0037] Matrix multiplication and addition unit, a processing unit for calculating the multiplication of two matrices;

[0038] AI chips, AI accelerators, or computing cards are modules used to handle the large number of computing tasks in AI applications. AI chips are mainly divided into graphics processing units (GPUs), field programmable gate arrays (FPGAs), and application-specific integrated circuits (ASICs).

[0039] Fast Convolution Algorithm (Img2col), an accelerated computing strategy for implementing convolution operations, can convert convolution operations into matrix multiplications, thereby utilizing the processor to maximize the shortening of convolution calculation time.

[0040] Example 1

[0041] According to an embodiment of the present application, a method for convolution processing of data is also provided. It should be noted that the steps shown in the flowchart of the accompanying drawings can be executed in a computer system such as a set of computer-executable instructions, and although a logical order is shown in the flowchart, in some cases, the steps shown or described can be executed in an order different from that shown here.

[0042] The method embodiment provided in Example 1 of the present application can be executed in a mobile terminal, a computer terminal or a similar computing device. Figure 1 shows a hardware structure block diagram of a computer terminal (or mobile device) for implementing convolution processing of data. As shown in Figure 1, the computer terminal 10 (or mobile device 10) may include one or more (102a, 102b, ..., 102n are used in the figure to illustrate) processors 102 (the processor 102 may include but is not limited to a microprocessor (Micro Controller Unit, referred to as MCU) or a programmable logic device (Field Programmable Gate Array, referred to as FPGA) and other processing devices), a memory 104 for storing data, and a transmission module 106 for communication functions. In addition, it may also include: a display, an input / output interface (Input / Output, referred to as I / O) interface, a universal serial bus (Universal Serial Bus, referred to as USB) port (which can be included as one of the ports of the BUS bus), a network interface, a power supply and / or a camera. It can be understood by those skilled in the art that the structure shown in Figure 1 is only a schematic diagram and does not limit the structure of the above-mentioned electronic device. For example, the computer terminal 10 may also include more or fewer components than shown in FIG. 1 , or have a configuration different from that shown in FIG. 1 .

[0043] It should be noted that the one or more processors 102 and / or other data processing circuits described above may generally be referred to herein as "data processing circuitry". The data processing circuitry may be embodied in whole or in part as software, hardware, firmware, or any other combination thereof. In addition, the data processing circuitry may be a single independent processing module, or may be incorporated in whole or in part into any of the other components of the computer terminal 10 (or mobile device). As described in the embodiments of the present application, the data processing circuitry serves as a processor control (e.g., selection of a variable resistor terminal path connected to an interface).

[0044] The memory 104 can be used to store software programs and modules of application software, such as the program instructions / data storage device corresponding to the convolution processing method of data in the embodiment of the present application. The processor 102 executes various functional applications and data processing by running the software programs and modules stored in the memory 104, that is, realizing the above-mentioned convolution processing method of data. The memory 104 may include a high-speed random access memory, and may also include a non-volatile memory, such as one or more magnetic storage devices, flash memory, or other non-volatile solid-state memory. In some instances, the memory 104 may further include a memory remotely located relative to the processor 102, and these remote memories may be connected to the computer terminal 10 via a network. Examples of the above-mentioned network include, but are not limited to, the Internet, an intranet, a local area network, a mobile communication network, and combinations thereof.

[0045] The transmission device 106 is used to receive or send data via a network. A specific example of the aforementioned network may include a wireless network provided by the communications provider of the computer terminal 10. In one embodiment, the transmission device 106 includes a network interface controller (NIC), which can be connected to other network devices via a base station to enable communication with the Internet. In another embodiment, the transmission device 106 may be a radio frequency (RF) module, which is used to communicate with the Internet wirelessly.

[0046] The display may be, for example, a touch screen liquid crystal display (LCD), which enables a user to interact with a user interface of the computer terminal 10 (or mobile device).

[0047] The hardware structure block diagram shown in FIG1 can serve not only as an exemplary block diagram of the computer terminal 10 (or mobile device) described above, but also as an exemplary block diagram of the server described above. In an optional embodiment, FIG2 shows a block diagram of an embodiment using the computer terminal 10 (or mobile device) shown in FIG1 as a computing node in a computing environment 201. FIG2 shows a structural block diagram of a computing environment. As shown in FIG2, the computing environment 201 includes multiple computing nodes (such as servers) (illustrated as 210-1, 210-2, ...) running on a distributed network. Each computing node includes local processing and memory resources, and the end user 202 can remotely run applications or store data in the computing environment 201. Applications can be provided as multiple services 220-1, 220-2, 220-3, and 220-4 in the computing environment 201, representing services "A," "D," "E," and "H," respectively.

[0048] End user 202 can provide and access services through a web browser or other software application on a client. In some embodiments, the provisioning and / or request of end user 202 can be provided to the ingress gateway 230. The ingress gateway 230 may include a corresponding agent to handle the provisioning and / or request for services (one or more services provided in the computing environment 201).

[0049] Services are provided or deployed based on various virtualization technologies supported by the computing environment 201. In some embodiments, services can be provided based on virtual machine (VM)-based virtualization, container-based virtualization, and / or similar methods. Virtual machine-based virtualization can simulate a real computer by initializing a virtual machine, executing programs and applications without directly contacting any actual hardware resources. While the virtual machine virtualizes the machine, according to container-based virtualization, a container can be started to virtualize the entire operating system (OS) so that multiple workloads can run on a single operating system instance.

[0050] In one embodiment based on container virtualization, several containers of service 220 can be assembled into a workload container group (POD) (e.g., Kubernetes POD). For example, as shown in Figure 2, service 220-2 can be equipped with one or more PODs 240-1, 240-2, ..., 240-N (collectively referred to as POD 240). Each POD 240 can include an agent 245 and one or more containers 242-1, 242-2, ..., 242-M (collectively referred to as containers 242). One or more containers 242 in POD 240 process requests related to one or more corresponding functions of the service, and the agent 245 generally controls network functions related to the service, such as routing, load balancing, etc. Other services can also be equipped with PODs similar to PODs.

[0051] During operation, executing a user request from end user 202 may require invoking one or more services 220 in computing environment 201. Executing one or more functions of one service 220 may require invoking one or more functions of another service 220. As shown in Figure 2, service "A" 220-1 receives a user request from end user 202 from ingress gateway 230. Service "A" 220-1 may invoke service "D" 220-2, and service "D" 220-2 may request service "E" 220-3 to execute one or more functions.

[0052] This computing environment can be a cloud computing environment, where resource allocation is managed by the cloud service provider, allowing for feature development without having to worry about implementing, adjusting, or scaling servers. This computing environment allows developers to execute code in response to events without building or maintaining complex infrastructure. Services can be partitioned to perform a set of functions that can scale independently and automatically, rather than scaling a single hardware device to handle the potential load.

[0053] In another alternative embodiment, FIG3 shows a block diagram of an embodiment using the computer terminal 10 (or mobile device) shown in FIG1 as a service grid. FIG3 shows a structural block diagram of a service grid. As shown in FIG3, the service grid 300 is primarily used to facilitate secure and reliable communication between multiple microservices. Microservices refer to the decomposition of an application into multiple smaller services or instances, which are distributed and run on different clusters / machines.

[0054] As shown in Figure 3, microservices may include application service instance A and application service instance B, which form the functional application layer of service grid 300. In one embodiment, application service instance A runs as a container / process 308 on a machine / workload container group 314 (POD), and application service instance B runs as a container / process 310 on a machine / workload container group 316 (POD).

[0055] In one embodiment, application service instance A can call the data mapping relationship to load the original data into the processor to obtain the input matrix, and application service instance B can perform matrix multiplication and addition operations on the input matrix in the processor to obtain the convolution operation result of the original data under the convolution operation task.

[0056] As shown in Figure 3, application service instance A and grid proxy (sidecar) 303 coexist in machine workload container group 614, while application service instance B and grid proxy 305 coexist in machine workload container 314. Grid proxy 303 and grid proxy 305 form the data plane layer (dataplane) of service grid 300. Grid proxy 303 and grid proxy 305 respectively operate as container / process 304, which can receive requests 312 for product query services, and grid proxy 306. Bidirectional communication is possible between grid proxy 303 and application service instance A, and between grid proxy 305 and application service instance B. Furthermore, bidirectional communication is possible between grid proxy 303 and grid proxy 305.

[0057] In one embodiment, all traffic from application service instance A is routed to the appropriate destination via grid proxy 303, and all network traffic from application service instance B is routed to the appropriate destination via grid proxy 305. It should be noted that network traffic mentioned herein includes, but is not limited to, Hypertext Transfer Protocol (HTTP), Representational State Transfer (REST), the high-performance, general-purpose open source framework (Google Remote Procedure Call, gRPC), and open source in-memory data structure storage systems (such as Remote Dictionary Server (Redis)).

[0058] In one embodiment, the data plane layer's functionality can be extended by writing custom filters for the proxies in service mesh 300. Service mesh proxy configuration can be designed to enable the service mesh to correctly proxy service traffic, enabling service interoperability and service governance. Mesh proxy 303 and mesh proxy 305 can be configured to perform at least one of the following functions: service discovery, health checking, routing, load balancing, authentication and authorization, and observability.

[0059] As shown in Figure 3 , the service grid 300 also includes a control plane layer. The control plane layer can be comprised of a set of services running in a dedicated namespace, hosted by a managed control plane component 301 within a machine / workload container group (machine / pod) 302. As shown in Figure 3 , managed control plane component 301 communicates bidirectionally with mesh proxy 303 and mesh proxy 305. Managed control plane component 301 is configured to perform certain control and management functions. For example, managed control plane component 301 receives telemetry data transmitted by mesh proxy 303 and mesh proxy 305 and can further aggregate this telemetry data. Managed control plane component 301 can also provide user-oriented application programming interfaces (APIs) for these services, making it easier to manipulate network behavior and provide configuration data to mesh proxy 303 and mesh proxy 305.

[0060] In the above operating environment, the present application provides a data convolution processing method as shown in Figure 4. Figure 4 is a flow chart of a data convolution method according to an embodiment of the present application. As shown in Figure 4, the method may include the following steps:

[0061] Step S401 : collecting raw data loaded into a memory, wherein the raw data is to be used for performing a convolution operation task.

[0062] In the technical solution provided in the above step S401 of the present application, the original data can be a picture or a frame of video, and the memory can be a data memory, for example, a memory, a video memory, a memory of different levels (cache) or other storage units. After the original data is loaded into the memory, the original data loaded into the memory can be collected, wherein the original data is to be used to perform the convolution operation task.

[0063] In this embodiment, tasks can be divided according to the convolution operation tasks to be performed, and a convolution subtask can be assigned to each submodule in the processor for performing the convolution operation. After that, the original data required by each submodule is loaded into the memory, and then the original data loaded into the memory is collected, wherein the number of channels of the original data is less than the channel number threshold. The channel number threshold can be pre-set, for example, the channel number threshold can be 4, and no specific limitation is made here.

[0064] It should be noted that the convolution kernel size corresponding to the convolution operation task is greater than the convolution kernel size threshold, where the convolution kernel size threshold can be set in advance. For example, the convolution kernel size threshold can be 1, and no specific limitation is made here.

[0065] Step S402: calling the data mapping relationship to load the original data into the processor to obtain an input matrix.

[0066] In the technical solution provided in step S402 of this application, a data mapping relationship is pre-set. This data mapping relationship is used to represent the correspondence between the raw data stored in the memory and the data arrangement information of the input matrix in the processor. The data arrangement information indicates the logical order in which the input matrix is ​​stored and arranged in the processor. Different processor chips correspond to different input matrix data arrangement information. Based on this, after the raw data is collected from the memory, the data mapping relationship can be used to load the raw data into the processor to obtain the input matrix.

[0067] For example, after calling the data mapping relationship, the data mapping relationship can be used to determine the data stored in the memory that is consistent with the original data, and the data arrangement information corresponding to the found data can be used as the data arrangement information of the input matrix corresponding to the original data in the processor. After determining the data arrangement information, the original data can be directly loaded into the processor through the data mapping relationship to obtain the input matrix.

[0068] In this embodiment, the original data can be arranged according to the corresponding data arrangement information to meet the processing requirements of the processor, and the original data can be directly loaded into the processor according to the data mapping relationship to obtain the input matrix, thereby reducing the storage space occupied by data transfer and improving data processing efficiency.

[0069] Step S403: Perform matrix multiplication and addition operations on the input matrix in the processor to obtain a convolution operation result of the original data under the convolution operation task.

[0070] In the technical solution provided in the above step S403 of the present application, after the original data is loaded into the processor according to the corresponding data mapping relationship to obtain the input matrix, the matrix multiplication and addition operation can be performed on the input matrix in the processor to obtain the convolution operation result of the original data under the convolution operation task.

[0071] In this embodiment, matrix multiplication and addition operations can be performed on the input matrix in the processor and the weight matrix corresponding to the original data to obtain the convolution operation result of the original data under the convolution operation task, wherein the weight matrix corresponding to the original data can be pre-adjusted for data arrangement according to the convolution expansion, and then loaded into the processor using the load_matrix_sync function to participate in the matrix multiplication and addition task.

[0072] Based on the scheme disclosed in steps S401 to S403 of the above embodiment, the original data loaded into the memory is collected, wherein the original data is to be used to perform the convolution operation task; the data mapping relationship is called to load the original data into the processor to obtain an input matrix, wherein the data mapping relationship is at least used to represent the correspondence between the original data in the memory and the data arrangement information of the input matrix in the processor; the matrix multiplication and addition operation is performed on the input matrix in the processor to obtain the convolution operation result of the original data under the convolution operation task. That is, in the embodiment of the present application, a mapping relationship between the original data stored in the memory and the data arrangement information of the input matrix in the processor is constructed. Based on this, the original data can be directly loaded into the processor by calling the data mapping relationship to obtain the input matrix, thereby reducing the storage space occupied by data transfer and the computational overhead caused by data handling. By performing the matrix multiplication and addition operation on the input matrix in the processor, the convolution operation result of the original data under the convolution operation task can be obtained, thereby achieving the technical effect of improving the efficiency of data convolution processing, thereby solving the technical problem of the inability to effectively perform convolution processing on data in the prior art.

[0073] The above method of this embodiment is further introduced below.

[0074] As an optional implementation, the data mapping relationship is also used to represent the correspondence between the original data in the memory and the first storage location index of the input matrix in the processor. The first storage location index is used to index the storage location of the input matrix in the processor. According to the data mapping relationship, the original data is mapped to the corresponding first storage location index.

[0075] In this embodiment, the first storage location index is used to index the storage location of the input matrix in the processor, that is, the first storage location index is used to determine the storage location of the input matrix in the processor, and the data mapping relationship is used to represent the correspondence between the original data in the memory and the first storage location index of the input matrix in the processor. Based on this, data consistent with the original data can be determined from the data mapping relationship, and then the first storage location index corresponding to the found data in the processor is determined as the first storage location index corresponding to the original data. Thereafter, the storage location of the original data in the processor is determined based on the first storage location index, and the original data is stored at this location.

[0076] As an optional implementation, calling the data mapping relationship to load the original data into the processor to obtain an input matrix includes: calling the data mapping relationship to load the original data into the storage location indexed by the first storage location index in the processor for storage to obtain the input matrix.

[0077] In this embodiment, as can be seen from the introduction of the aforementioned step S402, the data mapping relationship is used to represent the correspondence between the original data stored in the memory and the data arrangement information of the input matrix in the processor. Based on this, the data mapping relationship can be called, and the data arrangement information corresponding to the original data can be determined based on the data mapping relationship. Afterwards, the original data can be directly loaded into the storage location indexed by the first storage location index in the processor through the data mapping relationship for storage to obtain the input matrix, wherein the storage location can be the register file to which the input matrix belongs.

[0078] As an optional implementation, the method further includes: determining the first storage location index based on a processor model.

[0079] In this embodiment, the first storage location index of the corresponding input matrix is ​​different depending on the processor model. Based on this, the first storage location index corresponding to the original data can be determined according to the model of the processor used, and then the original data can be loaded into the storage location indexed by the first storage location index in the processor according to the corresponding data arrangement information for storage.

[0080] As an optional implementation, step S403 performs a matrix multiplication and addition operation on the input matrix in the processor to obtain a convolution operation result of the original data under the convolution operation task, including: performing a matrix multiplication and addition operation on the input matrix in the processor according to the weight of the original data to obtain a convolution operation result.

[0081] In this embodiment, before performing a matrix multiplication and addition operation on the input matrix, the matrix multiplication and addition unit in the processor can be divided into multiple sub-modules according to the convolution parameters of the matrix multiplication and addition unit, and a convolution sub-task is assigned to each sub-module to obtain multiple convolution sub-tasks, wherein the convolution parameters specify the convolution operation mode and information such as the amount of data required to perform the convolution operation task. Afterwards, the multiple sub-modules can perform matrix multiplication and addition operations on the weights of the input matrix and the original data according to their own assigned sub-tasks, thereby obtaining the convolution operation results.

[0082] For example, the input matrix is ​​the input matrix corresponding to the original data, the weight of the original data can be the weight data or weight matrix corresponding to the original data, and multiple sub-modules can perform convolution operations based on the input matrix and the weight data corresponding to the original data. The original data can be directly loaded into the registers of the processor according to the data mapping relationship, and the weight data corresponding to the original data can be pre-arranged and adjusted according to the convolution expansion, and then loaded into the registers of the processor using the load_matrix_sync function to participate in the convolution operation task.

[0083] As an optional implementation, the data mapping relationship is also used to represent the correspondence between the weight of the original data in the memory and the second storage location index in the processor. The second storage location index is used to index the storage location of the weight of the original data in the processor. The data convolution processing method also includes: calling the data mapping relationship, loading the weight of the original data into the storage location indexed by the second storage location index in the processor for storage.

[0084] In this embodiment, the data mapping relationship is used to represent the correspondence between the weight of the original data in the memory and the second storage location index in the processor, wherein the second storage location index is used to index the storage location of the weight of the original data in the processor. Based on this, the data mapping relationship can be called to determine the second storage location index corresponding to the weight of the original data in the processor, and then the weight of the original data is loaded into the storage location indexed by the corresponding second storage location index in the processor for storage.

[0085] For example, after determining the weight corresponding to the original data, a weight consistent with the weight can be searched in the data mapping relationship based on the weight of the original data, and then the second storage location index in the processor corresponding to the weight of the original data in the memory is determined as the second storage location index corresponding to the weight of the original data, and then the weight of the original data is loaded into the storage location indexed by the corresponding second storage location index in the processor for storage.

[0086] As an optional implementation, the method further includes: determining a second storage location index based on a processor model.

[0087] In this embodiment, as can be seen from the above introduction, different processor models have corresponding second storage location indexes. Based on this, the second storage location index can be determined according to the processor model, and then the weight of the original data can be loaded into the storage location indexed by the second storage location index in the processor for storage according to the determined second storage location index.

[0088] As an optional implementation, the method also includes: performing convolution expansion on the original data; calling the data mapping relationship to load the original data into the processor to obtain an input matrix, including: calling the data mapping relationship to load the original data after convolution expansion into the processor to obtain an input matrix.

[0089] In this embodiment, when the original data is convolutionally expanded, the img2col method can be used to convolutionally expand the original data. Afterwards, the original data after convolution is mapped according to the mapping relationship between the original data after convolution and the data arrangement information of the input matrix in the processor to obtain the data arrangement information corresponding to the original data after convolution. Then, the original data after convolution is loaded into the processor according to the mapping relationship to obtain the input matrix.

[0090] As an optional implementation, step S403, calling the data mapping relationship to load the original data into the processor to obtain an input matrix, includes: calling the data mapping relationship to load the original data that has not been expanded by convolution into the processor to obtain an input matrix.

[0091] In this embodiment, when determining the data arrangement information corresponding to the original data based on the data mapping relationship, for the original data that has not been expanded by convolution, the mapping relationship between the original data that has not been expanded and the data arrangement information of the input matrix in the processor can be called to obtain the data arrangement information corresponding to the original data that has not been expanded by convolution. After that, the original data that has not been expanded is loaded into the processor through the mapping relationship to obtain the input matrix.

[0092] As an optional implementation, the method also includes: dividing the convolution operation task based on the convolution parameters associated with the convolution operation task to obtain at least one convolution subtask; collecting the original data loaded into the memory, including: collecting the original data loaded into the memory required by the convolution subtask.

[0093] In this embodiment, the convolution operation task to be executed can be divided according to the convolution parameters corresponding to the processor to obtain at least one subtask, and then the original data required by each convolution subtask is collected in the memory.

[0094] For example, the processor can be divided into multiple sub-modules according to the convolution parameters corresponding to the processor, and a convolution sub-task is assigned to each sub-module. Then, the original data required to execute each convolution sub-task is collected from the memory.

[0095] As an optional implementation, the method further includes: determining the data arrangement information of the input matrix stored in the processor based on the processor model; and mapping at least the data arrangement information of the original data and the data arrangement information of the input matrix stored in the processor to obtain a data mapping relationship.

[0096] In this embodiment, the data arrangement information of the corresponding input matrix is ​​different depending on the processor model. Based on this, the data arrangement information of the input data stored in the processor can be determined according to the model of the processor used, and then mapping is performed based on the data arrangement information of the original data and the data arrangement information of the input matrix stored in the processor to obtain a data mapping relationship.

[0097] In the above steps, the raw data loaded into the memory is collected, wherein the raw data is to be used to perform the convolution operation task; the data mapping relationship is called to load the raw data into the processor to obtain an input matrix, wherein the data mapping relationship is at least used to represent the corresponding relationship between the raw data in the memory and the data arrangement information of the input matrix in the processor; the matrix multiplication and addition operation is performed on the input matrix in the processor to obtain the convolution operation result of the raw data under the convolution operation task. That is, in an embodiment of the present application, a mapping relationship is constructed between the raw data stored in the memory and the data arrangement information of the input matrix in the processor. Based on this, the data arrangement information corresponding to the raw data can be obtained through the data mapping relationship, and the raw data can be directly loaded into the processor through the data mapping relationship to obtain the input matrix. The matrix multiplication and addition operation is performed on the input matrix in the processor to obtain the convolution operation result of the raw data under the convolution operation task. The data arrangement information corresponding to the raw data can be obtained through the mapping relationship, which reduces the storage space occupied by data transfer and the computational overhead caused by data handling, thereby achieving the technical effect of improving the efficiency of data convolution processing, thereby solving the technical problem of being unable to effectively perform convolution processing on data.

[0098] The present application also provides a data convolution processing method as shown in FIG5 . FIG5 is a flow chart of a data convolution processing method according to an embodiment of the present application. As shown in FIG5 , the method may include the following steps:

[0099] Step S501: obtaining original data to be input into the data processing model, wherein the original data is to be used to perform a convolution operation task.

[0100] In the technical solution provided in the above step S501 of the present application, data to be processed is stored in the memory. Based on this, the original data input to the data processing model can be obtained from the memory, wherein the original data is to be used to perform the convolution operation task.

[0101] Step S502 : calling the data mapping relationship, loading the original data loaded into the memory into the processor, and obtaining an input matrix.

[0102] In the technical solution provided in the above step S502 of the present application, the data mapping relationship is at least used to represent the correspondence between the original data in the memory and the data arrangement information of the input matrix in the processor. Based on this, after obtaining the original data input to the data processing module, the data mapping relationship can be further called, and the original data can be directly loaded into the processor based on the data mapping relationship to obtain the input matrix.

[0103] Step S503: Perform matrix multiplication and addition operations on the input matrix in the processor to obtain a convolution operation result of the original data under the convolution operation task.

[0104] In the technical solution provided in the above step S503 of the present application, after the original data is loaded into the processor to obtain the input matrix, a matrix multiplication and addition operation can be performed on the input matrix in the processor and the weight matrix corresponding to the original data to obtain the convolution operation result of the original data under the convolution operation task.

[0105] It should be noted that the weight matrix corresponding to the original data can be pre-arranged and adjusted according to the convolution expansion, and then loaded into the processor using the load_matrix_sync function to participate in the convolution operation task.

[0106] Step S504: Determine the output result of the data processing model based on the convolution operation result.

[0107] In the technical solution provided in the above step S505 of the present application, after obtaining the convolution operation result of the original data under the convolution operation task, the output result of the data processing model can be determined based on the convolution operation result, wherein the output result of the data processing model can be a matrix.

[0108] Based on the scheme disclosed in steps S501 to S504 of the above embodiment, original data is obtained as input to the data processing model, wherein the original data is to be used to perform a convolution operation task; a data mapping relationship is called to load the original data loaded into the memory into the processor to obtain an input matrix, wherein the data mapping relationship is at least used to represent the correspondence between the original data in the memory and the data arrangement information of the input matrix in the processor; a matrix multiplication and addition operation is performed on the input matrix in the processor to obtain a convolution operation result of the original data under the convolution operation task; and an output result of the data processing model is determined based on the convolution operation result. That is to say, in an embodiment of the present application, a mapping relationship is constructed between the original data stored in the memory and the data arrangement information of the input matrix in the processor. Based on this, the data mapping relationship can be directly called to load the original data into the processor to obtain the input matrix, and matrix multiplication and addition operations are performed on the input matrix in the processor and the weight matrix corresponding to the original data. The convolution operation result of the original data under the convolution operation task can be obtained, which reduces the storage space occupied by data transfer and the computational overhead caused by data handling, thereby achieving the technical effect of improving the efficiency of data convolution processing, and thus solving the technical problem of being unable to effectively perform convolution processing on data.

[0109] The present application also provides a data convolution processing system as shown in Figure 6. Figure 6 is a schematic diagram of a data convolution processing system according to an embodiment of the present application. As shown in Figure 6, the system includes a memory 601, a matrix input unit 602, and a processor 603, wherein the memory 601 is connected to the matrix input unit 602, and the matrix input unit 602 is connected to the processor 603. The memory 601 is used to load original data, wherein the original data is to be used to perform a convolution operation task; the matrix input unit 602 is used to call a data mapping relationship to load the original data into the processor to obtain an input matrix, wherein the data mapping relationship is at least used to represent the correspondence between the original data in the memory and the data arrangement information of the input matrix in the processor; the processor 603 is used to perform a matrix multiplication and addition operation on the input matrix to obtain a convolution operation result of the original data under the convolution operation task.

[0110] The technical solutions of the embodiments of the present application are further described below with reference to preferred implementation modes.

[0111] At present, with the rapid development of AI models, AI models have put forward higher requirements on the processing performance of processors, and the computing bottleneck of most AI models is concentrated in convolution operations.

[0112] In related technologies, a matrix multiplication and addition unit can be used to perform convolution calculations. However, due to the size limitation of the element matrix processed by the matrix multiplier, the data needs to be padded with 0 to a regular size, which will introduce additional storage capacity requirements and memory access requirements. In the case of limited high-speed storage space, it will lead to a decrease in processing performance. Moreover, when the matrix multiplication and addition operation is performed on the data, since the matrix multiplication and addition is performed on the padded data, the padded data will also participate in the calculation, resulting in a large number of invalid operations and a waste of computing power.

[0113] Figure 7 is a schematic diagram of a convolution operation using a matrix multiplication and addition unit according to an embodiment of the present application. As shown in Figure 7, a data memory 701 is connected to a matrix multiplication and addition unit 702, wherein the data memory 701 stores data to be used for the convolution operation, can collect the data stored in the memory, and convert it into a regular size processed by the processor, and then load the converted element matrix into the matrix multiplication and addition unit 702 as a whole. After the matrix multiplication and addition unit 702 processes the element matrix, it can obtain a result matrix and send the result matrix to the data memory 701 for one-time storage.

[0114] In related technologies, non-matrix operation units can also be used for convolution calculations, that is, ordinary processing units can be used for convolution calculations. However, when using ordinary processing units for convolution operations, each processing unit runs a convolution operation, and the storage arrangement threads need to be reasonably designed to make memory access as continuous as possible. The ratio of memory access and calculation needs to be coordinated in advance to give full play to the performance of the processor's ordinary processing units. However, ordinary processing units in AI processors usually account for a smaller proportion than matrix multiplication and addition processing units, and their own computing power is limited, resulting in a technical problem that they cannot effectively perform convolution processing on data.

[0115] However, an embodiment of the present application provides a method for convolution processing of data, which collects raw data loaded into a memory, wherein the raw data is to be used to perform a convolution operation task; calls a data mapping relationship to load the raw data into a processor to obtain an input matrix, wherein the data mapping relationship is at least used to represent the correspondence between the raw data in the memory and the data arrangement information of the input matrix in the processor; performs a matrix multiplication and addition operation on the input matrix in the processor to obtain a convolution operation result of the raw data under the convolution operation task. That is, in an embodiment of the present application, a mapping relationship between the raw data stored in the memory and the data arrangement information of the input matrix in the processor is constructed. Based on this, the raw data can be directly loaded into the processor by calling the data mapping relationship to obtain the input matrix, thereby reducing the storage space occupied by data transfer and the computational overhead caused by data handling. By performing a matrix multiplication and addition operation on the input matrix in the processor, the convolution operation result of the raw data under the convolution operation task can be obtained, thereby achieving the technical effect of improving the efficiency of data convolution processing, thereby solving the technical problem of the inability to effectively perform convolution processing on data in the prior art.

[0116] The following introduces the convolution processing method of data in the embodiment of the present application.

[0117] In an embodiment of the present application, for convolution operations in which the number of input channels of a processor is small and the number of output channels is large, an efficient convolution calculation method is designed based on a matrix multiplication-addition unit to maximize the processing performance of the processor chip. According to the data arrangement information of the input matrix of the matrix multiplication-addition unit, an input matrix loading unit is provided. The unit expands the feature data stored in the data memory and loads the expanded data into the matrix multiplication-addition unit, or constructs a mapping relationship between each element in the input matrix of the matrix multiplication-addition unit and the unexpanded feature data, and then loads the feature data into the input matrix of the matrix multiplication-addition unit.

[0118] For example, the internal storage arrangement of the input matrix of the matrix multiply-add unit, the specific storage location of the feature data to be loaded, and the mapping relationship between the specific storage location of the input matrix, the unexpanded feature data, and the expanded feature data can be obtained. After obtaining the mapping relationship, the obtained mapping relationship can be stored in the matrix multiply-add unit.

[0119] FIG8 is a schematic diagram of a convolution processing process of data according to an embodiment of the present application. As shown in FIG8 , feature data is stored in a data memory 801. The data memory 801 is connected to an input matrix loading unit 802 and can send the feature data to the input matrix loading unit 801. After receiving the feature data, the input matrix loading unit 802 can perform img2col logical index expansion on the feature data. After that, the expanded data is mapped to the storage location index of the matrix multiplication and addition unit 803 based on the data arrangement information of the input matrix of the matrix multiplication and addition unit 803, and then the data is directly transferred from the data memory 801 to the matrix multiplication and addition unit 803, reducing the storage space occupied by unnecessary data transfer and data transfer overhead. After the matrix multiplication and addition unit 803 processes the element matrix, a result matrix can be obtained, and the result matrix is ​​sent to the data memory 801.

[0120] FIG9 is a schematic diagram of data mapping and data transport according to an embodiment of the present application. As shown in FIG9 , the feature data stored in the data memory 901 is a 3×3 matrix. After the input matrix loading unit 902 performs img2col expansion, a 4×9 matrix is ​​obtained. After filling 0, a 4×16 input matrix can be obtained, that is, the mapping relationship between the feature data and the input matrix can be obtained. After that, after the input matrix is ​​input to the matrix multiplication and addition unit 903, the matrix multiplication and addition unit 903 can determine the data arrangement information of the input matrix according to the input matrix, that is, the mapping relationship between the input matrix and the data arrangement information is obtained. After determining the mapping relationship between the feature data and the input matrix, and the mapping relationship between the input matrix and the data arrangement information of the input matrix in the matrix multiplication and addition unit, the mapping relationship between the feature data and the data arrangement information of the input matrix in the matrix multiplication and addition unit is obtained, and then data transport can be realized directly based on the mapping relationship between the feature data and the data arrangement information of the input matrix in the matrix multiplication and addition unit.

[0121] It should be noted that the above-mentioned input matrix loading unit can be hardware or a device, or can be a code, formula, or mapping table that logically implements similar functions, and no specific limitation is made here.

[0122] The following describes a method for implementing data convolution processing on a graphics processing unit (GPU) in an embodiment of the present application.

[0123] FIG10 is a flowchart of a method for implementing convolution processing of data on a GPU according to an embodiment of the present application. As shown in FIG10 , the method may include the following steps:

[0124] S1001: Divide tasks based on convolution parameters and assign convolution subtasks to each submodule (block).

[0125] In the technical solution of step S1001 above, the matrix multiplication and addition unit can be divided into multiple sub-modules according to the actual convolution parameters of the matrix multiplication and addition unit in the GPU, and then the convolution sub-tasks can be divided into each sub-module.

[0126] Step S1002: Load the data required by each submodule to perform the convolution subtask into the data memory.

[0127] In the technical solution of step S1002 above, after the convolution subtasks are divided into each submodule, the data required for each submodule to execute the corresponding convolution subtask can be loaded into the data memory.

[0128] Step S1003: confirming the data arrangement information and memory access index method of the matrix input matrix of the matrix multiplication and addition unit according to the target GPU model.

[0129] In the technical solution of step S1003 above, after the data required by the submodule is loaded into the data memory, the data arrangement information and memory access index method of the input matrix of the matrix multiplication and addition unit in the target GPU can be further determined according to the model of the target GPU.

[0130] Step S1004 : constructing a data mapping relationship between the data in the data memory and the data arrangement information of the input matrix of the matrix multiplication-addition unit, and loading the data stored in the data memory into the matrix multiplication-addition unit.

[0131] In the technical solution of the above-mentioned step S1004, the data arrangement information of the input matrix of the matrix multiplication-addition unit is different for different GPU models. Based on this, after determining the target GPU, a data mapping relationship can be further constructed between the data in the data memory and the data arrangement information of the input matrix of the matrix multiplication-addition unit of the target GPU, wherein the data mapping relationship can be expressed by an index calculation formula. Thereafter, the data mapping relationship can be called to directly load the data stored in the data memory into the matrix multiplication-addition unit.

[0132] Step S1005: Load the data into the register of the processor.

[0133] In the technical solution of the above step S1005, the data in the data memory can be loaded into the registers belonging to the processor according to the data mapping relationship (convolution calculation formula), and the weight matrix can be loaded into the registers belonging to the processor using the native load_matrix_sync function.

[0134] Step S1006: The matrix multiplication and addition unit performs convolution calculation.

[0135] In the above step S1006, the matrix multiplication and addition unit can perform a convolution operation on the data loaded into itself and the weight matrix, and cyclically execute the above steps S1001 to S1006 to obtain a convolution operation result.

[0136] Step S1007: Save the convolution operation result to the video memory or save it through the data memory.

[0137] In the technical solution of step S1007 above, after the convolution operation result is obtained, the convolution operation result can be saved in a memory.

[0138] In the above steps S1001 to S1007, the data arrangement information of the input matrix of the matrix multiplication and addition unit can be determined according to the model of the target GPU, and then a data mapping relationship between the data in the data memory and the data arrangement information of the input matrix of the matrix multiplication and addition unit is constructed, and based on the data mapping relationship, the data stored in the data memory is loaded into the matrix multiplication and addition unit, and convolution calculation is performed on the data and the weight matrix to obtain the convolution operation result, thereby reducing the storage space occupied by data conversion and achieving the technical effect of improving the efficiency of data convolution processing.

[0139] The convolution process of the embodiment of the present application is further introduced below.

[0140] Figure 11 is a schematic diagram of a convolution operator of an AI model according to an embodiment of the present application performing a convolution operation on data. As shown in Figure 11, a 1×1920×1088 image data is input, a 1×24 3×3 convolution operation is performed, and a 24-channel image data is output. Figure 11 shows a convolution operation process with a smaller input channel (1) and a larger output channel (24).

[0141] The following further introduces the mapping relationship between the data stored in the data storage device and the data arrangement information of the input matrix of the matrix multiplication and addition unit in the embodiment of the present application.

[0142] The storage arrangement of the data and weights stored in the data memory can be adjusted. Assuming that the input data is a feature map, the image channel format can be used to store the feature map. For the weights, in order to make the feature map data more convenient to load into the matrix multiplication and addition unit, an array of size 16*(32+8) can be selected. The data is stored close to the low latitude, and the remaining elements are filled with 0. On the one hand, this can avoid the data in the storage block that can only read data of a specific bandwidth (or 1 data) at a time. If multiple data of a storage block are read at the same time, the storage body conflict generated by serial reading needs to be generated. On the other hand, the feature map data can also be quickly loaded into the matrix multiplication and addition unit. Figure 12 is a schematic diagram of a feature map data array according to an embodiment of the present application. According to the data arrangement storage weights in Figure 12, the matrix read function load_matrix_sync can be used to directly complete the loading of weight data from the data memory to the matrix multiplication and addition unit, wherein the black area in Figure 12 is real data and the white area is filled data, wherein 0 can be used for data filling.

[0143] For the matrix multiply-add unit, the data arrangement information of its input matrix in real storage can be obtained through test experiments. For the matrix_a data arrangement in the matrix multiply-add unit, each thread needs to read 16 data from the data memory to fill the register array it holds. It traverses the rid-th element in the array, and its index value is (rid-1) element value + 1. Therefore, by locating the index of the first element in each thread group, the first element of each thread group can be obtained. Table 1 is a mapping relationship table of thread groups and the first element values ​​in each thread group according to an embodiment of the present application. Based on this table, the first element of each thread group can be obtained.

[0144] Table 1 Mapping relationship between thread groups and the first element value in each thread group

[0145] For feature data with a height of 3 and a width of 18, any element can be located by using the height index hid and the width index wid. Table 2 shows feature data with a height of 3 and a width of 18 according to an embodiment of the present application.

[0146] Table 2 Feature data with height of 3 and width of 18

[0147] The feature data shown in Table 2 is expanded according to 3×3 convolution and loaded into the matrix of the matrix multiplication and addition unit as shown in Table 3. Table 3 is a data table after 3×3 convolution expansion according to an embodiment of the present application.

[0148] Table 3 3×3 convolution expansion data table

[0149] After expansion, the i-th data element (a total of 16*16=256) can be located at its row (id / 16) and column (id / 16). The starting element of the feature data can be located based on the row, and its specific position in the 3×3 matrix of feature data can be located based on the column. If the located position is outside the 3×3 matrix, the value is assigned to 0. According to Table 3, the thread can locate the index corresponding to the r-th element in the array it holds. Then, the index is reversed according to the expansion method of the feature data to obtain the element in the data memory. The associated data in the data memory is then loaded into the corresponding position of the array held by the thread.

[0150] It should be noted that for the aforementioned method embodiments, for the sake of simplicity, they are all expressed as a series of action combinations, but those skilled in the art should be aware that this application is not limited by the order of the actions described, because according to this application, certain steps can be performed in other orders or simultaneously. Secondly, those skilled in the art should also be aware that the embodiments described in the specification are all preferred embodiments, and the actions and modules involved are not necessarily required by this application.

[0151] Through the description of the above implementation methods, those skilled in the art can clearly understand that the method according to the above embodiment can be implemented by means of software plus the necessary general hardware platform, and of course it can also be implemented by hardware, but in many cases the former is a better implementation method. Based on this understanding, the technical solution of the present application, or the part that contributes to the prior art, can be embodied in the form of a software product, which is stored in a storage medium (such as ROM / RAM, magnetic disk, optical disk), and includes a number of instructions for enabling a terminal device (which can be a mobile phone, computer, server, or network device, etc.) to execute the methods described in each embodiment of the present application.

[0152] Example 2

[0153] According to an embodiment of the present application, a data convolution processing device for implementing the above-mentioned data convolution processing method is also provided. Figure 13 is a schematic diagram of a data convolution processing device according to an embodiment of the present application. As shown in Figure 13, the device may include: an acquisition unit 1301, a calling unit 1302 and an operation unit 1303.

[0154] The acquisition unit 1301 is used to acquire raw data loaded into the memory, where the raw data is to be used to perform a convolution operation task.

[0155] The calling unit 1302 is used to call the data mapping relationship to load the original data into the processor to obtain an input matrix, wherein the data mapping relationship is at least used to represent the correspondence between the original data in the memory and the data arrangement information of the input matrix in the processor.

[0156] The operation unit 1303 is used to perform matrix multiplication and addition operations on the input matrix in the processor to obtain the convolution operation result of the original data under the convolution operation task.

[0157] It should be noted that the above-mentioned collection unit 1301, calling unit 1302, and operation unit 1303 correspond to steps S401 to S403 in Example 1. The examples and application scenarios implemented by the three units and the corresponding steps are the same, but are not limited to the contents disclosed in the above-mentioned Example 1. It should be noted that the above-mentioned modules, as part of the device, can be run in the computer terminal 10 provided in Example 1.

[0158] According to an embodiment of the present application, a convolution processing device for data is also provided for implementing the above-mentioned convolution processing method for data. Figure 14 is a schematic diagram of a convolution processing device for data according to an embodiment of the present application. As shown in Figure 14, the device may include: an acquisition unit 1401, a calling unit 1402, an operation unit 1403 and a determination unit 1404.

[0159] The acquisition unit 1401 is used to acquire original data input to the data processing model, wherein the original data is to be used to perform the convolution operation task.

[0160] The calling unit 1402 is used to call the data mapping relationship to load the original data loaded into the memory into the processor to obtain an input matrix, wherein the data mapping relationship is at least used to represent the correspondence between the original data in the memory and the data arrangement information of the input matrix in the processor.

[0161] The operation unit 1403 is used to perform matrix multiplication and addition operations on the input matrix in the processor to obtain the convolution operation result of the original data under the convolution operation task.

[0162] The determining unit 1404 is configured to determine an output result of the data processing model based on the convolution operation result.

[0163] It should be noted that the acquisition unit 1401, the calling unit 1402, the calculation unit 1403, and the determination unit 1404 correspond to steps S501 to S504 in Example 1. The examples and application scenarios implemented by the four units and the corresponding steps are the same, but are not limited to the contents disclosed in the above-mentioned Example 1. It should be noted that the above-mentioned modules, as part of the device, can be run in the computer terminal 10 provided in Example 1.

[0164] It should be noted that the preferred implementation scheme involved in the above embodiments of this application is the same as the scheme provided in Example 1, as well as the application scenario and implementation process, but is not limited to the scheme provided in Example 1.

[0165] Example 3

[0166] The embodiment of the present application can provide a computer terminal, which can be any computer terminal device in a computer terminal group. Optionally, in this embodiment, the computer terminal can also be replaced by a terminal device such as a mobile terminal.

[0167] Optionally, in this embodiment, the computer terminal may be located in at least one network device among a plurality of network devices of a computer network.

[0168] In this embodiment, the above-mentioned computer terminal can execute the program code of the following steps in the data convolution processing method: collecting the original data loaded into the memory, wherein the original data is to be used to perform the convolution operation task; calling the data mapping relationship to load the original data into the processor to obtain the input matrix, wherein the data mapping relationship is at least used to represent the correspondence between the original data in the memory and the data arrangement information of the input matrix in the processor; performing matrix multiplication and addition operations on the input matrix in the processor to obtain the convolution operation result of the original data under the convolution operation task.

[0169] Optionally, Figure 15 is a block diagram of a computer terminal according to an embodiment of the present application. As shown in Figure 15, the computer terminal A may include: one or more (only one is shown in the figure) processors 1502, a memory 1504, and a peripheral interface, wherein the peripheral interface is connected to a radio frequency module, an audio module, and a display.

[0170] Among them, the memory can be used to store software programs and modules, such as the program instructions / modules corresponding to the convolution processing method and device of data in the embodiments of the present application. The processor executes various functional applications and data processing by running the software programs and modules stored in the memory, that is, realizing the above-mentioned convolution processing method of data. The memory may include a high-speed random access memory, and may also include a non-volatile memory, such as one or more magnetic storage devices, flash memory, or other non-volatile solid-state memory. In some instances, the memory may further include a memory remotely located relative to the processor, and these remote memories may be connected to terminal A via a network. Examples of the above-mentioned network include, but are not limited to, the Internet, an intranet, a local area network, a mobile communication network, and combinations thereof.

[0171] The processor can call the information and application stored in the memory through the transmission device to perform the following steps: collect the original data loaded into the memory, wherein the original data is to be used to perform the convolution operation task; call the data mapping relationship to load the original data into the processor to obtain an input matrix, wherein the data mapping relationship is at least used to represent the correspondence between the original data in the memory and the data arrangement information of the input matrix in the processor; perform matrix multiplication and addition operations on the input matrix in the processor to obtain the convolution operation result of the original data under the convolution operation task.

[0172] Optionally, the processor may further execute program code of the following steps: mapping the original data to a corresponding first storage location index according to a data mapping relationship.

[0173] Optionally, the processor may further execute program code of the following steps: calling a data mapping relationship, loading the original data into the storage location indexed by the first storage location index in the processor for storage, and obtaining an input matrix.

[0174] Optionally, the processor may further execute program code of the following steps: determining a first storage location index based on a processor model.

[0175] Optionally, the processor may further execute a program code of the following steps: performing a matrix multiplication and addition operation on an input matrix in the processor and a weight of original data to obtain a convolution operation result.

[0176] Optionally, the processor may further execute the program code of the following steps: calling the data mapping relationship, and loading the weight of the original data into the storage location indexed by the second storage location index in the processor for storage.

[0177] Optionally, the processor may further execute program code of the following steps: determining a second storage location index based on a processor model.

[0178] Optionally, the above-mentioned processor can also execute the program code of the following steps: performing convolution expansion on the original data; calling the data mapping relationship to load the original data into the processor to obtain an input matrix, including: calling the data mapping relationship to load the original data after convolution expansion into the processor to obtain an input matrix.

[0179] Optionally, the processor may further execute program code of the following steps: calling a data mapping relationship, loading the original data that has not been expanded by convolution into the processor, and obtaining an input matrix.

[0180] Optionally, the above-mentioned processor can also execute the program code of the following steps: dividing the convolution operation task based on the convolution parameters associated with the convolution operation task to obtain at least one convolution subtask; collecting the original data loaded into the memory, including: collecting the original data loaded into the memory required by the convolution subtask.

[0181] Optionally, the processor may also execute the program code of the following steps: based on the processor model, determining the data arrangement information of the input matrix stored in the processor; and mapping at least the data arrangement information of the original data and the data arrangement information of the input matrix stored in the processor to obtain a data mapping relationship.

[0182] According to an embodiment of the present application, a scheme for convolution processing of data is provided. The original data loaded into the memory is collected, wherein the original data is to be used to perform a convolution operation task; the data mapping relationship is called to load the original data into the processor to obtain an input matrix, wherein the data mapping relationship is at least used to represent the corresponding relationship between the original data in the memory and the data arrangement information of the input matrix in the processor; the matrix multiplication and addition operation is performed on the input matrix in the processor to obtain the convolution operation result of the original data under the convolution operation task. That is, in an embodiment of the present application, a mapping relationship between the original data stored in the memory and the data arrangement information of the input matrix in the processor is constructed. Based on this, the original data can be directly loaded into the processor by calling the data mapping relationship to obtain the input matrix, and the matrix multiplication and addition operation is performed on the input matrix and the weight matrix in the processor to obtain the convolution operation result of the original data under the convolution operation task. The data arrangement information corresponding to the original data can be obtained through the mapping relationship, which reduces the storage space occupied by data transfer and the computational overhead caused by data handling, thereby achieving the technical effect of improving the efficiency of data convolution processing, thereby solving the technical problem of being unable to effectively perform convolution processing on data.

[0183] Those skilled in the art will appreciate that the structure shown in FIG15 is merely illustrative, and the computer terminal may also be a smartphone (such as an Android phone, iOS phone, etc.), a tablet computer, a PDA, a mobile internet device (MID), a PAD, or other terminal device. FIG15 does not limit the structure of the aforementioned electronic devices. For example, the computer terminal A may include more or fewer components (such as a network interface, a display device, etc.) than those shown in FIG15 , or may have a configuration different from that shown in FIG15 .

[0184] Those skilled in the art will understand that all or part of the steps in the various methods of the above embodiments can be completed by instructing the hardware related to the terminal device through a program, and the program can be stored in a computer-readable storage medium, which may include: a flash drive, a read-only memory (ROM), a random access memory (RAM), a magnetic disk or an optical disk, etc.

[0185] Example 4

[0186] The embodiment of the present application further provides a storage medium. Optionally, in this embodiment, the storage medium can be used to store the program code executed by the data convolution processing method provided in the first embodiment.

[0187] Optionally, in this embodiment, the storage medium may be located in any computer terminal in a computer terminal group in a computer network, or in any mobile terminal in a mobile terminal group.

[0188] Optionally, in this embodiment, the storage medium is configured to store program code for performing the following steps: collecting raw data loaded into the memory, wherein the raw data is to be used to perform a convolution operation task; calling a data mapping relationship to load the raw data into the processor to obtain an input matrix, wherein the data mapping relationship is at least used to represent the correspondence between the raw data in the memory and the data arrangement information of the input matrix in the processor; performing a matrix multiplication and addition operation on the input matrix in the processor to obtain a convolution operation result of the raw data under the convolution operation task.

[0189] Optionally, in this embodiment, the storage medium is further configured to store program codes for executing the following steps: mapping the original data to a corresponding first storage location index according to a data mapping relationship.

[0190] Optionally, in this embodiment, the storage medium is further configured to store program code for executing the following steps: calling the data mapping relationship, loading the original data into the storage location indexed by the first storage location index in the processor for storage, and obtaining an input matrix.

[0191] Optionally, in this embodiment, the storage medium is further configured to store program code for executing the following steps: determining a first storage location index based on a processor model.

[0192] Optionally, in this embodiment, the storage medium is further configured to store program codes for executing the following steps: performing matrix multiplication and addition operations on the input matrix in the processor and the weights of the original data to obtain a convolution operation result.

[0193] Optionally, in this embodiment, the storage medium is further configured to store program code for executing the following steps: calling the data mapping relationship, loading the weight of the original data into the storage location indexed by the second storage location index in the processor for storage.

[0194] Optionally, in this embodiment, the storage medium is further configured to store program code for executing the following steps: determining a second storage location index based on a processor model.

[0195] Optionally, in this embodiment, the storage medium is also configured to store program code for executing the following steps: performing convolution expansion on the original data; calling the data mapping relationship to load the original data into the processor to obtain an input matrix, including: calling the data mapping relationship to load the original data after convolution expansion into the processor to obtain an input matrix.

[0196] Optionally, in this embodiment, the storage medium is further configured to store program codes for executing the following steps: calling a data mapping relationship, loading the original data that has not been expanded by convolution into the processor, and obtaining an input matrix.

[0197] Optionally, in this embodiment, the storage medium is also configured to store program code for performing the following steps: dividing the convolution operation task based on the convolution parameters associated with the convolution operation task to obtain at least one convolution subtask; collecting the original data loaded into the memory, including: collecting the original data loaded into the memory required by the convolution subtask.

[0198] Optionally, in this embodiment, the storage medium is also configured to store program code for executing the following steps: based on the model of the processor, determining the data arrangement information of the input matrix stored in the processor; and mapping at least the data arrangement information of the original data and the data arrangement information of the input matrix stored in the processor to obtain a data mapping relationship.

[0199] The serial numbers of the above embodiments of the present application are for description only and do not represent the advantages or disadvantages of the embodiments.

[0200] In the above embodiments of the present application, the description of each embodiment has its own focus. For parts that are not described in detail in a certain embodiment, please refer to the relevant description of other embodiments.

[0201] In the several embodiments provided in this application, it should be understood that the disclosed technical content can be implemented in other ways. Among them, the device embodiments described above are only schematic. For example, the division of the units is only a logical function division. In actual implementation, there may be other division methods, such as multiple units or components can be combined or integrated into another system, or some features can be ignored or not executed. Another point is that the mutual coupling or direct coupling or communication connection shown or discussed can be through some interfaces, indirect coupling or communication connection of units or modules, which can be electrical or other forms.

[0202] The units described as separate components may or may not be physically separate, and the components shown as units may or may not be physical units, that is, they may be located in one place or distributed across multiple network units. Some or all of these units may be selected to achieve the purpose of this embodiment according to actual needs.

[0203] In addition, the functional units in the various embodiments of the present application may be integrated into a single processing unit, or each unit may exist physically separately, or two or more units may be integrated into a single unit. The aforementioned integrated units may be implemented in the form of hardware or software functional units.

[0204] If the integrated unit is implemented in the form of a software functional unit and sold or used as an independent product, it can be stored in a computer-readable storage medium. Based on this understanding, the technical solution of the present application is essentially or the part that contributes to the prior art or all or part of the technical solution can be embodied in the form of a software product, and the computer software product is stored in a storage medium, including a number of instructions for enabling a computer device (which can be a personal computer, a server or a network device, etc.) to execute all or part of the steps of the method described in each embodiment of the present application. The aforementioned storage medium includes: various media that can store program codes, such as a USB flash drive, a read-only memory (ROM), a random access memory (RAM), a mobile hard disk, a magnetic disk or an optical disk.

[0205] The above is only a preferred embodiment of the present application. It should be pointed out that for ordinary technicians in this technical field, several improvements and modifications can be made without departing from the principles of the present application. These improvements and modifications should also be regarded as the scope of protection of the present application.

Claims

1. A convolution processing method for data, It is characterized in that include: Collecting raw data loaded into a memory, wherein the raw data is to be used for performing a convolution operation task; Calling a data mapping relationship to load the original data into a processor to obtain an input matrix, wherein the data mapping relationship is at least used to represent a corresponding relationship between the original data in the memory and data arrangement information of the input matrix in the processor; Matrix multiplication and addition operations are performed on the input matrix in the processor to obtain a convolution operation result of the original data under the convolution operation task.

2. The method according to claim 1, It is characterized in that The data mapping relationship is also used to represent the correspondence between the original data in the memory and the first storage location index of the input matrix in the processor, and the first storage location index is used to index the storage location of the input matrix in the processor. According to the data mapping relationship, the original data is mapped to the corresponding first storage location index.

3. The method according to claim 2, It is characterized in that Calling the data mapping relationship to load the original data into the processor to obtain an input matrix includes: The data mapping relationship is called, and the original data is loaded into the storage location indexed by the first storage location index in the processor for storage, so as to obtain the input matrix.

4. The method according to claim 2, It is characterized in that The method further comprises: Based on the model of the processor, the first storage location index is determined.

5. The method according to claim 1, It is characterized in that Performing a matrix multiplication and addition operation on the input matrix in the processor to obtain a convolution operation result of the original data under the convolution operation task includes: A matrix multiplication and addition operation is performed on the input matrix in the processor and the weight of the original data to obtain the convolution operation result.

6. The method according to claim 5, It is characterized in that The data mapping relationship is further used to represent the corresponding relationship between the weight of the original data in the memory and the second storage location index in the processor, and the second storage location index is used to index the storage location of the weight of the original data in the processor. The method further includes: The data mapping relationship is called to load the weight of the original data into the storage location indexed by the second storage location index in the processor for storage.

7. The method according to claim 6, It is characterized in that The method further comprises: Based on the model of the processor, the second storage location index is determined.

8. The method according to claim 1, It is characterized in that The method further comprises: Performing convolution expansion on the original data; Calling the data mapping relationship to load the original data into the processor to obtain the input matrix includes: calling the data mapping relationship to load the original data after convolution expansion into the processor to obtain the input matrix.

9. The method according to claim 1, It is characterized in that The data mapping relationship is called to load the raw data into the processor to obtain an input matrix, including: The data mapping relationship is called, and the original data that has not been expanded by convolution is loaded into the processor to obtain the input matrix.

10. The method according to claim 1, It is characterized in that The method further comprises: Based on the convolution parameters associated with the convolution operation task, the convolution operation task is divided to obtain at least one convolution subtask; Collecting the original data loaded into the memory includes: collecting the original data loaded into the memory required by the convolution subtask.

11. The method according to any one of claims 1 to 10, It is characterized in that The method further comprises: Based on the model of the processor, determine the data arrangement information of the input matrix stored in the processor; At least the data arrangement information of the original data and the data arrangement information of the input matrix stored in the processor are mapped to obtain the data mapping relationship.

12. The method according to any one of claims 1 to 10, It is characterized in that The number of channels of the original data is less than a channel number threshold, and / or the convolution kernel size corresponding to the convolution operation task is greater than a convolution kernel size threshold.

13. A convolution processing method for data, It is characterized in that include: Obtaining raw data input to a data processing model, wherein the raw data is to be used to perform a convolution operation task; Calling a data mapping relationship to load the original data loaded into the memory into the processor to obtain an input matrix, wherein the data mapping relationship is at least used to represent a corresponding relationship between the original data in the memory and data arrangement information of the input matrix in the processor; Performing a matrix multiplication and addition operation on the input matrix in the processor to obtain a convolution operation result of the original data under the convolution operation task; An output result of the data processing model is determined based on the convolution operation result.

14. A data convolution processing system, It is characterized in that include: A memory, used to load raw data, wherein the raw data is to be used to perform a convolution operation task; A matrix input unit, used to call a data mapping relationship to load the original data into a processor to obtain an input matrix, wherein the data mapping relationship is at least used to represent a corresponding relationship between the original data in the memory and data arrangement information of the input matrix in the processor; The processor is used to perform matrix multiplication and addition operations on the input matrix to obtain a convolution operation result of the original data under the convolution operation task.

15. An electronic device, It is characterized in that include: Memory and processor; The memory is used to store computer-executable instructions, and the processor is used to execute the computer-executable instructions. When the computer-executable instructions are executed by the processor, the steps of the method described in any one of claims 1 to 13 are implemented.

Citation Information

Patent Citations

  • Chip for realizing binary neural network based on nonvolatile in-memory calculation and method

    CN110598858A

  • Method for realizing progressive CNN operation by using storage and calculation integrated chip

    CN111950718A

  • Graph optimization method and device for NPU data arrangement, electronic equipment and storage medium

    CN115730647A

  • Data convolution processing method and system and electronic equipment

    CN116720030A