[go: up one dir, main page]
More Web Proxy on the site http://driver.im/

CN115016848A - Instruction processing method, device, chip, board, device and medium - Google Patents

Instruction processing method, device, chip, board, device and medium Download PDF

Info

Publication number
CN115016848A
CN115016848A CN202210612463.8A CN202210612463A CN115016848A CN 115016848 A CN115016848 A CN 115016848A CN 202210612463 A CN202210612463 A CN 202210612463A CN 115016848 A CN115016848 A CN 115016848A
Authority
CN
China
Prior art keywords
instruction
calculation
computing
cached
merging
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Pending
Application number
CN202210612463.8A
Other languages
Chinese (zh)
Inventor
霍冠廷
王文强
徐宁仪
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Shanghai Power Tensors Intelligent Technology Co Ltd
Original Assignee
Shanghai Power Tensors Intelligent Technology Co Ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Shanghai Power Tensors Intelligent Technology Co Ltd filed Critical Shanghai Power Tensors Intelligent Technology Co Ltd
Priority to CN202210612463.8A priority Critical patent/CN115016848A/en
Publication of CN115016848A publication Critical patent/CN115016848A/en
Pending legal-status Critical Current

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/38Concurrent instruction execution, e.g. pipeline or look ahead
    • G06F9/3836Instruction issuing, e.g. dynamic instruction scheduling or out of order instruction execution
    • 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/30003Arrangements for executing specific machine instructions
    • G06F9/30007Arrangements for executing specific machine instructions to perform operations on data operands
    • 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/3802Instruction prefetching
    • G06F9/3808Instruction prefetching for instruction reuse, e.g. trace cache, branch target cache
    • YGENERAL TAGGING OF NEW TECHNOLOGICAL DEVELOPMENTS; GENERAL TAGGING OF CROSS-SECTIONAL TECHNOLOGIES SPANNING OVER SEVERAL SECTIONS OF THE IPC; TECHNICAL SUBJECTS COVERED BY FORMER USPC CROSS-REFERENCE ART COLLECTIONS [XRACs] AND DIGESTS
    • Y02TECHNOLOGIES OR APPLICATIONS FOR MITIGATION OR ADAPTATION AGAINST CLIMATE CHANGE
    • Y02DCLIMATE CHANGE MITIGATION TECHNOLOGIES IN INFORMATION AND COMMUNICATION TECHNOLOGIES [ICT], I.E. INFORMATION AND COMMUNICATION TECHNOLOGIES AIMING AT THE REDUCTION OF THEIR OWN ENERGY USE
    • Y02D10/00Energy efficient computing, e.g. low power processors, power management or thermal management

Landscapes

  • Engineering & Computer Science (AREA)
  • Software Systems (AREA)
  • Theoretical Computer Science (AREA)
  • Physics & Mathematics (AREA)
  • General Engineering & Computer Science (AREA)
  • General Physics & Mathematics (AREA)
  • Advance Control (AREA)

Abstract

本公开提供了一种指令处理方法、装置、芯片、板卡、设备及介质,其中,该方法包括:获取当前时刻待执行的第一计算指令;在确定出所述第一计算指令为待合并指令的情况下,在缓存空间中查找已缓存计算指令;在确定出查找到的所述已缓存计算指令和所述第一计算指令满足指令合并条件的情况下,将所述第一计算指令和所述已缓存计算指令进行合并处理。

Figure 202210612463

The present disclosure provides an instruction processing method, device, chip, board, device and medium, wherein the method includes: acquiring a first calculation instruction to be executed at the current moment; after determining that the first calculation instruction is to be merged In the case of an instruction, the cached computing instruction is searched in the cache space; when it is determined that the found cached computing instruction and the first computing instruction satisfy the instruction merging condition, the first computing instruction and the first computing instruction are combined. The cached computing instructions are merged.

Figure 202210612463

Description

指令处理方法、装置、芯片、板卡、设备及介质Instruction processing method, device, chip, board, device and medium

技术领域technical field

本公开涉及计算机技术领域,具体而言,涉及一种指令处理方法、装置、芯片、板卡、设备及介质。The present disclosure relates to the field of computer technology, and in particular, to an instruction processing method, device, chip, board, device, and medium.

背景技术Background technique

处理器在处理指令过程中,通常是按照一定的排列顺序执行接收到的指令。指令执行的过程主要包括对处理器中存储空间的访问过程和对数据的计算过程。数据的计算过程需要调用处理的硬件计算装置,在这一过程每个指令中对应计算过程的执行过程需要占用该硬件计算装置的一个时钟周期。如果待处理指令的数量较多,那么现有指令处理过程将影响处理器对指令的处理效率,从而降低处理器的处理性能。In the process of processing instructions, the processor usually executes the received instructions in a certain order. The process of executing the instruction mainly includes the process of accessing the storage space in the processor and the process of calculating the data. The computing process of data needs to call the processing hardware computing device, and the execution process of the corresponding computing process in each instruction in this process needs to occupy one clock cycle of the hardware computing device. If the number of instructions to be processed is large, the existing instruction processing process will affect the processor's processing efficiency of instructions, thereby reducing the processing performance of the processor.

发明内容SUMMARY OF THE INVENTION

本公开实施例至少提供一种指令处理方法、装置、芯片、板卡、设备及介质。Embodiments of the present disclosure at least provide an instruction processing method, apparatus, chip, board, device, and medium.

第一方面,本公开实施例提供了一种指令处理装置,所述指令处理装置包括:指令接收单元和指令合并单元:所述指令接收单元,用于获取当前时刻待执行的第一计算指令;所述指令合并单元,用于在确定出所述第一计算指令为待合并指令的情况下,在缓存空间中查找已缓存计算指令;以及在确定出查找到的所述已缓存计算指令和所述第一计算指令满足指令合并条件的情况下,将所述第一计算指令和所述已缓存计算指令进行合并处理。In a first aspect, an embodiment of the present disclosure provides an instruction processing apparatus, the instruction processing apparatus includes: an instruction receiving unit and an instruction merging unit: the instruction receiving unit is configured to obtain a first calculation instruction to be executed at the current moment; The instruction merging unit is configured to search for a cached calculation instruction in the cache space when it is determined that the first calculation instruction is an instruction to be merged; and when it is determined that the found cached calculation instruction and all When the first calculation instruction satisfies the instruction merging condition, the first calculation instruction and the cached calculation instruction are merged.

一种可选的实施方式中,所述指令合并单元,还用于:确定所述第一计算指令的指令识别标识,其中,所述指令识别标识用于指示所述第一计算指令是否为待合并指令;在确定所述指令识别标识的标识内容为目标内容的情况下,确定所述第一计算指令为所述待合并指令。In an optional implementation manner, the instruction merging unit is further configured to: determine an instruction identification of the first calculation instruction, wherein the instruction identification is used to indicate whether the first calculation instruction is to be Merge instruction; in the case that the identification content of the instruction identification identifier is determined as the target content, determine that the first calculation instruction is the instruction to be merged.

一种可选的实施方式中,所述指令合并单元,还用于:基于预先设置的合并策略确定所述已缓存计算指令与所述第一计算指令是否满足所述指令合并条件;其中,所述指令合并条件为与所述指令合并策略相关联的条件。In an optional implementation manner, the instruction merging unit is further configured to: determine, based on a preset merging strategy, whether the cached computing instruction and the first computing instruction satisfy the instruction merging condition; wherein the The instruction merging condition is a condition associated with the instruction merging strategy.

一种可选的实施方式中,所述指令合并单元,还用于:在所述合并策略为第一策略的情况下,获取所述已缓存计算指令的指令属性信息,得到第一信息,并获取所述第一计算指令的指令属性信息,得到第二信息;其中,所述第一策略用于指示基于指令属性信息进行计算指令的合并;确定所述第一信息和所述第二信息之间的信息匹配度;在所述信息匹配度满足预设匹配度要求的情况下,确定所述已缓存计算指令和第一计算指令满足所述指令合并条件。In an optional implementation manner, the instruction merging unit is further configured to: in the case that the merging strategy is the first strategy, obtain the instruction attribute information of the cached computing instruction, obtain the first information, and Obtain the instruction attribute information of the first calculation instruction, and obtain the second information; wherein, the first strategy is used to instruct the combination of calculation instructions based on the instruction attribute information; determine the first information and the second information. The information matching degree between them is determined; if the information matching degree satisfies the preset matching degree requirement, it is determined that the cached computing instruction and the first computing instruction satisfy the instruction merging condition.

一种可选的实施方式中,所述第一信息包含多个第一子信息,所述第二信息包含多个第二子信息;所述指令合并单元,还用于:分别确定对应属性信息的第一子信息和第二子信息的子匹配度值,得到多个子匹配度值;基于所述多个子匹配度值确定所述第一信息和所述第二信息之间的信息匹配度;所述属性信息包括:指令通道数量、指令计算类型和指令数据类型。In an optional implementation manner, the first information includes a plurality of first sub-information, and the second information includes a plurality of second sub-information; the instruction merging unit is further configured to: respectively determine corresponding attribute information The sub-matching degree values of the first sub-information and the second sub-information are obtained, and a plurality of sub-matching degree values are obtained; the information matching degree between the first information and the second information is determined based on the plurality of sub-matching degree values; The attribute information includes: the number of instruction channels, the instruction calculation type, and the instruction data type.

一种可选的实施方式中,所述指令合并单元,还用于:在所述合并策略为第二策略的情况下,确定所述缓存空间的剩余缓存空间;其中,所述第二策略用于指示基于缓存空间中剩余空间大小进行计算指令的合并;在确定所述剩余缓存空间不满足所述第一计算指令的缓存要求的情况下,确定所述已缓存计算指令和所述第一计算指令满足指令合并条件。In an optional implementation manner, the instruction merging unit is further configured to: in the case that the merging strategy is the second strategy, determine the remaining cache space of the cache space; wherein, the second strategy uses Instructing to combine calculation instructions based on the size of the remaining space in the cache space; in the case that it is determined that the remaining cache space does not meet the cache requirements of the first calculation instruction, determine that the cached calculation instruction and the first calculation instruction The instruction satisfies the instruction merging condition.

一种可选的实施方式中,所述指令合并单元,还用于:在所述合并策略为第三策略的情况下,获取所述缓存空间中已缓存计算指令的指令数量;其中,所述第三策略用于指示基于预设指令数量进行计算指令的合并;在确定所述指令数量信息满足指令数量要求的情况下,确定所述已缓存计算指令和所述第一计算指令满足指令合并条件。In an optional implementation manner, the instruction merging unit is further configured to: when the merging strategy is the third strategy, obtain the instruction quantity of the cached computing instructions in the cache space; wherein, the The third strategy is used to instruct the combination of computing instructions based on the preset number of instructions; if it is determined that the information on the number of instructions satisfies the requirement of the number of instructions, it is determined that the cached computing instruction and the first computing instruction satisfy the instruction merging condition .

一种可选的实施方式中,所述指令处理装置还包括:指令调度单元;所述指令合并单元,用于对所述已缓存计算指令和所述第一计算指令进行合并,得到目标计算指令;所述指令调度单元,用于接收所述指令合并单元发送的所述目标计算指令,并将所述目标计算指令发送到计算装置中进行计算处理。In an optional implementation manner, the instruction processing apparatus further includes: an instruction scheduling unit; and the instruction merging unit, configured to merge the cached computing instruction and the first computing instruction to obtain a target computing instruction ; the instruction scheduling unit is configured to receive the target computing instruction sent by the instruction merging unit, and send the target computing instruction to a computing device for computing processing.

一种可选的实施方式中,所述指令合并单元,还用于:确定所述第一计算指令和/或所述已缓存计算指令的指令计算类型;在基于所述指令计算类型确定所述第一计算指令和所述已缓存计算指令的指令合并模式为第一合并模式的情况下,将所述已缓存计算指令和所述第一计算指令进行合并,得到所述目标计算指令。In an optional implementation manner, the instruction merging unit is further configured to: determine the instruction calculation type of the first calculation instruction and/or the cached calculation instruction; When the instruction merging mode of the first calculation instruction and the cached calculation instruction is the first merge mode, the cached calculation instruction and the first calculation instruction are merged to obtain the target calculation instruction.

一种可选的实施方式中,所述指令合并单元,还用于:在基于所述指令计算类型确定所述第一计算指令和所述已缓存计算指令的指令合并模式为第二合并模式的情况下,向所述指令调度单元发送目标控制指令;所述指令调度单元,用于在接收到所述目标控制指令之后,在同一个指令发射周期内将所述第一计算指令和所述已缓存计算指令发送到计算装置中进行计算处理。In an optional implementation manner, the instruction merging unit is further configured to: determine, based on the instruction calculation type, that the instruction merging mode of the first calculation instruction and the cached calculation instruction is the second merge mode. In this case, send a target control instruction to the instruction scheduling unit; the instruction scheduling unit is configured to, after receiving the target control instruction, send the first calculation instruction and the The cache calculation instruction is sent to the calculation device for calculation processing.

一种可选的实施方式中,所述指令处理装置还包括:指令调度单元;所述指令调度单元,还用于在确定出查找到所述已缓存计算指令和所述第一计算指令不满足所述指令合并条件的情况下,将所述已缓存计算指令发送至计算装置进行处理,并将所述第一计算指令缓存至所述缓存空间。In an optional implementation manner, the instruction processing apparatus further includes: an instruction scheduling unit; the instruction scheduling unit is further configured to find that the cached computing instruction and the first computing instruction are not satisfied In the case of the instruction merging condition, the cached computing instruction is sent to the computing device for processing, and the first computing instruction is cached in the cache space.

第二方面,本公开实施例还提供一种指令处理方法,包括:获取当前时刻待执行的第一计算指令;在确定出所述第一计算指令为待合并指令的情况下,在缓存空间中查找已缓存计算指令;在确定出查找到的所述已缓存计算指令和所述第一计算指令满足指令合并条件的情况下,将所述第一计算指令和所述已缓存计算指令进行合并处理。In a second aspect, an embodiment of the present disclosure further provides an instruction processing method, including: acquiring a first calculation instruction to be executed at the current moment; and in the case of determining that the first calculation instruction is an instruction to be merged, in a cache space Find the cached computing instruction; in the case that it is determined that the found cached computing instruction and the first computing instruction satisfy the instruction merging condition, combine the first computing instruction and the cached computing instruction .

第三方面,本公开实施例还提供一种芯片,包括:指令分发装置、指令处理装置和计算装置;所述指令分发装置,用于向所述指令处理装置分发当前时刻待执行的第一计算指令;所述指令处理装置,用于获取当前时刻待执行的第一计算指令;在确定出所述第一计算指令为待合并指令的情况下,在缓存空间中查找已缓存计算指令;在确定出查找到的所述已缓存计算指令和所述第一计算指令满足指令合并条件的情况下,将所述第一计算指令和所述已缓存计算指令进行合并处理,得到目标计算指令;所述计算装置,用于获取用于执行所述目标计算指令的操作数,并基于所述操作数执行所述目标计算指令。In a third aspect, an embodiment of the present disclosure further provides a chip, including: an instruction distribution apparatus, an instruction processing apparatus, and a computing apparatus; the instruction distribution apparatus is configured to distribute to the instruction processing apparatus a first calculation to be executed at the current moment instruction; the instruction processing device is used to obtain the first calculation instruction to be executed at the current moment; when it is determined that the first calculation instruction is the instruction to be merged, the cached calculation instruction is searched in the cache space; Under the condition that the found cached calculation instruction and the first calculation instruction satisfy the instruction merging condition, the first calculation instruction and the cached calculation instruction are merged to obtain a target calculation instruction; the A computing device, configured to obtain operands for executing the target computing instruction, and execute the target computing instruction based on the operands.

第四方面,本公开实施例还提供一种板卡,其特征在于,包括:封装有至少一个如第三方面所述芯片的封装结构。In a fourth aspect, an embodiment of the present disclosure further provides a board, which is characterized by comprising: a package structure encapsulating at least one chip according to the third aspect.

第五方面,本公开实施例还提供一种计算机设备,包括如第三方面所述的芯片,或者如第四方面所述的板卡。In a fifth aspect, an embodiment of the present disclosure further provides a computer device, including the chip as described in the third aspect, or the board as described in the fourth aspect.

第六方面,本公开实施例还提供一种计算机可读存储介质,该计算机可读存储介质上存储有计算机程序,该计算机程序被处理器运行时执行上述第一方面,或第一方面中任一种可能的实施方式中的步骤。In a sixth aspect, an embodiment of the present disclosure further provides a computer-readable storage medium, where a computer program is stored on the computer-readable storage medium, and the computer program is executed by a processor to execute the first aspect, or any one of the first aspect. steps in one possible implementation.

为使本公开的上述目的、特征和优点能更明显易懂,下文特举较佳实施例,并配合所附附图,作详细说明如下。In order to make the above-mentioned objects, features and advantages of the present disclosure more obvious and easy to understand, the preferred embodiments are exemplified below, and are described in detail as follows in conjunction with the accompanying drawings.

附图说明Description of drawings

为了更清楚地说明本公开实施例的技术方案,下面将对实施例中所需要使用的附图作简单地介绍,此处的附图被并入说明书中并构成本说明书中的一部分,这些附图示出了符合本公开的实施例,并与说明书一起用于说明本公开的技术方案。应当理解,以下附图仅示出了本公开的某些实施例,因此不应被看作是对范围的限定,对于本领域普通技术人员来讲,在不付出创造性劳动的前提下,还可以根据这些附图获得其他相关的附图。In order to explain the technical solutions of the embodiments of the present disclosure more clearly, the following briefly introduces the accompanying drawings required in the embodiments, which are incorporated into the specification and constitute a part of the specification. The drawings illustrate embodiments consistent with the present disclosure, and together with the description serve to explain the technical solutions of the present disclosure. It should be understood that the following drawings only show some embodiments of the present disclosure, and therefore should not be regarded as limiting the scope. Other related figures are obtained from these figures.

图1示出了本公开实施例所提供的一种指令处理方法的流程图;FIG. 1 shows a flowchart of an instruction processing method provided by an embodiment of the present disclosure;

图2示出了本公开实施例所提供的指令处理装置的示意图;FIG. 2 shows a schematic diagram of an instruction processing apparatus provided by an embodiment of the present disclosure;

图3示出了本公开实施例所提供的一种芯片的结构示意图;FIG. 3 shows a schematic structural diagram of a chip provided by an embodiment of the present disclosure;

