Instruction execution method, device, electronic device, storage medium and program product

By co-processing the execution sequence of memory instructions and non-memory instructions in the artificial intelligence processor, the problem of insufficient performance improvement of traditional processors in artificial intelligence applications is solved, more efficient instruction execution and programming correctness are achieved, and artificial intelligence is promoted. The development of intelligent processors.

CN111857825BActive Publication Date: 2024-10-29KUNLUNXIN TECHNOLOGY (BEIJING) CO LTD
View PDF 2 Cites 0 Cited by

Patent Information

Application Number
CN202010699439.3
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2020-07-20
Publication Date
2024-10-29
Estimated Expiration
2040-07-20

AI Technical Summary

Technical Problem

In artificial intelligence application scenarios, the performance improvement of traditional processors due to cache is not obvious, and the performance may be reduced in scenarios where data is used and thrown away, and traditional storage model systems and methods cannot be fully applicable to notes in artificial intelligence processors The memory structure makes it difficult to guarantee programming accuracy and performance.

Method used

By determining, during instruction execution, that execution of the first memory instruction needs to be completed before beginning execution of the second memory instruction, and executing non-memory instructions during the cycle in which the first memory instruction is executed, without executing the second memory instruction, to coordinate Handle risky conflicts between memory instructions and leverage hardware and software collaboration to improve processor performance.

Benefits of technology

While improving the overall performance of the processor, it ensures programming accuracy and ease of use, improves the efficiency of the processor in artificial intelligence applications, and contributes to the promotion of artificial intelligence processors.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN111857825B_ABST
    Figure CN111857825B_ABST
Patent Text Reader

Abstract

According to an example embodiment of the present disclosure, an instruction execution method, apparatus, electronic device, storage medium and program product are provided, which can be used in the field of artificial intelligence. The instruction execution method includes: executing an instruction sequence, the instruction sequence includes memory instructions and non-memory instructions, and the instructions in the execution sequence start to execute in sequence; determining that the execution of a first memory instruction needs to be completed before starting to execute a second memory instruction, and the second memory instruction is the next memory instruction after the first memory instruction in the instruction sequence; and during the cycle of executing the first memory instruction, executing the non-memory instructions between the first memory instruction and the second memory instruction, and not executing the second memory instruction. Using the above method, the programming correctness and ease of use can be guaranteed while improving the overall performance of the processor, which is conducive to the promotion of artificial intelligence processors.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present disclosure relates to computer technology, and more specifically, to an instruction execution method, apparatus, electronic device, computer-readable storage medium, and computer program product, which can be applied in the field of artificial intelligence. Background Art

[0002] Memory models can be divided into hardware-level memory models and language-level memory models, which ensure the memory access order and program order by defining the specifications required by hardware design or programming, thereby ensuring the correctness of program execution. Traditional processors and high-level languages ​​such as C++ support memory models. The main memory models include sequential consistency models, full storage sorting models, and loose memory models, among which the loose memory model is the most performance-friendly. For emerging artificial intelligence processors and corresponding programming languages, memory models also need to be defined and supported. Artificial intelligence processors are a type of domain-specific processors. In the memory architecture designed for the characteristics of the artificial intelligence field, the biggest change is the use of scratch memory to replace the cache in traditional processors, so that programmers can directly manage data storage.

[0003] Specifically, in artificial intelligence application scenarios, memory access locality is poorer than that of traditional processors. At this time, the performance improvement brought by the cache is not obvious, and in scenarios where data is used and thrown away, it will reduce performance. At the same time, the complexity and resource share of the cache are extremely high. In comparison, it is more reasonable to remove the cache to obtain more hardware resource area for increasing computing power. Therefore, many artificial intelligence processors currently adopt a cache-free scratchpad memory structure. After adopting the scratchpad memory, the memory is mainly managed by software programmers. Due to differences in architecture and programming language, most artificial intelligence cannot be fully applied to the storage model system and method implemented by traditional processors. Summary of the invention

[0004] According to an embodiment of the present disclosure, an instruction execution method, an apparatus, an electronic device, a computer-readable storage medium, and a computer program product are provided.

[0005] In a first aspect of the present disclosure, an instruction execution method is provided, comprising: executing an instruction sequence, the instruction sequence comprising memory instructions and non-memory instructions, the instructions in the execution sequence starting to be executed in sequence; determining that execution of a first memory instruction needs to be completed before starting execution of a second memory instruction, the second memory instruction being the next memory instruction after the first memory instruction in the instruction sequence; and during a cycle of executing the first memory instruction, executing non-memory instructions between the first memory instruction and the second memory instruction without executing the second memory instruction.

