Processors, instruction fetching methods and computer devices
By introducing a counter generator and an instruction buffer into the processor, and prioritizing the lookup and copying of instructions from the buffer, the problem of frequent memory access by the processor is solved, achieving the effects of reducing power consumption and improving performance.
Patent Information
- Application Number
- CN202510585163.9
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2025-05-07
- Publication Date
- 2026-11-10
AI Technical Summary
Existing processors frequently access memory to fetch instructions when performing tasks, resulting in high power consumption.
By introducing n counter generators and n instruction buffers into the processor, corresponding one-to-one with n thread bundles, instructions are preferentially retrieved and copied from the instruction buffers, reducing memory access.
It reduces processor power consumption, improves processor performance, reduces unnecessary data transfer, and ensures efficient instruction fetching.
Smart Images

Figure CN123067933A_ABST
Abstract
Description
Technical Field
[0001] This application relates to the field of computer technology, and in particular to a processor, an instruction acquisition method, and a computer device. Background Technology
[0002] A processor includes memory that caches the instructions it will execute. When a processor performs a task, it creates multiple threads to fetch instructions from memory and execute them. However, current processors frequently access memory to fetch instructions during task execution, resulting in high power consumption. Summary of the Invention
[0003] This application provides a processor, an instruction fetching method, and a computer device, which can reduce processor power consumption and improve processor performance. The technical solution is as follows:
[0004] On one hand, a processor is provided, the processor including a processing module, n counter generators, n instruction buffers and a memory; the processing module is connected to each counter generator, each instruction buffer and the memory respectively, and the n counter generators and the n instruction buffers are each associated with n thread bundles, where n is an integer greater than 1;
[0005] The n instruction buffers are used to store the instructions to be executed for the corresponding thread bundle and the storage address of the instructions in the memory;
[0006] The first counting generator among the n counting generators is used to send a first acquisition request to the processing module. The first acquisition request carries an instruction storage address. The instruction storage address is the storage address in the memory of the instruction to be executed by the corresponding thread. The first counting generator is any one of the n counting generators.
[0007] The processing module is configured to receive the first acquisition request, and based on the first acquisition request, query from the n instruction buffers; if the instruction corresponding to the instruction storage address is found in the first instruction buffer, copy the instruction storage address and the corresponding instruction to the second instruction buffer, wherein the second instruction buffer and the first counter generator are in the same thread bundle, and the first instruction buffer is any one of the n instruction buffers except the second instruction buffer.
[0008] On the other hand, an instruction fetching method is provided, executed by the processor described above. The processor includes a processing module, n counter generators, n instruction buffers, and a memory. The processing module is connected to each counter generator, each instruction buffer, and the memory. The n instruction buffers store instructions to be executed for corresponding thread bundles and the storage addresses of the instructions in the memory. Each of the n counter generators and the n instruction buffers corresponds one-to-one with one of the n thread bundles, where n is an integer greater than 1. The method includes:
[0009] The first counter generator among the n counter generators sends a first acquisition request to the processing module. The first acquisition request carries an instruction storage address. The instruction storage address is the storage address in the memory of the instruction to be executed by the corresponding thread bundle. The first counter generator is any one of the n counter generators.
[0010] The processing module receives the first acquisition request and, based on the first acquisition request, queries from the n instruction buffers; if the instruction corresponding to the instruction storage address is found in the first instruction buffer, the instruction storage address and the corresponding instruction are copied to the second instruction buffer, the second instruction buffer and the first counter generator are in the same thread bundle, and the first instruction buffer is any one of the n instruction buffers except the second instruction buffer.
[0011] In one possible implementation, the processing module includes a processing unit and a buffer management unit. The processing unit is connected to each counter generator, the memory, and the buffer management unit, respectively. The buffer management unit is connected to each instruction buffer. The processing module receives the first acquisition request and, based on the first acquisition request, queries the n instruction buffers. If the instruction corresponding to the instruction storage address is found in the first instruction buffer, the instruction storage address and the corresponding instruction are copied to the second instruction buffer, including:
[0012] The processing unit receives the first acquisition request and, based on the first acquisition request, sends a query request to the buffer management unit, the query request carrying the instruction storage address;
[0013] The buffer management unit receives the query request and, based on the query request, queries from the n instruction buffers; if the instruction corresponding to the instruction storage address is found in the first instruction buffer, the instruction storage address and the corresponding instruction are copied to the second instruction buffer.
[0014] In another possible implementation, after querying the n instruction buffers based on the query request, the method further includes:
[0015] The buffer management unit sends a query result to the processing unit, wherein the query result is the result of querying the instruction corresponding to the instruction storage address from the n instruction buffers;
[0016] The processing unit receives the query result.
[0017] In another possible implementation, after the processing unit receives the query result, the method further includes:
[0018] If the query result indicates that no instruction corresponding to the instruction storage address is found, the processing unit sends the first acquisition request to the memory;
[0019] The memory receives the first acquisition request, reads the instruction at the instruction storage address based on the first acquisition request, and sends the instruction storage address and the instruction corresponding to the instruction storage address to the buffer management unit.
[0020] The buffer management unit receives the instruction storage address and the corresponding instruction, and writes the instruction storage address and the corresponding instruction into the second instruction buffer.
[0021] In another possible implementation, after querying the n instruction buffers based on the first acquisition request, the method further includes:
[0022] If the processing module does not find the instruction corresponding to the instruction storage address, it sends the first acquisition request to the memory.
[0023] The memory receives the first acquisition request, reads the instruction at the instruction storage address based on the first acquisition request, and sends the instruction corresponding to the instruction storage address to the processing module.
[0024] The processing module receives the instruction corresponding to the instruction storage address and writes the instruction storage address and the corresponding instruction into the second instruction buffer.
[0025] In another possible implementation, the processor further includes a request management module and a broadcast module; the processing module is connected to the request management module and the broadcast module respectively, and the memory is connected to the broadcast module; the request management module is used to store at least one request message, the request message including a storage address, the request message indicating that the processing module has sent an instruction retrieval request to the memory carrying the storage address; the broadcast module is used to store at least one entry message, the at least one entry message corresponding one-to-one with the at least one request message, the entry message including an identifier of at least one instruction buffer, the at least one instruction buffer requesting the instruction at the storage address in the request message; after receiving the first retrieval request, the method further includes:
[0026] Based on the first acquisition request, the processing module queries the request information stored in the request management module; if the first request information is found, the second instruction buffer identifier is added to the first entry information stored in the broadcast module, wherein the storage address included in the first request information is the same as the instruction storage address, and the first entry information corresponds to the first request information;
[0027] The memory sends an instruction corresponding to the instruction storage address to the processing module based on a second acquisition request. The second acquisition request is sent by a second counter generator, which is any one of the n counter generators other than the first counter generator. The second acquisition request carries the instruction storage address.
[0028] The processing module receives the instruction corresponding to the instruction storage address, obtains the first entry information from the broadcast module, and writes the instruction storage address and the corresponding instruction into the instruction buffer indicated by the first entry information based on the first entry information.
[0029] In another possible implementation, the step of adding the identifier of the second instruction buffer to the first entry information stored in the broadcast module upon querying the first request information includes:
[0030] When the processing module finds the first request information, it sends an entry update request to the broadcast module. The entry update request indicates that the entry information corresponding to the first request information be updated.
[0031] The broadcast module receives the entry update request and, based on the entry update request, adds the identifier of the second instruction buffer to the first entry information.
[0032] In another possible implementation, the processing module includes a processing unit and a buffer management unit. The processing unit is connected to each counter generator, the memory, the buffer management unit, the request management module, and the broadcast module, respectively. The buffer management unit is connected to each instruction buffer and the broadcast module, respectively. Based on the first acquisition request, the processing module queries the request information stored in the request management module. If the first request information is found, the identifier of the second instruction buffer is added to the first entry information stored in the broadcast module, including:
[0033] The processing unit queries the request information stored in the request management module based on the first acquisition request; if the first request information is found, the second instruction buffer identifier is added to the first entry information.
[0034] Based on the second acquisition request, the memory sends the instruction storage address and the corresponding instruction to the broadcast module;
[0035] The broadcast module receives the instruction storage address and the corresponding instruction, and sends the first entry information, the instruction storage address and the corresponding instruction to the buffer management unit.
[0036] The step of writing the instruction storage address and the corresponding instruction into the instruction buffer indicated by the first entry information based on the first entry information includes:
[0037] Based on the first entry information, the buffer management unit writes the instruction storage address and the corresponding instruction into the instruction buffer indicated by the first entry information.
[0038] In another possible implementation, the memory sends an instruction corresponding to the instruction storage address to the processing module based on a second fetch request, including:
[0039] Based on the second acquisition request, the memory sends the instruction corresponding to the instruction storage address to the broadcast module;
[0040] The broadcast module receives the instruction corresponding to the instruction storage address and sends the first entry information and the instruction corresponding to the instruction storage address to the processing module.
[0041] In another possible implementation, the request information includes an indicator and a storage address. The indicator includes a first indicator or a second indicator, whereby the first indicator indicates that the memory has responded with an instruction at the storage address, and the second indicator indicates that the memory has not responded with an instruction at the storage address. The processing module, based on the first acquisition request, queries the request information stored in the request management module, including:
[0042] The processing module queries the request information, which includes the second indicator, from the request management module based on the first acquisition request; the first request information includes the second indicator.
[0043] In another possible implementation, after the memory sends the instruction corresponding to the instruction storage address to the processing module based on the second fetch request, the method further includes:
[0044] The memory sends a feedback notification to the processing module, the feedback notification indicating that the second instruction to obtain feedback has been received;
[0045] The processing module receives the feedback notification and, based on the feedback notification, updates the indicator of the first request information in the request management module to the first indicator.
[0046] In another possible implementation, after the processing module queries the request information stored by the request management module based on the first acquisition request, the method further includes:
[0047] If the processing module does not find any request information including the instruction storage address, it adds a second request information to the request management module, sends a first acquisition request to the memory, and adds a second entry information corresponding to the second request information to the broadcast module. The second request information includes the instruction storage address, and the second entry information includes the identifier of the second instruction buffer.
[0048] On the other hand, a computer device is provided, the computer device including the processor described in the above aspects.
[0049] In the solution provided in this application embodiment, the processor includes a processing module, a memory, a counter generator corresponding to n thread bundles, and an instruction buffer corresponding to n thread bundles. When any counter generator requests an instruction at a certain memory address, considering that the instruction may already exist in the n instruction buffers, the processing module, based on the memory address, first queries the n instruction buffers to check whether the instruction exists in a certain instruction buffer. If the instruction is found, it only needs to be copied between the instruction buffers. This eliminates the need to access the memory again to obtain the instruction at the memory address, reducing the number of memory accesses, saving processor power consumption, and thus improving processor performance. At the same time, it eliminates the need to access the memory again to store the instruction in the corresponding instruction buffer, reducing unnecessary data transfer and ensuring instruction fetching efficiency. Attached Figure Description
[0050] To more clearly illustrate the technical solutions in the embodiments of this application, the accompanying drawings used in the description of the embodiments will be briefly introduced below. Obviously, the accompanying drawings described below are only some embodiments of the embodiments of this application. For those skilled in the art, other drawings can be obtained based on these drawings without creative effort.
[0051] Figure 1 This is a schematic diagram of the structure of a processor provided in an embodiment of this application;
[0052] Figure 2 This is a schematic diagram of the structure of a processor provided in an embodiment of this application;
[0053] Figure 3 This is a schematic diagram of the structure of a processor provided in an embodiment of this application;
[0054] Figure 4 This is a schematic diagram of the structure of a processor provided in an embodiment of this application;
[0055] Figure 5 This is a schematic diagram of the structure of a processor provided in an embodiment of this application;
[0056] Figure 6 This is a schematic diagram of the structure of a processor provided in an embodiment of this application;
[0057] Figure 7 This is a schematic diagram of the structure of a processor provided in an embodiment of this application;
[0058] Figure 8 This is a flowchart of an instruction acquisition method provided in an embodiment of this application;
[0059] Figure 9 This is a schematic diagram of the structure of a terminal provided in an embodiment of this application;
[0060] Figure 10 This is a schematic diagram of the structure of a server provided in an embodiment of this application. Detailed Implementation
[0061] To make the objectives, technical solutions, and advantages of the embodiments of this application clearer, the implementation methods of this application will be further described in detail below with reference to the accompanying drawings.
[0062] The terms “first,” “second,” “third,” “fourth,” “fifth,” “sixth,” etc., used in this application may be used to describe various concepts, but unless otherwise stated, these concepts are not limited by these terms. These terms are used only to distinguish one concept from another. For example, without departing from the scope of this application, a first acquisition request may be referred to as a second acquisition request, and similarly, a second acquisition request may be referred to as a first acquisition request.
[0063] As used in this application, the terms "at least one," "multiple," "each," and "any" have the following meanings: at least one includes one, two, or more; multiple includes two or more; each refers to each of the corresponding multiple; and any refers to any one of the multiple. For example, multiple instructions may include three instructions, where each refers to each of the three instructions, and any refers to any one of the three instructions, which could be the first instruction, the second instruction, or the third instruction.
[0064] It should be noted that the collection and processing of relevant data (such as instructions, storage addresses, etc.) in this application should strictly comply with the requirements of relevant national laws and regulations, obtain the informed consent or separate consent of the personal information subject, and carry out subsequent data use and processing within the scope of laws and regulations and the authorization of the personal information subject.
[0065] Figure 1 This is a schematic diagram of the structure of a processor provided in an embodiment of this application, such as... Figure 1 As shown, the processor includes a processing module 101, n counter generators 102, n instruction buffers 103, and a memory 104. The processing module 101 is connected to each counter generator 102, each instruction buffer 103, and the memory 104 respectively. Each of the n counter generators 102 and the n instruction buffers 103 corresponds to one of the n thread bundles, where n is an integer greater than 1.
[0066] In this embodiment, the processor creates n thread bundles during task execution to process data in parallel, thereby improving data processing speed and ensuring the efficiency of task execution. The processor's memory 104 caches instructions to be executed. Considering that executing tasks through n thread bundles requires frequent reading of instructions from memory 104, and that different thread bundles may execute the same instructions, the processor is configured to include a processing module 101, n counter generators 102, n instruction buffers 103, and memory 104. The instruction buffers 103 store instructions already retrieved from memory 104 and awaiting execution by the thread bundles. When the processor retrieves instructions for each thread, it prioritizes querying the instruction buffers 103 corresponding to the n thread bundles. If the requested instruction exists in an instruction buffer 103, instruction copying can be performed directly among the n instruction buffers 103, eliminating the need to retrieve it from memory 104 and reducing the access frequency to memory 104.
[0067] In this embodiment, for n thread bundles, each thread bundle includes at least one thread. Within the same thread bundle, threads execute synchronously; that is, different threads within the same thread bundle execute the same instruction synchronously. The instructions executed by different threads are identical, but the data processed by different threads executing the same instruction differs. During the processor's task execution, instructions are fetched for each thread bundle as a unit, and each thread bundle maintains an independent program counter (PC). The fetching rhythm of different thread bundles may differ, and the structure of instruction fetching for each thread bundle is related to the scheduling strategy.
[0068] For example, taking the processor's image rendering task as an example, the image is divided into n regions, and each of the n regions corresponds to one of the n thread bundles. Each thread bundle is used to execute the rendering task of the corresponding image region. Within the same thread bundle, the instructions executed by different threads are the instructions to render the image region corresponding to that thread bundle. However, when different threads execute instructions, they render different pixels in that image region.
[0069] The memory 104 is used to cache instructions to be executed by the processor. The memory 104 can be any type of storage device, such as a high-speed cache memory. For example, the memory 104 can be an I-Cache (Instruction Cache). The program counter generator 102 is used to generate the storage address in the memory 104 for the next instruction to be executed for the corresponding thread bundle. The program counter generator 102 can be any type of component, such as a PC Generator (Program Counter Generator). The PC (Program Counter) is a register in the processor used to store the storage address of the next instruction to be executed for the corresponding thread bundle. The PC Generator generates the correct PC value based on different situations to ensure that the processor can fetch and execute instructions from the memory 104 in the correct order. The processing module 101 manages instruction handling and provides the instructions to be executed for each thread bundle to the instruction buffer 103 corresponding to each thread bundle, thereby minimizing the frequency of access to the memory 104. Instruction buffer 103 is used to cache instructions fetched from memory 104. The cached instructions are also the instructions to be executed by the corresponding thread. Instruction buffer 103 can be any type of buffer; for example, it can be an I-Buffer (Instruction Buffer). The connection between processing module 101, n counter generators 102, n instruction buffers 103, and memory 104 can be implemented in any way. For example, processing module 101, n counter generators 102, n instruction buffers 103, and memory 104 can all be connected electrically or wirelessly.
[0070] The processor will now be described based on the above sections.
[0071] (1) n instruction buffers 103: used to store the instructions to be executed for the corresponding thread bundle and the storage address of the instructions in memory 104.
[0072] In this embodiment, during the execution of a task by the processor through n thread bundles, the next instruction to be executed for each thread bundle is pre-fetched from memory 104 and cached in the instruction buffer 103 corresponding to each thread bundle. This allows subsequent thread bundles to directly fetch and execute instructions from their respective instruction buffers 103, saving the time required to fetch instructions and ensuring the processor's processing efficiency. The instruction buffer 103 stores the instructions to be executed by the corresponding thread bundle and fetched from memory 104. Considering the possibility of instruction transfers between different instruction buffers 103, the instruction buffer 103 stores each instruction in a manner that maps instructions to their corresponding memory addresses, so that instructions can be retrieved later using the memory address.
[0073] Instructions are used to indicate the operation to be performed and the objects involved in the operation. For example, taking the processor's image rendering task as an example, the instruction instructs to perform calculations on the color, lighting, etc. of the pixels in the image. The storage address is also equivalent to the access address of memory 104, which reflects the storage location of the instruction in memory 104. The corresponding instruction can be retrieved from memory 104 according to the storage address.
[0074] In one possible implementation, the instruction buffer 103 includes an address field segment and an instruction field segment, wherein the address field segment is used to store the memory address of the instruction, and the instruction field segment is used to store the instruction.
[0075] In this embodiment, the content of the address field is the storage address of the instruction already stored in the instruction buffer 103, and the content of the instruction field is the instruction already stored in the instruction buffer 103. The instruction buffer 103 stores the instruction and the storage address in the form of address field and instruction field to facilitate subsequent lookup from the instruction buffer 103.
[0076] (2) The first counter generator 1021 among the n counter generators 102: is used to send a first acquisition request to the processing module 101. The first acquisition request carries the instruction storage address. The instruction storage address is the storage address of the instruction to be executed by the corresponding thread in the memory 104. The first counter generator 1021 is any one of the n counter generators 102.
[0077] In this embodiment of the application, during the process of the processor executing a task through n thread bundles, the counter generator 102 can generate the storage address of the next instruction based on the execution status of the current instruction by the corresponding thread bundle and the state of the processor, and send an instruction retrieval request carrying the storage address to the processing module 101, so that the subsequent processing module 101 can cache the instruction at the storage address in the instruction buffer 103 corresponding to the counter generator 102 based on the instruction retrieval request.
[0078] The first retrieval request is used to request the instruction at the instruction storage address.
[0079] For example, for any thread bundle, if the thread bundle is currently executing instruction 1, the counter generator 102 corresponding to the thread bundle can generate the storage address of the next instruction (instruction 2) based on the execution status of the current instruction and the state of the processor, and send an instruction fetch request carrying the storage address to the processing module 101 so that instruction 2 and its storage address can be cached in the instruction buffer 103 corresponding to the thread bundle. When the thread bundle executes instruction 2 later, the counter generator 102 corresponding to the thread bundle can generate the storage address of the next instruction (instruction 3) based on the execution status of the current instruction and the state of the processor, and send an instruction fetch request carrying the storage address to the processing module 101 so that instruction 3 and its storage address can be cached in the instruction buffer 103 corresponding to the thread bundle, and so on.
[0080] It should be noted that the embodiments of this application are illustrated using any one of the n counter generators 102 as an example. The functions of the other counter generators 102 are the same as those of the first counter generator described above, and will not be described in detail here.
[0081] (3) Processing module 101: is used to receive a first acquisition request, and based on the first acquisition request, to query from n instruction buffers 103; if the instruction corresponding to the instruction storage address is found in the first instruction buffer 1031, the instruction storage address and the corresponding instruction are copied to the second instruction buffer 1032. The second instruction buffer 1032 and the first counter generator 1021 are in the same thread bundle. The first instruction buffer 1031 is any one of the n instruction buffers 103 except the second instruction buffer 1032.
[0082] In this embodiment, after receiving the first acquisition request, the processing module 101 can query from n instruction buffers 103 based on the instruction storage address carried in the first acquisition request to check whether there is an instruction corresponding to the instruction storage address. If any instruction buffer 103 stores the instruction corresponding to the instruction storage address, it is only necessary to copy the instruction corresponding to the instruction storage address in the instruction buffer 103 to the instruction buffer 103 corresponding to the first acquisition request. In this way, it is not necessary to retrieve the instruction under the instruction storage address from the memory 104, which can reduce the number of accesses to the memory 104.
[0083] In one possible implementation, the instruction buffer 103 includes an address field and an instruction field. The processing module 101 is used to query the address field of each instruction buffer 103 based on the instruction storage address carried by the first acquisition request, and if any instruction buffer 103 includes the instruction storage address, determine that the instruction buffer stores the instruction corresponding to the instruction storage address.
[0084] In the solution provided in this application embodiment, the processor includes a processing module, a memory, a counter generator corresponding to n thread bundles, and an instruction buffer corresponding to n thread bundles. When any counter generator requests an instruction at a certain memory address, considering that the instruction may already exist in the n instruction buffers, the processing module, based on the memory address, first queries the n instruction buffers to check whether the instruction exists in a certain instruction buffer. If the instruction is found, it only needs to be copied between the instruction buffers. This eliminates the need to access the memory again to obtain the instruction at the memory address, reducing the number of memory accesses, saving processor power consumption, and thus improving processor performance. At the same time, it eliminates the need to access the memory again to store the instruction in the corresponding instruction buffer, reducing unnecessary data transfer and ensuring instruction fetching efficiency.
[0085] In the above Figure 1 Based on the illustrated embodiments, in this application embodiment, the processing module 101 includes a processing unit 1011 and a buffer management unit 1012, such as... Figure 2 As shown, the processing unit 1011 is connected to each counter generator 102, the memory 104 and the buffer management unit 1012 respectively, and the buffer management unit 1012 is connected to each instruction buffer 103.
[0086] The processing unit 1011 processes requests. For example, it can send a query request to the buffer management unit 1012 or an instruction retrieval request to the memory 104 based on an instruction retrieval request. The processing unit 1011 can be any type of unit; for example, it can be a Query Update Unit. The buffer management unit 1012 manages n instruction buffers 103 and can query from these n buffers. The buffer management unit 1012 can be any type of unit; for example, it can be an I-BufferManage (Instruction Buffer Manage).
[0087] In the embodiments of this application, the connection between the processing unit 1011, the counter generator 102, the memory 104, the buffer management unit 1012 and the instruction buffer 103 can be implemented in any connection manner. For example, the processing unit 1011, the counter generator 102, the memory 104, the buffer management unit 1012 and the instruction buffer 103 can all be connected by electrical connection or other communication methods.
[0088] The processor will now be described based on the above sections.
[0089] (1) Processing unit 1011: is used to receive a first acquisition request and send a query request to buffer management unit 1012 based on the first acquisition request. The query request carries the instruction storage address.
[0090] In this embodiment, the processing unit 1011 not only has the function of sending an instruction retrieval request to the memory 104, but also has the function of issuing a query instruction. After receiving the first retrieval request, in order to reduce the number of instruction retrieval requests sent to the memory 104 and thus reduce the number of accesses to the memory 104, the processing unit 1011 first generates a query request for querying the instruction based on the first retrieval request, and sends it to the buffer management unit 1012, so that the buffer management unit 1012 can query whether the instruction requested by the first retrieval request already exists in n instruction buffers 103.
[0091] The query request is used to check whether the instruction corresponding to the instruction storage address is stored in the n instruction buffers 103.
[0092] (2) Buffer management unit 1012: is used to receive query requests, and based on the query requests, to query from n instruction buffers 103; if the instruction corresponding to the instruction storage address is found in the first instruction buffer 1031, the instruction storage address and the corresponding instruction are copied to the second instruction buffer 1032.
[0093] In this embodiment, after receiving a query request, the buffer management unit 1012 can query from n instruction buffers 103 based on the instruction storage address carried in the query request to find which instruction buffer 103 stores the instruction storage address. The instruction buffer 103 storing the instruction storage address must store the instruction corresponding to the instruction storage address. If the instruction storage address is found to be stored in the first instruction buffer 1031, the instruction can be copied directly between the first instruction buffer 1031 and the second instruction buffer 1032. In this way, the instruction corresponding to the instruction storage address can be stored in the second instruction buffer 1032 to complete the response to the first acquisition request, while reducing the number of accesses to the memory 104.
[0094] In this embodiment of the application, the buffer management unit 1012 not only has the function of querying instructions from n instruction buffers 103, but also has the function of transferring data between the n instruction buffers 103.
[0095] In one possible implementation, the second instruction buffer 1032 stores a first-in-first-out (FIFO) queue, which stores at least one piece of information, each piece of information including a storage address and a corresponding instruction; the buffer management unit 1012 is used to copy the instruction storage address and the corresponding instruction to the tail of the FIFO queue when the instruction storage address is found in the first instruction buffer 1031.
[0096] In this embodiment, the instruction buffer 103 caches the instructions to be executed for the corresponding thread bundle through a maintained first-in-first-out queue. This ensures the order in which each instruction is executed, guarantees the accuracy of instruction execution, and thus ensures the performance of the processor.
[0097] In one possible implementation, the first acquisition request carries the identifier of the first counter generator 1021, and the processing module 101 stores the correspondence between the counter generator 102 and the instruction buffer 103. Then, the processing model is used to determine the identifier of the second instruction buffer 1032 based on the first acquisition request and the correspondence, and to generate a query request based on the first acquisition request and the identifier of the second instruction buffer 1032. The query request carries the instruction storage address and the identifier of the second instruction buffer 1032. The buffer management unit 1012 is used to copy the instruction storage address and the corresponding instruction in the first instruction buffer 1031 to the second instruction buffer 1032 indicated by the identifier in the query request when the instruction corresponding to the instruction storage address is found in the first instruction buffer 1031.
[0098] The identifier of the first counter generator 1021 is a unique identifier indicating the first counter generator 1021. This identifier can be represented in any form, for example, it can be represented as a number. The correspondence between the counter generator 102 and the instruction buffer 103 is the correspondence between the identifiers of n counter generators 102 and the identifiers of n instruction buffers 103. Therefore, by querying the correspondence using the identifier of the first counter generator 1021 in the first acquisition request, the identifier of the second instruction buffer 1032 corresponding to the first counter generator 1021 can be obtained.
[0099] In this embodiment, the query request carries not only the instruction storage address but also a second instruction buffer identifier. This allows the buffer management module to determine which instruction buffer needs the instruction corresponding to the instruction storage address based on the identifier carried in the query request. In this way, when the instruction corresponding to the instruction storage address is found in another instruction buffer, the instruction can be copied directly based on the identifier in the query request without waiting for instructions from other modules or units, thus ensuring the efficiency of instruction copying.
[0100] Optionally, the buffer management unit is used to query from n-1 instruction buffers 103 based on a query request, wherein the n-1 instruction buffers 103 are the instruction buffers 103 other than the second instruction buffer 1032 among the n instruction buffers 103.
[0101] In this embodiment, since the identifier carried by the query request indicates the second instruction buffer, that is, the second instruction buffer needs to store the instruction corresponding to the instruction storage address, it can also reflect that the second instruction buffer does not store the instruction corresponding to the instruction storage address. When querying from n instruction buffers, there is no need to query from the second instruction buffer, so only querying from n-1 instruction buffers is required. This reduces unnecessary querying processes, saves querying time, improves query efficiency, and thus improves instruction retrieval efficiency.
[0102] In one possible implementation, the first acquisition request carries the thread bundle identifier corresponding to the first counter generator 1021, and the processing module 101 stores the correspondence between thread bundles and instruction buffers 103. Then, the processing model is used to determine the identifier of the second instruction buffer 1032 based on the first acquisition request and the correspondence, and to generate a query request based on the first acquisition request and the identifier of the second instruction buffer 1032. The query request carries the instruction storage address and the identifier of the second instruction buffer 1032. The buffer management unit 1012 is used to copy the instruction storage address and the corresponding instruction in the first instruction buffer 1031 to the second instruction buffer 1032 indicated by the identifier in the query request when the instruction corresponding to the instruction storage address is found in the first instruction buffer 1031.
[0103] The thread bundle identifier is a unique identifier indicating the thread bundle, and this identifier can be represented in any form, such as a number. The correspondence between thread bundles and instruction buffers 103 is the correspondence between n thread bundle identifiers and n instruction buffer 103 identifiers. Therefore, by querying the correspondence using the identifier of the first counter generator 1021 in the first acquisition request, the identifier of the second instruction buffer 1032 corresponding to the first counter generator 1021 can be obtained.
[0104] In this embodiment, the query request carries not only the instruction storage address but also a second instruction buffer identifier. This allows the buffer management module to determine which instruction buffer needs the instruction corresponding to the instruction storage address based on the identifier carried in the query request. In this way, when the instruction corresponding to the instruction storage address is found in another instruction buffer, the instruction can be copied directly based on the identifier in the query request without waiting for instructions from other modules or units, thus ensuring the efficiency of instruction copying.
[0105] In one possible implementation, the identifiers of the counter generator 102 and the instruction buffer 103 corresponding to the same thread bundle are both thread bundle identifiers. The first acquisition request carries the thread bundle identifier corresponding to the first counter generator 1021, and the query request carries the instruction storage address and the thread bundle identifier. The buffer management unit 1012 is used to copy the instruction storage address and the corresponding instruction in the first instruction buffer 1031 to the second instruction buffer 1032 indicated by the thread bundle identifier in the query request when the instruction corresponding to the instruction storage address is found in the first instruction buffer 1031.
[0106] In this embodiment, for a counter generator and an instruction buffer corresponding to the same thread bundle, the identifier of the counter generator and the identifier of the instruction buffer are both thread bundle identifiers. This facilitates the management of the instruction buffer by the buffer management unit and ensures the accuracy of instruction copying.
[0107] In one possible implementation, the buffer management unit 1012 is further configured to send a query result to the processing unit 1011, the query result being the result of querying the instruction corresponding to the instruction storage address from the n instruction buffers 103. The processing unit 1011 is further configured to receive the query result.
[0108] In this embodiment, after the buffer management unit queries n instruction buffers based on the first fetch request, it obtains a query result indicating whether the instruction requested by the first fetch request is found in the instruction buffer. The query result is then sent to the processing unit so that the processing unit can further process according to the query result. This ensures the response to the first fetch request, guarantees the normal operation of the processor, and thus guarantees the performance of the processor. It also avoids the processing unit from waiting for a long time, ensuring the processing efficiency of the processor. Furthermore, it avoids the situation where the processing unit executes other fetch instructions, which would lead to duplicate instruction fetching, further guaranteeing the performance of the processor.
[0109] The query results include a first query result or a second query result. The first query result indicates that the instruction corresponding to the instruction storage address was found in the n instruction buffers 103, and the second query result indicates that the instruction corresponding to the instruction storage address was not found in the n instruction buffers 103.
[0110] Optionally, taking the example that the query result includes the first query result, after receiving the first query result, the processing unit 1011 will not perform any other operations on the first acquisition request.
[0111] In this embodiment of the application, after receiving the first query request, the processing unit 1011 can know that the instruction corresponding to the instruction storage address is stored in other instruction buffers 103. Then, it will no longer interact with the memory 104 to avoid the situation of repeated instruction acquisition caused by interacting with the memory 104. It also enables the processing unit 1011 to know that the response to the first acquisition request has been completed.
[0112] Optionally, the processing unit 1011 is further configured to send a first retrieval request to the memory 104 when the query result indicates that no instruction corresponding to the instruction storage address is found; the memory 104 is configured to receive the first retrieval request, read the instruction under the instruction storage address based on the first retrieval request, and send the instruction storage address and the instruction corresponding to the instruction storage address to the buffer management unit 1012; the buffer management unit 1012 is configured to receive the instruction storage address and the corresponding instruction, and write the instruction storage address and the corresponding instruction into the second instruction buffer 1032.
[0113] If the query result indicates that no instruction corresponding to the instruction storage address was found, then the query result is equivalent to the second query result.
[0114] In this embodiment, since the query result indicates that the instruction corresponding to the memory address is not found in the n instruction buffers, the processing unit interacts with the memory to retrieve the instruction at the memory address. Through the interaction between the memory and the buffer management unit, the buffer management unit writes the retrieved instruction into the second instruction buffer. In this way, even if the instruction requested by the first fetch request is not stored in the n instruction buffers, the corresponding instruction can still be provided to the second instruction buffer, ensuring that each thread bundle can be executed normally, thereby ensuring the performance of the processor.
[0115] In this embodiment, the processing module includes a processing unit and a buffer management unit. The processing unit is used to determine the subsequent execution logic based on the received instruction fetch request, that is, to instruct the buffer management unit to query the instruction buffer or access the memory to fetch the instruction from the memory. The buffer management unit can manage n instruction buffers. In this way, the process of processing the instruction fetch request can be decoupled from the process of managing the instruction buffer, so that the processing unit and the buffer management unit do not affect each other, ensuring the efficiency of the processing module in responding to the instruction fetch request, and thus ensuring the processing efficiency of the processor.
[0116] It should be noted that the above Figures 1 to 2 The illustrated embodiment is based on the example of finding the instruction corresponding to the instruction storage address from other instruction buffers 103. In another embodiment, the instruction may not be found, and the processor will interact with memory 104 to obtain the instruction. The processor will be described below based on the above-mentioned parts.
[0117] Processing module 101: Further configured to send a first fetch request to memory 104 if the instruction corresponding to the instruction storage address is not found. Memory 104: Configured to receive the first fetch request, read the instruction at the instruction storage address based on the first fetch request, and send the instruction corresponding to the instruction storage address to processing module 101. Processing module 101: Further configured to receive the instruction corresponding to the instruction storage address and write the instruction storage address and the corresponding instruction into the second instruction buffer 1032.
[0118] In this embodiment, since the instruction corresponding to the memory address is not found in the n instruction buffers, the processing module interacts with the memory to retrieve the instruction at the memory address and writes the retrieved instruction into the second instruction buffer. In this way, even if the instruction requested by the first fetch request is not stored in the n instruction buffers, the corresponding instruction can still be provided to the second instruction buffer, ensuring that each thread bundle can be executed normally, thereby ensuring the performance of the processor.
[0119] In the above Figures 1 to 2 Based on the illustrated embodiments, in this application embodiment, the processor further includes a request management module 105 and a broadcast module 106; as shown Figure 3 As shown, the processing module 101 is connected to the request management module 105 and the broadcast module 106 respectively, and the memory 104 is connected to the broadcast module 106.
[0120] In this embodiment, the request management module 105 records the interaction between the processing module 101 and the memory 104, using stored request information to represent instruction retrieval requests sent by the processing module 101 to the memory 104. The request management module 105 can be any type of module; for example, it can be a component with caching functionality. The broadcast module 106 records the instruction buffers 103 corresponding to each requested instruction retrieval request, using stored entry information to represent the instruction buffers 103 corresponding to each instruction retrieval request. The broadcast module 106 can be any type of module; for example, it can be a component with both caching and broadcasting functions. The connection between the processing module 101, the request management module 105, the broadcast module 106, and the memory 104 can be implemented using any connection method; for example, they can all be connected electrically or through other communication methods.
[0121] The processor will now be described based on the above sections.
[0122] (1) Request management module 105: used to store at least one request information, the request information includes a storage address, the request information indicates that the processing module 101 has sent an instruction to the memory 104 carrying the storage address to obtain the request.
[0123] In this embodiment of the application, each time the processing module 101 sends an instruction retrieval request to the memory 104, it generates a request information in the request management module 105. The request information indicates the instruction retrieval request that has been sent to the memory 104. In this way, the request management module 105 plays a recording role, recording the instruction retrieval requests sent by the processing module 101 to the memory 104.
[0124] In one possible implementation, the request information includes an indicator and a storage address. The indicator includes a first indicator or a second indicator. The first indicator indicates that the memory 104 has responded with an instruction at the storage address, and the second indicator indicates that the memory 104 has not responded with an instruction at the storage address.
[0125] In this embodiment, considering that after the processing module 101 sends an instruction fetch request to the memory 104, the memory 104 may respond to the instruction fetch request at any time, the request information not only records the storage address but also records an indicator to indicate whether the memory 104 has responded to the instruction fetch request corresponding to this request information. In this way, when the processing module 101 receives a new instruction fetch request, it can combine the indicator to merge the instruction fetch request, avoiding the situation where the new instruction fetch request is merged with the instruction fetch request of the already responded instruction, which would result in the inability to respond to the new instruction fetch request. This ensures that each thread can execute instructions normally, thereby ensuring the performance of the processor.
[0126] The first and second indicator identifiers can be represented in any form; for example, the first indicator identifier can be represented by "0" and the second indicator identifier by "1". Request information containing the first indicator identifier is invalid and cannot be used as the basis for querying new instructions. Request information containing the second indicator identifier is valid and can be used as the basis for querying new instructions.
[0127] Optionally, the request management module 105 includes a request list, which includes an identifier field and an address field. The identifier field is used to store an indication identifier, and the address field is used to store the storage address carried by the sent instruction retrieval request.
[0128] For example, the request table includes two columns: the first column is the identifier field and the second column is the address field. Each row in the request table represents a request message.
[0129] Optionally, in the request list, the requests are arranged in ascending order of the sending time of at least one request message obtained according to the corresponding instruction.
[0130] In this embodiment, the memory 104 processes the received instruction retrieval requests in the order of their receipt time, and the request list is also arranged in the order of their sending time, so as to ensure that the recorded request information is synchronized with the processing status of the memory 104.
[0131] (2) Broadcast module 106: used to store at least one entry information, the at least one entry information corresponds one-to-one with at least one request information, the entry information includes the identifier of at least one instruction buffer 103, and at least one instruction buffer 103 requests the instruction at the storage address in the request information.
[0132] In this embodiment, the broadcast module stores entry information corresponding to each request message to indicate which instruction buffers have requested the instruction requested by the instruction retrieval request that has been sent to the memory. This facilitates the subsequent combination of request information and entry information to accurately feed back the corresponding instruction to each instruction buffer, thereby ensuring the accuracy of instruction retrieval.
[0133] The identifier of instruction buffer 103 can be represented in any form. For example, the identifier can be represented by a numerical sequence number of each instruction buffer 103. For example, the identifier of instruction buffer 103 can be the instruction buffer 103 index (BufferIndex).
[0134] In one possible implementation, the broadcast module 106 stores a first-in-first-out queue, which stores at least one entry information. The at least one entry information is arranged in order of the sending time of the corresponding instruction retrieval request.
[0135] In this embodiment, the memory 104 processes received instruction retrieval requests in chronological order of receipt. The broadcast module 106 caches entry information through a maintained first-in-first-out queue to ensure that the recorded broadcast list is synchronized with the processing status of the memory 104, thereby ensuring the accuracy of subsequent instruction feedback.
[0136] Optionally, the broadcast module 106 stores a broadcast table, where each row in the broadcast table is an entry, and the entries in the broadcast table are arranged in order of the sending time of the corresponding instruction retrieval request.
[0137] In this embodiment, the memory 104 processes the received instruction retrieval requests in chronological order of receipt time, and the broadcast list is also arranged in chronological order of transmission time to ensure that the recorded broadcast list is synchronized with the processing status of the memory 104, thereby ensuring the accuracy of subsequent instruction feedback.
[0138] (3) Processing module 101: It is also used to query the request information stored in the request management module 105 based on the first acquisition request; if the first request information is found, the identifier of the second instruction buffer 1032 is added to the first entry information stored in the broadcast module 106, the storage address included in the first request information is the same as the instruction storage address, and the first entry information corresponds to the first request information.
[0139] In this embodiment, after receiving the first acquisition request, the processing module 101 queries the request information stored in the request management module 105 based on the instruction storage address carried in the first acquisition request to find which request information has the same storage address as the instruction storage address carried in the first acquisition request. If a storage address in a certain request information is found to be the same as the instruction storage address carried in the first acquisition request, it means that an instruction acquisition request for acquiring the instruction at that instruction storage address has already been sent to the memory 104, and there is no need to send it to the memory 104 again. Therefore, the processing module 101 no longer sends the first acquisition request to the memory 104, but instead updates the entry information corresponding to the request information so that when the memory 104 feeds back the instruction at that instruction storage address, it can accurately send the instruction to each instruction buffer 103 that has requested the instruction, thereby ensuring the accuracy of subsequent instruction feedback and thus ensuring the performance of the processor.
[0140] For example, if the first entry information before receiving the first acquisition request includes 3 identifiers, when the first request information is found, the identifiers of the second instruction buffer 1032 are added to the first entry information stored in the broadcast module 106, so that the first entry information at this time includes 4 identifiers.
[0141] In one possible implementation, the request information includes an indicator and a storage address. The indicator includes a first indicator or a second indicator. The first indicator indicates that the memory 104 has responded with an instruction at the storage address, and the second indicator indicates that the memory 104 has not responded with an instruction at the storage address. The processing module 101 is further configured to query the request information including the second indicator from the request management module 105 based on the first acquisition request; the first request information includes the second indicator.
[0142] In this embodiment of the application, for request information including the first indicator, the memory 104 has already responded with an instruction to the instruction retrieval request corresponding to the request information. Even if the storage address in these request information is the same as the instruction storage address carried by the first retrieval request, merging the first retrieval request with the instruction retrieval request corresponding to these request information would result in the inability to respond to the first retrieval request subsequently. Therefore, it is sufficient to query from the request information including the second indicator, which avoids an invalid query process, ensures query efficiency, and also ensures that the first retrieval request can be responded to subsequently, thereby ensuring the performance of the processor.
[0143] Optionally, the request management module 105 is used to delete the request information including the first indicator when the indicator in any request information is updated from the second indicator to the first indicator.
[0144] In this embodiment, since the request information including the first indicator indicates that the memory 104 has obtained the request feedback instruction corresponding to the request information, the request management module 105 deletes the request information including the first indicator, so that the request management model only stores the request information including the second indicator. In this way, when the subsequent processing module 101 receives a new instruction acquisition request, it can directly query from the request information in the request management module 105 without having to filter from the request information stored in the request management module 105. This ensures query efficiency and avoids the situation where the queried request information includes the first indicator, thus ensuring the accuracy of the query and, consequently, the accuracy of subsequent instruction acquisition.
[0145] (4) Memory 104: Used to send an instruction corresponding to the instruction storage address to the processing module 101 based on the second acquisition request. The second acquisition request is sent by the second counter generator 102. The second counter generator 102 is any one of the n counter generators 102 except the first counter generator 1021. The second acquisition request carries the instruction storage address.
[0146] In this embodiment, the second acquisition request refers to a request sent by the second counter generator 102 to the processing module 101 before the processing module 101 receives the first acquisition request, and then forwarded by the processing module 101 to the memory 104. Furthermore, the second acquisition request carries the same memory address as the first acquisition request. After receiving the second acquisition request, the memory 104 processes it to read the instruction according to the memory address carried in the second acquisition request, and returns the read instruction to the processing module 101 so that the subsequent processing module 101 can feed the instruction back to the corresponding instruction buffer 103.
[0147] The first request information in the request management module 105 is generated by the processing module 101 after receiving the second acquisition request sent by the second counter generator 102.
[0148] For example, after receiving the second acquisition request, the processing module 101, following the above query process, does not find any request information including the instruction storage address in the request management module 105. In this case, the request management module 105 generates the first request information and sends the second acquisition request to the memory 104.
[0149] In one possible implementation, if the request information in the request management module 105 includes an indication identifier, then the memory 104 is further configured to send a feedback notification to the processing module 101, the feedback notification indicating that feedback has been received based on the second instruction to obtain request feedback. The processing module 101 is further configured to receive the feedback notification and, based on the feedback notification, update the indication identifier of the first request information in the request management module 105 to a first indication identifier.
[0150] In this embodiment, after the memory 104 sends the instruction corresponding to the second acquisition request to the processing module 101, it also sends a feedback notification to the processing module 101 so that the processing module 101 can update the first request information in the request management module 105 based on the feedback notification, so as to update the second indicator in the first request information to the first indicator, thereby invalidating the first request information and preventing the first request information from being used as the basis for querying subsequent new instruction acquisition requests. This ensures the accuracy of the request information in the request management module 105 and also ensures the accuracy of processing subsequent instruction acquisition requests.
[0151] Optionally, the processing module 101 is configured to: send an update notification to the request management module 105 based on the feedback notification, wherein the update notification instructs the indicator of the first request information to be updated to the first indicator. The request management module 105 is configured to: receive the update notification and, based on the update notification, update the indicator of the first request information to the first indicator.
[0152] In this embodiment of the application, the processing module 101 interacts with the request management module 105 to update the request information in the request management module 105, so as to ensure the accuracy of the update.
[0153] (5) Processing module 101: It is also used to receive the instruction corresponding to the instruction storage address, obtain the first entry information from the broadcast module 106, and write the instruction storage address and the corresponding instruction into the instruction buffer 103 indicated by the first entry information based on the first entry information.
[0154] In this embodiment of the application, when the processing module 101 receives the instruction corresponding to the first request information, since the first entry information indicates each instruction buffer 103 requesting the instruction, it obtains the first entry information from the broadcast module 106, and then, in combination with the first entry information, writes the instruction storage address and the corresponding instruction into the instruction buffer 103 indicated by the first entry information.
[0155] Since the identifier of the second instruction buffer 1032 has been added to the first entry information, the instruction buffer 103 indicated by the first entry information includes the second instruction buffer 1032, and may also include other instruction buffers 103.
[0156] In this embodiment, since different counter generators may send instruction fetch requests to the processing module to request a certain instruction from memory, and considering that the requested instructions may be the same, the request management module and broadcast module in the processor can record the instruction fetch requests sent by the processing module to the memory. This allows the processing module to merge instruction fetch requests for the same instruction after receiving them, and send only one instruction fetch request to the memory. This avoids sending multiple instruction fetch requests for the same instruction to the memory, reduces the number of times instruction fetch requests are sent to the memory, thereby reducing the number of memory accesses, reducing processor power consumption, and ensuring processor performance.
[0157] In the above Figure 3 Based on the illustrated embodiment, in this embodiment of the application, the memory 104 transmits instructions to the processing module 101 through the broadcast module 106. The processor is described below. (1) Memory 104: is used to send the instruction corresponding to the instruction storage address to the broadcast module 106 based on the second acquisition request; (2) Broadcast module 106: is used to receive the instruction corresponding to the instruction storage address and send the first entry information and the instruction corresponding to the instruction storage address to the processing module 101; (3) Processing module 101: is also used to write the instruction storage address and the corresponding instruction into the instruction buffer 103 indicated by the first entry information based on the first entry information.
[0158] In this embodiment, the memory is connected to the broadcast module. After the memory receives an instruction in response to an instruction fetch request, it sends the fetched instruction to the broadcast module. This allows the broadcast module to extract the first entry information from its stored entry information and transmit the extracted first entry information and the instruction corresponding to the instruction storage address to the processing module. This is equivalent to the memory transmitting the instruction to the processing module. This ensures that the processing module directly obtains the entry information and the instruction, avoiding unnecessary operations caused by the processing module actively retrieving the entry information from the broadcast module after obtaining the instruction. This ensures the efficiency of the processing module in obtaining the entry information and the instruction, thereby guaranteeing the processor's performance.
[0159] In this embodiment of the application, the processing module 101 includes a processing unit 1011 and a buffer management unit 1012, such as... Figure 4 As shown, the processing unit 1011 is connected to each counter generator 102, memory 104, buffer management unit 1012, request management module 105 and broadcast module 106 respectively. The buffer management unit 1012 is connected to each instruction buffer 103 and broadcast module 106 respectively. The memory 104 is connected to the broadcast module 106. The processor will be described below based on the above parts.
[0160] (1) Processing unit 1011: Based on the first acquisition request, it queries the request information stored in the request management module 105; if the first request information is found, it adds the identifier of the second instruction buffer 1032 to the first entry information stored in the broadcast module 106.
[0161] (2) Memory 104: Used to send the instruction storage address and the corresponding instruction to the broadcast module 106 based on the second acquisition request, and to send a feedback notification to the processing unit 1011.
[0162] In this embodiment, the memory 104 is connected to the broadcast module 106. After the memory 104 obtains an instruction in response to an instruction fetch request, it sends the obtained instruction to the broadcast module 106, so that the broadcast module 106 transmits the instruction to the buffer management unit 1012. This is equivalent to the memory 104 transmitting the instruction to the processing module 101. Furthermore, the memory 104 also sends a feedback notification to the processing unit 1011, so that the subsequent processing unit 1011 can update the first request information in the request management module 105 based on the feedback notification.
[0163] (3) Processing unit 1011: It is also used to receive feedback notification and update the indicator of the first request information in the request management module 105 to the first indicator based on the feedback notification.
[0164] (4) Broadcast module 106: used to receive the instruction storage address and the corresponding instruction, extract the stored first entry information, and send the first entry information, instruction storage address and the corresponding instruction to the buffer management unit 1012.
[0165] In this embodiment, after receiving the instruction corresponding to the instruction storage address, the broadcast module 106 can extract the first entry information from the entry information stored in itself, and send the first entry information and the instruction corresponding to the instruction storage address to the buffer management unit 1012. At this time, the broadcast module 106 no longer stores the first entry information, so as to ensure that when it receives a new instruction sent by the memory 104 in the future, it can obtain the corresponding entry information and ensure the accuracy of the extracted entry information.
[0166] In one possible implementation, the broadcast module 106 stores a first-in-first-out (FIFO) queue, which contains at least one entry. These entries are arranged in ascending order of the sending time of the corresponding instruction retrieval request. The broadcast module 106 retrieves the first entry from the FIFO queue each time. Specifically, when an instruction corresponding to the instruction storage address is received, the first entry is placed at the head of the FIFO queue.
[0167] In this embodiment, the memory 104 processes received instruction retrieval requests in chronological order of receipt. The broadcast module 106 maintains a first-in-first-out queue to cache entry information, ensuring that the recorded broadcast list is synchronized with the processing status of the memory 104. This ensures that the entry information extracted from the first-in-first-out queue each time the broadcast module 106 receives an instruction corresponds to the received instruction, thereby guaranteeing the accuracy of subsequent instruction feedback.
[0168] (5) Buffer management unit 1012: used to receive the first entry information, the instruction storage address and the corresponding instruction, and write the instruction storage address and the corresponding instruction into the instruction buffer 103 indicated by the first entry information based on the first entry information.
[0169] In this embodiment, the processing module 101 includes a processing unit 1011 and a buffer management unit 1012. The processing unit 1011 is used to determine the subsequent execution logic based on the received instruction fetch request, that is, to query the request management module 105 or access the memory 104 to fetch the instruction from the memory 104. The buffer management unit 1012 can manage n instruction buffers 103. In this way, the process of processing the instruction fetch request can be decoupled from the process of managing the instruction buffers 103, so that the processing unit 1011 and the buffer management unit 1012 do not affect each other, ensuring the response efficiency of the processing module 101 to the instruction fetch request, and thus ensuring the processing efficiency of the processor.
[0170] In the above Figure 3 Based on the illustrated embodiment, the processing module 101 and the broadcast module 106 interact to update the entry information. The processor is described below. (1) Processing module 101: It is also used to send an entry update request to the broadcast module 106 when the first request information is found. The entry update request indicates that the entry information corresponding to the first request information should be updated. (2) Broadcast module 106: It is used to receive the entry update request and add the identifier of the second instruction buffer 1032 to the first entry information based on the entry update request.
[0171] In this embodiment, the processing module 101 interacts with the broadcast module 106 to update the entry information in the broadcast module 106, enabling the broadcast module to independently manage the stored entry information and ensure synchronization with the request information in the request management module, thereby ensuring the accuracy of the entry information update and thus ensuring the performance of the processor.
[0172] It should be noted that the above Figures 3 to 4The illustrated embodiment is based on the example of querying the first request information that includes the instruction storage address carried by the first acquisition request. In another embodiment, the request information in the request management module 105 does not include the instruction storage address. The processor will be described below.
[0173] (1) Processing module 101: It is also used to add a second request information in the request management module 105, send a first acquisition request to the memory 104, and add a second entry information corresponding to the second request information in the broadcast module 106 when no request information including the instruction storage address is found. The second request information includes the instruction storage address and the second entry information includes the identifier of the second instruction buffer 1032.
[0174] (2) Memory 104: Used to receive the first acquisition request and send the instruction corresponding to the instruction storage address to the processing module 101 based on the first acquisition request.
[0175] (3) Processing module 101: It is also used to receive the instruction corresponding to the instruction storage address, obtain the second entry information from the broadcast module 106, and write the instruction storage address and the corresponding instruction into the instruction buffer 103 indicated by the second entry information based on the second entry information.
[0176] In this embodiment, after receiving the first acquisition request, if the request information in the request management module 105 does not include the instruction storage address, it means that the processing module 101 has not sent an instruction acquisition request carrying the instruction storage address to the memory 104. Therefore, the processing module 101 sends the first acquisition request to the memory 104, generates new request information in the request management module 105, and generates new entry information in the broadcast module 106. This ensures that after the memory 104 returns the instruction based on the first acquisition request, it can combine the second entry information to return the instruction to the corresponding instruction buffer 103. It also ensures that before receiving the instruction returned by the memory 104 based on the first acquisition request, if other instruction acquisition requests carrying the instruction storage address are received, these requests can be merged with the first acquisition request. Only the second entry information needs to be updated as shown in the above embodiment, thereby reducing the number of accesses to the memory 104, reducing processor power consumption, and ensuring processor performance.
[0177] In one possible implementation, processing module 101 is further configured to, if no request information including the instruction storage address is found, send a first retrieval request to memory 104, a first add request to request management module 105, and a second add request to broadcast module 106. The first add request indicates the addition of request information in response to the first retrieval request, and the second add request indicates the addition of entry information corresponding to the first retrieval request. Request management module 105 is configured to receive the first add request and, based on the first add request, add second request information in request management module 105. Broadcast module 106 is configured to receive the second add request and, based on the second add request, add second entry information corresponding to the second request information in broadcast module 106.
[0178] In this embodiment, the processing module 101 interacts with the broadcast module 106 and the request management module 105 respectively, so that the broadcast model can add and store entry information, and the request management module 105 can add and store request information, so as to ensure that the first acquisition request can be responded to accurately in the future and to ensure the performance of the processor.
[0179] Based on the embodiments shown above, the processor in this application embodiment further includes an instruction issue arbiter, which is connected to each instruction buffer 103 and to the instruction execution unit occupied by each thread bundle. The processor will now be described based on the above components. The instruction issue arbiter is used to retrieve an instruction from any instruction buffer 103 and send the instruction to the instruction execution unit corresponding to that instruction buffer 103, so that the instruction execution unit executes the instruction.
[0180] The instruction execution unit (IPU) is the hardware module in the processor that actually executes instructions. The IPU executes instructions to perform corresponding calculations and operations. The IPU can be any type of execution unit; for example, it can be an arithmetic logic unit (ALU), a floating-point unit, etc.
[0181] In this embodiment, each instruction buffer 103 stores instructions to be executed for the corresponding thread bundle. The instruction issuing arbitrator can read instructions from the instruction buffer 103 and forward them to the corresponding instruction execution unit so that the subsequent instruction execution unit can execute the corresponding instructions, ensuring that each thread bundle can execute instructions normally, thereby ensuring the performance of the processor.
[0182] In one possible implementation, an instruction issuing arbitrator is used to retrieve instructions from either instruction buffer 103 in a polling manner.
[0183] For example, for n instruction buffers 103, the instruction issuing arbitrator retrieves an instruction from the first instruction buffer 103 and forwards it to the corresponding instruction execution unit. Then, the instruction issuing arbitrator retrieves an instruction from the second instruction buffer 103 and forwards it to the corresponding instruction execution unit, and so on, with the instruction issuing arbitrator retrieving an instruction from the nth instruction buffer 103 and forwarding it to the corresponding instruction execution unit.
[0184] It should be noted that the various optional embodiments shown above can be combined in any way. For example, the processor includes a processing module, n counter generators, n instruction buffers, a memory, a request management module, a broadcast module, and an instruction issue arbitrator. The processing module includes processing units and a buffer management unit. Taking a program counter generator as the counter generator, a query update unit as the processing unit, a request management module storing a request list, a broadcast module storing a broadcast list and broadcast units, an instruction buffer module storing a first-in-first-out queue, and an instruction cache as an example, the processor structure is as follows: Figure 5 As shown, the query update unit is connected to each counter generator, request management module, buffer management unit, broadcast unit, and instruction cache, respectively. The buffer management unit is connected to the broadcast unit and each instruction buffer, respectively. The instruction issuance arbitrator is connected to each instruction buffer and the instruction execution unit corresponding to each instruction buffer. In this embodiment, the connection between the instruction cache and the broadcast unit is equivalent to the connection between the instruction cache and the broadcast module, and the connection between the broadcast unit and the instruction buffer is equivalent to the connection between the broadcast module and the instruction buffer.
[0185] (1) Taking the first program counter generator sending a first acquisition request to the query update unit and the first acquisition request carrying instruction storage address 1 as an example, the query update unit is used to: after receiving the first acquisition request, perform a query from the request information stored in the request management module based on the first acquisition request; at the same time, send a query request to the buffer management unit based on the first acquisition request.
[0186] In this embodiment of the application, after receiving the first fetch request, the processor unit not only queries the request information stored in the request management module, but also sends a query request to the buffer management unit so as to be able to query whether the first fetch request can be merged with the previous instruction fetch request, and also to determine whether the instruction requested by the first fetch request exists in other instruction buffers.
[0187] (2) Buffer management unit: used to receive query requests, and based on the query requests, query from n instruction buffers; if instruction storage address 1 is found in instruction buffer 1, send the first query result to the query update unit, and copy instruction storage address 1 and the corresponding instruction from instruction buffer 1 to instruction buffer 2.
[0188] In this embodiment, the example given is that the buffer management unit queries the instruction corresponding to the first fetch request from other instruction buffers. The processor's processing flow is as follows: Figure 6 As shown. Instruction buffer 1 is equivalent to the first instruction buffer in the above embodiment, and instruction buffer 2 is equivalent to the second instruction buffer in the above embodiment. After receiving the first query result, the query update unit determines that the first retrieval request has been responded to and will not send the first retrieval request to the instruction cache again.
[0189] (3) Processor Unit: Used to send an entry update request to the broadcast module when the request list included in the request management module contains the first request information including instruction storage address 1. The entry update request indicates that the entry information corresponding to the first request information should be updated. Broadcast Module: Used to receive the entry update request and add the buffer index of instruction buffer 2 to the first entry information based on the entry update request. Taking the first entry information originally including the buffer index of instruction buffer 3 (i.e., 3) as an example, the updated first entry information includes the buffer index of instruction buffer 2 (i.e., 2) and the buffer index of instruction buffer 3 (i.e., 3). Broadcast Module: Also used to extract the first entry information from the broadcast list after receiving the instruction cache's instruction retrieval request for the first request information and the instruction storage address 1 and the corresponding instruction, and send the first entry information, instruction storage address 1 and the corresponding instruction to the buffer management unit. Buffer Management Unit: Used to receive the first entry information, instruction storage address and the corresponding instruction, and write the instruction storage address and the corresponding instruction into instruction buffer 2 and instruction buffer 3 based on the first entry information.
[0190] In this embodiment of the application, the processing flow of the processor is described as follows, taking the retrieval of the first request information from the request list as an example. Figure 7 As shown, after the processor unit retrieves the first request information from the request management module, it no longer sends the first fetch request to the instruction cache. Instead, it adds the buffer index of the second instruction buffer to the first entry information. This is equivalent to merging the first fetch request with the instruction fetch request indicated by the first request information, thereby reducing the number of instruction fetch requests sent to the instruction cache and thus reducing the number of accesses to the instruction cache.
[0191] It should be noted that the buffer management unit is used to send a second query result to the query update unit when the instruction corresponding to instruction storage address 1 is found from the n instruction buffers.
[0192] The query update unit is further configured to, upon receiving the second query result and finding no request information including instruction storage address 1 in the request list, send a first retrieval request to the instruction cache, generate new request information to be added to the request list, and generate new entry information corresponding to the new request information in the broadcast module. The new entry information includes the buffer index of instruction buffer 2. Then, after the instruction cache returns an instruction based on the first retrieval request, the instruction is written into the corresponding instruction buffer according to the new entry information via the broadcast module and the buffer management unit, as shown in the above embodiment.
[0193] It should be noted that the processor provided in this application embodiment can be any processor, for example, a processor under the SIMT (Single Instruction Multi Thread) architecture. During the execution of tasks by this processor, multiple threads can be driven to work by a single instruction, and each thread can process different data, realizing parallel processing at the data level and improving the parallelism of data processing.
[0194] This application provides a processor for SIMT architecture that can reduce the number of instruction fetches. It can adopt methods such as instruction copying between instruction buffers or instruction fetch request merging to avoid repeated access to the instruction cache, reduce the number of requests sent to the instruction cache, thereby reducing the number of accesses to the instruction cache, improving instruction fetch performance, reducing processor power consumption during instruction fetching, and ensuring processor processing efficiency, thereby improving processor performance.
[0195] Figure 8 This is a schematic diagram of the structure of an instruction fetching method provided in an embodiment of this application. The method is executed by the processor shown in the above embodiment. The processor includes a processing module, n counter generators, n instruction buffers, and a memory. The processing module is connected to each counter generator, each instruction buffer, and the memory. The n instruction buffers are used to store the instructions to be executed for the corresponding thread bundle and the storage addresses of the instructions in the memory. Each of the n counter generators and n instruction buffers corresponds one-to-one with one of the n thread bundles, where n is an integer greater than 1. Figure 8 As shown, the method includes:
[0196] 801. The first counter generator among the n counter generators sends a first retrieval request to the processing module. The first retrieval request carries the instruction storage address. The instruction storage address is the storage address in memory of the instruction to be executed by the corresponding thread. The first counter generator is any one of the n counter generators.
[0197] 802. The processing module receives a first acquisition request and, based on the first acquisition request, queries from n instruction buffers. If the instruction corresponding to the instruction storage address is found in the first instruction buffer, the instruction storage address and the corresponding instruction are copied to the second instruction buffer. The second instruction buffer corresponds to the first counter generator and is in the same thread bundle. The first instruction buffer is any one of the n instruction buffers except the second instruction buffer.
[0198] In the solution provided in this application embodiment, the processor includes a processing module, a memory, a counter generator corresponding to n thread bundles, and an instruction buffer corresponding to n thread bundles. When any counter generator requests an instruction at a certain memory address, considering that the instruction may already exist in the n instruction buffers, the processing module, based on the memory address, first queries the n instruction buffers to check whether the instruction exists in a certain instruction buffer. If the instruction is found, it only needs to be copied between the instruction buffers. This eliminates the need to access the memory again to obtain the instruction at the memory address, reducing the number of memory accesses, saving processor power consumption, and thus improving processor performance. At the same time, it eliminates the need to access the memory again to store the instruction in the corresponding instruction buffer, reducing unnecessary data transfer and ensuring instruction fetching efficiency.
[0199] In one possible implementation, the processing module includes a processing unit and a buffer management unit. The processing unit is connected to each counter generator, the memory, and the buffer management unit, respectively. The buffer management unit is connected to each instruction buffer. The processing module receives a first fetch request and, based on the first fetch request, queries from n instruction buffers. If the instruction corresponding to the instruction storage address is found in the first instruction buffer, the instruction storage address and the corresponding instruction are copied to the second instruction buffer, including:
[0200] The processing unit receives a first acquisition request and, based on the first acquisition request, sends a query request to the buffer management unit, the query request carrying the instruction storage address;
[0201] The buffer management unit receives a query request and, based on the query request, queries from n instruction buffers. If the instruction corresponding to the instruction storage address is found in the first instruction buffer, the instruction storage address and the corresponding instruction are copied to the second instruction buffer.
[0202] In another possible implementation, after querying from n instruction buffers based on the query request, the method further includes:
[0203] The buffer management unit sends a query result to the processing unit. The query result is the result of querying the instruction storage address corresponding to the instruction from n instruction buffers.
[0204] The processing unit receives the query results.
[0205] In another possible implementation, after the processing unit receives the query result, the method further includes:
[0206] If the query result indicates that the instruction corresponding to the instruction storage address is not found, the processing unit sends a first retrieval request to the memory;
[0207] The memory receives a first fetch request, reads the instruction at the instruction storage address based on the first fetch request, and sends the instruction storage address and the instruction corresponding to the instruction storage address to the buffer management unit.
[0208] The buffer management unit receives the instruction storage address and the corresponding instruction, and writes the instruction storage address and the corresponding instruction into the second instruction buffer.
[0209] In another possible implementation, after querying from n instruction buffers based on the first fetch request, the method further includes:
[0210] If the processing module does not find the instruction corresponding to the instruction storage address, it sends a first retrieval request to the memory;
[0211] The memory receives a first acquisition request, reads the instruction at the instruction storage address based on the first acquisition request, and sends the instruction corresponding to the instruction storage address to the processing module.
[0212] The processing module receives the instruction corresponding to the instruction storage address and writes the instruction storage address and the corresponding instruction into the second instruction buffer.
[0213] In another possible implementation, the processor further includes a request management module and a broadcast module; the processing module is connected to the request management module and the broadcast module respectively, and the memory is connected to the broadcast module; the request management module is used to store at least one request message, the request message including a memory address, the request message indicating that the processing module has sent an instruction retrieval request to the memory carrying the memory address; the broadcast module is used to store at least one entry message, the at least one entry message corresponding one-to-one with at least one request message, the entry message including an identifier of at least one instruction buffer, the at least one instruction buffer requesting the instruction at the memory address in the request message; after receiving the first retrieval request, the method further includes:
[0214] Based on the first acquisition request, the processing module queries the request information stored in the request management module; if the first request information is found, the processing module adds the identifier of the second instruction buffer to the first entry information stored in the broadcast module. The storage address included in the first request information is the same as the instruction storage address, and the first entry information corresponds to the first request information.
[0215] Based on the second fetch request, the memory sends an instruction corresponding to the instruction storage address to the processing module. The second fetch request is sent by the second counter generator, which is any one of the n counter generators except the first counter generator. The second fetch request carries the instruction storage address.
[0216] The processing module receives the instruction corresponding to the instruction storage address and obtains the first entry information from the broadcast module; based on the first entry information, it writes the instruction storage address and the corresponding instruction into the instruction buffer indicated by the first entry information.
[0217] In another possible implementation, upon retrieving the first request information, an identifier for the second instruction buffer is added to the first entry information stored in the broadcast module, including:
[0218] Upon finding the first request information, the processing module sends an entry update request to the broadcast module. The entry update request instructs that the entry information corresponding to the first request information be updated.
[0219] The broadcast module receives an entry update request and, based on the entry update request, adds the identifier of the second instruction buffer to the first entry information.
[0220] In another possible implementation, the processing module includes a processing unit and a buffer management unit. The processing unit is connected to each counter generator, the memory, the buffer management unit, the request management module, and the broadcast module, respectively. The buffer management unit is connected to each instruction buffer and the broadcast module, respectively. Based on a first acquisition request, the processing module queries the request information stored in the request management module. If the first request information is found, an identifier for the second instruction buffer is added to the first entry information stored in the broadcast module, including:
[0221] The processing unit queries the request information stored in the request management module based on the first acquisition request; if the first request information is found, the processing unit adds the identifier of the second instruction buffer to the first entry information.
[0222] Based on the second acquisition request, the memory sends the instruction storage address and the corresponding instruction to the broadcast module;
[0223] The broadcast module receives the instruction storage address and the corresponding instruction, and sends the first entry information, the instruction storage address and the corresponding instruction to the buffer management unit.
[0224] Based on the first entry information, the instruction storage address and the corresponding instruction are written into the instruction buffer indicated by the first entry information, including:
[0225] Based on the first entry information, the buffer management unit writes the instruction storage address and the corresponding instruction into the instruction buffer indicated by the first entry information.
[0226] In another possible implementation, the memory sends an instruction corresponding to the instruction storage address to the processing module based on the second fetch request, including:
[0227] Based on the second acquisition request, the memory sends the instruction corresponding to the instruction storage address to the broadcast module;
[0228] The broadcast module receives the instruction corresponding to the instruction storage address and sends the first entry information and the instruction corresponding to the instruction storage address to the processing module.
[0229] In another possible implementation, the request information includes an indicator and a storage address. The indicator includes a first indicator or a second indicator. The first indicator indicates that the memory has responded with an instruction at the storage address, and the second indicator indicates that the memory has not responded with an instruction at the storage address. The processing module, based on the first acquisition request, queries the request information stored in the request management module, including:
[0230] The processing module queries the request information, which includes a second indicator, from the request management module based on the first acquisition request; the first request information includes the second indicator.
[0231] In another possible implementation, after the memory sends the instruction corresponding to the instruction storage address to the processing module based on the second fetch request, the method further includes:
[0232] The memory sends a feedback notification to the processing module, indicating that the instruction to receive feedback based on the second acquisition request has been received;
[0233] The processing module receives feedback notifications and, based on these notifications, updates the indicator of the first request information in the request management module to the first indicator.
[0234] In another possible implementation, after the processing module queries the request information stored in the request management module based on the first acquisition request, the method further includes:
[0235] If the processing module does not find the request information including the instruction storage address, it adds a second request information to the request management module, sends a first acquisition request to the memory, and adds a second entry information corresponding to the second request information to the broadcast module. The second request information includes the instruction storage address, and the second entry information includes the identifier of the second instruction buffer.
[0236] It should be noted that the instruction acquisition method provided in the above embodiments and the processor embodiments belong to the same concept, and the specific implementation process can be found in the method embodiments, which will not be repeated here.
[0237] This application also provides a computer device that includes the processor shown in the above embodiments.
[0238] Optionally, the computer device is provided as a terminal. Figure 9 A structural block diagram of a terminal 900 provided in an exemplary embodiment of this application is shown. The terminal 900 includes a processor 901 and a memory 902.
[0239] Processor 901 may include one or more processing cores, such as a quad-core processor, an octa-core processor, etc. Processor 901 may be implemented using at least one hardware form selected from DSP (Digital Signal Processing), FPGA (Field-Programmable Gate Array), and PLA (Programmable Logic Array). Processor 901 may also include a main processor and a coprocessor. The main processor, also known as a CPU (Central Processing Unit), is used to process data in the wake-up state; the coprocessor is a low-power processor used to process data in the standby state. In some embodiments, processor 901 may integrate a GPU (Graphics Processing Unit), which is responsible for rendering and drawing the content required to be displayed on the screen. In some embodiments, processor 901 may also include an AI (Artificial Intelligence) processor, which is used to handle computational operations related to machine learning.
[0240] The memory 902 may include one or more computer-readable storage media, which may be non-transitory. The memory 902 may also include high-speed random access memory and non-volatile memory, such as one or more disk storage devices or flash memory devices. In some embodiments, the non-transitory computer-readable storage media in the memory 902 are used to store at least one computer program, which is executed by the processor 901 to implement the instruction fetching method provided in the method embodiments of this application.
[0241] In some embodiments, the terminal 900 may also optionally include a peripheral device interface 903 and at least one peripheral device. The processor 901, memory 902, and peripheral device interface 903 can be connected via a bus or signal line. Each peripheral device can be connected to the peripheral device interface 903 via a bus, signal line, or circuit board. Specifically, the peripheral device includes at least one of the following: a radio frequency circuit 904, a display screen 905, a camera assembly 906, an audio circuit 907, and a power supply 908.
[0242] Peripheral device interface 903 can be used to connect at least one I / O (Input / Output) related peripheral device to processor 901 and memory 902. In some embodiments, processor 901, memory 902 and peripheral device interface 903 are integrated on the same chip or circuit board; in some other embodiments, any one or two of processor 901, memory 902 and peripheral device interface 903 can be implemented on separate chips or circuit boards, which is not limited in this embodiment.
[0243] The radio frequency (RF) circuit 904 is used to receive and transmit RF (Radio Frequency) signals, also known as electromagnetic signals. The RF circuit 904 communicates with communication networks and other communication devices via electromagnetic signals. The RF circuit 904 converts electrical signals into electromagnetic signals for transmission, or converts received electromagnetic signals back into electrical signals. Optionally, the RF circuit 904 includes: an antenna system, an RF transceiver, one or more amplifiers, a tuner, an oscillator, a digital signal processor, a codec chipset, a user identity module card, etc. The RF circuit 904 can communicate with other terminals through at least one wireless communication protocol. This wireless communication protocol includes, but is not limited to: the World Wide Web, metropolitan area networks, intranets, various generations of mobile communication networks (2G, 3G, 4G, and 5G), wireless local area networks, and / or WiFi (Wireless Fidelity) networks. In some embodiments, the RF circuit 904 may also include circuitry related to NFC (Near Field Communication), which is not limited in this application.
[0244] Display screen 905 is used to display a UI (User Interface). This UI may include graphics, text, icons, videos, and any combination thereof. When display screen 905 is a touch display screen, it also has the ability to collect touch signals on or above its surface. These touch signals can be input as control signals to processor 901 for processing. In this case, display screen 905 can also be used to provide virtual buttons and / or a virtual keyboard, also known as soft buttons and / or a soft keyboard. In some embodiments, there may be one display screen 905, disposed on the front panel of terminal 900; in other embodiments, there may be at least two display screens 905, disposed on different surfaces of terminal 900 or in a folded design; in other embodiments, display screen 905 may be a flexible display screen, disposed on a curved or folded surface of terminal 900. Furthermore, display screen 905 may be configured as a non-rectangular irregular shape, i.e., a non-rectangular screen. Display screen 905 may be made of materials such as LCD (Liquid Crystal Display) or OLED (Organic Light-Emitting Diode).
[0245] The camera assembly 906 is used to acquire images or videos. Optionally, the camera assembly 906 includes a front-facing camera and a rear-facing camera. The front-facing camera is disposed on the front panel of the terminal, and the rear-facing camera is disposed on the back of the terminal. In some embodiments, there are at least two rear-facing cameras, which are any one of a main camera, a depth-sensing camera, a wide-angle camera, and a telephoto camera, to achieve background blurring by fusion of the main camera and the depth-sensing camera, panoramic shooting by fusion of the main camera and the wide-angle camera, VR (Virtual Reality) shooting, or other fusion shooting functions. In some embodiments, the camera assembly 906 may also include a flash. The flash may be a single-color temperature flash or a dual-color temperature flash. A dual-color temperature flash refers to a combination of a warm light flash and a cool light flash, which can be used for light compensation at different color temperatures.
[0246] The audio circuit 907 may include a microphone and a speaker. The microphone is used to collect sound waves from the user and the environment, converting them into electrical signals that are input to the processor 901 for processing, or to the radio frequency circuit 904 for voice communication. For stereo sound acquisition or noise reduction purposes, multiple microphones may be used, each positioned at a different location on the terminal 900. The microphone may also be an array microphone or an omnidirectional microphone. The speaker is used to convert electrical signals from the processor 901 or the radio frequency circuit 904 into sound waves. The speaker may be a conventional diaphragm speaker or a piezoelectric ceramic speaker. When the speaker is a piezoelectric ceramic speaker, it can convert electrical signals not only into audible sound waves but also into inaudible sound waves for purposes such as distance measurement. In some embodiments, the audio circuit 907 may also include a headphone jack.
[0247] Power supply 908 is used to power the various components in terminal 900. Power supply 908 can be AC power, DC power, a disposable battery, or a rechargeable battery. When power supply 908 includes a rechargeable battery, the rechargeable battery can be a wired rechargeable battery or a wireless rechargeable battery. A wired rechargeable battery is a battery that is charged via a wired line, while a wireless rechargeable battery is a battery that is charged via a wireless coil. The rechargeable battery can also be used to support fast charging technology.
[0248] Those skilled in the art will understand that Figure 9 The structure shown does not constitute a limitation on terminal 900 and may include more or fewer components than shown, or combine certain components, or use different component arrangements.
[0249] Optionally, the computer equipment is provided as a server. Figure 10 This is a schematic diagram of a server structure provided in an embodiment of this application. The server 1000 can vary significantly due to differences in configuration or performance. It may include one or more Central Processing Units (CPUs) 1001 and one or more memories 1002. The memories 1002 store at least one computer program, which is loaded and executed by the processor 1001 to implement the methods provided in the above-described method embodiments. Of course, the server may also have wired or wireless network interfaces, a keyboard, and input / output interfaces for input and output. The server may also include other components for implementing device functions, which will not be elaborated upon here.
[0250] Those skilled in the art will understand that all or part of the steps of the above embodiments can be implemented by hardware or by a program instructing related hardware. The program can be stored in a computer-readable storage medium, such as a read-only memory, a disk, or an optical disk.
[0251] The above description is only an optional embodiment of the present application and is not intended to limit the present application. Any modifications, equivalent substitutions, improvements, etc., made within the spirit and principles of the present application should be included within the protection scope of the present application.
Claims
1. A processor, characterized in that, The processor includes a processing module, n counter generators, n instruction buffers, and a memory; the processing module is connected to each counter generator, each instruction buffer, and the memory respectively, and each of the n counter generators and the n instruction buffers corresponds one-to-one with n thread bundles, where n is an integer greater than 1; The n instruction buffers are used to store the instructions to be executed for the corresponding thread bundle and the storage address of the instructions in the memory; The first counting generator among the n counting generators is used to send a first acquisition request to the processing module. The first acquisition request carries an instruction storage address. The instruction storage address is the storage address in the memory of the instruction to be executed by the corresponding thread. The first counting generator is any one of the n counting generators. The processing module is configured to receive the first acquisition request and, based on the first acquisition request, query from the n instruction buffers; If the instruction corresponding to the instruction storage address is found in the first instruction buffer, the instruction storage address and the corresponding instruction are copied to the second instruction buffer. The second instruction buffer corresponds to the first counter generator and is in the same thread bundle. The first instruction buffer is any one of the n instruction buffers except the second instruction buffer.
2. The processor according to claim 1, characterized in that, The processing module includes a processing unit and a buffer management unit. The processing unit is connected to each counter generator, the memory, and the buffer management unit, respectively. The buffer management unit is connected to each instruction buffer. The processing unit is configured to receive the first acquisition request and, based on the first acquisition request, send a query request to the buffer management unit, wherein the query request carries the instruction storage address; The buffer management unit is configured to receive the query request and, based on the query request, perform a query from the n instruction buffers; If the instruction corresponding to the instruction storage address is found in the first instruction buffer, the instruction storage address and the corresponding instruction are copied to the second instruction buffer.
3. The processor according to claim 2, characterized in that, The buffer management unit is also used to send a query result to the processing unit, wherein the query result is the result of querying the instruction corresponding to the instruction storage address from the n instruction buffers; The processing unit is also used to receive the query results.
4. The processor according to claim 3, characterized in that, The processing unit is further configured to send the first acquisition request to the memory when the query result indicates that no instruction corresponding to the instruction storage address is found; The memory is configured to receive the first acquisition request, read the instruction at the instruction storage address based on the first acquisition request, and send the instruction storage address and the instruction corresponding to the instruction storage address to the buffer management unit. The buffer management unit is used to receive the instruction storage address and the corresponding instruction, and write the instruction storage address and the corresponding instruction into the second instruction buffer.
5. The processor according to claim 1, characterized in that, The processing module is further configured to send the first acquisition request to the memory if the instruction corresponding to the instruction storage address is not found. The memory is used to receive the first acquisition request, read the instruction at the instruction storage address based on the first acquisition request, and send the instruction corresponding to the instruction storage address to the processing module. The processing module is further configured to receive the instruction corresponding to the instruction storage address and write the instruction storage address and the corresponding instruction into the second instruction buffer.
6. The processor according to any one of claims 1 to 5, characterized in that, The processor further includes a request management module and a broadcast module; the processing module is connected to the request management module and the broadcast module respectively, and the memory is connected to the broadcast module; The request management module is used to store at least one request message, the request message including a storage address, and the request message indicating that the processing module has sent an instruction to the memory carrying the storage address to obtain the request; The broadcast module is used to store at least one entry information, which corresponds one-to-one with at least one request information. The entry information includes the identifier of at least one instruction buffer, and the at least one instruction buffer requests the instruction stored at the address in the request information. The processing module is further configured to query the request information stored in the request management module based on the first acquisition request; if the first request information is found, add the identifier of the second instruction buffer to the first entry information stored in the broadcast module, wherein the storage address included in the first request information is the same as the instruction storage address, and the first entry information corresponds to the first request information; The memory is used to send an instruction corresponding to the instruction storage address to the processing module based on a second acquisition request. The second acquisition request is sent by a second counter generator, which is any one of the n counter generators other than the first counter generator. The second acquisition request carries the instruction storage address. The processing module is further configured to receive the instruction corresponding to the instruction storage address, obtain the first entry information from the broadcast module, and write the instruction storage address and the corresponding instruction into the instruction buffer indicated by the first entry information based on the first entry information.
7. The processor according to claim 6, characterized in that, The processing module is further configured to send an entry update request to the broadcast module when the first request information is found, wherein the entry update request indicates that the entry information corresponding to the first request information be updated; The broadcast module is used to receive the entry update request and, based on the entry update request, add the identifier of the second instruction buffer to the first entry information.
8. The processor according to claim 6, characterized in that, The processing module includes a processing unit and a buffer management unit. The processing unit is connected to each counter generator, the memory, the buffer management unit, the request management module, and the broadcast module, respectively. The buffer management unit is connected to each instruction buffer and the broadcast module, respectively. The processing unit is configured to query the request information stored in the request management module based on the first acquisition request; If the first request information is found, add the identifier of the second instruction buffer to the first entry information; The memory is used to send the instruction storage address and the corresponding instruction to the broadcast module based on the second acquisition request; The broadcast module is used to receive the instruction storage address and the corresponding instruction, and send the first entry information, the instruction storage address and the corresponding instruction to the buffer management unit; The buffer management unit is used to write the instruction storage address and the corresponding instruction into the instruction buffer indicated by the first entry information based on the first entry information.
9. The processor according to claim 6, characterized in that, The memory is used to send the instruction corresponding to the instruction storage address to the broadcast module based on the second acquisition request; The broadcast module is used to receive the instruction corresponding to the instruction storage address and send the first entry information and the instruction corresponding to the instruction storage address to the processing module.
10. The processor according to claim 6, characterized in that, The request information includes an indication identifier and a storage address. The indication identifier includes a first indication identifier or a second indication identifier. The first indication identifier indicates that the memory has responded with an instruction at the storage address, and the second indication identifier indicates that the memory has not responded with an instruction at the storage address. The processing module is further configured to query, based on the first acquisition request, the request information including the second indicator in the request management module; the first request information includes the second indicator.
11. The processor according to claim 10, characterized in that, The memory is also used to send a feedback notification to the processing module, the feedback notification indicating that the second instruction to obtain feedback has been received; The processing module is further configured to receive the feedback notification and, based on the feedback notification, update the indicator of the first request information in the request management module to the first indicator.
12. The processor according to claim 6, characterized in that, The processing module is further configured to, if no request information including the instruction storage address is found, add a second request information to the request management module, send a first acquisition request to the memory, and add a second entry information corresponding to the second request information to the broadcast module. The second request information includes the instruction storage address, and the second entry information includes the identifier of the second instruction buffer.
13. A method for acquiring instructions, characterized in that, Executed by a processor as described in any one of claims 1 to 12, the processor comprising a processing module, n counter generators, n instruction buffers, and a memory; the processing module is connected to each counter generator, each instruction buffer, and the memory respectively, and the n instruction buffers are used to store instructions to be executed for a corresponding thread bundle and the storage address of the instructions in the memory; The n counter generators and the n instruction buffers each correspond one-to-one with the n thread bundles, where n is an integer greater than 1; the method includes: The first counter generator among the n counter generators sends a first acquisition request to the processing module. The first acquisition request carries an instruction storage address. The instruction storage address is the storage address in the memory of the instruction to be executed by the corresponding thread bundle. The first counter generator is any one of the n counter generators. The processing module receives the first acquisition request and, based on the first acquisition request, queries from the n instruction buffers; if the instruction corresponding to the instruction storage address is found in the first instruction buffer, the instruction storage address and the corresponding instruction are copied to the second instruction buffer, the second instruction buffer and the first counter generator are in the same thread bundle, and the first instruction buffer is any one of the n instruction buffers except the second instruction buffer.
14. A computer device, characterized in that, The computer device includes a processor as described in any one of claims 1 to 12.
