Light depth tracing BSDF solution optimization method based on LSTM under heterogeneous parallel system
By using the LSTM deep learning model in heterogeneous parallel systems to monitor load status in real time and predict future trends, and dynamically adjust task allocation, the problems of load imbalance and resource waste in heterogeneous systems are solved, computing efficiency and resource utilization are improved, and the stability and efficiency of large-scale ray tracing scenarios are ensured.
Patent Information
- Application Number
- CN202510914796.X
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2025-07-03
- Publication Date
- 2025-09-23
- Estimated Expiration
- 2045-07-03
AI Technical Summary
Heterogeneous parallel systems have difficulty achieving dynamic load balancing in BSDF solving, have poor scene adaptability, and have structural waste in resource scheduling mechanisms, resulting in low computing efficiency, especially low resource utilization in dynamic scenarios.
A deep learning model based on LSTM is used to monitor load status in real time, predict future load trends, and dynamically adjust task allocation. By building an LSTM deep learning model to predict future load trends and training time series relationships based on historical load data, advance scheduling of ray tracing tasks is achieved, and task allocation is dynamically adjusted to achieve load balancing.
It significantly improves the adaptability and computing efficiency of heterogeneous systems, avoids resource contention, ensures task throughput stability in large-scale ray tracing scenarios, leverages the architectural advantages of each computing unit, and reduces ray tracing time.
Smart Images

