Data processing method and device and related product

文档序号:1815550 发布日期:2021-11-09 浏览:11次 中文

阅读说明:本技术 数据处理方法及装置以及相关产品 (Data processing method and device and related product ) 是由 不公告发明人 于 2020-05-08 设计创作,主要内容包括:本公开涉及一种数据处理方法及装置以及相关产品。所述产品包括控制模块,所述控制模块包括:指令缓存单元、指令处理单元和存储队列单元;所述指令缓存单元,用于存储所述人工神经网络运算关联的计算指令;所述指令处理单元,用于对所述计算指令解析得到多个运算指令;所述存储队列单元,用于存储指令队列,该指令队列包括:按该队列的前后顺序待执行的多个运算指令或计算指令。通过以上方法,本公开可以提高相关产品在进行神经网络模型的运算时的运算效率。(The present disclosure relates to a data processing method and apparatus and related products. The product includes a control module, the control module including: the device comprises an instruction cache unit, an instruction processing unit and a storage queue unit; the instruction cache unit is used for storing the calculation instruction associated with the artificial neural network operation; the instruction processing unit is used for analyzing the calculation instruction to obtain a plurality of operation instructions; the storage queue unit is configured to store an instruction queue, where the instruction queue includes: and a plurality of operation instructions or calculation instructions to be executed according to the front and back sequence of the queue. Through the method, the operation efficiency of the related product in the operation of the neural network model can be improved.)

1. A data processing method, comprising:

when the decoded processing instruction is a vector expansion instruction, determining a source data address, a destination data address and an expansion parameter of data corresponding to the processing instruction;

expanding the first vector data of the source data address according to the expansion parameters to obtain expanded second vector data;

storing the second vector data to the destination data address,

wherein the source data address and the destination data address comprise consecutive data addresses.

2. The method of claim 1, wherein when the decoded processing instruction is a vector expansion instruction, determining a source data address, a destination data address, and an expansion parameter of data corresponding to the processing instruction comprises:

determining a source data address of a plurality of data points of first vector data in an operational domain of the processing instruction according to a source data base address and a data size of the plurality of data points.

3. The method of claim 1 or 2, wherein the first vector data comprises N data points, wherein the extended parameters comprise N extended parameter bits corresponding to the N data points, wherein N is an integer greater than 1,

the expanding the first vector data of the source data address according to the expansion parameter to obtain expanded second vector data includes:

determining k of the nth data position of the second vector data according to the nth data point of the first vector data and the nth extension parameter position corresponding to the nth data pointnN is more than or equal to 1 and less than or equal to N, kn≥0;

Determining the second vector data from data points of the N data locations of the second vector data.

4. The method of any of claims 1-3, wherein storing the second vector data to the destination data address comprises:

and sequentially storing each data point of the second vector data according to the destination data base address and the data size of the destination data address.

5. The method according to any one of claims 1-4, further comprising:

decoding the received processing instruction to obtain a decoded processing instruction,

wherein the decoded processing instruction comprises an operation code, and the operation code is used for indicating vector expansion processing.

6. A data processing apparatus, comprising:

the address determining module is used for determining a source data address, a destination data address and an extension parameter of data corresponding to the decoded processing instruction when the decoded processing instruction is a vector extension instruction;

the data expansion module is used for expanding the first vector data of the source data address according to the expansion parameters to obtain expanded second vector data;

a data storage module for storing the second vector data to the destination data address,

wherein the source data address and the destination data address comprise consecutive data addresses.

7. The apparatus of claim 6, wherein the address determination module comprises:

and the source address determining submodule is used for determining the source data addresses of a plurality of data points according to the source data base addresses and the data sizes of the data points of the first vector data in the operation domain of the processing instruction.

8. The apparatus of claim 6 or 7, wherein the first vector data comprises N data points, wherein the extended parameter comprises N extended parameter bits corresponding to the N data points, wherein N is an integer greater than 1,

the data expansion module includes:

