TL;DR
Programmable switches are incredibly useful for accelerating distributed applications, but they lack the hardware to perform floating-point arithmetic. NetFC solves this by introducing a highly optimized, memory-efficient table-lookup method that enables accurate, on-the-fly floating-point math (including multiplication and division) directly on the switch data plane, eliminating the need for slow CPU detours or lossy integer conversions.
What Problem Does This Paper Address?
In modern data centers, "in-network computation" is a popular way to speed up data-intensive applications like distributed machine learning and network telemetry. By offloading tasks from servers to programmable switches (like the Barefoot Tofino), systems can drastically reduce network overhead.
However, there is a major hardware limitation: switch ASICs only support simple integer arithmetic (addition and subtraction). They do not have Floating Point Units (FPUs). Because many applications require floating-point numbers and complex operations (multiplication/division), developers currently rely on two flawed workarounds:
- Float-to-integer conversion: Multiplying floats by a large number on the host to turn them into integers before sending them to the switch. This causes massive accuracy loss due to integer overflow or the truncation of small decimals.
- Switch CPU processing: Sending packets from the switch's fast data plane to its local CPU (the "slow path") to do the math, which introduces severe latency.
Methods
NetFC enables floating-point math directly on the switch data plane using a table-lookup method.
A naive lookup table for 16-bit float addition would require 8GB of memory—impossible for a switch with only ~20MB of SRAM. To fix this, NetFC uses a Divide-and-Conquer approach based on logarithm projection. By converting numbers into the logarithmic domain, complex math becomes simpler (e.g., $x \times y$ becomes $2^{\log_2(x) + \log_2(y)}$). NetFC breaks the math down into three small tables: logTable (to get the log), miTable (to handle addition/subtraction complexities), and expTable (to convert the result back).
To make this work on integer-only hardware, NetFC introduces two key optimizations:
- Scaling Factor: Because switches round down decimals, taking a logarithm directly loses precision. NetFC multiplies the log by a scaling factor (e.g., $k=1024$) to preserve the fractional part as an integer, dividing it out at the end.
- Prefix-Based Lossless Compression: NetFC uses TCAM wildcards to merge adjacent table entries that share the same output value, saving about 25% of the required memory.
Datasets
The authors evaluated NetFC using three datasets:
- Dataset I (Synthetic): 10,000 randomly generated 16-bit floating-point numbers.
- Dataset II (Synthetic): 10,000 randomly generated 16-bit floating-point decimals (specifically small numbers ranging from -0.01 to 0.01).
- Dataset III (Real-world): 50,000 gradient updates sampled from an actual distributed deep learning model training session.
Key Insights and Ideas
- Math hacks bypass hardware limits: By translating arithmetic into the logarithmic domain, NetFC successfully tricks integer-only switch ASICs into performing complex floating-point multiplication and division at line rate.
- Float-to-integer is fundamentally fragile: The baseline float-to-integer method fails catastrophically on numbers with large dynamic ranges (causing integer overflow) or very small numbers (losing the decimal entirely). NetFC's logarithmic approach naturally handles dynamic range much better, making it far more robust for real-world machine learning gradients.
- Future-proofing with Posit: NetFC isn't just built for standard IEEE 754 floats; it also supports the emerging "Posit" floating-point standard. Posit is gaining traction in AI for its better dynamic range and "tapered accuracy," proving NetFC's underlying logic is highly adaptable.
Key Results
- High Accuracy: NetFC achieved an average accuracy of at least 99.94% across all operations (+, -, *, /) and datasets, vastly outperforming the float-to-integer baseline.
- Low Overhead: The entire system consumes only ~448KB of on-chip memory and uses just 5 pipeline stages, easily fitting into a standard Barefoot Tofino switch.
- Massive Latency Reduction: The authors integrated NetFC into the Sonata network telemetry system to detect Slowloris DDoS attacks (a task requiring division). NetFC reduced detection latency from 43.156ms (using the switch CPU) to just 0.046ms (processing entirely on the data plane)—a roughly 938x speedup.
Limitations and Future Work
- Memory vs. Accuracy Trade-off: The scaling factor used to maintain precision directly dictates the size of the lookup tables. Achieving higher accuracy requires consuming more of the switch's precious SRAM/TCAM memory.
- Posit Standard Constraints: Because the Posit standard has a larger dynamic range than IEEE 754, it requires a smaller scaling factor to fit within the same memory footprint. Consequently, NetFC's accuracy for Posit numbers is slightly lower than for IEEE 754 floats in this specific implementation.
- Future Work: The authors position NetFC as a foundational building block for in-network computation. Future work could involve scaling this approach to support 32-bit floats or implementing more complex mathematical functions (like neural network activation functions) directly in the network.
Summary updated