An anti-memory-overflow beamforming acceleration method based on dynamic addressing and boundary protection
By employing dynamic addressing and boundary protection on the GPU, beamforming calculations are performed directly on the physical memory address of the raw data, solving the memory overflow problem in existing technologies, enabling real-time and stable processing of massive array echo data, and improving processing efficiency.
Patent Information
- Application Number
- CN202611434920.3
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2026-09-16
- Publication Date
- 2026-11-27
AI Technical Summary
Existing GPU parallel beamforming methods rely on physical zero-padding of the original array data to align multi-channel latency differences, resulting in a sharp increase in memory usage, high risk of memory overflow and fragmentation, and large overhead for dynamic memory allocation and full data copying, making it difficult to meet the needs of real-time and stable processing of massive array echo data.
By adopting a method based on dynamic addressing and boundary protection, the delay summation calculation of beamforming is mapped to a thread structure on a parallel computing device. By calculating the non-negative sampling offset of each channel relative to the reference delay, the index is dynamically read and boundary protection judgment is performed. The data is directly accumulated at the physical memory address of the original data, avoiding the use of zero-padding buffer.
It significantly reduces additional video memory usage, avoids video memory overflow and fragmentation, improves memory access efficiency, achieves real-time stable processing of beamforming, and reduces processing time and inter-frame jitter.
Smart Images

