Numerical operation method, data verification method, processor, computing device, computer storage medium and computer program product

By executing vector operation instructions for operand multiplication and addition in a finite field, the problem of high instruction overhead in matrix operations of traditional processors is solved, and the performance of data verification and matrix multiplication operations of the processor is improved.

CN123138550APending Publication Date: 2026-11-20ALIBABA DAMO (HANGZHOU) TECH CO LTD
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202510653818.1
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2025-05-20
Publication Date
2026-11-20

AI Technical Summary

Technical Problem

Traditional processors require multiple instructions to perform matrix operations, which limits their performance and makes it difficult to efficiently handle data verification and encoding/decoding processes.

Method used

Vector operation instructions are used to perform operand multiplication and addition in a finite field. The result of multiplication between the first operand and the second operand is added to the operand variable in a finite field by vector operation instructions, which simplifies instruction overhead.

Benefits of technology

It improves the processor's performance in data verification and matrix multiplication operations, saves instruction overhead, and increases data processing efficiency.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN123138550A_ABST
    Figure CN123138550A_ABST
Patent Text Reader

Abstract

Embodiments of the present application provide a numerical operation method, a data verification method, a processor, a computing device, a computer storage medium and a computer program product. The numerical operation method comprises: performing a write operation on a plurality of first operands as a first operand vector and performing a write operation on a plurality of second operands as a second operand vector, wherein the plurality of first operands correspond to the plurality of second operands respectively, and the first operands and the second operands all have the same preset bit number; determining the first operand vector, the second operand vector and an operation variable as inputs of a vector operation instruction, and performing operand multiplication between each first operand and the corresponding second operand in a finite field of the preset bit number; performing finite field addition between a plurality of finite field products between the plurality of first operands and the plurality of second operands and the operation variable respectively in the finite field of the preset bit number, and updating the operation variable.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The embodiments of the present invention relate to the field of computer technology, and in particular to a numerical operation method, a data verification method, a processor, a computing device, a computer storage medium, and a computer program product. Background Technology

[0002] Matrix operations are a crucial technique in data processing, such as data verification and data encoding / decoding. By representing data blocks as vectors or matrices, multiplication with a specific verification matrix can generate verification information or recover lost data.

[0003] In exemplary applications of matrix operations, erasure coding (EC), as a data redundancy and recovery technique, can be widely used in data verification scenarios. For example, the erasure coding matrix corresponding to an erasure code (k, m) is an m*k matrix. When using erasure coding (k, m) for data verification, the data to be verified is divided into k equal parts. The data vector formed by the k equal parts is then multiplied by the erasure coding matrix (m*k) to obtain m parts of the data to be verified. Based on the invertibility of the erasure coding matrix, it can be ensured that the data to be verified can be completely recovered if no more than m parts of the data are lost. Typical values ​​for erasure coding (k, m) are (8, 3) or (4, 2).

[0004] Generally speaking, matrix operations in data processing are based on the mathematical principles of linear algebra. In traditional data processing, processors typically execute vector multiplication and accumulation operators to systematically handle a large number of matrix operations. However, in traditional methods, performing a single vector multiplication and accumulation operation requires multiple instructions, which can easily limit processor performance. Summary of the Invention

[0005] In view of this, embodiments of the present invention provide a numerical operation method, a data verification method, a processor, a computing device, a computer storage medium, and a computer program product to solve the above problems.

[0006] According to a first aspect of the present invention, a numerical operation method is provided, comprising: performing a write operation on a plurality of first operands as a first operand vector, and performing a write operation on a plurality of second operands as a second operand vector, wherein the plurality of first operands correspond to the plurality of second operands respectively, and the first operands and second operands each have the same preset number of bits; determining the first operand vector, the second operand vector, and the operation variable as inputs to a vector operation instruction, and performing operand multiplication between each first operand and its corresponding second operand in a finite field of the preset number of bits; and performing finite field addition on the operation variable with the plurality of finite field products between the plurality of first operands and the plurality of second operands in the finite field of the preset number of bits, thereby updating the operation variable.

[0007] According to a second aspect of the present invention, a data verification method is provided, comprising: loading multiple equally divided data blocks of data to be verified as multiple first operands, and loading multiple elements in each matrix row of multiple matrix rows as multiple second operands, wherein the multiple matrix rows form an erasure coding matrix; performing multiplication-accumulation processing on the multiple first operands and the multiple second operands using vector operation instructions to obtain a verification block corresponding to the matrix row, wherein the vector operation instructions are the vector operation instructions according to the first aspect; and merging the multiple verification blocks of the multiple matrix rows into verification data of the data to be verified.

[0008] According to a third aspect of the present invention, a processor is provided, comprising: a read / write operation unit, which performs a write operation on a plurality of first operands as a first operand vector and performs a write operation on a plurality of second operands as a second operand vector, wherein the plurality of first operands correspond to the plurality of second operands respectively, and the first operands and second operands each have the same preset number of bits; and an instruction execution unit, which determines the first operand vector, the second operand vector, and an operation variable as input to a vector operation instruction, and performs operand multiplication between each first operand and the corresponding second operand in a finite field of the preset number of bits, and performs finite field addition on the operation variable by performing a plurality of finite field products between the plurality of first operands and the plurality of second operands respectively, thereby updating the operation variable.

[0009] According to a fourth aspect of the present invention, a processor is provided, comprising: a data loading unit, which loads multiple equally divided data blocks of data to be verified as multiple first operands, and loads multiple elements in each of multiple matrix rows as multiple second operands, wherein the multiple matrix rows form an erasure coding matrix; an instruction execution unit, which uses vector operation instructions to perform multiplication-accumulation processing on the multiple first operands and the multiple second operands to obtain a verification block corresponding to the matrix row, wherein the vector operation instructions are vector operation instructions according to the first aspect; and a data merging unit, which merges the multiple verification blocks of the multiple matrix rows into verification data of the data to be verified.

[0010] According to a fifth aspect of the present invention, a computing device is provided, comprising: a processor, a memory, a communication interface, and a communication bus, wherein the processor, the memory, and the communication interface communicate with each other via the communication bus; the memory is used to store at least one executable instruction, the executable instruction causing the processor to perform the method as described in the first or second aspect.

