# US 2022/0291901 A1 · Data processing method for processing unit, electronic device and computer readable storage medium

> Agents: this data is available as JSON from the patentgrep API and MCP server — see https://patentgrep.com/llms.txt

- Number: US 2022/0291901 A1
- Document ID: US20220291901A1
- Status: Published application
- Kind: A1
- Application number: 17/690,014
- Filed: 2022-03-09
- Published: 2022-09-15
- Earliest claimed: 2021-03-09
- Assignees: Shanghai Biren Technology Co., Ltd
- Applicants: Shanghai Biren Technology Co.,Ltd
- Inventors: YuFei ZHANG; Dacheng LIANG
- Web page: https://patentgrep.com/patent/US20220291901A1

## CPC

- G06F 7/483: Computations with numbers represented by a non-linear combination of denominational numbers, e.g. rational numbers, logarithmic number system or floating-point numbers {(G06F7/4806, G06F7/4824, G06F7/49, G06F7/491, G06F7/544 take precedence)}
- G06F 7/4876: {Multiplying}
- G06F 7/5443: {Sum of products (for applications thereof, see the relevant places, e.g. G06F17/10, H03H17/00)}
- G06F 17/16: Matrix or vector computation {, e.g. matrix-matrix or matrix-vector multiplication, matrix factorization (matrix transposition G06F7/78)}
- G06F: ELECTRIC DIGITAL DATA PROCESSING (computer systems based on specific computational models G06N)

## Abstract

Embodiments of the present disclosure relate to a method for data processing and to the field of computers. The method comprises: in the mth clock cycle, determining a first exponent value; in the m+1th clock cycle, inputting two n-dimensional vectors into the processing unit to determine n second exponent values; determining a maximum value among the first exponent value and the determined n second exponent values; determining whether a target second exponent value exists among the n second exponent values, an absolute value of a difference between the target second exponent value and the maximum value being greater than or equal to a first threshold; and in response to determining that the target second exponent value exists in n second exponent values, not performing a multiply operation of two floating point numbers corresponding to the target second exponent value in the processing unit, during the m+1th clock cycle.

## Claims

### Claim 1

A data processing method for a processing unit, comprising:
in mth clock cycle, determining a first exponent value of a floating point number as a result of a first dot product operation performed in the processing unit, where m is a positive integer greater than or equal to 1;
in m+1th clock cycle, inputting two n-dimensional vectors into the processing unit to determine n second exponent values, the second exponent values being obtained by adding the exponent of a floating point number in one of the two n-dimensional vectors with the exponent of a corresponding floating point number in the other of the two n-dimensional vectors, n being a positive integer greater than or equal to 1;
determining a maximum value among the first exponent value and the determined n second exponent values;
determining whether a target second exponent value exists among the n second exponent values, an absolute value of a difference between the target second exponent value and the maximum value being greater than or equal to a first threshold; and
in response to determining that the target second exponent value exists in n second exponent values, not performing a multiply operation of two floating point numbers corresponding to the target second exponent value in the processing unit, during the m+1th clock cycle.

### Claim 2 (depends on 1)

The data processing method according to claim 1, wherein in response to determining that the target second exponent value does not exist among the n second exponent values, the multiply operation is performed for all data in the two n-dimensional vectors in the processing unit, during the m+1th clock cycle.

### Claim 3 (depends on 1)

The data processing method according to claim 1, wherein the processing unit comprises a register; and
an absolute value of a difference between the first threshold and the number of bits of the mantissa of the floating point number stored in the register is smaller than a second threshold.

### Claim 4 (depends on 1)

The data processing method according to claim 1, wherein the first exponent value is obtained in the following manner:
in the mth clock cycle, inputting a first n-dimensional vector and a second n-dimensional vector into the processing unit to perform the first dot product operation to obtain a floating point number of a first dot product operation result;
performing normalization processing for the floating point number of the first dot product operation result to obtain the first exponent value.

### Claim 5 (depends on 4)

The data processing method according to claim 4, wherein performing the first dot product operation to obtain the floating point number of the first dot product operation result comprises:
multiplying i data from the first n-dimensional vector with corresponding i data from the second n-dimensional vector, respectively, to obtain i floating point numbers, where i=0, 1, 2 . . . n;
performing exponent matching processing on at least two floating point numbers among the i floating point numbers and the floating point numbers obtained by the dot product operation in m−1th clock cycle;
summing the exponent matching processed floating point numbers, to obtain a floating point number of the first dot product operation result in the mth clock cycle.

### Claim 6 (depends on 2)

The data processing method according to claim 2, wherein the exponent value of the floating point number of the result of the operation performed in the m+1th clock cycle is determined as the first exponent value for comparison with the n second exponent values determined in m+2th clock cycle.

### Claim 7

An electronic device, comprising:
a processor; and
a memory coupled to the processor, the memory having instructions stored therein that, when executed by the processor, cause the electronic device to perform acts comprising:
in mth clock cycle, determining a first exponent value of a floating point number as a result of a first dot product operation performed in a processing unit, where m is a positive integer greater than or equal to 1;
in m+1th clock cycle, inputting two n-dimensional vectors into the processing unit to determine n second exponent values, the second exponent values being obtained by adding the exponent of a floating point number in one of the two n-dimensional vectors with the exponent of a corresponding floating point number in the other of the two n-dimensional vectors, n being a positive integer greater than or equal to 1;
determining a maximum value among the first exponent value and the determined n second exponent values;
determining whether a target second exponent value exists among the n second exponent values, an absolute value of a difference between the target second exponent value and the maximum value being greater than or equal to a first threshold; and
in response to determining that the target second exponent value exists in n second exponent values, not performing a multiply operation of two floating point numbers corresponding to the target second exponent value in the processing unit, during the m+1th clock cycle.

### Claim 8 (depends on 1)

A non-transitory computer-readable storage medium having computer instructions stored thereon, the computer instructions, when executed by a machine, implementing the method according to claim 1.
