Heterogeneous computing method and platform with CPU and GPU working cooperatively

By using meta-task analysis and closed-loop learning mechanisms, the system dynamically determines execution paths and performs adaptive resource allocation, generating heterogeneous-aware optimized kernel code. This solves the problems of rigid task scheduling and inefficient memory management in heterogeneous computing systems, improving computational efficiency and adaptability.

CN121560541BActive Publication Date: 2026-05-29BEIJING XINYIHE TECHNOLOGY CO LTD
View PDF 2 Cites 0 Cited by

Patent Information

Application Number
CN202511723927.2
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2025-11-22
Publication Date
2026-05-29
Estimated Expiration
2045-11-22

AI Technical Summary

Technical Problem

Existing heterogeneous computing technologies lack deep metadata awareness and real-time decision-making capabilities in task scheduling, leading to resource waste and energy loss. The system as a whole exhibits open-loop characteristics, making it unable to form a continuous learning mechanism, which affects computing efficiency and adaptability.

Method used

Meta-task analysis extracts computational feature metadata, dynamically determines the execution path based on the performance prediction model, performs adaptive resource allocation and generates heterogeneous perception optimization kernel code, and monitors and adjusts in real time to build a closed-loop learning system.

Benefits of technology

It enables dynamic decision-making for task execution paths, adaptive resource configuration, and kernel code customization, improving the efficiency and adaptability of the computing system and solving problems such as rigid task scheduling, inefficient memory management, and open-loop systems.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN121560541B_ABST
    Figure CN121560541B_ABST
Patent Text Reader

Abstract

The application is suitable for the technical field of computers, and provides a heterogeneous computing method and platform for CPU and GPU to work cooperatively, wherein the method comprises the following steps: step S1: performing meta-task analysis on an input computing task, extracting computing feature metadata thereof, and dynamically deciding execution path planning of the task between CPU and GPU based on a pre-trained performance prediction model; step S2: performing adaptive resource cooperative configuration according to the execution path planning; and step S3: generating heterogeneous-aware optimized kernel code based on the computing feature metadata and a current hardware state through a parameterized kernel template or a just-in-time compilation technology. The application effectively solves the problems of rigid task scheduling strategy, prominent memory and data transmission bottlenecks, insufficient and lack of adaptability of computing kernel optimization, and lack of self-evolution and learning ability of the system.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This invention belongs to the field of computer technology, and in particular relates to a heterogeneous computing method and platform for CPU and GPU to work together. Background Technology

[0002] With the rapid popularization of artificial intelligence and scientific computing applications, computing tasks are continuously increasing in complexity and scale. Single-processor architectures are struggling to meet modern computing demands, and heterogeneous systems combining CPUs and GPUs are gradually becoming the mainstream solution. CPUs excel at handling logic-intensive tasks, while GPUs, with their parallel processing capabilities, have a significant advantage in data throughput tasks. However, existing heterogeneous computing technologies have revealed several shortcomings in practical applications:

[0003] Task scheduling mechanisms generally rely on static rules, such as forcibly allocating all parallel tasks to GPUs, ignoring dynamic changes in task characteristics such as data size, dimensionality, sparsity, and numerical precision. When task characteristics shift, an execution path that was originally efficient on the GPU may become more efficient on the CPU. However, existing systems lack deep awareness of metadata and real-time decision-making capabilities, resulting in wasted computing resources and energy losses.

[0004] More importantly, the system exhibits open-loop characteristics. Metadata, configuration parameters, and performance metrics generated during task execution are not effectively collected and utilized, making it impossible to form a continuous learning mechanism. Consequently, the decision-making model cannot evolve with changes in load, and performance tuning relies on manual intervention in the long term.

[0005] These technological bottlenecks severely restrict the efficiency and adaptability of heterogeneous computing systems. Summary of the Invention

[0006] The purpose of this invention is to provide a heterogeneous computing method and platform for CPU and GPU to work together, so as to solve the problems mentioned in the background art.

[0007] To achieve the above objectives, the present invention provides the following technical solution:

[0008] A heterogeneous computing method for CPU and GPU to work together, the method comprising the following steps:

[0009] Step S1: Perform meta-task analysis on the input computation task, extract its computational feature metadata, and dynamically decide on the execution path planning of the task between CPU and GPU based on the pre-trained performance prediction model.

[0010] Step S2: Based on the execution path planning, perform adaptive resource collaborative configuration, including but not limited to intelligent unified memory management, pipelined orchestration of computing and data transmission, and dynamic power consumption allocation;

[0011] Step S3: Based on the computational feature metadata and the current hardware state, generate heterogeneous awareness optimized kernel code; the generation process includes parameterized kernel templates and just-in-time compilation technology;

[0012] Step S4: During the execution of the optimized kernel code, real-time performance monitoring and dynamic execution adjustment are performed. The dynamic execution adjustment includes dynamic parallelism and concurrent kernel execution.

[0013] Step S5: Perform intelligent verification on the calculation output results, and feed back the task metadata, configuration parameters and performance data of this execution to the historical database to update the performance prediction model and form a closed-loop learning system.

[0014] As a further aspect of the present invention, step S1 specifically includes:

[0015] S11: Extract the metadata of the computing task, the metadata including data size, dimension, sparsity and numerical precision;