图4示出了本公开实施例所提供的一种指令处理装置的示意图;FIG. 4 shows a schematic diagram of an instruction processing apparatus provided by an embodiment of the present disclosure;

图5示出了本公开实施例所提供的一种芯片的示意图;FIG. 5 shows a schematic diagram of a chip provided by an embodiment of the present disclosure;

图6示出了本公开实施例所提供的一种板卡的示意图。FIG. 6 shows a schematic diagram of a board provided by an embodiment of the present disclosure.

具体实施方式Detailed ways

为使本公开实施例的目的、技术方案和优点更加清楚,下面将结合本公开实施例中附图,对本公开实施例中的技术方案进行清楚、完整地描述,显然,所描述的实施例仅仅是本公开一部分实施例,而不是全部的实施例。通常在此处附图中描述和示出的本公开实施例的组件可以以各种不同的配置来布置和设计。因此,以下对在附图中提供的本公开的实施例的详细描述并非旨在限制要求保护的本公开的范围,而是仅仅表示本公开的选定实施例。基于本公开的实施例,本领域技术人员在没有做出创造性劳动的前提下所获得的所有其他实施例,都属于本公开保护的范围。In order to make the purposes, technical solutions and advantages of the embodiments of the present disclosure more clear, the technical solutions in the embodiments of the present disclosure will be clearly and completely described below with reference to the accompanying drawings in the embodiments of the present disclosure. Obviously, the described embodiments are only These are some, but not all, embodiments of the present disclosure. The components of the disclosed embodiments generally described and illustrated in the drawings herein may be arranged and designed in a variety of different configurations. Therefore, the following detailed description of the embodiments of the disclosure provided in the accompanying drawings is not intended to limit the scope of the disclosure as claimed, but is merely representative of selected embodiments of the disclosure. Based on the embodiments of the present disclosure, all other embodiments obtained by those skilled in the art without creative work fall within the protection scope of the present disclosure.

应注意到:相似的标号和字母在下面的附图中表示类似项,因此,一旦某一项在一个附图中被定义,则在随后的附图中不需要对其进行进一步定义和解释。It should be noted that like numerals and letters refer to like items in the following figures, so once an item is defined in one figure, it does not require further definition and explanation in subsequent figures.

本文中术语“和/或”,仅仅是描述一种关联关系,表示可以存在三种关系,例如,A和/或B,可以表示:单独存在A,同时存在A和B,单独存在B这三种情况。另外,本文中术语“至少一种”表示多种中的任意一种或多种中的至少两种的任意组合,例如,包括A、B、C中的至少一种,可以表示包括从A、B和C构成的集合中选择的任意一个或多个元素。The term "and/or" in this paper only describes an association relationship, which means that there can be three kinds of relationships, for example, A and/or B, which can mean: the existence of A alone, the existence of A and B at the same time, the existence of B alone. a situation. In addition, the term "at least one" herein refers to any combination of any one of the plurality or at least two of the plurality, for example, including at least one of A, B, and C, and may mean including from A, B, and C. Any one or more elements selected from the set of B and C.

经研究发现,相关技术中,数据的计算过程需要调用处理的硬件计算装置,在这一过程每个指令中对应计算过程的执行过程需要占用该硬件计算装置的一个时钟周期。如果待处理指令的数量较多,那么现有指令处理过程将影响处理器对指令的处理效率,从而降低处理器的处理性能。基于此,发明人发现可以将全部指令中的部分指令合并起来进行处理,以提高计算装置对于数据的吞吐率,进而提高处理器的性能。这里,将部分指令合并起来处理可以理解为通过占用同一个时钟周期来对该部分指令进行处理,从而提高处理器的处理效率和处理器的处理性能,进而缩短处理器对指令的处理时间。Through research, it is found that in the related art, the calculation process of data needs to call a hardware computing device for processing, and the execution process of the corresponding calculation process in each instruction in this process needs to occupy one clock cycle of the hardware computing device. If the number of instructions to be processed is large, the existing instruction processing process will affect the processor's processing efficiency of instructions, thereby reducing the processing performance of the processor. Based on this, the inventor found that some of the instructions in all the instructions can be combined for processing, so as to improve the throughput rate of the computing device for data, thereby improving the performance of the processor. Here, combining and processing part of the instructions can be understood as processing the part of the instructions by occupying the same clock cycle, thereby improving the processing efficiency and processing performance of the processor, thereby shortening the processing time of the processor for the instructions.

发明人发现,在对指令进行合并的过程中,可以通过编程人员在程序中设定待合并的指令,并通过预先编写的程序对待合并的指令进行合并。然而,发明人发现,该指令合并方式具有一定的局限性,例如,如果合并条件过多,则会导致编程人员所编写的程序过于复杂,增加了程序出现漏洞或者缺陷的概率,从而导致指令合并结果的准确性不理想。The inventor found that in the process of merging the instructions, the instructions to be merged can be set in the program by the programmer, and the instructions to be merged can be merged through the pre-written program. However, the inventor found that this instruction merging method has certain limitations. For example, if there are too many merging conditions, the program written by the programmer will be too complicated, which increases the probability of loopholes or defects in the program, thus leading to instruction merging. The accuracy of the results is not ideal.

基于上述研究,本公开提供了一种指令处理方法、装置、芯片、板卡、设备及介质。在本公开实施例中,首先,可以获取当前时刻待执行的第一计算指令,在确定出该第一计算指令为待合并计算指令之后,可以在缓存空间中查找已缓存的计算指令,并在确定出该已缓存计算指令和该第一计算指令满足指令合并条件的情况下,将该第一计算指令和已缓存计算指令进行合并处理,并对合并之后的指令进行处理。通过上述处理方式,可以实现将满足指令合并条件的计算指令进行自动合并,以通过处理器对合并后的指令进行处理,从而可以提高处理器的处理效率,加快处理器对指令的处理速度。Based on the above research, the present disclosure provides an instruction processing method, device, chip, board, device and medium. In the embodiment of the present disclosure, first, the first calculation instruction to be executed at the current moment may be obtained, and after it is determined that the first calculation instruction is the calculation instruction to be merged, the cached calculation instruction may be searched in the cache space, and stored in the cache space. When it is determined that the cached calculation instruction and the first calculation instruction satisfy the instruction merging condition, the first calculation instruction and the cached calculation instruction are merged, and the merged instruction is processed. Through the above processing method, the calculation instructions satisfying the instruction combining condition can be automatically combined, so that the combined instructions can be processed by the processor, so that the processing efficiency of the processor can be improved, and the processing speed of the instructions by the processor can be accelerated.

为便于对本实施例进行理解,首先对本公开实施例所公开的一种指令处理方法进行详细介绍,本公开实施例所提供的指令处理方法的执行主体一般为具有一定计算能力的计算机设备,该计算机设备例如包括:终端设备或服务器或其它处理设备,该指令处理方法可以通过处理器调用存储器中存储的计算机可读指令的方式来实现。In order to facilitate the understanding of this embodiment, an instruction processing method disclosed in the embodiment of the present disclosure is first introduced in detail. The device includes, for example, a terminal device or a server or other processing device, and the instruction processing method can be implemented by the processor calling computer-readable instructions stored in the memory.

参见图1所示,为本公开实施例提供的一种指令处理方法的流程图,所述方法包括步骤S101~S105,该步骤S101~S105所描述的过程可以应用于指令处理装置,其中,该指令处理装置为芯片的处理器中的装置,该芯片为上述计算机设备中的芯片,具体地:Referring to FIG. 1 , which is a flowchart of an instruction processing method provided by an embodiment of the present disclosure, the method includes steps S101 to S105 , and the processes described in the steps S101 to S105 may be applied to an instruction processing apparatus, wherein the The instruction processing device is a device in a processor of a chip, and the chip is a chip in the above-mentioned computer equipment, specifically:

S101:获取当前时刻待执行的第一计算指令。S101: Acquire a first calculation instruction to be executed at the current moment.

在本公开实施例中,处理器的指令处理装置可以接收处理器中指令分发装置分发的待执行指令(即,上述第一计算指令)。这里,该第一计算指令可以为任意一种计算指令,例如,可以为macc指令,即乘累加指令。例如,该macc指令可以为:macc1(a0,b0),其中,a0和b0为寄存器标识。其中,该寄存器标识可以理解为存储用于执行该第一计算指令macc1的操作数的寄存器。In the embodiment of the present disclosure, the instruction processing apparatus of the processor may receive the instruction to be executed (ie, the above-mentioned first calculation instruction) distributed by the instruction distribution apparatus in the processor. Here, the first calculation instruction may be any calculation instruction, for example, may be a macc instruction, that is, a multiply-accumulate instruction. For example, the macc instruction may be: macc1(a0,b0), where a0 and b0 are register identifiers. Wherein, the register identifier can be understood as a register for storing the operand for executing the first calculation instruction macc1.

S103:在确定出所述第一计算指令为待合并指令的情况下,在缓存空间中查找已缓存计算指令。这里,已缓存计算指令为在接收到所述第一计算指令之前缓存至所述缓存空间中的待合并计算指令。S103: In a case where it is determined that the first calculation instruction is an instruction to be merged, search for a cached calculation instruction in the cache space. Here, the cached calculation instruction is a calculation instruction to be merged that is cached in the cache space before the first calculation instruction is received.

在本公开实施例中,在获取到上述第一计算指令后,可以获取第一计算指令的指令属性信息,从而基于该第一计算指令的指令属性信息确定该第一计算指令是否为能够合并的指令,并在确定该第一计算指令为能够合并的指令的情况下,将该第一计算指令确定为待合并指令。In the embodiment of the present disclosure, after the above-mentioned first calculation instruction is obtained, the instruction attribute information of the first calculation instruction may be obtained, so as to determine whether the first calculation instruction is mergeable based on the instruction attribute information of the first calculation instruction instruction, and when it is determined that the first calculation instruction is an instruction that can be combined, the first calculation instruction is determined as an instruction to be combined.

这里,指令属性信息可以用于指示以下至少之一:指令计算类型、指令所占用指令发送通道的数量、该指令所对应操作数的数据类型。Here, the instruction attribute information may be used to indicate at least one of the following: the instruction calculation type, the number of instruction sending channels occupied by the instruction, and the data type of the operand corresponding to the instruction.

例如,数据类型可以包含二进制数据、八进制数据、十进制数据、十六进制数据等。指令计算类型可以用于表示第一计算指令的运算策略,例如点积计算,加减乘除运算等。指令所占用指令发送通道的数量可以理解为指令处理装置向计算装置发送该第一计算指令的过程中,该第一计算指令所占用的指令发送通道的数量。这里,计算装置可以理解为处理器中执行该第一计算指令的单元。For example, data types may contain binary data, octal data, decimal data, hexadecimal data, and the like. The instruction calculation type can be used to represent the operation strategy of the first calculation instruction, such as dot product calculation, addition, subtraction, multiplication and division. The number of instruction sending channels occupied by an instruction may be understood as the number of instruction sending channels occupied by the first computing instruction in the process of sending the first computing instruction to the computing device by the instruction processing apparatus. Here, the computing device may be understood as a unit in the processor that executes the first computing instruction.

以指令属性信息为指令所占用指令发送通道的数量为例,在指令处理装置获取到第一计算指令后,可以通过指令处理装置和计算装置之间预先设定的指令发送通道将该指令发送至计算装置,以使该计算装置对获取到的第一计算指令进行数据处理。如果指令处理装置在向该计算装置发送第一计算指令的过程中,所占用的指令发送通道的通道数量小于上述预先设定的指令发送通道的通道数量。此时,如果选择将第一计算指令在一个时钟周期将该第一计算指令发送至计算装置中进行处理,将浪费大量的资源。Taking the instruction attribute information as the number of instruction sending channels occupied by the instruction as an example, after the instruction processing device obtains the first calculation instruction, it can send the instruction to the instruction sending channel preset between the instruction processing device and the computing device. A computing device, so that the computing device performs data processing on the acquired first computing instruction. If the instruction processing apparatus sends the first calculation instruction to the computing apparatus, the number of channels of the instruction sending channel occupied is less than the number of channels of the above preset instruction sending channel. At this time, if the first calculation instruction is selected to be sent to the computing device for processing in one clock cycle, a large amount of resources will be wasted.

假设,上述预先设定的指令发送通道数量为8个通道,且该第一计算指令所占用的指令发送通道的数量为4个通道,此时,可以确定第一计算指令所占用的指令发送通道的数量小于预先设定的指令发送通道数量。此时,为了节省处理器的资源,可以将该第一计算指令与其他计算指令进行合并之后再发送至计算装置,此时,可以确定该第一计算指令为待合并指令。Assuming that the above preset number of command sending channels is 8 channels, and the number of command sending channels occupied by the first calculation command is 4 channels, at this time, the command sending channel occupied by the first calculation command can be determined The number is less than the preset number of command sending channels. At this time, in order to save the resources of the processor, the first calculation instruction may be combined with other calculation instructions before being sent to the computing device. At this time, it may be determined that the first calculation instruction is an instruction to be combined.

以指令属性信息为指令计算类型为例。假设,预先设定的能够合并的指令的指令计算类型为点积计算。在指令接收单元在接收到第一计算指令后,可以获取第一计算指令的指令计算类型,如果该指令计算类型为点积计算,那么该第一计算指令为能够合并的指令,此时,可以确定该第一计算指令为待合并指令。Take the instruction attribute information as the instruction calculation type as an example. It is assumed that the command calculation type of the preset commands that can be combined is dot product calculation. After the instruction receiving unit receives the first calculation instruction, it can obtain the instruction calculation type of the first calculation instruction. If the instruction calculation type is dot product calculation, then the first calculation instruction is an instruction that can be combined. It is determined that the first calculation instruction is an instruction to be combined.

以指令属性信息为数据类型为例。假设,预先设定的能够合并的指令的数据类型为二进制数据。在指令接收单元在接收到第一计算指令后,可以获取第一计算指令的数据类型,如果该数据类型为二进制数据,那么该第一计算指令为能够合并的指令,此时,可以确定该第一计算指令为待合并指令。Take the instruction attribute information as the data type as an example. It is assumed that the data type of the pre-set mergeable instructions is binary data. After the instruction receiving unit receives the first calculation instruction, it can obtain the data type of the first calculation instruction. If the data type is binary data, then the first calculation instruction is an instruction that can be combined. At this time, the first calculation instruction can be determined. A calculation instruction is an instruction to be combined.

在确定第一计算指令为待合并指令之后,可以在处理器的缓存空间中查找已缓存计算指令。这里,查找到的已缓存计算指令的指令数量可以为一个,还可以为多个。After it is determined that the first computing instruction is the instruction to be merged, the cached computing instruction may be searched in the cache space of the processor. Here, the number of the found cached computing instructions may be one or more.

S105:在确定出查找到的所述已缓存计算指令和所述第一计算指令满足指令合并条件的情况下,将所述第一计算指令和所述已缓存计算指令进行合并处理。S105: If it is determined that the found cached calculation instruction and the first calculation instruction satisfy an instruction merging condition, perform a merge process on the first calculation instruction and the cached calculation instruction.

在缓存空间中查找到已缓存计算指令的情况下,可以确定该已缓存计算指令和第一计算指令是否满足指令合并条件。When a cached calculation instruction is found in the cache space, it can be determined whether the cached calculation instruction and the first calculation instruction satisfy the instruction merging condition.

这里,可以确定已缓存计算指令和第一计算指令的合并策略,并基于合并策略确定所述已缓存计算指令与所述第一计算指令是否满足所述指令合并条件;其中,所述指令合并条件为与所述指令合并策略相关联的条件。Here, a merging strategy of the cached computing instruction and the first computing instruction may be determined, and based on the merging strategy, it is determined whether the cached computing instruction and the first computing instruction satisfy the instruction merging condition; wherein, the instruction merging condition is a condition associated with the instruction merging strategy.

其中,合并策略可以用于指示基于指令属性信息对已缓存计算指令和第一计算指令进行合并;或者,用于指示基于缓存空间中剩余空间大小对已缓存计算指令和第一计算指令进行合并;或者,用于指示基于预设指令数量对已缓存计算指令和第一计算指令进行合并。可以理解的是,不同合并策略所对应的指令合并条件不相同。Wherein, the merging strategy may be used to instruct to merge the cached computing instruction and the first computing instruction based on the instruction attribute information; or, to instruct to merge the cached computing instruction and the first computing instruction based on the size of the remaining space in the cache space; Or, it is used to instruct to combine the cached computing instruction and the first computing instruction based on a preset number of instructions. It can be understood that the command merging conditions corresponding to different merging strategies are different.

如果合并策略用于指示基于指令属性信息对已缓存计算指令和第一计算指令进行合并,那么可以基于已缓存计算指令的指令属性信息以及第一计算指令的指令属性信息确定,已缓存计算指令与第一计算指令是否满足指令合并条件。If the merging policy is used to instruct to merge the cached computing instruction and the first computing instruction based on the instruction attribute information, then it may be determined based on the instruction attribute information of the cached computing instruction and the instruction attribute information of the first computing instruction that the cached computing instruction is the same as the first computing instruction. Whether the first calculation instruction satisfies the instruction merging condition.

延续上例,在上述预先设定的指令发送通道的通道数量为8个通道的情况下,可以分别基于已缓存计算指令和第一计算指令的指令属性信息,确定该已缓存计算指令和第一计算指令所占用的指令发送通道的通道数量和是否小于或者等于预先设定的指令发送通道的通道数量。在确定出是的情况下,可以确定该已缓存计算指令和第一计算指令满足指令合并条件。Continuing the above example, in the case where the number of channels of the above preset command sending channel is 8 channels, the cached computing instruction and the first computing instruction can be determined based on the instruction attribute information of the cached computing instruction and the first computing instruction respectively. Calculate whether the channel number of the command sending channel occupied by the command and whether it is less than or equal to the preset channel number of the command sending channel. If yes, it may be determined that the cached computing instruction and the first computing instruction satisfy the instruction merging condition.

