WO2021114548A1 - Batch processing method, apparatus and device, and storage medium - Google Patents

Batch processing method, apparatus and device, and storage medium Download PDF

Info

Publication number
WO2021114548A1
WO2021114548A1 PCT/CN2020/087108 CN2020087108W WO2021114548A1 WO 2021114548 A1 WO2021114548 A1 WO 2021114548A1 CN 2020087108 W CN2020087108 W CN 2020087108W WO 2021114548 A1 WO2021114548 A1 WO 2021114548A1
Authority
WO
WIPO (PCT)
Prior art keywords
batch
instruction
register
data
instructions
Prior art date
Application number
PCT/CN2020/087108
Other languages
French (fr)
Chinese (zh)
Inventor
范宝余
杨宏斌
董刚
Original Assignee
浪潮(北京)电子信息产业有限公司
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 浪潮(北京)电子信息产业有限公司 filed Critical 浪潮(北京)电子信息产业有限公司
Publication of WO2021114548A1 publication Critical patent/WO2021114548A1/en

Links

Images

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F9/00Arrangements for program control, e.g. control units
    • G06F9/06Arrangements for program control, e.g. control units using stored programs, i.e. using an internal store of processing equipment to receive or retain programs
    • G06F9/30Arrangements for executing machine instructions, e.g. instruction decode
    • G06F9/30098Register arrangements
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F9/00Arrangements for program control, e.g. control units
    • G06F9/06Arrangements for program control, e.g. control units using stored programs, i.e. using an internal store of processing equipment to receive or retain programs
    • G06F9/30Arrangements for executing machine instructions, e.g. instruction decode
    • G06F9/38Concurrent instruction execution, e.g. pipeline or look ahead
    • G06F9/3867Concurrent instruction execution, e.g. pipeline or look ahead using instruction pipelines