[0006] In a second aspect of the present disclosure, an instruction execution device is provided, comprising: an instruction sequence execution module, configured to execute an instruction sequence, the instruction sequence comprising memory instructions and non-memory instructions, the instructions in the execution sequence starting to be executed in sequence; an execution determination module, configured to determine that the execution of a first memory instruction needs to be completed before starting to execute a second memory instruction, the second memory instruction being the next memory instruction after the first memory instruction in the instruction sequence; and a non-memory instruction execution module, configured to execute non-memory instructions between the first memory instruction and the second memory instruction, without executing the second memory instruction, during a cycle of executing the first memory instruction.

[0007] In the third aspect of the present disclosure, an electronic device is provided, comprising at least one processor; and a memory communicatively connected to the at least one processor; wherein the memory stores instructions executable by the at least one processor, and the instructions are executed by the at least one processor to enable the at least one processor to implement the method according to the first aspect of the present disclosure.

[0008] In a fourth aspect of the present disclosure, a non-transitory computer-readable storage medium storing computer instructions is provided, wherein the computer instructions are used to cause the computer to implement the method according to the first aspect of the present disclosure.

[0009] In a fifth aspect of the present disclosure, a computer program product is provided, comprising a computer program, and when the computer program is executed by a processor, the computer program performs the method according to the first aspect of the present disclosure.

[0010] By utilizing the technology according to the present application, the overall performance of the processor can be improved while ensuring programming correctness and ease of use, which is conducive to the promotion of artificial intelligence processors.

[0011] It should be understood that the contents described in the summary of the invention are not intended to limit the key or important features of the embodiments of the present disclosure, nor are they intended to limit the scope of the present disclosure. Other features of the present disclosure will become easily understood through the following description. BRIEF DESCRIPTION OF THE DRAWINGS

[0012] The above and other purposes, features and advantages of the present disclosure will become more apparent by describing the exemplary embodiments of the present disclosure in more detail in conjunction with the accompanying drawings, wherein the same reference numerals generally represent the same components in the exemplary embodiments of the present disclosure. It should be understood that the accompanying drawings are used to better understand the present solution and do not constitute a limitation of the present disclosure. Among them:

[0013] Figure 1A schematic diagram of an instruction execution system 100 is shown in which the instruction execution method in some exemplary embodiments of the present disclosure can be implemented;

[0014] Figure 2 A flowchart of an instruction execution method 200 according to an embodiment of the present disclosure is shown;

[0015] Figure 3 A schematic block diagram of an instruction execution device 300 according to an embodiment of the present disclosure is shown; and

[0016] Figure 4 A schematic block diagram of an electronic device 400 according to an embodiment of the present disclosure is shown.

[0017] In the various drawings, the same or corresponding reference numerals represent the same or corresponding parts. DETAILED DESCRIPTION

[0018] The preferred embodiments of the present disclosure will be described in more detail below with reference to the accompanying drawings. Although the preferred embodiments of the present disclosure are shown in the accompanying drawings, it should be understood that the present disclosure can be implemented in various forms and should not be limited by the embodiments set forth herein. On the contrary, these embodiments are provided to make the present disclosure more thorough and complete, and to fully convey the scope of the present disclosure to those skilled in the art.

[0019] As used herein, the term "including" and its variations mean open inclusion, i.e., "including but not limited to". Unless otherwise stated, the term "or" means "and / or". The term "based on" means "based at least in part on". The terms "an example embodiment" and "an embodiment" mean "at least one example embodiment". The term "another embodiment" means "at least one additional embodiment". The terms "first", "second", etc. may refer to different or the same objects. Other explicit and implicit definitions may also be included below.

[0020] As described in the background technology above, cache is more suitable for situations where the storage content is used multiple times, but in artificial intelligence application scenarios, the data may be used less frequently or may even be used only once, so it is more suitable for applying a scratch pad memory, and the two types of memories are implemented differently. Therefore, the storage model system and method implemented using a traditional processor cannot be fully applicable to the scratch pad memory used in an artificial intelligence processor, for example. For example, in a traditional processor, due to the presence of a cache, the storage of instructions and data is invisible to the programmer. Therefore, in order to implement a loose memory model, the relevant program correctness is handled by the compiler.