a data point determination submodule for determining a data point based on an nth data point of the first vector data and the sumDetermining k of the nth data position of the second vector data according to the nth expansion parameter position corresponding to the nth data pointnN is more than or equal to 1 and less than or equal to N, kn≥0;

And the data determination submodule is used for determining the second vector data according to the data points of the N data positions of the second vector data.

9. The apparatus of any one of claims 6-8, wherein the data storage module comprises:

and the storage submodule is used for sequentially storing each data point of the second vector data according to the target data base address and the data size of the target data address.

10. The apparatus according to any one of claims 6-9, further comprising:

a decoding module for decoding the received processing instruction to obtain a decoded processing instruction,

wherein the decoded processing instruction comprises an operation code, and the operation code is used for indicating vector expansion processing.

11. An artificial intelligence chip, wherein the chip comprises a data processing apparatus according to any one of claims 6 to 10.

12. An electronic device, characterized in that the electronic device comprises an artificial intelligence chip according to claim 11.

13. The utility model provides a board card, its characterized in that, the board card includes: a memory device, an interface device and a control device and an artificial intelligence chip according to claim 11;

wherein, the artificial intelligence chip is respectively connected with the storage device, the control device and the interface device;

the storage device is used for storing data;

the interface device is used for realizing data transmission between the artificial intelligence chip and external equipment;

and the control device is used for monitoring the state of the artificial intelligence chip.

Technical Field

The present disclosure relates to the field of computer technologies, and in particular, to a data processing method and apparatus, and a related product.

Background

With the development of the artificial intelligence technology, the method has better effect in the fields of image recognition and the like. In the image recognition process, a large amount of vector data may need to be processed (e.g., difference operation, expansion, deformation, etc.), however, the processing process in the related art is complex, and the data overhead is large.

Disclosure of Invention

In view of the foregoing, it is desirable to provide a data processing method and apparatus and related products.

According to an aspect of the present disclosure, there is provided a data processing method including:

when the decoded processing instruction is a vector expansion instruction, determining a source data address, a destination data address and an expansion parameter of data corresponding to the processing instruction;

expanding the first vector data of the source data address according to the expansion parameters to obtain expanded second vector data;

storing the second vector data to the destination data address,

wherein the source data address and the destination data address comprise consecutive data addresses.

According to another aspect of the present disclosure, there is provided a data processing apparatus including:

the address determining module is used for determining a source data address, a destination data address and an extension parameter of data corresponding to the decoded processing instruction when the decoded processing instruction is a vector extension instruction;

the data expansion module is used for expanding the first vector data of the source data address according to the expansion parameters to obtain expanded second vector data;

a data storage module for storing the second vector data to the destination data address,

wherein the source data address and the destination data address comprise consecutive data addresses.

According to another aspect of the present disclosure, an artificial intelligence chip is provided, which includes the data processing apparatus described above.

According to another aspect of the present disclosure, an electronic device is provided, which includes the artificial intelligence chip described above.

According to another aspect of the present disclosure, a board card is provided, which includes: the artificial intelligence chip comprises a storage device, an interface device, a control device and the artificial intelligence chip;

wherein, the artificial intelligence chip is respectively connected with the storage device, the control device and the interface device; the storage device is used for storing data;

the interface device is used for realizing data transmission between the artificial intelligence chip and external equipment;

and the control device is used for monitoring the state of the artificial intelligence chip.

According to the embodiment of the disclosure, vector expansion and storage can be realized through the expansion parameters in the vector expansion instruction, and expanded vector data is obtained, so that the processing process is simplified, and the data overhead is reduced.

Through deducing technical characteristics in the claims, the beneficial effects corresponding to the technical problems in the background art can be achieved. Other features and aspects of the present disclosure will become apparent from the following detailed description of exemplary embodiments, which proceeds with reference to the accompanying drawings.

Drawings

The accompanying drawings, which are incorporated in and constitute a part of this specification, illustrate exemplary embodiments, features, and aspects of the disclosure and, together with the description, serve to explain the principles of the disclosure.

Fig. 1 shows a schematic diagram of a processor of a data processing method according to an embodiment of the present disclosure.