Definitions

  • This application relates to the field of deep learning, in particular to a batch processing method, device, equipment, and storage medium.
  • CNN Convolutional Neural Networks
  • Feedforward Neural Networks Feedforward Neural Networks
  • It is one of the representative algorithms of deep learning.
  • user software is required to provide the computing device with batch data to be processed and instructions for processing the batch data, and then the computing device executes the corresponding batch processing according to the instructions for the batch data to be processed Operation to achieve feature extraction of batch data.
  • the batch data initiated by the user software to the computing device contains multiple pieces of data, and the batch processing operation of the computing device needs to be executed based on the corresponding instructions of each piece of data, but the instruction flow initiated by the current user software is The number of instructions generated in advance and contained in it is fixed, and the number of data in the batch data initiated by the current user software is often flexible according to the actual situation, so it may cause the computing device to execute the data that does not correspond to the data in the batch data. Redundant instructions make it difficult to ensure the reliability of batch operations.
  • the purpose of this application is to provide a batch processing method, device, equipment, and storage medium to relatively ensure the reliability of batch processing operations.
  • this application provides a batch processing method, including:
  • selecting the target instruction whose status information corresponding to the execution flag bit meets the executable standard from the instructions of the instruction stream includes:
  • the instruction is set as the target instruction.
  • obtaining register information from the execution flag of the instruction, and reading the status information in the corresponding register according to the register information includes:
  • the status information meets the executable standard.
  • the method before reading the state value in the corresponding register according to the register address corresponding to the register serial number information, the method further includes:
  • register serial number information is the register serial number of the special register, execute the step of setting the instruction as the target instruction
  • the register serial number information is not the register serial number of the special register, perform the step of reading the state value in the corresponding register according to the register address corresponding to the register serial number information.
  • the standard value includes 1 or 0.
  • obtaining batch data and instruction stream includes:
  • the basic instruction stream contains basic instructions whose execution flag is empty;
  • the register information of the target register is set in the execution flag bit of the target basic instruction uniquely corresponding to the target register in the basic instruction stream to obtain the instruction stream.
  • obtaining batch data and basic instruction stream includes:
  • the batch size of statistical batch data including:
  • the method before the batch processing operation is performed on the batch data according to the target instruction, the method further includes:
  • the step of performing a batch processing operation on the batch data according to the target instruction is executed.
  • the preset value includes the instruction quantity value of the instruction stream.
  • the number of instructions in the instruction stream is greater than or equal to the batch size of the batch data.
  • this application also provides a batch processing device, including:
  • Obtaining module used to obtain batch data and instruction stream, the instruction of the instruction stream contains the execution flag bit;
  • the instruction selection module is used to select the target instruction whose status information corresponding to the execution flag bit meets the executable standard among the instructions of the instruction stream;
  • the instruction execution module is used to perform batch processing operations on the batch data according to the target instruction.
  • this application also provides a batch processing device, including:
  • Memory used to store computer programs
  • the processor is used to implement the steps of the above-mentioned batch processing method when the computer program is executed.
  • the present application also provides a computer-readable storage medium with a computer program stored on the computer-readable storage medium, and when the computer program is executed by a processor, the steps of the batch processing method as described above are realized.
  • the batch processing method provided by this application first obtains batch data and an instruction stream.
  • the instructions of the instruction stream include an execution flag bit, and then selects the state information corresponding to the execution flag bit in the instructions of the instruction stream to meet the target instruction of the executable state. And according to the target instruction to perform batch processing operations on the batch data.
  • the execution flag bit is preset in the batch instruction, and then according to the status information corresponding to the execution flag bit in the instruction, it is determined whether the instruction needs to be executed for this batch operation, so as to ensure that the instruction flow
  • the instructions in the instruction stream can also be executed flexibly, which relatively avoids the computing device from executing redundant instructions that do not correspond to the data in the batch data, thereby ensuring Reliability of batch operations.
  • this application also provides a batch processing device, equipment, and storage medium, and the beneficial effects are the same as those described above.
  • FIG. 1 is a flowchart of a batch processing method disclosed in an embodiment of the application
  • FIG. 3 is a flowchart of a specific batch processing method disclosed in an embodiment of the application.
  • FIG. 4 is a flowchart of a specific batch processing method disclosed in an embodiment of the application.
  • FIG. 5 is a flowchart of a specific batch processing method disclosed in an embodiment of the application.
  • FIG. 6 is a flowchart of a specific batch processing method disclosed in an embodiment of the application.
  • FIG. 7 is a schematic diagram of generating an instruction stream disclosed in an embodiment of this application.
  • FIG. 8 is a schematic structural diagram of a batch processing device disclosed in an embodiment of the application.
  • user software is required to provide the computing device with batch data to be processed and instructions for processing the batch data, and then the computing device executes the corresponding batch processing according to the instructions for the batch data to be processed Operation to achieve feature extraction of batch data.
  • the batch data initiated by the user software to the computing device contains multiple pieces of data, and the batch processing operation of the computing device needs to be executed based on the corresponding instructions of each piece of data, but the instruction flow initiated by the current user software is The number of instructions generated in advance and contained in it is fixed, and the number of data in the batch data initiated by the current user software is often flexible according to the actual situation, so it may cause the computing device to execute the data that does not correspond to the data in the batch data. Redundant instructions make it difficult to ensure the reliability of batch operations.
  • the core of this application is to provide a batch processing method to relatively ensure the reliability of batch processing operations.
  • an embodiment of the present application discloses a batch processing method, including:
  • Step S10 Obtain batch data and an instruction stream.
  • the instructions of the instruction stream include an execution flag bit.
  • the batch data in this step refers to batch big data, which is data that arrives in batches.
  • batch data there are often more data items. Therefore, for batch data processing, Essentially, it is the data processing for each data item in the batch data, and at the hardware level, the execution of different types of data processing on the data item needs to be based on the response to the corresponding instruction, so in this step, the batch data is obtained at the same time Instruction stream.
  • Instruction stream refers to a sequence of instructions executed by hardware, consisting of multiple instructions. The focus of this step is that the instructions in the instruction stream contain the execution flag bit. The function of the execution flag bit is to mark whether the instruction to which it belongs is executed. This is due to the number of instructions in the instruction stream and the number of data items in the batch data.
  • the execution flag bit can mark whether the corresponding instruction is executed in the current batch process.
  • Step S11 Select the target instruction whose status information corresponding to the execution flag bit meets the executable standard from the instructions of the instruction stream.
  • Step S12 Perform a batch processing operation on the batch data according to the target instruction.
  • this step further selects the target instruction whose status information corresponding to the execution flag bit meets the executable standard in the instructions of the instruction stream, and the target instruction is the batch The instructions that need to be executed when the data is batch processed, and then batch processing operations are performed on the batch data according to the target instructions.
  • the batch processing method provided by this application first obtains batch data and an instruction stream.
  • the instructions of the instruction stream include an execution flag bit, and then selects the state information corresponding to the execution flag bit in the instructions of the instruction stream to meet the target instruction of the executable state. And according to the target instruction to perform batch processing operations on the batch data.
  • the execution flag bit is preset in the batch instruction, and then according to the status information corresponding to the execution flag bit in the instruction, it is determined whether the instruction needs to be executed for this batch operation, so as to ensure that the instruction flow
  • the instructions in the instruction stream can also be executed flexibly, which relatively avoids the computing device from executing redundant instructions that do not correspond to the data in the batch data, thereby ensuring Reliability of batch operations.
  • the number of instructions in the instruction stream is greater than or equal to the batch size of the batch data.
  • the number of instructions in the instruction stream is greater than or equal to the batch size of the batch data to relatively ensure that the incoming batch data can be processed at one time through the instruction stream, and the processing efficiency of the batch processing can be ensured.
  • an embodiment of the present application discloses a batch processing method, including:
  • Step S20 Obtain batch data and an instruction stream.
  • the instructions of the instruction stream include an execution flag bit.
  • Step S21 Obtain the register information from the execution flag of the instruction, and read the status information in the corresponding register according to the register information.
  • the execution flag of the instruction in the instruction stream records register information
  • the register information further corresponds to the register that records the status information, so the status of the instruction can be obtained through the execution flag of the instruction.
  • Information specifically, first obtains the register information from the execution flag of the instruction, and then reads the status information in the corresponding register according to the register information.
  • Step S22 It is judged whether the status information meets the executable standard, if yes, then step S23 to step S24 are executed, otherwise, step S25 is executed.
  • Step S23 Set the instruction as the target instruction.
  • Step S24 Perform a batch processing operation on the batch data according to the target instruction.
  • Step S25 No processing is performed.
  • the instruction to which the register information belongs is set as the target instruction, and then according to the target instruction Perform batch operations on batch data.
  • the execution flag bits of each instruction in the instruction stream record register information, and the register information corresponds to a register with variable storage content
  • the register information in the execution flag bits of each instruction in the instruction stream can always be No change, only need to flexibly modify the contents of the register corresponding to the register information to achieve flexible control of the execution of each instruction in the instruction stream, and there is no need to frequently modify the instructions in the instruction stream for batch data with different data items to ensure In order to ensure the overall accuracy of the instruction flow, the overall reliability of the batch process is ensured.
  • an embodiment of the present application discloses a batch processing method, including:
  • Step S30 Obtain batch data and an instruction stream.
  • the instructions of the instruction stream include an execution flag bit.
  • Step S31 Obtain the register serial number information from the execution flag of the instruction, and read the state value in the corresponding register according to the register address corresponding to the register serial number information.
  • Step S32 It is judged whether the state value is equal to the standard value, if it is, then step S33 to step S34 are executed, otherwise, step S35 is executed.
  • Step S33 Set the instruction as the target instruction.
  • Step S34 Perform a batch processing operation on the batch data according to the target instruction.
  • Step S35 No processing is performed.
  • the register information recorded in the execution flag bit is specifically register serial number information, and then after the register serial number is obtained in the execution flag bit of the instruction, it is further read according to the register address corresponding to the register serial number. Take the state value in the corresponding register, and then judge whether the instruction is an executable instruction based on the state value. Since the serial number of the register is more concise than the address of the register, this embodiment uses the serial number of the register as the content of the execution flag of the instruction, which can relatively reduce the structural length that the execution flag needs to occupy in the instruction. , Reduce the resource occupation degree in the hardware by the instruction stream, and improve the overall reliability of the batch process.
  • the value of the standard value includes 1 or 0.
  • an embodiment of the present application discloses a batch processing method, including:
  • Step S40 Obtain batch data and an instruction stream.
  • the instructions of the instruction stream include an execution flag bit.
  • Step S41 Obtain the register serial number information from the execution flag of the instruction.
  • Step S42 It is judged whether the register serial number information is the register serial number of the special register, if yes, execute step S45 to step S46, otherwise, execute step S43 to step S44.
  • Step S43 Read the state value in the corresponding register according to the register address corresponding to the register serial number information.
  • Step S44 It is judged whether the state value is equal to the standard value, if yes, then step S45 to step S46 are executed, otherwise, step S47 is executed.
  • Step S45 Set the instruction as the target instruction.
  • Step S46 Perform a batch processing operation on the batch data according to the target instruction.
  • Step S47 No processing is performed.
  • the focus of this embodiment is that before reading the status value in the corresponding register according to the register address corresponding to the register serial number information, first determine whether the register serial number information is the register serial number of a special register.
  • the register serial number information is a special register Regardless of the value stored in the special register, the instruction to which the register number information belongs is set as the target instruction, which can achieve the purpose of controlling the execution of the instruction without assigning a value to the cluster, which further ensures the instruction flow The controllability of the execution of the instructions.
  • an embodiment of the present application discloses a batch processing method, including:
  • Step S50 Obtain the batch data and the basic instruction stream.
  • the basic instruction stream contains the basic instruction whose content of the execution flag is empty.
  • Step S51 Count the batch size of the batch data, and set the status information that meets the executable standard for the corresponding number of target registers according to the batch size.
  • Step S52 Set the register information of the target register to the execution flag bit of the target basic instruction uniquely corresponding to the target register in the basic instruction stream to obtain the instruction stream.
  • Step S53 Obtain the register information from the execution flag of the instruction, and read the status information in the corresponding register according to the register information.
  • the execution flag of the instruction in the instruction stream records register information
  • the register information further corresponds to the register that records the status information, so the status of the instruction can be obtained through the execution flag of the instruction.
  • Information specifically, first obtains the register information from the execution flag of the instruction, and then reads the status information in the corresponding register according to the register information.
  • Step S54 It is judged whether the status information meets the executable standard, if yes, then step S55 to step S56 are executed, otherwise, step S57 is executed.
  • Step S55 Set the instruction as the target instruction.
  • Step S56 Perform a batch processing operation on the batch data according to the target instruction.
  • Step S57 No processing is performed.
  • the focus of this embodiment is that in the process of generating the instruction stream, first obtain the batch data and the basic instruction stream whose content of the execution flag is empty, and then count the batch size of the batch data, that is, the data in the batch data.
  • the number of items, and according to the batch size, the corresponding number of target registers are set to meet the executable standard status information.
  • the purpose is to provide register information to the execution flag of the target basic instruction uniquely corresponding to the target register in the basic instruction stream through the target register. That is, the register information of the target register is set in the execution flag bit of the target basic instruction uniquely corresponding to the target register in the basic instruction stream, and the instruction stream is obtained by this.
  • This embodiment can ensure that the executable instructions in the data stream are consistent with the batch size of the batch data, thereby improving the accuracy of the batch processing results.
  • obtaining batch data and a basic instruction stream includes:
  • the batch size of statistical batch data including:
  • the focus of this embodiment is to obtain the batch data and basic instruction stream initiated by the user software by the hardware, and then calculate the batch size of the batch data by executing the preset instructions, so that according to the batch size and the basic instruction The flow generates the final instruction flow.
  • the way of executing preset instructions through hardware relatively improves the flexibility of instruction stream generation.
  • an embodiment of the present application discloses a batch processing method, including:
  • Step S60 Obtain batch data and an instruction stream.
  • the instructions of the instruction stream include an execution flag bit.
  • Step S61 Select the target instruction whose status information corresponding to the execution flag bit meets the executable standard from the instructions of the instruction stream.
  • Step S62 It is judged whether the batch size of the batch data is greater than the preset value, and if so, step S63 to step S64 are executed, otherwise, step S65 is executed.
  • Step S63 Divide the batch data into batch data groups with a batch size smaller than a preset value.
  • Step S64 Perform batch processing operations on each batch of data groups in sequence according to the target instruction.
  • Step S65 Perform a batch processing operation on the batch data according to the target instruction.
  • this embodiment further determines whether the batch size of the batch data is greater than the preset value. If it is, the batch data is divided into batch data groups with the batch size smaller than the preset value, and then according to The state information corresponding to the execution flag bit satisfies the target instruction of the executable standard to perform batch processing operations on each batch of data groups in turn, where the preset value may be the largest batch size that the hardware can undertake when the batch processing operation is performed.
  • the preset value may be the largest batch size that the hardware can undertake when the batch processing operation is performed.
  • the focus of this embodiment is that when the batch size of the batch data is greater than the preset value, group batch processing is performed on the batch data, which further ensures the overall reliability of the batch processing process.
  • the preset value includes the instruction quantity value of the instruction stream.
  • the instruction flow is a sequence of instructions designed for hardware, the number of instructions in the instruction flow should be less than or equal to the maximum number of instructions carried by the hardware, and the instruction quantity value of the instruction flow can be used as the preset value. Ensure the overall reliability of the batch process.
  • the present application also provides a scenario embodiment in a specific application scenario for description.
  • this application designs an instruction set based on condition registers. Its characteristic is that a condition register is added for each instruction. When the value stored in the condition register is 0, the current instruction will not be executed. When the value stored in the condition register is not 0, the current instruction will be executed.
  • the instruction structure is shown in Table 1. Due to instruction length limitation, this application designs 16 condition registers (CR0 ⁇ CR15), among which CR0 is a special condition register. When the instruction is configured as CR0, the current instruction will be executed regardless of whether the value stored in CR0 is non-zero.
  • condition register comparison instructions With instructions that support conditional execution, it is also necessary to design a set of instructions for conditional register assignment. To this end, the present invention has designed a group of condition register comparison instructions, the detailed structure of which is shown in Table 2.
  • the condition register comparison instruction has three parameters.
  • the first parameter is the condition register to be assigned, and the last two parameters are comparison parameters. Its function is to compare whether the two values meet the condition and store the result in the corresponding condition register. in.
  • conditional register comparison instructions At the forefront of the entire instruction stream.
  • the batch size is a global information. Once specified, it will not change during the entire instruction execution process.
  • the present invention only generates the condition register comparison instruction at the beginning of the instruction stream, stores the result in the corresponding instruction register, and requires software to ensure that the value of the condition register is not changed in other locations.
  • the second parameter (Reg1) of the condition register in Table 2 needs to be configured as R0.
  • the software exposes the read and write interface of the general register R0 to the user to realize the dynamic configuration of the batch size by the user. The user needs to configure the value of this register before starting the task.
  • Hardware batch refers to the batch size processed by one instruction during hardware design, usually 1.
  • the third item of the dynamic batch control protocol stipulates that the software must generate an instruction stream in accordance with the maximum batch.
  • the present invention divides the batch into a bottom-up hardware batch, an instruction batch, and a user batch.
  • the user batch refers to the batch size actually set by the user
  • the instruction batch is the maximum batch determined when the instruction is generated, which is determined by the number of condition registers
  • the hardware batch refers to the batch size processed by one instruction in the hardware design, usually 1. Therefore, the user batch will actually be divided into instruction batches first, and then the instruction batches will be divided into several hardware batches, and finally support for any batch.
  • an embodiment of the present application discloses a batch processing device, including:
  • the acquiring module 10 is used to acquire batch data and instruction stream, and the instruction of the instruction stream contains an execution flag bit;
  • the instruction selection module 11 is used to select the target instruction whose status information corresponding to the execution flag bit meets the executable standard among the instructions of the instruction stream;
  • the instruction execution module 12 is used to perform batch processing operations on batch data according to target instructions.
  • the batch processing device provided by the present application first obtains batch data and instruction stream.
  • the instructions of the instruction stream include execution flag bits, and then selects the state information corresponding to the execution flag bits in the instructions of the instruction stream to meet the target instructions of the executable state. And according to the target instruction to perform batch processing operations on the batch data.
  • This device uses the preset execution flag bit in the batch instruction, and then determines whether the instruction needs to be executed for this batch operation according to the status information corresponding to the execution flag bit in the instruction, so as to ensure that the instruction flow
  • the instructions in the instruction stream can also be executed flexibly, which relatively avoids the computing device from executing redundant instructions that do not correspond to the data in the batch data, thereby ensuring Reliability of batch operations.
  • a batch processing device including:
  • Memory used to store computer programs
  • the processor is used to implement the steps of the above-mentioned batch processing method when the computer program is executed.
  • the batch processing equipment provided by this application first obtains batch data and instruction stream.
  • the instructions of the instruction stream include execution flag bits, and then selects the state information corresponding to the execution flag bits in the instructions of the instruction stream to meet the target instructions of the executable state. And according to the target instruction to perform batch processing operations on the batch data.
  • This device uses the preset execution flag bit in the batch instruction, and then determines whether the instruction needs to be executed for this batch operation according to the status information corresponding to the execution flag bit in the instruction, so as to ensure that the instruction flow
  • the instructions in the instruction stream can also be executed flexibly, which relatively avoids the computing device from executing redundant instructions that do not correspond to the data in the batch data, thereby ensuring Reliability of batch operations.
  • the present application also provides a computer-readable storage medium on which a computer program is stored, and when the computer program is executed by a processor, the steps of the batch processing method as described above are realized.
  • the computer-readable storage medium provided by this application first obtains batch data and an instruction stream.
  • the instructions of the instruction stream include an execution flag bit, and then selects the state information corresponding to the execution flag bit in the instructions of the instruction stream to meet the target of the executable state Command, and perform batch processing operations on batch data according to the target command.
  • the computer-readable storage medium presets the execution flag bit in the batch instruction, and then determines whether the instruction needs to be executed for this batch operation according to the status information corresponding to the execution flag bit in the instruction.
  • the instructions in the instruction stream can also be executed flexibly, relatively avoiding the execution of redundant instructions that do not correspond to the data in the batch data by the computing device , Thereby ensuring the reliability of batch operations.