[0021] When a processor executes an instruction sequence, the instructions in the instruction sequence will start to execute in order. However, the processor does not need to start executing the next instruction after each instruction is executed. Instead, it can, for example, execute the first instruction at the beginning of one processor cycle and execute the second instruction at the beginning of the next processor cycle. Since the instruction cycle of each instruction may be different, for example, the first instruction may require 10 processor cycles, while the second instruction may only require 1 processor cycle, so the instruction that starts to execute later may be executed before the instruction that starts to execute earlier, and the processor can continue to execute subsequent instructions. Therefore, the processor may execute the instructions in the instruction sequence out of order.

[0022] However, when the processor processes instructions, some instructions must have a strict execution order, that is, the subsequent instruction must be executed only after the previous instruction is executed, otherwise an error will occur. For example, the first instruction is to assign a value to variable A, and the second instruction is to use the assigned variable A. Since the assigned variable A must be used normally after the assignment of variable A, the execution of these two instructions needs to have a strict execution order, that is, the second instruction must be executed after the first instruction is executed. In the field of processors, instructions that need to ensure the execution order include, for example, scalar load instructions, scalar store instructions, vector load instructions, vector store instructions, global memory to local memory transfer (gm2lm) instructions, and local memory to global memory transfer (lm2gm) instructions. In the present disclosure, these instructions are referred to as memory instructions, and instructions other than these instructions that do not need to have a strict execution order are referred to as non-memory instructions.

[0023] In addition, still taking the assignment instruction as an example, after the programmer writes the above two instructions using a high-level language, after the two instructions are converted into assembly language, multiple other instructions may be generated between them, and these instructions are usually non-memory instructions. Therefore, in the instruction sequence after the assembly language is converted, there will be a large number of non-memory instructions between the memory instructions.

[0024] When two memory instructions must have a strict execution order due to the semantics of the instructions, it can be said that there is a hazard conflict. In order to solve the hazard conflict problem, the method used in traditional processors includes implicitly adding appropriate abort instructions during the compilation process, such as fence instructions. The purpose of the abort instruction is similar to that of a blocker. When the abort instruction is executed, the execution of all subsequent instructions will be blocked, and the execution of subsequent instructions needs to be resumed when specific conditions are met. These conditions include, for example, the execution of specific instructions or all instructions before the abort instruction.

[0025] However, in traditional processors, since the instructions stored in the cache are not visible at the software level, the hazard conflict problem can only be solved by hardware. In addition, since the traditional processor will block the execution of all subsequent instructions when starting to execute the abort instruction, it will also block the execution of non-memory instructions that can be executed without causing hazard conflicts. For example, there may be several, dozens, hundreds or even more non-memory instructions between two memory instructions with hazard conflicts. Due to the existence of the above situation, in traditional processors, the efficiency of solving the hazard conflict problem is low, and the execution efficiency of non-memory instructions will be seriously affected when solving the hazard conflict problem.

[0026] In order to at least partially solve one or more of the above problems and other potential problems, the embodiments of the present disclosure propose an instruction execution method, using this method, when an instruction sequence including memory instructions and non-memory instructions is executed in sequence, when a risk conflict occurs between adjacent memory instructions, a large number of non-memory instructions between the two memory instructions that cause the risk conflict can be continued to be executed through the collaboration of hardware and software. This can improve the overall performance of the processor while still ensuring programming correctness and ease of use, which is beneficial to improving the efficiency of users using the processor to execute instructions and user experience, and can also contribute to the promotion of artificial intelligence processors.

[0027] Figure 1 1 is a schematic diagram of an instruction execution system 100 in which the instruction execution method in some exemplary embodiments of the present disclosure can be implemented. Figure 1 As shown in FIG. 1 , the instruction execution system 100 includes a global memory 110, a DMA (direct memory access unit) 120, and a processor core 130. It should be noted that the instruction execution system 100 is scalable, and may include more processor cores 130, and may even include more global memories 110 and DMA 120. Figure 1 Only one global memory 110, one DMA 120 and one processor core 130 are shown. It should be noted that the instruction execution system 100 can be any instruction execution system that uses the storage content in the memory to be visible and manageable to the software level, for example, an artificial intelligence memory system using a scratch pad memory.

[0028] Figure 1The processor core 130 shown in FIG. 1 includes a scalar module 131, a vector module 132, a global memory module 133, a cross switch 134, and a local memory 135. The cross switch 134 controls data interaction with the local memory 135, the scalar module 131, the vector module 132, and the global memory module 133. The global memory module 133 interacts with the global memory 110 through the DMA 120.