[0016] S12: Input the metadata into the performance prediction model, which is trained based on historical execution data and is used to predict the expected time consumption and energy efficiency under different execution paths;

[0017] S13: Based on the prediction results, the system automatically decides the execution path and determines the optimal thread organization structure during GPU execution; among which, the execution path includes pure CPU execution path, pure GPU execution path and CPU-GPU hybrid execution path.

[0018] As a further aspect of the present invention, the intelligent unified memory management in step S2 includes:

[0019] S21: Based on the execution path planning, perform an active prefetch operation on the data in the unified memory space to migrate the data required for computation to the GPU memory before the GPU kernel executes the calculation.

[0020] S22: Implements a transparent paging mechanism, automatically exchanging data between GPU memory and host memory when the data processing scale exceeds the GPU memory capacity.

[0021] As a further aspect of the present invention, the pipelined arrangement of computation and data transmission in step S2 is as follows:

[0022] The data stream to be processed is divided into consecutive data batches, so that while the GPU is processing the Nth batch of data, the CPU is performing the preparation and transmission operations of the N+1th batch of data in parallel, thereby realizing pipeline parallelism of data transmission and kernel computation.

[0023] As a further aspect of the present invention, step S3 specifically comprises:

[0024] S31: Provides parameterized kernel code templates containing dynamically configurable parameters, including loop unrolling factor, memory access mode, and shared memory usage.

[0025] S32: During runtime, based on the computational feature metadata extracted in step S1, the optimal parameters are filled into the template to generate executable kernel code customized for the current task and hardware architecture.

[0026] As a further aspect of the present invention, the dynamic execution adjustment in step S4 includes:

[0027] S41: Supports dynamic parallelism, allowing GPU threads to launch new nested kernels at runtime based on computation results;

[0028] S42: Breaks down large tasks into multiple independent subtasks and schedules the kernels corresponding to these subtasks to execute concurrently on the GPU.

[0029] As a further aspect of the present invention, step S5 specifically includes:

[0030] S51: For calculation tasks with permissible errors, enable low-precision approximation calculation mode to obtain calculation results, and use a fast verification procedure to confirm the error range of the calculation results.

[0031] S52: Record the complete context information of this task execution, including task metadata, resource configuration parameters and real-time performance indicators, into the historical database;

[0032] S53: Periodically retrain the performance prediction model using the historical database to achieve continuous self-optimization of the system.

[0033] The present invention also provides a heterogeneous computing platform for CPU and GPU collaborative operation, applied to the heterogeneous computing method for CPU and GPU collaborative operation, the platform comprising:

[0034] The dynamic decision-making module is used to perform meta-task analysis on the input computation task, extract its computational feature metadata, and dynamically decide on the execution path planning of the task between CPU and GPU based on the pre-trained performance prediction model.

[0035] The resource configuration module is used to perform adaptive resource collaborative configuration based on the execution path planning, including but not limited to intelligent unified memory management, pipelined orchestration of computing and data transmission, and dynamic power consumption allocation.

[0036] The code generation module is used to generate heterogeneous awareness optimized kernel code based on the computational feature metadata and the current hardware state; the generation process includes parameterized kernel templates and just-in-time compilation technology.

[0037] The dynamic adjustment module is used to perform real-time performance monitoring and dynamic execution adjustment during the execution of the optimized kernel code. The dynamic execution adjustment includes dynamic parallelism and concurrent kernel execution.

[0038] The distillation module is used to intelligently verify the calculation output results and feed back the task metadata, configuration parameters and performance data of this execution to the historical database to update the performance prediction model and form a closed-loop learning system.

[0039] Compared with the prior art, the beneficial effects of the present invention are:

[0040] The heterogeneous computing method, platform, and computer-readable storage medium for CPU and GPU collaboration provided by this invention effectively solve the defects of existing technologies such as static task scheduling, inefficient memory management, serialized data transmission, insufficient kernel optimization, and open-loop system by dynamically deciding on task execution paths, adaptively configuring resources, generating heterogeneous perception optimization kernels, real-time monitoring and adjustment of the execution process, and building a closed-loop learning mechanism. It has the advantages of dynamic decision-making on task execution paths, adaptive resource collaborative configuration, kernel code optimization and customization, and closed-loop system learning. Attached Figure Description

[0041] To more clearly illustrate the technical solutions in the embodiments of the present invention, the accompanying drawings used in the description of the embodiments or the prior art will be briefly introduced below. Obviously, the accompanying drawings described below are only some embodiments of the present invention.

[0042] Figure 1 The overall flowchart of the heterogeneous computing method that allows CPUs and GPUs to work together is shown.

[0043] Figure 2 The diagram shows the architecture of a heterogeneous computing platform where the CPU and GPU work together. Detailed Implementation

[0044] To make the objectives, technical solutions, and advantages of this invention clearer, the invention will be further described in detail below with reference to the accompanying drawings and embodiments. It should be understood that the specific embodiments described herein are merely illustrative and not intended to limit the invention.

[0045] The specific implementation of the present invention will be described in detail below with reference to specific embodiments.

[0046] Figure 1The diagram illustrates the overall flowchart of a heterogeneous computing method that integrates CPU and GPU. In one embodiment of the present invention, a heterogeneous computing method integrating CPU and GPU is provided, comprising the following steps:

[0047] Step S1: Perform meta-task analysis on the input computation task, extract its computational feature metadata, and dynamically decide on the execution path planning of the task between CPU and GPU based on the pre-trained performance prediction model.

[0048] Computational feature metadata refers to a set of parameters used to quantitatively describe the characteristics of a computational task. This can be achieved using the statistical distribution characteristics of the task's input data, such as skewness and kurtosis indices. Its main purpose is to provide objective representations of the task's features. Specifically, a pre-trained performance prediction model can be understood as a prediction tool built based on historical execution data. It can be implemented using support vector machine algorithms, such as using kernel functions to handle non-linear feature relationships. Its main purpose is to generate performance prediction results under different execution paths.

[0049] Step S2: Based on the execution path planning, perform adaptive resource collaborative configuration, including but not limited to intelligent unified memory management, pipelined orchestration of computing and data transmission, and dynamic power consumption allocation;

[0050] Intelligent unified memory management refers to a mechanism that coordinates CPU and GPU memory space access. This can be implemented using cache replacement strategies based on access frequency, such as the Least Recently Used algorithm to dynamically adjust data residency locations, primarily to reduce the overhead of cross-device data migration. Therefore, pipelined orchestration of computation and data transfer can be understood as a method for parallel processing of data transfer and computation operations. This can be implemented using asynchronous transmission techniques, such as non-blocking I / O operations to achieve overlapping execution of data transfer and computation, primarily to eliminate idle computing units caused by data transfer waiting.

[0051] Step S3: Based on the computational feature metadata and the current hardware state, generate heterogeneous-aware optimized kernel code using parameterized kernel templates or just-in-time compilation technology. A parameterized kernel template is a code framework containing configurable parameters, which can be implemented using macro definition technology, such as replacing the thread block size parameter value during the compilation stage. Its main purpose is to generate kernel code that adapts to the characteristics of the current task.

[0052] Step S4: During the execution of the optimized kernel code, real-time performance monitoring and dynamic execution adjustment are performed. The dynamic execution adjustment includes dynamic parallelism and concurrent kernel execution.

[0053] Step S5: Perform intelligent verification on the calculation output results, and feed back the task metadata, configuration parameters, and performance data of this execution to the historical database to update the performance prediction model, forming a closed-loop learning system. A closed-loop learning system refers to a mechanism that continuously optimizes the decision model through feedback data. It can be implemented using online learning algorithms, such as stochastic gradient descent, to periodically update model parameters. Its main purpose is to achieve the dynamic evolution of the performance prediction model.

[0054] This embodiment avoids efficiency losses caused by static scheduling strategies failing to adapt to differences in task characteristics through dynamic decision-making execution path planning. Adaptive resource collaborative configuration eliminates the serial dependency between data transmission and computation. Heterogeneous awareness-based optimized kernel code generation solves the defect that fixed kernels cannot adapt to task changes and require manual tuning. The closed-loop feedback mechanism overcomes the limitation of open-loop systems being unable to accumulate execution experience. Thus, it effectively addresses the technical problems of rigid task scheduling strategies, prominent memory transmission bottlenecks, insufficient kernel adaptability, and the lack of self-evolution capabilities of the system.

[0055] This heterogeneous computing method, which enables CPU and GPU collaboration, achieves efficient collaboration of heterogeneous systems through dynamically perceiving task characteristics and a closed-loop learning mechanism. Upon inputting a computational task, meta-task analysis is performed, extracting computational feature metadata, including data size, dimensionality, sparsity, and numerical precision. This metadata is input into a pre-trained performance prediction model, which dynamically determines the optimal execution path between the CPU and GPU based on historical execution data. Based on the decision, adaptive resource collaborative configuration is implemented, encompassing intelligent unified memory management, pipelined orchestration of computation and data transfer, and dynamic power allocation. Furthermore, based on the computational feature metadata and the current hardware state, heterogeneously perceptive optimized kernel code is generated, utilizing parameterized kernel templates or just-in-time (JIT) compilation techniques to achieve context customization. During the execution of the optimized kernel code, real-time performance monitoring is performed, and dynamic execution adjustments, including dynamic parallel and concurrent kernel execution, are triggered. Finally, the computational output is intelligently verified, and the task metadata, configuration parameters, and performance data of this execution are fed back to the historical database to update the performance prediction model, forming a closed-loop learning system.

[0056] For example, in a video processing scenario, when handling a real-time video stream analysis task, the metadata is defined as having a data size of 80MB, a dimension of 2D, a sparsity of 0.85, and a numerical precision of FP32. After performance prediction model analysis, a CPU-GPU hybrid execution path is adopted. Based on this, the system configures unified memory management, actively migrating the data required for computation to the GPU memory. The data stream is divided into consecutive batches, so that while the GPU processes the Nth batch of video frames, the CPU prepares the N+1th batch of data in parallel. Optimized kernel code is generated, in which kernel parameters are dynamically configured to the optimal values ​​for the characteristics of the task. During execution, GPU load fluctuations are monitored, and the number of kernel concurrency is dynamically adjusted to maintain stable performance. After the results are verified, the complete execution context data is recorded in the historical database for model iteration and optimization.