具体的,假设指令处理装置在向计算装置发送已缓存计算指令时,所占用的指令发送通道的通道数量为4个,指令处理装置在向计算装置发送第一计算指令时,所占用的指令发送通道的通道数量为4个,那么,该已缓存计算指令和第一计算指令所占用的通道数和为8个通道。此时,可以确定该已缓存计算指令和第一计算指令满足指令合并条件。接下来,可以对该第一计算指令和已缓存计算指令进行合并处理。Specifically, it is assumed that when the instruction processing apparatus sends the cached calculation instruction to the computing apparatus, the number of channels occupied by the instruction sending channel is 4, and when the instruction processing apparatus sends the first calculation instruction to the computing apparatus, the occupied instruction sending channel The number of channels of the channel is 4, then, the sum of the number of channels occupied by the cached calculation instruction and the first calculation instruction is 8 channels. At this time, it can be determined that the cached computing instruction and the first computing instruction satisfy the instruction merging condition. Next, the first calculation instruction and the cached calculation instruction may be merged.

如果合并策略用于指示基于缓存空间中剩余空间大小对已缓存计算指令和第一计算指令进行合并,那么可以基于剩余空间大小确定已缓存计算指令和第一计算指令是否满足指令合并条件。If the merging policy is used to instruct to merge the cached computing instruction and the first computing instruction based on the size of the remaining space in the cache space, it may be determined whether the cached computing instruction and the first computing instruction satisfy the instruction merging condition based on the size of the remaining space.

如果合并策略用于指示基于预设指令数量进行计算指令的合并,那么可以基于已缓存计算指令的指令数量和第一计算指令的指令数量,确定已缓存计算指令和第一计算指令是否满足指令合并条件。If the merging policy is used to instruct the merging of computing instructions based on the preset number of instructions, then it may be determined whether the cached computing instruction and the first computing instruction satisfy instruction merging based on the number of instructions of the cached computing instruction and the number of instructions of the first computing instruction condition.

通过上述描述可知,可以实现将满足指令合并条件的计算指令进行自动合并,以通过处理器对合并后的指令进行处理,从而可以提高处理器的处理效率,加快处理器对指令的处理速度。It can be seen from the above description that the calculation instructions satisfying the instruction merging condition can be automatically merged, so that the combined instructions can be processed by the processor, thereby improving the processing efficiency of the processor and speeding up the processing speed of the processor on the instructions.

在一个可选的实施方式中,上述步骤S103,确定出所述第一计算指令为待合并指令,具体包括如下过程:In an optional implementation manner, in the above step S103, it is determined that the first calculation instruction is an instruction to be combined, which specifically includes the following process:

S1031:确定所述第一计算指令的指令识别标识,其中,所述指令识别标识用于指示所述第一计算指令是否为待合并指令。S1031: Determine an instruction identification identifier of the first calculation instruction, where the instruction identification identifier is used to indicate whether the first calculation instruction is an instruction to be combined.

S1032:在确定所述指令识别标识的标识内容为目标内容的情况下,确定所述第一计算指令为所述待合并指令。S1032: In the case that the identification content of the instruction identification identifier is determined to be the target content, determine that the first calculation instruction is the instruction to be merged.

在本公开实施例中,可以预先设置先决合并条件和后置合并条件,其中,该先决合并条件用于确定第一计算指令是否为待合并指令,后置合并条件用于确定第一计算指令和查找到的已缓存计算指令是否能够进行合并,也即,上述指令合并条件可以为上述后置合并条件。In the embodiment of the present disclosure, a pre-combination condition and a post-combination condition may be preset, wherein the pre-combination condition is used to determine whether the first calculation instruction is an instruction to be combined, and the post-combination condition is used to determine the first calculation instruction and the post-combination condition. Whether the found cached computing instructions can be combined, that is, the above-mentioned instruction combining condition may be the above-mentioned post-combining condition.

这里,可以确定第一计算指令的指令识别标识,根据指令识别标识确定该第一计算指令是否满足先决合并条件。在确定第一计算指令满足先决合并条件的情况下,可以将该第一计算指令确定为待合并指令。Here, an instruction identification identifier of the first calculation instruction may be determined, and whether the first calculation instruction satisfies the prerequisite merging condition is determined according to the instruction identification identifier. In the case where it is determined that the first calculation instruction satisfies the prerequisite merging condition, the first calculation instruction may be determined as the instruction to be merged.

这里,可以通过以下方式确定第一计算指令的指令识别标识。Here, the instruction identification identifier of the first computing instruction may be determined in the following manner.

在第一计算指令的指令内容中确定指令识别标识。The instruction identification identifier is determined in the instruction content of the first calculation instruction.

这里,获取第一计算指令的指令内容,进而在该指令内容中查找指令识别标识。在查找到第一计算指令的指令识别标识的标识内容之后,可以将该标识内容和目标内容进行匹配,并在该标识内容与目标内容相同的情况下,将该第一计算指令确定为待合并指令。Here, the instruction content of the first calculation instruction is acquired, and then the instruction identification identifier is searched in the instruction content. After finding the identification content of the instruction identification mark of the first calculation instruction, the identification content can be matched with the target content, and if the identification content is the same as the target content, the first calculation instruction is determined to be merged instruction.

例如,第一计算指令为macc,那么该第一计算指令的指令内容可以为:macc(a0,b0,c),其中,a0和b0为寄存器标识。其中,该寄存器标识可以理解为存储用于执行该第一计算指令macc1的操作数的寄存器,c可以理解为上述指令识别标识。For example, if the first calculation instruction is macc, then the instruction content of the first calculation instruction may be: macc(a0, b0, c), where a0 and b0 are register identifiers. Wherein, the register identifier can be understood as a register for storing the operand for executing the first calculation instruction macc1, and c can be understood as the above-mentioned instruction identifier.

通过上述描述可知,本公开实施例中,指令识别标识的标识内容可以用于指示指令处理装置在接收到该第一计算指令之后是否立即向计算装置输出该第一计算指令。在标识内容为目标内容的情况下,可以确定不需要立即输出该第一计算指令,也即,该第一计算指令满足先决合并条件,并将该第一计算指令确定为待合并指令。It can be seen from the above description that, in the embodiment of the present disclosure, the identification content of the instruction identification identifier can be used to indicate whether the instruction processing apparatus outputs the first calculation instruction to the computing apparatus immediately after receiving the first calculation instruction. In the case that the identified content is the target content, it can be determined that the first calculation instruction does not need to be output immediately, that is, the first calculation instruction satisfies the prerequisite merging condition, and the first calculation instruction is determined as the instruction to be merged.

上述实施方式中,在获取到第一计算指令的指令内容后,可以确定该指令内容中的指令识别标识,并在该指令识别标识的标识内容为目标内容的情况下,确定该第一计算指令满足先决合并条件,从而将该第一计算指令确定为待合并指令。通过该处理方式,可以提高待合并指令的设置灵活性,以满足用户的各种合并需求。In the above-mentioned embodiment, after the instruction content of the first calculation instruction is acquired, the instruction identification mark in the instruction content can be determined, and when the identification content of the instruction identification mark is the target content, the first calculation instruction is determined. The prerequisite merging condition is satisfied, so that the first calculation instruction is determined as the instruction to be merged. Through this processing method, the flexibility of setting the instructions to be merged can be improved to meet various merging requirements of users.

本公开实施例中,承接上述方式,可以确定每个第一计算指令的指令识别标识。In the embodiment of the present disclosure, following the above method, the instruction identification identifier of each first computing instruction can be determined.

可以在每个第一计算指令的指令内容均设置上述指令识别标识。指令处理装置在获取到每个第一计算指令之后,可以在每个第一计算指令的指令内容中查找该指令识别标识,以根据该指令识别标识的标识内容确定该第一计算指令是否为待合并指令。The instruction identification identifier may be set in the instruction content of each first calculation instruction. After acquiring each first calculation instruction, the instruction processing device may search for the instruction identification mark in the instruction content of each first calculation instruction, so as to determine whether the first calculation instruction is pending according to the identification content of the instruction identification mark. Merge instructions.

这里,指令识别标识的标识内容除了能够用于指示该第一计算指令是否满足先决合并条件之外,还可以通过该指令识别标识的标识内容确定在该第一计算指令满足先决合并条件的情况下,该缓存空间中所包含的已缓存计算指令中能够与该第一计算指令进行合并的指令。例如,可以针对不同类型的待合并指令设置不同的标识内容,以通过该标识内容对相同类型的待合并指令进行合并。Here, in addition to indicating whether the first calculation instruction satisfies the prerequisite merging condition, the identification content of the instruction identification mark can also be used to determine whether the first calculation instruction satisfies the prerequisite merging condition through the identification content of the instruction identification mark. , an instruction that can be combined with the first computing instruction among the cached computing instructions contained in the cache space. For example, different identification contents may be set for different types of instructions to be merged, so that instructions to be merged of the same type are merged through the identification contents.

在一个可选的实施方式中,上述步骤S105,确定出查找到所述已缓存计算指令和所述第一计算指令满足指令合并条件,具体包括如下过程:In an optional implementation manner, in the above step S105, it is determined that the cached computing instruction and the first computing instruction are found to satisfy the instruction merging condition, which specifically includes the following process:

(1)、在所述合并策略为第一策略的情况下,获取所述已缓存计算指令的指令属性信息,得到第一信息,并获取所述第一计算指令的指令属性信息,得到第二信息;其中,所述第一策略用于指示基于指令属性信息进行计算指令的合并;(1), in the case where the merging strategy is the first strategy, obtain the instruction attribute information of the cached calculation instruction, obtain the first information, and obtain the instruction attribute information of the first calculation instruction, and obtain the second information; wherein, the first strategy is used to instruct the merging of computing instructions based on instruction attribute information;

(2)、确定所述第一信息和所述第二信息之间的信息匹配度;(2), determining the degree of information matching between the first information and the second information;

(3)、在所述信息匹配度满足预设匹配度要求的情况下,确定所述已缓存计算指令和第一计算指令满足所述指令合并条件。(3) In the case that the information matching degree satisfies the preset matching degree requirement, determine that the cached computing instruction and the first computing instruction satisfy the instruction merging condition.

在合并策略为第一策略的情况下,可以分别获取已缓存计算指令和第一计算指令的指令属性信息,从而得到已缓存计算指令所对应的第一信息(相当于已缓存计算指令所对应的指令属性信息的属性值)以及第一计算指令所对应的第二信息(相当于第一计算指令所对应的属性信息的属性值)。In the case where the merging strategy is the first strategy, the instruction attribute information of the cached computing instruction and the first computing instruction can be obtained respectively, so as to obtain the first information corresponding to the cached computing instruction (equivalent to the cached computing instruction corresponding to the The attribute value of the attribute information of the instruction) and the second information corresponding to the first calculation instruction (equivalent to the attribute value of the attribute information corresponding to the first calculation instruction).

这里,指令属性信息可以用于指示以下至少之一:指令计算类型、指令所占用指令发送通道的数量、该指令所对应操作数的数据类型。Here, the instruction attribute information may be used to indicate at least one of the following: the instruction calculation type, the number of instruction sending channels occupied by the instruction, and the data type of the operand corresponding to the instruction.

例如,数据类型可以包含二进制数据、八进制数据、十进制数据、十六进制数据等。指令计算类型可以用于表示第一计算指令的运算模式,例如点积计算,加减乘除运算等。指令所占用指令发送通道的数量可以理解为指令处理装置向计算装置发送该对应指令的过程中,该指令所占用的指令发送通道的数量。这里,计算装置可以理解为处理器中执行上述指令的单元。For example, data types may contain binary data, octal data, decimal data, hexadecimal data, and the like. The instruction calculation type can be used to indicate the operation mode of the first calculation instruction, such as dot product calculation, addition, subtraction, multiplication and division. The number of instruction sending channels occupied by an instruction can be understood as the number of instruction sending channels occupied by the instruction in the process of sending the corresponding instruction to the computing device by the instruction processing apparatus. Here, a computing device may be understood as a unit in a processor that executes the above-mentioned instructions.

通过上述描述可知,第一信息包含多个第一子信息,其中,该多个第一子信息包含已缓存计算指令的以下指令属性信息的属性值:指令计算类型、指令所占用指令发送通道的数量、该指令所对应操作数的数据类型;第二信息包含多个第二子信息,其中,该多个第二子信息包含第一计算指令的以下指令属性信息的属性值:指令计算类型、指令所占用指令发送通道的数量(以下简称通道数量)、该指令所对应操作数的数据类型。It can be seen from the above description that the first information includes a plurality of first sub-information, wherein the plurality of first sub-information includes the attribute values of the following instruction attribute information of the cached calculation instruction: instruction calculation type, instruction transmission channel occupied by the instruction The number, the data type of the operand corresponding to the instruction; the second information includes multiple second sub-information, wherein the multiple second sub-information includes the attribute values of the following instruction attribute information of the first calculation instruction: instruction calculation type, The number of instruction sending channels occupied by the instruction (hereinafter referred to as the number of channels), and the data type of the operand corresponding to the instruction.

在此情况下,指令合并单元,还用于:分别确定对应属性信息的第一子信息和第二子信息的子匹配度值,得到多个子匹配度值;以及基于所述多个子匹配度值确定所述第一信息和所述第二信息之间的信息匹配度。In this case, the instruction merging unit is further configured to: respectively determine the sub-matching degree values of the first sub-information and the second sub-information corresponding to the attribute information, to obtain multiple sub-matching degree values; and based on the multiple sub-matching degree values A degree of information matching between the first information and the second information is determined.

这里,第一子信息中的通道数量与第二子信息中通道数量可以通道数量属性的属性值,第一子信息中的数据类型与第二子信息中数据类型可以是数据类型属性的属性值。Here, the number of channels in the first sub-information and the number of channels in the second sub-information may be attribute values of the channel number attribute, and the data type in the first sub-information and the data type in the second sub-information may be attribute values of the data type attribute .

接下来,可以确定每个所述信息组中第一子信息和第二子信息的子匹配度值,得到多个子匹配度值。Next, the sub-matching degree values of the first sub-information and the second sub-information in each of the information groups may be determined to obtain a plurality of sub-matching degree values.

在确定每个信息组中第一子信息和第二子信息之间的子匹配度值的过程中,针对上述第一子信息和第二子信息中所包含的不同内容,可以设置不同的匹配标准,具体包括如下几种情况:In the process of determining the sub-matching degree value between the first sub-information and the second sub-information in each information group, different matches may be set for different contents contained in the first sub-information and the second sub-information. Standards, including the following situations:

情况一:第一子信息为已缓存计算指令的数据类型,第二子信息为第一计算指令的数据类型。此时,可以确定上述第一计算指令和已缓存计算指令之间的数据类型是否匹配。Case 1: The first sub-information is the data type of the cached calculation instruction, and the second sub-information is the data type of the first calculation instruction. At this time, it may be determined whether the data types of the first calculation instruction and the cached calculation instruction match.

在本公开实施例中,可以基于上述第二子信息确定出第一计算指令所对应操作数的第一数据类型,并基于上述第一子信息确定出已缓存计算指令所对应操作数的第二数据类型,并确定该第一数据类型与第二数据类型是否匹配。在该第一数据类型与第二数据类型匹配的情况下,确定该第一计算指令和已缓存计算指令之间的数据类型匹配。例如,在该第一数据类型与第二数据类型所指示的数制均为二进制的情况下,可以确定该第一计算指令和已缓存计算指令之间的数据类型匹配。此时,可以确定第一子信息和第二子信息的子匹配度值为预设数值(例如,1/3)。In the embodiment of the present disclosure, the first data type of the operand corresponding to the first calculation instruction may be determined based on the foregoing second sub-information, and the second data type of the operand corresponding to the cached calculation instruction may be determined based on the foregoing first sub-information data type, and determine whether the first data type matches the second data type. In the case where the first data type matches the second data type, it is determined that the data type matches between the first computation instruction and the cached computation instruction. For example, in the case where the number systems indicated by the first data type and the second data type are both binary, it may be determined that the data types between the first computing instruction and the cached computing instruction match. At this time, it may be determined that the sub-matching degree value of the first sub-information and the second sub-information is a preset value (for example, 1/3).

情况二:第一子信息为已缓存计算指令的指令计算类型,第二子信息为第一计算指令的指令计算类型。此时,可以确定上述第一计算指令和已缓存计算指令之间的指令计算类型是否匹配。Case 2: The first sub-information is the instruction calculation type of the cached calculation instruction, and the second sub-information is the instruction calculation type of the first calculation instruction. At this time, it may be determined whether the instruction calculation types match between the first calculation instruction and the cached calculation instruction.

在本公开实施例中,可以分别基于上述第一子信息以及第二子信息确定出第一计算指令和已缓存计算指令的运算模式,并在该第一计算指令和已缓存计算指令的运算模式相同的情况下,确定该第一计算指令和已缓存计算指令的之间的指令计算类型相匹配。例如,在确定出该第一计算指令和已缓存计算指令的运算模式均为点积运算的情况下,可以确定该第一计算指令和已缓存计算指令的指令计算类型相匹配。此时,可以确定第一子信息和第二子信息的子匹配度值为预设数值(例如,1/3)。In this embodiment of the present disclosure, the operation modes of the first calculation instruction and the cached calculation instruction may be determined based on the first sub-information and the second sub-information, respectively, and the operation modes of the first calculation instruction and the cached calculation instruction In the same case, it is determined that the instruction calculation type of the first calculation instruction and the cached calculation instruction match. For example, if it is determined that the operation modes of the first calculation instruction and the cached calculation instruction are both dot product operations, it may be determined that the instruction calculation types of the first calculation instruction and the cached calculation instruction match. At this time, it may be determined that the sub-matching degree value of the first sub-information and the second sub-information is a preset value (for example, 1/3).

情况三:第一子信息为已缓存计算指令的通道数量,第二子信息为第一计算指令的通道数量。此时,可以确定上述第一计算指令所占用指令发送通道的数量和已缓存计算指令所占用指令发送通道的数量是否匹配。Case 3: The first sub-information is the number of channels of the cached computing instruction, and the second sub-information is the number of channels of the first computing instruction. At this time, it may be determined whether the number of instruction sending channels occupied by the first calculation instruction matches the number of instruction sending channels occupied by the cached calculation instruction.