Figure CN120688367A_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the technical field of computer graphics, and in particular to an LSTM-based ray depth tracing (BSDF) solution optimization method in a heterogeneous parallel system. Background Art
[0002] The BSDF (Bidirectional Scattering Distribution Function) is a mathematical model that describes the interaction between light and materials. It accurately simulates the reflection and transmission behavior of different surface materials and is widely used in computer graphics, particularly in high-quality renderings, enabling realistic rendering of the optical properties of complex materials and enhancing visual realism. However, solving large-scale light propagation problems using the BSDF also presents computational bottlenecks: each interaction between light and a surface requires multiple sampling and complex calculations based on the BSDF model. For example, these calculations involve the integration and sampling of high-dimensional probability distributions and must strictly adhere to physical constraints such as energy conservation, resulting in an exponential increase in the computational overhead of a single ray path. In dynamic scenes, the real-time updating of ray paths further exacerbates the computational pressure. Traditional computing architectures struggle to cope with these high-concurrency and high-complexity requirements, often leading to rendering delays and resource contention. For example, calculating multiple scattering from highly rough surfaces requires extensive parallel processing power, while accurately solving specular reflections relies on complex logical branching, making it difficult for a single computing unit to achieve both efficiency and accuracy.
[0003] To overcome this bottleneck, the introduction of heterogeneous parallel systems is crucial. By synergistically leveraging the serial logic processing capabilities of the CPU (central processing unit) and the massively parallel computing power of the GPU (graphics processing unit), the system can batch-allocate low-complexity BSDF tasks (such as simple reflections or low-roughness scattering) to the GPU for rapid processing, while the CPU focuses on solving high-complexity paths (such as caustics or multi-layer transmission). However, the performance of heterogeneous systems is highly dependent on the rationality of task allocation. If task allocation is rigid, the GPU may become saturated with simple tasks while the CPU becomes blocked with complex ones, or vice versa. Therefore, dynamic load balancing strategies are essential. By monitoring the load status of each computational unit in real time and combining it with real-time complexity assessment of ray paths, this method can intelligently adjust task allocation, for example, migrating high-concurrency tasks when the GPU is idle or distributing computational pressure to other nodes when the CPU is overloaded. This strategy not only maximizes hardware resource utilization but also significantly improves rendering efficiency, enabling real-time interactivity in complex scenes and providing a scalable solution for the application of BSDF in large-scale ray tracing.
[0004] Therefore, existing technologies for solving large-scale ray depth tracing based on bidirectional scattering distribution functions (BSDFs) in heterogeneous parallel systems suffer from the following key issues: First, dynamic load balancing is difficult in heterogeneous systems. Traditional static allocation strategies fail to consider the real-time dynamic characteristics of BSDF surface interactions (such as the continuous variation of the microscopic roughness coefficient α and the multidimensional coupling of the Fresnel reflectivity F term), resulting in low hardware resource utilization. Second, poor scene adaptability leads to low computational efficiency. Fixed task partitioning schemes (such as dividing computational units by a single roughness threshold α = 0.3) cannot respond to complex scenarios such as dynamic changes in material properties (such as surface oxidation in real-time rendering) and sudden changes in optical characteristics (such as caustic path generation and light energy attenuation in high-roughness media). This results in high-dynamic BSDF calculation time consumption. Finally, resource scheduling mechanisms suffer from structural waste. Task-level optimization strategies are not established to address the heterogeneous hardware characteristics (CPU multi-core parallelism / GPU large-scale thread concurrency). In particular, data dependencies between ray paths are ignored during cross-platform task migration, resulting in idle computing resources. Summary of the Invention
[0005] The present invention aims to solve the technical problems in the prior art that heterogeneous systems are difficult to achieve dynamic load balancing, poor scene adaptability leads to low computing efficiency, and there is structural waste in the resource scheduling mechanism. It provides an LSTM-based ray depth tracing BSDF solution optimization method in a heterogeneous parallel system.
[0006] In order to solve the above technical problems, the technical solutions of the present invention are as follows:
[0007] A LSTM-based ray depth tracing BSDF solution optimization method in a heterogeneous parallel system includes the following steps:
[0008] Step 1: Divide the large-scale ray depth tracing task of solving BSDF into subtasks to be executed in parallel, quantify and analyze the complexity of the subtasks, and estimate the data volume;
[0009] Step 2: Obtain the hardware parameters of each computing unit in the heterogeneous system, initially divide the basic units of the BSDF solution task, and collect historical data of historical BSDF solution tasks;
[0010] Step 3: Monitor the load status of each computing unit in the BSDF solution task divided in step 1 in real time, and set the dynamic monitoring cycle according to the dynamic changes of the task;
[0011] Step 4: Based on the historical data collected in Step 2, build an LSTM deep learning model to predict the load value of future BSDF calculation tasks;
[0012] Step 5: Input the real-time load status information monitored in step 3 into the deep learning model trained in step 4 to evaluate and predict the load status. The system load status is determined by combining the model output and the load status of each computing unit.
[0013] Step 6: When the system load imbalance is detected in step 5, a dynamic task adjustment strategy is formulated to migrate tasks to appropriate computing units with lower loads;
[0014] Step 7: Repeat steps 3-6, continuously monitor the load status during the entire BSDF solution process, use the deep learning model to evaluate and predict the load and perform dynamic task adjustments, add new data to the historical dataset, and regularly retrain and optimize the deep learning model.
[0015] In the above technical solution, step 1 is specifically as follows:
[0016] The BSDF solving task is divided into N subtasks according to the light propagation path, and each subtask corresponds to multiple surface interactions of a light ray;
[0017] For each subtask, calculate its computational complexity and data volume; according to the BSDF microsurface model, quantify the computational complexity C of each subtask i :
[0018]
[0019] Where M represents the number of interactions between light and the object surface in the subtask;
[0020] D(h k ): Normal distribution function, which represents the relationship between the normal direction and the half-angle vector h in the surface micro geometry k Probability density of uniform microsurfaces:
[0021]
[0022] Where h is the half-angle vector, α is the roughness parameter, and n is the macroscopic surface normal;
[0023] G(h k ): Occlusion term, which describes the proportion of light that is blocked or obscured by surface unevenness and is used to correct energy loss on rough surfaces:
[0024]
[0025] Where l is the incident direction of the light;
[0026] F(h k ): Fresnel term, which represents the reflection ratio of light at a specific incident angle:
[0027] F(h)=F0+(1-F0)(1-(v·h)) 5
[0028] Where F0 is the base reflectivity and v is the sight direction;
[0029] After quantifying the complexity of the subtasks, the data volume is estimated. The data volume of each subtask is D i Proportional to the number of interactions M between the light and the surface:
[0030] D i =M·S data (S data =1KM / interaction)
[0031] Where M is the number of interactions between the ray and the surface.
[0032] In the above technical solution, step 2 is specifically as follows:
[0033] When the heterogeneous computing system starts, the hardware parameters of each computing unit in the system are obtained through the system API. These parameters include CPU parameters: main frequency, number of cores, cache capacity; GPU parameters: floating-point computing power, number of stream processors, and memory bandwidth; communication delay: the data transmission delay between the CPU and GPU is measured through the Ping-Pong test; hardware performance evaluation function:
[0034] P CPU =f CPU ·C core ,P GPU =F GPU ·S SM
[0035] Among them, f CPU is the CPU main frequency, C core is the number of cores, F GPU For GPU floating point performance, S SM is the number of stream processors.
[0036] According to the characteristics of BSDF solving tasks, the light propagation path is used as the basic division unit for initial task allocation. The initial task allocation strategy for each path is: assign low-roughness paths to GPU batch processing; assign high-roughness paths to CPU single-thread processing;
[0037] Before the system is run, the load data of historical BSDF solving tasks is collected, including the real-time utilization of CPU / GPU, the length of the task queue, the task execution time and the remaining computational load, to construct a historical data set.
[0038] In the above technical solution, step 3 is specifically as follows:
[0039] Real-time monitoring of the load status of each computing unit during the BSDF solution process: monitoring CPU usage, task queue length, and remaining computational load; monitoring GPU memory occupancy, stream processor utilization, communication latency, and load balancing factor β calculation:
[0040]
[0041] Among them, U CPU 、U GPU Represents the utilization of CPU and GPU respectively, Q CPU , Q GPU Represents the task queue lengths of the CPU and GPU, respectively, and is used to preliminarily measure the current load; F CPU 、F GPU Represents the peak performance FLOPS of CPU and GPU respectively; R CPU 、R GPU Represent the remaining computational load of the CPU and GPU respectively;
[0042] Adjust the monitoring frequency according to the dynamic nature of the task: Set the monitoring period separately for static and dynamic scenarios.
[0043] In the above technical solution, step 4 is specifically as follows:
[0044] Build a deep learning model LSTM based on historical data to learn the intrinsic relationship between load data and the execution effect of BSDF solution tasks;
[0045] The model architecture design consists of three layers: input layer, LSTM layer, and output layer. The input layer uses historical load data to capture load changes under different batches, time steps, and feature dimensions, providing rich input information for subsequent model learning. The output layer is a fully connected layer that outputs load forecasts for multiple cycles in the future.
[0046] The loss function in the training process uses mean square error to measure the average square error between the predicted value and the true value, clarifying the direction of model optimization; the optimizer uses Adam;
[0047] For training data, the historical data set is divided into a training set and a validation set. The historical data set is used to train and optimize the model and adjust the model parameters to improve the prediction accuracy of the model.
[0048] LSTM unit calculation:
[0049] f t =σ(W f ·[h t-1 ,x t ]+b f )
[0050] it =σ(W i ·[h t-1 ,x t ]+b i )
[0051] o t =σ(W o ·[h t-1 ,x t ]+b o )
[0052]
[0053] h t =o t tanh(C t )
[0054] Among them, f t 、i t 、o t They are respectively the forget gate, input gate, and output gate, C t is the cell state; the forget gate determines the t The input gate is used to control which new information is input into the cell state; the output gate is responsible for determining which information in the cell state will be output.
[0055] In the above technical solution, step 5 is specifically as follows:
[0056] Calculate the load imbalance Δ based on the prediction results:
[0057]
[0058] Among them, T CPU Indicates the comprehensive load index of the CPU, quantifying the current task pressure of the CPU; T GPU Indicates the comprehensive load index of the GPU and quantifies the current task pressure of the GPU;
[0059]
[0060] Among them, Q CPU , Q GPU Represents the task queue lengths of CPU and GPU respectively, C avg,CPU 、C avg,GPU Represents the average complexity of CPU and GPU processing a single subtask, H CPU 、H GPU Represents the cache hit rate of CPU and GPU respectively; U CPU 、U GPU Represents the resource utilization of CPU and GPU respectively; P CPU 、PGPU Represent the computing power of CPU and GPU respectively, which are normalized according to hardware parameters:
[0061] P CPU =f CPU ·N core ,P GPU =F GPU ·N SM
[0062] Among them, f CPU Indicates the CPU main frequency, N core Indicates the number of CPU cores, F GPU Indicates the floating-point performance of a single stream processor of the GPU, N SM Indicates the number of GPU stream processors;
[0063] Combined with the prediction results of the model, a comprehensive evaluation is conducted on the load of each computing unit to determine whether there is any load imbalance in the system.
[0064] In the above technical solution, step 6 is specifically as follows:
[0065] When the system load is unbalanced, task allocation is dynamically adjusted according to the following strategies:
[0066]
[0067] Where α is the BSDF roughness parameter; β is the system load factor; T CPU Indicates the comprehensive load index of the CPU; T GPU Indicates the comprehensive load index of the GPU;
[0068] By combining material characteristics and system real-time load status, the task migration strategy is dynamically adjusted to achieve load balancing of heterogeneous systems; the number of migration tasks N migrate With W adjust is proportional to the degree of deviation:
[0069] N migrate =k·|W adjust -W threshold |
[0070] Where k is the migration coefficient, which is used to control the migration amplitude.
[0071] In the above technical solution, step 7 is specifically as follows:
[0072] During the entire BSDF solution process, the system load is continuously monitored. Steps 3-6 are repeated every cycle. The deep learning model LSTM is used to evaluate and predict the load of each computing unit, and the BSDF calculation task allocation is adjusted in real time to dynamically optimize the load distribution.
[0073] The loss function is updated when the model is retrained:
[0074] L new =λL old +(1-λ)L current
[0075] Among them, λ is the weight of historical data, L old is the historical loss, which represents the load data collected in the past training cycles to prevent the model from being over-adjusted due to short-term data fluctuations and maintain long-term stability; L current is the current loss, which represents the latest monitored load data and is used to capture the latest state changes of the system, ensuring that the model adapts to dynamic scenarios and avoids prediction lag; L new It is a comprehensive loss, which represents the weighted fusion of new and old losses, balancing long-term memory and short-term adaptation.
[0076] In the above technical solution, step 4 is specifically as follows: Based on the historical data collected in step 2, a Transformer time series prediction model is constructed to predict the load value of future BSDF calculation tasks:
[0077] The global temporal correlation of historical load data is modeled through a multi-head attention mechanism, and the temporal order information of load fluctuations is retained in combination with position encoding. An Encoder-Decoder structure is used for multi-period load prediction: the Encoder layer uses a sliding window to extract the time series features of the CPU / GPU memory occupancy rate and task queue backlog of the computing unit, and the Decoder layer generates future load prediction values step by step based on an autoregressive mechanism.
[0078] In the above technical solution, step 6 is specifically as follows: when step 5 detects that the system load is unbalanced, a Markov decision process model is constructed, with the states of the heterogeneous computing units as the state space, the task migration actions as the behavior space, and the system-level energy efficiency ratio as the reward function; the PPO algorithm is used to update the policy network online and dynamically adjust the allocation weights of the BSDF calculation tasks.
[0079] The present invention has the following beneficial effects:
[0080] The present invention's LSTM-based ray tracing (BSDF) solution optimization method for heterogeneous parallel systems predicts future load trends by constructing an LSTM deep learning model. Using an LSTM network trained on historical load data to model temporal relationships, the method accurately captures the long-term dependencies of load changes, thereby enabling proactive scheduling of ray tracing tasks. Compared to traditional static resource allocation methods, this method can predict load bottlenecks in computing units in advance and dynamically adjust BSDF solution task allocation decisions, avoiding resource contention caused by monitoring lags and significantly improving the adaptability and computational efficiency of heterogeneous systems.
[0081] The LSTM-based ray tracing BSDF solution optimization method in heterogeneous parallel systems of the present invention formulates a dynamic feedback load balancing optimization strategy to realize dynamic task allocation of heterogeneous parallel systems. It can quickly identify overloaded nodes according to the real-time system status, accurately split BSDF calculation subtasks and intelligently match idle computing units, significantly improving the collaborative efficiency of heterogeneous hardware resources and ensuring the stability of task throughput in large-scale ray tracing scenarios.
[0082] The LSTM-based ray depth tracing BSDF solution optimization method in the heterogeneous parallel system of the present invention realizes a BSDF-aware heterogeneous hardware adaptation mechanism. By mining the intrinsic material characteristic parameters of the BSDF calculation task, a mapping relationship between material characteristics and the computing characteristics of the hardware architecture is established. This differentiated hardware adaptation strategy based on the essence of physical characteristics can effectively give play to the architectural advantages of each computing unit and reduce the ray tracing time while maintaining rendering accuracy. BRIEF DESCRIPTION OF THE DRAWINGS
[0083] The present invention will be further described in detail below with reference to the accompanying drawings and specific embodiments.
[0084] Figure 1 The figure is a schematic diagram of the steps of the LSTM-based ray depth tracing BSDF solution optimization method in the heterogeneous parallel system of the present invention.
[0085] Figure 2 Schematic diagram of the large-scale light propagation process. DETAILED DESCRIPTION
[0086] The inventive concept of the present invention is: the LSTM-based BSDF solution optimization method for ray tracing in a heterogeneous parallel system of the present invention establishes an atomic task division mechanism based on ray path independence in the ray tracing process, and decouples massive ray tracing processes into sub-task units that can be calculated in parallel; integrates BSDF real-time feature analysis (including scattering energy distribution, path complexity prediction) with heterogeneous hardware performance, and constructs a lightweight deep learning model to realize dynamic load perception; develops a priority scheduling engine and an adaptive migration strategy, and dynamically reallocates GPU memory resident tasks and CPU multi-core batch processing tasks under the premise of ensuring data locality, thereby improving the utilization rate of heterogeneous computing resources and realizing the optimization of computing efficiency in large-scale ray tracing scenarios.
[0087] The present invention will be described in detail below with reference to the accompanying drawings.
[0088] The LSTM-based ray tracing deep learning (BSDF) solution optimization method for heterogeneous parallel systems of the present invention divides large-scale ray tracing tasks based on BSDF into subtasks executed in parallel, monitors the load status of the heterogeneous parallel system during the solution process, and constructs an LSTM deep learning model based on historical data of the solution process to evaluate and predict the load of computing units, thereby dynamically allocating tasks and realizing load balancing for heterogeneous parallel systems in solving large-scale ray tracing tasks based on BSDF.
[0089] like Figure 1 As shown, the method of the present invention comprises the following steps:
[0090] Step 1: Divide the large-scale ray depth tracing task of solving BSDF into subtasks to be executed in parallel, quantify and analyze the complexity of the subtasks, and estimate the data volume;
[0091] Step 2: Obtain the hardware parameters of each computing unit in the heterogeneous system, initially divide the basic units of the BSDF solution task, and collect historical data of historical BSDF solution tasks;
[0092] Step 3: Monitor the load status of each computing unit in the BSDF solution task divided in step 1 in real time, and set the dynamic monitoring cycle according to the dynamic changes of the task;
[0093] Step 4: Based on the historical data collected in Step 2, build an LSTM deep learning model to predict the load value of future BSDF calculation tasks;
[0094] Step 5: Input the real-time load status information monitored in step 3 into the deep learning model trained in step 4 to evaluate and predict the load status. The system load status is determined by combining the model output and the load status of each computing unit.
[0095] Step 6: When the system load imbalance is detected in step 5, a dynamic task adjustment strategy is formulated to migrate tasks to appropriate computing units with lower loads;
[0096] Step 7: Repeat steps 3-6, continuously monitor the load status during the entire BSDF solution process, use the deep learning model to evaluate and predict the load and perform dynamic task adjustments, add new data to the historical dataset, and regularly retrain and optimize the deep learning model.
[0097] In step 1 of the present invention, the BSDF solving task is divided into N subtasks according to the light propagation path, and each subtask corresponds to multiple surface interactions of a light. Figure 2As shown in the figure, {R1, R2, R3, ...} constitute a large-scale ray set. For the deep ray tracing process, the path tracing process of each ray is abstracted into independent subtask units. For example, ray R1 will interact with the surfaces {S1, S2, S3, ...} in the scene one by one during its propagation path. During each interaction, the subsequent propagation path is solved through BSDF based on the physical simulation of the material reflection characteristics and the incident direction. For each subtask, its computational complexity and data volume are calculated. Based on the micro-surface model of BSDF, the computational complexity C of each subtask is quantified. i :
[0098]
[0099] Where M represents the number of interactions between light and the object surface in the subtask;
[0100] D(h k ): Normal distribution function, which represents the relationship between the normal direction and the half-angle vector h in the surface micro geometry k A consistent probability density of microsurfaces is used to control the effect of surface roughness on the direction of light scattering. When the D value is concentrated, light tends to be specularly reflected, while when the D value is widely distributed, light scattering is more dispersed:
[0101]
[0102] Among them, h is the half-angle vector (the midpoint between the incident direction l and the viewing direction v), α is the roughness parameter (0 is smooth and 1 is completely rough), and n is the macroscopic surface normal.
[0103] G(h k ): Shielding term, which describes the proportion of light that is blocked or obscured by surface unevenness. It is used to correct the energy loss of rough surfaces and ensure energy conservation. For smooth surfaces, the shielding effect is negligible (G≈1), while for rough surfaces, part of the light is blocked (G<1), especially at grazing angles (light is close to parallel to the surface):
[0104]
[0105] Where l is the incident direction of the light.
[0106] F(h k ): Fresnel term, which represents the reflection ratio of light at a specific incident angle. When the incident light is perpendicular, the reflectivity is the lowest, and when the incident light is at a grazing angle, the reflectivity is close to 100%:
[0107] F(h)=F0+(1-F0)(1-(v·h)) 5
[0108] Among them, F0 is the basic reflectivity (material property characteristics, metal F0 is high, non-metallic F0 is low), and v is the viewing direction.
[0109] Subtask complexity C i It is the cumulative effect of multiple interactions between light and the surface. D·G·F combines the effects of microscopic geometric distribution (D), energy shielding (G), and angular reflection (F) to accurately describe the interaction intensity between light and the material. For smooth materials, low complexity (C i Small), while for rough materials, the complexity is high (C i After quantifying the complexity of the subtasks, the data volume is estimated. The data volume of each subtask is D i Proportional to the number of interactions M between the light and the surface:
[0110] D i =M·S data (S data =1KM / interaction)
[0111] Where M is the number of interactions between the ray and the surface.
[0112] In step 2 of the present invention, when a heterogeneous computing system (such as a CPU-GPU architecture) is started, the hardware parameters of each computing unit in the system (such as a CPU core, a GPU stream processor, etc.) are first obtained through the system API, including CPU parameters: main frequency (such as 3.5GHz), number of cores (such as 8 cores), cache capacity (such as 32MB); GPU parameters: floating-point computing power (such as 10TFLOPS), number of stream processors (such as 4096), memory bandwidth (such as 512GB / s); communication delay: the data transmission delay between the CPU and GPU is measured through the Ping-Pong test (such as 0.1ms). Hardware performance evaluation function:
[0113] P CPU =f CPU ·C core ,P GPU =F GPU ·S SM
[0114] Among them, f CPU is the CPU main frequency, C core is the number of cores, F GPU For GPU floating point performance, S SM is the number of stream processors.
[0115] At the same time, according to the characteristics of the BSDF solving task, the light propagation path is used as the basic division unit, and the initial task allocation is performed. The initial task allocation strategy for each path is: assign low roughness paths (α<0.3) to GPU batch processing; assign high roughness paths (α≥0.3) to CPU single-thread processing.
[0116] Before the system is run, the load data of historical BSDF solving tasks are collected, including the real-time utilization of CPU / GPU (such as CPU utilization 70%, GPU memory occupancy 80%); task queue length (such as CPU queue 20 tasks, GPU queue 100 tasks); task execution time and remaining computational load (such as subtask 1 takes 50ms and the remaining computational load is 30%), to construct a historical data set.
[0117] In step 3 of the present invention, the load status of each computing unit in the BSDF solution process is monitored in real time: the CPU usage (%), task queue length, and remaining computational load (%) are monitored; the GPU memory occupancy (%), stream processor utilization (%), and communication delay (ms) are monitored, and the load balancing factor β is calculated:
[0118]
[0119] Among them, U CPU 、U GPU Represents the utilization of CPU and GPU respectively, Q CPU , Q GPU Represents the task queue lengths of the CPU and GPU, respectively, and is used to preliminarily measure the current load; F CPU 、F GPU Represents the peak performance FLOPS (floating point operations per second) of the CPU and GPU respectively. The inverse ratio of peak performance is introduced to balance the performance differences of computing units, which is in line with the principle of heterogeneous computing resource allocation; R CPU 、R GPU Represent the remaining computational load of the CPU and GPU respectively.
[0120] The monitoring frequency is adjusted based on the dynamic nature of the task: for static scenes, the monitoring period is set to 200ms; for dynamic scenes (such as real-time rendering), the monitoring period is shortened to 50ms. CPU monitoring is achieved by acquiring real-time data through the perf or OpenMP interface, and GPU monitoring is achieved using NVML (NVIDIA Management Library) or CUDA event logging.
[0121] In step 4 of the present invention, a deep learning model LSTM is constructed based on historical data to learn the intrinsic relationship between load data and the execution effect of the BSDF solution task.
[0122] The model architecture design consists of three layers: the input layer, which inputs historical load data (CPU usage, GPU memory occupancy, etc., with a batch dimension) size ,time steps, features), capturing the load changes under different batches, time steps and feature dimensions, and providing rich input information for subsequent model learning; LSTM layer, 3 layers stacked, 128 neurons in each layer, and tanh activation function. This multi-layer stacking method can enhance the model's ability to capture long-distance dependencies in sequence data. Through the nonlinear transformation of a large number of neurons, it can more complexly extract potential features in the load data, thereby better learning the relationship between load data and task execution effects; the output layer is designed as a fully connected layer, which outputs the load forecast value for the next 10 cycles.
[0123] The training process loss function uses the mean squared error (MSE) to measure the average squared error between the predicted value and the true value, clarifying the model optimization direction. The optimizer uses Adam (with an initial learning rate of 0.001), which can automatically adjust the learning rate during training to accelerate the model's convergence. For training data, the historical dataset is divided into 80% training set and 20% validation set. The historical dataset is used to train and optimize the model, and model parameters (such as the weights and bias of the LSTM layer) are adjusted to improve the model's prediction accuracy. LSTM unit calculation:
[0124] f t =σ(W f ·[h t-1 ,x t ]+b f )
[0125] i t =σ(W i ·[h t-1 ,x t ]+b i )
[0126] o t =σ(W o ·[h t-1 ,x t ]+b o )
[0127]
[0128] h t =o t tanh(C t )
[0129] Among them, f t 、i t 、o t They are respectively the forget gate, input gate, and output gate, C t is the cell state. The forget gate determines the tThe LSTM cell dynamically adjusts these three gates to effectively handle long-term dependencies in sequential data and better capture the changing trends and inherent patterns of load data over time.
[0130] In step 5 of the present invention, the load status information of each computing unit during the BSDF solution process monitored in real time in step 3 is used as input information and input into the LSTM deep learning model trained in step 4. The model evaluates the current load status and outputs the predicted future load change trend and task execution time of each computing unit under the current task allocation. The load imbalance Δ is calculated based on the predicted results:
[0131]
[0132] Among them, T CPU Indicates the comprehensive load index of the CPU, quantifying the current task pressure of the CPU, T GPU Represents the comprehensive load index of the GPU, quantifying the current task pressure of the GPU, T CPU 、T GPU The larger the value, the heavier the load on the corresponding computing unit, and the longer it takes to process the task:
[0133]
[0134] Among them, Q CPU , Q GPU Represents the task queue lengths of CPU and GPU (i.e., the number of tasks to be processed), C avg,CPU 、C avg,GPU Represents the average complexity of CPU and GPU processing a single subtask (given by C in step 1) i calculated); H CPU 、H GPU Represent the cache hit rates of CPU and GPU respectively, The larger the value, the longer the actual processing time of the task; CPU 、U GPU They represent the resource utilization of CPU and GPU respectively, (1-U) is the ratio of remaining available resources; P CPU 、P GPU Represent the computing power of CPU and GPU respectively, which are normalized according to hardware parameters:
[0135] P CPU =f CPU ·N core ,P GPU =F GPU ·N SM
[0136] Among them, f CPU Indicates the CPU main frequency, N core Indicates the number of CPU cores, F GPU Indicates the floating-point performance of a single stream processor of the GPU, N SM Indicates the number of GPU stream processors.
[0137] Combined with the model's prediction results, a comprehensive evaluation is conducted on the load of each computing unit to determine whether the system has load imbalance. If Δ>0.3, it is determined to be load imbalance, and task migration needs to be triggered to improve overall efficiency.
[0138] In step 6 of the present invention, based on the system load imbalance Δ obtained in step 5, when the system load is unbalanced, task allocation is dynamically adjusted according to the following strategy:
[0139]
[0140] Among them, α is the BSDF roughness parameter. The larger α is, the greater the roughness is, the higher the BSDF calculation complexity is, and more computing resources are required. β is the system load factor calculated in step 3. β>1 indicates that the CPU load is heavy, otherwise it indicates that the GPU load is heavy.
[0141] For high-roughness tasks (α->1), we tend to rely on the computing power of the GPU (because the GPU is good at processing high-complexity tasks in parallel); for high-CPU load tasks (β->∞), we tend to migrate tasks to the GPU to reduce CPU pressure.
[0142] By combining material properties (BSDF roughness α) and system real-time load status (β, T CPU 、T GPU ), dynamically adjust the task migration strategy to achieve load balancing of heterogeneous systems. adjust The higher it is, the more likely it is that the current task characteristics (high roughness) or system status (CPU overload) require GPU intervention, indicating that the current system load and material characteristics are more inclined to assign tasks to the GPU; on the contrary, W adjust The lower the value, the more tasks should be assigned to the CPU. Set the threshold W based on experience or system performance. threshold , if W adjust >W threshold , some CPU tasks will be migrated to GPU. In this case, subtasks with low data dependency (such as independent light paths) will be given priority during migration; otherwise, some GPU tasks will be migrated to CPU. Number of migration tasks N migrate With W adjust is proportional to the degree of deviation:
[0143] Nmigrate =k·|W adjust -W threshold |
[0144] Where k is the migration coefficient, which is used to control the migration amplitude.
[0145] In step 7 of the present invention, the system load is continuously monitored during the entire BSDF solution process, and steps 3-6 are repeated every periodic time. The deep learning model LSTM is used to evaluate and predict the load of each computing unit, adjust the BSDF calculation task allocation in real time, and dynamically optimize the load distribution. At the same time, after completing 10 tasks, the newly generated load data of each computing unit and the BSDF solution task execution results are added to the historical data set, and the LSTM model is retrained to enable it to adapt to the ever-changing tasks and system environment and improve the prediction accuracy. The LRU (least recently used) strategy is used to eliminate obsolete caches to ensure data validity. The loss function is updated when the model is retrained:
[0146] L new =λL old +(1-λ)L current
[0147] Among them, λ is the weight of historical data, L old is the historical loss, which represents the load data collected in the past training cycles (such as CPU / GPU utilization and task queue length) to prevent the model from being over-adjusted due to short-term data fluctuations (such as instantaneous load peaks) and maintain long-term stability; L current L is the current loss, which represents the latest monitored load data (such as real-time indicators of the last 10 task cycles). It is used to capture the latest state changes of the system (such as the addition of high-complexity materials and hardware performance fluctuations) to ensure that the model adapts to dynamic scenarios and avoids prediction lag. new is a comprehensive loss, representing a weighted fusion of old and new losses, balancing long-term memory and short-term adaptation. If λ is large, the model relies more on historical data and is suitable for stable scenarios; conversely, the model focuses more on new data and is suitable for rapidly changing dynamic environments.
[0148] In other specific embodiments, in the load prediction module, the Transformer time series prediction model can be used instead of the LSTM deep learning architecture. The global time series correlation of historical load data is modeled through a multi-head attention mechanism, and the time sequence information of load fluctuations is retained in combination with position encoding. The Encoder-Decoder (encoding-decoding) structure is used for multi-cycle load prediction: the Encoder layer uses a sliding window to extract time series features such as the CPU / GPU memory occupancy rate and task queue backlog of the computing unit, and the Decoder layer generates future load prediction values step by step based on the autoregressive mechanism. Compared with LSTM, Transformer has the advantage of parallel computing in long sequence modeling, but a dynamic sparse attention mechanism is required to control the computational complexity.
[0149] In other specific implementations, in the dynamic task allocation strategy, an adaptive partitioning algorithm based on reinforcement learning can be introduced to replace the current priority queue mechanism. By constructing a Markov decision process model, the state of the heterogeneous computing unit (core utilization, cache hit rate, power consumption) is used as the state space, the task migration action is used as the behavior space, and the system-level energy efficiency ratio (task completion amount under unit power consumption) is used as the reward function. The PPO (proximal policy optimization) algorithm is used to update the policy network online and dynamically adjust the allocation weight of the BSDF calculation task. Compared with the heuristic rules of the original scheme, this method can autonomously mine the implicit correlation characteristics of hardware resources, but there will be a delay in real-time decision-making.
[0150] The present invention's LSTM-based ray tracing (BSDF) solution optimization method for heterogeneous parallel systems predicts future load trends by constructing an LSTM deep learning model. Using an LSTM network trained on historical load data to model temporal relationships, the method accurately captures the long-term dependencies of load changes, thereby enabling proactive scheduling of ray tracing tasks. Compared to traditional static resource allocation methods, this method can predict load bottlenecks in computing units in advance and dynamically adjust BSDF solution task allocation decisions, avoiding resource contention caused by monitoring lags and significantly improving the adaptability and computational efficiency of heterogeneous systems.
[0151] The LSTM-based ray tracing BSDF solution optimization method in heterogeneous parallel systems of the present invention formulates a dynamic feedback load balancing optimization strategy to realize dynamic task allocation of heterogeneous parallel systems. It can quickly identify overloaded nodes according to the real-time system status, accurately split BSDF calculation subtasks and intelligently match idle computing units, significantly improving the collaborative efficiency of heterogeneous hardware resources and ensuring the stability of task throughput in large-scale ray tracing scenarios.
[0152] The LSTM-based ray depth tracing BSDF solution optimization method in the heterogeneous parallel system of the present invention realizes a BSDF-aware heterogeneous hardware adaptation mechanism. By mining the intrinsic material characteristic parameters of the BSDF calculation task, a mapping relationship between material characteristics and the computing characteristics of the hardware architecture is established. This differentiated hardware adaptation strategy based on the essence of physical characteristics can effectively give play to the architectural advantages of each computing unit and reduce the ray tracing time while maintaining rendering accuracy.
[0153] Obviously, the above embodiments are merely examples for clarity of explanation and are not intended to limit the implementation methods. Those skilled in the art will readily appreciate that other variations or modifications based on the above descriptions are possible. It is not necessary and impossible to enumerate all implementation methods here. Obvious variations or modifications arising therefrom remain within the scope of protection of the present invention.
Claims
1. A LSTM-based ray depth tracing BSDF solution optimization method in a heterogeneous parallel system, characterized by: The following steps are involved: Step 1: Divide the large-scale ray depth tracing task of solving BSDF into subtasks to be executed in parallel, quantify and analyze the complexity of the subtasks, and estimate the data volume; Step 2: Obtain the hardware parameters of each computing unit in the heterogeneous system, initially divide the basic units of the BSDF solution task, and collect historical data of historical BSDF solution tasks; Step 3: Monitor the load status of each computing unit in the BSDF solution task divided in step 1 in real time, and set the dynamic monitoring cycle according to the dynamic changes of the task; Step 4: Based on the historical data collected in Step 2, build an LSTM deep learning model to predict the load value of future BSDF calculation tasks; Step 5: Input the real-time load status information monitored in step 3 into the deep learning model trained in step 4 to evaluate and predict the load status. The system load status is determined by combining the model output and the load status of each computing unit. Step 6: When the system load imbalance is detected in step 5, a dynamic task adjustment strategy is formulated to migrate tasks to appropriate computing units with lower loads; Step 7: Repeat steps 3-6, continuously monitor the load status during the entire BSDF solution process, use the deep learning model to evaluate and predict the load and perform dynamic task adjustments, add new data to the historical dataset, and regularly retrain and optimize the deep learning model.
2. The LSTM-based ray depth tracing BSDF solution optimization method in a heterogeneous parallel system according to claim 1 is characterized in that: Step 1 is as follows: The BSDF solving task is divided into N subtasks according to the light propagation path, and each subtask corresponds to multiple surface interactions of a light ray; For each subtask, calculate its computational complexity and data volume; according to the BSDF microsurface model, quantify the computational complexity C of each subtask i : Where M represents the number of interactions between light and the object surface in the subtask; D(h k ): Normal distribution function, which represents the relationship between the normal direction and the half-angle vector h in the surface micro geometry k Probability density of uniform microsurfaces: Where h is the half-angle vector, α is the roughness parameter, and n is the macroscopic surface normal; G(h k ): Occlusion term, which describes the proportion of light that is blocked or obscured by surface unevenness and is used to correct energy loss on rough surfaces: Where l is the incident direction of the light; F(h k ): Fresnel term, which represents the reflection ratio of light at a specific incident angle: F(h)=F0+(1-F0)(1-(v·h)) 5 Where F0 is the base reflectivity and v is the sight direction; After quantifying the complexity of the subtasks, the data volume is estimated. The data volume of each subtask is D i Proportional to the number of interactions M between the light and the surface: D i =M·S data (S data =1KM / interaction) Where M is the number of interactions between the ray and the surface.
3. The LSTM-based ray depth tracing BSDF solution optimization method in a heterogeneous parallel system according to claim 1 is characterized in that: Step 2 is as follows: When a heterogeneous computing system is started, the hardware parameters of each computing unit in the system are obtained through the system API; including CPU parameters: main frequency, number of cores, cache capacity; GPU parameters: floating-point computing power, number of stream processors, and video memory bandwidth; Communication latency: Ping-Pong test is used to measure the data transmission latency between the CPU and GPU; hardware performance evaluation function: P CPU =f CPU ·C core ,P GPU =F GPU ·S SM Among them, f CPU is the CPU main frequency, C core is the number of cores, F GPU For GPU floating point performance, S SM is the number of stream processors; According to the characteristics of BSDF solving tasks, the light propagation path is used as the basic division unit for initial task allocation. The initial task allocation strategy for each path is: assign low-roughness paths to GPU batch processing; assign high-roughness paths to CPU single-thread processing; Before the system is run, the load data of historical BSDF solving tasks is collected, including the real-time utilization of CPU / GPU, the length of the task queue, the task execution time and the remaining computational load, to construct a historical data set.
4. The LSTM-based ray depth tracing BSDF solution optimization method in a heterogeneous parallel system according to claim 1, characterized in that: Step 3 is as follows: Real-time monitoring of the load status of each computing unit during the BSDF solution process: monitoring CPU usage, task queue length, and remaining computational load; monitoring GPU memory occupancy, stream processor utilization, communication latency, and load balancing factor β calculation: Among them, U CPU 、U GPU Represents the utilization of CPU and GPU respectively, Q CPU , Q GPU Represents the task queue lengths of the CPU and GPU, respectively, and is used to preliminarily measure the current load; F CPU 、F GPU Represents the peak performance FLOPS of CPU and GPU respectively; R CPU 、R GPU Represent the remaining computational load of the CPU and GPU respectively; Adjust the monitoring frequency according to the dynamic nature of the task: Set the monitoring period separately for static and dynamic scenarios.
5. The LSTM-based ray depth tracing BSDF solution optimization method in a heterogeneous parallel system according to claim 1, characterized in that: Step 4 is as follows: Build a deep learning model LSTM based on historical data to learn the intrinsic relationship between load data and the execution effect of BSDF solution tasks; The model architecture design consists of three layers: input layer, LSTM layer, and output layer. The input layer uses historical load data to capture load changes under different batches, time steps, and feature dimensions, providing rich input information for subsequent model learning. The output layer is a fully connected layer that outputs load forecast values for multiple cycles in the future; The loss function in the training process uses mean square error to measure the average square error between the predicted value and the true value, clarifying the direction of model optimization; the optimizer uses Adam; For training data, the historical data set is divided into a training set and a validation set. The historical data set is used to train and optimize the model and adjust the model parameters to improve the prediction accuracy of the model. LSTM unit calculation: f t =σ(W f ·[h t-1 ,x t ]+b f ) i t =σ(W i ·[h t-1 ,x t ]+b i ) the t =σ(W o ·[h t-1 ,x t ]+b o ) h t =o t ·tanh(C t ) Among them, f t 、i t 、o t They are respectively the forget gate, input gate, and output gate, C t is the cell state; the forget gate determines the t The input gate is used to control which new information is input into the cell state; the output gate is responsible for determining which information in the cell state will be output.
6. The LSTM-based ray depth tracing BSDF solution optimization method in a heterogeneous parallel system according to claim 1, characterized in that: Step 5 is as follows: Calculate the load imbalance Δ based on the prediction results: Among them, T CPU Indicates the comprehensive load index of the CPU, quantifying the current task pressure of the CPU; T GPU Indicates the comprehensive load index of the GPU and quantifies the current task pressure of the GPU; Among them, Q CPU , Q GPU Represents the task queue lengths of CPU and GPU respectively, C avg,CPU 、C avg,GPU Represents the average complexity of CPU and GPU processing a single subtask, H CPU 、H GPU Represents the cache hit rate of CPU and GPU respectively; U CPU 、U GPU Represents the resource utilization of CPU and GPU respectively; P CPU 、P GPU Represent the computing power of CPU and GPU respectively, which are normalized according to hardware parameters: P CPU =f CPU ·N core ,P GPU =F GPU ·N SM Among them, f CPU Indicates the CPU main frequency, N core Indicates the number of CPU cores, F GPU Indicates the floating-point performance of a single stream processor of the GPU, N SM Indicates the number of GPU stream processors; Combined with the prediction results of the model, a comprehensive evaluation is conducted on the load of each computing unit to determine whether there is any load imbalance in the system.
7. The LSTM-based ray depth tracing BSDF solution optimization method in a heterogeneous parallel system according to claim 1, characterized in that: Step 6 is as follows: When the system load is unbalanced, task allocation is dynamically adjusted according to the following strategies: Where α is the BSDF roughness parameter; β is the system load factor; T CPU Indicates the comprehensive load index of the CPU; T GPU Indicates the comprehensive load index of the GPU; By combining material characteristics and system real-time load status, the task migration strategy is dynamically adjusted to achieve load balancing of heterogeneous systems; the number of migration tasks N migrate With W adjust is proportional to the degree of deviation: N migrate =k·|W adjust -W threshold | Where k is the migration coefficient, which is used to control the migration amplitude.
8. The LSTM-based ray depth tracing BSDF solution optimization method in a heterogeneous parallel system according to claim 1, characterized in that: Step 7 is as follows: During the entire BSDF solution process, the system load is continuously monitored. Steps 3-6 are repeated every cycle. The deep learning model LSTM is used to evaluate and predict the load of each computing unit, and the BSDF calculation task allocation is adjusted in real time to dynamically optimize the load distribution. The loss function is updated when the model is retrained: THE new =λL old +(1-λ)L current Among them, λ is the weight of historical data, L old is the historical loss, which represents the load data collected in the past training cycles to prevent the model from being over-adjusted due to short-term data fluctuations and maintain long-term stability; L current is the current loss, which represents the latest monitored load data and is used to capture the latest state changes of the system, ensuring that the model adapts to dynamic scenarios and avoids prediction lag; L new It is a comprehensive loss, which represents the weighted fusion of new and old losses, balancing long-term memory and short-term adaptation.
9. The LSTM-based ray depth tracing BSDF solution optimization method in a heterogeneous parallel system according to claim 1, characterized in that: Step 4 is as follows: Based on the historical data collected in step 2, a Transformer time series prediction model is constructed to predict the load value of future BSDF calculation tasks: The global temporal correlation of historical load data is modeled through a multi-head attention mechanism, and the temporal order information of load fluctuations is retained in combination with position encoding. An Encoder-Decoder structure is used for multi-period load prediction: the Encoder layer uses a sliding window to extract the time series features of the CPU / GPU memory occupancy rate and task queue backlog of the computing unit, and the Decoder layer generates future load prediction values step by step based on an autoregressive mechanism.
10. The LSTM-based ray depth tracing BSDF solution optimization method in a heterogeneous parallel system according to claim 1, characterized in that: Step 6 is as follows: when step 5 detects that the system load is unbalanced, a Markov decision process model is constructed, with the states of the heterogeneous computing units as the state space, the task migration action as the behavior space, and the system-level energy efficiency ratio as the reward function; the PPO algorithm is used to update the policy network online and dynamically adjust the allocation weights of the BSDF calculation tasks.
Citation Information
Patent Citations
Building energy consumption prediction method and system based on improved LSTM
CN114742278A
Load-aware scheduling method based on deep learning
CN119065835A
Multi-base inventory optimization method and system based on deep learning
CN120181741A
Graph fusion system for embedding disparate domain data
US20250014748A1
Log anomaly detection system
WO2022047658A1