[0011] According to a sixth aspect of the present invention, a computer storage medium is provided having a computer program stored thereon, which, when executed by a processor, implements the method as described in the first or second aspect.

[0012] According to a seventh aspect of the present invention, a computer program product is provided, including computer instructions that, when executed by a processor, implement the method as described in the first or second aspect.

[0013] In the embodiment of the present invention, the vector operation instruction can take the first operand vector, the second operand vector, and the operation variable as inputs. By performing operand multiplication between each first operand and the corresponding second operand, the resulting multiple finite field products are then added to the operation variables in a finite field. That is, the vector operation instruction can directly output the execution result of the finite field addition, saving instruction overhead in the numerical operation process. Especially in matrix multiplication operations involved in data processing such as data verification, it greatly improves the performance of the processor. Attached Figure Description

[0014] To more clearly illustrate the technical solutions in the embodiments of the present invention or related technologies, the drawings used in the description of the embodiments or related technologies will be briefly introduced below. Obviously, the drawings described below are only some embodiments recorded in the embodiments of the present invention. For those skilled in the art, other drawings can be obtained based on these drawings.

[0015] Figure 1This is a schematic block diagram of a computing device applicable to some embodiments of the present invention.

[0016] Figure 2 This is a flowchart of the steps of a numerical operation method according to some embodiments of the present invention.

[0017] Figure 3 According to Figure 2 The flowchart illustrates the steps of a numerical manipulation method for some specific examples of embodiments.

[0018] Figure 4 This is a flowchart of the steps of a data verification method according to some other embodiments of the present invention.

[0019] Figure 5 This is a schematic structural diagram of a processor according to other embodiments of the present invention.

[0020] Figure 6 This is a schematic structural diagram of a processor according to other embodiments of the present invention.

[0021] Figure 7 This is a schematic diagram of the structure of a computing device according to other embodiments of the present invention. Detailed Implementation

[0022] To enable those skilled in the art to better understand the technical solutions in the embodiments of the present invention, the technical solutions in the embodiments of the present invention will be clearly and completely described below with reference to the accompanying drawings. Obviously, the described embodiments are only some embodiments of the present invention, and not all embodiments. Based on the embodiments of the present invention, all other embodiments obtained by those skilled in the art should fall within the protection scope of the present invention.

[0023] The specific implementation of the embodiments of the present invention will be further described below with reference to the accompanying drawings.

[0024] Figure 1 This is a schematic block diagram of a computing device applicable to some embodiments of the present invention. Figure 1 The computing device 100 includes one or more processors 10 and memory 14. Multiple processor cores 120 of the processor 10 can be coupled via a bus 18. The computing device 10 may also include at least one level cache (not shown) coupled to the bus 18. The cache is used to cache program data or message data, etc., that may be repeatedly accessed in the memory 14. The cache can be a storage device of the type Static Random Access Memory (SRAM).

[0025] Furthermore, memory 14 can be main memory (or simply main memory or RAM), used to store instruction information and / or data information represented by data signals, such as data provided by processor 12 (e.g., calculation results), and can also be used to realize data exchange between processor 12 and external storage devices (or auxiliary memory or external memory). In some cases, processor 12 needs to access memory 14 to obtain data in memory 14 or modify data in memory 14.

[0026] Furthermore, such as Figure 1 As shown, processor core 120 can be controlled by a user (e.g., through an application) and / or system platform to process instructions. In some embodiments, each processor core 120 can be used to process a specific instruction set. In some embodiments, the instruction set can support Complex Instruction Set Computing (CISC), Reduced Instruction Set Computing (RISC-V) computation, or computation based on Very Long Instruction Word (VLIW). Different processor cores 120 can each process different or the same instruction sets. In some embodiments, processor core 120 may also include other processing modules, such as a Digital Signal Processor (DSP). As an example, Figure 1 The diagram shows processor cores 1 through m, where m is a non-zero natural number.

[0027] In some embodiments, such as Figure 1 As shown, processor 10 may include a register file 126, which may include multiple registers for storing different types of data and / or instructions. These registers may be of different types. For example, register file 126 may include integer registers, floating-point registers, status registers, instruction registers, and pointer registers. The registers in register file 126 may be implemented using general-purpose registers, or a specific design may be adopted according to the actual needs of processor 10.

[0028] Furthermore, the processor 10 may also include a Memory Management Unit (MMU) 122 for translating virtual addresses to physical addresses in memory. The MMU 122 caches a portion of the entries in the page table, and can also retrieve uncached entries from memory. Each processor core 120 may have one or more MMUs 122, and the MMUs 120 in different processor cores 120 can be synchronized with those in other processors or processor cores, allowing each processor or processor core to share a unified virtual memory system.

[0029] Processor 10 is used to execute a sequence of instructions (i.e., a program). The process of processor 10 executing each instruction includes: fetching the instruction from the memory where the instructions are stored, decoding the fetched instruction, executing the decoded instruction, and saving the instruction execution result, etc., and so on, until all instructions in the instruction sequence have been executed or a halt instruction is encountered.

[0030] To implement the above process, the processor 10 may include an instruction fetch unit 124, an instruction decode unit 125, an instruction dispatch unit (not shown), an instruction execution unit 121, and an instruction de-instruction unit (not shown), etc.

[0031] The instruction fetch unit 124 serves as the boot engine of the processor 10, used to move instructions from memory 14 to the instruction register (which may be...). Figure 1 The instruction is stored in one of the registers in the register file 26 shown, and the next fetch address is received or calculated according to the fetch algorithm, which may include, for example, incrementing or decrementing the address based on the instruction length.

[0032] After the instruction is fetched, the processor 10 enters the instruction decoding stage. The instruction decoding unit 125 decodes the fetched instruction according to a predetermined instruction format to obtain the operand fetch information required by the fetched instruction, thereby preparing for the operation of the instruction execution unit 121. Operand fetch information may include pointers to immediate values, registers, or other software / hardware that can provide source operands.