在本公开实施例中,可以基于上述第二子信息确定出第一计算指令所占用指令发送通道的数量,即第一通道数信息,并基于上述第一子信息确定出已缓存计算指令所占用指令发送通道的数量,即第二通道数信息。然后,可以确定该第一通道数信息以及第二通道数信息的和是否和上述指令发送通道相匹配,并在该第一通道数信息以及第二通道数信息的和与上述预先设定的指令发送通道的通道数量相匹配的情况下,确定该第一计算指令和已缓存计算指令之间的通道数信息相匹配。此时,可以确定第一子信息和第二子信息的子匹配度值为预设数值(例如,1/3)。In this embodiment of the present disclosure, the number of instruction sending channels occupied by the first computing instruction, that is, the information on the number of first channels, may be determined based on the second sub-information, and the occupied by the cached computing instruction may be determined based on the first sub-information Indicates the number of channels sent by the command, that is, the second channel number information. Then, it can be determined whether the sum of the first channel number information and the second channel number information matches the above command sending channel, and the sum of the first channel number information and the second channel number information and the above preset command can be determined. In the case where the channel numbers of the sending channels match, it is determined that the channel number information between the first calculation instruction and the cached calculation instruction matches. At this time, it may be determined that the sub-matching degree value of the first sub-information and the second sub-information is a preset value (for example, 1/3).

这里,在该第一通道数信息以及第二通道数信息的和小于或者等于预先设定的指令发送通道的通道数量的情况下,可以确定该第一计算指令和已缓存计算指令之间的通道数信息相匹配。Here, when the sum of the first channel number information and the second channel number information is less than or equal to the number of channels of the preset command sending channel, the channel between the first calculation command and the cached calculation command may be determined matching information.

举例来说,在上述指令发送通道的总通道数量为8个通道的情况下,若上述第一计算指令所对应的第一通道数信息为4个通道,已缓存计算指令所对应的第二通道信息为4个通道,那么,可以确定该第一计算指令和已缓存计算指令之间的通道数信息相匹配。For example, in the case where the total number of channels of the above-mentioned command sending channel is 8 channels, if the first channel number information corresponding to the above-mentioned first calculation command is 4 channels, the second channel corresponding to the calculation command has been cached. If the information is 4 channels, then it can be determined that the channel number information between the first calculation instruction and the cached calculation instruction matches.

在得到多个子匹配度值之后,就可以将多个子匹配度值进行求和运算,得到第一信息和第二信息之间的信息匹配度。因此,上述信息匹配度可以为指令属性信息中相匹配的内容的占比,例如,若上述第一计算指令和已缓存计算指令之间的通道数信息不匹配,而指令计算类型和数据类型相匹配,那么指令属性信息中相匹配的内容的占比为2/3,此时,可以该第一计算指令和已缓存计算指令之间的信息匹配度可以四舍五入为67%。After the multiple sub-matching degree values are obtained, a sum operation may be performed on the multiple sub-matching degree values to obtain the information matching degree between the first information and the second information. Therefore, the above-mentioned information matching degree may be the proportion of the matching content in the instruction attribute information. If there is a match, then the proportion of the matching content in the instruction attribute information is 2/3. In this case, the information matching degree between the first calculation instruction and the cached calculation instruction may be rounded to 67%.

在上述信息匹配度满足预设匹配度要求的情况下,可以确定该已缓存计算指令和第一计算指令满足后置合并条件。例如,若上述第一计算指令和已缓存计算指令之间的信息匹配度为100%,预设匹配度要求为80%,此时可以确定该已缓存计算指令和第一计算指令满足后置合并条件,即满足指令合并条件。In the case that the above-mentioned information matching degree satisfies the preset matching degree requirement, it may be determined that the cached calculation instruction and the first calculation instruction satisfy the post-merging condition. For example, if the information matching degree between the above-mentioned first calculation instruction and the cached calculation instruction is 100%, and the preset matching degree requirement is 80%, it can be determined that the cached calculation instruction and the first calculation instruction satisfy the post-combination requirement. Condition, that is, the command merge condition is satisfied.

在本公开实施例中,在缓存空间中包含已缓存计算指令的情况下,可以基于已缓存计算指令和第一计算指令的指令属性信息,确定已缓存计算指令和第一计算指令之间的信息匹配度是否满足预设匹配度要求,从而对第一计算指令和已缓存计算指令是否满足指令合并条件进行判断,为将该第一计算指令和已缓存计算指令进行合并处理提供了技术基础。In this embodiment of the present disclosure, when a cached computing instruction is included in the cache space, the information between the cached computing instruction and the first computing instruction may be determined based on the instruction attribute information of the cached computing instruction and the first computing instruction Whether the matching degree satisfies the preset matching degree requirement is judged whether the first computing instruction and the cached computing instruction meet the instruction merging condition, which provides a technical basis for combining the first computing instruction and the cached computing instruction.

在一个可选的实施方式中,上述步骤S105,确定出查找到所述已缓存计算指令和所述第一计算指令满足指令合并条件,具体还包括如下过程:In an optional implementation manner, in the above step S105, it is determined that the cached computing instruction and the first computing instruction are found to satisfy the instruction merging condition, which specifically further includes the following process:

(1)、在所述合并策略为第三策略的情况下,获取所述缓存空间中已缓存计算指令的指令数量信息;其中,所述第三策略用于指示基于预设指令数量进行计算指令的合并;(1), in the case that the merging strategy is a third strategy, obtain the instruction quantity information of the cached computing instructions in the cache space; wherein, the third strategy is used to instruct the calculation instruction based on the preset number of instructions. the merger;

(2)、在确定所述指令数量信息满足指令数量要求的情况下,确定所述已缓存计算指令和所述第一计算指令满足指令合并条件。(2) In a case where it is determined that the instruction quantity information satisfies the instruction quantity requirement, determine that the cached computing instruction and the first computing instruction satisfy an instruction merging condition.

在合并策略为第三策略的情况下,如果确定出上述第一计算指令为待合并指令,则可以获取缓存空间中已缓存计算指令的指令数量,并确定该指令数量信息是否满足指令数量要求。When the merging strategy is the third strategy, if it is determined that the first computing instruction is an instruction to be merged, the instruction quantity of the cached computing instruction in the cache space can be obtained, and it is determined whether the instruction quantity information meets the instruction quantity requirement.

这里,编程人员在编写程序代码之后,指令处理装置可以基于该程序代码确定用于指示计算机设备运行的指令。因此,编程人员在编写程序代码的过程中,还可以在该程序代码中编写指令合并条件,例如,该指令合并条件可以为指令数量要求,该指令数量要求可以用于指示在指令合并过程中进行合并的指令的数量(即,上述预设指令数量)。Here, after the programmer writes the program code, the instruction processing apparatus may determine the instruction for instructing the computer device to run based on the program code. Therefore, in the process of writing the program code, the programmer can also write the instruction merging condition in the program code. For example, the instruction merging condition can be the instruction quantity requirement, and the instruction quantity requirement can be used to indicate that the instruction merging process is performed The number of combined instructions (ie, the above-mentioned preset number of instructions).

具体实施时,在预设指令数量为n的情况下,若缓存空间中已缓存计算指令的指令数量信息为n-1,可以确定该指令数量信息满足指令数量要求,并确定该已缓存计算指令和第一计算指令满足指令合并条件。应理解的是,该指令数量要求n为2以上的整数,如3、4、5、6等。During specific implementation, in the case where the preset number of instructions is n, if the instruction number information of the cached computing instruction in the cache space is n-1, it can be determined that the instruction number information meets the instruction number requirement, and the cached computing instruction can be determined. and the first calculation instruction to satisfy the instruction merging condition. It should be understood that the number of instructions requires n to be an integer greater than 2, such as 3, 4, 5, 6, and so on.

若缓存空间中已缓存计算指令的指令数量信息为n,则可以按照缓存空间中已缓存计算指令的缓存顺序在已缓存计算指令中选择最先缓存至缓存空间的n-1个已缓存计算指令,并将最先缓存至缓存空间的n-1个已缓存计算指令和第一计算指令进行合并。If the instruction number information of the cached computing instructions in the cache space is n, the n-1 cached computing instructions that are first cached in the cache space can be selected from the cached computing instructions according to the cache order of the cached computing instructions in the cache space. , and merge the n-1 cached computing instructions that are first cached in the cache space with the first computing instruction.

在本公开实施例中,可以设置指令数量要求,并在缓存空间中已缓存计算指令的指令数量信息满足该指令数量要求的情况下,确定已缓存计算指令和第一计算指令满足指令合并条件,从而对指令合并的过程进行了完善,提高了进行指令合并处理的准确性。In the embodiment of the present disclosure, the instruction quantity requirement may be set, and if the instruction quantity information of the cached computation instruction in the cache space meets the instruction quantity requirement, it is determined that the cached computation instruction and the first computation instruction satisfy the instruction merging condition, Therefore, the process of command merging is improved, and the accuracy of command merging processing is improved.

在一个可选的实施方式中,上述步骤S105,确定出查找到所述已缓存计算指令和所述第一计算指令满足指令合并条件,具体还包括如下过程:In an optional implementation manner, in the above step S105, it is determined that the cached computing instruction and the first computing instruction are found to satisfy the instruction merging condition, which specifically further includes the following process:

(1)、在所述合并策略为第二策略的情况下,确定所述缓存空间的剩余缓存空间;其中,所述第二策略用于指示基于缓存空间中剩余空间大小进行计算指令的合并;(1), in the case where the merging strategy is the second strategy, determine the remaining cache space of the cache space; wherein, the second strategy is used to indicate that the calculation instruction is merged based on the size of the remaining space in the cache space;

(2)、在确定所述剩余缓存空间不满足所述第一计算指令的缓存要求的情况下,确定所述已缓存计算指令和所述第一计算指令满足指令合并条件。(2) In a case where it is determined that the remaining cache space does not meet the cache requirement of the first computing instruction, determine that the cached computing instruction and the first computing instruction satisfy an instruction merging condition.

在合并策略为第二策略的情况下,在将该第一计算指令存储到缓存空间中之前,还可以确定该缓存空间中的剩余缓存空间是否满足该第一计算指令的缓存要求。When the merging strategy is the second strategy, before storing the first computing instruction in the cache space, it may also be determined whether the remaining cache space in the cache space satisfies the cache requirement of the first computing instruction.

在该剩余缓存空间不满足所述第一计算指令的缓存要求的情况下,可以确定已缓存计算指令和第一计算指令满足指令合并条件,并对该已缓存计算指令和第一计算指令满足指令进行合并处理。In the case that the remaining cache space does not meet the cache requirement of the first computing instruction, it may be determined that the cached computing instruction and the first computing instruction satisfy the instruction merging condition, and the cached computing instruction and the first computing instruction satisfy the instruction Merge processing.

在该剩余缓存空间满足所述第一计算指令的缓存要求的情况下,可以将该第一计算指令缓存至该缓存空间,直至剩余缓存空间不满足缓存要求时,将不满足缓存要求时接收到的第一计算指令和缓存空间中的已缓存计算指令进行合并。In the case that the remaining cache space satisfies the cache requirement of the first computing instruction, the first computing instruction may be cached in the cache space until the remaining cache space does not meet the cache requirement, and will receive a message when the cache requirement is not met. The first computation instruction of the , and the cached computation instruction in the cache space are merged.

举例来说,可以为上述缓存空间设置最大缓存数量y,该最大缓存数量y可以用于指示该缓存空间中可以存储的已缓存计算指令数量的上限值。在该缓存空间的剩余缓存空间无法完整对第一计算指令进行缓存时,可以确定该剩余缓存空间不满足第一计算指令的缓存要求。For example, a maximum number of caches y may be set for the above-mentioned cache space, and the maximum number of caches y may be used to indicate an upper limit of the number of cached computing instructions that can be stored in the cache space. When the remaining cache space of the cache space cannot completely cache the first computing instruction, it may be determined that the remaining cache space does not meet the cache requirement of the first computing instruction.

在确定该缓存空间的剩余缓存空间的过程中,可以获取该缓存空间中已缓存计算指令已占用的缓存空间,并计算该缓存空间的最大缓存空间y和已占用的缓存空间x的差值y-x,并将该差值y-x的结果确定为剩余缓存空间。如果该差值y-x小于第一计算指令的指令大小,则确定剩余缓存空间不满足所述第一计算指令的缓存要求,也即可以确定已缓存计算指令和第一计算指令满足指令合并条件。In the process of determining the remaining cache space of the cache space, the cache space occupied by the cached computing instructions in the cache space can be obtained, and the difference y-x between the maximum cache space y of the cache space and the occupied cache space x can be calculated , and the result of the difference y-x is determined as the remaining buffer space. If the difference y-x is smaller than the instruction size of the first calculation instruction, it is determined that the remaining cache space does not meet the cache requirement of the first calculation instruction, that is, it is determined that the cached calculation instruction and the first calculation instruction satisfy the instruction merging condition.

在本公开实施例中,在将上述第一计算指令存储到缓存空间中之前,还可以确定该缓存空间中的剩余缓存空间是否满足该第一计算指令的缓存要求,并在不满足缓存要求的情况下,确定已缓存计算指令和第一计算指令满足指令合并条件,从而对该已缓存计算指令和第一计算指令进行合并处理,进一步对指令合并的过程进行了完善,提高了进行指令合并处理的准确性。In the embodiment of the present disclosure, before storing the above-mentioned first calculation instruction in the cache space, it may also be determined whether the remaining cache space in the cache space satisfies the cache requirement of the first calculation instruction, and if the cache requirement does not meet the cache requirement In this case, it is determined that the cached calculation instruction and the first calculation instruction satisfy the instruction merging condition, so that the cached calculation instruction and the first calculation instruction are merged, which further improves the instruction merging process and improves the performance of the instruction merging process. accuracy.

在一个可选的实施方式中,上述步骤S105,将所述第一计算指令和所述已缓存计算指令进行合并处理,具体包括如下过程:In an optional implementation manner, in the above step S105, the first calculation instruction and the cached calculation instruction are combined and processed, which specifically includes the following process:

S1051:对所述已缓存计算指令和所述第一计算指令进行合并,得到目标计算指令;S1051: Combine the cached computing instruction and the first computing instruction to obtain a target computing instruction;

S1052:将所述目标计算指令发送到计算装置中进行计算处理。S1052: Send the target calculation instruction to a computing device for calculation processing.

在本公开实施例中,在将上述已缓存计算指令和第一计算指令进行合并处理之后,可以得到目标计算指令,然后,可以将该目标计算指令发送到计算装置中,以使该计算装置基于该目标计算指令对待处理数据进行计算处理,得到计算结果。In this embodiment of the present disclosure, after the above-mentioned cached computing instruction and the first computing instruction are combined, a target computing instruction can be obtained, and then the target computing instruction can be sent to a computing device, so that the computing device can be based on The target calculation instruction performs calculation processing on the data to be processed to obtain a calculation result.

具体实施时,以卷积运算中的点积运算为例,展示上述合并处理的过程:In the specific implementation, taking the dot product operation in the convolution operation as an example, the process of the above-mentioned merging processing is shown:

例如,处理器接收到的指令为计算矩阵a和矩阵b的点积a·b,这里,

Figure BDA0003673365220000111
Figure BDA0003673365220000112
For example, the instruction received by the processor is to calculate the dot product a·b of matrix a and matrix b. Here,
Figure BDA0003673365220000111
Figure BDA0003673365220000112

那么,上述a·b=a0b0+a1b1+…+a8b8。因此,基于获取到的指令a·b,可以分别得到如下所示的计算指令0-计算指令8:Then, the above a·b=a 0 b 0 +a 1 b 1 +...+a 8 b 8 . Therefore, based on the obtained instructions a·b, the following calculation instructions 0-calculation instructions 8 can be obtained respectively:

计算指令0:macc(a0,b0);Calculation instruction 0: macc(a0, b0);

计算指令1:macc(a1,b1);Calculation instruction 1: macc(a1, b1);

计算指令2:macc(a2,b2);Calculation instruction 2: macc(a2, b2);

计算指令3:macc(a3,b3);Calculation instruction 3: macc(a3, b3);

计算指令4:macc(a4,b4);Calculation instruction 4: macc(a4, b4);

计算指令5:macc(a5,b5);Calculation instruction 5: macc(a5, b5);

计算指令6:macc(a6,b6);Calculation instruction 6: macc(a6, b6);

计算指令7:macc(a7,b7);Calculation instruction 7: macc(a7, b7);

计算指令8:macc(a8,b8)。Calculation instruction 8: macc(a8, b8).

这里,对上述计算指令0至8进行指令合并的合并策略为上述第一策略和第三策略,即:基于指令属性信息和指令数量要求对计算指令0至8进行合并。若上述指令数量要求n=2,那么,针对上述计算指令0-计算指令8进行合并处理的过程过下:Here, the merging strategies for merging the above calculation instructions 0 to 8 are the above first strategy and the third strategy, that is, the calculation instructions 0 to 8 are merged based on the instruction attribute information and the instruction quantity requirement. If the above-mentioned number of instructions requires n=2, then the process of combining the above-mentioned calculation instructions 0-calculation instructions 8 is as follows:

获取计算指令0,并将获取到的计算指令0:macc(a0,b0)确定为第一计算指令,并判断该计算指令0是否满足先决合并条件,在该计算指令0满足先决合并条件的情况下,将该计算指令0存储到缓存空间中作为已缓存计算指令。Acquire calculation instruction 0, and determine the acquired calculation instruction 0: macc(a0, b0) as the first calculation instruction, and determine whether the calculation instruction 0 satisfies the prerequisite merging condition, and in the case that the calculation instruction 0 satisfies the prerequisite merging condition Next, the calculation instruction 0 is stored in the cache space as a cached calculation instruction.

获取计算指令1,并将获取到的计算指令1:macc(a1,b1)确定为第一计算指令,接下来,可以分别获取第一计算指令以及缓存空间中的已缓存计算指令的指令计算类型。由于缓存空间中的已缓存计算指令的指令数量信息为1,满足指令数量要求n-1≤1,因此,如果计算指令1的指令计算类型与计算指令0的指令计算类型相同,则该计算指令1和计算指令0满足指令合并条件。此时,可以将该计算指令1和计算指令0进行合并处理,得到目标计算指令macc(a0,b0,a1,b1),并将该目标计算指令macc(a0,b0,a1,b1)发送至计算装置中进行计算处理。Acquire calculation instruction 1, and determine the acquired calculation instruction 1: macc(a1, b1) as the first calculation instruction. Next, obtain the instruction calculation type of the first calculation instruction and the cached calculation instruction in the cache space respectively. . Since the instruction quantity information of the cached calculation instruction in the cache space is 1, the instruction quantity requirement n-1≤1 is satisfied. Therefore, if the instruction calculation type of calculation instruction 1 is the same as the instruction calculation type of calculation instruction 0, the calculation instruction 1 and calculation instruction 0 satisfy the instruction merging condition. At this time, the calculation instruction 1 and the calculation instruction 0 can be combined to obtain the target calculation instruction macc(a0, b0, a1, b1), and the target calculation instruction macc(a0, b0, a1, b1) is sent to the Calculation processing is performed in the computing device.

