Heterogeneous platform simulation method and system, computer equipment and storage medium

By establishing Socket connections between the virtualization platform and the GPU simulator and using shared memory, the problem of insufficient communication capabilities between the virtualization platform and the GPU simulator is solved, and a complete closed loop of efficient data interaction and GPU function verification is achieved.

CN119918477AInactive Publication Date: 2025-05-02SUZHOU YIZHU INTELLIGENT TECH CO LTD

Patent Information

Application Number
CN202510389878.7
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2025-03-31
Publication Date
2025-05-02
Estimated Expiration
Not applicable · inactive patent

AI Technical Summary

Technical Problem

At this stage, the lack of direct communication capabilities between the virtualization platform and the GPU simulator has led to many limitations in GPU function simulation testing, including the inability of the virtualization platform to verify execution feedback in time and the lack of access to instruction-related data.

Method used

By establishing a Socket connection between the virtualization platform and the GPU simulator, and using shared memory to store instruction flow and associated data, the instruction flow and associated data transmission channel is realized, ensuring that the GPU simulator can obtain control instructions and data in real time.

Benefits of technology

It realizes efficient data interaction between the virtualization platform and the GPU simulator, improves functional test coverage, and ensures a complete closed loop of GPU function verification.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119918477A_ABST
    Figure CN119918477A_ABST
Patent Text Reader

Abstract

The invention discloses a heterogeneous platform simulation method and system, computer equipment and a storage medium. The heterogeneous platform simulation method comprises the steps that a virtualization platform outputs an instruction stream and associated data of the instruction stream to a shared memory for storage; a control instruction of the virtualization platform is transmitted to the GPU simulator through the Socket connection; the GPU simulator obtains an instruction stream and associated data of the instruction stream from the shared memory based on the control instruction, executes the instruction stream based on the associated data, and outputs an execution result to the shared memory for storage; and the virtualization platform obtains the execution result from the shared memory. According to the embodiment of the invention, a dual-channel concurrent transmission mechanism is adopted, so that the real-time performance of the control instruction is ensured, and the transmission efficiency of big data such as the instruction stream and the associated data is improved. And the virtualization platform can obtain an execution result from the shared memory to feed back to the host machine, so that a complete closed loop of function verification is realized. According to the embodiment of the invention, capability support can be provided for GPU function simulation based on a heterogeneous platform.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The embodiments of the present application relate to the field of computer technology, and in particular to a heterogeneous platform simulation method, a heterogeneous platform simulation system, a computer device, and a computer-readable storage medium. Background Art

[0002] The Graphics Processing Unit (GPU) simulator is a tool used to simulate the behavior and performance of a GPU. It allows developers to test and debug GPU-related code and algorithms without actual hardware. The GPU simulator can simulate the calculation, memory access, and other functions of the GPU to evaluate indicators such as performance and power consumption. The virtualization platform can interact with the real GPU to complete the transmission and execution of the instruction stream (Packet stream). However, when it is necessary to simulate the behavior of the real GPU executing the instruction stream through the GPU simulator, the lack of direct communication between the virtualization platform and the GPU simulator at this stage leads to many limitations in the simulation. The main manifestation is that the virtualization platform can only perform a simple verification of the instruction stream from the host machine and then write it into the driver log, while the GPU simulator can only obtain the instruction stream through the driver log and cannot access the associated data of the instruction stream, resulting in the inability to complete complex calculations, which limits the simulation. Summary of the invention

[0003] The embodiments of the present application provide a heterogeneous platform simulation method, a heterogeneous platform simulation system, a computer device and a computer-readable storage medium, which are intended to establish a transmission channel for instruction streams and associated data between a virtualization platform and a GPU simulator, and provide capability support for executing instruction streams transmitted by the virtualization platform through the GPU simulator.

[0004] In a first aspect, an embodiment of the present application provides a heterogeneous platform simulation method, the method comprising:

[0005] Establish a socket connection between the virtualization platform and the GPU simulator;

[0006] The virtualization platform outputs the instruction stream to be executed and the associated data of the instruction stream to the shared memory for storage;

[0007] The virtualization platform sends a control instruction to the GPU simulator through the Socket connection;

[0008] The GPU simulator obtains the instruction stream and associated data of the instruction stream from the shared memory based on the control instruction;

[0009] The GPU simulator executes the instruction stream based on the associated data of the instruction stream, and outputs the execution result to the shared memory for storage;

[0010] The virtualization platform obtains the execution result from the shared memory and feeds the execution result back to the host machine.

[0011] In the embodiment of the present application, a Socket connection is established between the virtualization platform and the GPU simulator, and the control instructions of the virtualization platform are transmitted to the GPU simulator through the Socket. The instruction stream to be executed and the associated data of the instruction stream output by the virtualization platform are stored through the shared memory, so that the GPU simulator can obtain the control instructions through the Socket, and then obtain the instruction stream to be executed and the associated data of the instruction stream from the shared memory based on the control instructions, and then perform the relevant calculations of the instruction stream based on the associated data to obtain the execution result. The embodiment of the present application adopts a dual-channel concurrent transmission mechanism, that is, the control instructions are transmitted through the Socket, and the instruction stream and associated data are transmitted through the shared memory, which not only ensures the real-time nature of the control instructions, but also improves the transmission efficiency of the instruction stream and associated data, and realizes efficient data interaction. The GPU simulator stores the execution results of the instruction stream in the shared memory, so that the virtualization platform can obtain the execution results of the GPU simulator on the instruction stream from the shared memory, and then feeds the execution results back to the host machine, realizing a complete closed loop of GPU function verification. The scheme of the embodiment of the present application provides a strong capability support for completing GPU function simulation based on heterogeneous platforms, and effectively improves the functional test coverage of the virtualization platform and the GPU simulator.

[0012] In a possible implementation of the present application, the Socket connection caches the control instructions output by the virtualization platform; the method further includes: the GPU simulator obtains the control instructions from the cache of the Socket connection based on preset rules.

[0013] In a possible implementation of the present application, the GPU simulator obtains the control instruction from the cache of the Socket connection based on a preset rule, including:

[0014] Creating a Socket monitoring task in the event queue of the GPU simulator so that the GPU simulator periodically monitors the Socket connection;

[0015] After monitoring that the Socket connection cache has the control instruction, the GPU simulator obtains the control instruction from the cache of the Socket connection.

[0016] In a possible implementation of the present application, the control instruction includes storage location information of the instruction stream and associated data of the instruction stream in the shared memory; the GPU simulator obtains the instruction stream and associated data of the instruction stream from the shared memory based on the control instruction, including:

[0017] The GPU simulator determines the storage location information based on the control instruction, and obtains the instruction stream and associated data of the instruction stream from the shared memory based on the storage location information.

[0018] In a possible implementation of the present application, the method further includes:

[0019] The GPU simulator transmits its own capability information table to the virtualization platform through the Socket connection, wherein the capability information table is used to indicate the functions supported by the GPU simulator;

[0020] The virtualization platform outputs the instruction stream to be executed and associated data of the instruction stream based on the capability information table.

[0021] In a possible implementation manner of the present application, the method further includes: the GPU simulator sending an execution response message to the virtualization platform through the Socket connection.

[0022] In a possible implementation of the present application, the virtualization platform obtains the execution result from the shared memory, including: the virtualization platform obtains the execution result from the shared memory based on the execution response message.

[0023] In a second aspect, an embodiment of the present application provides a heterogeneous platform simulation system, the system comprising a virtualization platform, a GPU simulator and a shared memory, wherein a Socket connection is established between the virtualization platform and the GPU simulator;

[0024] The virtualization platform is used to output the instruction stream to be executed and the associated data of the instruction stream;

[0025] The shared memory is used to store the instruction stream and the associated data of the instruction stream;

[0026] The virtualization platform also sends control instructions to the GPU simulator through the Socket connection;

[0027] The GPU simulator is used to obtain the instruction stream and the associated data of the instruction stream from the shared memory based on the control instruction;

[0028] The GPU simulator is further used to execute the instruction stream based on the associated data of the instruction stream and output the execution result;

[0029] The shared memory is also used to store the execution result;

[0030] The virtualization platform is also used to obtain the execution result from the shared memory and feed the execution result back to the host machine.

[0031] In a third aspect, an embodiment of the present application provides a computer device, including:

[0032] Memory, used to store programs;

[0033] A processor is used to execute the program stored in the memory. When the processor executes the program stored in the memory, the processor is used to execute the heterogeneous platform simulation method as described in the first aspect above.

[0034] In a fourth aspect, an embodiment of the present application provides a computer-readable storage medium, wherein the computer-readable storage medium stores computer-executable instructions, and the computer-executable instructions are used to execute the heterogeneous platform simulation method described in the first aspect above.

[0035] The solutions provided in the second to fourth aspects are used to implement or cooperate with the heterogeneous platform simulation method provided in the first aspect, and thus can achieve the same or corresponding beneficial effects as the first aspect, and will not be described in detail here.

[0036] It should be understood that the above general description and the following detailed description are exemplary only and are not restrictive of the present application. BRIEF DESCRIPTION OF THE DRAWINGS

[0037] In order to more clearly illustrate the embodiments of the present application or the technical solutions in the prior art, the drawings required for use in the embodiments or related technical descriptions are briefly introduced below. Obviously, the drawings described below are only some embodiments of the present application. For ordinary technicians in this field, other drawings can be obtained based on these drawings without paying creative work.

[0038] Figure 1 A schematic diagram of an implementation environment of the heterogeneous platform simulation method provided in an embodiment of the present application;

[0039] Figure 2 A schematic diagram of a heterogeneous platform simulation method provided in an embodiment of the present application Figure 1 ;

[0040] Figure 3 A schematic diagram of a heterogeneous platform simulation method provided in an embodiment of the present application Figure 2 ;

[0041] Figure 4A schematic diagram of the structure of an event stack provided in an embodiment of the present application;

[0042] Figure 5 A schematic diagram of a heterogeneous platform simulation method provided in an embodiment of the present application Figure 3 ;

[0043] Figure 6 A schematic diagram of the structure of a computer device provided in an embodiment of the present application. DETAILED DESCRIPTION

[0044] In order to make the purpose, technical methods and advantages of this application more clear, the following is a further detailed description of this application in conjunction with the accompanying drawings and embodiments. It should be understood that the specific embodiments described here are only used to explain this application and are not used to limit this application.

[0045] It should be noted that the meaning of "multiple" (or multiple) involved in the description of the embodiments of the present application is more than two, "greater than", "less than", "exceed", etc. are understood as not including the number itself, and "above", "below", "within", etc. are understood as including the number itself. If there is a description of "first", "second", etc., it is only used for the purpose of distinguishing technical features, and cannot be understood as indicating or implying relative importance or implicitly indicating the number of the indicated technical features or implicitly indicating the order of the indicated technical features.

[0046] In the embodiments of the present application, "at least one" refers to one or more, and "more than one" refers to two or more. "And / or" describes the association relationship of associated objects, indicating that three relationships may exist. For example, A and / or B can represent the situation where A exists alone, A and B exist at the same time, and B exists alone. Among them, A and B can be singular or plural. The character " / " generally indicates that the objects associated before and after are in an "or" relationship. "At least one of the following" and similar expressions refer to any combination of these items, including any combination of singular or plural items. For example, at least one of a, b and c can mean: a exists alone, b exists alone, c exists alone, a and b exist at the same time, a and c exist at the same time, b and c exist at the same time, or a, b and c exist at the same time, wherein a, b, c can be single or multiple.