[0033] The instruction dispatch unit, typically located within the high-performance processor 10, lies between the instruction decoding unit 125 and the instruction execution unit 121. It is used for instruction scheduling and control, efficiently allocating instructions to different instruction execution units 121, thus enabling parallel operation of multiple instructions. After an instruction is fetched, decoded, and scheduled to the corresponding instruction execution unit 121, the unit begins executing the instruction, performing the operation specified by the instruction and implementing the corresponding function.

[0034] The instruction write-back unit (or instruction write-back unit) is mainly responsible for writing the execution results generated by the instruction execution unit 121 back to the corresponding storage location (e.g., a register inside the processor 10), so that subsequent instructions can quickly obtain the corresponding execution results from that storage location.

[0035] Different instruction execution units 121 can be correspondingly configured in the processor 10 for different types of instructions. The instruction execution unit 121 can be an arithmetic unit (e.g., including an arithmetic logic unit, a vector arithmetic unit, etc., used to perform operations based on operands and output the results; it is the execution body for the multiplication of a sparse matrix and a vector to be multiplied in this embodiment), a memory execution unit (e.g., used to access memory according to instructions to read data from memory or write specified data to memory), or a coprocessor. In the processor 10, each instruction execution unit 121 can run in parallel and output corresponding execution results.

[0036] When executing a certain type of instruction (such as a memory access instruction), the instruction execution unit 121 needs to access the memory 14 to obtain information stored in the memory 14 or to provide data that needs to be written to the memory 14.

[0037] The instruction execution unit 121 used to execute memory access instructions can also be simply referred to as a memory execution unit, such as a load store unit (LSU) and / or other units used for memory access.

[0038] After the memory access instruction is fetched by the instruction fetch unit 124, the instruction decoding unit 125 can decode the memory access instruction so that the source operand of the memory access instruction can be fetched. The decoded memory access instruction is provided to the corresponding instruction execution unit 121, which can perform corresponding operations on the source operand of the memory access instruction (for example, the arithmetic logic unit performs operations on the source operand stored in the register) to obtain the address information corresponding to the memory access instruction, and initiate corresponding requests based on the address information, such as address translation requests, write access requests, etc.

[0039] The source operand of a memory access instruction typically includes an address operand. The instruction execution unit 121 performs operations on this address operand to obtain the virtual or physical address corresponding to the memory access instruction. When the memory management unit 122 is disabled, the instruction execution unit 121 can directly obtain the physical address of the memory access instruction through logical operations. When the memory management unit 121 is enabled, the corresponding instruction execution unit 121 initiates an address translation request based on the virtual address corresponding to the memory access instruction. This address translation request includes the virtual address corresponding to the address operand of the memory access instruction. The memory management unit 122 responds to the address translation request and converts the virtual address in the address translation request into a physical address based on the entry matching the virtual address, so that the instruction execution unit 121 can access the cache and / or memory 14 according to the translated physical address.

[0040] Depending on their function, memory access instructions may include load instructions and store instructions. The execution of a load instruction typically does not require modification of the information in memory 14 or the cache; the instruction execution unit 121 only needs to read the data stored in memory 14, the cache, or an external storage device based on the address operand of the load instruction.

[0041] Unlike load instructions, store instructions include not only address operands but also data information as their source operands. The execution of store instructions typically requires modification of memory 14 and / or the cache. The data information in a store instruction can point to data to be written. This written data can originate from the execution results of arithmetic instructions, load instructions, or other instructions, as well as data provided by registers or other storage units in processor 10, or even immediate values.

[0042] It should be understood that in traditional data processing, processors typically execute vector multiplication and accumulation operators to systematically process a large number of matrix operations. In some cases, a single vector multiplication and accumulation operation requires multiple instruction overheads, which can easily limit processor performance. The various embodiments of the present invention can save instruction overheads and improve processor performance.

[0043] The following will combine Figure 2 The numerical manipulation methods according to some embodiments of the present invention are described in detail. Specifically, Figure 2 Numerical manipulation methods can be employed in ways such as Figure 1 The example processor executes the numerical manipulation methods, which include:

[0044] Step S210: Perform a write operation on multiple first operands as a first operand vector, and perform a write operation on multiple second operands as a second operand vector, wherein the multiple first operands correspond to the multiple second operands respectively, and both the first operands and the second operands have the same preset number of bits.

[0045] It should be understood that this step can be performed using methods such as... Figure 1 The memory access instruction in the processor's instruction execution unit is used for execution. For example, the memory access instruction can read a first operand vector and a second operand vector from memory into the processor's first register and second register, respectively. That is, multiple first operands form a first operand vector, and multiple second operands form a second operand vector. Furthermore, the first operands and second operands have a corresponding relationship, and both have the same preset number of bits. The number of bits for each operand is preset and consistent to ensure the compatibility and standardization of subsequent operations. Alternatively, the first operand vector and the second operand vector can also have an element-wise correspondence; for example, both the first operand vector and the second operand vector have a preset number of elements.

[0046] Step S220: Determine the first operand vector, the second operand vector, and the operation variable as the input of the vector operation instruction, and perform operand multiplication between each first operand and the corresponding second operand in a finite field with a preset number of bits.

[0047] It should be understood that this step can be performed using methods such as... Figure 1 The instruction execution unit in the processor executes the vector operation instruction. The first input of the vector operation instruction is the first operand vector, the second input is the second operand vector, and the third input is the operation variable. The updated operation variable serves as the execution result of the vector operation instruction.

[0048] It should also be understood that a finite field is a field that satisfies rules such as closure, commutativity, and associativity, such as a Galois field (GF). The first and second operands have the same number of bits, enabling operand multiplication based on the finite field. This ensures that the result of the multiplication operation does not overflow the register parameters configured based on a preset number of bits. The correspondence between operands guarantees the order and accuracy of the multiplication operation, allowing each first operand and its corresponding second operand to be multiplied according to predetermined rules. Furthermore, the multiplication operation between each first operand and its corresponding second operand can be performed independently.

[0049] Step S230: In a finite field with a preset number of bits, perform finite field addition on the multiple finite field products between multiple first operands and multiple second operands and update the operation variable.