获取计算指令2,并将获取到的计算指令2:macc(a2,b2)确定为第一计算指令,并判断该计算指令2是否满足先决合并条件,在该计算指令2满足先决合并条件的情况下,将该计算指令2存储到缓存空间中作为已缓存计算指令。Acquire calculation instruction 2, and determine the acquired calculation instruction 2: macc(a2, b2) as the first calculation instruction, and determine whether the calculation instruction 2 satisfies the prerequisite merging condition, and in the case that the calculation instruction 2 satisfies the prerequisite merging condition Next, the calculation instruction 2 is stored in the cache space as a cached calculation instruction.

获取计算指令3,并将获取到的计算指令3:macc(a3,b3)确定为第一计算指令,接下来,可以分别获取第一计算指令以及缓存空间中的已缓存计算指令的指令计算类型。由于缓存空间中的已缓存计算指令的指令数量信息为1,满足指令数量要求n-1≤1,因此,如果计算指令2的指令计算类型与计算指令3的指令计算类型相同,则可以确定该计算指令3和计算指令2满足指令合并条件。此时,可以将该计算指令2和计算指令3进行合并处理,得到目标计算指令macc(a2,b2,a3,b3),并将该目标计算指令macc(a2,b2,a3,b3)发送至计算装置中进行计算处理。Acquire calculation instruction 3, and determine the acquired calculation instruction 3: macc(a3, b3) as the first calculation instruction. Next, obtain the instruction calculation type of the first calculation instruction and the cached calculation instruction in the cache space respectively . Since the instruction quantity information of the cached calculation instructions in the cache space is 1, the instruction quantity requirement n-1≤1 is satisfied. Therefore, if the instruction calculation type of calculation instruction 2 is the same as the instruction calculation type of calculation instruction 3, it can be determined that the Calculation instruction 3 and calculation instruction 2 satisfy the instruction merging condition. At this time, the calculation instruction 2 and the calculation instruction 3 can be combined to obtain the target calculation instruction macc(a2, b2, a3, b3), and the target calculation instruction macc(a2, b2, a3, b3) can be sent to Calculation processing is performed in the computing device.

这里,对上述计算指令4-7的合并过程如上所述,此处不再赘述。Here, the merging process of the above calculation instructions 4-7 is as described above, and details are not repeated here.

接下来,由于计算指令8为计算a·b的指令中的最后一条计算指令,因此,区别于上述指令类型为不需要立即输出的指令类型,该计算指令8的指令识别标识所指示的指令类型可以为需要立即输出的指令类型。因此,该计算指令8不满足上述先决合并条件,此时,可以直接将该计算指令8发送到计算装置中进行计算处理。Next, since the calculation instruction 8 is the last calculation instruction in the instructions for calculating a·b, therefore, different from the instruction type that does not require immediate output, the instruction type indicated by the instruction identification identifier of the calculation instruction 8 is different from the above instruction type. Can be an instruction type that needs immediate output. Therefore, the calculation instruction 8 does not satisfy the above-mentioned pre-combination condition, and in this case, the calculation instruction 8 can be directly sent to the computing device for calculation processing.

在本公开实施例中,可以对已缓存计算指令和第一计算指令进行合并,得到目标计算指令,并将该目标计算指令发送到计算装置中进行计算处理,从而使得计算装置能够基于该目标计算指令对待处理数据进行计算处理,得到计算结果。In this embodiment of the present disclosure, the cached computing instruction and the first computing instruction may be combined to obtain a target computing instruction, and the target computing instruction may be sent to a computing device for computing processing, so that the computing device can perform computing based on the target computing instruction. The instruction performs calculation processing on the data to be processed, and obtains the calculation result.

在一个可选的实施方式中,上述步骤S1051,对所述已缓存计算指令和所述第一计算指令进行合并,得到目标计算指令,具体包括如下过程:In an optional implementation manner, in the above step S1051, the cached calculation instruction and the first calculation instruction are combined to obtain the target calculation instruction, which specifically includes the following process:

(1)、确定所述第一计算指令和所述已缓存计算指令的指令计算类型;(1), determine the instruction calculation type of the first calculation instruction and the cached calculation instruction;

(2)、在基于所述指令计算类型确定所述第一计算指令和所述已缓存计算指令的指令合并模式为第一合并模式的情况下,将所述已缓存计算指令和所述第一计算指令进行合并,得到所述目标计算指令;(2) In the case that the instruction merge mode of the first calculation instruction and the cached calculation instruction is determined to be the first merge mode based on the instruction calculation type, merge the cached calculation instruction with the first merge mode. The calculation instructions are combined to obtain the target calculation instructions;

(3)、在基于所述指令计算类型确定所述第一计算指令和所述已缓存计算指令的指令合并模式为第二合并模式的情况下,在同一个指令发射周期内将所述第一计算指令和所述已缓存计算指令发送到计算装置中进行计算处理。(3) In the case that the instruction merge mode of the first calculation instruction and the cached calculation instruction is determined to be the second merge mode based on the instruction calculation type, in the same instruction issuing cycle The computing instructions and the cached computing instructions are sent to the computing device for computing processing.

在本公开实施例中,在针对上述第一计算指令和已缓存计算指令进行合并时,可以采用不同的指令合并模式,其中,采用的指令合并模式可以根据该第一计算指令和所述已缓存计算指令的指令计算类型进行确定。In the embodiment of the present disclosure, when combining the first computing instruction and the cached computing instruction, different instruction combining modes may be adopted, wherein the adopted instruction combining mode may be based on the first computing instruction and the cached computing instruction. The instruction calculation type of the calculation instruction is determined.

举例来说,上述指令合并模式可以分为第一合并模式和第二合并模式。在该第一计算指令和已缓存计算指令的指令计算类型相同的情况下,可以采用第一合并模式,在该第一计算指令和已缓存计算指令的指令计算类型不相同的情况下,可以采用第二合并模式。For example, the above-mentioned command merging mode can be divided into a first merging mode and a second merging mode. In the case that the instruction calculation type of the first calculation instruction and the cached calculation instruction are the same, the first merge mode may be adopted, and if the instruction calculation type of the first calculation instruction and the cached calculation instruction are different, the Second merge mode.

在本公开实施例中,在指令合并模式为上述第一合并模式的情况下,首先可以分别获取上述第一计算指令和已缓存计算指令所对应的上述指令计算类型,并基于该指令计算类型所指示的计算方式,对第一计算指令和已缓存计算指令中的元素进行合并。例如,在该第一计算指令和已缓存计算指令的指令计算类型所指示的计算方式为点积运算的情况下,可以将该第一算指令和已缓存计算指令中的元素进行合并,从而得到目标计算指令。In the embodiment of the present disclosure, when the instruction merging mode is the above-mentioned first merging mode, firstly, the above-mentioned instruction calculation types corresponding to the above-mentioned first calculation instruction and the cached calculation instructions may be obtained respectively, and based on the above-mentioned instruction calculation type Indicated calculation mode, the elements in the first calculation instruction and the cached calculation instruction are combined. For example, in the case where the calculation method indicated by the instruction calculation type of the first calculation instruction and the cached calculation instruction is a dot product operation, the elements in the first calculation instruction and the cached calculation instruction may be combined to obtain target calculation instruction.

这里,元素可以用于指示执行对应计算指令的操作数,或者,用于指示存储该操作数的寄存器的标识信息。Here, an element may be used to indicate an operand for executing a corresponding calculation instruction, or may be used to indicate identification information of a register storing the operand.

具体的,以上述计算指令0macc(a0,b0)和计算指令1macc(a1,b1)为例,将该计算指令1macc(a1,b1)和计算指令0macc(a0,b0)进行合并处理后,可以得到目标计算指令macc(a0,b0,a1,b1)。Specifically, taking the above calculation instruction 0macc(a0, b0) and calculation instruction 1macc(a1, b1) as an example, after combining the calculation instruction 1macc(a1, b1) and the calculation instruction 0macc(a0, b0), you can The target calculation instruction macc(a0, b0, a1, b1) is obtained.

另外的,上述第二合并模式所指示的合并方式可以为并列合并,即在同一个指令发射周期内向计算装置发送第一计算指令和已缓存计算指令,例如,已缓存计算指令为上述macc指令,第一计算指令为初始化指令minit,那么,该第一计算指令和已缓存计算指令所对应的指令合并模式可以为该第二合并模式。In addition, the merging mode indicated by the second merging mode may be parallel merging, that is, the first computing instruction and the cached computing instruction are sent to the computing device in the same instruction issuing cycle. For example, the cached computing instruction is the above-mentioned macc instruction, If the first calculation instruction is the initialization instruction minit, then the instruction merge mode corresponding to the first calculation instruction and the cached calculation instruction may be the second merge mode.

在本公开实施例中,可以基于指令计算类型确定第一计算指令和已缓存计算指令的指令合并模式,从而使得本公开能够适用于不同指令计算类型的计算指令,增加了本公开的适用范围。In the embodiment of the present disclosure, the instruction merging mode of the first computing instruction and the cached computing instruction can be determined based on the instruction computing type, so that the present disclosure can be applied to computing instructions of different instruction computing types, and the scope of application of the present disclosure is increased.

在一个可选的实施方式中,上述方法还包括如下过程:In an optional embodiment, the above method further includes the following process:

在确定出查找到所述已缓存计算指令和所述第一计算指令不满足所述指令合并条件的情况下,将所述已缓存计算指令发送至计算装置进行处理,并将所述第一计算指令缓存至所述缓存空间。In the case where it is determined that the cached computing instruction and the first computing instruction do not meet the instruction merging condition, the cached computing instruction is sent to a computing device for processing, and the first computing instruction is sent to the computing device for processing. Instructions are cached into the cache space.

通过上述描述可知,已缓存计算指令和第一计算指令之间的合并策略包含以下至少之一:第一策略、第二策略和第三策略,其中,每种合并策略对应一个子合并条件,分别为子合并条件1、子合并条件2和子合并条件3。It can be seen from the above description that the merging strategy between the cached computing instruction and the first computing instruction includes at least one of the following: a first strategy, a second strategy and a third strategy, wherein each merging strategy corresponds to a sub-merging condition, which is respectively Sub-merge condition 1, sub-merge condition 2, and sub-merge condition 3.

这里,在指令合并条件包含多个子合并条件的情况下,如果已缓存计算指令和第一计算指令不满足第一策略所对应的子合并条件,那么可以将已缓存计算指令发送至计算装置进行处理,并将第一计算指令缓存至缓存空间。Here, in the case where the instruction merging condition includes multiple sub-merging conditions, if the cached computing instruction and the first computing instruction do not satisfy the sub-merging condition corresponding to the first policy, the cached computing instruction may be sent to the computing device for processing , and cache the first computing instruction to the cache space.

以合并策略为第一策略和第三策略为例介绍。Take the merging strategy as the first strategy and the third strategy as an example to introduce.

在上述缓存空间中包含已缓存计算指令的情况下,可以获取已缓存计算指令的指令属性信息,得到第一信息,并获取第一计算指令的指令属性信息,得到第二信息。然后,可以确定该第一信息和第二信息之间的信息匹配度是否满足预设匹配度要求,此时,可以确定已缓存计算指令和第一计算指令不满足子合并条件1,此时,无论已缓存计算指令的指令数量是否满足子合并条件3,都可以将已缓存计算指令发送至计算装置进行处理,并将第一计算指令缓存至所述缓存空间。In the case that the cache space includes cached computing instructions, the instruction attribute information of the cached computing instructions can be obtained to obtain the first information, and the instruction attribute information of the first computing instructions can be obtained to obtain the second information. Then, it can be determined whether the information matching degree between the first information and the second information meets the preset matching degree requirement. At this time, it can be determined that the cached calculation instruction and the first calculation instruction do not meet the sub-merging condition 1. At this time, Regardless of whether the instruction quantity of the cached computing instructions satisfies the sub-merge condition 3, the cached computing instruction may be sent to the computing device for processing, and the first computing instruction is cached in the cache space.

在另一个实施例中,在指令合并条件包含多个子合并条件的情况下,如果已缓存计算指令和第一计算指令不满足第一策略所对应的子合并条件,还可以将第一计算指令发送至计算装置进行处理,并继续对接下来的获取到的计算指令进行识别,确定接下来的计算指令是否能和已缓存计算指令进行合并。In another embodiment, when the instruction merging condition includes multiple sub-merging conditions, if the cached computing instruction and the first computing instruction do not satisfy the sub-merging condition corresponding to the first policy, the first computing instruction may also be sent Go to the computing device for processing, and continue to identify the next acquired computing instruction to determine whether the next computing instruction can be combined with the cached computing instruction.

在本公开实施例中,在确定出查找到已缓存计算指令和第一计算指令不满足指令合并条件的情况下,可以将已缓存计算指令发送至计算装置进行处理,并将第一计算指令缓存至缓存空间中,从而在能够进行合并处理的计算指令之间相隔较远的情况下,减少因为等待合并而造成的指令处理延时。In the embodiment of the present disclosure, when it is determined that the cached computing instruction and the first computing instruction do not meet the instruction merging condition, the cached computing instruction can be sent to the computing device for processing, and the first computing instruction is cached into the cache space, thereby reducing the instruction processing delay caused by waiting for the merging when the computing instructions that can be merged are far apart.

参见图2所示,为本公开实施例提供的一种指令处理装置的示意图。参见图3所示,为本公开实施例提供的一种芯片的示意图。Referring to FIG. 2, it is a schematic diagram of an instruction processing apparatus according to an embodiment of the present disclosure. Referring to FIG. 3 , a schematic diagram of a chip provided by an embodiment of the present disclosure is shown.

如图3所示,该芯片包含指令分发装置31、指令处理装置32、调度单元33和计算装置34。As shown in FIG. 3 , the chip includes an instruction distribution device 31 , an instruction processing device 32 , a scheduling unit 33 and a computing device 34 .

如图3所示,指令分发装置用于向指令处理装置分发第一计算指令;指令处理装置用于基于本公开实施例所提供的指令处理装置对该第一计算指令进行处理;指令调度单元用于将合并之后的计算指令发送至对应的计算装置进行处理。As shown in FIG. 3 , the instruction distribution apparatus is used to distribute the first calculation instruction to the instruction processing apparatus; the instruction processing apparatus is used to process the first calculation instruction based on the instruction processing apparatus provided by the embodiment of the present disclosure; the instruction scheduling unit uses The combined calculation instruction is sent to the corresponding computing device for processing.

在本公开实施例中,该指令处理装置32包括:指令接收单元10和指令合并单元20。In the embodiment of the present disclosure, the instruction processing apparatus 32 includes: an instruction receiving unit 10 and an instruction combining unit 20 .

指令接收单元10,用于获取当前时刻待执行的第一计算指令。The instruction receiving unit 10 is configured to acquire the first calculation instruction to be executed at the current moment.

在本公开实施例中,芯片的指令处理装置可以接收芯片中指令分发装置分发的待执行指令(即,上述第一计算指令)。这里,该第一计算指令可以为任意一种计算指令,例如,可以为macc指令,即乘累加指令。例如,该macc指令可以为:macc1(a0,b0),其中,a0和b0为寄存器标识。其中,该寄存器标识可以理解为存储用于执行该第一计算指令macc1的操作数的寄存器。In the embodiment of the present disclosure, the instruction processing apparatus of the chip may receive the instruction to be executed (ie, the above-mentioned first calculation instruction) distributed by the instruction distribution apparatus in the chip. Here, the first calculation instruction may be any calculation instruction, for example, may be a macc instruction, that is, a multiply-accumulate instruction. For example, the macc instruction may be: macc1(a0,b0), where a0 and b0 are register identifiers. Wherein, the register identifier can be understood as a register for storing the operand for executing the first calculation instruction macc1.

所述指令合并单元20,用于在确定出所述第一计算指令为待合并指令的情况下,在缓存空间中查找已缓存计算指令;其中,所述已缓存计算指令为在接收到所述第一计算指令之前缓存至所述缓存空间中的待合并计算指令。The instruction merging unit 20 is configured to search for a cached calculation instruction in the cache space when it is determined that the first calculation instruction is an instruction to be merged; wherein, the cached calculation instruction is received after the The first calculation instruction is cached into the to-be-combined calculation instruction in the cache space.

在本公开实施例中,在获取到上述第一计算指令后,可以获取第一计算指令的指令属性信息,从而基于该第一计算指令的指令属性信息确定该第一计算指令是否为能够合并的指令,并在确定该第一计算指令为能够合并的指令的情况下,将该第一计算指令确定为待合并指令。In the embodiment of the present disclosure, after the above-mentioned first calculation instruction is obtained, the instruction attribute information of the first calculation instruction may be obtained, so as to determine whether the first calculation instruction is mergeable based on the instruction attribute information of the first calculation instruction instruction, and when it is determined that the first calculation instruction is an instruction that can be combined, the first calculation instruction is determined as the instruction to be combined.

在缓存空间中查找到已缓存计算指令的情况下,可以确定该已缓存计算指令和第一计算指令是否满足指令合并条件。具体的,可以基于预先设置的合并策略确定所述已缓存计算指令与所述第一计算指令是否满足所述指令合并条件;其中,所述指令合并条件为与所述指令合并策略相关联的条件。在确定该已缓存计算指令和第一计算指令满足指令合并条件的条件下,可以对该第一计算指令和已缓存计算指令进行合并处理。When a cached calculation instruction is found in the cache space, it can be determined whether the cached calculation instruction and the first calculation instruction satisfy the instruction merging condition. Specifically, it may be determined whether the cached computing instruction and the first computing instruction satisfy the instruction merging condition based on a preset merging policy; wherein the instruction merging condition is a condition associated with the instruction merging policy . On the condition that it is determined that the cached calculation instruction and the first calculation instruction satisfy the instruction merging condition, the first calculation instruction and the cached calculation instruction may be merged.

通过上述描述可知,可以实现将满足指令合并条件的计算指令进行自动合并,以通过对合并后的指令进行处理,从而可以提高芯片中处理器的处理效率,加快处理器对指令的处理速度;同时还可以减少了编程人员的编程工作量。As can be seen from the above description, it is possible to realize automatic merging of computing instructions that satisfy the instruction merging conditions, so that the processing efficiency of the processor in the chip can be improved by processing the merged instructions, and the processing speed of the instructions by the processor can be accelerated; The programming workload of the programmer can also be reduced.

