A hardware-software deployment collaborative acceleration system and method

By accelerating the system through hardware and software collaboration, the deployment of the MobileViTv2 model was optimized, solving the problems of uneven resource utilization and memory access pressure in FPGA acceleration methods, and achieving efficient edge inference.

CN123180237APending Publication Date: 2026-11-27ZHONGKE HUAXIN (DONGGUAN) TECH CO LTD
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202611294738.2
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2026-08-25
Publication Date
2026-11-27

AI Technical Summary

Technical Problem

Existing FPGA acceleration methods are difficult to efficiently adapt to the convolution operator structure of the MobileViTv2 model, resulting in uneven resource utilization during the computation process. The linear attention module has a global context dependency, and the intermediate results are accessed frequently, causing memory access pressure and increased latency.

Method used

A hardware and software co-acceleration system is adopted. Through the coordinated deployment of the processing system, programmable logic, on-chip cache and off-chip memory, attention processing engine and feedforward processing engine are used to perform cross-layer interleaved pipeline scheduling to optimize Transformer layer computation. Combined with ping-pong caching and feature expansion, off-chip memory access is reduced.

Benefits of technology

It improves the inference efficiency and hardware resource utilization of the MobileViTv2 model at the edge, reduces memory access overhead, and achieves stable end-to-end inference.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN123180237A_ABST
    Figure CN123180237A_ABST
Patent Text Reader

Abstract

The application discloses a hardware and software deployment cooperative acceleration system and method, relates to the model deployment field, and comprises a Conv IP and a Pwdwconv IP. Under the scheduling of a processing system, the Conv IP and the Pwdwconv IP perform the deployment of the first three convolutions according to model weights and input atlas and write into off-chip memory. The processing system schedules and deploys the third to fifth stage convolutions in a fixed sequence: the Pwdwconv IP performs downsampling and local coding and writes into the off-chip memory; the processing system reads the convolution output from the off-chip memory and performs feature unfolding; the attn IP performs calculation of each layer of a Transformer layer; the processing system performs feature folding and writes into the off-chip memory; each layer of the Transformer layer completes calculation by using an attention processing engine and a feedforward processing engine based on a cross-layer interleaving pipeline scheduling mechanism; and finally, the network end completes deployment. The application takes into account both execution efficiency and off-chip memory access overhead.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This application relates to the field of model deployment, and in particular to a software and hardware deployment collaborative acceleration system and method. Background Technology

[0002] With the development of the power Internet of Things and edge intelligent monitoring, the status perception of high-voltage electrical equipment is gradually shifting from centralized analysis in the cloud to local inference at the field terminal. Partial discharge is an important characteristic signal of insulation degradation and fault evolution. In engineering, phase-resolved partial discharge (PRPD) maps are commonly used to statistically analyze the phase, amplitude, and repetition count of discharge pulses. Due to the differences in the discharge mechanisms of different insulation defects, their maps usually exhibit different characteristics in terms of phase distribution range, point cluster morphology, and positive and negative half-cycle symmetry. In recent years, artificial intelligence methods have been gradually applied to partial discharge diagnosis. Related reviews and applied research have pointed out that directly inputting PRPD maps as two-dimensional images into deep learning models helps reduce the manual feature construction process and improves the automation level of defect identification.

[0003] In typical technical approaches, early methods often relied on manual feature engineering and shallow classifiers. This involved first extracting statistical and frequency domain features from the original discharge signal or PRPD spectrum, and then using support vector machines, random forests, or shallow neural networks to complete the classification. While these methods could achieve some success in laboratory environments, under conditions of complex electromagnetic interference, multi-source discharge superposition, and changing field data distribution, manual features struggled to fully preserve the spatial topological information of the spectrum, thus limiting the model's generalization ability.

[0004] As online partial discharge monitoring (PRPD) is deployed to edge computing, models not only need high recognition accuracy but also must meet the constraints of power consumption, latency, and storage capacity imposed by field terminals. To reduce computational load, researchers have begun to employ lightweight convolutional networks. However, the discriminative information in PRPD maps is not entirely represented as continuous texture; it also includes the global phase correlation of scattered point clusters throughout the entire power frequency cycle. Pure convolutional architectures are limited by local receptive fields and typically require stacking more layers to indirectly expand the receptive field. Therefore, a trade-off remains between global relationship modeling and edge inference efficiency.

[0005] In terms of hardware deployment, for lightweight hybrid architectures like MobileViTv2, convolutional and transform network modules coexist. The computational density, memory access patterns, and on-chip cache requirements vary significantly among different operators. To achieve stable end-to-end inference on resource-constrained edge-level field-programmable gate arrays (FPGAs), further optimization is needed regarding the overall model data flow, hardware resource allocation, and hardware-software collaborative scheduling. Currently, there is no good solution that balances execution efficiency and off-chip memory access overhead. Summary of the Invention

[0006] The purpose of this application is to provide a hardware and software deployment collaborative acceleration system and method that can balance execution efficiency and off-chip memory access overhead.

[0007] To achieve the above objectives, this application provides the following solution: In a first aspect, this application provides a hardware and software deployment collaborative acceleration system, including: a processing system, programmable logic, on-chip cache, and off-chip memory; The off-chip memory is used to store the model weights, input graphs, and inter-layer results of MobileViTv2; the on-chip cache is used to store the input features, weights, and intermediate results of the current computation block; MobileViTv2 includes standard convolution, first-stage convolution, second-stage convolution, third-stage convolution, fourth-stage convolution, fifth-stage convolution, and network ends; The programmable logic includes an attention processing engine, a feedforward processing engine, and hardware acceleration IP cores; the hardware acceleration IP cores include: Conv IP, Pwdwconv IP, attn IP, and fc IP; Under the scheduling of the processing system, the Conv IP and the Pwdwconv IP perform standard convolution, first-stage convolution and second-stage convolution according to the model weights and the input graph, and write the inter-layer results to off-chip memory; the intermediate results of each layer are written to the on-chip cache. The processing system schedules and deploys the third-stage convolution, the fourth-stage convolution, and the fifth-stage convolution in a fixed order. The scheduling and deployment process for each of these stages includes: the Pwdwconv IP performing downsampling and local encoding and writing it to off-chip memory; the processing system reading the convolution output from the local encoding process from the off-chip memory and performing feature unrolling; the attn IP performing calculations for each Transformer layer, followed by feature folding and writing it to off-chip memory; the Pwdwconv IP performing pointwise convolution channel mapping; and each Transformer layer completing calculations using the attention processing engine and the feedforward processing engine based on a cross-layer interleaving pipeline scheduling mechanism. The fc IP is deployed at the network end based on the final features of the fifth-stage convolution read from off-chip memory and written to off-chip memory.