[0029] The scalar module 131 includes a risk process unit 131-1, a scalar loading unit 131-2 and a scalar storage unit 131-3. The scalar loading unit 131-2 is used to process the loading of scalar instructions, the scalar storage unit 131-3 is used to process the storage of scalar instructions, and the risk process unit 131-1 is used to process the risk conflict of scalar instructions. Scalar instructions may include, for example, scalar load instructions and scalar store instructions.

[0030] The vector module 132 includes a risk process unit 132-1, a vector loading unit 132-2 and a vector storage unit 132-3. The vector loading unit 132-2 is used to process the loading of vector instructions, the vector storage unit 132-3 is used to process the storage of vector instructions, and the risk process unit 132-1 is used to process risk conflicts of vector instructions. Vector instructions may include, for example, vector loading instructions and vector storage instructions.

[0031] The global memory module 133 includes a global memory loading unit 133-1 and a global memory unit storage unit 133-2. The global memory loading unit 133-1 is used to process the loading of global memory instructions, and the global memory unit storage unit 133-2 is used to process the storage of global memory instructions. The global memory instructions may include, for example, instructions for transferring from the global memory to the local memory and instructions for transferring from the local memory to the global memory.

[0032] According to an embodiment of the present disclosure, the instruction execution system 100 may further include a controller for controlling the instruction execution system 100 to perform various operations.

[0033] According to an embodiment of the present disclosure, in the instruction execution system 100, memory instructions such as scalar load instructions, scalar store instructions, vector load instructions, vector store instructions, global memory to local memory move instructions, and local memory to global memory move instructions can be executed using different hardware queues, maintaining memory order consistency and program order consistency between each hardware queue.

[0034] Figure 21 is a flowchart of an instruction execution method 200 according to an embodiment of the present disclosure. Specifically, the method 200 may be executed by the instruction execution system 100. It should be understood that the method 200 may also include additional operations not shown and / or may omit the operations shown, and the scope of the present disclosure is not limited in this respect.

[0035] At block 202 , the instruction execution system 100 executes an instruction sequence. According to an embodiment of the present disclosure, the instruction sequence includes memory instructions and non-memory instructions as described above, and the instruction execution system 100 starts executing each instruction in the order of executing the instructions in the sequence.

[0036] At block 204, the instruction execution system 100 determines that execution of the first memory instruction needs to be completed before starting execution of the second memory instruction. According to an embodiment of the present disclosure, the second memory instruction is the next memory instruction after the first memory instruction in the instruction sequence.

[0037] According to some embodiments of the present disclosure, since there is a sequence in the execution of instructions, the instruction execution system 100 may determine that the execution of the first memory instruction needs to be completed before the execution of the second memory instruction begins when executing the first memory instruction. According to other embodiments of the present disclosure, the instruction execution system 100 may also determine that the execution of the first memory instruction needs to be completed before the execution of the second memory instruction begins before the execution of the first memory instruction begins.

[0038] In the field of artificial intelligence processors, not all hazard conflicts can be discovered by software. For example, for a specific operation of a memory row size for a memory instruction whose memory operation granularity is a memory row size, the hazard conflicts between loads and stores within the same subsystem (e.g., scalar module 131 and vector module 132) are handled by hardware. These memory instructions include between scalar load instructions, between scalar store instructions, between vector load instructions, and between vector store instructions. Because these hazard conflicts are not visible to software, they cannot be handled by software.

[0039] However, since it is more efficient and convenient to process by software, in the embodiment according to the present disclosure, the hazard conflict problem is first processed by software. If the hazard conflict cannot be discovered and processed by software because it is invisible to the software, the hazard conflict is processed by hardware.

[0040] Therefore, according to some embodiments of the present disclosure, the instruction execution system 100 can determine that the execution of the first memory instruction needs to be completed before the execution of the second memory instruction starts based on the types of the first memory instruction and the second memory instruction. This situation includes, for example, a specific operation whose memory operation granularity is a memory row size, such as a risk conflict between scalar load instructions, between scalar store instructions, between vector load instructions, and between vector store instructions. At this time, it is determined by the hardware used to execute the instruction sequence that the execution of the first memory instruction needs to be completed before the execution of the second memory instruction starts.

[0041] For instruction conflicts that can be handled by software, since programmers are aware of possible risk conflicts when writing instruction sequences, programmers can add specifically defined abort instructions to the instruction sequences to let the software know that a risk conflict will occur.

