-
Notifications
You must be signed in to change notification settings - Fork 3.1k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[Kernel] Expand FP8 support to Ampere GPUs using FP8 Marlin #5975
Merged
+1,587
−44
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This is an awesome feature! |
comaniac
approved these changes
Jul 3, 2024
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Overall LGTM. Thanks!
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
This work expands FP8 support in vLLM from GPUs with hardware FP8 support (Hopper and Ada Lovelace) to GPUs without native support (currently Ampere) by introducing FP8 Marlin - a fast fused dequantization kernel for FP8 to BF16/FP16 conversion.
Key features:
quantization="fp8"
at runtime or use pre-quantized FP8 checkpointsImplementation details:
End-to-end performance and accuracy results:
![FP8 Marlin A10 E2E Latency in vLLM](https://private-user-images.githubusercontent.com/3195154/344824782-a2f3a500-9461-4d7d-a0ed-b9ce8672cc23.png?jwt=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJnaXRodWIuY29tIiwiYXVkIjoicmF3LmdpdGh1YnVzZXJjb250ZW50LmNvbSIsImtleSI6ImtleTUiLCJleHAiOjE3MjAxMTYwNDcsIm5iZiI6MTcyMDExNTc0NywicGF0aCI6Ii8zMTk1MTU0LzM0NDgyNDc4Mi1hMmYzYTUwMC05NDYxLTRkN2QtYTBlZC1iOWNlODY3MmNjMjMucG5nP1gtQW16LUFsZ29yaXRobT1BV1M0LUhNQUMtU0hBMjU2JlgtQW16LUNyZWRlbnRpYWw9QUtJQVZDT0RZTFNBNTNQUUs0WkElMkYyMDI0MDcwNCUyRnVzLWVhc3QtMSUyRnMzJTJGYXdzNF9yZXF1ZXN0JlgtQW16LURhdGU9MjAyNDA3MDRUMTc1NTQ3WiZYLUFtei1FeHBpcmVzPTMwMCZYLUFtei1TaWduYXR1cmU9YzkwMzlkMjZlMTgwYzllNjUxMjY5ZTQ4YWI0ZWM4N2VhOGU3ZWY3MmI5ODZkOGIwYTkyNGQ4NTJiZDUyOTEzMCZYLUFtei1TaWduZWRIZWFkZXJzPWhvc3QmYWN0b3JfaWQ9MCZrZXlfaWQ9MCZyZXBvX2lkPTAifQ.VL2sP8Z_sgfVZRnUtOjuH6BiiWPu0tQnmWevHH2i5aY)
![FP8 Marlin A100 E2E Latency in vLLM](https://private-user-images.githubusercontent.com/3195154/344333825-57d635c7-55c6-427a-963a-81ca611de550.png?jwt=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJnaXRodWIuY29tIiwiYXVkIjoicmF3LmdpdGh1YnVzZXJjb250ZW50LmNvbSIsImtleSI6ImtleTUiLCJleHAiOjE3MjAxMTYwNDcsIm5iZiI6MTcyMDExNTc0NywicGF0aCI6Ii8zMTk1MTU0LzM0NDMzMzgyNS01N2Q2MzVjNy01NWM2LTQyN2EtOTYzYS04MWNhNjExZGU1NTAucG5nP1gtQW16LUFsZ29yaXRobT1BV1M0LUhNQUMtU0hBMjU2JlgtQW16LUNyZWRlbnRpYWw9QUtJQVZDT0RZTFNBNTNQUUs0WkElMkYyMDI0MDcwNCUyRn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XlfaWQ9MCZyZXBvX2lkPTAifQ.KR7ygg9Q6bWkuaLIUfKt6Z1b3-ihmriUMy8ZlSxJPt4)
![A10 Layer-wise Sweep _ PyTorch FP16 vs FP8 Marlin MatMul](https://private-user-images.githubusercontent.com/3195154/344825673-70275c91-4f2f-4b4e-bec1-eef7176d026c.png?jwt=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJnaXRodWIuY29tIiwiYXVkIjoicmF3LmdpdGh1YnVzZXJjb250ZW50LmNvbSIsImtleSI6ImtleTUiLCJleHAiOjE3MjAxMTYwNDcsIm5iZiI6MTcyMDExNTc0NywicGF0aCI6Ii8zMTk1MTU0LzM0NDgyNTY3My03MDI3NWM5MS00ZjJmLTRiNGUtYmVjMS1lZWY3MTc2ZDAyNmMucG5nP1gtQW16LUFsZ29yaXRobT1BV1M0LUhNQUMtU0hBMjU2JlgtQW16LUNyZWRlbnRpYWw9QUtJQVZDT0RZTFNBNTNQUUs0WkElMkYyMDI0MDcwNCUyRnVzLWVhc3QtMSUyRnMzJTJGYXdzNF9yZXF1ZXN0JlgtQW16LURhdGU9MjAyNDA3MDRUMTc1NTQ3WiZYLUFtei1FeHBpcmVzPTMwMCZYLUFtei1TaWduYXR1cmU9YWY0ZTFkYmJlZjg4NzQ3ZjdkOGIwZjA1NGIxZDM3NWExNzUyNDJjM2I0N2JjNjJlN2I2N2Y1YjgwZTgyODcwMCZYLUFtei1TaWduZWRIZWFkZXJzPWhvc3QmYWN0b3JfaWQ9MCZrZXlfaWQ9MCZyZXBvX2lkPTAifQ.MzPnmls0APxUl3BfyT3ErcmVuHCK38zdmSoi2OMrxjs)
![A100 Layer-wise Sweep _ PyTorch FP16 vs FP8 Marlin MatMul](https://private-user-images.githubusercontent.com/3195154/344825678-669e574f-7ae5-40aa-945c-d0ee2db833c5.png?jwt=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJnaXRodWIuY29tIiwiYXVkIjoicmF3LmdpdGh1YnVzZXJjb250ZW50LmNvbSIsImtleSI6ImtleTUiLCJleHAiOjE3MjAxMTYwNDcsIm5iZiI6MTcyMDExNTc0NywicGF0aCI6Ii8zMTk1MTU0LzM0NDgyNTY3OC02NjllNTc0Zi03YWU1LTQwYWEtOTQ1Yy1kMGVlMmRiODMzYzUucG5nP1gtQW16LUFsZ29yaXRobT1BV1M0LUhNQUMtU0hBMjU2JlgtQW16LUNyZWRlbnRpYWw9QUtJQVZDT0RZTFNBNTNQUUs0WkElMkYyMDI0MDcwNCUyRnVzLWVhc3QtMSUyRnMzJTJGYXdzNF9yZXF1ZXN0JlgtQW16LURhdGU9MjAyNDA3MDRUMTc1NTQ3WiZYLUFtei1FeHBpcmVzPTMwMCZYLUFtei1TaWduYXR1cmU9MDU3YTYyYTZlMTJmYmZkYzIwZGJiM2M4NzM2Y2M4ZmFkYmU4MjRkMGVkMmFkMjU3NDc5YjkwNTY5NTFkOWQ2YiZYLUFtei1TaWduZWRIZWFkZXJzPWhvc3QmYWN0b3JfaWQ9MCZrZXlfaWQ9MCZyZXBvX2lkPTAifQ.2BOME793lMyHXUE0rhir4N4jllTLn2XJm51O59diBB8)
Individual layer sweeps:
As shown in the graphs, FP8 Marlin can provide significant speedups with minimal accuracy impact. Performance gains are higher on GPUs with less memory bandwidth (A10, RTX 3090) and for larger models.
Notes:
Testing:
This enhancement enables more users to benefit from FP8 quantization without hardware restrictions, improving vLLM's performance and efficiency across a broader range of setups!