[0008] Secondly, this application provides a software and hardware deployment collaborative acceleration method, comprising: the software and hardware deployment collaborative acceleration method applying the software and hardware deployment collaborative acceleration system, the software and hardware deployment collaborative acceleration method comprising: The MobileViTv2 model weights and input graph are obtained through off-chip memory; the off-chip memory interacts with programmable logic; the programmable logic includes an attention processing engine, a feedforward processing engine, and hardware acceleration IP cores; the hardware acceleration IP cores include: Conv IP, Pwdwconv IP, attn IP, and fc IP; the MobileViTv2 includes standard convolution, first-stage convolution, second-stage convolution, third-stage convolution, fourth-stage convolution, fifth-stage convolution, and network ends; Under the scheduling of the processing system, Conv IP and Pwdwconv IP perform standard convolution, first-stage convolution and second-stage convolution according to model weights and input graph, and write the inter-layer results to off-chip memory; the intermediate results of each layer are written to on-chip cache. The processing system schedules and deploys the third-stage convolution, the fourth-stage convolution, and the fifth-stage convolution in a fixed order. The scheduling and deployment process for each of these stages includes: the Pwdwconv IP performing downsampling and local encoding and writing it to off-chip memory; the processing system reading the convolution output from the local encoding process from the off-chip memory and performing feature unrolling; after the attn IP performs calculations for each Transformer layer, the processing system performs feature folding and writes it to off-chip memory; the Pwdwconv IP performing pointwise convolution channel mapping; and each Transformer layer completing calculations using an attention processing engine and a feedforward processing engine based on a cross-layer interleaving pipeline scheduling mechanism. The fc IP deploys the network endpoints based on the final features of the fifth-stage convolution read from off-chip memory and writes them to off-chip memory.

[0009] According to the specific embodiments provided in this application, the following technical effects are disclosed: This application provides a hardware and software deployment collaborative acceleration system and method. The processing system schedules sequentially, taking turns starting Conv IP, Pwdwconv IP, attn IP, and fc IP. The same IP is time-division multiplexed in different layers and different operator segments. The intermediate results of each layer are written to the on-chip cache, and the results between layers are written to off-chip memory. Each Transformer layer completes the computation using an attention processing engine and a feedforward processing engine based on a cross-layer interleaved pipeline scheduling mechanism, thereby achieving complete MobileViTv2 inference under limited programmable logic resources, while taking into account execution efficiency and off-chip memory access overhead. Attached Figure Description

[0010] To more clearly illustrate the technical solutions in the embodiments of this application or the prior art, the drawings used in the embodiments will be briefly introduced below. Obviously, the drawings described below 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.

[0011] Figure 1 System architecture diagram for accelerating collaborative deployment of software and hardware; Figure 2 A diagram illustrating the ping-pong buffer; Figure 3 This is a schematic diagram of spatial block loading; Figure 4 This is a schematic diagram of feature map reshaping. Figure 5 This is a schematic diagram of the MobileViT Block. Figure 6 A schematic diagram of Transformer partitioning; Figure 7 This is a schematic diagram of a single-pass Transformer pipeline; Figure 8 This is a schematic diagram of a cross-level cascaded pipeline based on interleaving scheduling; Figure 9 This is a diagram of the computational architecture of the linear attention module; Figure 10 This is a single-graph reasoning flowchart; Figure 11 A schematic diagram of a collaborative acceleration system for software and hardware deployment. Detailed Implementation

[0012] The technical solutions of the embodiments of this application will be clearly and completely described below with reference to the accompanying drawings. Obviously, the described embodiments are only some embodiments of this application, and not all embodiments. Based on the embodiments of this application, all other embodiments obtained by those skilled in the art without creative effort are within the scope of protection of this application.

[0013] To balance local feature extraction and global context modeling, the MobileViT model combines convolutional neural networks with visual transformation networks. Convolutional modules extract local spatial features, while transformation network modules establish long-range dependencies. The MobileViT model demonstrates that lightweight hybrid networks can achieve both good accuracy and low model complexity in mobile vision tasks. Building on this, MobileViTv2 further employs a linearly separable self-attention mechanism, transforming the computational complexity of standard self-attention, which increases quadratically with the number of feature labels, into a linear aggregation and broadcasting process based on latent nodes, thus reducing the global modeling overhead from an algorithmic perspective. Therefore, the MobileViT model is well-suited as a foundational model for PRPD map edge recognition tasks because it can utilize convolutional modules to capture the morphological features of partial discharge point clusters and linear attention modules to establish global correlations between different phase intervals.

[0014] In terms of hardware deployment, Field-Programmable Gate Arrays (FPGAs) are widely used for accelerating neural network inference due to their reconfigurability, customizable parallelism, and low power consumption. Low-bit-width quantization, loop unrolling, data partitioning, and on-chip data reuse are common techniques to alleviate off-chip memory bandwidth pressure. These methods are relatively mature for convolutional neural networks; however, hardware deployment for MobileViT models, which include convolutional and transform network modules, still faces new challenges. Hybrid convolutional-transform network architectures such as MobileViTv2 still require special attention for hardware-friendly deployment.

[0015] Module-level acceleration solutions for MobileViT and hardware quantization for MobileViTv2 demonstrate the value of lightweight hybrid models like MobileViT for edge deployment from different perspectives. However, for lightweight hybrid architectures represented by MobileViTv2, convolutional and transform network modules coexist, and the computational density, memory access patterns, and on-chip cache requirements of different operators vary significantly. To achieve stable end-to-end inference on resource-constrained edge-level field-programmable gate arrays, further optimization is needed regarding the overall model data flow, hardware resource allocation, and hardware-software co-scheduling. Therefore, FPGA acceleration methods for lightweight hybrid vision networks still have room for further research.

[0016] The relevant technical solutions for edge-side deep learning inference can be roughly divided into three categories.

[0017] One approach is to directly execute model inference using a central processing unit (CPU) or a graphics processing unit (GPU). This solution is convenient to develop and has a mature software ecosystem, but CPUs have limited parallel multiplication-accumulation capabilities, easily leading to computational bottlenecks when dealing with neural networks intensive in convolution and matrix multiplication. While GPUs offer strong parallel computing capabilities, they typically consume more power and require sophisticated heat dissipation and power supply conditions. For industrial edge scenarios such as substations that operate long-term, unattended, and have limited power and heat dissipation, these general-purpose platforms struggle to simultaneously meet the requirements of low power consumption and real-time performance.

[0018] Second, FPGA accelerators designed for convolutional neural networks are employed. These accelerators typically design parallel multiply-accumulate arrays around standard or lightweight convolutions and improve data reuse through loop unrolling, data chunking, and ping-pong caching. However, their drawback lies in the fact that the MobileViTv2 model includes not only convolution operators but also transform network operators such as linear attention and feedforward networks. If the MobileViTv2 model is deployed solely according to the data flow of a traditional convolutional accelerator, the global aggregation and broadcasting processes in the linear attention module cannot be effectively piped, and intermediate features still need to be frequently written back to off-chip memory, thus limiting the overall system performance.

[0019] Third, FPGA accelerators designed for standard visual transformation networks are employed. Such solutions typically design systolic arrays or fully pipelined architectures for large-scale matrix multiplication in standard self-attention. However, the linear attention module in the MobileViTv2 model does not perform the two-dimensional attention graph computation of standard attention; instead, it adopts a linearly separable computational form of "aggregation first, then broadcasting." The main bottleneck of this computational form is not simply large-scale matrix multiplication, but rather the sequential dependencies brought about by global context vector generation, the scheduling relationships between block tasks, and the memory access pressure of intermediate features. Therefore, directly applying standard visual transformation network accelerators makes it difficult to fully utilize the linear attention structure characteristics of the MobileViTv2 model itself.