[0042] According to an embodiment of the present disclosure, since the instruction sequence includes an abort instruction, the instruction execution system 100 may determine the memory instruction targeted by the abort instruction as the first memory instruction when executing the abort instruction, and further determine that the execution of the first memory instruction needs to be completed before the execution of the second memory instruction begins. According to some embodiments of the present disclosure, the abort instruction may be immediately after a certain memory instruction, thereby indicating that the closest memory instruction before the abort instruction is the first memory instruction. According to some other embodiments of the present disclosure, the abort instruction may be immediately before a certain memory instruction, thereby indicating that the closest memory instruction after the abort instruction is the first memory instruction. At this time, it is determined by software that the execution of the first memory instruction needs to be completed before the execution of the second memory instruction begins. According to an embodiment of the present disclosure, the hazard conflict handled by the software may, for example, include hazard conflicts between different subsystems, such as hazard conflicts between the scalar module 131, the vector module 132, and the global memory module 133. The hazard conflict handled by the software may also include operations where the memory operation granularity of the memory instruction is a plurality of memory line sizes, such as hazard conflicts between global memory loads and global memory stores within the global memory module 133.

[0043] At block 206 , the instruction execution system 100 executes non-memory instructions between the first memory instruction and the second memory instruction during a cycle in which the first memory instruction is executed, without executing the second memory instruction.

[0044] Through the operations in blocks 202, 204, and 206, hazard conflicts can be efficiently discovered, and when hazard conflicts exist, a large number of non-memory instructions are executed instead of memory instructions that may cause hazard conflicts, thereby improving the processing efficiency of hazard conflicts and the processing efficiency of instruction sequences.

[0045] The method 200 further includes: Figure 2 Optional block 208 is shown in the form of a dashed box in FIG. At optional block 208, the instruction execution system 100 begins executing the second memory instruction in response to completing execution of the first memory instruction.

[0046] The operation process of the abort instruction according to the embodiment of the present disclosure is described below by taking a specifically defined fence instruction as an example of the abort instruction according to the embodiment of the present disclosure.

[0047] For example, the instruction sequence is gm2lm→fence→add,r0,r1,r2→load r3,lm→add,r0,r1,r2→.... In this instruction sequence, gm2lm is the first memory instruction, load is the second memory instruction, and fence is the abort instruction. When the fence instruction is executed, the software knows that gm2lm is the first memory instruction, and knows that the execution of gm2lm should be completed before starting to execute load. According to traditional processor processing, the execution of all instructions after fence will be stopped at this time. However, in this example according to an embodiment of the present disclosure, the add,r0,r1,r2 instructions between the fence instruction and the load instruction will still be executed normally. When the gm2lm instruction is executed, the software will notify the hardware to continue executing the load instruction.

[0048] References Figure 1 to Figure 2 The instruction execution system 100 in which the instruction execution method in some exemplary embodiments of the present disclosure can be implemented and the related contents for the instruction execution method 200 according to the embodiments of the present disclosure are described. It should be understood that the above description is for better illustrating the contents recorded in the present disclosure, but is not limited in any way.

[0049] It should be understood that the numbers and sizes of various elements used in the above-mentioned drawings of the present disclosure are only examples, and are not intended to limit the scope of protection of the present disclosure. The above-mentioned numbers and sizes can be arbitrarily set as needed without affecting the normal implementation of the embodiments of the present disclosure.

[0050] See above Figure 1 to Figure 2 The details of the instruction execution method according to the embodiment of the present disclosure are described. Figure 3 Describe the various modules in the instruction execution device.

[0051] Figure 3 FIG. 3 is a schematic block diagram of an instruction execution device 300 according to an embodiment of the present disclosure. Figure 3As shown, the instruction execution device 300 may include: an instruction sequence execution module 310, configured to execute an instruction sequence, the instruction sequence includes memory instructions and non-memory instructions, and the instructions in the execution sequence are executed in sequence; an execution determination module 320, configured to determine that the execution of a first memory instruction needs to be completed before starting to execute a second memory instruction, and the second memory instruction is the next memory instruction after the first memory instruction in the instruction sequence; and a non-memory instruction execution module 330, configured to execute the non-memory instructions between the first memory instruction and the second memory instruction during the cycle of executing the first memory instruction, without executing the second memory instruction.

[0052] In some embodiments, the execution determination module 320 includes: a first execution determination module (not shown), configured to, when executing a first memory instruction, determine that the execution of the first memory instruction needs to be completed before starting to execute the second memory instruction.

[0053] In some embodiments, the execution determination module 320 includes: a second execution determination module (not shown), which is configured to determine, based on the types of the first memory instruction and the second memory instruction, that the execution of the first memory instruction needs to be completed before starting to execute the second memory instruction.