[0047] The terms "substantially", "approximately" and similar terms used in the embodiments of the present application are used as approximate terms rather than as terms of degree, and are intended to take into account the inherent deviations of measured values ​​or calculated values ​​that will be known to those of ordinary skill in the art. In addition, the use of "may" when describing the embodiments of the present application refers to "possible one or more embodiments". The terms "use", "being used", and "being used" used in the embodiments of the present application may be considered to be synonymous with the terms "utilize", "being utilized", and "being utilized", respectively. In addition, the term "exemplary" is intended to refer to an example or an example.

[0048] When studying computer architecture, you will encounter a lot of concepts and methods. Generally speaking, simulator tools are used to verify the effects of these concepts and methods in the processor. The GPU simulator is a software tool that can simulate the microarchitecture and execution process of the GPU. It allows developers to test and debug GPU-related code and algorithms without actual hardware. Developers can modify the simulation parameters, modify the internal architecture of the GPU, and perform performance simulation to better design code for project requirements and obtain better performance. In general, the GPU simulator can simulate the calculation, memory access, and other functions of the GPU to evaluate indicators such as performance and power consumption. Developers can simulate and perform performance tests of GPU computing on different platforms without relying on specific hardware, which provides great convenience for the research and development of GPU computing.

[0049] Currently, a virtualization platform can be built on a physical host to simulate a complete machine (including CPU, memory, and simulated devices) to run the client operating system. The virtualization platform can provide users with an isolated environment so that different applications and operating systems can run on the same physical host. Users can test and run software on different platforms, which greatly facilitates various simulation tests.

[0050] It is understandable that the virtualization platform can interact with the real GPU through the driver to complete the transmission and execution of the instruction stream (Packet stream). However, when it is necessary to simulate the real GPU execution instruction stream through the GPU simulator, the lack of direct communication capabilities between the virtualization platform and the GPU simulator at this stage leads to many limitations in GPU function simulation testing.

[0051] In the related art, when the virtualization platform cannot communicate directly with the GPU simulator, the virtualization platform can only perform a simple verification on the instruction stream transmitted from the host machine, and then write it into the driver log, while the GPU simulator can only obtain the instruction stream through the driver log, load the instruction stream into the bootloader located in the firmware through the baremental startup method, and then notify the GPU simulator to execute these instruction streams through PIO (Programmed Input / Output). The shortcomings of the above approach are obvious: first, the virtualization platform verification is insufficient. The virtualization platform can only verify whether the form of the instruction stream transmitted by the Host is correct, but cannot calculate and verify the result; second, the GPU simulator can only obtain the instruction stream through the log, lacks access to the instruction-related data, and cannot complete complex calculations on the instruction stream; third, there is a lack of direct interaction between the GPU simulator and the virtualization platform, and the virtualization platform cannot verify the execution feedback in time, and there is an interaction block between the two; fourth, synchronization is difficult. Directly introducing a listening thread in the GPU simulator may cause the timing of the main thread and the listening thread to be out of sync, affecting the accuracy of the simulation.

[0052] In order to solve the technical problems existing in the related technologies, the embodiments of the present application provide a heterogeneous platform simulation method, a heterogeneous platform simulation system, a computer device and a computer-readable storage medium, which aim to establish a transmission channel for instruction streams and associated data between a virtualization platform and a GPU simulator, and provide capability support for executing instruction streams transmitted by the virtualization platform through the GPU simulator.

[0053] See also Figure 1 , Figure 1 A schematic diagram of an implementation environment of the heterogeneous platform simulation method provided in the embodiment of the present application. Figure 1 As shown, the implementation environment of the heterogeneous platform simulation method includes a virtualization platform, a GPU simulator and a shared memory, wherein the virtualization platform, the GPU simulator and the shared memory may be located in the same physical host. It should be understood that the physical host may also be referred to as a host machine.

[0054] It is understandable that the virtualization platform of the embodiment of the present application is created in the host machine, and the host machine provides the necessary hardware resources (such as CPU, memory, storage and network interface, etc.) for the virtualization platform to use. In the embodiment of the present application, the host machine can send instruction streams and associated data of instruction streams to the virtualization platform, wherein the instruction stream refers to a collection of a series of instructions executed by the simulated hardware or software system, and these instructions will be read, decoded and executed one by one by the simulator. The instruction stream can also be regarded as a series of operations and processing steps to simulate the behavior of the target system. It involves multiple links such as reading, decoding and execution of instructions, and is the basis for the simulator to realize functional simulation. The associated data of the instruction stream refers to the data on which the execution of the instruction stream depends. For example, the instruction stream guides the simulator to perform complex calculations, and then the associated data of the instruction stream is the physical parameters and state information processed by these calculations. It should be understood that the instruction stream and the associated data of the instruction stream in the embodiment of the present application are encapsulated and transmitted in the form of data packets.

[0055] Exemplarily, the virtualization platform may adopt the QEMU platform, which is a general and open source machine simulator and virtualization software that can simulate a complete machine (including CPU, memory, and simulated devices) to run a client operating system. It should be noted that the QEMU platform is only an example, and the virtualization platform may also use other types of virtualization platforms such as VirtualBox and KVM (Kernel-based Virtual Machine). Those skilled in the art may select a suitable virtualization platform according to actual needs in a specific implementation scenario, and the embodiments of the present application do not limit the specific type of the virtualization platform.

[0056] It is understandable that the GPU simulator of the embodiment of the present application runs in the host machine, and the GPU resources of the host machine are allocated to the virtual machine for use, so that the GPU simulator can simulate the behavior of the GPU to evaluate the general computing performance on the GPU without the need for additional hardware support. The GPU simulator is used to develop and test GPU-accelerated applications, helping researchers and developers optimize code in a simulation environment to better utilize the advantages of heterogeneous computing.

[0057] Exemplarily, the GPU simulator can use the GEM5 simulator, which is a modular platform for computer system architecture research, covering system-level architecture and processor microarchitecture. The GEM5 simulator is integrated with a GPU model and can be used to study and simulate the behavior and performance of GPUs in heterogeneous computing environments. It should be noted that the GEM5 simulator is only an example. In a specific implementation scenario, the GPU simulator can also use other types of simulators such as GPGPU-Sim and FireSim. Those skilled in the art can select a suitable GPU simulator according to actual needs. The specific type of the GPU simulator is not limited in the embodiments of the present application.

[0058] It is understandable that the shared memory in the embodiment of the present application is a physical memory area divided from the host machine, and the shared memory provides an inter-process communication (IPC) mechanism, allowing multiple processes to directly access the same physical memory area to achieve data sharing between processes. In the embodiment of the present application, the shared memory provides technical support for cross-process data interaction between the virtualization platform and the GPU simulator, and the virtualization platform and the GPU simulator can perform efficient large-scale data packet transmission through the shared memory.

[0059] It is understandable that the virtual platform and the GPU simulator are respectively connected to the shared memory for communication to complete the data interaction between the virtualization platform and the GPU simulator, that is, both the virtual platform and the GPU simulator can perform read and write operations on the shared memory. In order to enable the virtual platform and the GPU simulator to respectively perform read and write operations on the shared memory, the shared memory can be mapped to the address space of the process based on memory mapping technology, such as MMAP (Memory Map). For example, the MMAP technology can be used to configure the first mapping interface of the shared memory to the virtual platform for access, and the second mapping interface of the shared memory can be configured to the GPU simulator for access. In this way, the virtual platform can directly access the shared memory through the first mapping interface and perform read and write operations, and the GPU simulator can directly access the shared memory through the second mapping interface and perform read and write operations, thereby improving the read and write performance of the virtual platform and the GPU simulator on the shared memory.

[0060] Exemplarily, the host machine of the embodiment of the present application may be a terminal device, including but not limited to a laptop computer, tablet computer, handheld computer, PAD (tablet computer), desktop computer, etc. with local computing capability. The terminal device is often equipped with a display device, which may also be a display, a display screen, a touch screen, etc., and the touch screen may also be a touch screen, a touch panel, etc.

[0061] The host machine of the embodiment of the present application may also be a server, and the server may be one or more. When there are multiple servers, there are at least two servers for providing different services, and / or there are at least two servers for providing the same service, such as providing the same service in a load balancing manner, which is not limited in the embodiment of the present application. Among them, the above-mentioned server may be an independent physical server, or a server cluster or distributed system composed of multiple physical servers, or a cloud server that provides basic cloud computing services such as cloud services, cloud databases, cloud computing, cloud functions, cloud storage, network services, cloud communications, middleware services, domain name services, security services, CDN (Content Delivery Network), and big data and artificial intelligence platforms. The server can also become a node of the blockchain.

[0062] It can be understood that the scheme of the embodiment of the present application is to realize the output of the instruction stream of the simulated GPU and the associated data of the instruction stream to the GPU simulator through the virtual platform, so as to execute the instruction stream of the simulated GPU through the GPU simulator and return the execution result. In order to achieve this technical purpose, the embodiment of the present application establishes a Socket connection between the virtualization platform and the GPU simulator, transmits the control instructions of the virtualization platform to the GPU simulator through the Socket, and also stores the instruction stream to be executed and the associated data of the instruction stream output by the virtualization platform through the shared memory, so that the GPU simulator can obtain the control instructions of the virtualization platform through the Socket, and obtain the instruction stream to be executed and the associated data of the instruction stream from the shared memory based on the control instructions, and then perform the relevant calculations of the instruction stream based on the associated data to obtain the execution result. In the scheme of the embodiment of the present application, the GPU simulator will eventually store the execution result of the instruction stream in the shared memory, so that the virtualization platform can obtain the execution result of the instruction stream by the GPU simulator from the shared memory, and then feed the execution result back to the host Host, realizing the complete closed loop of GPU function verification. Through the solution of the embodiment of the present application, strong capability support can be provided for completing GPU function simulation based on the virtualization platform and the GPU simulator, effectively improving the functional test coverage of the virtualization platform and the GPU simulator.

[0063] It is understandable that the scheme of the embodiment of the present application adopts a dual-channel concurrent transmission mechanism to establish a control plane transmission channel and a data plane transmission channel between the virtualization platform and the GPU simulator, wherein the control plane transmission channel is implemented based on Socket, that is, a Socket connection is established between the virtualization platform and the GPU simulator, and then the Socket connection is used to transmit the interactive data of the control plane between the virtualization platform and the GPU simulator; the data plane transmission channel is implemented based on shared memory, that is, the interactive data of the data plane between the virtualization platform and the GPU simulator is stored in the shared memory, and the virtualization platform and the GPU simulator obtain the interactive data of the data plane from the shared memory respectively. The control plane interactive data between the virtualization platform and the GPU simulator is generally small in size, mainly involving control instructions, messages and a small amount of status information, rather than large-scale data transmission. These data have an important impact on the behavior and performance of the system, but they themselves do not take up a lot of storage space or bandwidth. The data plane interaction data between the virtualization platform and the GPU simulator is generally large in size, mainly involving the instruction stream (Packet stream) that needs to be executed by the GPU simulator, the associated data of the instruction stream (such as model parameters) and the execution results of the instruction stream, etc. These data plane interaction data exist and are transmitted in the simulator in the form of data packets (Packet), which takes up a lot of storage space or bandwidth. The dual-channel concurrent transmission mechanism adopted in the embodiment of the present application can well ensure the real-time transmission of control plane interaction data, and can also improve the transmission efficiency of large-scale data plane interaction data, thereby realizing efficient data interaction between the virtualization platform and the GPU simulator.