Figure CN123178080A_ABST
Abstract
Description
Technical Field
[0001] The embodiments of this application relate to the field of array signal processing technology, and in particular to a method for accelerating beamforming against memory overflow based on dynamic addressing and boundary protection. Background Technology
[0002] Beamforming is the primary step in the array signal processing chain. Its function is to transform the time-domain echo signals received from multiple array elements and channels into spatially directional beam-domain data by applying corresponding delays based on the acoustic path differences of each channel and summing the results. This achieves target orientation and signal-to-noise ratio gain. In time-domain delay-summing beamforming, it is necessary to traverse all array element channels for each beam direction and each sampling time to accumulate delays. The computational load is approximately the product of the number of beams, the number of sampling points, and the number of array elements, making it a typical computationally intensive task. With the continuous increase in array size, system sampling rate, and observation duration, especially in applications such as high-frequency active sonar, the single-frame array element domain echo data itself has reached the scale of millions or even higher sampling points. Traditional serial processing methods based on the Central Processing Unit (CPU) are insufficient to meet real-time processing requirements.
[0003] Graphics Processing Units (GPUs) possess a many-core parallel architecture, which is highly compatible with the data parallelism characteristics of the aforementioned time-delay summation operation. Existing technologies typically map time-domain time-delay summation beamforming as a two-dimensional Compute Unified Device Architecture (CUDA) thread grid, mapping the time sampling dimension in one dimension (e.g., the X-axis) and the beam orientation dimension in another dimension (e.g., the Y-axis). Massive concurrent threads undertake the accumulation task at different sampling points and in different beam directions, thereby compressing the processing time of a single beamforming operation to the millisecond level.
[0004] However, the acoustic path lengths of each array element channel are not the same under the same beam direction, and the required sampling delays for each channel are different. Moreover, the delay amount varies with the beam angle, and the maximum delay can reach thousands of sampling points. To ensure that all channels can still access valid data after delay alignment, existing GPU methods must, before beamforming, pad the front and back ends of the original array data matrix with zero-value sampling points corresponding to the maximum delay, forming a zero-padded intermediate buffer, and then perform addressing and accumulation operations on this filled buffer.
[0005] The aforementioned scheme relying on physical zero-padding has significant shortcomings: First, the data matrix volume expands rapidly with the increase of the number of array elements, sampling points, and maximum latency. Given that the original array element domain data already occupies a large amount of video memory, it is very easy to exceed the GPU's physical video memory capacity limit, causing video memory overflow and system crashes. Second, the filling buffer usually needs to be repeatedly requested and released during real-time operation, which not only brings significant low-level memory management and scheduling latency, but also gradually accumulates severe video memory fragmentation, reducing the success rate of video memory allocation and the stability of the system during long-term operation. Third, moving the original data to the filling buffer also requires performing a full video memory copy. The additional copying process and invalid memory access to the zero-value region further squeeze the valuable video memory bandwidth, restricting the overall throughput efficiency of the beamforming stage. Summary of the Invention
[0006] In view of this, embodiments of this application propose an anti-memory overflow beamforming acceleration method based on dynamic addressing and boundary protection. This method aims to solve the technical problems of existing GPU parallel beamforming methods that rely on physical zero-padding of the original array data to align multi-channel delay differences, resulting in a sharp increase in memory usage, high risk of memory overflow and fragmentation, and large overhead of dynamic memory allocation and full data copying, making it difficult to meet the requirements of real-time and stable processing of massive array echo data.
[0007] To achieve the above objectives, embodiments of this application propose a method for accelerating beamforming against memory overflow based on dynamic addressing and boundary protection, the method comprising the following steps: S1: Map the delay summation calculation of beamforming to a thread structure on a parallel computing device; wherein, the thread structure contains multiple threads that execute in parallel, and each thread corresponds to a processing task for a time sampling point and a beam direction; S2: For each element channel under the current beam direction, calculate the non-negative sampling offset of each channel relative to the reference delay; S3: Add the time sampling index corresponding to the current thread to the non-negative sampling offset of the current channel to obtain the dynamic reading index of the current channel; S4: Determine whether the dynamic read index is within the valid index range of the original data; if yes, directly read the sampled value of the current channel at the dynamic read index from the original data; if no, skip the sampled value reading operation of the current channel. S5: Traverse all array element channels, execute S3 and S4 in sequence, accumulate the sampled values of each channel, and obtain the beamforming output value of the current beam direction at the current time sampling point.
[0008] To achieve the above objectives, embodiments of this application also propose a computer-readable storage medium storing a computer program that, when executed by a processor, enables the implementation of a memory overflow-resistant beamforming acceleration method based on dynamic addressing and boundary protection as described above.
[0009] Compared with the prior art, this application has the following beneficial effects: First, this application transforms delay alignment from physical data relocation to address calculation through dynamic index offset and boundary protection judgment. Beam accumulation is directly completed on the physical memory address of the original array data, completely eliminating the zero-padding buffer and the original data copy set for delay alignment in the traditional scheme. This significantly reduces the additional memory usage and eliminates the risk of overflow and system crash due to insufficient memory from a physical mechanism perspective.
[0010] Second, this application completes index calculation, boundary judgment and condition accumulation in a closed loop within the kernel function. During runtime, there is no need to perform dynamic allocation and release for large blocks of video memory, thus avoiding video memory fragmentation and underlying memory management scheduling delays caused by frequent dynamic allocation. At the same time, it eliminates the copying step of moving the original data to the filling buffer, realizing zero-copy data flow.
[0011] Third, this application intercepts read requests from out-of-bounds channels through boundary protection conditions, making the out-of-bounds channels numerically equivalent to zero-padding contributions while not generating any actual memory access. This avoids illegal address access and ensures that the video memory bus bandwidth is fully reserved for valid feature data, thereby improving memory access efficiency.
[0012] Fourth, the synergistic effect of the above features significantly reduces the processing time of the beamforming kernel function and reduces inter-frame jitter, achieving overall acceleration while maintaining numerical equivalence.
[0013] Based on this, this solution can solve the technical problems of existing GPU parallel beamforming methods that rely on physical zero-padding of the original array data to align multi-channel delay differences, resulting in a sharp increase in memory usage, high risk of memory overflow and fragmentation, and large overhead of dynamic memory allocation and full data copying, making it difficult to meet the technical requirements of real-time and stable processing of massive array echo data.
[0014] Optionally, the thread structure is a two-dimensional thread grid, where the first dimension of the two-dimensional thread grid maps to the time sampling point index, and the second dimension maps to the beam azimuth angle index.
[0015] Optionally, for each array element channel under the current beam direction, the non-negative sampling offset of each channel relative to the reference delay is calculated, including: calculating the acoustic delay of each array element channel based on the beam angle corresponding to the current beam direction; converting the acoustic delay of each array element channel into channel delay in units of sampling points; determining the minimum value among all channel delays and using it as the reference delay; and calculating the non-negative sampling offset of each channel relative to the reference delay based on the reference delay and the number of sampling points of each array element channel.
[0016] Optionally, the first Individual element channels calculate acoustic delay The expression is as follows: ; in, Indicates the array element number, and ; Indicates the spacing between array elements; Indicates the speed of sound in water; Indicates the beam angle; No. Non-negative sampling offset of each element channel relative to the reference delay The expression is as follows: ; in, This represents the channel delay in units of the number of sampling points. Indicates the reference delay.
[0017] Optionally, dynamically read the index. The expression is as follows: ; in, This represents the time sampling index of the current thread.
[0018] Optionally, the raw data is stored in video memory in column-major format, and the linear storage address of the current channel at the current dynamic read index is: ; in, For linear memory addresses, Number of sampling points for each channel.
[0019] Optionally, the effective index range is: .
[0020] Optionally, the sampled value is a complex number; The step of accumulating the sampled values from each channel to obtain the beamforming output value at the current time sampling point in the current beam direction includes: The real and imaginary parts of the sampled values from each channel are summed, and the expression is as follows: ; ; in, The accumulated value of the real part. This is the accumulated value of the imaginary part. For the first Channels dynamically read indexes Complex sampled values at the location, This represents the total number of array element channels; The expression for the beamforming output value is as follows: ; in, For beamforming output values, It is the imaginary unit.
[0021] Optionally, before mapping the beamforming delay summation calculation to a thread structure on a parallel computing device, the method further includes: acquiring multi-channel array echo data and storing the multi-channel array echo data sequentially in the raw input buffer of the GPU memory; wherein the raw input buffer is a raw data area without zero padding corresponding to the maximum delay; configuring an output buffer for storing beam domain output data; the step of accumulating the sampled values of each channel to obtain the beamforming output value of the current beam direction at the current time sampling point includes: after traversing all array element channels, writing the accumulation result as the beam output value of the current beam angle and the current time sampling point into the output buffer. Attached Figure Description
[0022] To more clearly illustrate the technical solutions in the embodiments or related technologies of this application, the accompanying drawings used in the description of the embodiments or related technologies of this application will be briefly introduced below. Obviously, the following drawings are only some embodiments of this application. For those skilled in the art, other drawings can be obtained based on these drawings without creative effort. The drawings described herein are only used to explain this application and are not intended to limit this application.
[0023] Figure 1 This is a flowchart of a beamforming acceleration method for resisting memory overflow based on dynamic addressing and boundary protection provided in this application; Figure 2 This is a comparison diagram of a traditional method provided in this application and the memory layout of the present invention; Figure 3 This application provides a dynamic addressing and boundary protection logic flow graph based on GPU single-core functions; Figure 4This is a comparison chart of beamforming processing time between a dynamic addressing scheme provided in this application and a traditional zero-filling scheme; Figure 5 This is an overall flowchart of a beamforming acceleration method for resisting memory overflow based on dynamic addressing and boundary protection provided in this application. Detailed Implementation
[0024] To make the objectives, technical solutions, and advantages of the embodiments of this application clearer, the various embodiments of this application will be described in detail below with reference to the accompanying drawings. Those skilled in the art will understand that many technical details have been presented in the embodiments of this application to facilitate better understanding. However, the technical solutions claimed in this application can be implemented even without these technical details and various variations and modifications based on the following embodiments. The division of the following embodiments is for ease of description and should not constitute any limitation on the specific implementation of this application. The following embodiments can be combined with and referenced by each other without contradiction.
[0025] Beamforming is the primary step in the array signal processing chain. Its function is to transform the time-domain echo signals received from multiple array elements and channels into spatially directional beam-domain data by applying corresponding delays based on the acoustic path differences of each channel and summing the results. This achieves target orientation and signal-to-noise ratio gain. In time-domain delay-summing beamforming, it is necessary to traverse all array element channels for each beam direction and each sampling time to accumulate delays. The computational load is approximately the product of the number of beams, the number of sampling points, and the number of array elements, making it a typical computationally intensive task. With the continuous increase in array size, system sampling rate, and observation duration, especially in applications such as high-frequency active sonar, the single-frame array element domain echo data itself has reached the scale of millions or even higher sampling points. Traditional serial processing methods based on the Central Processing Unit (CPU) are insufficient to meet real-time processing requirements.
[0026] Graphics Processing Units (GPUs) possess a many-core parallel architecture, which is highly compatible with the data parallelism characteristics of the aforementioned time-delay summation operation. Existing technologies typically map time-domain time-delay summation beamforming as a two-dimensional Compute Unified Device Architecture (CUDA) thread grid, mapping the time sampling dimension in one dimension (e.g., the X-axis) and the beam orientation dimension in another dimension (e.g., the Y-axis). Massive concurrent threads undertake the accumulation task at different sampling points and in different beam directions, thereby compressing the processing time of a single beamforming operation to the millisecond level.
[0027] However, the acoustic path lengths of each array element channel are not the same under the same beam direction, and the required sampling delays for each channel are different. Moreover, the delay amount varies with the beam angle, and the maximum delay can reach thousands of sampling points. To ensure that all channels can still access valid data after delay alignment, existing GPU methods must, before beamforming, pad the front and back ends of the original array data matrix with zero-value sampling points corresponding to the maximum delay, forming a zero-padded intermediate buffer, and then perform addressing and accumulation operations on this filled buffer.
[0028] The aforementioned scheme relying on physical zero-padding has significant shortcomings: First, the data matrix volume expands rapidly with the increase of the number of array elements, sampling points, and maximum latency. Given that the original array element domain data already occupies a large amount of video memory, it is very easy to exceed the GPU's physical video memory capacity limit, causing video memory overflow and system crashes. Second, the filling buffer usually needs to be repeatedly requested and released during real-time operation, which not only brings significant low-level memory management and scheduling latency, but also gradually accumulates severe video memory fragmentation, reducing the success rate of video memory allocation and the stability of the system during long-term operation. Third, moving the original data to the filling buffer also requires performing a full video memory copy. The additional copying process and invalid memory access to the zero-value region further squeeze the valuable video memory bandwidth, restricting the overall throughput efficiency of the beamforming stage.
[0029] In view of this, embodiments of this application propose an anti-memory overflow beamforming acceleration method based on dynamic addressing and boundary protection. This method aims to solve the technical problems of existing GPU parallel beamforming methods that rely on physical zero-padding of the original array data to align multi-channel delay differences, resulting in a sharp increase in memory usage, high risk of memory overflow and fragmentation, and large overhead of dynamic memory allocation and full data copying, making it difficult to meet the technical requirements of real-time and stable processing of massive array echo data.
[0030] The specific process of the anti-memory overflow beamforming acceleration method based on dynamic addressing and boundary protection proposed in this embodiment can be described as follows: Figure 1 As shown, it includes: S1 to S5.
[0031] It should be noted that this embodiment is described using GPU and CUDA parallel programming model as the specific implementation environment. However, those skilled in the art will understand that the method of the present invention is also applicable to other parallel computing devices with many-core parallel execution capabilities, such as heterogeneous accelerator cards supporting OpenCL, digital signal processor arrays, parallel processing units on FPGAs, and various many-core coprocessors.
[0032] The underlying test environment in this embodiment is deployed on an NVIDIA RTX 4060 series GPU platform. The parameter settings for the raw echo data of the element domain processed are as follows: The signal length is 10s, the number of array elements is 64, the system sampling rate is 120kHz, a single channel contains 1,200,000 sampling points, the detection beam coverage is set to -60° to 60°, the beam step size is 1°, and a total of 121 azimuth beams are generated.
[0033] The following is an exemplary description of a beamforming acceleration method for resisting memory overflow based on dynamic addressing and boundary protection provided in this embodiment.
[0034] Before S1, during the system initialization phase, the GPU memory pool is pre-allocated once based on parameters. The input buffer directly stores the raw array time-domain data in column-major complex matrix format (64 channels × 200,000 samples); the output buffer is also allocated in column-major format (121 beams × 1,200,000 samples). Figure 2 As shown, compared with the traditional zero-padding scheme, the input data in this embodiment resides directly in the original array data area (physical video memory), eliminating the huge zero-padding buffer allocation operation and using the saved video memory resources to support the concurrent pipeline processing of subsequent multi-frame data.
[0035] S1: Map the delay summation calculation of beamforming to a thread structure on a parallel computing device.
[0036] The thread structure contains multiple threads that execute in parallel, with each thread corresponding to a time sampling point and a processing task in a beam direction.
[0037] For example, the thread structure is a two-dimensional thread grid, where the first dimension of the two-dimensional thread grid maps to the time sampling point index and the second dimension maps to the beam azimuth angle index.
[0038] In this embodiment, the time-domain delay summation calculation of beamforming is mapped to a two-dimensional CUDA thread grid. The X dimension (i.e., the first dimension) of the thread grid maps to the time sampling point index, and the Y dimension (i.e., the second dimension) maps to the beam azimuth angle index, thus ensuring that each thread corresponds exactly to a single processing task with one time sampling point and one beam direction.
[0039] Thread block size set to That is, 256 threads in the X direction and 1 thread in the Y direction; the grid size is set as follows: ; in, This indicates rounding up. The time sampling index and beam angle index for each thread are determined by the following formulas: ; ; In the formula, This is the number of the current thread block in the X direction. The size of the thread block in the X direction (taken as 256). This represents the offset of the thread in the X direction. The current thread block's number in the Y direction. This represents the size of the thread block in the Y direction (taken as 1). This represents the offset of the thread in the Y direction.
[0040] To address this, each thread uses boundary checks to ensure the index does not exceed the valid range, i.e.: and .
[0041] Threads that do not meet the requirements are returned directly and will not participate in subsequent calculations. This thread-level boundary check is unrelated to the total mismatch in the time sampling dimension; it is only used to eliminate redundant threads caused by rounding up the grid, without introducing any additional memory overhead.
[0042] In an alternative implementation, the thread block size is not limited to... Alternatively, other values such as 128 or 512 can be used depending on the specific GPU architecture and register resource constraints; alternatively, a one-dimensional threaded grid can be used, and the values can be parsed using modulo and integer division operations based on linear indexing. and Alternatively, a three-dimensional threaded mesh can be used to simultaneously carry the frame number, beam number, and time sampling number. The mapping relationship is consistent with the core idea of this invention and both fall within the protection scope of this invention.
[0043] S2: For each element channel under the current beam direction, calculate the non-negative sampling offset of each channel relative to the reference delay.
[0044] In one possible embodiment, S2 includes: calculating the acoustic delay of each array element channel based on the beam angle corresponding to the current beam direction; converting the acoustic delay of each array element channel into channel delay in units of sampling points; determining the minimum value among all channel delays and using it as the reference delay; and calculating the non-negative sampling offset of each channel relative to the reference delay based on the reference delay and the number of sampling points of each array element channel.
[0045] For example, each thread can index according to its own Y-dimensional dimension. The corresponding physical azimuth angle is obtained by analysis, and its expression is as follows: ; In this embodiment , , The value ranges from 0 to 120, therefore Take in sequence 60° 59°, ..., 0°, ..., 59°, 60°.
[0046] No. Individual element channels calculate acoustic delay The expression is as follows: ; in, Indicates the array element number, and ,Right now ; Indicates the spacing between array elements; Indicates the speed of sound in water; Indicates the beam angle; The acoustic delay is then converted into a delay amount in units of sampling points, as expressed below: ; in, Sampling frequency, This indicates rounding to the nearest integer. In other embodiments, the fractional delay can also be obtained by rounding up, rounding down, or linear interpolation weighting, and this invention does not limit this to any particular method.
[0047] To eliminate out-of-bounds access caused by negative latency, the minimum latency of all channels is calculated as the baseline latency: ; It should be noted that the validity of this formula lies in the fact that, due to acoustic delay... Follow-up element sequence number It exhibits monotonous changes, and hour Therefore, the minimum delay across all channels must occur in the first channel, which corresponds to... hour Monotonically increasing; or appearing in the last channel, i.e., corresponding to hour Monotonically decreasing; taking the smaller value between it and 0 guarantees this. The delay should not exceed the delay of any single channel. Of course, in a more general implementation, it can also be applied to all channels directly. Each channel Find the minimum value.
[0048] Then, a non-negative offset is calculated for each channel; Non-negative sampling offset of each element channel relative to the reference delay The expression is as follows: ; in, This represents the channel delay in units of the number of sampling points. This represents the reference delay for all channels.
[0049] because This holds true for any channel, therefore That is, the offset of all channels is a non-negative integer, and at least one channel has an offset of 0 (that channel is the reference channel).
[0050] Taking this embodiment as an example: exist In the beam direction, the system calculated that the terminal channel (channel 63) has the largest acoustic delay, equivalent to approximately 4160 sampling points; at this time , , Therefore, the offset of channel 0 Offset of channel 63 The offsets of the remaining channels are distributed between 0 and 4160 according to the element number. Under the normal beam, The acoustic delay of all channels is 0, therefore And the offset of all channels is 0. In the direction of the beam, , , Therefore , That is, the distribution of offset between channels is exactly the opposite of the 60° case.
[0051] In an optional implementation, the offset of each channel in each beam direction can also be pre-calculated offline by the host before the kernel function is started, forming a value of [size missing]. The integer offset table (in this embodiment, it contains 121 × 64 = 7744 integers, approximately 30KB) is uploaded to the GPU's constant memory or global memory and then retrieved by the kernel function; alternatively, several threads within a thread block collaboratively calculate the beam corresponding to that thread block. The offset is calculated and written to shared memory for all threads within the block to share. (This is because in this embodiment...) All threads within the same thread block correspond to the same beam direction and therefore share the same set of offsets. Using shared memory reuse can significantly reduce the number of times trigonometric functions and rounding operations are repeatedly executed within a thread.
[0052] S3: Add the time sampling index corresponding to the current thread to the non-negative sampling offset of the current channel to obtain the dynamic read index of the current channel.
[0053] For the current thread's time sampling index , and the offset of it from the current channel. Add them together to get the dynamically read index; dynamically read index The expression is as follows: ; in, This represents the time sampling index of the current thread.
[0054] This index directly accesses the physical address of the raw array data in GPU memory, without any preprocessing copying or zero-padding operations. The raw array data is stored in column-major format (channel-major), and the index... Channel, First linear address of the sampling point in video memory for: ; in, For linear memory addresses, Number of sampling points for each channel.
[0055] This index is used to directly access the physical address of the raw array data in the GPU memory without any preprocessing copying or zero-padding operations.
[0056] Combination Figure 2 Note: This application directly uses the input buffer storing the original array data as the data reading object of the kernel function, and no longer establishes a zero-padding buffer for delay alignment. Figure 2 The original array data areas in the buffer represent the storage locations and addressing relationships of the original data. Both correspond to the same input data buffer and do not represent a separate copy of the original data. Each thread calculates the read index based on the current time sampling point index and the delay offset of the current channel, and maps this index to the corresponding position in the original input buffer, realizing in-situ reading and zero-copy data transfer.
[0057] Furthermore, due to the adjacent threads within the same thread block consecutive offsets of each thread within the same block to the same channel The same, its corresponding With global memory address Since they are also continuous, memory access requests within the same thread bundle can form continuous address accesses within the valid data range, which is beneficial to improving the efficiency of merging accesses to global video memory.
[0058] S4: Determine whether the dynamic read index is within the valid index range of the original data; if yes, directly read the sampled value of the current channel at the dynamic read index from the original data; if no, skip the sampled value reading operation of the current channel.
[0059] For dynamic read index Determine the boundary protection conditions: The effective index range is: ; in, To dynamically read the index, Number of sampling points for each channel.
[0060] If the condition is met, the complex value is read from the original video memory address given in the above formula and used to participate in the summation of the real and imaginary parts; if the condition is not met, the channel is skipped and no video memory read operation is performed. The contribution of the skipped out-of-bounds channel is numerically equivalent to zero-filling, but it neither actually occupies any video memory space nor generates any video memory access request or read / write bus occupation.
[0061] Combination Figure 3 The logic flow inside the kernel function is explained. Figure 3 middle, Corresponding to the aforementioned time sampling index, For the current beam direction, the first The non-negative sampling offset of each element channel relative to the minimum delay reference. After the thread performs validity checks in the time sampling dimension and beam azimuth dimension, it accumulates the real part of the variable. Variables with accumulated imaginary parts Initialize to zero, and iterate through each array element channel sequentially. For the current channel, first execute... Figure 3 The addition operation shown (represented by "adder" in the diagram) samples the current time index. With channel offset Add them together to get the dynamic read index. .
[0062] Then, the thread checks whether the read index satisfies the condition. This decision is made before reading the input data for the current channel, thus physically preventing the index, after delay and offset, from exceeding the valid data range of the channel.
[0063] When the judgment result is "yes", then according to the storage method of the original input data, Calculate the linear addressing offset corresponding to the current channel and read the complex sample value from the original input buffer. and its actual part is added to The imaginary part is accumulated to After completing the accumulation of the current channel, continue processing the next channel.
[0064] If the judgment result is "no", then the input data for that out-of-bounds position will not be read, nor will the data be updated. and Instead of terminating the processing of other channels, the thread continues processing the next channel. Therefore, what is skipped is the contribution of the current channel to the current output sample point, not the termination of processing for the remaining channels. Since the accumulated value remains unchanged, this process is numerically equivalent to reading a zero value and then accumulating it.
[0065] Specific example: In this embodiment, under a 60° beam direction, the offset of the 63rd channel is 4160 sampling points.
[0066] when hour, ,satisfy Due to the valid range requirements, reading and accumulation are performed. when hour, The reading and accumulation of channel 63 at this output sampling point has exceeded the valid range, so the reading and accumulation are skipped. The remaining channels still perform boundary checks independently according to their respective offsets, without interfering with each other. It can be seen that, as... As the data moves towards the tail, channels with larger offsets enter the out-of-bounds state earlier, resulting in more invalid memory access requests being skipped. This makes the memory access bandwidth saved by the out-of-bounds protection mechanism most significant in the data tail region.
[0067] Furthermore, due to and , If the condition is always true, then dynamically reading the index naturally satisfies the lower bound of the effective index range, and boundary protection essentially only requires upper bound judgment.
[0068] Of course, this application still records it in a complete two-way judgment form to cover the negative index that may occur in cases where the array element delay is not monotonically changing (e.g., two-dimensional planar array, cylindrical array, array with fixed electrical delay or acoustic lens delay between channels) and the introduction of pre-weighted fractional delay, so as to ensure the universality and robustness of the boundary protection mechanism.
[0069] The above index calculation, boundary judgment and condition accumulation process is completed in a closed loop within the same beamforming kernel function, without the need to pre-generate the zero-padded input matrix, and without relying on any additional buffer.
[0070] S5: Traverse all array element channels, execute S3 and S4 in sequence, accumulate the sampled values of each channel, and obtain the beamforming output value of the current beam direction at the current time sampling point.
[0071] The step of accumulating the sampled values from each channel to obtain the beamforming output value at the current time sampling point in the current beam direction includes: The real and imaginary parts of the sampled values from each channel are summed, and the expression is as follows: ; ; in, The accumulated value of the real part. This is the accumulated value of the imaginary part. For the first Channels dynamically read indexes Complex sampled values at the location, This represents the total number of array element channels; In the formula, the summation operation is only performed on valid channels that pass the boundary protection check; channels that fail the check contribute zero numerically. During the accumulation process, and It resides in a thread-private register, thus avoiding repeated reads and writes to global video memory.
[0072] The expression for the beamforming output value is as follows: ; in, For beamforming output values, It is the imaginary unit.
[0073] In one possible embodiment, before mapping the beamforming delay summation calculation to a thread structure on a parallel computing device, the method further includes: acquiring multi-channel array echo data and storing the multi-channel array echo data sequentially in the raw input buffer of the GPU memory; configuring an output buffer for storing beam domain output data. The raw input buffer is the raw data area without zero-padding corresponding to the maximum delay. The step of accumulating the read channel sample values to obtain the beamforming output value of the current beam direction at the current time sampling point includes: after traversing all array element channels, writing the accumulated result as the beam output value of the current beam angle and the current time sampling point into the output buffer.
[0074] During the system initialization phase, the GPU memory pool can be pre-allocated in one go, and the input and output buffers can be allocated in one go. After that, no large blocks of video memory will be dynamically allocated or released during the entire processing flow.
[0075] Specifically, the input buffer directly stores the original array time-domain data in a column-major complex matrix format (64 channels × 1.2 million sampling points), i.e., the data of the same array channel... The sampling points are stored contiguously in the video memory. The starting address of the channel is The output buffer is also allocated in column-major format (121 beams × 1.2 million sampling points), the first... The starting address of each beam is Each complex sampling point can be stored as a single-precision floating-point complex number (4 bytes for the real part and 4 bytes for the imaginary part, for a total of 8 bytes) or a double-precision floating-point complex number (16 bytes in total). In this embodiment, a single-precision floating-point complex number is used to further reduce the memory usage and memory access bandwidth pressure while ensuring the dynamic range of underwater acoustic signal processing.
[0076] After all channels have been traversed, the accumulated result is written to the output buffer in complex form: ; Among them, the output buffer is arranged according to The column-major format is used for organization, and its linear write address is: The output beam domain matrix is directly taken over by downstream components (such as matched filtering, detection, imaging, or display modules) through pointer references, avoiding cross-process or host-side data readback, and realizing end-to-end memory flow from element domain input to beam domain output.
[0077] For example, such as Figure 2 As shown, the original array data can first be stored in the input buffer. To meet the data access requirements after delay alignment of different array element channels, the traditional zero-padding scheme requests an independent padding buffer through video memory allocation operations, copies the original array data to the middle area of the padding buffer, and sets zero-padding areas at its front and back ends. Thus, the padding buffer consists of three parts: a forward zero-padding area, a copied original data area, and a backward zero-padding area. During beamforming, the thread reads the data in the padding buffer according to the delay relationship of each channel; when the read position exceeds the valid range corresponding to the original data and falls into the zero-padding area, the accumulation is completed by reading the pre-stored zero value.
[0078] In addition to the original input buffer, the above scheme also requires storing a copy of the original data for delay alignment and corresponding zero-padding data. When both the original input buffer and the padding buffer exist, they share GPU memory. Furthermore, the creation of the padding buffer involves three types of operations: memory allocation, zero-value initialization, and copying of the original data. When there are many channels, a high sampling rate, or a long observation time, the additional buffer will further compress the available GPU memory space, increasing the risk of allocation failure due to insufficient GPU memory. In multi-frame pipelines or real-time continuous processing scenarios, the repeated allocation and release of the padding buffer can also cause memory fragmentation, significantly increasing the latency of underlying memory management and scheduling.
[0079] exist Figure 2In this application, the input buffer storing the original array data is directly used as the data read object of the kernel function, and a zero-padding buffer for delay alignment is no longer established. The "original array data area" in the diagram represents the storage location of the original data and its addressing relationship; both correspond to the same input data buffer and do not indicate a separate copy of the original data. Each thread calculates the read index based on the current time sampling point index and the delay offset of the current channel, and maps this index to the corresponding position in the original input buffer.
[0080] Figure 2 The "Channel 0 Read Window" illustrates the case where the read position is within the valid range of the original data, in which case data reading and accumulation are performed. The "Channel N Read Window" illustrates the case where an out-of-bounds read position occurs after a delay offset, where N represents a specific array channel. For out-of-bounds positions, the kernel function skips the read and accumulation operations for that channel at the current output sampling point based on boundary conditions, making its contribution equivalent to zero, without actually storing or reading the zero value in video memory. The read windows shown in the diagram are only for illustrating the addressing range; the validity of each sampling position is determined separately by its corresponding read index.
[0081] like Figure 4 As shown, Figure 4 This is an overall flowchart of a beamforming acceleration method for resisting memory overflow based on dynamic addressing and boundary protection proposed in this application.
[0082] The parallel computing architecture construction phase corresponds to S1 above, used to establish the mapping relationship between the beamforming task and the thread structure of the parallel computing device. It includes two nodes: "Inputting multi-channel array echo data" and "Constructing a two-dimensional parallel thread grid (X-dimensional: time sample, Y-dimensional: beam)". First, the multi-channel array echo data is input. In this embodiment, this data is an element-domain time-domain echo, directly residing in the input buffer of the GPU memory in a column-major complex matrix format. Then, a two-dimensional parallel thread grid is constructed.
[0083] The delay calculation and data addressing stage can correspond to S2 and S3 above. It is used to complete the equivalent processing of delay alignment inside the kernel function and includes two nodes: "calculate the relative delay time of each array element" and "dynamic addressing based on relative delay".
[0084] The spatial gain and beam generation stages can correspond to S4 and S5 above, and are used to complete multi-channel energy convergence under the premise of eliminating invalid memory accesses. They include three nodes: "data read index boundary protection check", "array element channel signal amplitude accumulation and summation" and "specified direction beam domain data".
[0085] Compared with the prior art, this application has the following beneficial effects: First, this application transforms delay alignment from physical data relocation to address calculation through dynamic index offset and boundary protection judgment. Beam accumulation is directly completed on the physical memory address of the original array data, completely eliminating the zero-padding buffer and the original data copy set for delay alignment in the traditional scheme. This significantly reduces the additional memory usage and eliminates the risk of overflow and system crash due to insufficient memory from a physical mechanism perspective.
[0086] Second, this application completes index calculation, boundary judgment and condition accumulation in a closed loop within the kernel function. During runtime, there is no need to perform dynamic allocation and release for large blocks of video memory, thus avoiding video memory fragmentation and underlying memory management scheduling delays caused by frequent dynamic allocation. At the same time, it eliminates the copying step of moving the original data to the filling buffer, realizing zero-copy data flow.
[0087] Third, this application intercepts read requests from out-of-bounds channels through boundary protection conditions, making the out-of-bounds channels numerically equivalent to zero-padding contributions while not generating any actual memory access. This avoids illegal address access and ensures that the video memory bus bandwidth is fully reserved for valid feature data, thereby improving memory access efficiency.
[0088] Fourth, the synergistic effect of the above features significantly reduces the processing time of the beamforming kernel function and reduces inter-frame jitter, achieving overall acceleration while maintaining numerical equivalence.
[0089] Based on this, this solution can solve the technical problems of existing GPU parallel beamforming methods that rely on physical zero-padding of the original array data to align multi-channel delay differences, resulting in a sharp increase in memory usage, high risk of memory overflow and fragmentation, and large overhead of dynamic memory allocation and full data copying, making it difficult to meet the requirements of real-time and stable processing of massive array echo data.
[0090] To verify the technical advantages of this invention in resisting memory overflow, this embodiment uses the underlying cudaMemGetInfo interface to monitor the peak physical memory usage of both schemes in real time. Test data shows that, under the same scale of massive array data (signal length 10s, number of array elements 64, sampling rate 120kHz), this invention performs calculations directly on the original physical memory through dynamic addressing and boundary protection, with a peak memory usage of 1676.5MB. In contrast, the traditional zero-padding scheme, due to the dynamic allocation of a large d_padded_buffer buffer using cudaMalloc, causes the system's peak memory usage to surge to 2264.5MB. This invention completely eliminates the redundant memory overhead of up to 588MB in the traditional scheme, removing the hidden dangers of memory overflow and system crashes from the underlying physical mechanism, and greatly improving the system robustness in underwater acoustic environments.
[0091] To verify the technical effectiveness of this invention, under the same data load, the processing time of the traditional GPU zero-padding scheme and the dynamic addressing scheme of this invention in the beamforming kernel function stage were compared. This embodiment is based on element domain echo data (signal length 10s, number of element domains 64, sampling rate 120kHz), and was run 10 times consecutively using the same batch of measured data. The test statistics are as follows: Figure 5 As shown.
[0092] Figure 5 This is a comparison chart of the beamforming kernel function processing time between the dynamic addressing scheme of this invention and the traditional zero-padding scheme. The horizontal axis represents the test number (values from 1 to 10), and the vertical axis represents the kernel function processing time (in milliseconds). In each group of bars, the blue bars represent the dynamic addressing scheme of this invention, and the orange bars represent the traditional zero-padding scheme. The two horizontal dashed lines represent the average processing time of the two schemes in 10 tests, with the average values rounded to one decimal place: 242.7 ms and 428.3 ms, respectively.
[0093] Depend on Figure 5 It can be seen that the kernel function processing time of the proposed solution is lower than that of the corresponding traditional zero-padding solution in all 10 tests. Compared with the traditional solution, the average processing time of the proposed solution is reduced by 185.56ms, a reduction of approximately 43.33%; calculated by the ratio of the average processing time of the traditional solution to the average processing time of the proposed solution, the speedup is approximately 1.76 times. Furthermore, the test processing time of the proposed solution ranges from 198.2ms to 262.5ms, with a range of 64.3ms; the test processing time of the traditional solution ranges from 369.4ms to 531.8ms, with a range of 162.4ms, indicating that the processing time of the proposed solution has a smaller fluctuation range in this set of tests.
[0094] The steps described above are for clarity only. In implementation, they can be combined into one step or some steps can be broken down into multiple steps, as long as they involve the same logical relationship, they are all within the scope of protection of this application. Any insignificant modifications or introductions to the algorithm or process that do not change the core design of the algorithm or process are also within the scope of protection of this application.
[0095] Another embodiment of this application proposes a computer-readable storage medium storing a computer program that, when executed by a processor, can implement a method for accelerating anti-memory overflow beamforming based on dynamic addressing and boundary protection as described in the above method embodiments.
[0096] That is, those skilled in the art will understand that all or part of the steps in the above method embodiments can be implemented by a program instructing related hardware. The program is stored in a storage medium and includes several instructions to cause a device (such as a microcontroller, chip, etc.) or processor to execute all or part of the steps of the method described in the method embodiments of this application. The aforementioned storage medium includes various media capable of storing program code, such as USB flash drives, portable hard drives, read-only memory, random access memory, magnetic disks, or optical disks.
[0097] Those skilled in the art will understand that the above embodiments are specific implementations of this application, and in practical applications, various changes can be made in form and detail without departing from the spirit and scope of this application. For those skilled in the art, several improvements and modifications can be made without departing from the principles of this application, and these improvements and modifications are also considered to be within the scope of protection of this application.
Claims
1. A method for accelerating beamforming against memory overflow based on dynamic addressing and boundary protection, characterized in that, The method includes: S1: Map the delay summation calculation of beamforming to a thread structure on a parallel computing device; wherein, the thread structure contains multiple threads that execute in parallel, and each thread corresponds to a processing task for a time sampling point and a beam direction; S2: For each element channel under the current beam direction, calculate the non-negative sampling offset of each channel relative to the reference delay; S3: Add the time sampling index corresponding to the current thread to the non-negative sampling offset of the current channel to obtain the dynamic reading index of the current channel; S4: Determine whether the dynamic read index is within the valid index range of the original data; if yes, directly read the sampled value of the current channel at the dynamic read index from the original data; if no, skip the sampled value reading operation of the current channel. S5: Traverse all array element channels, execute S3 and S4 in sequence, accumulate the sampled values of each channel, and obtain the beamforming output value of the current beam direction at the current time sampling point.
2. The method according to claim 1, characterized in that, The thread structure is a two-dimensional thread grid. The first dimension of the two-dimensional thread grid maps the time sampling point index, and the second dimension maps the beam azimuth angle index.
3. The method according to claim 2, characterized in that, The calculation of the non-negative sampling offset of each array element channel relative to the reference delay for the current beam direction includes: Based on the beam angle corresponding to the current beam direction, calculate the acoustic delay of each array element channel respectively; The acoustic delay of each array element channel is converted into channel delay in units of sampling points; Determine the minimum delay among all channels and use it as the baseline delay; Based on the reference delay and the number of sampling points for each array element channel, calculate the non-negative sampling offset of each channel relative to the reference delay.
4. The method according to claim 3, characterized in that, No. Individual element channels calculate acoustic delay The expression is as follows: ; in, Indicates the array element number, and ; Indicates the spacing between array elements; Indicates the speed of sound in water; Indicates the beam angle; No. Non-negative sampling offset of each element channel relative to the reference delay The expression is as follows: ; in, This represents the channel delay in units of the number of sampling points. Indicates the reference delay.
5. The method according to claim 4, characterized in that, The dynamic index reading The expression is as follows: ; in, This represents the time sampling index of the current thread.
6. The method according to claim 5, characterized in that, The raw data is stored in video memory in column-major format. The linear storage address of the current channel at the current dynamically read index is: ; in, For linear memory addresses, Number of sampling points for each channel.
7. The method according to claim 6, characterized in that, The effective index range is: 。 8. The method according to claim 7, characterized in that, The sampled value is a complex number; The step of accumulating the sampled values from each channel to obtain the beamforming output value at the current time sampling point in the current beam direction includes: The real and imaginary parts of the sampled values from each channel are summed, and the expression is as follows: ; ; in, The accumulated value of the real part. This is the accumulated value of the imaginary part. For the first Channels dynamically read indexes Complex sampled values at the location, This represents the total number of array element channels; The expression for the beamforming output value is as follows: ; in, For beamforming output values, It is the imaginary unit.
9. The method according to claim 1, characterized in that, Before mapping the delay summation calculation of beamforming to a thread structure on a parallel computing device, the method further includes: Acquire multi-channel array echo data and store the multi-channel array echo data sequentially in the raw input buffer of the GPU memory; the raw input buffer is the raw data area without zero padding corresponding to the maximum delay; Configure the output buffer for storing beam domain output data; The step of accumulating the sampled values from each channel to obtain the beamforming output value at the current time sampling point in the current beam direction includes: After traversing all array element channels, the accumulated result is written into the output buffer as the beam output value of the current beam angle and the current time sampling point.
10. A computer-readable storage medium storing a computer program, characterized in that, When the computer program is executed by the processor, it can implement the anti-memory overflow beamforming acceleration method based on dynamic addressing and boundary protection as described in any one of claims 1 to 9.
