Enhanced FP8 Support with Significant Performance Optimizations #122
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Description
This PR ports and enhances FP8 support from #82 to the latest branch, delivering substantial performance improvements through optimized computational patterns and memory access strategies.
Key Changes
Compared to Original FlashMLA:
retrieve_rP_for_SP(sQ(8))operationsImprovements over PR #82:
ceil_divcalculationsPerformance Benchmarks
Test Configuration:
Key Performance Highlights:
Representative Performance Comparison:
Configuration: b=128, s_q=1, mean_sk=4096, h_q=16
Configuration: b=128, s_q=2, mean_sk=4096, h_q=32
Scalability Analysis:
Across Head Counts (mean_sk=4096, s_q=1):
Across Sequence Lengths (h_q=16, s_q=1):
Performance Improvements Summary
vs Original FlashMLA (bfloat16):
vs PR #82 (FP8):
Technical Advantages
Computational Efficiency:
Memory Optimization:
Scalability:
Testing & Validation
Usage
export ENABLE_SWAPAB=1 python3 -m sglang.launch_server XXX --quantization fp8 --kv-cache-dtype fp8_e4m3This PR delivers substantial performance improvements while maintaining full numerical correctness and compatibility with existing FP8 functionality.