[0020] Current publicly available research primarily focuses on FPGA acceleration of convolutional neural networks or standard visual transformation networks. For lightweight hybrid networks like MobileViTv2, which integrate convolutional and linear attention structures, there is a lack of collaborative deployment solutions tailored to their structural characteristics. In summary, existing convolutional neural network acceleration solutions and visual transformation network acceleration solutions may have the following shortcomings when deployed on MobileViTv2 models: There is a lack of a unified deployment architecture for the MobileViTv2 hybrid network structure. The computation modes of convolutional modules and transform network modules differ significantly, and using a single general-purpose computing array can easily lead to uneven utilization of hardware resources.

[0021] Standard convolution, depthwise convolution, and pointwise convolution have different memory access and computation characteristics. If a unified data flow is used for deployment, some computing units may become idle, reducing the system throughput.

[0022] Linear attention modules have a sequential dependency of "aggregation first, broadcast later". When the previous global context has not been completed, the subsequent feature modulation is difficult to start, which can easily cause pipeline waiting.

[0023] When a multi-layer transformation network is executed serially, if each layer needs to write all intermediate results back to off-chip storage, it will increase the number of DDR accesses, resulting in increased memory access bandwidth pressure and inference latency.

[0024] To address the problems of existing FPGA neural network acceleration methods when applied to MobileViTv2 models, such as difficulty in unifying and efficiently mapping convolution and linear attention operators, limited on-chip storage resources, sequential dependence of linear attention modules leading to decreased pipeline efficiency, and frequent access to off-chip storage for intermediate results between layers, this application proposes a hardware and software deployment collaborative acceleration system and method for MobileViTv2 models to improve the inference efficiency and hardware resource utilization of the model on edge platforms.

[0025] This application aims to address the following technical issues: This addresses the problem that the complex structure of convolution operators in the MobileViTv2 model and the significant differences in computation and memory access characteristics among different types of convolution make it difficult for existing FPGA acceleration methods to be efficiently adapted.

[0026] This addresses the problem that the global context dependency of the linear attention module makes it difficult to achieve continuous pipelined execution of the computation process.

[0027] This addresses the issues of a large number of intermediate results, high pressure on on-chip cache, and frequent access to off-chip storage during feature processing in the Transformer module.

[0028] This addresses the challenge of balancing computing performance, resource utilization, and power consumption in edge FPGA deployments.

[0029] To make the above-mentioned objectives, features and advantages of this application more apparent and understandable, the application will be further described in detail below with reference to the accompanying drawings and specific embodiments.

[0030] 1. MobileViTv2: The second-generation MobileViT model, which uses a linearly separable self-attention mechanism to reduce the computational complexity of global modeling.

[0031] 2. FPGA: Field Programmable Gate Array, is a semi-custom hardware platform that allows internal computing circuitry to be reconfigured through hardware description or high-level synthesis.

[0032] 3. Transformer: A neural network structure that uses an attention mechanism to model global dependencies.

[0033] 4. Linear Attention: Linear attention, also known as linearly separable self-attention, is a global feature interaction module in MobileViTv2 used to reduce the computational complexity of attention. In this paper, it is referred to as the "linear attention module".

[0034] 5. PRPD map: Phase-resolved partial discharge map is a two-dimensional map formed by statistically analyzing the phase, amplitude, and repetition count of discharge pulses with reference to the power frequency cycle.

[0035] 6. HLS: High-level synthesis is a development methodology that transforms algorithms described in high-level languages ​​into register-transfer level hardware circuits.

[0036] 7. PS: Processing System, refers to the processor side of a heterogeneous on-chip system responsible for control, scheduling, and some data rearrangement tasks.

[0037] 8. PL: Programmable Logic, refers to the hardware side of a heterogeneous on-chip system, which consists of field-programmable gate array logic resources and is used to perform the main parallel computing tasks.

[0038] In one exemplary embodiment, such as Figure 11 As shown, a hardware and software deployment collaborative acceleration system is provided, including: a processing system, programmable logic, on-chip cache, and off-chip memory.

[0039] The off-chip memory is used to store the model weights, input graphs, and inter-layer results of MobileViTv2; the on-chip cache is used to store the input features, weights, and intermediate results of the current computation block; MobileViTv2 includes standard convolution, first-stage convolution, second-stage convolution, third-stage convolution, fourth-stage convolution, fifth-stage convolution, and network ends.

[0040] The programmable logic includes an attention processing engine, a feedforward processing engine, and hardware acceleration IP cores; the hardware acceleration IP cores include: Conv IP, Pwdwconv IP, attn IP, and fc IP.

[0041] Under the scheduling of the processing system, the Conv IP and the Pwdwconv IP perform standard convolution, first-stage convolution and second-stage convolution according to the model weights and the input graph, and write the inter-layer results to off-chip memory; the intermediate results of each layer are written to the on-chip cache.

[0042] The processing system schedules and deploys the third-stage convolution, the fourth-stage convolution, and the fifth-stage convolution in a fixed order. The scheduling and deployment process for each of these stages includes: the Pwdwconv IP performing downsampling and local encoding and writing it to off-chip memory; the processing system reading the convolution output from the local encoding process from the off-chip memory and performing feature unrolling; the attn IP performing calculations for each Transformer layer, followed by feature folding and writing it to off-chip memory; the Pwdwconv IP performing pointwise convolution channel mapping; and each Transformer layer completing calculations using the attention processing engine and the feedforward processing engine based on a cross-layer interleaving pipeline scheduling mechanism.

[0043] The fc IP is deployed at the network end based on the final features of the fifth-stage convolution read from off-chip memory and written to off-chip memory.

[0044] In an exemplary embodiment, the Pwdwconv IP performs downsampling and local encoding and writes the results to off-chip memory, specifically including: the Pwdwconv IP performs downsampling according to the output of the previous stage in the order of pointwise convolution, depthwise convolution and pointwise convolution and writes the downsampling results to off-chip memory; the Pwdwconv IP performs local encoding according to the downsampling results in the order of depthwise convolution and pointwise convolution and writes the local encoding results to off-chip memory.

[0045] In an exemplary embodiment, the processing system reads the convolution output of the local encoding process from the off-chip memory and performs feature unrolling, specifically including: the processing system reads the convolution output of the local encoding process and divides the image into blocks; the processing system groups the image blocks according to their relative positions within the blocks and segments them to obtain computational sub-blocks.

[0046] In one exemplary embodiment, such as Figure 2As shown, the on-chip cache includes a ping-pong cache; both the attention processing engine and the feedforward processing engine are configured with two sets of the ping-pong cache; each set of the ping-pong cache holds the feature data of a computational sub-block; the computation process of the Transformer layer includes: using the computational sub-block of the first execution group from off-chip memory as input to the first-layer attention processing engine; the attention processing engine performs a first-layer normalization on the current computational sub-block and stores the current computational sub-block and the normalized data in the ping-pong cache on the attention processing engine side; the attention processing engine performs three-way projection using a matrix multiplication array based on the normalized data to obtain the current computational sub-block to be processed; starting from the second-layer attention processing engine, the input of the current-layer attention processing engine is obtained through the ping-pong cache on the feedforward processing engine side of the previous layer; the feedforward processing engine reads the current computational sub-block to be processed through the ping-pong cache on the attention processing engine side, performs a second-layer normalization, and writes the current computational sub-block to be processed and the normalized current computational sub-block to be processed into the ping-pong cache on the feedforward processing engine side.

