Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 7 additions & 6 deletions vllm/model_executor/layers/quantization/utils/fp8_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -201,12 +201,13 @@ def apply_w8a8_block_fp8_linear_fake(
return torch.empty(output_shape, dtype=input.dtype, device=input.device)


direct_register_custom_op(
op_name="apply_w8a8_block_fp8_linear",
op_func=apply_w8a8_block_fp8_linear,
mutates_args=[],
fake_impl=apply_w8a8_block_fp8_linear_fake,
)
if not current_platform.is_cpu():
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

medium

The condition not current_platform.is_cpu() is correct for the immediate problem, but it could be more specific. The apply_w8a8_block_fp8_linear function appears to be implemented only for CUDA and ROCm platforms, as it relies on GPU-specific kernels (Triton, CUTLASS, or AITer).

Using a more specific check like current_platform.is_cuda_alike() would be more robust. This would prevent the operator from being incorrectly registered on other future non-CPU platforms (e.g., TPU, HPU) where it might not be supported, improving future maintainability.

Suggested change
if not current_platform.is_cpu():
if current_platform.is_cuda_alike():

direct_register_custom_op(
op_name="apply_w8a8_block_fp8_linear",
op_func=apply_w8a8_block_fp8_linear,
mutates_args=[],
fake_impl=apply_w8a8_block_fp8_linear_fake,
)


def input_to_float8(
Expand Down