Performance analysis method for processor, processor and storage medium
The processor's hardware scheduling unit issues dump instructions and executes data dump operations by itself, which solves the delay and impact problems caused by frequent CPU intervention in GPU and NPU performance analysis, and improves system execution efficiency.
Patent Information
- Application Number
- CN202410866436.2
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-06-28
- Publication Date
- 2024-11-15
AI Technical Summary
In the prior art, performance analysis of GPU and NPU relies on CPU, resulting in high overhead of frequent interaction and synchronization, resulting in latency and service execution impact.
The hardware scheduling unit through the processor issues dump instructions without receiving the CPU enable instruction, performs data dump operations, and writes data to the main memory for performance analysis by the CPU.
It reduces the synchronization overhead and data transfer overhead between the processor and CPU during the Profiling process, reduces the impact on business execution, and improves the overall execution efficiency of the system.
Smart Images

Figure CN118964151A_ABST
Abstract
Description
Technical Field
[0001] The present disclosure relates to the technical field of performance analysis, and more particularly to a performance analysis method for a processor, a processor, and a computer-readable storage medium and a computer program product for implementing the method. Background Art
[0002] In the field of computer science, processors are the core components for performing computing tasks. With the boom of artificial intelligence (AI) and the widespread application of AI algorithms, the demand for processor computing power is increasing. We are currently at a technical turning point of switching from the general computing mode dominated by the central processing unit (CPU) to the accelerated AI computing with graphics processing units (GPU) and neural network processing units (NPU) as the core.
[0003] Currently, performance analysis (Profiling) for GPUs and NPUs mainly relies on the CPU. For example, the current serial profiling or continuous profiling for GPUs requires frequent interactions between the CPU and GPU. For example, each profiling requires synchronization between the GPU and the CPU, and the CPU has a large instruction issuance overhead and dump data transfer overhead, which will cause a large delay.
[0004] It should be noted that the information disclosed in the above background technology section is only used to enhance the understanding of the background of the present disclosure, and therefore may include information that does not constitute the prior art known to a person of ordinary skill in the art. Summary of the invention
[0005] In order to solve or at least alleviate one or more of the above problems, the following technical solutions are provided. The embodiments of the present disclosure provide a performance analysis method for a processor, a processor, and a computer-readable storage medium and a computer program product for implementing the method, which can reduce the system overhead introduced by profiling, thereby improving the execution efficiency of the system.
[0006] According to a first aspect of the present disclosure, a performance analysis method for a processor is provided, the performance analysis method comprising the following steps: without receiving an enable instruction from a CPU, a hardware scheduling unit of the processor sends a dump instruction to the hardware of the processor; in response to receiving the dump instruction, the hardware performs a dump operation to write dump data to a main memory; and the CPU reads the dump data from the main memory for performance analysis of the processor.
[0007] As an alternative or supplement to the above scheme, in a performance analysis method according to an embodiment of the present disclosure, the processor includes an NPU and / or GPU communicatively connected to the CPU, and the hardware of the processor includes one or more of the core, bus, and various levels of cache memory of the NPU and / or GPU.
[0008] As an alternative or supplement to the above scheme, in a performance analysis method according to an embodiment of the present disclosure, without receiving an enable instruction from the CPU, the hardware scheduling unit of the processor sends a dump instruction to the hardware of the processor, including: in response to the enable instruction periodically issued by the software compiled on the processor, the hardware scheduling unit periodically sends the dump instruction to the hardware.
[0009] As an alternative or supplement to the above scheme, in a performance analysis method according to an embodiment of the present disclosure, the performance analysis method includes: the software compiled on the processor sends a dump configuration instruction to the hardware scheduling unit; the hardware scheduling unit sends corresponding configuration information to each hardware that needs to be scheduled according to the dump configuration instruction; the performance analysis unit of the hardware modifies the internal configuration according to the received configuration information, and returns a first completion response to the hardware scheduling unit after the modification is completed; in response to receiving the first completion response of each hardware that needs to be scheduled, the hardware scheduling unit reports a second completion response to the software.
[0010] As an alternative or supplement to the above scheme, in a performance analysis method according to an embodiment of the present disclosure, the performance analysis method includes: the software compiled on the processor sends the enable instruction to the hardware scheduling unit; in response to receiving the enable instruction, the hardware scheduling unit sends the dump instruction to each hardware that needs to be scheduled according to the dump configuration instruction; the performance analysis unit of the hardware performs a dump operation according to an internal configuration, and returns a first completion response to the hardware scheduling unit after the dump operation is completed; in response to receiving the first completion response of each hardware that needs to be scheduled, the hardware scheduling unit reports a second completion response to the software.
[0011] As an alternative or supplement to the above scheme, in a performance analysis method according to an embodiment of the present disclosure, without receiving an enable instruction from the CPU, the hardware scheduling unit of the processor sends a dump instruction to the hardware of the processor, including: the hardware scheduling unit sends the dump instruction to the hardware on its own to perform a dump operation at a grid granularity or a task granularity.
[0012] As an alternative or supplement to the above scheme, in a performance analysis method according to an embodiment of the present disclosure, the performance analysis method includes: the hardware scheduling unit reads the descriptor of the processor from the main memory, wherein the descriptor includes dump configuration information; and the hardware scheduling unit issues corresponding dump instructions to each hardware that needs to be scheduled according to the dump configuration information.
[0013] As an alternative or supplement to the above scheme, in a performance analysis method according to an embodiment of the present disclosure, the performance analysis method includes: according to the dump configuration information, first issuing a first dump instruction to the hardware that needs to be scheduled; after the hardware completes the first dump operation, issuing a business execution instruction to the hardware; after all business execution instructions are issued, issuing a second dump instruction to the hardware that needs to be scheduled; and calculating the difference between the first dump data obtained by the first dump operation and the second dump data obtained by the second dump operation for performance analysis of the processor.
[0014] As an alternative or supplement to the above scheme, in a performance analysis method according to an embodiment of the present disclosure, the dump configuration information includes mode configuration information, wherein if the mode configuration information indicates a blocking mode, then when the hardware performs a dump operation, the first dump operation for the next grid is started only after the second dump operation for one grid is completed; or if the mode configuration information indicates a non-blocking mode, the dump operation for the grid does not affect the execution of the business execution instruction.
[0015] According to a second aspect of the present disclosure, a processor is provided, which is communicatively connected to a CPU and a main memory, and includes: a hardware scheduling unit, which is used to issue a dump instruction to the hardware of the processor without receiving an enable instruction from the CPU; hardware, which is used to perform a dump operation in response to receiving the dump instruction to write dump data to the main memory, so that the CPU can perform performance analysis on the processor based on the dump data.
[0016] As an alternative or supplement to the above scheme, in a processor according to an embodiment of the present disclosure, the hardware scheduling unit is further configured to: in response to an enable instruction periodically issued by software compiled on the processor, periodically issue the dump instruction to the hardware; and / or issue the dump instruction to the hardware on its own to perform dump operations at a grid granularity or a task granularity.
[0017] As an alternative or supplement to the above scheme, in a processor according to an embodiment of the present disclosure, in response to receiving the dump configuration instruction from the software, the hardware scheduling unit sends corresponding configuration information to each hardware that needs to be scheduled according to the dump configuration instruction; the performance analysis unit of the hardware modifies the internal configuration according to the received configuration information, and returns a first completion response to the hardware scheduling unit after the modification is completed; in response to receiving the first completion response of each hardware that needs to be scheduled, the hardware scheduling unit reports a second completion response to the software; in response to receiving an enable instruction from the software, the hardware scheduling unit issues the dump instruction to each hardware that needs to be scheduled according to the dump configuration instruction; the performance analysis unit of the hardware performs a dump operation according to the internal configuration, and returns a first completion response to the hardware scheduling unit after the dump operation is completed; in response to receiving the first completion response of each hardware that needs to be scheduled, the hardware scheduling unit reports a second completion response to the software.
[0018] As an alternative or supplement to the above scheme, in a processor according to an embodiment of the present disclosure, the hardware scheduling unit reads a descriptor of the processor from the main memory, wherein the descriptor includes dump configuration information; and the hardware scheduling unit issues corresponding dump instructions to each hardware that needs to be scheduled according to the dump configuration information, wherein issuing corresponding dump instructions to each hardware that needs to be scheduled according to the dump configuration information includes: first issuing a first dump instruction to the hardware that needs to be scheduled according to the dump configuration information; after the hardware completes the first dump operation, issuing a business execution instruction to the hardware; after all business execution instructions are issued, issuing a second dump instruction to the hardware that needs to be scheduled; the CPU is configured to calculate the difference between the first dump data obtained by the first dump operation and the second dump data obtained by the second dump operation, for performance analysis of the processor.
[0019] As an alternative or supplement to the above scheme, in a processor according to an embodiment of the present disclosure, the dump configuration information includes mode configuration information, wherein if the mode configuration information indicates a blocking mode, then when the hardware performs a dump operation, the first dump operation for the next grid is started only after the second dump operation for one grid is completed; or if the mode configuration information indicates a non-blocking mode, the dump operation for the grid does not affect the execution of the business execution instruction.
[0020] According to a third aspect of the present disclosure, a computer storage medium is provided, wherein the computer storage medium includes instructions, and the instructions, when run, execute any one of the performance analysis methods described in the first aspect of the present disclosure.
[0021] According to a fourth aspect of the present disclosure, a computer program product is provided, including a computer program. When the computer program is executed by a processor, any one of the performance analysis methods described in the first aspect of the present disclosure is implemented.
[0022] According to one or more embodiments of the present disclosure, the performance analysis solution for the processor can execute the hardware data dump operation by the processor without receiving the enable instruction of the CPU. Since the frequent intervention of the CPU is not required, the synchronization overhead between the processor and the CPU, the instruction issuance overhead of the CPU and the dump data movement overhead are reduced during the profiling process, thereby reducing the impact of profiling on normal business execution and improving the overall execution efficiency of the system. BRIEF DESCRIPTION OF THE DRAWINGS
[0023] The above and / or other aspects and advantages of the present disclosure will become clearer and easier to understand through the following description of various aspects in conjunction with the accompanying drawings, in which the same or similar units are represented by the same reference numerals. In the accompanying drawings:
[0024] Figure 1 An exemplary application scenario 10 of the performance analysis solution according to one or more embodiments of the present disclosure;
[0025] Figure 2 is an exemplary flow chart of a performance analysis method 20 according to one or more embodiments of the present disclosure;
[0026] Figure 3 A schematic diagram of instruction execution in blocking mode according to one or more embodiments of the present disclosure;
[0027] Figure 4 A schematic diagram of instruction execution in non-blocking mode according to one or more embodiments of the present disclosure; and
[0028] Figure 5is an exemplary block diagram of a processor 50 according to one or more embodiments of the present disclosure. DETAILED DESCRIPTION
[0029] The following describes some of the various embodiments of the present disclosure, which are intended to provide a basic understanding of the present disclosure, but are not intended to identify the key or decisive elements of the present disclosure or to limit the scope of protection.
[0030] For brevity and illustrative purposes, the principles of the present disclosure are described herein primarily with reference to its exemplary embodiments. However, those skilled in the art will readily recognize that the same principles are equally applicable to all types of cache management methods, cache management systems, electronic devices, and computer-readable storage media, and that these same principles may be implemented therein, and that any such changes do not depart from the true spirit and scope of this patent application.
[0031] Moreover, in the following description, reference is made to the accompanying drawings, which illustrate specific exemplary embodiments. Electrical, mechanical, logical and structural changes may be made to these embodiments without departing from the spirit and scope of the present disclosure. In addition, although the features of the present disclosure are combined with only one of several implementations / embodiments, this feature may be combined with one or more other features of other implementations / embodiments as may be desired and / or advantageous for any given or identifiable function. Therefore, the following description should not be regarded as limiting, and the scope of the present disclosure is defined by the appended claims and their equivalents.
[0032] Terms such as "having" and "including" indicate that in addition to the units (modules) and steps that are directly and clearly stated in the specification and claims, the technical solution of the present disclosure does not exclude the situation where there are other units (modules) and steps that are not directly or clearly stated. Terms such as "first" and "second" do not indicate the order of units in terms of time, space, size, etc., but are only used to distinguish each unit. Moreover, the steps in this article are not limited to being implemented in the order of writing, but the steps written later can also be implemented at the same time as the steps written earlier, or before the steps written earlier.
[0033] In computer science, the processor is the core component for performing computing tasks. CPU, GPU and NPU are three common types of processors. They have significant differences in computing power and different types of processors have different advantages in different computing tasks. Therefore, each is suitable for different types of computing tasks. For example, CPU is generally suitable for processing general computing tasks, GPU is suitable for processing a large number of parallel computing tasks, and NPU is suitable for processing neural network computing tasks. In practical applications, it is usually necessary to profile the processor or its subsystem for performance optimization or debugging. Specifically, a data dump operation is first performed to dump the data of each processor or the application running on it to the memory, and then the dumped data is actually measured and evaluated by profiling, for example, where the running time of the analysis program is mainly consumed. As mentioned above, the current profiling for GPU and NPU mainly relies on the CPU to be dominant. For example, serial profiling or continuous profiling for GPU needs to rely on frequent interactions between CPU and GPU. For example, each profiling requires synchronization between GPU and CPU and the CPU has a large instruction issuance overhead and dump data transfer overhead, so it will generate a large delay. In this regard, the present disclosure provides a performance analysis solution, which can reduce the system overhead introduced by Profiling, thereby improving the execution efficiency of the system. In the following, various exemplary embodiments according to the present disclosure will be described in detail with reference to the accompanying drawings.
[0034] Referring to the accompanying drawings, Figure 1 FIG. 10 is an exemplary application scenario 10 of the performance analysis solution according to one or more embodiments of the present disclosure. Figure 1 As shown, the application scenario 10 includes a CPU 110, one or more processors 120, and a main memory 130. In the application scenario 10, the CPU 110 is used as a main processor, the processor 120 is used as a coprocessor of the CPU 110 and is connected to the CPU 110 through a bus (e.g., a PCI-Express bus), and the CPU 110 and the processor 120 can exchange data with the main memory 130. Exemplarily, the processor 120 can be a GPU, an NPU, a TPU (Tensor Processing Unit), other types of processors, or a combination thereof, and the main memory 130 can be a DDR (Double Data Rate) memory.
[0035] Continue to refer Figure 2 , Figure 2 FIG. 2 is an exemplary flow chart of a performance analysis method 20 according to one or more embodiments of the present disclosure.
[0036] like Figure 2 As shown, in step S210, without receiving an enable instruction from the CPU, the hardware scheduling unit of the processor sends a dump instruction to the hardware of the processor. Next, in step S220, in response to receiving the dump instruction, the hardware performs a dump operation to write the dump data into the main memory.
[0037] The processor in step S210 may be Figure 1 Any example of the processor 120 in, for example, a GPU, an NPU, a TPU. Exemplarily, the hardware of the processor includes one or more of a core (Core), a bus (Bus), and various levels of cache memory (Cache) of a GPU, an NPU, or a TPU.
[0038] It should be emphasized that the dump instruction in step S210 is issued without receiving the enable instruction from the CPU. In other words, the CPU does not perceive the process of issuing the Profiling instruction and the subsequent dump operation process, but normally issues the business execution instruction to the processor. As for when to execute Profiling and for whom to execute Profiling, it is determined by the processor.
[0039] In some embodiments according to the present disclosure, Profiling can be divided into two types: periodic Profiling and grid or task granularity level Profiling. Correspondingly, the dump instructions issued by the hardware scheduling unit can be divided into two types: periodic Dump instructions and grid or task granularity level Dump instructions.
[0040] Exemplarily, periodic profiling is initiated by software. Specifically, in response to an enable instruction (e.g., Trigger) periodically issued by software compiled on the processor, the hardware scheduling unit of the processor periodically issues dump instructions to the hardware of the processor (e.g., core, bus, cache at all levels). In one embodiment, the execution logic and related configurations of Profiling can be compiled in advance on the software on the processor. At the beginning of Profiling, the software on the processor periodically issues dump configuration instructions to the hardware scheduling unit based on the execution logic of Profiling. Exemplarily, the dump configuration instructions can indicate the hardware that needs to be scheduled, the dump configuration of each hardware, etc. The hardware scheduling unit sends corresponding configuration information to each hardware that needs to be scheduled according to the received dump configuration instruction. Next, the performance analysis unit (Profiler) of the corresponding hardware modifies the internal configuration according to the received configuration information, and returns a first completion response to the hardware scheduling unit after the modification is completed to indicate that the hardware has completed the configuration modification, and waits until the hardware scheduling unit receives all responses (that is, after all the hardware that needs to be scheduled has completed the configuration modification) to report a second completion response to the software to indicate that the hardware has completed the configuration modification. After completing the configuration modification, the Profiling process can be started. In one embodiment, the software compiled on the processor sends an enable instruction (for example, Trigger) to the hardware scheduling unit, and the hardware scheduling unit sends a dump instruction to each hardware that needs to be scheduled according to the received dump configuration instruction. The performance analysis unit of the corresponding hardware performs a dump operation according to the internal configuration and returns a first completion response to the hardware scheduling unit after the dump operation is completed to indicate that the hardware has completed data dumping, and waits until the hardware scheduling unit receives all responses (that is, after all the hardware that needs to be scheduled has completed data dumping) to report a second response to the software to indicate that each hardware has completed data dumping. In this way, the data in each hardware that needs to be scheduled can be periodically dumped to the main memory (for example, Figure 1 In the main memory 130, such as DDR).
[0041] Exemplarily, Grid or Task granularity-level Profiling is initiated by the processor's hardware scheduling unit. Optionally, configuration information about the dump operation and the processor's layer structure information may be stored in the system's main memory (e.g., DDR) in advance. In one example, the hardware scheduling unit reads the processor's descriptor from the main memory, wherein the descriptor includes the dump configuration information and / or the processor's layer structure information, and the hardware scheduling unit issues corresponding dump instructions to each hardware that needs to be scheduled based on the dump configuration information. Additionally or alternatively, the configuration information about the dump operation may also be compiled in advance in the Profiler of each hardware, that is, the dump configuration is determined by the Profiler of each hardware.
[0042] In the execution process of Profiling at the Grid or Task granularity level, illustratively, according to the dump configuration information, firstly, a first dump instruction is issued to the hardware that needs to be scheduled in order to understand the current background noise of the hardware, after the hardware completes the first dump operation, a business execution instruction is issued to the hardware, after all the business execution instructions are issued, a second dump instruction is issued to the hardware that needs to be scheduled again, and then the difference between the first dump data obtained by the first dump operation and the second dump data obtained by the second dump operation can be used for the performance analysis of the processor. In one example, the hardware opens Profiling according to the compilation of the software, and then according to the dump configuration information, when the Grid or Task that needs to be dumped is issued, the dump instruction is first issued in order to understand the current background noise, and then the specific business execution instruction (for example, Block instruction) is issued, and after all the business execution instructions have been issued, the dump instruction is issued again, and the difference between the two dump data is the data that needs Profiling.
[0043] Optionally, Profiling can be divided into two modes, namely, blocking mode and non-blocking mode, wherein in blocking mode, dumping instructions blocks subsequent instructions, while in non-blocking mode, dumping instructions does not block subsequent instructions. Figure 3 and Figure 4 ,in Figure 3 An exemplary schematic diagram showing instruction execution in blocking mode is shown, Figure 4 An exemplary schematic diagram of instruction execution in non-blocking mode is shown. Figure 3 and Figure 4 In the example, dmp_st refers to the start instruction for the dump operation, and dmp_end refers to the end instruction for the dump operation. Referring to the above, the profiling for a specific Grid includes two dump operations, and the execution of the business occurs between the first dump operation and the second dump operation. It can be understood that Figure 3 and Figure 4The dmp_st in the dmp_end may be the first dump instruction for a specific Grid and the dmp_end may be the second dump instruction for a specific Grid. Specifically, the dump configuration information includes mode configuration information, wherein if the mode configuration information indicates a blocking mode, when the hardware performs a dump operation (refer to Figure 3 ), the dump operation for the next grid (for example, the first dump instruction dmp_st for Grid 1) and the service instruction are executed only after the dump operation and service execution for one grid are completed (for example, after the second dump instruction dmp_end for Grid 0 is issued). If the mode configuration information indicates the non-blocking mode, the dump operation for the Grid does not affect the service execution of the Grid. Figure 4 , the business execution instructions for Grid 0, Grid 1 and Grid 2 are executed according to the time sequence preset in the system task, and the dump instruction for Grid 0 does not block the execution of the business of Grid 1. .
[0044] In step S230 , the CPU reads the dump data from the main memory for use in performing performance analysis on the processor.
[0045] Optionally, whether it is periodic profiling or grid or task granularity level profiling, the storage space (for example, DDR space) is determined by software through configuration registers. It should be noted that the storage space of each type of profiling is continuous, so that the CPU can eventually read the data, and the storage space of different types of profiling does not overlap.
[0046] Reference below Figure 5 , Figure 5 FIG. 5 is an exemplary block diagram of a processor 50 according to one or more embodiments of the present disclosure. Figure 5 As shown, the processor 50 includes a hardware scheduling unit 510 and one or more hardware 520 .
[0047] The hardware scheduling unit 510 is used to send a dump instruction to the hardware 520 without receiving an enable instruction from the CPU. In response to receiving the dump instruction, the hardware 520 performs a dump operation to write the dump data into the main memory for the CPU to perform performance analysis on the processor 50 based on the dump data.
[0048] Optionally, the hardware scheduling unit 510 is further configured to: periodically issue dump instructions to the hardware 520 in response to enable instructions periodically issued by software compiled on the processor 50; and / or issue dump instructions to the hardware 520 on its own to perform dump operations at a grid granularity or a task granularity.
[0049] Optionally, in response to receiving a dump configuration instruction from the software, the hardware scheduling unit 510 sends corresponding configuration information to each hardware 520 that needs to be scheduled according to the dump configuration instruction; the performance analysis unit 521 of the hardware 520 modifies the internal configuration according to the received configuration information, and returns a first completion response to the hardware scheduling unit 510 after the modification is completed; in response to receiving the first completion response of each hardware 520 that needs to be scheduled, the hardware scheduling unit 510 reports a second completion response to the software. Additionally or alternatively, in response to receiving an enable instruction from the software, the hardware scheduling unit 510 issues a dump instruction to each hardware 520 that needs to be scheduled according to the dump configuration instruction; the performance analysis unit 521 of the hardware 520 performs a dump operation according to the internal configuration, and returns a first completion response to the hardware scheduling unit 510 after the dump operation is completed; in response to receiving the first completion response of each hardware 520 that needs to be scheduled, the hardware scheduling unit 510 reports a second completion response to the software.
[0050] Optionally, the hardware scheduling unit 510 reads a descriptor of the processor from the main memory, wherein the descriptor includes dump configuration information; and the hardware scheduling unit 510 issues corresponding dump instructions to each hardware 520 that needs to be scheduled according to the dump configuration information, wherein issuing corresponding dump instructions to each hardware 520 that needs to be scheduled according to the dump configuration information includes: first issuing a first dump instruction to the hardware 520 that needs to be scheduled according to the dump configuration information; after the hardware 520 completes the first dump operation, issuing a business execution instruction to the hardware 520; after all business execution instructions are issued, issuing a second dump instruction to the hardware 520 that needs to be scheduled; the CPU is configured to calculate the difference between the first dump data obtained by the first dump operation and the second dump data obtained by the second dump operation, for performance analysis of the processor.
[0051] The configuration of the processor 50, the hardware scheduling unit 510, and the hardware 520 may refer to the above description of Figure 2 The description of each step in will not be repeated here.
[0052] According to one or more embodiments of the present disclosure, the performance analysis method 20 and the processor 50 can execute the hardware data dump operation by the processor without receiving the enable instruction of the CPU. Since the frequent intervention of the CPU is not required, the synchronization overhead between the processor and the CPU, the CPU instruction issuance overhead and the dump data movement overhead are reduced during the Profiling process, thereby reducing the impact of Profiling on normal business execution and improving the overall execution efficiency of the system.
[0053] In addition, as described above, the present disclosure can also be implemented as a computer-readable storage medium, in which a program for causing a computer to execute the following steps is stored. Figure 2 Here, as the computer-readable storage medium, various computer-readable storage media such as disks (e.g., magnetic disks, optical disks, etc.), cards (e.g., memory cards, optical cards, etc.), semiconductor memories (e.g., ROMs, nonvolatile memories, etc.), and tapes (e.g., magnetic tapes, cassette tapes, etc.) can be used.
[0054] The present disclosure may also be implemented as a computer program product, which includes a computer program. When the computer program is executed by a processor, Figure 2 The procedure of the performance analysis method 20 is shown.
[0055] Where applicable, hardware, software or a combination of hardware and software may be used to implement the various embodiments provided by the present disclosure. Moreover, where applicable, without departing from the scope of the present disclosure, the various hardware components and / or software components set forth herein may be combined into composite components comprising software, hardware and / or both. Where applicable, without departing from the scope of the present disclosure, the various hardware components and / or software components set forth herein may be divided into subcomponents comprising software, hardware or both. In addition, where applicable, it is contemplated that software components may be implemented as hardware components, and vice versa.
[0056] The embodiments and examples presented herein are provided to best illustrate embodiments according to the present disclosure and its specific applications, and thereby enable those skilled in the art to implement and use the present disclosure. However, those skilled in the art will appreciate that the above description and examples are provided only for ease of illustration and example. The presented description is not intended to cover all aspects of the present disclosure or to limit the present disclosure to the precise form disclosed.
Claims
1. A performance analysis method for a processor, characterized in that: The performance analysis method comprises the following steps: In the case where there is no need to receive an enable instruction from the CPU, the hardware scheduling unit of the processor sends a dump instruction to the hardware of the processor; In response to receiving the dump instruction, executing a dump operation by the hardware to write the dump data into the main memory; and The CPU reads the dump data from the main memory for use in performing performance analysis on the processor.
2. The performance analysis method according to claim 1, characterized in that: The processor includes an NPU and / or a GPU that is communicatively connected to the CPU, and the hardware of the processor includes one or more of a core, a bus, and various levels of cache memory of the NPU and / or the GPU.
3. The performance analysis method according to claim 1, characterized in that: In the case where the enable instruction of the CPU is not received, the hardware scheduling unit of the processor sends a dump instruction to the hardware of the processor, including: In response to an enable instruction periodically issued by software compiled on the processor, the hardware scheduling unit periodically issues the dump instruction to the hardware.
4. The performance analysis method according to claim 3, characterized in that: The performance analysis method comprises: The software compiled on the processor sends a dump configuration instruction to the hardware scheduling unit; The hardware scheduling unit sends corresponding configuration information to each hardware that needs to be scheduled according to the dump configuration instruction; The hardware performance analysis unit modifies the internal configuration according to the received configuration information, and returns a first completion response to the hardware scheduling unit after the modification is completed; In response to receiving the first completion response of each hardware that needs to be scheduled, the hardware scheduling unit reports a second completion response to the software.
5. The performance analysis method according to claim 4, characterized in that: The performance analysis method comprises: The software compiled on the processor sends the enabling instruction to the hardware scheduling unit; In response to receiving the enabling instruction, the hardware scheduling unit sends the dump instruction to each hardware that needs to be scheduled according to the dump configuration instruction; The performance analysis unit of the hardware performs a dump operation according to the internal configuration, and returns a first completion response to the hardware scheduling unit after the dump operation is completed; In response to receiving the first completion response of each hardware that needs to be scheduled, the hardware scheduling unit reports a second completion response to the software.
6. The performance analysis method according to claim 1, characterized in that: In the case where the enable instruction of the CPU is not received, the hardware scheduling unit of the processor sends a dump instruction to the hardware of the processor, including: The hardware scheduling unit automatically sends the dump instruction to the hardware to perform a dump operation at a grid granularity or a task granularity.
7. The performance analysis method according to claim 6, characterized in that: The performance analysis method comprises: The hardware scheduling unit reads a descriptor of the processor from the main memory, wherein the descriptor includes dump configuration information; and The hardware scheduling unit sends corresponding dump instructions to each hardware that needs to be scheduled according to the dump configuration information.
8. The performance analysis method according to claim 6, characterized in that: The performance analysis method comprises: According to the dump configuration information, firstly, a first dump instruction is issued to the hardware that needs to be scheduled; After the hardware completes the first dump operation, issuing a service execution instruction to the hardware; After all the service execution instructions are issued, a second dump instruction is issued to the hardware that needs to be scheduled; A difference between first dump data obtained by the first dump operation and second dump data obtained by the second dump operation is calculated for use in performing performance analysis on the processor.
9. The performance analysis method according to claim 8, characterized in that: The dump configuration information includes mode configuration information, wherein: If the mode configuration information indicates a blocking mode, when the hardware performs a dump operation, the first dump operation for the next grid is started only after the second dump operation for one grid is completed; or If the mode configuration information indicates a non-blocking mode, the dump operation on the grid does not affect the execution of the service execution instruction.
10. A processor, the processor being communicatively connected to a CPU and a main memory, characterized in that: The processor comprises: a hardware scheduling unit, configured to send a dump instruction to the hardware of the processor without receiving an enable instruction from the CPU; and The hardware is configured to execute a dump operation in response to receiving the dump instruction to write dump data into the main memory, so that the CPU can perform performance analysis on the processor based on the dump data.
