Method, device, chip, equipment, medium and program product for performing calculations
By vectorizing the operations in deep learning training and using the new instruction format to implement parallel operations, the problem of insufficient vector operation resources and high synchronization overhead is solved, and the calculation speed and processor utilization of deep learning training are improved.
Patent Information
- Application Number
- CN202110820258.6
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2021-07-20
- Publication Date
- 2024-08-23
- Estimated Expiration
- 2041-07-20
AI Technical Summary
In deep learning training, vector operations occupy a large amount of computing resources, resulting in insufficient computing resources and affecting the training speed. Traditional CPU and GPU processors have problems with serialization inefficiency and high synchronization overhead when processing vector operations.
By vectorizing the instructions of operation operations, the parallelism of operation operations is increased, and new instruction formats such as vSETcc instructions are used to implement vectorized operations, avoid serial processing and synchronization overhead, and improve calculation speed.
It improves the calculation speed of deep learning training, effectively utilizes artificial intelligence chip processor resources, reduces serial processing delay and synchronization overhead, and improves the performance-to-power ratio of the processor.
Smart Images

Figure CN113407351B
Abstract
Description
Technical Field
[0001] The present disclosure relates to the field of computer technology, and in particular to methods, devices, chips, electronic devices, computer-readable storage media, and computer program products for performing computing operations, which can be used in the field of artificial intelligence, and in particular in the field of deep learning. Background Art
[0002] With the widespread application of deep learning training, people have put forward higher and higher requirements for improving the speed of deep learning training. The calculation operations in deep learning training can involve various operations, such as scalar calculation operations (referred to as scalar operations), vector calculation operations (referred to as vector operations), etc. In deep learning algorithms, complex calculations, such as tensor operations, are often required for various application scenarios. Tensor operations can be decomposed into multiple continuous vector operations using a compiler. The execution of these vector operations often requires a large amount of computing resources, resulting in the inability to process a large number of vector operations in a timely manner, and even causing the system performing deep learning training to exit the execution of calculation operations due to insufficient computing resources. Therefore, it is necessary to improve the efficiency of a large number of continuous vector operations in order to increase the speed of the entire deep learning training. Summary of the invention
[0003] The present disclosure provides a method, an apparatus, a chip, an electronic device, a storage medium, and a program product for performing a computing operation.
[0004] According to a first aspect of the present disclosure, a method for performing an operation in deep learning training is provided, comprising: obtaining an instruction for an operation, the operation comprising a plurality of vector operations; for each vector operation in the plurality of vector operations, determining two source operand vectors for comparison; and performing the vector operation on the two source operand vectors using an instruction format for the vector operation to obtain an operation result comprising a destination operand vector.
[0005] According to a second aspect of the present disclosure, a device for performing arithmetic operations in deep learning training is provided, comprising: an acquisition module configured to acquire instructions for arithmetic operations, the arithmetic operations comprising a plurality of vector operations; a vector determination module configured to determine, for each of the plurality of vector operations, two source operand vectors for comparison; and a vector calculation module configured to perform vector operations on the two source operand vectors using an instruction format for the vector operation to obtain a calculation result comprising a destination operand vector.
[0006] According to a third aspect of the present disclosure, a chip is provided, including at least one processor; and a device according to the second aspect of the present disclosure communicatively connected to the at least one processor.
[0007] According to a fourth aspect of the present disclosure, an electronic device is provided, comprising at least one processor; and a memory communicatively connected to the at least one processor; wherein the memory stores instructions executable by the at least one processor, and the instructions are executed by the at least one processor to enable the at least one processor to implement the method according to the first aspect of the present disclosure.
[0008] According to a fifth aspect of the present disclosure, a non-transitory computer-readable storage medium storing computer instructions is provided, where the computer instructions are used to cause a computer to implement the method according to the first aspect of the present disclosure.
[0009] According to a sixth aspect of the present disclosure, a computer program product is provided, comprising a computer program, and when the computer program is executed by a processor, the computer program performs the method according to the first aspect of the present disclosure.
[0010] According to the technology disclosed in the present invention, a method for performing arithmetic operations in deep learning training is provided, by which instructions for arithmetic operations can be vectorized according to different data types, and the parallelism of arithmetic operations can be increased, thereby accelerating the arithmetic operations. Thus, in deep learning training, a large number of continuous vector operations that occupy a large amount of computing resources can improve processing efficiency, thereby improving the computing speed of the entire deep learning training.
[0011] It should be understood that the content described in this section is not intended to identify the key or important features of the embodiments of the present disclosure, nor is it intended to limit the scope of the present disclosure. Other features of the present disclosure will become easily understood through the following description. BRIEF DESCRIPTION OF THE DRAWINGS
[0012] The accompanying drawings are used to better understand the present solution and do not constitute a limitation of the present disclosure.
[0013] Figure 1 is a schematic block diagram of a deep learning training environment 100 in which the method of performing computing operations of certain embodiments of the present disclosure may be implemented;
[0014] Figure 2 is a flow chart of a computing operation method 200 according to an embodiment of the present disclosure;
[0015] Figure 3 is a flow chart of a computing operation method 300 according to an embodiment of the present disclosure;
[0016] Figure 4 is a schematic diagram of an accelerated vector operation according to an embodiment of the present disclosure;
[0017] Figure 5 is a scene graph for performing continuous vector operations that can implement the embodiments of the present disclosure;
[0018] Figure 6 is a block diagram of an apparatus 600 for performing a computing operation according to an embodiment of the present disclosure;
[0019] Figure 7 is a schematic block diagram of a chip 700 for implementing a computing operation according to an embodiment of the present disclosure; and
[0020] Figure 8 8 is a block diagram of an electronic device 800 for implementing the method for performing a computing operation according to an embodiment of the present disclosure. DETAILED DESCRIPTION
[0021] The following is a description of exemplary embodiments of the present disclosure in conjunction with the accompanying drawings, including various details of the embodiments of the present disclosure to facilitate understanding, which should be considered as merely exemplary. Therefore, it should be recognized by those of ordinary skill in the art that various changes and modifications may be made to the embodiments described herein without departing from the scope and spirit of the present disclosure. Similarly, for the sake of clarity and conciseness, descriptions of well-known functions and structures are omitted in the following description.
[0022] As described in the background technology above, with the widespread application of deep learning training, people have put forward higher and higher requirements for improving the speed of deep learning training. The operation operations in the deep learning algorithm can involve various operations, such as scalar operation operations, vector operation operations, etc. Typical tensor operations in deep learning algorithms can be decomposed into multiple continuous vector operations, which involve calculations for SETcc (condition code condition code) operation operations. For example, SETlt and SETgt are both SETcc operation operations, and their main operations are shown in Table 1.
[0023]
[0024] Table 1. SETcc operations
[0025] In the SETcc operation, the destination operand is set to 0 or 1 of the data type according to the result of comparing the sizes of the two source operands, and the data type of the destination operand is consistent with the data type of the source operand. Element-wise EW comparison operation is a common operation in deep learning algorithms. During the algorithm training process, the reverse gradient calculation of the EW comparison operation uses two operations, SETlt and SETgt. Table 2 below shows the common EW comparison operation algorithm.
[0026]
[0027] Table 2. EW algorithm
[0028] In deep learning training, we can consider how to improve the computing speed of the deep learning training process by accelerating vector operations in the acceleration unit of the reverse training algorithm in the artificial intelligence (AI) chip processor. When the number of operations is particularly large, the speed of computing operations becomes the main limitation of the computing power of the artificial intelligence chip processor. First, in deep learning training, the execution of a large number of vector operations often requires a large amount of computing resources, resulting in the inability to process a large number of continuous vector operations in a timely manner, and even causing the system performing deep learning training to exit the execution of the operation due to insufficient computing resources. Secondly, the mainstream deep learning algorithms in traditional technologies have certain problems in processing a large number of vector operations. For example, the vector acceleration unit of traditional CPU and GPU processors does not support SETcc instructions. When deep learning algorithm training involves SETcc operations, two solutions are currently commonly used to solve the problem: (1) using scalar units for serial operations; (2) accelerating by starting multi-core parallelism. Solution (1) is usually used in Intel / ARM CPU processors. Such processors usually have a small number of cores. From the perspective of the programming model, it is not suitable to execute the same algorithm kernel on multiple processor cores at the same time. Therefore, it can only be processed serially through the scalar processing unit of each core. The serial processing time is relatively long, and the delay is N (typically N = 8, 16) times that of parallel processing. Solution (2) is usually used in GPU processors. GPUs have a large number of threads, and from the perspective of the programming model, a task can be easily divided into multiple threads for execution, which improves the speed of serial processing, but there is a problem of large synchronization overhead between threads. Therefore, the traditional technology does not fully utilize the chip processor, resulting in a low performance-power ratio of the chip processor, which affects the efficiency of deep learning.
[0029] In order to at least partially solve one or more of the above-mentioned problems and other potential problems, an embodiment of the present disclosure proposes a scheme for performing arithmetic operations in deep learning training. In this scheme, by vectorizing the instructions for the arithmetic operations and increasing the parallelism of the arithmetic operations, the calculation speed of the arithmetic operations can be improved. Secondly, since multiple vector operations are executed simultaneously, this method can avoid the inefficiency of CPU serial processing. Thirdly, since there is no need to use threads to synchronize the degree of completion between the same computing tasks, this method can avoid the synchronization overhead of GPU processing. By utilizing the technical solution of the present disclosure, effective utilization of artificial intelligence chip processors is achieved, thereby effectively improving the speed of deep learning training.
[0030] Figure 11 is a schematic block diagram of a deep learning training environment 100 in which the method for performing computing operations in certain embodiments of the present disclosure can be implemented. According to one or more embodiments of the present disclosure, the deep learning training environment 100 may be a cloud environment. Figure 1 As shown in , the deep learning training environment 100 includes a computing device 110. In the deep learning training environment 100, input data 120 is provided to the computing device 110 as an input of the computing device 110. The input data 120 may include, for example, data associated with a computing operation for deep learning, data associated with instructions for a computing operation, and the like. Figure 1 As shown in , the computing device 110 includes a scalar processing unit 113 and a vector acceleration unit 115 .
[0031] According to one or more embodiments of the present disclosure, when a calculation operation for deep learning needs to be performed, the associated data is provided to the computing device 110 as input data 120. Then, the scalar processing unit 113 (sometimes also referred to as the core module) in the computing device 110 processes the basic scalar calculation operation for the input data 120, and converts the input data 120 into the form of instructions for calculation operations (for example, SETcc instructions and vector SETcc instructions (vSETcc instructions), but the protection scope of the present disclosure is not limited to this). The instructions for the calculation operation can then be written back to the memory of the scalar processing unit 113 after being processed by the arithmetic logic ALU, or can be distributed to the vector acceleration unit 115 (sometimes also referred to as the vector acceleration module).
[0032] In the embodiment of the present disclosure, a new instruction vSETcc is proposed to support operations on input data 120 based on the existing architecture 32-bit instruction set. The format of the instruction is shown in Table 3. The design of the instruction format mainly considers two issues: (1) compatibility. By adopting an independent opcode field, the existing instruction format is not affected. (2) Scalability. The instruction format fully considers the subsequent possible expansion requirements and uses specific fields as reserved fields. It should be understood that the instruction vSETcc is given as an example of implementing a calculation operation. Those skilled in the art can use the content and spirit of the present disclosure to set instructions to implement similar functions and new functions. As an example only, Table 3 only shows the implementation of the vSETlt instruction.
[0033]
[0034] Table 3.vSETcc instruction format
[0035] As shown in Table 3, in the vSETlt instruction, a specific field (e.g., an xfunct field) is used as a reserved field. It should be understood that other fields may also be used as reserved fields in case of subsequent expansion requirements. As also shown in Table 3, in the opcode field, the opcode (opcode) relates to a specific vector operation, such as one used to distinguish whether the conditional code belongs to "an object is less than another object (LessThan)", "an object is greater than another object (Great Than)", or "an object is equal to another object (Equal)". In addition, Table 3 also shows the data types of supported vector data, such as floating point numbers (float), half floating point numbers (bfloat), signed integers (int), unsigned integers (unsignedint), etc. It should be understood that although only the above data types are shown here, other data types may also be used, such as a 16-bit signed integer represented in binary complement (short), a 64-bit signed integer represented in binary complement (long), a double-precision 64-bit floating-point number compliant with the IEEE754 standard (double), a single 16-bit Unicode character (char), a Boolean representing one bit of information, and the like.
[0036] In the vector acceleration unit 115, instructions for operation (such as SETcc instructions) are vectorized to implement parallel execution of multiple vector operations (also called vectorized operations), and multiple vector operations are executed continuously. The scalar processing unit 113 and the vector acceleration unit 115 interact with each other through a simple interface, which to a certain extent realizes the independence of module development and reduces the impact on existing processor units.
[0037] It should be understood that the deep learning training environment 100 is merely exemplary and not restrictive, and is scalable, wherein more computing devices 110 may be included, and more input data 120 may be provided to the computing device 110, so that more users may use more computing devices 110 at the same time, and even use more input data 120 to simultaneously or non-simultaneously determine and execute multiple operations for deep learning. In addition, the computing device 110 may also include other units, such as a data storage unit, an information preprocessing unit, etc.
[0038] Figure 2 FIG. 2 is a flowchart of a method 200 for performing a computing operation according to an embodiment of the present disclosure. Specifically, the method 200 for performing a computing operation may be Figure 1The method 200 for performing a computing operation may be performed by the computing device 110 in the deep learning training environment 100 shown in FIG. It should be understood that the method 200 for performing a computing operation may also include additional operations not shown and / or may omit the operations shown, and the scope of the present disclosure is not limited in this respect.
[0039] In block 202 , the computing device 110 obtains instructions for a computing operation, the computing operation including a plurality of vector operations. According to one or more embodiments of the present disclosure, the instructions for the computing operation may be input data 120 or instructions processed by a scalar processing unit 113 in the computing device 110 .
[0040] In box 204, the computing device 110 determines two source operand vectors for comparison for each vector operation in the multiple vector operations obtained in box 202. According to one or more embodiments of the present disclosure, the source operands involved in each vector operation are distributed to a register group (vector register file) VRF, or a cache or other type of temporary storage device according to the data type. Since the purpose of method 200 is to accelerate the operation operation under the framework of the existing chip processor, the problem to be solved is to reduce the latency of serial processing scalar operations and reduce or avoid the synchronization overhead between different threads. In this case, the method 200 solves the aforementioned problem by implementing vectorization of instructions for operation operations and, for example, using, for example, the vSETcc instruction format.
[0041] In block 206, the computing device 110 uses the instruction format for vector operations to perform vector operations on two source operand vectors to obtain an operation result including a destination operand vector. According to one or more embodiments of the present disclosure, in the context of the present disclosure, for data that needs to be operated, such as data to be compared, the data is combined in the form of a vector, and a corresponding operation is performed on each element in the vector to obtain a calculation result. This process is a vectorized operation or a vector operation. By vectorizing instructions for operation operations and increasing the parallelism of operation operations, the method can improve the calculation speed of operation operations.
[0042] Figure 3 FIG. 3 is a flowchart of a method 300 for performing a computing operation according to an embodiment of the present disclosure. Specifically, the method 300 for performing a computing operation can also be performed by Figure 1 It is performed by the computing device 110 in the deep learning training environment 100 shown in . It should be understood that the method 300 for performing a computing operation can be considered as an extension of the method 200 for performing a computing operation, and it can also include additional operations not shown and / or can omit the operations shown, and the scope of the present disclosure is not limited in this respect.
[0043] In block 302, computing device 110 obtains instructions for a computing operation, the computing operation including a plurality of vector operations. The specific contents of the steps involved in block 302 are the same as those involved in block 202, and are not described in detail here.
[0044] In block 304, computing device 110 determines two source operand vectors for comparison for each of the plurality of vector operations obtained in block 202. The specific contents of the steps involved in block 304 are the same as those involved in block 204, and are not described again.
[0045] In box 306, the computing device 110 uses an instruction format for vector operations to perform a second number of element-by-element comparison operations in parallel for each element in two source operand vectors according to the corresponding data type of the element, where the two source operand vectors have a first number of elements respectively, and the first number is greater than or equal to the second number, to obtain an operation result including the destination operand vector.
[0046] According to one or more embodiments of the present disclosure, for data that needs to be operated, such as data to be compared, it is combined in the form of a vector, and operating the two source operand vectors obtained therefrom will be better than operating the two scalar source operands, because the elements of the same type are processed collectively. The two source operand vectors have a first number of elements respectively, and then each element thereof performs a second number of element-by-element comparison operations in parallel according to the data type of the element. It should be understood that, for example, on a chip with limited resources, the number of processors may be relatively small, so for the first number of elements that need to be operated, the number of element operations performed in the corresponding processing unit can be equal to or less than the number of elements, and for the elements in the vector that have not completed the operation, the next parallel processing cycle can be sequentially waited. In other words, in the technical solution of the present disclosure, the number of elements in the source operand vector (i.e., the first number) can be greater than or equal to the number of vector operations performed (i.e., the second number). Therefore, the technical solution of the present disclosure can be used not only on the next generation chip processor with powerful computing functions, but also on the existing chip processor with limited resources, thereby improving the utilization rate of the existing chip processor.
[0047] Figure 4 FIG. 4 is a schematic diagram of a process 400 for accelerating vector operations according to an embodiment of the present disclosure. According to one or more embodiments, Figure 4In the embodiment, the execution of the vector operation first starts with loading data from the memory into the corresponding source operand register group VRF (401). After the operand is ready, it is sent to a comparison submodule in the corresponding comparison submodule (431-437) for operation, and the operation result is finally written back (stored) to the storage space. It should be understood that for some reusable data, the process of loading from the memory can be omitted.
[0048] like Figure 4 As shown, each element in the source operand vectors src0 (1x N1 vector) 411 and src1 (1x N2 vector) 413, which respectively have a first number N1 of elements, is distributed to a second number N2 of operation submodules of the same data type according to the data type, that is, the number of elements participating in the current element-by-element comparison operation in parallel is N2. As mentioned above, on a chip with limited resources, for example, the number of processors may be relatively small. By setting the number N2 of comparison submodules that perform element-by-element comparison operations in parallel to be less than or equal to the number N1 of elements in the source operand vector, the technical solution disclosed in the present invention can effectively utilize the chip processor, thereby effectively improving the training speed of the deep learning algorithm on the chip processor. After the calculation of the operator module of the same data type, taking the floating-point operator module 431 as an example, the floating-point number element in src0 411 and the corresponding floating-point number element in src1 413 can be compared, and the comparison result of the floating-point number element in src0 411 and the corresponding floating-point number element in src1 413 is determined to be true or false at the multiplexer 451. It should be understood that the conditional code for comparison can be one of "object is less than another object (Less Than)", "object is greater than another object (Great Than)", "object is equal to another object (Equal)". Then, after the determination for the data type (vtype) is carried out at the multiplexer 471, if the data type is consistent, the destination operand dst 491 is set to the constant 1 of the data type, otherwise it is set to the constant 0 of the data type.
[0049] According to one or more embodiments of the present disclosure, due to Figure 4 In the example, the comparison submodule of each data type performs operations on instructions of all data types, so the specific data type is determined to be valid at the comparison calculation result. It should be understood that Figure 4 The determination of the data type can also be performed at the source operand vector, so that only one type of comparison submodule can be determined to be executed before the operation. In addition, it should be understood that Figure 4 The specific data types listed are shown only as examples and are not intended to limit other possible data types.
[0050] Figure 5 is a scene graph that can implement the execution of continuous vector operations 500 of the embodiment of the present disclosure. Figure 5 As shown in FIG, each vector operation in the continuous vector operation is not executed serially, but is executed in the order of load (LD), ALU operation, and storage (ST), wherein the execution of two adjacent vector operations in the continuous vector operation is partially overlapped. In fact, by implementing the execution of continuous vector operations, combined with Figure 4 The technical solution of the present invention has obvious progress in processing a large number of complex computing operations compared with traditional CPU processors and GPU processors, which not only reduces the delay of serial processing, but also avoids the problem of high synchronization overhead between threads in parallel processing.
[0051] References Figures 1 to 5 The present invention describes a deep learning training environment 100 in which a method for performing arithmetic operations in certain embodiments of the present disclosure can be implemented, a method 200 for performing arithmetic operations according to an embodiment of the present disclosure, a method 300 for performing arithmetic operations according to an embodiment of the present disclosure, accelerated vector operations according to an embodiment of the present disclosure, and implementation of continuous vector operations according to an embodiment of the present disclosure. It should be understood that the above description is for the purpose of better illustrating the contents recorded in the present disclosure, and is not intended to be limiting in any way.
[0052] It should be understood that the numbers and sizes of various elements used in the above-mentioned drawings of the present disclosure are only examples, and are not intended to limit the scope of protection of the present disclosure. The above-mentioned numbers and sizes can be arbitrarily set as needed without affecting the normal implementation of the embodiments of the present disclosure.
[0053] See above Figures 1 to 5 The details of the method 200 for performing a computing operation and the method 300 for performing a computing operation according to an embodiment of the present disclosure are described. Figure 6 Describes the various modules in the device that perform the operation.
[0054] Figure 6 6 is a block diagram of an apparatus 600 for implementing an operation of an embodiment of the present disclosure. Figure 6 As shown, the device 600 for performing an operation includes: an acquisition module 610, configured to acquire instructions for an operation, the operation including multiple vector operations; a vector determination module 620, configured to determine two source operand vectors for comparison for each vector operation in the multiple vector operations; and a vector calculation module 630, configured to perform a vector operation on two source operand vectors using an instruction format for the vector operation to obtain an operation result including a destination operand vector.
[0055] In one or more embodiments, wherein two source operand vectors each have a first number of elements, performing a vector operation on the two source operand vectors includes: for each element in the two source operand vectors, performing a second number of element-by-element comparison operations in parallel according to the corresponding data types of the elements, wherein the first number is greater than or equal to the second number.
[0056] In one or more embodiments, performing the vector operation on two source operand vectors further comprises: determining values of corresponding elements in the destination operand vector.
[0057] In one or more embodiments, the instruction format includes fields for two source operand vectors, a field for a destination operand vector, a field for a data type, an opcode field, and / or a reserved field.
[0058] In one or more embodiments, in the opcode field, the opcode includes one of: whether the comparison object is less than another object; whether the comparison object is greater than another object; and whether the comparison object is equal to another object.
[0059] In one or more embodiments, the data type of the destination operand vector includes one of the following: a floating point number, a half floating point number, a signed integer, and an unsigned integer.
[0060] In one or more embodiments, wherein the plurality of vector operations are executed in the order of load, ALU operation, and storage, execution of each of the plurality of vector operations is partially overlapped.
[0061] Through the above reference Figures 1 to 6 According to the description, the technical solution according to the embodiment of the present disclosure has many advantages over the traditional solution. For example, by using the technical solution according to the embodiment of the present disclosure, by vectorizing the instructions for the operation operation, increasing the parallelism of the operation operation, and implementing the element-by-element comparison operation for the continuous vector operation in parallel, the technical solution of the present disclosure can effectively improve the calculation speed of deep learning training.
[0062] In the technical solution disclosed herein, the acquisition, storage and application of user personal information involved are in compliance with the provisions of relevant laws and regulations and do not violate public order and good morals.
[0063] Figure 7 7 is a schematic block diagram of a chip 700 for implementing a computing operation according to an embodiment of the present disclosure. Figure 7As shown, the chip 700 for performing arithmetic operations may include: a processor 710 and a vector acceleration module 720. The processor 710 converts input data into instructions for arithmetic operations through operations such as instruction fetching and decoding, and distributes the instructions to the vector acceleration module 720. Similarly, the vector acceleration module 720 may also return the accelerated vector operation results to the processor 710. It should be understood that the chip 700 may include multiple processors 710 and multiple vector acceleration modules 720, and the vector acceleration module 720 may be Figure 6 The device 600 shown may also be a combination of multiple devices. It should also be understood that the chip 700 can be operated alone or added to other existing hardware architectures in combination, thereby speeding up the chip's operation speed and improving the utilization of the hardware system including the chip.
[0064] According to an embodiment of the present disclosure, the present disclosure also provides an electronic device, a readable storage medium and a computer program product.
[0065] Figure 8 A schematic block diagram of an example electronic device 800 that can be used to implement an embodiment of the present disclosure is shown. The electronic device is intended to represent various forms of digital computers, such as laptop computers, desktop computers, workstations, personal digital assistants, servers, blade servers, mainframe computers, and other suitable computers. The electronic device can also represent various forms of mobile devices, such as personal digital processing, cellular phones, smart phones, wearable devices, and other similar computing devices. The components shown herein, their connections and relationships, and their functions are merely examples and are not intended to limit the implementation of the present disclosure described and / or required herein.
[0066] like Figure 8 As shown, the device 800 includes a computing unit 801, which can perform various appropriate actions and processes according to a computer program stored in a read-only memory (ROM) 802 or a computer program loaded from a storage unit 808 into a random access memory (RAM) 803. In the RAM 803, various programs and data required for the operation of the device 800 can also be stored. The computing unit 801, the ROM 802, and the RAM 803 are connected to each other via a bus 804. An input / output (I / O) interface 805 is also connected to the bus 804.
[0067] A number of components in the device 800 are connected to the I / O interface 805, including: an input unit 806, such as a keyboard, a mouse, etc.; an output unit 807, such as various types of displays, speakers, etc.; a storage unit 808, such as a disk, an optical disk, etc.; and a communication unit 809, such as a network card, a modem, a wireless communication transceiver, etc. The communication unit 809 allows the device 800 to exchange information / data with other devices through a computer network such as the Internet and / or various telecommunication networks.
[0068] The computing unit 801 may be a variety of general and / or special processing components with processing and computing capabilities. Some examples of the computing unit 801 include, but are not limited to, a central processing unit (CPU), a graphics processing unit (GPU), various dedicated artificial intelligence (AI) computing chips, various computing units running machine learning model algorithms, digital signal processors (DSPs), and any appropriate processors, controllers, microcontrollers, etc. The computing unit 801 performs the various methods and processes described above, such as methods 200 and 300. For example, in some embodiments, methods 200 and 300 may be implemented as a computer software program, which is tangibly included in a machine-readable medium, such as a storage unit 808. In some embodiments, part or all of the computer program may be loaded and / or installed on the device 800 via the ROM 802 and / or the communication unit 809. When the computer program is loaded into the RAM 803 and executed by the computing unit 801, one or more steps of the methods 200 and 300 described above may be performed. Alternatively, in other embodiments, the computing unit 801 may be configured to execute the methods 200 and 300 in any other appropriate manner (eg, by means of firmware).
[0069] Various implementations of the systems and techniques described above herein can be implemented in digital electronic circuit systems, integrated circuit systems, field programmable gate arrays (FPGAs), application specific integrated circuits (ASICs), application specific standard products (ASSPs), systems on chips (SOCs), load programmable logic devices (CPLDs), computer hardware, firmware, software, and / or combinations thereof. These various implementations can include: being implemented in one or more computer programs that can be executed and / or interpreted on a programmable system including at least one programmable processor, which can be a special purpose or general purpose programmable processor that can receive data and instructions from a storage system, at least one input device, and at least one output device, and transmit data and instructions to the storage system, the at least one input device, and the at least one output device.
[0070] The program code for implementing the method of the present disclosure may be written in any combination of one or more programming languages. These program codes may be provided to a processor or controller of a general-purpose computer, a special-purpose computer, or other programmable data processing device, so that the program code, when executed by the processor or controller, enables the functions / operations specified in the flow chart and / or block diagram to be implemented. The program code may be executed entirely on the machine, partially on the machine, partially on the machine and partially on a remote machine as a stand-alone software package, or entirely on a remote machine or server.
[0071] In the context of the present disclosure, a machine-readable medium may be a tangible medium that may contain or store a program for use by or in conjunction with an instruction execution system, device, or equipment. A machine-readable medium may be a machine-readable signal medium or a machine-readable storage medium. A machine-readable medium may include, but is not limited to, an electronic, magnetic, optical, electromagnetic, infrared, or semiconductor system, device, or equipment, or any suitable combination of the foregoing. A more specific example of a machine-readable storage medium may include an electrical connection based on one or more lines, a portable computer disk, a hard disk, a random access memory (RAM), a read-only memory (ROM), an erasable programmable read-only memory (EPROM or flash memory), an optical fiber, a portable compact disk read-only memory (CD-ROM), an optical storage device, a magnetic storage device, or any suitable combination of the foregoing.
[0072] To provide interaction with a user, the systems and techniques described herein can be implemented on a computer having: a display device (e.g., a CRT (cathode ray tube) or LCD (liquid crystal display) monitor) for displaying information to the user; and a keyboard and pointing device (e.g., a mouse or trackball) through which the user can provide input to the computer. Other types of devices can also be used to provide interaction with the user; for example, the feedback provided to the user can be any form of sensory feedback (e.g., visual feedback, auditory feedback, or tactile feedback); and input from the user can be received in any form (including acoustic input, voice input, or tactile input).
[0073] The systems and techniques described herein may be implemented in a computing system that includes back-end components (e.g., as a data server), or a computing system that includes middleware components (e.g., an application server), or a computing system that includes front-end components (e.g., a user computer with a graphical user interface or a web browser through which a user can interact with implementations of the systems and techniques described herein), or a computing system that includes any combination of such back-end components, middleware components, or front-end components. The components of the system may be interconnected by any form or medium of digital data communication (e.g., a communication network). Examples of communication networks include: a local area network (LAN), a wide area network (WAN), and the Internet.
[0074] A computer system may include a client and a server. The client and the server are generally remote from each other and usually interact through a communication network. The relationship of client and server is generated by computer programs running on respective computers and having a client-server relationship with each other. The server may be a cloud server, a server of a distributed system, or a server combined with a blockchain.
[0075] It should be understood that the various forms of processes shown above can be used to reorder, add or delete steps. For example, the steps recorded in this disclosure can be executed in parallel, sequentially or in different orders, as long as the desired results of the technical solutions disclosed in this disclosure can be achieved, and this document does not limit this.
[0076] The above specific implementations do not constitute a limitation on the protection scope of the present disclosure. It should be understood by those skilled in the art that various modifications, combinations, sub-combinations and substitutions can be made according to design requirements and other factors. Any modification, equivalent substitution and improvement made within the spirit and principle of the present disclosure shall be included in the protection scope of the present disclosure.
Claims
1. A method for performing computational operations in deep learning training, include: Obtaining instructions for the arithmetic operation, wherein the arithmetic operation includes a plurality of vector operations; For each vector operation of the plurality of vector operations, determining two source operand vectors for comparison, the two source operand vectors being loaded into corresponding source operand register groups according to data types, wherein the two source operand vectors respectively have a first number of elements; as well as In a corresponding processing unit of the processor, the vector operation is performed in parallel on the elements of the two source operand vectors from the corresponding source operand register groups according to the data type using an instruction format for the vector operation to obtain an operation result including a destination operand vector, wherein the vector operation includes: for each element in the two source operand vectors, performing a second number of element-by-element comparison operations in parallel according to the data type of the element, wherein the first number is greater than or equal to the second number.
2. The method according to claim 1, further comprising: include: The value of the corresponding element in the destination operand vector is determined.
3. The method of claim 1, wherein the instruction format comprises fields for the two source operand vectors, a field for the destination operand vector, a field for a data type, an opcode field, and / or a reserved field.
4. The method according to claim 3, wherein in the operation code field, the operation code includes one of the following: whether the comparison object is less than another object; whether the comparison object is greater than another object; and whether the comparison object is equal to another object. 5 . The method of claim 3 , wherein the data type comprises one of: a floating point number, a half floating point number, a signed integer, and an unsigned integer. 6 . The method according to claim 1 , wherein each of the plurality of vector operations is executed in the order of load, ALU operation, and storage, and the execution of two adjacent vector operations of the plurality of vector operations is partially overlapped.
7. A device for performing computational operations in deep learning training, include: At least one vector acceleration module, the at least one vector acceleration module comprising: An acquisition module is configured to acquire instructions for the operation, wherein the operation includes a plurality of vector operations; a vector determination module configured to determine, for each vector operation of the plurality of vector operations, two source operand vectors for comparison, the two source operand vectors being loaded into corresponding source operand register groups according to data types, wherein the two source operand vectors respectively have a first number of elements; and A vector calculation module is configured to, in a corresponding processing unit of the processor, use an instruction format for the vector operation to perform the vector operation in parallel on the elements of the two source operand vectors from the corresponding source operand register group according to the data type to obtain an operation result including a destination operand vector, wherein the vector operation includes: for each element in the two source operand vectors, performing a second number of element-by-element comparison operations in parallel according to the data type of the element, wherein the first number is greater than or equal to the second number.
8. The apparatus of claim 7 , further comprising: performing the vector operation on the two source operand vectors; include: The value of the corresponding element in the destination operand vector is determined.
9. The apparatus of claim 7, wherein the instruction format comprises fields for the two source operand vectors, a field for the destination operand vector, a field for a data type, an opcode field, and / or a reserved field.
10. The apparatus of claim 9, wherein in the opcode field, the opcode includes one of: whether the comparison object is less than another object; whether the comparison object is greater than another object; and whether the comparison object is equal to another object.
11. The apparatus of claim 9, wherein the data type of the destination operand vector comprises one of: a floating point number, a half floating point number, a signed integer, and an unsigned integer.
12. The apparatus according to claim 7, wherein each of the plurality of vector operations is executed in the order of load, ALU operation, and storage, and the execution of two adjacent vector operations of the plurality of vector operations is partially overlapped.
13. A chip, include: at least one processor; as well as An apparatus according to any one of claims 7-12, communicatively coupled to the at least one processor.
14. An electronic device, include: at least one processor; as well as a memory communicatively connected to the at least one processor; wherein, The memory stores instructions that can be executed by the at least one processor, and the instructions are executed by the at least one processor to enable the at least one processor to perform the method according to any one of claims 1 to 6.
15. A non-transitory computer-readable storage medium storing computer instructions, in, The computer instructions are used to cause the computer to execute the method according to any one of claims 1-6.