Fig. 2 shows a flow diagram of a data processing method according to an embodiment of the present disclosure.

Fig. 3 shows a block diagram of a data processing apparatus according to an embodiment of the present disclosure.

Fig. 4 shows a block diagram of a board card according to an embodiment of the present disclosure.

Detailed Description

The technical solutions in the embodiments of the present disclosure will be clearly and completely described below with reference to the drawings in the embodiments of the present disclosure, and it is obvious that the described embodiments are some, but not all embodiments of the present disclosure. All other embodiments, which can be derived by a person skilled in the art from the embodiments disclosed herein without making any creative effort, shall fall within the protection scope of the present disclosure.

It will be understood that the terms "comprises" and/or "comprising," when used in this specification and claims, specify the presence of stated features, integers, steps, operations, elements, and/or components, but do not preclude the presence or addition of one or more other features, integers, steps, operations, elements, components, and/or groups thereof.

It is also to be understood that the terminology used in the description of the disclosure herein is for the purpose of describing particular embodiments only, and is not intended to be limiting of the disclosure. As used in the specification and claims of this disclosure, the singular forms "a", "an" and "the" are intended to include the plural forms as well, unless the context clearly indicates otherwise. It should be further understood that the term "and/or" as used in the specification and claims of this disclosure refers to any and all possible combinations of one or more of the associated listed items and includes such combinations.

As used in this specification and claims, the term "if" may be interpreted contextually as "when", "upon" or "in response to a determination" or "in response to a detection". Similarly, the phrase "if it is determined" or "if a [ described condition or event ] is detected" may be interpreted contextually to mean "upon determining" or "in response to determining" or "upon detecting [ described condition or event ]" or "in response to detecting [ described condition or event ]".

The data Processing method according to the embodiment of the present disclosure may be applied to a processor, which may be a general-purpose processor, such as a Central Processing Unit (CPU), or an artificial Intelligence Processor (IPU) for performing artificial intelligence operations. The artificial intelligence operations may include machine learning operations, brain-like operations, and the like. The machine learning operation comprises neural network operation, k-means operation, support vector machine operation and the like. The artificial intelligence processor may include, for example, one or a combination of a GPU (Graphics Processing Unit), a NPU (Neural-Network Processing Unit), a DSP (Digital Signal Processing Unit), and a Field Programmable Gate Array (FPGA) chip. The present disclosure is not limited to a particular type of processor.

In one possible implementation, the processor referred to in this disclosure may include multiple processing units, each of which may independently run various tasks assigned thereto, such as: a convolution operation task, a pooling task, a full connection task, or the like. The present disclosure is not limited to processing units and tasks executed by processing units.

Fig. 1 shows a schematic diagram of a processor of a data processing method according to an embodiment of the present disclosure. As shown in fig. 1, processor 100 includes a plurality of processing units 101 and a storage unit 102, where the plurality of processing units 101 is configured to execute instruction sequences, and the storage unit 102 is configured to store data, and may include a Random Access Memory (RAM) and a register file. Multiple processing units 101 in processor 100 may share a portion of memory, such as a portion of RAM memory and a register file, or may have separate memory spaces at the same time.

Fig. 2 shows a flow diagram of a data processing method according to an embodiment of the present disclosure. As shown in fig. 2, the method includes:

in step S11: when the decoded processing instruction is a vector expansion instruction, determining a source data address, a destination data address and an expansion parameter of data corresponding to the processing instruction;

in step S12: expanding the first vector data of the source data address according to the expansion parameters to obtain expanded second vector data;

in step S13, storing the second vector data to the destination data address,

wherein the source data address and the destination data address comprise consecutive data addresses.

According to the embodiment of the disclosure, vector expansion and storage can be realized through the expansion parameters in the vector expansion instruction, and expanded vector data is obtained, so that the processing process is simplified, and the data overhead is reduced.

In one possible implementation, the method further includes: and decoding the received processing instruction to obtain a decoded processing instruction. Wherein the decoded processing instruction comprises an operation code, and the operation code is used for indicating vector expansion processing.