[0047] In practical applications, the residual fusion process in the attention processing engine specifically includes: The attention processing engine performs Softmax on the projection results of the I-path (one of the three projection paths) to obtain attention weights, and stores these attention weights in the ping-pong buffer on the attention processing engine side. The three projection paths include I-path projection, K-path projection, and V-path projection. The attention processing engine weights and accumulates the K-path features according to the attention weights to generate a global context vector. The attention processing engine performs output projection based on the global context vector and adds it to the normalized data to obtain the first residual fusion result, which is then written into the ping-pong buffer on the attention processing engine side.

[0048] In practical applications, the residual fusion process in the feedforward processing engine specifically includes: the feedforward processing engine completes feedforward dimensionality increase and Leaky ReLUctant activation through a matrix multiplication array, and the dimensionality increase result and activation result are stored in the ping-pong cache on the feedforward processing engine side; the feedforward processing engine completes dimensionality reduction through a matrix multiplication array and adds it to the current computational sub-block to be processed to obtain the second residual fusion result; the feedforward processing engine performs layer normalization on the second residual fusion result and writes it into the ping-pong cache on the feedforward processing engine side.

[0049] The programmable logic interacts with the off-chip memory via an AXI bus. The programmable logic in this application is an FPGA. The deployed MobileViTv2 is used for partial discharge detection. The MobileViTv2 performs channel pruning through structured channel pruning.

[0050] In another exemplary embodiment, the specific implementation of the hardware and software deployment collaborative acceleration system is provided. The deployment target is a lightweight MobileViTv2 model that has undergone structured channel pruning and 16-bit fixed-point quantization. Specifically, structured channel pruning reduces redundant network channels, decreasing network parameter size and computational complexity while maintaining model accuracy. This reduces the model parameter size from 9.96 MB to 5.68 MB. Further, using 16-bit fixed-point quantization further compresses the model storage size to 2.84 MB, providing a foundation for efficient deployment in FPGA-restricted environments.

[0051] like Figure 1 As shown, this system is based on the collaborative operation of the Processing System (PS) and Programmable Logic (PL). Hardware partitioning is based on the different computational characteristics of the convolutional and linear attention modules in the MobileViTv2 model: the PS is mainly responsible for model hierarchical scheduling, computational unit configuration, and address rearrangement tasks such as feature unrolling and feature folding; the PL is mainly responsible for computational tasks such as convolution, linear attention, feedforward networks, global pooling, and classification; off-chip memory is used to store model weights, input graphs, and inter-layer results, while on-chip cache is used to temporarily store the input features, weights, and intermediate results of the current block during critical computational stages. The Processing System (PS) includes an ARM processor (Advanced RISC Machine). Figure 1 In this architecture, W_BRAM is the weight buffer block memory, F_BRAM is the feature map buffer block memory, and F_URAM is the feature map cache ultra-large-scale memory. Shortcut is the residual skip connection module, Pwdwconv is the depthwise separable convolution module, Conv is the standard convolution, Fc_pool is the fully connected-pooling combination module, and Linear_attn is the linear attention module. AXI and AXI-Lite are both high-level scalable interfaces. DDR stands for Double Data Rate, and BRAM and URAM are both memory types.

[0052] The architecture of the MobileViTv2 model is shown in Table 1.

[0053] Table 1. Overall Network Architecture of MobileViTV2

[0054] Standard convolutional module deployment scheme.

[0055] The standard convolutional module is responsible for the first-layer feature extraction of the network, mapping the input map to a downsampled multi-channel feature map. This module adopts a data path of off-chip memory access—on-chip block-level computation—off-chip write-back: After the processing system sends the layer parameters, the programmable logic reads the input receptive field and weights required for the output sub-block of the currently executed convolutional layer from external memory via the AXI bus according to a spatial block partitioning strategy, such as... Figure 1 To mask external memory access latency, the module is equipped with multiple ping-pong caches at both the input and output ends. This allows the prefetching of the next block of data, the convolution calculation of the current block, and the write-back of the result from the previous block to overlap in time, forming a task-level pipeline. This significantly reduces the limitation of memory bandwidth on the throughput of the computing array. Figure 3 .

[0056] At the underlying computing core, the module constructs an array of Processing Elements (PEs) primarily based on parallel output channels. The hardware employs a data broadcasting mechanism, synchronously broadcasting the same input pixel to multiple parallel processing units. Each unit, under a unified clock schedule, synchronously completes multiply-accumulate operations within its local convolutional kernel and cross-channel accumulation operations. This architectural design enables the standard convolution module to achieve extremely high on-chip input data reuse and stable throughput within limited Digital Signal Processor (DSP) and Block Random Access Memory (BRAM) resources. It efficiently completes the initial downsampling and channel expansion of the PRPD map and provides continuous feature input for subsequent modules.

[0057] Deployment scheme for deeply separable modules.

[0058] As shown in Table 1, the inverse residual structure in MobileViTv2 appears multiple times in the first-stage convolution to the fifth-stage convolution (Layer 1 to Layer 5), with each layer executing in the order of pointwise convolution (PW) → depthwise convolution (DW) → pointwise convolution (PW). If the top-level IP is instantiated separately for PW and DW, the number of AXI interfaces and inter-layer scheduling overhead will increase significantly. Therefore, this application constructs a unified depthwise separable convolution computation engine: externally sharing a single AXI interface and control logic, internally switching between PW and DW modes via a mode state machine, and configuring independent data paths and computation arrays for each type of operator.

[0059] In terms of acceleration strategies, PW and DW are optimized according to their respective computational bottleneck types. PW is essentially a 1×1 cross-channel dense multiply-accumulate operator, belonging to the computationally constrained operator category. To address this, the engine adopts a strategy of multi-channel data packetization for input channels and multi-dimensional bidirectional parallelism for output channels, and configures dual-port weight reading and on-chip ping-pong caching to ensure that the weight data supply and the underlying multiply-accumulate (MAC) calculation highly overlap in time, masking memory access latency. DW, due to independent computation for each channel, belongs to the memory-sensitive operator category. To address this, the engine employs multi-channel parallel processing, combined with a feature map space partitioning mechanism and multi-channel burst transmission packetization technology based on the system bus width, to maximize the bandwidth utilization of off-chip memory. This unified engine covers multiple inverse residual repetitive structures in the network, ensuring that both PW and DW obtain parallelism and memory access acceleration capabilities commensurate with their computational characteristics while controlling resource overhead.

[0060] Global pooling and fully connected module deployment scheme.

[0061] The computational cost at the network's end is relatively small, but it directly determines the final classification result of the PRPD graph. This application fuses Global Average Pooling (GAP) and Fully Connected (FC) operators at the hardware level, integrating them into the same programmable logic module.

[0062] In terms of acceleration and scheduling mechanisms: During the GAP stage, all spatial pixels within each feature channel are reduced in parallel using a multi-level addition tree within the on-chip cache. The reduction result is directly fed into the subsequent FC multiply-accumulate array via on-chip registers, achieving seamless connection between operators and completely avoiding the overhead of writing intermediate features back to external memory (such as Double Data Rate, DDR). During the FC stage, matrix-vector multiplication is organized into blocks according to the input channels, and a double-buffering mechanism allows the underlying multiply-accumulate array to pre-fetch the features and weights of the next block while calculating the current channel block, masking memory access latency. Finally, the classification score is written back to external memory, and the processing system executes Argmax to output the partial discharge defect category.