[0057] As a result, the problem of rigid task scheduling strategies is effectively solved. Execution path decisions are based on real-time changes in task characteristics rather than preset rules, avoiding efficiency losses caused by feature differences. Memory and data transfer bottlenecks are eliminated, and pipelined orchestration enables parallel data transfer and computation processes, reducing idle time of computing units. The lack of adaptability of the computing kernel is overcome, and parameterized templates combined with task characteristics generate customized code, reducing the need for repeated manual optimization. The system's self-evolution capability is established, and the closed-loop feedback mechanism enables the performance prediction model to continuously accumulate execution experience, achieving iterative improvement in decision-making capabilities.

[0058] In a preferred embodiment of the present invention, step S1 specifically includes:

[0059] S11: Extract the metadata of the computing task, the metadata including data size, dimension, sparsity and numerical precision;

[0060] S12: Input the metadata into the performance prediction model, which is trained based on historical execution data and is used to predict the expected time consumption and energy efficiency under different execution paths;

[0061] S13: Based on the prediction results, automatically decide whether to use a pure CPU, pure GPU, or CPU-GPU hybrid execution path, and determine the optimal thread organization structure when the GPU is executed;

[0062] In this embodiment, metadata refers to the core characteristic quantification indicators of a computing task. These can be implemented using a combination of parameters such as data size, dimensionality, sparsity, and numerical precision, specifically used to characterize the differentiated computing resource requirements of a task. Data size can be understood as a measure of the total amount of data processed by the task, which can be quantified based on the number of bytes or elements, aiming to reflect memory bandwidth pressure and computational load intensity. Dimensionality can be understood as a representation of the structural complexity of the data, which can be described using a two-dimensional or three-dimensional spatial coordinate system, aiming to distinguish task types with different parallelization potential. Sparsity refers to the distribution characteristics of non-zero elements in the dataset, which can be based on compressed storage formats or zero-value proportions. The implementation aims to evaluate the efficiency of parallel computing and memory access patterns; numerical precision refers to the bit width specification of floating-point operations, which can be defined using half-precision, single-precision, or double-precision floating-point formats, with the aim of determining the arithmetic logic unit load characteristics of the computing unit; max-min normalization refers to the standardization process that eliminates differences in feature dimensions, which can use linear transformations to map the original features to a uniform numerical range, with the aim of ensuring fair contributions of features of different scales in the prediction model; linear equations refer to the mathematical modeling method for performance prediction, which can achieve quantitative output of time consumption and energy efficiency based on weighted linear combinations, with the aim of establishing an interpretable causal relationship between task characteristics and execution performance.

[0063] Specifically, the solution of this invention first extracts multi-dimensional metadata to construct a task feature vector, then uses max-min normalization to eliminate dimensional differences and form a standardized input, subsequently inputs the normalized feature vector into a performance prediction model to generate quantitative predictions of time consumption and energy efficiency, and finally automatically decides the optimal execution path and thread structure based on the prediction results. This process realizes a closed-loop data-driven mechanism from task feature quantification to resource allocation decision-making: the construction of metadata vectors ensures that task characteristics are fully captured, normalization processing ensures the comparability of feature values ​​and avoids large-scale features dominating the prediction process, linear equations accurately quantify the independent impact of each feature on performance through weight parameters, a historical data training mechanism allows model parameters to continuously adapt to changes in hardware status, and finally, the automatic decision-making mechanism transforms the prediction results into execution path selection and thread configuration instructions, thus forming a complete technical chain of feature extraction, quantitative modeling, performance prediction, and path decision-making.

[0064] As a specific implementation method, the present invention is implemented as follows: In the image segmentation task processing scenario, the system extracts the data scale (e.g., 10MB of pixel data), dimension (three-dimensional volume data), sparsity (0.3 non-zero voxel ratio), and numerical precision (32-bit floating point) of the input image to form a metadata vector; after normalization, this vector is input into the performance prediction model. The model calculates the pure CPU path time prediction value as 8.2 seconds and the energy efficiency prediction value as 0.45 based on the pre-trained parameters, and the pure GPU path time prediction value as 3.1 seconds and the energy efficiency prediction value as 0.78; the system automatically selects the GPU execution path based on the prediction results and determines a 128×128 thread block organization structure to match the parallel characteristics of the three-dimensional data; during the task execution process, the historical database records the metadata and actual performance indicators of this execution for subsequent periodic updates of the model parameters.

[0065] Through the above technical solutions, this invention achieves multi-dimensional quantitative representation of task characteristics and data-driven execution path decision-making, effectively avoiding decision bias caused by single-dimensional analysis; normalization processing eliminates the interference of feature dimension differences on prediction results, ensuring that low-to-medium scale features such as data size and dimensionality receive reasonable evaluation weights; the weight parameters in the linear equation system clearly express the causal relationship between features and performance, enabling path decision-making to accurately respond to dynamic changes in task sparsity, dimensionality, and other characteristics; the historical data training mechanism enables the prediction model to continuously adapt to hardware platform characteristics, improving the long-term adaptability of path decision-making; the automatic decision-making mechanism eliminates the subjective limitations of empirical rules, ensuring that CPU and GPU resource allocation is always based on real-time quantitative analysis, thereby significantly improving the resource utilization efficiency and energy efficiency of heterogeneous computing systems.