[0050] It should be understood that performing finite-field addition on multiple finite-field products between multiple first operands and multiple second operands with the operand variable yields the finite-field addition result of the first operand vector and the second operand vector in the operand variable. This finite-field addition result is the execution result of the vector operation instruction. In the finite-field addition, the finite-field products obtained from all operand multiplications are XORed one by one, and the scattered finite-field products are integrated into the operand variable as the execution result of the vector operation instruction.

[0051] In the embodiment of the present invention, the vector operation instruction can take the first operand vector, the second operand vector, and the operation variable as inputs. By performing operand multiplication between each first operand and the corresponding second operand, the resulting multiple finite field products are then added to the operation variables in a finite field. That is, the vector operation instruction can directly output the execution result of the finite field addition, saving instruction overhead in the numerical operation process. Especially in matrix multiplication operations involved in data processing such as data verification, it greatly improves the performance of the processor.

[0052] In some embodiments, Figure 3 The document demonstrates some specific examples of numerical manipulation methods, which can be used as... Figure 2 Some examples of embodiments, and may be based on Figure 1 The computing device executes this. Specifically, Figure 3 Numerical manipulation methods include:

[0053] Step S310: Execute a memory access instruction, writing multiple first operands to a first register and multiple second operands to a second register, and then continue to step S315. It should be understood that the first operand vector [0110, 1010] and the second operand vector [1100, 1001] can be written to their respective memory regions as input to a vector operation instruction. For example, the first operand vector [0110, 1010] can be written to the first register, and the second operand vector [1100, 1001] can be written to the second register.

[0054] Without loss of generality, when performing a write operation on the first operand vector and the second operand vector, multiple first operands can be written to the first register, and multiple second operands can be written to the second register. The first register outputs the first operand vector when the vector operation instruction is read, and the second register outputs the second operand vector when the vector operation instruction is read. In other words, managing multiple first operands through the first register and managing multiple second operands through the second register ensures compatibility with the instruction format in the processor while simplifying the format definition of vector operation instructions.

[0055] Step S315: Execute the vector operation instructions to perform iterations for a number of iterations matching the preset number of elements, and continue to step S320. It should be understood that the vector operation instructions can be broken down into a sequence of micro-instructions (UOPs). For example, the vector operation instructions can be broken down into a first micro-instruction with a preset number of elements and a second micro-instruction with a preset number of elements; that is, the first micro-instruction is used to perform finite field multiplication in the corresponding iteration operation, and the second micro-instruction is used to perform finite field addition in the corresponding iteration operation.

[0056] Step S320: In the current iteration, read the first operand corresponding to the current element index from the first register, read the second operand corresponding to the current element index from the second register, and read the operation variable from the third register, then continue to step S325. It should be understood that the current element index shared by the first operand vector and the second operand vector can be determined, and operand multiplication is performed for the current element index. Specifically, for the first operand vector and the second operand vector, the vector length VLEN can be calculated and divided by the element group step size EGS to obtain the element group length eg_len, and the current element index j can be traversed from the starting index eg_start to eg_len-1. For example, when the vector operation instruction is executed, 0110 and 1010 are read sequentially from the first register as the first input of the vector operation instruction, and the outputs 1100 and 1001 are read sequentially from the second register as the second input of the vector operation instruction.

[0057] Step S325: For the current element index, perform bit reversal operations on the original bit sequences of the first operand and the second operand respectively to obtain the first bit sequence and the second bit sequence, and continue to step S330. It should be understood that after performing the bit reversal operation, the bit sequence can be iterated from right to left using the processor instruction set rules. That is, when performing operand multiplication between each first operand and the corresponding second operand in a finite field of a preset number of bits, bit reversal operations can be performed on the original bit sequences of the first operand and the second operand respectively to obtain the first bit sequence and the second bit sequence. In the current iteration, when updating the current bit using the next bit in the first bit sequence of the first operand, the next bit can be determined by shifting the current bit in the first bit sequence of the first operand by one bit towards the higher-order bit side of the first bit sequence. When performing a shift operation on the second bit sequence of the corresponding second operand, the second bit sequence of the corresponding second operand can be shifted by one bit towards the higher-order bit side of the second bit sequence to obtain the second bit sequence after the shift operation. For example, when a vector operation instruction reads the first operand and the second operand as the first input and the second input, respectively, the original bit sequence of the first operand in the first register can be reversed to obtain the first bit sequence. Similarly, the original bit sequence of the second operand in the second register can be reversed to obtain the second bit sequence, thus ensuring compatibility with the register shifting rules of the processor instruction set and improving the computational efficiency of vector operation instructions.

[0058] Step S330: Perform iterations for a number of iterations matching the preset number of bits, and determine whether the first operand has a next bit. If yes, continue to step S335; if no, continue to step S340.

[0059] Step S335: In the current iteration, update the current bit using the next bit in the first bit sequence, and according to the position of the next bit in the first bit sequence, perform a shift operation on the second bit sequence of the corresponding second operand, and continue to step S345. For example, the starting element index is 0, indicating that it points to the first elements 0110 and 1100 of two vectors. Then, read the first operand 0110 corresponding to the current element index 0 from the first register, and read the second operand 1100 corresponding to the current element index 0 from the second register. Then, in a 4-bit finite field, calculate the finite field product between the first operand 0110 and the second operand 1100, and after completing the operand multiplication corresponding to the current element index 0, update the current element index using the next element index 1, and then continue to read the finite field product between the first operand 1010 and the second operand 1001 corresponding to the current element index 1.

[0060] Without loss of generality, when the first operand vector, the second operand vector, and the operand variable are determined as the inputs to the vector operation instruction, the current element index shared by the first and second operand vectors can be determined. Then, the first operand corresponding to the current element index is read from the first register, the second operand corresponding to the current element index is read from the second register, and the operand variable is read from the third register. Then, when the finite field product between the first operand and the second operand corresponding to the current element index is XORed to the operand variable, the current element index is updated using the next element index. In other words, by using the element index shared by the first and second operand vectors, the first operand and its corresponding second operand can be efficiently locked, which is beneficial for parallel and efficient execution of operand multiplication of the first and second operand vectors.

