Update FP8 kernel configuration for 4xGPU support on AMD #3850
+39
−9
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.
Motivation
This PR aims to restore and improve FP8 quantization kernel functionality (specific to the Deepseek R1 model) on systems using 4 GPUs, especially on AMD GPUs. The changes ensure that the proper configuration files are selected based on the number of available GPUs, and that the default settings for the matrix multiplication function are adjusted to better support MFMA instructions on lower GPU counts.
Modifications
get_num_gpus()
to dynamically determine the number of GPUs usingtorch.cuda.device_count()
.get_w8a8_block_fp8_configs
to adjust the JSON configuration file naming logic when using HIP and fewer than 8 GPUs.w8a8_block_fp8_matmul
to provide an alternative configuration for AMD GPUs:Example
HSA_NO_SCRATCH_RECLAIM=1 HIP_VISIBLE_DEVICES=4,5,6,7 python3 -m sglang.bench_offline_throughput --model-path deepseek-ai/DeepSeek-R1 --tp 4 --num-prompts 10 --trust-remote-code