[0054] In some embodiments, the second execution determination module is configured to determine, through hardware for executing the instruction sequence, that the execution of the first memory instruction needs to be completed before starting to execute the second memory instruction.

[0055] In some embodiments, the instruction sequence also includes a stop instruction, and the execution determination module 320 includes: a first memory instruction determination module (not shown), configured to, when executing the stop instruction, determine the memory instruction targeted by the stop instruction as the first memory instruction; and a third execution determination module (not shown), configured to determine that the execution of the first memory instruction needs to be completed before starting to execute the second memory instruction.

[0056] In some embodiments, the third execution determination module is configured to determine, by software, that the execution of the first memory instruction needs to be completed before starting to execute the second memory instruction.

[0057] In some embodiments, the instruction execution device 300 further includes an optional second memory instruction execution module 340 (in Figure 3), and is configured to start executing the second memory instruction in response to completing the execution of the first memory instruction.

[0058] According to an embodiment of the present disclosure, the present disclosure also provides an electronic device, a computer-readable storage medium, and a computer program product.

[0059] Through the above reference Figures 1 to 3 According to the description, the technical solution according to the embodiment of the present disclosure has many advantages over the traditional solution. For example, by using the above technical solution, a large number of non-memory instructions between the two memory instructions that cause the hazard conflict can still be executed when processing the memory instruction hazard conflict, so that the programming correctness and ease of use can be guaranteed while improving the overall performance of the processor, which is beneficial to improve the efficiency of users using the processor to execute instructions and user experience, and can also contribute to the promotion of artificial intelligence processors. In addition, by using the above technical solution, memory instruction hazard conflicts can be processed collaboratively by hardware and software, rather than just by hardware, so the efficiency of processing memory instruction hazard conflicts can be further improved.

[0060] Figure 4 4 shows a schematic block diagram of an electronic device 400 according to an embodiment of the present disclosure. Figure 1 The instruction execution system 100 shown in FIG. Figure 3 The illustrated instruction execution device 300 may be implemented by an electronic device 400. The electronic device 400 is intended to represent various forms of digital computers, such as laptop computers, desktop computers, workstations, personal digital assistants, servers, blade servers, mainframe computers, and other suitable computers. The electronic device 400 may also represent various forms of mobile devices, such as personal digital processing, cellular phones, smart phones, wearable devices, and other similar computing devices. The components shown herein, their connections and relationships, and their functions are merely examples and are not intended to limit the implementation of the present disclosure described and / or required herein.

[0061] like Figure 4As shown, the electronic device 400 includes: one or more processors 401, a memory 402, and interfaces for connecting various components, including high-speed interfaces and low-speed interfaces. The various components are connected to each other using different buses, and can be installed on a common mainboard or installed in other ways as needed. The processor can process the instructions executed in the electronic device 400, including instructions stored in or on the memory to display the graphical information of the GUI on an external input / output device (such as, a display device coupled to the interface). In other embodiments, if necessary, multiple processors and / or multiple buses can be used together with multiple memories and multiple memories. Similarly, multiple electronic devices 400 can be connected, and each device provides some necessary operations (for example, as a server array, a group of blade servers, or a multi-processor system). Figure 4 A processor 401 is taken as an example.

[0062] The memory 402 is a non-transitory computer-readable storage medium provided by the present disclosure. The memory stores instructions executable by at least one processor, so that the at least one processor executes the instruction execution method provided by the present disclosure. The non-transitory computer-readable storage medium of the present disclosure stores computer instructions, which are used to cause a computer to execute the instruction execution method provided by the present disclosure.