Landscapes

  • Engineering & Computer Science (AREA)
  • Software Systems (AREA)
  • Theoretical Computer Science (AREA)
  • Physics & Mathematics (AREA)
  • General Engineering & Computer Science (AREA)
  • General Physics & Mathematics (AREA)
  • Executing Machine-Instructions (AREA)

Abstract

A batch processing method, apparatus and device, and a storage medium. The method comprises the following steps: acquiring batch data and an instruction stream, wherein instructions in the instruction stream include execution flag bits; selecting, from the instructions in the instruction stream, a target instruction, state information corresponding to the execution flag bit of which meets an executable standard; and executing a batch processing operation on the batch data according to the target instruction. According to the present method, in relative terms, a computing device is prevented from executing redundant instructions which do not correspond to data in batch data, such that the reliability of batch processing operation is ensured. In addition, further provided are a batch processing apparatus and device, and a storage medium, and the beneficial effects thereof are the same as those described above.

Description

一种批处理方法、装置、设备及存储介质Batch processing method, device, equipment and storage medium
本申请要求于2019年12月12日提交中国专利局、申请号为201911288737.7、发明名称为“一种批处理方法、装置、设备及存储介质”的中国专利申请的优先权,其全部内容通过引用结合在本申请中。This application claims the priority of a Chinese patent application filed with the Chinese Patent Office on December 12, 2019, the application number is 201911288737.7, and the invention title is "a batch processing method, device, equipment and storage medium", the entire content of which is incorporated by reference Incorporated in this application.
技术领域Technical field
本申请涉及深度学习领域,特别是涉及一种批处理方法、装置、设备及存储介质。This application relates to the field of deep learning, in particular to a batch processing method, device, equipment, and storage medium.
背景技术Background technique
卷积神经网络(Convolutional Neural Networks,CNN)是一类包含卷积计算且具有深度结构的前馈神经网络(Feedforward Neural Networks),是深度学习(deep learning)的代表算法之一。Convolutional Neural Networks (CNN) is a type of Feedforward Neural Networks (Feedforward Neural Networks) that includes convolution calculations and has a deep structure. It is one of the representative algorithms of deep learning.
在当前基于卷积神经网络的批处理过程中,需要用户软件向运算设备提供待处理的批数据以及对批数据进行处理的指令,进而运算设备根据该指令对待处理的批数据执行相应的批处理操作,以此实现对批数据的特征提取。由于在当前的批处理场景中用户软件向运算设备发起的批数据中包含多条数据,并且运算设备的批处理操作时需要基于每一条数据相应的指令执行,但是当前用户软件发起的指令流是预先产生并且其包含的指令数量是固定的,而当前用户软件发起的批数据中的数据条数往往是根据实际情况灵活多变的,因此可能导致运算设备执行未与批数据中的数据对应的多余指令,进而难以确保批处理操作的可靠性。In the current batch processing process based on convolutional neural networks, user software is required to provide the computing device with batch data to be processed and instructions for processing the batch data, and then the computing device executes the corresponding batch processing according to the instructions for the batch data to be processed Operation to achieve feature extraction of batch data. Because in the current batch processing scenario, the batch data initiated by the user software to the computing device contains multiple pieces of data, and the batch processing operation of the computing device needs to be executed based on the corresponding instructions of each piece of data, but the instruction flow initiated by the current user software is The number of instructions generated in advance and contained in it is fixed, and the number of data in the batch data initiated by the current user software is often flexible according to the actual situation, so it may cause the computing device to execute the data that does not correspond to the data in the batch data. Redundant instructions make it difficult to ensure the reliability of batch operations.
由此可见,提供一种批处理方法,以相对确保批处理操作的可靠性,是本领域技术人员需要解决的问题。It can be seen that providing a batch processing method to relatively ensure the reliability of batch processing operations is a problem that needs to be solved by those skilled in the art.
发明内容Summary of the invention
本申请的目的是提供一种批处理方法、装置、设备及存储介质,以相对确保批处理操作的可靠性。The purpose of this application is to provide a batch processing method, device, equipment, and storage medium to relatively ensure the reliability of batch processing operations.
为解决上述技术问题,本申请提供一种批处理方法,包括:To solve the above technical problems, this application provides a batch processing method, including:
获取批数据以及指令流,指令流的指令中包含执行标志位;Get batch data and instruction stream, the instruction of the instruction stream contains the execution flag bit;
在指令流的指令中选取执行标志位对应的状态信息满足可执行标准的目标指令;In the instructions of the instruction stream, select the target instruction whose status information corresponding to the execution flag bit meets the executable standard;
根据目标指令对批数据执行批处理操作。Perform batch processing operations on batch data according to target instructions.
优选的,在指令流的指令中选取执行标志位对应的状态信息满足可执行标准的目标指令,包括:Preferably, selecting the target instruction whose status information corresponding to the execution flag bit meets the executable standard from the instructions of the instruction stream includes:
在指令的执行标志位中获取寄存器信息,并根据寄存器信息读取相应寄存器中的状态信息;Obtain the register information from the execution flag of the instruction, and read the status information in the corresponding register according to the register information;
判断状态信息是否满足可执行标准;Determine whether the status information meets the executable standards;
如果状态信息满足可执行标准,则将指令设置为目标指令。If the status information meets the executable criteria, the instruction is set as the target instruction.
优选的,在指令的执行标志位中获取寄存器信息,并根据寄存器信息读取相应寄存器中的状态信息,包括:Preferably, obtaining register information from the execution flag of the instruction, and reading the status information in the corresponding register according to the register information, includes:
在指令的执行标志位中获取寄存器序号信息,并根据寄存器序号信息对应的寄存器地址读取相应寄存器中的状态数值;Obtain the register serial number information in the execution flag of the instruction, and read the status value in the corresponding register according to the register address corresponding to the register serial number information;
判断状态信息是否满足可执行标准,包括:Determine whether the status information meets the executable standards, including:
判断状态数值是否等于标准数值;Judge whether the status value is equal to the standard value;
如果状态数值等于标准数值,则状态信息满足可执行标准。If the status value is equal to the standard value, the status information meets the executable standard.
优选的,在根据寄存器序号信息对应的寄存器地址读取相应寄存器中的状态数值之前,方法还包括:Preferably, before reading the state value in the corresponding register according to the register address corresponding to the register serial number information, the method further includes:
判断寄存器序号信息是否为特殊寄存器的寄存器序号;Judge whether the register serial number information is the register serial number of the special register;
如果寄存器序号信息为特殊寄存器的寄存器序号,则执行将指令设置为目标指令的步骤;If the register serial number information is the register serial number of the special register, execute the step of setting the instruction as the target instruction;
如果寄存器序号信息非特殊寄存器的寄存器序号,则执行根据寄存器序号信息对应的寄存器地址读取相应寄存器中的状态数值的步骤。If the register serial number information is not the register serial number of the special register, perform the step of reading the state value in the corresponding register according to the register address corresponding to the register serial number information.
优选的,标准数值包括1或0。Preferably, the standard value includes 1 or 0.
优选的,获取批数据以及指令流,包括:Preferably, obtaining batch data and instruction stream includes:
获取批数据以及基础指令流,基础指令流中包含执行标志位的内容为空的基础指令;Obtain batch data and basic instruction stream. The basic instruction stream contains basic instructions whose execution flag is empty;
统计批数据的批大小,根据批大小对相应数量的目标寄存器设置满足 可执行标准的状态信息;Calculate the batch size of the batch data, and set the status information that meets the executable standard for the corresponding number of target registers according to the batch size;
将目标寄存器的寄存器信息设置于基础指令流中与目标寄存器唯一对应的目标基础指令的执行标志位,以得到指令流。The register information of the target register is set in the execution flag bit of the target basic instruction uniquely corresponding to the target register in the basic instruction stream to obtain the instruction stream.
优选的,获取批数据以及基础指令流,包括:Preferably, obtaining batch data and basic instruction stream includes:
获取由用户软件传入的批数据以及基础指令流;Obtain batch data and basic instruction stream passed in by user software;
统计批数据的批大小,包括:The batch size of statistical batch data, including:
通过执行预设指令的方式统计批数据的批大小。Count the batch size of batch data by executing preset instructions.
优选的,在根据目标指令对批数据执行批处理操作之前,方法还包括:Preferably, before the batch processing operation is performed on the batch data according to the target instruction, the method further includes:
判断批数据的批大小是否大于预设值;Determine whether the batch size of batch data is greater than the preset value;
如果批数据的批大小大于预设值,则将批数据划分为批大小小于预设值的批数据组;If the batch size of the batch data is larger than the preset value, divide the batch data into batch data groups with the batch size smaller than the preset value;
根据目标指令依次对各批数据组执行批处理操作;Perform batch processing operations on each batch of data groups in sequence according to the target instruction;
如果批数据的批大小小于预设值,则执行根据目标指令对批数据执行批处理操作的步骤。If the batch size of the batch data is smaller than the preset value, the step of performing a batch processing operation on the batch data according to the target instruction is executed.
优选的,预设值包括指令流的指令数量值。Preferably, the preset value includes the instruction quantity value of the instruction stream.
优选的,指令流中指令的数量大于或等于批数据的批大小。Preferably, the number of instructions in the instruction stream is greater than or equal to the batch size of the batch data.
此外,本申请还提供一种批处理装置,包括:In addition, this application also provides a batch processing device, including:
获取模块,用于获取批数据以及指令流,指令流的指令中包含执行标志位;Obtaining module, used to obtain batch data and instruction stream, the instruction of the instruction stream contains the execution flag bit;
指令选取模块,用于在指令流的指令中选取执行标志位对应的状态信息满足可执行标准的目标指令;The instruction selection module is used to select the target instruction whose status information corresponding to the execution flag bit meets the executable standard among the instructions of the instruction stream;
指令执行模块,用于根据目标指令对批数据执行批处理操作。The instruction execution module is used to perform batch processing operations on the batch data according to the target instruction.
此外,本申请还提供一种批处理设备,包括:In addition, this application also provides a batch processing device, including:
存储器,用于存储计算机程序;Memory, used to store computer programs;
处理器,用于执行计算机程序时实现如上述的批处理方法的步骤。The processor is used to implement the steps of the above-mentioned batch processing method when the computer program is executed.
此外,本申请还提供一种计算机可读存储介质,计算机可读存储介质上存储有计算机程序,计算机程序被处理器执行时实现如上述的批处理方法的步骤。In addition, the present application also provides a computer-readable storage medium with a computer program stored on the computer-readable storage medium, and when the computer program is executed by a processor, the steps of the batch processing method as described above are realized.
本申请所提供的批处理方法,首先获取批数据以及指令流,指令流的 指令中包含执行标志位,进而在指令流的指令中选取执行标志位对应的状态信息满足可执行状态的目标指令,并根据该目标指令对批数据执行批处理操作。本方法是通过在批处理的指令中预设有执行标志位,进而根据指令中执行标志位所对应的状态信息判定该指令是否为本次批处理操作需要执行的指令,以此确保在指令流的指令数量固定且批数据中的数据条数灵活多变的情况下,指令流中的指令也能够灵活执行,相对避免了运算设备执行未与批数据中的数据对应的多余指令,进而确保了批处理操作的可靠性。此外,本申请还提供一种批处理装置、设备及存储介质,有益效果同上所述。The batch processing method provided by this application first obtains batch data and an instruction stream. The instructions of the instruction stream include an execution flag bit, and then selects the state information corresponding to the execution flag bit in the instructions of the instruction stream to meet the target instruction of the executable state. And according to the target instruction to perform batch processing operations on the batch data. In this method, the execution flag bit is preset in the batch instruction, and then according to the status information corresponding to the execution flag bit in the instruction, it is determined whether the instruction needs to be executed for this batch operation, so as to ensure that the instruction flow When the number of instructions is fixed and the number of data in the batch data is flexible, the instructions in the instruction stream can also be executed flexibly, which relatively avoids the computing device from executing redundant instructions that do not correspond to the data in the batch data, thereby ensuring Reliability of batch operations. In addition, this application also provides a batch processing device, equipment, and storage medium, and the beneficial effects are the same as those described above.
附图说明Description of the drawings
图1为本申请实施例公开的一种批处理方法的流程图;FIG. 1 is a flowchart of a batch processing method disclosed in an embodiment of the application;
图2为本申请实施例公开的一种具体的批处理方法的流程图;2 is a flowchart of a specific batch processing method disclosed in an embodiment of the application;
图3为本申请实施例公开的一种具体的批处理方法的流程图;FIG. 3 is a flowchart of a specific batch processing method disclosed in an embodiment of the application;
图4为本申请实施例公开的一种具体的批处理方法的流程图;FIG. 4 is a flowchart of a specific batch processing method disclosed in an embodiment of the application;
图5为本申请实施例公开的一种具体的批处理方法的流程图;FIG. 5 is a flowchart of a specific batch processing method disclosed in an embodiment of the application;
图6为本申请实施例公开的一种具体的批处理方法的流程图;FIG. 6 is a flowchart of a specific batch processing method disclosed in an embodiment of the application;
图7为本申请实施例公开的一种指令流的生成示意图;FIG. 7 is a schematic diagram of generating an instruction stream disclosed in an embodiment of this application;
图8为本申请实施例公开的一种批处理装置的结构示意图。FIG. 8 is a schematic structural diagram of a batch processing device disclosed in an embodiment of the application.
具体实施方式Detailed ways
下面将结合本申请实施例中的附图,对本申请实施例中的技术方案进行清楚、完整地描述,显然,所描述的实施例仅仅是本申请一部分实施例,而不是全部实施例。基于本申请中的实施例,本领域普通技术人员在没有做出创造性劳动前提下,所获得的所有其他实施例,都属于本申请保护范围。The technical solutions in the embodiments of the present application will be clearly and completely described below in conjunction with the drawings in the embodiments of the present application. Obviously, the described embodiments are only a part of the embodiments of the present application, rather than all the embodiments. Based on the embodiments in this application, all other embodiments obtained by those of ordinary skill in the art without creative work shall fall within the protection scope of this application.
在当前基于卷积神经网络的批处理过程中,需要用户软件向运算设备提供待处理的批数据以及对批数据进行处理的指令,进而运算设备根据该 指令对待处理的批数据执行相应的批处理操作,以此实现对批数据的特征提取。由于在当前的批处理场景中用户软件向运算设备发起的批数据中包含多条数据,并且运算设备的批处理操作时需要基于每一条数据相应的指令执行,但是当前用户软件发起的指令流是预先产生并且其包含的指令数量是固定的,而当前用户软件发起的批数据中的数据条数往往是根据实际情况灵活多变的,因此可能导致运算设备执行未与批数据中的数据对应的多余指令,进而难以确保批处理操作的可靠性。In the current batch processing process based on convolutional neural networks, user software is required to provide the computing device with batch data to be processed and instructions for processing the batch data, and then the computing device executes the corresponding batch processing according to the instructions for the batch data to be processed Operation to achieve feature extraction of batch data. Because in the current batch processing scenario, the batch data initiated by the user software to the computing device contains multiple pieces of data, and the batch processing operation of the computing device needs to be executed based on the corresponding instructions of each piece of data, but the instruction flow initiated by the current user software is The number of instructions generated in advance and contained in it is fixed, and the number of data in the batch data initiated by the current user software is often flexible according to the actual situation, so it may cause the computing device to execute the data that does not correspond to the data in the batch data. Redundant instructions make it difficult to ensure the reliability of batch operations.
为此,本申请的核心是提供一种批处理方法,以相对确保批处理操作的可靠性。For this reason, the core of this application is to provide a batch processing method to relatively ensure the reliability of batch processing operations.
为了使本技术领域的人员更好地理解本申请方案,下面结合附图和具体实施方式对本申请作进一步的详细说明。In order to enable those skilled in the art to better understand the solution of the application, the application will be further described in detail below with reference to the accompanying drawings and specific implementations.
请参见图1所示,本申请实施例公开了一种批处理方法,包括:As shown in FIG. 1, an embodiment of the present application discloses a batch processing method, including:
步骤S10:获取批数据以及指令流,指令流的指令中包含执行标志位。Step S10: Obtain batch data and an instruction stream. The instructions of the instruction stream include an execution flag bit.
需要说明的是,本步骤中的批数据指的是批式(Batch)大数据,是按照批次到来的数据,对于批数据中往往包含有较多的数据项,因此对于批数据的处理,本质上是对批数据中的各个数据项进行的数据处理,而在硬件层面上,对数据项执行不同类型的数据处理需要基于对相应指令的响应,因此本步骤中在获取批数据的同时获取指令流,指令流指的是由硬件执行的指令序列,由多个指令构成。本步骤的重点在于指令流的指令中包含执行标志位,执行标志位的作用是用于标记其所属的指令是否执行,这是由于考虑到指令流中的指令数量与批数据中的数据项数量可能存在不匹配的情况,当指令流中的指令数量多于当前批数据的数据项数量的情况下,指令流中会存在当前批处理过程中无需执行的指令,因此通过指令流中指令包含的执行标志位,能够标记相应指令是否在当前批处理的过程中执行。It should be noted that the batch data in this step refers to batch big data, which is data that arrives in batches. For batch data, there are often more data items. Therefore, for batch data processing, Essentially, it is the data processing for each data item in the batch data, and at the hardware level, the execution of different types of data processing on the data item needs to be based on the response to the corresponding instruction, so in this step, the batch data is obtained at the same time Instruction stream. Instruction stream refers to a sequence of instructions executed by hardware, consisting of multiple instructions. The focus of this step is that the instructions in the instruction stream contain the execution flag bit. The function of the execution flag bit is to mark whether the instruction to which it belongs is executed. This is due to the number of instructions in the instruction stream and the number of data items in the batch data. There may be a mismatch. When the number of instructions in the instruction stream is more than the number of data items in the current batch of data, there will be instructions in the instruction stream that do not need to be executed in the current batch process, so the instructions contained in the instruction stream The execution flag bit can mark whether the corresponding instruction is executed in the current batch process.
步骤S11:在指令流的指令中选取执行标志位对应的状态信息满足可执行标准的目标指令。Step S11: Select the target instruction whose status information corresponding to the execution flag bit meets the executable standard from the instructions of the instruction stream.
步骤S12:根据目标指令对批数据执行批处理操作。Step S12: Perform a batch processing operation on the batch data according to the target instruction.
可以理解的是,本实施例在获取到指令流以及批数据后,本步骤进一 步在指令流的指令中选取执行标志位对应的状态信息满足可执行标准的目标指令,该目标指令即为对批数据进行批处理时需要执行的指令,进而根据目标指令对批数据执行批处理操作。It is understandable that after the instruction stream and batch data are obtained in this embodiment, this step further selects the target instruction whose status information corresponding to the execution flag bit meets the executable standard in the instructions of the instruction stream, and the target instruction is the batch The instructions that need to be executed when the data is batch processed, and then batch processing operations are performed on the batch data according to the target instructions.
本申请所提供的批处理方法,首先获取批数据以及指令流,指令流的指令中包含执行标志位,进而在指令流的指令中选取执行标志位对应的状态信息满足可执行状态的目标指令,并根据该目标指令对批数据执行批处理操作。本方法是通过在批处理的指令中预设有执行标志位,进而根据指令中执行标志位所对应的状态信息判定该指令是否为本次批处理操作需要执行的指令,以此确保在指令流的指令数量固定且批数据中的数据条数灵活多变的情况下,指令流中的指令也能够灵活执行,相对避免了运算设备执行未与批数据中的数据对应的多余指令,进而确保了批处理操作的可靠性。The batch processing method provided by this application first obtains batch data and an instruction stream. The instructions of the instruction stream include an execution flag bit, and then selects the state information corresponding to the execution flag bit in the instructions of the instruction stream to meet the target instruction of the executable state. And according to the target instruction to perform batch processing operations on the batch data. In this method, the execution flag bit is preset in the batch instruction, and then according to the status information corresponding to the execution flag bit in the instruction, it is determined whether the instruction needs to be executed for this batch operation, so as to ensure that the instruction flow When the number of instructions is fixed and the number of data in the batch data is flexible, the instructions in the instruction stream can also be executed flexibly, which relatively avoids the computing device from executing redundant instructions that do not correspond to the data in the batch data, thereby ensuring Reliability of batch operations.
在上述实施例的基础上,作为一种优选的实施方式,指令流中指令的数量大于或等于批数据的批大小。On the basis of the foregoing embodiment, as a preferred implementation manner, the number of instructions in the instruction stream is greater than or equal to the batch size of the batch data.
需要说明的是,指令流中指令的数量大于或等于批数据的批大小能够相对确保到来的批数据能够通过指令流一次性完成处理,能够确保批处理的处理效率。It should be noted that the number of instructions in the instruction stream is greater than or equal to the batch size of the batch data to relatively ensure that the incoming batch data can be processed at one time through the instruction stream, and the processing efficiency of the batch processing can be ensured.
参见图2所示,本申请实施例公开了一种批处理方法,包括:Referring to FIG. 2, an embodiment of the present application discloses a batch processing method, including:
步骤S20:获取批数据以及指令流,指令流的指令中包含执行标志位。Step S20: Obtain batch data and an instruction stream. The instructions of the instruction stream include an execution flag bit.
步骤S21:在指令的执行标志位中获取寄存器信息,并根据寄存器信息读取相应寄存器中的状态信息。Step S21: Obtain the register information from the execution flag of the instruction, and read the status information in the corresponding register according to the register information.
需要说明的是,本实施例的重点在于指令流中指令的执行标志位中记录的是寄存器信息,寄存器信息进一步对应记录有状态信息的寄存器,因此通过指令的执行标志位获取到该指令的状态信息,具体是先在指令的执行标志位中获取寄存器信息,进而根据寄存器信息读取相应寄存器中的状态信息。It should be noted that the focus of this embodiment is that the execution flag of the instruction in the instruction stream records register information, and the register information further corresponds to the register that records the status information, so the status of the instruction can be obtained through the execution flag of the instruction. Information, specifically, first obtains the register information from the execution flag of the instruction, and then reads the status information in the corresponding register according to the register information.
步骤S22:判断状态信息是否满足可执行标准,如果是,则执行步骤S23至步骤S24,否则,执行步骤S25。Step S22: It is judged whether the status information meets the executable standard, if yes, then step S23 to step S24 are executed, otherwise, step S25 is executed.
步骤S23:将指令设置为目标指令。Step S23: Set the instruction as the target instruction.
步骤S24:根据目标指令对批数据执行批处理操作。Step S24: Perform a batch processing operation on the batch data according to the target instruction.
步骤S25:不做处理。Step S25: No processing is performed.
在根据寄存器信息获取到相应寄存器中的状态信息后,进一步判断该状态信息是否满足可执行标准,如果状态信息满足可执行标准,则将该寄存器信息所属的指令设置为目标指令,进而根据目标指令对批数据执行批处理操作。After obtaining the status information in the corresponding register according to the register information, it is further judged whether the status information meets the executable standard. If the status information meets the executable standard, the instruction to which the register information belongs is set as the target instruction, and then according to the target instruction Perform batch operations on batch data.
由于本实施例中,指令流各个指令的执行标志位中记录的是寄存器信息,而寄存器信息对应有所存内容可变的寄存器,因此指令流中的各个指令的执行标志位中的寄存器信息可以始终不变,仅需要灵活修改与寄存器信息对应的寄存器中的内容即可实现对指令流中各指令执行的灵活控制,无需针对不同数据项数量的批数据而对指令流中指令进行频繁修改,确保了指令流的整体准确性,进而确保批处理过程的整体可靠性。Since in this embodiment, the execution flag bits of each instruction in the instruction stream record register information, and the register information corresponds to a register with variable storage content, the register information in the execution flag bits of each instruction in the instruction stream can always be No change, only need to flexibly modify the contents of the register corresponding to the register information to achieve flexible control of the execution of each instruction in the instruction stream, and there is no need to frequently modify the instructions in the instruction stream for batch data with different data items to ensure In order to ensure the overall accuracy of the instruction flow, the overall reliability of the batch process is ensured.
参见图3所示,本申请实施例公开了一种批处理方法,包括:Referring to FIG. 3, an embodiment of the present application discloses a batch processing method, including:
步骤S30:获取批数据以及指令流,指令流的指令中包含执行标志位。Step S30: Obtain batch data and an instruction stream. The instructions of the instruction stream include an execution flag bit.
步骤S31:在指令的执行标志位中获取寄存器序号信息,并根据寄存器序号信息对应的寄存器地址读取相应寄存器中的状态数值。Step S31: Obtain the register serial number information from the execution flag of the instruction, and read the state value in the corresponding register according to the register address corresponding to the register serial number information.
步骤S32:判断状态数值是否等于标准数值,如果是,则执行步骤S33至步骤S34,否则,执行步骤S35。Step S32: It is judged whether the state value is equal to the standard value, if it is, then step S33 to step S34 are executed, otherwise, step S35 is executed.
步骤S33:将指令设置为目标指令。Step S33: Set the instruction as the target instruction.
步骤S34:根据目标指令对批数据执行批处理操作。Step S34: Perform a batch processing operation on the batch data according to the target instruction.
步骤S35:不做处理。Step S35: No processing is performed.
需要说明的是,本实施例的重点在于执行标志位中记录的是寄存器信息具体为寄存器序号信息,进而在指令的执行标志位中获取到寄存器序号后,进一步根据与寄存器序号对应的寄存器地址读取相应寄存器中的状态数值,进而根据状态数值判断该指令是否为可执行的指令。由于寄存器的序号相比于寄存器地址而言具有更高的简洁性,因此本实施例将寄存器的序号作为指令的执行标志位中的内容,能够相对减少执行标志位在指令内 需要占用的结构长度,降低了指令流对硬件中的资源占用程度,提高批处理过程的整体可靠性。It should be noted that the focus of this embodiment is that the register information recorded in the execution flag bit is specifically register serial number information, and then after the register serial number is obtained in the execution flag bit of the instruction, it is further read according to the register address corresponding to the register serial number. Take the state value in the corresponding register, and then judge whether the instruction is an executable instruction based on the state value. Since the serial number of the register is more concise than the address of the register, this embodiment uses the serial number of the register as the content of the execution flag of the instruction, which can relatively reduce the structural length that the execution flag needs to occupy in the instruction. , Reduce the resource occupation degree in the hardware by the instruction stream, and improve the overall reliability of the batch process.
在上述实施例的基础上,作为一种优选的实施方式,标准数值的取值包括1或0。On the basis of the foregoing embodiment, as a preferred implementation manner, the value of the standard value includes 1 or 0.
可以理解的是,由于0和1能够准确且简洁的表征指令处于可执行或不可执行的两种对立的状态,因此标准数值的取值包括1或0能够相对确保判断状态数值是否等于标准数值的整体效率,进而确保批处理过程的整体效率。It is understandable that since 0 and 1 can accurately and concisely indicate that the instruction is in two opposite states of executable or non-executable, the value of the standard value including 1 or 0 can relatively ensure that the state value is equal to the standard value. Overall efficiency, thereby ensuring the overall efficiency of the batch process.
参见图4所示,本申请实施例公开了一种批处理方法,包括:Referring to FIG. 4, an embodiment of the present application discloses a batch processing method, including:
步骤S40:获取批数据以及指令流,指令流的指令中包含执行标志位。Step S40: Obtain batch data and an instruction stream. The instructions of the instruction stream include an execution flag bit.
步骤S41:在指令的执行标志位中获取寄存器序号信息。Step S41: Obtain the register serial number information from the execution flag of the instruction.
步骤S42:判断寄存器序号信息是否为特殊寄存器的寄存器序号,如果是,则执行步骤S45至步骤S46,否则,执行步骤S43至步骤S44。Step S42: It is judged whether the register serial number information is the register serial number of the special register, if yes, execute step S45 to step S46, otherwise, execute step S43 to step S44.
步骤S43:根据寄存器序号信息对应的寄存器地址读取相应寄存器中的状态数值。Step S43: Read the state value in the corresponding register according to the register address corresponding to the register serial number information.
步骤S44:判断状态数值是否等于标准数值,如果是,则执行步骤S45至步骤S46,否则,执行步骤S47。Step S44: It is judged whether the state value is equal to the standard value, if yes, then step S45 to step S46 are executed, otherwise, step S47 is executed.
步骤S45:将指令设置为目标指令。Step S45: Set the instruction as the target instruction.
步骤S46:根据目标指令对批数据执行批处理操作。Step S46: Perform a batch processing operation on the batch data according to the target instruction.
步骤S47:不做处理。Step S47: No processing is performed.
需要说明的是,本实施例的重点是在根据寄存器序号信息对应的寄存器地址读取相应寄存器中的状态数值之前,首先判断寄存器序号信息是否为特殊寄存器的寄存器序号,当寄存器序号信息为特殊寄存器的寄存器序号时,不论特殊寄存器中存储的内容为何值,均将寄存器序号信息所属的指令设置为目标指令,以此能够实现无需对集群器赋值即可控制指令执行的目的,进一步确保了指令流中指令执行的可控性。It should be noted that the focus of this embodiment is that before reading the status value in the corresponding register according to the register address corresponding to the register serial number information, first determine whether the register serial number information is the register serial number of a special register. When the register serial number information is a special register Regardless of the value stored in the special register, the instruction to which the register number information belongs is set as the target instruction, which can achieve the purpose of controlling the execution of the instruction without assigning a value to the cluster, which further ensures the instruction flow The controllability of the execution of the instructions.
参见图5所示,本申请实施例公开了一种批处理方法,包括:Referring to FIG. 5, an embodiment of the present application discloses a batch processing method, including:
步骤S50:获取批数据以及基础指令流,基础指令流中包含执行标志位的内容为空的基础指令。Step S50: Obtain the batch data and the basic instruction stream. The basic instruction stream contains the basic instruction whose content of the execution flag is empty.
步骤S51:统计批数据的批大小,根据批大小对相应数量的目标寄存器设置满足可执行标准的状态信息。Step S51: Count the batch size of the batch data, and set the status information that meets the executable standard for the corresponding number of target registers according to the batch size.
步骤S52:将目标寄存器的寄存器信息设置于基础指令流中与目标寄存器唯一对应的目标基础指令的执行标志位,以得到指令流。Step S52: Set the register information of the target register to the execution flag bit of the target basic instruction uniquely corresponding to the target register in the basic instruction stream to obtain the instruction stream.
步骤S53:在指令的执行标志位中获取寄存器信息,并根据寄存器信息读取相应寄存器中的状态信息。Step S53: Obtain the register information from the execution flag of the instruction, and read the status information in the corresponding register according to the register information.
需要说明的是,本实施例的重点在于指令流中指令的执行标志位中记录的是寄存器信息,寄存器信息进一步对应记录有状态信息的寄存器,因此通过指令的执行标志位获取到该指令的状态信息,具体是先在指令的执行标志位中获取寄存器信息,进而根据寄存器信息读取相应寄存器中的状态信息。It should be noted that the focus of this embodiment is that the execution flag of the instruction in the instruction stream records register information, and the register information further corresponds to the register that records the status information, so the status of the instruction can be obtained through the execution flag of the instruction. Information, specifically, first obtains the register information from the execution flag of the instruction, and then reads the status information in the corresponding register according to the register information.
步骤S54:判断状态信息是否满足可执行标准,如果是,则执行步骤S55至步骤S56,否则,执行步骤S57。Step S54: It is judged whether the status information meets the executable standard, if yes, then step S55 to step S56 are executed, otherwise, step S57 is executed.
步骤S55:将指令设置为目标指令。Step S55: Set the instruction as the target instruction.
步骤S56:根据目标指令对批数据执行批处理操作。Step S56: Perform a batch processing operation on the batch data according to the target instruction.
步骤S57:不做处理。Step S57: No processing is performed.
需要说明的是,本实施例的重点是在生成指令流的过程中,首先获取批数据以及执行标志位的内容为空的基础指令流,进而统计批数据的批大小,即批数据中的数据项数量,并根据批大小对相应数量的目标寄存器设置满足可执行标准的状态信息,目的是为了通过目标寄存器向基础指令流中与目标寄存器唯一对应的目标基础指令的执行标志位提供寄存器信息,即将目标寄存器的寄存器信息设置于基础指令流中与目标寄存器唯一对应的目标基础指令的执行标志位,并以此得到指令流。本实施例能够确保数据流中的可执行指令与批数据的批大小一致,进而提高批处理的结果正确性。It should be noted that the focus of this embodiment is that in the process of generating the instruction stream, first obtain the batch data and the basic instruction stream whose content of the execution flag is empty, and then count the batch size of the batch data, that is, the data in the batch data. The number of items, and according to the batch size, the corresponding number of target registers are set to meet the executable standard status information. The purpose is to provide register information to the execution flag of the target basic instruction uniquely corresponding to the target register in the basic instruction stream through the target register. That is, the register information of the target register is set in the execution flag bit of the target basic instruction uniquely corresponding to the target register in the basic instruction stream, and the instruction stream is obtained by this. This embodiment can ensure that the executable instructions in the data stream are consistent with the batch size of the batch data, thereby improving the accuracy of the batch processing results.
在上述实施例的基础上,作为一种优选的实施方式,获取批数据以及基础指令流,包括:On the basis of the foregoing embodiment, as a preferred implementation manner, obtaining batch data and a basic instruction stream includes:
获取由用户软件传入的批数据以及基础指令流;Obtain batch data and basic instruction stream passed in by user software;
统计批数据的批大小,包括:The batch size of statistical batch data, including:
通过执行预设指令的方式统计批数据的批大小。Count the batch size of batch data by executing preset instructions.
需要说明的是,在本实施方式的重点是由硬件获取由用户软件发起的批数据以及基础指令流,进而通过执行预设指令的方式统计批数据的批大小,以此根据批大小以及基础指令流生成最终的指令流。通过硬件执行预设指令的方式相对提高了指令流生成的灵活性。It should be noted that the focus of this embodiment is to obtain the batch data and basic instruction stream initiated by the user software by the hardware, and then calculate the batch size of the batch data by executing the preset instructions, so that according to the batch size and the basic instruction The flow generates the final instruction flow. The way of executing preset instructions through hardware relatively improves the flexibility of instruction stream generation.
参见图6所示,本申请实施例公开了一种批处理方法,包括:As shown in FIG. 6, an embodiment of the present application discloses a batch processing method, including:
步骤S60:获取批数据以及指令流,指令流的指令中包含执行标志位。Step S60: Obtain batch data and an instruction stream. The instructions of the instruction stream include an execution flag bit.
步骤S61:在指令流的指令中选取执行标志位对应的状态信息满足可执行标准的目标指令。Step S61: Select the target instruction whose status information corresponding to the execution flag bit meets the executable standard from the instructions of the instruction stream.
步骤S62:判断批数据的批大小是否大于预设值,如果是,则执行步骤S63至步骤S64,否则,执行步骤S65。Step S62: It is judged whether the batch size of the batch data is greater than the preset value, and if so, step S63 to step S64 are executed, otherwise, step S65 is executed.
步骤S63:将批数据划分为批大小小于预设值的批数据组。Step S63: Divide the batch data into batch data groups with a batch size smaller than a preset value.
步骤S64:根据目标指令依次对各批数据组执行批处理操作。Step S64: Perform batch processing operations on each batch of data groups in sequence according to the target instruction.
步骤S65:根据目标指令对批数据执行批处理操作。Step S65: Perform a batch processing operation on the batch data according to the target instruction.
需要说明的是,本实施例在获取到批数据后,进一步判断批数据的批大小是否大于预设值,如果是,则将批数据划分为批大小小于预设值的批数据组,进而根据执行标志位对应的状态信息满足可执行标准的目标指令依次对各批数据组执行批处理操作,其中预设值可以是硬件进行批处理操作时所能承担的最大的批大小。本实施例的重点在于当批数据的批大小大于预设值时,对批数据执行分组批处理,进一步确保了批处理过程的整体可靠性。It should be noted that after obtaining the batch data, this embodiment further determines whether the batch size of the batch data is greater than the preset value. If it is, the batch data is divided into batch data groups with the batch size smaller than the preset value, and then according to The state information corresponding to the execution flag bit satisfies the target instruction of the executable standard to perform batch processing operations on each batch of data groups in turn, where the preset value may be the largest batch size that the hardware can undertake when the batch processing operation is performed. The focus of this embodiment is that when the batch size of the batch data is greater than the preset value, group batch processing is performed on the batch data, which further ensures the overall reliability of the batch processing process.
在上述实施例的基础上,作为一种优选的实施方式,预设值包括指令流的指令数量值。On the basis of the foregoing embodiment, as a preferred implementation manner, the preset value includes the instruction quantity value of the instruction stream.
可以理解的是,由于指令流是针对于硬件设计的指令序列,因此指令流中的指令数量应小于或等于硬件最大承载的指令数量,进而将指令流的指令数量值作为预设值,能够进一步确保批处理过程的整体可靠性。It is understandable that, because the instruction flow is a sequence of instructions designed for hardware, the number of instructions in the instruction flow should be less than or equal to the maximum number of instructions carried by the hardware, and the instruction quantity value of the instruction flow can be used as the preset value. Ensure the overall reliability of the batch process.
为了进一步加深对于本申请技术方案的理解,本申请还提供一种具体应用场景下的场景实施例进行说明。In order to further deepen the understanding of the technical solution of the present application, the present application also provides a scenario embodiment in a specific application scenario for description.
为了使同一指令流支持多种批数据(Batch)的执行,首先需要在硬件上提供一种机制,以由软件控制当前指令是否执行。为此,本申请设计了一种基于条件寄存器的指令集。其特点为,为每条指令添加了一个条件寄存器,当条件寄存器内存储的值为0时,当前指令不执行,当条件寄存器内存储的值非0时,当前指令才会执行。指令结构如表1所示。由于指令长度限制,本申请设计16个条件寄存器(CR0~CR15),其中CR0为特殊条件寄存器,当指令配置为CR0时,不论CR0内存储值是否非0,当前指令都会执行。In order to enable the same instruction stream to support the execution of multiple batches, it is first necessary to provide a mechanism on the hardware to control whether the current instruction is executed by the software. For this reason, this application designs an instruction set based on condition registers. Its characteristic is that a condition register is added for each instruction. When the value stored in the condition register is 0, the current instruction will not be executed. When the value stored in the condition register is not 0, the current instruction will be executed. The instruction structure is shown in Table 1. Due to instruction length limitation, this application designs 16 condition registers (CR0~CR15), among which CR0 is a special condition register. When the instruction is configured as CR0, the current instruction will be executed regardless of whether the value stored in CR0 is non-zero.
条件寄存器序号Condition register number 指令序号Order number 指令参数寄存器列表Instruction parameter register list
4bit4bit 12bit12bit 48bit48bit
表1Table 1
有了支持条件执行的指令,还需要为其设计一组指令,用于条件寄存器赋值。为此,本发明设计了一组条件寄存器比较指令,其详细结构如表2所示。With instructions that support conditional execution, it is also necessary to design a set of instructions for conditional register assignment. To this end, the present invention has designed a group of condition register comparison instructions, the detailed structure of which is shown in Table 2.
Figure PCTCN2020087108-appb-000001
Figure PCTCN2020087108-appb-000001
表2Table 2
条件寄存器比较指令,有三个参数,第一个参数为待赋值的条件寄存器,后两个参数为比较参数,其功能是,比较两个值的大小是否满足条件,并将结果存储到对应条件寄存器中。The condition register comparison instruction has three parameters. The first parameter is the condition register to be assigned, and the last two parameters are comparison parameters. Its function is to compare whether the two values meet the condition and store the result in the corresponding condition register. in.
由于硬件提供的指令条件执行机制比较灵活,为了保证添加动态Batch后,结果的正确性,需要规定一种用于动态Batch支持的条件指令执行控制协议。Since the instruction conditional execution mechanism provided by the hardware is relatively flexible, in order to ensure the correctness of the result after adding dynamic batch, it is necessary to specify a conditional instruction execution control protocol for dynamic batch support.
第一,在整个指令流的最前端生成条件寄存器比较指令。对于指令执行来说,Batch大小是一个全局信息,一旦指定,在整个指令执行的过程中都不会发生变化。为了提高指令执行效率,本发明只在指令流最开始生成条件寄存器比较指令,将结果存储在对应指令寄存器中,并需要软件保证在其他位置不更改条件寄存器的值。First, generate conditional register comparison instructions at the forefront of the entire instruction stream. For instruction execution, the batch size is a global information. Once specified, it will not change during the entire instruction execution process. In order to improve the efficiency of instruction execution, the present invention only generates the condition register comparison instruction at the beginning of the instruction stream, stores the result in the corresponding instruction register, and requires software to ensure that the value of the condition register is not changed in other locations.
第二,使用第一个通用寄存器(R0)作为用户Batch设定寄存器,即 在生成指令的时候,表2中条件寄存器的第二个参数(Reg1)需要配置为R0。软件中向用户暴露通用寄存器R0的读写接口,实现用户对Batch大小的动态配置。用户需要在启动任务之前配置该寄存器的值。Second, use the first general register (R0) as the user batch setting register, that is, when generating instructions, the second parameter (Reg1) of the condition register in Table 2 needs to be configured as R0. The software exposes the read and write interface of the general register R0 to the user to realize the dynamic configuration of the batch size by the user. The user needs to configure the value of this register before starting the task.
第三,按照最大Batch生成指令流,为每个硬件Batch生成一条指令,并按硬件Batch序号配置条件寄存器序号。硬件Batch是指,硬件设计时一条指令处理的Batch大小,通常为1。Third, generate an instruction stream according to the maximum batch, generate an instruction for each hardware batch, and configure the condition register sequence number according to the hardware batch sequence number. Hardware batch refers to the batch size processed by one instruction during hardware design, usually 1.
动态Batch控制协议第三项规定,软件要按照最大Batch生成指令流。为了明确最大Batch的概念,本发明将Batch分为自下而上的硬件Batch、指令Batch和用户Batch。其中用户Batch是指用户实际设定的Batch大小;指令Batch是生成指令时,确定的最大Batch,由条件寄存器的个数决定;硬件Batch是指,硬件设计时一条指令处理的Batch大小,通常为1。所以,用户Batch实际上会先划分为指令Batch,再将指令Batch划分为若干个硬件Batch,最终实现对任意Batch的支持。The third item of the dynamic batch control protocol stipulates that the software must generate an instruction stream in accordance with the maximum batch. In order to clarify the concept of the maximum batch, the present invention divides the batch into a bottom-up hardware batch, an instruction batch, and a user batch. Among them, the user batch refers to the batch size actually set by the user; the instruction batch is the maximum batch determined when the instruction is generated, which is determined by the number of condition registers; the hardware batch refers to the batch size processed by one instruction in the hardware design, usually 1. Therefore, the user batch will actually be divided into instruction batches first, and then the instruction batches will be divided into several hardware batches, and finally support for any batch.
一个硬件Batch为1,指令Batch为4的指令流如图7所示。首先将R0的存储和立即数1~4进行对比,大于等于为真,小于等于为假,并将结果分别存储到条件寄存器CR1~CR4。然后配置Batch1指令的条件寄存器为CR1,Batch2指令条件寄存器为CR2,以此类推。这样就能实现小于等于实际Batch的指令会执行,大于实际Batch的指令不会执行的效果。The instruction flow of a hardware Batch of 1 and instruction Batch of 4 is shown in Figure 7. First, compare the storage of R0 with the immediate numbers 1 to 4, if greater than or equal to true, less than or equal to false, and store the results in the condition registers CR1 to CR4, respectively. Then configure the condition register of the Batch1 instruction as CR1, the condition register of the Batch2 instruction as CR2, and so on. In this way, the effect that instructions less than or equal to the actual batch will be executed, and instructions greater than the actual batch will not be executed.
请参见图8所示,本申请实施例公开了一种批处理装置,包括:As shown in FIG. 8, an embodiment of the present application discloses a batch processing device, including:
获取模块10,用于获取批数据以及指令流,指令流的指令中包含执行标志位;The acquiring module 10 is used to acquire batch data and instruction stream, and the instruction of the instruction stream contains an execution flag bit;
指令选取模块11,用于在指令流的指令中选取执行标志位对应的状态信息满足可执行标准的目标指令;The instruction selection module 11 is used to select the target instruction whose status information corresponding to the execution flag bit meets the executable standard among the instructions of the instruction stream;
指令执行模块12,用于根据目标指令对批数据执行批处理操作。The instruction execution module 12 is used to perform batch processing operations on batch data according to target instructions.
本申请所提供的批处理装置,首先获取批数据以及指令流,指令流的指令中包含执行标志位,进而在指令流的指令中选取执行标志位对应的状态信息满足可执行状态的目标指令,并根据该目标指令对批数据执行批处理操作。本装置是通过在批处理的指令中预设有执行标志位,进而根据指 令中执行标志位所对应的状态信息判定该指令是否为本次批处理操作需要执行的指令,以此确保在指令流的指令数量固定且批数据中的数据条数灵活多变的情况下,指令流中的指令也能够灵活执行,相对避免了运算设备执行未与批数据中的数据对应的多余指令,进而确保了批处理操作的可靠性。The batch processing device provided by the present application first obtains batch data and instruction stream. The instructions of the instruction stream include execution flag bits, and then selects the state information corresponding to the execution flag bits in the instructions of the instruction stream to meet the target instructions of the executable state. And according to the target instruction to perform batch processing operations on the batch data. This device uses the preset execution flag bit in the batch instruction, and then determines whether the instruction needs to be executed for this batch operation according to the status information corresponding to the execution flag bit in the instruction, so as to ensure that the instruction flow When the number of instructions is fixed and the number of data in the batch data is flexible, the instructions in the instruction stream can also be executed flexibly, which relatively avoids the computing device from executing redundant instructions that do not correspond to the data in the batch data, thereby ensuring Reliability of batch operations.
此外,本申请实施例还公开了一种批处理设备,包括:In addition, the embodiment of the present application also discloses a batch processing device, including:
存储器,用于存储计算机程序;Memory, used to store computer programs;
处理器,用于执行计算机程序时实现如上述的批处理方法的步骤。The processor is used to implement the steps of the above-mentioned batch processing method when the computer program is executed.
本申请所提供的批处理设备,首先获取批数据以及指令流,指令流的指令中包含执行标志位,进而在指令流的指令中选取执行标志位对应的状态信息满足可执行状态的目标指令,并根据该目标指令对批数据执行批处理操作。本设备是通过在批处理的指令中预设有执行标志位,进而根据指令中执行标志位所对应的状态信息判定该指令是否为本次批处理操作需要执行的指令,以此确保在指令流的指令数量固定且批数据中的数据条数灵活多变的情况下,指令流中的指令也能够灵活执行,相对避免了运算设备执行未与批数据中的数据对应的多余指令,进而确保了批处理操作的可靠性。The batch processing equipment provided by this application first obtains batch data and instruction stream. The instructions of the instruction stream include execution flag bits, and then selects the state information corresponding to the execution flag bits in the instructions of the instruction stream to meet the target instructions of the executable state. And according to the target instruction to perform batch processing operations on the batch data. This device uses the preset execution flag bit in the batch instruction, and then determines whether the instruction needs to be executed for this batch operation according to the status information corresponding to the execution flag bit in the instruction, so as to ensure that the instruction flow When the number of instructions is fixed and the number of data in the batch data is flexible, the instructions in the instruction stream can also be executed flexibly, which relatively avoids the computing device from executing redundant instructions that do not correspond to the data in the batch data, thereby ensuring Reliability of batch operations.
进一步的,本申请还提供一种计算机可读存储介质,计算机可读存储介质上存储有计算机程序,计算机程序被处理器执行时实现如上述的批处理方法的步骤。Further, the present application also provides a computer-readable storage medium on which a computer program is stored, and when the computer program is executed by a processor, the steps of the batch processing method as described above are realized.
本申请所提供的计算机可读存储介质,首先获取批数据以及指令流,指令流的指令中包含执行标志位,进而在指令流的指令中选取执行标志位对应的状态信息满足可执行状态的目标指令,并根据该目标指令对批数据执行批处理操作。本计算机可读存储介质是通过在批处理的指令中预设有执行标志位,进而根据指令中执行标志位所对应的状态信息判定该指令是否为本次批处理操作需要执行的指令,以此确保在指令流的指令数量固定且批数据中的数据条数灵活多变的情况下,指令流中的指令也能够灵活执 行,相对避免了运算设备执行未与批数据中的数据对应的多余指令,进而确保了批处理操作的可靠性。The computer-readable storage medium provided by this application first obtains batch data and an instruction stream. The instructions of the instruction stream include an execution flag bit, and then selects the state information corresponding to the execution flag bit in the instructions of the instruction stream to meet the target of the executable state Command, and perform batch processing operations on batch data according to the target command. The computer-readable storage medium presets the execution flag bit in the batch instruction, and then determines whether the instruction needs to be executed for this batch operation according to the status information corresponding to the execution flag bit in the instruction. Ensure that when the number of instructions in the instruction stream is fixed and the number of data in the batch data is flexible, the instructions in the instruction stream can also be executed flexibly, relatively avoiding the execution of redundant instructions that do not correspond to the data in the batch data by the computing device , Thereby ensuring the reliability of batch operations.
以上对本申请所提供的一种批处理方法、装置、设备及存储介质进行了详细介绍。说明书中各个实施例采用递进的方式描述,每个实施例重点说明的都是与其他实施例的不同之处,各个实施例之间相同相似部分互相参见即可。对于实施例公开的装置而言,由于其与实施例公开的方法相对应,所以描述的比较简单,相关之处参见方法部分说明即可。应当指出,对于本技术领域的普通技术人员来说,在不脱离本申请原理的前提下,还可以对本申请进行若干改进和修饰,这些改进和修饰也落入本申请权利要求的保护范围内。Above, a batch processing method, device, equipment, and storage medium provided by this application have been introduced in detail. The various embodiments in the specification are described in a progressive manner, and each embodiment focuses on the differences from other embodiments, and the same or similar parts between the various embodiments can be referred to each other. For the device disclosed in the embodiment, since it corresponds to the method disclosed in the embodiment, the description is relatively simple, and the relevant parts can be referred to the description of the method part. It should be pointed out that for those of ordinary skill in the art, without departing from the principles of this application, several improvements and modifications can be made to this application, and these improvements and modifications also fall within the protection scope of the claims of this application.
还需要说明的是,在本说明书中,诸如第一和第二等之类的关系术语仅仅用来将一个实体或者操作与另一个实体或操作区分开来,而不一定要求或者暗示这些实体或操作之间存在任何这种实际的关系或者顺序。而且,术语“包括”、“包含”或者其任何其他变体意在涵盖非排他性的包含,从而使得包括一系列要素的过程、方法、物品或者设备不仅包括那些要素,而且还包括没有明确列出的其他要素,或者是还包括为这种过程、方法、物品或者设备所固有的要素。在没有更多限制的情况下,由语句“包括一个……”限定的要素,并不排除在包括所述要素的过程、方法、物品或者设备中还存在另外的相同要素。It should also be noted that in this specification, relational terms such as first and second are only used to distinguish one entity or operation from another entity or operation, and do not necessarily require or imply these entities or operations. There is any such actual relationship or sequence between operations. Moreover, the terms "include", "include" or any other variants thereof are intended to cover non-exclusive inclusion, so that a process, method, article or device including a series of elements not only includes those elements, but also includes those that are not explicitly listed Other elements of, or also include elements inherent to this process, method, article or equipment. If there are no more restrictions, the element defined by the sentence "including a..." does not exclude the existence of other identical elements in the process, method, article, or equipment that includes the element.