For example, when the processor receives a processing instruction, the processor may decode the received processing instruction to obtain a decoded processing instruction. The decoded processing instruction comprises an operation code and an operation field, wherein the operation code is used for indicating the processing type of the processing instruction, and the operation field is used for indicating the data to be processed and the data parameter. If the opcode of the decoded processing instruction indicates Vector Extension processing, the instruction is a Vector Extension instruction (Vector Extension).

In one possible implementation, if the decoded processing instruction is a vector expansion instruction, the source data address, the destination data address, and the expansion parameter of the data corresponding to the processing instruction may be determined in step S11. Data corresponding to the processing instruction is first vector data indicated by an operation field of the processing instruction, and the first vector data comprises a plurality of data points. The source data address represents the current data storage address of a plurality of data points in the data storage space, and is a continuous data address; the destination data address indicates a data storage address for storing a plurality of data points of the expanded second vector data, and is also a continuous data address. The data storage space in which the source data address is located and the data storage space in which the destination data address is located may be the same or different, and this disclosure does not limit this.

In a possible implementation manner, after determining the source data address and the extension parameter, the processor may read a plurality of data points of the first vector data from the source data address in step S12, and respectively extend the plurality of read data points according to the extension parameter to obtain a plurality of data points of the extended second vector data, thereby implementing vector extension.

In a possible implementation manner, a plurality of data points of the expanded second vector data may be sequentially stored in the destination data address to obtain the second vector data, thereby completing the vector expansion process.

By the method, when vector data needs to be expanded in application scenes such as image recognition, the original vector can be expanded into a new vector through the vector expansion instruction and stored in a continuous address space, so that the processing process is simplified, and the data overhead is reduced.

In one possible implementation, step S11 may include: determining a source data address of a plurality of data points of first vector data in an operational domain of the processing instruction according to a source data base address and a data size of the plurality of data points.

For example, a vector expand instruction may have an operation field for indicating parameters of vector data to be expanded. The operation field may include, for example, a Source Data Base Address (Source Data Base Address), a Destination Data Base Address (Destination Data Base Address), a Size of a Single Data Point (Single Point Data Size), a Number of Single Data points (Single Point Data Number), an extension parameter, and the like.

Wherein the source data base address may represent a base address of the plurality of data points of the first vector data currently in the data storage space; the destination data base address may represent a base address of the plurality of data points of the expanded second vector data in the data storage space; the size of a single data point may represent the data size (e.g., 4 bits or 8 bits) of each data point of the first vector data and the second vector data; the number of single data points may represent the number N of data points of the first vector data (N is an integer greater than 1); the spread parameter may indicate a manner of spreading the N data points of the first vector data. The present disclosure does not limit the number and type of parameters specific to the operation domain of the vector expand instruction.

In one possible implementation, the operation domain of the vector expand instruction may include a Source Data Base Address (Source Data Base Address), and a Size of a Single Data Point (Single Point Data Size). Because the source data addresses are continuous data addresses, the source data addresses of the data points can be determined in sequence directly according to the data sizes of the data points and the serial numbers of the data points. The source data address of the nth data point may be expressed as:

Single Point Src Addr[n]= Source Data Base Address +n*Single Point Data Size (1)

in formula (1), Single Point Src Addr [ n ] represents the source data address of the nth data Point. When the source data base address is Addr1[0, 3], the size of a single data point is 4 bits, and n is 3, for example, it can be determined that the source data address of the 3 rd data point is Addr1[12,15 ].

In this way, the source data addresses of the respective data points can be determined separately, so that the respective data points of the first vector data are read from the source data addresses.

In one possible implementation, the first vector data includes N data points, N is an integer greater than 1, and accordingly, the extended parameter includes N extended parameter bits corresponding to the N data points. Wherein, the step S12 may include:

determining k of the nth data position of the second vector data for the nth data point of the first vector data and the nth extended parameter bit corresponding to the nth data pointnN is more than or equal to 1 and less than or equal to N, kn≥0;