[0061] Step S340: Output the product result variable and continue to step S350.

[0062] Step S345: XOR the result of the finite field iteration of the second bit sequence after the shift operation in a finite field of a preset number of bits to the product result variable corresponding to the first operand, and continue to step S335. That is, in a finite field of a preset number of bits (e.g., 4 bits), the operand multiplication between each first operand and its corresponding second operand is calculated. For example, the first bit sequence of the first pair of operands is 0110, the second bit sequence of the second operand is 1100, and the iteration number 4 matches the preset number of bits. After the finite field multiplication of bit 0 is completed, the second bit sequence of the second operand 1100 can be shifted according to the position of the next bit 1 in the first bit sequence (the second bit), assuming a left shift of one bit to obtain 1000. Then, the result of the finite field iteration of the shifted 1000 in a 4-bit finite field is XORed to the product result variable corresponding to the first operand. The current bit is updated sequentially, and the above process is repeated until 4 iterations are completed to obtain the product result of the pair of operands.

[0063] Furthermore, when performing operand multiplication, iterations can be performed for a number of iterations matching a preset number of bits. The XOR operation result can be obtained bit-by-bit for both the first and second operands. If a bit of the first operand Y is 1 (in the example of the first bit value), the corresponding second operand H is XORed with the finite field iteration result into the product result variable Z. If a bit of the first operand Y is 0 (in the example of the second bit value), it indicates that the finite field iteration result is 0, and the product result variable Z remains unchanged. It should be understood that the corresponding second operand can be determined by examining the most significant bit of the bit sequence of the second operand H. For example, if the most significant bit of the second reverse sequence of the second operand H is 1, the second reverse sequence is shifted left by 1 bit, and an XOR operation is performed in the finite field.

[0064] Furthermore, when the current bit is 0, the product result variable corresponding to the first operand remains unchanged, eliminating the need for finite field addition. Without loss of generality, when XORing the result of the shifted second bit sequence in a finite field of a predetermined number of bits into the product result variable corresponding to the first operand, if the current bit has a second bit value, the product result variable corresponding to the first operand is preserved. For example, when the second bit value is 0, no unnecessary XOR operation is required, improving the computational efficiency of vector operation instructions.

[0065] In other words, when the result of the finite-field iteration of the shifted second bit sequence in a finite field of a preset number of bits is XORed with the product result variable corresponding to the first operand, if the current bit has a first bit value, then modulo reduction is performed on the shifted second bit sequence in the finite field of the preset number of bits to obtain the modulo reduction result. Then, the modulo reduction result is XORed with the product result variable corresponding to the first operand. For example, when the first bit value is 1, performing modulo reduction on the shifted second bit sequence in a finite field helps to simplify the algorithmic complexity of vector operation instructions while ensuring that the product result variable satisfies the finite field condition.

[0066] Without loss of generality, when performing operand multiplication between each first operand and its corresponding second operand within a finite field of a preset number of bits, iterations can be performed with a number of iterations matching the preset number of bits. In the current iteration, the current bit is updated using the next bit in the first bit sequence of the first operand. Then, based on the position of the next bit in the first bit sequence, a shift operation is performed on the second bit sequence of the corresponding second operand. Finally, the finite field iteration result of the shifted second bit sequence within the finite field of the preset number of bits is XORed into the product result variable corresponding to the first operand. In other words, with a number of iterations matching the preset number of bits, finite field multiplication between each bit in the first bit sequence and the second operand can be performed, which helps to simplify the algorithmic complexity of vector operation instructions.

[0067] Step S350: Reverse the product result variable corresponding to the current element index and XOR it with the operation variable, then continue to step S355. For example, based on a preset number of bits (e.g., 4 bits or 8 bits), perform finite field addition sequentially with the operation variable to obtain a finite field addition result. For example, the finite field addition result is a value of the preset number of bits, which serves as the current scalar value of the operation variable. When both the first operand vector and the second operand vector have the same preset number of elements, iteration can be performed using an iteration number matching the preset number of elements. Then, in the current iteration, reverse the product result variable corresponding to the first operand, XOR the reversed product result variable with the operation variable, and update the operation variable. That is, reversing the product result variable corresponding to the first operand enables vector operation instructions to be compatible with the numerical read / write rules of the processor instruction set.

[0068] Step S355: Determine whether the next element exists in the first register and the second register. If yes, continue to step S360; if no, continue to step S365.

[0069] Step S360: Update the current element index using the next element index. For example, if the vector length multiplier LMUL multiplied by the vector length VLEN is not less than the element group width EGW, the current element index j can be iterated; otherwise, the vector operation instruction can be triggered to an abnormal state. For example, from the current iteration to the next iteration, for corresponding elements in the first operand vector and the second operand vector, the operand multiplication between the first operand and the corresponding bit and the second operand can be performed, which helps to simplify the algorithmic complexity of the vector operation instruction.

[0070] Step S365: Output the operation variable as the execution result of the vector operation instruction. For example, after performing operand multiplication on all elements in the first operand vector and the second operand vector, the scalar result of performing an XOR operation on the product of a finite field with a preset number of elements is obtained, and this is used as the execution result of the vector operation instruction.

[0071] The following will combine Figure 4 A data verification method according to other embodiments of the present invention is described. Specifically, Figure 4 Data validation methods include:

[0072] Step S410: Load multiple equally divided data blocks of the data to be verified as multiple first operands, and load multiple elements in each matrix row of multiple matrix rows as multiple second operands, wherein the multiple matrix rows form an erasure coding matrix.

[0073] It should be understood that the erasure coding matrix is ​​a predefined matrix, including but not limited to invertible matrices such as the Vandermonde matrix or the Cauchy matrix. For example, in the Vandermonde matrix, each row is a geometric sequence. In the Cauchy matrix, each row and each column is a geometric sequence. The number of rows and columns of the erasure coding matrix is ​​determined based on the number of data blocks and the number of parity blocks to be generated. The elements of each matrix row are operated on with the corresponding data block to generate a parity block.

[0074] Step S420: Using vector operation instructions, perform multiplication and accumulation on multiple first operands and multiple second operands to obtain the check block corresponding to the row of the matrix.