Claims (13)

  1. 一种批处理方法,其特征在于,包括:A batch processing method, characterized in that it comprises:
    获取批数据以及指令流,所述指令流的指令中包含执行标志位;Acquiring batch data and an instruction stream, where the instructions of the instruction stream include an execution flag bit;
    在所述指令流的指令中选取所述执行标志位对应的状态信息满足可执行标准的目标指令;Selecting, from the instructions of the instruction stream, the target instruction whose status information corresponding to the execution flag bit meets the executable standard;
    根据所述目标指令对所述批数据执行批处理操作。Perform a batch processing operation on the batch data according to the target instruction.
  2. 根据权利要求1所述的批处理方法,其特征在于,所述在所述指令流的指令中选取所述执行标志位对应的状态信息满足可执行标准的目标指令,包括:The batch processing method according to claim 1, wherein said selecting from the instructions of the instruction stream the target instruction whose state information corresponding to the execution flag bit meets the executable standard comprises:
    在所述指令的执行标志位中获取寄存器信息,并根据所述寄存器信息读取相应寄存器中的状态信息;Acquiring register information from the execution flag of the instruction, and reading the status information in the corresponding register according to the register information;
    判断所述状态信息是否满足所述可执行标准;Judging whether the status information meets the executable standard;
    如果所述状态信息满足所述可执行标准,则将所述指令设置为所述目标指令。If the status information meets the executable criterion, the instruction is set as the target instruction.
  3. 根据权利要求2所述的批处理方法,其特征在于,所述在所述指令的执行标志位中获取寄存器信息,并根据所述寄存器信息读取相应寄存器中的状态信息,包括:The batch processing method according to claim 2, wherein the obtaining register information from the execution flag of the instruction, and reading the status information in the corresponding register according to the register information, comprises:
    在所述指令的执行标志位中获取寄存器序号信息,并根据所述寄存器序号信息对应的寄存器地址读取相应所述寄存器中的状态数值;Acquiring register serial number information in the execution flag bit of the instruction, and reading the corresponding state value in the register according to the register address corresponding to the register serial number information;
    所述判断所述状态信息是否满足所述可执行标准,包括:The determining whether the status information meets the executable standard includes:
    判断所述状态数值是否等于标准数值;Determine whether the state value is equal to the standard value;
    如果所述状态数值等于所述标准数值,则所述状态信息满足所述可执行标准。If the status value is equal to the standard value, the status information meets the executable standard.
  4. 根据权利要求3所述的批处理方法,其特征在于,在所述根据所述寄存器序号信息对应的寄存器地址读取相应所述寄存器中的状态数值之前,所述方法还包括:The batch processing method according to claim 3, characterized in that, before the reading the state value in the corresponding register according to the register address corresponding to the register serial number information, the method further comprises:
    判断所述寄存器序号信息是否为特殊寄存器的寄存器序号;Judging whether the register serial number information is the register serial number of a special register;
    如果所述寄存器序号信息为所述特殊寄存器的寄存器序号,则执行所述将所述指令设置为所述目标指令的步骤;If the register serial number information is the register serial number of the special register, execute the step of setting the instruction as the target instruction;
    如果所述寄存器序号信息非所述特殊寄存器的寄存器序号,则执行所述根据所述寄存器序号信息对应的寄存器地址读取相应所述寄存器中的状态数值的步骤。If the register serial number information is not the register serial number of the special register, the step of reading the state value in the corresponding register according to the register address corresponding to the register serial number information is performed.
  5. 根据权利要求3所述的批处理方法,其特征在于,所述标准数值包括1或0。The batch processing method according to claim 3, wherein the standard value comprises 1 or 0.
  6. 根据权利要求2所述的批处理方法,其特征在于,所述获取批数据以及指令流,包括:The batch processing method according to claim 2, wherein said obtaining batch data and instruction stream comprises:
    获取所述批数据以及基础指令流,所述基础指令流中包含所述执行标志位的内容为空的基础指令;Acquiring the batch data and a basic instruction stream, where the basic instruction stream includes a basic instruction whose content of the execution flag is empty;
    统计所述批数据的批大小,根据所述批大小对相应数量的目标寄存器设置满足所述可执行标准的所述状态信息;Count the batch size of the batch data, and set the status information that meets the executable standard for a corresponding number of target registers according to the batch size;
    将所述目标寄存器的所述寄存器信息设置于所述基础指令流中与所述目标寄存器唯一对应的目标基础指令的所述执行标志位,以得到所述指令流。The register information of the target register is set in the execution flag bit of the target basic instruction uniquely corresponding to the target register in the basic instruction stream to obtain the instruction stream.
  7. 根据权利要求6所述的批处理方法,其特征在于,所述获取所述批数据以及基础指令流,包括:The batch processing method according to claim 6, wherein the obtaining the batch data and the basic instruction stream comprises:
    获取由用户软件传入的所述批数据以及所述基础指令流;Acquiring the batch data and the basic instruction stream passed in by the user software;
    所述统计所述批数据的批大小,包括:The counting the batch size of the batch data includes:
    通过执行预设指令的方式统计所述批数据的批大小。Count the batch size of the batch data by executing preset instructions.
  8. 根据权利要求1所述的批处理方法,其特征在于,在所述根据所述目标指令对所述批数据执行批处理操作之前,所述方法还包括:The batch processing method according to claim 1, wherein before the batch processing operation is performed on the batch data according to the target instruction, the method further comprises:
    判断所述批数据的批大小是否大于预设值;Judging whether the batch size of the batch data is greater than a preset value;
    如果所述批数据的批大小大于所述预设值,则将所述批数据划分为批大小小于所述预设值的批数据组;If the batch size of the batch data is greater than the preset value, dividing the batch data into batch data groups with a batch size smaller than the preset value;
    根据所述目标指令依次对各所述批数据组执行所述批处理操作;Sequentially execute the batch processing operation on each of the batch data groups according to the target instruction;
    如果所述批数据的批大小小于所述预设值,则执行所述根据所述目标指令对所述批数据执行批处理操作的步骤。If the batch size of the batch data is smaller than the preset value, the step of performing a batch processing operation on the batch data according to the target instruction is executed.
  9. 根据权利要求8所述的批处理方法,其特征在于,所述预设值包括所述指令流的指令数量值。The batch processing method according to claim 8, wherein the preset value includes a value of the instruction quantity of the instruction stream.
  10. 根据权利要求1至9任意一项所述的批处理方法,其特征在于,所述指令流中指令的数量大于或等于所述批数据的批大小。The batch processing method according to any one of claims 1 to 9, wherein the number of instructions in the instruction stream is greater than or equal to the batch size of the batch data.
  11. 一种批处理装置,其特征在于,包括:A batch processing device, characterized in that it comprises:
    获取模块,用于获取批数据以及指令流,所述指令流的指令中包含执行标志位;An acquisition module for acquiring batch data and an instruction stream, and the instructions of the instruction stream include an execution flag bit;
    指令选取模块,用于在所述指令流的指令中选取所述执行标志位对应的状态信息满足可执行标准的目标指令;An instruction selection module, configured to select target instructions whose status information corresponding to the execution flag bit meets the executable standard among the instructions of the instruction stream;
    指令执行模块,用于根据所述目标指令对所述批数据执行批处理操作。The instruction execution module is configured to perform batch processing operations on the batch data according to the target instruction.
  12. 一种批处理设备,其特征在于,包括:A batch processing equipment, characterized in that it comprises:
    存储器,用于存储计算机程序;Memory, used to store computer programs;
    处理器,用于执行所述计算机程序时实现如权利要求1至10任一项所述的批处理方法的步骤。The processor is configured to implement the steps of the batch processing method according to any one of claims 1 to 10 when the computer program is executed.
  13. 一种计算机可读存储介质,其特征在于,所述计算机可读存储介质上存储有计算机程序,所述计算机程序被处理器执行时实现如权利要求1至10任一项所述的批处理方法的步骤。A computer-readable storage medium, wherein a computer program is stored on the computer-readable storage medium, and when the computer program is executed by a processor, the batch processing method according to any one of claims 1 to 10 is realized A step of.