Determining the second vector data from data points of the N data locations of the second vector data.

For example, the extension parameter may include N extension parameter bits, respectively representing the number of copies k of the N data points of the first vector datanFor example, when N is 5, the extension parameter can be represented as [1,2,0,3,1]The results are 1,2,0,3 and 1 copies of 5 data points.

In one possible implementation, for the nth data point (1 ≦ N) of the first vector data, the nth data point has k as the nth extended parameter bitn(kn≧ 0), it may be determined that the nth data position of the second vector data has knAn nth data point of the first vector data. Thus, by performing the expansion process on N data points of the first vector data, respectively, data points of N data positions of the second vector data can be determined. For example, the first vector data is [ A, B, C, D, E]The extension parameter may be [1,2,0,3,1 ]]After the fact of expansionAfter expansion, the second vector data is [ A, B, B, D, D, D, E [ ]]。

It should be understood that the expansion parameter may also include other expansion contents (for example, the value of each data point is enlarged or reduced by a certain factor), and the expansion parameter may also include other expressions, which can be set by those skilled in the art according to practical situations, and the present disclosure does not limit the present disclosure.

In this way, the expanded second vector data can be obtained.

In one possible implementation, step S13 may include: and sequentially storing each data point of the second vector data according to the destination data base address and the data size of the destination data address.

For example, after the expanded second vector data is obtained, the second vector data may be stored to a preset destination data address. The operation field of the vector expansion instruction may include a Destination Data Base Address (Destination Data Base Address), and the Destination Data addresses of the Data points of the second vector Data may be determined according to the Destination Data Base Address and the Data size of a single Data point.

Single Point Dest Addr[m]=Destination Data Base Address+m*Single Point Data Size (2)

In formula (2), Single Point Src Addr [ M ] represents the destination data address of the mth data Point of the second vector data (the second vector data includes M data points, M is greater than or equal to 1 and is less than or equal to M, and M is an integer greater than 1). When the destination data base address is Addr2[14, 17], the size of a single data point is 4 bits, and m is 3, the source data address of the 3 rd data point is Addr2[26,29 ].

In this way, each data point of the second vector data can be stored in turn into the destination data address, thereby completing the entire process of vector expansion.

According to the data processing method disclosed by the embodiment of the disclosure, the vector can be expanded through the vector expansion instruction, so that when vector data needs to be expanded in application scenes such as image recognition, the original vector can be expanded into a new vector and stored in a continuous address space, the processing process is simplified, and the data overhead is reduced.

It is noted that while for simplicity of explanation, the foregoing method embodiments have been described as a series of acts or combination of acts, it will be appreciated by those skilled in the art that the present disclosure is not limited by the order of acts, as some steps may, in accordance with the present disclosure, occur in other orders and concurrently. Further, those skilled in the art should also appreciate that the embodiments described in the specification are exemplary embodiments and that acts and modules referred to are not necessarily required by the disclosure.

It should be further noted that, although the steps in the flowchart are shown in sequence as indicated by the arrows, the steps are not necessarily executed in sequence as indicated by the arrows. The steps are not performed in the exact order shown and described, and may be performed in other orders, unless explicitly stated otherwise. Moreover, at least a portion of the steps in the flowchart may include multiple sub-steps or multiple stages, which are not necessarily performed at the same time, but may be performed at different times, and the order of performing the sub-steps or stages is not necessarily sequential, but may be performed alternately or alternately with other steps or at least a portion of the sub-steps or stages of other steps.

Fig. 3 shows a block diagram of a data processing apparatus according to an embodiment of the present disclosure. As shown in fig. 3, the apparatus includes:

an address determining module 31, configured to determine, when the decoded processing instruction is a vector expansion instruction, a source data address, a destination data address, and an expansion parameter of data corresponding to the processing instruction;

a data expansion module 32, configured to expand the first vector data of the source data address according to the expansion parameter to obtain expanded second vector data;

a data storage module 33 for storing the second vector data to the destination data address,

wherein the source data address and the destination data address comprise consecutive data addresses.