[0075] It should be understood that vector operation instructions can be based on... Figure 2 Implementation examples or Figure 3 The vector operation instructions in this embodiment. Furthermore, when performing multiplication and accumulation operations on the loaded first operand (data block) and second operand (matrix row elements) using vector operation instructions, for each matrix row, each element in that matrix row is multiplied element-wise with the corresponding data block, and then all product results are accumulated. The accumulated result is used as the check block corresponding to that matrix row.

[0076] Step S430: Merge multiple check blocks from multiple matrix rows into check data for the data to be checked.

[0077] It should be understood that the check blocks corresponding to all matrix rows obtained through multiplication and accumulation are merged to form complete check data. This check data will be stored together with the original data blocks for use in recovering the original data in case of data loss or corruption. During the merging process, all check blocks can be arranged sequentially to form a complete check data set, which, together with the original data blocks, constitutes the stored data used to store it in memory.

[0078] For example, the erasure coding matrix corresponding to the erasure code (k, m) is an m*k matrix. When using the erasure code (k, m) for data verification, the data to be verified is divided into k equal parts. The data vector formed by the k equal parts is then multiplied by the erasure coding matrix (m*k) to obtain m parts of the verification data. Based on the invertibility of the erasure coding matrix, it can be ensured that the data to be verified can be completely recovered if no more than m parts of the data are lost. Typical values ​​for the erasure code (k, m) are (8, 3) or (4, 2).

[0079] In the embodiments of the present invention, vector operation instructions can improve the efficiency of instruction utilization in numerical operation processes and save instruction overhead in numerical operation processes. As a result, in matrix multiplication operations involved in data processing processes such as data verification, the performance of the processor and the efficiency of data processing are greatly improved.

[0080] Furthermore, Figure 5 A processor according to other embodiments of the present invention is shown. Specifically, Figure 5 The processor corresponds to Figure 2 Implementation examples or Figure 3 The numerical operation method of the embodiment includes:

[0081] The read / write operation unit 510 performs a write operation on a plurality of first operands as a first operand vector and performs a write operation on a plurality of second operands as a second operand vector, wherein the plurality of first operands correspond to the plurality of second operands respectively, and both the first operands and the second operands have the same preset number of bits;

[0082] The instruction execution unit 520 determines the first operand vector, the second operand vector, and the operation variable as inputs to a vector operation instruction, and performs operand multiplication between each first operand and its corresponding second operand in a finite field of a preset number of bits, and performs finite field addition between the multiple finite field products between the multiple first operands and the multiple second operands and the operation variable, thereby updating the operation variable.

[0083] In the embodiment of the present invention, the vector operation instruction can take the first operand vector, the second operand vector, and the operation variable as inputs. By performing operand multiplication between each first operand and the corresponding second operand, the resulting multiple finite field products are then added to the operation variables in a finite field. That is, the vector operation instruction can directly output the execution result of the finite field addition, saving instruction overhead in the numerical operation process. Especially in matrix multiplication operations involved in data processing such as data verification, it greatly improves the performance of the processor.

[0084] In other embodiments, in the read / write operation unit, performing a write operation on a plurality of first operands as a first operand vector and performing a write operation on a plurality of second operands as a second operand vector includes: writing a plurality of first operands to a first register and writing a plurality of second operands to a second register, wherein the first register outputs a first operand vector when the vector operation instruction is read, and the second register outputs a second operand vector when the vector operation instruction is read.

[0085] In other embodiments, in the instruction execution unit, determining the first operand vector, the second operand vector, and the operation variable as inputs to a vector operation instruction includes: determining a current element index shared by the first operand vector and the second operand vector; reading a first operand corresponding to the current element index from the first register, reading a second operand corresponding to the current element index from the second register, and reading the operation variable from a third register; and updating the current element index using the next element index when the finite field product between the first operand and the second operand corresponding to the current element index is XORed with the operation variable.

[0086] In other embodiments, in the instruction execution unit, performing operand multiplication between each first operand and its corresponding second operand within a finite field of the preset number of bits includes: performing iterations for a number of iterations matching the preset number of bits; updating the current bit with the next bit in the first bit sequence of the first operand in the current iteration; performing a shift operation on the second bit sequence of the corresponding second operand according to the position of the next bit in the first bit sequence; and XORing the finite field iteration result of the shifted second bit sequence within the finite field of the preset number of bits into the product result variable corresponding to the first operand.

[0087] In other embodiments, in the instruction execution unit, the finite field iteration result of the shifted second bit sequence in the finite field of the preset number of bits is XORed with the product result variable corresponding to the first operand, including: if the current bit has a first bit value, performing modulo reduction on the shifted second bit sequence in the finite field of the preset number of bits to obtain a modulo reduction result; and XORing the modulo reduction result with the product result variable corresponding to the first operand.

[0088] In other embodiments, in the instruction execution unit, performing operand multiplication between each first operand and its corresponding second operand within a finite field of the preset number of bits further includes: performing bit reversal operations on the original bit sequences of the first operand and the original bit sequences of the second operand respectively to obtain a first bit sequence and a second bit sequence; in the current iteration, updating the current bit using the next bit in the first bit sequence of the first operand includes: in the current iteration, shifting the current bit in the first bit sequence of the first operand by one bit towards the higher bit side of the first bit sequence to determine the next bit; and performing a shift operation on the second bit sequence of the corresponding second operand according to the position of the next bit in the first bit sequence, including: shifting the second bit sequence of the corresponding second operand by one bit towards the higher bit side of the second bit to obtain the second bit sequence after the shift operation.

[0089] In other embodiments, both the first operand vector and the second operand vector have the same preset number of elements. In the instruction execution unit, within a finite field of the preset number of bits, multiple finite field products between the plurality of first operands and the plurality of second operands are respectively added to the operand variable in a finite field to update the operand variable. This includes: performing iterations with an iteration count matching the preset number of elements; in the current iteration, reversing the product result variable corresponding to the first operand, performing an XOR operation on the reversed product result variable and the operand variable, and updating from the current iteration to the next iteration.