[0064] It can be understood that the solution of the embodiment of the present application proposes to use inter-process communication (IPC) combining Socket and shared memory to achieve communication connection between heterogeneous virtual platforms and GPU simulators, establish a data and communication bridge between the two platforms, and thus provide strong technical support for completing the execution of the instruction flow of the virtual platform through the GPU simulator.

[0065] The technical solutions of the embodiments of the present application are described in detail below through some embodiments. The following embodiments can be combined with each other, and the same or similar concepts or processes may not be repeated in some embodiments.

[0066] See also Figure 2 , Figure 2 A schematic diagram of a heterogeneous platform simulation method provided in an embodiment of the present application Figure 1The heterogeneous platform simulation method can be executed by a computer device, which can be a server device or a terminal device, or the heterogeneous platform simulation method can also be executed by a system combining a server device and a terminal device. The following will take the execution of the heterogeneous platform simulation method by a computer device as an example for explanation.

[0067] like Figure 2 As shown, the heterogeneous platform simulation method provided in the embodiment of the present application includes but is not limited to the following steps S101-S106:

[0068] Step S101: Establish a Socket connection between the virtualization platform and the GPU simulator.

[0069] It is understandable that a computer device can be used as a host machine, a virtualization platform is created in the host machine, and the hardware resources provided by the host machine are used. The virtualization platform is used to simulate a complete machine (including CPU, memory, and simulated devices) to run the client operating system and provide an isolated environment for the user. The GPU simulator of the embodiment of the present application can be created in the same host machine as the virtualization platform, and can schedule the GPU resources of the host machine, simulate the calculation, memory access and other functions of the GPU, and evaluate indicators such as performance and power consumption.

[0070] Exemplarily, the virtualization platform may be a QEMU platform, and the GPU simulator may be a GEM5 simulator.

[0071] Exemplarily, the socket connection between the virtualization platform and the GPU simulator can be implemented using Unix Socket (also known as Unix domain socket). Unix Socket is a mechanism for inter-process communication that allows two processes to communicate on the same physical host. When establishing a Unix socket connection between two platforms, it can be implemented in the following way: create a Unix socket server on one platform and a Unix socket client on the other platform; the server listens to the Unix socket file, and the client tries to connect to the file; after the connection is established, the client and the server can exchange data.

[0072] In the specific implementation of the embodiment of the present application, a Unix socket server can be created on the GPU simulator, and a Unix socket client can be created on the virtualization platform. The server uses the bind() function to bind the Socket to a specific file system path, which is the "address" of the Unix Socket. The client uses the connect() function to initiate a connection request to the server, the server uses the listen() function to make the Socket listen for the connection request, and the server uses the accept() function to accept the client's connection request. After the connection is established, the client and the server can exchange data through the Socket. In other words, both the virtualization platform and the GPU simulator can transmit data on the Socket through read and write operations (such as send() and recv()). In the above manner, a Unix socket can be established between the virtualization platform and the GPU simulator, and the Unix socket can be used as a channel for transmitting control plane data, wherein the control plane data may include but is not limited to: control instructions, interactive messages or a small amount of status information and other control plane data. It should be noted that the above Unix socket is only an example. In a specific implementation scenario, those skilled in the art can use other types of Sockets to establish a control plane communication connection between the virtualization platform and the GPU simulator according to different protocols and communication requirements, and the embodiment of the present application does not limit this.

[0073] It is understandable that the virtualization platform and the GPU simulator will conduct handshake negotiation in the process of establishing a Socket connection to negotiate some parameters of the Socket communication. In one example, the virtualization platform sends a handshake request frame to the GPU simulator, including the protocol version number, the frame format of the transmission, the functions it supports, and the error handling mechanism, etc.; after receiving the handshake request, the GPU simulator checks the compatibility of the protocol version. If it is compatible, it sends a handshake response frame, including the functions and frame formats it supports, the session ID, and confirmation information of the error handling mechanism, etc.; after receiving the handshake response, the virtualization platform confirms the session ID and sends a confirmation frame to the GPU simulator, thereby completing the handshake process.

[0074] It is understandable that the embodiment of the present application establishes a Socket connection between the virtualization platform and the GPU simulator, and uses the Socket connection as a control plane transmission channel between the virtualization platform and the GPU simulator to transmit interactive data of the control plane between the virtualization platform and the GPU simulator. In other words, the control frames are transmitted between the virtualization platform and the GPU simulator via the Socket.

[0075] It is understandable that the format of the control frame transmitted between the virtualization platform and the GPU simulator through the Socket can be negotiated and determined through a handshake process. For example, the encapsulation format, structure and transmission rules of the control frame can be defined through the handshake process.

[0076] In some embodiments, the virtualization platform and the GPU simulator define the encapsulation format of the control frame through a handshake process, including defining the positions of the frame type identification field, the frame length field, the session ID field, the sequence number field, and the checksum field in the control frame, for example, defining the first byte of the control frame to encapsulate the frame type identification, the second byte of the control frame to encapsulate the frame length information, the third and fourth bytes of the control frame to encapsulate the session ID, the last byte of the control frame to encapsulate the checksum, and so on.

[0077] In some embodiments, the virtualization platform and the GPU simulator define identifiers of different control frame types through a handshake process. The identifier of the control frame type is used to identify which operation the control frame is an instruction to perform. For example, the binary value of the frame type identifier is "00000001", which means that the current frame is a control frame, and the control type instructs the GPU simulator to obtain the instruction stream and the associated data of the instruction stream from the shared memory.

[0078] In some embodiments, the virtualization platform and the GPU simulator define the transmission rules of the Socket through a handshake process. For example, the handshake negotiation process can determine which error detection and correction mechanism to use to ensure the reliability of data transmission. For example, each control frame contains a checksum to detect whether an error occurs during the transmission process. If the checksum does not match, the receiver should discard the frame and request retransmission; for another example, the handshake negotiation determines the encryption and authentication mechanism to protect the security of the transmitted data and prevent unauthorized access and data leakage; for another example, the handshake negotiation determines the best transmission parameters, such as frame size, transmission rate, etc., which can optimize the efficiency of data transmission, reduce delays and improve throughput.

[0079] It can be understood that by negotiating the frame format, structure and transmission rules through handshake, the virtualization platform and the GPU simulator can reach a consensus on the frame structure, format and transmission rules to ensure that the control plane data transmitted through the Socket can be accurately sent, received and processed.

[0080] Step S102: The virtualization platform outputs the instruction stream to be executed and the associated data of the instruction stream to the shared memory for storage.

[0081] It can be understood that after receiving the instruction stream of the simulated GPU sent by the host machine and some related data used to execute the instruction stream, the virtualization platform will send the instruction stream and the related data of the instruction stream to the shared memory for storage, so that the GPU simulator can obtain the instruction stream and the related data of the instruction stream from the shared memory. In other words, the embodiment of the present application realizes the transmission of instruction streams and related data between the virtualization platform and the GPU simulator through shared memory.

[0082] The shared memory of the embodiment of the present application is a specific physical memory area in the host machine, which is used for inter-process communication (IPC), allowing multiple processes to directly access the same physical memory area to achieve data sharing between processes. The embodiment of the present application uses shared memory to establish a data plane transmission channel between the virtualization platform and the GPU simulator. The interactive data of the data plane between the virtualization platform and the GPU simulator is stored in the shared memory, and the virtualization platform and the GPU simulator respectively obtain the interactive data of the data plane from the shared memory to achieve cross-process data interaction between the virtualization platform and the GPU simulator. It should be noted that compared with the Socket used to transmit control information with a smaller data size, in the embodiment of the present application, the shared memory is used to transmit some large-scale data packets, mainly involving the instruction stream (Packet stream) that needs to be executed by the GPU simulator, the associated data of the instruction stream (such as model parameters, calculation data, etc.) and the execution results of the instruction stream.

[0083] Step S103: The virtualization platform sends a control instruction to the GPU simulator via a Socket connection.

[0084] It is understandable that the control instructions in the embodiment of the present application are used to instruct the GPU simulator to obtain the instruction stream and the associated data of the instruction stream from the shared memory, and execute the instruction stream based on the associated data. Specifically, after the virtualization platform receives the instruction stream of the simulated GPU issued by the host machine and some associated data used to execute the instruction stream, the virtualization platform parses the instruction stream and the associated data, and then generates the control instructions. The control instruction is encapsulated based on the control frame format previously negotiated with the GPU simulator, for example, the corresponding frame type identifier and the write frame length are set in the header of the control frame, etc., so that after the GPU simulator receives the control frame through the Socket, it can know that the received control frame is a control instruction that indicates to obtain the instruction stream and associated data from the shared memory, and then perform the corresponding operation.

[0085] Exemplarily, the data format of the control instruction includes fields such as frame type, frame length, session ID, sequence number, data payload and checksum, wherein the frame type field is used to identify the control instruction; the frame length field is used to indicate the total size of the frame (including the header and data payload); the session ID field is used to identify a specific connection between two communication endpoints; the sequence number field is used to ensure the sequential transmission and correct assembly of data; the data payload field is the data portion actually transmitted in the frame, which follows the header of the frame; and the checksum field is used to detect whether an error occurs during the transmission process.

[0086] In an embodiment of the present application, the data payload of the control instruction may include information such as storage location information of the instruction stream and the associated data of the instruction stream in the shared memory, data packet size, and data packet flag, so that the GPU simulator can correctly obtain the instruction stream and the associated data of the instruction stream from the shared memory according to the content of the data payload. It should be understood that the instruction stream and the associated data of the instruction stream can be stored in different locations of the shared memory, so the data payload of the control instruction may include first description information of the instruction stream and second description information of the associated data, the first description information includes information such as storage location information of the instruction stream in the shared memory, data packet size, and data packet flag, and the second description information includes information such as storage location information of the associated data of the instruction stream in the shared memory, data packet size, and data packet flag, and the GPU simulator correctly obtains the instruction stream and the associated data of the instruction stream from the shared memory according to the above-mentioned first description information and second description information.

[0087] Step S104: The GPU simulator obtains the instruction stream and the associated data of the instruction stream from the shared memory based on the control instruction.

[0088] It is understandable that after the GPU simulator establishes a Socket connection with the virtualization platform, it will monitor the Socket connection to monitor whether the virtualization platform has sent new control plane data through the Socket. If the GPU simulator detects that there is new control plane data coming from the Socket, it will obtain the control plane data from the virtualization platform from the Socket, and then parse and process the control plane data.