[0063] This module is located after all the convolution and Transformer calculations are completed. It is the final link in the feature extraction chain leading to the classification output. Through the above operator fusion and pipeline mechanism, spatial dimension elimination and category mapping are efficiently completed while maintaining low resource consumption.

[0064] Deployment scheme for linear attention module.

[0065] (1) Deployment objects and computation blocks.

[0066] The linear attention module is the focus of this application. Before the Transformer computation, the input graph (size C×H×W) is unfolded (feature expansion) and rearranged into a P×N×C sequence tensor (see...). Figure 4 The input map is a feature map. First, the feature map is divided into N h×w image patches. Then, it is grouped according to the relative position within each patch – pixels with the same position in all patches are grouped together, for a total of P=h×w groups. Each group contains N tokens (each token has C channels), forming a sequence of length N. Here, N is the total number of image patches obtained after spatial partitioning of the feature map, N=H×W / (h×w); P is the number of pixels in each image patch, P=h×w. h is the height of a single image patch, w is the width of a single image patch, W is the width of the input feature map, and H is the height of the input feature map. The token is the smallest basic computational unit constituting the sequence in the Transformer model; in the original natural language model, the token is the word segmentation unit, and in the Visual Transformer (ViT), the token corresponds to the local pixel / local feature unit after image segmentation, and is the basic processing object for attention computation.

[0067] This application partitions the aforementioned tensor along the P-dimensional axis to obtain P sub-tensors, each called a computational block (BP). A BP represents a complete sequence of tokens at a relative position, with a data size of N×C. Figure 4 For example, when N=4 and P=4, orange is BP0 (top left corner of each block), blue is BP1 (top right corner), green is BP2, and purple is BP3; Figure 4 Each row in the middle corresponds to a BP. BP0 is the computation block labeled 0, BP1 is the computation block labeled 1, BP2 is the computation block labeled 2, and BP3 is the computation block labeled 3.

[0068] Attention calculations between different Backpropagators (BPs) are independent and can be scheduled separately. Within the same BP, context aggregation of N tokens must be completed first, followed by element-wise modulation of the Value branch, exhibiting a "aggregate first, broadcast later" sequential dependency. Therefore, this application uses the BP as the basic unit for hardware scheduling in the Transformer layer, processing one BP at a time. After all P BPs have been processed, they are then restored to a C×H×W feature map via Fold, as shown below. Figure 5 .

[0069] (2) The basis for the division between ARE and FRE.

[0070] A standard Transformer Block contains two residual connections, one after the attention module and the other after the feedforward network. For example... Figure 6As shown, to reduce intermediate data storage overhead and improve hardware resource utilization, this application divides a single-layer Transformer into two functional modules, namely the Attention Runtime Engine (ARE) and the Feedforward Runtime Engine (FRE), using residual connections as boundaries. ARE: Completes the first layer normalization (LN1), linear attention calculation, and the first residual connection.

[0071] FRE: Completes the second layer normalization (LN2), feedforward network dimension-up matrix multiplication, dimension-down matrix multiplication, and the second residual connection.

[0072] This division method has the following advantages: 1. The two residual connections are completed within the corresponding computing engines. The input features can be accumulated in the local cache, without the need to establish an additional global residual storage space.

[0073] 2. Only a single BP intermediate result needs to be passed between ARE and FRE, avoiding the need to configure on-chip cache according to the scale of the entire layer feature map.

[0074] (3) The composition of a single-layer task-level pipeline.

[0075] Within a single-layer Transformer, the execution of FRE depends on the output of ARE, thus there is a natural sequential relationship between the two. For example... Figure 7 As shown, if the serial execution method is used, the FRE is idle during the ARE calculation, resulting in reduced hardware utilization.

[0076] To address this issue, this application constructs a dual-engine task-level pipeline architecture on the PL side and configures four sets of BRAM ping-pong caches: ARE corresponds to caches A0 and A1; FRE corresponds to caches B0 and B1. A0, A1, B0, and B1 are all dual-cache labels.

[0077] Each cache can hold the feature data of one Backpropagation Path (BP). During scheduling, when the ARE performs attention calculation on the current BP, the FRE can simultaneously process the feedforward calculation of the previous BP. After the current calculation cycle ends, data handover is completed through ping-pong cache switching, thus forming a dual-engine pipelined execution mechanism with BP as the granularity. In this way, different BPs alternate between ARE and FRE, achieving time overlap between the attention path and the feedforward path, improving the hardware utilization and throughput of a single-layer Transformer.

[0078] (4) Interwoven water flow across layers.

[0079] When using only a single-layer task-level pipeline, each Transformer layer still needs to wait for all backpropagation (BP) operations in the previous layer to complete before starting the next layer's computation, resulting in inter-layer backflow. Additionally, intermediate results need to be frequently written back to DDR and reread, increasing memory access overhead.

[0080] To further improve overall execution efficiency, this application proposes a cross-layer interleaved pipeline scheduling mechanism based on BP grouping, such as... Figure 8 As shown. In the MobileViTv2 network, the number of BPs is fixed at 4. Therefore, this application divides the 4 BPs into two execution groups: BP0 and BP1 form the first group, and BP2 and BP3 form the second group, which are interleaved and scheduled separately. Each group contains 2 BPs, which can correspond one-to-one with the two on-chip ping-pong buffers.

[0081] Once an execution group completes the FRE computation for its current layer, its output is stored in the on-chip cache of the FRE layer, without needing to be written back to DDR. The scheduler then directly uses this result as input to the next Transformer layer and immediately starts the next layer's ARE computation. Therefore, the same execution group can continuously traverse multiple Transformer layers from 0 to N, until the final layer's computation is completed, at which point the results are uniformly written back to external DDR memory. This mechanism allows the Backpropagation (BP) mechanism within an execution group to advance continuously across multiple Transformer layers, achieving inter-layer computational overlap and on-chip resident intermediate results, reducing DDR read / write operations, thereby reducing inter-layer latency and memory access latency, and improving overall computational throughput.

[0082] (5) Matrix multiplication reuse and operator fusion.

[0083] Multi-path linear projections within ARE and FRE, as well as dimensionality increases / decreases in FFN, all involve dense matrix multiplication. For example... Figure 9 As shown, this application configures a reusable general matrix multiplication systolic array (GEMM) in each of the two engines. The control state machine schedules the data streams I, K, V, OutProj, and FFN1 and FFN2 in a time-sharing manner, avoiding the independent DSP usage for each matrix multiplication. Furthermore, to further avoid data transfer, context aggregation, element-wise modulation, and residual addition are directly fused to the GEMM output. I: Input; K: Key; V: Value; OutProj: OutputProjection; FFN stands for Feed Forward Network; FFN1: First layer of the feed forward network, a linear layer of increased dimensionality; FFN2: Second layer of the feed forward network, a linear layer of decreased dimensionality.

[0084] (6) Overall execution process.