[0066] In practical applications, some of the embodiments of the present invention proposed intelligent unified memory management to optimize resource collaborative configuration. However, in its implementation, the problems of data transmission and idle computing units are prominent. The lack of active prefetching and transparent paging mechanisms based on execution paths leads to frequent idle GPUs waiting for data migration. Furthermore, when the data processing scale exceeds the video memory capacity, manual intervention is required for data exchange, resulting in low computing efficiency and insufficient system robustness.

[0067] In a preferred embodiment of the present invention, the intelligent unified memory management in step S2 includes:

[0068] S21: According to the execution path planning, perform an active prefetch operation on the data in the unified memory space to migrate the data required for computation to the GPU memory before the GPU kernel executes. The active prefetch operation refers to the mechanism of migrating data in advance according to the execution path planning. It can be implemented by a predictive prefetch strategy based on historical task characteristics or a dynamic triggering prefetch strategy based on real-time hardware status. The purpose is to ensure that the data required by the GPU kernel is ready when it starts up, and to eliminate the idle computing units caused by data waiting.

[0069] S22: Implements a transparent paging mechanism that automatically swaps data between GPU memory and host memory when the data processing scale exceeds the GPU's video memory capacity. The transparent paging mechanism can be understood as an automatic handling of memory boundary issues. It can be implemented using a hardware-accelerated unified memory controller or a virtual memory management module at the operating system kernel level. Its purpose is to enable the system to maintain continuous execution without modifying application code when processing extremely large amounts of data, avoiding computational interruptions caused by video memory overflow.

[0070] Specifically, the solution of this invention uses execution path planning as the decision-making basis for proactive prefetching operations, ensuring that the timing of data migration precisely matches the GPU computing needs and that data is ready before the GPU kernel executes. Simultaneously, a transparent paging mechanism continuously monitors the video memory usage status, automatically triggering a data exchange process when the data size exceeds a capacity threshold, without application-layer intervention. Through unified memory space collaborative management, these two mechanisms form a closed-loop mechanism from data prefetching to boundary processing, effectively guaranteeing the continuity and reliability of data flow.

[0071] As a specific implementation method, the solution of the present invention is implemented as follows: In the image recognition task, the system predicts that the GPU will perform convolutional layer calculations according to the execution path planning determined in step S1, and migrates the next batch of image feature data from the host memory to the GPU memory in advance; when processing high-resolution satellite imagery causes the GPU memory resources to be scarce, the system automatically migrates inactive data pages to the host memory and swaps them in in real time when needed for subsequent calculations. The whole process is completely transparent to the application.

[0072] In a preferred embodiment of the present invention, the pipelined arrangement of computation and data transmission in step S2 is as follows:

[0073] The data stream to be processed is divided into consecutive data batches, so that while the GPU is processing the Nth batch of data, the CPU is performing the preparation and transmission operations of the N+1th batch of data in parallel, thereby realizing pipeline parallelism of data transmission and kernel computation.

[0074] In this embodiment, data batch segmentation refers to dividing the overall data stream into independently processable sub-units. This can be achieved using a fixed-size segmentation strategy or a dynamic-size segmentation strategy based on task characteristics. The purpose is to provide basic structural support for pipelined operations and avoid the risk of blocking in overall data processing. The parallel operation of GPU and CPU can be understood as embedding the data transmission link into the GPU computing cycle through the staggered arrangement of tasks in the time dimension. This can be achieved using double-buffered memory technology or a circular buffer mechanism. The purpose is to eliminate the idle cycle of the GPU waiting for data to be ready.

[0075] Specifically, the scheme first divides the data stream to be processed into consecutive data batches, forming basic units that can be processed in parallel. Then, during execution, the GPU is configured to process the current Nth batch of data while the CPU is scheduled to execute the preparation and transmission operations for the next N+1th batch of data. This execution order arrangement allows data transmission operations and computation operations to overlap on the time axis. When the GPU completes the computation of the Nth batch, the N+1th batch of data is ready, thus avoiding the waiting state of the GPU. Finally, through the seamless connection between batches, the stability of system throughput is maintained, enabling heterogeneous hardware resources to achieve optimal collaboration under dynamic task loads.

[0076] As a specific embodiment, the solution of the present invention is implemented in an image processing scenario as follows: the video stream data is divided into batches of 10 frames each. While the GPU is processing the rendering calculation of the first batch (frames 1-10), the CPU simultaneously performs decoding and memory preloading operations for the second batch (frames 11-20). This process adopts a double-buffered memory structure, with one buffer for the GPU to read the current batch of data and the other buffer for the CPU to write the next batch of data. When the GPU finishes processing the current batch, it immediately switches to the prepared buffer, thereby achieving uninterrupted continuous processing.

[0077] In a preferred embodiment of the present invention, step S3 specifically comprises:

[0078] S31: Provides parameterized kernel code templates, which contain dynamically configurable parameters, including loop unrolling factor, memory access mode, and shared memory usage. A parameterized kernel code template refers to a predefined code framework structure, which can be implemented using C++ template metaprogramming or string replacement techniques. Its purpose is to support runtime dynamic generation of customized code. The loop unrolling factor is a configuration parameter that controls the number of times the loop body is executed; it can be set to an integer value. Its purpose is to reduce branch instruction overhead and improve instruction-level parallelism efficiency. The memory access mode refers to the way data is organized and read in memory; it can be configured as continuous access or step-by-step access. Its purpose is to optimize data locality and reduce memory latency. Shared memory usage refers to the allocated size of the GPU shared memory region; it can be dynamically adjusted to the hardware-supported specifications. Its purpose is to maximize the use of limited shared resources and improve data access speed.

[0079] S32: During runtime, based on the computational feature metadata extracted in step S1, the optimal parameters are filled into the template to generate executable kernel code customized for the current task and hardware architecture.

[0080] Specifically, the solution of this invention uses the computational feature metadata extracted in step S1 as input to drive the instantiation process of the parameterized template. The system first loads a predefined kernel code template containing multiple configurable parameter points; then, based on the data size, dimension, and sparsity characteristics in the task metadata, it calculates the optimal parameter combination; finally, these parameters are filled into the template to generate executable code. This mechanism ensures that the kernel code can accurately match the current task requirements and hardware architecture characteristics, avoiding the limitations of static compilation, and simultaneously achieving a closed-loop association between task features and kernel parameters.

[0081] As a specific implementation, the parameterized kernel template can be implemented using CUDA C++ template classes. The loop unrolling factor controls the unrolling depth via compilation instructions, the memory access mode is configured by selecting a data layout strategy for either a structure array or an array-structure, and the shared memory usage is specified by a dynamic allocation function. At runtime, the system automatically selects the loop unrolling factor value based on the task's metadata characteristics, configures the step-size access mode for high-dimensional data, and allocates the shared memory size according to the GPU architecture characteristics, thereby generating highly optimized kernel code.

[0082] In a preferred embodiment of the present invention, the dynamic execution adjustment in step S4 includes:

[0083] S41: Supports dynamic parallelism, allowing GPU threads to launch new nested kernels based on computation results during runtime; Supporting dynamic parallelism means that GPU threads can dynamically generate and launch new kernel execution units based on real-time computation status during execution. This can be achieved using the dynamic parallelism mechanism natively supported by the GPU hardware architecture, with the aim of enabling kernel execution to adaptively adjust task granularity based on intermediate computation results.

[0084] S42: Large tasks are broken down into multiple independent subtasks, and the kernels corresponding to these subtasks are scheduled to execute concurrently on the GPU. Task decomposition refers to breaking down large computational tasks into multiple logically independent subtask units with no data dependencies. This can be done based on the task's data partitioning strategy or computation graph topology, with the aim of improving the parallelism of the task. Concurrent execution refers to scheduling the kernels corresponding to multiple subtasks to run simultaneously on GPU computing resources. This can be achieved using the GPU's multi-stream concurrent execution engine, with the aim of ensuring that the computing units are constantly in a working state and reducing resource idle periods.

[0085] As a specific implementation method, the solution of the present invention is implemented as follows: In the image edge detection task, when the GPU thread processes the image data stream, if a high gradient region feature is detected, a new nested kernel can be dynamically started to perform local detail enhancement processing; at the same time, the entire image is divided into multiple continuous blocks, and the edge detection kernels corresponding to these blocks are scheduled to be executed concurrently on the GPU, so that the data processing process and the kernel startup operation form a dynamic pipeline.

[0086] In a preferred embodiment of the present invention, step S5 specifically includes:

[0087] S51: For computational tasks that allow for error, a low-precision approximation computation mode is enabled to obtain the computational results, and a fast verification procedure is used to confirm the error range of the computational results. The low-precision approximation computation mode refers to a computational strategy that reduces the precision of numerical representation while meeting the task's precision tolerance threshold. It can be implemented using a hybrid precision computational architecture, a truncation iterative algorithm, or a probabilistic approximation computation technique. The purpose is to reduce floating-point operations and memory bandwidth consumption, thereby improving computational throughput. The fast verification procedure can be understood as a lightweight verification mechanism specifically for error boundary determination. It can be built based on interval arithmetic, fast residual convergence, or statistical sampling methods. Its purpose is to confirm the reliability of the results with an overhead far lower than that of full computation.

[0088] S52: Record the complete context information of this task execution, including task metadata, resource configuration parameters and real-time performance indicators, into the historical database; the complete context information refers to a data set covering the entire link state of task execution. In practical applications, it may include task feature descriptors, resource allocation topology and performance counter snapshots. Its purpose is to establish an accurate mapping relationship between task attributes and system response.

[0089] S53: Periodically retrain the performance prediction model using the historical database to achieve continuous self-optimization of the system; periodic retraining can be understood as a model iteration mechanism triggered by time or data volume thresholds, which can be implemented by incremental learning, online Bayesian update or sliding window retraining, with the aim of maintaining the dynamic consistency between the prediction model and the current hardware state.