[0089] It can be understood that the control plane data transmitted by the Socket is a control frame encapsulated in a pre-negotiated frame format. After the GPU simulator receives the control frame from the virtualization platform through the Socket, it will first determine the control type indicated by the control frame according to the frame type identifier in the header of the control frame, and then extract the specific control content from the data payload of the control frame according to the control type, and then perform corresponding operations based on the control content.

[0090] For example, the GPU simulator determines that the currently received control frame is a control instruction instructing to obtain an instruction stream and associated data from the shared memory based on the frame type identifier "00000001" in the frame header of the currently received control frame, and then determines the data payload based on the frame length field in the frame header of the control frame. Then, the storage location information, data packet size, data packet flag and other information of the instruction stream and associated data in the shared memory are obtained from the data payload. Then, based on the information obtained from the data payload, the relevant instruction stream and associated data are obtained from the shared memory.

[0091] Step S105: The GPU simulator executes the instruction stream based on the associated data of the instruction stream, and outputs the execution result to the shared memory for storage.

[0092] It is understandable that after the GPU simulator obtains the instruction stream and the associated data of the instruction stream from the shared memory, it will perform the GPU simulation task based on the instruction stream and the associated data of the instruction stream. The working principle of the GPU simulator to perform the GPU simulation task is to run a virtual environment containing the target system on the host system. This virtual environment can simulate the hardware and software functions of the target system. The GPU simulator interprets the instructions of the target system as instructions of the host system and performs the simulated operation.

[0093] It is understandable that the above instruction stream contains a series of instructions that the GPU simulator needs to execute, and these instructions define the specific operations that the GPU simulator needs to perform during the simulation process, such as data loading, data processing, and data storage, etc. The instruction stream is used to control the execution process of the simulator, and may include control structures such as conditional branches and loops to ensure that the simulation tasks are performed in a predetermined logical order. In multi-threaded or distributed simulations, the instruction stream can be used as a synchronization mechanism to ensure that different parts of the simulation tasks can be performed in a coordinated manner.

[0094] It can be understood that the associated data of the above instruction stream is the data required to be used in the operations in the instruction stream.

[0095] In some embodiments, the associated data is necessary input data used in the process of executing the instruction stream, and these data may be parameters of the simulation environment, properties of the model, user input, etc.

[0096] In some embodiments, the associated data is necessary decision-supporting data used in the process of executing the instruction stream. For example, in the simulation process, the associated data supports decision-making, such as data-based threshold judgment, conditional branching, etc.

[0097] In some embodiments, the associated data is necessary verification data used in the process of executing the instruction stream. For example, after the simulation is completed, the associated data can be used as the expected output result to analyze and verify the accuracy and effectiveness of the simulation.

[0098] It is understandable that in the process of executing simulation tasks, the instruction stream interacts with the associated data. The GPU simulator drives the execution of the instruction stream based on the content of the associated data, that is, the GPU simulator decides which operations to perform next or how to perform them based on the content of the associated data. This also means that in GPU simulation, the simulator needs to be able to dynamically adjust the execution path based on the input data provided by the associated data. During the simulation process, the execution results of the instruction stream may be fed back to the associated data to form a closed-loop control to adjust subsequent simulation behaviors. This is crucial for implementing dynamic resource allocation and scheduling strategies for GPU simulators. In addition, the GPU simulator needs to be able to handle errors that may be encountered during the execution of the instruction stream, such as data format errors, calculation overflows, etc., which may involve verification of associated data and exception handling.

[0099] It is understandable that after the GPU simulator executes the instruction stream based on the associated data of the instruction stream, an execution result is obtained. In the embodiment of the present application, the GPU simulator will encapsulate the execution result into a data packet and then send the execution result to the shared memory for storage. In the embodiment of the present application, the execution result is large-scale data, so it is transmitted through the shared memory.

[0100] In a specific implementation scenario, the GPU simulator can encapsulate the execution result into a data packet according to a predefined encapsulation format. For example, the data packet of the execution result can include fields such as a flag field, a length field, and a data payload, wherein the flag field is used to indicate that the data packet is a data packet for carrying the execution result, the length field is used to indicate the length of the data packet, and the data payload is used to carry the actual content of the execution result.

[0101] Step S106: The virtualization platform obtains the execution result from the shared memory and feeds the execution result back to the host machine.

[0102] It is understandable that the virtualization platform obtains the execution results of the GPU simulator on the instruction stream from the shared memory, and feeds the execution results back to the host machine to achieve a complete closed loop of GPU function verification.

[0103] In a possible implementation of the present application, the heterogeneous platform simulation method also includes: outputting an execution response message through a GPU simulator, and transmitting the execution response message to a virtualization platform through a Socket connection, so that the virtualization platform obtains an execution result from a shared memory based on the execution response message.

[0104] It can be understood that after the GPU simulator completes the execution of the instruction stream based on the associated data of the instruction stream, it sends an execution response message to the virtualization platform through the Socket connection previously established with the virtualization platform. The execution response message is used to notify the virtualization platform to obtain the execution result of the GPU simulator on the instruction stream from the shared memory.

[0105] In the embodiment of the present application, a Socket connection is established between the virtualization platform and the GPU simulator, and the control instructions of the virtualization platform are transmitted to the GPU simulator through the Socket. The instruction stream to be executed and the associated data of the instruction stream output by the virtualization platform are stored through the shared memory, so that the GPU simulator can obtain the control instructions through the Socket, and then obtain the instruction stream to be executed and the associated data of the instruction stream from the shared memory based on the control instructions, and then perform the relevant calculations of the instruction stream based on the associated data to obtain the execution result. The embodiment of the present application adopts a dual-channel concurrent transmission mechanism, that is, the control instructions are transmitted through the Socket, and the instruction stream and associated data are transmitted through the shared memory, which not only ensures the real-time nature of the control instructions, but also improves the transmission efficiency of the instruction stream and associated data, and realizes efficient data interaction. The GPU simulator stores the execution results of the instruction stream in the shared memory, so that the virtualization platform can obtain the execution results of the GPU simulator on the instruction stream from the shared memory, and then feeds the execution results back to the host machine, realizing a complete closed loop of GPU function verification. The scheme of the embodiment of the present application provides a strong capability support for completing GPU function simulation based on heterogeneous platforms, and effectively improves the functional test coverage of the virtualization platform and the GPU simulator.

[0106] It is understandable that, in some embodiments, before requesting the GPU simulator to perform a GPU simulation task, the virtualization platform will first confirm the capabilities of the GPU simulator, including the GPU simulator's ability to process data, whether the model required to execute a certain step is loaded, and whether a certain simulation function can be supported, etc., to confirm whether the GPU simulator has the processing capabilities required to perform a specific task, so as to avoid task failures due to hardware or software limitations during execution. Based on this, the heterogeneous platform simulation method of the embodiment of the present application may also include: the GPU simulator transmits its own capability information table to the virtualization platform via a Socket connection; the virtualization platform outputs the instruction stream to be executed and the associated data of the instruction stream based on the capability information table. Among them, the capability information table is used to indicate the functions supported by the GPU simulator.

[0107] In some embodiments, after the virtualization platform and the GPU simulator establish a connection through the Socket communication protocol, the process of the GPU simulator transmitting its own capability information table to the virtualization platform through the Socket connection can be implemented by active acquisition or autonomous push. Among them, the active acquisition method is: the virtualization platform sends a capability inquiry message to the GPU simulator through the Socket connection, triggering the GPU simulator to return its capability information table; the autonomous push method is: after completing the Socket connection handshake protocol, the GPU simulator actively sends the capability information table to the virtualization platform without the virtualization platform initiating additional requests. The triggering time for the GPU simulator to transmit its own capability information table to the virtualization platform through the Socket connection can be dynamically configured according to system requirements, including but not limited to immediate triggering and on-demand triggering, wherein the immediate triggering is executed immediately after the Socket connection is established; the on-demand triggering is executed before the virtualization platform submits a specific GPU simulation task request to the GPU simulator.

[0108] For example, in a certain GPU simulation task, the ability to convert virtual addresses into physical addresses is required. If the virtualization platform finds that the GPU simulator does not support converting virtual addresses into physical addresses based on the capability information table of the GPU simulator, the virtualization platform can convert the virtual addresses into physical addresses in advance and directly send the converted physical addresses to the GPU simulator to ensure that the task can proceed smoothly.

[0109] See also Figure 3 , Figure 3 A schematic diagram of a heterogeneous platform simulation method provided in an embodiment of the present application Figure 2 Understandably, Figure 3 The steps in the embodiment shown can be regarded as the above Figure 2 Reasonable variations or supplements to the embodiments shown; or, it can be understood that the heterogeneous platform simulation method in the embodiments of the present application can also be regarded as an embodiment that can be executed independently, and the present application does not limit this. Figure 3 As shown, the heterogeneous platform simulation method provided in the embodiment of the present application includes but is not limited to the following steps S201-S211:

[0110] Step S201: Establish a Socket connection between the virtualization platform and the GPU simulator.

[0111] It is understandable that the embodiment of the present application realizes the control plane data transmission between the virtualization platform and the GPU simulator by establishing a Socket connection between the virtualization platform and the GPU simulator. In the embodiment of the present application, the Socket is used to transmit control frames with smaller data size, such as control instructions, messages and a small amount of status information. When establishing a Socket connection, the virtualization platform and the GPU simulator will negotiate the communication parameters of the Socket connection, the format of the control frame, the error handling mechanism, etc. by exchanging a series of handshake messages to ensure that both parties are ready to communicate and agree to use consistent communication parameters. Obviously, this process plays a very important role in establishing a stable, reliable and secure communication connection between the virtualization platform and the GPU simulator.

[0112] It is understandable that after the Socket connection is established, the virtualization platform and the GPU simulator will monitor the Socket connection to determine whether the other end has sent a new control frame through the Socket. If a new control frame is detected from the other end, the control frame from the other end will be obtained from the Socket, and then the control frame will be parsed and processed. Generally speaking, the control frame contains a frame type field and a data payload field. After receiving the control frame, the virtualization platform and the GPU simulator can determine what type of operation needs to be performed based on the frame type field, and perform the operation based on the content in the data payload field.

[0113] Exemplarily, the above-mentioned Socket connection is a Unix socket connection. The Unix socket connection uses a file system path to identify the endpoint of communication instead of using an IP address and a port number, which allows two-way communication between processes on the same machine.

[0114] It should be noted that for the specific introduction of step S201, reference may be made to the description of the aforementioned step S101, which will not be repeated here.

[0115] Step S202: The GPU simulator transmits its own capability information table to the virtualization platform through the Socket connection, where the capability information table is used to indicate the functions supported by the GPU simulator; correspondingly, the virtualization platform receives the capability information table of the GPU simulator through the Socket connection.

[0116] In some embodiments, after establishing a Socket connection with the virtualization platform, the GPU simulator actively sends its own capability information table to the virtualization platform. The capability information table is encapsulated in a control frame and transmitted to the virtualization platform through the Socket connection.

