Neural network model deployment method and apparatus, and electronic device
By combining multiple neural network models to evaluate CPU performance, it solves the evaluation problems caused by complex or simple network structures in the existing technology, achieves low-complexity and high-precision CPU performance evaluation, and improves the system usage experience.
Patent Information
- Application Number
- CN202310282878.8
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2023-03-21
- Publication Date
- 2024-09-24
AI Technical Summary
When evaluating CPU performance of existing neural network models, the complex network structure leads to poor deployment, or the simple structure leads to low evaluation accuracy, making it difficult to deploy low-complexity and high-precision models.
Multiple types of neural network models (such as cache misses, TLB misses, CPU stalls, branch prediction errors, number of instruction cycles, etc.) are used to form a neural network model. CPU performance is jointly evaluated through these models to ensure the low complexity and high performance of the network structure. Accuracy.
A low-complexity and high-precision neural network model is implemented, which can effectively evaluate the CPU performance of the system and improve the overall user experience of the system.
Smart Images

Figure CN118689490A
Abstract
Description
Technical Field
[0001] The present application relates to the field of computers, and specifically to a neural network model deployment method and device, and electronic equipment. Background Art
[0002] The central processing unit (CPU) is the computing and control core of the computer system and the final execution unit for information processing and program running. For a system loaded with a CPU, the system performance (such as system computing power, system energy consumption, and system energy efficiency, etc.) affects the user's overall experience of using the system, and the better the performance, the better the user experience.
[0003] At present, there are many neural network models deployed to evaluate system performance. However, these neural network models either have poor network deployability due to complex network structure, or have low evaluation accuracy due to simple network structure. Therefore, how to deploy low-complexity and high-precision neural network models to evaluate the CPU performance of the system requires further research. Summary of the invention
[0004] The embodiments of the present application provide a neural network model deployment method and device, and an electronic device, in the hope of solving the problem of how to deploy a low-complexity and high-precision neural network model to evaluate the CPU performance of the system.
[0005] In a first aspect, a neural network model deployment method of the present application includes:
[0006] Deploy a neural network model, wherein the neural network model is used to evaluate the central processing unit (CPU) performance of the system based on the system performance data;
[0007] Wherein, the neural network model is composed of at least one of the following:
[0008] The first type of network model is used to determine the number of CPU cycles for cache misses;
[0009] The second type of network model is used to determine the number of CPU cycles missed by the lookaside translation buffer TLB;
[0010] The third type of network model is used to determine the number of CPU cycles during which the CPU is stalled;
[0011] The fourth type of network model is used to determine the number of CPU cycles for branch prediction errors;
[0012] The fifth type of network model is used to determine the average number of CPU cycles to execute instructions;
[0013] The sixth type of network model is used to determine the total number of CPU cycles to execute instructions.
[0014] It can be seen that the present application can evaluate the CPU performance of the system by deploying a neural network model. Since the present application needs to jointly evaluate the CPU performance of the system according to various performance parameters of the system (such as cache miss, TLB miss, CPU stall, branch prediction error, instruction, etc.), and the present application can obtain these performance parameters according to the neural network model, in order to ensure that the network structure of the neural network model has low complexity, the present application can form the neural network model through multiple types of network models (i.e., at least one of the first type of network model, the second type of network model, the third type of network model, the fourth type of network model, the fifth type of network model, and the sixth type of network model), and each type of network model is used to determine a type of performance parameter, thereby realizing the deployment of a low-complexity and high-precision neural network model to evaluate the CPU performance of the system.
[0015] In a second aspect, a neural network model deployment device of the present application includes:
[0016] A deployment unit, used to deploy a neural network model, wherein the neural network model is used to evaluate the central processing unit (CPU) performance of the system according to the system performance data;
[0017] Wherein, the neural network model is composed of at least one of the following:
[0018] The first type of network model is used to determine the number of CPU cycles for cache misses;
[0019] The second type of network model is used to determine the number of CPU cycles to bypass the translation buffer TLB;
[0020] The third type of network model is used to determine the number of CPU cycles during which the CPU is stalled;
[0021] The fourth type of network model is used to determine the number of CPU cycles for branch prediction errors;
[0022] The fifth type of network model is used to determine the average number of CPU cycles to execute instructions;
[0023] The sixth type of network model is used to determine the total number of CPU cycles to execute instructions.
[0024] The third aspect is an electronic device of the present application, comprising a processor, a memory, and a computer program or instructions stored in the memory, wherein the processor executes the computer program or instructions to implement the steps of the method described in the first aspect.
[0025] The fourth aspect is a computer-readable storage medium of the present application, wherein the computer-readable storage medium stores a computer program or instructions, and when the computer program or instructions are executed by a processor, the steps of the method described in the first aspect are implemented.
[0026] The fifth aspect is a computer program product of the present application, comprising a computer program or instructions, wherein the computer program or instructions, when executed by a processor, implements the steps of the method described in the first aspect or the second aspect.
[0027] The beneficial effects brought about by the technical solutions of the second to fifth aspects can be referred to the technical effects brought about by the technical solution of the first aspect, and will not be repeated here. BRIEF DESCRIPTION OF THE DRAWINGS
[0028] In order to more clearly illustrate the technical solutions in the embodiments of the present application, the drawings required for use in the embodiments of the present application are briefly introduced below.
[0029] Figure 1 It is a flowchart of a neural network model deployment method according to an embodiment of the present application;
[0030] Figure 2 is a distribution diagram of CPI Stacks in an embodiment of the present application;
[0031] Figure 3 is a structural schematic diagram of a neural network model in an embodiment of the present application;
[0032] Figure 4 It is a block diagram of the functional units of a neural network model deployment device according to an embodiment of the present application;
[0033] Figure 5 It is a structural schematic diagram of an electronic device according to an embodiment of the present application. DETAILED DESCRIPTION
[0034] In order to help those skilled in the art better understand the technical solutions of the present application, the following is a clear and complete description of the technical solutions in the embodiments of the present application in conjunction with the drawings in the embodiments of the present application. Obviously, the described embodiments are only some embodiments of the present application, not all embodiments. Based on the description of the embodiments of the present application, all other embodiments obtained by those skilled in the art without creative work are within the scope of protection of the present application.
[0035] It should be understood that the terms "first", "second", etc. involved in the embodiments of the present application are used to distinguish different objects, rather than to describe a specific order. In addition, the terms "including" and "having" and any variations thereof are intended to cover non-exclusive inclusions. For example, a process, method, software, product, or device that includes a series of steps or units is not limited to the listed steps or units, but also includes steps or units that are not listed, or also includes other steps or units inherent to these processes, methods, products, or devices.
[0036] The "embodiment" involved in the embodiments of the present application means that the specific features, structures or characteristics described in conjunction with the embodiment may be included in at least one embodiment of the present application. The appearance of this phrase in various places in the specification does not necessarily refer to the same embodiment, nor is it an independent or alternative embodiment that is mutually exclusive with other embodiments. It is explicitly and implicitly understood by those skilled in the art that the embodiments described herein can be combined with other embodiments.
[0037] In the embodiments of the present application, "and / or" describes the association relationship of the associated objects, indicating that three relationships may exist. For example, A and / or B can represent the following three situations: A exists alone; A and B exist at the same time; B exists alone. Among them, A and B can be singular or plural.
[0038] In the embodiment of the present application, the symbol " / " can indicate that the objects associated with each other are in an "or" relationship. In addition, the symbol " / " can also indicate a division sign, that is, performing a division operation. For example, A / B can indicate A divided by B.
[0039] In the embodiments of the present application, the symbol "*" or "·" can represent a multiplication sign, that is, a multiplication operation is performed. For example, A*B or A·B can represent A multiplied by B.
[0040] In the embodiments of the present application, "at least one item" or similar expressions refer to any combination of these items, including any combination of single items or plural items, and refer to one or more, and multiple refers to two or more. For example, at least one item of a, b, or c can represent the following seven situations: a, b, c, a and b, a and c, b and c, a, b, and c. Among them, each of a, b, and c can be an element or a set containing one or more elements.
[0041] In the embodiments of the present application, "equal to" can be used in conjunction with greater than, and is applicable to the technical solution adopted when greater than, and can also be used in conjunction with less than, and is applicable to the technical solution adopted when less than. When equal to is used in conjunction with greater than, it is not used in conjunction with less than; when equal to is used in conjunction with less than, it is not used in conjunction with greater than.
[0042] The technical solutions, beneficial effects and related concepts involved in the embodiments of the present application are described in detail below.
[0043] 1. Electronic equipment
[0044] 1. Description
[0045] The electronic device of the embodiment of the present application may be an entity / unit / module / device, etc. with a communication function of sending and receiving.
[0046] In some possible implementations, the types of electronic devices may include handheld devices, wearable devices, vehicle-mounted devices, vehicle-mounted terminals, augmented reality (AR) devices, virtual reality (VR) devices, Internet of Things (IOT) devices, projection devices, projectors, user equipment (UE), terminal devices, terminals, mobile terminals, smart phones, smart screens, smart TVs, smart watches, laptops, smart speakers, cameras, game controllers, microphones, stations (STA), access points (AP), mobile stations (MS), personal digital assistants (PDA), personal computers (PC), relay devices, etc.
[0047] In some possible implementations, the wearable device may also be referred to as a smart wearable device, which is a general term for smart devices that use wearable technology to intelligently design and develop daily wearables. For example, smart glasses, smart gloves, smart watches, smart bracelets for monitoring various specific features, smart jewelry, etc. In addition, the wearable device is a portable device that can be worn directly on the body or integrated into the user's clothing or accessories. The wearable device can not only be equipped with a dedicated hardware architecture, but also with a dedicated software architecture for data interaction, cloud interaction, etc. The wearable smart device can achieve complete or partial functions without relying on other smart devices.
[0048] It should be noted that the embodiments of the present application do not specifically limit the specific structure of the execution subject of the performance scheduling method, as long as it can be processed by running a computer program or instruction that records the method provided by the embodiments of the present application, and according to the method provided by the embodiments of the present application. For example, the execution subject of the method provided by the embodiments of the present application can be an electronic device, or a processor / device / module / unit in the electronic device that can call and execute a computer program or instruction, and no specific limitation is made to this.
[0049] 2) Hardware architecture examples of electronic devices
[0050] In some possible implementations, the electronic device of the embodiment of the present application may include at least one of a processor, a memory, a sensor component, a display component, a camera component, a communication component, an input / output driver, etc. Exemplary descriptions are given below.
[0051] ①Processor
[0052] In some possible implementations, the processor may be used to run or load an operating system, which may be any one or more computer operating systems that implement business processing through processes, such as Linux operating system, Unix operating system, Android operating system, iOS operating system, Windows operating system, Zephyr operating system, real-time operating system (RTOS), DOS operating system, Mac operating system, ThreadX operating system, embedded operating system, NucleusPlus operating system, etc.
[0053] In some possible implementations, the processor can be viewed as a complete system on chip (SOC).
[0054] In some possible implementations, the processor may include one or more processing units. For example, the processing unit may include at least one of a central processing unit (CPU), an application processor (AP), a microcontroller unit (MCU), a single chip microcomputer (SCM), a single chip microcomputer, a graphics processing unit (GPU), an image signal processor (ISP), a controller, a digital signal processor (DSP), a field programmable gate array (FPGA), an application-specific integrated circuit (ASIC), a baseband processor, a neural network processing unit (NPU), etc. Among them, different processing units may be separated or integrated together.
[0055] In some possible implementations, a processing unit may be a single core or multiple cores.
[0056] In some possible implementations, a processing unit may run or load a multi-core subsystem, wherein the multi-core subsystem may be an operating system with multi-core processing capabilities.
[0057] In some possible implementations, the processor may further include a memory for storing computer programs or instructions.
[0058] For example, the processor may call a program stored in the memory to run an operating system.
[0059] For another example, the memory in the processor can store or cache instructions that the processor has just used or circulated. If the processor needs to use the instruction or data again, it can be directly called from the memory, thereby avoiding repeated access, reducing the waiting time of the processor and improving system efficiency.
[0060] For another example, the memory in the processor can also store or cache data, and synchronize or transmit the data to other processors for execution. The memory in the processor can be a high-speed cache memory.
[0061] In some possible implementations, the processor may include one or more communication interfaces, wherein the communication interface may include at least one of a serial peripheral interface (SPI), an inter-integrated circuit (I2C) interface, an inter-integrated circuit sound (I2S) interface, a pulse code modulation (PCM) interface, a universal asynchronous receiver / transmitter (UART) interface, a mobile industry processor interface (MIPI), a general-purpose input / output (GPIO) interface, a subscriber identity module (SIM) interface, a universal serial bus (USB) interface, and the like.
[0062] ②Memory
[0063] In some possible implementations, the memory may be used to store computer programs or instructions.
[0064] In some possible implementations, the memory includes, but is not limited to, random access memory (RAM), read-only memory (ROM), erasable programmable read only memory (EPROM), compact disc read-only memory (CD-ROM), synchronous dynamic random-access memory (SDRAM), and double data rate SDRAM (DDR SDRAM).
[0065] ③Sensor components
[0066] In some possible implementations, the sensing component may be a sensor.
[0067] For example, the sensing component may include at least one of a gravity sensor, a gyroscope sensor, a magnetometer sensor, an accelerometer, an inertial sensor (such as an inertial motion unit (IMU)), a pressure sensor, an air pressure sensor, a distance sensor, a proximity light sensor, a fingerprint sensor, a temperature sensor, a touch sensor, an ambient light sensor, a bone conduction sensor, an ultra-wideband (UWB) sensor, a near field communication (NFC) sensor, a laser sensor and / or a visible light sensor, etc.
[0068] ④Display components
[0069] In some possible implementations, a display component may be used to display at least one of a user interface, user interface elements and features, user-selectable controls, various displayable objects, and the like.
[0070] In some possible implementations, the display component may be a physical screen of the electronic device, wherein the physical screen may include one of a display screen, a touch screen, and the like.
[0071] For example, the display component may include a display panel, wherein the display panel may be a liquid crystal display (LCD), an organic light-emitting diode (OLED), an active-matrix organic light-emitting diode or an active-matrix organic light-emitting diode (AMOLED), a flexible light-emitting diode (FLED), a quantum dot light-emitting diode (QLED), etc.
[0072] It should be noted that the electronic device can realize the display function through a GPU, a display component, and a processor. Among them, the GPU can be used to perform mathematical and geometric calculations and perform graphic rendering. In addition, the GPU can be a microprocessor for image processing and connect the display component and the processor. The processor may include one or more GPUs, which execute program instructions to generate or change display information.
[0073] ⑤Camera component
[0074] In some possible implementations, the camera component may be a camera or a camera module, which is used to capture (shoot / scan / collect, etc.) static / dynamic images or videos.
[0075] In some possible implementations, the camera assembly may include a lens, a photosensitive element, etc., and the photosensitive element may be a charge coupled device (CCD) or a complementary metal-oxide-semiconductor (CMOS) phototransistor.
[0076] Therefore, the object can generate an optical image through the lens and project it onto the photosensitive element. The photosensitive element can convert the light signal in the optical image into an electrical signal, and then transmit the electrical signal to the ISP to convert it into a digital image signal. The ISP outputs the digital image signal to the DSP. The DSP converts the digital image signal into an image signal in a standard RGB, YUV or other format.
[0077] It should be noted that the device can realize functions such as capturing (shooting / scanning, etc.) images through ISP, DSP, camera components, video codecs, GPU, display components and processors.
[0078] In some possible implementations, the ISP can be used to process data fed back by the camera assembly. For example, when taking a photo, the shutter is opened first, and then the light is transmitted through the lens of the camera assembly to the photosensitive element of the camera assembly to convert the light signal into an electrical signal, and finally the electrical signal is transmitted to the ISP through the photosensitive element to be processed and converted into a digital image.
[0079] In some possible implementations, the ISP can also perform algorithmic optimization on the noise, brightness, and skin color of the image.
[0080] In some possible implementations, the ISP can also optimize parameters such as exposure and color temperature of the shooting scene.
[0081] In some possible implementations, the ISP and / or DSP may be provided in the camera assembly.
[0082] ⑥Communication components
[0083] It should be noted that the communication component can be used to support electronic devices to communicate.
[0084] In some possible implementations, the communication component can provide solutions for wireless communications including 2G / 3G / 4G / 5G, etc., applied to electronic devices.
[0085] In some possible implementations, the communication component can provide wireless communication solutions for application in electronic devices, including Bluetooth (BT), wireless local area networks (WLAN), wireless fidelity (Wi-Fi) networks, near field communication (NFC), ultra wide band (UWB), infrared technology (IR), etc.
[0086] In some possible implementations, the communication component can receive electromagnetic waves through an antenna, filter, amplify, and process the received electromagnetic waves, and transmit them to a modem processor for demodulation. The communication component can also amplify the signal modulated by the modem processor and convert it into electromagnetic waves for radiation through the antenna.
[0087] In some possible implementations, the communication component may include at least one filter, a switch, a power amplifier, a low noise amplifier (LNA), and the like.
[0088] In some possible implementations, at least some functional modules of the communication component may be disposed in a processor; or, at least some functional modules of the communication component may be disposed in the same device as some modules of the processor.
[0089] ⑦Input / output driver
[0090] In some possible implementations, an input / output driver may be used to handle various inputs / outputs from a user-operated device.
[0091] For example, when the display screen is a touch screen, the input / output driver may be operable to detect and process various click events or touch events, etc. The click event or touch event on the touch screen may simultaneously indicate an area of interest and start scanning an object. The object may be displayed on the touch screen as a preview of an image to be scanned, and a touch event at a specific location on the touch screen indicates an image that should be scanned.
[0092] 2. A Neural Network Model Deployment Method
[0093] 1. Description
[0094] Currently, there are many neural network models deployed to evaluate system performance, but these neural network models either have poor network deployability due to complex network structure, or have low evaluation accuracy due to simple network structure.
[0095] Based on this, Figure 1 As shown, Figure 1 : is a flowchart of a neural network model deployment method according to an embodiment of the present application, and the method may include the following steps:
[0096] S110, deploying a neural network model, where the neural network model is used to evaluate the central processing unit (CPU) performance of the system according to the system performance data;
[0097] Among them, the neural network model is composed of at least one of the following: a first type of network model is used to determine the number of CPU cycles for cache misses; a second type of network model is used to determine the number of CPU cycles for bypass translation buffer TLB misses; a third type of network model is used to determine the number of CPU cycles for CPU stalls; a fourth type of network model is used to determine the number of CPU cycles for branch prediction errors; a fifth type of network model is used to determine the average number of CPU cycles for executing instructions; and a sixth type of network model is used to determine the total number of CPU cycles for executing instructions.
[0098] It should be noted that the first type of network model can be used to determine the number of CPU cycles for cache misses based on system performance data; the second type of network model can be used to determine the number of CPU cycles for bypass translation buffer TLB misses based on system performance data; the third type of network model can be used to determine the number of CPU cycles for CPU stalls based on system performance data; the fourth type of network model can be used to determine the number of CPU cycles for branch prediction errors based on system performance data; the fifth type of network model can be used to determine the average number of CPU cycles for executing instructions based on system performance data; and the sixth type of network model can be used to determine the total number of CPU cycles for executing instructions based on system performance data.
[0099] It can be seen that the present application can evaluate the CPU performance of the system by deploying a neural network model. Since the present application needs to jointly evaluate the CPU performance of the system according to various performance parameters of the system (such as cache miss, TLB miss, CPU stall, branch prediction error, instruction, etc.), and the present application can obtain these performance parameters according to the neural network model, in order to ensure that the network structure of the neural network model has low complexity, the present application can form the neural network model through multiple types of network models (i.e., at least one of the first type of network model, the second type of network model, the third type of network model, the fourth type of network model, the fifth type of network model, and the sixth type of network model), and each type of network model is used to determine a type of performance parameter, thereby realizing the deployment of a low-complexity and high-precision neural network model to evaluate the CPU performance of the system.
[0100] 2. Specific implementation instructions
[0101] The following is the above Figure 1 It should be noted that the contents in the following sections can be combined and related to each other in order to realize the complete technical solution of this application.
[0102] 1) System and system frequency
[0103] a. System
[0104] It should be noted that the system of the present application can be regarded as a system loaded with a CPU, which can be a software and hardware entity.
[0105] For example, the system may be a CPU micro-architecture system, a chip or a processor (such as a system-on-chip (SOC)), an electronic device, etc.
[0106] In some possible implementations, the system may include at least one of a CPU, a cache, a translation lookaside buffer (TLB), a memory, etc. Each of these is described below.
[0107] CPU
[0108] It should be noted that the CPU, as the computing and control core of the computer system, is the final execution unit for information processing and program running. The frequency of the CPU can be called the CPU frequency.
[0109] ◆Cache
[0110] It should be noted that cache refers to a storage device that can exchange data at high speed. It exchanges data with the CPU before the main memory, so the speed is very fast. In other words, the CPU reads data from the cache first and then from the main memory. When the data required by the CPU is not in the cache, the CPU will access the main memory.
[0111] In addition, the process in which the CPU finds useful data in the cache is called a "cache hit", and the process in which the CPU does not find useful data in the cache is called a "cache miss".
[0112] For example, the cache may have multiple levels, such as a first-level cache (L1 Cache), a second-level cache (L2 Cache), a third-level cache (L3 Cache), etc. Among them, the L1 Cache may include an L1 instruction cache (L1i Cache), an L1 data cache (L1dCache), etc.; the L2 Cache may include an L2 data cache (L2d Cache), etc.; the L3 Cache may include an L3 data cache (L3d Cache), etc.
[0113] The process of the CPU finding an instruction in the L1i Cache is called a "L1i Cache Hit", and the process of the CPU not finding an instruction in the L1i Cache is called a "L1i Cache Miss". The same goes for L1d Cache, L2d Cache, and L3d Cache, and we will not go into details here.
[0114] ◆TLB
[0115] It should be noted that the TLB may be a small cache for storing the conversion from virtual addresses to physical addresses, wherein the processor may use the effective page frame number (EPN) to find the final real page frame number (RPN) in the TLB.
[0116] The process in which the CPU finds useful data in the TLB is called a "TLB hit", and the process in which the CPU does not find useful data in the TLB is called a "TLB miss".
[0117] For example, the TLB may have multiple levels of TLBs, such as L1 TLB, L2 TLB, etc. Among them, the L1 TLB may include L1 instruction TLB (L1iTLB), L1 data TLB (L1d TLB), etc.; the L2 TLB may include L2 data TLB (L2d TLB), etc.
[0118] The process of the CPU finding an instruction in the L1i TLB is called a "first-level instruction TLB hit", and the process of the CPU not finding an instruction in the L1i TLB is called a "first-level instruction TLB miss". For the L2d TLB, the same is true and will not be described in detail.
[0119] Memory
[0120] It should be noted that the memory can be called internal memory, which is used to store the calculation data in the CPU and the data exchanged with external storage such as hard disk. As long as the computer is running, the CPU will transfer the data to be calculated to the memory for calculation. When the calculation is completed, the CPU will transmit the result. The operation of the memory also determines the stable operation of the computer.
[0121] For example, the memory of the present application may include various types of memory, for example, the memory may include RAM, SDRAM, DDR SDRAM, etc.
[0122] b. System frequency
[0123] It should be noted that the system frequency will affect the latency of the system processing data. At the same time, too high a latency will affect the system's operating speed, causing the system to freeze and reduce the overall performance of the system.
[0124] In some possible implementations, the system frequency may include at least one of a CPU frequency, a cache frequency, a memory frequency, and the like.
[0125] CPU frequency is the CPU clock frequency (i.e. main frequency), the operating frequency of the CPU operation, which determines the operating speed of the system and is the reciprocal of the CPU clock cycle. Among them, the CPU clock cycle is the time required for the clock pulse, also called the beat pulse or T cycle, which is the smallest time unit in the CPU.
[0126] In this way, the present application can dynamically adjust the CPU frequency in order to optimize / schedule the performance of the system.
[0127] The cache frequency may represent the latency / rate of reading and writing the cache and / or accessing the cache. In this way, the present application may dynamically adjust the cache frequency to optimize / schedule the performance of the system.
[0128] For example, the cache frequency may include the frequency of the L3 cache, ie, the L3 frequency.
[0129] Memory frequency can represent the latency / rate of reading and writing memory and / or accessing memory. In this way, the present application can dynamically adjust the memory frequency to optimize / schedule the performance of the system.
[0130] For example, the memory frequency may include the frequency of DDR SDRAM, that is, DDR frequency.
[0131] 2) System performance data
[0132] a. Description
[0133] It should be noted that the system performance data can be used to represent data related to various performance monitoring unit (PMU) events, various components, CPU micro-architecture hardware, etc. of the system.
[0134] It should be noted that many chip architectures include PMU, which can be used to track and count some low-level hardware events within the system, such as chip-related events (such as the number of instructions executed, the number of exceptions captured, the number of clock cycles, etc.), cache-related events (such as the number of L1 cache accesses, etc.), TLB-related events, etc., and these events can be called "PMU events".
[0135] PMU can include a set of counters and control registers for operating these counters. Among them, the counters can be divided into two categories: one is the cycle counter, which can only be used to count cycle events; the other is the ordinary performance counter, that is, the event counter, the number of which is not fixed, and the specific number can be determined by the implementation, and the type of event counted can be configured through the control register.
[0136] The system may include various components (such as CPU, memory, cache, TLB, modem, etc.), and these components will have some characteristic performance parameters and generate some operating data.
[0137] The system's CPU can have the CPU manufacturer provide the CPU micro-architecture hardware parameters, which are fixed / default parameters that can be obtained from the CPU micro-architecture manual so that the CPU user can check the CPU-related performance parameters accordingly.
[0138] In some possible implementations, the system performance data may include PMU data and / or CPU micro-architecture hardware parameters, which are described below.
[0139] b.PMU data
[0140] It should be noted that the PMU data may include data of various PMU events and the like.
[0141] For example, the present application can collect PMU data every 100ms, and the interval between two adjacent collections cannot be too short or too long. At the same time, the current collection of PMU events needs to be subtracted from the previous collection of PMU events to represent PMU data. This is because the collection of PMU events is implemented through the PMU event timer, and the PMU event timer is continuously accumulated. Therefore, by subtracting the previous PMU event timer, the actual accumulation number of the PMU event timer within the current 100ms can be obtained.
[0142] In some possible implementations, the PMU data may include at least one of the following:
[0143] The number of instructions executed, the number of cache misses, the number of TLB misses, the number of CPU cycles with frontend stalls, the number of CPU cycles with backend stalls, the number of CPU cycles with backend memory stalls, the number of branch mispredicted, the system frequency, etc.
[0144] It should be noted that the number of executed instructions can be determined by a timer corresponding to the PMU event instructions.
[0145] The number of cache misses may be determined by a timer corresponding to a PMU event called cache refill.
[0146] The number of TLB misses may be determined by a timer corresponding to a PMU event TLB refill.
[0147] The number of CPU cycles of front-end stall may indicate the number of CPU cycles consumed in processing the front-end stall, and may be determined by a timer corresponding to a PMU event stalled-cycles-frontend.
[0148] The number of CPU cycles of backend stall may indicate the number of CPU cycles consumed in processing the backend stall, and may be determined by a timer corresponding to a PMU event stalled-cycles-backend.
[0149] The number of CPU cycles of the backend stall memory may indicate the number of CPU cycles consumed in processing the backend stall memory, and may be determined by a timer corresponding to a PMU event of the backend stall memory (stall-backend-memory).
[0150] The number of branch mispredictions may be determined by a timer corresponding to a PMU event branch mispredicted retired.
[0151] In some possible implementations, the number of cache misses may include at least one of the following: the number of L1 instruction cache misses, the number of L1 data cache misses, the number of L2 data cache misses, and the number of L3 data cache misses.
[0152] It should be noted that, since the cache may have multiple levels, the cache miss may include cache misses at all levels.
[0153] In some possible implementations, the number of TLB misses may include at least one of the following: the number of L1 instruction TLB misses, the number of L1 data TLB misses, and the number of L2 data TLB misses.
[0154] It should be noted that, since the TLB may have multiple levels, a TLB miss may include misses at each level of the TLB.
[0155] c. Preprocessing of PMU data
[0156] It should be noted that, since the PMU data may contain noise, invalid values or outliers, the present application may pre-process the PMU data to reduce the noise, invalid values or outliers.
[0157] d.CPU microarchitecture hardware parameters
[0158] In some possible implementations, the CPU microarchitecture hardware parameters may include at least one of the following: the time to process a cache miss, the time to process a TLB miss, the maximum value of the memory level parallelism (MLP) corresponding to the cache miss, the maximum value of the memory level parallelism corresponding to the TLB miss, and the number of CPU pipeline front-ends (CPU pipeline front-end pipeline depth) (or the number of stages of the CPU pipeline).
[0159] It should be noted that the time for processing a cache miss may include the time for reading and writing the cache and / or the time for accessing the memory.
[0160] The time to handle a TLB miss can include the time to read and write the TLB.
[0161] The number of parallel instruction issuances can be determined by the issue width or dispatch width in the CPU microarchitecture hardware parameters.
[0162] The maximum value of the memory level parallelism (MLP) corresponding to the cache miss can be determined by the Miss Status Handling Registers (MSHR) parameter in the CPU microarchitecture hardware parameters.
[0163] The maximum value of memory-level parallelism corresponding to a TLB miss can be determined by the MSHR parameter in the CPU microarchitecture hardware parameters.
[0164] The number of front ends of the CPU pipeline can be determined by the stages in the CPU microarchitecture hardware parameters.
[0165] 3) Cycle per instruction (CPI), CPI stacks, and second per instruction (SPI)
[0166] a.CPI
[0167] CPI can represent the average number of instruction cycles, which can indicate the average number of CPU cycles the system consumes to execute each instruction.
[0168] b.CPI Stacks
[0169] Since the CPU consumes CPU cycles when executing instructions, in the process of executing instructions, in addition to the CPU cycles, it also consumes the CPU cycles required to read and write data from the cache, memory, TLB, the CPU cycles required for branch prediction errors, the CPU cycles required for CPU stalls, etc. Therefore, these consumed CPU cycles can be uniformly represented by CPI Stacks.
[0170] In other words, CPI Stacks refers to the total CPI, which is composed of the number of CPU cycles consumed by instructions, cache, TLB, memory, branch prediction errors, CPU stalls, etc., and each CPI in CPI Stacks represents a type of consumed CPU cycles.
[0171] For example, CPI Stacks can be:
[0172] CPI Stacks=instruct_cpi+cache_miss_cpi+tlb_miss_cpi+branch_miss_cpi+stall_cpi;
[0173] Among them, instruct_cpi may refer to the average number of CPU cycles for executing instructions, cache_miss_cpi may refer to the number of CPU cycles for cache misses, tlb_miss_cpi may refer to the number of CPU cycles for TLB misses, branch_miss_cpi may refer to the number of CPU cycles for branch prediction errors, and stall_cpi may refer to the number of CPU cycles for CPU stalls.
[0174] For example, taking the CPU microarchitecture with three levels of cache as an example, cache_miss_cpi can be:
[0175] cache_miss_cpi=l1i_miss_cpi+l1d_miss_cpi+l2d_miss_cpi+l3d_miss_cpi;
[0176] Among them, l1i_miss_cpi may indicate the number of CPU cycles of L1i cache (L1i-Cache) misses, l1d_miss_cpi may indicate the number of CPU cycles of L1d cache misses, l2d_miss_cpi may indicate the number of CPU cycles of L2d cache misses, and l3d_miss_cpi may indicate the number of CPU cycles of L3d cache misses.
[0177] Of course, cache_miss_cpi may include only one level of cache misses, may include two levels of cache misses, or may include more than three levels of cache misses, and there is no specific limitation on this.
[0178] For example, taking the CPU microarchitecture with two levels of TLB as an example, tlb_miss_cpi can be:
[0179] tlb_miss_cpi=l1_tlb_miss_cpi+l2d_tlb_miss_cpi;
[0180] Among them, l1_tlb_miss_cpi may indicate the number of CPU cycles of L1 TLB misses, and l2d_tlb_miss_cpi may indicate the number of CPU cycles of L2d TLB misses.
[0181] In addition, l1_tlb_miss_cpi may include l1i_tlb_miss_cpi and / or l1d_tlb_miss_cpi. l1i_tlb_miss_cpi may indicate the number of CPU cycles of L1i TLB miss, and l1d_tlb_miss_cpi may indicate the number of CPU cycles of L1d TLB miss.
[0182] Of course, tlb_miss_cpi may include only one level of TLB misses, or may include more than two levels of TLB misses, and there is no specific limitation on this.
[0183] For example, taking the CPU microarchitecture with front-end stalls and back-end stalls as an example, stall_cpi can be:
[0184] stall_cpi=frontend_stall_cpi+backend_stall_cpi;
[0185] Among them, frontend_stall_cpi can indicate the number of CPU cycles of the CPU front end, and backend_stall_cpi can indicate the number of CPU cycles of the CPU back end.
[0186] Of course, stall_cpi may include other stalls, and there is no specific limitation on this.
[0187] c. Example of CPI Stacks
[0188] The following uses the SPEC integer test case in the Standard Performance Evaluation Cooperation (SPEC) benchmark as an example to illustrate the CPI Stacks of the system under each specint test case.
[0189] like Figure 2As shown in the figure, the specint test cases are sys_400.perlbench, sys_401.bzip2, sys_403.gcc, sys_429.mcf, etc. Each specint test case may have the same or different CPIs, and each specint test case has a different CPI ratio in the CPI Stacks. For example, both sys_400.perlbench and sys_401.bzip2 have instruct_cpi, the CPI Stacks of sys_400.perlbench is 0.3, and the CPI Stacks of sys_401.bzip2 is 0.4, etc. Among them, the CPI Stacks of sys_400.perlbench is 0.3, which means that the system needs to consume 0.3 CPU cycles on average to execute instructions.
[0190] In addition, the CPI Stacks of sys_429.mcf is the highest among all the specint test cases, which is 2.1, indicating that the system needs to consume an average of 2.1 CPU cycles to execute instructions. Among the CPI Stacks of sys_429.mcf, the CPIs with the highest proportion are l2d_miss_cpi and l3d_miss_cpi, indicating that the delays of the two parts are relatively high.
[0191] l2d_miss indicates that the L2 data cache is missing, indicating that there is no data required by the system in the L2 data cache, and the system needs to access the L3 cache. In this regard, l2d_miss_cpi is affected by the speed of accessing the L3 cache. If the l2d_miss_cpi is higher, it means that the delay in accessing the L3 cache is higher. In addition, the speed of accessing the L3 cache may be affected by the L3 cache frequency. If the delay in accessing the L3 cache is higher, the L3 cache frequency may be lower. Therefore, the present application can optimize the speed of accessing the L3 cache by adjusting the L3 cache frequency, so as to reduce the delay in accessing the L3 cache and achieve the purpose of reducing l2d_miss_cpi.
[0192] l3d_miss indicates a L3 data cache miss, indicating that there is no data required by the system in the L3 data cache, and the system needs to access the memory. In this regard, l3d_miss_cpi is affected by the speed of accessing the memory. If l3d_miss_cpi is higher, it means that the latency of accessing the memory is higher. In addition, the speed of accessing the memory may be affected by the memory frequency. If the latency of accessing the memory is higher, the memory frequency may be lower. Therefore, the present application can optimize the speed of accessing the memory by adjusting the memory frequency so as to reduce the latency of accessing the memory and achieve the purpose of reducing l2d_miss_cpi.
[0193] d.SPI
[0194] SPI can represent the average instruction time, which can be expressed as CPI / CPU frequency. In other words, SPI can be CPI divided by CPU frequency, with the unit time being seconds. To convert to nanoseconds (ns), multiply by 1e9.
[0195] 4) Neural Network Model
[0196] a. Description
[0197] It should be noted that the neural network model of the present application can be used to evaluate CPU performance, and the neural network model can be composed of at least one of the following: a first type of network model, a second type of network model, a third type of network model, a fourth type of network model, a fifth type of network model, and a sixth type of network model.
[0198] For example, Figure 3 As shown, the present application can combine the first type of network model, the second type of network model, the third type of network model, the fourth type of network model, the fifth type of network model, and the sixth type of network model to obtain the neural network model of the present application. The following are respectively explained.
[0199] b. The first type of network model
[0200] It should be noted that the first type of network model can be used to determine the number of CPU cycles of cache misses.
[0201] In some possible implementations, the first type of network model may be an artificial neural network (ANN). ANN is a neural network designed specifically by humans, which is very different from common neural networks (such as convolutional neural network (CNN), recurrent neural network (RNN), etc.).
[0202] In some possible implementations, the first type of network model may include at least one of the following:
[0203] The first subnetwork of the first type of network model is used to determine the memory-level parallelism corresponding to the cache miss;
[0204] The second sub-network of the first type of network model is used to determine the number of CPU cycles of the cache miss in parallel according to the memory level corresponding to the cache miss.
[0205] The first subnetwork of the first type of network model may be an ANN, and the second subnetwork of the first type of network model may be an ANN.
[0206] It can be seen that the first type of network model of the present application can be composed of two sub-networks, one sub-network is used to determine the memory-level parallelism corresponding to the cache miss, and the other sub-network is used to determine the number of CPU cycles of the memory-level parallel cache miss corresponding to the cache miss.
[0207] For the convenience of description and explanation, the following application is The number of CPU cycles indicating cache misses is used as an example for explanation.
[0208] In this way, the first subnetwork of the first type of network model of the present application can determine x_MLP, and the second subnetwork of the first type of network model can determine
[0209] ◆x
[0210] x, can indicate a cache miss.
[0211] For example, taking a CPU microarchitecture having three levels of cache as an example, x may include L1i cache miss and / or L1d cache miss, L2d cache miss, and L3d cache miss.
[0212] Of course, x may include only one level of cache misses, two levels of cache misses, or more than three levels of cache misses, and there is no specific limitation on this.
[0213] ◆m x
[0214] m x , which can represent the number of cache misses, can be determined by the timer corresponding to the PMU event cache refill, such as raw-cache-refill.
[0215] Combined with the content in the above “b. PMU data”, this application can collect PMU events to determine m x .
[0216] For example, take the CPU microarchitecture with three levels of cache as an example, m x Can include m L1I$ and / or m L1D$ 、m L2$ 、m L3$ .
[0217] Among them, m L1I$ Indicates the number of L1i cache misses, which can be determined by the timer corresponding to the PMU event L1i cache fill (LII_CACHE_REFILL), such as raw-11i-cache-refill:
[0218] m L1D$ Indicates the number of L1d cache misses, which can be determined by the timer corresponding to the PMU event L1d cache fill (L1D_CACHE_REFILL), such as raw-l1d-cache-refill;
[0219] m L2$ Indicates the number of L2d cache misses, which can be determined by the timer corresponding to the PMU event L2d cache fill (L2D_CACHE_REFILL), such as raw-12d-cache-refill;
[0220] m L3$ Indicates the number of L3d cache misses, which can be determined by the timer corresponding to the PMU event L3d cache fill (L3D_CACHE_REFILL), such as raw-13d-cache-refill.
[0221] Of course, x It may include only the number of cache misses at one level, may include the number of cache misses at two levels, or may include the number of cache misses at more than three levels, and there is no specific limitation on this.
[0222] ◆c x
[0223] c x , may represent the time for processing cache misses, and the unit may be the number of CPU cycles. The time for processing cache misses may include the time for reading and writing cache and / or the time for accessing memory.
[0224] Combined with the content in "d. CPU micro-architecture hardware parameters" above, this application can determine c by using the CPU micro-architecture hardware parameters provided by the CPU manufacturer. x .
[0225] For example, let's take a CPU microarchitecture with three levels of cache. x Can include c L2I and / or c L2D 、c L3 、c mem .
[0226] Among them, c L2I It can represent the time to process L1i cache misses, which can include the time to access L2d cache and the time to read and write L1i cache, which can be determined by CPU microarchitecture hardware parameters;
[0227] c L2DIt can represent the time to process L1d cache miss, which can include the time to access L2d cache and the time to read and write L1d cache, which can be determined by CPU microarchitecture hardware parameters;
[0228] c L3 It can represent the time to process L2d cache miss, which can include the time to access L3d cache and the time to read and write L2d cache, which can be determined by CPU microarchitecture hardware parameters;
[0229] c mem It can represent the time to process L3d cache miss, which can include the time to access memory and the time to read and write L3d cache, and can be determined by the CPU microarchitecture hardware parameters.
[0230] Of course, x It may include only the time for processing one level of cache misses, may include the time for processing two levels of cache misses, or may include the time for processing more than three levels of cache misses, and there is no specific limitation on this.
[0231] ◆x_MLP
[0232] x_MLP,can represent memory-level parallelism corresponding to cache misses.
[0233] It should be noted that, since x_MLP can be a fitting parameter, the present application can determine x_MLP by constructing a first subnetwork of the first type of network model.
[0234] For example, the present application may input the data related to x_MLP in the system performance data into the first sub-network of the first type of network model, thereby outputting x_MLP. The data related to x_MLP in the system performance data may include m x and c x wait.
[0235] For example, x_MLP can be:
[0236] x_MLP=max(bi*(m x +1) bj , x_max_mlp);
[0237] Among them, bi and bj are fitting parameters or preset parameters, and the fitting parameters or preset parameters of different cache misses are different; x_max_mlp represents the maximum value of memory level parallelism corresponding to the cache miss (x), which can be determined by the MSHR parameter or custom parameter in the CPU microarchitecture hardware parameters.
[0238] For example, taking the CPU microarchitecture with three levels of cache as an example, x_MLP includes L1I_MLP, L1D_MLP, L2_MLP, and L3_MLP.
[0239] L1I_MLP is:
[0240] L1I_MLP=max(bi_L1i*(m llI$ +1) bj_L1i , L1I_max_mlp);
[0241] Wherein, bi_Lli and bj_Lli are fitting parameters or preset parameters; L1I_max_mlp represents the maximum value of memory level parallelism corresponding to L1 instruction cache miss;
[0242] L1D_MLP is:
[0243] L1D_MLP=max(bi_L1d*(m L1D$ +1) bj_L1d , L1D_max_mlp);
[0244] Wherein, bi_L1d and bj_L1d are fitting parameters or preset parameters; L1D_max_mlp represents the maximum value of memory level parallelism corresponding to L1 data cache miss;
[0245] L2D_MLP is:
[0246] L2_MLP=max(bi_L2d*(m L2$ +1) bj_L2d , L2D_max_mlp);
[0247] Wherein, bi_L2d and bj_L2d are fitting parameters or preset parameters; L2D_max_mlp represents the maximum value of memory level parallelism corresponding to L2 data cache miss;
[0248] L3D_MLP is:
[0249] L3_MLP=max(bi_L3d*(m L3$ +1) bj_L3d , L3D_max_mlp);
[0250] Among them, bi_L3d and bj_L3d are fitting parameters or preset parameters; L3D_max_mlp represents the maximum value of memory level parallelism corresponding to L3 data cache miss.
[0251] Of course, x_MLP may include only the maximum value of memory-level parallelism corresponding to one level of cache misses, may include the maximum value of memory-level parallelism corresponding to two levels of cache misses, or may include the maximum value of memory-level parallelism corresponding to processing cache misses of more than three levels, without any specific limitation.
[0252] c. The second type of network model
[0253] It should be noted that the second type of network model can be used to determine the number of CPU cycles of TLB misses.
[0254] In some possible implementations, the second type of network model may be an ANN.
[0255] In some possible implementations, the second type of network model may include at least one of the following:
[0256] The first sub-network of the second type of network model is used to determine the memory-level parallelism corresponding to the TLB miss;
[0257] The second sub-network of the second type of network model is used to determine the number of CPU cycles of the TLB miss in parallel according to the memory level corresponding to the TLB miss.
[0258] Among them, the first sub-network of the second type of network model can be ANN, and the second sub-network of the second type of network model can be ANN.
[0259] It can be seen that the second type of network model of the present application can be composed of two sub-networks, one sub-network is used to determine the memory level parallelism corresponding to the TLB miss, and the other sub-network is used to determine the number of CPU cycles of the TLB miss according to the memory level parallelism corresponding to the TLB miss.
[0260] For the convenience of description and explanation, the following application is The number of CPU cycles indicating TLB misses is used as an example for explanation.
[0261] In this way, the first sub-network of the second type of network model of the present application can determine y_MLP, and the second sub-network of the second type of network model can determine
[0262] ◆y
[0263] y, can indicate a TLB miss.
[0264] For example, taking a CPU microarchitecture with two levels of TLB as an example, y may include an L1 TLB miss and / or an L2d TLB miss.
[0265] Of course, y may include only one level of TLB misses, or may include more than two levels of TLB misses, and there is no specific limitation on this.
[0266] ◆m y
[0267] m y, which can represent the number of TLB misses, can be determined by the timer corresponding to the PMU event TLB refill, such as raw-tlb-refill.
[0268] Combined with the content in the above “b. PMU data”, this application can collect PMU events to determine m y .
[0269] For example, take the CPU microarchitecture with two levels of TLB as an example, m y Can include m L1ITLB$ and / or m L1DTLB$ 、m L2TLB$ .
[0270] Among them, m L1ITLB$ Indicates the number of L1i TLB misses, which can be determined by the timer corresponding to the PMU event L1i TLB fill (L1I_TLB_REFILL), such as raw-l1i-tlb-refill;
[0271] m L1DTLB$ Indicates the number of L1d TLB misses, which can be determined by the timer corresponding to the PMU event L1d TLB fill (L1D_TLB_REFILL), such as raw-11d-tlb-refill;
[0272] m L2TLB$ Indicates the number of L2dTLB misses, which can be determined by the timer corresponding to the PMU event L2d TLB fill (L2D_CACHE_REFILL), such as raw-12d-tlb-refill.
[0273] Of course, y The number of TLB misses at only one level may be included, or the number of TLB misses at more than two levels may be included, and there is no specific limitation on this.
[0274] ◆c y
[0275] c y Indicates the time to process a TLB miss, in units of CPU cycles. The time to process a TLB miss may include the time to read and write the TLB.
[0276] Combined with the content in "d. CPU micro-architecture hardware parameters" above, this application can determine c by using the CPU micro-architecture hardware parameters provided by the CPU manufacturer. y .
[0277] For example, take the CPU microarchitecture with 2 levels of TLB as an example, c yCan include c L2ITLB and / or c L2DTLB 、c walk .
[0278] Among them, c L2ITLB It can represent the time to process L1iTLB miss, which can include the time to access L2d TLB and the time to read and write L1i TLB, which can be determined by CPU microarchitecture hardware parameters;
[0279] c L2DTLB It can represent the time to process L1d TLB miss, which can include the time to access L2d TLB and the time to read and write L1dTLB, which can be determined by CPU microarchitecture hardware parameters;
[0280] c walk It can represent the time for processing L2dTLB miss, which can include the time for accessing L2d Cache (or the time for accessing memory) and the time for reading and writing L2dTLB, and can be determined by the CPU microarchitecture hardware parameters.
[0281] It should be noted that an L2dTLB miss may access the L2d Cache or the memory, depending on the kernel configuration (config). If the config is memory, the L2d TLB miss accesses the memory; if the config is cache, the L2dTLB miss accesses the L2d Cache. The default / preset is to access the L2d Cache.
[0282] Of course, y It may include only the time for processing TLB misses of one level, or it may include the time for processing TLB misses of more than two levels, and there is no specific limitation on this.
[0283] ◆y-MLP
[0284] y_MLP represents memory-level parallelism corresponding to TLB misses.
[0285] It should be noted that, since y_MLP can be a fitting parameter, the present application can determine y_MLP by constructing the first subnetwork of the second type of network model.
[0286] For example, the present application may input the data related to y_MLP in the system performance data into the first sub-network of the second type of network model, thereby outputting y_MLP. The data related to y_MLP in the system performance data may include m y and c y wait.
[0287] For example, y_MLP can be:
[0288] y_MLP=max(bm*(m y +1) bn , y_max_mlp);
[0289] Among them, bm and bn are fitting parameters or preset parameters, and the fitting parameters or preset parameters of different cache misses are different; y_max_mlp represents the maximum value of memory level parallelism corresponding to TLB miss (y), which can be determined by MSHR parameters or custom parameters in the CPU microarchitecture hardware parameters.
[0290] For example, taking the CPU microarchitecture with two levels of TLB as an example, y_MLP includes L1ITLB_MLP, L1DTLB_MLP, and L2TLBD_MLP.
[0291] L1ITLB_MLP is:
[0292] L1ITLB_MLP=max(bm_L1i*(m L1ITLB$ +1) bn_L1 , L1ITLB_max_mlp);
[0293] Wherein, bm_Lli and bn_Lli represent fitting parameters or preset parameters; L1ITLB_max_mlp represents the maximum value of memory level parallelism corresponding to L1i TLB miss;
[0294] L1DTLB-MLP is:
[0295] L1DTLB-MLP=max(bm_Lld*(m LlDTLB$ +1) bn_L1d , L1DTLB_max_mlp);
[0296] Wherein, bm_L1d and bn_L1d represent fitting parameters or preset parameters; L1DTLB_max_mlp represents the maximum value of memory level parallelism corresponding to L1d TLB miss;
[0297] L2TLBD_MLP is:
[0298] L2TLB_MLP=max(bm_L2d*(m L2TLB$ +1) bn_L2d , L2TLB_max_mlp);
[0299] Among them, bm_L2d and bn_L2d represent fitting parameters or preset parameters; L2TLB_max_mlp represents the maximum value of memory level parallelism corresponding to L2 data cache miss, and * represents a multiplication sign.
[0300] Of course, y-MLP may include only the maximum value of memory-level parallelism corresponding to TLB misses at one level, or may include the maximum value of memory-level parallelism corresponding to TLB misses at more than two levels, and there is no specific limitation on this.
[0301] d. The third type of network model
[0302] It should be noted that the third type of network model can be used to determine the number of CPU cycles during which the CPU is stalled.
[0303] In some possible implementations, the third type of network model may be an ANN.
[0304] In some possible implementations, the third type of network model may include at least one of the following:
[0305] The first sub-network of the third type of network model is used to determine the number of CPU cycles during which the CPU front end is stalled;
[0306] The second sub-network of the third type of network model is used to determine the number of CPU cycles during which the CPU backend is stalled;
[0307] The third sub-network of the third type of network model is used to determine the number of CPU cycles in which the CPU is paused according to the number of CPU cycles in which the CPU front end is paused and the number of CPU cycles in which the CPU back end is paused.
[0308] Among them, the first sub-network of the third type of network model can be an ANN, the second sub-network of the third type of network model can be an ANN, and the third sub-network of the third type of network model can be an ANN.
[0309] It can be seen that the third type of network model of the present application can be composed of three sub-networks. The first sub-network is used to determine the number of CPU cycles when the CPU front end is paused, the second sub-network is used to determine the number of CPU cycles when the CPU back end is paused, and the third sub-network is used to determine the number of CPU cycles when the CPU is paused based on the number of CPU cycles when the CPU front end is paused and the number of CPU cycles when the CPU back end is paused.
[0310] For the convenience of description and explanation, the following application uses c stall The CPU stall is used as an example for explanation.
[0311] c stall , which can represent the number of CPU cycles during which the CPU is paused. stall It can be determined by the following PMU events: front-end stalled cycles (stalled-cycles-frontend), back-end stalled cycles (stalled-cycles-backend) and back-end stalled memory (stall-backend-memory).
[0312] For example, c stall Can be:
[0313] c stal =bx*c frontend_stall +by*c backtend_stall .
[0314] In this way, the first subnetwork of the third type of network model can determine c frontend_stall , the second sub-network of the third type of network model can determine c backtend_stall , the second sub-network of the third type of network model can be based on c frontend_stall and c backtend_stall Determine the stall The following is a description of each parameter.
[0315] ◆bx and by
[0316] bx and by can represent fitting parameters or preset parameters.
[0317] ◆c frontend_stall
[0318] c frontend_stall , which can indicate the number of CPU cycles during which the CPU front end is stalled.
[0319] For example, the present application may include system performance data in the frontend_stall The relevant data is input into the first sub-network of the third type of network model, thereby outputting c frontend_stall Among them, with c frontend_stall The relevant data can be determined by stalled-cycles-frontend.
[0320] For example, c frontend_stal for:
[0321] c frontend_stal =c frontend_stall_cycle -c frontend_cycle -Δc;
[0322] Among them, c frontend_stall_cycle Indicates the total number of CPU cycles in which the CPU front end is stalled, as determined by the timer corresponding to stalled-cycles-frontend, such as raw-stalled-cycles-frontend; c frontend_cycle Indicates the number of CPU cycles during which the CPU front end is paused after fitting is completed; Δc indicates c backtend_stall The remaining items that have not been deducted.
[0323] For example, let's take a CPU microarchitecture with 3 levels of cache and 2 levels of TLB. frontend_cycle for:
[0324]
[0325] ◆c backtend_stall
[0326] c backtend_stall , which can indicate the number of CPU cycles during which the CPU backend is stalled.
[0327] For example, the present application may include system performance data in the backtend_stall The relevant data is input into the second sub-network of the third type of network model, thereby outputting c backtend_stall ; Among them, with c backtend_stall The relevant data can be determined by the stalled-cycles-backend.
[0328] For example, c backtend_stall for:
[0329] c backtend_stall =c backtend_stall-cycle -c backtend-cycle ;
[0330] Among them, c backtend_stall_cycle Indicates the total number of CPU cycles in which the CPU backend is stalled, as determined by the timer corresponding to stalled-cycles-backend, such as raw-stalled-cycles-backend; c backtend_cycle Indicates the number of CPU cycles that the CPU backend was stalled for while the fit was completed.
[0331] For example, let's take a CPU microarchitecture with 3 levels of cache and 2 levels of TLB. backtend_cycle for:
[0332]
[0333] e. The fourth type of network model
[0334] It should be noted that the fourth type of network model can be used to determine the number of CPU cycles for branch prediction errors;
[0335] In some possible implementations, the fourth type of network model may be an ANN.
[0336] In some possible implementations, the fourth type of network model includes at least one of the following:
[0337] The first sub-network of the fourth type of network model is used to determine the branch prediction processing time (branch resolution time);
[0338] The second sub-network of the fourth type of network model is used to determine the number of CPU cycles of branch prediction errors according to the branch prediction processing time.
[0339] Among them, the first sub-network of the fourth type of network model can be ANN, and the second sub-network of the fourth type of network model can be ANN.
[0340] It can be seen that the fourth type of network model of the present application can be composed of two sub-networks, the first sub-network is used to determine the branch prediction processing time, and the second sub-network is used to determine the number of CPU cycles of branch prediction errors based on the branch prediction processing time.
[0341] For the convenience of description and explanation, the following application uses m br ×(c br +c fe ) represents the number of CPU cycles with branch prediction errors as an example.
[0342] In this way, the first subnetwork of the fourth type of network model of the present application can determine c br , and then m br 、c br and c fe As the input of the second sub-network of the fourth type of network model, the output is m br ×(c br +c fe ).
[0343] ◆m br
[0344] m br Indicates the number of branch misprediction events, which can be determined by the timer corresponding to the PMU event branchmispredicted retired, such as raw-br-mis-pred-retired.
[0345] Combined with the content in the above “b. PMU data”, this application can collect PMU events to determine m hr .
[0346] ◆c br
[0347] c br , which can represent the branch prediction processing time.
[0348] It should be noted that due to c br It can be a fitting parameter, so the present application can determine c by constructing the first subnetwork of the fourth type of network model. br .
[0349] For example, the present application may include system performance data in the br The relevant data is input into the first sub-network of the fourth type of network model, thereby outputting cbr Among them, the system performance data is related to c br Related data may include m br 、m x and the number of executed instructions, etc.
[0350] For example, c br Can be:
[0351]
[0352] Among them, b1, b2, b3 and b4 are fitting parameters or preset parameters;
[0353] mpμ br for:
[0354]
[0355] Among them, N can represent the number of executed instructions, which can be determined by the timer corresponding to the PMU event instructions; combined with the content in the above "b. PMU data", the present application can collect PMU events to determine N.
[0356] mpμ L1D$ for:
[0357]
[0358] mpμ L1DTLB$ for:
[0359]
[0360] ◆c fe
[0361] c fe , which can represent the number of front ends of the CPU pipeline or the number of stages of the CPU pipeline.
[0362] Combined with the content in "d. CPU micro-architecture hardware parameters" above, this application can determine c by using the CPU micro-architecture hardware parameters provided by the CPU manufacturer. fe .
[0363] For example, ARMA77 stages=13 means c fe is 13.
[0364] f. The fifth type of network model
[0365] It should be noted that the fifth type of network model can be used to determine the average number of CPU cycles to execute instructions;
[0366] In some possible implementations, the fifth type of network model may be an ANN.
[0367] In some possible implementations, the fifth type of network model includes at least one of the following:
[0368] The first sub-network of the fifth type of network model is used to determine the number of parallel issuance of instructions;
[0369] The second sub-network of the fifth type of network model is used to determine the average number of CPU cycles for executing instructions according to the number of parallel instruction issuances.
[0370] Among them, the first sub-network of the fifth type of network model can be ANN, and the second sub-network of the fifth type of network model can be ANN.
[0371] It can be seen that the fifth type of network model of the present application can be composed of two sub-networks, the first sub-network is used to determine the number of parallel instruction issuances, and the second sub-network is used to determine the average number of CPU cycles for executing instructions based on the number of parallel instruction issuances.
[0372] For example, Represents the average number of CPU cycles to execute instructions; where D can represent the number of instructions issued in parallel, and N can represent the number of instructions executed.
[0373] Thus, since D can be a fitting parameter, the present application can determine D by constructing the first sub-network of the fifth type of network model, and then use D and N as the input of the second sub-network of the fifth type of network model, thereby outputting
[0374] g. The sixth type of network model
[0375] It should be noted that the sixth type of network model is used to determine the total number of CPU cycles to execute instructions.
[0376] In some possible implementations, the sixth type of network model may be an ANN.
[0377] In some possible implementations, the sixth type of network model can be used to sum the outputs of the remaining types of network models in the neural network model except the sixth type of network model to obtain the total number of CPU cycles for executing instructions.
[0378] For example, the output of the first type of network model The second network model output The third network model outputs c stall , the fourth type of network model outputs m br ×(c br +c fe ), the fifth network model output For example, the total number of CPU cycles of the instructions output by the sixth type of network model is:
[0379]
[0380] Among them, CPU-Cycle represents the total number of CPU cycles to execute instructions.
[0381] It can be seen that the present application can regard the above formula as a fitting relationship between input data and output data, and thus communicate the first type of network model, the second type of network model, the third type of network model, the fourth type of network model, the fifth type of network model and the sixth type of network model of the present application through the fitting relationship, so as to combine these network models to realize the construction of the neural network model of the present application.
[0382] In addition, combined with the above "b.CPI Stacks" and "d.SPI", the above formula can be viewed as follows:
[0383] CPU_Cycle=instruction cycles+cache miss cycles+tlb miss cycles+branch miss cycles+stall cycles;
[0384] Among them, CPU-Cycle can be regarded as CPU cycles, CPU cycles can represent the total number of CPU cycles consumed to execute instructions, and the various sub-items of CPU cycles can form CPI Stacks;
[0385] It can represent the average number of CPU cycles to execute instructions, i.e. instmct_cpi;
[0386] It can represent the number of CPU cycles for cache misses, i.e. cache_miss_cpi;
[0387] It can represent the number of CPU cycles of TLB miss, i.e. tlb_miss_cpi;
[0388] branchmiss cycles=m br ×(c br +c fe ), which can represent the number of CPU cycles of branch prediction errors, namely branch_miss_cpi;
[0389] stall cycles=c stakk , which can represent the number of CPU cycles when the CPU is stalled, that is, stall_cpi.
[0390] It can be seen that the above formula can be regarded as CPI Stacks and the proportion of each CPI in CPI Stacks.
[0391] Taking the CPU microarchitecture with 3 levels of cache and 2 levels of TLB as an example, the above formula can be:
[0392]
[0393] h. Training of neural network model
[0394] It should be noted that the present application can continuously iteratively train various types of network models in the neural network model by collecting training samples, thereby continuously improving the prediction accuracy of the CPU performance model.
[0395] 3. Exemplary description of a neural network model deployment device
[0396] 1. Description
[0397] The above mainly introduces the scheme of the embodiment of the present application from the perspective of the execution process of the method side. It is understandable that in order to achieve the above functions, the electronic device or system includes a hardware structure and / or software module corresponding to the execution of each function. Those skilled in the art should know that, in combination with the methods, functions, modules, units or steps of each example described in the embodiments provided herein, the present application can be implemented in the form of hardware or a combination of hardware and computer software. Whether a certain method, function, module, unit or step is executed in the form of hardware or computer software driving hardware depends on the specific application and design constraints of the technical solution. Those skilled in the art can use different methods to implement the described methods, functions, modules, units or steps for each specific application, but such implementation should not be considered to exceed the scope of the present application.
[0398] The embodiment of the present application can divide the electronic device or system into functional units / modules according to the above method example. For example, each functional unit / module can be divided according to each function, or two or more functions can be integrated into one functional unit / module. The above integrated functional unit / module can be implemented in hardware or in software program. It should be noted that the division of functional units / modules in the embodiment of the present application is schematic, which is only a logical function division, and there may be other division methods in actual implementation.
[0399] In the case of an integrated unit, Figure 4 The neural network model deployment device 400 specifically includes: a deployment unit 410.
[0400] It should be noted that the deployment unit 410 may be a module unit for deploying a network model, etc., and there is no specific limitation on this.
[0401] In some possible implementations, the deployment unit 410 may be integrated into the processing unit.
[0402] It should be noted that the processing unit may be a processor or a controller, such as a central processing unit (CPU), a general processor, a digital signal processor (DSP), an application-specific integrated circuit (ASIC), a field programmable gate array (FPGA) or other programmable logic devices, transistor logic devices, hardware components or any combination thereof. It may implement or execute various exemplary logic blocks, modules and circuits described in conjunction with the disclosure of this application. The processing unit may also be a combination that implements a computing function, such as a combination of one or more microprocessors, a combination of a DSP and a microprocessor, etc.
[0403] In some possible implementations, the neural network model deployment device 400 may also include a storage unit for storing computer programs or instructions executed by the neural network model deployment device 400.
[0404] For example, the storage unit may be a memory.
[0405] In some possible implementations, the neural network model deployment device 400 may be a chip / chip module / processor / hardware, etc.
[0406] In specific implementation, the neural network model deployment device 400 is used to execute the steps described in the above method embodiment. Detailed description is given below.
[0407] A deployment unit 410 is used to deploy a neural network model, where the neural network model is used to evaluate the central processing unit CPU performance of the system according to the system performance data;
[0408] The neural network model consists of at least one of the following:
[0409] The first type of network model is used to determine the number of CPU cycles for cache misses;
[0410] The second type of network model is used to determine the number of CPU cycles to bypass the translation buffer TLB;
[0411] The third type of network model is used to determine the number of CPU cycles during which the CPU is stalled;
[0412] The fourth type of network model is used to determine the number of CPU cycles for branch prediction errors;
[0413] The fifth type of network model is used to determine the average number of CPU cycles to execute instructions;
[0414] The sixth type of network model is used to determine the total number of CPU cycles to execute instructions.
[0415] It can be seen that the present application can evaluate the CPU performance of the system by deploying a neural network model. Since the present application needs to jointly evaluate the CPU performance of the system according to various performance parameters of the system (such as cache miss, TLB miss, CPU stall, branch prediction error, instruction, etc.), and the present application can obtain these performance parameters according to the neural network model, in order to ensure that the network structure of the neural network model has low complexity, the present application can form the neural network model through multiple types of network models (i.e., at least one of the first type of network model, the second type of network model, the third type of network model, the fourth type of network model, the fifth type of network model, and the sixth type of network model), and each type of network model is used to determine a type of performance parameter, thereby realizing the deployment of a low-complexity and high-precision neural network model to evaluate the CPU performance of the system.
[0416] It should be noted that the specific implementation of each operation performed by the neural network model deployment device 400 can be found in the corresponding description of the method embodiment shown above, and will not be repeated here.
[0417] 2. Other implementation methods
[0418] Some of the implementation methods involved are further explained below, and other contents not involved can be found in the above description in detail, which will not be repeated here.
[0419] In some possible implementations, the first type of network model includes at least one of the following:
[0420] The first subnetwork of the first type of network model is used to determine the memory-level parallelism corresponding to the cache miss;
[0421] The second sub-network of the first type of network model is used to determine the number of CPU cycles of the cache miss in parallel according to the memory level corresponding to the cache miss.
[0422] It should be noted that, in combination with the content of the above "b. First type of network model", the first type of network model of the present application can be composed of two sub-networks, one sub-network is used to determine the memory-level parallelism corresponding to the cache miss, and the other sub-network is used to determine the number of CPU cycles of the memory-level parallel cache miss corresponding to the cache miss.
[0423] by For example, the first subnetwork of the first type of network model of the present application can determine x_MLP, and the second subnetwork of the first type of network model can determine
[0424] In some possible implementations, the second type of network model includes at least one of the following:
[0425] The first sub-network of the second type of network model is used to determine the memory-level parallelism corresponding to the TLB miss;
[0426] The second sub-network of the second type of network model is used to determine the number of CPU cycles of the TLB miss in parallel according to the memory level corresponding to the TLB miss.
[0427] It should be noted that, in combination with the content of the above "c. Second type of network model", the second type of network model of the present application can be composed of two sub-networks, one sub-network is used to determine the memory level parallelism corresponding to the TLB miss, and the other sub-network is used to determine the number of CPU cycles of the TLB miss based on the memory level parallelism corresponding to the TLB miss.
[0428] by For example, the first sub-network of the second type of network model of the present application can determine y_MLP, and the second sub-network of the second type of network model can determine
[0429] In some possible implementations, the third type of network model includes at least one of the following:
[0430] The first sub-network of the third type of network model is used to determine the number of CPU cycles during which the CPU front end is stalled;
[0431] The second sub-network of the third type of network model is used to determine the number of CPU cycles during which the CPU backend is stalled;
[0432] The third sub-network of the third type of network model is used to determine the number of CPU cycles in which the CPU is paused according to the number of CPU cycles in which the CPU front end is paused and the number of CPU cycles in which the CPU back end is paused.
[0433] It should be noted that, in combination with the content of the above "d. The third type of network model", the third type of network model of the present application can be composed of three sub-networks. The first sub-network is used to determine the number of CPU cycles when the CPU front end is paused, the second sub-network is used to determine the number of CPU cycles when the CPU back end is paused, and the third sub-network is used to determine the number of CPU cycles when the CPU is paused based on the number of CPU cycles when the CPU front end is paused and the number of CPU cycles when the CPU back end is paused.
[0434] For example, c stallFor example, the number of CPU cycles indicating CPU pauses, c stall Can be:
[0435] c stall =bx*c frontend_stall +by*c backtend_stall .
[0436] In this way, the first subnetwork of the third type of network model can determine c frontend_stall , the second sub-network of the third type of network model can determine c backtend_stall , the second sub-network of the third type of network model can be based on c frontend_stall and c backtend_stall Determine the stall .
[0437] In some possible implementations, the fourth type of network model includes at least one of the following:
[0438] The first sub-network of the fourth type of network model is used to determine the branch prediction processing time;
[0439] The second sub-network of the fourth type of network model is used to determine the number of CPU cycles of branch prediction errors according to the branch prediction processing time.
[0440] It should be noted that, in combination with the content of the above "e. The fourth type of network model", the fourth type of network model of the present application can be composed of two sub-networks, the first sub-network is used to determine the branch prediction processing time, and the second sub-network is used to determine the number of CPU cycles for branch prediction errors based on the branch prediction processing time.
[0441] m br ×(c br +c fe ) represents the number of CPU cycles of branch prediction errors as an example, the first subnetwork of the fourth type of network model of the present application can determine c br , and then m br 、c br and c fe As the input of the second sub-network of the fourth type of network model, the output is m br ×(c br +c fe ).
[0442] In some possible implementations, the fifth type of network model includes at least one of the following:
[0443] The first sub-network of the fifth type of network model is used to determine the number of parallel issuance of instructions;
[0444] The second sub-network of the fifth type of network model is used to determine the average number of CPU cycles for executing instructions according to the number of parallel instruction issuances.
[0445] It should be noted that, combined with the content of the above "f. Fifth type of network model", the fifth type of network model of the present application can be composed of two sub-networks, the first sub-network is used to determine the number of parallel instruction issuances, and the second sub-network is used to determine the average number of CPU cycles for executing instructions based on the number of parallel instruction issuances.
[0446] by As an example, D can be a fitting parameter. Therefore, the present application can determine D by constructing the first sub-network of the fifth network model, and then use D and N as the input of the second sub-network of the fifth network model, thereby outputting
[0447] In some possible implementations, the system performance data includes performance monitoring unit PMU data and / or CPU microarchitecture hardware parameters;
[0448] PMU data, including at least one of the following: number of executed instructions, number of cache misses, number of TLB misses, number of CPU cycles with front-end stalls, number of CPU cycles with back-end stalls, number of CPU cycles with back-end stalls on memory, number of branch mispredictions, and system frequency;
[0449] CPU microarchitecture hardware parameters, including at least one of the following: time to process cache miss, time to process TLB miss, maximum value of memory-level parallelism corresponding to cache miss, maximum value of memory-level parallelism corresponding to TLB miss, and number of front-ends of CPU pipeline.
[0450] It should be noted that, in combination with the content in the above “2) System Performance Data”, the system performance data can be used to represent data related to various PMU events, various components, CPU micro-architecture hardware, etc. of the system.
[0451] Many chip architectures include a PMU, which can be used to track and count some low-level hardware events within the system, such as chip-related events (such as the number of instructions executed, the number of exceptions captured, the number of clock cycles, etc.), cache-related events (such as the number of L1 cache accesses, etc.), TLB-related events, etc., and these events can be called "PMU events".
[0452] PMU can include a set of counters and control registers for operating these counters. Among them, the counters can be divided into two categories: one is the cycle counter, which can only be used to count cycle (CYCLES) events, and each PMU has only one cycle counter; the other is the ordinary performance counter, that is, the event counter, the number of which is not fixed, and the specific number can be determined by the implementation, and the type of event counted can be configured through the control register.
[0453] The system may include various components (such as CPU, memory, cache, TLB, modem, etc.), and these components will have some characteristic performance parameters and generate some operating data.
[0454] The system's CPU can have the CPU manufacturer provide the CPU micro-architecture hardware parameters, which are fixed / default parameters that can be obtained from the CPU micro-architecture manual so that the CPU user can check the CPU-related performance parameters accordingly.
[0455] In some possible implementations, a cache miss includes at least one of the following: a level 1 instruction cache miss, a level 1 data cache miss, a level 2 data cache miss, a level 3 data cache miss;
[0456] A TLB miss includes at least one of the following: a first-level instruction TLB miss, a first-level data TLB miss, or a second-level data TLB miss.
[0457] It should be noted that, in combination with the content in the above “2) System performance data”, since the cache may have multiple levels, the cache miss may include cache misses at all levels.
[0458] IV. Exemplary description of an electronic device
[0459] 1. Description
[0460] The following is a schematic diagram of the structure of an electronic device according to an embodiment of the present application. Figure 5 The electronic device 500 includes a processor 510 , a memory 520 , and at least one communication bus for connecting the processor 510 and the memory 520 .
[0461] In some possible implementations, the processor 510 may be one or more central processing units (CPUs). In the case where the processor 510 is a CPU, the CPU may be a single-core CPU or a multi-core CPU. The memory 520 includes, but is not limited to, a random access memory (RAM), a read-only memory (ROM), an erasable programmable read-only memory (EPROM), or a portable read-only memory (CD-ROM), and the memory 520 is used to store computer programs or instructions.
[0462] In some possible implementations, the electronic device 500 further includes a communication interface, which is used to receive and send data.
[0463] In some possible implementations, the processor 510 in the electronic device 500 is used to execute the computer program or instruction 521 stored in the memory 520 to implement the following steps:
[0464] Deploy a neural network model for evaluating the system's central processing unit (CPU) performance based on the system performance data;
[0465] Among them, the neural network model is composed of at least one of the following: a first type of network model is used to determine the number of CPU cycles for cache misses; a second type of network model is used to determine the number of CPU cycles for bypass translation buffer TLB misses; a third type of network model is used to determine the number of CPU cycles for CPU stalls; a fourth type of network model is used to determine the number of CPU cycles for branch prediction errors; a fifth type of network model is used to determine the average number of CPU cycles for executing instructions; and a sixth type of network model is used to determine the total number of CPU cycles for executing instructions.
[0466] It can be seen that the present application can evaluate the CPU performance of the system by deploying a neural network model. Since the present application needs to jointly evaluate the CPU performance of the system according to various performance parameters of the system (such as cache miss, TLB miss, CPU stall, branch prediction error, instruction, etc.), and the present application can obtain these performance parameters according to the neural network model, in order to ensure that the network structure of the neural network model has low complexity, the present application can form the neural network model through multiple types of network models (i.e., at least one of the first type of network model, the second type of network model, the third type of network model, the fourth type of network model, the fifth type of network model, and the sixth type of network model), and each type of network model is used to determine a type of performance parameter, thereby realizing the deployment of a low-complexity and high-precision neural network model to evaluate the CPU performance of the system.
[0467] It should be noted that the specific implementation of each operation performed by the electronic device 500 can refer to the corresponding description of the method embodiment shown above, and will not be repeated here.
[0468] V. Other Explanations
[0469] An embodiment of the present application also provides a computer-readable storage medium, wherein a computer program or instructions are stored on the computer-readable storage medium, and when the computer program or instructions are executed by a processor, the steps described in the above embodiment are implemented.
[0470] The present application also provides a computer program product, including a computer program or instructions, wherein the computer program or instructions are executed by a processor to implement the steps described in the above embodiment. Exemplarily, the computer program product may be a software installation package.
[0471] In addition, a computer program product should be understood as a software product that mainly implements the technical solution of the present application through computer programs or instructions.
[0472] It should be noted that, for the above-mentioned various embodiments, for the sake of simple description, they are all expressed as a series of action combinations. Those skilled in the art should be aware that the present application is not limited by the described order of actions, because some steps in the embodiments of the present application can be performed in other orders or simultaneously. In addition, those skilled in the art should also be aware that the embodiments described in the specification are all preferred embodiments, and the actions, steps, modules or units involved are not necessarily required by the embodiments of the present application.
[0473] In the above embodiments, the embodiments of the present application have different focuses on the description of each embodiment. For parts that are not described in detail in a certain embodiment, please refer to the relevant descriptions of other embodiments.
[0474] Those skilled in the art should be aware that the methods, steps or functions of related modules / units described in the embodiments of the present application can be implemented in whole or in part by software, hardware, firmware or any combination thereof. When implemented using software, it can be implemented in whole or in part in the form of a computer program product, or it can be implemented by a processor executing a computer program instruction. Wherein, the computer program product includes at least one computer program instruction, and the computer program instruction can be composed of corresponding software modules, and the software module can be stored in RAM, flash memory, ROM, EPROM, EEPROM, register, hard disk, mobile hard disk, read-only compact disk (CD-ROM) or any other form of storage medium known in the art. The computer program instruction can be stored in a computer-readable storage medium, or transmitted from one computer-readable storage medium to another computer-readable storage medium. For example, the computer program instruction can be transmitted from a website site, computer, server or data center to another website site, computer, server or data center by wired or wireless means. The computer-readable storage medium can be any available medium that a computer can access or a data storage device such as a server or data center that includes one or more available media integrations. The available medium may be a magnetic medium (eg, a floppy disk, a hard disk, a magnetic tape), an optical medium, or a semiconductor medium (eg, an SSD), etc.
[0475] The modules / units included in the devices or products described in the above embodiments may be software modules / units, hardware modules / units, or may be partially software modules / units and partially hardware modules / units. For example, for each device or product whose application is applied to or integrated into a chip, each module / unit included therein may be implemented in the form of hardware such as circuits; or, a part of the modules / units included therein may be implemented in the form of a software program, which runs on a processor integrated inside the chip, while a part of the modules / units of another part (if any) may be implemented in the form of hardware such as circuits. The same is true for each device or product whose application is applied to or integrated into a chip module, or each device or product whose application is applied to or integrated into a terminal.
[0476] The above specific implementation methods further describe the purpose, technical solutions and beneficial effects of the embodiments of the present application in detail. It should be understood that the above are only specific implementation methods of the embodiments of the present application and are not intended to limit the protection scope of the embodiments of the present application. Any modifications, equivalent replacements, improvements, etc. made on the basis of the technical solutions of the embodiments of the present application shall be included in the protection scope of the embodiments of the present application.
Claims
1. A neural network model deployment method, It is characterized in that include: Deploy a neural network model, wherein the neural network model is used to evaluate the central processing unit (CPU) performance of the system based on the system performance data; Wherein, the neural network model is composed of at least one of the following: The first type of network model is used to determine the number of CPU cycles for cache misses; The second type of network model is used to determine the number of CPU cycles missed by the lookaside translation buffer TLB; The third type of network model is used to determine the number of CPU cycles during which the CPU is stalled; The fourth type of network model is used to determine the number of CPU cycles for branch prediction errors; The fifth type of network model is used to determine the average number of CPU cycles to execute instructions; The sixth type of network model is used to determine the total number of CPU cycles to execute instructions.
2. The method according to claim 1, It is characterized in that The first type of network model includes at least one of the following: A first subnetwork of the first type of network model, used to determine the memory level parallelism corresponding to the cache miss; The second sub-network of the first type of network model is used to determine the number of CPU cycles of the cache miss in parallel according to the memory level corresponding to the cache miss.
3. The method according to claim 1, It is characterized in that The second type of network model includes at least one of the following: The first sub-network of the second type of network model is used to determine the memory level parallelism corresponding to the TLB miss; The second sub-network of the second type of network model is used to determine the number of CPU cycles of the TLB miss in parallel according to the memory level corresponding to the TLB miss.
4. The method according to claim 1, It is characterized in that The third type of network model includes at least one of the following: The first sub-network of the third type of network model is used to determine the number of CPU cycles during which the CPU front end is stalled; The second sub-network of the third type of network model is used to determine the number of CPU cycles during which the CPU backend is stalled; The third subnetwork of the third type of network model is used to determine the number of CPU cycles during which the CPU is paused according to the number of CPU cycles during which the CPU front end is paused and the number of CPU cycles during which the CPU back end is paused.
5. The method according to claim 1, It is characterized in that The fourth type of network model includes at least one of the following: The first sub-network of the fourth type of network model is used to determine the branch prediction processing time; The second sub-network of the fourth type of network model is used to determine the number of CPU cycles of the branch prediction error according to the branch prediction processing time.
6. The method according to claim 1, It is characterized in that The fifth type of network model includes at least one of the following: The first sub-network of the fifth type of network model is used to determine the number of parallel issuances of instructions; The second sub-network of the fifth type of network model is used to determine the average number of CPU cycles for executing the instruction according to the number of parallel issuance of the instruction.
7. The method according to claim 1, It is characterized in that The system performance data includes performance monitoring unit PMU data and / or CPU micro-architecture hardware parameters; The PMU data includes at least one of the following: the number of executed instructions, the number of cache misses, the number of TLB misses, the number of CPU cycles of front-end stalls, the number of CPU cycles of back-end stalls, the number of CPU cycles of back-end stalls of memory, the number of branch prediction errors, and system frequency; The CPU microarchitecture hardware parameters include at least one of the following: the time for processing the cache miss, the time for processing the TLB miss, the maximum value of memory-level parallelism corresponding to the cache miss, the maximum value of memory-level parallelism corresponding to the TLB miss, and the number of front-ends of the CPU pipeline.
8. The method according to any one of claims 1 to 7, It is characterized in that The cache miss includes at least one of the following: a first-level instruction cache miss, a first-level data cache miss, a second-level data cache miss, and a third-level data cache miss; The TLB miss includes at least one of the following: a first-level instruction TLB miss, a first-level data TLB miss, and a second-level data TLB miss.
9. A neural network model deployment device, It is characterized in that include: A deployment unit, used to deploy a neural network model, wherein the neural network model is used to evaluate the central processing unit (CPU) performance of the system according to the system performance data; Wherein, the neural network model is composed of at least one of the following: The first type of network model is used to determine the number of CPU cycles for cache misses; The second type of network model is used to determine the number of CPU cycles to bypass the translation buffer TLB; The third type of network model is used to determine the number of CPU cycles during which the CPU is stalled; The fourth type of network model is used to determine the number of CPU cycles for branch prediction errors; The fifth type of network model is used to determine the average number of CPU cycles to execute instructions; The sixth type of network model is used to determine the total number of CPU cycles to execute instructions.
10. An electronic device, It is characterized in that The method comprises a processor, a memory and a computer program or instructions stored in the memory, wherein the processor executes the computer program or instructions to implement the steps of the method according to any one of claims 1 to 8.
11. A computer-readable storage medium, It is characterized in that The computer stores a computer program or an instruction, and when the computer program or the instruction is executed, the steps of the method according to any one of claims 1 to 8 are implemented.