[0085] This application divides a single-layer Transformer into an Attention and Residual Fusion Engine (ARE) and a Feedforward and Residual Fusion Engine (FRE). Both the ARE and FRE sides are configured with two storage slots, Cache 0 and Cache 1, each slot holding the data for one Backpropagation Buffer (BP). The two slots coordinate in a ping-pong manner: when the ARE writes the result of the current BP to one slot, the FRE can read the previous BP (or the BP that was written in the previous cycle) from the other ready slot and perform feedforward calculations, allowing the ARE and FRE to overlap in execution on the time axis, rather than strictly waiting sequentially. In MobileViTv2, P is always 4. This application assigns BP0 and BP1 to the first execution group and BP2 and BP3 to the second execution group, implementing cross-layer interleaving scheduling by group.

[0086] like Figure 9 As shown in the microarchitecture, the system loads BP0 and BP1 of the first execution group from external storage (DDR) as inputs to the first-level ARE. From the second level onwards, the inputs to the current-level ARE are directly provided by the on-chip cache of the previous-level FRE, without needing to write intermediate results back to DDR first. Regardless of whether the input comes from DDR or FRE cache, the ARE first performs the first-level normalization (LN1) on the current BP and retains a copy of the original input locally for subsequent residual addition. The normalized data is written to the working cache on the ARE side and then sent to the matrix multiplication array (GEMM) to complete the I, K, and V projections in sequence. The three projections share the same set of multiplication hardware and are scheduled sequentially by the control logic.

[0087] ARE Phase 1: Softmax is applied to the projection results of each token in the I-path to obtain attention weights, which are then temporarily stored in the ARE's on-chip cache. Phase 2: The weights obtained in Phase 1 are used to weight and accumulate the K-path features to generate a global context vector. Phase 3: The global context vector is element-wise multiplied with the V-path features to complete feature modulation. Phase 4: The output projection of the result from Phase 3 is performed and added to the original input retained at the beginning of the phase to complete the first residual fusion. The output of Phase 4 is written to the ARE-side cache.

[0088] After FRE reads the BP to be processed from the ARE cache, it first performs a second layer normalization (LN2) and retains a copy of the input for residual addition. FRE Stage 1: Feedforward dimensionality increase and Leaky ReLU activation are completed through GEMM, and the result is temporarily stored in the FRE on-chip cache. FRE Stage 2: Dimensionality reduction is completed through GEMM, and the result is added to the retained input to complete the second residual fusion; after final layer normalization, it is written to the FRE-side cache for subsequent scheduling in this layer or reading by the next layer ARE.

[0089] Taking BP0 first and BP1 last as an example to illustrate ping-pong and interleaving: After ARE writes the result of BP0 into ARE Cache 0, FRE reads BP0 from ARE Cache 0; at the same time, ARE continues to process BP1 and writes the result into ARE Cache 1, realizing the parallel overlap of ARE and FRE. After FRE completes the feedforward calculation of BP0, it writes the result into FRE Cache 0; then it reads BP1 from ARE Cache 1 to continue processing and writes the result of BP1 into FRE Cache 1. When BP0 and BP1 of the first layer have been processed by FRE, the next layer ARE can directly read BP0 and BP1 from FRE Cache 0 and FRE Cache 1 respectively as input, and pass through the subsequent Transformers in sequence; during this process, intermediate results are passed between the on-chip caches of FRE and ARE, and are only written back to DDR by the last layer FRE after the entire group has completed all layer processing. Subsequently, the system loads the second execution group BP2 and BP3, repeating the above ping-pong and cross-layer interleaving process.

[0090] In summary, interleaved scheduling has two meanings: First, ARE and FRE achieve parallelism of tasks at the same level by using dual-slot ping-pong; second, when the BP of the same execution group passes through all Transformer layers, intermediate results are transferred locally between the FRE and ARE caches, reducing DDR read / write and inter-layer waiting.

[0091] The scheduling process of the overall architecture of MobilevitV2.

[0092] This application implements MobileViTv2 inference acceleration based on the Zynq heterogeneous platform: the ARM processor on the PS side is responsible for global task scheduling and start / stop control of each hardware IP; the FPGA on the PL side is responsible for core calculations such as convolution, linear attention, pooling and classification; model weights, input images and inter-layer intermediate results are all stored in off-chip DDR, and each computing unit interacts with DDR through the AXI bus.

[0093] (1) Reasoning initiation.

[0094] like Figure 11 After the system powers on, the ARM completes driver initialization, loading the model weights and the image to be inferred from the SD card to the DDR. At the start of a single inference, the ARM, according to the network layer order, sequentially sends the input address, output address, weight offset, and layer parameters of the current layer to each computation IP of the PL via AXI-Lite, triggering hardware startup. After the PL completes the computation of the current layer, it returns a completion signal to the ARM, which then starts the next layer. The output address of the previous layer becomes the input address of the next layer, thus achieving inter-layer connectivity. The overall execution follows the principle of control flow driving data flow.

[0095] (2) Operator time-sharing reuse mechanism.

[0096] Due to the limitations of on-chip resources on the FPGA, this application deploys a set of hardware acceleration IP cores for each type of operator on the PL side, and adopts a time-sharing operator inference method to perform network inference. That is, the same IP core is called by the ARM in turn in different network layers and different stages, rather than instantiating hardware separately for each layer. The top layer mainly includes: Conv IP (standard convolution in the first layer), Pwdwconv IP (all pointwise convolutions PW and depthwise convolutions DW), attn IP (all linear attention (Linear Attention, Linear Attn) and FFN), and fc IP (global average pooling and fully connected classification). After configuring the input address, output address, weight offset and layer parameters for the current task, the ARM starts the corresponding IP. After the calculation is completed and written back to DDR, the parameters are switched to start the next task. Since each IP is occupied in turn in time, except for cross-layer transfer within the Transformer segment group, most intermediate results between layers are connected through DDR.

[0097] like Figure 10 As shown, a single inference is performed by the ARM according to the network topology, and the overall process follows the control flow-driven and data flow-following principle: the output address of the previous operator is the input address of the next operator.

[0098] (3) Scheduling process according to network phase.

[0099] The pruned MobileViTv2-0.75 goes through four stages in sequence: standard convolution Stem, first-stage convolution Layer1 to second-stage convolution Layer2, third-stage convolution Layer3 to fourth-stage convolution Layer5, and network end Tail, as shown in Table 1.

[0100] i.Stem and Layer1 to Layer2.

[0101] The standard convolution in the Stem layer is performed by the Conv IP: it reads the input image and weights from the DDR (Data Residual Processing Unit), performs the computation, and writes it back to the DDR. The inverse residual modules (PW→DW→PW) of Layer 1 and Layer 2 are both performed by the Pwdwconv IP. Internally, the Pwdwconv IP performs PW and DW operations on the same hardware in a time-sharing manner through mode switching. The scheduling method involves the ARM processor sending parameters layer by layer and starting the Pwdwconv IP. This IP reads features and weights from the DDR, and on-chip double buffering ping-pong ensures that loading and computation overlap. After the result is written back to the DDR, the ARM processor starts the next layer. This stage does not involve Transformer or Backpropagation (BP) partitioning.

[0102] ii.Layer3~Layer5.

[0103] Layer 3, Layer 4, and Layer 5 each contain four steps, which are scheduled by ARM in a fixed order: The first step is that the Pwdwconv IP performs PW→DW→PW downsampling, with input and output transmitted via DDR. The second step is that the Pwdwconv IP performs DW→PW local encoding, also transmitted via DDR. The fourth step is that the Pwdwconv IP performs PW channel mapping, transmitted via DDR.