在一个可选的实施方式中,指令合并单元20,还用于:In an optional implementation manner, the instruction merging unit 20 is further configured to:

(1)、确定所述第一计算指令的指令识别标识,其中,所述指令识别标识用于指示所述第一计算指令是否为待合并指令;(1), determine the instruction identification mark of the first calculation instruction, wherein, the instruction identification mark is used to indicate whether the first calculation instruction is an instruction to be merged;

(2)、在确定所述指令识别标识的标识内容为目标内容的情况下,确定所述第一计算指令为所述待合并指令。(2) In the case that the identification content of the instruction identification identifier is determined to be the target content, determine that the first calculation instruction is the instruction to be merged.

在本公开实施例中,可以预先设置先决合并条件和后置合并条件,其中,该先决合并条件用于确定第一计算指令是否为待合并指令,后置合并条件用于确定第一计算指令和查找到的已缓存计算指令是否能够进行合并,也即,上述指令合并条件可以为上述后置合并条件。In the embodiment of the present disclosure, a pre-combination condition and a post-combination condition may be preset, wherein the pre-combination condition is used to determine whether the first calculation instruction is an instruction to be combined, and the post-combination condition is used to determine the first calculation instruction and the post-combination condition. Whether the found cached computing instructions can be combined, that is, the above-mentioned instruction combining condition may be the above-mentioned post-combining condition.

这里,可以确定第一计算指令的指令识别标识,根据指令识别标识确定该第一计算指令是否满足先决合并条件。在确定第一计算指令满足先决合并条件的情况下,可以将该第一计算指令确定为待合并指令。具体判断该第一计算指令是否满足先决合并条件的过程如上述图1所对应的指令处理方法中的步骤S1031所对应的实施方式所述,此处不再赘述。Here, an instruction identification identifier of the first calculation instruction may be determined, and whether the first calculation instruction satisfies the prerequisite merging condition is determined according to the instruction identification identifier. In the case where it is determined that the first calculation instruction satisfies the prerequisite merging condition, the first calculation instruction may be determined as the instruction to be merged. The specific process of judging whether the first calculation instruction satisfies the pre-combination condition is as described in the embodiment corresponding to step S1031 in the instruction processing method corresponding to FIG. 1 above, and will not be repeated here.

在本公开实施例中,在获取到第一计算指令的指令内容后,可以确定该指令内容中的指令识别标识,并在该指令识别标识的标识内容为目标内容的情况下,确定该第一计算指令满足先决合并条件,从而将该第一计算指令确定为待合并指令。具体确定指令识别标识的标识内容是否为目标内容的过程如上述图1所对应的指令处理方法中的步骤S1032所述,此处不再赘述。In the embodiment of the present disclosure, after the instruction content of the first calculation instruction is acquired, the instruction identification mark in the instruction content may be determined, and if the identification content of the instruction identification mark is the target content, the first calculation instruction is determined. The calculation instruction satisfies the pre-combination condition, so that the first calculation instruction is determined as the instruction to be merged. The specific process of determining whether the identification content of the instruction identification identifier is the target content is as described in step S1032 in the instruction processing method corresponding to FIG. 1 , which will not be repeated here.

在一个可选的实施方式中,上述指令合并单元,还用于:In an optional implementation manner, the above-mentioned instruction merging unit is further used for:

(1)、在合并策略为第一策略的情况下,获取所述已缓存计算指令的指令属性信息,得到第一信息,并获取所述第一计算指令的指令属性信息,得到第二信息;其中,所述第一策略用于指示基于指令属性信息进行计算指令的合并;(1), in the case where the merging strategy is the first strategy, obtain the instruction attribute information of the cached calculation instruction, obtain the first information, and obtain the instruction attribute information of the first calculation instruction, and obtain the second information; Wherein, the first strategy is used for instructing to combine calculation instructions based on instruction attribute information;

(2)、确定所述第一信息和所述第二信息之间的信息匹配度;(2), determining the degree of information matching between the first information and the second information;

(3)、在所述信息匹配度满足预设匹配度要求的情况下,确定所述已缓存计算指令和第一计算指令满足所述指令合并条件。(3) In the case that the information matching degree satisfies the preset matching degree requirement, determine that the cached computing instruction and the first computing instruction satisfy the instruction merging condition.

在合并策略为第一策略的情况下,可以分别获取已缓存计算指令和第一计算指令的指令属性信息,从而得到已缓存计算指令所对应的第一信息以及第一计算指令所对应的第二信息。When the merging strategy is the first strategy, the instruction attribute information of the cached computing instruction and the first computing instruction can be obtained respectively, so as to obtain the first information corresponding to the cached computing instruction and the second computing instruction corresponding to the first computing instruction. information.

另外的,在本公开实施方式中,上述指令合并单元在确定第一信息和第二信息之间的信息匹配度是否满足预设匹配度要求的过程如上述图1所对应的指令处理方法中的步骤S105所对应的实施方式所述,此处不再赘述。In addition, in the embodiment of the present disclosure, the process of determining whether the information matching degree between the first information and the second information meets the preset matching degree requirement by the instruction merging unit is as described in the instruction processing method corresponding to FIG. 1 above. The implementation manner corresponding to step S105 is described, and details are not repeated here.

在本公开实施例中,在缓存空间中包含已缓存计算指令的情况下,可以基于已缓存计算指令和第一计算指令的指令属性信息,确定已缓存计算指令和第一计算指令之间的信息匹配度是否满足预设匹配度要求,从而对第一计算指令和已缓存计算指令是否满足指令合并条件进行判断,为将该第一计算指令和已缓存计算指令进行合并处理提供了技术基础。In this embodiment of the present disclosure, when a cached computing instruction is included in the cache space, the information between the cached computing instruction and the first computing instruction may be determined based on the instruction attribute information of the cached computing instruction and the first computing instruction Whether the matching degree satisfies the preset matching degree requirement is judged whether the first computing instruction and the cached computing instruction meet the instruction merging condition, which provides a technical basis for combining the first computing instruction and the cached computing instruction.

在一个可选的实施方式中,在第一信息包含多个第一子信息,所述第二信息包含多个第二子信息的情况下,上述指令合并单元,还用于:In an optional implementation manner, when the first information includes multiple first sub-information, and the second information includes multiple second sub-information, the above-mentioned instruction merging unit is further configured to:

分别确定对应属性信息的第一子信息和第二子信息的子匹配度值,得到多个子匹配度值;基于所述多个子匹配度值确定所述第一信息和所述第二信息之间的信息匹配度;所述属性信息包括:指令通道数量、指令计算类型和指令数据类型。Determine the sub-matching degree values of the first sub-information and the second sub-information corresponding to the attribute information, respectively, to obtain a plurality of sub-matching degree values; determine the difference between the first information and the second information based on the plurality of sub-matching degree values. The information matching degree; the attribute information includes: the number of instruction channels, the instruction calculation type and the instruction data type.

具体实施过程如上述实施例中情况一至情况三的描述,此处不再详细赘述。The specific implementation process is as described in the first to third situations in the foregoing embodiment, and details are not repeated here.

在一个可选的实施方式中,上述指令合并单元,还用于:In an optional implementation manner, the above-mentioned instruction merging unit is further used for:

(1)、在所述合并策略为第二策略的情况下,确定所述缓存空间的剩余缓存空间;其中,所述第二策略用于指示基于缓存空间中剩余空间大小进行计算指令的合并;(1), in the case where the merging strategy is the second strategy, determine the remaining cache space of the cache space; wherein, the second strategy is used to indicate that the calculation instruction is merged based on the size of the remaining space in the cache space;

(2)、在确定所述剩余缓存空间不满足所述第一计算指令的缓存要求的情况下,确定所述已缓存计算指令和所述第一计算指令满足指令合并条件。(2) In a case where it is determined that the remaining cache space does not meet the cache requirement of the first computing instruction, determine that the cached computing instruction and the first computing instruction satisfy an instruction merging condition.

在合并策略为第二策略的情况下,确定剩余缓存空间是否满足第一计算指令的缓存要求的过程如上述图1所对应的指令处理方法中的步骤S105所对应的实施方式所述,此处不再赘述。When the merging strategy is the second strategy, the process of determining whether the remaining cache space meets the cache requirement of the first computing instruction is as described in the embodiment corresponding to step S105 in the instruction processing method corresponding to FIG. 1 above. No longer.

在本公开实施例中,在将上述第一计算指令存储到缓存空间中之前,还可以确定该缓存空间中的剩余缓存空间是否满足该第一计算指令的缓存要求,并在不满足缓存要求的情况下,确定已缓存计算指令和第一计算指令满足指令合并条件,从而对该已缓存计算指令和第一计算指令进行合并处理,进一步对指令合并的过程进行了完善,提高了进行指令合并处理的准确性。In the embodiment of the present disclosure, before storing the above-mentioned first calculation instruction in the cache space, it may also be determined whether the remaining cache space in the cache space satisfies the cache requirement of the first calculation instruction, and if the cache requirement does not meet the cache requirement In this case, it is determined that the cached calculation instruction and the first calculation instruction satisfy the instruction merging condition, so that the cached calculation instruction and the first calculation instruction are merged, which further improves the instruction merging process and improves the performance of the instruction merging process. accuracy.

在一个可选的实施方式中,上述指令合并单元,还用于:In an optional implementation manner, the above-mentioned instruction merging unit is further used for:

(1)、在所述合并策略为第三策略的情况下,获取所述缓存空间中已缓存计算指令的指令数量;其中,所述第三策略用于指示基于预设指令数量进行计算指令的合并;(1), in the case that the merging strategy is a third strategy, obtain the instruction quantity of the cached computing instructions in the cache space; wherein, the third strategy is used to indicate the calculation instruction based on the preset number of instructions. merge;

(2)、在确定所述指令数量信息满足指令数量要求的情况下,确定所述已缓存计算指令和所述第一计算指令满足指令合并条件。(2) In a case where it is determined that the instruction quantity information satisfies the instruction quantity requirement, determine that the cached computing instruction and the first computing instruction satisfy an instruction merging condition.

在合并策略为第三策略的情况下,确定缓存空间中已缓存计算指令的指令数量是否满足指令数量要求的过程如上述图1所对应的指令处理方法中的步骤S105所对应的实施方式所述,此处不再赘述。When the merging strategy is the third strategy, the process of determining whether the number of instructions of the cached computing instructions in the cache space meets the requirement of the number of instructions is as described in the embodiment corresponding to step S105 in the instruction processing method corresponding to FIG. 1 above. , and will not be repeated here.

在本公开实施例中,可以设置指令数量要求,并在缓存空间中已缓存计算指令的指令数量信息满足该指令数量要求的情况下,确定已缓存计算指令和第一计算指令满足指令合并条件,从而对指令合并的过程进行了完善,提高了进行指令合并处理的准确性。In the embodiment of the present disclosure, the instruction quantity requirement may be set, and if the instruction quantity information of the cached computation instruction in the cache space meets the instruction quantity requirement, it is determined that the cached computation instruction and the first computation instruction satisfy the instruction merging condition, Therefore, the process of command merging is improved, and the accuracy of command merging processing is improved.

在一个可选的实施方式中,上述指令处理装置还包括:指令调度单元。In an optional implementation manner, the above-mentioned instruction processing apparatus further includes: an instruction scheduling unit.

所述指令合并单元,用于对所述已缓存计算指令和所述第一计算指令进行合并,得到目标计算指令;the instruction combining unit, configured to combine the cached computing instruction and the first computing instruction to obtain a target computing instruction;

所述指令调度单元,用于接收所述指令合并单元发送的所述目标计算指令,并将所述目标计算指令发送到计算装置中进行计算处理。The instruction scheduling unit is configured to receive the target computing instruction sent by the instruction merging unit, and send the target computing instruction to a computing device for computing processing.

在本公开实施例中,将已缓存计算指令和第一计算指令进行合并,得到目标计算指令,并将该目标计算指令发送到计算装置中的过程如上述图1所对应的指令处理方法中的步骤S105所对应的实施方式所述,此处不再赘述。In the embodiment of the present disclosure, the process of combining the cached computing instruction and the first computing instruction to obtain the target computing instruction, and sending the target computing instruction to the computing device is as described in the instruction processing method corresponding to FIG. 1 above. The implementation manner corresponding to step S105 is described, and details are not repeated here.

在本公开实施例中,可以对已缓存计算指令和第一计算指令进行合并,得到目标计算指令,并将该目标计算指令发送到计算装置中进行计算处理,从而使得计算装置能够基于该目标计算指令对待处理数据进行计算处理,得到计算结果。In this embodiment of the present disclosure, the cached computing instruction and the first computing instruction may be combined to obtain a target computing instruction, and the target computing instruction may be sent to a computing device for computing processing, so that the computing device can perform computing based on the target computing instruction. The instruction performs calculation processing on the data to be processed, and obtains the calculation result.

在一个可选的实施方式中,上述指令合并单元,还用于:In an optional implementation manner, the above-mentioned instruction merging unit is further used for:

(1)、确定所述第一计算指令和所述已缓存计算指令的指令计算类型;(1), determine the instruction calculation type of the first calculation instruction and the cached calculation instruction;

(2)、在基于所述指令计算类型确定所述第一计算指令和所述已缓存计算指令的指令合并模式为第一合并模式的情况下,将所述已缓存计算指令和所述第一计算指令进行合并,得到所述目标计算指令。(2) In the case that the instruction merge mode of the first calculation instruction and the cached calculation instruction is determined to be the first merge mode based on the instruction calculation type, merge the cached calculation instruction with the first merge mode. The calculation instructions are combined to obtain the target calculation instructions.

在本公开实施例中,确定第一计算指令和已缓存计算指令的指令合并模式,并基于该指令合并模式将已缓存计算指令和第一计算指令进行合并的过程如上述图1所对应的指令处理方法中的步骤S1051所对应的实施方式所述,此处不再赘述。In the embodiment of the present disclosure, the process of determining the instruction merging mode of the first computing instruction and the cached computing instruction, and merging the cached computing instruction and the first computing instruction based on the instruction merging mode is as shown in the instruction corresponding to FIG. 1 above. The embodiment corresponding to step S1051 in the processing method is described, and details are not repeated here.

在本公开实施例中,可以基于指令计算类型确定第一计算指令和已缓存计算指令的指令合并模式,从而使得本公开能够适用于不同指令计算类型的计算指令,增加了本公开的适用范围。In the embodiment of the present disclosure, the instruction merging mode of the first computing instruction and the cached computing instruction can be determined based on the instruction computing type, so that the present disclosure can be applied to computing instructions of different instruction computing types, and the scope of application of the present disclosure is increased.

在一个可选的实施方式中,所述指令合并单元,还用于:在基于所述指令计算类型确定所述第一计算指令和所述已缓存计算指令的指令合并模式为第二合并模式的情况下,向所述指令调度单元发送目标控制指令;In an optional implementation manner, the instruction merging unit is further configured to: determine, based on the instruction calculation type, that the instruction merging mode of the first calculation instruction and the cached calculation instruction is the second merge mode In this case, send a target control instruction to the instruction scheduling unit;

所述指令调度单元,用于在接收到所述目标控制指令之后,在同一个指令发射周期内将所述第一计算指令和所述已缓存计算指令发送到计算装置中进行计算处理。The instruction scheduling unit is configured to, after receiving the target control instruction, send the first calculation instruction and the cached calculation instruction to a computing device for calculation processing within the same instruction sending cycle.

这里,第二合并模式所指示的合并方式可以为并列合并,即在同一个指令发射周期内向计算装置发送第一计算指令和已缓存计算指令,例如,已缓存计算指令为上述macc指令,第一计算指令为初始化指令minit,那么,该第一计算指令和已缓存计算指令所对应的指令合并模式可以为该第二合并模式。Here, the merging mode indicated by the second merging mode may be parallel merging, that is, the first computing instruction and the cached computing instruction are sent to the computing device in the same instruction issuing cycle. If the calculation instruction is an initialization instruction minit, then the instruction merge mode corresponding to the first calculation instruction and the cached calculation instruction may be the second merge mode.

在一个可选的实施方式中,上述指令处理装置还包括:指令调度单元;In an optional implementation manner, the above-mentioned instruction processing apparatus further includes: an instruction scheduling unit;

所述指令调度单元,还用于在确定出查找到所述已缓存计算指令和所述第一计算指令不满足所述指令合并条件的情况下,将所述已缓存计算指令发送至计算装置进行处理,并将所述第一计算指令缓存至所述缓存空间。The instruction scheduling unit is further configured to send the cached computing instruction to a computing device for processing when it is determined that the cached computing instruction and the first computing instruction are found not to satisfy the instruction merging condition. processing, and cache the first computing instruction to the cache space.

在本公开实施例中,在上述缓存空间中包含已缓存计算指令的情况下,可以获取已缓存计算指令的指令属性信息,得到第一信息,并获取第一计算指令的指令属性信息,得到第二信息。然后,可以确定该第一信息和第二信息之间的信息匹配度是否满足预设匹配度要求,并在不满足预设匹配度要求的情况下,确定已缓存计算指令和第一计算指令不满足指令合并条件,其中,确定第一信息和第二信息之间的信息匹配度的过程如上述步骤S105所对应的实施方式所述,此处不再赘述。In the embodiment of the present disclosure, when the cache space includes a cached calculation instruction, the instruction attribute information of the cached calculation instruction can be obtained to obtain the first information, and the instruction attribute information of the first calculation instruction can be obtained to obtain the first information. 2. Information. Then, it may be determined whether the information matching degree between the first information and the second information satisfies the preset matching degree requirement, and if the preset matching degree requirement is not met, it is determined that the cached calculation instruction and the first calculation instruction do not meet the preset matching degree requirement. The instruction merging condition is satisfied, wherein the process of determining the information matching degree between the first information and the second information is as described in the embodiment corresponding to the foregoing step S105, and details are not repeated here.

在确定出已缓存计算指令和第一计算指令不满足指令合并条件之后,可以包括以下两种实施方式:After it is determined that the cached computing instruction and the first computing instruction do not meet the instruction merging condition, the following two implementations may be included:

方式一:method one:

在本公开实施例中,将第一计算指令发送至计算装置进行处理,并继续对接下来的获取到的计算指令进行识别,确定接下来的计算指令是否能和已缓存计算指令进行合并。In the embodiment of the present disclosure, the first calculation instruction is sent to the computing device for processing, and the next acquired calculation instruction is continued to be identified to determine whether the next calculation instruction can be combined with the cached calculation instruction.

