Unified programming model compiling and runtime system oriented to Shenwei supercomputing platform
Through the unified programming model compilation and runtime system for the Sunway supercomputer platform, the problems of instruction set compatibility and task allocation in domestic supercomputer systems have been solved, efficient computing performance and resource management have been achieved, and the overall performance of domestic supercomputer systems has been improved.
Patent Information
- Application Number
- CN202510709772.0
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2025-05-29
- Publication Date
- 2025-09-12
AI Technical Summary
The many-core accelerators of domestic supercomputing systems face challenges in instruction set compatibility and task allocation. Existing programming frameworks such as DPC++ are not adaptable to the Sunway SW39000/Matrix 3000, resulting in a mismatch between task allocation and data layout and low efficiency.
A unified programming model compilation and runtime system for the Sunway supercomputing platform was designed, including a compilation module and a common runtime module. Through compile-time kernel extraction and runtime dynamic calling, it optimized task scheduling, memory management, and fault tolerance mechanisms, and achieved collaborative computing between the host and device sides.
It has achieved efficient operation of domestic supercomputer systems, overcome the problem of poor instruction set compatibility, improved computing performance and resource utilization efficiency, and provided flexible computing resource management and fault tolerance guarantees.
Smart Images

Figure HDA0005426775180000011 
Figure HDA0005426775180000012
Abstract
Description
Technical Field
[0001] The present invention belongs to the field of high-performance computing technology, and the present invention relates to a unified programming model compilation and runtime system for the Sunway supercomputing platform. Background Art
[0002] Domestic supercomputing systems have significant performance advantages compared to international supercomputing systems. However, the many-core accelerators they utilize (such as the SW39000 and Matrix 3000) differ significantly from traditional CPU and GPU architectures in terms of physical structure and resource management. Many-core accelerators typically feature hundreds or even thousands of computing cores, but the hardware scheduler and thread group scheduling mechanisms are relatively weak, requiring task allocation and execution to rely on manual optimization by programmers. International research has shown that SYCL and related extensions (such as Celerity and DPC++) provide comprehensive support for multi-device heterogeneous systems, optimizing memory management, data transfer, and task scheduling. However, these frameworks still face numerous challenges when targeting domestic heterogeneous supercomputing systems. For example, instruction set compatibility issues exist. Mainstream international programming frameworks (such as DPC++) are designed based on the x86 / ARM instruction set and are not compatible with the proprietary instruction set of the Sunway SW39000 / Matrix 3000. Furthermore, load balancing and task allocation in many-core systems rely heavily on manual optimization and lack fine-grained thread scheduling capabilities, which can easily lead to a mismatch between task allocation and data layout, resulting in low efficiency. Summary of the Invention
[0003] In order to overcome the problem of instruction set compatibility defects in domestic supercomputer systems in the existing technology, the purpose of the present invention is to propose a unified programming model compilation and runtime system for the Sunway supercomputer platform, aiming to efficiently manage the heterogeneous computing resources of the Sunway supercomputer platform, optimize task scheduling, memory management, computing acceleration and fault tolerance mechanisms, and improve overall computing performance.
[0004] To achieve the above object, the technical solution adopted by the present invention is as follows:
[0005] A unified programming model compilation and runtime system for the Sunway supercomputing platform, including:
[0006] The compilation module is used to compile the SYCL programming model code and detect the kernel function to generate the device-side intermediate representation; the device-side intermediate representation is processed to obtain the kernel function dynamic link library and the host-side executable code;
[0007] The public runtime module is used to call the kernel function dynamic link library when the host-side executable code runs.
[0008] Furthermore, the SYCL programming model code is compiled and kernel function detected, including: compiling the SYCL programming model code through the clang compiler front-end to obtain a host-side intermediate representation, cloning a host-side intermediate representation, and then performing kernel function detection on the cloned host-side intermediate representation, removing the code related only to the host side, and generating a device-side intermediate representation.
[0009] Furthermore, the device-side intermediate representation is processed, including optimized branch processing of the device-side intermediate representation. First, the libkernel library is linked, then the default optimization PASS is executed, and then architecture-related backend specific optimization is performed. Finally, the compilation tool is used to link to obtain the kernel function dynamic link library.
[0010] Furthermore, the device-side intermediate representation is processed, including storing the kernel information of the device-side intermediate representation in the host-side intermediate representation, and then mapping the kernel function name after C++ compiler name mangling with the corresponding C++ object, performing optimization PASS, and obtaining the host-side executable code.
[0011] Furthermore, the common runtime module includes a device management module, a memory management module, a computing management module, a scheduling management module, a fault-tolerant management module and a communication management module; the fault-tolerant management module is connected to the device management module, the memory management module, the computing management module, the scheduling management module and the communication management module, the memory management module and the scheduling management module are connected to the communication management module, and the computing management module is connected to the scheduling management module.
[0012] Furthermore, the device management module is used to discover the heterogeneous devices of the Sunway supercomputing platform, obtain the computing power and memory capacity status of the heterogeneous devices, and select the target device based on the status information; establish a dynamic device information database by calling the query API of the target device; use the target device for calculation based on the information in the device information database, or perform device switching or device deletion.
[0013] Furthermore, the memory management module is used to provide a unified memory space, support the allocation of host-side and device-side memory and cross-device data migration; among them, the allocation of host-side and device-side memory is to optimize the data layout to match the memory hierarchy of the Sunway supercomputing platform; cross-device data migration uses a synchronization mechanism to perform cross-device data migration.
[0014] Furthermore, the computing management module is used to undertake the computing tasks of the upper-layer SYCL programming model and forward the target device downward to the target device selected by the device management module through the task scheduling module.
[0015] Furthermore, the scheduling management module is used to analyze the dependencies and computing loads of the SYCL task queues, and receive the kernel function dynamic link library generated by the compilation module. According to the target device status and the dependencies of the task queues, based on the load balancing principle, the kernel function tasks in the kernel function dynamic link library are divided into thread groups, and asynchronous execution and synchronization primitives are performed within the nodes of the communication management module to dynamically schedule the kernel function tasks to the target device.
[0016] Furthermore, the fault-tolerant management module is used to monitor the device management module, the memory management module, the calculation management module, the scheduling management module and the communication management module by adopting system events;
[0017] The communication management module is used to implement communication management for the SYCL unified programming model based on the MPI standard, including point-to-point communication, collective communication, and the creation, destruction, merging and splitting of communication groups. It is combined with the memory management module to optimize fine-grained data transmission.
[0018] Compared with the prior art, the present invention has the following beneficial effects:
[0019] Based on the compilation module and the public runtime module, the present invention constructs a vertical optimization system from the compiler to the runtime, realizes the efficient operation of SYCL in the domestic supercomputing system, and overcomes the semantic gap between the domestic many-core architecture and the general programming model. The SYCL programming model is divided into the host side and the device side for separate processing after the kernel is extracted during compilation, and is dynamically called through the public runtime module to give full play to the collaborative computing capabilities of the host side and the device side.
[0020] Furthermore, during compilation, the kernel information of the device-side intermediate representation is stored in the host-side intermediate representation, and then the kernel function name after C++ compiler name mangling is mapped to the corresponding C++ object. The scheduling management module dynamically schedules the kernel function to the target device. That is, through the two-layer mechanism of "semantic preservation at compile time + dynamic mapping at runtime", the hardware potential is released while maintaining programming abstraction, overcoming the problem of poor instruction set compatibility in domestic supercomputer systems in the existing technology. BRIEF DESCRIPTION OF THE DRAWINGS
[0021] Figure 1 Compilation workflow for user programs;
[0022] Figure 2 Execution flow for kernel functions in the public runtime. DETAILED DESCRIPTION
[0023] To facilitate understanding of the present invention, the present invention will be described more fully below with reference to the accompanying drawings. The accompanying drawings illustrate preferred embodiments of the present invention. However, the present invention may be implemented in a variety of different forms and is not limited to the embodiments described herein. Rather, these embodiments are provided to provide a more thorough and comprehensive understanding of the disclosure of the present invention.
[0024] The present invention provides a unified programming model compilation and runtime system for the Sunway supercomputing platform. The system supports compiling SYCL code into Sunway executable code to achieve collaborative scheduling of heterogeneous computing resources, and includes two parts: a compilation module and a public runtime module.
[0025] See also Figure 1 The compilation module compiles the SYCL programming model code through the clang compiler front-end to generate the host intermediate representation (Host LLVM IR). It also clones a copy of the host intermediate representation, performs kernel function detection on the cloned host intermediate representation, removes code related only to the host, and generates the device intermediate representation (IR). This design extracts kernel functions and separates them from the host, facilitating architecture-specific optimizations.
[0026] The device-side intermediate representation is processed in two parts. One part involves optimizing the intermediate representation, linking to the libkernel library, executing a default optimization pass, performing architecture-specific backend optimizations, and finally linking using hardware-specific compilation tools to obtain a kernel dynamic link library (DLL) for host-side code to call at runtime. The other part involves storing the kernel information from the device-side intermediate representation within the host-side intermediate representation, mapping the kernel function names after name mangling by the C++ compiler to the corresponding C++ objects, and executing an optimization pass to obtain the host-side executable code. The host-side executable code calls the kernel dynamic link library through the common runtime module at runtime.
[0027] The public runtime module is used to correctly call the kernel function dynamic link library when the host-side executable code is running.
[0028] The common runtime module includes a device management module, a memory management module, a computing management module, a scheduling management module, a fault-tolerance management module, and a communication management module. The fault-tolerance management module is connected to the device management module, the memory management module, the computing management module, the scheduling management module, and the communication management module. The memory management module and the scheduling management module are connected to the communication management module, and the computing management module is connected to the scheduling management module.
[0029] (1) Equipment management module:
[0030] The device management module is used to discover the heterogeneous devices on the Sunway supercomputing platform, obtain the computing power, memory capacity, and other status of these heterogeneous devices, and select the target device (such as an accelerated computing unit or CPU) based on this status. By calling the target device's query API (Application Programming Interface), a dynamic device information database is established. This information database will maintain the real-time status and performance characteristics of all available computing devices at runtime, allowing users to obtain device information in real time during application execution to make decisions based on actual needs. Based on the information in the device information database, calculations can be performed using the target device, and device switching or deletion can also be performed.
[0031] Device switching will be based on real-time device performance evaluation and task execution status to ensure that the selected device can best meet the computing needs of the task and improve overall system performance.
[0032] The device management module supports operations such as device discovery, usage, switching, and deletion, ensuring that users can flexibly and efficiently manage computing resources in different computing environments. This provides a critical guarantee for the runtime module, enabling it to fully utilize the heterogeneous computing capabilities of the Sunway supercomputing platform.
[0033] (2) Memory Management Module
[0034] The memory management module provides a unified memory space, supports host-side and device-side memory allocation, and supports cross-device data migration. During allocation, data layout is optimized to match the Sunway platform's memory hierarchy, ensuring thread-safe access to the global address space. The memory management module fully considers the Sunway platform's memory hierarchy to ensure that the runtime system can operate efficiently within the hardware environment. Flexible memory allocation algorithms can be employed to balance memory utilization and allocation efficiency, ensuring effective management of the system's memory resources.
[0035] When migrating data across devices, a synchronization mechanism is used to ensure data consistency within the global address space and reduce communication overhead between heterogeneous memories on the Sunway supercomputing platform. Synchronization is a key component of the memory management module design, ensuring thread-safe concurrent access within the global address space.
[0036] The memory management module was designed with full consideration of the memory characteristics of the Sunway supercomputing platform, providing a highly customizable memory allocation and release interface. A memory migration strategy was developed to address runtime memory migration requirements. During task execution, data is migrated as needed to optimize the system's memory layout.
[0037] (3) Computing management module
[0038] The computing management module is used to undertake the computing tasks of the upper-level SYCL programming model and forward the target device to the target device selected by the device management module through the task scheduling module.
[0039] The Computing Management Module leverages the Sunway supercomputing platform's architecture and computing resource distribution. Through the Task Scheduling Module, it leverages load balancing and optimizes task dependencies to improve overall computing efficiency. Furthermore, the Computing Management Module provides a task dependency description language or interface, allowing users to clearly describe the dependencies between tasks to ensure their orderly execution.
[0040] This computing management module is designed to achieve flexible adjustment of computing resources to adapt to the heterogeneous computing environment of the Sunway supercomputing platform.
[0041] (4) Scheduling management module
[0042] The scheduling management module includes a scheduling execution unit based on the hardware scheduling mechanism of the Sunway multi-core accelerator.
[0043] The scheduling management module is used to first analyze the dependencies and computing load of the SYCL task queues, and receive the kernel function dynamic link library generated by the compilation module. According to the target device status and the dependencies of the task queues, based on the load balancing principle, the kernel function tasks in the kernel function dynamic link library are divided into thread groups through the scheduling execution unit, and asynchronous execution and synchronization primitives (such as barriers and events) are performed within the nodes of the communication management module. The kernel function tasks are dynamically scheduled to the target device to achieve efficient mapping of thread groups and computing cores, and optimize task allocation and load balancing.
[0044] The scheduling management module efficiently allocates and executes tasks within the nodes of the communication management module to maximize hardware resource utilization and improve overall computing performance.
[0045] When kernel functions are dynamically scheduled, they are optimally allocated based on the device's real-time load status, computing power, and task resource requirements to ensure balanced and efficient resource utilization.
[0046] In the SYCL-based design, the scheduling management module specifically optimizes task execution on target devices. Based on the device query and selection capabilities provided by SYCL, the scheduling management module dynamically selects appropriate computing devices for task allocation. For example, for compute-intensive tasks, the scheduling management module can prioritize assigning tasks to accelerated computing units to leverage their powerful parallel computing capabilities. For tasks with complex control flows or strong data dependencies, the scheduling management module may choose to process them. Furthermore, the scheduling management module leverages SYCL's asynchronous execution model to minimize device idle time, enabling seamless task switching and concurrent execution. To ensure thread safety and synchronization, asynchronous execution and synchronization primitives (such as barriers and events) are implemented within the communication management module's nodes, implementing an efficient resource contention management mechanism. The scheduling management module uses SYCL synchronization primitives, such as barriers and events, to coordinate the execution order of different tasks and ensure that task dependencies are correctly handled. Through these synchronization mechanisms, the scheduling management module effectively avoids resource contention and deadlock issues, improving overall system stability and execution efficiency.
[0047] (5) Fault-tolerant management module
[0048] The fault-tolerance management module plays a key role in ensuring system robustness in supercomputing systems. The runtime system provides a checkpoint recovery mechanism to ensure overall system stability and reliability in the face of device and node failures. To simplify application development, an abstract interface is provided that enables fault detection and rapid recovery through system event monitoring. This encapsulates underlying platform details, shielding against underlying platform differences and providing a unified fault-tolerance management function interface.
[0049] The fault-tolerant management module is used to monitor system events. When a failure occurs in the device management module, memory management module, computing management module, scheduling management module, and communication management module, it can quickly sense it and respond promptly through the checkpoint recovery mechanism to maintain the stability of the entire system.
[0050] (6) Communication management module
[0051] The communication management module implements communication management for the SYCL unified programming model based on the MPI (Message Passing Interface) standard, including specific communication functions such as point-to-point communication and collective communication. Furthermore, the module provides communication group management, including the creation, destruction, merging, and splitting of communication groups. It also integrates the memory management module within the communication management module's nodes to optimize fine-grained data transmission, enabling efficient, flexible, and controllable communication between nodes.
[0052] Within the node, the communication management module faces the memory management module, providing fine-grained data transmission support for different memory levels within the node, ensuring that data transmission within the node can be more efficient. At the same time, the unified memory model simplifies the implementation of parallel algorithms.
[0053] The execution flow of the common runtime module is as follows Figure 2 As shown in the figure, during initialization, the device management module is used to discover and select devices. After submitting the kernel function task to the scheduling management module, the kernel function task is queued and the relevant information of the kernel function task is loaded, including the kernel function name (the function name after the C++ compiler name mangling operation) and function parameters (function parameters include the number of parameters, parameter type, parameter size, parameter offset, etc.). Function parameters are prepared at runtime based on this parameter information. The memory management module is used to optimize the layout of function parameters.
[0054] Based on the underlying hardware calling the back-end loader (SW / HIP / MT) and the architectural characteristics of the underlying hardware and the dimensional information of the function parameters, the scheduling management module maps data and threads through the computing management module and the communication management module to maximize the efficiency of parallel computing and fully tap the computing potential of the hardware. Finally, the kernel function is sent to the Tianhe supercomputer, Shenwei supercomputer system and Dawn system.
[0055] The fault-tolerant management module is used to ensure the stability of other modules (device management module, memory management module, calculation management module, scheduling management module and communication management module).
[0056] The memory management module in this invention maps the abstract memory hierarchy in the programming model to the hardware architecture memory model, providing a concise memory management interface to upper-level users while fully utilizing the hardware's storage hierarchy and bandwidth. The communication management module automatically maps tasks based on data layout characteristics and thread count through a fine-grained automatic scheduling mechanism, achieving load balancing and improving runtime efficiency. The fault-tolerance management module uses a flexible fault-tolerance mechanism to perform checkpoint recovery at runtime, enhancing the robustness of the fault-aware assurance system.
[0057] The above description is merely a description of the preferred embodiment of the present invention and is not to be construed as limiting the claims. The present invention is not limited to the above embodiment, and variations in the specific structure are permitted. Any variations made within the scope of the independent claims of the present invention are also within the scope of protection of the present invention.
[0058] Unless otherwise defined, all technical and scientific terms used herein have the same meaning as commonly understood by those skilled in the art to which this invention pertains. The terms used herein in the specification of the present invention are for the purpose of describing specific embodiments only and are not intended to limit the present invention. The term "and / or" as used herein includes any and all combinations of one or more of the associated listed items.
Claims
1. A unified programming model compilation and runtime system for the Sunway supercomputing platform, characterized by: include: The compilation module is used to compile the SYCL programming model code and detect kernel functions to generate the device-side intermediate representation; Process the device-side intermediate representation to obtain the kernel function dynamic link library and the host-side executable code; The public runtime module is used to call the kernel function dynamic link library when the host-side executable code runs.
2. The unified programming model compilation and runtime system for the Sunway supercomputer platform according to claim 1, characterized in that: Compiling the SYCL programming model code and detecting kernel functions include: compiling the SYCL programming model code through the clang compiler front-end to obtain a host-side intermediate representation, cloning a copy of the host-side intermediate representation, and then performing kernel function detection on the cloned host-side intermediate representation, removing code related only to the host side, and generating a device-side intermediate representation.
3. The unified programming model compilation and runtime system for the Sunway supercomputer platform according to claim 1, characterized in that: Process the device-side intermediate representation, including optimizing the branch processing of the device-side intermediate representation. First, link the libkernel library, then execute the default optimization pass, and then perform architecture-related backend-specific optimizations. Finally, use the compilation tool to link to obtain the kernel function dynamic link library.
4. The unified programming model compilation and runtime system for the Sunway supercomputer platform according to claim 1, characterized in that: The device-side intermediate representation is processed, including storing the kernel information of the device-side intermediate representation in the host-side intermediate representation, then mapping the kernel function name after C++ compiler name mangling with the corresponding C++ object, performing optimization PASS, and obtaining the executable code on the host side.
5. The unified programming model compilation and runtime system for the Sunway supercomputer platform according to claim 1, characterized in that: The common runtime module includes a device management module, a memory management module, a computing management module, a scheduling management module, a fault-tolerant management module and a communication management module; the fault-tolerant management module is connected to the device management module, the memory management module, the computing management module, the scheduling management module and the communication management module, the memory management module and the scheduling management module are connected to the communication management module, and the computing management module is connected to the scheduling management module.
6. The unified programming model compilation and runtime system for the Sunway supercomputing platform according to claim 5, characterized in that: The device management module is used to discover heterogeneous devices on the Sunway supercomputing platform, obtain the computing power and memory capacity status of heterogeneous devices, and select target devices based on this status information. By calling the query API of the target device, a dynamic device information database is established. The target device is used for calculation based on the information in the device information database, or the device is switched or deleted.
7. The unified programming model compilation and runtime system for the Sunway supercomputing platform according to claim 5, characterized in that: The memory management module is used to provide a unified memory space, support the allocation of host-side and device-side memory, and cross-device data migration. Among them, the allocation of host-side and device-side memory is to optimize the data layout to match the memory hierarchy of the Sunway supercomputing platform; cross-device data migration uses a synchronization mechanism to perform cross-device data migration.
8. The unified programming model compilation and runtime system for the Sunway supercomputer platform according to claim 5, characterized in that: The computing management module is used to undertake the computing tasks of the upper-level SYCL programming model and forward the target device to the target device selected by the device management module through the task scheduling module.
9. The unified programming model compilation and runtime system for the Sunway supercomputer platform according to claim 5, characterized in that: The scheduling management module is used to analyze the dependencies and computing load of the SYCL task queues, and receive the kernel function dynamic link library generated by the compilation module. According to the target device status and the dependencies of the task queues, based on the load balancing principle, the kernel function tasks in the kernel function dynamic link library are divided into thread groups, and asynchronous execution and synchronization primitives are performed within the nodes of the communication management module to dynamically schedule the kernel function tasks to the target device.
10. The unified programming model compilation and runtime system for the Sunway supercomputer platform according to claim 5, characterized in that: A fault-tolerant management module, configured to monitor the device management module, the memory management module, the calculation management module, the scheduling management module, and the communication management module by using system events; The communication management module is used to implement communication management for the SYCL unified programming model based on the MPI standard, including point-to-point communication, collective communication, and the creation, destruction, merging and splitting of communication groups. It is combined with the memory management module to optimize fine-grained data transmission.
Citation Information
Cited By
Method for accelerating program cross-instruction-set-architecture simulation execution
CN121934891A
A method of accelerating program execution across instruction set architecture emulation
CN121934891B