In one possible implementation, the address determining module includes:

and the source address determining submodule is used for determining the source data addresses of a plurality of data points according to the source data base addresses and the data sizes of the data points of the first vector data in the operation domain of the processing instruction.

In one possible implementation, the first vector data includes N data points, the extended parameter includes N extended parameter bits corresponding to the N data points, N is an integer greater than 1,

the data expansion module includes:

a data point determining submodule for determining k of an nth data position of second vector data according to an nth data point of the first vector data and an nth expansion parameter bit corresponding to the nth data pointnN is more than or equal to 1 and less than or equal to N, kn≥0;

And the data determination submodule is used for determining the second vector data according to the data points of the N data positions of the second vector data.

In one possible implementation, the data storage module includes:

and the storage submodule is used for sequentially storing each data point of the second vector data according to the target data base address and the data size of the target data address.

In one possible implementation, the apparatus further includes:

a decoding module for decoding the received processing instruction to obtain a decoded processing instruction,

wherein the decoded processing instruction comprises an operation code, and the operation code is used for indicating vector expansion processing.

It should be understood that the above-described apparatus embodiments are merely illustrative and that the apparatus of the present disclosure may be implemented in other ways. For example, the division of the units/modules in the above embodiments is only one logical function division, and there may be another division manner in actual implementation. For example, multiple units, modules, or components may be combined, or may be integrated into another system, or some features may be omitted, or not implemented.

In addition, unless otherwise specified, each functional unit/module in each embodiment of the present disclosure may be integrated into one unit/module, each unit/module may exist alone physically, or two or more units/modules may be integrated together. The integrated units/modules may be implemented in the form of hardware or software program modules.

If the integrated unit/module is implemented in hardware, the hardware may be digital circuits, analog circuits, etc. Physical implementations of hardware structures include, but are not limited to, transistors, memristors, and the like. The artificial intelligence processor may be any suitable hardware processor, such as a CPU, GPU, FPGA, DSP, ASIC, etc., unless otherwise specified. Unless otherwise specified, the Memory unit may be any suitable magnetic storage medium or magneto-optical storage medium, such as resistive Random Access Memory rram (resistive Random Access Memory), Dynamic Random Access Memory dram (Dynamic Random Access Memory), Static Random Access Memory SRAM (Static Random-Access Memory), enhanced Dynamic Random Access Memory edram (enhanced Dynamic Random Access Memory), High-Bandwidth Memory HBM (High-Bandwidth Memory), hybrid Memory cubic hmc (hybrid Memory cube), and so on.

The integrated units/modules, if implemented in the form of software program modules and sold or used as a stand-alone product, may be stored in a computer readable memory. Based on such understanding, the technical solution of the present disclosure may be embodied in the form of a software product, which is stored in a memory and includes several instructions for causing a computer device (which may be a personal computer, a server, or a network device) to execute all or part of the steps of the method according to the embodiments of the present disclosure. And the aforementioned memory comprises: a U-disk, a Read-Only Memory (ROM), a Random Access Memory (RAM), a removable hard disk, a magnetic or optical disk, and other various media capable of storing program codes.

In a possible implementation manner, an artificial intelligence chip is also disclosed, which comprises the data processing device.

In a possible implementation manner, an electronic device is also disclosed, and the electronic device includes the artificial intelligence chip.

In a possible implementation manner, a board card is further disclosed, which comprises a storage device, an interface device, a control device and the artificial intelligence chip; wherein, the artificial intelligence chip is respectively connected with the storage device, the control device and the interface device; the storage device is used for storing data; the interface device is used for realizing data transmission between the artificial intelligence chip and external equipment; and the control device is used for monitoring the state of the artificial intelligence chip.

Fig. 4 shows a block diagram of a board according to an embodiment of the present disclosure, and referring to fig. 4, the board may include other kit components besides the chip 389, where the kit components include, but are not limited to: memory device 390, interface device 391 and control device 392;