[0090] In this embodiment, the present invention significantly reduces the load on computing units by dynamically enabling a low-precision computation mode for tasks with permissible error, while ensuring that the result error range is controllable. Simultaneously, complete contextual information of task execution is continuously injected into the historical database as training samples, enabling the performance prediction model to capture the deep correlation between resource allocation and performance indicators. Furthermore, by setting a reasonable training cycle interval, the model update frequency is ensured to match the system state change rate. These three elements form an organic closed loop: the validation data generated by low-precision computation, after rapid program confirmation, together with comprehensive contextual information, constitutes a high-quality training set; periodic model updates transform this experience into more accurate path decision-making capabilities, thereby guiding resource allocation strategies for subsequent tasks, ultimately achieving a synergistic improvement in system energy efficiency and execution efficiency.

[0091] As a specific implementation method, when processing large-scale matrix factorization tasks in scientific computing scenarios, for intermediate calculation stages where a relative error of 0.1% is allowed, the system automatically switches to FP16 half-precision calculation mode to perform matrix operations and calls a verification program based on the residual norm for fast convergence to confirm the error range of the results. At the same time, the system fully records the task metadata (including matrix dimension, sparsity, and numerical precision requirements), resource configuration parameters (such as the number of GPU stream processors allocated and memory bandwidth configuration), and real-time performance indicators (including computation time, energy efficiency ratio, and memory utilization) to the historical database. The system is set to automatically trigger the retraining process of the performance prediction model after accumulating 50 valid execution records, and incorporate the new data into the model parameter optimization process.

[0092] Figure 2 A structural diagram of a heterogeneous computing platform that integrates CPU and GPU is shown. As a preferred embodiment of the technical solution of the present invention, a heterogeneous computing platform that integrates CPU and GPU is also provided, applied to the above-mentioned heterogeneous computing method that integrates CPU and GPU. The platform 10 includes:

[0093] The dynamic decision module 11 is used to perform meta-task analysis on the input computation task, extract its computational feature metadata, and dynamically decide on the execution path planning of the task between the CPU and GPU based on the pre-trained performance prediction model.

[0094] The resource configuration module 12 is used to perform adaptive resource collaborative configuration according to the execution path planning, including but not limited to intelligent unified memory management, pipelined orchestration of computing and data transmission, and dynamic power consumption allocation.

[0095] The code generation module 13 is used to generate heterogeneous awareness optimized kernel code based on the computational feature metadata and the current hardware state; the generation process includes parameterized kernel templates and just-in-time compilation technology.

[0096] The dynamic adjustment module 14 is used to perform real-time performance monitoring and dynamic execution adjustment during the execution of the optimized kernel code, wherein the dynamic execution adjustment includes dynamic parallelism and concurrent kernel execution;

[0097] The distillation module 15 is used to intelligently verify the calculation output results and feed back the task metadata, configuration parameters and performance data of this execution to the historical database to update the performance prediction model and form a closed-loop learning system.

[0098] Specifically, the dynamic decision-making module 11 is actually a task intelligent analysis and decision-making module, used to execute step S1, including a metadata extraction unit and a performance prediction unit; the resource configuration module 12 can also be called an adaptive resource management module, used to execute step S2, including a unified memory management unit, a pipeline scheduling unit, and a power consumption management unit; the code generation module 13 can also be called a heterogeneous awareness kernel synthesis module, used to execute step S3, including a parameterized template library and a just-in-time compiler; the dynamic adjustment module 14 can also be called a dynamic execution and monitoring module, used to execute step S4, including a performance counter acquisition unit and a kernel scheduler; the distillation module 15 can also be called a feedback and learning closed-loop module, used to execute step S5, including a result verification unit and a historical database management unit.

[0099] The core innovation of this embodiment lies in combining the task intelligent analysis and decision-making module with the feedback and learning closed-loop module through a closed-loop feedback mechanism, and integrating the adaptive resource management module, heterogeneous perception kernel synthesis module, and dynamic execution and monitoring module. This achieves dynamic path decision-making based on task feature metadata, intelligent memory management, customized kernel generation, and continuous learning optimization. Specifically, the metadata extraction unit in the task intelligent analysis and decision-making module dynamically quantifies task attributes, and the performance prediction unit generates execution path predictions based on historical data, avoiding the rigidity of static scheduling strategies. The adaptive resource management module implements an active prefetching mechanism through a unified memory management unit, and the pipeline scheduling unit realizes parallel orchestration of data transmission and computation, effectively alleviating memory and data transmission bottlenecks. The heterogeneous perception kernel synthesis module uses a parameterized template library and a just-in-time compiler to generate context-customized kernel code, overcoming the problem of the lack of adaptability of the computation kernel. The dynamic execution and monitoring module works collaboratively with the feedback and learning closed-loop module, using a performance counter acquisition unit to monitor the status in real time and a historical database management unit to accumulate execution experience to update the prediction model, establishing the system's self-evolution capability.

[0100] Through the above technical solutions, this invention effectively solves the problems of rigid task scheduling strategies, prominent memory and data transmission bottlenecks, insufficient optimization and lack of adaptability of computing kernels, and lack of self-evolution and learning capabilities of the system. It significantly improves the overall efficiency and adaptability of heterogeneous computing systems and ensures optimal resource scheduling and energy efficiency balance under dynamically changing computing loads.

[0101] The above description is only a preferred embodiment of the present invention and is not intended to limit the present invention. Any modifications, equivalent substitutions, and improvements made within the spirit and principles of the present invention should be included within the protection scope of the present invention.

Claims