方式二:Method two:

在本公开实施例中,可以将已缓存计算指令进行合并处理,并将合并处理之后得到的计算指令发送至计算装置进行处理,同时将该第一计算指令缓存至缓存空间中。In the embodiment of the present disclosure, the cached computing instructions may be combined, and the computing instructions obtained after the combined processing are sent to the computing device for processing, and the first computing instructions are cached in the cache space at the same time.

在本公开实施例中,在确定出查找到已缓存计算指令和第一计算指令不满足指令合并条件的情况下,可以将已缓存计算指令发送至计算装置进行处理,并将第一计算指令缓存至缓存空间中,从而在能够进行合并处理的计算指令之间相隔较远的情况下,减少因为等待合并而造成的指令处理延时。In the embodiment of the present disclosure, when it is determined that the cached computing instruction and the first computing instruction do not meet the instruction merging condition, the cached computing instruction can be sent to the computing device for processing, and the first computing instruction is cached into the cache space, thereby reducing the instruction processing delay caused by waiting for the merging when the computing instructions that can be merged are far apart.

另外的,在本公开实施例中,如图3所示为一种芯片的示意图,如图3所示,在该芯片中包括指令分发装置31,指令处理装置32以及计算装置33,具体地:In addition, in the embodiment of the present disclosure, FIG. 3 is a schematic diagram of a chip. As shown in FIG. 3 , the chip includes an instruction distribution device 31, an instruction processing device 32 and a computing device 33, specifically:

指令分发装置,用于向所述指令处理装置分发当前时刻待执行的第一计算指令;an instruction distribution device, configured to distribute the first computing instruction to be executed at the current moment to the instruction processing device;

指令处理装置,用于获取当前时刻待执行的第一计算指令;在确定出所述第一计算指令为待合并指令的情况下,在缓存空间中查找已缓存计算指令;在确定出查找到的所述已缓存计算指令和所述第一计算指令满足指令合并条件的情况下,将所述第一计算指令和所述已缓存计算指令进行合并处理,得到目标计算指令;The instruction processing device is used to obtain the first calculation instruction to be executed at the current moment; when it is determined that the first calculation instruction is the instruction to be merged, the cached calculation instruction is searched in the cache space; Under the condition that the cached computing instruction and the first computing instruction satisfy the instruction merging condition, combine the first computing instruction and the cached computing instruction to obtain a target computing instruction;

计算装置,用于获取所述目标计算指令所对应的操作数,并基于所述操作数执行所述目标计算指令。A computing device, configured to obtain an operand corresponding to the target computing instruction, and execute the target computing instruction based on the operand.

这里,该指令处理装置中包含指令接收单元、指令合并单元、指令调度单元,计算装置中包含多个计算核。Here, the instruction processing apparatus includes an instruction receiving unit, an instruction merging unit, and an instruction scheduling unit, and the computing apparatus includes a plurality of computing cores.

在本公开实施例中,指令分发装置31,指令处理装置32以及计算装置33的处理流程可以为下述步骤S301~S308所描述的流程,其中:In this embodiment of the present disclosure, the processing flow of the instruction distribution apparatus 31, the instruction processing apparatus 32, and the computing apparatus 33 may be the flow described in the following steps S301-S308, wherein:

S301:指令分发装置可以将获取到的计算指令发送至指令处理装置中进行处理。S301: The instruction distribution apparatus may send the acquired calculation instruction to the instruction processing apparatus for processing.

S302:指令处理装置的指令接收单元可以在将接收到的计算指令确定为第一计算指令之后,确定第一计算指令是否为待合并计算指令。S302: After determining the received calculation instruction as the first calculation instruction, the instruction receiving unit of the instruction processing apparatus may determine whether the first calculation instruction is the calculation instruction to be combined.

其中,在该第一计算指令不是待合并计算指令的情况下,则执行S303,之后,跳转至执行S308。在该第一计算指令是待合并计算指令的情况下,则跳转至执行S304至S308。Wherein, if the first calculation instruction is not the calculation instruction to be combined, execute S303, and then jump to execute S308. In the case that the first calculation instruction is the calculation instruction to be combined, then jump to execute S304 to S308.

S303:指令接收单元将该待合并计算指令发送至指令调度单元。其中,在执行S303之后,跳转至执行S308,直至将待合并计算指令发送至计算装置中进行处理。S303: The instruction receiving unit sends the to-be-combined calculation instruction to the instruction scheduling unit. Wherein, after executing S303, jump to executing S308 until the calculation instruction to be combined is sent to the computing device for processing.

S304:指令处理装置中的指令接收单元将该待合并计算指令发送至指令合并单元。S304: The instruction receiving unit in the instruction processing apparatus sends the instruction to be combined to the instruction combining unit.

在执行S303之后,依次执行S305-S308,直至将待合并计算指令发送至计算装置中进行处理。After executing S303, execute S305-S308 in sequence until the calculation instruction to be combined is sent to the computing device for processing.

S305:指令接收单元可以确定上述待合并计算指令和缓存空间中的已缓存计算指令是否满足指令合并条件,在满足指令合并条件的情况下,则执行S306,在不满足指令合并条件的情况下,则执行S307。S305: The instruction receiving unit can determine whether the above-mentioned calculation instruction to be merged and the cached calculation instruction in the cache space satisfy the instruction merging condition. Then execute S307.

S306:指令接收单元对第一计算指令和已缓存计算指令进行合并处理,得到目标计算指令,并将该目标计算指令发送至指令发送器中。S306: The instruction receiving unit combines the first calculation instruction and the cached calculation instruction to obtain a target calculation instruction, and sends the target calculation instruction to the instruction transmitter.

S307:指令接收单元将该待合并计算指令存储到缓存空间中。S307: The instruction receiving unit stores the to-be-combined calculation instruction into the cache space.

S308:指令调度单元将获取到的计算指令(可以包括第一计算指令以及目标计算指令)发送到计算装置中,以使计算装置中的多个计算核可以基于获取到的计算指令进行计算处理。S308: The instruction scheduling unit sends the acquired computing instruction (which may include the first computing instruction and the target computing instruction) to the computing device, so that multiple computing cores in the computing device can perform computing processing based on the acquired computing instruction.

综上,在本公开实施例中,在确定出获取到当前时刻待执行的第一计算指令为待合并计算指令之后,可以在缓存空间中查找已缓存的计算指令,并在查找到的已缓存计算指令和该第一计算指令满足指令合并条件的情况下,将该第一计算指令和已缓存计算指令进行合并处理,从而实现计算指令的动态合并,减少了编程人员的编程工作量,进而提高了编程人员的编程效率。To sum up, in the embodiment of the present disclosure, after it is determined that the acquired first calculation instruction to be executed at the current moment is the calculation instruction to be merged, the cached calculation instruction can be searched in the cache space, and the cached calculation instruction that is found can be searched. When the calculation instruction and the first calculation instruction satisfy the instruction merging condition, the first calculation instruction and the cached calculation instruction are merged, so as to realize the dynamic merge of the calculation instructions, reduce the programming workload of the programmer, and further improve the The programmer's programming efficiency.

本领域技术人员可以理解,在具体实施方式的上述方法中,各步骤的撰写顺序并不意味着严格的执行顺序而对实施过程构成任何限定,各步骤的具体执行顺序应当以其功能和可能的内在逻辑确定。Those skilled in the art can understand that in the above method of the specific implementation, the writing order of each step does not mean a strict execution order but constitutes any limitation on the implementation process, and the specific execution order of each step should be based on its function and possible Internal logic is determined.

基于同一发明构思,本公开实施例中还提供了与指令处理方法对应的指令处理装置,由于本公开实施例中的装置解决问题的原理与本公开实施例上述指令处理方法相似,因此装置的实施可以参见方法的实施,重复之处不再赘述。Based on the same inventive concept, the embodiment of the present disclosure also provides an instruction processing apparatus corresponding to the instruction processing method. Reference may be made to the implementation of the method, and repeated descriptions will not be repeated.

参照图4所示,为本公开实施例提供的一种指令处理装置的示意图,所述装置包括:获取单元41、确定单元42、合并单元43;其中,Referring to FIG. 4 , which is a schematic diagram of an instruction processing apparatus provided by an embodiment of the present disclosure, the apparatus includes: an obtaining unit 41 , a determining unit 42 , and a merging unit 43 ; wherein,

获取单元41,用于获取当前时刻待执行的第一计算指令;an obtaining unit 41, for obtaining the first calculation instruction to be executed at the current moment;

确定单元42,用于在确定出所述第一计算指令为待合并指令的情况下,在缓存空间中查找已缓存计算指令;A determination unit 42, configured to search for a cached calculation instruction in the cache space when it is determined that the first calculation instruction is an instruction to be merged;

合并单元43,用于在确定出查找到的所述已缓存计算指令和所述第一计算指令满足指令合并条件的情况下,将所述第一计算指令和所述已缓存计算指令进行合并处理。The merging unit 43 is configured to perform merging processing on the first computing instruction and the cached computing instruction when it is determined that the found cached computing instruction and the first computing instruction satisfy the instruction merging condition .

在本公开实施例中,在确定出获取到当前时刻待执行的第一计算指令为待合并计算指令之后,可以在缓存空间中查找已缓存的计算指令,并在查找到的已缓存计算指令和该第一计算指令满足指令合并条件的情况下,将该第一计算指令和已缓存计算指令进行合并处理,从而实现计算指令的动态合并。In the embodiment of the present disclosure, after it is determined that the acquired first calculation instruction to be executed at the current moment is the calculation instruction to be merged, the cached calculation instruction may be searched in the cache space, and the cached calculation instruction and When the first calculation instruction satisfies the instruction merging condition, the first calculation instruction and the cached calculation instruction are merged, so as to realize dynamic merging of the calculation instructions.

关于装置中的各单元的处理流程、以及各单元之间的交互流程的描述可以参照上述方法实施例中的相关说明,这里不再详述。For the description of the processing flow of each unit in the apparatus and the interaction flow between the various units, reference may be made to the relevant descriptions in the foregoing method embodiments, which will not be described in detail here.

对应于图1中的指令处理方法,本公开实施例还提供了一种芯片500,如图5所示,为本公开实施例提供的芯片500结构示意图,包括:Corresponding to the instruction processing method in FIG. 1 , an embodiment of the present disclosure further provides a chip 500 . As shown in FIG. 5 , a schematic structural diagram of the chip 500 provided by an embodiment of the present disclosure includes:

芯片51、存储器52、和总线53;存储器52用于存储执行指令,所述芯片51与所述存储器52之间通过总线53通信,使得所述芯片51执行以下指令:The chip 51, the memory 52, and the bus 53; the memory 52 is used to store execution instructions, and the chip 51 and the memory 52 communicate through the bus 53, so that the chip 51 executes the following instructions:

获取当前时刻待执行的第一计算指令;Obtain the first calculation instruction to be executed at the current moment;

在确定出所述第一计算指令为待合并指令的情况下,在缓存空间中查找已缓存计算指令;When it is determined that the first calculation instruction is an instruction to be merged, look up the cached calculation instruction in the cache space;

在确定出查找到的所述已缓存计算指令和所述第一计算指令满足指令合并条件的情况下,将所述第一计算指令和所述已缓存计算指令进行合并处理。When it is determined that the found cached calculation instruction and the first calculation instruction satisfy the instruction merging condition, the first calculation instruction and the cached calculation instruction are merged.

本公开还提供了一种板卡,其包括了封装有至少一个上述芯片的封装结构。参阅图6,其提供了一种示例性的板卡,上述板卡包括上述芯片500,还可以包括其他的部件,包括但不限于:存储器件604和接口器件606。The present disclosure also provides a board, which includes a package structure packaged with at least one of the above-mentioned chips. Referring to FIG. 6 , an exemplary board card is provided. The above board card includes the above chip 500 , and may also include other components, including but not limited to: a storage device 604 and an interface device 606 .

所述存储器件与所述芯片封装结构内的芯片通过总线连接,用于存储数据。所述存储器件可以包括多组存储单元608,例如:DDR SDRAM(英文:Double Data Rate SDRAM,双倍速率同步动态随机存储器)等。每一组所述存储单元与所述芯片通过总线连接。The storage device is connected to the chip in the chip package structure through a bus, and is used for storing data. The storage device may include multiple groups of storage units 608, such as: DDR SDRAM (English: Double Data Rate SDRAM, double-rate synchronous dynamic random access memory) and the like. Each group of the memory cells is connected to the chip through a bus.

所述接口装置与所述芯片封装结构内的芯片电连接。所述接口装置用于实现所述芯片与外部设备610(例如:终端、服务器、摄像头等)之间的数据传输。在一个实施例中,所述接口装置可以包括PCIE接口,还可以是网络接口、或者其他的接口,本公开不做限制。The interface device is electrically connected to the chip in the chip package structure. The interface device is used to realize data transmission between the chip and an external device 610 (for example, a terminal, a server, a camera, etc.). In one embodiment, the interface device may include a PCIE interface, and may also be a network interface, or other interfaces, which are not limited in the present disclosure.

本公开实施例还提供一种计算机可读存储介质,该计算机可读存储介质上存储有计算机程序,该计算机程序被芯片运行时执行上述方法实施例中所述的指令处理方法的步骤。其中,该存储介质可以是易失性或非易失的计算机可读取存储介质。Embodiments of the present disclosure further provide a computer-readable storage medium, where a computer program is stored on the computer-readable storage medium, and the computer program executes the steps of the instruction processing method described in the above method embodiments when the computer program is run by the chip. Wherein, the storage medium may be a volatile or non-volatile computer-readable storage medium.

本公开实施例还提供一种计算机程序产品,该计算机程序产品承载有程序代码,所述程序代码包括的指令可用于执行上述方法实施例中所述的指令处理方法的步骤,具体可参见上述方法实施例,在此不再赘述。Embodiments of the present disclosure further provide a computer program product, where the computer program product carries program codes, and the instructions included in the program codes can be used to execute the steps of the instruction processing methods described in the foregoing method embodiments. For details, please refer to the foregoing methods. The embodiments are not repeated here.

其中,上述计算机程序产品可以具体通过硬件、软件或其结合的方式实现。在一个可选实施例中,所述计算机程序产品具体体现为计算机存储介质,在另一个可选实施例中,计算机程序产品具体体现为软件产品,例如软件开发包(Software Development Kit,SDK)等等。Wherein, the above-mentioned computer program product can be specifically implemented by means of hardware, software or a combination thereof. In an optional embodiment, the computer program product is embodied as a computer storage medium, and in another optional embodiment, the computer program product is embodied as a software product, such as a software development kit (Software Development Kit, SDK), etc. Wait.

所属领域的技术人员可以清楚地了解到,为描述的方便和简洁,上述描述的系统和装置的具体工作过程,可以参考前述方法实施例中的对应过程,在此不再赘述。在本公开所提供的几个实施例中,应该理解到,所揭露的系统和方法,可以通过其它的方式实现。以上所描述的装置实施例仅仅是示意性的,例如,所述单元的划分,仅仅为一种逻辑功能划分,实际实现时可以有另外的划分方式,又例如,多个单元或组件可以结合或者可以集成到另一个系统,或一些特征可以忽略,或不执行。另一点,所显示或讨论的相互之间的耦合或直接耦合或通信连接可以是通过一些通信接口,装置或单元的间接耦合或通信连接,可以是电性,机械或其它的形式。Those skilled in the art can clearly understand that, for the convenience and brevity of description, for the specific working process of the system and device described above, reference may be made to the corresponding process in the foregoing method embodiments, which will not be repeated here. In the several embodiments provided in the present disclosure, it should be understood that the disclosed system and method may be implemented in other manners. The apparatus embodiments described above are only illustrative. For example, the division of the units is only a logical function division. In actual implementation, there may be other division methods. For example, multiple units or components may be combined or Can be integrated into another system, or some features can be ignored, or not implemented. On the other hand, the shown or discussed mutual coupling or direct coupling or communication connection may be through some communication interfaces, indirect coupling or communication connection of devices or units, which may be in electrical, mechanical or other forms.

所述作为分离部件说明的单元可以是或者也可以不是物理上分开的,作为单元显示的部件可以是或者也可以不是物理单元,即可以位于一个地方,或者也可以分布到多个网络单元上。可以根据实际的需要选择其中的部分或者全部单元来实现本实施例方案的目的。The units described as separate components may or may not be physically separated, and components displayed as units may or may not be physical units, that is, may be located in one place, or may be distributed to multiple network units. Some or all of the units may be selected according to actual needs to achieve the purpose of the solution in this embodiment.

另外,在本公开各个实施例中的各功能单元可以集成在一个处理单元中,也可以是各个单元单独物理存在,也可以两个或两个以上单元集成在一个单元中。In addition, each functional unit in each embodiment of the present disclosure may be integrated into one processing unit, or each unit may exist physically alone, or two or more units may be integrated into one unit.

所述功能如果以软件功能单元的形式实现并作为独立的产品销售或使用时,可以存储在一个芯片可执行的非易失的计算机可读取存储介质中。基于这样的理解,本公开的技术方案本质上或者说对现有技术做出贡献的部分或者该技术方案的部分可以以软件产品的形式体现出来,该计算机软件产品存储在一个存储介质中,包括若干指令用以使得一台计算机设备(可以是个人计算机,服务器,或者网络设备等)执行本公开各个实施例所述方法的全部或部分步骤。而前述的存储介质包括:U盘、移动硬盘、只读存储器(Read-OnlyMemory,ROM)、随机存取存储器(Random Access Memory,RAM)、磁碟或者光盘等各种可以存储程序代码的介质。If the functions are implemented in the form of software functional units and sold or used as independent products, they may be stored in a chip-executable non-volatile computer-readable storage medium. Based on such understanding, the technical solutions of the present disclosure can be embodied in the form of software products in essence, or the parts that contribute to the prior art or the parts of the technical solutions. The computer software products are stored in a storage medium, including Several instructions are used to cause a computer device (which may be a personal computer, a server, or a network device, etc.) to execute all or part of the steps of the methods described in various embodiments of the present disclosure. The aforementioned storage medium includes: U disk, mobile hard disk, read-only memory (Read-Only Memory, ROM), random access memory (Random Access Memory, RAM), magnetic disk or optical disk and other media that can store program codes.