[0117] In other embodiments, before requesting the GPU simulator to perform a GPU simulation task, the virtualization platform first learns about the functions supported by the GPU simulator, so the virtualization platform sends a capability inquiry message to the GPU simulator via a Socket connection, and the capability inquiry message is used to request to obtain the capability information table of the GPU simulator. After the GPU simulator receives the capability inquiry message from the virtualization platform via a Socket connection, it sends a capability inquiry response message carrying the capability information table of the GPU simulator to the virtualization platform via a Socket connection.

[0118] It can be understood that the capability inquiry message is sent to the GPU simulator through the Socket connection in the form of a control frame. When the GPU simulator monitors that a new control frame is coming from the Socket, it obtains the control frame from the Socket, parses the control frame, and determines the type of the control frame based on the frame type identifier in the header of the control frame. For example, assuming that the frame type identifier of the capability inquiry message frame is "00000010", after the GPU simulator recognizes the frame type identifier from the frame type field in the control frame, it can determine that the type of the current control frame is a capability inquiry message frame. Furthermore, the GPU simulator will respond to the capability inquiry message, generate a capability inquiry response message frame, and encapsulate its own capability information table into the capability inquiry response message frame.

[0119] It can be understood that the capability inquiry response message frame can be encapsulated according to a predefined encapsulation format, and the predefined capability inquiry response message frame can include the following fields: a frame type field, a length field, and a data payload field, wherein the frame type field is used to identify the control frame as a capability inquiry response message frame, the length field is used to indicate the length of the capability inquiry response message frame, and the data payload field is used to carry the capability information table of the GPU simulator.

[0120] It is understandable that the capability inquiry response message frame is in the form of a control frame and is sent to the virtualization platform through the Socket connection. After the virtualization platform monitors that there is a new control frame in the Socket, it obtains the control frame from the Socket, parses the control frame, and determines the control frame type based on the frame type identifier in the header of the control frame. For example, assuming that the frame type identifier of the capability negotiation frame is "00000011", after the virtualization platform recognizes the frame type identifier from the frame type field in the control frame, it can determine that the type of the current control frame is a capability inquiry response message frame. Further, the virtualization platform determines the data payload based on the length field in the header of the capability inquiry response message frame, thereby extracting the capability information table of the GPU simulator in the data payload.

[0121] Step S203: The virtualization platform outputs the instruction stream to be executed and the associated data of the instruction stream based on the capability information, and sends the instruction stream to be executed and the associated data of the instruction stream to the shared memory for storage.

[0122] In an embodiment of the present application, a capability inquiry message is initiated through a virtualization platform, and the capability inquiry message is transmitted to a GPU simulator through a Socket connection; then, a capability information table is returned by the GPU simulator based on the capability inquiry message, and the capability information table is transmitted to the virtualization platform through a Socket connection; and then, the virtualization platform outputs an instruction stream to be executed and associated data of the instruction stream based on the capability information table.

[0123] It is understandable that after the virtualization platform receives the original instruction stream and original associated data from the host machine, it will analyze whether the GPU simulator is capable of successfully executing the GPU simulation task in combination with the capability information of the GPU simulator. Based on the capability information of the GPU simulator, the virtualization platform adjusts at least one of the original instruction stream and the original associated data, and outputs the instruction stream to be executed and the associated data of the instruction stream. By adjusting at least one of the original instruction stream and the original associated data, it is ensured that the simulation task can be successfully executed by the GPU simulator. In one example, the virtualization platform confirms that the GPU simulator lacks the corresponding execution capability for certain instructions in the original instruction stream based on the capability information, and then filters or optimizes the original instruction stream that the GPU simulator cannot execute to ensure that the instruction stream can be executed smoothly. In one example, the virtualization platform confirms that the GPU simulator lacks the decoding capability for certain data in the original associated data based on the capability information, and then converts the data that the GPU simulator cannot decode to convert it into data that can be decoded by the GPU simulator.

[0124] It can be understood that by filtering, optimizing and other adjustment operations on the original instruction stream and the original associated data, dynamic mapping of the instruction stream based on the capability information of the GPU simulator can be achieved, ensuring that the instruction stream and associated data sent to the GPU simulator can be correctly understood and executed by the GPU simulator, so as to increase the probability of successful execution of the GPU simulation task.

[0125] Step S204: The virtualization platform sends a control instruction to the GPU simulator via the Socket connection; correspondingly, the GPU simulator receives the control instruction from the virtualization platform via the Socket connection.

[0126] It is understandable that the virtualization platform sends a control instruction to the GPU simulator through the Socket connection to notify the GPU simulator to obtain the instruction stream and the associated data of the instruction stream from the shared memory and perform the corresponding simulation operation.

[0127] For a detailed introduction to step S205, please refer to the description of the aforementioned step S103, which will not be repeated here.

[0128] Step S205: The GPU simulator obtains the instruction stream and the associated data of the instruction stream from the shared memory based on the control instruction.

[0129] It can be understood that the GPU simulator receives the control instruction from the virtualization platform through the Socket connection, and then executes the operation of obtaining the instruction stream and the associated data of the instruction stream from the shared memory in response to the control instruction. Specifically, the GPU simulator can obtain the storage location information of the instruction stream and the associated data of the instruction stream from the control instruction, and then obtain the instruction stream and the associated data of the instruction stream from the shared memory based on the storage location information.

[0130] In a possible implementation of the present application, the control instruction includes storage location information of the instruction stream and the associated data of the instruction stream in the shared memory. The process of obtaining the instruction stream and the associated data of the instruction stream from the shared memory based on the control instruction by the GPU simulator may be to determine the storage location information based on the control instruction by the GPU simulator, and obtain the instruction stream and the associated data of the instruction stream from the shared memory based on the storage location information.

[0131] For a detailed introduction to step S205, please refer to the description of the aforementioned step S104, which will not be repeated here.

[0132] Step S206: The GPU simulator executes the instruction stream based on the associated data of the instruction stream.

[0133] It is understandable that after the GPU simulator obtains the instruction stream and the associated data of the instruction stream from the shared memory, it executes the instruction stream based on the associated data of the instruction stream. Specifically, the GPU simulator decodes the instruction stream and the associated data by reading the instruction stream and the associated data. The decoding process involves converting the instructions and associated data in the instruction stream into a form that the simulator can understand and execute, and the decoded instruction stream will be executed by the simulator. During the execution process, the simulator simulates the hardware and software functions of the target system, and interprets the instructions of the target system as instructions of the host system, so that the target system can run on the host system. When the simulator executes instructions in the instruction stream, it needs to use associated data. For example, the execution of some instructions requires the use of an algorithm model. In this case, the associated data may include the attributes of the model, the input data of the model, etc. The GPU simulator selects a model based on the attributes of the model, inputs the input data of the model into the model, and outputs the corresponding results; the execution of some instructions requires execution in a specific environment. In this case, the associated data may include the parameters of the simulation environment. The GPU simulator configures the execution environment of the instructions based on the parameters of the simulation environment; the execution of some instructions requires deciding which instruction to execute next based on a threshold. In this case, the associated data may include threshold data, execution condition data, etc. The GPU simulator selects the next instruction path based on the threshold data or execution condition data; some instructions need to verify the execution effect after execution. In this case, the associated data may include verification data, and the GPU simulator verifies the accuracy and effectiveness of the instruction execution based on the verification data.

[0134] In some embodiments, the GPU simulator includes multiple execution modules, and the GPU simulator distributes instructions in the instruction stream to multiple execution modules for execution, so as to realize concurrent execution of multiple instructions and improve execution efficiency. It should be understood that the efficiency of the GPU simulator in executing the instruction stream directly affects the performance of the simulator. In order to improve the simulation efficiency, the GPU simulator may adopt various optimization technologies, such as instruction pipelining, dynamic translation, etc.

[0135] Step S207: The GPU simulator outputs the execution result to the shared memory for storage.

[0136] It can be understood that after the GPU simulator executes all instructions in the instruction stream, it will obtain the corresponding execution results. The GPU simulator will encapsulate the execution results into data packets according to a predefined encapsulation format, and then send the data packets carrying the execution results to the shared memory for storage, so that the virtualization platform can obtain the data packets carrying the execution results from the shared memory.

[0137] In some embodiments, the execution results include performance data, which is used to indicate data about the GPU performance when the GPU simulator executes a simulation task, such as the number of instructions executed in each clock cycle, the total number of simulation cycles, or the execution time of each instruction.

[0138] In some embodiments, the execution results include cache and memory access statistics, which are used to indicate the access statistics of L1 and L2 caches during the GPU simulator executing the instruction stream, including cache hit rate and miss rate, and detailed information of DRAM access, such as L2 bandwidth, etc.

[0139] In some embodiments, the execution result includes occupancy and parallelism, which are used to indicate the occupancy of the GPU during the GPU simulator executing the instruction stream, that is, the usage of GPU resources, and the parallelism at the partition level.

[0140] In some embodiments, the execution result includes energy consumption data, which is used to indicate data related to energy consumption during the GPU simulator's execution of the instruction stream.

[0141] In some embodiments, the execution result includes debugging information. If the GPU simulator finds that the application may generate erroneous data during operation, the error information will be recorded in the debugging information. The GPU simulator helps developers diagnose problems by providing debugging information.

[0142] In some embodiments, the execution result includes an execution status, and the GPU simulator can report the execution status of the kernel through the execution result, including the start, execution and end status of the kernel, and any potential branch divergence points.

[0143] In some embodiments, the execution results include error and exception information. During the GPU simulator executing the instruction stream, if it detects that there are unexecutable instructions or logical errors in the instruction stream, it will report the errors and exceptions and record them in the execution results to help developers identify and correct the problems.

[0144] In some embodiments, the execution results include functional simulation results to help developers verify the correctness of the program.

[0145] In some embodiments, the execution result includes instruction pipeline analysis data. The GPU simulator can analyze the instruction pipeline and generate instruction pipeline analysis data. The analysis data provides information about the instruction execution order and potential bottlenecks.

[0146] Understandably, the execution results can help developers understand the behavior of the program on the GPU, optimize performance, and debug and correct problems in the program.

[0147] Step S208: The GPU simulator sends an execution response message to the virtualization platform through the Socket connection; correspondingly, the virtualization platform receives the execution response message from the GPU simulator through the Socket connection.

[0148] It can be understood that in the embodiment of the present application, after the execution result is output to the shared memory for storage through the GPU simulator, the execution response message is also output through the GPU simulator, and the execution response message is transmitted to the virtualization platform through the Socket connection.

[0149] It can be understood that the above execution response message is used to indicate that the GPU simulator has completed the execution of the instruction stream and to notify the virtualization platform to obtain the data packet of the execution result from the shared memory.

[0150] It can be understood that the above-mentioned execution response message is in the form of a control frame and is sent to the virtualization platform through the Socket connection. After the virtualization platform monitors that there is a new control frame in the Socket, it obtains the control frame from the Socket, parses the control frame, and determines the control frame type based on the frame type identifier in the header of the control frame.

[0151] For example, assuming that the frame type identifier of the capability negotiation frame is "00000100", after the virtualization platform recognizes the frame type identifier from the frame type field in the control frame, it can determine that the type of the current control frame is an execution response message, and then execute the operation of obtaining the execution result data packet from the shared memory.

[0152] Step S209: The virtualization platform obtains the execution result from the shared memory based on the execution response message.