PCT/CN2020/087108 2019-12-12 2020-04-27 Batch processing method, apparatus and device, and storage medium WO2021114548A1 (en)

Applications Claiming Priority (2)

Application Number Priority Date Filing Date Title
CN201911288737.7 2019-12-12
CN201911288737.7A CN111124491B (en) 2019-12-12 2019-12-12 Batch processing method, device, equipment and storage medium

Publications (1)

Publication Number Publication Date
WO2021114548A1 true WO2021114548A1 (en) 2021-06-17

Family

ID=70498843

Family Applications (1)

Application Number Title Priority Date Filing Date
PCT/CN2020/087108 WO2021114548A1 (en) 2019-12-12 2020-04-27 Batch processing method, apparatus and device, and storage medium

Country Status (2)

Country Link
CN (1) CN111124491B (en)
WO (1) WO2021114548A1 (en)

Citations (7)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN1549107A (en) * 2003-05-13 2004-11-24 凌阳科技股份有限公司 Processor for executing conditional instruction and method thereof
JP2009230581A (en) * 2008-03-24 2009-10-08 Nippon Telegr & Teleph Corp <Ntt> Batch job control system, management node, and batch job control method
CN101930358A (en) * 2010-08-16 2010-12-29 中国科学技术大学 Data processing method on single instruction multiple data (SIMD) structure and processor
CN105718243A (en) * 2014-12-01 2016-06-29 金蝶软件(中国)有限公司 Data batch operating method and system in ERP system
CN110147293A (en) * 2019-05-20 2019-08-20 江南大学 A method of reducing microprocessor soft error neurological susceptibility
CN110309214A (en) * 2018-04-10 2019-10-08 腾讯科技(深圳)有限公司 A kind of instruction executing method and its equipment, storage medium, server
CN110335079A (en) * 2019-07-02 2019-10-15 上海上湖信息技术有限公司 A kind of intelligent task dispatching method and device collected based on instruction