[0090] In other embodiments, in the instruction execution unit, the finite field iteration result of the second bit sequence after the shift operation in the finite field of the preset number of bits is XORed into the product result variable corresponding to the first operand, and further includes: if the current bit has a second bit value, then the product result variable corresponding to the first operand is maintained.

[0091] Furthermore, Figure 6 A processor according to other embodiments of the present invention is shown. Figure 6 The processor corresponds to Figure 4 Data validation methods include:

[0092] The data loading unit 610 loads multiple equally divided data blocks of the data to be verified as multiple first operands, and loads multiple elements in each matrix row of multiple matrix rows as multiple second operands, wherein the multiple matrix rows form an erasure coding matrix;

[0093] The instruction execution unit 620 uses vector operation instructions to perform multiplication and accumulation processing on the plurality of first operands and the plurality of second operands to obtain the check block corresponding to the row of the matrix.

[0094] The data merging unit 630 merges multiple verification blocks of the multiple matrix rows into verification data of the data to be verified.

[0095] In the embodiments of the present invention, vector operation instructions can improve the efficiency of instruction utilization in numerical operation processes and save instruction overhead in numerical operation processes. As a result, in matrix multiplication operations involved in data processing processes such as data verification, the performance of the processor and the efficiency of data processing are greatly improved.

[0096] It should be understood that the specific implementation of each unit in the processor described above can be found in the description of the corresponding steps in the numerical operation method or data verification method, and has corresponding beneficial effects, which will not be elaborated here. Those skilled in the art will clearly understand that, for the sake of convenience and brevity, the specific working process of the processor and units described above can be referred to the corresponding process description in the numerical operation method or data verification method, and will not be elaborated here.

[0097] Reference Figure 7 The diagram shows a structural schematic of a computing device according to another embodiment of the present invention. The specific embodiments of the present invention do not limit the specific implementation of the computing device.

[0098] like Figure 7 As shown, the computing device may include: a processor 702 for executing program 710, a communications interface 704, a memory 706, and a communications bus 708.

[0099] The processor, communication interface, and memory communicate with each other via a communication bus.

[0100] A communication interface is used to communicate with other devices or servers.

[0101] The processor is used to execute programs, specifically the relevant steps in the above method embodiments.

[0102] Specifically, the program may include program code, which includes computer operation instructions.

[0103] The processor may be a CPU, an Application Specific Integrated Circuit (ASIC), or one or more integrated circuits configured to implement embodiments of the present invention. The one or more processors included in a smart device may be of the same type, such as one or more CPUs; or they may be of different types, such as one or more CPUs and one or more ASICs.

[0104] Memory is used to store programs. Memory may include high-speed RAM, and may also include non-volatile memory, such as at least one disk drive.

[0105] The program may include multiple computer instructions, and the program may specifically cause the processor to execute the numerical operation method or data verification method described in any of the foregoing multiple method embodiments through multiple computer instructions.

[0106] The specific implementation of each step in the program can be found in the corresponding descriptions of the steps, modules, or units in the above method embodiments, and has corresponding beneficial effects, which will not be repeated here. Those skilled in the art will clearly understand that, for the sake of convenience and brevity, the specific working process of the above-described device, equipment, or module can be referred to the corresponding process descriptions in the foregoing method embodiments, and will not be repeated here.

[0107] This invention also provides a computer storage medium storing a computer program thereon, which, when executed by a processor, implements the method described in any of the foregoing method embodiments. The computer storage medium includes, but is not limited to, compact disc read-only memory (CD-ROM), random access memory (RAM), floppy disk, hard disk, or magneto-optical disk.

[0108] This invention also provides a computer program product, including computer instructions that instruct a computing device to execute the numerical operation method or data verification method in the above-described multiple method embodiments.

[0109] Furthermore, it should be noted that the user-related information (including but not limited to user device information, user personal information, etc.) and data (including but not limited to sample data used for training the model, data used for analysis, stored data, displayed data, etc.) involved in the embodiments of the present invention are all information and data authorized by the user or fully authorized by all parties. Moreover, the collection, use and processing of related data must comply with relevant regulations and standards, and corresponding operation entry points are provided for users to choose to authorize or refuse.

[0110] It should be noted that, depending on the implementation needs, the various components / steps described in the embodiments of the present invention can be broken down into more components / steps, or two or more components / steps or parts of the operation of components / steps can be combined into new components / steps to achieve the purpose of the embodiments of the present invention.

[0111] The methods described above according to embodiments of the present invention can be implemented in hardware, firmware, or as software or computer code that can be stored in a recording medium (such as a CD-ROM, RAM, floppy disk, hard disk, or magneto-optical disk), or as computer code originally stored in a remote recording medium or a non-transitory machine-readable medium and subsequently stored in a local recording medium, downloaded via a network. Thus, the methods described herein can be stored on a recording medium using a general-purpose computer, a dedicated processor, or programmable or dedicated hardware (such as an Application Specific Integrated Circuit (ASIC) or a Field Programmable Gate Array (FPGA)). It is understood that the computer, processor, microprocessor controller, or programmable hardware includes storage components (e.g., random access memory (RAM), read-only memory (ROM), flash memory, etc.) capable of storing or receiving software or computer code, which, when accessed and executed by the computer, processor, or hardware, implements the methods described herein. Furthermore, when a general-purpose computer accesses code used to implement the methods shown herein, the execution of the code transforms the general-purpose computer into a dedicated computer for executing the methods shown herein.

[0112] Those skilled in the art will recognize that the units and method steps of the various examples described in conjunction with the embodiments herein can be implemented in electronic hardware, or a combination of computer software and electronic hardware. Whether these functions are implemented in hardware or software depends on the specific application and design constraints of the technical solution. Those skilled in the art can use different methods to implement the described functions for each specific application, but such implementations should not be considered beyond the scope of the embodiments of the present invention.

[0113] The above embodiments are only used to illustrate the embodiments of the present invention, and are not intended to limit the embodiments of the present invention. Those skilled in the art can make various changes and modifications without departing from the spirit and scope of the embodiments of the present invention. Therefore, all equivalent technical solutions also fall within the scope of the embodiments of the present invention, and the patent protection scope of the embodiments of the present invention should be defined by the claims.