[0153] Exemplarily, after the virtualization platform receives the execution response message from the GPU simulator, it determines the data payload based on the length field in the header of the execution response message, and extracts the storage location information, data packet size, data packet flag and other information of the execution result in the shared memory from the data payload. Based on the storage location information, data packet size, and data packet flag, the virtualization platform can correctly obtain the data packet carrying the execution result in the shared memory.

[0154] Step S210: The virtualization platform feeds back the execution result to the host machine.

[0155] It can be understood that after the virtualization platform obtains the execution result from the shared memory, it feeds the execution result back to the host machine, thus realizing a complete closed loop of GPU function verification.

[0156] In some embodiments, after the virtualization platform obtains the data packet carrying the execution result from the shared memory, it also parses and verifies the data packet generated by the GPU simulator to ensure the accuracy and reliability of the data, thereby providing support for further analysis and decision-making.

[0157] In some embodiments, after the virtualization platform obtains the data packet carrying the execution result from the shared memory, it also performs structured processing on the relevant results of the execution result, for example, analyzing the start and end time of each instruction, the utilization rate of the GPU, the usage of the memory, etc. based on the execution result, and generates structured data based on this information, and then feeds the structured data back to the host machine. Optionally, the structured data of the execution result can also be displayed to the user through the display module of the host machine.

[0158] In order to better understand how the embodiment of the present application performs control plane data transmission through Socket, some working principles of Socket connection are exemplarily introduced below.

[0159] For example, the Socket of the embodiment of the present application is provided with a cache. In a possible implementation of the present application, the control instructions output by the virtualization platform are cached through the Socket connection, and then the control instructions are obtained from the cache of the Socket connection based on a preset rule by the GPU simulator. In this way, the control instructions can be temporarily stored in the cache of the Socket before being read immediately by the GPU simulator.

[0160] It is understood that in the embodiment of the present application, when control plane data is sent from one process to another process via a socket, the data is first copied to a cache. This buffer acts as an intermediary between the sender and the receiver, allowing the data to be temporarily stored without the receiver reading it immediately.

[0161] Exemplarily, the Socket of the embodiment of the present application is a Unix Socket, and the Unix Socket includes a sending end buffer and a receiving end buffer. It should be understood that the sizes of these buffers can be adjusted as needed. The data caching capability of UnixSocket makes it an efficient IPC mechanism, which can communicate with high performance and low latency, and is particularly suitable for the transmission of control plane data to ensure the real-time transmission of control plane data. Unix Socket also adopts a flow control mechanism to prevent the sending end from sending data too quickly, causing the receiving end to be unable to process in time. If the buffer of the receiving end is full, the write operation of the sending end will be blocked until the receiving end reads enough data to make room for the cache for new data. In this way, the usage of the buffer is monitored and managed to ensure that data will not be lost due to buffer overflow, while avoiding data transmission delays caused by insufficient buffer.

[0162] It is understandable that the GPU simulator obtains control instructions from the cache of the Socket connection based on preset rules. The preset rules here can be to stipulate that the GPU simulator obtains control instructions from the cache of the Socket connection only when the main thread is idle, so as to avoid introducing timing problems for the main thread.

[0163] In a possible implementation of the present application, a GPU simulator obtains control instructions from a cache of a Socket connection based on preset rules, including: creating a Socket listening task in an event queue of the GPU simulator so that the GPU simulator periodically listens to the Socket connection; then, after the GPU simulator monitors that there are control instructions in the Socket connection cache, it obtains the control instructions from the cache of the Socket connection.

[0164] It is understandable that the GPU simulator of the embodiment of the present application relies on an event scheduling mechanism to drive operation. The GPU simulator is internally configured with an event queue (Event Queue), which contains multiple events (Event), and each event in the event queue can be triggered cyclically. Specifically, after the main thread of the GPU simulator completes the serial execution of an event, it will read the corresponding event from the event queue (Event Queue), and continue to execute serially in the main thread. The above process is repeated continuously, forming an event loop.

[0165] It is understandable that if the listening thread is directly introduced into the GPU simulator, the timing of the main thread and the listening thread may be out of sync, affecting the accuracy of the simulation. Therefore, in order to solve this technical problem, the embodiment of the present application adds the Socket listening task as an event to the event queue, so that the main thread of the GPU simulator will periodically execute the Socket listening task to monitor whether there is new data in the cache of the Socket connection. If there is new data, the new data will be obtained from the cache of the Socket connection. The embodiment of the present application adds the Socket listening task to the event queue so that the Socket listening is periodically called as an event. This can avoid starting another thread to listen to the Socket, causing the problem of timing asynchrony between the main threads of the GPU simulator, and ensure the consistency of the simulation.

[0166] In some embodiments, Socket monitoring, data transfer, instruction stream processing and execution result processing are added to the event queue as events. In the embodiment of the present application, the GPU simulator uses events as the basic scheduling and execution units. Events can be understood as a series of behaviors that change the system state, including but not limited to reading and writing memory, sending and arriving of data packets, etc. The entire simulation process of the simulator is the process of creating, scheduling, executing and terminating all event objects. The embodiment of the present application creates each execution step in the GPU simulator simulation process as an event to ensure that each execution step can be executed in an orderly manner, ensure the synchronization of data, and avoid causing timing confusion of the GPU simulator.

[0167] See also Figure 4 , Figure 4 A schematic diagram of the structure of an event stack (Event Stack) provided in an embodiment of the present application. The event stack includes multiple event objects, namely, socket listening events, control frame identification events, instruction stream execution events, and execution result processing events. Figure 4 In the event stack shown, the Socket listening event is at the first priority; the control frame identification event is at the second priority, and the pointer of the Socket listening event points to the control frame identification event; the instruction stream execution event is at the third priority; the execution result processing event is at the fourth priority, and the pointer of the instruction stream execution event points to the execution result processing event.

[0168] It is understandable that the GPU simulator runs in an event-driven manner, and Figure 4 The events in the event stack provided are sorted by timestamp and priority. When the GPU simulator schedules events, it schedules each event based on the order of events in the event stack. Figure 4 The event stack provided is used to exemplarily illustrate the event scheduling mechanism of the GPU simulator in the embodiment of the present application.

[0169] Please refer to the following Figure 4 and Figure 5 , which is a schematic diagram of a heterogeneous platform simulation method provided in an embodiment of the present application Figure 3 Understandably, Figure 5 The steps in the embodiment shown can be regarded as the above Figure 2 Reasonable variations or supplements to the embodiments shown; or, it can be understood that the heterogeneous platform simulation method in the embodiments of the present application can also be regarded as an embodiment that can be executed independently, and the present application does not limit this. Figure 5 The heterogeneous platform simulation method shown includes but is not limited to the following steps S301-S306:

[0170] Step S301: Create a Socket listening task in the event queue of the GPU simulator.

[0171] It can be understood that the event queue in the GPU simulator is the basis for the implementation of the event stack. The event queue maintains the order and execution of events in the form of an event stack. In the event queue, events are sorted by timestamp and priority, and support event insertion and removal operations.

[0172] In the embodiment of the present application, a Socket monitoring task is created in the event queue of the GPU simulator, so that the Socket monitoring is cyclically scheduled by the GPU simulator as a periodic event.

[0173] Step S302: Periodically monitor the Socket connection based on the event queue.

[0174] It is understandable that the main thread of the GPU simulator will execute the events in the event queue in the form of a stack, and the main thread will cyclically read and execute the events in the event queue. In the embodiment of the present application, the GPU simulator will periodically monitor the Socket connection based on the event queue.

[0175] It is understandable that when the virtualization platform transmits new control plane data (control frame) through the Socket, the control plane data may not be received immediately by the GPU simulator, but cached in the Socket cache. When the GPU simulator polls the Socket listening task, it will obtain the control plane data from the Socket cache.

[0176] Step S303: when a control frame transmitted through the Socket connection is monitored, the control frame is obtained from the buffer of the Socket, and the control frame is identified to determine the control type of the control frame.

[0177] It is understandable that when the GPU simulator detects that there is an unreceived control frame in the Socket cache, it obtains the control frame from the Socket cache and then parses the control type of the control frame. The header of the control frame contains a frame type field, which is used to identify the control type of the control frame. Therefore, the control type of the control frame can be determined according to the field value of the frame type field. For example, if the frame type field in the header of the control frame is a first value, then the control type of the control frame is determined to be a first type, where the first type is set to represent a request to execute an instruction stream; for another example, if the frame type field in the header of the control frame is a second value, then the control type of the control frame is determined to be a second type, where the second type is set to represent a request to obtain capability negotiation.

[0178] It should be understood that the GPU simulator will perform different operations for different control types, so Figure 4In the event stack shown, there are instruction stream execution events and capability query response message events with the same priority. The GPU simulator will decide to execute one of the instruction stream execution events and capability query response message events based on the execution result of the control frame recognition event.

[0179] Optionally, the end of the control frame includes a checksum field. After the GPU simulator obtains the control frame from the cache of the Socket, it first verifies the checksum, performs specific calculations on certain parts of the frame (usually the header and data payload) based on preset rules, and compares the calculation results with the checksum to verify whether an error occurs during the transmission of the control frame. If it is determined that an error occurs during the transmission of the control frame, the GPU simulator can request the virtualization platform to re-transmit the control frame through the Socket.

[0180] Next, different event branches are executed based on different control types of the control frame. Specifically, when it is determined that the control type of the control frame is the first type, steps S304-S305 are executed; when it is determined that the control type of the control frame is the second type, step S306 is executed.

[0181] Step S304: Obtain the instruction stream and the associated data of the instruction stream from the shared memory, and then execute the instruction stream based on the associated data to obtain an execution result.

[0182] It can be understood that the header of the control frame contains a frame length field, and the value of the frame length field indicates the total size of the frame (including the header and the data payload). Since the length of the header of the control frame and the length of the checksum are fixed, the position of the data payload in the control frame can be determined based on the value of the frame length field, and then based on the position of the data payload, the actual content carried by the data payload can be determined.

[0183] It is understandable that the header of the control frame contains a sequence number field. Some control plane data may be divided into multiple control frames for transmission. In this case, the GPU simulator needs to correctly assemble the data payloads of multiple control frames according to the value of the sequence number field to obtain complete data.

[0184] It can be understood that when the control type of the control frame is the first type, the data payload of the control frame may include first description information of the instruction stream and second description information of the associated data, the first description information includes at least one of the following: storage location information of the instruction stream in the shared memory, data packet size of the instruction stream, and data packet flag of the instruction stream; the second description information includes at least one of the following: storage location information of the associated data in the shared memory, data packet size of the associated data, and data packet flag of the associated data. The GPU simulator may obtain the instruction stream and the associated data of the instruction stream from the shared memory according to the first description information of the instruction stream and the second description information of the associated data.

[0185] It is understandable that the first description information of the instruction stream and the second description information of the associated data can be transmitted through multiple control frames, and the GPU simulator can assemble these control frames according to the sequence numbers of these control frames to obtain the complete first description information and the second description information. The first description information of the instruction stream and the second description information of the associated data can also be transmitted through one control frame, which is not limited in the embodiments of the present application.