Family Cites Families (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN104461943B (en) * 2014-12-29 2017-10-27 成都致云科技有限公司 Method for reading data, device and system
CN109669766A (en) * 2018-09-11 2019-04-23 深圳平安财富宝投资咨询有限公司 Processing method, device, equipment and the storage medium of batch processing job
CN110308946A (en) * 2019-05-21 2019-10-08 深圳壹账通智能科技有限公司 Race batch processing method, equipment, storage medium and device based on artificial intelligence
CN110516789B (en) * 2019-08-09 2022-02-18 苏州浪潮智能科技有限公司 Method and device for processing instruction set in convolutional network accelerator and related equipment

Patent Citations (7)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN1549107A (en) * 2003-05-13 2004-11-24 凌阳科技股份有限公司 Processor for executing conditional instruction and method thereof
JP2009230581A (en) * 2008-03-24 2009-10-08 Nippon Telegr & Teleph Corp <Ntt> Batch job control system, management node, and batch job control method
CN101930358A (en) * 2010-08-16 2010-12-29 中国科学技术大学 Data processing method on single instruction multiple data (SIMD) structure and processor
CN105718243A (en) * 2014-12-01 2016-06-29 金蝶软件(中国)有限公司 Data batch operating method and system in ERP system
CN110309214A (en) * 2018-04-10 2019-10-08 腾讯科技(深圳)有限公司 A kind of instruction executing method and its equipment, storage medium, server
CN110147293A (en) * 2019-05-20 2019-08-20 江南大学 A method of reducing microprocessor soft error neurological susceptibility
CN110335079A (en) * 2019-07-02 2019-10-15 上海上湖信息技术有限公司 A kind of intelligent task dispatching method and device collected based on instruction

Also Published As

Publication number Publication date
CN111124491B (en) 2022-04-22
CN111124491A (en) 2020-05-08

Similar Documents

Publication Publication Date Title
CN105700764A (en) Icon arrangement method and user terminal
WO2018032698A1 (en) Page turning method and device, and writing terminal
US11199997B2 (en) Storage device operations using a die translation table
WO2021114548A1 (en) Batch processing method, apparatus and device, and storage medium
CN111638925A (en) Interface method table generation method, function pointer query method and device
CN104700255B (en) Multi-process processing method, device and system
CN105740073A (en) Method and apparatus for dynamically controlling quantity of operation system processes
WO2019232925A1 (en) Hotspot data migration flow control method and apparatus, and electronic device and storage medium
US20240039863A1 (en) Resource address allocation method, system and apparatus for pci device
CN112000591B (en) SSD scanning method capable of designating logical block address, SSD scanning device, SSD scanning computer equipment and storage medium
CN111045959B (en) Complex algorithm variable mapping method based on storage optimization
WO2020166397A1 (en) Reviewing method, information processing device, and reviewing program
US10175913B2 (en) Link management method and physical device
CN108073594B (en) Method and device for generating thermodynamic diagram
CN111143411A (en) Dynamic streaming pre-calculation method and device and storage medium
TWI746517B (en) Data processing method and device and data table processing method and device
CN112395829B (en) Method and device for adding Chinese numbers to documents and electronic equipment
JP5149115B2 (en) Semiconductor test equipment
US9411837B2 (en) System and method for optimizing memory utilization in a database
CN112783446B (en) Data writing method and system of storage system
CN114020459B (en) FPGA (field programmable Gate array) resource balancing method and device based on packet sending rate, FPGA equipment and medium
CN112417041B (en) Parameter configuration method and device, electronic equipment and storage medium
CN110096555B (en) Table matching processing method and device for distributed system
JP5907558B2 (en) MULTI-INTERVAL TIMER AND ITS CONTROL DEVICE, CONTROL METHOD, AND CONTROL PROGRAM
KR102322593B1 (en) Method, apparatus and electronic device for controlling memory access

Legal Events

Date Code Title Description
121 Ep: the epo has been informed by wipo that ep was designated in this application

Ref document number: 20900048

Country of ref document: EP

Kind code of ref document: A1

NENP Non-entry into the national phase

Ref country code: DE

122 Ep: pct application non-entry in european phase

Ref document number: 20900048

Country of ref document: EP

Kind code of ref document: A1