CN108037908A - A kind of computational methods and Related product - Google Patents

A kind of computational methods and Related product Download PDF

Info

Publication number
CN108037908A
CN108037908A CN201711362568.8A CN201711362568A CN108037908A CN 108037908 A CN108037908 A CN 108037908A CN 201711362568 A CN201711362568 A CN 201711362568A CN 108037908 A CN108037908 A CN 108037908A
Authority
CN
China
Prior art keywords
matrix
stage
pipelining
operational order
result
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Granted
Application number
CN201711362568.8A
Other languages
Chinese (zh)
Other versions
CN108037908B (en
Inventor
胡帅
刘恩赫
张尧
孟小甫
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Cambricon Technologies Corp Ltd
Beijing Zhongke Cambrian Technology Co Ltd
Original Assignee
Beijing Zhongke Cambrian Technology Co Ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Beijing Zhongke Cambrian Technology Co Ltd filed Critical Beijing Zhongke Cambrian Technology Co Ltd
Priority to CN201711362568.8A priority Critical patent/CN108037908B/en
Publication of CN108037908A publication Critical patent/CN108037908A/en
Application granted granted Critical
Publication of CN108037908B publication Critical patent/CN108037908B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F7/00Methods or arrangements for processing data by operating upon the order or content of the data handled
    • G06F7/76Arrangements for rearranging, permuting or selecting data according to predetermined rules, independently of the content of the data
    • G06F7/78Arrangements for rearranging, permuting or selecting data according to predetermined rules, independently of the content of the data for changing the order of data flow, e.g. matrix transposition or LIFO buffers; Overflow or underflow handling therefor
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F7/00Methods or arrangements for processing data by operating upon the order or content of the data handled
    • G06F7/38Methods or arrangements for performing computations using exclusively denominational number representation, e.g. using binary, ternary, decimal representation
    • G06F7/48Methods or arrangements for performing computations using exclusively denominational number representation, e.g. using binary, ternary, decimal representation using non-contact-making devices, e.g. tube, solid state device; using unspecified devices
    • G06F7/57Arithmetic logic units [ALU], i.e. arrangements or devices for performing two or more of the operations covered by groups G06F7/483 – G06F7/556 or for performing logical operations

Landscapes

  • Engineering & Computer Science (AREA)
  • Theoretical Computer Science (AREA)
  • Physics & Mathematics (AREA)
  • General Physics & Mathematics (AREA)
  • General Engineering & Computer Science (AREA)
  • Computing Systems (AREA)
  • Mathematical Optimization (AREA)
  • Pure & Applied Mathematics (AREA)
  • Mathematical Analysis (AREA)
  • Computational Mathematics (AREA)
  • Mathematical Physics (AREA)
  • Complex Calculations (AREA)
  • Advance Control (AREA)

Abstract

Present disclose provides a kind of information processing method, the method is applied in computing device, and the computing device includes:Storage medium, register cell and matrix calculation unit;Described method includes following steps:The computing device controls the matrix calculation unit to obtain the first operational order, and the matrix that first operational order includes performing needed for described instruction reads instruction;The computing device controls the arithmetic element to read instruction according to the matrix and sends reading order to the storage medium;The computing device controls the arithmetic element to indicate corresponding matrix according to using the batch reading manner reading matrix reading, and first operational order is performed to the matrix.The technical solution that the application provides has the advantages of calculating speed is fast, efficient.

Description

A kind of computational methods and Related product
Technical field
This application involves technical field of data processing, and in particular to a kind of computational methods and Related product.
Background technology
Data processing is the step of most of algorithm needs to pass through or stage, after computer introduces data processing field, More and more data processings realize have computing device carrying out the calculating of matrix data in existing algorithm by computer Shi Sudu is slow, and efficiency is low.
Apply for content
The embodiment of the present application provides a kind of computational methods and Related product, can lift the processing speed of computing device, carry High efficiency.
First aspect, there is provided a kind of computational methods, applied in computing device, the computing device include storage medium, Register cell and matrix operation unit, the described method includes:
The computing device controls the matrix operation unit to obtain the first operational order, and first operational order is used for Matrix is realized to the computing between matrix, the matrix that first operational order includes performing needed for described instruction reads instruction, The required matrix is at least one matrix, and at least one matrix is the matrix that length is identical or length is different;
The computing device controls the matrix operation unit to read instruction according to the matrix and is sent out to the storage medium Send reading order;
The computing device controls the matrix operation unit to be read using batch reading manner from the storage medium The matrix reads the corresponding matrix of instruction, and performs first operational order to the matrix.
It is described that matrix execution first operational order is included in some possible embodiments:
The computing device controls the matrix operation unit to be held using the calculation of multistage pipelining-stage to the matrix Row first operational order.
In some possible embodiments, each pipelining-stage in the multistage pipelining-stage includes at least one computing Device,
The computing device controls the matrix operation unit to be held using the calculation of multistage pipelining-stage to the matrix Row first operational order includes:
The computing device controls the matrix operation unit to utilize first order pipelining-stage according to the selection of multiple selector In first choice arithmetic unit to the matrix be calculated first as a result, first result is input to second level stream The second Selecting operation device in water level perform be calculated second as a result, and so on, until inputting the i-th -1 result to the The i-th Selecting operation device in i grades of pipelining-stages, which performs, is calculated i-th of result;
I-th of result is inputted to the storage medium and is stored;
Wherein, the quantity i of the multistage pipelining-stage is determined according to the calculating topological structure of first operational order, And i is positive integer.
In some possible embodiments, each pipelining-stage in the multistage pipelining-stage is each configured with corresponding multichannel Selector, the multiple selector, which is set, free option, and the sky option is used to indicate the kth being connected with the multiple selector Level pipelining-stage and follow-up kth+1 are not performed to i-stage pipelining-stage calculates operation, wherein, k is less than or equal to i just Integer.
In some possible embodiments, it is described multistage pipelining-stage in each pipelining-stage included by arithmetic unit and institute The quantity for stating arithmetic unit is by user side or the self-defined setting in computing device side.
In some possible embodiments, each pipelining-stage in the multistage pipelining-stage includes pre-set fixation Arithmetic unit, the fixation arithmetic unit in each pipelining-stage differ,
The computing device controls the matrix operation unit to be held using the calculation of multistage pipelining-stage to the matrix Row first operational order includes:
The computing device controls the matrix operation unit to utilize the fixation arithmetic unit in first order pipelining-stage to described Matrix be calculated first as a result, the fixation arithmetic unit first result being input in the pipelining-stage of the second level performs Be calculated second as a result, and so on, until the i-th -1 result inputted to the fixation arithmetic unit in i-stage pipelining-stage holding I-th of result is calculated in row;
I-th of result is inputted to the storage medium and is stored;
Wherein, the quantity i of the multistage pipelining-stage is determined according to the calculating topological structure of first operational order, And i is positive integer.
In some possible embodiments, the arithmetic unit in the multistage pipelining-stage in each pipelining-stage include it is following in Any one or multinomial combination:Addition of matrices arithmetic unit, matrix multiplication operation device, matrix scalar multiplication arithmetic unit, non-linear fortune Calculate device and matrix comparison operation device.
In some possible embodiments, first operational order includes any one of following:Matrix inversion instructs MINV, Matrix Calculating exponential instructions MEXP, Matrix Calculating logarithm command M LOG, Matrix power command M SQRT, matrix spin upside down instruction MUPDO, matrix or so upset command M LERI, matrix to the left 90 degree overturn command M FORTU, 90 degree of upsets refer to matrix to the right Make MBACTU, ask adjoint matrix to instruct.
In some possible embodiments, first operational order is matrix inversion command M INV,
The computing device controls the matrix operation unit to be held using the calculation of multistage pipelining-stage to the matrix Row first operational order includes:
The computing device controls the matrix operation unit to utilize first order pipelining-stage according to the selection of multiple selector Middle nonlinear operator obtains first into row matrix augmentation to the matrix and is flowed as a result, inputting first result to the second level Second is obtained as a result, by institute to carry out Applying Elementary Row Operations to first result using the addition of matrices arithmetic unit in it in water level State the second result input into third level pipelining-stage with using the nonlinear operator in it to second result into row matrix Interception obtains the 3rd result;3rd result is inputted to the storage medium and is stored.
In some possible embodiments, first operational order is any one of following:Matrix Calculating exponential instructions MEXP, Matrix Calculating logarithm command M LOG and Matrix power command M SQRT,
The computing device controls the matrix operation unit to be held using the calculation of multistage pipelining-stage to the matrix Row first operational order includes:
The computing device controls the matrix operation unit to utilize first order pipelining-stage according to the selection of multiple selector Middle nonlinear operator corresponds to the matrix and carries out seeking logarithm, ask index or extracting operation by element, obtains the first knot Fruit;First result is inputted to the storage medium and is stored.
In some possible embodiments, the instruction format of first operational order includes command code and at least one behaviour Make domain, command code is used for the function of indicating the operational order, and arithmetic element is by identifying that the command code can carry out different matrixes Computing, operation domain are used to indicate the data message of the operational order, wherein, data message can be immediate or register number, For example, when obtaining a matrix, matrix initial address and matrix can be obtained in corresponding register according to register number Length, the matrix of appropriate address storage is obtained further according to matrix initial address and matrix length in storage medium.Alternatively, may be used Any one of following middle information or multinomial combination are obtained in corresponding registers:The line number of matrix needed for described instruction, row Number, data type, mark, storage address (first address) and dimension length, the dimension length refer to row matrix length and/ Or the length of rectangular array.
In some possible embodiments, the matrix, which reads instruction, to be included:The storage of matrix needed for described instruction The mark of matrix needed for location or described instruction.
In some possible embodiments, when the matrix, which is read, is designated as the mark of matrix needed for described instruction,
The computing device controls the matrix operation unit to read instruction according to the matrix and is sent out to the storage medium Reading order is sent to include:
It is single that the computing device controls the matrix operation unit to be used according to the mark from the register cell Position reading manner reads the corresponding storage address of the mark;
The computing device controls the matrix operation unit to be sent to the storage medium and reads the storage address Reading order simultaneously obtains the matrix using batch reading manner.
In some possible embodiments, the computing device further includes:Buffer unit, the method further include:
Pending operational order is cached in the buffer unit by the computing device.
In some possible embodiments, control the matrix operation unit to obtain the first computing in the computing device and refer to Before order, the method further includes:
The computing device determines first operational order and the second operational order before first operational order With the presence or absence of incidence relation, if first operational order and second operational order there are incidence relation, will described in First operational order is cached in the buffer unit, after second operational order is finished, from the buffer unit Extract first operational order and be transmitted to the arithmetic element;
Described definite first operational order whether there is with the second operational order before the first operational order to be associated System includes:
The first storage address section of required matrix in first operational order is extracted according to first operational order, The second storage address section of required matrix in second operational order is extracted according to second operational order, if described First storage address section has overlapping region with the second storage address section, it is determined that first operational order with Second operational order has incidence relation, if the first storage address section and the second storage address section are not With overlapping region, it is determined that first operational order does not have incidence relation with second operational order.
Second aspect, there is provided a kind of computing device, the computing device include being used for the method for performing above-mentioned first aspect Functional unit.
The third aspect, there is provided a kind of computer-readable recording medium, it stores the computer journey for electronic data interchange Sequence, wherein, the computer program causes computer to perform the method that first aspect provides.
Fourth aspect, there is provided a kind of computer program product, the computer program product include storing computer journey The non-transient computer-readable recording medium of sequence, the computer program are operable to make computer perform first aspect offer Method.
5th aspect, there is provided a kind of chip, the chip include the computing device that as above second aspect provides.
6th aspect, there is provided a kind of chip-packaging structure, the chip-packaging structure include as above the 5th aspect and provide Chip.
7th aspect, there is provided a kind of board, the board include the chip-packaging structure that as above the 6th aspect provides.
Eighth aspect, there is provided a kind of electronic equipment, the electronic equipment include the board that as above the 7th aspect provides.
In certain embodiments, the electronic equipment includes data processing equipment, robot, computer, printer, scanning Instrument, tablet computer, intelligent terminal, mobile phone, automobile data recorder, navigator, sensor, camera, server, cloud server, Camera, video camera, projecting apparatus, wrist-watch, earphone, mobile storage, wearable device, the vehicles, household electrical appliance, and/or medical treatment Equipment.
In certain embodiments, the vehicles include aircraft, steamer and/or vehicle;The household electrical appliance include electricity Depending on, air-conditioning, micro-wave oven, refrigerator, electric cooker, humidifier, washing machine, electric light, gas-cooker, kitchen ventilator;The Medical Devices include Nuclear Magnetic Resonance, B ultrasound instrument and/or electrocardiograph.
Implement the embodiment of the present application, have the advantages that:
As can be seen that by the embodiment of the present application, computing device is provided with register cell and storage medium, is respectively used to Store scalar data and matrix data, and unit reading manner and batch are read the application for two kinds of memory distributions Mode, the characteristics of by matrix data distribution match the data reading mode of its feature, can be good at utilizing bandwidth, avoid Because influence of the bottleneck of bandwidth to matrix computations speed, in addition, for register cell, since its storage is scalar Data, there is provided the reading manner of scalar data, improve the utilization rate of bandwidth, so the technical solution that the application provides can Utilize bandwidth well, avoid influence of the bandwidth to calculating speed, so it is fast with calculating speed, it is efficient the advantages of.
Brief description of the drawings
In order to illustrate more clearly of the technical solution in the embodiment of the present application, make required in being described below to embodiment Attached drawing is briefly described, it should be apparent that, drawings in the following description are some embodiments of the present application, for ability For the those of ordinary skill of domain, without creative efforts, it can also be obtained according to these attached drawings other attached Figure.
Fig. 1 is a kind of structure diagram of computing device provided by the embodiments of the present application.
Fig. 2 is a kind of structure diagram of arithmetic element provided by the embodiments of the present application.
Fig. 3 is a kind of flow diagram of computational methods provided in an embodiment of the present invention.
Fig. 4 A and Fig. 4 B are the configuration diagrams of two kinds of pipelining-stages provided by the embodiments of the present application.
Fig. 5 is the structure diagram of pipelining-stage provided by the embodiments of the present application.
Fig. 6 A and Fig. 6 B are the form schematic diagrams of two kinds of instruction set provided by the embodiments of the present application.
Fig. 7 is the structure diagram of another computing device provided by the embodiments of the present application.
Fig. 8 is the flow chart that computing device provided by the embodiments of the present application performs the instruction of Matrix Calculating logarithm.
Embodiment
Below in conjunction with the attached drawing in the embodiment of the present application, the technical solution in the embodiment of the present application is carried out clear, complete Site preparation describes, it is clear that described embodiment is some embodiments of the present application, instead of all the embodiments.Based on this Shen Please in embodiment, the every other implementation that those of ordinary skill in the art are obtained without creative efforts Example, shall fall in the protection scope of this application.
Term " first ", " second ", " the 3rd " in the description and claims of this application and the attached drawing and " Four " etc. be to be used to distinguish different objects, rather than for describing particular order.In addition, term " comprising " and " having " and it Any deformation, it is intended that cover non-exclusive include.Such as contain the process of series of steps or unit, method, be The step of system, product or equipment are not limited to list or unit, but alternatively further include the step of not listing or list Member, or alternatively further include for the intrinsic other steps of these processes, method, product or equipment or unit.
Referenced herein " embodiment " is it is meant that a particular feature, structure, or characteristic described can wrap in conjunction with the embodiments It is contained at least one embodiment of the application.Each position in the description occur the phrase might not each mean it is identical Embodiment, nor the independent or alternative embodiment with other embodiments mutual exclusion.Those skilled in the art explicitly and Implicitly understand, embodiment described herein can be combined with other embodiments.
It should be noted that this application involves matrix be specifically as follows m*n matrixes, wherein, m and N are more than or equal to 1 Integer, when m or n is 1, is represented by 1*n matrixes or m*1 matrixes, is referred to as vector;When m and n at the same time for 1 when, can be with It is considered as the Special matrix of 1*1.Following matrixes all can be in above-mentioned three types matrix any one, do not repeating below.
The embodiment of the present application provides a kind of computational methods, which can be applied in computing device.It is this such as Fig. 1 A kind of structure diagram of possible computing device shown in inventive embodiments.Computing device as shown in Figure 1 includes:
Storage medium 201, for storage matrix.The preferable storage medium can be scratchpad, Neng Gouzhi Hold the matrix data of different length;Necessary calculating data are temporarily stored in scratchpad (Scratchpad by the application Memory), this arithmetic unit is made more flexibly can effectively to support the data of different length during matrix operation is carried out. Above-mentioned storage medium can also be the outer database of piece, database or other media that can be stored etc..
Register cell 202, for storing scalar data, wherein, which includes but not limited to:Matrix data (the application is also referred to as matrix) storage address and matrix in storage medium 201 and scalar during scalar operation.A kind of real Apply in mode, register cell can be scalar register heap, there is provided scalar register needed for calculating process, scalar deposit Device not only stores matrix address, and also storage has scalar data.It is to be understood that matrix address (the i.e. storage address of matrix, as first Location) also it is scalar.When being related to the computing of matrix and matrix, arithmetic element not only will with obtaining matrix from register cell Location, will also obtain corresponding scalar from register cell, such as the type of the line number of matrix, columns, matrix data (can also claim For data type), matrix dimension length (the concretely length of row matrix, length of rectangular array etc.).
Arithmetic element 203 (the application is also referred to as matrix operation unit 203), for obtaining and performing the first operational order. As shown in Fig. 2, the arithmetic element includes multiple arithmetic units, which includes but not limited to:Addition of matrices arithmetic unit 2031, square Battle array multiplicative operator 2032, size comparison operation device 2033 (also can matrix comparison operation device), nonlinear operator 2034 and square Battle array scalar multiplication arithmetic unit 2035.
This method is as shown in figure 3, include the following steps:
Step S301, arithmetic element 203 obtains the first operational order, and first operational order is used for realization matrix to square The computing of battle array, first operational order include:Perform the matrix needed for the instruction and read instruction.
In step S301, matrix needed for the above-mentioned execution instruction read instruction be specifically as follows it is a variety of, for example, at this Apply in an optional technical solution, the matrix needed for the above-mentioned execution instruction reads the storage that instruction can be required matrix Address.And for example, in the application in another optional technical solution, matrix needed for the above-mentioned execution instruction reads instruction can be with For the mark of required matrix, the form of expression of the mark can be a variety of, for example, the title of matrix, and for example, the identification of matrix Number, register number or storage address of the matrix in register cell for another example.
Illustrate the square performed needed for the instruction that above-mentioned first operational order includes below by the example of a reality Battle array reads instruction, it is assumed here that and the matrix operation formula is f (x)=A+B, wherein, A, B are matrix.So in the first computing In instruction in addition to carrying the matrix operation formula, the storage address of matrix needed for the matrix operation formula can also be carried, is had Body, such as the storage address of A is 0000-0FFF, the storage address of B is 1000-1FFF.And for example, it can carry A's and B Mark, for example, A be identified as 0101, B be identified as 1010.
Step S302, arithmetic element 203 reads instruction according to the matrix and sends reading order to the storage medium 201.
The implementation method of above-mentioned steps S302 is specifically as follows:
Such as matrix reads the storage address that instruction can be required matrix, and arithmetic element 203 is sent out to the storage medium 201 Give the reading order of the reading storage address and corresponding matrix is obtained using batch reading manner.
And for example the matrix reads instruction when can be the mark of required matrix, and arithmetic element 203 is according to the mark from deposit The corresponding storage address of the mark is read using unit reading manner at device unit, then arithmetic element 203 is to the storage medium 201 send the reading order of the reading storage address and obtain corresponding matrix using batch reading manner.
Above-mentioned single reading manner is specifically as follows, and reads every time as the data of unit, i.e. 1bit data.Set at this time The reason for unit reading manner i.e. 1 reading manner, is, for scalar data, the capacity that it takes is very small, if adopted With batch data reading manner, then the data volume of reading is easily more than the capacity of required data, can so cause bandwidth Waste, so using unit reading manner here for the data of scalar and reading to reduce the waste of bandwidth.
Step S303, arithmetic element 203 reads the corresponding matrix of the instruction using batch reading manner, which is performed First operational order.
Batch reading manner is specifically as follows in above-mentioned steps S303, and reading every time is the data of multidigit, such as every time The data bits of reading is 16bit, 32bit or 64bit, i.e., no matter the data volume needed for it is how many, it reads equal every time For the data of fixed long number, the data mode that this batch is read is very suitable for the reading of big data, for matrix, due to Capacity shared by it is big, if using single reading manner, its speed read can be very slow, so being read here using batch Mode is taken to obtain the data of multidigit so as to quickly read matrix data, is avoided because reading the excessively slow influence matrix meter of matrix data The problem of calculating speed.
The computing device for the technical solution that the application provides is provided with register cell and storage medium, it stores mark respectively Measure data and matrix data, and the application for two kinds of memory distributions unit reading manner and batch reading manner, The characteristics of by matrix data distribution match its feature data reading mode, can be good at utilize bandwidth, avoid because of Influence of the bottleneck of bandwidth to matrix computations speed, in addition, for register cell, since its storage is scalar number According to there is provided the reading manner of scalar data, the utilization rate of bandwidth being improved, so the technical solution that the application provides can be very Good utilization bandwidth, avoids influence of the bandwidth to calculating speed, so it is fast with calculating speed, it is efficient the advantages of.
Optionally, it is above-mentioned that matrix execution first operational order is specifically as follows:
Arithmetic element 203 can use the calculation of multistage pipelining-stage, and the embodiment of the present application can use the meter of i grades of pipelining-stages Calculation mode performs first operational order to the matrix.Specifically include following several embodiments.
In the first embodiment, the computing device can also design at least one multiple selector MMUX to realize multistage The calculating of pipelining-stage.It is specific as what Fig. 4 A and 4B were shown respectively pipelining-stage more than two kinds realizes framework.Such as Fig. 4 A, the computing device Can be that each pipelining-stage designs a multiple selector MMUX;Fig. 4 B are shown as multiple pipelining-stages and set a multiple selector MMUX.Multiple selector it is corresponding needed for control/selection pipelining-stage connection, for select the arithmetic unit in the pipelining-stage with Realize relevant calculating.It is to be understood that arithmetic unit of the multiple selector selected in pipelining-stage is according to the first operational order What corresponding calculating network topology determined, specifically it will be described in detail later.
In the specific implementation, arithmetic element 203 can be according to the selection of multiple selector, using selected by first (level) pipelining-stage First choice arithmetic unit to the matrix be calculated first and utilized as a result, the first result then is inputted the second pipelining-stage The selected second Selecting operation device of second pipelining-stage perform be calculated second as a result, and so on, the i-th -1 result is defeated Enter into the i-th pipelining-stage to perform using its selected i-th Selecting operation device and i-th of result is calculated.Here i-th of result As export result (being specially output matrix).Further, arithmetic element 203 can store the output result to storage medium 201。
What the quantity i of the multistage pipelining-stage was specifically determined according to the calculating topological structure of first operational order, i For positive integer.In general, i=3.May be provided with arithmetic unit correspondingly in each pipelining-stage, the arithmetic unit include but not limited to Any one of lower or multinomial combination:Addition of matrices arithmetic unit, matrix scalar multiplication arithmetic unit, nonlinear operator, matrix Comparison operation device and other matrix operation devices.It is the quantity of arithmetic unit and arithmetic unit included in each pipelining-stage Can there are user side or the self-defined setting in computing device side, not limit.
With i=3, exemplified by three-level flowing water, arithmetic element can select the first pipelining-stage respectively extremely by three multiple selector The respective required arithmetic unit (alternatively referred to as arithmetic unit) used in 3rd pipelining-stage;Meanwhile the first flowing water is performed to the matrix Level is calculated first as a result, the first result is input to calculating for the second pipelining-stage the second pipelining-stage of execution by (optional) To second as a result, (optional) by the second result be input to the 3rd pipelining-stage perform the 3rd pipelining-stage be calculated the 3rd as a result, (optional) stores the 3rd result to storage medium 201.As Fig. 5 shows a kind of operating process schematic diagram of pipelining-stage.
Above-mentioned first pipelining-stage includes but not limited to:Matrix multiplication operation device etc..
Above-mentioned second pipelining-stage includes but not limited to:Addition of matrices arithmetic unit, size comparison operation device etc..
Above-mentioned 3rd pipelining-stage includes but not limited to:Nonlinear operator, matrix scalar multiplication arithmetic unit etc..
By three pipelining-stage computings of matrix point primarily to improving the speed of computing, for the calculating of matrix, example Such as using general processor when calculating, the step of its computing, is specifically as follows, and processor carries out matrix to be calculated first As a result, then by the storage of the first result in memory, processor from memory reads the first result and performs is calculated for the second time Two as a result, then by the storage of the second result in memory, processor is calculated for the third time from interior performed from the second result of reading 3rd as a result, then by the storage of the 3rd result in memory.It can be seen that from the step of above-mentioned calculating and carried out in general processor During matrix computations, it does not shunt water level and is calculated, then be required to after calculating every time the data that will have been calculated into Row preservation, needs to again read off when next time calculates, so this scheme needs repetition storage to read multiple data, for the application's For technical solution, the first result that the first pipelining-stage calculates is directly entered the grading row calculating of the second flowing water, the second pipelining-stage meter The second result calculated enters directly into the 3rd pipelining-stage and is calculated, the first result that the first pipelining-stage and the second pipelining-stage calculate With the second result without storage, which reduce the occupied space of memory first, secondly, which obviate result multiple storage and Read, improve the utilization rate of bandwidth, further increase computational efficiency.
In another embodiment of the application, each flowing water component can be freely combined or take level-one pipelining-stage.Such as will Second pipelining-stage and the 3rd pipelining-stage merge, and either all merge first and second and the 3rd assembly line or each Pipelining-stage is responsible for different computings can be with permutation and combination.For example, first order flowing water is responsible for comparison operation, and partial product computing, Two level flowing water is responsible for the combination such as nonlinear operation and matrix scalar multiplication.It is that the i pipelining-stage designed in the application is supported to appoint Multiple pipelining-stages of anticipating are in parallel, connect and merge, and to form different permutation and combination, the application does not limit.
It should be noted that being also provided with sky option in each multiple selector, i.e., it is connected with the multiple selector Pipelining-stage and follow-up pipelining-stage are not involved in computing.It that is to say, sky option described herein is used to indicate to select with the multichannel Select the kth level pipelining-stage of device connection and follow-up kth+1 not performs to i-stage pipelining-stage and calculates operation, wherein, k is Positive integer less than or equal to i.
With i=3, exemplified by three-level flowing water, if the multiple selector selected as sky option of the 3rd pipelining-stage of connection, the 3rd Pipelining-stage is not involved in computing, and the current pipelining-stage for performing arithmetic operation is less than three;For example, certain operational order is instructed comprising two-stage, Then the corresponding multiple selector of the 3rd pipelining-stage chooses sky option.
Using above-mentioned computing device (be designed with multiple selector select to need in every grade of pipelining-stage the arithmetic unit that uses/ Arithmetic unit), have the advantages that:In addition to bandwidth is improved, while have that logic is clear and definite, the output result of no arithmetic unit From rear pipelining-stage redirecting to preceding pipelining-stage, the characteristics of input interface and output interface are single, good operability.
In second of embodiment, the computing device can be that the fixation pipelining-stage of every kind of operational order design correspondingly is real Existing framework.The corresponding three-level pipelining-stage of a kind of operational order as shown in figure 5 above realizes framework.It is to refer to for certain computing For order, arithmetic unit included in each pipelining-stage is that the fixed setting in advance of user side or the computing device side is good, this The alternatively referred to as fixed arithmetic unit of application.In addition, fixation arithmetic unit in each pipelining-stage can it is identical also can be different, typically not Identical.For example, the first pipelining-stage is addition of matrices arithmetic unit, second level flowing water is matrix multiplication operation device, third level flowing water For nonlinear operator;And for example, the first pipelining-stage is addition of matrices arithmetic unit, and second level flowing water is addition of matrices arithmetic unit, the Three-level flowing water is matrix multiplication operation device etc..I.e. different operational orders, is related to different flowing water stage arrangements (realizing framework). It is to be understood that realizing demand according to what nonidentity operation instructed, the quantity i of its pipelining-stage being related to can be different, can correspond to increase or Less, the application does not limit.
In the specific implementation, arithmetic element 203 utilizes the fixation arithmetic unit in first (level) pipelining-stage to the matrix successively First be calculated as a result, the first result is inputted the second pipelining-stage to be calculated using the fixation arithmetic unit execution in it To second as a result, and so on, until the i-th -1 result is inputted to the i-th pipelining-stage to be held using the fixation arithmetic unit in it I-th of result is calculated in row.Here i-th of result is to export result (being specially output matrix).Further, computing list Member 203 can store the output result to storage medium 201.Quantity i and each pipelining-stage on the multistage pipelining-stage The fixation arithmetic unit of middle design can be found in the related elaboration in previous embodiment, and which is not described herein again.
With i=3, exemplified by three-level flowing water.Referring to earlier figures 5, a kind of the fixed real of the corresponding pipelining-stage of operational order is shown Existing framework.Specifically, the multiplication that arithmetic element performs the matrix the first pipelining-stage is calculated first as a result, by the first result The additional calculation for being input to the second pipelining-stage the second pipelining-stage of execution obtains second as a result, the second result is input to the 3rd flowing water The NONLINEAR CALCULATION that level performs the 3rd pipelining-stage obtains the 3rd as a result, storing the 3rd result (exporting result) to storage medium 201。
It should be noted that the arithmetic unit in above-mentioned computing device in each pipelining-stage be in advance it is self-defined set, Once it is determined that do not allow to change;That is i grades of pipelining-stage may be designed as the permutation and combination of any arithmetic unit, i grades of pipelining-stages once driving not Change again, different operational orders can design different i level flowing water stage arrangements.Wherein, which can be according to specific instruction Demand, the quantity of adaptability increase/less pipelining-stage.Finally, the flowing water stage arrangement designed for different instruction can be combined Together, the computing device is formed.
Using above-mentioned computing device (i.e. arithmetic unit/arithmetic unit design in every grade of pipelining-stage is fixed), have with following Beneficial effect:In addition to bandwidth is improved, have specificity high, without unnecessary logic judgment, further improve operational performance, arithmetic speed The characteristics of fast.
Optionally, above-mentioned computing device can also include:Buffer unit 204, for caching the first operational order.Instruction exists In implementation procedure, while also it is buffered in instruction cache unit, after an instruction has performed, if the instruction is at the same time It is not to be submitted an instruction earliest in instruction in instruction cache unit, which will carry on the back and submits, once submit, this instruction Change of the operation of progress to unit state will be unable to cancel.In one embodiment, instruction cache unit can be reset Sequence caches.
Optionally, the above method can also include before step S301:
Determine that first operational order whether there is incidence relation with the second operational order before the first operational order, such as First operational order there are incidence relation, is then performed with the second operational order before the first operational order in the second operational order After finishing, first operational order is extracted from buffer unit and is transferred to arithmetic element 203.If the first operational order is with being somebody's turn to do Instruction onrelevant relation before first operational order, then be directly transferred to arithmetic element by the first operational order.
Above-mentioned definite first operational order whether there is with the second operational order before the first operational order to be associated The concrete methods of realizing of system can be:
The first storage address section of required matrix in first operational order, foundation are extracted according to first operational order Second operational order extracts the second storage address section of required matrix in second operational order, such as the first stored address area Between with the second storage address section there is overlapping region, it is determined that the first operational order has with the second operational order to be associated System.Such as the first storage address section and the non-overlapping region in the second storage address section, it is determined that the first operational order and second Operational order does not have incidence relation.
There is overlapping region the first operational order of explanation occur in trivial of this storage and have accessed phase with the second operational order Same matrix, for matrix, is as judgement since the space of its storage is bigger, such as using identical storage region The no condition for incidence relation, in fact it could happen that situation be, the second operational order access storage region contain the first computing The storage region accessed is instructed, is deposited for example, the second operational order accesses A matrix storage areas, B matrix storage areas and C matrixes Storage area domain, if A, B storage region are adjacent or A, C storage region are adjacent, the second operational order access storage region be, A, B storage regions and C storage regions, or A, C storage region and B storage regions.In this case, if the first operational order Access for A matrixes and the storage region of D matrix, then the storage region for the matrix that the first operational order accesses can not be with second The storage region of the matrix of operational order model essay is identical, if using identical Rule of judgment, it is determined that the first operational order with Second operational order does not associate, but it was verified that the first operational order and the second operational order belong to incidence relation at this time, institute With the application by whether have overlapping region to determine whether for incidence relation condition, the erroneous judgement of the above situation can be avoided.
Illustrate which kind of situation belongs to incidence relation below with the example of a reality, which kind of situation belongs to dereferenced pass System.It is assumed here that the matrix needed for the first operational order is A matrixes and D matrix, the storage region of wherein A matrixes is【0001, 0FFF】, the storage region of D matrix is【A000, AFFF】, it is A matrixes, B matrixes and C for the matrix needed for the second operational order Matrix, its corresponding storage region are【0001,0FFF】、【1000,1FFF】、【B000, BFFF】, refer to for the first computing For order, its corresponding storage region is:【0001,0FFF】、【A000, AFFF】, for the second operational order, it is corresponded to Storage region be:【0001,1FFF】、【B000, BFFF】, so the storage region of the second operational order and the first operational order Storage region there is overlapping region【0001,0FFF】, so the first operational order has incidence relation with the second operational order.
It is assumed here that the matrix needed for the first operational order is E matrixes and D matrix, the storage region of wherein A matrixes is 【C000, CFFF】, the storage region of D matrix is【A000, AFFF】, it is A matrixes for the matrix needed for the second operational order, B Matrix and C matrixes, its corresponding storage region are【0001,0FFF】、【1000,1FFF】、【B000, BFFF】, for For one operational order, its corresponding storage region is:【C000, CFFF】、【A000, AFFF】, come for the second operational order Say, its corresponding storage region is:【0001,1FFF】、【B000, BFFF】, so the storage region of the second operational order and the The storage region of one operational order does not have overlapping region, so the first operational order and the second operational order onrelevant relation.
In the application, if Fig. 6 A are that (concretely the first operational order, or operation refer to a kind of instruction for providing of the application Make) instruction set form schematic diagram, as shown in Figure 6A, operational order includes a command code and an at least operation domain, wherein, behaviour Make the function that code is used to indicate the operational order, arithmetic element is grasped by identifying that the command code can carry out different matrix operations Make the data message that domain is used to indicate the operational order, wherein, data message can be immediate or register number, for example, will When obtaining a matrix, matrix initial address and matrix length can be obtained in corresponding register according to register number, then The matrix of appropriate address storage is obtained in storage medium according to matrix initial address and matrix length.
I.e. the first operational order can include:Operation domain and at least one command code, by taking matrix operation command as an example, such as Shown in table 1, wherein, register 0, register 1, register file 2, register 3, register 4 can be operation domain.Wherein, each Register 0, register 1, register 2, register 3, register 4 be used for marker register numbering, its can be one or Multiple registers.It is to be understood that the quantity of register does not limit in command code, each register is used to storage computing and refers to The related data information of order.
If Fig. 6 B are the fingers for another instruction (can be the first operational order, be alternatively referred to as operational order) that the application provides Make collection form schematic diagram, as shown in Figure 6B, instruction include at least two command codes and at least an operation domain, wherein, it is described extremely Few two command codes include the first command code and the second command code (diagram is respectively command code 1 and command code 2).The command code 1 is used for the type (i.e. certain major class instruction) of indicator, such as can concretely I/O instruction, logical order or operational order etc. Deng, the command code 2 is used for the function (explanation of the specific instruction i.e. under major class instruction) of indicator, such as in operational order Matrix operation command (such as Matrix Multiplication vector instruction MMUL, matrix inversion command M INV), vector operation instruction is (as vector is asked Lead instruction VDIER etc.) etc., the application does not limit.
It is to be understood that the form of instruction can be user side or the self-defined setting in computing device side.The behaviour of instruction Regular length, such as 8bit, 16bit etc. are may be designed as code.Instruction format as shown in Fig. 6 A has the advantage that feature: Command code occupancy digit is few, decoding system design is simple.Instruction format as shown in Fig. 6 B has the advantage that feature:It is variable Long, decoding average efficiency higher, in the case that certain major class instructs lower specific instruction less and calls frequency height, design its second The length of command code (i.e. command code 2) is short and small, can improve decoding efficiency;Moreover it is possible to strengthen the readable and expansible of instruction Property, optimizes the coding structure of instruction.
In the embodiment of the present application, instruction set includes the operational order of difference in functionality, concretely:
Matrix inversion instructs (MINV), and according to the instruction, device is from memory (preferable scratchpad or mark Measure register file) specified address take out setting length matrix data, carried out in arithmetic element to matrix inversion matrix Computing, and result back into.Preferably, and by result of calculation memory (preferable scratchpad or mark are written back to Measure register file) specified address.
Matrix Calculating exponential instructions (MEXP), according to the instruction, device from memory (preferable scratchpad or Scalar register heap) specified address take out setting length matrix data, carried out in arithmetic element to matrix by element into The computing of row index, and result back into.Preferably, and by result of calculation being written back to memory, (preferable scratchpad stores Device or scalar register heap) specified address.For example, Am, wherein A is matrix, and m is index, and m is positive integer.
Matrix Calculating logarithm instruct (MLOG), according to the instruction, device from memory (preferable scratchpad or Scalar register heap) specified address take out setting length matrix data, carried out in arithmetic element to matrix by element into The computing of row logarithm, and result back into.Preferably, and by result of calculation being written back to memory, (preferable scratchpad stores Device or scalar register heap) specified address.For example, logmA, wherein A are matrix, and m is the truth of a matter, and m is positive integer.
Matrix power instruct (MSQRT), according to the instruction, device from memory (preferable scratchpad or Scalar register heap) specified address take out setting length matrix data, carried out in arithmetic element to matrix by element into The computing of row extraction of square root, and result back into.Preferably, and by result of calculation being written back to memory, (preferable scratchpad is deposited Reservoir or scalar register heap) specified address.For example,Wherein A is matrix, and m is by the number of evolution, and m is just Integer.
Matrix spins upside down instruction (MUPDO), and according to the instruction, device is from memory (preferable scratchpad Or scalar register heap) specified address take out setting length matrix data, carried out in arithmetic element above and below to matrix The computing of upset, and result back into.Preferably, and by result of calculation it is written back to memory (preferable scratchpad Or scalar register heap) specified address.
Matrix or so upset instruction (MLERI), according to the instruction, device is from memory (preferable scratchpad Or scalar register heap) specified address take out setting length matrix data, carried out in arithmetic element to matrix or so The computing of upset, and result back into.Preferably, and by result of calculation it is written back to memory (preferable scratchpad Or scalar register heap) specified address.
Matrix 90 degree of upset instructions (MFORTU) to the left, according to the instruction, device is from memory (preferable scratchpad Memory or scalar register heap) specified address take out setting length matrix data, carried out in arithmetic element to square The computing of battle array 90 ° of upsets to the left, and result back into.Preferably, and by result of calculation it is (preferable temporary at a high speed to be written back to memory Deposit memory or scalar register heap) specified address.
Matrix 90 degree of upset instructions (MBACTU) to the right, according to the instruction, device is from memory (preferable scratchpad Memory or scalar register heap) specified address take out setting length matrix data, carried out in arithmetic element to square The computing of battle array 90 ° of upsets to the right, and result back into.Preferably, and by result of calculation it is (preferable temporary at a high speed to be written back to memory Deposit memory or scalar register heap) specified address.
Adjoint matrix is asked to instruct, according to the instruction, device from memory (post by preferable scratchpad or scalar Storage heap) specified address take out setting length matrix data, carry out asking for matrix its adjoint matrix in arithmetic element Computing, and result back into.Preferably, and by result of calculation be written back to memory (preferable scratchpad or Scalar register heap) specified address.
It is to be understood that matrix manipulation/operational order that the application proposes is mainly used for numerical operation of the matrix by element, spy The computings such as different matrix transposition (upset) operates, the form of matrix change (inverting).Therefore, the computing designed in every grade of pipelining-stage Device is including but not limited to any one of following or multinomial combination:Addition of matrices arithmetic unit, matrix multiplication operation device, matrix mark Measure multiplicative operator, nonlinear operator, matrix comparison operation device.
Be exemplified below this application involves operational order (i.e. the first operational order) calculating.
By taking first operational order is matrix inversion command M INV as an example, given full rank inverse of a square matrix is calculated. During specific implementation, a full rank square formation A is given, becoming changing district using row carries out matrix inversion, i.e. A1=[A/I];Then use Square formation is disappeared into unit matrix I by Applying Elementary Row Operations, and it is inverse matrix B by matrix to obtain, i.e. [A/I] → B=[I/A1]。
Correspondingly, the instruction format of matrix inversion instruction is specially:
With reference in previous embodiment, arithmetic element can obtain matrix inversion command M INV, and after being decoded to it, utilize first The multiple selector of pipelining-stage chooses nonlinear operator and handles to obtain first as a result, then inputting into row matrix augmentation to matrix Applying Elementary Row Operations are carried out in addition of matrices arithmetic unit selected by the multiple selector of second pipelining-stage and obtain second as a result, last Input in the nonlinear operator selected by the multiple selector of the 3rd pipelining-stage intercept to obtain the 3rd result into row matrix it is (i.e. defeated Go out result).Alternatively, the 3rd result is stored into storage medium.
By taking first operational order is Matrix Calculating exponential instructions MEXP as an example, a matrix A is given, to owning in matrix Element is made to seek exponent arithmetic using the element as index using natural number e as the truth of a matter by element.During specific implementation, to set matrix A, solves to obtain output matrix B according to formula below.
Wherein, AmnThe element arranged for m rows n-th in matrix A, m and n are positive integer.
Correspondingly, the instruction format of Matrix Calculating exponential instructions is specially:
With reference in previous embodiment, arithmetic element can obtain Matrix Calculating exponential instructions MEXP, and after being decoded to it, utilize The multiple selector of one pipelining-stage chooses nonlinear operator and matrix is carried out to ask exponent arithmetic to obtain the first result (i.e. by element Export result/output matrix).Alternatively, which is stored into storage medium.
By taking first operational order is Matrix Calculating logarithm command M LOG as an example, a matrix A is given, to owning in matrix Element is made to seek logarithm operation using natural number e as the truth of a matter by element.During specific implementation, matrix A is given, is asked according to formula below Solution obtains output matrix B.
Wherein, AmnThe element arranged for m rows n-th in matrix A, m and n are positive integer.It is to be understood that the application is only the bottom of with Can also be alternatively other natural numbers exemplified by number is e, such as 2,3, composition restriction.
Correspondingly, the instruction format of Matrix Calculating logarithm instruction is specially:
With reference in previous embodiment, arithmetic element can obtain Matrix Calculating logarithm command M LOG, and after being decoded to it, utilize The multiple selector of one pipelining-stage chooses nonlinear operator and matrix is carried out to ask logarithm operation to obtain the first result (i.e. by element Export result/output matrix).Alternatively, which is stored into storage medium.
By taking first operational order is Matrix power command M SQRT as an example, a matrix A is given, to owning in matrix Element makees the extracting operation by element.During specific implementation, matrix A is given, solves to obtain output matrix B according to formula below.
Wherein, AmnThe element arranged for m rows n-th in matrix A, m and n are positive integer.It is to be understood that the application is only to open Can also be alternatively other natural numbers exemplified by number formulary is 2 (i.e. sqrt), such as 3,4, composition restriction.
Correspondingly, the instruction format of Matrix power instruction is specially:
With reference in previous embodiment, arithmetic element can obtain Matrix power command M SQRT, and after being decoded to it, utilize It is (i.e. defeated that the multiple selector selection nonlinear operator of one pipelining-stage obtains the first result to matrix progress by element extracting operation Go out result/output matrix).Alternatively, which is stored into storage medium.
By taking first operational order spins upside down command M UPDO for matrix as an example, give a matrix A, to matrix into Row spins upside down computing.During specific implementation, matrix A is given, solves to obtain output matrix B according to formula below.
Wherein, AmnThe element arranged for m rows n-th in matrix A, m and n are positive integer.
Correspondingly, the instruction format that matrix spins upside down command M UPDO is specially:
With reference in previous embodiment, arithmetic element can obtain matrix and spin upside down command M UPDO, and after being decoded to it, profit Matrix transposition device is chosen with the multiple selector of the first pipelining-stage carry out according to transformation for mula the exchange of respective element obtain the One result (exports result/output matrix).Alternatively, which is stored into storage medium.
By taking first operational order overturns command M LERI for matrix or so as an example, give a matrix A, to matrix into The upset computing of row left and right.During specific implementation, matrix A is given, solves to obtain output matrix B according to formula below.
Wherein, AmnThe element arranged for m rows n-th in matrix A, m and n are positive integer.
Correspondingly, the instruction format of matrix or so upset command M LERI is specially:
With reference in previous embodiment, arithmetic element can obtain matrix or so upset command M LERI, and after being decoded to it, profit Matrix transposition device is chosen with the multiple selector of the first pipelining-stage carry out according to transformation for mula the exchange of respective element obtain the One result (exports result/output matrix).Alternatively, which is stored into storage medium.On matrix conversion Device the application does not do excessive detailed description.
By taking first operational order is 90 ° to the left (90 degree) upset command M FORTU of matrix as an example, a square is given Battle array A, carries out matrix 90 ° of upset computings to the left.During specific implementation, matrix A is given, solves to obtain output square according to formula below Battle array B.
Wherein, AmnThe element arranged for m rows n-th in matrix A, m and n are positive integer.
Correspondingly, 90 ° of instruction formats for overturning command M FORTU are specially matrix to the left:
With reference in previous embodiment, arithmetic element can obtain matrix 90 ° of upset command M FORTU, and being decoded to it to the left Afterwards, choose matrix transposition device using the multiple selector of the first pipelining-stage and exchanging for respective element is carried out according to transformation for mula To the first result (exporting result/output matrix).Alternatively, which is stored into storage medium.
By taking first operational order is 90 ° to the right (90 degree) upset command M BACTU of matrix as an example, a square is given Battle array A, carries out matrix 90 ° of upset computings to the right.During specific implementation, matrix A is given, solves to obtain output square according to formula below Battle array B.
Wherein, AmnThe element arranged for m rows n-th in matrix A, m and n are positive integer.
Correspondingly, 90 ° of instruction formats for overturning command M BACTU are specially matrix to the right:
With reference in previous embodiment, arithmetic element can obtain matrix 90 ° of upset command M BACTU, and being decoded to it to the right Afterwards, choose matrix transposition device using the multiple selector of the first pipelining-stage and exchanging for respective element is carried out according to transformation for mula To the first result (exporting result/output matrix).Alternatively, which is stored into storage medium.
It should be noted that the acquisition and decoding of above-mentioned various operational orders will be described in detail later.Ying Li Solution, the calculating of operational order (such as matrix inversion command M INV) is realized using the structure of above-mentioned computing device, can be obtained Following beneficial effect:The scalable of matrix, it is possible to reduce instruction number, the use of reduction instruction;Different storages can be handled The matrix of form (row-major order and row main sequence), avoids the expense converted to matrix;Support according to certain intervals storage Matrix format, avoids the executive overhead converted to matrix storage format and the space hold of storage intermediate result.
Setting length in above-mentioned operational order (i.e. operational order) can be optional real at one by user's sets itself Apply in scheme, which can be arranged to a value by user, and certainly in practical applications, user can also be set this Length is arranged to multiple values.The application embodiment does not limit the occurrence and number of the setting length.To make this The purpose, technical scheme and advantage of application are more clearly understood, below in conjunction with specific embodiment, and referring to the drawings, to the application It is further described.
Refering to Fig. 7, Fig. 7 is another computing device 50 that the application embodiment provides.Shown in Fig. 7, dress is calculated Putting 50 includes:Storage medium 501, register cell 502 (preferably scalar data storage unit, scalar register unit), Arithmetic element 503 (can also claim matrix operation unit 503) and control unit 504;
Storage medium 501, for storage matrix;
Scalar data storage unit 502, for storing scalar data, the scalar data includes at least:The matrix exists Storage address in the storage medium;
Control unit 504, for controlling the arithmetic element to obtain the first operational order, first operational order is used for Matrix is realized to the computing between matrix, the matrix that first operational order includes performing needed for described instruction reads instruction;
Arithmetic element 503, reading order is sent for reading instruction according to the matrix to the storage medium;Foundation is adopted The matrix is read with batch reading manner and reads the corresponding matrix of instruction, and first operational order is performed to the matrix.
Optionally, above-mentioned matrix reads instruction and includes:Storage address or the described instruction institute of matrix needed for described instruction Need the mark of matrix.
Optionally as needed for matrix reading is designated as described instruction during the mark of matrix,
Control unit 504, for controlling the arithmetic element to go out according to the mark from the register cell using single Position reading manner reads the corresponding storage address of the mark, controls the arithmetic element to be sent to the storage medium and reads institute State the reading order of storage address and the matrix is obtained using batch reading manner.
Optionally, arithmetic element 503, specifically for the calculation using multistage pipelining-stage, institute is performed to the matrix State the first operational order.
Alternatively, each pipelining-stage in the multistage pipelining-stage includes at least one arithmetic unit,
Arithmetic element 503, specifically for the selection according to multiple selector, utilizes the first choice in first order pipelining-stage Arithmetic unit to the matrix be calculated first as a result, first result to be input to second in the pipelining-stage of the second level Selecting operation device perform be calculated second as a result, and so on, until inputting the i-th -1 result into i-stage pipelining-stage The i-th Selecting operation device perform i-th of result is calculated;I-th of result is inputted to the storage medium and is deposited Storage;Wherein, the quantity i of the multistage pipelining-stage is determined according to the calculating topological structure of first operational order, and i is Positive integer.
Alternatively, each pipelining-stage in the multistage pipelining-stage includes pre-set fixed arithmetic unit, described every Fixation arithmetic unit in a pipelining-stage differs,
Arithmetic element 503, for the matrix to be calculated using the fixation arithmetic unit in first order pipelining-stage First as a result, the fixation arithmetic unit first result being input in the pipelining-stage of the second level performs and the second knot is calculated Fruit, and so on, it is calculated i-th until the i-th -1 result is inputted to the fixation arithmetic unit in i-stage pipelining-stage to perform As a result;I-th of result is inputted to the storage medium and is stored;Wherein, the quantity i of the multistage pipelining-stage is root Determined according to the calculating topological structure of first operational order, and i is positive integer.
Alternatively, first operational order is matrix inversion command M INV,
Arithmetic element 503, for the selection according to multiple selector, utilizes nonlinear operator pair in first order pipelining-stage The matrix obtains first as a result, inputting first result into second level pipelining-stage with using in it into row matrix augmentation Addition of matrices arithmetic unit to first result carry out Applying Elementary Row Operations obtain second as a result, by second result input to To intercept to obtain the 3rd result into row matrix to second result using the nonlinear operator in it in third level pipelining-stage; 3rd result is inputted to the storage medium and is stored.
Alternatively, first operational order is any one of following:Matrix Calculating exponential instructions MEXP, Matrix Calculating logarithm Command M LOG and Matrix power command M SQRT,
Arithmetic element 503, for the selection according to multiple selector, utilizes nonlinear operator pair in first order pipelining-stage The matrix, which corresponds to, carries out seeking logarithm, ask index or extracting operation by element, obtains the first result;By first result Input to the storage medium is stored.
Optionally, the computing device further includes:
Buffer unit 505, for caching pending operational order;
Described control unit 504, for pending operational order to be cached in the buffer unit 504.
Optionally, control unit 504, for determining the before first operational order and first operational order Two operational orders whether there is incidence relation, such as first operational order and second operational order there are incidence relation, Then by first operational order caching with the buffer unit, after second operational order is finished, from described Buffer unit extracts first operational order and is transmitted to the arithmetic element;
Described definite first operational order whether there is with the second operational order before the first operational order to be associated System includes:
The first storage address section of required matrix in first operational order is extracted according to first operational order, The second storage address section of required matrix in second operational order is extracted according to second operational order, such as described the One storage address section has overlapping region with the second storage address section, it is determined that first operational order and institute Stating the second operational order has incidence relation, and such as the first storage address section does not have with the second storage address section Overlapping region, it is determined that first operational order does not have incidence relation with second operational order.
Optionally, above-mentioned control unit 503, can be used for obtaining operational order from instruction cache unit, and to the computing After instruction is handled, there is provided to the arithmetic element.Wherein, control unit 503 can be divided into three modules, be respectively: Fetching module 5031, decoding module 5032 and instruction queue module 5033,
Fetching module 5031, for obtaining operational order from instruction cache unit;
Decoding module 5032, for the operational order to acquisition into row decoding;
Instruction queue 5033, for after decoding operational order carry out sequential storage, it is contemplated that different instruction comprising Register on there may exist dependence, for cache decode after instruction, launch after dependence is satisfied and refer to Order.
Refering to Fig. 8, Fig. 8 is the flow chart that computing device provided by the embodiments of the present application performs operational order, such as Fig. 8 institutes Show, the hardware configuration of the computing device is refering to the structure shown in Fig. 7, and storage medium as shown in Figure 7 is with scratchpad Exemplified by, performing the process of Matrix Calculating logarithm command M LOG includes:
Step S601, computing device control fetching module takes out the instruction of Matrix Calculating logarithm, and the Matrix Calculating logarithm is instructed It is sent to decoding module.
Step S602, decoding module are sent to instruction to the Matrix Calculating logarithm Instruction decoding, and by Matrix Calculating logarithm instruction Queue.
Step S603, in instruction queue, Matrix Calculating logarithm instruction needs to obtain in instruction from scalar register heap The data in scalar register corresponding to four operation domains, the line number of the data including input matrix, the columns of input matrix, Input matrix address, output matrix address.
Step S604, control unit determine the Matrix Calculating logarithm instruction and the operational order before the instruction of Matrix Calculating logarithm With the presence or absence of incidence relation, such as there are incidence relation, the instruction of Matrix Calculating logarithm is deposited into buffer unit, associated tube such as is not present Reason, arithmetic element is transmitted to by Matrix Calculating logarithm instruction.
Step S605, data in scalar register of the arithmetic element according to corresponding to five operation domains are from scratch pad memory It is middle to take out the matrix data needed, then complete to seek logarithm operation in arithmetic element.
Step S606, after the completion of arithmetic element computing, write the result into memory (preferable scratchpad or Scalar register heap) specified address, reorder caching in the Matrix Calculating logarithm instruction is submitted.
Optionally, in above-mentioned steps S605 when arithmetic element performs and seeks logarithm operation, the computing device can use non- Linear operator seeks logarithm operation into row matrix by element.
In the specific implementation, after decoding module is to the Matrix Calculating logarithm Instruction decoding, letter is controlled according to caused by decoding Number, the Input matrix acquired in S603 is performed to via the selected nonlinear operator of first order pipelining-stage multiple selector Matrix asks Logarithmic calculation to obtain first as a result, the multiple selector of second level pipelining-stage would know that according to control signal by element The level is empty option.Correspondingly, first result (exporting result) is directly transferred to output terminal.
Operational order in above-mentioned Fig. 8 is by taking the instruction of Matrix Calculating logarithm as an example, in practical applications, embodiment as shown in Figure 8 In the instruction of Matrix Calculating logarithm can be instructed with matrix inversion, the instruction of Matrix Calculating exponential instructions, Matrix power, matrix spins upside down 90 ° of upset instructions, matrixes 90 ° of upset instruction equal matrix computing/operations to the right to the left of instruction, matrix or so upset instruction, matrix Instruction is replaced, and is not repeated one by one here.
The embodiment of the present application also provides a kind of computer-readable storage medium, wherein, computer-readable storage medium storage is used for electricity The computer program that subdata exchanges, it is any as described in above-mentioned embodiment of the method which make it that computer is performed Implementation section or Overall Steps.
The embodiment of the present application also provides a kind of computer program product, and the computer program product includes storing calculating The non-transient computer-readable recording medium of machine program, the computer program are operable to make computer perform such as above-mentioned side Any implementation section or Overall Steps described in method embodiment.
The embodiment of the present application additionally provides a kind of accelerator, including:Memory:It is stored with executable instruction;Processor: For performing the executable instruction in storage unit, in execute instruction according to the embodiment described in above method embodiment into Row operation.
Wherein, processor can be single processing unit, but can also include two or more processing units.In addition, Processor can also include general processor (CPU) or graphics processor (GPU);It is additionally may included in field programmable logic Gate array (FPGA) or application-specific integrated circuit (ASIC), to be configured to neutral net and computing.Processor can also wrap Include the on-chip memory for caching purposes (i.e. including the memory in processing unit).
In some embodiments, a kind of chip is also disclosed, is used to perform above method embodiment institute that includes above-mentioned Corresponding neural network processor.
In some embodiments, a kind of chip-packaging structure is disclosed, that includes said chip.
In some embodiments, a kind of board is disclosed, that includes said chip encapsulating structure.
In some embodiments, a kind of electronic equipment is disclosed, that includes above-mentioned board.
Electronic equipment include data processing equipment, robot, computer, printer, scanner, tablet computer, intelligent terminal, Mobile phone, automobile data recorder, navigator, sensor, camera, server, cloud server, camera, video camera, projecting apparatus, hand Table, earphone, mobile storage, wearable device, the vehicles, household electrical appliance, and/or Medical Devices.
The vehicles include aircraft, steamer and/or vehicle;The household electrical appliance include TV, air-conditioning, micro-wave oven, Refrigerator, electric cooker, humidifier, washing machine, electric light, gas-cooker, kitchen ventilator;The Medical Devices include Nuclear Magnetic Resonance, B ultrasound instrument And/or electrocardiograph.
It should be noted that for foregoing each method embodiment, in order to be briefly described, therefore it is all expressed as a series of Combination of actions, but those skilled in the art should know, the application and from the limitation of described sequence of movement because According to the application, some steps can use other orders or be carried out at the same time.Secondly, those skilled in the art should also know Know, embodiment described in this description belongs to alternative embodiment, involved action and module not necessarily the application It is necessary.
In the above-described embodiments, the description to each embodiment all emphasizes particularly on different fields, and does not have the portion being described in detail in some embodiment Point, it may refer to the associated description of other embodiment.
In several embodiments provided herein, it should be understood that disclosed device, can be by another way Realize.For example, device embodiment described above is only schematical, such as the division of the unit, it is only one kind Division of logic function, can there is an other dividing mode when actually realizing, such as multiple units or component can combine or can To be integrated into another system, or some features can be ignored, or not perform.Another, shown or discussed is mutual Coupling, direct-coupling or communication connection can be by some interfaces, the INDIRECT COUPLING or communication connection of device or unit, Can be electrical or other forms.
The unit illustrated as separating component may or may not be physically separate, be shown as unit The component shown may or may not be physical location, you can with positioned at a place, or can also be distributed to multiple In network unit.Some or all of unit therein can be selected to realize the mesh of this embodiment scheme according to the actual needs 's.
In addition, each functional unit in each embodiment of the application can be integrated in a processing unit, can also That unit is individually physically present, can also two or more units integrate in a unit.Above-mentioned integrated list Member can both be realized in the form of hardware, can also be realized in the form of software program module.
If the integrated unit is realized in the form of software program module and is used as independent production marketing or use When, it can be stored in a computer-readable access to memory.Based on such understanding, the technical solution of the application substantially or Person say the part to contribute to the prior art or the technical solution all or part can in the form of software product body Reveal and, which is stored in a memory, including some instructions are used so that a computer equipment (can be personal computer, server or network equipment etc.) performs all or part of each embodiment the method for the application Step.And foregoing memory includes:USB flash disk, read-only storage (ROM, Read-Only Memory), random access memory (RAM, Random Access Memory), mobile hard disk, magnetic disc or CD etc. are various can be with the medium of store program codes.
One of ordinary skill in the art will appreciate that all or part of step in the various methods of above-described embodiment is can To instruct relevant hardware to complete by program, which can be stored in a computer-readable memory, memory It can include:Flash disk, read-only storage (English:Read-Only Memory, referred to as:ROM), random access device (English: Random Access Memory, referred to as:RAM), disk or CD etc..
The embodiment of the present application is described in detail above, specific case used herein to the principle of the application and Embodiment is set forth, and the explanation of above example is only intended to help to understand the present processes and its core concept; Meanwhile for those of ordinary skill in the art, according to the thought of the application, can in specific embodiments and applications There is change part, in conclusion this specification content should not be construed as the limitation to the application.

Claims (10)

1. a kind of computational methods, it is characterised in that applied in computing device, the computing device includes storage medium, deposit Device unit and matrix operation unit, the described method includes:
The computing device controls the matrix operation unit to obtain the first operational order, and first operational order is used for realization For matrix to the computing between matrix, the matrix that first operational order includes performing needed for described instruction reads instruction, described Required matrix is at least one matrix, and at least one matrix is the matrix that length is identical or length is different;
The computing device controls the matrix operation unit to read instruction according to the matrix and sends reading to the storage medium Take order;
The computing device is controlled described in the matrix operation unit read from the storage medium using batch reading manner Matrix reads the corresponding matrix of instruction, and using the calculation of multistage pipelining-stage, first fortune is performed to the matrix Calculate instruction.
2. according to the method described in claim 1, it is characterized in that, it is described multistage pipelining-stage in each pipelining-stage include to A few arithmetic unit,
The calculation using multistage pipelining-stage, performing first operational order to the matrix includes:
The computing device controls selection of the matrix operation unit according to multiple selector, using in first order pipelining-stage First choice arithmetic unit to the matrix be calculated first as a result, first result is input to second level pipelining-stage In the second Selecting operation device perform be calculated second as a result, and so on, until inputting the i-th -1 result to i-stage The i-th Selecting operation device in pipelining-stage, which performs, is calculated i-th of result;
I-th of result is inputted to the storage medium and is stored;
Wherein, i-th of result is output matrix, and the quantity i of the multistage pipelining-stage is according to first operational order Calculating topological structure determine that and i is positive integer.
3. according to the method described in claim 1, it is characterized in that, it is described multistage pipelining-stage in each pipelining-stage include it is pre- The fixation arithmetic unit first set, the fixation arithmetic unit in each pipelining-stage differ,
The calculation using multistage pipelining-stage, performing first operational order to the matrix includes:
The computing device controls the matrix operation unit to utilize the fixation arithmetic unit in first order pipelining-stage to the matrix First be calculated as a result, the fixation arithmetic unit execution that first result is input in the pipelining-stage of the second level is calculated To second as a result, and so on, until the i-th -1 result inputted to the fixation arithmetic unit in i-stage pipelining-stage performing calculating Obtain i-th of result;
I-th of result is inputted to the storage medium and is stored;
Wherein, the quantity i of the multistage pipelining-stage is determined according to the calculating topological structure of first operational order, and i For positive integer.
4. method according to any one of claim 1-3, it is characterised in that each flowing water in the multistage pipelining-stage Level is each configured with corresponding multiple selector, and the multiple selector, which is set, free option, the sky option be used to indicating with The kth level pipelining-stage of the multiple selector connection and follow-up kth+1 not perform to i-stage pipelining-stage and calculate behaviour Make, wherein, k is the positive integer less than or equal to i;
Arithmetic unit in the multistage pipelining-stage in each pipelining-stage includes any one of following or multinomial combination:Matrix adds Method arithmetic unit, matrix multiplication operation device, matrix scalar multiplication arithmetic unit, nonlinear operator and matrix comparison operation device.
5. according to the method described in claim 1, it is characterized in that, first operational order is including any one of following: Matrix inversion command M INV, Matrix Calculating exponential instructions MEXP, Matrix Calculating logarithm command M LOG, Matrix power command M SQRT, matrix Spin upside down command M UPDO, matrix or so upset command M LERI, matrix overturns command M FORTU, matrixes to the right for 90 degree to the left 90 degree of upset command M BACTU, ask adjoint matrix to instruct;
The instruction format of first operational order includes at least one command code and at least one operation domain, described at least one Command code is used for the function of indicating first operational order, and at least one operation domain is used to indicate that first computing refers to The data message of order, the data message include immediate or register number, and instruction and institute are read for storing the matrix State the length of matrix;Wherein, at least one command code includes the first command code and the second command code, first command code For indicating the type of first operational order, second command code is used for the function of indicating first operational order.
6. according to the method described in claim 2, it is characterized in that, first operational order is matrix inversion command M INV,
The calculation using multistage pipelining-stage, performing first operational order to the matrix includes:
The computing device controls selection of the matrix operation unit according to multiple selector, using non-in first order pipelining-stage Linear operator obtains first as a result, inputting first result to second level pipelining-stage to the matrix into row matrix augmentation In to carry out Applying Elementary Row Operations to first result using the addition of matrices arithmetic unit in it obtain second as a result, by described the Two results are inputted into third level pipelining-stage to be intercepted using the nonlinear operator in it to second result into row matrix Obtain the 3rd result;3rd result is inputted to the storage medium and is stored.
7. a kind of computing device, it is characterised in that the computing device includes storage medium, register cell, matrix operation list Member and controller unit;
The storage medium, for storage matrix;
The register cell, for storing scalar data, the scalar data includes at least:The matrix is situated between in the storage Storage address in matter;
The controller unit, for controlling the matrix operation unit to obtain the first operational order, first operational order Matrix is used for realization to the computing between matrix, the matrix that first operational order includes performing needed for described instruction, which is read, to be referred to Show, the required matrix is at least one matrix, and at least one matrix is the matrix that length is identical or length is different;
The matrix operation unit, reading order is sent for reading instruction according to the matrix to the storage medium;Foundation The matrix is read using batch reading manner and reads the corresponding matrix of instruction, using the calculation of multistage pipelining-stage, to institute State matrix and perform first operational order.
8. a kind of chip, it is characterised in that the chip includes the as above computing device described in claim 7.
9. a kind of electronic equipment, it is characterised in that the electronic equipment includes the as above chip described in claim 8.
A kind of 10. computer-readable recording medium, it is characterised in that the computer-readable storage medium is stored with computer program, The computer program includes programmed instruction, and described program instruction makes the processor perform such as right when being executed by a processor It is required that 1-6 any one of them methods.
CN201711362568.8A 2017-12-15 2017-12-15 Calculation method and related product Active CN108037908B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN201711362568.8A CN108037908B (en) 2017-12-15 2017-12-15 Calculation method and related product

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN201711362568.8A CN108037908B (en) 2017-12-15 2017-12-15 Calculation method and related product

Publications (2)

Publication Number Publication Date
CN108037908A true CN108037908A (en) 2018-05-15
CN108037908B CN108037908B (en) 2021-02-09

Family

ID=62099684

Family Applications (1)

Application Number Title Priority Date Filing Date
CN201711362568.8A Active CN108037908B (en) 2017-12-15 2017-12-15 Calculation method and related product

Country Status (1)

Country Link
CN (1) CN108037908B (en)

Cited By (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN110727911A (en) * 2018-07-17 2020-01-24 展讯通信(上海)有限公司 Matrix operation method and device, storage medium and terminal
CN111242293A (en) * 2020-01-13 2020-06-05 腾讯科技(深圳)有限公司 Processing component, data processing method and electronic equipment

Citations (10)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN102262525A (en) * 2011-08-29 2011-11-30 孙瑞琛 Vector-operation-based vector floating point operational device and method
CN103902507A (en) * 2014-03-28 2014-07-02 中国科学院自动化研究所 Matrix multiplication calculating device and matrix multiplication calculating method both oriented to programmable algebra processor
CN105468335A (en) * 2015-11-24 2016-04-06 中国科学院计算技术研究所 Pipeline-level operation device, data processing method and network-on-chip chip
WO2017124647A1 (en) * 2016-01-20 2017-07-27 北京中科寒武纪科技有限公司 Matrix calculation apparatus
CN106990940A (en) * 2016-01-20 2017-07-28 南京艾溪信息科技有限公司 A kind of vector calculation device
CN107305538A (en) * 2016-04-22 2017-10-31 北京中科寒武纪科技有限公司 One Seed Matrix arithmetic unit and method
WO2017185418A1 (en) * 2016-04-29 2017-11-02 北京中科寒武纪科技有限公司 Device and method for performing neural network computation and matrix/vector computation
CN107315574A (en) * 2016-04-26 2017-11-03 北京中科寒武纪科技有限公司 A kind of apparatus and method for performing matrix multiplication
CN107315715A (en) * 2016-04-26 2017-11-03 北京中科寒武纪科技有限公司 A kind of apparatus and method for performing matrix plus/minus computing
CN108090028A (en) * 2017-12-15 2018-05-29 北京中科寒武纪科技有限公司 A kind of computational methods and Related product

Patent Citations (10)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN102262525A (en) * 2011-08-29 2011-11-30 孙瑞琛 Vector-operation-based vector floating point operational device and method
CN103902507A (en) * 2014-03-28 2014-07-02 中国科学院自动化研究所 Matrix multiplication calculating device and matrix multiplication calculating method both oriented to programmable algebra processor
CN105468335A (en) * 2015-11-24 2016-04-06 中国科学院计算技术研究所 Pipeline-level operation device, data processing method and network-on-chip chip
WO2017124647A1 (en) * 2016-01-20 2017-07-27 北京中科寒武纪科技有限公司 Matrix calculation apparatus
CN106990940A (en) * 2016-01-20 2017-07-28 南京艾溪信息科技有限公司 A kind of vector calculation device
CN107305538A (en) * 2016-04-22 2017-10-31 北京中科寒武纪科技有限公司 One Seed Matrix arithmetic unit and method
CN107315574A (en) * 2016-04-26 2017-11-03 北京中科寒武纪科技有限公司 A kind of apparatus and method for performing matrix multiplication
CN107315715A (en) * 2016-04-26 2017-11-03 北京中科寒武纪科技有限公司 A kind of apparatus and method for performing matrix plus/minus computing
WO2017185418A1 (en) * 2016-04-29 2017-11-02 北京中科寒武纪科技有限公司 Device and method for performing neural network computation and matrix/vector computation
CN108090028A (en) * 2017-12-15 2018-05-29 北京中科寒武纪科技有限公司 A kind of computational methods and Related product

Cited By (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN110727911A (en) * 2018-07-17 2020-01-24 展讯通信(上海)有限公司 Matrix operation method and device, storage medium and terminal
CN110727911B (en) * 2018-07-17 2022-09-02 展讯通信(上海)有限公司 Matrix operation method and device, storage medium and terminal
CN111242293A (en) * 2020-01-13 2020-06-05 腾讯科技(深圳)有限公司 Processing component, data processing method and electronic equipment

Also Published As

Publication number Publication date
CN108037908B (en) 2021-02-09

Similar Documents

Publication Publication Date Title
CN108009126A (en) A kind of computational methods and Related product
CN107957976A (en) A kind of computational methods and Related product
CN108874445A (en) Neural network processor and the method for executing dot product instruction using processor
CN108121688A (en) A kind of computational methods and Related product
CN106875011B (en) Hardware architecture of binary weight convolution neural network accelerator and calculation flow thereof
CN107608715A (en) For performing the device and method of artificial neural network forward operation
CN104915322B (en) A kind of hardware-accelerated method of convolutional neural networks
CN108108190A (en) A kind of computational methods and Related product
CN108388446A (en) Computing module and method
CN108197705A (en) Convolutional neural networks hardware accelerator and convolutional calculation method and storage medium
CN107169563A (en) Processing system and method applied to two-value weight convolutional network
CN107392309A (en) A kind of general fixed-point number neutral net convolution accelerator hardware structure based on FPGA
CN107957975A (en) A kind of computational methods and Related product
CN107943756A (en) A kind of computational methods and Related product
CN107957977A (en) A kind of computational methods and Related product
CN108416436A (en) The method and its system of neural network division are carried out using multi-core processing module
CN107315715A (en) A kind of apparatus and method for performing matrix plus/minus computing
CN110516810B (en) Quantum program processing method and device, storage medium and electronic device
CN109032670A (en) Processing with Neural Network device and its method for executing vector duplicate instructions
CN107423816A (en) A kind of more computational accuracy Processing with Neural Network method and systems
CN108629406A (en) Arithmetic unit for convolutional neural networks
CN108090028A (en) A kind of computational methods and Related product
CN108108189A (en) A kind of computational methods and Related product
CN108037908A (en) A kind of computational methods and Related product
CN109240644A (en) A kind of local search approach and circuit for Yi Xin chip

Legal Events

Date Code Title Description
PB01 Publication
PB01 Publication
SE01 Entry into force of request for substantive examination
SE01 Entry into force of request for substantive examination
CB02 Change of applicant information

Address after: 100000 room 644, No. 6, No. 6, South Road, Beijing Academy of Sciences

Applicant after: Zhongke Cambrian Technology Co., Ltd

Address before: 100000 room 644, No. 6, No. 6, South Road, Beijing Academy of Sciences

Applicant before: Beijing Zhongke Cambrian Technology Co., Ltd.

CB02 Change of applicant information
GR01 Patent grant
GR01 Patent grant