[0104] The third step involves Linear Attn and FFN, executed by the attn IP, with data rearrangement performed before and after by the PS. Before entering the attn IP, the PS reads the output of the second-step convolution from DDR and performs feature unfolding, rearranging the C×H×W feature map into a P×N×C sequence in 2×2 image blocks (in MobileViTv2, P is always 4, and N is the total number of image blocks in the current layer, varying with the feature map size). After the attn IP has completed all Transformer sublayers, the PS performs feature folding, restoring the sequence to a C×H×W feature map and writing it back to DDR. Then, the Pwdwconv IP performs the fourth step, PW. Unfolding / Folding is handled by the PS to avoid occupying a large amount of on-chip cache for address rearrangement at the PL. Since the PL itself uses operator multiplexing, intermediate results need to be transferred via DDR, so the rearrangement and core computation are separated.

[0105] Layer 3 contains 2 Transformer sublayers, Layer 4 contains 4, and Layer 5 contains 3, all of which call the same attn IP to complete the process in a time-sharing manner.

[0106] iii.Tail.

[0107] At the network end, the fc IP reads the final Layer5 features from DDR, performs global average pooling and fully connected classification on-chip, and writes the predicted scores back to DDR; the ARM reads and takes the maximum value to output the category.

[0108] The overall network scheduling can be summarized as follows: ARM sequentially starts four IPs—Conv, Pwdwconv, attn, and fc—in the order Stem→Layer1~5→Tail. The same IP is time-multiplexed across different layers and different operator segments. Convolution and tailing employ DDR buffering plus on-chip double-buffered ping-pong. Unfold / Fold in the MobileViT Block is performed by the PS, while Linear Attn and FFN are performed by the attn IP using BP as the granularity, ARE / FRE double-buffered ping-pong, and two sets of cross-sublayer interleaving, BP0 / BP1 and BP2 / BP3. This achieves complete MobileViTv2 inference with limited FPGA resources, while balancing execution efficiency and off-chip memory access overhead.

[0109] This application enables end-to-end inference of a pruned and quantized int16 precision MobileViTv2 model on an edge-level FPGA platform. Taking the experimental results on the Xilinx Zynq UltraScale+XCZU7EV platform as an example, the system achieves a single-graph inference latency of 44.99 ms, a throughput of 22.23 FPS, and a total power consumption of 7.84 W at a working frequency of 175 MHz. This demonstrates that the hardware-software co-engineering architecture can support the actual operation of lightweight hybrid models containing convolutional and transform network modules, rather than simply accelerating a single operator or module.

[0110] This application constructs a PS-PL collaborative deployment architecture for MobileViTv2 models. The PS side is responsible for control scheduling, parameter configuration, and feature rearrangement, while the PL side undertakes the main computational tasks such as convolution, linear attention, and classification. Collaborative inference is achieved through a control bus and a data bus, improving overall computational efficiency while ensuring system flexibility. Differentiated hardware mapping methods are designed to address the computational characteristics of different types of convolution operators in the MobileViTv2 network. Standard convolution, depthwise convolution, and pointwise convolution correspond to different parallel computing structures, and the data access process is optimized by combining ping-pong caching and data packing mechanisms, thereby improving convolution computation throughput and memory access efficiency. For the MobileViTv2 linear attention module, a fusion microcomputing architecture is proposed. This architecture uses computational blocks as the basic processing unit, pipelines and fuses linear attention, feedforward networks, and residual connections, and combines cross-layer interleaving scheduling and matrix array reuse mechanisms to achieve efficient hardware deployment of the linear attention module.

[0111] This application addresses the MobileViTv2 linear attention module, proposing a hardware deployment method based on computational block residency and interlayer interleaving pipeline. Leveraging the relatively independent nature of different image blocks in MobileViTv2 linear attention, this application divides features into multiple computational blocks (BPs), retaining only the current block for computation in the on-chip cache. Simultaneously, it employs an interleaving pipeline mechanism, allowing completed computational blocks to directly proceed to the next layer without waiting for the entire layer to finish. Compared to traditional convolutional or visual Transformer acceleration schemes, this application significantly reduces off-chip memory access overhead and interlayer pipeline waiting in FPGA deployment, improving MobileViTv2 model inference efficiency and hardware resource utilization.

[0112] Based on the same inventive concept, this application also provides a method for implementing the aforementioned software and hardware deployment collaborative acceleration system. The solution provided by this method is similar to the implementation scheme described in the above system. Therefore, the specific limitations in one or more embodiments of the software and hardware deployment collaborative acceleration method provided below can be found in the limitations of the software and hardware deployment collaborative acceleration system described above, and will not be repeated here.

[0113] In one exemplary embodiment, a software and hardware deployment collaborative acceleration method is provided, wherein the software and hardware deployment collaborative acceleration method applies the aforementioned software and hardware deployment collaborative acceleration system, and the software and hardware deployment collaborative acceleration method includes: The MobileViTv2 model weights and input graph are obtained through off-chip memory; the off-chip memory interacts with programmable logic; the programmable logic includes an attention processing engine, a feedforward processing engine, and hardware acceleration IP cores; the hardware acceleration IP cores include: Conv IP, Pwdwconv IP, attn IP, and fc IP; the MobileViTv2 includes standard convolution, first-stage convolution, second-stage convolution, third-stage convolution, fourth-stage convolution, fifth-stage convolution, and network ends.

[0114] Under the scheduling of the processing system, Conv IP and Pwdwconv IP perform standard convolution, first-stage convolution and second-stage convolution according to model weights and input graph, and write the inter-layer results to off-chip memory; the intermediate results of each layer are written to on-chip cache.

[0115] The processing system schedules and deploys the third-stage convolution, the fourth-stage convolution, and the fifth-stage convolution in a fixed order. The scheduling and deployment process for each of these stages includes: the Pwdwconv IP performing downsampling and local encoding and writing it to off-chip memory; the processing system reading the convolution output from the local encoding process from the off-chip memory and performing feature unrolling; after the attn IP performs calculations for each Transformer layer, the processing system performs feature folding and writes it to off-chip memory; the Pwdwconv IP performing pointwise convolution channel mapping; and each Transformer layer completing calculations using an attention processing engine and a feedforward processing engine based on a cross-layer interleaving pipeline scheduling mechanism.

[0116] The fc IP deploys the network endpoints based on the final features of the fifth-stage convolution read from off-chip memory and writes them to off-chip memory.

[0117] In an exemplary embodiment, a hardware and software deployment collaborative acceleration method is provided for single-graph inference in practical applications. The ARM initiates a data transfer command to transfer weights and image data from the SD to the DDR. The ARM issues calculation instructions, the PL module performs calculations, the results are written back to the DDR, and the ARM reads the results.

[0118] The technical features of the above embodiments can be combined in any way. For the sake of brevity, not all possible combinations of the technical features in the above embodiments are described. However, as long as there is no contradiction in the combination of these technical features, they should be considered to be within the scope of this specification.