Claims

1. A numerical operation method, comprising: A write operation is performed on a plurality of first operands as a first operand vector, and a write operation is performed on a plurality of second operands as a second operand vector, wherein the plurality of first operands correspond to the plurality of second operands respectively, and both the first operands and the second operands have the same preset number of bits; The first operand vector, the second operand vector, and the operation variable are determined as the input of the vector operation instruction, and operand multiplication between each first operand and the corresponding second operand is performed in a finite field of the preset number of bits; Within the finite field of the preset number of bits, the finite field products between the plurality of first operands and the plurality of second operands are respectively added to the operand variable to update the operand variable.

2. The method according to claim 1, wherein, Performing a write operation on multiple first operands as a first operand vector and performing a write operation on multiple second operands as a second operand vector includes: Multiple first operands are written to a first register, and multiple second operands are written to a second register. The first register outputs a first operand vector when the vector operation instruction is read, and the second register outputs a second operand vector when the vector operation instruction is read.

3. The method according to claim 2, wherein, Determining the first operand vector, the second operand vector, and the operation variable as the input to the vector operation instruction includes: Determine the index of the current element shared by the first operand vector and the second operand vector; Read the first operand corresponding to the current element index from the first register, read the second operand corresponding to the current element index from the second register, and read the operation variable from the third register; When the finite field product between the first operand and the second operand corresponding to the current element index is XORed into the operation variable, the current element index is updated using the next element index.

4. The method according to claim 1, wherein, Performing operand multiplication between each first operand and its corresponding second operand within a finite field of the preset number of bits includes: The iteration is performed by a number of iterations matching the preset number of bits. In the current iteration, the current bit is updated by the next bit in the first bit sequence of the first operand. Based on the position of the next bit in the first bit sequence, perform a shift operation on the second bit sequence of the corresponding second operand; The result of the finite field iteration of the second bit sequence after the shift operation in the finite field of the preset number of bits is XORed into the product result variable corresponding to the first operand.

5. The method according to claim 4, wherein, The result of the finite field iteration of the second bit sequence after the shift operation in the finite field of the preset number of bits is XORed with the product result variable corresponding to the first operand, including: If the current bit has a first bit value, then in the finite field of the preset number of bits, perform modulo reduction on the second bit sequence after the shift operation to obtain the modulo reduction result; The modulo reduction result is XORed with the product result variable corresponding to the first operand.

6. The method according to claim 5, wherein, Performing operand multiplication between each first operand and its corresponding second operand within a finite field of the preset number of bits further includes: Perform bit reversal operations on the original bit sequences of the first operand and the second operand respectively to obtain the first bit sequence and the second bit sequence; In the current iteration, the current bit is updated using the next bit in the first bit sequence of the first operand, including: In the current iteration, the current bit in the first bit sequence of the first operand is shifted one bit to the higher bit side of the first bit sequence to determine the next bit; Based on the position of the next bit in the first bit sequence, perform a shift operation on the second bit sequence corresponding to the second operand, including: Shift the second bit sequence of the corresponding second operand by one bit to the higher bit side of the second bit to obtain the second bit sequence after the shift operation.

7. The method according to claim 6, wherein, Both the first operand vector and the second operand vector have the same preset number of elements; Accordingly, the finite field additions are performed on the operands by respectively applying the finite field products between the plurality of first operands and the plurality of second operands to the operands, thereby updating the operands, including: The iteration is performed using an iteration number that matches the preset number of elements; In the current iteration, the product result variable corresponding to the first operand is reversed, and the reversed product result variable is XORed with the operation variable. Update from the current iteration to the next iteration.

8. The method according to claim 4, wherein, The process of XORing the result of the finite field iteration of the second bit sequence after the shift operation in the finite field of the preset number of bits with the product result variable corresponding to the first operand also includes: If the current bit has a second bit value, then the product result variable corresponding to the first operand is retained.

9. A data verification method, comprising: Multiple equally divided data blocks of the data to be verified are loaded as multiple first operands, and multiple elements in each matrix row of multiple matrix rows are loaded as multiple second operands, wherein the multiple matrix rows form an erasure coding matrix; Using vector operation instructions, multiplication and accumulation processing is performed on the plurality of first operands and the plurality of second operands to obtain the check block corresponding to the row of the matrix, wherein the vector operation instructions are the vector operation instructions according to any one of claims 1-8; The multiple verification blocks of the multiple matrix rows are merged into the verification data of the data to be verified.

10. A processor, comprising: The read / write operation unit performs a write operation on a plurality of first operands as a first operand vector and performs a write operation on a plurality of second operands as a second operand vector, wherein the plurality of first operands correspond to the plurality of second operands respectively, and both the first operands and the second operands have the same preset number of bits; The instruction execution unit determines the first operand vector, the second operand vector, and the operation variable as inputs to a vector operation instruction, and performs operand multiplication between each first operand and its corresponding second operand in a finite field of a preset number of bits, and performs finite field addition between the multiple finite field products between the multiple first operands and the multiple second operands and the operation variable, thereby updating the operation variable.

11. A processor, comprising: The data loading unit loads multiple equally divided data blocks of the data to be verified as multiple first operands, and loads multiple elements in each matrix row of multiple matrix rows as multiple second operands, wherein the multiple matrix rows form an erasure coding matrix; The instruction execution unit uses vector operation instructions to perform multiplication and accumulation processing on the plurality of first operands and the plurality of second operands to obtain the check block corresponding to the row of the matrix, wherein the vector operation instructions are the vector operation instructions according to any one of claims 1-8; The data merging unit merges multiple verification blocks of the multiple matrix rows into verification data of the data to be verified.

12. A computing device, comprising: The processor, memory, communication interface, and communication bus are provided, wherein the processor, memory, and communication interface communicate with each other via the communication bus. The memory is used to store at least one executable instruction that causes the processor to perform the method according to any one of claims 1-7.

13. A computer storage medium having a computer program stored thereon, which, when executed by a processor, implements the method according to any one of claims 1-7.

14. A computer program product comprising computer instructions that, when executed by a processor, implement the method of any one of claims 1-7.