[0186] Exemplarily, the first description information includes storage location information of the instruction stream in the shared memory, and the GPU simulator searches for the corresponding data packet in the shared memory according to the storage location information of the instruction stream in the shared memory, thereby obtaining the data packet of the instruction stream. The second description information includes storage location information of the associated data in the shared memory, and the GPU simulator searches for the corresponding data packet in the shared memory according to the storage location information of the associated data in the shared memory, thereby obtaining the data packet of the associated data.

[0187] Exemplarily, the first description information includes a data packet flag of the instruction stream, and the GPU simulator searches for a corresponding data packet in the shared memory according to the data packet flag of the instruction stream, thereby obtaining the data packet of the instruction stream. The second description information includes a data packet flag of the associated data, and the GPU simulator searches for a corresponding data packet in the shared memory according to the data packet flag of the associated data, thereby obtaining the data packet of the associated data.

[0188] Exemplarily, the first description information includes the storage location information of the instruction stream in the shared memory, the packet size of the instruction stream, and the packet flag of the instruction stream. The GPU simulator searches for the packet of the instruction stream in the shared memory according to the storage location information of the instruction stream in the shared memory, and then compares the found packet with the packet size and packet flag of the instruction stream to confirm whether the found packet is correct. The second description information includes the storage location information of the associated data in the shared memory, the packet size of the associated data, and the packet flag of the associated data. The GPU simulator searches for the packet of the associated data in the shared memory according to the storage location information of the associated data in the shared memory, and then compares the found packet with the packet size and packet flag of the associated data to confirm whether the found packet is correct.

[0189] It can be understood that after the GPU simulator obtains the instruction stream and the associated data of the instruction stream from the shared memory, it executes the instruction stream based on the associated data of the instruction stream, and generates an execution result after the execution is completed.

[0190] It can be understood that when the control type of the control frame is the first type, the GPU simulator executes the instruction stream execution event after executing the control frame identification event. The execution process of the instruction stream execution event includes: obtaining the instruction stream and the associated data of the instruction stream from the shared memory, executing the instruction stream based on the associated data of the instruction stream, and generating an execution result.

[0191] Step S305: Send the execution result to the shared memory for storage.

[0192] It is understandable that after the main thread of the GPU simulator completes the execution instruction stream execution event, it continues to execute the execution result processing event. The execution process of the execution result processing event includes: encapsulating the execution result into a data packet, and then sending the execution result to the shared memory for storage. Specifically, the GPU simulator can encapsulate the execution result into a data packet according to a predefined encapsulation format. For example, the data packet of the execution result can include fields such as a flag field, a length field, and a data payload, wherein the flag field is used to indicate that the data packet is a data packet for carrying the execution result, the length field is used to indicate the length of the data packet, and the data payload is used to carry the actual content of the execution result.

[0193] Step S306: Send a capability query response message carrying a capability information table of the GPU simulator to the virtualization platform through a Socket connection.

[0194] It can be understood that when the control type of the control frame is the second type, it means that the control frame is a capability inquiry message frame. The GPU simulator generates a capability inquiry response message frame, and encapsulates its own capability information table into the capability inquiry response message frame, and then sends the capability inquiry response message frame carrying the capability information table of the GPU simulator to the virtualization platform through the Socket connection.

[0195] It is to be understood that, although the steps in the above-mentioned various flow charts are shown in sequence according to the indication of the arrows, these steps are not necessarily performed in sequence according to the order indicated by the arrows. Unless there is a clear explanation in the present embodiment, the execution of these steps does not have a strict order restriction, and these steps can be performed in other orders. Moreover, at least a portion of the steps in the above-mentioned flow charts can include a plurality of steps or a plurality of stages, and these steps or stages are not necessarily performed at the same time, but can be performed at different times, and the execution order of these steps or stages is not necessarily performed in sequence, but can be performed in turn or alternately with at least a portion of the steps or stages in other steps or other steps.

[0196] It should be noted that in the above embodiments, the description of each embodiment has its own emphasis, and for the parts that are not described in detail in a certain embodiment, reference can be made to the relevant descriptions of other embodiments.

[0197] It should also be noted that the various implementation methods provided in the embodiments of the present application can be combined arbitrarily to achieve different technical effects.

[0198] The heterogeneous platform simulation method provided in the embodiment of the present application is further exemplified below through several application examples.

[0199] The embodiment of the present application can be applied to code compatibility testing. Specifically, an instruction stream for instructing a GPU simulator to perform code compatibility testing can be written through a virtualization platform, and the code test program can be placed in an operating system image file, and the operating system image file is used as the associated data of the instruction stream, and the instruction stream and the associated data are sent to a shared memory for storage; the virtualization platform sends a control instruction to the GPU simulator through a socket to instruct the GPU simulator to obtain the instruction stream and associated data from the shared memory; the GPU simulator obtains the instruction stream and associated data from the shared memory, wherein the associated data includes an operating system image file carrying the code test program, and the GPU simulator runs the operating system image file under the guidance of the instruction stream to test the compatibility of the code in the GPU environment, and after the operating system image file is run, the GPU simulator generates an execution result, stores the execution result in the shared memory, and sends an execution response message to the virtualization platform through a socket to notify the virtualization platform to obtain the execution result from the shared memory; the virtualization platform parses and verifies the execution result, feeds it back to the host machine, and analyzes the compatibility of the GPU with the code.

[0200] The embodiments of the present application can be applied to the neural network model training process of the simulation accelerator hardware GPU. Specifically, the virtualization platform can be used to write an instruction stream for instructing the GPU simulator to complete the training of the neural network model, and the neural network model, as well as the sample data, learning rate, weight parameters, optimization algorithm, loss function, etc. for training the neural network model are used as associated data, and the instruction stream and associated data are sent to the shared memory for storage; the virtualization platform sends a control instruction to the GPU simulator through the Socket to instruct the GPU simulator to obtain the instruction stream and associated data from the shared memory; the GPU simulator obtains the instruction stream and associated data from the shared memory, and under the guidance of the instruction stream, the GPU simulator loads the neural network model, and trains the neural network model in combination with the sample data, learning rate, weight parameters, optimization algorithm, loss function and other parameters for training the neural network model. After the training is completed, the GPU simulator generates an execution result, stores the execution result in the shared memory, and sends an execution response message to the virtualization platform through the Socket to notify the virtualization platform to obtain the execution result from the shared memory; the virtualization platform parses and verifies the execution result and feeds it back to the host machine, wherein the training result may include data such as cache performance, training duration, energy consumption and power consumption during the training simulation process to evaluate the performance of the learning framework of the neural network model on the GPU, and then optimize the learning framework of the neural network model.

[0201] It is understandable that the embodiments of the present application can also be applied to power consumption prediction and management. Specifically, an instruction stream can be written through a virtualization platform, the instruction stream instructs the GPU simulator to run different computing tasks, and records the energy consumption data during the operation of each computing task, takes each computing task as associated data, and sends the instruction stream and associated data to the shared memory for storage; the virtualization platform sends a control instruction to the GPU simulator through the Socket to instruct the GPU simulator to obtain the instruction stream and associated data from the shared memory; the GPU simulator obtains the instruction stream and associated data from the shared memory, and the GPU simulator runs different computing tasks under the guidance of the instruction stream, and outputs the execution result after all computing tasks are executed. The execution result includes the energy consumption data when each computing task is executed, and the GPU simulator stores the execution result in the shared memory, and sends an execution response message to the virtualization platform through the Socket to notify the virtualization platform to obtain the execution result from the shared memory; the virtualization platform parses and verifies the execution result, feeds back to the host machine, and analyzes the power change trend brought by different computing tasks, so as to formulate a reasonable work plan to extend the battery life.

[0202] It is understandable that the embodiments of the present application can also be applied to high performance computing (HPC) scenarios. Specifically, the virtualization platform can be used to write instructions for the GPU simulator to execute multiple algorithm tasks in parallel, use the data of the multiple algorithm tasks as associated data, and send the instruction stream and associated data to the shared memory for storage; the virtualization platform sends control instructions to the GPU simulator through the Socket to instruct the GPU simulator to obtain the instruction stream and associated data from the shared memory; the GPU simulator obtains the instruction stream and associated data from the shared memory, and the GPU simulator executes multiple algorithm tasks in parallel under the guidance of the instruction stream, and outputs the execution result, which may include cache performance data, micro-architecture statistics, and power consumption data in the process of the GPU simulator executing multiple algorithm tasks in parallel. The GPU simulator stores the execution result in the shared memory, sends an execution response message to the virtualization platform through the Socket to notify the virtualization platform to obtain the execution result from the shared memory, and the virtualization platform parses and verifies the execution result and feeds it back to the host machine, so as to study the effect of the parallel algorithm and load balancing strategy according to the execution result.

[0203] The heterogeneous platform simulation method of the embodiment of the present application transmits the control instructions of the virtualization platform to the GPU simulator through a Socket connection; the virtualization platform outputs the instruction stream to be executed and the associated data of the instruction stream to the shared memory for storage; the GPU simulator obtains the instruction stream and the associated data of the instruction stream from the shared memory based on the control instructions, executes the instruction stream based on the associated data, and outputs the execution result to the shared memory for storage; the virtualization platform obtains the execution result from the shared memory. The embodiment of the present application adopts a dual-channel concurrent transmission mechanism, which not only ensures the real-time performance of the control instructions, but also improves the transmission efficiency of large data such as instruction streams and associated data. The virtualization platform can obtain the execution results from the shared memory to feed back to the host machine, realizing a complete closed loop of functional verification. The solution of the embodiment of the present application can provide strong capability support for completing GPU functional simulation based on heterogeneous platforms.

[0204] The embodiment of the present application also creates each execution step in the GPU simulator simulation process as an event to ensure that each execution step can be executed in an orderly manner, ensure the synchronization of data, and avoid causing timing confusion in the GPU simulator.

[0205] The method of the embodiment of the present application is described above, and the system provided by the embodiment of the present application is introduced below.

[0206] It should be noted that the heterogeneous platform simulation system provided in the embodiment of the present application has the function of implementing the heterogeneous platform simulation method provided in any of the above embodiments. The function can be implemented by hardware, or by hardware executing corresponding software. The hardware or software includes one or more modules corresponding to the above functions.

[0207] In a possible implementation, the heterogeneous platform simulation system includes a virtualization platform, a GPU simulator and a shared memory, wherein a Socket connection is established between the virtualization platform and the GPU simulator;

[0208] The virtualization platform is used to output the instruction stream to be executed and the associated data of the instruction stream;

[0209] Shared memory is used to store instruction streams and the data associated with the instruction streams;

[0210] The virtualization platform is also used to send control instructions to the GPU simulator through the Socket connection;

[0211] The GPU simulator is used to obtain the instruction stream and the associated data of the instruction stream from the shared memory based on the control instruction;

[0212] The GPU simulator is further used to execute the instruction stream based on the associated data of the instruction stream and output the execution result;

[0213] Shared memory is also used to store execution results;

[0214] The virtualization platform is also used to obtain the execution results from the shared memory and feed the execution results back to the host machine.

[0215] In a possible implementation of the present application, the heterogeneous platform simulation system also caches the control instructions output by the virtualization platform through a Socket connection; the GPU simulator obtains the control instructions from the cache of the Socket connection based on preset rules.

