Learning index-based programmable switch range matching expansion method
By adopting a recursive pipeline model indexing structure based on learning index in programmable switches, the problem of excessive resource consumption is solved, efficient support for large-scale range matching is achieved, and the performance and security of multimodal networks are improved.
Patent Information
- Application Number
- CN202510145184.9
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2025-02-10
- Publication Date
- 2025-05-30
AI Technical Summary
When the prior art realizes large-scale range matching in programmable switches, it faces the problem of excessive consumption of TCAM and SRAM resources, resulting in reduced system efficiency and limited multimodal network identification resolution scale.
The recursive pipeline model index (RPMI) structure based on learning index is adopted, and the data division between recursive layers is divided by quantitative approximation and shift compression technology, and efficient linear search is achieved in combination with register arrays.
It significantly reduces the consumption of TCAM and SRAM resources, supports the matching ability of millions of scale rules, realizes range matching applications with high throughput, low latency and low resource consumption, and improves the performance and security of multimodal networks.
Smart Images

Figure CN120067158A_ABST
Abstract
Description
Technical Field
[0001] The present invention belongs to the technical fields of computer networks and programmable hardware, etc., and includes the research on implementing large-scale range matching on programmable switches. Range matching is widely used in network applications such as traffic classification, access control lists, and intrusion prevention in programmable switches. These applications require efficient data structures and algorithm support to adapt to hardware resource limitations (such as TCAM, ternary content addressable memory, and SRAM, static random access memory), and specifically relates to a method for expanding range matching of programmable switches based on learning indexes. Background Art
[0002] In a multi-modal network, to support packet forwarding between various devices / modes in the multi-modal network, constructing a multi-modal network identifier resolution method is the core and foundation for supporting the multi-modal network. In multi-modal identifier resolution technology, range matching is a crucial part, which is used to determine whether a data field is within a specified range to support network functions such as network element identification and traffic monitoring. However, programmable switch hardware only supports exact matching and ternary matching. For range matching, the range needs to be converted into multiple ternary matching rules, and this conversion will consume a large amount of TCAM resources, while TCAM resources are very limited in programmable switches, directly affecting the implementation of high-performance range matching and further restricting the scale of multi-modal network identifier resolution.
[0003] Existing range matching technologies provide several methods to address this challenge. The ternary matching method supports range matching by splitting the range into multiple ternary matching rules, but this method will quickly exhaust TCAM resources and reduce the overall system efficiency. The bitmap method implements range matching based on SRAM and uses a global bitmap to represent range rules, but when the field length increases, the demand for SRAM will increase exponentially. The decision tree method constructs a decision tree in SRAM and uses an ALU to perform range judgment to determine the matching rule, but the number of available ALUs in the switch limits the depth of the decision tree, making its performance limited when dealing with large-scale range matching. To address these problems, existing solutions maintain performance by periodically reconstructing the decision tree, but this process is often time-consuming and affects the real-time performance and stability of the service. Summary of the Invention
[0004] Aiming at the defects and deficiencies existing in the above prior art, the present invention proposes a method for expanding range matching of programmable switches based on learning indexes, which is used to support efficient range matching on programmable switches. It can support large-scale multi-modal network identifier resolution of programmable network elements under a multi-modal network, laying a solid foundation for improving network performance and ensuring network security.
[0005] The present invention is designed specifically for achieving efficient range matching on programmable switches. Considering that traditional range matching methods have problems of excessive consumption of TCAM and SRAM resources when facing switches with limited resources, a learning index structure is utilized to achieve efficient range matching through a Recursive Pipeline Model Index (RPMI). This method replaces floating-point operations with quantization approximation, uses table mapping and shift compression techniques for data partitioning between recursive layers, and combines a register array to achieve efficient linear search. Through these optimization strategies, the hardware limitations of programmable switches in processing large-scale range matching tasks are successfully solved, the matching ability of millions of rules is achieved, and the resource consumption of TCAM and SRAM is significantly reduced. This method provides a range matching application with high throughput, low latency, and low resource consumption for programmable network elements supporting multi-modal networks, providing strong support for enabling multi-modal network identity resolution and ensuring the performance and security of multi-modal networks.
[0006] The technical solution specifically adopted by the present invention to solve its technical problems is as follows:
[0007] A method for expanding range matching of a programmable switch based on a learning index: achieving range matching of a programmable switch through a Recursive Pipeline Model Index; the Recursive Pipeline Model Index establishes a hierarchical structure through hierarchical recursion, mapping data into different sub-models; each of the sub-models shares the same recursive framework and completes matching operations step by step in a pipeline.
[0008] Further, the Recursive Pipeline Model Index uses a linear regression model to map data at each layer, and the linear regression function expression used for each layer is:
[0009] LF(x) = a·x + b
[0010] where LF(x) represents the linear regression function, which is used to describe the linear mapping relationship of data, a is the slope, and b is the bias term. At each layer, the input data is mapped into the corresponding sub-model through the linear regression model, thereby achieving recursive layering.
[0011] Further, the Recursive Pipeline Model Index replaces the floating-point operations of the neural network in the learning index with quantization approximation, uses table mapping and shift compression techniques for data partitioning between recursive layers, and combines a register array to achieve linear search.
[0012] In this solution, the use of a learning index can support large-scale range rule matching. By designing a pipeline recursive model index (RPMI) structure for programmable switches, the resource consumption of TCAM and SRAM is significantly reduced, supporting large-scale range matching to achieve the large-scale modal identification function of multi-modal network elements.
[0013] The main design and functions of the solution can be summarized as follows:
[0014] 1) Use a quantization-based linear regression model (BLF) to replace the floating-point operations of the neural network in the traditional learning index to implement the regression task, overcoming the computational model limitations of programmable switches;
[0015] 2) Simulate the data recursion process in the learning index through the shift compression and matching action table mapping method to achieve uniform partitioning of data, and minimize the memory resource consumption of the matching action table entries while implementing model deployment;
[0016] 3) Use a register array to store the range boundaries, and parallelly simulate a bounded loop through multiple registers to achieve the final accurate matching of the range.
[0017] 4) Dynamically calculate the prediction error of the current recursive layer to ensure that the error is limited within the range supported by the maximum bounded loop, achieving the accuracy and stability of range matching.
[0018] Furthermore, the replacement of the floating-point operations of the neural network in the learning index by quantization approximation specifically means using a quantization-based linear regression model to replace the floating-point operations of the neural network in the learning index to implement the regression task; the quantization-based linear regression model is implemented by the formula BLF(x) = x << >> BM(a) + b'; where represents the displacement amount of the slope, and b' is the quantized bias term. Through this displacement operation and addition, a hardware-implementable regression task is achieved, avoiding floating-point operations.
[0019] Furthermore, the recursive pipeline model index stores the first m bits of the results of the quantization-based linear regression model in the mapping table, thus avoiding generating a separate table entry for each quantization-based linear regression model to reduce resource occupancy and improve data uniform distribution: the table mapping is used to further divide the data into multiple sub-models. During the construction of the table mapping, by setting the layer_shift parameter, it is ensured that the data is evenly distributed among different sub-models; during the table mapping process, the recursive pipeline model index adopts a pre-training and hierarchical balancing strategy. By initially training the data, the distribution of each data block is obtained, and then the layer_shift parameter is set according to the range and distribution of the data to ensure that the data remains balanced during stratification.
[0020] Furthermore, the pipeline mechanism adopted by the recursive pipeline model index combines a stage-wise quantized linear regression model and a register array linear search to achieve efficient range matching for large-scale data: in each pipeline stage, the stage-wise quantized linear regression model is used to divide the data and map it to multiple sub-ranges; after preliminary filtering, it enters the register array linear search stage for precise matching of the preliminarily filtered data in each pipeline stage. The boundary values of each range are stored in the register array, and combined with the popcnt operation, parallel matching is achieved: the query range is defined as: [E - ∈, E + ∈], where E is the range center estimated by the recursive pipeline model index, and ∈ is the allowable error threshold.
[0021] Furthermore, the recursive pipeline model index dynamically adjusts the number of layers and sub-models according to the model error to ensure that the prediction error is within the preset threshold range. When the error exceeds the threshold, the number of sub-models is increased first; if the error still does not meet the requirements after retraining, the number of recursive layers is increased.
[0022] Furthermore, the recursive pipeline model index preprocesses some matching conditions into table entries and stores them in the register, and retrieves the offset in the register through table entry matching; linear search is performed in the switch pipeline through the register array, and the range boundaries in the register are read in parallel in each pipeline stage, so as to quickly determine the matching range; the layout of the register array is such that each range boundary is stored at different positions in the register, and is arranged in the relationship of remainder and quotient to achieve parallel access and fast search.
[0023] An electronic device includes a memory, a processor, and a computer program stored on the memory and executable on the processor. When the processor executes the program, it implements the steps of a method for expanding the range matching of a programmable switch based on a learning index as described above.
[0024] A non-transitory computer-readable storage medium stores a computer program, and when the computer program is executed by a processor, it implements the steps of a method for expanding the range matching of a programmable switch based on a learning index as described above.
[0025] Compared with the prior art, the present invention and its preferred solutions construct an RPMI structure, divide data in a hierarchical recursive manner through a lightweight learning index method, and ensure that the index depth is within the switch hardware limit. By adopting a quantization approximation method, floating-point operations are replaced by shift operations, eliminating the dependence on floating-point calculations, so that the learning index can be efficiently executed in the switch hardware.
[0026] Through RPMI structure and hardware adaptation optimization, it significantly reduces the consumption of TCAM and SRAM resources on programmable switches. Under the scale of one million rules, the P4Alex framework can reduce the TCAM resource consumption by 89.9% and the SRAM resource by 43.7%, with only a 0.48-microsecond increase in latency, making it suitable for large-scale data center application environments. BRIEF DESCRIPTION OF THE DRAWINGS
[0027] The present invention will be further described in detail below with reference to the drawings and specific embodiments:
[0028] Figure 1 It is a schematic diagram and flowchart of the overall structure of RPMI in an embodiment of the present invention.
[0029] Figure 2 It is an example diagram of the recursive pipeline model index data partitioning in an embodiment of the present invention.
[0030] Figure 3 It is an example diagram of the implementation method of the pipeline structure in an embodiment of the present invention.
[0031] Figure 4 It is a construction and implementation flowchart of the overall solution in an embodiment of the present invention. DETAILED DESCRIPTION OF THE EMBODIMENTS
[0032] To make the features and advantages of this patent more obvious and understandable, specific embodiments are given below for detailed description as follows:
[0033] It should be noted that the following detailed description is illustrative and is intended to provide further explanation of the present application. Unless otherwise specified, all technical and scientific terms used in this specification have the same meaning as commonly understood by those of ordinary skill in the technical field to which this application belongs.
[0034] It should be noted that the terms used here are only for describing specific embodiments and are not intended to limit the exemplary embodiments according to the present application. As used herein, unless the context clearly indicates otherwise, the singular form is also intended to include the plural form. In addition, it should be understood that when the terms "comprise" and / or "include" are used in this specification, they indicate the presence of features, steps, operations, devices, components, and / or combinations thereof.
[0035] As Figure 4 shown, the embodiments of the present invention provide a construction and implementation process of an efficient and scalable range matching scheme based on learning index. By constructing a recursive model index (RPMI) structure and combining hardware adaptation optimization, it solves the problem of large consumption of TCAM and SRAM resources in traditional methods and is applicable to the processing requirements of large-scale range matching in programmable switches. The method includes the following steps:
[0036] 1) Construct a Recursive Model Index (RPMI) structure, and divide the data into multiple sub-models through a hierarchical recursive linear regression model.
[0037] 2) Optimize the RPMI structure through a quantization approximation method to adapt to the limitations of switch hardware for floating-point calculations.
[0038] 3) Implement table mapping segmentation of data in the RPMI structure. By setting the layer_shift parameter and a pre-trained mapping table, further divide the data into multiple sub-models.
[0039] 4) Introduce a register array linear search in the pipeline structure to replace the traditional variable-length loop operation and achieve efficient range matching.
[0040] In an embodiment of the present invention, first, construct an RPMI structure to divide the data in a hierarchical recursive manner, and use a simple linear regression model at each level. The basic form of each model is LF(x) = a·x + b, where a is the slope and b is the bias. The RPMI recursive structure divides a large amount of data into multiple sub-models, and each sub-model is responsible for a different data interval, thereby achieving a fixed index depth and reducing the load of a single node, and making the index structure adapt to the limited pipeline stages of the switch.
[0041] In an embodiment of the present invention, to solve the problem of floating-point calculation limitations, the present invention adopts a quantization approximation method to approximate the slope as a shift operation. Specifically, the quantization function (BLF) is defined as: BLF(x) = x << BM(a) + b', where represents the displacement amount of the slope, and b' is the adjusted bias term. By replacing multiplication with a shift operation, approximate calculation of the linear regression is achieved, ensuring the applicability of the model and the efficiency of index calculation.
[0042] In an embodiment of the present invention, to further optimize the computational burden of the serial ALU (Arithmetic Logic Unit, the serial ALU refers to a serial adder), the present invention transfers part of the calculation tasks to the matching action table to reduce the use of serial ALU resources in each pipeline stage. Specifically, preprocess part of the matching conditions as table entries and store them in registers, and retrieve the offset in the register through table entry matching, thereby reducing the ALU calculation load.
[0043] In an embodiment of the present invention, to address the problem that variable-length loops cannot be used in hardware, the present invention adopts a combination of a register array and linear search. By storing range boundaries in parallel in registers and performing linear search in combination with the popcnt operation. The query range is defined as: [E - ∈, E + ∈], where E is the RPMI estimated value and ∈ is the maximum error. This linear search structure ensures the accuracy of range matching. In addition, the present invention also designs a data filling strategy to fill adjacent non-empty data branches into empty nodes to evenly distribute data and reduce storage waste.
[0044] In an embodiment of the present invention, the RPMI structure of the present invention recursively stores large-scale range matching rules hierarchically to adapt to the pipeline depth limitation of the switch. The RPMI framework effectively distributes to multiple pipeline stages through hierarchical data allocation, thereby avoiding the performance bottleneck caused by excessive tree depth in the traditional decision tree method.
[0045] The following provides the specific implementation process of the embodiments of the present invention.
[0046] Please refer to Figure 1 , the present invention includes two main parts: recursive model index (RPMI) construction and pipeline structure design.
[0047] (1) Recursive model index (RPMI) construction
[0048] In the present invention, the recursive model index (RPMI) is used to efficiently divide large-scale data into multiple sub-models to achieve precise range matching. RPMI builds a hierarchical structure through hierarchical recursion, maps data into different sub-models, and thus completes the matching operation within a limited pipeline depth, reducing the occupancy of hardware resources. The first step of the present invention is to construct the RPMI index structure, including data layering, quantization approximation processing, and table mapping allocation.
[0049] First, in the construction of the RPMI structure, a linear regression model is used to map data at each layer. The linear regression function expression used for each layer is:
[0050] LF(x) = a · x + b
[0051] Where LF(x) represents the linear regression function, which is used to describe the linear mapping relationship of data, a is the slope, and b is the bias term. At each layer, the input data is mapped into the corresponding sub-model through this linear regression model, thereby realizing recursive layering. The purpose of linear regression is to transform range matching into a partition index operation through a simple linear relationship, gradually narrowing the data range layer by layer, and improving the accuracy and efficiency of matching.
[0052] In the process of constructing the recursive hierarchy, the present invention adopts a quantization approximation technique to adapt to the hardware limitations of programmable switches. In traditional linear regression, the slope and bias require floating-point operations. However, in the switch hardware environment, the resource occupancy of floating-point calculations is relatively large. Therefore, the present invention designs a quantization approximation scheme to replace floating-point operations with shift operations. The quantized expression is:
[0053] BLF(x) = x << >> BM(a) + b
[0054] where represents the displacement amount of the slope. The present invention uses a shift operator to replace the multiplication operation. When the multiplier is less than 1, >> is used; otherwise, << is used., b' is the quantized bias term, and its calculation formula is: In this way, data mapping can be achieved through simple shift and addition operations, reducing the computational complexity, avoiding floating-point operations, and improving the efficiency of hardware execution. The quantization approximation technique ensures that effective linear mapping can be achieved for large-scale data in a hardware-constrained environment.
[0055] Next, to further optimize the distribution of data in the recursive model, the present invention introduces the TableMapping technique. Table mapping is used to further divide data into multiple sub-models to improve the efficiency and accuracy of matching. Specifically, in the process of constructing the table mapping, by setting the layer_shift parameter, it is ensured that the data can be evenly distributed among different sub-models. Please refer to Figure 2 , through the pre-trained mapping table, the data is divided into different stages BLF (Stage BLF), and recursive data layering is performed in each stage. When layer_shift = 2, the data is split into four sub-models (Stage BLF i + 1 - j * k + 0 to i + 1 - j * k + 3), thus achieving more refined data control.
[0056] In the process of table mapping, to avoid the problem of uneven data distribution, the present invention adopts a pre-training and hierarchical balancing strategy. First, through preliminary training of the data, the distribution of each data block is obtained, and then the layer_shift parameter is set according to the range and distribution of the data to ensure that the data remains balanced during layering. If the data distribution is relatively concentrated, the number of layers in the mapping layer can be increased to perform more detailed segmentation of the data, thereby reducing the error in the matching process. In addition, if a data block shows a deviation in the final layering, the adjacent non-empty data branches are filled into the empty nodes to further ensure the uniformity of data distribution and the accuracy of recursive indexing.
[0057] Finally, through the RPMI structure with recursive hierarchical partitioning, efficient matching of large-scale data is achieved. In the programmable switch of the present invention, the optimization of resource utilization is completed through RPMI. Each sub-model shares the same recursive framework, and the matching operation is completed stage by stage in the pipeline, thus ensuring low latency and high performance in large-scale range matching scenarios.
[0058]
[0059]
[0060] (2) Pipeline Structure Design
[0061] In the pipeline structure design of the present invention, an optimized pipeline mechanism is adopted. By combining the staged BLF (Bounded Linear Function) and the register array linear search, the traditional variable-length loop operation is replaced to achieve efficient range matching of large-scale data. This design distributes the computing tasks to different pipeline stages, ensuring efficient matching operations under the condition of limited hardware resources. Please refer to Figure 3 , which shows an example diagram of the implementation of the pipeline structure of the method of the present invention, specifically illustrating the processing process of data in the pipeline structure.
[0062] First, in each pipeline stage, the staged BLF is used to partition the data. The BLF is used for preliminary range filtering of the input data to narrow the data range to be matched. Specifically, the BLF maps the data to multiple sub-ranges, and each sub-range will be further refined in the next stage. The advantage of this staged filtering is that it can gradually reduce the data volume in the early stage of the pipeline, thereby reducing the computational pressure in the subsequent stages and improving the overall processing efficiency. In the design of the BLF in each stage, the present invention uses a quantized linear regression model and replaces the floating-point operation with a shift operation to meet the hardware requirements of the programmable switch.
[0063] After the preliminary filtering in the BLF stage, it enters the register array linear search stage. The register array linear search is used to perform precise matching on the data filtered by the BLF in each pipeline stage. In traditional implementation methods, range matching usually requires a loop structure to traverse the data, but in a programmable switch, loop operations may cause serious occupation of hardware resources. The present invention stores the boundary values of each range in the register array and combines the popcnt (PopulationCount) operation to achieve parallel matching, thus avoiding loop operations.
[0064] Specifically, the register array stores boundary information of different ranges and filters data through a preset error threshold. At each stage of the pipeline, the register array matches according to the query range of the input data. The query range is defined as:
[0065] [E - ∈, E + ∈]
[0066] where E is the center of the range estimated by RPMI, and ∈ is the allowable error threshold. The register array will search for qualified data within this range and return the matching result. Through the linear search of the register array, the pipeline structure can complete the matching in parallel at each stage, thus significantly improving the matching speed.
[0067] In practical applications, the pipeline structure gradually realizes the accurate matching of data through multiple pipeline stages. The BLF of each stage is responsible for screening the data range, while the register array is responsible for finding qualified items in the screened data. Each pipeline stage is independent of each other, ensuring the parallelism and efficiency of data processing. To avoid data conflicts in the register array, the present invention designs a data filling strategy to fill the empty register positions with adjacent non-empty data to ensure the consistency of data processing.
[0068] Finally, by combining the phased BLF and the linear search of the register array, the pipeline structure design of the present invention effectively solves the common problems of resource occupation and delay in large-scale data matching. The pipeline structure design realizes low-latency and high-performance data matching under the condition of limited switch hardware resources and is applicable to real-time range matching tasks in large-scale network environments.
[0069] Based on the same inventive concept, the present invention also provides a computer device, which includes: one or more processors, and a memory for storing one or more computer programs; the program includes program instructions, and the processor is used to execute the program instructions stored in the memory. The processor may be a Central Processing Unit (CPU), or may also be other general-purpose processors, Digital Signal Processors (DSPs), Application Specific Integrated Circuits (ASICs), Field-Programmable Gate Arrays (FPGAs) or other programmable logic devices, discrete gate or transistor logic devices, discrete hardware components, etc. It is the computing core and control core of the terminal, and is used to implement one or more instructions, specifically used to load and execute one or more instructions in the computer storage medium to implement the above method.
[0070] It should be further noted that, based on the same inventive concept, the present invention also provides a computer storage medium, on which a computer program is stored. When the computer program is run by a processor, it executes the above-mentioned method. The storage medium can adopt any combination of one or more computer-readable media. The computer-readable medium can be a computer-readable signal medium or a computer-readable storage medium. The computer-readable storage medium can be, for example, but not limited to, an electrical, magnetic, optical, electrical, magnetic, infrared, or semiconductor system, device, or component, or any combination of the above. More specific examples (non-exhaustive list) of the computer-readable storage medium include: an electrical connection with one or more wires, a portable computer disk, a hard disk, a random access memory (RAM), a read-only memory (ROM), an erasable programmable read-only memory (EPROM or flash memory), an optical fiber, a portable compact disk read-only memory (CD-ROM), an optical storage device, a magnetic storage device, or any suitable combination of the above. In the present invention, the computer-readable storage medium can be any tangible medium that contains or stores a program, and this program can be used by or in combination with an instruction execution system, device, or component.
[0071] It should be noted that, unless otherwise defined, the technical terms or scientific terms used in the present invention should have the ordinary meanings understood by those with ordinary skills in the field to which the present invention belongs. The "first", "second", and similar terms used in the present invention do not denote any order, quantity, or importance, but are only used to distinguish different components. Words such as "including" or "comprising" mean that the elements or objects appearing before this word cover the elements or objects listed after this word and their equivalents, without excluding other elements or objects. Words such as "connected" or "linked" are not limited to physical or mechanical connections, but can include electrical connections, whether direct or indirect. "Up", "down", "left", "right", etc. are only used to represent relative position relationships. When the absolute position of the object being described changes, the relative position relationship may also change accordingly.
[0072] As mentioned above, these are only the preferred embodiments of the present invention, and it is not a limitation of the present invention in other forms. Any person skilled in the art may use the disclosed technical content to make changes or modifications into equivalent embodiments with equivalent changes. However, any simple modifications, equivalent changes, and modifications made to the above embodiments based on the technical essence of the present invention without departing from the technical solution content of the present invention still fall within the protection scope of the technical solution of the present invention.
[0073] This patent is not limited to the above-mentioned best implementation modes. Anyone inspired by this patent can come up with other various forms of a range matching expansion method for a programmable switch based on learning indexes. All equivalent changes and modifications made according to the scope of the patent application of the present invention shall fall within the scope covered by this patent.
Claims
1. A programmable switch range matching expansion method based on learning index, characterized in that: Range matching of programmable switches is achieved through recursive pipeline model indexing; the recursive pipeline model indexing establishes a hierarchical structure through hierarchical recursion to map data to different sub-models; each of the sub-models shares the same recursive framework and completes matching operations step by step in the pipeline.
2. According to the method for programmable switch range matching expansion based on learning index according to claim 1, it is characterized in that: The recursive pipeline model index uses a linear regression model to map data at each layer, and the linear regression function expression used in each layer is: LF(x)=a·x+b Where LF(x) represents the linear regression function, which is used to describe the linear mapping relationship of the data. a is the slope and b is the bias term. Each layer maps the input data to the corresponding sub-model through the linear regression model, thereby realizing recursive stratification.
3. According to claim 2, a programmable switch range matching and expansion method based on learning index is characterized in that: The recursive pipeline model index replaces the floating point operations of the neural network in the learning index through quantization approximation, uses table mapping and shift compression technology to divide data between recursive layers, and combines register arrays to realize linear search.
4. According to claim 3, a programmable switch range matching and expansion method based on learning index is characterized in that: The method of replacing the floating-point operation of the neural network in the learning index by quantization approximation is specifically to use a quantized linear regression model to replace the floating-point operation of the neural network in the learning index to achieve the regression task; the quantized linear regression model is implemented by the formula BLF(x)=x<<>>BM(a)+b'; wherein represents the displacement of the slope, and b' is the quantized bias term.
5. According to claim 4, a programmable switch range matching and expansion method based on learning index is characterized in that: The recursive pipeline model index stores the first m bits of the quantized linear regression model result in a mapping table, thereby avoiding generating a separate table entry for each quantized linear regression model: the table mapping is used to further divide the data into multiple sub-models, and in the process of constructing the table mapping, the layer_shift parameter is set to ensure that the data is evenly distributed in different sub-models; the recursive pipeline model index adopts a pre-training and layered balancing strategy in the table mapping process, and obtains the distribution of each data block by performing preliminary training on the data, and then sets the layer_shift parameter according to the range and distribution of the data to ensure that the data remains balanced when layered.
6. According to claim 3, a programmable switch range matching and expansion method based on learning index is characterized in that: The pipeline mechanism adopted by the recursive pipeline model index combines a stage-wise quantized linear regression model and a register array linear search to achieve efficient range matching of large-scale data: in each pipeline stage, a stage-wise quantized linear regression model is used to divide the data and map the data to multiple sub-ranges; After completing the preliminary filtering, the register array linear search stage is entered to accurately match the preliminary filtered data in each pipeline stage. The boundary values of each range are stored in the register array, and combined with the popcnt operation, parallel matching is achieved: the query range is defined as: [E-∈, E+∈], where E is the center of the range estimated by the recursive pipeline model index, and ∈ is the allowable error threshold.
7. The programmable switch range matching and expansion method based on learning index according to claim 3 is characterized in that: The recursive pipeline model index dynamically adjusts the number of layers and sub-models according to the model error to ensure that the prediction error is within a preset threshold range, and when the error exceeds the threshold, the number of sub-models is first increased; if the error still does not meet the requirements after retraining, the number of recursive layers is increased.
8. The programmable switch range matching and expansion method based on learning index according to claim 3 is characterized in that: The recursive pipeline model index preprocesses part of the matching conditions into table items and stores them in registers, and realizes offset retrieval in the register through table item matching; linear search is performed in the switch pipeline through the register array, and the range boundaries in the register are read in parallel in each pipeline stage, so as to quickly determine the matching range; the layout of the register array is to store each range boundary at a different position in the register, and arrange them in the relationship between remainder and quotient to realize parallel access and fast search.
9. An electronic device comprising a memory, a processor, and a computer program stored in the memory and executable on the processor, characterized in that: When the processor executes the program, the steps of a programmable switch range matching and expansion method based on a learning index are implemented as described in any one of claims 1 to 8.
10. A non-transitory computer-readable storage medium having a computer program stored thereon, characterized in that: When the computer program is executed by a processor, the steps of a programmable switch range matching and expansion method based on a learning index as described in any one of claims 1 to 8 are implemented.