Supporting real number calculations in physical switches
Patent Information
- Application Number
- EP2022834619
- Authority / Receiving Office
- EP · EP
- Patent Type
- Applications
- Current Assignee / Owner
- Priority Date
- 2022-01-14
- Filing Date
- 2022-12-12
- Publication Date
- 2024-11-20
AI Technical Summary
Physical switches in electronic communication networks are limited by their calculation and memory capacities, leading to constraints on latency and the ability to perform complex calculations, which restricts their programming possibilities and requires offloading complex processing to servers, resulting in high latency for certain operations.
A method for packet processing in physical switches that uses real value representations encoded in specific bit subsets to perform operations, allowing for more complex functions by reducing the number of steps required for calculations, such as exponential and logarithmic operations, while minimizing errors and latency.
Enables the execution of more complex functions within the switch, reducing latency and increasing processing capabilities without the need for server-based processing, by optimizing the distribution of bits between integer and decimal parts in real value representations.
Smart Images

Figure 1.1
Abstract
Description
Support for calculations on real numbers at the level of physical switches
[0001] The present invention relates to the field of electronic communication networks and in particular to the physical switches implemented in these networks.
[0002] It finds applications in particular in the configuration of physical switches for packet processing.
[0003] Physical switches are very limited in their computing and memory capabilities and have very strong latency constraints. Thus, a switch processes each packet it receives with a very limited number of steps or clock cycles (i.e. the minimum time unit during which the processor can process an elementary action or instruction). In current switches, the number of steps or cycles does not exceed 12 cycles. During a clock cycle, the processor can process several instructions in parallel. However, the number of instructions that the processor can process in parallel depends greatly on the size of the processor register, which is also very limiting on the processors used in physical switches.
[0004] These limitations of switch processors and the need for very low latency to avoid affecting the performance of services passing through the network, force switches to execute only scripts involving very simple calculations and therefore reduce the programming possibilities of switches. Thus, switch processors can only calculate very simple functions because: more complex functions require more resources, as they often involve more mathematical operations (e.g., addition, division, sine, etc.) requiring more cycles to perform their calculation; and / or more complex functions often require the use of real values during their calculation, otherwise they risk causing errors.
[0005] Thus, to be able to execute scripts involving more complex calculations, physical switches can be programmed to transfer packets on which more complex processing is to be applied to a server which will perform the complex calculation and then forward the packet. Such an implementation allows for more complex calculations to be performed, and in particular to be much less limited on the functions that can be used. However, such an implementation results in high latency and therefore cannot be used for all types of processing. It will therefore be used mainly for processing packets a posteriori.
[0006] The paper “InREC: In-network REal Number Computation” by M. Jose et al, published in the proceedings of the 2021 IFIP / IEEE International Symposium on Integrated Network Management (IM), proposes using lookup tables to perform operations on values expressed in real-valued representations such as floating-point numbers described in the IEEE 754 standard. This allows for logarithm- or exponential-type operations. However, these real-valued representations require more clock cycles to process even basic operations such as addition, thus greatly reducing the number of operations that the complex function can include.
[0007] The present invention improves the situation.
[0008] A first aspect of the invention relates to a method of packet processing by a physical switch of an electronic communications network, the method comprising:
[0009] The reception by the switch of a packet;
[0010] Determining by the switch a result of applying one or a plurality of operations to at least one input value obtained by the switch from the packet, wherein at least one of the operations corresponds to a lookup table, said lookup table representing correspondences between input values of the table and output values of the table, the input values of the table are represented in a first real value representation encoded on a first set of bits comprising a first subset of bits representing an integer part and a second subset of bits representing a decimal part and / or the output values of the table are represented in a second real value representation encoded on a second set of bits comprising a first subset of bits representing an integer part and a second subset of bits representing a decimal part; and
[0011] Depending on the result of applying the operation or plurality of operations, the switch applies an action on the packet.
[0012] When a script (for example, a script written in a P4 programming language, also called Programming Protocol-Independent Packet Processors in English) based on a function is executed (or more precisely, when the compiled version of the script is executed) at a switch, the switch will apply a series of operations corresponding to the script or deduced from the script. In a standard switch, these operations have integer values as inputs and outputs. Implementing these operations on real values encoded in a specific way (i.e., the set of bits encoding each of these inputs / outputs is broken down into two subsets of bits, one representing an integer part and the other representing a decimal part), allows the switch to execute sets of operations forming more complex functions than those implemented on a conventional physical switch.Indeed, the real value representation allows to execute operations of the exponential, logarithmic, division or even sine type. In addition, the specific coding of these real values makes it possible to reduce the number of steps (otherwise called cycles) necessary for each operation, allowing to apply more operations and therefore more complex functions or possibly to reduce latency. Indeed, the number of steps allocated to perform the calculation executing the script based on the function is very small on physical switches: it is in principle limited to 12 steps.Thus, if an operation requires only 2 steps with the specific real value representation (hereinafter referred to simply as real value representation) instead of 4 steps (as is the case for addition with the floating point representation of the IEEE 754 standard): either 10 steps remain available to perform the other operations instead of 8 steps, allowing more complex functions to be implemented and more generally allowing the use of a greater choice of functions; or the total number of steps to implement the function will be reduced, and since each step takes the same time, the latency will be reduced.
[0013] A step is a clock cycle during which the processor can process only one instruction in a row or several instructions if they are all processed in parallel.
[0014] A physical switch is understood to mean a network switch, also called a switch in English, which connects several physical segments in an electronic communications network (for example, a telecommunications network or a computer network) or several physical segments between several electronic communications networks.
[0015] By reception by the switch of a packet, it is understood that the switch on one of its input ports receives the packet.
[0016] A packet is understood to be the structure that allows data transmission at the network layer. A packet includes a header and the data to be transmitted.
[0017] By value obtained from the packet, we mean a value obtained by the switch on the basis of the packet and which is therefore dependent on the packet, in other words the value depends either on the characteristics of the packet (for example, the length of the packet), or on the data contained in the packet both in the header part and in the body of the packet (thus the value can be the source port written in the header of the packet).
[0018] An operation is understood to mean any operation performed by the switch either natively (for example, addition, permutation, left bit shift, right bit shift), i.e. the tasks to be performed to execute the operation are already defined in the switch memory, or based on a lookup table, i.e. for operations that correspond to a lookup table. An operation, when performed natively, may require several clock cycles (or several steps to be processed), i.e. such an operation is broken down into a succession of instructions applied one after the other. Operations performed on the basis of a lookup table can each be processed by the processor in a single clock cycle.
[0019] By applying a plurality of operations on at least one value, i.e. a set of one or more values, it is understood that the compound operations that form a function are applied in an order prescribed by the composition (several orders of application of the operations may correspond with the function, for example, the addition of a+b then the multiplication by c or the multiplication of a and b by c then the addition of ac and bc). A first operation is thus applied (or a set of first operations if these can be applied in parallel) then a second operation (or a set of second operations) is applied to the result(s) of the first operation(s) and so on until all the operations of the composition are processed.This plurality of operations is processed by the switch (e.g., by means of the processor core, the processor register, and possibly RAM elements present in the switch). The operation or plurality of operations performed by the switch corresponds to an algorithm that represents a function whose input(s) are values obtained from the packet.
[0020] A lookup table is a table of correspondences, or a Lookup Table (LUT) in English, that maps input values to output values. Lookup tables represent correspondences between inputs and outputs of the table. In other words, the lookup table is generated (or encoded, for example, in bits) based on the correspondences between its inputs and outputs. These inputs and outputs are encoded, for example, in bits. These inputs and outputs can be integers or real numbers, among other things. They can also include any type of information commonly encoded in the lookup tables implemented in network switches.
[0021] By operation corresponding to a correspondence table, it is understood that the result of the operation applied to one or more input values corresponds to the value (or indicated output value) indicated by the correspondence table for the said input value(s).
[0022] By value (input or output) of a table represented in a real value representation, it is understood here that the input value before being encoded on a set of bits in the table is a real and that the encoding on this set of bits makes it possible to keep information on this value in addition to the information relating to the integer part of this value. The specific real value representation implemented by the invention is a division of the bits making it possible to encode the value in the table, between bits representing the integer part and bits representing the decimal part.
[0023] By applying an action on the packet, we mean any action commonly applied in a physical or virtual switch, for example: dropping the received packet, i.e. not forwarding it; modifying the packet before forwarding it, for example by changing the destination port; forwarding the packet without modification.
[0024] The action is a function of the result of the application of a succession of operations, that is to say that the action is dependent on the result, it is thus understood that the application of the action is either subordinate to the result of the application of the succession of operations (for example the action is only applied for a certain result) or that the action itself varies according to the result of the succession of operations (for example, the action consisting of modifying the destination port of the packet by taking as the new destination port the value resulting from the application of the succession of operations).
[0025] According to one embodiment, the determination of the action to be applied to the packet and / or the at least one input value obtained from the packet and / or the operation or the plurality of operations are a function of at least one trigger value obtained by the switch from the packet.
[0026] For example, the trigger value is entered into a match-action table which has as output a function (representing the operation or plurality of operations), input values on which to apply this function and an action.
[0027] According to one embodiment each LUT correspondence table i corresponding to one of the plurality of operations represents correspondences between input values of the LUT table i and output values from the LUT table i , the input values of the LUT table iare represented in a first real value representation RVR 1,i coded on a first set of bits EB 1,1,i comprising a first subset of SEB bits 1,1,i representing an integer part and a second subset of SEB bits 1,2,i representing a decimal part and / or the output values of the table are represented in a second real value representation RVR 2,i encoded on a second set of EB bits 2,i comprising a first subset of SEB bits 2,1,i representing an integer part and a second subset of SEB bits 2,2,i representing a decimal part.
[0028] Thus, all lookup tables have at least one of their inputs or outputs represented as real numbers, or both. This allows several operations to be performed with real numbers as input or output, or both.
[0029] Optionally, operations that have as input at least one input value (i.e., the input value(s) of the function applied by the switch) correspond to LUT lookup tables i whose output values are represented in second real value representations RVR 2,i . In this case, the input values are integers, and the output values are equal to or close to the input values respectively. These operations are subsequently called real-valued transformation operations. Thus, it is possible to transform the input values of the function so that all operations are performed on values expressed in real-valued representations.
[0030] By close we mean the distance between the output values respectively coded on the second set of bits EB 2,i and the input values encoded on the first set of bits EB 1,iis less than a threshold, for example, strictly less than 0.5. The distance used can for example be the Cartesian distance.
[0031] A value represented in a real value representation encoded on a set of bits is encoded in that real value representation.
[0032] According to one embodiment, at least one output value of a lookup table, corresponding to one of the operations among the operation or the plurality of operations, is adapted by adding or subtracting a value in order to minimize the discrepancy between the result of applying the operation or plurality of operations to the at least one input value and the result of the function that the operation or plurality of operations represents when the function is applied to the at least one input value and calculated with a precision greater than the precisions of the real value representations RVR1, i ,RVR2,i .
[0033] Thus, it is possible to adapt the tables to reduce errors or deviations between the desired result and the result of applying the operation or plurality of operations calculated by the switch. The output value and the adapted output value can be close. This optimization can be carried out in the same way as the optimization carried out in neural networks, namely by minimizing a distance between the desired result and the obtained result.
[0034] Thus, real-valued transformation operations can transform an integer into a value represented in a real-valued representation whose integer part differs from the integer of the value .
[0035] This is particularly advantageous, since it is often possible to adapt the output value of one of the correspondence tables, in particular upwards for positive numbers and downwards for negative numbers, so that any truncations due to the limit of the number of bits of the decimal parts of the real value representations in which the output values of the different operations are represented (and especially the output value of the last operation executed, i.e. the result of the application of the operation or of the plurality of operations) which follows the operation represented by the adapted correspondence table, correspond to roundings of these decimal parts.The result is therefore more accurate and this makes it possible to reduce or eliminate the need for rounding procedures when such procedures are essential to avoid the result being completely erroneous; however, these procedures consume many steps in the commutator calculation process.
[0036] By result of the function applied on a value and calculated with a precision greater than the precisions of the representations of real value RVR1, i ,RVR2, i, it is understood that the function represented by the operation or plurality of operations is calculated with real value representations having larger decimal parts and / or by practicing rounding procedures during the calculation. The calculation of the function can in particular be carried out by means of processors adapted to numerical calculation. It is thus possible to determine the desired result to which the result obtained when the switch (or an equivalent system) executes the operation or plurality of operations is compared.
[0037] According to one embodiment, the distribution of bits between the first subset of bits and the second subset of bits of the first set of bits is modified in order to minimize the deviation between the result of the application of the operation or the plurality of operations on the at least one input value and the result of the function that the operation or the plurality of operations represents when the function is applied on the at least one input value and calculated with a precision greater than the precisions of the real value representations RVR1, i ,RVR2, i ; et / ou
[0038] the distribution of bits between the first subset of bits and the second subset of bits of the second set of bits is modified in order to minimize the deviation between the result of the application of the operation or the plurality of operations on the at least one input value and the result of the function that the operation or the plurality of operations represents when the function is applied on the at least one input value and calculated with a precision greater than the precisions of the real value representations RVR1, i ,RVR2, i .
[0039] Thus, it is possible to adapt, for each representation of real value, the distribution of the bits between the set representing the integer parts and the set representing the decimal parts to reduce the errors or gaps between the desired result and the result of the application of the operation or the plurality of operations calculated by the switch. Indeed, when executing certain operations (for example, an operation representing the exponential on the domain [-10; 0]) a decimal part that is too small of the output values will not sufficiently discriminate these values, conversely when executing certain operations (for example, an operation representing the exponential on the domain [0; 10]) a whole part that is too small of the output values will not allow all these values to be expressed.Thus, during the chain of operations it is advantageous to adapt the distribution between bits representing the integer parts and bits representing the decimal parts of each table independently (i.e., the real value representations are adapted separately if necessary). This optimization can be achieved by minimizing a distance between the desired result and the result obtained when each distribution is modified.
[0040] By modifying the distribution of bits between the decimal part and the integer part, it is understood that the number of bits allocated to the integer part is reduced in favor of the number of bits allocated to the decimal part or that the number of bits allocated to the integer part is increased in favor of the number of bits allocated to the decimal part, the number of bits representing the value being constant during this modification.
[0041] According to one embodiment, the operations not corresponding to a lookup table are operations among addition, multiplication, permutation, bit shifting.
[0042] Addition, multiplication and permutation are operations that are particularly suitable for being applied to values expressed in a real value representation whose integer part is coded on one set of bits and the decimal part is coded in another set of bits. Indeed, when the distribution of bits between the integer part and the decimal part is the same for all the input values of the same operation of this type, the execution of the operation can be carried out independently of the distribution of bits between the integer part and the decimal part. In other words, the distribution of bits between the integer part and the decimal part does not affect the calculation of the operation.Other real-value representations, for example, the IEEE 754 floating-point representation, do not allow the use of the operations indicated above without applying additional transformations to the values to enable the operation to be applied, which increases the number of steps required to perform the operation. Thus, according to the method proposed in the previously referenced article, to add two numbers represented in the IEEE 754 floating-point representation the switch processor would require four steps, whereas to add two numbers represented in the real-value representation as described herein requires only one step (or two if the two numbers have a different representation).
[0043] According to one embodiment, the second set of bits on which the second real value representation is encoded comprises a third subset of bits representing information dependent on the first subset of bits and / or the second subset of bits, and in which the result of applying one or a plurality of operations is based on the information. For example, the result of a next operation among the plurality of operations is based on the information, said next operation being executed after the at least one operation corresponding to a lookup table.
[0044] Thus, it is possible to add additional information to the set of bits encoding the input or output values of an operation in a real-value representation. This information makes it possible to reduce the number of instructions to be implemented by an operation that has these values as input. Thus, for example, if this operation requires the execution of several instructions, the result of one of these instructions depending on the data encoded on the first and second subsets can be pre-calculated and indicated in the third subset. It is then not necessary to execute this instruction to obtain the result of the operation, thus reducing the processing steps of the operation. The first set of bits on which the first real-value representation is encoded can also comprise a third subset of bits representing information depending on the first subset of bits and / or the second subset of bits.The information encoded in the third subset of bits is advantageously a digital value, for example a real value. By information dependent on a subset of bits it is understood that the information is obtained by applying an operation or an instruction on the value encoded by the subset of bits when determining the correspondence table.
[0045] According to another aspect, there is provided a computer program comprising instructions for implementing all or part of a method as defined herein when these instructions are executed by a processor. According to another aspect of the invention, there is provided a non-transitory, computer-readable recording medium on which such a program is recorded.
[0046] Another aspect of the invention relates to a physical switch for an electronic communications network, the switch comprising:
[0047] - an input port connected to an electronic communications network;
[0048] - a processor; and
[0049] - a memory storing instructions, so that when these instructions are executed by the processor, they configure the switch to:
[0050] receive a packet via the input port;
[0051] determining a result of applying one or a plurality of operations to at least one input value obtained by the switch from the packet, wherein at least one of the operations corresponds to a lookup table, said lookup table representing correspondences between input values of the table and output values of the table, the input values of the table are represented in a first real value representation encoded on a first set of bits comprising a first subset of bits representing an integer part and a second subset of bits representing a decimal part and / or the output values of the table are represented in a second real value representation encoded on a second set of bits comprising a first subset of bits representing an integer part and a second subset of bits representing a decimal part; and
[0052] depending on the result of applying the operation or plurality of operations, apply an action on the package.
[0053] Other characteristics and advantages of the invention will become apparent from reading the description which follows. This description is purely illustrative and must be read in conjunction with the appended drawings in which: Fig. 1
[0054] illustrates switches according to the invention. Fig. 2
[0055] illustrates a flowchart representing the method in a particular embodiment. Fig. 3
[0056] illustrates a graph representing a decomposition of a function f into elementary operations.
[0057] In the example of the present invention, an electronic communication network 1 is described comprising switches 2, 3, 4, each of the switches connecting several physical segments 5 (e.g. cables or optical fibers) of the network together. On these physical segments, signals representing packets 8, 9 are communicated from switch to switch.
[0058] Some of these switches 3, 4 connect only segments 5 internal to the network, others of these switches 2 connect segments 5 internal to the network with segments coming from other electronic communication networks 7.
[0059] We then move into the field of software-defined communication networks of the SDN type (for "Software-Defined Networks"), in which a switch applies processing to a flow of packets using an RMT table (for "Reconfigurable Match-Action Tables").
[0060] We will describe in more detail the operation of a switch 3. This description can be easily transposed to other switches. The switch 3 comprises a communication unit (COM) 3.1 comprising input ports and output ports. The switch 3 also comprises a processor (PROC) 3.2, a memory (MEMO) 3.3 and a control plane communication unit (CONT_COM) 3.4 for configuring the switch 3.
[0061] Memory 3.3 includes non-volatile memory on which the computer program is stored and volatile memory on which the compiled script to be executed by the processor, correspondence tables, instructions relating to native operations are stored.
[0062] The control plane communication unit 3.4 allows the receipt of compiled scripts as well as correspondence tables sent through a control plane by a computer 10.
[0063] The processor 3.2 is in particular configured to control the communication unit 3.1 to receive packets 8 and to transmit packets 9 in a data transfer plane. The processor 3.2 is also configured to process the packet 8: this processing is defined by a script and implements a succession of operations executed on the basis of correspondence tables or sequences of instructions stored on the volatile memory. The processing by the switch 3 of the packet 8 ends when the packet is transmitted (as in the case of packet 9) to another entity of the network, for example another switch, or when the packet is dropped.
[0064] The 3.2 processors implemented in the physical switches 2, 3, 4 are switch-specific processors that allow processing with very little latency, for example, RISC-type processors.
[0065] The computer 10 makes it possible to supervise the activity of the different switches 2, 3, 4 of the network 1 and to configure them, namely to transmit to them the compiled scripts to be executed and the correspondence tables making it possible to execute these scripts. The communication between the control computer 10 and the switches 2, 3, 4 takes place at the level of the control plane via the same packets 8, 9 or via packets specific to the control plane 11. The computer 10 can allow the network manager to write the scripts, to compile them and to generate the correspondence tables. However, these different tasks can be distributed over different entities.
[0066] It represents a flowchart of a process according to a particular embodiment.
[0067] In step S1, the user enters into the computer 10 a script relating to a processing operation to be applied at the switch. This script indicates the packets concerned by the processing operation, a rule to be executed and an action to be taken by the switch according to the rule. The rule comprises a function and a domain of definition of this function. This rule also comprises a definition of the inputs used to calculate the result of this function. Thus, the rule determines a function f and inputs of this function. The action is defined as dependent on the result of the application of the rule.
[0068] For example, the function can be f(x,y), with x and y representing a first and second characteristic or value of a packet, respectively. For example, x can represent the packet size and y can represent the source port number of the packet. If the packets under consideration are TCP (for "Transmission Control Protocol") packets, the packet size can be between 0 and 32 bits. Thus, the range of x can be defined as the interval [0; 32]. For example, y can represent the source port of the received packet. The source physical port is the physical input port of the switch through which the packet entered the network.
[0069] The packets concerned, that is to say those for which the rule will be applied, can for example, be the packets whose source port is one of the physical ports numbers [1, 2, 3, 6, 5] of the network, and the destination port is physical port number 4. The destination physical port is the physical output port of the switch through which the packet will leave the network. The source physical port is the physical input port of the switch through which the packet will enter the network.
[0070] Based on the script indicating the packets affected by the processing, a correspondence table is generated. This associates input values representing a characteristic of the packet or corresponding to values of the packet with the first operation(s) to be executed to apply the rule.
[0071] In the case of the example, the action is defined based on the rule results, i.e. the result of calculating f(x,y). For example, a threshold δ is defined and the action can be defined for example as dropping the packet when the result is equal to or lower than this threshold.
[0072] In the case of this example, f can be defined by the equation:
[0073]
[0074] The function f defined above is an example. This description is not limited to this type of function. For example, f can have a single input x (e.g. log(x)) or a set of inputs (x, y, z…).
[0075] In step S2, the computer 10 determines for each input, x, y, of the function f a correspondence table matching the possible values taken by the inputs x (respectively y) of the function f which are integers with values (respectively ) expressed in a real value representation RVR x (respectively RVR y ). Real-valued representation is a real representation of numbers in a number of bits, in which a part of the bits, for example, the first bits of this representation represent the integer part of the real number and a second part, for example, the following bits of this representation represent the decimal part of the real number.
[0076] Each of the inputs x, y can be represented in a real-valued representation RVR x , RVR y which is specific to it. Thus, in the case of the example, two correspondence tables are determined LUT x and LUT y . The n x first bits of the real-valued representation used in LUT x can correspond to the integer part of the representation and the following bits to the decimal part of the real value representation RVR x used in LUT x . Similarly, the n y first bits of the real-valued representation used in LUT y can correspond to the integer part of the representation and the following bits to the decimal part of the real value representation RVR y used in LUT y .
[0077] Depending on the implemented function f, n x and n y can be distinct. In the example in Figure 2, n x and n y are identical when the sum function x + y is not implemented as a lookup table, but directly as a native switch operation. In this example, n x and n ycan also be distinct when the sum function x + y is implemented as a lookup table. In this case the lookup table corresponding to x+y or to a set of operations including x+y (for example, ) takes into account RVR representations x and RVR y used and therefore can adapt to differences in representations.
[0078] Any distribution of bits between the integer and fractional parts can be implemented. However, it is possible to choose optimized distributions depending on the implemented function and possible inputs. This allows to optimize the accuracy of the calculated values and to reduce errors in calculating the result of the function f. This optimization is performed in a later step.
[0079] In addition, a value (the real representation of an integer value x iobtained using the LUT lookup table x ) and a value (the real representation of an integer value y j obtained using the LUT lookup table y ) may also differ while the values of x i and there i are identical. In principle, the difference between the two values And will be low, but may be more significant when the sum function x + y is implemented as a lookup table, i.e. the first operation performed on x and y is performed using a lookup table and not a native operation. In this case the lookup table corresponding to the operation x + y takes into account the differences induced by the LUT lookup tables x and LUT y in the transformation of identical integers.
[0080] Distinctions between LUT mappings x , LUTy same integer values with their real-valued representations can be performed to obtain more accurate results once the function f is applied to these real-valued values. This optimizes the accuracy of the calculated values and reduces errors in calculating the result of the function f. This optimization is performed in a later step.
[0081] More generally, for the same representation in real value, for example RVR x , each representation in real value , can be adapted separately. This makes it possible to adapt the input values on which the function will be applied and thus to obtain more precise results of the function f or with fewer errors, in particular when the result of the function f (or of a subfunction of f) expressed in the real value representation does not correspond to the rounding to the same number of decimal digits of the result that would have been obtained with a real value representation with more bits and in particular more bits allocated to the decimal part.
[0082] Optimizing LUT lookup tables x , LUT y (i.e., optimizing the values in the real-valued representation assigned to each integer) and RVR real-valued representations x , RVR y (i.e. optimization of the distribution of bits between the integer part and the decimal part) used will be described in the optimization step.
[0083] In the example of Figure 2, LUT x maps the possible values that x can take (namely the values 0 to 32) to as many values expressed in the real value representation RVR x on n bits. For example, if the real value representation is coded on 32 bits, n x can be 16 and can be 16. Thus, the first 16 bits of the real-valued representation represent the integer part of the real number and the following 16 the decimal part. The distance between the integer part of the real-valued representation and the integer x i is small, that is, the distance between the value and the valuex i is less than a threshold, for example, strictly less than 0.5.
[0084] In the example in Figure 2, LUT ymaps the possible values of the source ports (namely the values 0 to 18) to as many values expressed in the real value representation RVR y on n bits. Here we will take, for the sake of simplification of the presentation, n y equal to n x , that is, that n y And are equal to 16. The distance between the integer part of the real-valued representation and the whole i is small, that is, the distance between the value and the value i is less than a threshold, for example, strictly less than 0.5.
[0085] By determining the LUT correspondence tables x and LUT y it is understood the generation of these tables.
[0086] The values And correspond to a binary notation, with one part representing the integer part and one part representing the decimal part. However, it is not necessary to have information in the real-valued representation indicating the position of the decimal point. Indeed, native operations are not affected by the location of the decimal points. Thus, the result of an operation, for example, x + y will be the same regardless of the location of the decimal point in RVR real-valued representations x , RVR y , except when x and y have integer and decimal parts encoded on a different number of bits.
[0087] In step S3, the function f is decomposed into elementary operations by the computer 10. As shown in , a graph representation of the Directed Acyclic Graph type can be used to represent the function. Each node of the graph represents an elementary operation (for example, an addition, a multiplication, a sine, a logarithm, etc.) and each edge of the graph represents the relationship between the two elementary operations of the two nodes connected by the edge (for example, the composition of these two elementary operations).
[0088] In the example of the function f(x,y) defined by the previous equation, f can be broken down into operations which are addition 31, multiplication by a constant 32, exponential 33, addition with a constant 34, and inversion 35.
[0089] Addition 31, multiplication by a constant 32, and addition with a constant 34 can be natively implemented operations. Exponential 33 and inversion 35 are implemented using lookup tables.
[0090] Nodes 30.1 and 30.2 correspond to the correspondence tables transforming the integers x into and there are some . Nodes 32.1, 34.1 and 35.1 are nodes corresponding to constants.
[0091] In step S4, the correspondence tables corresponding to the exponential and inverse operations are generated by the computer 10.
[0092] Thus, the correspondence table corresponding to the exponential operation associates with each of the possible values of (resulting from the sum of with multiplied by log(2) obtained by applying the operations implemented natively on the switch) a value represented in a real-valued representation RVR u close to the value of the calculation of the exponential function on . By close we mean the distance between the result of the exponential function on and the value is less than a threshold, for example 0.5.
[0093] In addition, the correspondence table corresponding to the inverse operation associates with each of the possible values of (resulting from the sum of with 1 obtained by applying an operation implemented natively on the switch) a value represented in a real-valued representation RVR w close to the value of the calculation of the inverse function on . By close we mean the distance between the result of the inverse function on and the value is less than a threshold, for example 0.5.
[0094] These tables can be optimized by any known optimization technique. For example, for each pair of input values (x i ,y j ) it is possible to associate a set of values allowing the output values of the correspondence tables concerned to be adapted by the pair of input values (x i ,y j ). So the output value from the lookup table corresponding to node 30.1 for the input value x i can be replaced by the value , the output value from the lookup table corresponding to node 30.2 for the input value y j can be replaced by the value , the output value of the correspondence table corresponding to node 33 for the pair of input values (x i ,y j) can be replaced by the value , the output value of the correspondence table corresponding to node 35 for the pair of input values (x i ,y j ) can be replaced by the value . Thus, for each n-tuple of input value, here the pair of input values (x i ,y j ), it is possible to associate a set , here , , et , serving as a parameter to perform the optimization of the lookup tables used. Each value is small, that is, close to 0. Optimization consists of determining the set which minimizes the distance between values and the values obtained resulting from the calculation of the function f on the input pairs (x,y) when this calculation is carried out with a precision greater than the precisions of the RVR real value representationsx , RVR y , RVR u , RVR w used for the calculations of operations as described in Figure 3 and with a processor adapted to numerical calculation. Once the set determined, the optimized correspondence tables are obtained by respectively replacing the values by values for all pairs (i,j) ∈ [0; 32]x[0; 18].
[0095] In addition, it is also possible to optimize the distribution of bits between the integer and decimal parts of each real value representation RVR x , RVR y , RVR u , RVR w output values of the lookup tables. For example, for each lookup table several bit distributions are determined. For example, the output values are represented on three real-valued representations with different bit distributions RVR 1 x, RVR 2 x , RVR 3 x . Similarly, the output values are represented on three real-valued representations with different bit distributions RVR 1 y , RVR 2 y , RVR 3 y , the output values are represented on three real-valued representations with different bit distributions RVR 1 u , RVR 2 u , RVR 3 u . Finally, the output values are represented on three real-valued representations with different bit distributions RVR 1 w , RVR 2 w , RVR 3 w . The combination of real-valued representations RVR t x , RVR t’ y , RVR t ’’ u , RVR t ’’ wwith the quadruple (t, t', t'', t''') ∈ {1,2,3} 4 which minimizes the distance between values and the values obtained resulting from the calculation of the function f on the input pairs (x,y) when this calculation is carried out with a precision greater than the precisions of all the real value representations used for the calculations of the operations is the combination of representations implemented respectively in the correspondence tables representing the nodes 30.1, 30.2, 33, 35.
[0096] Optimization to adapt the output values of the lookup tables and optimization to determine the most appropriate bit distributions can be implemented successively, or even recursively.
[0097] The correspondence tables can also be adapted to integrate for each input or output value information relating to this value, called additional information. Thus, for example, the real value representations RVR x , RVR y , RVR u , RVR w may provide additional bits to encode this additional information. For example, these representations may be encoded on 40 bits, 8 of which are reserved for the additional information. This additional information depends on the operations to be applied to the value relating to this information. For example, given that the output values of operation 33 are very large compared to 1 when is large we can approximate by . It is then possible to indicate in the RVR representations u coding for values corresponding to the values greater than a threshold, for example 5, the value of as additional information. Thus, the value of added in RVR representation u can directly replace the result of the processing of operation 35, that is to say that for the values of large, the calculation will not need to be done.
[0098] The values resulting from operation 32 can also be represented in an RVR representation z part of which encodes additional information. These values are the inputs to operation 33.
[0099] When one of the operations to be applied is the logarithm, the additional information added to the output values of the lookup table T pré oprepresenting the operation (e.g., the operation that transforms a value encoded in an integer value representation into a value encoded in a real value representation) preceding the logarithm can indicate an approximation of the logarithm for this value s. Thus, it is possible to indicate as additional information encoded on the 8 bits the integer value n such that . Since , the operation representing the logarithm can thus be reduced to the calculation of , being between 1 and 2, can be approximated by which reduces the complexity of the calculation.
[0100] In step S5, the script is compiled by computer 10.
[0101] In step S6, the compiled script and the correspondence tables generated in steps S1 (correspondence table relating to the packets concerned), S2 (correspondence tables relating to the transformation of the inputs into real value representation) and S4 (correspondence tables relating to the operations which are not implemented natively on the switch) are transmitted to the physical switches, and in particular to the physical switch 3 to be stored in its memory 3.3 and to be executed by its processor 3.2.
[0102] The setting of the physical switch 3 performed by steps S1 to S6 is then completed. Steps S1 to S6 can all be performed by the computer 10.
[0103] At step S7, switch 3 receives packet 8 on one of its input ports.
[0104] In step S8, switch 3 executes the compiled script received in step S6.
[0105] Running the compiled script causes the first LUT to be applied init determined in step S1 (correspondence table relating to the packets concerned) to determine whether packet 8 is concerned by the processing. Thus, a value corresponding to a characteristic of the packet or directly to one or more values of the packet are entered into LUT init . At output, the LUT lookup table init then indicates the action to be applied and the rule (i.e. the sequence of operations) to be executed. For example, the pair of values corresponding respectively to the source port and the destination port of packet 8 is entered in the LUT correspondence table init , if the pair of values belongs to the set {1, 2, 3, 6, 5}x{4} then the rule to be executed and the action to be applied are indicated at the output of the LUT correspondence table init .
[0106] Executing the compiled script results in the operations as described in Figure 2 being applied to the x and y values extracted from packet 8. For example, since packet 8 has a size of 32 bits and the source port of packet 8 is 6, the integers x, y of packet 8 are equal to 32 and 6 respectively. The LUT tables x and LUT y (i.e., the lookup tables relating to the transformation of the inputs of f into real-valued representation determined in step S2) of transformation of x and y are applied respectively to the values 32 and 6. For example, at the value 32, LUT x maps the value 31.98561 to the value 6, LUT y matches the value 6.00153. These two values And are respectively expressed in the form of the real value representations RVR t x and RVR t’ ywhose distributions between whole parts and decimal parts are the same.
[0107] Then the execution of the compiled script indicates the native operation 31 to be applied, that is to say the addition of And whose instructions are stored natively on switch 3. The instructions for performing the addition are the same as for an addition between two integers, that is, to add the bits of the same weight together. However, when the real-value representations in which the values to be added are encoded have different bit distributions, then the script can provide an intermediate operation, for example, to remove the last bit(s) of the decimal part and add as many zero bits in front of the other bits of the integer part. Switch 3 obtains the value 37.98714 at the output of operation 31.
[0108] The execution of the script then indicates the native operation 32 to be applied, that is to say the multiplication of the result obtained by log(2) whose instructions are stored natively on switch 3. Switch 3 obtains at the output of operation 32 the value 11.435268.
[0109] Running the script then indicates operation 33 to be applied, i.e. applying the exponential function on . The script refers to the LUT table u corresponding to operation 33 (generated and optimized in step S4 and stored on switch 3) to apply this exponential function. The LUT table u is applied to the value 11.435268. The output from the LUT table u is expressed in the form of the real-valued representation RVR t ’’ uhaving an integer part represented in a much larger number of bits than the decimal part to accommodate the exponential function. For example, the decimal part of is coded on 0 bits while the integer part of is coded on all available bits, namely 32 bits. Thus, the LUT table u maps to the value 11.435268, the value 92,528 encoded in the RVR representation t ’’ u .
[0110] Then, running the compiled script indicates the native operation 34 to be applied, i.e. the addition of and 1 whose instructions are stored natively on switch 3. Switch 3 obtains at the output of operation 34 the value 92,529.
[0111] The execution of the script then indicates the operation 35 to be applied, that is to say the application of the inverse operation on . The script refers to the LUT table wcorresponding to this operation 35 (generated and optimized in step S4 and stored on switch 3) to apply this operation. The LUT table w is applied to the value 92,527. The output from the LUT table w is expressed in the form of the real-valued representation RVR t ’’’ w having a decimal part represented on a much larger number of bits than the integer part to accommodate the inverse function whose output values are all between 0 and 1. For example, the integer part of is coded on 1 bit while the decimal part of is coded on all the remaining bits, namely 31 bits. Thus, the LUT table w maps to the value 92529, the value 0.000010807 encoded in the RVR representation t ’’’ w .
[0112] At step S9, the execution of the compiled script then indicates a comparison of the value obtained by applying the different operations with the threshold δ (for example a threshold of 0.0005) defined in step S1. The comparison can be a native operation with instructions stored on switch 3 or a final LUT lookup table fin which has the value associate 1 if is greater than the threshold and 0 otherwise. Then the switch applies the action indicated by the script depending on the result of the comparison. In the example of packet 8, the value of is lower than the threshold δ and therefore packet 8 is dropped, if the value of had been greater than the threshold δ packet 8 would have been forwarded to the segment leading to the destination port indicated in packet 8, as was the case for packet 9.
Claims
A method of processing a packet by a physical switch of an electronic communications network, the method comprising:Receiving by the switch a packet;Determining by the switch a result of applying one or a plurality of operations to at least one input value obtained by the switch from the packet, wherein at least one of the operations corresponds to a lookup table, said lookup table representing correspondences between input values of the table and output values of the table, the input values of the table are represented in a first real value representation encoded on a first set of bits comprising a first subset of bits representing an integer part and a second subset of bits representing a decimal part and / or the output values of the table are represented in a second real value representation encoded on a second set of bits comprising a first subset of bits representing an integer part and a second subset of bits representing a decimal part;andDepending on the result of applying the one or more operations, applying an action to the packet by the switch.; The method of claim 1, wherein determining the action to be applied to the packet and / or the at least one input value obtained from the packet and / or the operation or plurality of operations is a function of at least one trigger value obtained by the switch from the packet. Method according to one of the preceding claims in which the distribution of the bits between the first subset of bits and the second subset of bits of the first set of bits is modified in order to minimize the difference between the result of the application of the operation or the plurality of operations on the at least one input value and the result of the function which the operation or the plurality of operations represents when the function is applied on the at least one input value and calculated with a precision greater than the precisions of the real value representations RVR1, i ,RVR2, i;and / orthe distribution of bits between the first subset of bits and the second subset of bits of the second set of bits is modified in order to minimize the deviation between the result of the application of the operation or the plurality of operations on the at least one input value and the result of the function that the operation or the plurality of operations represents when the function is applied on the at least one input value and calculated with a precision greater than the precisions of the real value representations RVR 1,i,RVR2,i. Method according to one of the preceding claims in which each LUT lookup table i corresponding to one of the plurality of operations represents correspondences between input values of the LUT table i and output values from the LUT table i , the input values of the LUT table iare represented in a first real value representation RVR 1,i coded on a first set of bits EB 1,1,i comprising a first subset of SEB bits 1,1,i representing an integer part and a second subset of SEB bits 1,2,i representing a decimal part and / or the output values of the table are represented in a second real value representation RVR 2,i encoded on a second set of EB bits 2,i comprising a first subset of SEB bits 2,1,i representing an integer part and a second subset of SEB bits 2,2,i representing a decimal part. The method of claim 4 wherein the one or more operations among the plurality of operations that have as inputs the at least one input value correspond to LUT lookup tables. i whose output values are represented in second real value representations RVR2,i . A method according to any preceding claim wherein at least one output value of a lookup table corresponding to one of the one or more operations is adapted by adding or subtracting a value in order to minimize the discrepancy between the result of applying the operation or plurality of operations to the at least one input value and the result of the function that the operation or plurality of operations represents when the function is applied to the at least one input value and calculated with a precision greater than the precisions of the real value representations RVR1, i ,RVR2, i . Method according to one of the preceding claims in which the operations not corresponding to a lookup table are operations among addition, multiplication, permutation, bit shift to the left, bit shift to the right. Method according to one of the preceding claims in which the second set of bits on which the second real value representation is encoded comprises a third subset of bits representing information depending on the first subset of bits and / or the second subset of bits, and in which the result of the application of one or a plurality of operations is based on the information. The method of claim 8 wherein the result of a next operation among the plurality of operations is based on the information, said next operation being performed after the at least one operation corresponding to a lookup table.
10. Method according to one of the preceding claims in which the first set of bits on which the first real value representation is coded comprises a third subset of bits representing information depending on the first subset of bits and / or the second subset of bits.
11. Computer program comprising instructions for implementing the method according to one of the preceding claims, when these instructions are executed by a processor.
12. Physical switch of electronic communications network, the switch comprises:- an input port connected to an electronic communications network;- a processor; and- a memory storing instructions, so that when these instructions are executed by the processor, they configure the switch to:receive via the input port a packet;determining a result of an application of one or a plurality of operations on at least one input value obtained by the switch from the packet, at least one of the operations corresponds to a lookup table, said lookup table representing correspondences between input values of the table and output values of the table, the input values of the table are represented in a first real value representation encoded on a first set of bits comprising a first subset of bits representing an integer part and a second subset of bits representing a decimal part and / or the output values of the table are represented in a second real value representation encoded on a second set of bits comprising a first subset of bits representing an integer part and a second subset of bits representing a decimal part;and depending on the result of applying the operation or plurality of operations, applying an action to the package.;