the storage device 390 is connected to the artificial intelligence chip through a bus for storing data. The memory device may include a plurality of groups of memory cells 393. Each group of the storage units is connected with the artificial intelligence chip through a bus. It is understood that each group of the memory cells may be a DDR SDRAM (Double Data Rate SDRAM).

DDR can double the speed of SDRAM without increasing the clock frequency. DDR allows data to be read out on the rising and falling edges of the clock pulse. DDR is twice as fast as standard SDRAM. In one embodiment, the storage device may include 4 sets of the storage unit. Each group of the memory cells may include a plurality of DDR4 particles (chips). In one embodiment, the artificial intelligence chip may include 4 72-bit DDR4 controllers, and 64 bits of the 72-bit DDR4 controller are used for data transmission, and 8 bits are used for ECC check. It can be understood that when DDR4-3200 particles are adopted in each group of memory cells, the theoretical bandwidth of data transmission can reach 25600 MB/s.

In one embodiment, each group of the memory cells includes a plurality of double rate synchronous dynamic random access memories arranged in parallel. DDR can transfer data twice in one clock cycle. And a controller for controlling DDR is arranged in the chip and is used for controlling data transmission and data storage of each memory unit.

The interface device is electrically connected with the artificial intelligence chip. The interface device is used for realizing data transmission between the artificial intelligence chip and external equipment (such as a server or a computer). For example, in one embodiment, the interface device may be a standard PCIE interface. For example, the data to be processed is transmitted to the chip by the server through the standard PCIE interface, so as to implement data transfer. Preferably, when PCIE 3.0X 16 interface transmission is adopted, the theoretical bandwidth can reach 16000 MB/s. In another embodiment, the interface device may also be another interface, and the disclosure does not limit the specific expression of the other interface, and the interface unit may implement the switching function. In addition, the calculation result of the artificial intelligence chip is still transmitted back to the external device (e.g. server) by the interface device.

The control device is electrically connected with the artificial intelligence chip. The control device is used for monitoring the state of the artificial intelligence chip. Specifically, the artificial intelligence chip and the control device can be electrically connected through an SPI interface. The control device may include a single chip Microcomputer (MCU). As the artificial intelligence chip can comprise a plurality of processing chips, a plurality of processing cores or a plurality of processing circuits, a plurality of loads can be driven. Therefore, the artificial intelligence chip can be in different working states such as multi-load and light load. The control device can realize the regulation and control of the working states of a plurality of processing chips, a plurality of processing circuits and/or a plurality of processing circuits in the artificial intelligence chip.

In one possible implementation, an electronic device is disclosed that includes the artificial intelligence chip described above. The electronic device comprises a data processing device, a robot, a computer, a printer, a scanner, a tablet computer, an intelligent terminal, a mobile phone, a vehicle data recorder, a navigator, a sensor, a camera, a server, a cloud server, a camera, a video camera, a projector, a watch, an earphone, a mobile storage, a wearable device, a vehicle, a household appliance, and/or a medical device. The vehicle comprises an airplane, a ship and/or a vehicle; the household appliances comprise a television, an air conditioner, a microwave oven, a refrigerator, an electric cooker, a humidifier, a washing machine, an electric lamp, a gas stove and a range hood; the medical equipment comprises a nuclear magnetic resonance apparatus, a B-ultrasonic apparatus and/or an electrocardiograph.

In the foregoing embodiments, the descriptions of the respective embodiments have respective emphasis, and for parts that are not described in detail in a certain embodiment, reference may be made to related descriptions of other embodiments. The technical features of the embodiments may be arbitrarily combined, and for the sake of brevity, all possible combinations of the technical features in the embodiments are not described, but should be considered as the scope of the present specification as long as there is no contradiction between the combinations of the technical features.

The foregoing may be better understood in light of the following clauses:

clause a1. a data processing method, comprising:

when the decoded processing instruction is a vector expansion instruction, determining a source data address, a destination data address and an expansion parameter of data corresponding to the processing instruction;

expanding the first vector data of the source data address according to the expansion parameters to obtain expanded second vector data;

storing the second vector data to the destination data address,

