Method and device for executing block instruction and storage medium
By introducing the block cache into the processor system and utilizing its high read and write performance to read blocks directly from the block cache, the problem of low efficiency in executing block instructions in the existing technology is solved and more efficient execution of block instructions is achieved. .
Patent Information
- Application Number
- CN202310339793.9
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2023-03-27
- Publication Date
- 2024-09-27
AI Technical Summary
In the prior art, when executing a block instruction, it takes a long time to read the block body from the instruction cache, resulting in reduced execution efficiency.
By introducing the block cache into the system, the high read and write performance of the block cache is used to obtain and save the index information of the block, so that the block can be read directly from the block cache when executing the block instruction, thereby reducing the load from the instruction cache. rely.
It improves the efficiency of executing block instructions, reduces the time-consuming block reading, and improves the performance of the processor.
Smart Images

Figure CN118708240A
Abstract
Description
Technical Field
[0001] The present application relates to the field of computers, and in particular to a method, device and storage medium for executing block instructions. Background Art
[0002] A block instruction is an instruction set designed according to the block granularity organization concept. Usually, a block instruction program includes multiple block instructions. Executing a block instruction program means executing multiple block instructions included in the program. Before executing a block instruction program, the processor may save multiple block instructions of the block instruction program in the instruction cache.
[0003] The block instruction includes a block header and a block body. The block header includes index information of the block body in the instruction cache, and the block body may include at least one microinstruction. When the processor executes any block instruction in the block instruction program, it first reads the block header of the block instruction from the instruction cache, reads the block body of the block instruction from the instruction cache based on the index information of the block body of the block instruction included in the block header, and executes the microinstructions included in the block body.
[0004] It takes a long time to read the block from the instruction cache, which reduces the efficiency of executing block instructions. Summary of the invention
[0005] The present application provides a method, device and storage medium for executing block instructions, which improves the efficiency of executing block instructions. The technical solution is as follows:
[0006] In a first aspect, the present application provides a method for executing a block instruction, the method being applied to a system including a processor, an instruction cache and a block cache, the instruction cache including a plurality of block instructions, the block cache including the corresponding relationship between the index information of a first block and the first block, the first block being a block of at least two block instructions among the plurality of block instructions, the index information being the index information of the first block in the instruction cache, and the read and write performance of the block cache being higher than the read and write performance of the instruction cache. In the method, the processor obtains a block header of a first block instruction to be executed, the block header including the index information, the block of the first block instruction is the first block, and the at least two block instructions include the first block instruction. The processor obtains the first block from the block cache based on the index information. The processor executes the first block.
[0007] Since the block cache includes the index information of the first block and the corresponding relationship between the first block, the processor obtains the block header of the first block of instructions to be executed, and the block header includes the index information of the first block, so that the processor reads the first block from the block cache based on the index information of the first block. Since the read and write performance of the block cache is higher than the read and write performance of the instruction cache, the time consumption of reading the first block can be reduced, and the efficiency of executing the first block of instructions is improved.
[0008] In a possible implementation, the at least two block instructions also include a second block instruction, the processor obtains a block header of the second block instruction to be executed, the block header of the second block instruction includes the index information, and the block body of the second block instruction is the first block body. The processor obtains the first block body from the instruction cache based on the index information. The processor saves the corresponding relationship between the index information and the first block body in the block body cache. When executing the second block instruction, the first block body is saved in the block body index, so that for the first block instruction located after the second block instruction, when executing the first block instruction, the first block body can be read from the block body cache, thereby improving the efficiency of executing the first block instruction.
[0009] In another possible implementation, the block header of the second block instruction further includes first indication information, and the first indication information is used to indicate that the block of other block instructions in the instruction cache is the same as the block of the second block instruction. The processor obtains the first block from the instruction cache based on the first indication information and the index information. In this way, the processor is instructed to read the first block from the instruction cache through the first indication information, without querying the block cache, thereby improving the efficiency of obtaining the first block.
[0010] In another possible implementation, the second block instruction is the first block instruction of the at least two block instructions. Thus, when the first block instruction is executed, the first block is saved in the block cache.
[0011] In another possible implementation, the processor adds first indication information to the block header of the first block instruction of the at least two block instructions, so that the processor is controlled by the first indication information to directly read the first block from the instruction cache when executing the first block instruction.
[0012] In another possible implementation, when the processor determines that the block of the other block instruction is the same as the block of the second block instruction in the instruction cache based on the first indication information, the processor queries the block cache based on the index information. When the processor queries that the block cache does not store the first block, the processor obtains the first block from the instruction cache. By controlling the processor to query the block cache preferentially through the first indication information, the efficiency of reading the block can be improved.
[0013] In another possible implementation, the block header of the first block instruction also includes second indication information, and the second indication information is used to indicate that there are other block instructions in the instruction cache that are the same as the block of the first block instruction. When the processor determines that there are other block instructions in the instruction cache that are the same as the block of the first block instruction based on the second indication information, the processor queries the block cache based on the index information. When the processor queries that the block cache stores the first block, it obtains the first block from the block cache. By controlling the processor to query the block cache preferentially through the second indication information, the efficiency of reading the block can be improved.
[0014] Optionally, the block cache is located in the processor, which can reduce the time consumption of reading the first block from the block cache.
[0015] In a second aspect, the present application provides a device for executing a block instruction, for executing the method in the first aspect or any possible implementation of the first aspect. Specifically, the device includes a unit for executing the method in the first aspect or any possible implementation of the first aspect.
[0016] In a third aspect, the present application provides a device for executing block instructions, comprising at least one processor and a memory, wherein the at least one processor is used to couple with the memory, read and execute instructions in the memory, so as to implement the method in the first aspect or any possible implementation manner of the first aspect.
[0017] In a fourth aspect, the present application provides a computer program product, which includes a computer program stored in a computer-readable storage medium, and the computer program is loaded by a processor to implement the method of the above-mentioned first aspect or any possible implementation method of the first aspect.
[0018] In a fifth aspect, the present application provides a computer-readable storage medium for storing a computer program, wherein the computer program is loaded by a processor to execute the method of the first aspect or any possible implementation of the first aspect.
[0019] In a sixth aspect, the present application provides a chip comprising a memory and a processor, wherein the memory is used to store computer instructions, and the processor is used to call and run the computer instructions from the memory to execute the method of the above-mentioned first aspect or any possible implementation of the first aspect. BRIEF DESCRIPTION OF THE DRAWINGS
[0020] Figure 1 It is a schematic diagram of a system structure provided in an embodiment of the present application;
[0021] Figure 2 This is a schematic diagram of a block instruction in an instruction cache provided by an embodiment of the present application;
[0022] Figure 3 is another schematic diagram of a system structure provided in an embodiment of the present application;
[0023] Figure 4 is a flow chart of a method for executing a block instruction provided by an embodiment of the present application;
[0024] Figure 5 This is a block header structure schematic diagram provided in an embodiment of the present application;
[0025] Figure 6is a flow chart of another method for executing a block instruction provided by an embodiment of the present application;
[0026] Figure 7 is a flow chart of another method for executing a block instruction provided by an embodiment of the present application;
[0027] Figure 8 It is a schematic diagram of the structure of a device for executing block instructions provided in an embodiment of the present application;
[0028] Fig. 9 It is a schematic diagram of a device structure provided in an embodiment of the present application. DETAILED DESCRIPTION
[0029] The implementation methods of the present application will be further described in detail below with reference to the accompanying drawings.
[0030] See also Figure 1 An embodiment of the present application provides a system 100, which includes a processor 101, an instruction cache 102 and a block cache 103, and the read and write performance of the block cache 103 is higher than the read and write performance of the instruction cache 102.
[0031] In some embodiments, the block cache 103 is located in the processor 101. Optionally, the instruction cache 102 is located in the processor 101, or is located outside the processor 101.
[0032] The instruction cache 102 is used to store multiple block instructions of the block instruction program, and the processor 101 can be used to execute the multiple block instructions.
[0033] In some embodiments, the processor 101 may be a central processing unit (CPU), a graphics processing unit (GPU), a network processor (NP), a microprocessor, an application-specific integrated circuit (ASIC), etc.
[0034] For any block instruction among the multiple block instructions, the block instruction includes a block header and a block body. The block header includes index information of the block body in the instruction cache 102 . The index information is used to indicate a storage location of the block body in the instruction cache 102 .
[0035] For example, the index information is the storage address of the block in the instruction cache 102 .
[0036] In some embodiments, the block header also includes one or more of the following information: external input and output register information of the block instruction, the size of the block instruction or jump information between block instructions, etc.
[0037] In some embodiments, the instruction cache 102 includes a first cache area and a second cache area, the first cache area stores a block header of each block instruction in the plurality of block instructions, and the second cache area stores a block body of each block instruction in the plurality of block instructions.
[0038] Some of the multiple block instructions include the same block body.
[0039] For example, see Figure 2 , the instruction cache 102 stores block instruction 1, block instruction 2, block instruction 3, block instruction 4 and block instruction 5.
[0040] Block instruction 1 includes block header 1 and block body 1, block instruction 2 includes block header 2 and block body 2, block instruction 3 includes block header 3 and block body 1, block instruction 4 includes block header 4 and block body 3, and block instruction 5 includes block header 5 and block body 3.
[0041] Block instruction 1 and block instruction 3 both include block body 1 , and the index information included in the block header of block instruction 1 and the index information included in the block header of block instruction 3 both point to block body 1 .
[0042] The index information included in the block header of block instruction 2 points to block body 2.
[0043] Block instruction 4 and block instruction 5 both include block body 3 , and the index information included in the block header of block instruction 4 and the index information included in the block header of block instruction 5 both point to block body 3 .
[0044] For multiple block instructions including the same block, the block cache 103 stores the index information of the block and the corresponding relationship between the block.
[0045] For example, block instruction 1 and block instruction 3 both include block 1, and the index information included in the block header of block instruction 1 and the index information included in the block header of block instruction 3 are both index information "IP1" of block 1, see Table 1 below, the block cache 103 can save the correspondence between the index information "IP1" of block 1 and block 1.
[0046] For another example, block instruction 4 and block instruction 5 both include block 3, and the index information included in the block header of block instruction 4 and the index information included in the block header of block instruction 5 are both index information "IP3" of block 3. See Table 1 below. Block cache 103 can save the correspondence between index information "IP1" of block 3 and block 3.
[0047] Table 1
[0048] Index information Block IP1 Block 1 (A1, B1, C1, D1) IP3 Block 3 (A3, B3, C3, D3) …… ……
[0049] In some embodiments, the processor 101 may analyze each block instruction in the instruction cache 102 to obtain at least two block instructions including the same block, and save the index information of the block and the corresponding relationship between the blocks in the block cache 103 .
[0050] Thus, when executing any one of the at least two block instructions, the processor 101 obtains the block of the block instruction from the block cache 103 based on the index information included in the block header of the block instruction, and then executes the block, thereby reducing the time required to obtain the block.
[0051] In some embodiments, the processor 101 may run a compiler, and the compiler may analyze each block instruction in the instruction cache 102 to obtain at least two block instructions including the same block.
[0052] In some embodiments, the system 100 may include multiple processors 101 , and the processor 101 that analyzes each block instruction in the instruction cache 102 and the processor 101 that executes the block instruction may be the same processor or may be different processors.
[0053] In some embodiments, for at least two block instructions including the same block in the instruction cache 103, when the processor 101 executes the first block instruction of the at least two block instructions, based on the index information included in the block header of the first block instruction, it obtains the block of the first block instruction from the instruction cache 102, and saves the correspondence between the index information and the block in the block cache 103.
[0054] Thus, for any block instruction other than the first block instruction among the at least two block instructions, when the processor 101 executes the block instruction, it obtains the block of the block instruction from the block cache 103 based on the index information included in the block header of the block instruction, and then executes the block, thereby reducing the time required to obtain the block.
[0055] In some embodiments, for any block instruction in instruction cache 102 , the body of the block instruction may include at least one microinstruction.
[0056] For example, see Figure 2 For block instruction 1, block body 1 of block instruction 1 includes microinstructions A1, B1, C1 and D1. Processor 101 executes block body 1 of block instruction 1: processor 101 executes microinstructions A1, B1, C1 and D1 included in block body 1.
[0057] See also Figure 3The system 100 further includes a memory 104, which is used to store multiple block instructions of the block instruction program. The multiple block instructions in the instruction cache 102 are read from the memory 104 when the processor 101 executes the block instruction program. That is, when the processor 101 executes the block instruction program, the processor 101 obtains the multiple block instructions of the block instruction program from the memory 104 and stores the multiple block instructions in the instruction cache 102.
[0058] Then, the processor 101 may execute the multiple block instructions stored in the instruction cache 102. For a detailed execution process, please refer to any of the following embodiments.
[0059] See also Figure 4 The present application embodiment provides a method 400 for executing a block instruction, wherein the method 400 is applied to Figure 1 or Figure 3 In the system 100 shown, the method 400 includes the following process from step 401 to step 407.
[0060] Step 401: The processor obtains a plurality of block instructions including the same block.
[0061] When executing the block instruction program, the processor reads multiple block instructions of the block instruction program from the memory and stores the multiple block instructions in the instruction cache. Then, multiple block instructions including the same block are obtained from the instruction cache. The number of the multiple block instructions is two or more than two, that is, the processor obtains at least two block instructions including the same block.
[0062] In some embodiments, the processor may identify index information included in the block header of each block instruction, and obtain multiple block instructions including the same index information from each block instruction, where the multiple block instructions are multiple block instructions including the same block body.
[0063] For example, see Figure 2 , assuming that the instruction cache stores block instruction 1, block instruction 2, block instruction 3, block instruction 4 and block instruction 5, the processor obtains block instruction 1 and block instruction 2 including the same block (block 1) from the instruction cache, and obtains block instruction 4 and block instruction 5 including the same block (block 3).
[0064] Step 402: The processor saves the corresponding relationship between the index information of the block and the block in the block cache.
[0065] In step 402, the processor may obtain the index information of the block from the block header of any block instruction among the multiple block instructions, and save the corresponding relationship between the index information of the block and the block in the block cache.
[0066] For example, the processor obtains the index information "IP1" of block 1 from the block header of block instruction 1 or the block header of block instruction 3, and stores the corresponding relationship between the index information "IP1" of block 1 and block 1 in the block cache. The processor obtains the index information "IP3" of block 3 from the block header of block instruction 4 or the block header of block instruction 5, and stores the corresponding relationship between the index information "IP3" of block 3 and block 3 in the block cache, as shown in Table 1 above.
[0067] In some embodiments, for multiple block instructions including the same block body, the processor may further add indication information to the block header of each block instruction in the multiple block instructions. For the indication information in the block header of any block instruction, the indication information is used to indicate that there are other block instructions in the instruction cache that have the same block body as the block instruction.
[0068] In some embodiments, see Figure 5 The block header of the block instruction includes a flag bit, and the processor sets the flag bit to add indication information to the block header of the block instruction, and the set flag bit is the indication information.
[0069] See also Figure 5 The block header of the block instruction also includes external input register, external output register information, block instruction size and block instruction information. The block instruction information may be jump information between block instructions, etc.
[0070] For example, for block instruction 1 and block instruction 2, the processor adds indication information to the block header of block instruction 1, and adds indication information to the block header of block instruction 2. For block instruction 4 and block instruction 5, the processor adds indication information to the block header of block instruction 4, and adds indication information to the block header of block instruction 5.
[0071] Next, the processor can sequentially execute each block instruction in the instruction cache, that is, the execution process is the following steps 403-407. That is, the processor executes the process of steps 403-407 for the first block instruction in the instruction cache, executes the process of steps 403-407 for the second block instruction, executes the process of steps 403-407 for the third block instruction, ..., until the process of steps 403-407 is completed for each block instruction.
[0072] Step 403: The processor obtains a block header of a first block of instructions to be executed, where the block header includes index information of a block of the first block of instructions.
[0073] In step 403, the processor reads the block header of the first block instruction from the instruction cache, uses the block header of the first block instruction as the block header of the first block instruction, and reads the index information of the block body of the first block instruction from the block header.
[0074] For example, see Figure 2, the processor reads the block header of the first block instruction from the instruction cache, the block header is the block header of block instruction 1, and reads the index information "IP1" of block body 1 of block instruction 1 from the block header.
[0075] Step 404: the processor determines whether the block cache stores the block of the first instruction. If the block cache stores the block of the first instruction, the processor executes step 405. If the block cache does not store the block of the first instruction, the processor executes step 406.
[0076] In some embodiments, the processor determines whether the block header of the first block of instructions includes indication information, and if so, determines that a block of the first block of instructions is stored in the block cache; if the block header of the first block of instructions does not include indication information, determines that a block of the first block of instructions is not stored in the block cache.
[0077] In some embodiments, the processor queries whether the block cache stores the index information of the block of the first block of instructions based on the index information of the block of the first block of instructions; if the block cache stores the index information, it is determined that the block cache stores the block of the first block of instructions; if the block cache does not store the index information, it is determined that the block cache does not store the block of the first block of instructions.
[0078] For example, the block header of the block instruction 1 includes indication information, so the processor determines that the block 1 of the block instruction 1 is stored in the block cache, and executes step 405 .
[0079] Step 405 : the processor obtains the block of the first block of instructions from the block cache based on the index information of the block of the first block of instructions, and executes step 407 .
[0080] For example, the processor obtains the block 1 of the block instruction 1 from the block cache shown in Table 1 based on the index information “IP1” of the block 1 of the block instruction 1.
[0081] Step 406: The processor obtains the block of the first block of instructions from the instruction cache based on the index information of the block of the first block of instructions.
[0082] In step 406 , the processor determines the storage location of the first block of instructions in the instruction cache based on the index information of the first block of instructions, and reads the first block of instructions from the storage location.
[0083] Step 407: The processor executes the body of the first block of instructions.
[0084] In step 407, the processor executes each microinstruction included in the body of the first block of instructions.
[0085] If there are still unexecuted block instructions in the instruction cache, the processor reads the block header of the next block instruction of the first block instruction from the instruction cache, and uses the block header of the next block instruction as the block header of the first block instruction, that is, re-executes the above step 403 until each block instruction in the instruction cache is executed.
[0086] In some embodiments, the processor that executes steps 401 to 402 and the processor that executes steps 403 to 407 may be the same processor or different processors.
[0087] For example, the processor executes block 1 of block instruction 1, and reads the block header of the next block instruction from the instruction cache, that is, reads the block header of block instruction 2. The block header of block instruction 2 does not include indication information, and it is determined that block 2 of block instruction 2 is not stored in the block cache, and the index information "IP2" of block 2 of block instruction 2 is read from the block header of block instruction 2. Based on the index information "IP2", the storage location of block 2 in the instruction cache is determined, and block 2 is read from the storage location, and block 2 is executed.
[0088] The block header of the next block instruction is read from the instruction cache, that is, the block header of block instruction 3 is read. The block header of block instruction 3 includes indication information, and it is determined that block 1 of block instruction 3 is stored in the block cache. The index information "IP1" of block 1 of block instruction 3 is read from the block header of block instruction 3. Based on the index information "IP1", block 1 of block instruction 3 is obtained from the block cache shown in Table 1 above, and block 1 is executed.
[0089] The block header of the next block instruction is read from the instruction cache, that is, the block header of block instruction 4 is read. The block header of block instruction 4 includes indication information, and it is determined that block 3 of block instruction 4 is stored in the block cache. The index information "IP3" of block 3 of block instruction 4 is read from the block header of block instruction 4. Based on the index information "IP3", block 3 of block instruction 4 is obtained from the block cache shown in Table 1 above, and block 3 is executed.
[0090] The block header of the next block instruction is read from the instruction cache, that is, the block header of block instruction 5 is read. The block header of block instruction 5 includes indication information, and it is determined that block 3 of block instruction 5 is stored in the block cache. The index information "IP3" of block 3 of block instruction 5 is read from the block header of block instruction 5. Based on the index information "IP3", block 3 of block instruction 5 is obtained from the block cache shown in Table 1 above, and block 3 is executed. Block instruction 5 is the last block instruction stored in the instruction cache, and the process ends after block 3 is executed.
[0091] In the embodiment of the present application, since the instruction cache includes multiple block instructions of the same block, the index information of the block is obtained from the block header of any one of the multiple block instructions, and the corresponding relationship between the index information of the block and the block is stored in the block cache. In this way, when the processor executes any one of the multiple block instructions, based on the index information included in the block header of the block instruction, the block of the block instruction is obtained from the block cache and the block is executed. Since the read and write performance of the block cache is higher than the read and write performance of the instruction cache, the time consumed by the processor to read the block from the block cache is reduced, and the efficiency of executing the block instruction is improved.
[0092] See also Figure 6 The present application embodiment provides a method 600 for executing a block instruction, wherein the method 600 is applied to Figure 1 or Figure 3 In the system 100 shown, the method 600 includes the following process from step 601 to step 607.
[0093] Step 601: The processor obtains a plurality of block instructions including the same block.
[0094] In step 601, the processor reads multiple block instructions of the block instruction program from the hard disk and stores the multiple block instructions in the memory. Then, multiple block instructions including the same block are obtained from the memory. The number of the multiple block instructions is two or more than two, that is, the processor obtains at least two block instructions including the same block.
[0095] In step 601, the processor runs a compiler, and the compiler compiles each block instruction in the memory into a block instruction in an assembly format, and obtains at least two block instructions including the same block from each block instruction in the assembly format.
[0096] In some embodiments, the processor may identify index information included in the block header of each block instruction, and obtain multiple block instructions including the same index information from each block instruction, where the multiple block instructions are multiple block instructions including the same block body.
[0097] The number of the multiple block instructions is two or more than two, that is, at least two block instructions including the same block are obtained.
[0098] For example, see Figure 2 , assuming that the instruction cache stores block instruction 1, block instruction 2, block instruction 3, block instruction 4 and block instruction 5, the processor obtains block instruction 1 and block instruction 2 including the same block (block 1) from the instruction cache, and obtains block instruction 4 and block instruction 5 including the same block (block 3).
[0099] Step 602: The processor adds indication information to the block header of the first block instruction among the multiple block instructions, where the indication information is used to indicate that there are other block instructions in the instruction cache whose block bodies are the same as the block body of the first block instruction.
[0100] In some embodiments, see Figure 5 The block header of the first block instruction includes a flag bit, and the processor sets the flag bit to add indication information to the block header of the first block instruction, and the set flag bit is the indication information.
[0101] For example, for block instructions 1 and block instructions 3, the processor adds indication information in the block header of block instruction 1, and the indication information is used to indicate that there are other block instructions in the instruction cache that are the same as block 1 of block instruction 1. For block instructions 4 and block instructions 5, the processor adds indication information in the block header of block instruction 4, and the indication information is used to indicate that there are other block instructions in the instruction cache that are the same as block 3 of block instruction 4.
[0102] In step 602, the processor runs a compiler, and the compiler adds indication information to a block header of a first block instruction among the multiple block instructions.
[0103] Next, the processor may sequentially execute each block instruction in the block instruction program, that is, execute the following process of steps 603-606.
[0104] Step 603: The processor obtains a block header of a second block of instructions to be executed, where the block header includes index information and indication information of a first block, where the first block is the block of the second block of instructions.
[0105] In step 603, when the processor executes the block instruction in the block instruction program, it reads multiple block instructions of the block instruction program from the hard disk or the memory, and saves the multiple block instructions into the instruction cache. Then, the processor reads the block header of the first block instruction from the instruction cache as the block header of the second block instruction, and reads the index information of the first block of the second block instruction from the block header.
[0106] A block of multiple block instructions in the instruction cache is the first block. It is assumed that the first block instruction is the first block instruction among the multiple block instructions, and the block header of the first block instruction among the multiple block instructions includes indication information, that is, the block header of the first block instruction includes indication information.
[0107] For example, see Figure 2 The processor reads the block header of the first block instruction from the instruction cache, the block header is the block header of block instruction 1, and the block header includes the index information "IP1" and indication information of block body 1 of block instruction 1. The index information "IP1" of block body 1 of block instruction 1 is read from the block header.
[0108] Step 604: The processor obtains the first block from the instruction cache based on the indication information and the index information of the first block.
[0109] In step 604, the processor determines based on the indication information that there are other block instructions in the instruction cache that are the same as the first block, and the second block instruction is the first block instruction among multiple block instructions including the first block. Therefore, the processor concludes that the first block is not stored in the block cache, determines the storage location of the first block in the instruction cache based on the index information of the first block, and reads the first block from the storage location.
[0110] For example, for block instruction 1, the block header of block instruction 1 includes the index information "IP1" and indication information of block 1. Based on the indication information, the processor determines that there are other block instructions in the instruction cache that are the same as block 1, and block instruction 1 is the first block instruction among multiple block instructions including block 1. Therefore, the processor concludes that block 1 is not stored in the block cache, determines the storage location of block 1 in the instruction cache based on the index information "IP1" of block 1, and reads block 1 from the storage location.
[0111] Step 605: The processor saves the index information of the first block and the corresponding relationship between the first block in the block cache, and executes the first block.
[0112] The first block includes a plurality of microinstructions, and the processor executes the microinstructions included in the first block.
[0113] For example, the processor saves the corresponding relationship between the index information “IP1” of block 1 and block 1 in the block cache shown in Table 1 above, and executes the microinstructions included in block 1.
[0114] After the processor completes executing the first block of the second block of instructions, it may continue to obtain the next block of instructions located in the instruction cache after the second block of instructions.
[0115] Step 606: The processor obtains a block header of a first block of instructions to be executed, where the block header includes index information of a first block, where the first block is a block of the first block of instructions.
[0116] In the instruction cache, the first block of instructions is located after the second block of instructions, and the processor executes the second block of instructions first. The first block of instructions and the second block of instructions are two block instructions including the same block.
[0117] Step 607: When the processor determines that the block cache stores the first block based on the index information of the first block of the first instruction, the processor obtains the first block from the block cache and executes the first block.
[0118] In step 607, the processor queries whether the index information of the first block is stored in the block cache based on the index information of the first block of the first block instruction, and if the index information of the first block is stored in the block cache, it is determined that the block cache stores the first block, obtains the first block corresponding to the index information of the first block from the block cache, and executes the microinstructions included in the first block.
[0119] In some embodiments, if it is found that the index information of the first block is not stored in the block cache, it is determined that the block cache does not store the first block. At this time, the processor determines the storage location of the first block in the instruction cache based on the index information of the first block, reads the first block from the storage location, and executes the first block.
[0120] If there are unexecuted block instructions in the instruction cache, the processor reads the block header of the next block instruction of the first block instruction from the instruction cache, and executes the above steps 603-607 for the block instruction until each block instruction in the instruction cache is executed.
[0121] In some embodiments, the processor that executes steps 601 to 602 and the processor that executes steps 603 to 607 may be the same processor or different processors.
[0122] For example, after the processor executes block 1 of block instruction 1, it reads the block header of the next block instruction from the instruction cache, that is, reads the block header of block instruction 2. The block header of block instruction 2 does not include indication information, and the index information "IP2" of block 2 of block instruction 2 is read from the block header of block instruction 2. Based on the index information "IP2", it is found that block 2 of block instruction 2 is not stored in the block cache shown in Table 1 above. Based on the index information "IP2", the storage location of block 2 in the instruction cache is determined, and block 2 is read from the storage location, and block 2 is executed.
[0123] The block header of the next block instruction is read from the instruction cache, that is, the block header of block instruction 3 is read. The block header of block instruction 3 does not include indication information, and the index information "IP1" of block body 1 of block instruction 3 is read from the block header of block instruction 3. Based on the index information "IP1", the block body 1 of block instruction 3 stored in the block body cache shown in Table 1 is queried, and the block body 1 of block instruction 3 is obtained from the block body cache shown in Table 1, and block body 1 is executed.
[0124] The block header of the next block instruction is read from the instruction cache, that is, the block header of block instruction 4 is read. The block header of block instruction 4 includes indication information, the index information "IP3" of block body 3 of block instruction 4 is read from the block header of block instruction 4, the storage location of block body 3 in the instruction cache is determined, block body 3 is read from the storage location, the corresponding relationship between the index information "IP3" of block body 3 and block body 3 is saved in the block cache shown in the above Table 1, and block body 3 is executed.
[0125] The block header of the next block instruction is read from the instruction cache, that is, the block header of block instruction 5 is read. The block header of block instruction 5 does not include indication information, and the index information "IP3" of block body 3 of block instruction 5 is read from the block header of block instruction 5. Based on the index information "IP3", it is found that the block body 1 of block instruction 3 is stored in the block body cache shown in Table 1 above, and the block body 3 of block instruction 5 is obtained from the block body cache shown in Table 1 above, and the block body 3 is executed.
[0126] In an embodiment of the present application, multiple block instructions including the same block (first block) are obtained from the instruction cache, and indication information is added to the block header of the first block instruction of the multiple block instructions. The second block instruction is the first block instruction among the multiple block instructions including the first block, so the block header of the second block instruction includes indication information. When the processor executes the second block instruction, based on the indication information and the index information of the first block included in the block header of the second block instruction, the processor obtains the first block from the instruction cache, saves the corresponding relationship between the index information of the first block and the first block in the block cache, and executes the first block. There is also a first block instruction among the multiple block instructions including the first block. When the processor obtains the block header of the first block instruction, it obtains the first block from the block cache based on the index information of the first block included in the block header of the first block instruction. Since the read and write performance of the block cache is higher than the read and write performance of the instruction cache, the time consumed by the processor to read the block from the block cache is reduced, and the efficiency of executing the block instruction is improved.
[0127] See also Figure 7 The present application embodiment provides a method 700 for executing a block instruction, wherein the method 700 is applied to Figure 1 or Figure 3 In the system 100 shown, the method 700 includes the following process from step 701 to step 707.
[0128] Step 701: The processor obtains a plurality of block instructions including the same block from the instruction cache.
[0129] In step 701, the processor obtains a detailed implementation process of multiple block instructions including the same block, see Figure 4 The relevant contents in step 401 of the method 400 are not described in detail here.
[0130] The number of the multiple block instructions is two or more than two, that is, at least two block instructions including the same block are obtained.
[0131] For example, see Figure 2 , assuming that the instruction cache stores block instruction 1, block instruction 2, block instruction 3, block instruction 4 and block instruction 5, the processor obtains block instruction 1 and block instruction 2 including the same block (block 1) from the instruction cache, and obtains block instruction 4 and block instruction 5 including the same block (block 3).
[0132] Step 702: The processor adds indication information to the block header of each block instruction in the multiple block instructions, where the indication information in any block instruction is used to indicate that there are other block instructions in the instruction cache that are the same as the block of any block instruction.
[0133] In some embodiments, see Figure 5 The block header of any block instruction includes a flag bit, and the processor sets the flag bit to add indication information to the block header of any block instruction, and the set flag bit is the indication information.
[0134] For example, for block instruction 1 and block instruction 3, the processor adds indication information in the block header of block instruction 1, and the indication information is used to indicate that there are other block instructions in the instruction cache that are the same as block 1 of block instruction 1. Instruction information is added to the block header of block instruction 3, and the indication information is used to indicate that there are other block instructions in the instruction cache that are the same as block 1 of block instruction 3.
[0135] For block instructions 4 and 5, the processor adds indication information in the block header of block instruction 4, and the indication information is used to indicate that there are other block instructions in the instruction cache that are the same as block 3 of block instruction 4. The processor adds indication information in the block header of block instruction 5, and the indication information is used to indicate that there are other block instructions in the instruction cache that are the same as block 3 of block instruction 5.
[0136] In step 702, the processor runs a compiler, and the compiler adds indication information to a block header of each block instruction in the plurality of block instructions.
[0137] Next, the processor may sequentially execute each block instruction in the block instruction program, that is, execute the following process of steps 703 - 707 .
[0138] Step 703: The processor obtains a block header of a second block of instructions to be executed, where the block header includes index information and indication information of a first block, where the first block is the block of the second block of instructions.
[0139] In step 703, when the processor executes the block instruction in the block instruction program, it reads multiple block instructions of the block instruction program from the hard disk or the memory, and saves the multiple block instructions into the instruction cache. Then, the processor reads the block header of the first block instruction from the instruction cache as the block header of the first block instruction, and reads the index information of the first block body of the first block instruction from the block header.
[0140] Assume that a block of multiple block instructions in the instruction cache is the first block, the first block instruction is the first block instruction among the multiple block instructions, and the block header of the first block instruction among the multiple block instructions includes indication information, that is, the block header of the first block instruction includes indication information.
[0141] For example, see Figure 2 The processor reads the block header of the first block instruction from the instruction cache, the block header is the block header of block instruction 1, and the block header includes the index information "IP1" and indication information of block body 1 of block instruction 1. The index information "IP1" of block body 1 of block instruction 1 is read from the block header.
[0142] Step 704: When the processor determines, based on the indication information and the index information of the first block, that the first block is not stored in the block cache, the processor obtains the first block from the instruction cache.
[0143] In step 704, the processor determines, based on the indication information, that there are other block instructions in the instruction cache that are the same as the first block, so the processor queries whether the first block is saved in the block cache based on the index information of the first block, and when it is found that the first block is not saved in the block cache, the processor determines the storage location of the first block in the instruction cache based on the index information of the first block, and reads the first block from the storage location.
[0144] For example, for block instruction 1, the block header of block instruction 1 includes the index information "IP1" of block 1 and indication information. Based on the indication information, the processor determines that there are other block instructions in the instruction cache that are the same as block 1. Based on the index information "IP1" of block 1, the processor queries that block 1 is not stored in the block cache, determines the storage location of block 1 in the instruction cache based on the index information "IP1" of block 1, and reads block 1 from the storage location.
[0145] Step 705: The processor saves the index information of the first block and the corresponding relationship between the first blocks in the block cache, and executes the first block.
[0146] The first block includes a plurality of microinstructions, and the processor executes the microinstructions included in the first block.
[0147] For example, the processor saves the corresponding relationship between the index information “IP1” of block 1 and block 1 in the block cache shown in Table 1 above, and executes the microinstructions included in block 1.
[0148] If the block header of the second block of instructions does not include the indication information, the processor directly obtains the first block from the instruction cache based on the index information of the first block and executes the first block. In other words, the processor directly determines the storage location of the first block in the instruction cache based on the index information of the first block, reads the first block from the storage location, and executes the first block.
[0149] After the processor completes executing the first block of the second block of instructions, it may continue to obtain the next block of instructions located in the instruction cache after the second block of instructions.
[0150] Step 706: The processor obtains a block header of a first block of instructions to be executed, where the block header includes index information and indication information of a first block, where the first block is a block of the first block of instructions.
[0151] In the instruction cache, the first block of instructions is located after the second block of instructions, and the processor executes the second block of instructions first. The first block of instructions and the second block of instructions are two block instructions including the same block.
[0152] Step 707: When the processor determines that the block cache stores the first block based on the indication information and the index information of the first block, the processor obtains the first block from the block cache and executes the first block.
[0153] In step 707, the processor determines that there are other block instructions in the instruction cache that are the same as the first block based on the indication information, so the processor queries whether the index information of the first block is stored in the block cache based on the index information of the first block of the first block instruction, and queries the index information of the first block stored in the block cache, and determines that the block cache stores the first block. The first block corresponding to the index information of the first block is obtained from the block cache, and the microinstructions included in the first block are executed.
[0154] If there are still unexecuted block instructions in the instruction cache, the processor reads the block header of the next block instruction of the first block instruction from the instruction cache, and executes the above steps 703-707 for the block instruction until each block instruction in the instruction cache is executed.
[0155] In some embodiments, the processor that executes steps 701 to 702 and the processor that executes steps 703 to 707 may be the same processor or different processors.
[0156] For example, after the processor executes block 1 of block instruction 1, it reads the block header of the next block instruction from the instruction cache, that is, reads the block header of block instruction 2. The block header of block instruction 2 does not include indication information, and the index information "IP2" of block 2 of block instruction 2 is read from the block header of block instruction 2. Based on the index information "IP2", the storage location of block 2 in the instruction cache is determined, and block 2 is read from the storage location, and block 2 is executed.
[0157] The block header of the next block instruction is read from the instruction cache, that is, the block header of block instruction 3 is read, and the block header of block instruction 3 includes indication information. Based on the indication information, the processor determines that there are other block instructions in the instruction cache that are the same as block 1, and then queries based on the index information "IP1" of block 1 that block 1 is stored in the block cache shown in Table 1 above, obtains block 1 of block instruction 3 from the block cache shown in Table 1 above, and executes block 1.
[0158] The block header of the next block instruction is read from the instruction cache, that is, the block header of block instruction 4 is read, and the block header of block instruction 4 includes indication information and index information "IP3" of block 3. Based on the indication information, the processor determines that there are other block instructions in the instruction cache that are the same as block 3 of block instruction 4, and then queries based on the index information "IP3" of block 3 that block 3 is not stored in the block cache shown in Table 1 above, determines the storage location of block 3 in the instruction cache, reads block 3 from the storage location, saves the corresponding relationship between the index information "IP3" of block 3 and block 3 in the block cache shown in Table 1 above, and executes block 3.
[0159] The block header of the next block instruction is read from the instruction cache, that is, the block header of block instruction 5 is read. The block header of block instruction 5 includes indication information and index information "IP3" of block body 3. Based on the indication information, the processor determines that there are other block instructions in the instruction cache that are the same as block body 3 of block instruction 5, and then queries based on the index information "IP3" of block body 3 that block body 3 is stored in the block body cache shown in Table 1 above, obtains block body 3 of block instruction 5 from the block body cache shown in Table 1 above, and executes block body 3.
[0160] In an embodiment of the present application, a plurality of block instructions including the same block (first block) are obtained from the instruction cache, and indication information is added to the block header of each block instruction of the plurality of block instructions. The plurality of block instructions include the first block instruction and the second block instruction, so the block header of the first block instruction and the block header of the second block instruction both include indication information. When the processor executes the second block instruction, based on the indication information and the index information of the first block included in the block header of the second block instruction, it is inquired that the block cache does not store the first block, the first block is obtained from the instruction cache, the corresponding relationship between the index information of the first block and the first block is saved in the block cache, and the first block is executed. When the processor obtains the block header of the first block instruction, based on the indication information and the index information of the first block included in the block header of the first block instruction, it is inquired that the block cache stores the first block, and the first block is obtained from the block cache. Since the read and write performance of the block cache is higher than the read and write performance of the instruction cache, the time consumed by the processor to read the block from the block cache is reduced, and the efficiency of executing the block instruction is improved.
[0161] See also Figure 8 The embodiment of the present application provides a device 800 for executing a block instruction. The device 800 is applied to a system including the device 800, an instruction cache and a block cache. The instruction cache includes multiple block instructions. The block cache includes a correspondence between index information of a first block and the first block. The first block is a block of at least two block instructions among the multiple block instructions. The index information is index information of the first block in the instruction cache. The read and write performance of the block cache is higher than the read and write performance of the instruction cache. The device 800 includes:
[0162] An acquiring unit 801 is configured to acquire a block header of a first block instruction to be executed, the block header including the index information, the block body of the first block instruction is a first block body, and the at least two block instructions include the first block instruction;
[0163] The acquiring unit 801 is further configured to acquire a first block from the block cache based on the index information;
[0164] The execution unit 802 is configured to execute the first block.
[0165] Optionally, the detailed implementation process of the acquisition unit 801 acquiring the block header of the first block of instructions is as follows: Figure 4 Step 403 of the method 400 shown, Figure 6 Step 606 of method 600 or Figure 7 The relevant contents in step 706 of the method 700 are not described in detail here.
[0166] Optionally, the detailed implementation process of the acquisition unit 801 acquiring the first block is as follows: Figure 4 Step 405 of the method 400 shown, Figure 6Step 607 of method 600 or Figure 7 The relevant contents in step 707 of the method 700 are not described in detail here.
[0167] Optionally, the execution unit 802 executes the detailed implementation process of the first block, see Figure 4 Step 407 of the method 400 shown, Figure 6 Step 607 of method 600 or Figure 7 The relevant contents in step 707 of the method 700 are not described in detail here.
[0168] Optionally, the at least two block instructions further include a second block instruction, and the acquiring unit 801 is further configured to:
[0169] Obtaining a block header of a second block of instructions to be executed, wherein the block header of the second block of instructions includes the index information, and the block body of the second block of instructions is the first block body;
[0170] Based on the index information, obtain a first block from the instruction cache;
[0171] The corresponding relationship between the index information and the first block is stored in the block cache.
[0172] Optionally, the detailed implementation process of the acquisition unit 801 acquiring the block header of the second block of instructions to be executed is as follows: Figure 6 Step 603 of method 600 or Figure 7 The relevant contents in step 703 of the method 700 are not described in detail here.
[0173] Optionally, the acquisition unit 801 acquires the first block from the instruction cache based on the index information. Figure 6 Step 604 of method 600 or Figure 7 The relevant contents in step 704 of the method 700 are not described in detail here.
[0174] Optionally, for a detailed implementation process of the acquisition unit 801 storing the corresponding relationship between the index information and the first block in the block cache, see Figure 6 Step 605 of method 600 or Figure 7 The relevant contents in step 705 of the method 700 are not described in detail here.
[0175] Optionally, the block header of the second block of instructions further includes first indication information, and the first indication information is used to indicate that the block body of other block instructions in the instruction cache is the same as the block body of the second block of instructions;
[0176] The acquiring unit 801 is configured to acquire a first block from an instruction cache based on the first indication information and the index information.
[0177] Optionally, the acquisition unit 801 acquires the first block from the instruction cache based on the first indication information and the index information. Figure 6 The relevant contents in step 607 of the method 600 are not described in detail here.
[0178] Optionally, the second block instruction is the first block instruction of the at least two block instructions.
[0179] Optionally, the acquiring unit 801 is further configured to add first indication information to a block header of a first block instruction among the at least two block instructions.
[0180] Optionally, the acquisition unit 801 acquires the detailed implementation process of the at least two block instructions, see Figure 6 The relevant contents in step 601 of the method 600 are not described in detail here.
[0181] Optionally, the detailed implementation process of the acquisition unit 801 adding the first indication information to the block header of the first block instruction of the at least two block instructions is as follows: Figure 6 The relevant contents in step 602 of the method 600 are not described in detail here.
[0182] Optionally, the acquiring unit 801 is configured to:
[0183] When it is determined based on the first indication information that the block of the other block instructions in the instruction cache is the same as the block of the second block instructions, querying the block cache based on the index information;
[0184] When it is found that the block cache does not store the first block, the first block is obtained from the instruction cache.
[0185] Optionally, the acquisition unit 801 queries the block cache based on the index information, and when it is found that the block cache does not store the first block, acquires the first block from the instruction cache. For a detailed implementation process, see Figure 7 The relevant contents in step 704 of the method 700 are not described in detail here.
[0186] Optionally, the block header of the first block of instructions further includes second indication information, and the second indication information is used to indicate that there are other block instructions in the instruction cache whose block bodies are the same as the block body of the first block of instructions;
[0187] The acquisition unit 801 is used to:
[0188] When it is determined based on the second indication information that the block of other block instructions in the instruction cache is the same as the block of the first block instruction, querying the block cache based on the index information;
[0189] When it is found that the block cache stores the first block, the first block is obtained from the block cache.
[0190] Optionally, the acquisition unit 801 queries the block cache based on the index information, and when it is found that the block cache does not store the first block, acquires the first block from the block cache. For a detailed implementation process, see Figure 7 The relevant contents in step 707 of the method 700 are not described in detail here.
[0191] Optionally, the block cache is located in the device 800 .
[0192] In the embodiment of the present application, since the block cache includes the index information of the first block and the corresponding relationship between the first block, the acquisition unit acquires the block header of the first block instruction to be executed, and the block header includes the index information of the first block, so that the acquisition unit reads the first block from the block cache based on the index information of the first block. Since the read and write performance of the block cache is higher than the read and write performance of the instruction cache, the time consumption of reading the first block can be reduced, and the efficiency of executing the first block instruction is improved.
[0193] See also Fig. 9 , an embodiment of the present application provides a schematic diagram of a device 900. The device 900 may include a processor provided by any of the above embodiments, for example, may include Figure 1 or Figure 3 The processor in the system 100 shown, or Figure 4 The processor in the method 400 shown, or Figure 6 The processor in the method 600 shown, or Figure 7 The processor in the method 700 is shown. The device 900 comprises at least one processor 901 , an internal connection 902 , a memory 903 and at least one transceiver 904 .
[0194] The device 900 is a hardware structure device that can be used to implement Figure 8 The functional modules in the device 800 are as follows. For example, those skilled in the art may think of Figure 8 The acquisition unit 801 and the execution unit 802 in the device 800 shown can be implemented by the at least one processor 901 calling the code in the memory 903 .
[0195] The device 900 may also be used to implement the function of the processor in any of the above embodiments.
[0196] The processor 901 may be a general-purpose central processing unit (CPU), a network processor (NP), a microprocessor, an application-specific integrated circuit (ASIC), or one or more integrated circuits for controlling the execution of the program of the present application.
[0197] The internal connection 902 may include a path to transmit information between the components. The internal connection 902 may be a single board or a bus.
[0198] The at least one transceiver 904 is used to communicate with other devices or communication networks.
[0199] The memory 903 may be a read-only memory (ROM) or other types of static storage devices that can store static information and instructions, a random access memory (RAM) or other types of dynamic storage devices that can store information and instructions, or an electrically erasable programmable read-only memory (EEPROM), a compact disc read-only memory (CD-ROM) or other optical disc storage, optical disc storage (including compressed optical disc, laser disc, optical disc, digital versatile disc, Blu-ray disc, etc.), a magnetic disk storage medium or other magnetic storage device, or any other medium that can be used to carry or store the desired program code in the form of instructions or data structures and can be accessed by a computer, but is not limited thereto. The memory may exist independently and be connected to the processor via a bus. The memory may also be integrated with the processor.
[0200] The memory 903 is used to store the application code for executing the solution of the present application, and the execution is controlled by the processor 901. The processor 901 is used to execute the application code stored in the memory 903, and cooperate with at least one transceiver 904, so that the device 900 implements the functions of the method of the present patent.
[0201] In a specific implementation, as an embodiment, the processor 901 may include one or more CPUs, such as Fig. 9 CPU0 and CPU1 in.
[0202] In a specific implementation, as an embodiment, the device 900 may include multiple processors, such as Fig. 9901 and processor 907 in the embodiment. Each of these processors may be a single-CPU processor or a multi-CPU processor. The processor herein may refer to one or more devices, circuits, and / or processing cores for processing data (e.g., computer program instructions).
[0203] A person skilled in the art will understand that all or part of the steps to implement the above embodiments may be accomplished by hardware or by instructing related hardware through a program, and the program may be stored in a computer-readable storage medium, and the above-mentioned storage medium may be a read-only memory, a disk or an optical disk, etc.
[0204] The above description is only an optional embodiment of the present application and is not intended to limit the present application. Any modifications, equivalent substitutions, improvements, etc. made within the principles of the present application shall be included in the protection scope of the present application.
Claims
1. A method for executing a block instruction, It is characterized in that The method is applied to a system including a processor, an instruction cache and a block cache, the instruction cache including a plurality of block instructions, the block cache including a correspondence between index information of a first block and the first block, the first block is a block of at least two block instructions among the plurality of block instructions, the index information is index information of the first block in the instruction cache, the read and write performance of the block cache is higher than the read and write performance of the instruction cache, the method comprising: The processor obtains a block header of a first block of instructions to be executed, the block header includes the index information, the block body of the first block of instructions is the first block body, and the at least two block instructions include the first block of instructions; The processor obtains the first block from the block cache based on the index information; The processor executes the first block.
2. The method according to claim 1, It is characterized in that The at least two block instructions also include a second block instruction, and the method further includes: The processor obtains a block header of the second block of instructions to be executed, the block header of the second block of instructions includes the index information, and the block body of the second block of instructions is the first block body; The processor obtains the first block from the instruction cache based on the index information; The processor stores the corresponding relationship between the index information and the first block in the block cache.
3. The method according to claim 2, It is characterized in that The block header of the second block instruction further includes first indication information, where the first indication information is used to indicate that there is a block body of another block instruction in the instruction cache that is the same as the block body of the second block instruction; The processor obtains the first block from the instruction cache based on the index information, including: The processor obtains the first block from the instruction cache based on the first indication information and the index information.
4. The method according to claim 3, It is characterized in that The second block instruction is a first block instruction of the at least two block instructions.
5. The method according to claim 3 or 4, It is characterized in that The method further comprises: The processor adds the first indication information to a block header of a first block instruction among the at least two block instructions.
6. The method according to claim 3, It is characterized in that The processor obtains the first block from the instruction cache based on the first indication information and the index information, including: When the processor determines, based on the first indication information, that a block of another block instruction in the instruction cache is the same as the block of the second block instruction, querying the block cache based on the index information; When the processor finds out that the block cache does not store the first block, it obtains the first block from the instruction cache.
7. The method according to claim 1, 2 or 6, It is characterized in that The block header of the first block instruction further includes second indication information, where the second indication information is used to indicate that there are other block instructions in the instruction cache whose block bodies are the same as the block body of the first block instruction; The processor obtains the first block from the block cache based on the index information, including: When the processor determines, based on the second indication information, that a block of another block instruction in the instruction cache is the same as the block of the first block instruction, querying the block cache based on the index information; When the processor finds out that the block cache stores the first block, it obtains the first block from the block cache.
8. The method according to any one of claims 1 to 7, It is characterized in that The block cache is located in the processor.
9. A device for executing a block instruction, It is characterized in that The device is applied to a system including the device, an instruction cache and a block cache, the instruction cache including multiple block instructions, the block cache including a correspondence between index information of a first block and the first block, the first block is a block of at least two block instructions among the multiple block instructions, the index information is index information of the first block in the instruction cache, the read and write performance of the block cache is higher than the read and write performance of the instruction cache, and the device includes: an acquiring unit, configured to acquire a block header of a first block instruction to be executed, the block header including the index information, the block body of the first block instruction being the first block body, and the at least two block instructions including the first block instruction; The acquiring unit is further configured to acquire the first block from the block cache based on the index information; An execution unit, configured to execute the first block.
10. The device according to claim 9, It is characterized in that The at least two block instructions also include a second block instruction, and the acquisition unit is further configured to: Acquire a block header of the second block of instructions to be executed, where the block header of the second block of instructions includes the index information, and the block body of the second block of instructions is the first block body; Based on the index information, obtaining the first block from the instruction cache; The corresponding relationship between the index information and the first block is stored in the block cache.
11. The device according to claim 10, It is characterized in that The block header of the second block instruction further includes first indication information, where the first indication information is used to indicate that there is a block body of another block instruction in the instruction cache that is the same as the block body of the second block instruction; The acquiring unit is configured to acquire the first block from the instruction cache based on the first indication information and the index information.
12. The device according to claim 11, It is characterized in that The second block instruction is a first block instruction of the at least two block instructions.
13. The device according to claim 11 or 12, It is characterized in that The acquisition unit is further used for: The first indication information is added to a block header of a first block instruction among the at least two block instructions.
14. The device according to claim 11, It is characterized in that The acquisition unit is used to: When it is determined based on the first indication information that a block of another block instruction in the instruction cache is the same as the block of the second block instruction, querying the block cache based on the index information; When it is found that the block cache does not store the first block, the first block is obtained from the instruction cache.
15. The device according to claim 9, 10 or 14, It is characterized in that The block header of the first block instruction further includes second indication information, where the second indication information is used to indicate that there are other block instructions in the instruction cache whose block bodies are the same as the block body of the first block instruction; The acquisition unit is used to: When it is determined based on the second indication information that a block of another block instruction in the instruction cache is the same as the block of the first block instruction, querying the block cache based on the index information; When it is found that the block cache stores the first block, the first block is obtained from the block cache.
16. The device according to any one of claims 9 to 15, It is characterized in that The block cache is located in the device.
17. A device for executing a block instruction, It is characterized in that The system comprises at least one processor, wherein the at least one processor is used to be coupled with a memory, read and execute instructions in the memory, so as to implement the method according to any one of claims 1 to 8.
18. A computer-readable storage medium having a computer program stored thereon, It is characterized in that When the computer program is executed by a computer, the method according to any one of claims 1 to 8 is implemented.
