An optimization method for solving BSDF based on LSTM under a heterogeneous parallel system
By using an LSTM deep learning model to monitor the load status in real time and dynamically adjust task allocation in a heterogeneous parallel system, the problems of load imbalance and resource waste in heterogeneous systems are solved, achieving efficient BSDF solution and improving computational efficiency and scenario adaptability.
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- CHANGCHUN INST OF OPTICS FINE MECHANICS & PHYSICS CHINESE ACAD OF SCI
- Filing Date
- 2025-07-03
- Publication Date
- 2026-04-24
AI Technical Summary
Heterogeneous parallel systems struggle to achieve dynamic load balancing in BSDF solving, exhibit poor scenario adaptability, and suffer from structural waste in resource scheduling mechanisms, resulting in low computational efficiency.
A deep learning model based on LSTM is used to monitor the load status in real time. By constructing an LSTM deep learning model to predict future load trends, the task allocation is dynamically adjusted to achieve load balancing.
It significantly improves the adaptability and computational efficiency of heterogeneous systems, ensures the stability of task throughput in large-scale ray tracing scenarios, and reduces ray tracing time.
Smart Images

Figure CN120688367B_ABST
Abstract
Description
Technical Field
[0001] This invention relates to the field of computer graphics technology, and in particular to an optimization method for solving BSDF based ray tracing in heterogeneous parallel systems using LSTM. Background Technology
[0002] Two-way scattering distribution function (BSDF) is a mathematical model describing the interaction between light and materials. It can accurately simulate the reflection and transmission behavior of different material surfaces and is widely used in computer graphics, especially in high-quality rendering, where it can realistically present the optical properties of complex materials and enhance the realism of visual effects. However, BSDF also has certain computational bottlenecks in solving large-scale light propagation: each interaction between light and surface requires multiple sampling and complex calculations based on the BSDF model, such as the joint solution of normal distribution, occlusion effect, and Fresnel reflection in micro-surface models. These calculations not only involve the integration and sampling of high-dimensional probability distributions but also need to strictly follow physical constraints such as energy conservation, leading to an exponential increase in the computational cost of a single light path. In dynamic scenes, the real-time update of light paths further exacerbates the computational pressure. Traditional computing architectures struggle to cope with such high concurrency and high complexity, often resulting in rendering delays or resource contention. For example, the calculation of multiple scattering on high-roughness surfaces requires a large amount of parallel processing power, while the accurate solution of specular reflection relies on intricate logical branches, making it difficult for a single computing unit to balance efficiency and accuracy.
[0003] To overcome this bottleneck, the introduction of heterogeneous parallel systems becomes crucial. By collaboratively utilizing the serial logic processing capabilities of the CPU (Central Processing Unit) and the massively parallel computing advantages of the GPU (Graphics Processing Unit), the system can batch-distribute 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 caustic paths or multi-layer transmission). However, the performance of heterogeneous systems is highly dependent on the rationality of task allocation. If task allocation is rigid, it may lead to GPU saturation in simple tasks and CPU blockage in complex tasks, or vice versa. Therefore, dynamic load balancing strategies are indispensable. By monitoring the load status of each computing unit in real time and combining it with real-time complexity assessment of ray paths, this method can intelligently adjust task allocation, such as migrating some high-concurrency tasks when the GPU is idle, or distributing the computational pressure to other nodes when the CPU is overloaded. This strategy not only maximizes the utilization of hardware resources but also significantly improves rendering efficiency, enabling real-time interaction in complex scenes and providing a scalable solution for the application of BSDF in large-scale ray tracing.
[0004] Therefore, in solving large-scale ray depth tracing based on the bidirectional scattering distribution function (BSDF) in heterogeneous parallel systems, existing technologies suffer from the following key problems: First, heterogeneous systems struggle to achieve dynamic load balancing. Traditional static allocation strategies fail to consider the real-time dynamic characteristics of BSDF surface interactions (such as continuous changes in the micro-roughness coefficient α and multi-dimensional 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 patterns (such as dividing computational units with a single roughness threshold α = 0.3) cannot respond to complex scenarios such as dynamic changes in material properties (such as surface oxidation processes in real-time rendering) and abrupt changes in optical characteristics (such as caustic path generation and light energy attenuation in high-roughness media), resulting in high computational time consumption for high-dynamic BSDF computation methods. Finally, resource scheduling mechanisms suffer from structural waste. Task-level optimization strategies are not established for heterogeneous hardware characteristics (CPU multi-core parallelism / GPU large-scale thread concurrency), especially neglecting data dependencies between ray paths during cross-platform task migration, leading to idle and wasted computational resources. Summary of the Invention
[0005] This invention aims to address the technical problems in existing technologies, such as the difficulty in achieving dynamic load balancing in heterogeneous systems, poor scene adaptability leading to low computational efficiency, and structural waste in resource scheduling mechanisms. It provides an optimization method for solving BSDF based on LSTM in heterogeneous parallel systems.
[0006] To solve the above-mentioned technical problems, the technical solution of the present invention is as follows:
[0007] An optimization method for solving BSDF (Browser-Based Depth Tracing) based on LSTM in a heterogeneous parallel system includes the following steps:
[0008] Step 1: Divide the BSDF solution of large-scale ray depth tracing task into parallel subtasks, quantify the complexity of the subtasks and estimate the amount of data;
[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 the historical BSDF solution task;
[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, construct an LSTM deep learning model to predict the load value of future BSDF computing 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, and judge the system load status by combining the model output and the load status of each computing unit.
[0013] Step 6: When step 5 detects an imbalance in system load, formulate a dynamic task adjustment strategy to migrate tasks to suitable computing units with lower loads.
[0014] Step 7: Repeat steps 3-6, continuously monitor the load status throughout the BSDF solution process, use a deep learning model to assess and predict the load and make dynamic task adjustments, add new data to the historical dataset, and periodically retrain and optimize the deep learning model.
[0015] In the above technical solution, step 1 specifically includes:
[0016] The BSDF solving task is divided into N subtasks according to the ray propagation path, and each subtask corresponds to multiple surface interactions of a ray.
[0017] For each subtask, calculate its computational complexity and data volume; based on the micro-surface model of BSDF, quantify the computational complexity C of each subtask. i :
[0018]
[0019] Where M represents the number of interactions between the light and the object surface in the subtask;
[0020] D(h k ): Normal distribution function, representing the relationship between the normal direction and the half-angle vector h in the surface micro-geometry. k Consistent probability density of microsurfaces:
[0021]
[0022] Where h is a half-angle vector, α is the roughness parameter, and n is the macroscopic surface normal;
[0023] G(h k ): Occlusion term, describes the proportion of light that is blocked or obstructed due to surface unevenness, used to correct for energy loss on rough surfaces:
[0024]
[0025] Where l is the direction of light incidence;
[0026] F(h k Fresnel term: Represents the proportion of light reflected at a specific angle of incidence.
[0027] F(h)=F0+(1-F0)(1-(v·h)) 5
[0028] Where F0 is the base reflectivity and v is the line of sight direction;
[0029] After quantifying the complexity of subtasks, the data volume is estimated, with the data volume D for each subtask. i It is proportional to the number of interactions M between light and the surface:
[0030] D i =M·S data (S data =1KM / interaction)
[0031] Where M is the number of interactions between the light and the surface.
[0032] In the above technical solution, step 2 specifically includes:
[0033] When the heterogeneous computing system starts up, the hardware parameters of each computing unit in the system are obtained through the system API, including CPU parameters: clock speed, number of cores, cache capacity; GPU parameters: floating-point operation capability, number of stream processors, memory bandwidth; communication latency: data transfer latency between the CPU and GPU is measured through Ping-Pong testing; hardware performance evaluation functions:
[0034] P CPU =f CPU ·C core ,P GPU =F GPU ·S SM
[0035] Among them, f CPU For CPU clock speed, C core For the core number, F GPU For GPU floating-point performance, S SM This represents the number of stream processors.
[0036] Based on the characteristics of the BSDF solving task, the initial task allocation strategy for each path is as follows: low roughness paths are assigned to GPU batch processing; high roughness paths are assigned to CPU single-thread processing.
[0037] Before the system runs, collect load data of historical BSDF solving tasks, including real-time CPU / GPU utilization, task queue length, task execution time and remaining computation, and build a historical dataset.
[0038] In the above technical solution, step 3 specifically includes:
[0039] Real-time monitoring of the load status of each computational unit during the BSDF solution process: monitoring CPU utilization, task queue length, and remaining computational load; monitoring GPU memory usage, stream processor utilization, and communication latency; and calculating the load balancing factor β.
[0040]
[0041] Among them, U CPU U GPU Q represents the utilization of the CPU and GPU, respectively. CPU Q GPU These represent the task queue lengths for the CPU and GPU, respectively, used to initially measure the current load; F CPU F GPU R represents the peak performance (FLOPS) of the CPU and GPU, respectively; CPU R GPU These represent the remaining computing power of the CPU and GPU, respectively.
[0042] Adjust the monitoring frequency according to the dynamic nature of the task: Set monitoring cycles for static and dynamic scenarios respectively.
[0043] In the above technical solution, step 4 specifically includes:
[0044] A deep learning model LSTM is built based on historical data to learn the intrinsic relationship between workload data and the performance of BSDF solution tasks.
[0045] The model architecture consists of three layers: an input layer, an LSTM layer, and an output layer. In the input layer, the input is historical load data, which captures the 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 predictions for multiple future periods.
[0046] The training process uses mean squared error as the loss function, which measures the average squared error between the predicted and the true values and clarifies the direction of model optimization; the optimizer used is Adam.
[0047] For training data, the historical dataset is divided into training and validation sets. The historical dataset is used to train and optimize the model, and the model parameters are adjusted to improve the model's prediction accuracy.
[0048] LSTM cell computation:
[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 These are the forget gate, input gate, and output gate, respectively. (C) t For cell state; the forgetting gate determines the state from cell state C. t The input gate controls which new information is input into the cell state; the output gate determines which information in the cell state will be output.
[0055] In the above technical solution, step 5 specifically includes:
[0056] Calculate the load imbalance Δ based on the prediction results:
[0057]
[0058] Among them, T CPU This represents the overall CPU load metric, quantifying the current task pressure on the CPU; T GPU This represents the overall load metric of the GPU, quantifying the current task pressure on the GPU;
[0059]
[0060] Among them, Q CPU Q GPU C represents the task queue lengths of the CPU and GPU, respectively. avg,CPU C avg,GPU H represents the average complexity of CPU and GPU processing a single subtask, respectively. CPU H GPU These represent the cache hit rates of the CPU and GPU, respectively; U CPU U GPU These represent the resource utilization rates of the CPU and GPU, respectively; P CPU PGPU These represent the computing power of the CPU and GPU, respectively, obtained by normalizing the hardware parameters:
[0061] P CPU =f CPU ·N core ,P GPU =F GPU ·N SM
[0062] Among them, f CPU N represents the CPU clock speed. core F represents the number of CPU cores. GPU N represents the floating-point performance of a single stream processor in a GPU. SM Indicates the number of GPU stream processors;
[0063] Based on the model's prediction results, a comprehensive evaluation of the load on each computing unit is conducted to determine whether there is a load imbalance in the system.
[0064] In the above technical solution, step 6 specifically includes:
[0065] When the system load is unbalanced, task allocation will be dynamically adjusted according to the following strategy:
[0066]
[0067] Where α is the BSDF roughness parameter; β is the system load factor; T CPU This represents the overall load metric for the CPU; T GPU This indicates the overall load metric for the GPU;
[0068] By combining material properties and real-time system load status, the task migration strategy is dynamically adjusted to achieve load balancing of heterogeneous systems; the number of migration tasks is N. migrate With W adjust The degree of deviation is directly proportional:
[0069] N migrate =k·|W adjust -W threshold |
[0070] Where k is the migration coefficient, used to control the migration amplitude.
[0071] In the above technical solution, step 7 specifically includes:
[0072] Throughout the BSDF solution process, the system load is continuously monitored. Steps 3-6 are repeated at each cycle time. The load of each computing unit is evaluated and predicted using the deep learning model LSTM. The BSDF computing task allocation is adjusted in real time to dynamically optimize the load allocation.
[0073] Loss function update during model retraining:
[0074] L new =λL old +(1-λ)L current
[0075] Where λ is the weight of historical data, L old Historical loss represents the load data collected in past training cycles, used to prevent the model from over-adjusting due to short-term data fluctuations and maintain long-term stability; L current The current loss represents the most recently monitored load data, used to capture the latest changes in the system's state, ensuring the model adapts to dynamic scenarios and avoiding prediction lag; L new It is a comprehensive loss, which represents a weighted fusion of old and new losses, balancing long-term memory and short-term adaptation.
[0076] In the above technical solution, step 4 specifically involves: based on the historical data collected in step 2, constructing a Transformer time-series prediction model to predict the load value of future BSDF computing tasks.
[0077] The global temporal correlation of historical load data is modeled by a multi-head attention mechanism, and the temporal sequence information of load fluctuations is preserved by combining positional 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 CPU / GPU memory usage and task queue backlog of computing units, 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 specifically involves: when an imbalance in system load is detected in step 5, a Markov decision process model is constructed, with the state of the heterogeneous computing unit 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 weight of the BSDF computing tasks.
[0079] The present invention has the following beneficial effects:
[0080] This invention presents an LSTM-based optimization method for solving BSDF (Browser-Based Depth Tracing) tasks in heterogeneous parallel systems. By constructing an LSTM deep learning model to predict future load trends and modeling temporal relationships using an LSTM network trained on historical load data, it accurately captures the long-term dependencies of load changes, thereby achieving proactive scheduling of ray tracing tasks. Compared to traditional static resource allocation methods, this method can predict the load bottlenecks of computing units in advance, dynamically adjust the allocation decisions for BSDF tasks, avoid resource contention caused by monitoring lag, and significantly improve the adaptability and computational efficiency of heterogeneous systems.
[0081] The present invention provides an optimization method for solving BSDF based on LSTM in heterogeneous parallel systems. It formulates a dynamic feedback load balancing optimization strategy to realize dynamic task allocation in heterogeneous parallel systems. It can quickly identify overloaded nodes based on 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 present invention provides an optimization method for solving BSDF based ray depth tracing in a heterogeneous parallel system using LSTM. This method achieves a BSDF-aware heterogeneous hardware adaptation mechanism. By mining the inherent material characteristic parameters of the BSDF computation task, a mapping relationship between material features and the computational characteristics of the hardware architecture is established. This differentiated hardware adaptation strategy based on the essence of physical characteristics can effectively leverage the architectural advantages of each computing unit and reduce ray tracing time while maintaining rendering accuracy. Attached Figure Description
[0083] The present invention will now be described in further detail with reference to the accompanying drawings and specific embodiments.
[0084] Figure 1 This is a schematic diagram illustrating the steps of the LSTM-based BSDF solution optimization method for heterogeneous parallel systems according to the present invention.
[0085] Figure 2 This is a schematic diagram of a large-scale light propagation process. Detailed Implementation
[0086] The inventive concept of this invention is as follows: The LSTM-based BSDF solution optimization method for heterogeneous parallel systems establishes an atomic task partitioning mechanism based on ray path independence during the ray depth tracing process, decoupling the massive ray tracing process into parallelizable sub-task units; it integrates real-time BSDF feature analysis (including scattering energy distribution and path complexity prediction) with heterogeneous hardware performance to construct a lightweight deep learning model that achieves dynamic load awareness; and it develops a priority scheduling engine and adaptive migration strategy to dynamically reallocate GPU memory-resident tasks and CPU multi-core batch processing tasks while ensuring data locality, thereby improving the utilization of heterogeneous computing resources and optimizing computational efficiency in large-scale ray tracing scenarios.
[0087] The present invention will now be described in detail with reference to the accompanying drawings.
[0088] The present invention provides an optimization method for solving BSDF-based ray depth tracing tasks in heterogeneous parallel systems using LSTM. This method divides large-scale BSDF-based ray tracing tasks into parallel subtasks, 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 the computing units, thereby dynamically allocating tasks and achieving load balancing for solving large-scale BSDF-based ray tracing tasks in heterogeneous parallel systems.
[0089] like Figure 1 As shown, the method of the present invention includes the following steps:
[0090] Step 1: Divide the BSDF solution of large-scale ray depth tracing task into parallel subtasks, quantify the complexity of the subtasks and estimate the amount of data;
[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 the historical BSDF solution task;
[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, construct an LSTM deep learning model to predict the load value of future BSDF computing 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, and judge the system load status by combining the model output and the load status of each computing unit.
[0095] Step 6: When step 5 detects an imbalance in system load, formulate a dynamic task adjustment strategy to migrate tasks to suitable computing units with lower loads.
[0096] Step 7: Repeat steps 3-6, continuously monitor the load status throughout the BSDF solution process, use a deep learning model to assess and predict the load and make dynamic task adjustments, add new data to the historical dataset, and periodically retrain and optimize the deep learning model.
[0097] In step 1 of this invention, the BSDF solving task is divided into N sub-tasks according to the light propagation path, and each sub-task corresponds to multiple surface interactions of a single light ray. For example... Figure 2As shown, {R1,R2,R3,...} constitutes a large-scale ray set. For the ray depth tracing process, the path tracing process of each ray is abstracted into an independent sub-task unit. For example, ray R1 will successively interact with surfaces {S1,S2,S3,...} in the scene during its propagation path. At each interaction, based on the physical simulation of material reflection characteristics and incident direction, its subsequent propagation path is solved using BSDF. For each sub-task, its computational complexity and data volume are calculated. Based on the micro-surface model of BSDF, the computational complexity C of each sub-task is quantitatively calculated. i :
[0098]
[0099] Where M represents the number of interactions between the light and the object surface in the subtask;
[0100] D(h k ): Normal distribution function, representing 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] Where h is a half-angle vector (the vector between the incident direction l and the viewing direction v), α is a roughness parameter (0 for smooth, 1 for completely rough), and n is the macroscopic surface normal.
[0103] G(h k ): The shading term describes the proportion of light rays that are blocked or obstructed due to surface unevenness. It is used to correct for energy loss on rough surfaces and ensure energy conservation. For smooth surfaces, the shading effect is negligible (G≈1), while for rough surfaces, some light rays are blocked (G<1), especially at grazing angles (where the light ray is close to parallel to the surface).
[0104]
[0105] Where l is the direction of light incidence.
[0106] F(h k Fresnel term: Reflectance represents the proportion of light reflected at a specific angle of incidence. It is lowest at perpendicular incidence and approaches 100% at grazing angles.
[0107] F(h)=F0+(1-F0)(1-(v·h)) 5
[0108] Wherein, F0 is the basic reflectivity (a material property characteristic; metals have high F0, and non-metals have low F0), and v is the viewing direction.
[0109] Subtask complexity C i It is the cumulative effect of multiple interactions between light and a surface. D·G·F integrates the influence of microscopic geometric distribution (D), energy shielding (G), and angular reflection (F), accurately describing the intensity of the interaction between light and material. For smooth materials, it has low complexity (C). i Small), while for rough materials, high complexity (C) i (Large). After quantifying the complexity of subtasks, the data volume is estimated, with the data volume D for each subtask. i It is proportional to the number of interactions M between light and the surface:
[0110] D i =M·S data (S data =1KM / interaction)
[0111] Where M is the number of interactions between the light and the surface.
[0112] In step 2 of this invention, the hardware parameters of each computing unit (such as CPU cores, GPU stream processors, etc.) in the system (such as CPU cores, GPU stream processors, etc.) are first obtained through the system API when the heterogeneous computing system (such as CPU-GPU architecture) starts up. These parameters include CPU parameters: clock speed (e.g., 3.5GHz), number of cores (e.g., 8 cores), cache capacity (e.g., 32MB); GPU parameters: floating-point operation capability (e.g., 10TFLOPS), number of stream processors (e.g., 4096), and memory bandwidth (e.g., 512GB / s); and communication latency: the data transfer latency between the CPU and GPU is measured using a Ping-Pong test (e.g., 0.1ms). Hardware performance evaluation function:
[0113] P CPU =f CPU ·C core ,P GPU =F GPU ·S SM
[0114] Among them, f CPU For CPU clock speed, C core For the core number, F GPU For GPU floating-point performance, S SM This represents the number of stream processors.
[0115] Meanwhile, based on the characteristics of the BSDF solution task, the initial task allocation strategy for each path is as follows: low roughness paths (α<0.3) are allocated to GPU batch processing; high roughness paths (α≥0.3) are allocated to CPU single-thread processing.
[0116] Before the system runs, collect the load data of historical BSDF solving tasks, including the real-time utilization of CPU / GPU (e.g., CPU utilization 70%, GPU memory utilization 80%); task queue length (e.g., CPU queue 20 tasks, GPU queue 100 tasks); task execution time and remaining computation (e.g., subtask 1 takes 50ms, remaining computation 30%), and construct a historical dataset.
[0117] In step 3 of this invention, the load status of each computing unit during the BSDF solution process is monitored in real time: CPU utilization (%), task queue length, and remaining computational load (%) are monitored; GPU memory utilization (%), stream processor utilization (%), and communication latency (ms) are monitored; and the load balancing factor β is calculated.
[0118]
[0119] Among them, U CPU U GPU Q represents the utilization of the CPU and GPU, respectively. CPU Q GPU These represent the task queue lengths for the CPU and GPU, respectively, used to initially measure the current load; F CPU F GPU These represent 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 between computing units, conforming to the principle of heterogeneous computing resource allocation; R CPU R GPU These represent the remaining computing power of the CPU and GPU, respectively.
[0120] The monitoring frequency is adjusted according to the dynamic nature of the task: for static scenes, the monitoring cycle is set to 200ms; while for dynamic scenes (such as real-time rendering), the monitoring cycle is shortened to 50ms. Real-time data is obtained through the perf or OpenMP interface for CPU monitoring, and NVML (NVIDIA Management Library) or CUDA event logging is used for GPU monitoring.
[0121] In step 4 of this invention, a deep learning model LSTM is constructed based on historical data to learn the intrinsic relationship between the load data and the performance of the BSDF solution task.
[0122] The model architecture design consists of three layers: an input layer, where the input is historical load data (CPU utilization, GPU memory usage, etc., in batches). size ,time stepsThe first layer (features) captures load variations across different batches, time steps, and feature dimensions, providing rich input information for subsequent model learning. The second layer (LSTM) consists of three stacked layers, each with 128 neurons and an activation function of tanh. This multi-layer stacking enhances the model's ability to capture long-distance dependencies in sequence data. Through the nonlinear transformation of a large number of neurons, it can extract latent features from the load data in a more complex way, thereby better learning the relationship between load data and task performance. The third layer (output layer) is designed as a fully connected layer, outputting the load prediction values for the next 10 cycles.
[0123] The mean squared error (MSE) loss function is used during training to measure the average squared error between predicted and true values, thus clarifying the direction of model optimization. The optimizer used is Adam (initial learning rate 0.001), which automatically adjusts the learning rate during training to accelerate model convergence. For training data, the historical dataset is divided into an 80% training set and a 20% validation set. The historical dataset is used to train and optimize the model, adjusting model parameters (such as the weights and biases of the LSTM layer) to improve prediction accuracy. LSTM unit computation:
[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 These are the forget gate, input gate, and output gate, respectively. (C) t The cell state is determined by the forgetting gate. tThe LSTM cell determines which information is forgotten during processing; the input gate controls which new information is input into the cell state; and the output gate determines which information from the cell state will be output. Through the dynamic adjustment of these three gates, the LSTM cell can effectively handle long-term dependencies in sequence data and better capture the changing trends and inherent patterns of the load data over time.
[0130] In step 5 of this 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 fed 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 prediction results.
[0131]
[0132] Among them, T CPU This represents the overall CPU load metric, quantifying the current task pressure on the CPU. (T) GPU This represents the overall load metric of the GPU, quantifying the current task pressure on 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 C represents the task queue length (i.e., the number of tasks to be processed) of the CPU and GPU, respectively. avg,CPU C avg,GPU These represent the average complexity of the CPU and GPU processing a single subtask, respectively (derived from C in step 1). i (Calculated); H CPU H GPU These represent the cache hit rates of the CPU and GPU, respectively. The larger the value, the longer the actual processing time of the task; U CPU U GPU P represents the resource utilization of CPU and GPU, respectively, where (1-U) is the proportion of remaining available resources; CPU P GPU These represent the computing power of the CPU and GPU, respectively, obtained by normalizing the hardware parameters:
[0135] P CPU =f CPU ·N core ,P GPU =F GPU ·N SM
[0136] Among them, f CPU N represents the CPU clock speed. core F represents the number of CPU cores. GPU N represents the floating-point performance of a single stream processor in a GPU. SM This indicates the number of GPU stream processors.
[0137] Based on the model's prediction results, the load of each computing unit is comprehensively evaluated to determine whether there is a load imbalance in the system: if Δ>0.3, it is determined to be a load imbalance, and task migration needs to be triggered to improve overall efficiency.
[0138] In step 6 of this invention, based on the system load imbalance Δ obtained in step 5, when the system load is unbalanced, the task allocation is dynamically adjusted according to the following strategy:
[0139]
[0140] Where α is the BSDF roughness parameter, the larger the α is, the greater the roughness, the higher the BSDF computational complexity, and the more computational resources are required; β is the system load factor calculated in step 3, β>1 indicates a heavy CPU load, and vice versa, it indicates a heavy GPU load.
[0141] For tasks with high coarsness (α->1), there is a tendency to rely on the computing power of the GPU (because the GPU is good at parallel processing of highly complex tasks); for tasks with high CPU load (β->∞), there is a tendency to migrate the task to the GPU to reduce CPU pressure.
[0142] By combining material properties (BSDF roughness α) and the real-time load state of the system (β, T) CPU T GPU Dynamically adjust task migration strategies to achieve load balancing across heterogeneous systems. adjust A higher W indicates that the current task characteristics (high roughness) or system state (CPU overload) require GPU intervention, meaning that the current system load and material characteristics are more inclined to allocate tasks to the GPU; conversely, a lower W indicates a lower W. adjust The lower the value, the more tasks should be allocated to the CPU. Set the threshold W based on experience or system performance. threshold If W adjust >W threshold If the CPU task is not critically dependent on the GPU, then some CPU tasks will be migrated to the GPU, prioritizing subtasks with low data dependencies (such as independent ray paths); conversely, if the GPU task is not critically dependent on the CPU, then some GPU tasks will be migrated to the CPU. The number of tasks to be migrated is N. migrate With W adjust The degree of deviation is directly proportional:
[0143] Nmigrate =k·|W adjust -W threshold |
[0144] Where k is the migration coefficient, used to control the migration amplitude.
[0145] In step 7 of this invention, the system load is continuously monitored throughout the BSDF solution process. Steps 3-6 are repeated at regular intervals, and the LSTM deep learning model is used to evaluate and predict the load of each computing unit, adjusting the BSDF computation task allocation in real time and dynamically optimizing the load distribution. Simultaneously, after every 10 tasks, the newly generated load data for each computing unit and the execution results of the BSDF solution tasks are added to the historical dataset, and the LSTM model is retrained to adapt to constantly changing task and system environments, improving prediction accuracy. An LRU (Least Recently Used) strategy is used to evict outdated cached data to ensure data validity. The loss function is updated during model retraining.
[0146] L new =λL old +(1-λ)L current
[0147] Where λ is the weight of historical data, L old Historical loss represents the load data (such as CPU / GPU utilization, task queue length) collected in past training cycles. This prevents the model from over-adjusting due to short-term data fluctuations (such as instantaneous load peaks) and maintains long-term stability. current This is the current loss, representing the most recently monitored load data (such as real-time metrics from the last 10 task cycles). It is used to capture the latest changes in the system's state (such as the addition of highly complex materials or hardware performance fluctuations) to ensure the model adapts to dynamic scenarios and avoids prediction lag. new λ represents the 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, if λ is small, the model focuses more on new data and is suitable for rapidly changing dynamic environments.
[0148] In other specific implementations, the Transformer time-series prediction model can be used instead of the LSTM deep learning architecture in the load prediction module. A multi-head attention mechanism is used to model the global temporal correlation of historical load data, and positional encoding is combined to preserve the temporal order information of load fluctuations. An Encoder-Decoder structure is used for multi-period load prediction: the Encoder layer uses a sliding window to extract time-series features such as CPU / GPU memory usage and task queue backlog of the computing units, while the Decoder layer generates future load prediction values step by step based on an autoregressive mechanism. Compared with LSTM, Transformer has the advantage of parallel computing in long sequence modeling, but a dynamic sparse attention mechanism is needed to control computational complexity.
[0149] In other specific implementations, an adaptive partitioning algorithm based on reinforcement learning can be introduced to replace the current priority queue mechanism in the dynamic task allocation strategy. By constructing a Markov decision process model, the states of heterogeneous computing units (core utilization, cache hit rate, power consumption) are used as the state space, task transition actions as the behavior space, and system-level energy efficiency ratio (task completion rate per unit power consumption) is used as the reward function. The PPO (Proximal Policy Optimization) algorithm is used to update the policy network online, dynamically adjusting the allocation weights of BSDF computing tasks. Compared to the heuristic rules of the original scheme, this method can autonomously mine the implicit correlation features of hardware resources, but there will be a delay in real-time decision-making.
[0150] This invention presents an LSTM-based optimization method for solving BSDF (Browser-Based Depth Tracing) tasks in heterogeneous parallel systems. By constructing an LSTM deep learning model to predict future load trends and modeling temporal relationships using an LSTM network trained on historical load data, it accurately captures the long-term dependencies of load changes, thereby achieving proactive scheduling of ray tracing tasks. Compared to traditional static resource allocation methods, this method can predict the load bottlenecks of computing units in advance, dynamically adjust the allocation decisions for BSDF tasks, avoid resource contention caused by monitoring lag, and significantly improve the adaptability and computational efficiency of heterogeneous systems.
[0151] The present invention provides an optimization method for solving BSDF based on LSTM in heterogeneous parallel systems. It formulates a dynamic feedback load balancing optimization strategy to realize dynamic task allocation in heterogeneous parallel systems. It can quickly identify overloaded nodes based on 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 present invention provides an optimization method for solving BSDF based ray depth tracing in a heterogeneous parallel system using LSTM. This method achieves a BSDF-aware heterogeneous hardware adaptation mechanism. By mining the inherent material characteristic parameters of the BSDF computation task, a mapping relationship between material features and the computational characteristics of the hardware architecture is established. This differentiated hardware adaptation strategy based on the essence of physical characteristics can effectively leverage the architectural advantages of each computing unit and reduce ray tracing time while maintaining rendering accuracy.
[0153] Obviously, the above embodiments are merely illustrative examples for clear explanation and are not intended to limit the implementation. Those skilled in the art will recognize that other variations or modifications can be made based on the above description. It is neither necessary nor possible to exhaustively list all possible implementations here. However, obvious variations or modifications derived therefrom are still within the scope of protection of this invention.
Claims
1. An optimization method for solving BSDF (Browser-Based Depth Tracing) based on LSTM in heterogeneous parallel systems, characterized in that, Includes the following steps: Step 1: Divide the BSDF solution of large-scale ray depth tracing task into parallel subtasks, quantify the complexity of the subtasks and estimate the amount of data; 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 the historical BSDF solution task; 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, construct an LSTM deep learning model to predict the load value of future BSDF computing tasks; Step 4 is as follows: A deep learning model LSTM is built based on historical data to learn the intrinsic relationship between workload data and the performance of BSDF solution tasks. The model architecture design consists of three layers: an input layer, an LSTM layer, and an output layer. In the input layer, the input is historical load data, which captures the 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 predictions for multiple future cycles. The training process uses mean squared error as the loss function, which measures the average squared error between the predicted and the true values and clarifies the direction of model optimization; the optimizer used is Adam. For training data, the historical dataset is divided into training and validation sets. The historical dataset is used to train and optimize the model, and the model parameters are adjusted to improve the model's prediction accuracy. LSTM cell computation: Among them, f t i t o t These are the forget gate, input gate, and output gate, respectively. (C) t For cell state; the forgetting gate determines the state from cell state C. t The input gate controls which new information is input into the cell state; the output gate determines which information from the cell state will be output. 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, and judge the system load status by combining the model output and the load status of each computing unit. Step 6: When step 5 detects an imbalance in system load, formulate a dynamic task adjustment strategy to migrate tasks to suitable computing units with lower loads. Step 7: Repeat steps 3-6, continuously monitor the load status throughout the BSDF solution process, use a deep learning model to assess and predict the load and make dynamic task adjustments, add new data to the historical dataset, and periodically retrain and optimize the deep learning model.
2. The LSTM-based BSDF solution optimization method for heterogeneous parallel systems according to claim 1, characterized in that, Step 1 is as follows: The BSDF solving task is divided into N subtasks according to the ray propagation path, and each subtask corresponds to multiple surface interactions of a ray. For each subtask, calculate its computational complexity and data volume; based on the micro-surface model of BSDF, quantify the computational complexity C of each subtask. i : Where M represents the number of interactions between the light and the object surface in the subtask; D(h k ): Normal distribution function, representing the relationship between the normal direction and the half-angle vector h in the surface micro-geometry. k Consistent probability density of microsurfaces: Where h is a half-angle vector, α is the roughness parameter, and n is the macroscopic surface normal; G(h k ): Occlusion term, describes the proportion of light that is blocked or obstructed due to surface unevenness, used to correct for energy loss on rough surfaces: Where l is the direction of light incidence; F(h k Fresnel term: Represents the proportion of light reflected at a specific angle of incidence. Where F0 is the base reflectivity and v is the line of sight direction; After quantifying the complexity of subtasks, the data volume is estimated, with the data volume D for each subtask. i It is proportional to the number of interactions M between light and the surface: Where M is the number of interactions between the light and the surface.
3. The optimization method for solving BSDF based LSTM in heterogeneous parallel systems according to claim 1, characterized in that, Step 2 is as follows: When the heterogeneous computing system starts up, the hardware parameters of each computing unit in the system are obtained through the system API, including CPU parameters: clock speed, number of cores, cache capacity; GPU parameters: floating-point operation capability, number of stream processors, memory bandwidth; communication latency: data transfer latency between the CPU and GPU is measured through Ping-Pong testing; hardware performance evaluation functions: Among them, f CPU For CPU clock speed, C core For the core number, F GPU For GPU floating-point performance, S SM This refers to the number of stream processors. Based on the characteristics of the BSDF solving task, the ray propagation path is used as the basic unit of division. The initial task allocation strategy for each path is as follows: low roughness paths are assigned to GPU batch processing; high roughness paths are assigned to CPU single-thread processing. Before the system runs, collect load data of historical BSDF solving tasks, including real-time CPU / GPU utilization, task queue length, task execution time and remaining computation, and build a historical dataset.
4. The LSTM-based BSDF solution optimization method for heterogeneous parallel systems according to claim 1, characterized in that, Step 3 specifically involves: Real-time monitoring of the load status of each computational unit during the BSDF solution process: monitoring CPU utilization, task queue length, and remaining computational load; monitoring GPU memory usage, stream processor utilization, and communication latency; and calculating the load balancing factor β. Among them, U CPU U GPU Q represents the utilization of the CPU and GPU, respectively. CPU Q GPU These represent the task queue lengths for the CPU and GPU, respectively, used to initially measure the current load; F CPU F GPU R represents the peak performance (FLOPS) of the CPU and GPU, respectively; CPU R GPU These represent the remaining computing power of the CPU and GPU, respectively. Adjust the monitoring frequency according to the dynamic nature of the task: Set monitoring cycles for static and dynamic scenarios respectively.
5. The LSTM-based BSDF solution optimization method for heterogeneous parallel systems according to claim 1, characterized in that, Step 5 specifically involves: Calculate the load imbalance Δ based on the prediction results: Among them, T CPU This represents the overall CPU load metric, quantifying the current task pressure on the CPU; T GPU This represents the overall load metric of the GPU, quantifying the current task pressure on the GPU; Among them, Q CPU Q GPU C represents the task queue lengths of the CPU and GPU, respectively. avg,CPU、 C avg,GPU H represents the average complexity of CPU and GPU processing a single subtask, respectively. CPU H GPU These represent the cache hit rates of the CPU and GPU, respectively; U CPU U GPU These represent the resource utilization rates of the CPU and GPU, respectively; P CPU P GPU These represent the computing power of the CPU and GPU, respectively, obtained by normalizing the hardware parameters: Among them, f CPU N represents the CPU clock speed. core F represents the number of CPU cores. GPU N represents the floating-point performance of a single stream processor in a GPU. SM Indicates the number of GPU stream processors; Based on the model's prediction results, a comprehensive evaluation of the load on each computing unit is conducted to determine whether there is a load imbalance in the system.
6. The optimization method for solving BSDF based LSTM in heterogeneous parallel systems according to claim 1, characterized in that, Step 6 specifically involves: When the system load is unbalanced, task allocation will be dynamically adjusted according to the following strategy: Where α is the BSDF roughness parameter; β is the system load factor; T CPU This represents the overall load metric for the CPU; T GPU This indicates the overall load metric for the GPU; By combining material properties and real-time system load status, the task migration strategy is dynamically adjusted to achieve load balancing of heterogeneous systems; the number of migration tasks is N. migrate With W adjust The degree of deviation is directly proportional: Where k is the migration coefficient, used to control the migration amplitude.
7. The optimization method for solving BSDF based LSTM in heterogeneous parallel systems according to claim 1, characterized in that, Step 7 specifically includes: Throughout the BSDF solution process, the system load is continuously monitored. Steps 3-6 are repeated at each cycle time. The load of each computing unit is evaluated and predicted using the deep learning model LSTM. The BSDF computing task allocation is adjusted in real time to dynamically optimize the load allocation. Loss function update during model retraining: Where λ is the weight of historical data, L old Historical loss represents the load data collected in past training cycles, used to prevent the model from over-adjusting due to short-term data fluctuations and maintain long-term stability; L current The current loss represents the most recently monitored load data, used to capture the latest changes in the system's state, ensuring the model adapts to dynamic scenarios and avoiding prediction lag; L new It is a comprehensive loss, which represents a weighted fusion of old and new losses, balancing long-term memory and short-term adaptation.
8. The optimization method for solving BSDF based LSTM in heterogeneous parallel systems according to claim 1, characterized in that, Step 4 specifically involves: Based on the historical data collected in Step 2, constructing a Transformer time-series prediction model to predict the load value of future BSDF computing tasks. The global temporal correlation of historical load data is modeled by a multi-head attention mechanism, and the temporal sequence information of load fluctuations is preserved by combining positional 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 CPU / GPU memory usage and task queue backlog of computing units, and the Decoder layer generates future load prediction values step by step based on an autoregressive mechanism.
9. The optimization method for solving BSDF based LSTM in heterogeneous parallel systems according to claim 1, characterized in that, Step 6 specifically involves: when an imbalance in system load is detected in step 5, a Markov decision process model is constructed, using the state of heterogeneous computing units as the state space, task migration actions as the behavior space, and 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 BSDF computing tasks.
Citation Information
Patent Citations
Graph fusion system for embedding disparate domain data
US20250014748A1
Deep autoregressive recurrent neural network-based edge prediction method
WO2024065904A1