wherein the source data address and the destination data address comprise consecutive data addresses.

A2. According to the method in a1, when the decoded processing instruction is a vector expansion instruction, determining a source data address, a destination data address and an expansion parameter of data corresponding to the processing instruction includes:

determining a source data address of a plurality of data points of first vector data in an operational domain of the processing instruction according to a source data base address and a data size of the plurality of data points.

A3. The method of A1 or A2, the first vector data comprising N data points, the extended parameters comprising N extended parameter bits corresponding to the N data points, N being an integer greater than 1,

the expanding the first vector data of the source data address according to the expansion parameter to obtain expanded second vector data includes:

determining k of the nth data position of the second vector data according to the nth data point of the first vector data and the nth extension parameter position corresponding to the nth data pointnN is more than or equal to 1 and less than or equal to N, kn≥0;

Determining the second vector data from data points of the N data locations of the second vector data.

A4. The method of any one of A1-A3, storing the second vector data to the destination data address, comprising:

and sequentially storing each data point of the second vector data according to the destination data base address and the data size of the destination data address.

A5. The method of any one of a1-a4, the method further comprising:

decoding the received processing instruction to obtain a decoded processing instruction,

wherein the decoded processing instruction comprises an operation code, and the operation code is used for indicating vector expansion processing.

A6. A data processing apparatus comprising:

the address determining module is used for determining a source data address, a destination data address and an extension parameter of data corresponding to the decoded processing instruction when the decoded processing instruction is a vector extension instruction;

the data expansion module is used for expanding the first vector data of the source data address according to the expansion parameters to obtain expanded second vector data;

a data storage module for storing the second vector data to the destination data address,

wherein the source data address and the destination data address comprise consecutive data addresses.

A7. The apparatus of a6, the address determination module comprising:

and the source address determining submodule is used for determining the source data addresses of a plurality of data points according to the source data base addresses and the data sizes of the data points of the first vector data in the operation domain of the processing instruction.

A8. The apparatus of A6 or A7, the first vector data comprising N data points, the extended parameters comprising N extended parameter bits corresponding to the N data points, N being an integer greater than 1, the data extension module comprising:

a data point determining submodule for determining k of an nth data position of second vector data according to an nth data point of the first vector data and an nth expansion parameter bit corresponding to the nth data pointnN is more than or equal to 1 and less than or equal to N, kn≥0;

And the data determination submodule is used for determining the second vector data according to the data points of the N data positions of the second vector data.

A9. The apparatus of any of claims a6-A8, the data storage module comprising:

and the storage submodule is used for sequentially storing each data point of the second vector data according to the target data base address and the data size of the target data address.

A10. The apparatus of any one of a6-a9, the apparatus further comprising:

a decoding module for decoding the received processing instruction to obtain a decoded processing instruction,

wherein the decoded processing instruction comprises an operation code, and the operation code is used for indicating vector expansion processing.

A11. An artificial intelligence chip comprising a data processing apparatus as claimed in any one of a6-a 10.

A12. An electronic device comprising the artificial intelligence chip of a11.

A13. A card, the card comprising: a memory device, an interface device and a control device and an artificial intelligence chip as described in A11;

wherein, the artificial intelligence chip is respectively connected with the storage device, the control device and the interface device;

the storage device is used for storing data;

the interface device is used for realizing data transmission between the artificial intelligence chip and external equipment;

and the control device is used for monitoring the state of the artificial intelligence chip.

The embodiments of the present disclosure have been described in detail, and the principles and embodiments of the present disclosure are explained herein using specific examples, which are provided only to help understand the method and the core idea of the present disclosure. Meanwhile, a person skilled in the art should, based on the idea of the present disclosure, change or modify the specific embodiments and application scope of the present disclosure. In view of the above, the description is not intended to limit the present disclosure.

15页详细技术资料下载
上一篇:一种医用注射器针头装配设备
下一篇:适应性加载合并

网友询问留言

已有0条留言

还没有人留言评论。精彩留言会获得点赞!

精彩留言,会给你点赞!