Data processing method and processor
By processing vector loading instructions on the scalar pipeline and processing instructions on the vector pipeline, the resource usage of the vector register group is reduced, and the problem of excessive resource usage caused by the circular expansion of vector loading instructions is solved, which improves the performance of AI processors.
Patent Information
- Application Number
- CN202310629949.7
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2023-05-30
- Publication Date
- 2024-12-03
AI Technical Summary
In AI processors, the circular expansion of vector loading instructions causes excessive resource use of vector register group, affecting system performance.
By processing vector loading instructions on the scalar pipeline, sending vector loading memory access requests in advance, and processing vector processing instructions on the vector pipeline, reducing the number of loop expansions of vector loading instructions and reducing the resource usage of vector register groups.
It effectively reduces the resource usage of vector register groups, improves processor performance and vector processing flexibility.
Smart Images

Figure CN119065718A_ABST
Abstract
Description
Technical Field
[0001] The present disclosure relates to the field of data processing technology, and in particular to a data processing method and a processor. Background Art
[0002] The Very Long Instruction Word (VLIW) architecture is a common architecture for artificial intelligence (AI) processors. The VLIW architecture is characterized by an instruction package containing multiple instructions, including scalar instructions and vector instructions, which can be processed separately by their corresponding execution units, and can execute multiple operations in parallel in a single clock cycle. It has high performance and is suitable for use in scenarios such as AI processors that have high performance requirements.
[0003] An important indicator of AI processors is their vector processing capability. Usually, to match high-computing computing scenarios, AI processors have high vector processing parallelism. In order to improve the flexibility of vector processing, AI processors usually introduce vector register files (VRFs), so that the data processed by the computing unit can be temporarily stored in the VRF, without having to output it to the on-chip memory every time the calculation is completed, which is more flexible.
[0004] In the related art, the decoding unit of the VLIW architecture first decodes the instruction packet, and after the decoding is completed, the scalar instructions and vector instructions therein are distributed to the scalar pipeline and the vector pipeline for processing. The vector load instruction (VLOAD) corresponding to the vector instruction is emitted only after the vector instruction reaches the vector pipeline, and the loading result of the VLOAD instruction is stored in the VRF. It usually takes multiple clock cycles to execute the VLOAD instruction, and the vector processing instruction that needs to use its loading result can only be emitted after multiple clock cycles. In these clock cycles, multiple subsequent VLOAD instructions are usually emitted, that is, multiple rounds of VLOAD loop expansion are performed, which requires too many valuable VRF resources, and the VRF resources left for calculation will become less, which greatly affects the performance of the entire system.
[0005] As mentioned above, how to avoid excessive VRF resource occupation when processing instruction packets becomes an urgent problem to be solved.
[0006] The above information disclosed in the Background section is only for enhancement of understanding of the background of the present disclosure and therefore it may include information that does not constitute the prior art that is already known to one of ordinary skill in the art. Summary of the invention
[0007] The purpose of the present disclosure is to provide a data processing method and a processor, which can reduce the VRF resource occupation when processing instruction packets at least to a certain extent.
[0008] Other features and advantages of the present disclosure will become apparent from the following detailed description, or may be learned in part by the practice of the present disclosure.
[0009] An embodiment of the present disclosure provides a data processing method, including: processing a first instruction packet on a first scalar pipeline, obtaining and sending a first vector load memory access request corresponding to a first vector load instruction, the first instruction packet including the first vector load instruction, the first vector load instruction being used to indicate loading of first vector data; processing a second instruction packet on a second scalar pipeline, obtaining and executing a second scalar processing instruction, obtaining a first vector processing instruction, and submitting the first vector processing instruction to the vector pipeline, the second instruction packet including the second scalar processing instruction and the first vector processing instruction, the first vector processing instruction being used to indicate processing of the first vector data; processing the first vector load memory access request, obtaining and registering the first vector data; on the vector pipeline, obtaining the registered first vector data, executing the first vector processing instruction, and obtaining a first vector data processing result.
[0010] The embodiment of the present disclosure provides a processor, comprising: a decoding unit, configured to process a first instruction packet on a first scalar pipeline, obtain and send a first vector load memory access request corresponding to a first vector load instruction, wherein the first instruction packet includes the first vector load instruction, and the first vector load instruction is used to instruct to load first vector data; the decoding unit is further configured to process a second instruction packet on a second scalar pipeline, obtain a second scalar processing instruction and a first vector processing instruction, wherein the second instruction packet includes the second scalar processing instruction and the first vector processing instruction, and the first vector processing instruction is used to instruct to process the first vector data; the scalar instruction An instruction execution unit, coupled to the decoding unit, is used to execute the second scalar processing instruction on the second scalar pipeline; an instruction submission unit, coupled to the decoding unit and the scalar instruction execution unit, is used to submit the first vector processing instruction to the vector pipeline; a vector loading unit, coupled to the decoding unit, is used to process the first vector load memory access request, obtain and register the first vector data; a vector reading unit, is used to obtain the registered first vector data on the vector pipeline; a vector instruction execution unit, coupled to the vector reading unit, is used to execute the first vector processing instruction and obtain a first vector data processing result.
[0011] According to an embodiment of the present disclosure, the decoding unit is further used to decode the first instruction packet on the first scalar pipeline in a first clock cycle to obtain and send the first vector load memory access request; the decoding unit is further used to process the second instruction packet on the second scalar pipeline in a second clock cycle to obtain the second scalar processing instruction and the first vector processing instruction, the second clock cycle is after the first clock cycle, and the second clock cycle includes a plurality of single clock cycles; the scalar instruction execution unit is further used to execute the second scalar processing instruction on the second scalar pipeline in the second clock cycle; The instruction submission unit is further used to submit the first vector processing instruction to the vector pipeline on the second scalar pipeline in the second clock cycle; the vector loading unit is further used to process the first vector load memory access request in the second clock cycle to obtain and register the first vector data; the vector reading unit is further used to obtain the registered first vector data on the vector pipeline in the third clock cycle after the second clock cycle; the vector instruction execution unit is further used to execute the first vector processing instruction on the vector pipeline in the third clock cycle to obtain the first vector data processing result.
[0012] According to an embodiment of the present disclosure, the processor also includes a vector register group shared by the first scalar pipeline, the second scalar pipeline and the vector pipeline; the vector loading unit is also coupled to the vector register group, and is also used to send the first vector data to the vector register group in the last clock cycle of the second clock cycle; the processor also includes: a vector decoding unit, coupled to the instruction submission unit and the vector register group, and is used to decode the first vector processing instruction on the vector pipeline in the last clock cycle of the second clock cycle, obtain the first vector processing control information corresponding to the first vector processing instruction, and send the first vector processing control information to the vector pipeline. The information is sent to the vector register group; the vector read unit is coupled to the vector register group, and is also used to read the first vector processing control information and the first vector data from the vector register group respectively at the third clock cycle on the vector pipeline; the vector instruction execution unit is also used to process the first vector data according to the first vector processing control information at the third clock cycle on the vector pipeline to obtain the first vector data processing result; the processor also includes: a vector write back unit, coupled to the vector instruction execution unit and the vector register group, and is used to send the first vector data processing result to the vector register group at the third clock cycle on the vector pipeline.
[0013] According to one embodiment of the present disclosure, the decoding unit is also used to decode the first instruction packet on the first scalar pipeline, obtain the first vector load memory access request, and send the first vector load memory access request to the vector loading unit; the vector loading unit is also coupled to the vector memory, and is also used to send the first vector load memory access request to the vector memory, and after the vector memory returns the first vector data according to the first vector load memory access request, send the first vector data to store it.
[0014] According to one embodiment of the present disclosure, the vector loading unit is also used to determine whether to issue the first vector load memory access request or to issue a request to be resent, wherein the request to be resent is a vector load memory access request corresponding to a vector load instruction that is determined to have a dependency relationship with a preceding instruction; if it is determined to issue the first vector load memory access request, the first vector load memory access request is sent to the vector memory.
[0015] According to an embodiment of the present disclosure, the vector loading unit includes a dependency detection unit, an entry allocation unit, an instruction queue and an arbitration scheduling unit; the dependency detection unit is coupled to the decoding unit, and is used to determine whether the first vector loading instruction has a dependency relationship with a preceding instruction according to the first vector loading memory access request; the entry allocation unit is coupled to the decoding unit and the instruction queue, and is used to allocate an entry in the instruction queue to the first vector loading memory access request, and obtain first entry information corresponding to the first vector loading memory access request; the dependency detection unit is also coupled to the instruction queue, and is also used to write resending indication information into the first entry information if it is determined that the first vector loading instruction has a dependency relationship with the preceding instruction; the vector loading unit is also used to determine the first vector loading memory access request as the vector loading memory access request to be sent based on the first entry information and according to the resending indication information; the arbitration scheduling unit is coupled to the vector memory, and is used to send the vector loading memory access request to be sent to the vector memory.
[0016] According to an embodiment of the present disclosure, the first vector load instruction includes a first memory access address; the decoding unit is further used to decode the first instruction packet on the first scalar pipeline to obtain the first memory access address in the first vector load instruction; based on the first memory access address, the first vector load memory access request is generated, and the first vector load memory access request includes the first memory access address; the entry allocation unit is further used to allocate an entry in the instruction queue to the first vector load memory access request, store the first memory access address into the instruction queue according to the allocated entry, and obtain the first entry information, and the first entry information includes the first memory access address; the dependency detection unit is further used to obtain the memory access address of the preceding storage instruction sent by the storage instruction processing unit; the dependency detection unit is further used to obtain the first memory access address in the instruction queue; the dependency detection unit is further used to determine whether the first memory access address is the same as the memory access address of the preceding storage instruction; if it is determined that the first memory access address is the same as the memory access address of the preceding storage instruction, the resending indication information is written into the first entry information.
[0017] According to one embodiment of the present disclosure, the first entry information includes a dependency table; the dependency detection unit is also coupled to the storage instruction processing unit, and is also used to write the information of the preceding storage instruction into the dependency table if it is determined that the first memory access address is the same as the memory access address of the preceding storage instruction; obtain the execution completion information of the preceding storage instruction from the storage instruction processing unit; delete the information of the preceding storage instruction in the dependency table according to the execution completion information of the preceding storage instruction; and write the need to resend indication information into the first entry information according to the dependency table.
[0018] According to one embodiment of the present disclosure, the vector loading unit is also used to: obtain request sending return information from the arbitration scheduling unit; determine whether the first vector loading memory access request has been retransmitted based on the request sending return information, obtain whether it has been retransmitted information, and write the whether it has been retransmitted information into the first entry information; the vector loading unit also includes a logic operation unit and a leading detection unit; the logic operation unit is coupled to the instruction queue, and is used to perform a logic operation on the retransmission indication information and the whether it has been retransmitted information to obtain a logic operation result; the leading detection unit is coupled to the logic operation unit, and is used to determine the first vector loading memory access request as the vector loading memory access request to be sent based on the logic operation result.
[0019] According to one embodiment of the present disclosure, the vector loading unit also includes an index queue and a data queue; the arbitration scheduling unit is also coupled to the index queue, and is also used to send the vector load memory access request to be sent to the vector memory, and write the number of the entry in the instruction queue corresponding to the vector load memory access request to be sent into the index queue; the vector loading unit is also used to write the first vector data into the data queue according to the number in the index queue after the vector memory returns the first vector data according to the first vector load memory access request; the data queue is used to send the first vector data for storage.
[0020] According to one embodiment of the present disclosure, the second clock cycle includes a fourth clock cycle and a fifth clock cycle, the fourth clock cycle is the first at least one clock cycle in the second clock cycle, and the fifth clock cycle is after the fourth clock cycle; the decoding unit is also used to decode the second instruction packet on the second scalar pipeline in the fourth clock cycle, obtain the second scalar processing instruction and the first vector processing instruction, and determine whether to submit the first vector processing instruction; the scalar instruction execution unit is also used to execute the second scalar processing instruction on the second scalar pipeline in the fourth clock cycle; the instruction submission unit is also used to submit the first vector processing instruction to the vector pipeline on the second scalar pipeline in the fifth clock cycle when the decoding unit determines to submit the first vector processing instruction.
[0021] According to one embodiment of the present disclosure, the second instruction packet also includes a second vector load instruction, and the second vector load instruction is used to indicate the loading of second vector data; the decoding unit is also used to process the second instruction packet on the second scalar pipeline, obtain and send a second vector load memory access request corresponding to the second vector load instruction.
[0022] An embodiment of the present disclosure provides a device, including: a memory, a processor, and executable instructions stored in the memory and executable in the processor, wherein the processor implements any of the above methods when executing the executable instructions.
[0023] An embodiment of the present disclosure provides a computer-readable storage medium having computer-executable instructions stored thereon, and when the executable instructions are executed by a processor, any of the above methods is implemented.
[0024] The embodiments of the present disclosure provide a computer program product or a computer program, which includes computer instructions stored in a computer-readable storage medium. A processor of a computer device reads the computer instructions from the computer-readable storage medium, and the processor executes the computer instructions, so that the computer device executes the methods provided in the above-mentioned various optional implementations.
[0025] The data processing method provided by the embodiment of the present disclosure first processes a first instruction packet including a first vector load instruction for indicating loading of first vector data on a first scalar pipeline, obtains and sends a first vector load memory access request corresponding to the first vector load instruction; then processes a second instruction packet including a second scalar processing instruction and a first vector processing instruction for indicating processing of the first vector data on a second scalar pipeline, obtains and executes the second scalar processing instruction, obtains the first vector processing instruction, and submits the first vector processing instruction to the vector pipeline; and processes the first vector load memory access request to obtain and register the first vector data; then on the vector pipeline, obtains the registered first vector data, executes the first vector processing instruction, and obtains the first vector data processing result. By sending a first vector load memory access request corresponding to a first vector load instruction on a first scalar pipeline, and processing a second instruction packet on a second scalar pipeline, executing the second scalar processing instruction, and submitting the first vector processing instruction, the sent first vector load memory access request is processed to register the first vector data, and the first vector processing instruction can be executed on the vector pipeline that obtains the first vector processing instruction using the registered first vector data, thereby reducing the emission of instruction packets including subsequent vector load instructions after the first instruction packet, thereby reducing the resource occupancy of the VRF used to register the loaded vector data.
[0026] It is to be understood that the foregoing general description and the following detailed description are exemplary only and are not restrictive of the present disclosure. BRIEF DESCRIPTION OF THE DRAWINGS
[0027] The above and other objects, features and advantages of the present disclosure will become more apparent by describing in detail example embodiments thereof with reference to the attached drawings.
[0028] Figure 1 The schematic diagram of distributing instructions to instruction packets in the related art is exemplified.
[0029] Figure 2 The following is a schematic diagram showing an exemplary method of expanding a VLOAD instruction in the related art.
[0030] Figure 3 The invention is a flowchart of a data processing method according to an exemplary embodiment.
[0031] Figure 4 The figure is a flowchart of another data processing method according to an exemplary embodiment.
[0032] Figure 5 is a flowchart of yet another data processing method according to an exemplary embodiment.
[0033] Figure 6 is a flowchart of yet another data processing method according to an exemplary embodiment.
[0034] Figure 7 is based on Figure 6 A schematic diagram of a VLOAD instruction loop expansion is shown.
[0035] Figure 8 Shows Figure 3 FIG. 4 is a schematic diagram of the processing process of S304 in one embodiment.
[0036] Fig. 9 Shows Figure 3 FIG. 4 is a schematic diagram of the processing process of S306 in one embodiment.
[0037] Fig.10 Shows Figure 3 FIG. 4 is a schematic diagram of the processing process of S306 in another embodiment.
[0038] Fig.11 Shows Figure 3 FIG. 4 is a schematic diagram of the processing process of S302 and S306 in yet another embodiment.
[0039] Fig.12 Shows Fig.11 FIG. 1 is a schematic diagram of the processing process of S11010 in one embodiment.
[0040] Fig.13 Shows Fig.10 FIG. 4 is a schematic diagram of the processing process of S1008 in one embodiment.
[0041] Fig.14 is based on Fig.13 A schematic diagram showing entry information of an instruction queue during a retransmission process.
[0042] Fig.15 Shows Fig.10 The S10010 and Figure 3 FIG. 4 is a schematic diagram of the processing process of S306 in one embodiment.
[0043] Fig.16 is based on Figures 9 to 15 A schematic diagram of the overall architecture of a vector loading unit is shown.
[0044] Fig.17 is based on Figures 3 to 16 A schematic diagram of a pipeline architecture is shown.
[0045] Fig.18 A block diagram of a processor in an embodiment of the present disclosure is shown.
[0046] Fig.19 A block diagram showing another processor in an embodiment of the present disclosure.
[0047] Fig. 20 A schematic structural diagram of an electronic device in an embodiment of the present disclosure is shown. DETAILED DESCRIPTION
[0048] Example embodiments will now be described more fully with reference to the accompanying drawings. However, example embodiments can be implemented in a variety of forms and should not be construed as limited to the examples set forth herein; rather, these embodiments are provided so that the disclosure will be more comprehensive and complete and will fully convey the concepts of the example embodiments to those skilled in the art. The accompanying drawings are only schematic illustrations of the disclosure and are not necessarily drawn to scale. The same reference numerals in the figures represent the same or similar parts, and thus their repeated description will be omitted.
[0049] In addition, the described features, structures or characteristics may be combined in one or more embodiments in any suitable manner. In the following description, many specific details are provided to provide a full understanding of the embodiments of the present disclosure. However, those skilled in the art will appreciate that the technical solutions of the present disclosure may be practiced while omitting one or more of the specific details, or other methods, devices, steps, etc. may be adopted. In other cases, well-known structures, methods, devices, implementations or operations are not shown or described in detail to avoid obscuring various aspects of the present disclosure.
[0050] In addition, in the description of the present disclosure, unless otherwise clearly specified and limited, terms such as "connection" should be understood in a broad sense, for example, it can be an electrical connection or can communicate with each other; it can be directly connected or indirectly connected through an intermediate medium. The meaning of "plurality" is at least two, such as two, three, etc., unless otherwise clearly and specifically limited. For ordinary technicians in this field, the specific meanings of the above terms in the present disclosure can be understood according to specific circumstances.
[0051] The terms involved in the present disclosure are explained below.
[0052] Pipeline: Pipeline technology is a technology that breaks down instructions into multiple steps and overlaps the operations of different steps of different instructions, so as to realize parallel processing of several instructions and speed up the program running process. Each step of the instruction is processed by its own independent circuit. After completing each step, it proceeds to the next step, and the circuit that processes the previous step processes the subsequent instructions.
[0053] Scalar pipeline: A pipeline used to process scalar data.
[0054] Vector pipeline: A pipeline used to process vector data.
[0055] In the field of AI processors, vector load instructions are widely used. As mentioned above, in related technologies, vector load instructions are usually processed only after the vector instructions reach the vector pipeline. Figure 1 The schematic diagram of distributing instructions to instruction packets in the related art is exemplified. Figure 1 As shown, the decoding unit (decoder, DEC) 102 first decodes the instruction packet, and after decoding, distributes the scalar instructions and vector instructions therein to the scalar pipeline 1042 and the vector pipeline 1044 for processing.
[0056] AI processors improve the flexibility of vector processing by introducing VRF. The cost of higher flexibility is that VRF will occupy more resources. The pipeline for executing vector load instructions to load vector data from the on-chip cache is long, that is, there is a VLOAD delay. To avoid the generation of instruction bubbles, the VLOAD instruction loop is usually expanded, that is, the next VLOAD instruction is issued while the previous VLOAD instruction is still in the process of loading. The number of times the loop is expanded is related to the time of the VLOAD delay. The following takes the VLOAD delay of 6 clock cycles as an example for explanation.
[0057] Figure 2 The following is a schematic diagram showing a VLOAD instruction expansion method in the related art. Figure 2 As shown, instruction (inst) 0, instruction 1, instruction 2 ... instruction 11 are 12 instruction packets that are issued in a chronological order in consecutive clock cycles, and each instruction packet may include at least two instruction slots (SLOT): a load slot (LOAD SLOT) 202 and a calculation slot (CALC SLOT) 204. The load slot 202 is used to place a load instruction, such as a vector load instruction VLOAD; the calculation slot 204 is used to place a calculation instruction, such as a vector processing instruction, Figure 2The vector non-instruction VINV is used as an example for explanation. When the process of processing VLOAD instructions to access the on-chip cache requires 6 clock cycles, that is, it takes 6 clock cycles from issuing the VLOAD instruction to the vector data corresponding to the instruction reaching the VRF, the vector data stored in register r0 corresponding to the VLOAD out.r0 instruction issued by instruction 0 needs to arrive at VRF after 6 clock cycles. The execution of the corresponding vector calculation instruction VINV out.r8,in.r0 requires the result loaded by the VLOAD out.r0 instruction, that is, the vector data stored in register r0, so it is necessary to issue the instruction package containing the VINV out.r8,in.r0 instruction 6 clock cycles after issuing instruction 0, that is, to issue it in the instruction package of instruction 6. In order to avoid the generation of instruction bubbles, the five instruction packages of instruction 1 to instruction 5 successively expand VLOAD out.r1, VLOAD out.r2, VLOAD out.r3, VLOAD out.r4 and VLOAD out.r5, a total of 5 VLOAD instructions, and the VLOAD instruction loop is expanded 6 times. These instructions occupy different VRF entries. Usually, the instructions have two operands, which requires the expansion of two VLOAD instructions, which requires a total of 12 VRF entries. Usually, the total number of VRF entries is 32. In the VLOAD loop expansion, more VRFs are occupied, which greatly affects the operation of the program.
[0058] Therefore, the present disclosure provides a data processing method, which pre-places vector load instructions to the scalar pipeline for issuance, and processes vector load instructions in parallel when the scalar instructions are executed, thereby reducing the time waiting for vector loading on the vector pipeline, reducing the number of times the vector load instruction loop is expanded, reducing the occupancy of VRF resources, and improving the utilization rate of VRF.
[0059] AI is the theory, method, technology and application system that uses digital computers or machines controlled by digital computers to simulate, extend and expand human intelligence, perceive the environment, acquire knowledge and use knowledge to obtain the best results. In other words, artificial intelligence is a comprehensive technology in computer science that attempts to understand the essence of intelligence and produce a new intelligent machine that can respond in a similar way to human intelligence. Artificial intelligence is to study the design principles and implementation methods of various intelligent machines so that machines have the functions of perception, reasoning and decision-making.
[0060] Artificial intelligence technology is a comprehensive discipline that covers a wide range of fields, including both hardware-level and software-level technologies. The basic technologies of artificial intelligence generally include sensors, dedicated artificial intelligence chips, cloud computing, distributed storage, big data processing technology, operating / interactive systems, mechatronics and other technologies.
[0061] With the research and advancement of artificial intelligence technology, artificial intelligence technology has been studied and applied in many fields, such as common smart homes, smart wearable devices, virtual assistants, smart speakers, smart marketing, unmanned driving, automatic driving, drones, robots, smart medical care, smart customer service, etc. I believe that with the development of technology, artificial intelligence technology will be applied in more fields and play an increasingly important role.
[0062] The three major supports of artificial intelligence technology are hardware, algorithms and data, among which hardware refers to the AI processor that runs the AI algorithm and its corresponding computing platform. The technical solution provided in the embodiments of the present disclosure involves aspects such as the AI processor, which will be illustrated by specific embodiments below.
[0063] The data processing method provided in the embodiments of the present disclosure can be applied to the above-mentioned AI processor, and can also be applied to an ordinary processor that can process vector data, and the present disclosure is not limited thereto.
[0064] Figure 3 FIG. 1 is a flow chart of a data processing method according to an exemplary embodiment. Figure 3 The method shown can be applied to an AI processor, for example, or to a common processor that processes vector data.
[0065] refer to Figure 3 , the method 30 provided in the embodiment of the present disclosure may include the following S302 to S308.
[0066] In S302, a first instruction packet is processed on a first scalar pipeline to obtain and send a first vector load memory access request corresponding to a first vector load instruction, wherein the first instruction packet includes the first vector load instruction, and the first vector load instruction is used to instruct loading of first vector data.
[0067] In some embodiments, the first scalar pipeline and the second scalar pipeline described below may be parallel pipelines. The instruction packet may be a set of scalar instructions and vector instructions, for example, it may include a first instruction packet and a second instruction packet described below. The scalar instruction may be an instruction for indicating processing scalar data, for example, it may include a first scalar processing instruction and a second scalar processing instruction described below. The vector instruction may be an instruction for indicating processing vector data, for example, it may include a first vector load instruction, a first vector processing instruction described below, a second vector load instruction and a second vector processing instruction.
[0068] In some embodiments, the first vector load instruction is an instruction to instruct to load the first vector data. The first instruction packet may be decoded on the first scalar pipeline to generate a control signal corresponding to the first instruction packet. For example, when the first instruction packet includes the first vector load instruction, decoding the first instruction packet may obtain a first vector load memory access request, the first vector load memory access request may include a first memory access address, and the first vector load memory access request may be a request to load the first vector data according to the first memory access address.
[0069] In some embodiments, decoding the first instruction packet on the first scalar pipeline to obtain the first vector load memory access request can be performed in the same clock cycle as sending the first vector load memory access request, that is, the loading process of the first vector data is processed as early as possible. For specific implementation methods, refer to Figure 4 and Figure 6 .
[0070] In some other embodiments, when the time period for processing the first vector load memory access request is relatively short and / or the time period for processing on the second scalar pipeline is relatively long, the first vector load memory access request may be sent on the first scalar pipeline in one or more clock cycles after obtaining the first vector load memory access request. For specific implementations, refer to Figure 5 .
[0071] In some embodiments, the processor may include a vector register group shared by a first scalar pipeline, a second scalar pipeline, and a vector pipeline. After decoding the first instruction packet on the first scalar pipeline and obtaining a first vector load memory access request, the first vector load memory access request may be sent to a vector load unit, and the vector load unit reads the first vector data from the vector memory according to the first memory access address to load the first vector data. The specific implementation of the vector load unit may refer to Figures 9 to 16 .
[0072] In S304, the second instruction packet is processed on the second scalar pipeline, the second scalar processing instruction is obtained and executed, the first vector processing instruction is obtained, and the first vector processing instruction is submitted to the vector pipeline, the second instruction packet includes the second scalar processing instruction and the first vector processing instruction, and the first vector processing instruction is used to instruct the processing of the first vector data.
[0073] In some embodiments, after the first instruction packet is decoded on the first scalar pipeline, the second instruction packet is decoded on the second scalar pipeline, and after obtaining the second scalar processing instruction and the first vector processing instruction, the second scalar processing instruction is executed, and after the second scalar processing instruction is executed, the first vector processing instruction is submitted to the vector pipeline. The specific implementation of each step on the second scalar pipeline can be referred to Figure 6 .
[0074] In some embodiments, the second instruction packet may further include a second vector load instruction, where the second vector load instruction is an instruction for instructing to load the second vector data. When the second instruction packet is decoded on the second scalar pipeline, a second vector load memory access request may also be obtained and sent. For a specific implementation, see Figure 6 .
[0075] In some embodiments, the clock cycle for executing the second scalar processing instruction may be one or more, and the specific time length is related to the content of the second scalar processing instruction. In the embodiments of the present disclosure, two clock cycles are used as an example for description, but the present invention is not limited thereto.
[0076] In some embodiments, when the second instruction packet is decoded to obtain the first vector processing instruction, it can be determined whether it is a vector instruction. It takes a long time to determine whether the first vector processing instruction is a vector instruction. It is not completed in the clock cycle of decoding. It can be completed in the clock cycle of executing the second scalar processing instruction. Then, after determining that the first vector processing instruction is a vector instruction, the first vector processing instruction is submitted to the vector pipeline. For specific implementations, please refer to Figure 8 .
[0077] In S306 , the first vector load memory access request is processed to obtain and store the first vector data.
[0078] In some embodiments, the time required to process the first vector load memory access request is usually relatively long, which is a plurality of single clock cycles. In the embodiments of the present disclosure, unless otherwise specified, six clock cycles are used as an example for description, but the present invention is not limited thereto.
[0079] In some embodiments, registering the first vector data may be an operation of sending the first vector data to a unit for data registration. The unit for data registration may be a register, a vector register group, etc. The embodiment of the disclosure is described by taking the vector register group as an example, but is not limited thereto.
[0080] In some embodiments, the first vector load memory access request may be processed by a vector load unit in the processor. The vector load unit may send the first vector load memory access request to the vector memory, and after the vector memory returns the first vector data according to the first vector load memory access request, send the first vector data to be stored.
[0081] In some embodiments, the vector load unit may speculatively execute the VLOAD instruction, that is, the vector load unit may process the first vector load memory access request and determine whether it has a dependency relationship with the preceding instruction in parallel. If it is determined that it has a dependency relationship with the preceding instruction, the first vector load memory access request may be reissued. Figures 9 to 14 .
[0082] In some embodiments, the vector loading unit may determine whether there is a dependency relationship between the vector loading memory access request and the preceding instruction according to the memory access address. For a specific implementation, see Fig.11 .
[0083] In some embodiments, after the vector memory returns the first vector data according to the first vector load access request, the vector loading unit may send the first vector data to the vector register group through a data queue (Data Queue, DQ). Fig.15 .
[0084] In S308, on the vector pipeline, the first stored vector data is obtained, the first vector processing instruction is executed, and the first vector data processing result is obtained.
[0085] In some embodiments, after the first vector data is stored in S306, the stored first vector data can be obtained on the vector pipeline, and the first vector processing instruction is executed using the obtained first vector data to obtain the first vector data processing result. Figure 4 .
[0086] For example, the submitted first vector processing instruction may be decoded on the vector pipeline, and after decoding, the first vector data in the vector register group may be obtained to execute the first vector processing instruction. A suitable clock cycle for sending the first vector load memory access request may be selected so that the time for processing the first vector load memory access request is adapted to the time for processing on the second scalar pipeline, so that in S306, the first vector data is sent to the vector register group and the first vector processing instruction is decoded on the vector pipeline in the same clock cycle, and then S308 is implemented on the vector pipeline in the next clock cycle. For a specific implementation, please refer to Figure 5 and Figure 6 .
[0087] For example, after decoding the first vector processing instruction on the vector pipeline to obtain the corresponding first vector processing control information, the first vector processing control information can also be sent to the vector register group, and then the vector register group can be read on the vector pipeline in the next clock cycle to obtain the stored first vector data and the first vector processing control information, so that the first vector data can be processed according to the first vector processing control information on the vector pipeline in the next clock cycle, that is, the first vector processing instruction is executed. For specific implementations, please refer to Figure 6 .
[0088] In some embodiments, after executing the first vector processing instruction on the vector pipeline and obtaining the first vector data processing result, the first vector data processing result can be written back to the vector register group. Figure 6 .
[0089] According to the data processing method provided by the embodiment of the present disclosure, a first vector load memory access request corresponding to a first vector load instruction is sent on a first scalar pipeline, and when a second instruction packet is processed on a second scalar pipeline, the second scalar processing instruction is executed, and the first vector processing instruction is submitted, the sent first vector load memory access request is processed to register the first vector data, and then the first vector processing instruction is executed by using the first vector data registered on the vector pipeline that obtains the first vector processing instruction. Since the time period for processing on the second scalar pipeline can overlap with the time period of the process of processing the first vector load memory access request by one or more time periods, the transmission of instruction packets including subsequent vector load instructions after the first instruction packet to avoid instruction bubbles can be reduced. Therefore, compared with the related art in which the vector load instruction in the instruction packet is sent only when it arrives at the vector pipeline for decoding, the pipeline delay is used to hide the delay of accessing the on-chip cache during the processing of the vector load instruction, thereby reducing the resource occupation of the VRF used to register the loaded vector data and improving the overall performance of the processor.
[0090] Figure 4 FIG. 1 is a flow chart of another data processing method according to an exemplary embodiment. Figure 4 The method shown can be applied to an AI processor, for example, or to a common processor that processes vector data. Figure 4 and Figure 3 The connection is that Figure 4 Shows Figure 3 A temporal relationship between the various steps in a process.
[0091] refer to Figure 4 , the method 40 provided in the embodiment of the present disclosure may include the following S402 to S408.
[0092] In S402, in the first clock cycle 4012 on the first scalar pipeline 4002, a first instruction packet is decoded and processed to obtain and send a first vector load memory access request.
[0093] In some embodiments, the first clock cycle 4012 may be a single clock cycle, during which the decoding unit decodes the first instruction packet, obtains the first vector load memory access request, and simultaneously sends the first vector load memory access request for processing.
[0094] In some other embodiments, the first clock cycle may also include multiple single clock cycles, that is, the first vector load memory access request may be sent in the clock cycle after the clock cycle in which the first instruction packet is decoded. For specific implementations, see Figure 5 .
[0095] In S404 , the second instruction packet is processed on the second scalar pipeline 4004 in the second clock cycle 4014 , a second scalar processing instruction is obtained and executed, a first vector processing instruction is obtained, and the first vector processing instruction is submitted to the vector pipeline 4016 .
[0096] The second clock cycle 4014 may follow the first clock cycle 4012 , and the second clock cycle 4014 may include a plurality of single clock cycles.
[0097] In some embodiments, the second clock cycle 4014 may be a clock cycle in which the second instruction packet is transmitted to the second scalar pipeline 4004 and processed. The clock cycles occupied by the multiple steps of the second scalar pipeline 4004 are related to the execution time of the second scalar processing instruction, and may occupy the entire second clock cycle 4014, or may remain at least one clock cycle, and start the processing steps of the vector pipeline 4006 in the remaining clock cycle. The embodiment of the present disclosure is described by taking the remaining one clock cycle as an example, but is not limited thereto.
[0098] In S406 , in the second clock cycle 4014 , the first vector load memory access request is processed to obtain and store the first vector data.
[0099] Reference Figure 4 , Figure 4 The embodiment in which the process of S406 occupies the entire second clock cycle 4014 is shown, which corresponds to the situation where the first instruction packet is decoded on the first scalar pipeline, the first vector load memory access request is obtained, and the first vector load memory access request is sent in the same clock cycle.
[0100] In some other embodiments, the process of processing the first vector load memory access request, obtaining and storing the first vector data may occupy part of the second clock cycle 4014, which corresponds to the case where the first vector load memory access request is sent on the first scalar pipeline in one or more clock cycles after obtaining the first vector load memory access request. For specific implementations, refer to Figure 5 .
[0101] In S408 , on the vector pipeline 4006 , in the third clock cycle 4016 after the second clock cycle 4014 , the registered first vector data is obtained, the first vector processing instruction is executed, and the first vector data processing result is obtained.
[0102] The third clock cycle 4016 may also include multiple single clock cycles. After the first vector processing instruction is submitted to the vector pipeline 4006, it may be decoded on the vector pipeline 4006. In some embodiments, the decoding operation may be performed in the first clock cycle of the third clock cycle 4016. Then, in subsequent clock cycles in the third clock cycle 4016, the first vector data stored is obtained, the first vector processing instruction is executed, and the first vector data processing result is obtained.
[0103] In some other embodiments, the decoding operation may also be performed in the last clock cycle of the second clock cycle 4014. Then, in the third clock cycle 4016, the first vector data stored is obtained, the first vector processing instruction is executed, and the first vector data processing result is obtained. Figure 5 and Figure 6 .
[0104] According to the method provided by the embodiment of the present disclosure, by decoding the first instruction packet on the first scalar pipeline in the first clock cycle to obtain the first vector load memory access request and send it, it is possible to process the second instruction packet on the second scalar pipeline, execute the second scalar processing instruction, and submit the first vector processing instruction in the second clock cycle, process the sent first vector load memory access request to register the first vector data, and then obtain the first vector processing instruction on the vector pipeline in the third clock cycle, and execute the first vector processing instruction using the obtained registered first vector data, which can reduce the emission of instruction packets including subsequent vector load instructions after the first instruction packet to avoid instruction bubbles, thereby reducing the resource occupation of the VRF used to register the loaded vector data and improving the overall performance of the processor.
[0105] Figure 5 FIG. 1 is a flow chart of another data processing method according to an exemplary embodiment. Figure 5 The method shown can be applied to an AI processor, for example, or to a common processor that processes vector data. Figure 5and Figure 4 The difference is that Figure 5 The invention provides an implementation method of sending the first vector load memory access request on the first scalar pipeline one clock cycle after obtaining the first vector load memory access request, sending the first vector data to the vector register group and decoding the first vector processing instruction on the vector pipeline in the same clock cycle.
[0106] refer to Figure 5 , the method 50 provided in the embodiment of the present disclosure may include the following S502 to S5084.
[0107] In S502, in the first clock cycle 5012 on the first scalar pipeline 5002, a first instruction packet is decoded and processed to obtain and send a first vector load memory access request.
[0108] Reference Figure 5 , the first clock cycle 5012 may include two single clock cycles. In the first clock cycle of the first clock cycle 5012, the first instruction packet may be decoded to obtain a first vector load memory access request. In the second clock cycle of the first clock cycle 5012, the first vector load memory access request may be sent to process the first vector load memory access request in the second clock cycle 5014.
[0109] In S504 , in the second clock cycle 5014 , the second instruction packet is decoded on the second scalar pipeline 5004 , a second scalar processing instruction is obtained and executed, a first vector processing instruction is obtained, and the first vector processing instruction is submitted to the vector pipeline 5006 .
[0110] In some embodiments, in the first scalar pipeline 5002, an instruction fetch operation may be performed in the clock cycle before the first clock cycle 5012, and then in the first clock cycle 5012, after the first instruction packet is obtained in the instruction fetch step, the first instruction packet may be decoded to obtain a first vector load memory access request. At the same time, in the first clock cycle 5012, an instruction fetch operation may be performed in the second scalar pipeline 5004 to obtain a second instruction packet. The instruction fetch operation may take one or more clock cycles. Figure 5 and Figure 6 The situation of taking two clock cycles is shown in FIG. 1 , so the decoding operation on the second scalar pipeline is the second clock cycle after the decoding operation on the first scalar pipeline.
[0111] Reference Figure 5, the process of decoding, executing the second scalar instruction, and submitting the first vector processing instruction on the second scalar pipeline 5004 can be completed before the last clock cycle 50142 in the second clock cycle 5014, then the submitted first vector processing instruction can be decoded on the vector pipeline 5006 in the clock cycle 50142.
[0112] In S5062, in the second clock cycle 5014, the first vector load memory access request is processed to obtain the first vector data.
[0113] In S5064 , in the last clock cycle 50142 in the second clock cycle 5014 , the first vector data is sent to the vector register group.
[0114] Reference Figure 5 , the process of processing the first vector load memory access request and obtaining and storing the first vector data occupies the entire second clock cycle 5014.
[0115] In S5082, on the vector pipeline 5006, in the last clock cycle 50142 in the second clock cycle 5014, the first vector processing instruction is decoded, first vector processing control information corresponding to the first vector processing instruction is obtained, and the first vector processing control information is sent to the vector register group.
[0116] In some embodiments, the first vector processing control information may be a control signal generated by decoding the first vector processing instruction. The control signal may indicate how to operate on the first vector data, for example, may be an operation code corresponding to the first vector processing instruction.
[0117] In S5084, in the third clock cycle 5016 on the vector pipeline 5006, the first vector processing control information and the first vector data are read from the vector register group respectively, and the first vector data is processed according to the first vector processing control information to obtain the first vector data processing result, and the first vector data processing result is sent to the vector register group.
[0118] According to the method provided by the embodiment of the present disclosure, by decoding the first instruction packet on the first scalar pipeline in the first clock cycle to obtain the first vector load memory access request and send it, it is possible to process the second instruction packet on the second scalar pipeline, execute the second scalar processing instruction, and submit the first vector processing instruction in the second clock cycle, process the sent first vector load memory access request to register the first vector data, and then obtain the first vector processing instruction on the vector pipeline in the third clock cycle, and execute the first vector processing instruction using the obtained registered first vector data, which can reduce the emission of instruction packets including subsequent vector load instructions after the first instruction packet to avoid instruction bubbles, thereby reducing the resource occupation of the VRF used to register the loaded vector data and improving the overall performance of the processor.
[0119] Figure 6 FIG. 1 is a flowchart of another data processing method according to an exemplary embodiment. Figure 6 The method shown can be applied to an AI processor, for example, or to a common processor that processes vector data. Figure 6 and Figure 4 The connection is that Figure 6 Shows Figure 4 In the embodiment, loading vector data takes 6 clock cycles, and the decoding operation on the vector pipeline is performed in the last clock cycle of the second clock cycle.
[0120] refer to Figure 6 , the method 60 provided in the embodiment of the present disclosure may include the following S602 to S6010.
[0121] In S6022, in the first clock cycle of the first clock cycle 6012 on the first scalar pipeline 6002, the first instruction packet is decoded to obtain a first vector load memory access request and a first scalar processing instruction, and the first vector load memory access request is sent.
[0122] In S6024 , the first scalar processing instruction of the first stage is executed in the second clock cycle of the first clock cycle 6012 on the first scalar pipeline 6002 .
[0123] In S6026 , the first scalar processing instruction of the second stage is executed in the first clock cycle 60142 in the second clock cycle 6014 on the first scalar pipeline 6002 .
[0124] Reference Figure 6 , the execution of the first scalar processing instruction takes two clock cycles. The first instruction packet may also include vector instructions, which may be unrelated to the instructions in the second instruction packet, so the vector pipeline corresponding to the first scalar pipeline 6002 is not shown in the figure of the embodiment of the present disclosure.
[0125] In S6042, in the first clock cycle 60142 in the second clock cycle 6014 on the second scalar pipeline 6004, the second instruction packet is decoded to obtain a second vector load memory access request, a second scalar processing instruction and a first vector processing instruction, and the second vector load memory access request is sent to the vector loading unit 6006.
[0126] Reference Figure 6 The second instruction packet may further include a second vector load instruction, the second vector load instruction is used to instruct to load the second vector data, and a second vector load memory access request corresponding to the second vector load instruction may be sent in the clock cycle of step S6042 so that the vector load unit 6006 loads the second vector data, that is, the next vector load instruction of the first vector load instruction is expanded in the next instruction packet of the first instruction packet, Figure 7 An example diagram showing the expansion of a VLOAD instruction is shown.
[0127] In S6044 , the second scalar processing instruction of the first stage is executed on the second scalar pipeline 6004 in the second clock cycle 6014 .
[0128] In S6046 , the second stage second scalar processing instruction is executed on the second scalar pipeline 6004 in the second clock cycle 6014 .
[0129] In S6048 , on the second scalar pipeline 6004 , at the second clock cycle 6014 , the first vector processing instruction is submitted to the vector pipeline.
[0130] S6044, S6046 and S6048 are steps executed in sequence in three consecutive clock cycles.
[0131] In S6062 , in the second clock cycle 6014 , the vector loading unit 6006 processes the first vector load memory access request to obtain first vector data.
[0132] In S6064 , in the last clock cycle 60144 in the second clock cycle 6014 , the vector loading unit 6006 sends the first vector data to the vector register group.
[0133] In S6082, on the vector pipeline 6006, in the last clock cycle 60144 in the second clock cycle 6014, the first vector processing instruction is decoded, first vector processing control information corresponding to the first vector processing instruction is obtained, and the first vector processing control information is sent to the vector register group.
[0134] In S6084 , in the third clock cycle 6016 on the vector pipeline 6006 , the first vector processing control information and the first vector data are read from the vector register group respectively.
[0135] Reference Figure 6 , S6062 and S6064 occupy a total of 6 clock cycles, including the second clock cycle in the first clock cycle 6012 and the entire second clock cycle 6014. (Refer to Figure 5 In S504), the second scalar pipeline 6004 starts in the second clock cycle 6014, S6042 decodes the second instruction packet which takes one clock cycle, the execution of the second scalar processing instructions at S6044 and S6046 takes two clock cycles, S6048 submission takes one clock cycle, and the last clock cycle 60144 in the second clock cycle 6014 starts the vector instruction decoding step S6082 on the vector pipeline 6006, then the first vector data and its corresponding first vector processing control information can be read in the VRF at S6084.
[0136] In S6086 , in the third clock cycle 6016 , the first-stage first vector processing instruction is executed on the vector pipeline 6006 using the read first vector processing control information and the first vector data.
[0137] In S6088, the first vector processing instruction of the second stage is executed on the vector pipeline 6006 in the third clock cycle 6016, and the first vector data is processed according to the first vector processing control information to obtain the first vector data processing result.
[0138] In S60810 , in the third clock cycle 6016 on the vector pipeline 6006 , the first vector data processing result is written back to the vector register group.
[0139] S6084, S6086, S6088 and S60810 are steps executed in sequence in four consecutive clock cycles.
[0140] In S6010, in a clock cycle after a first clock cycle 60144 in the second clock cycle 6014, a second vector load memory access request is processed to obtain and store second vector data.
[0141] Reference Figure 6 The vector loading unit 6006 may load the second vector data in a clock cycle after the first clock cycle 60144 in the second clock cycle 6014 and in the first two clock cycles of the third clock cycle 6016 .
[0142] Figure 7 is based on Figure 6A schematic diagram of a VLOAD instruction loop expansion is shown in FIG. Figure 7 Instruction 0, instruction 1, and instruction 2 are three instruction packets that are continuously emitted, and each instruction packet is provided with at least a loading slot 702 and a computing slot 704.
[0143] For example, instruction 0 may correspond to the first instruction packet, instruction 1 may correspond to the second instruction packet, then VLOAD out.r0 corresponds to the first vector load instruction, VLOAD out.r1 corresponds to the second vector load instruction, and VINV out.r8,in r0 corresponds to the first vector processing instruction. Figure 6 , when VLOAD out.r1 is issued and starts processing, VINV out.r8,in r0 is submitted to the vector pipeline for execution. At this time, VLOAD out.r0 has been executed, and the VINV operation can be performed on the data of VRF r0, and the operation result can be written back to VRF r8. Then instruction 1 can issue instruction 2 in the next clock cycle, and VLOAD out.r0 can be issued and processed again. VINV out.r9,in r1 can use the loaded data of VRF r1 when it is executed.
[0144] According to the method provided by the embodiment of the present disclosure, a first instruction packet is decoded and processed on a first scalar pipeline in a first clock cycle to obtain a first vector load memory access request and send it, and a second instruction packet is processed on a second scalar pipeline in a second clock cycle after the first clock cycle, a second vector load memory access request is emitted, a second scalar processing instruction is executed, and the first vector processing instruction is submitted, and the sent first vector load memory access request is processed by a vector loading unit to register the first vector data, and then the first vector processing instruction is obtained on the vector pipeline in a third clock cycle, and the first vector processing instruction is executed using the obtained registered first vector data, so that the vector load instruction can be loop-unrolled only once, and it can be achieved that after the first instruction packet and the second instruction packet are continuously emitted, the processing of the second instruction packet utilizes the instruction execution result in the first instruction packet, thereby reducing the emission of instruction packets including subsequent vector load instructions after the first instruction packet to avoid instruction bubbles, thereby reducing the resource occupation of the VRF used to register the loaded vector data, and improving the overall performance of the processor.
[0145] Figure 8 Shows Figure 3 The processing process of S304 in one embodiment is shown in FIG. The processor executing the method implements the following process through the cooperation of its decoding unit, scalar instruction execution unit and instruction submission unit. Figure 8The second clock cycle 8014 may include a fourth clock cycle 80142 and a fifth clock cycle 80144, wherein the fourth clock cycle 80142 is the first at least one clock cycle in the second clock cycle 8014, and the fifth clock cycle 80144 is after the fourth clock cycle 80142.
[0146] like Figure 8 As shown, in the embodiment of the present disclosure, the above S304 may further include the following S802 to S806.
[0147] S802, on the second scalar pipeline 8004, the decoding unit decodes the second instruction packet in the fourth clock cycle 80142, obtains the second scalar processing instruction and the first vector processing instruction, and determines whether to submit the first vector processing instruction.
[0148] In some embodiments, the decoding unit may be a unit in a processor for decoding instructions, and the decoding process may be splitting and interpreting the instructions obtained (through the instruction fetching step) according to a preset instruction format. For the second instruction packet, the decoding unit may determine whether the first vector processing instruction therein is indeed a vector instruction, and if so, determine to submit, that is, determine to submit the first vector processing instruction to the vector pipeline; if not, determine not to submit the first vector processing instruction to the vector pipeline.
[0149] In some embodiments, the decoding processing process of the decoding unit can be completed in the first clock cycle of the fourth clock cycle 80142, and the process of determining whether to submit the first vector processing instruction can be completed in the clock cycle after the first clock cycle of the fourth clock cycle 80142, for example, it can be completed in the last clock cycle.
[0150] S804, on the second scalar pipeline 8004, the scalar instruction execution unit executes the second scalar processing instruction in the fourth clock cycle 80142.
[0151] In some embodiments, the scalar instruction execution unit may be a unit in the processor for processing the scalar instruction obtained after decoding. The clock cycle used by the scalar instruction execution unit to execute the second scalar processing instruction is related to the second scalar processing instruction. In the embodiment of the present disclosure, two clock cycles are used as an example for explanation, but the present invention is not limited thereto.
[0152] S806, on the second scalar pipeline 8004, when the decoding unit determines to submit the first vector processing instruction, the instruction submission unit submits the first vector processing instruction to the vector pipeline in the fifth clock cycle 80144.
[0153] In some embodiments, on the second scalar pipeline 8004, in the fifth clock cycle 80144, the second scalar processing instruction is executed, and the decoding unit has also determined to submit the first vector processing instruction, that is, the first vector processing instruction can be submitted to the vector pipeline. Then, the first vector processing instruction is processed on the vector pipeline in the remaining clock cycles of the fifth clock cycle 80144 and the third clock cycle 8016.
[0154] Reference Figure 1 In the related art, the decoding unit 102 first decodes the instruction packet and performs branch prediction on the instruction therein, that is, determines whether the instruction is a vector instruction or a scalar instruction. If it is determined to be a vector instruction, it is distributed to the vector pipeline 1044, and if it is determined to be a scalar instruction, it is distributed to the scalar pipeline 1042 for processing. If a branch prediction failure occurs, the state of the VRF needs to be restored, thereby increasing the design complexity of the vector processing unit that executes the vector instruction.
[0155] According to the method provided in the embodiment of the present disclosure, by placing the vector pipeline after the submission stage of the scalar pipeline, since the instructions submitted to the vector pipeline after the scalar pipeline judges the instructions in the instruction package are indeed vector instructions, that is, vector instructions that need to be executed on the vector pipeline, they will not be affected by branch prediction failures, thereby reducing the complexity of designing the vector processing unit, consuming less chip area, and effectively improving the competitiveness of the product.
[0156] Fig. 9 Shows Figure 3 The processing process of S306 in one embodiment is shown in FIG. Fig. 9 The process shown may be performed by a vector load unit (VLDU), which may be a unit in a processor for executing vector load instructions.
[0157] like Fig. 9 As shown, in the embodiment of the present disclosure, the above S306 may further include the following S902 to S906.
[0158] S902, determine whether to issue a first vector load memory access request or to issue a request to be reissued. The request to be reissued is a vector load memory access request corresponding to a vector load instruction that is determined to have a dependency relationship with a preceding instruction.
[0159] In some embodiments, there may be a dependency relationship between instructions. For example, before the first vector load instruction corresponding to the first vector load memory access request is issued, if a storage instruction (i.e., a pre-instruction, a pre-store instruction) is issued, and the storage instruction has the same memory access address as the first vector load instruction, if the first vector load instruction is executed when the storage instruction has not yet been executed, the first vector data obtained by loading is not the latest.
[0160] For example, it can be determined whether the first vector load memory access request needs to be reissued by determining whether there is a preceding storage instruction with the same memory access address as the first vector load instruction. For a specific implementation, see Fig.11 .
[0161] In some embodiments, the first vector load memory access request may be reissued after the preceding instruction is executed. For a specific implementation, see Fig.12 .
[0162] In some embodiments, the vector loading unit includes only one port for transmitting a request. The vector loading unit may include an arbitration scheduling unit, which may be used to determine whether to transmit a request currently transmitted from the decoding unit or to transmit a request to be retransmitted. The arbitration strategy may be determined according to system requirements, for example, the request currently transmitted from the decoding unit and the request to be retransmitted may be transmitted in turn.
[0163] S904: If it is determined to issue a first vector load memory access request, the first vector load memory access request is sent to the vector memory.
[0164] S906: If it is determined that a request to be retransmitted is to be transmitted, the request to be retransmitted is sent to the vector memory.
[0165] In some embodiments, the request retransmission logic can be implemented through the cooperation between the dependency detection unit, the entry allocation unit, the instruction queue, the retransmission judgment unit and the arbitration scheduling unit of the vector loading unit. For specific implementations, please refer to Fig.10 .
[0166] According to the method provided by the embodiment of the present disclosure, the vector load instruction is executed speculatively, that is, the issuance of the vector load memory access request corresponding to the vector load instruction and the dependency detection between the vector load instruction and other instructions are performed in parallel. If no dependency is detected, the vector data read back by executing the vector load instruction can be used normally; if a dependency is detected, the vector load instruction is reissued. On the basis of prepending the vector load instruction to the scalar pipeline execution, the time for the issuance of the vector load instruction can be further advanced through speculative issuance, thereby further reducing the issuance of instruction packets including subsequent vector load instructions after the first instruction packet to avoid instruction bubbles, thereby reducing the resource occupation of the VRF used to store the loaded vector data and improving the overall performance of the processor.
[0167] Fig.10 Shows Figure 3 FIG. 4 is a schematic diagram of the processing process of S306 in another embodiment. Fig.10 and Fig. 9 The association is that it shows that speculative emission is achieved through the cooperation of the dependency detection unit, entry allocation unit, instruction queue, arbitration scheduling unit and other sub-units in the vector load unit. In the embodiment of the present disclosure, the above S306 may further include the following S1002 to S1006.
[0168] S1002, the dependency detection unit 10002 determines whether there is a dependency relationship between the first vector load instruction and the preceding instruction according to the first vector load memory access request.
[0169] In some embodiments, the dependency detection unit may be used to detect a dependency relationship between an instruction corresponding to a request sent by the decoding unit to the vector loading unit and other instructions.
[0170] In some embodiments, the preceding instruction is an instruction issued before the first vector load instruction is issued, for example, it may be a preceding storage instruction. The first vector load instruction may include a first memory access address, and whether the first memory access address is the same as the memory access address of the preceding instruction can be used to determine whether the first vector load instruction has a dependency relationship with the preceding instruction. Fig.11 .
[0171] S1004 , the entry allocation unit 10004 allocates an entry in the instruction queue 10003 to the first vector load memory access request, and obtains first entry information corresponding to the first vector load memory access request.
[0172] In some embodiments, the entry allocation unit may be used to allocate entries in the instruction queue for requests transmitted from the decoding unit. The instruction queue may be used to cache requests corresponding to the instructions, and the number of entries in the instruction queue is the number of cacheable requests, which may be arbitrarily expanded according to the application scenario, for example, 8, 16, 32, etc. In the embodiment of the present disclosure, 8 entries are used as an example for description, but the present invention is not limited thereto.
[0173] The instruction queue can be maintained by two pointers: rear represents the tail pointer, and head represents the head pointer. The instruction queue can adopt a first-in-first-out strategy, that is, the instruction that enters the queue first will be out of the queue first after the read data comes back. New instructions are pushed in at the tail end, and read data is returned at the head end.
[0174] For example, the instruction queue 10003 in the vector load unit can be an address queue (Address Queue, AQ), which can be used to store the memory access address in the vector load memory access request, as well as some status information including retransmission status. The instruction queue may include multiple entries, and one entry stores the information of a request. Each entry may include multiple fields, and different fields are used to store different information. The first entry information may be the information of each field of the entry in the instruction queue allocated to the first vector load memory access request. For example, after the entry allocation unit 10004 allocates an entry in the instruction queue 10003 to the first vector load memory access request, the first memory access address in the first vector load memory access request may be written into the corresponding field in the allocated entry (refer to Fig.16 , which can be an address field segment), obtain the first entry information including the first memory access address.
[0175] S1006: If the dependency detection unit 10002 determines that there is a dependency relationship between the first vector load instruction and the predecessor instruction, resending indication information is written into the first entry information.
[0176] In some embodiments, the need-to-retransmit indication information may be information indicating that the need-to-retransmit field in the entry of the instruction queue is set to logic "1". For example, the dependency detection unit 10002 writes the need-to-retransmit indication information into the first entry information, and the retransmission determination unit 10006 may determine that the first vector load memory access request needs to be retransmitted based on the information.
[0177] In some other embodiments, if the dependency detection unit 10002 determines that there is no dependency relationship between the first vector load instruction and the preceding instruction, then no reissue indication information is written into the first entry information. For example, the no reissue indication information may be information indicating that the reissue field in the entry of the instruction queue is set to logic "0".
[0178] S1008: The retransmission determination unit 10006 determines the first vector load memory access request as the vector load memory access request to be sent based on the first entry information and the retransmission indication information as needed.
[0179] In some embodiments, the retransmission determination unit may be a unit that determines whether to retransmit the corresponding instruction based on information of a corresponding field in an entry of the instruction queue.
[0180] In some embodiments, the retransmission determination unit 10006 may determine the first vector load memory access request as the vector load memory access request to be sent when obtaining the retransmission requirement indication information in the first entry information.
[0181] In some other embodiments, when determining the vector load memory access request to be sent, the retransmission determination unit 10006 may also determine whether the request has been retransmitted, and if it has been retransmitted, it is no longer determined as the vector load memory access request to be sent. The retransmission determination unit may include a logic operation unit and a leading detection unit to implement the above process, and the specific implementation method may refer to 13.
[0182] S10010, the arbitration scheduling unit 10008 sends the vector load memory access request to be sent to the vector memory.
[0183] In some embodiments, when the arbitration scheduling unit 10008 determines that it is its turn to send a request to be retransmitted ( S906 ), it may send the vector load memory access request to be sent determined by S1008 to the vector memory.
[0184] In some embodiments, the vector loading unit may further include an index queue and a data queue. After the vector memory returns the read data, it may be sent to the vector register through the index queue and the data queue. For a specific implementation, please refer to Fig.15 .
[0185] According to the method provided in the embodiment of the present disclosure, through the collaboration of sub-units such as the dependency detection unit, entry allocation unit, instruction queue and arbitration scheduling unit in the vector loading unit, the issuance of the vector load memory access request corresponding to the vector loading instruction and the dependency detection between the vector loading instruction and other instructions are carried out in parallel, and the vector load memory access request is re-issued after the dependency is detected, which can effectively ensure the accuracy of the processed vector data.
[0186] Fig.11 Shows Figure 3 FIG. 4 is a schematic diagram of the processing process of S302 and S306 in yet another embodiment. Fig.11 and Fig.10The association is that the embodiment of determining the dependency relationship between instructions by using the memory access address is shown. In the embodiment of the present disclosure, the above S302 may further include the following S1102 to S1104, and S306 may further include the following S1106 to S11014.
[0187] S1102, the decoding unit 10001 decodes the first instruction packet on the first scalar pipeline to obtain a first memory access address in the first vector load instruction.
[0188] S1104 , the decoding unit 10001 generates a first vector load memory access request according to the first memory access address, where the first vector load memory access request includes the first memory access address.
[0189] S1106, the entry allocation unit 11004 allocates an entry in the instruction queue 11003 for the first vector load memory access request, stores the first memory access address into the instruction queue 11003 according to the allocated entry, and obtains first entry information, the first entry information including the first memory access address.
[0190] S11082, the dependency detection unit 11002 obtains the memory access address of the preceding storage instruction sent by the storage instruction processing unit.
[0191] In some embodiments, the storage instruction processing unit may be a unit in the processor for executing storage instructions (not in the vector load unit, Fig.11 (not shown in the figure). When processing a storage instruction, the storage instruction processing unit may send the corresponding memory access address to the dependency detection unit 11002.
[0192] S11084 , the dependency detection unit 11002 obtains the first memory access address in the instruction queue 11003 .
[0193] S11086, the dependency detection unit 11002 determines whether the first memory access address is the same as the memory access address of the previous storage instruction.
[0194] S11010: If the dependency detection unit 11002 determines that the first memory access address is the same as the memory access address of the previous storage instruction, resending indication information is written into the first entry information.
[0195] In some embodiments, the entry in the instruction queue may further include a field for recording the previous storage instruction with a dependency relationship, such as a dependency table field. After the dependency detection unit 11002 determines that the first memory access address is the same as the memory access address of the previous storage instruction, the information of the previous storage instruction may be written into the dependency table in the first entry information, and then the resending indication information may be written into the first entry information according to the dependency table. For a specific implementation, please refer to Fig.12 .
[0196] S11012: The retransmission determination unit 11006 determines the first vector load memory access request as the vector load memory access request to be sent based on the first entry information and the retransmission indication information as needed.
[0197] S11014, the arbitration scheduling unit 11008 sends the vector load memory access request to be sent to the vector memory.
[0198] According to the method provided in the embodiment of the present disclosure, by comparing the first memory access address in the first vector load memory access request with the memory access address in the preceding storage instruction, it is determined whether the first vector load instruction and the preceding storage instruction have a dependency relationship, and the first vector load memory access request can be re-issued after the dependency is detected, thereby effectively ensuring the accuracy of the processed first vector data.
[0199] Fig.12 Shows Fig.11 The processing process of S11010 in one embodiment is shown in FIG. In the embodiment of the present disclosure, the above S11010 may further include the following S1202 to S1206.
[0200] S1202 , if the dependency detection unit 12002 determines that the first memory access address is the same as the memory access address of the preceding storage instruction, then the information of the preceding storage instruction is written into the dependency table in the first entry information in the instruction queue 12004 .
[0201] In some embodiments, the information of the preceding storage instruction may be an identifier of the preceding storage instruction.
[0202] S1204, the dependency detection unit 12002 obtains the execution completion information of the preceding storage instruction from the storage instruction processing unit 12001.
[0203] In some embodiments, after the storage instruction processing unit 12001 completes processing of the preceding storage instruction, it sends the corresponding execution completion information to the dependency detection unit 12002.
[0204] In other embodiments, after the storage instruction processing unit 12001 completes processing of the preceding storage instruction, it can cache the execution completion information by itself. When the dependency detection unit 12002 determines that the first memory access address is the same as the memory access address of the preceding storage instruction, it can periodically query the storage instruction processing unit 12001 according to the information of the preceding storage instruction until the corresponding execution completion information is obtained.
[0205] S1206, the dependency detection unit 12002 deletes the information of the preceding storage instruction in the dependency table in the first entry information in the instruction queue 12004 according to the execution completion information of the preceding storage instruction.
[0206] S1208 , the dependency detection unit 12002 writes the resending indication information into the first entry information according to the dependency table in the first entry information in the instruction queue 12004 .
[0207] In some embodiments, for a vector load instruction, there may be multiple preceding storage instructions with the same memory access address, that is, there are dependencies with multiple preceding storage instructions. In this case, it is necessary to wait for all the preceding storage instructions with dependencies to be executed, and then write the need to resend indication information into the first entry information. When it is determined that the first memory access address has a dependency relationship with the preceding storage instruction, it can be determined that there is no preceding storage instruction in the dependency table, and then write the need to resend indication information into the first entry information.
[0208] According to the method provided by the embodiment of the present disclosure, by designing a dependency table field segment in the entry of the instruction queue, after the dependency detection unit determines that the first memory access address is the same as the memory access address of the preceding storage instruction, the information of the preceding storage instruction is written into the dependency table in the first entry information, and after obtaining the execution completion information of the preceding storage instruction, the information of the preceding storage instruction in the dependency table is deleted, and then the indication information that needs to be resent is written into the first entry information, thereby improving the accuracy of determining the request to be resent, and effectively ensuring the accuracy of the processed first vector data.
[0209] Fig.13 Shows Fig.10 The processing process of S1008 in one embodiment is shown in FIG. In the embodiment of the present disclosure, the above S1008 may further include the following S1302 to S1306.
[0210] S1302, obtaining request to send return information from the arbitration scheduling unit 13008.
[0211] In some embodiments, after sending a retransmission request, the arbitration scheduling unit may return a request transmission return information, where the request transmission return information is used to indicate that the corresponding retransmitted vector load memory access request has been sent.
[0212] S1304, according to the request sending return information, determine whether the first vector load memory access request has been resent, obtain whether it has been resent information, and write the whether it has been resent information into the first entry information.
[0213] In some embodiments, the entry of the instruction queue may include a field whether it has been resent, which may be set to a default value of logic "0". For example, after resending the first vector load access request (such as after sending it through S10010 or S11014), the arbitration scheduling unit 13008 may obtain "whether it has been resent information", which is used to indicate whether the field in the first entry information of the instruction queue 13002 has been resent is set to logic "1".
[0214] S1306, the logic operation unit 13004 performs a logic operation on the retransmission indication information and the retransmission information to obtain a logic operation result.
[0215] In some embodiments, the logic operation unit 13004 may perform a logic operation on the value of the need-to-retransmit field and the whether-has-been-retransmitted field in the first entry information of the instruction queue 13002. For example, if the value of the need-to-retransmit field is logic "1" and the whether-has-been-retransmitted field is logic "0", the result of the logic operation is logic "1" (i.e., true), otherwise the result of the logic operation is logic "0" (i.e., false) in all other cases.
[0216] S1308: The leading detection unit 13006 determines the first vector load memory access request as the vector load memory access request to be sent according to the logic operation result.
[0217] In some embodiments, the preamble detection unit 13006 may determine the first vector load memory access request as the vector load memory access request to be sent when the logic operation result is logic “1”.
[0218] In some embodiments, after the leading detection unit 13006 determines multiple vector load memory access requests to be sent, the vector load memory access requests to be sent can be selected by a multi-way selection unit (for example, a multi-way selector) and sent to the arbitration scheduling unit for transmission. For specific implementations, refer to Fig.16 .
[0219] Fig.14 is based on Fig.13 FIG. 1 is a schematic diagram showing entry information of a command queue during a retransmission process. Fig.14 The instruction queue 1402 shown includes 8 entries from entry 0 to entry 7, the head 14042 pointer points to entry 1, the tail 14044 pointer points to entry 5, and the valid entries in the current instruction queue 1402 are entries 1 to 5.
[0220] After detection, the instructions of entries 3 / 4 / 5 need to be resent, so the value of the 14062 field of entries 3 / 4 / 5 needs to be resent is "1", and the value of the 1462 field of entries 1 / 2 needs to be resent is "0". Fig.14 At the moment of the middle figure, entry (1 / 2 / )4 / 5 has not been resent, and entry 3 has been resent. The value of the field 14064 of entry (1 / 2 / )4 / 5 whether it has been resent is "0", and the value of the field 14064 of entry 3 whether it has been resent is "1". Then, after selecting the instruction of entry 4 for resent, Fig.14 At the moment in the middle and lower figure, the value of whether the 14064 field in entry 4 has been resent is changed to "1".
[0221] According to the method provided by the embodiment of the present disclosure, by obtaining request sending return information from the arbitration scheduling unit, it is determined whether the first vector load memory access request has been retransmitted, whether the retransmission information has been obtained, and whether the retransmission information has been written into the first entry information, and then the vector load memory access request to be sent is determined according to the retransmission indication information and the whether retransmission information in the first entry information. Therefore, when the vector load memory access request needs to be retransmitted but has not been retransmitted, it can be determined as the vector load memory access request to be sent. While ensuring the accuracy of determining the request to be retransmitted, multiple retransmissions can be avoided, thereby effectively improving the efficiency of the processor.
[0222] Fig.15 Shows Fig.10 The S10010 and Figure 3 The processing process of S306 in one embodiment is shown in FIG. In the embodiment of the present disclosure, the above S10010 may further include the following S1502, and S306 may further include the following S1504 to S1506.
[0223] S1502 , the arbitration scheduling unit 15004 sends the vector load memory access request to be sent to the vector memory 15002 , and writes the number of the entry in the instruction queue corresponding to the vector load memory access request to be sent into the index queue 15006 .
[0224] In some embodiments, the vector loading unit may further include an index queue. The index queue may be used to cache index information, and the index information may be, for example, the number of an entry in the instruction queue.
[0225] S1504, the vector memory 15002 returns the first vector data according to the first vector load memory access request.
[0226] S1506 , the data writing unit 15008 writes the first vector data into the data queue 15010 according to the number in the index queue 15006 .
[0227] In some embodiments, the vector loading unit may further include a data writing unit, which may be used to write data read from the vector memory into a data queue. The data queue may be used to cache data to be sent to the vector register group.
[0228] S1508, the data queue 15010 sends the first vector data to be stored.
[0229] In some embodiments, after the header data in the data queue 15010 is prepared, the header data can be selected by a multi-way selection unit (for example, a multi-way selector) and sent to the vector register group. For specific implementations, refer to Fig.16 .
[0230] According to the method provided by the embodiment of the present disclosure, the arbitration scheduling unit may write the number of the entry in the corresponding instruction queue into the index queue when sending the first vector load memory access request, and then after the vector memory returns the first vector data according to the first vector load memory access request, write the first vector data into the corresponding entry in the data queue according to the number in the index queue, send the first vector data to the vector register group through the data queue, and use the index queue to align the instruction queue with the data queue, thereby improving the accuracy of vector data loading.
[0231] Fig.16 is based on Figures 9 to 15 A schematic diagram of the overall architecture of a vector loading unit is shown. Fig.16 1 shows a vector loading unit 1602 and a decoding unit 1601, a vector memory 1604 and a vector register group 1606 interacting therewith. Fig.16 As shown, the decoding unit 1601 generates a load request (load req), i.e., a read request signal of the vector load access request as described above, and sends it to the entry allocation unit (allocater) 16024. The entry allocation unit 16024 allocates entries of the address queue 16026, and its allocation strategy is that if the address queue 16026 is not full, the entry at the tail of the address queue 16026 is allocated to the newly pushed instruction.
[0232] The address queue 16026 is used to store the memory access address of the vector load memory access request and some status information. The address queue 16026 can be maintained by two pointers: the tail pointer 160264 and the head pointer 160262. The address queue 16026 adopts a first-in-first-out strategy, that is, the instruction that enters the queue first will be out of the queue first after the read data comes back; the new instruction is pushed in at the tail end, and the read data is returned at the head end. Here, the depth of the address queue 16026 is set to 8. In some embodiments, the depth of the address queue can be arbitrarily expanded according to the application scenario.
[0233] The decode unit 1601 generates a load request, which can be sent to the hazard detection unit 16022. The hazard detection unit 16022 can be used for inter-instruction dependency checking. For example, if the access address of a store instruction issued before the load instruction corresponding to the current load request is the same as the access address in the current load request, but the store instruction has not been executed, it is necessary to wait for the store instruction to be executed before issuing the current load request. This dependency management logic can be performed based on the status information of the entries in the address queue 16026.
[0234] Each entry in the address queue 16026 may contain the following multiple fields.
[0235] The memory access address (addr) 1602661 indicates the memory access address of the current load instruction.
[0236] The dependency table (dep_tab) 1602662 is used to record the information of the predecessor instructions that have a dependency relationship with the current load instruction. If the current load instruction and the predecessor storage instruction have a dependency relationship, the dependency relationship can be recorded in the dependency table 1602661, and after the corresponding dependent storage instruction is executed, the dependency table 1602661 is updated. Until there are no dependent instructions in the dependency table 1602661, that is, all the predecessor instructions that have a dependency relationship with the current load instruction are executed, the current load instruction can be re-issued, and the value of the need to re-issue 1602663 can be set to "1".
[0237] Need to resend (need_resend) 1602663. If the value of this field segment is "1", it means that after the dependency detection unit 16022 determines, the current load instruction needs to be reissued, that is, the current load instruction has a dependency relationship with the predecessor instruction (that is, the above-mentioned predecessor instruction), and the dependency table 1602662 of the entry is empty at the current moment; if the value of this field segment is "0", it means that after the dependency detection unit 16022 determines, the current load instruction does not need to be reissued, that is, the current load instruction has no dependency relationship with the predecessor instruction, or, after the dependency detection unit 16022 determines, the current load instruction needs to be reissued, but the dependency table 1602662 of the entry is not empty at the current moment.
[0238] Resend_go_off 1602664: If the value of this field is "1", it means that the current load instruction has been reissued; if the value of this field is "0", it means that the current load instruction has not been reissued. This information can be obtained from the arbitration scheduling unit 160216.
[0239] The first return data (get_1st) 160265 has been obtained. If the value of this field segment is "1", it means that the data read from the vector memory 1604 in response to the first issuance of the current load instruction has been returned to the corresponding data queue 160222; if the value of this field segment is "0", it means that the data read from the vector memory 1604 in response to the first issuance of the current load instruction has not yet been returned to the corresponding data queue 160222.
[0240] The second return data (get_2 nd)160266, if the value of this field is "1", it means that the data read from the vector memory 1604 in response to the re-issuance of the current load instruction has been returned to the corresponding data queue 160222; if the value of this field is "0", it means that the data read from the vector memory 1604 in response to the re-issuance of the current load instruction has not been returned to the corresponding data queue 160222. Only the load instruction that needs to be re-issued needs to query this field.
[0241] Based on the need to resend 1602663 field segment and the resent 1602664 field segment of the entries in the address queue 16026, the logic operation unit 16028, the mask 160210 and the leading detection unit 160210 implement the resend logic. For example, the logic operation unit 16028 completes the logic operation for each entry from entry 0 to entry 7: need_resend&&(!resend_go_off). If the result of the logic operation is "1", it means that the current entry needs to be resent and has not been resent yet. The result of the logic operation is masked by mask 160210, and the entries other than the head pointer 160262 and the tail pointer 160264 are shielded, that is, only the information of the existing valid entries in the address queue 16026 is retained. Then, the leading one detection unit (also called leading one detection unit (leading one detect, lod)) 160210 performs a leading one detection, and obtains the instruction corresponding to the entry with a logical operation result of "1" in the valid entries as the instruction to be reissued (that is, it is determined to be the vector load memory access request to be sent). The schematic diagram of the entry information of the instruction queue during the reissue process can be referred to Fig.14 .
[0242] According to the result of the leading detection unit 160210, 8 entries of memory access addresses (in the form of vector load memory access requests) can be selected for transmission, and a multiplexer unit (for example, a multiplexer (mux)) 160214 can be used to select the memory access addresses.
[0243] In the case where the VLDU has only one request port, arbitration scheduling can be performed through an arbitration scheduling unit (for example, an arbitrator (arbter, arb)) 160216 to select whether to transmit a speculative request directly sent by the decoding unit 1601 or a retransmission request in the address queue 16026. The arbitration strategy can be determined according to system requirements. The arbitration scheduling unit 160216 outputs the final request to the vector memory (Vector Memory, VMEM) 1604, and records the entry number in the address queue 16026 where the request is located in the index queue (index queue, idxq) 160218. When the vector memory 1604 reads data and returns, the write unit 160220 stores the read data in the corresponding entry of the data queue 160222 according to the entry number at the head of the index queue 160218. When the read data of the head entry in the data queue 160222 is ready, the read data at the head can be selected by a multi-way selection unit 160224 and then sent to the VRF 1606.
[0244] Fig.17 is based on Figures 3 to 16 A schematic diagram of a pipeline architecture is shown. Fig.17 Two types of pipelines are shown: a scalar pipeline 17002 and a vector pipeline 17004. The first scalar pipeline, the second scalar pipeline, etc. in the embodiment of the present disclosure can all adopt the architecture of the scalar pipeline 17002, and the first vector pipeline, the second vector pipeline, etc. can all adopt the architecture of the vector pipeline 17004. The meaning of each step in the two types of pipelines is described as follows.
[0245] S1702, instruction fetch (IF), fetch an instruction packet from the instruction cache according to the instruction address, for example, the first instruction packet, the second instruction packet, etc. If the instruction packet cannot be fetched in one clock cycle, S1702 may be the first stage instruction fetch.
[0246] S1704, second stage instruction fetch.
[0247] S1706, instruction decoder (DEC), decodes the instruction in the instruction packet and generates a control signal corresponding to the instruction. For example, a first vector load memory access request corresponding to the first vector load instruction is generated on the first scalar pipeline. In the clock cycle of decoding the first instruction packet on the first scalar pipeline, the generated first vector load memory access request can be sent to the vector load unit 17006 for processing.
[0248] S1708, scalar instruction execution (Execute, EX), executing the decoded scalar instruction, for example, the first scalar processing instruction, the second scalar processing instruction, etc. If the scalar instruction cannot be executed in one clock cycle, S1708 may be executed in the first stage.
[0249] S17010, second stage scalar instruction execution.
[0250] S17012, vector instruction commit (Commet, CMT), the commit of the instruction indicates that this instruction will be executed on the vector pipeline 17004. The specific implementation method for determining whether to commit the vector instruction can be referred to Figure 8 .
[0251] S17014, vector instruction decoding (Vector Decoder, VDEC). The vector instruction flows in the scalar pipeline along with the overall instruction packet. After being submitted in S17012, it enters the vector pipeline and is decoded to obtain the operation code.
[0252] S17016, Vector Register File Read (VRFR), reads operands from vector registers according to instruction decoding results.
[0253] S17018, Vector Execute (VEX), executes a vector instruction, for example, a first vector processing instruction, etc. If the execution cannot be completed in one clock cycle, S17018 may be executed in the first stage.
[0254] S17020, second stage vector instruction execution.
[0255] S17022, vector result is written back to the register group (Vector Write Back, VWB). At this time, the vector calculation has been completed and the calculation result is written back to the vector register group.
[0256] According to the method provided by the embodiment of the present disclosure, at the decoding stage of the first scalar pipeline, the decoding operation of the first vector load instruction is started, the memory access address of the first vector load instruction is obtained, and a first vector load memory access request is formed and transmitted to the vector transmitting unit. The vector transmitting unit then transmits the first vector load request to the vector memory. After the vector memory obtains the read data, the read data is returned to the vector transmitting unit. Finally, the vector transmitting unit returns the data to the vector register group.
[0257] Reference Fig.17, the vector load instruction is sent to the vector load unit 17006 to read the data back to the vector register group, and there are a total of 6 pipeline stages in the middle (the specific number of pipeline stages is related to the vector memory 17008), that is, Fig.17 A1~A6 in .
[0258] According to the method provided in the embodiment of the present disclosure, the vector load instruction is pre-placed in the scalar pipeline, the delay of accessing the on-chip cache is hidden in the pipeline, and can be executed speculatively, which can significantly reduce the number of system loop unrolling times, improve the utilization rate of the vector register group, and improve the overall performance of the processor.
[0259] Fig.18 FIG. 1 is a block diagram of a processor according to an exemplary embodiment. Fig.18 The processor shown may be, for example, an AI processor, or may be a common processor for processing vector data.
[0260] refer to Fig.18 The processor 180 provided in the embodiment of the present disclosure may include a decoding unit 1802, a scalar instruction execution unit 1804, an instruction submission unit 1806, a vector loading unit 1808, a vector reading unit 18010 and a vector instruction execution unit 18012.
[0261] The decoding unit 1802 can be used to process the first instruction packet on the first scalar pipeline, obtain and send a first vector load memory access request corresponding to the first vector load instruction, the first instruction packet includes the first vector load instruction, and the first vector load instruction is used to instruct loading of the first vector data.
[0262] The decoding unit 1802 can also be used to process the second instruction packet on the second scalar pipeline to obtain the second scalar processing instruction and the first vector processing instruction, the second instruction packet includes the second scalar processing instruction and the first vector processing instruction, and the first vector processing instruction is used to instruct the processing of the first vector data.
[0263] The scalar instruction execution unit 1804 is coupled to the decoding unit 1802 and can be used to execute a second scalar processing instruction on a second scalar pipeline.
[0264] The instruction issuing unit 1806 is coupled to the decoding unit 1802 and the scalar instruction executing unit 1804 , and may be configured to issue the first vector processing instruction to the vector pipeline.
[0265] The vector loading unit 1808 is coupled to the decoding unit 1802 and can be used to process the first vector load memory access request to obtain and store the first vector data.
[0266] The vector reading unit 18010 may be used to obtain the stored first vector data on the vector pipeline.
[0267] The vector instruction execution unit 18012 is coupled to the vector reading unit 18010 and can be used to execute a first vector processing instruction to obtain a first vector data processing result.
[0268] Fig.19 FIG. 1 is a block diagram of another processor according to an exemplary embodiment. Fig.19 The processor shown may be, for example, an AI processor, or may be a common processor for processing vector data.
[0269] refer to Fig.19 The processor 190 provided in the embodiment of the present disclosure may include a decoding unit 1902, a scalar instruction execution unit 1904, an instruction submission unit 1906, a vector register group 1907, a vector loading unit 1908, a vector decoding unit 1909, a vector reading unit 19010, a vector instruction execution unit 19012 and a vector write back unit 19014. The vector loading unit 1908 may include a dependency detection unit 19082, an entry allocation unit 19084, an instruction queue 19086, a logic operation unit 19088, a leading detection unit 190810, an arbitration scheduling unit 190812, an index queue 190814 and a data queue 190816.
[0270] The decoding unit 1902 can read the circuit ( Fig.19 Not shown) and instruction memory ( Fig.19 The instruction memory may be connected to the processor 190 (not shown), and the instruction memory may be integrated into the same chip as the processor 190. The read circuit may fetch the first instruction packet, the second instruction packet, etc. from the instruction memory to the decoding unit 1902.
[0271] The decoding unit 1902 can be used to process the first instruction packet on the first scalar pipeline, obtain and send a first vector load memory access request corresponding to the first vector load instruction, the first instruction packet includes the first vector load instruction, and the first vector load instruction is used to instruct loading of the first vector data.
[0272] The first vector load instruction may include a first memory access address.
[0273] The decoding unit 1902 can also be used to process the second instruction packet on the second scalar pipeline to obtain the second scalar processing instruction and the first vector processing instruction, the second instruction packet includes the second scalar processing instruction and the first vector processing instruction, and the first vector processing instruction is used to instruct the processing of the first vector data.
[0274] The second instruction packet may further include a second vector load instruction, where the second vector load instruction is used to instruct loading of second vector data.
[0275] The decoding unit 1902 may also be configured to decode the first instruction packet in the first clock cycle on the first scalar pipeline, and obtain and send a first vector load memory access request.
[0276] The decoding unit 1902 can also be used to process the second instruction packet on the second scalar pipeline in a second clock cycle to obtain a second scalar processing instruction and a first vector processing instruction. The second clock cycle is after the first clock cycle, and the second clock cycle includes multiple single clock cycles.
[0277] The second clock cycle may include a fourth clock cycle and a fifth clock cycle, the fourth clock cycle being at least one first clock cycle of the second clock cycle, and the fifth clock cycle being after the fourth clock cycle.
[0278] The decoding unit 1902 may also be coupled to the vector loading unit 1908 , and may also be used to decode the first instruction packet on the first scalar pipeline, obtain a first vector loading memory access request, and send the first vector loading memory access request to the vector loading unit 1908 .
[0279] The decoding unit 1902 can also be used to decode the first instruction packet on the first scalar pipeline to obtain the first memory access address in the first vector load instruction; generate a first vector load memory access request according to the first memory access address, and the first vector load memory access request includes the first memory access address.
[0280] The decoding unit 1902 may also be configured to decode the second instruction packet on the second scalar pipeline in the fourth clock cycle to obtain the second scalar processing instruction and the first vector processing instruction, and determine whether to submit the first vector processing instruction.
[0281] The decoding unit 1902 may also be configured to process the second instruction packet on the second scalar pipeline, and obtain and send a second vector load memory access request corresponding to the second vector load instruction.
[0282] The scalar instruction execution unit 1904 is coupled to the decoding unit 1902, and can obtain the second scalar processing instruction decoded by the decoding unit 1902, which can be used to execute the second scalar processing instruction on the second scalar pipeline. The scalar instruction execution unit 1904 may include an arithmetic logic unit ( Fig.19 Not shown), multiplication and accumulation unit ( Fig.19 ) and the like) are used to implement circuit units for scalar calculations, but are not limited thereto.
[0283] The scalar instruction execution unit 1904 may also be configured to execute a second scalar processing instruction on a second scalar pipeline in a second clock cycle.
[0284] The scalar instruction execution unit 1904 may also be configured to execute a second scalar processing instruction on the second scalar pipeline in a fourth clock cycle.
[0285] The instruction issuing unit 1906 may be coupled to the scalar instruction executing unit 1904 and may be configured to issue the first vector processing instruction to the vector pipeline.
[0286] The instruction submit unit 1906 may also be configured to submit the first vector processing instruction to the vector pipeline in a second clock cycle on the second scalar pipeline.
[0287] The instruction submission unit 1906 can also be coupled to the decoding unit 1902 and the vector decoding unit 1909, and can also be used on the second scalar pipeline to submit the first vector processing instruction to the vector pipeline in the fifth clock cycle when the decoding unit 1902 determines to submit the first vector processing instruction.
[0288] The vector register group 1907 is shared by the first scalar pipeline, the second scalar pipeline, and the vector pipeline. The vector register group 1907 can be accessed through the read / write interface ( Fig.19 Not shown), using the input queue ( Fig.19 (not shown) buffers the received vector data and then stores it in a register of the corresponding type in the vector register group 1907.
[0289] The vector loading unit 1908 may be configured to process a first vector load memory access request, and obtain and store first vector data.
[0290] The vector loading unit 1908 may also be configured to process the first vector load memory access request in the second clock cycle, and obtain and store the first vector data.
[0291] The vector loading unit 1908 may be coupled to the vector register set 1907 , and may be further configured to send the first vector data to the vector register set 1907 in a last clock cycle of the second clock cycle.
[0292] The vector loading unit 1908 may be coupled to the vector memory ( Fig.19 ), and can also be used to send a first vector load memory access request to the vector memory, and after the vector memory returns the first vector data according to the first vector load memory access request, send the first vector data to store it.
[0293] The vector loading unit 1908 can also be used to determine whether to issue a first vector load memory access request or a request to be resent, where the request to be resent is a vector load memory access request corresponding to a vector load instruction that is determined to have a dependency relationship with a preceding instruction; if it is determined to issue a first vector load memory access request, the first vector load memory access request is sent to the vector memory.
[0294] The dependency detection unit 19082 may be coupled to the decoding unit 1902 , and may be configured to determine whether a dependency relationship exists between the first vector load instruction and the preceding instruction according to the first vector load memory access request sent by the decoding unit 1902 .
[0295] The dependency detection unit 19082 may be coupled to the instruction queue 19086 , and may be further configured to write reissue indication information into the first entry information in the instruction queue 19086 if it is determined that the first vector load instruction has a dependency relationship with a preceding instruction.
[0296] The first entry information may include a dependency table.
[0297] The dependency detection unit 19082 may also be coupled to the storage instruction processing unit ( Fig.19 (not shown) and can also be used to obtain the memory access address of the preceding storage instruction sent by the storage instruction processing unit.
[0298] The dependency detection unit 19082 may also be used to obtain the first memory access address in the instruction queue 19086 .
[0299] The dependency detection unit 19082 may also be used to determine whether the first memory access address is the same as the memory access address of the previous storage instruction; if it is determined that the first memory access address is the same as the memory access address of the previous storage instruction, then the resending indication information is written into the first entry information.
[0300] The dependency detection unit 19082 can also be used for: if it is determined that the first memory access address is the same as the memory access address of the preceding storage instruction, then the information of the preceding storage instruction is written into the dependency table; the execution completion information of the preceding storage instruction is obtained from the storage instruction processing unit; based on the execution completion information of the preceding storage instruction, the information of the preceding storage instruction in the dependency table is deleted; and based on the dependency table, the indication information that needs to be resent is written into the first entry information.
[0301] The entry allocation unit 19084 may be coupled to the decoding unit 1902 and the instruction queue 19086 and may be used to allocate an entry in the instruction queue 19086 for the first vector load memory access request sent by the decoding unit 1902 to obtain first entry information corresponding to the first vector load memory access request.
[0302] The entry allocation unit 19084 may also be used to allocate an entry in the instruction queue for the first vector load memory access request, store the first memory access address into the instruction queue 19086 according to the allocated entry, and obtain first entry information, which includes the first memory access address.
[0303] The logic operation unit 19088 can be coupled to the instruction queue 19086, and can be used to perform logic operations on the resending indication information and the resending information of each entry in the instruction queue 19086 to obtain a logic operation result.
[0304] The leading detection unit 190810 may be coupled to the logic operation unit 19088, and may be configured to determine the first vector load memory access request as the vector load memory access request to be sent according to a logic operation result.
[0305] The leading detection unit 190810 can be coupled to a multiplexer ( Fig.19 (not shown), the determined vector load memory access request to be sent is sent to the multiplexer, and the multiplexer can also be coupled to the instruction queue 19086 and the arbitration scheduling unit 190812, and the address selected in the instruction queue 19086 is sent to the arbitration scheduling unit 190812.
[0306] The arbitration scheduling unit 190812 may be coupled to the vector memory, and may be configured to send a to-be-sent vector load access request to the vector memory.
[0307] The arbitration scheduling unit 190812 can also be coupled to the index queue 190814, and can be used to send the vector load memory access request to be sent to the vector memory, and write the number of the entry in the instruction queue 19086 corresponding to the vector load memory access request to be sent into the index queue 190814.
[0308] The vector loading unit 1908 may also be configured to resend the indication information as needed based on the first entry information, and determine the first vector load memory access request as the vector load memory access request to be sent.
[0309] The vector loading unit 1908 can also be used to: obtain request sending return information from the arbitration scheduling unit; determine whether the first vector load memory access request has been resent according to the request sending return information, obtain whether it has been resent information, and write the whether it has been resent information into the first entry information.
[0310] The vector loading unit 1908 may also be used to write the first vector data into the data queue 190816 according to the number in the index queue 190814 after the vector memory returns the first vector data according to the first vector load access request. The vector loading unit 1908 may use the write unit ( Fig.19 (not shown) writes the first vector data returned by the vector memory into the data queue 190816 according to the number in the index queue 190814, and the writing unit is coupled to the vector memory, the index queue 190814 and the data queue 190816.
[0311] The data queue 190816 may be coupled to the vector register group 1907 and may be used to send the first vector data to be stored.
[0312] The vector decoding unit 1909 can be coupled to the vector register group 1907, and can be used to decode the first vector processing instruction in the last clock cycle of the second clock cycle on the vector pipeline, obtain the first vector processing control information corresponding to the first vector processing instruction, and send the first vector processing control information to the vector register group 1907.
[0313] The vector reading unit 19010 may be used to obtain the stored first vector data on the vector pipeline.
[0314] The vector read unit 19010 may also be used to obtain the registered first vector data in a third clock cycle after the second clock cycle on the vector pipeline.
[0315] The vector reading unit 19010 may be coupled to the vector register group 1907 , and may be further configured to read the first vector processing control information and the first vector data from the vector register group 1907 in a third clock cycle on the vector pipeline.
[0316] The vector instruction execution unit 19012 may be coupled to the vector reading unit 19010 and may be used to execute the first vector processing instruction to obtain the first vector data processing result. The vector instruction execution unit 19012 may include an arithmetic logic unit ( Fig.19 Not shown), multiplication and accumulation unit ( Fig.19 ) and the like) are used to implement circuit units for vector calculations, but are not limited thereto.
[0317] The vector instruction execution unit 19012 may also be configured to execute a first vector processing instruction on the vector pipeline in a third clock cycle to obtain a first vector data processing result.
[0318] The vector instruction execution unit 19012 may also be configured to process the first vector data according to the first vector processing control information in the third clock cycle on the vector pipeline to obtain a first vector data processing result.
[0319] The vector write-back unit 19014 may be coupled to the vector instruction execution unit 19012 and the vector register group 1907 , and may be configured to send the first vector data processing result to the vector register group in the third clock cycle on the vector pipeline.
[0320] The specific implementation of each module in the device provided by the embodiment of the present disclosure can refer to the content of the above method, which will not be repeated here.
[0321] Fig. 20The following is a schematic diagram showing the structure of an electronic device in an embodiment of the present disclosure. It should be noted that: Fig. 20 The device shown is only an example of a computer system, which should not bring any limitation to the functions and scope of use of the embodiments of the present disclosure.
[0322] like Fig. 20 As shown, the device 2000 includes a central processing unit (CPU) 2001, which can be, for example, an AI processor, which can perform various appropriate actions and processes according to a program stored in a read-only memory (ROM) 2002 or a program loaded from a storage part 2008 into a random access memory (RAM) 2003, and can be used to execute the data processing method provided in the embodiment of the present disclosure. In RAM 2003, various programs and data required for the operation of the device 2000 are also stored. CPU 2001, ROM 2002, and RAM 2003 are connected to each other via a bus 2004. An input / output (I / O) interface 2005 is also connected to the bus 2004.
[0323] The following components are connected to the I / O interface 2005: an input section 2006 including a keyboard, a mouse, etc.; an output section 2007 including a cathode ray tube (CRT), a liquid crystal display (LCD), etc., and a speaker, etc.; a storage section 2008 including a hard disk, etc.; and a communication section 2009 including a network interface card such as a LAN card, a modem, etc. The communication section 2009 performs communication processing via a network such as the Internet. A drive 2010 is also connected to the I / O interface 2005 as needed. A removable medium 2011, such as a magnetic disk, an optical disk, a magneto-optical disk, a semiconductor memory, etc., is installed on the drive 2010 as needed, so that a computer program read therefrom is installed into the storage section 2008 as needed.
[0324] In particular, according to an embodiment of the present disclosure, the process described above with reference to the flowchart can be implemented as a computer software program. For example, an embodiment of the present disclosure includes a computer program product, which includes a computer program carried on a computer-readable medium, and the computer program includes a program code for executing the method shown in the flowchart. In such an embodiment, the computer program can be downloaded and installed from a network through a communication part 2009, and / or installed from a removable medium 2011. When the computer program is executed by a central processing unit (CPU) 2001, the above-mentioned functions defined in the system of the present disclosure are executed.
[0325] It should be noted that the computer-readable medium shown in the present disclosure may be a computer-readable signal medium or a computer-readable storage medium or any combination of the above two. The computer-readable storage medium may be, for example, but not limited to, an electrical, magnetic, optical, electromagnetic, infrared, or semiconductor system, device or device, or any combination of the above. More specific examples of computer-readable storage media may include, but are not limited to: an electrical connection with one or more wires, a portable computer disk, a hard disk, a random access memory (RAM), a read-only memory (ROM), an erasable programmable read-only memory (EPROM or flash memory), an optical fiber, a portable compact disk read-only memory (CD-ROM), an optical storage device, a magnetic storage device, or any suitable combination of the above. In the present disclosure, a computer-readable storage medium may be any tangible medium containing or storing a program that can be used by or in combination with an instruction execution system, device or device. In the present disclosure, a computer-readable signal medium may include a data signal propagated in a baseband or as part of a carrier wave, in which a computer-readable program code is carried. This propagated data signal may take a variety of forms, including but not limited to electromagnetic signals, optical signals, or any suitable combination of the above. Computer-readable signal media may also be any computer-readable medium other than computer-readable storage media, which may send, propagate or transmit a program for use by or in conjunction with an instruction execution system, apparatus or device. The program code contained on the computer-readable medium may be transmitted using any appropriate medium, including but not limited to: wireless, wire, optical cable, RF, etc., or any suitable combination of the above.
[0326] The flow charts and block diagrams in the accompanying drawings illustrate the possible architecture, functions and operations of the systems, methods and computer program products according to various embodiments of the present disclosure. In this regard, each box in the flow chart or block diagram can represent a module, a program segment, or a part of a code, and the above-mentioned module, program segment, or a part of a code contains one or more executable instructions for realizing the specified logical function. It should also be noted that in some alternative implementations, the functions marked in the box can also occur in a different order from the order marked in the accompanying drawings. For example, two boxes represented in succession can actually be executed substantially in parallel, and they can sometimes be executed in the opposite order, depending on the functions involved. It should also be noted that each box in the block diagram or flow chart, and the combination of the boxes in the block diagram or flow chart can be implemented with a dedicated hardware-based system that performs a specified function or operation, or can be implemented with a combination of dedicated hardware and computer instructions.
[0327] The modules involved in the embodiments described in the present disclosure may be implemented by software or hardware. For example, it may be described as follows: a processor includes a decoding unit, a scalar instruction execution unit, an instruction submission unit, a vector loading unit, a vector reading unit, and a vector instruction execution unit. The names of these units do not, in some cases, constitute limitations on the units themselves. For example, the decoding unit may also be described as a "unit that decodes instructions in an instruction packet."
[0328] The present disclosure also provides a computer-readable medium, which may be included in the device described in the above embodiment; or may exist independently without being assembled into the device. The above computer-readable medium carries one or more programs, and when the above one or more programs are executed by a device, the method implemented by the device includes:
[0329] A first instruction packet is processed on a first scalar pipeline to obtain and send a first vector load memory access request corresponding to a first vector load instruction, the first instruction packet includes a first vector load instruction, and the first vector load instruction is used to indicate loading of first vector data; a second instruction packet is processed on a second scalar pipeline to obtain and execute a second scalar processing instruction to obtain a first vector processing instruction, and the first vector processing instruction is submitted to the vector pipeline, the second instruction packet includes a second scalar processing instruction and a first vector processing instruction, and the first vector processing instruction is used to indicate processing of the first vector data; the first vector load memory access request is processed to obtain and register the first vector data; on the vector pipeline, the registered first vector data is obtained, the first vector processing instruction is executed, and a first vector data processing result is obtained.
[0330] The embodiments of the present disclosure provide a computer program product or a computer program, which includes computer instructions stored in a computer-readable storage medium. A processor of a computer device reads the computer instructions from the computer-readable storage medium, and the processor executes the computer instructions, so that the computer device executes the methods provided in the above-mentioned various optional implementations.
[0331] The exemplary embodiments of the present disclosure are specifically shown and described above. It should be understood that the present disclosure is not limited to the detailed structures, configurations or implementations described herein; on the contrary, the present disclosure is intended to cover various modifications and equivalent configurations included in the spirit and scope of the appended claims.
Claims
1. A data processing method, characterized in that: include: Processing a first instruction packet on a first scalar pipeline, obtaining and sending a first vector load memory access request corresponding to a first vector load instruction, wherein the first instruction packet includes the first vector load instruction, and the first vector load instruction is used to instruct loading of first vector data; Processing a second instruction packet on a second scalar pipeline, obtaining and executing a second scalar processing instruction, obtaining a first vector processing instruction, and submitting the first vector processing instruction to the vector pipeline, wherein the second instruction packet includes the second scalar processing instruction and the first vector processing instruction, and the first vector processing instruction is used to instruct processing of the first vector data; Processing the first vector load memory access request to obtain and store the first vector data; On the vector pipeline, the first stored vector data is obtained, the first vector processing instruction is executed, and the first vector data processing result is obtained.
2. The method according to claim 1, characterized in that Processing a first instruction packet on a first scalar pipeline to obtain and send a first vector load memory access request corresponding to a first vector load instruction includes: Decoding the first instruction packet on the first scalar pipeline in a first clock cycle, obtaining and sending the first vector load memory access request; Processing the second instruction packet on the second scalar pipeline, obtaining and executing the second scalar processing instruction, obtaining the first vector processing instruction, and submitting the first vector processing instruction to the vector pipeline, including: processing the second instruction packet on the second scalar pipeline in a second clock cycle, obtaining and executing the second scalar processing instruction, obtaining the first vector processing instruction, and submitting the first vector processing instruction to the vector pipeline, wherein the second clock cycle is after the first clock cycle, and the second clock cycle includes a plurality of single clock cycles; Processing the first vector load memory access request to obtain and store the first vector data includes: In the second clock cycle, processing the first vector load memory access request, obtaining and storing the first vector data; On the vector pipeline, obtaining the first stored vector data, executing the first vector processing instruction, and obtaining a first vector data processing result, including: On the vector pipeline, in a third clock cycle after the second clock cycle, the first registered vector data is obtained, the first vector processing instruction is executed, and a first vector data processing result is obtained.
3. The method according to claim 2, characterized in that The method is performed by a processor, the processor comprising a vector register set shared by the first scalar pipeline, the second scalar pipeline, and the vector pipeline; In the second clock cycle, the first vector load memory access request is processed to obtain and store the first vector data, including: In a last clock cycle of the second clock cycle, sending the first vector data to the vector register group; The method further comprises: On the vector pipeline, in a last clock cycle in the second clock cycle, decoding the first vector processing instruction, obtaining first vector processing control information corresponding to the first vector processing instruction, and sending the first vector processing control information to the vector register group; On the vector pipeline, in a third clock cycle after the second clock cycle, obtaining the first stored vector data, executing the first vector processing instruction, and obtaining a first vector data processing result, including: On the vector pipeline, in the third clock cycle, the first vector processing control information and the first vector data are respectively read from the vector register group, and the first vector data is processed according to the first vector processing control information to obtain the first vector data processing result, and the first vector data processing result is sent to the vector register group.
4. The method according to claim 1, characterized in that: The method is performed by a processor, the processor comprising a vector loading unit; Processing a first instruction packet on a first scalar pipeline to obtain and send a first vector load memory access request corresponding to a first vector load instruction includes: Decoding the first instruction packet on the first scalar pipeline to obtain the first vector load memory access request, and sending the first vector load memory access request to the vector load unit; Processing the first vector load memory access request to obtain and store the first vector data includes: The vector loading unit sends the first vector load memory access request to the vector memory, and after the vector memory returns the first vector data according to the first vector load memory access request, sends the first vector data to be stored.
5. The method according to claim 4, characterized in that The vector loading unit sends the first vector load memory access request to the vector memory, including: The vector loading unit determines whether to transmit the first vector loading memory access request or to transmit a request to be resent, wherein the request to be resent is a vector loading memory access request corresponding to a vector loading instruction that is determined to have a dependency relationship with a preceding instruction; If the vector load unit determines to issue the first vector load memory access request, the first vector load memory access request is sent to the vector memory.
6. The method according to claim 4, characterized in that The vector loading unit includes a dependency detection unit, an entry allocation unit, an instruction queue and an arbitration scheduling unit; The vector loading unit sends the first vector load memory access request to the vector memory, including: The dependency detection unit determines whether the first vector load instruction has a dependency relationship with a preceding instruction according to the first vector load memory access request; The entry allocation unit allocates an entry in the instruction queue to the first vector load memory access request, and obtains first entry information corresponding to the first vector load memory access request; If the dependency detection unit determines that the first vector load instruction has a dependency relationship with the preceding instruction, then writing resending indication information into the first entry information; Based on the first entry information and according to the need to resend indication information, determining the first vector load memory access request as the vector load memory access request to be sent; The arbitration scheduling unit sends the to-be-sent vector load memory access request to the vector memory.
7. The method according to claim 6, characterized in that The first vector load instruction includes a first memory access address; Decoding the first instruction packet on the first scalar pipeline to obtain the first vector load memory access request includes: Decoding the first instruction packet on the first scalar pipeline to obtain the first memory access address in the first vector load instruction; generating, according to the first memory access address, a first vector load memory access request, wherein the first vector load memory access request includes the first memory access address; The entry allocation unit allocates an entry in the instruction queue for the first vector load memory access request, and obtains first entry information corresponding to the first vector load memory access request, including: The entry allocation unit allocates an entry in the instruction queue for the first vector load memory access request, stores the first memory access address into the instruction queue according to the allocated entry, and obtains the first entry information, wherein the first entry information includes the first memory access address; The dependency detection unit determines, according to the first vector load memory access request, whether the first vector load instruction has a dependency relationship with a preceding instruction, including: The dependency detection unit obtains a memory access address of a preceding storage instruction sent by the storage instruction processing unit; The dependency detection unit obtains the first memory access address in the instruction queue; The dependency detection unit determines whether the first memory access address is the same as the memory access address of the preceding storage instruction; If the dependency detection unit determines that the first vector load instruction has a dependency relationship with the preceding instruction, writing resending indication information into the first entry information includes: If the dependency detection unit determines that the first memory access address is the same as the memory access address of the preceding storage instruction, the resending indication information is written into the first entry information.
8. The method according to claim 7, characterized in that The first entry information includes a dependency table; If the dependency detection unit determines that the first memory access address is the same as the memory access address of the preceding storage instruction, writing the need-to-retransmit indication information into the first entry information includes: If the dependency detection unit determines that the first memory access address is the same as the memory access address of the preceding storage instruction, then writing the information of the preceding storage instruction into the dependency table; The dependency detection unit obtains the execution completion information of the preceding storage instruction from the storage instruction processing unit; The dependency detection unit deletes the information of the preceding storage instruction in the dependency table according to the execution completion information of the preceding storage instruction; The dependency detection unit writes the resending requirement indication information into the first entry information according to the dependency table.
9. The method according to claim 6, characterized in that The vector loading unit sends the first vector load access request to the vector memory, and further includes: Obtaining request-send return information from the arbitration scheduling unit; Sending return information according to the request, determining whether the first vector load memory access request has been resent, obtaining resent information, and writing the resent information into the first entry information; The vector loading unit also includes a logic operation unit and a leading detection unit; Based on the first entry information and according to the need to resend indication information, determining the first vector load memory access request as the vector load memory access request to be sent includes: The logic operation unit performs a logic operation on the resending indication information and the resending information to obtain a logic operation result; The leading detection unit determines the first vector load memory access request as the vector load memory access request to be sent according to the logic operation result.
10. The method according to claim 6, characterized in that The vector loading unit also includes an index queue and a data queue; The arbitration scheduling unit sends the to-be-sent vector load memory access request to the vector memory, including: The arbitration scheduling unit sends the to-be-sent vector load memory access request to the vector memory, and writes the number of the entry in the instruction queue corresponding to the to-be-sent vector load memory access request into the index queue; The vector loading unit sends the first vector load memory access request to the vector memory, and after the vector memory returns the first vector data according to the first vector load memory access request, sends the first vector data to store it, including: After the vector memory returns the first vector data according to the first vector load access request, the vector loading unit writes the first vector data into the data queue according to the number in the index queue; The data queue sends the first vector data to be stored.
11. The method according to claim 2, characterized in that The method is performed by a processor, the processor comprising a decoding unit, a scalar instruction execution unit and an instruction submission unit; The second clock cycle includes a fourth clock cycle and a fifth clock cycle, the fourth clock cycle is at least one first clock cycle of the second clock cycle, and the fifth clock cycle is after the fourth clock cycle; Processing the second instruction packet on the second scalar pipeline in a second clock cycle, obtaining and executing a second scalar processing instruction, obtaining the first vector processing instruction, and submitting the first vector processing instruction to the vector pipeline, including: On the second scalar pipeline, the decoding unit decodes the second instruction packet in the fourth clock cycle to obtain the second scalar processing instruction and the first vector processing instruction, and determines whether to submit the first vector processing instruction; On the second scalar pipeline, the scalar instruction execution unit executes the second scalar processing instruction in the fourth clock cycle; On the second scalar pipeline, when the decoding unit determines to submit the first vector processing instruction, the instruction submitting unit submits the first vector processing instruction to the vector pipeline in the fifth clock cycle.
12. The method according to claim 1, characterized in that The second instruction packet further includes a second vector load instruction, where the second vector load instruction is used to instruct loading of second vector data; Also includes: The second instruction packet is processed on the second scalar pipeline to obtain and send a second vector load memory access request corresponding to the second vector load instruction.
13. A processor, characterized in that: include: a decoding unit, configured to process a first instruction packet on a first scalar pipeline, obtain and send a first vector load memory access request corresponding to a first vector load instruction, wherein the first instruction packet includes the first vector load instruction, and the first vector load instruction is used to instruct to load first vector data; The decoding unit is further used to process the second instruction packet on the second scalar pipeline to obtain a second scalar processing instruction and a first vector processing instruction, wherein the second instruction packet includes the second scalar processing instruction and the first vector processing instruction, and the first vector processing instruction is used to instruct processing of the first vector data; a scalar instruction execution unit, coupled to the decoding unit, for executing the second scalar processing instruction on the second scalar pipeline; an instruction submitting unit, coupled to the decoding unit and the scalar instruction execution unit, for submitting the first vector processing instruction to a vector pipeline; a vector loading unit, coupled to the decoding unit, and configured to process the first vector load memory access request, and obtain and store the first vector data; A vector reading unit, used for obtaining the first stored vector data on the vector pipeline; The vector instruction execution unit is coupled to the vector reading unit and is used for executing the first vector processing instruction to obtain a first vector data processing result.
14. The processor according to claim 13, characterized in that The vector loading unit includes a dependency detection unit, an entry allocation unit, an instruction queue and an arbitration scheduling unit, wherein: The dependency detection unit is coupled to the decoding unit and is used to determine whether the first vector load instruction has a dependency relationship with a preceding instruction according to the first vector load memory access request; The entry allocation unit is coupled to the decoding unit and the instruction queue, and is used to allocate an entry in the instruction queue to the first vector load memory access request, and obtain first entry information corresponding to the first vector load memory access request; The dependency detection unit is also coupled to the instruction queue, and is further used to write resending indication information into the first entry information if it is determined that the first vector load instruction has a dependency relationship with a preceding instruction; The vector loading unit is further configured to determine the first vector load memory access request as the vector load memory access request to be sent based on the first entry information and according to the need to resend indication information; The arbitration scheduling unit is coupled to the vector memory, and is used to send the to-be-sent vector load memory access request to the vector memory.
Citation Information
Cited By
Reexecution method and device of memory access instruction, equipment and storage medium
CN122018997A
Scalar-vector heterogeneous assembly line interaction chip and interaction method
CN122308924A
