Instruction fetch method and related device
By pre-dividing the instruction sequence and creating task tables, using path merge instruction fetch and parallel instruction fetch relationships, the instruction flow discontinuity caused by jump instructions is solved, and the processor performance is improved and the instruction-level parallelism is improved. .
Patent Information
- Application Number
- PCT/CN2023/142035
- Authority / Receiving Office
- WO · WO
- Patent Type
- Applications
- Current Assignee / Owner
- Priority Date
- 2023-04-06
- Filing Date
- 2023-12-26
- Publication Date
- 2024-11-21
AI Technical Summary
When the prior art improves processor performance, the instruction flow discontinuity and instruction fetching capabilities are encountered by improving the instruction level parallelism by increasing the instruction level. Moreover, it is difficult for the serial instruction fetching mechanism to accurately extract complex controls and dependencies. instruction.
By pre-dividing the instruction sequence, creating a task table and a prediction table, using path merge instruction fetch and parallel instruction fetch relationships, ensuring the accurate start and end positions of instruction segments, and implementing parallel and serial merge and extraction of instructions.
Improves processor performance, can accurately extract instructions for complex control and dependencies, and enhances instruction-level parallelism.
Smart Images

Figure CN2023142035_21112024_PF_FP_ABST
Abstract
Description
A method and related device for extracting instruction
[0001] CROSS-REFERENCE TO RELATED APPLICATIONS
[0002] This application claims priority to the Chinese patent application filed with the China Patent Office on April 6, 2023, with application number 202310403892.9 and application name “A method for instruction extraction and related devices”, the entire contents of which are incorporated by reference into this application. Technical Field
[0003] The present application relates to the field of processor technology, and in particular to an instruction extraction method and related devices. Background Art
[0004] Currently, the primary approach to improving processor performance is to increase instruction-level parallelism. To achieve higher instruction-level parallelism, more instructions must be fetched within a single processor cycle. The existing instruction fetching method involves fetching instructions from the jump target during the next instruction fetch if a jump instruction is present in the instruction sequence fetched each cycle and the processor determines that the jump instruction needs to be executed. However, fetching instructions using jump instructions discontinuously reduces instruction fetching capabilities.
[0005] Because the number of jump instructions in an instruction sequence affects the number of instructions fetched, existing techniques address the limitation on instruction fetches due to jump instructions by expanding the width of the instruction fetch port within the microarchitecture using a serial instruction fetch mechanism. However, fetching instructions based solely on the serial instruction fetch mechanism still cannot accurately fetch a large number of instructions from instruction sequences with complex control and dependency relationships.
[0006] Summary of the Invention
[0007] In view of this, the present application provides an instruction extraction method and related devices, so that instruction sequences with complex control and dependencies can accurately extract more instructions and improve processor performance.
[0008] In a first aspect, the present application provides a method for instruction extraction, the method comprising: obtaining at least one instruction segment by pre-dividing an instruction sequence, and then creating a task table based on the tasks during the execution of each instruction segment, wherein the task table contains at least one task table item, and based on the created task table, determining a prediction table indicating the execution order of each task table item in the task table, and finally obtaining the instruction extraction result of the instruction sequence based on the created task table and the prediction table.
[0009] Compared with the prior art, which extracts instructions according to the execution order of instructions in the instruction sequence, the present application pre-divides the instruction sequence so that instruction sequences can be extracted according to instruction segments, thereby ensuring that instruction sequences with complex control and dependency relationships can also accurately extract more instructions, thereby improving processor performance.
[0010] In one possible design, the target partitioning rule is to pre-partition the instruction set according to the path merging instruction fetching; the path merging instruction fetching indicates the end of execution of the first instruction segment and the start of execution of the second instruction segment, and the first instruction segment and the second instruction segment are any one of the at least one instruction segment.
[0011] The present application defines a path merging instruction fetching method to ensure that the instruction sequence is divided by using the path merging instruction fetching method, and the accurate starting position and ending position of each instruction segment can be obtained.
[0012] In one possible design, the path merging instruction fetching indication in the instruction set indicates whether the instructions of the first instruction segment and the instructions of the second instruction segment are fetched according to the target execution order, and the first instruction segment and the second instruction segment are any one of the at least one instruction segment.
[0013] By defining different attributes for path merging and instruction fetching, instructions can be accurately extracted according to their different attributes.
[0014] In one possible design, the instruction set includes parallel instruction fetching, and there is a corresponding path merge instruction fetching in each instruction segment, and the number of parallel instruction fetching is the same as the number of path merge instruction fetching; the target instruction of the parallel instruction fetching in the first instruction segment is the starting instruction of the second instruction segment, and the first instruction segment and the second instruction segment are both any one of the at least one instruction segment.
[0015] This application defines the relationship between path merging instruction fetching and parallel instruction fetching, so that the instruction sequence can be fetched in parallel according to at least one instruction segment, and after fetching instructions separately in at least one instruction segment, the instructions can still be merged in the serial instruction fetch order, thereby ensuring that instruction sequences with complex control and dependency relationships can also accurately extract more instructions, thereby improving processor performance.
[0016] In one possible design, the instruction set includes mutually exclusive instruction fetches, and there is a corresponding path merge instruction fetch in any instruction segment for the mutually exclusive instruction fetches, and the path merge instruction fetch indicates that the instructions of the first instruction segment and the instructions of the second instruction segment are not fetched in accordance with the target execution order, and the first instruction segment and the second instruction segment are both any one of the at least one instruction segment.
[0017] The present application defines mutually exclusive instruction fetching to ensure that instructions in an instruction sequence that are mutually exclusive and cannot be fetched in parallel can be accurately fetched in accordance with the execution logic order.
[0018] In one possible design, when the first path merged instruction fetch in the first instruction segment indicates that the instructions of the first instruction segment and the instructions of the second instruction segment are fetched in the target execution order, the target task instruction fetch status in the first task table item corresponding to the first path merged instruction fetch in the task table is in a waiting state; and when the target task of the first path merged instruction fetch exists, the target task instruction fetch status in the first task table item remains unchanged, and the first instruction segment and the second instruction segment are both any one of the at least one instruction segment.
[0019] The present application defines differently the instruction fetching status of the target task in the first task table item when the association relationship between the instructions in the first instruction segment and the instructions in the second instruction segment is different, so that when different instructions are executed, the location of the executed instruction can be accurately determined based on the adjustment of the instruction fetching status of the target task in the first task table item.
[0020] In one possible design, when the first path merged instruction fetch in the first instruction segment indicates that the instructions of the first instruction segment and the instructions of the second instruction segment are fetched in the target execution order, the instruction fetch status of the target task in the first task table item corresponding to the first path merged instruction fetch in the task table is a waiting state; and when the target task of the first path merged instruction fetch does not exist, after the task corresponding to the target task identifier in the first task table item is merged, the instruction fetch status of the target task in the first task table item is changed from a waiting state to a mergeable state, and the first instruction segment and the second instruction segment are both any one of the at least one instruction segment.
[0021] The present application defines differently the instruction fetching status of the target task in the first task table item when the association relationship between the instructions in the first instruction segment and the instructions in the second instruction segment is different, so that when different instructions are executed, the location of the executed instruction can be accurately determined based on the adjustment of the instruction fetching status of the target task in the first task table item.
[0022] In one possible design, when the first path merged instruction fetch in the first instruction segment indicates that the instructions of the first instruction segment and the instructions of the second instruction segment are not fetched in the target execution order, the target task instruction fetch status in the first task table item corresponding to the first path merged instruction fetch in the task table is a mergeable state; and when the target task of the first path merged instruction fetch exists, the target task instruction fetch status in the first task table item remains unchanged, and the first instruction segment and the second instruction segment are both any one of the at least one instruction segment.
[0023] The present application defines differently the instruction fetching status of the target task in the first task table item when the association relationship between the instructions in the first instruction segment and the instructions in the second instruction segment is different, so that when different instructions are executed, the location of the executed instruction can be accurately determined based on the adjustment of the instruction fetching status of the target task in the first task table item.
[0024] In one possible design, when the first path merged instruction fetch in the first instruction segment indicates that the instructions of the first instruction segment and the instructions of the second instruction segment are not fetched in the target execution order, the target task instruction fetch status in the first task table item corresponding to the first path merged instruction fetch in the task table is a mergeable state; when the target task of the first path merged instruction fetch does not exist, and the first path merged instruction fetch also indicates that there are no mutually exclusive instructions between the instructions of the first instruction segment and the instructions of the second instruction segment, the target task instruction fetch status in the first task table item remains unchanged, and the first instruction segment and the second instruction segment are both any one of the at least one instruction segment.
[0025] The present application defines differently the instruction fetching status of the target task in the first task table item when the association relationship between the instructions in the first instruction segment and the instructions in the second instruction segment is different, so that when different instructions are executed, the location of the executed instruction can be accurately determined based on the adjustment of the instruction fetching status of the target task in the first task table item.
[0026] In one possible design, when the first path merged instruction fetch in the first instruction segment indicates that the instructions of the first instruction segment and the instructions of the second instruction segment are not fetched in the target execution order, the target task instruction fetch status in the first task table item corresponding to the first path merged instruction fetch in the task table is a mergeable state; when the target task of the first path merged instruction fetch does not exist, and the first path merged instruction fetch also indicates that there are mutually exclusive instructions between the instructions of the first instruction segment and the instructions of the second instruction segment, before determining the instruction fetch result of the instruction sequence based on the created task table and the prediction table, the method also includes: establishing a new task table item corresponding to the first path merged instruction in the mutually exclusive task table, and setting the mutually exclusive instruction fetch status in the first task table item to a non-idle state.
[0027] The present application determines whether the target task of the first path merge instruction fetching exists, and when the association relationship between the instructions in the first instruction segment and the instructions in the second instruction segment is different, the target task instruction fetching state in the first task table item is adaptively adjusted, so that when different instructions are executed, the location of the executed instruction can be accurately determined based on the adjustment of the target task instruction fetching state in the first task table item.
[0028] In the second aspect, the present application provides an instruction extraction device, which includes: an acquisition unit for acquiring an instruction sequence, the instruction sequence including at least one instruction segment; wherein the at least one instruction segment is determined according to a target division rule; a creation unit for creating a task table based on the tasks during the execution of each instruction segment, wherein the task table contains at least one task table item; each task table item contains at least a task identifier of the corresponding task; a first determination unit for determining a prediction table based on the created task table; the prediction table indicates the execution order of each task table item in the task table; a second determination unit for determining the instruction extraction result of the instruction sequence based on the created task table and the prediction table.
[0029] In one possible design, the target partitioning rule is to pre-partition the instruction set according to the path merging instruction fetching; the path merging instruction fetching indicates the end of execution of the first instruction segment and the start of execution of the second instruction segment, and the first instruction segment and the second instruction segment are any one of the at least one instruction segment.
[0030] In one possible design, the path merging instruction fetching indication in the instruction set indicates whether the instructions of the first instruction segment and the instructions of the second instruction segment are fetched according to the target execution order, and the first instruction segment and the second instruction segment are any one of the at least one instruction segment.
[0031] In one possible design, the instruction set includes parallel instruction fetching, and there is a corresponding path merge instruction fetching in each instruction segment, and the number of parallel instruction fetching is the same as the number of path merge instruction fetching; the target instruction of the parallel instruction fetching in the first instruction segment is the starting instruction of the second instruction segment, and the first instruction segment and the second instruction segment are both any one of the at least one instruction segment.
[0032] In one possible design, the instruction set includes mutually exclusive instruction fetches, and there is a corresponding path merge instruction fetch in any instruction segment for the mutually exclusive instruction fetches, and the path merge instruction fetch indicates that the instructions of the first instruction segment and the instructions of the second instruction segment are not fetched in accordance with the target execution order, and the first instruction segment and the second instruction segment are both any one of the at least one instruction segment.
[0033] In one possible design, when the first path merged instruction fetch in the first instruction segment indicates that the instructions of the first instruction segment and the instructions of the second instruction segment are fetched in the target execution order, the target task instruction fetch status in the first task table item corresponding to the first path merged instruction fetch in the task table is in a waiting state; and when the target task of the first path merged instruction fetch exists, the target task instruction fetch status in the first task table item remains unchanged, and the first instruction segment and the second instruction segment are both any one of the at least one instruction segment.
[0034] In one possible design, when the first path merged instruction fetch in the first instruction segment indicates that the instructions of the first instruction segment and the instructions of the second instruction segment are fetched in the target execution order, the instruction fetch status of the target task in the first task table item corresponding to the first path merged instruction fetch in the task table is a waiting state; and when the target task of the first path merged instruction fetch does not exist, after the task corresponding to the target task identifier in the first task table item is merged, the instruction fetch status of the target task in the first task table item is changed from a waiting state to a mergeable state, and the first instruction segment and the second instruction segment are both any one of the at least one instruction segment.
[0035] In one possible design, when the first path merged instruction fetch in the first instruction segment indicates that the instructions of the first instruction segment and the instructions of the second instruction segment are not fetched in the target execution order, the target task instruction fetch status in the first task table item corresponding to the first path merged instruction fetch in the task table is a mergeable state; and when the target task of the first path merged instruction fetch exists, the target task instruction fetch status in the first task table item remains unchanged, and the first instruction segment and the second instruction segment are both any one of the at least one instruction segment.
[0036] In one possible design, when the first path merged instruction fetch in the first instruction segment indicates that the instructions of the first instruction segment and the instructions of the second instruction segment are not fetched in the target execution order, the target task instruction fetch status in the first task table item corresponding to the first path merged instruction fetch in the task table is a mergeable state; when the target task of the first path merged instruction fetch does not exist, and the first path merged instruction fetch also indicates that there are no mutually exclusive instructions between the instructions of the first instruction segment and the instructions of the second instruction segment, the target task instruction fetch status in the first task table item remains unchanged, and the first instruction segment and the second instruction segment are both any one of the at least one instruction segment.
[0037] In one possible design, when the first path merged instruction fetch in the first instruction segment indicates that the instructions of the first instruction segment and the instructions of the second instruction segment are not fetched in accordance with the target execution order, the target task instruction fetch status of the first path merged instruction fetch in the corresponding first task table item in the task table is a mergeable state; when the target task of the first path merged instruction fetch does not exist, and the first path merged instruction fetch also indicates that there are mutually exclusive instructions between the instructions of the first instruction segment and the instructions of the second instruction segment, the first determination unit is also used to: establish a new task table item corresponding to the first path merged instruction in the mutually exclusive task table, and set the mutually exclusive instruction fetch status in the first task table item to a non-idle state.
[0038] In a third aspect, an embodiment of the present application provides a computing device comprising a processor and a memory; the memory is used to store computer program instructions; the processor executes and calls the computer program instructions in the memory to execute the method provided in any of the aforementioned aspects or any possible implementation of any of the aspects.
[0039] In a fourth aspect, an embodiment of the present application further provides a computer-readable storage medium, which stores a software program. When the software program is read and executed by one or more processors, it can implement any method provided by any design in any aspect.
[0040] In a fifth aspect, the present application provides a computer program product, comprising computer instructions that, when executed by a computing device, causes the computing device to perform the method provided in any of the aforementioned aspects or any possible implementations of any of the aforementioned aspects. The computer program product may be a software installation package, and when the method provided in any of the aforementioned aspects or any possible implementations of any of the aforementioned aspects is required, the computer program product may be downloaded and executed on the computing device.
[0041] In a sixth aspect, the present application also provides a chip, comprising a processor, which is coupled to a memory and is used to execute computer program instructions stored in the memory, so that the chip executes the method provided in any of the aforementioned aspects or any possible implementation of any of the aspects. BRIEF DESCRIPTION OF THE DRAWINGS
[0042] FIG1 is a schematic diagram of an application scenario of instruction extraction provided by an embodiment of the present application;
[0043] FIG2( a ) is a flow chart of a method for extracting instructions according to an embodiment of the present application;
[0044] FIG2( b ) is a schematic diagram of a process for performing instruction fetching based on parallel instruction fetching and path merging instruction fetching according to an embodiment of the present application;
[0045] FIG3 is a schematic diagram of a process for extracting instructions from an instruction sequence according to a processor architecture framework according to an embodiment of the present application;
[0046] FIG4 is a schematic diagram of a process for determining a subsequent task according to an embodiment of the present application;
[0047] FIG5 is a schematic diagram of a task merging process according to an embodiment of the present application;
[0048] FIG6 is a schematic diagram of a process for determining mutually exclusive tasks according to an embodiment of the present application;
[0049] FIG7 is a schematic diagram of a process for determining mutually exclusive tasks according to an embodiment of the present application;
[0050] FIG8( a ) is a schematic diagram of a process for executing boot according to an embodiment of the present application;
[0051] FIG8( b ) is a schematic diagram of a process for updating a prediction table according to an embodiment of the present application;
[0052] FIG8( c ) is a schematic diagram of the process of executing next provided in an embodiment of the present application;
[0053] FIG9 is a schematic diagram of the execution process of boot and next provided in an embodiment of the present application;
[0054] FIG10( a ) is a schematic diagram of the execution process of trigger.mutex and next.mutex provided in an embodiment of the present application;
[0055] FIG10( b ) is a schematic diagram of the execution process of trigger.mutex and next.mutex provided in an embodiment of the present application;
[0056] FIG11 is a schematic diagram of the execution process of next.serial provided in an embodiment of the present application;
[0057] FIG12 is a schematic structural diagram of an instruction extraction device provided in an embodiment of the present application;
[0058] FIG13 is a schematic diagram of the structure of a computing device provided in an embodiment of the present application. DETAILED DESCRIPTION
[0059] In order to enable ordinary people in the art to better understand the technical solutions of the present application, the technical solutions in the embodiments of the present application will be clearly and completely described below with reference to the accompanying drawings.
[0060] It should be noted that the terms "first," "second," and the like in the specification and claims of this application and the accompanying drawings are used to distinguish similar objects and are not necessarily used to describe a specific order or precedence. It should be understood that the terms used in this manner are interchangeable where appropriate, so that the embodiments of the application described herein can be implemented in an order other than those illustrated or described herein. The embodiments described in the following exemplary embodiments do not represent all embodiments consistent with the present application. Instead, they are merely examples of apparatus and methods consistent with certain aspects of the present application, as detailed in the appended claims.
[0061] Below, some terms used in the embodiments of the present application are explained to facilitate understanding by those skilled in the art.
[0062] 1. Terminal device: It can be a wireless terminal device that can receive base station scheduling and indication information. The wireless terminal device can be a device that provides voice and / or data connectivity to the user, or a handheld device with wireless connection function, or other processing device connected to a wireless modem.
[0063] Wireless terminal devices can communicate with one or more core networks or the Internet via a radio access network (e.g., a radio access network, RAN). Wireless terminal devices can be mobile terminal devices, such as mobile phones (also known as "cellular" phones, mobile phones), computers, and data cards. For example, they can be portable, pocket-sized, handheld, computer-built-in, or vehicle-mounted mobile devices that exchange voice and / or data with the radio access network. Examples include personal communication service (PCS) phones, cordless phones, Session Initiation Protocol (SIP) phones, wireless local loop (WLL) stations, personal digital assistants (PDAs), tablet computers, and computers with wireless transceiver capabilities. A wireless terminal device may also be referred to as a system, a subscriber unit, a subscriber station, a mobile station, a mobile station (MS), a remote station, an access point (AP), a remote terminal, an access terminal, a user terminal, a user agent, a subscriber station (SS), a customer premises equipment (CPE), a terminal, a UE, a mobile terminal (MT), etc. A terminal device may also be a wearable device and a next-generation communication system, for example, a terminal device in a 5G network or a terminal device in a future evolved public land mobile network (PLMN) network, a terminal device in a new radio (NR) communication system, etc.
[0064] 2. Server: This serves the terminal device. For example, the service might extract instructions from an instruction sequence based on at least one instruction segment pre-defined by the user. The server corresponds to the application installed on the terminal device and operates in conjunction with the application. The server may include a processor, hard drive, memory, and system bus. The processor may be a central processing unit (CPU), a graphics processing unit (GPU), or a network processing unit.
[0065] 3. Parallel instruction fetching: refers to the simultaneous fetching of multiple instructions at the same time, represented by boot.
[0066] 4. Path merging instruction fetching: refers to merging the instructions extracted by merging instruction fetching according to the execution logic order of the instructions to ensure the logical correctness of the instruction fetching, which is represented by next. Among them, path merging instruction fetching can indicate the association relationship between the first instruction segment at the end of execution and the second instruction segment at the beginning of execution, and the association relationship can be that the instructions in the first instruction segment and the instructions in the second instruction segment are fetched in the target execution order (represented by next.serial), or the association relationship can be that there is an instruction mutual exclusion relationship between the instructions in the first instruction segment and the instructions in the second instruction segment, and the instructions are not fetched in the target execution order (represented by next.mutex).
[0067] 5. Mutually exclusive instruction fetching: This means that there is a mutually exclusive relationship between instructions in two instruction segments, and instructions cannot be fetched in parallel at the same time. It is represented by trigger.mutex.
[0068] 6. Cancel the mutually exclusive instruction: This refers to the instruction to cancel the mutually exclusive instruction after the mutually exclusive instruction is executed, which is represented by end.mutex.
[0069] 7. Mergeable state: refers to the state where the target task fetching instruction in the task table entry is in the mergeable state after the task corresponding to the target task identifier in the task table entry is merged.
[0070] Currently, the primary approach to improving processor performance is to increase instruction-level parallelism. To achieve higher instruction-level parallelism, more instructions must be fetched within a single processor cycle. The existing instruction fetching method involves fetching instructions from the jump target during the next instruction fetch if a jump instruction is present in the instruction sequence fetched each cycle and the processor determines that the jump instruction needs to be executed. However, fetching instructions using jump instructions discontinuously reduces instruction fetching capabilities.
[0071] Because the number of jump instructions in an instruction sequence affects the number of instructions fetched, existing techniques address the limitation on instruction fetches due to jump instructions by expanding the width of the instruction fetch port within the microarchitecture using a serial instruction fetch mechanism. However, fetching instructions based solely on the serial instruction fetch mechanism still cannot accurately fetch a large number of instructions from instruction sequences with complex control and dependency relationships.
[0072] The present application obtains at least one instruction segment by pre-dividing the instruction sequence, and then creates at least one task table item in the task table based on the tasks in the execution process of each instruction segment. Based on the created task table, a prediction table indicating the execution order of each task table item in the task table is determined. Finally, based on the created task table and the prediction table, the instruction extraction result of the instruction sequence is obtained, thereby achieving accurate extraction of more instructions for instruction sequences with complex control and dependency relationships, thereby improving processor performance.
[0073] To this end, the present invention provides an instruction extraction method and related apparatus. In order to make the purpose, technical solution and advantages of the present invention more clear, the present invention will be further described in detail below with reference to the accompanying drawings.
[0074] FIG1 is a schematic diagram of an instruction fetch application scenario provided by an embodiment of the present application. The application scenario includes a terminal device 101 and a CPU 102. Terminal device 101 may include electronic devices such as a mobile phone 101-1, a computer 101-2, ..., a supercomputer 101-n, and the processor in CPU 102 may include processor cores 102-1, 102-2, ..., and 102-n. Terminal device 101 may also include, but is not limited to, electronic devices such as desktop computers, mobile phones, mobile computers, tablet computers, media players, smart wearable devices, and smart TVs.
[0075] Taking the interaction between mobile phone 101-1 and CPU102 as an example, the user first pre-marks the instruction sequence in mobile phone 101-1 to obtain at least one instruction segment. Then, mobile phone 101-1 sends the instruction sequence containing at least one instruction segment to CPU102. In CPU102, multiple processors are used to check at least one instruction segment in the instruction sequence to extract instructions and obtain instruction extraction results.
[0076] Of course, the method provided in the embodiment of the present application is not limited to the application scenario shown in Figure 1, and can also be used in other possible application scenarios, which are not limited by the embodiment of the present application. The functions that can be implemented by each device in the application scenario shown in Figure 1 will be described in the subsequent method embodiments, and will not be described in detail here.
[0077] To further illustrate the technical solutions provided by the embodiments of the present application, the following is a detailed description of the technical solutions in conjunction with the accompanying drawings and specific implementation methods. Although the embodiments of the present application provide method operation steps as shown in the following embodiments or drawings, more or fewer operation steps may be included in the method based on routine or no creative work. In steps where there is no necessary causal relationship logically, the execution order of these steps is not limited to the execution order provided in the embodiments of the present application.
[0078] The technical solution provided in the embodiment of the present application is described below in conjunction with the application scenario shown in FIG1 .
[0079] FIG2( a ) shows a flow chart of an instruction extraction method provided by the present application, which is applied to a processor. The method includes the following steps:
[0080] S201: Acquire an instruction sequence, where the instruction sequence includes at least one instruction segment.
[0081] S202: Creating a task table based on the tasks in the execution process of each instruction segment, wherein the task table includes at least one task table entry; each task table entry includes at least a task identifier of a corresponding task.
[0082] S203: Determine a prediction table based on the created task table; the prediction table indicates the execution order of each task table item in the task table.
[0083] S204: Determine the instruction extraction result of the instruction sequence based on the created task table and prediction table.
[0084] Here, at least one instruction segment is determined according to a target division rule, and the target division rule is pre-divided according to the path merging instruction fetching in the instruction set. Assuming that the first instruction segment and the second instruction segment are any one of the at least one instruction segment, the path merging instruction fetching indicates the end of execution of the first instruction segment and the start of execution of the second instruction segment. In addition, the instruction set also includes parallel fetching instructions, and the target instruction of the parallel fetching instruction in the first instruction segment is the starting instruction of the second instruction segment. The parallel fetching instruction is pre-marked in each instruction segment, and the position of the parallel fetching instruction in each instruction segment is the same. The number of parallel fetching instructions in each instruction segment is the same as the number of path merging instruction fetching instructions, and there is a corresponding path merging instruction for each parallel fetching instruction.
[0085] For example, as shown below, Code Segment 1 shows the C code, and Code Segment 2 shows the corresponding pseudo-assembly code. The pseudo-assembly code in Code Segment 2 pre-marks the location of the parallel fetch instruction (represented by boot) and the location of the path merge fetch instruction (represented by next). Figure 2(b) shows the process of instruction extraction based on parallel fetch and path merge fetch. As shown in Figure 2(b), path merge fetch divides the instruction sequence into multiple instruction segments. Assuming b0, b1, b2, parallel fetch, b3, and path merge fetch are the first instruction segment, then b1, b2, parallel fetch, b3, and path merge fetch are the second instruction segment. Path merge fetch indicates the end of execution of the first instruction segment and the beginning of execution of the second instruction segment. The target instruction of the parallel fetch instruction in the first instruction segment is the starting instruction b1 of the second instruction segment. As shown in Code Segment 2 and Figure 2(b), the location of the parallel fetch instruction in each instruction segment is the same, and the number of parallel fetch instructions and path merge fetch instructions in each instruction segment is the same.
[0086] Code Snippet 1:
[0087] for(i=0;i <max;i++){
[0088] array[i]=i;
[0089] }
[0090] Code snippet 2:
[0091] Optionally, for any corresponding parallel instruction fetch and path merging instruction fetch in each instruction segment, the position of the parallel instruction fetch in the instruction segment takes precedence over the position of the path merging instruction fetch in the corresponding instruction segment. For example, the position of the parallel instruction fetch in the first instruction segment shown in Figure 2(b) takes precedence over the position of the path merging instruction fetch.
[0092] As shown in Figure 3, the process of fetching instructions from an instruction sequence according to the processor structure framework is illustrated, taking the application of the processor as an example. First, the processor includes multiple instruction fetch modules (which can be represented by fetch modules) and an instruction fetch scheduling module. Each instruction fetch module fetches an instruction segment from an independent instruction cache icache. For example, Figure 2(b) illustrates this. Assuming that an instruction fetch module fetches the first instruction segment containing b0, b1, b2, parallel fetch, b3, and path merge fetch, the instruction fetch module sends the parallel fetch and path merge fetch in the first instruction segment to the instruction fetch buffer module in the instruction fetch scheduling module, and sends b0, b1, b2, and b3 in the first instruction segment to the instruction buffer module.
[0093] For any first parallel instruction fetch and first path merged instruction fetch corresponding to any first instruction segment in at least one instruction segment: when the first parallel instruction fetch is executed in the first instruction segment, a first task table entry corresponding to the first parallel instruction fetch is established in the task table of FIG3 , and when the first instruction segment executes the first path merged instruction fetch, the first task table entry in the task table is updated. After each parallel instruction fetch and corresponding path merged instruction fetch are executed in each instruction segment, a prediction table is determined based on the created task table, and the executable order of each task table entry in the task table is indicated by the prediction table. Then, based on the created task table and prediction table, the steps of creating tasks in the instruction fetch execution process are implemented, and finally, by updating the completed task table and prediction table, task scheduling is performed to obtain the instruction extraction result of the instruction sequence. The mutually exclusive task table in FIG3 will be introduced in detail later and will not be repeated here.
[0094] As can be seen from the above description, the instruction fetch module needs to sequentially send at least one parallel instruction fetch and at least one path-merged instruction fetch to the instruction fetch buffer module. Each instruction in the instruction fetch buffer module has the instruction code, target instruction location, and task attributes of the target instruction as shown in Table 1 below. The task attributes here will be explained in detail later and will not be repeated here.
[0095] Table 1
[0096] Optionally, the instruction fetch process of an instruction segment is defined as a task, and each task has a corresponding task table entry in the task table. After each instruction in the instruction fetch buffer module corresponding to an instruction fetch module begins execution, the instruction fetch module can continue to fetch instructions for other tasks. If there is an unfinished current task in the instruction fetch buffer module, the target instruction fetch status (represented by next_PC) in the task table entry corresponding to the current task in the task table is updated:
[0097] Next, the composition of the task table is introduced. The task table records the tasks that are currently fetching instructions or are about to fetch instructions. Each task table entry may include parameter information as shown in Table 2.
[0098] Table 2
[0099] Here, the task ID is used as the index for searching the task entry in the task table.
[0100] When executing any first instruction in at least one parallel instruction fetch or at least one path merge instruction fetch, the following steps are performed for the task table:
[0101] A1: Based on the instruction attributes of the first instruction, determine whether to continue fetching the subsequent task under the current task, create a new task, or ignore the new task;
[0102] A2: If a new task is being created, determine the location of the active entry in the task table that is in the idle state and obtain the task ID corresponding to that location.
[0103] A3: If there is no idle position in the active entry in the task table at this time, then ignore the new task, or delete the subsequent task that continues to fetch instructions under the current task, or suspend instruction fetching;
[0104] A4: Update the task table entry corresponding to the first instruction in the task table according to the execution result of the first instruction.
[0105] In the example of the first and second instruction segments in FIG2(b), when the first instruction segment begins fetching instructions, the main path parameter of the first instruction segment is defined as a non-idle state. When the second instruction segment begins fetching instructions, the main path parameter of the second instruction segment is defined as an idle state. The thread identifier of the first instruction segment and the thread identifier of the second instruction segment are the same.
[0106] According to the instruction attributes of parallel instruction fetch, executing parallel instruction fetch requires creating a new task in the task table. Next, we will continue to introduce the process of creating a task table entry in the task table when executing parallel instruction fetch:
[0107] First, obtain the parameter information in Table 1 corresponding to the parallel instruction fetch from the instruction fetch buffer module, then obtain the parameter information of the currently executing task as shown in Table 3 from the instruction fetch module, and then determine the position where the active table entry is in the idle state from the task table. Assuming that the task identifier corresponding to this position is valid_index, then when executing parallel instruction fetch, the task table entry of the new task created is shown in Table 4.
[0108] Table 3
[0109] Table 4
[0110] When creating a new task based on parallel instruction fetching, the parameters in the task table entry corresponding to the current task need to be updated:
[0111] As can be seen from the above content, each parallel instruction fetch takes precedence over the corresponding path merge fetch instruction, and the target instruction of the parallel instruction fetch is the starting position of the path merge fetch partition instruction. Therefore, when executing the path merge fetch instruction, it is necessary to determine whether a new task needs to be created. Here, we will explain in detail how to determine whether a new task needs to be created. Here, we will continue to describe the process of creating a task table entry when a new task needs to be created:
[0112] First, obtain the parameter information in Table 1 corresponding to the path merging instruction fetch from the instruction fetch buffer module. Then, obtain the parameter information of the currently executing task as shown in Table 3 from the instruction fetch module. Then, determine the position where the active table entry is in the idle state from the task table. Assuming that the task identifier corresponding to this position is valid_index, then when executing the path merging instruction fetch, the task table entry of the new task created is shown in Table 5.
[0113] Table 5
[0114] Similarly, when creating a new task based on path merging instruction fetching, the parameters in the task table entry corresponding to the current task need to be updated:
[0115] Next, we will introduce the process of determining whether a new task needs to be created when executing path merging instructions:
[0116] As shown in Figure 4, target_PC is obtained based on the pending path merge instruction, and successor_id is obtained from the currently executing instruction. Then, using successor_id as an index, the start_PC and active corresponding to the successor_id are retrieved from the corresponding task table entry in the task table. If active is not idle and start_PC == target_PC, then a successor task exists for the pending path merge instruction, and there is no need to create a new task. Here, the existing successor task is the task created by the parallel instruction fetch corresponding to the pending path merge instruction.
[0117] When executing a path merge instruction fetch for an existing successor task, the updated parameter information needs to be merged with the parameter information of the existing successor task. As shown in Figure 5, the task table entry parameter information corresponding to the successor task is obtained as shown in Table 6. Then, the task table entry parameter information corresponding to the execution path merge instruction is updated based on the parameter information in Table 6. The updated parameter information is shown in Table 7. The fetch_model_id_found in Table 7 is then sent to the instruction fetch module of the successor task, which then continues to fetch the instruction. At the same time, the instruction fetch module where the path merge instruction is located is set to an idle state.
[0118] Table 6
[0119] Table 7
[0120] In the case where there is no subsequent task, continue to determine whether a new task needs to be created based on the instruction attributes of the path merging instructions to be executed. Take the example of the path merging instruction fetch indicating the end of execution of the first instruction segment and the start of execution of the second instruction segment: If the path merging instruction fetch also indicates that the instructions of the first instruction segment and the instructions of the second instruction segment are not fetched according to the target execution order, and there are no mutually exclusive instructions between the instructions of the first instruction segment and the instructions of the second instruction segment, then there is no need to create a new task, and you can directly continue to fetch instructions of the subsequent segment in the existing task. If the path merging instruction fetch also indicates that the instructions of the first instruction segment and the instructions of the second instruction segment are fetched according to the target execution order, or there are mutually exclusive instructions between the instructions of the first instruction segment and the instructions of the second instruction segment, then it may be necessary to create a new task. The process of creating a new task has been introduced above and will not be repeated here.
[0121] Next, we will introduce the following process: the path merging instruction fetching indicates that the instructions of the first instruction segment and the instructions of the second instruction segment are fetched in the target execution order, and the instruction fetching process in which there are mutually exclusive instructions between the instructions of the first instruction segment and the instructions of the second instruction segment:
[0122] B1: Path merging instruction fetching indicates that the instructions of the first instruction segment and the instructions of the second instruction segment are fetched in the target execution order.
[0123] According to the instructions of the first instruction segment and the instructions of the second instruction segment, it is known that there is an instruction dependency relationship between the instructions of the first instruction segment and the instructions of the second instruction segment. Therefore, different state settings can be performed by fetch_next_status in the corresponding task table item of the instruction in the task table of Table 2 to accurately execute the order of fetching instructions. Here, fetch_next_status can include two types of mergeable state and waiting state. In the case of B1, the fetch_next_status corresponding to the current task is set to waiting state. It should be known that when creating a new task in the task table, fetch_next_status is waiting state in the task table item of the new task.
[0124] Optionally, if a subsequent task exists for path merging, then after merging the parameter information as described above, fetch_next_status remains in the waiting state. If a subsequent task does not exist for path merging, then after the current task completes, no further instruction fetching will occur until the task is merged, at which point fetch_next_status will be in the mergeable state.
[0125] B2: Path merging instruction fetching indicates that the instructions of the first instruction segment and the instructions of the second instruction segment are not fetched in the target execution order.
[0126] In this case, the fetch_next_status corresponding to the current task is set to the mergeable state. If the successor task of the path merging instruction fetching exists, then after the parameter information is merged according to the above description, fetch_next_status is still set to the mergeable state. If the successor task of the path merging instruction fetching does not exist, then in the case that there are no mutually exclusive instructions between the instructions of the first instruction segment and the instructions of the second instruction segment, the successor task instruction fetching continues in the existing task, and fetch_next_status is still set to the mergeable state. In the case that there are mutually exclusive instructions between the instructions of the first instruction segment and the instructions of the second instruction segment, it will be introduced in detail later and will not be repeated here.
[0127] In one embodiment of the present application, the instruction set may also include mutually exclusive fetch instructions, which can be used to create mutually exclusive tasks. When the path merging fetch instructions of each instruction segment in the instruction sequence indicate that there are mutually exclusive instructions between the instructions of the first instruction segment and the instructions of the second instruction segment, there are pre-marked mutually exclusive fetch instruction positions in both the first instruction segment and the second instruction segment, and the previous task of each mutually exclusive task is the end of the execution of the path merging fetch instruction with the mutually exclusive instruction. That is, to execute mutually exclusive fetch instructions, it is necessary to trigger the path merging fetch instruction first. Here, the creation of the mutually exclusive task table can refer to the task table creation process described above, which will not be repeated here.
[0128] Assume that a mutually exclusive task table is created as shown in Table 8:
[0129] Table 8
[0130] When executing a path merge fetch where mutually exclusive instructions exist, as shown in Figure 6, the first step is to check whether a matching mutually exclusive task exists in the mutex task table. The suffix _current indicates the task that executes next, while the absence of a suffix indicates a task entry in the mutually exclusive task table. A matching mutually exclusive task exists if the following conditions are met:
[0131] a)next_PC_current==start_PC
[0132] b) path_id_current==successor_id or path_id_current==path_id
[0133] c)active=true
[0134] If a matching mutually exclusive task exists, the corresponding task entry in the mutually exclusive task table is deleted. At this point, the task executing boot.next continues to execute the mutually exclusive task. If no matching mutually exclusive task exists, the task is suspended.
[0135] As shown in Figure 7, the steps for executing a mutex task include: first, searching the task table to see if there is a task waiting for the corresponding mutex task. The suffix _current indicates the task executing trigger.mutex; no suffix indicates a task entry in the task table. If the following conditions are met at the same time, there is a matching task waiting for the mutex task to be started by trigger.mutex:
[0136] a) target_PC == next_PC
[0137] b)successor_id_current==path_id
[0138] c)active=true
[0139] If a matching task is found, no new task entry is created in the mutex task table. The fetch_mutex_status corresponding to the task_id in the corresponding task entry is updated to idle. The mutex task continues to execute. If no matching task is found, a new task entry is created in the mutex task table.
[0140] Optionally, the instruction set may also include a cancel mutex fetch instruction (denoted by end.mutex). When executing the cancel mutex fetch instruction, a matching mutex task is first searched in the mutex task table. If a matching mutex task is found, the cancel fetch instruction is executed for that mutex task. If no matching mutex task is found, a backup task table entry corresponding to the cancel mutex fetch instruction is created in the mutex task table, denoted by the suffix _bk. The suffix _current indicates the task that executes end.mutex. The backup task contents are shown in Table 9 below:
[0141] Table 9
[0142] At the same time, the existing tasks are modified as shown in Table 10:
[0143] Table 10
[0144] The existing task is processed as a task that executes next.mutex until a trigger.mutex matches the task. At this point, the task is checked to see if it has the backed_up attribute. If so, the original content is restored from the backup task based on the successor_id, as shown in Table 11:
[0145] Table 11
[0146] After recovery, the task continues to execute.
[0147] Next, we'll describe the process of determining the execution order of instruction segments based on the prediction table: First, the prediction table indicates the executable order of each task entry in the task table. The prediction table can contain target_PC, executable score, and executable degree. The initial executable score is 0, and the initial executable degree is idle.
[0148] Then, as shown in Figure 8(a), when boot is executed, a new task is created in the task table and the prediction table is searched. If target_PC exists and the corresponding executable state is not idle, the corresponding task table entry in the task table will have a non-idle state. If a fetch module is idle, the task is fetched. Otherwise, the task is set to suspended, meaning that the schedulable state is idle.
[0149] As shown in Figure 8(b), when the task table is full and a new task is added, the task table entry with successor_id = 0 is deleted. This task table entry is indicated by the suffix _del. The task table entry with successor_id == task_id_del is searched and its successor_id is set to 0. When deleting a task table entry, the prediction table is searched based on the task table entry's start_PC. If the task table entry is found, its corresponding executable score is decremented by 1. When the executable score falls below the set threshold, the corresponding task table entry's executable status is set to idle.
[0150] As shown in Figure 8(c), when executing "next", if the schedulable of the merged task is idle, the prediction table is searched for the target_PC corresponding to the start_PC of the merged task. If the target_PC is not found, a new task table entry is created. If the target_PC is found, the executable score of the corresponding task table entry is increased by 1. If the executable score is greater than the set threshold, the executable status of the corresponding task table entry is non-idle.
[0151] Next, based on the above introduction, the execution process of the instruction extraction method provided by this application is illustrated by example:
[0152] Example 1:
[0153] Figure 9 shows a schematic diagram of the execution process of parallel instruction fetching (represented by boot) and path merging instruction fetching (represented by next). The specific steps include:
[0154] C1: Start a parallel instruction fetch task boot after instruction b2. The task ID of this new task is task_id i, and update the successor_id of the existing task corresponding to instruction b2 to i.
[0155] C2: Start a next after the b3 instruction. If the successor task of the existing task is not the task corresponding to task_id, that is, the next_PC does not match the start_PC corresponding to task_id, the existing task passes the successor_id to the successor task.
[0156] C3: When next_PC matches the start_PC corresponding to task_id, path merging is performed.
[0157] Example 2:
[0158] Figure 10(a) shows a schematic diagram of the execution process of mutually exclusive instruction fetching (represented by trigger.mutex) and path merging instruction fetching with mutually exclusive instructions (represented by next.mutex). The specific steps include:
[0159] D1: Start a parallel instruction fetch task boot after instruction b1. The task identifier task_id corresponding to this new task is i, and the successor_id in the existing task corresponding to instruction b2 is updated to i.
[0160] D2: When trigger.mutex occurs, the successor_id in the task table entry of the mutually exclusive task must be the path_id of the starting point of the new task. If there is no other boot in the existing task and the new task at this time, the path_id of the matching mutually exclusive task on the new task will match the successor_id on the original path.
[0161] Figure 10(b) shows a schematic diagram of the execution process of mutually exclusive instruction fetching (represented by trigger.mutex) and path merging instruction fetching with mutually exclusive instructions (represented by next.mutex). The specific steps include:
[0162] E1: Start a parallel instruction fetch task boot after instruction b1. The task identifier task_id corresponding to this new task is i, and the successor_id in the existing task corresponding to instruction b2 is updated to i.
[0163] E2: When the next.mutex occurs, the successor_id in the mutually exclusive task's task table entry must be the path_id of the new task's starting point. If other boots exist in the existing and new tasks, the path_id corresponding to b3' may change after the other boots have just completed. That is, the task_id and path_id will also be j. However, after executing next, b1' to b3' are merged, and the path_id becomes b1''s path_id, which is i. At this point, the successor_id still matches b4 in the existing task.
[0164] Among them, b4' can be executed after b1', b2', and b3' are executed, or after b4 is executed. That is, the two attributes next.serial and next.mutex of the path merging instruction next can be reflected in the above instruction segment at the same time. Here, next.serial.mutex can be used to mark the situation where the two attributes next.serial and next.mutex of next appear at the same time.
[0165] Example 3:
[0166] Figure 11 shows a schematic diagram of the execution process of sequential instructions (represented by next.serial) in the path merging instruction fetching process. The specific steps include:
[0167] F1: Due to the dependency relationship between sequential instructions in the instruction segment, the initial state of fetch_next_status in the task table entry of instruction b1 is set to the mergeable state, the initial state of fetch_next_status in the task table entry of instruction a=fa() is set to the waiting state, and the initial state of fetch_next_status in the task table entry of instruction b=fb() is set to the waiting state;
[0168] F2: After the execution of the a=fa() instruction is completed, the fetch_next_status in the task table entry is set to the mergeable state, and then after the execution and merger with the b=fb() instruction are completed, the fetch_next_status in the merged task table entry is set to the mergeable state.
[0169] Example 4:
[0170] Table 12 shows the nested inner and outer loop codes. When performing instruction extraction on the nested inner and outer loop codes, the following steps are included:
[0171] G1: During initial execution, neither boot loop_1 nor boot loop_2 is executed.
[0172] G2: When next loop_2 determines that boot loop_2 is not executed but exists in the task table, it adds points to loop_2 in the prediction table.
[0173] G3: After several cycles, the loop_2 score reaches the threshold, then boot loop_2 is encountered again, and instructions for loop_2 are fetched in parallel.
[0174] G4: If loop_2 does not have many cycles and can still process boot loop_1 requests, then determine the unexecuted loop_1 tasks based on next loop_1 and start parallel loop_1.
[0175] G5: If loop_1 fills the task table and loop_2 needs to be executed at the same time, loop_1 is deleted by deducting its score in the prediction table. When loop_1's score is less than the threshold, loop_1 no longer fetches instructions in parallel.
[0176] Table 12
[0177] Embodiment 5:
[0178] Table 13 shows an example in which the path merging instruction fetching indicates that the instructions of the first instruction segment and the instructions of the second instruction segment are fetched in the target execution order (indicated by next.serial).
[0179] Since there is no dependency between task_a and task_b, task_b can be fetched in parallel by the boot task_b instruction. At this time, if task_b completes instruction fetching, task_c can continue to fetch instructions even if task_a is not completed.
[0180] Since task_c is dependent on task_a and task_b, it is necessary to merge the instruction fetch results of task_a and task_b through the fetch instruction after both task_a and task_b have completed instruction fetching, and then fetch the instruction of task_c.
[0181] Table 13
[0182] Example 6:
[0183] Table 14 shows an example of mutually exclusive instruction fetching (represented by trigger.mutex). The trigger.mutex at the init position ensures that the mutex task can be executed for the first time. In the loop, since most of the main body can fetch instructions in parallel, the boot loop starts the parallel instruction fetching process. The code at the mutex position has dependencies between loops and must fetch instructions serially one by one in the order of loop execution. Therefore, the next.mutex mutex is used to indicate that the subsequent task is a mutex task. After the mutex task body ends, the trigger.mutex instruction is used to start the next mutex task. After the loop exits, the end.mutex deletes the mutex task that will not be used last time and was initiated by trigger.mutex.
[0184] Table 14
[0185] Therefore, the present application merges the instruction definitions of instruction fetching and parallel instruction fetching through the path in the instruction set, so that the instruction sequence can fetch instructions in parallel according to at least one instruction segment, and after fetching instructions separately in at least one instruction segment, the instructions can still be synthesized in the serial instruction fetch order, thereby achieving instruction sequences with complex control and dependency relationships. More instructions can also be accurately extracted, thereby improving processor performance.
[0186] Based on the same inventive concept as the method embodiment, the embodiment of the present application also provides an instruction extraction device for executing the above-mentioned instruction extraction method embodiment applied to the processor as shown in Figure 2(a). The relevant features can be found in the above-mentioned method embodiment and will not be repeated here. As shown in Figure 12, the device includes:
[0187] An acquiring unit 1201 is configured to acquire an instruction sequence, wherein the instruction sequence includes at least one instruction segment; wherein the at least one instruction segment is determined according to a target partitioning rule;
[0188] A creating unit 1202 is configured to create a task table based on the tasks in each instruction segment execution process, wherein the task table includes at least one task table entry; each task table entry includes at least a task identifier of the corresponding task;
[0189] The first determining unit 1203 is configured to determine a prediction table based on the created task table; the prediction table indicates the execution order of each task item in the task table;
[0190] The second determining unit 1204 is configured to determine an instruction extraction result of the instruction sequence based on the created task table and the prediction table.
[0191] In one possible design, the target partitioning rule is to pre-partition the instruction set according to the path merging instruction fetching; the path merging instruction fetching indicates the end of execution of the first instruction segment and the start of execution of the second instruction segment, and the first instruction segment and the second instruction segment are any one of the at least one instruction segment.
[0192] In one possible design, the path merging instruction fetching indication in the instruction set indicates whether the instructions of the first instruction segment and the instructions of the second instruction segment are fetched according to the target execution order, and the first instruction segment and the second instruction segment are any one of the at least one instruction segment.
[0193] In one possible design, the instruction set includes parallel instruction fetching, and there is a corresponding path merge instruction fetching in each instruction segment, and the number of parallel instruction fetching is the same as the number of path merge instruction fetching; the target instruction of the parallel instruction fetching in the first instruction segment is the starting instruction of the second instruction segment, and the first instruction segment and the second instruction segment are both any one of the at least one instruction segment.
[0194] In one possible design, the instruction set includes mutually exclusive instruction fetches, and there is a corresponding path merge instruction fetch in any instruction segment for the mutually exclusive instruction fetches, and the path merge instruction fetch indicates that the instructions of the first instruction segment and the instructions of the second instruction segment are not fetched in accordance with the target execution order, and the first instruction segment and the second instruction segment are both any one of the at least one instruction segment.
[0195] In one possible design, when the first path merged instruction fetch in the first instruction segment indicates that the instructions of the first instruction segment and the instructions of the second instruction segment are fetched in the target execution order, the target task instruction fetch status in the first task table item corresponding to the first path merged instruction fetch in the task table is in a waiting state; and when the target task of the first path merged instruction fetch exists, the target task instruction fetch status in the first task table item remains unchanged, and the first instruction segment and the second instruction segment are both any one of the at least one instruction segment.
[0196] In one possible design, when the first path merged instruction fetch in the first instruction segment indicates that the instructions of the first instruction segment and the instructions of the second instruction segment are fetched in the target execution order, the instruction fetch status of the target task in the first task table item corresponding to the first path merged instruction fetch in the task table is a waiting state; and when the target task of the first path merged instruction fetch does not exist, after the task corresponding to the target task identifier in the first task table item is merged, the instruction fetch status of the target task in the first task table item is changed from a waiting state to a mergeable state, and the first instruction segment and the second instruction segment are both any one of the at least one instruction segment.
[0197] In one possible design, when the first path merged instruction fetch in the first instruction segment indicates that the instructions of the first instruction segment and the instructions of the second instruction segment are not fetched in the target execution order, the target task instruction fetch status in the first task table item corresponding to the first path merged instruction fetch in the task table is a mergeable state; and when the target task of the first path merged instruction fetch exists, the target task instruction fetch status in the first task table item remains unchanged, and the first instruction segment and the second instruction segment are both any one of the at least one instruction segment.
[0198] In one possible design, when the first path merged instruction fetch in the first instruction segment indicates that the instructions of the first instruction segment and the instructions of the second instruction segment are not fetched in the target execution order, the target task instruction fetch status in the first task table item corresponding to the first path merged instruction fetch in the task table is a mergeable state; when the target task of the first path merged instruction fetch does not exist, and the first path merged instruction fetch also indicates that there are no mutually exclusive instructions between the instructions of the first instruction segment and the instructions of the second instruction segment, the target task instruction fetch status in the first task table item remains unchanged, and the first instruction segment and the second instruction segment are both any one of the at least one instruction segment.
[0199] In one possible design, when the first path merge fetch instruction in the first instruction segment indicates that instructions of the first instruction segment and instructions of the second instruction segment are not fetched in a target execution order, the instruction fetch status of the target task in the first task table entry corresponding to the first path merge fetch instruction in the task table is a mergeable state; when the target task of the first path merge fetch instruction does not exist, and the first path merge fetch instruction further indicates that there are mutually exclusive instructions between the instructions of the first instruction segment and the instructions of the second instruction segment, the first determining unit 1203 is further configured to:
[0200] A new task table entry corresponding to the first path combined instruction fetch in the mutually exclusive task table is created, and a mutually exclusive instruction fetch state in the first task table entry is set to a non-idle state.
[0201] It should be noted that the division of modules in the embodiments of the present application is illustrative and is merely a logical functional division. In actual implementation, other division methods may be used. The functional modules in the embodiments of the present application may be integrated into a single processing module, or each module may exist physically separately, or two or more modules may be integrated into a single module. The integrated modules may be implemented in either hardware or software functional modules.
[0202] The above method can be implemented in whole or in part using software, hardware, firmware, or any other combination. When implemented using software, the above method can be implemented in whole or in part in the form of a computer program product. A computer program product includes one or more computer instructions. When the computer program instructions are loaded or executed on a computer, the process or function according to the embodiments of the present invention is generated in whole or in part. The computer can be a general-purpose computer, a special-purpose computer, a computer network, or other programmable device. The computer instructions can be stored in a computer-readable storage medium or transmitted from one computer-readable storage medium to another. For example, the computer instructions can be transmitted from one website, computer, server, or data center to another website, computer, server, or data center via wired (e.g., coaxial cable, optical fiber, digital subscriber line (DSL)) or wireless (e.g., infrared, wireless, microwave, etc.) means. The computer-readable storage medium can be any available medium that can be accessed by a computer or a data storage device such as a server or data center that contains a collection of one or more available media. The available medium can be a magnetic medium (e.g., a floppy disk, a hard disk, a magnetic tape), an optical medium (e.g., a DVD), or a semiconductor medium. The semiconductor medium can be a solid state drive (SSD).
[0203] The device 1300 shown in FIG13 includes at least one processor 1301 , a memory 1302 , and optionally, a communication interface 1303 .
[0204] The memory 1302 may be a volatile memory, such as a random access memory (RAM); a non-volatile memory, such as a read-only memory (ROM), a flash memory, a hard disk drive (HDD), or a solid-state drive (SSD); or any other medium capable of carrying or storing desired program code in the form of instructions or data structures and accessible by a computer, but is not limited thereto. The memory 1302 may be a combination of the aforementioned memories.
[0205] The embodiment of the present application does not limit the specific connection medium between the processor 1301 and the memory 1302.
[0206] The processor 1301 may be a CPU, or other general-purpose processor, a digital signal processor (DSP), an application-specific integrated circuit (ASIC), a field programmable gate array (FPGA) or other programmable logic device, a discrete gate or transistor logic device, a discrete hardware component, an artificial intelligence chip, a chip-on-chip, etc. A general-purpose processor may be a microprocessor or any conventional processor, etc. In the device shown in FIG13 , an independent data transceiver module, such as a communication interface 1303, may also be provided for transmitting and receiving data; when the processor 1301 communicates with other devices, data may be transmitted through the communication interface 1303.
[0207] In a possible application scenario, the controller adopts the form shown in Figure 13. The processor 1301 in Figure 13 can call the computer execution instructions stored in the memory 1302, so that the controller can execute the startup control method of the chiller in any of the above method embodiments.
[0208] Those skilled in the art will appreciate that the embodiments of the present application can be provided as methods, systems, or computer program products. Therefore, the present application can adopt the form of a complete hardware embodiment, a complete software embodiment, or an embodiment in combination with software and hardware. Moreover, the present application can adopt the form of a computer program product implemented on one or more computer-usable storage media (including but not limited to magnetic disk storage, CD-ROM, optical storage, etc.) that contain computer-usable program code.
[0209] The present application is described with reference to the flowcharts and / or block diagrams of the methods, devices (systems), and computer program products according to the present application. It should be understood that each flow and / or box in the flow chart and / or block diagram, as well as the combination of the flow chart and / or box in the flow chart and / or block diagram, can be implemented by computer program instructions. These computer program instructions can be provided to a processor of a general-purpose computer, a special-purpose computer, an embedded processor, or other programmable data processing device to produce a machine, so that the instructions executed by the processor of the computer or other programmable data processing device produce a device for implementing the functions specified in one or more flow charts and / or one or more boxes in the block diagram.
[0210] These computer program instructions may also be stored in a computer-readable memory that can direct a computer or other programmable data processing device to operate in a specific manner, so that the instructions stored in the computer-readable memory produce a product including an instruction device that implements the functions specified in one or more processes in the flowchart and / or one or more boxes in the block diagram.
[0211] These computer program instructions can also be loaded onto a computer or other programmable data processing device so that a series of operating steps are executed on the computer or other programmable device to produce a computer-implemented process, so that the instructions executed on the computer or other programmable device provide steps for implementing the functions specified in one or more processes in the flowchart and / or one or more boxes in the block diagram.
[0212] Obviously, those skilled in the art may make various changes and modifications to the present application without departing from the scope of the present application. Thus, if these modifications and variations of the present application fall within the scope of the claims of the present application and their equivalents, the present application is intended to include these modifications and variations.
Claims
1. A method for instruction extraction, characterized in that: The method comprises: Acquire an instruction sequence, wherein the instruction sequence includes at least one instruction segment; wherein the at least one instruction segment is determined according to a target partitioning rule; Based on the tasks in each instruction segment execution process, a task table is created, wherein the task table contains at least one task table item; each task table item contains at least a task identifier of a corresponding task; Based on the created task table, determining a prediction table; the prediction table indicates the execution order of each task table item in the task table; Based on the created task table and prediction table, an instruction fetch result of the instruction sequence is determined.
2. The method according to claim 1, characterized in that The target division rule is to pre-divide the instruction set according to the path merging instruction fetching in the instruction set; the path merging instruction fetching indicates the end of execution of the first instruction segment and the start of execution of the second instruction segment, and the first instruction segment and the second instruction segment are any one of the at least one instruction segment.
3. The method according to claim 1 or 2, characterized in that The path merging instruction fetching indication in the instruction set indicates whether the instructions of the first instruction segment and the instructions of the second instruction segment are fetched according to the target execution order, and the first instruction segment and the second instruction segment are any one of the at least one instruction segment.
4. The method according to any one of claims 1 to 3, characterized in that: The instruction set includes parallel fetch instructions, and there is a corresponding path merge fetch instruction in each instruction segment, and the number of parallel fetch instructions is the same as the number of path merge fetch instructions; the target instruction of the parallel fetch instruction in the first instruction segment is the starting instruction of the second instruction segment, and the first instruction segment and the second instruction segment are any one of the at least one instruction segment.
5. The method according to any one of claims 1 to 4, characterized in that: The instruction set includes mutually exclusive fetch instructions, and there is a corresponding path merging fetch instruction in any instruction segment for the mutually exclusive fetch instructions, and the path merging fetch instruction indicates that the instructions of the first instruction segment and the instructions of the second instruction segment are not fetched according to the target execution order, and the first instruction segment and the second instruction segment are any one of the at least one instruction segment.
6. The method according to any one of claims 1 to 5, characterized in that: When the first path merge instruction fetch in the first instruction segment indicates that the instructions of the first instruction segment and the instructions of the second instruction segment are fetched according to the target execution order, the instruction fetch status of the target task in the first task table item corresponding to the first path merge instruction fetch in the task table is a waiting state; and when the target task of the first path merge instruction fetch exists, the instruction fetch status of the target task in the first task table item remains unchanged, and the first instruction segment and the second instruction segment are any one of the at least one instruction segment.
7. The method according to any one of claims 1 to 6, characterized in that: When the first path merge instruction fetch in the first instruction segment indicates that the instructions of the first instruction segment and the instructions of the second instruction segment are fetched according to the target execution order, the instruction fetch status of the target task in the first task table item corresponding to the first path merge instruction fetch in the task table is a waiting state; and when the target task of the first path merge instruction fetch does not exist, after the task corresponding to the target task identifier in the first task table item is merged, the instruction fetch status of the target task in the first task table item is changed from a waiting state to a mergeable state, and the first instruction segment and the second instruction segment are any one of the at least one instruction segment.
8. The method according to any one of claims 1 to 7, characterized in that: When the first path merge instruction fetch in the first instruction segment indicates that the instructions of the first instruction segment and the instructions of the second instruction segment are not fetched in the target execution order, the instruction fetch status of the target task in the first task table item corresponding to the first task table in the task table by the first path merge instruction fetch is a mergeable state; and when the target task of the first path merge instruction fetch exists, the instruction fetch status of the target task in the first task table item remains unchanged, and the first instruction segment and the second instruction segment are any one of the at least one instruction segment.
9. The method according to any one of claims 1 to 8, characterized in that When the first path merge instruction fetch in the first instruction segment indicates that the instructions of the first instruction segment and the instructions of the second instruction segment are not fetched in the target execution order, the instruction fetch status of the target task in the first task table item corresponding to the first path merge instruction fetch in the task table is a mergeable state; when the target task of the first path merge instruction fetch does not exist, and the first path merge instruction fetch also indicates that there are no mutually exclusive instructions between the instructions of the first instruction segment and the instructions of the second instruction segment, the instruction fetch status of the target task in the first task table item remains unchanged, and the first instruction segment and the second instruction segment are any one of the at least one instruction segment.
10. The method according to any one of claims 1 to 9, characterized in that: When the first path merge fetch instruction in the first instruction segment indicates that the instructions of the first instruction segment and the instructions of the second instruction segment are not fetched according to the target execution order, the target task fetch instruction state in the first task table entry corresponding to the first path merge fetch instruction in the task table is a mergeable state; when the target task of the first path merge fetch instruction does not exist, and the first path merge fetch instruction also indicates that there are mutually exclusive instructions between the instructions of the first instruction segment and the instructions of the second instruction segment, before determining the instruction fetch result of the instruction sequence based on the created task table and the prediction table, the method further includes: A new task table entry corresponding to the first path combined instruction fetching in the mutually exclusive task table is established, and the mutually exclusive instruction fetching state in the first task table entry is set to a non-idle state.
11. An instruction extraction device, characterized in that: The device comprises: An acquisition unit, configured to acquire an instruction sequence, wherein the instruction sequence includes at least one instruction segment; wherein the at least one instruction segment is determined according to a target partitioning rule; A creating unit, configured to create a task table based on the tasks in each instruction segment execution process, wherein the task table contains at least one task table item; each task table item contains at least a task identifier of a corresponding task; A first determining unit is used to determine a prediction table based on the created task table; the prediction table indicates the execution order of each task table item in the task table; The second determining unit is used to determine the instruction extraction result of the instruction sequence based on the created task table and the prediction table.
12. The device according to claim 11, characterized in that The target division rule is to pre-divide the instruction set according to the path merging instruction fetching in the instruction set; the path merging instruction fetching indicates the end of execution of the first instruction segment and the start of execution of the second instruction segment, and the first instruction segment and the second instruction segment are any one of the at least one instruction segment.
13. The device according to claim 11 or 12, characterized in that The path merging instruction fetching indication in the instruction set indicates whether the instructions of the first instruction segment and the instructions of the second instruction segment are fetched according to the target execution order, and the first instruction segment and the second instruction segment are any one of the at least one instruction segment.
14. The device according to any one of claims 11 to 13, characterized in that: The instruction set includes parallel fetch instructions, and there is a corresponding path merge fetch instruction in each instruction segment, and the number of parallel fetch instructions is the same as the number of path merge fetch instructions; the target instruction of the parallel fetch instruction in the first instruction segment is the starting instruction of the second instruction segment, and the first instruction segment and the second instruction segment are any one of the at least one instruction segment.
15. The device according to any one of claims 11 to 14, characterized in that: The instruction set includes mutually exclusive fetch instructions, and there is a corresponding path merging fetch instruction in any instruction segment for the mutually exclusive fetch instructions, and the path merging fetch instruction indicates that the instructions of the first instruction segment and the instructions of the second instruction segment are not fetched according to the target execution order, and the first instruction segment and the second instruction segment are any one of the at least one instruction segment.
16. The device according to any one of claims 11 to 15, characterized in that When the first path merge instruction fetch in the first instruction segment indicates that the instructions of the first instruction segment and the instructions of the second instruction segment are fetched according to the target execution order, the instruction fetch status of the target task in the first task table item corresponding to the first path merge instruction fetch in the task table is a waiting state; and when the target task of the first path merge instruction fetch exists, the instruction fetch status of the target task in the first task table item remains unchanged, and the first instruction segment and the second instruction segment are any one of the at least one instruction segment.
17. The device according to any one of claims 11 to 16, characterized in that: When the first path merge instruction fetch in the first instruction segment indicates that the instructions of the first instruction segment and the instructions of the second instruction segment are fetched according to the target execution order, the instruction fetch status of the target task in the first task table item corresponding to the first path merge instruction fetch in the task table is a waiting state; and when the target task of the first path merge instruction fetch does not exist, after the task corresponding to the target task identifier in the first task table item is merged, the instruction fetch status of the target task in the first task table item is changed from a waiting state to a mergeable state, and the first instruction segment and the second instruction segment are any one of the at least one instruction segment.
18. The device according to any one of claims 11 to 17, characterized in that When the first path merge instruction fetch in the first instruction segment indicates that the instructions of the first instruction segment and the instructions of the second instruction segment are not fetched in the target execution order, the instruction fetch status of the target task in the first task table item corresponding to the first task table in the task table by the first path merge instruction fetch is a mergeable state; and when the target task of the first path merge instruction fetch exists, the instruction fetch status of the target task in the first task table item remains unchanged, and the first instruction segment and the second instruction segment are any one of the at least one instruction segment.
19. The device according to any one of claims 11 to 18, characterized in that When the first path merge instruction fetch in the first instruction segment indicates that the instructions of the first instruction segment and the instructions of the second instruction segment are not fetched in the target execution order, the instruction fetch status of the target task in the first task table item corresponding to the first path merge instruction fetch in the task table is a mergeable state; when the target task of the first path merge instruction fetch does not exist, and the first path merge instruction fetch also indicates that there are no mutually exclusive instructions between the instructions of the first instruction segment and the instructions of the second instruction segment, the instruction fetch status of the target task in the first task table item remains unchanged, and the first instruction segment and the second instruction segment are any one of the at least one instruction segment.
20. The device according to any one of claims 11 to 19, characterized in that When the first path merge fetch instruction in the first instruction segment indicates that the instructions of the first instruction segment and the instructions of the second instruction segment are not fetched according to the target execution order, the target task fetch instruction state of the first path merge fetch instruction in the first task table entry corresponding to the task table is a mergeable state; when the target task of the first path merge fetch instruction does not exist, and the first path merge fetch instruction also indicates that there are mutually exclusive instructions between the instructions of the first instruction segment and the instructions of the second instruction segment, the first determining unit is further used to: A new task table entry corresponding to the first path combined instruction fetching in the mutually exclusive task table is established, and the mutually exclusive instruction fetching state in the first task table entry is set to a non-idle state.
21. A computing device, characterized in that including a processor and a memory; The memory is used to store computer program instructions; The processor executes and calls the computer program instructions in the memory to perform the method according to any one of claims 1 to 10.
22. A chip, characterized in that: The chip comprises a processor, which is coupled to a memory and is used to execute computer program instructions stored in the memory, so that the chip executes the method according to any one of claims 1 to 10.
23. A computer-readable storage medium, characterized in that: The method comprises computer program instructions. When the computer program instructions are executed by a computing device, the computing device executes the method according to any one of claims 1 to 10.