最后应说明的是:以上所述实施例,仅为本公开的具体实施方式,用以说明本公开的技术方案,而非对其限制,本公开的保护范围并不局限于此,尽管参照前述实施例对本公开进行了详细的说明,本领域的普通技术人员应当理解:任何熟悉本技术领域的技术人员在本公开揭露的技术范围内,其依然可以对前述实施例所记载的技术方案进行修改或可轻易想到变化,或者对其中部分技术特征进行等同替换;而这些修改、变化或者替换,并不使相应技术方案的本质脱离本公开实施例技术方案的精神和范围,都应涵盖在本公开的保护范围之内。因此,本公开的保护范围应所述以权利要求的保护范围为准。Finally, it should be noted that the above-mentioned embodiments are only specific implementations of the present disclosure, and are used to illustrate the technical solutions of the present disclosure rather than limit them. The protection scope of the present disclosure is not limited thereto, although referring to the foregoing The embodiments describe the present disclosure in detail. Those of ordinary skill in the art should understand that: any person skilled in the art can still modify the technical solutions described in the foregoing embodiments within the technical scope disclosed by the present disclosure. Changes can be easily thought of, or equivalent replacements are made to some of the technical features; and these modifications, changes or replacements do not make the essence of the corresponding technical solutions deviate from the spirit and scope of the technical solutions of the embodiments of the present disclosure, and should be covered in the present disclosure. within the scope of protection. Therefore, the protection scope of the present disclosure should be based on the protection scope of the claims.

Claims (16)

1.一种指令处理装置,其特征在于,所述指令处理装置包括:指令接收单元和指令合并单元:1. An instruction processing device, characterized in that the instruction processing device comprises: an instruction receiving unit and an instruction merging unit: 所述指令接收单元,用于获取当前时刻待执行的第一计算指令;The instruction receiving unit is used to obtain the first calculation instruction to be executed at the current moment; 所述指令合并单元,用于在确定出所述第一计算指令为待合并指令的情况下,在缓存空间中查找已缓存计算指令;以及在确定出查找到的所述已缓存计算指令和所述第一计算指令满足指令合并条件的情况下,将所述第一计算指令和所述已缓存计算指令进行合并处理。The instruction merging unit is configured to search for a cached calculation instruction in the cache space when it is determined that the first calculation instruction is an instruction to be merged; and when it is determined that the found cached calculation instruction and all When the first calculation instruction satisfies the instruction merging condition, the first calculation instruction and the cached calculation instruction are merged. 2.根据权利要求1所述的指令处理装置,其特征在于,所述指令合并单元,还用于:2. The instruction processing apparatus according to claim 1, wherein the instruction merging unit is further configured to: 确定所述第一计算指令的指令识别标识,其中,所述指令识别标识用于指示所述第一计算指令是否为待合并指令;determining an instruction identification of the first calculation instruction, wherein the instruction identification is used to indicate whether the first calculation instruction is an instruction to be merged; 在确定所述指令识别标识的标识内容为目标内容的情况下,确定所述第一计算指令为所述待合并指令。When it is determined that the identification content of the instruction identification identifier is the target content, it is determined that the first calculation instruction is the instruction to be combined. 3.根据权利要求1或2所述的指令处理装置,其特征在于,所述指令合并单元,还用于:3. The instruction processing apparatus according to claim 1 or 2, wherein the instruction merging unit is further configured to: 基于预先设置的合并策略确定所述已缓存计算指令与所述第一计算指令是否满足所述指令合并条件;其中,所述指令合并条件为与所述指令合并策略相关联的条件。Whether the cached computing instruction and the first computing instruction satisfy the instruction merging condition is determined based on a preset merging policy; wherein the instruction merging condition is a condition associated with the instruction merging policy. 4.根据权利要求3所述的指令处理装置,其特征在于,所述指令合并单元,还用于:4. The instruction processing apparatus according to claim 3, wherein the instruction merging unit is further configured to: 在所述合并策略为第一策略的情况下,获取所述已缓存计算指令的指令属性信息,得到第一信息,并获取所述第一计算指令的指令属性信息,得到第二信息;其中,所述第一策略用于指示基于指令属性信息进行计算指令的合并;In the case where the merging strategy is the first strategy, obtain the instruction attribute information of the cached calculation instruction to obtain the first information, and obtain the instruction attribute information of the first calculation instruction to obtain the second information; wherein, The first strategy is used to instruct the merging of computing instructions based on instruction attribute information; 确定所述第一信息和所述第二信息之间的信息匹配度;determining the degree of information matching between the first information and the second information; 在所述信息匹配度满足预设匹配度要求的情况下,确定所述已缓存计算指令和第一计算指令满足所述指令合并条件。In the case that the information matching degree satisfies the preset matching degree requirement, it is determined that the cached computing instruction and the first computing instruction satisfy the instruction merging condition. 5.根据权利要求4所述的指令处理装置,其特征在于,所述第一信息包含多个第一子信息,所述第二信息包含多个第二子信息;所述指令合并单元,还用于:5 . The instruction processing apparatus according to claim 4 , wherein the first information includes a plurality of first sub-information, and the second information includes a plurality of second sub-information; the instruction merging unit further comprises: 6 . Used for: 分别确定对应属性信息的第一子信息和第二子信息的子匹配度值,得到多个子匹配度值;respectively determining the sub-matching degree values of the first sub-information and the second sub-information corresponding to the attribute information, to obtain a plurality of sub-matching degree values; 基于所述多个子匹配度值确定所述第一信息和所述第二信息之间的信息匹配度;determining an information matching degree between the first information and the second information based on the plurality of sub-matching degree values; 所述属性信息包括:指令通道数量、指令计算类型和指令数据类型。The attribute information includes: the number of instruction channels, the instruction calculation type, and the instruction data type. 6.根据权利要求3至5中所述的指令处理装置,其特征在于,所述指令合并单元,还用于:6. The instruction processing apparatus according to claims 3 to 5, wherein the instruction merging unit is further configured to: 在所述合并策略为第二策略的情况下,确定所述缓存空间的剩余缓存空间;其中,所述第二策略用于指示基于缓存空间中剩余空间大小进行计算指令的合并;In the case that the merging strategy is the second strategy, determining the remaining cache space of the cache space; wherein the second strategy is used to instruct the merging of computing instructions based on the size of the remaining space in the cache space; 在确定所述剩余缓存空间不满足所述第一计算指令的缓存要求的情况下,确定所述已缓存计算指令和所述第一计算指令满足指令合并条件。In a case where it is determined that the remaining cache space does not meet the cache requirement of the first computing instruction, it is determined that the cached computing instruction and the first computing instruction satisfy an instruction merging condition. 7.根据权利要求3至6中任一项所述的指令处理装置,其特征在于,所述指令合并单元,还用于:7. The instruction processing apparatus according to any one of claims 3 to 6, wherein the instruction merging unit is further configured to: 在所述合并策略为第三策略的情况下,获取所述缓存空间中已缓存计算指令的指令数量;其中,所述第三策略用于指示基于预设指令数量进行计算指令的合并;In the case that the merging strategy is a third strategy, obtain the instruction quantity of the cached computing instructions in the cache space; wherein the third strategy is used to instruct the merging of computing instructions based on a preset number of instructions; 在确定所述指令数量满足指令数量要求的情况下,确定所述已缓存计算指令和所述第一计算指令满足指令合并条件。When it is determined that the instruction quantity meets the instruction quantity requirement, it is determined that the cached computation instruction and the first computation instruction satisfy an instruction merging condition. 8.根据权利要求1至7中任一项所述的指令处理装置,其特征在于,所述指令处理装置还包括:指令调度单元;8. The instruction processing apparatus according to any one of claims 1 to 7, wherein the instruction processing apparatus further comprises: an instruction scheduling unit; 所述指令合并单元,用于对所述已缓存计算指令和所述第一计算指令进行合并,得到目标计算指令;the instruction merging unit, configured to merge the cached computing instruction and the first computing instruction to obtain a target computing instruction; 所述指令调度单元,用于接收所述指令合并单元发送的所述目标计算指令,并将所述目标计算指令发送到计算装置中进行计算处理。The instruction scheduling unit is configured to receive the target computing instruction sent by the instruction merging unit, and send the target computing instruction to a computing device for computing processing. 9.根据权利要求8所述的指令处理装置,其特征在于,所述指令合并单元,还用于:9. The instruction processing apparatus according to claim 8, wherein the instruction merging unit is further configured to: 确定所述第一计算指令和/或所述已缓存计算指令的指令计算类型;determining the instruction computation type of the first computation instruction and/or the cached computation instruction; 在基于所述指令计算类型确定所述第一计算指令和所述已缓存计算指令的指令合并模式为第一合并模式的情况下,将所述已缓存计算指令和所述第一计算指令进行合并,得到所述目标计算指令。If it is determined based on the instruction calculation type that the instruction merge mode of the first calculation instruction and the cached calculation instruction is the first merge mode, the cached calculation instruction and the first calculation instruction are merged to obtain the target calculation instruction. 10.根据权利要求9所述的指令处理装置,其特征在于,10. The instruction processing apparatus according to claim 9, characterized in that: 所述指令合并单元,还用于:在基于所述指令计算类型确定所述第一计算指令和所述已缓存计算指令的指令合并模式为第二合并模式的情况下,向所述指令调度单元发送目标控制指令;The instruction merging unit is further configured to: in the case that the instruction merging mode of the first computing instruction and the cached computing instruction is determined to be the second merging mode based on the instruction calculation type, send the instruction to the instruction scheduling unit Send target control instructions; 所述指令调度单元,用于在接收到所述目标控制指令之后,在同一个指令发射周期内将所述第一计算指令和所述已缓存计算指令发送到计算装置中进行计算处理。The instruction scheduling unit is configured to, after receiving the target control instruction, send the first calculation instruction and the cached calculation instruction to a computing device for calculation processing within the same instruction sending cycle. 11.根据权利要求1至10中任一项所述的指令处理装置,其特征在于,所述指令处理装置还包括:指令调度单元;11. The instruction processing apparatus according to any one of claims 1 to 10, wherein the instruction processing apparatus further comprises: an instruction scheduling unit; 所述指令调度单元,还用于在确定出查找到所述已缓存计算指令和所述第一计算指令不满足所述指令合并条件的情况下,将所述已缓存计算指令发送至计算装置进行处理,并将所述第一计算指令缓存至所述缓存空间。The instruction scheduling unit is further configured to send the cached computing instruction to a computing device for processing when it is determined that the cached computing instruction and the first computing instruction are found not to satisfy the instruction merging condition. processing, and cache the first computing instruction to the cache space. 12.一种指令处理方法,其特征在于,包括:12. An instruction processing method, comprising: 获取当前时刻待执行的第一计算指令;Obtain the first calculation instruction to be executed at the current moment; 在确定出所述第一计算指令为待合并指令的情况下,在缓存空间中查找已缓存计算指令;When it is determined that the first calculation instruction is an instruction to be merged, look up the cached calculation instruction in the cache space; 在确定出查找到的所述已缓存计算指令和所述第一计算指令满足指令合并条件的情况下,将所述第一计算指令和所述已缓存计算指令进行合并处理。When it is determined that the found cached calculation instruction and the first calculation instruction satisfy the instruction merging condition, the first calculation instruction and the cached calculation instruction are merged. 13.一种芯片,其特征在于,包括:指令分发装置、指令处理装置和计算装置;13. A chip, comprising: an instruction distribution device, an instruction processing device, and a computing device; 所述指令分发装置,用于向所述指令处理装置分发当前时刻待执行的第一计算指令;the instruction distribution device, configured to distribute the first computing instruction to be executed at the current moment to the instruction processing device; 所述指令处理装置,用于获取当前时刻待执行的第一计算指令;在确定出所述第一计算指令为待合并指令的情况下,在缓存空间中查找已缓存计算指令;在确定出查找到的所述已缓存计算指令和所述第一计算指令满足指令合并条件的情况下,将所述第一计算指令和所述已缓存计算指令进行合并处理,得到目标计算指令;The instruction processing device is used to obtain the first calculation instruction to be executed at the current moment; when it is determined that the first calculation instruction is an instruction to be merged, the cached calculation instruction is searched in the cache space; Under the condition that the received cached computing instruction and the first computing instruction satisfy the instruction merging condition, combine the first computing instruction and the cached computing instruction to obtain a target computing instruction; 所述计算装置,用于获取用于执行所述目标计算指令的操作数,并基于所述操作数执行所述目标计算指令。The computing device is configured to obtain operands for executing the target computing instruction, and execute the target computing instruction based on the operands. 14.一种板卡,其特征在于,包括:封装有至少一个如权利要求13所述芯片的封装结构。14. A board, comprising: a package structure encapsulating at least one chip according to claim 13. 15.一种计算机设备,其特征在于,包括如权利要求1至11中任一项所述的指令处理装置,或者如权利要求13所述的芯片,或者如权利要求14所述的板卡。15 . A computer device, characterized in that it comprises the instruction processing device according to any one of claims 1 to 11 , or the chip according to claim 13 , or the board according to claim 14 . 16.一种计算机可读存储介质,其特征在于,该计算机可读存储介质上存储有计算机程序,该计算机程序被处理器运行时执行如权利要求12所述的指令处理方法的步骤。16. A computer-readable storage medium, wherein a computer program is stored on the computer-readable storage medium, and the computer program executes the steps of the instruction processing method according to claim 12 when the computer program is run by a processor.
CN202210612463.8A 2022-05-31 2022-05-31 Instruction processing method, device, chip, board, device and medium Pending CN115016848A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202210612463.8A CN115016848A (en) 2022-05-31 2022-05-31 Instruction processing method, device, chip, board, device and medium

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202210612463.8A CN115016848A (en) 2022-05-31 2022-05-31 Instruction processing method, device, chip, board, device and medium

Publications (1)

Publication Number Publication Date
CN115016848A true CN115016848A (en) 2022-09-06

Family

ID=83070651

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202210612463.8A Pending CN115016848A (en) 2022-05-31 2022-05-31 Instruction processing method, device, chip, board, device and medium

Country Status (1)

Country Link
CN (1) CN115016848A (en)

Citations (8)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US20130262839A1 (en) * 2012-03-28 2013-10-03 International Business Machines Corporation Instruction merging optimization
CN105453031A (en) * 2012-03-28 2016-03-30 国际商业机器公司 Instruction merging optimization
US20180373539A1 (en) * 2017-06-23 2018-12-27 Shanghai Zhaoxin Semiconductor Co., Ltd. System and method of merging partial write results for resolving renaming size issues
CN110688155A (en) * 2019-09-11 2020-01-14 上海高性能集成电路设计中心 Merging method for storage instruction accessing non-cacheable area
US20200042322A1 (en) * 2018-08-03 2020-02-06 Futurewei Technologies, Inc. System and method for store instruction fusion in a microprocessor
CN112199118A (en) * 2020-10-13 2021-01-08 Oppo广东移动通信有限公司 Instruction merging method, out-of-order execution equipment, chip and storage medium
CN112214242A (en) * 2020-09-23 2021-01-12 上海赛昉科技有限公司 RISC-V instruction compression method, system and computer readable medium
US20220114005A1 (en) * 2020-10-12 2022-04-14 Hewlett Packard Enterprise Development Lp Comparing tags for determining matching virtual machine images in cloud networks

Patent Citations (8)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US20130262839A1 (en) * 2012-03-28 2013-10-03 International Business Machines Corporation Instruction merging optimization
CN105453031A (en) * 2012-03-28 2016-03-30 国际商业机器公司 Instruction merging optimization
US20180373539A1 (en) * 2017-06-23 2018-12-27 Shanghai Zhaoxin Semiconductor Co., Ltd. System and method of merging partial write results for resolving renaming size issues
US20200042322A1 (en) * 2018-08-03 2020-02-06 Futurewei Technologies, Inc. System and method for store instruction fusion in a microprocessor
CN110688155A (en) * 2019-09-11 2020-01-14 上海高性能集成电路设计中心 Merging method for storage instruction accessing non-cacheable area
CN112214242A (en) * 2020-09-23 2021-01-12 上海赛昉科技有限公司 RISC-V instruction compression method, system and computer readable medium
US20220114005A1 (en) * 2020-10-12 2022-04-14 Hewlett Packard Enterprise Development Lp Comparing tags for determining matching virtual machine images in cloud networks
CN112199118A (en) * 2020-10-13 2021-01-08 Oppo广东移动通信有限公司 Instruction merging method, out-of-order execution equipment, chip and storage medium

Similar Documents

Publication Publication Date Title
CN109784930B (en) A method, device, electronic device and medium for processing blockchain transaction data
US5862400A (en) Formula processor having cache means for storing and retrieving results of previously computed formulas based on identification and dependency information
US11868872B1 (en) Direct memory access operation for neural network accelerator
WO2021244194A1 (en) Register reading/writing method, chip, subsystem, register group, and terminal
US9703603B1 (en) System and method for executing accelerator call
CN105159841B (en) A kind of internal memory migration method and device
US10761822B1 (en) Synchronization of computation engines with non-blocking instructions
CN112100090A (en) Data access request processing method, device, medium and memory mapping controller
US20240143392A1 (en) Task scheduling method, chip, and electronic device
CN103150278A (en) Submission method of descriptor of network interface card (NIC) based on mixing of PIO (process input output) and DMA (direct memory access)
WO2024198954A1 (en) Method and apparatus for data scheduling based on ray tracing, system, device, storage medium, and computer program product
US20190294442A1 (en) Computer system and memory access technology
CN111258950B (en) Atomic fetch method, storage medium, computer equipment, apparatus and system
CN116897581A (en) Computing task scheduling device, computing task scheduling method, and computing method
CN111832714B (en) Computing methods and devices
CN116804915B (en) Data interaction method, processor, device and medium based on memory
CN110688223A (en) Data processing methods and related products
CN115016848A (en) Instruction processing method, device, chip, board, device and medium
CN118012628A (en) A data processing method, device and storage medium
US11907144B1 (en) Early semaphore update
WO2023134588A1 (en) Computing system, method and apparatus, and acceleration device
US11061654B1 (en) Synchronization of concurrent computation engines
US10997277B1 (en) Multinomial distribution on an integrated circuit
CN119311427B (en) Peripheral device interconnection to expand device resource management systems, devices and clusters
US20240111694A1 (en) Node identification allocation in a multi-tile system with multiple derivatives

Legal Events

Date Code Title Description
PB01 Publication
PB01 Publication
SE01 Entry into force of request for substantive examination
SE01 Entry into force of request for substantive examination