[0119] This document uses specific examples to illustrate the principles and implementation methods of this application. The descriptions of the above embodiments are only for the purpose of helping to understand the methods and core ideas of this application. Furthermore, those skilled in the art will recognize that, based on the ideas of this application, there will be changes in the specific implementation methods and application scope. Therefore, the content of this specification should not be construed as a limitation of this application.

Claims

1. A hardware and software deployment collaborative acceleration system, characterized in that, include: Processing system, programmable logic, on-chip cache, and off-chip memory; The off-chip memory is used to store the MobileViTv2 model weights, input graphs, and inter-layer results; The on-chip cache is used to store the input features, weights, and intermediate results of the current computation block; the MobileViTv2 includes standard convolution, first-stage convolution, second-stage convolution, third-stage convolution, fourth-stage convolution, fifth-stage convolution, and network ends; The programmable logic includes an attention processing engine, a feedforward processing engine, and a hardware acceleration IP core; The hardware acceleration IP cores include: Conv IP, Pwdwconv IP, attn IP, and fc IP; Under the scheduling of the processing system, the Conv IP and the Pwdwconv IP perform standard convolution, first-stage convolution and second-stage convolution according to the model weights and the input graph, and write the inter-layer results to off-chip memory; the intermediate results of each layer are written to the on-chip cache. The processing system schedules and deploys the third-stage convolution, the fourth-stage convolution, and the fifth-stage convolution in a fixed order. The scheduling and deployment process for each of these stages includes: the Pwdwconv IP performing downsampling and local encoding and writing it to off-chip memory; the processing system reading the convolution output from the local encoding process from the off-chip memory and performing feature unrolling; after the attn IP performs calculations for each Transformer layer, the processing system performs feature folding and writes it to off-chip memory; the Pwdwconv IP performing pointwise convolution channel mapping; and each Transformer layer completing calculations using the attention processing engine and the feedforward processing engine based on a cross-layer interleaving pipeline scheduling mechanism. The fc IP is deployed at the network end based on the final features of the fifth-stage convolution read from off-chip memory and written to off-chip memory.

2. The hardware and software deployment collaborative acceleration system according to claim 1, characterized in that, The Pwdwconv IP performs downsampling and local encoding and writes to off-chip memory, specifically including: The Pwdwconv IP performs downsampling based on the output of the previous stage in the order of pointwise convolution, depthwise convolution, and pointwise convolution, and writes the downsampling results to off-chip memory. The Pwdwconv IP performs local encoding based on the downsampling results, following the order of depthwise convolution and pointwise convolution, and writes the local encoding results to off-chip memory.

3. The hardware and software deployment collaborative acceleration system according to claim 1, characterized in that, The processing system reads the convolutional output of the local encoding process from the off-chip memory and performs feature unrolling, specifically including: The processing system reads the convolution output of the local encoding process and divides the image into blocks; The processing system groups and segments the image blocks according to their relative positions within the blocks to obtain computational sub-blocks.

4. The hardware and software deployment collaborative acceleration system according to claim 1, characterized in that, The on-chip cache includes a ping-pong cache; both the attention processing engine and the feedforward processing engine are configured with two sets of the ping-pong cache. Each group of the ping-pong caches contains the feature data of a computational sub-block; The calculation process of the Transformer layer includes: The computational sub-blocks of the first execution group are sandwiched in off-chip memory as input to the first-layer attention processing engine; the attention processing engine performs the first-layer normalization on the current computational sub-block and stores the current computational sub-block and the normalized data in the ping-pong cache on the attention processing engine side; the attention processing engine performs three-way projection using a matrix multiplication array based on the normalized data to obtain the current computational sub-block to be processed; starting from the second-layer attention processing engine, the input of the current layer attention processing engine is obtained through the ping-pong cache on the feedforward processing engine side of the previous layer; The feedforward processing engine reads the current computational sub-block to be processed through the ping-pong cache on the attention processing engine side, performs a second layer normalization, and writes the current computational sub-block to be processed and the normalized current computational sub-block to be processed into the ping-pong cache on the feedforward processing engine side.

5. The hardware and software deployment collaborative acceleration system according to claim 4, characterized in that, The residual fusion process in the attention processing engine specifically includes: The attention processing engine performs Softmax on the projection result of the I-path of the three projections to obtain the attention weights and stores the attention weights in the ping-pong buffer on the attention processing engine side; the three projections include the I-path projection, the K-path projection and the V-path projection; The attention processing engine weights and accumulates the K-path features according to the attention weights to generate a global context vector; The attention processing engine performs output projection based on the global context vector and adds it to the normalized data to obtain the first residual fusion result, which is then written into the attention processing engine's side ping-pong cache.

6. The hardware and software deployment collaborative acceleration system according to claim 4, characterized in that, The residual fusion process in the feedforward processing engine specifically includes: The feedforward processing engine completes feedforward dimensionality upscaling and Leaky ReLUctant activation through a matrix multiplication array. The dimensionality upscaling and activation results are stored in the feedforward processing engine's side ping-pong cache. The feedforward processing engine performs dimensionality reduction through a matrix multiplication array and adds it to the current computational sub-block to obtain the second residual fusion result; The feedforward processing engine performs layer normalization on the second residual fusion result and writes it into the feedforward processing engine side ping-pong cache.

7. The hardware and software deployment collaborative acceleration system according to claim 1, characterized in that, The programmable logic interacts with the off-chip memory via the AXI bus.

8. The hardware and software deployment collaborative acceleration system according to claim 1, characterized in that, Once deployed, MobileViTv2 is used for partial discharge detection.

9. The hardware and software deployment collaborative acceleration system according to claim 1, characterized in that, The MobileViTv2 performs channel pruning through structured channel pruning.

10. A method for accelerating collaborative software and hardware deployment, characterized in that, The software and hardware deployment collaborative acceleration method applies the software and hardware deployment collaborative acceleration system according to any one of claims 1-9, and the software and hardware deployment collaborative acceleration method includes: The MobileViTv2 model weights and input graph are obtained through off-chip memory; the off-chip memory interacts with programmable logic; the programmable logic includes an attention processing engine, a feedforward processing engine, and hardware acceleration IP cores; the hardware acceleration IP cores include: Conv IP, Pwdwconv IP, attn IP, and fc IP; the MobileViTv2 includes standard convolution, first-stage convolution, second-stage convolution, third-stage convolution, fourth-stage convolution, fifth-stage convolution, and network ends; Under the scheduling of the processing system, Conv IP and Pwdwconv IP perform standard convolution, first-stage convolution and second-stage convolution according to model weights and input graph, and write the inter-layer results to off-chip memory; the intermediate results of each layer are written to on-chip cache. The processing system schedules and deploys the third-stage convolution, the fourth-stage convolution, and the fifth-stage convolution in a fixed order. The scheduling and deployment process for each of these stages includes: the Pwdwconv IP performing downsampling and local encoding and writing it to off-chip memory; the processing system reading the convolution output from the local encoding process from the off-chip memory and performing feature unrolling; after the attn IP performs calculations for each Transformer layer, the processing system performs feature folding and writes it to off-chip memory; the Pwdwconv IP performing pointwise convolution channel mapping; and each Transformer layer completing calculations using an attention processing engine and a feedforward processing engine based on a cross-layer interleaving pipeline scheduling mechanism. The fc IP deploys the network endpoints based on the final features of the fifth-stage convolution read from off-chip memory and writes them to off-chip memory.