[0063] The memory 402 is a non-transient computer-readable storage medium that can be used to store non-transient software programs, non-transient computer executable programs and modules, such as program instructions / modules corresponding to the instruction execution method in the embodiment of the present disclosure (for example, Figure 3 The processor 401 executes various functional applications and data processing of the server by running the non-transient software programs, instructions and modules stored in the memory 402, that is, the instruction execution method in the above method embodiment is implemented.

[0064] The memory 402 may include a program storage area and a data storage area, wherein the program storage area may store an operating system and applications required for at least one function; the data storage area may store data created according to the use of the electronic device 400, etc. In addition, the memory 402 may include a high-speed random access memory, and may also include a non-transient memory, such as at least one disk storage device, a flash memory device, or other non-transient solid-state storage device. In some embodiments, the memory 402 may optionally include a memory remotely arranged relative to the processor 401, and these remote memories may be connected to the electronic device 400 via a network. Examples of the above-mentioned network include, but are not limited to, the Internet, an intranet, a local area network, a mobile communication network, and combinations thereof.

[0065] The electronic device 400 may further include: an input device 403 and an output device 404. The processor 401, the memory 402, the input device 403 and the output device 404 may be connected via a bus or other means. Figure 4 The example of connecting through bus is taken in the following.

[0066] The input device 403 can receive input digital or character information, and generate key signal input related to user settings and function control of the electronic device 400, such as a touch screen, a keypad, a mouse, a track pad, a touch pad, an indicator bar, one or more mouse buttons, a trackball, a joystick and other input devices. The output device 404 may include a display device, an auxiliary lighting device (e.g., an LED) and a tactile feedback device (e.g., a vibration motor), etc. The display device may include, but is not limited to, a liquid crystal display (LCD), a light emitting diode (LED) display and a plasma display. In some embodiments, the display device may be a touch screen.

[0067] Various implementations of the systems and techniques described herein can be realized in digital electronic circuit systems, integrated circuit systems, dedicated ASICs (application specific integrated circuits), computer hardware, firmware, software, and / or combinations thereof. These various implementations can include: being implemented in one or more computer programs that can be executed and / or interpreted on a programmable system including at least one programmable processor, which can be a special purpose or general purpose programmable processor that can receive data and instructions from a storage system, at least one input device, and at least one output device, and transmit data and instructions to the storage system, the at least one input device, and the at least one output device.

[0068] These computer programs (also referred to as programs, software, software applications, or code) include machine instructions for programmable processors and can be implemented using high-level procedural and / or object-oriented programming languages, and / or assembly / machine languages. As used herein, the terms "machine-readable medium" and "computer-readable medium" refer to any computer program product, device, and / or means (e.g., disk, optical disk, memory, programmable logic device (PLD)) for providing machine instructions and / or data to a programmable processor, including a machine-readable medium that receives machine instructions as a machine-readable signal. The term "machine-readable signal" refers to any signal for providing machine instructions and / or data to a programmable processor.

[0069] To provide interaction with a user, the systems and techniques described herein can be implemented on a computer having: a display device (e.g., a CRT (cathode ray tube) or LCD (liquid crystal display) monitor) for displaying information to the user; and a keyboard and pointing device (e.g., a mouse or trackball) through which the user can provide input to the computer. Other types of devices can also be used to provide interaction with the user; for example, the feedback provided to the user can be any form of sensory feedback (e.g., visual feedback, auditory feedback, or tactile feedback); and input from the user can be received in any form (including acoustic input, voice input, or tactile input).

[0070] The systems and techniques described herein may be implemented in a computing system that includes back-end components (e.g., as a data server), or a computing system that includes middleware components (e.g., an application server), or a computing system that includes front-end components (e.g., a user computer with a graphical user interface or a web browser through which a user can interact with implementations of the systems and techniques described herein), or a computing system that includes any combination of such back-end components, middleware components, or front-end components. The components of the system may be interconnected by any form or medium of digital data communication (e.g., a communication network). Examples of communication networks include: a local area network (LAN), a wide area network (WAN), and the Internet.

[0071] A computer system may include clients and servers. Clients and servers are generally remote from each other and usually interact through a communication network. The relationship of client and server is generated by computer programs running on respective computers and having a client-server relationship to each other.

[0072] According to the technical solution of the embodiments of the present disclosure, when an instruction sequence including memory instructions and non-memory instructions is executed in sequence, when a hazard conflict occurs between adjacent memory instructions, a large number of non-memory instructions between the two memory instructions that cause the hazard conflict can continue to be executed through the collaboration of hardware and software, thereby improving the overall performance of the processor (processing speed and instruction execution efficiency) while still ensuring programming correctness and ease of use, which is beneficial to improving the efficiency of users using the processor to execute instructions and user experience, and can also contribute to the promotion of artificial intelligence processors.

[0073] It should be understood that the various forms of processes shown above can be used to reorder, add or delete steps. For example, the steps recorded in this application can be executed in parallel, sequentially or in different orders, as long as the desired results of the technical solution disclosed in this disclosure can be achieved, and this document is not limited here.

[0074] The above specific implementations do not constitute a limitation on the protection scope of the present disclosure. It should be understood by those skilled in the art that various modifications, combinations, sub-combinations and substitutions can be made according to design requirements and other factors. Any modification, equivalent substitution and improvement made within the spirit and principle of the present disclosure shall be included in the protection scope of the present disclosure.

Claims

1. A method for executing an instruction, include: Executing an instruction sequence, the instruction sequence comprising memory instructions and non-memory instructions, wherein the instruction sequence further comprises a stop instruction, and the instructions in the instruction sequence begin to be executed in sequence; Determining that execution of a first memory instruction needs to be completed before starting execution of a second memory instruction, the second memory instruction being a next memory instruction after the first memory instruction in the instruction sequence, wherein determining that execution of the first memory instruction needs to be completed before starting execution of the second memory instruction comprises: When executing the abort instruction, determining the memory instruction targeted by the abort instruction as the first memory instruction; and determining that execution of the first memory instruction needs to be completed before starting execution of the second memory instruction; and During a cycle in which the first memory instruction is executed, a non-memory instruction between the first memory instruction and the second memory instruction is executed, while the second memory instruction is not executed.

2. The method of claim 1 , wherein determining that the execution of the first memory instruction needs to be completed before starting execution of the second memory instruction include: While executing a first memory instruction, it is determined that execution of the first memory instruction needs to be completed before starting execution of the second memory instruction.

3. The method of claim 1 , wherein determining that the execution of the first memory instruction needs to be completed before starting execution of the second memory instruction include: Based on types of the first memory instruction and the second memory instruction, it is determined that the execution of the first memory instruction needs to be completed before starting execution of the second memory instruction.

4. The method of claim 3, wherein determining, by hardware for executing the sequence of instructions, that execution of the first memory instruction needs to be completed before beginning execution of the second memory instruction.

5. The method of claim 1, wherein determining that the execution of the first memory instruction needs to be completed before starting execution of the second memory instruction is performed by software.

6. The method according to claim 1, further comprising: include: In response to completing the execution of the first memory instruction, executing the second memory instruction begins.

7. An instruction execution device, include: An instruction sequence execution module is configured to execute an instruction sequence, wherein the instruction sequence includes memory instructions and non-memory instructions, wherein the instruction sequence also includes a stop instruction, and the instructions in the instruction sequence begin to be executed in sequence; an execution determination module, configured to determine that execution of a first memory instruction needs to be completed before starting execution of a second memory instruction, wherein the second memory instruction is a next memory instruction after the first memory instruction in the instruction sequence, and the execution determination module is further configured to: When executing the abort instruction, determining the memory instruction targeted by the abort instruction as the first memory instruction; and determining that execution of the first memory instruction needs to be completed before starting execution of the second memory instruction; as well as The non-memory instruction execution module is configured to execute non-memory instructions between the first memory instruction and the second memory instruction, but not execute the second memory instruction, during a cycle of executing the first memory instruction, wherein the cycle period includes when a stop instruction is executed.

8. The apparatus according to claim 7, wherein the execution determination module include: The first execution determination module is configured to determine, when executing a first memory instruction, that the execution of the first memory instruction needs to be completed before starting to execute the second memory instruction.

9. The apparatus according to claim 7, wherein the execution determination module include: The second execution determination module is configured to determine, based on types of the first memory instruction and the second memory instruction, that the execution of the first memory instruction needs to be completed before starting to execute the second memory instruction.

10. The apparatus of claim 9, wherein the second execution determination module is configured to determine, by hardware for executing the sequence of instructions, that the execution of the first memory instruction needs to be completed before starting execution of the second memory instruction.

11. The apparatus of claim 7, wherein the execution determination module is configured to determine, by software, that the execution of the first memory instruction needs to be completed before starting to execute the second memory instruction.

12. The device according to claim 7, further comprising: include: The second memory instruction execution module is configured to start executing the second memory instruction in response to completing the execution of the first memory instruction.

13. An electronic device, It is characterized in that include: at least one processor; as well as a memory communicatively connected to the at least one processor; wherein, The memory stores instructions that can be executed by the at least one processor, and the instructions are executed by the at least one processor to enable the at least one processor to perform the method according to any one of claims 1 to 6.

14. A non-transitory computer-readable storage medium storing computer instructions, It is characterized in that The computer instructions are used to cause the computer to execute the method according to any one of claims 1 to 6.

15. A computer program product, comprising a computer program, wherein when the computer program is executed by a processor, the computer program performs the method according to any one of claims 1 to 6.

Citation Information

Patent Citations

  • Processor architecture and instruction execution method integrating sequence and VLIW (Very Long Instruction Word)

    CN102799418A

  • Processor instruction sequence translation

    US20170046157A1