1. A heterogeneous computing method for collaborative operation of CPU and GPU, characterized in that, The method includes the following steps: Step S1: Perform meta-task analysis on the input computation task, extract its computational feature metadata, and dynamically decide on the execution path planning of the task between CPU and GPU based on the pre-trained performance prediction model. Step S2: Based on the execution path planning, perform adaptive resource collaborative configuration, including but not limited to intelligent unified memory management, pipelined orchestration of computing and data transmission, and dynamic power consumption allocation; Step S3: Based on the computational feature metadata and the current hardware state, generate heterogeneous awareness optimized kernel code; the generation process includes parameterized kernel templates and just-in-time compilation technology; Step S4: During the execution of the optimized kernel code, real-time performance monitoring and dynamic execution adjustment are performed. The dynamic execution adjustment includes dynamic parallelism and concurrent kernel execution. Step S5: Perform intelligent verification on the calculation output results, and feed back the task metadata, configuration parameters and performance data of this execution to the historical database to update the performance prediction model and form a closed-loop learning system; Step S1 specifically includes: S11: Extract the metadata of the computing task, the metadata including data size, dimension, sparsity and numerical precision; S12: Construct a task feature vector based on the extracted metadata, and apply the maximum value to the task feature vector. Minimal normalization eliminates dimensional differences to form a standardized feature vector. The normalized feature vector is then input into the performance prediction model to generate quantitative prediction values ​​for time consumption and energy efficiency. The performance prediction model is trained based on historical execution data and is used to predict the expected time consumption and energy efficiency under different execution paths. S13: Based on the prediction results, the system automatically decides the execution path and determines the optimal thread organization structure during GPU execution; among which, the execution path includes pure CPU execution path, pure GPU execution path and CPU-GPU hybrid execution path.

2. The heterogeneous computing method for CPU and GPU collaborative operation according to claim 1, characterized in that, The intelligent unified memory management in step S2 includes: S21: Based on the execution path planning, perform an active prefetch operation on the data in the unified memory space to migrate the data required for computation to the GPU memory before the GPU kernel executes the calculation. S22: Implements a transparent paging mechanism, automatically exchanging data between GPU memory and host memory when the data processing scale exceeds the GPU memory capacity.

3. The heterogeneous computing method for CPU and GPU collaborative operation according to claim 1, characterized in that, The pipelined arrangement of computation and data transmission in step S2 is as follows: The data stream to be processed is divided into consecutive data batches, so that while the GPU is processing the Nth batch of data, the CPU is performing the preparation and transmission operations of the N+1th batch of data in parallel, thereby realizing pipeline parallelism of data transmission and kernel computation.

4. The heterogeneous computing method for CPU and GPU collaborative operation according to claim 1, characterized in that, Step S3 specifically involves: S31: Provides parameterized kernel code templates containing dynamically configurable parameters, including loop unrolling factor, memory access mode, and shared memory usage. S32: During runtime, based on the computational feature metadata extracted in step S1, the optimal parameters are filled into the template to generate executable kernel code customized for the current task and hardware architecture.

5. The heterogeneous computing method for CPU and GPU working in collaboration according to claim 1, characterized in that, The dynamic execution adjustment in step S4 includes: S41: Supports dynamic parallelism, allowing GPU threads to launch new nested kernels at runtime based on computation results; S42: Breaks down large tasks into multiple independent subtasks and schedules the kernels corresponding to these subtasks to execute concurrently on the GPU.

6. The heterogeneous computing method for CPU and GPU collaborative operation according to claim 1, characterized in that, Step S5 specifically includes: S51: For calculation tasks with permissible errors, enable low-precision approximation calculation mode to obtain calculation results, and use a fast verification procedure to confirm the error range of the calculation results. S52: Record the complete context information of this task execution, including task metadata, resource configuration parameters and real-time performance indicators, into the historical database; S53: Periodically retrain the performance prediction model using the historical database to achieve continuous self-optimization of the system.

7. A heterogeneous computing platform for CPU and GPU collaboration, applied to the heterogeneous computing method for CPU and GPU collaboration as described in any one of claims 1-6, characterized in that, The platform includes: The dynamic decision-making module is used to perform meta-task analysis on the input computation task, extract its computational feature metadata, and dynamically decide on the execution path planning of the task between CPU and GPU based on the pre-trained performance prediction model. The resource configuration module is used to perform adaptive resource collaborative configuration based on the execution path planning, including but not limited to intelligent unified memory management, pipelined orchestration of computing and data transmission, and dynamic power consumption allocation. The code generation module is used to generate heterogeneous awareness optimized kernel code based on the computational feature metadata and the current hardware state; the generation process includes parameterized kernel templates and just-in-time compilation technology. The dynamic adjustment module is used to perform real-time performance monitoring and dynamic execution adjustment during the execution of the optimized kernel code. The dynamic execution adjustment includes dynamic parallelism and concurrent kernel execution. The distillation module is used to intelligently verify the calculation output results and feed back the task metadata, configuration parameters and performance data of this execution to the historical database to update the performance prediction model and form a closed-loop learning system.

Citation Information

Patent Citations

  • Two-dimensional sequence splitting method and system under large model pipeline parallel training

    CN119883383A

  • Container cloud-oriented task flow flexible arrangement system and method

    CN119960937A