[0216] In a possible implementation of the present application, a Socket listening task is created in the event queue of the GPU simulator, and the GPU simulator periodically listens to the Socket connection; after the GPU simulator listens to the control instruction in the Socket connection cache, it obtains the control instruction from the Socket connection cache.

[0217] In a possible implementation of the present application, the control instruction includes storage location information of the instruction stream and associated data of the instruction stream in the shared memory; the GPU simulator determines the storage location information based on the control instruction, and obtains the instruction stream and associated data of the instruction stream from the shared memory based on the storage location information.

[0218] In a possible implementation of the present application, the virtualization platform is also used to initiate a capability inquiry message, and transmit the capability inquiry message to the GPU simulator through a Socket connection; the GPU simulator returns a capability information table based on the capability inquiry message, and transmits the capability information table to the virtualization platform through a Socket connection; the virtualization platform outputs the instruction stream to be executed and the associated data of the instruction stream based on the capability information table.

[0219] In a possible implementation of the present application, the GPU simulator is further configured to output an execution response message, and transmit the execution response message to the virtualization platform via a Socket connection.

[0220] In a possible implementation of the present application, the virtualization platform is further configured to obtain an execution result from the shared memory based on the execution response message when the execution response message indicates that the GPU simulator has completed the execution of the instruction stream.

[0221] It should be noted that the information interaction, execution process, etc. between the above-mentioned modules / units are based on the same concept as the method embodiment of the present application. Their specific functions and technical effects can be found in the method embodiment part and will not be repeated here.

[0222] It should be noted that the device described in the embodiments of the present application is only schematic. For example, the division of the units is only a logical function division. There may be other division methods in specific implementation scenarios. For example, multiple units or components can be combined or integrated into another system, or some features can be ignored or not executed. Another point is that the mutual coupling or direct coupling or communication connection shown or discussed can be an indirect coupling or communication connection through some communication interface, device or unit, which can be electrical, mechanical or other forms.

[0223] The units described as separate components may or may not be physically separated, and the components shown as units may or may not be physical units, that is, they may be located in one place or distributed on multiple network units. Some or all of the units may be selected according to actual needs to achieve the purpose of the solution of this embodiment.

[0224] In addition, each functional unit in each embodiment of the present application may be integrated into one processing unit, or each unit may exist physically separately, or two or more units may be integrated into one unit.

[0225] If the functions are implemented in the form of software functional units and sold or used as independent products, they can be stored in a processor-executable non-volatile computer-readable storage medium. Based on this understanding, the technical solution of the present application, or the part that contributes to the prior art, or the part of the technical solution, can be embodied in the form of a software product, and the computer software product is stored in a storage medium.

[0226] See also Figure 6 The embodiment of the present application further provides a computer device 300. The computer device 300 may be a server or a terminal. The internal structure of the computer device 300 includes but is not limited to:

[0227] A memory 310, used for storing programs;

[0228] The processor 320 is used to execute the program stored in the memory 310. When the processor 320 executes the program stored in the memory 310, the processor 320 is used to execute the heterogeneous platform simulation method in any of the aforementioned embodiments.

[0229] The processor 320 and the memory 310 may be connected via a bus or other means.

[0230] The memory 310 is a non-transient computer-readable storage medium that can be used to store non-transient software programs and non-transient computer executable programs, such as the position sensorless permanent magnet synchronous motor control described in any embodiment of the present application. The processor 320 implements the heterogeneous platform simulation method in any of the aforementioned embodiments by running the non-transient software programs and instructions stored in the memory 310.

[0231] The memory 310 may include a program storage area and a data storage area, wherein the program storage area may store an operating system and application programs required for at least one function; the data storage area may store and execute the above-mentioned heterogeneous platform simulation method. In addition, the memory 310 may include a high-speed random access memory, and may also include a non-volatile memory, such as at least one disk storage device, a flash memory device, or other non-volatile solid-state storage device. In some embodiments, the memory 310 may optionally include a memory remotely arranged relative to the processor 320, and these remote memories may be connected to the processor 320 via a network. Examples of the above-mentioned network include, but are not limited to, the Internet, an intranet, a local area network, a mobile communication network, and combinations thereof.

[0232] The non-transient software programs and instructions required to implement the above-mentioned heterogeneous platform simulation method are stored in the memory 310, and when executed by one or more processors 320, the heterogeneous platform simulation method provided by any embodiment of the present application is executed.

[0233] The embodiment of the present application also provides a computer-readable storage medium storing computer-executable instructions, where the computer-executable instructions are used to execute the above-mentioned heterogeneous platform simulation method.

[0234] In one embodiment, the storage medium stores computer executable instructions, which are executed by one or more control processors, for example, by one or more processors 320 in the above-mentioned computer device 300, so that the above-mentioned one or more processors 320 can execute the heterogeneous platform simulation method provided in any embodiment of the present application.

[0235] It will be appreciated by those skilled in the art that all or some of the steps and systems in the methods disclosed above may be implemented as software, firmware, hardware, and appropriate combinations thereof. Some or all physical components may be implemented as software executed by a processor, such as a central processing unit, a digital signal processor, or a microprocessor, or as hardware, or as an integrated circuit, such as an application-specific integrated circuit. Such software may be distributed on a computer-readable medium, which may include a computer storage medium (or non-transitory medium) and a communication medium (or transient medium). As known to those skilled in the art, the term computer storage medium includes volatile and non-volatile, removable and non-removable media implemented in any method or technology for storing information (such as computer-readable instructions, data structures, program modules, or other data). Computer storage media include, but are not limited to, RAM, ROM, EEPROM, flash memory or other memory technology, CD-ROM, digital versatile disk (DVD) or other optical disk storage, magnetic cassettes, magnetic tapes, magnetic disk storage or other magnetic storage devices, or any other medium that can be used to store desired information and can be accessed by a computer. Furthermore, it is well known to those skilled in the art that communication media typically include computer readable instructions, data structures, program modules, or other data in a modulated data signal such as a carrier wave or other transport mechanism, and may include any information delivery media.

[0236] In addition, an embodiment of the present application further provides a computer program product, including a computer program, which implements the heterogeneous platform simulation method in any of the aforementioned embodiments when the computer program is executed by a processor.

[0237] It should be noted that, in the description of this specification, the description with reference to the terms "one embodiment", "some embodiments", "example", "specific example", or "some examples" means that the specific features, structures, materials or characteristics described in conjunction with the embodiment or example are included in at least one embodiment or example of the present application. In this specification, the schematic representation of the above terms does not necessarily refer to the same embodiment or example. Moreover, the specific features, structures, materials or characteristics described may be combined in any one or more embodiments or examples in a suitable manner.

[0238] Finally, it should be noted that the above embodiments are only specific implementation methods of the present application, which are used to illustrate the technical solution of the present application rather than to limit it. The protection scope of the present application is not limited thereto. Although the present application has been described in detail with reference to the aforementioned embodiments, ordinary technicians in this field should understand that any technician familiar with this technical field can still modify the technical solution recorded in the aforementioned embodiments within the technical scope disclosed in the present application, or make equivalent replacements for some of the technical features therein; and these modifications, changes or replacements do not make the essence of the corresponding technical solution deviate from the spirit and scope of the technical solution of the embodiments of the present application, and should all be covered by the protection scope of the present application.

Claims

1. A heterogeneous platform simulation method, characterized in that: The method comprises: Establish a socket connection between the virtualization platform and the GPU simulator; The virtualization platform outputs the instruction stream to be executed and the associated data of the instruction stream to the shared memory for storage; The virtualization platform sends a control instruction to the GPU simulator through the Socket connection; The GPU simulator obtains the instruction stream and associated data of the instruction stream from the shared memory based on the control instruction; The GPU simulator executes the instruction stream based on the associated data of the instruction stream, and outputs the execution result to the shared memory for storage; The virtualization platform obtains the execution result from the shared memory and feeds the execution result back to the host machine.

2. The heterogeneous platform simulation method according to claim 1, characterized in that: The Socket connection caches the control instruction output by the virtualization platform; the method further includes: The GPU simulator obtains the control instruction from the cache connected to the Socket based on a preset rule.

3. The heterogeneous platform simulation method according to claim 2, characterized in that: The GPU simulator obtains the control instruction from the cache connected to the Socket based on a preset rule, including: Creating a Socket monitoring task in the event queue of the GPU simulator so that the GPU simulator periodically monitors the Socket connection; After monitoring that the Socket connection cache has the control instruction, the GPU simulator obtains the control instruction from the cache of the Socket connection.

4. The heterogeneous platform simulation method according to claim 1, characterized in that: The control instruction includes the instruction stream and storage location information of associated data of the instruction stream in the shared memory; The GPU simulator obtains the instruction stream and associated data of the instruction stream from the shared memory based on the control instruction, including: The GPU simulator determines the storage location information based on the control instruction, and obtains the instruction stream and associated data of the instruction stream from the shared memory based on the storage location information.

5. The heterogeneous platform simulation method according to claim 1, characterized in that: The method further comprises: The GPU simulator transmits its own capability information table to the virtualization platform through the Socket connection, wherein the capability information table is used to indicate the functions supported by the GPU simulator; The virtualization platform outputs the instruction stream to be executed and associated data of the instruction stream based on the capability information table.

6. The heterogeneous platform simulation method according to claim 1, characterized in that: The method further comprises: The GPU simulator sends an execution response message to the virtualization platform through the Socket connection.

7. The heterogeneous platform simulation method according to claim 6, characterized in that: The virtualization platform obtains the execution result from the shared memory, including: The virtualization platform obtains the execution result from the shared memory based on the execution response message.

8. A heterogeneous platform simulation system, characterized in that: The system includes a virtualization platform, a GPU simulator and a shared memory, wherein a Socket connection is established between the virtualization platform and the GPU simulator; The virtualization platform is used to output the instruction stream to be executed and the associated data of the instruction stream; The shared memory is used to store the instruction stream and the associated data of the instruction stream; The virtualization platform is also used to send control instructions to the GPU simulator through the Socket connection; The GPU simulator is used to obtain the instruction stream and the associated data of the instruction stream from the shared memory based on the control instruction; The GPU simulator is further used to execute the instruction stream based on the associated data of the instruction stream and output the execution result; The shared memory is also used to store the execution result; The virtualization platform is also used to obtain the execution result from the shared memory and feed the execution result back to the host machine.

9. A computer device, characterized in that: include: Memory, used to store programs; A processor, used to execute the program stored in the memory. When the processor executes the program stored in the memory, the processor is used to execute: the heterogeneous platform simulation method as described in any one of claims 1 to 7.

10. A computer-readable storage medium, characterized in that: Computer executable instructions are stored, and the computer executable instructions are used to execute: the heterogeneous platform simulation method according to any one of claims 1 to 7.

Citation Information

Patent Citations

  • GPU virtualization implementation method, and related apparatus and system

    CN105122210A

  • Communication method and device between virtual machines, physical host and medium

    CN112905304A

  • Computer system

    CN119201357A

Cited By

  • Method and device for managing server GPU (Graphics Processing Unit) equipment

    CN121029259A