[XPU] fix fused_input_norm for MM (#59865)
Signed-off-by: Yan Ma <yan.ma@intel.com>
This commit is contained in:
@@ -28,16 +28,7 @@ steps:
|
|||||||
export VLLM_WORKER_MULTIPROC_METHOD=spawn &&
|
export VLLM_WORKER_MULTIPROC_METHOD=spawn &&
|
||||||
export PYTHONFAULTHANDLER=1 &&
|
export PYTHONFAULTHANDLER=1 &&
|
||||||
cd tests &&
|
cd tests &&
|
||||||
pytest -v -s model_executor -m "not slow_test" --ignore="model_executor/layers/test_rocm_unquantized_gemm.py" --ignore="model_executor/model_loader/tensorizer_loader/test_tensorizer.py" --deselect="tests/model_executor/model_loader/test_reload.py::test_kv_scale_reload"
|
pytest -v -s model_executor -m "not slow_test" --ignore="model_executor/layers/test_rocm_unquantized_gemm.py" --ignore="model_executor/model_loader/tensorizer_loader/test_tensorizer.py" --deselect="tests/model_executor/model_loader/test_reload.py::test_kv_scale_reload"'
|
||||||
--deselect="tests/model_executor/layers/test_mm_input_norm.py::TestFusedMMInputNormModule::test_matches_reference_above_cudnn_grid_limit"
|
|
||||||
--deselect="tests/model_executor/layers/test_mm_input_norm.py::TestFusedMMInputNormDtypes::test_dtype_combinations[in_dtype0-out_dtype0]"
|
|
||||||
--deselect="tests/model_executor/layers/test_mm_input_norm.py::TestFusedMMInputNormDtypes::test_dtype_combinations[in_dtype1-out_dtype1]"
|
|
||||||
--deselect="tests/model_executor/layers/test_mm_input_norm.py::TestFusedMMInputNormDtypes::test_dtype_combinations[in_dtype2-out_dtype2]"
|
|
||||||
--deselect="tests/model_executor/layers/test_mm_input_norm.py::TestFusedMMInputNormDtypes::test_dtype_combinations[in_dtype3-out_dtype3]"
|
|
||||||
--deselect="tests/model_executor/layers/test_mm_input_norm.py::TestFusedMMInputNormDtypes::test_dtype_combinations[in_dtype4-out_dtype4]"
|
|
||||||
--deselect="tests/model_executor/layers/test_mm_input_norm.py::TestFusedMMInputNormDtypes::test_dtype_combinations[in_dtype5-out_dtype5]"
|
|
||||||
--deselect="tests/model_executor/layers/test_mm_input_norm.py::TestFusedMMInputNormShapes"
|
|
||||||
--deselect="tests/model_executor/layers/test_mm_input_norm.py::TestFusedMMInputNormInputHandling"'
|
|
||||||
|
|
||||||
- label: Tensorizer Model Loader Tests (XPU)
|
- label: Tensorizer Model Loader Tests (XPU)
|
||||||
key: tensorizer-model-loader-tests-xpu
|
key: tensorizer-model-loader-tests-xpu
|
||||||
|
|||||||
@@ -73,7 +73,8 @@ steps:
|
|||||||
bash .buildkite/scripts/hardware_ci/run-intel-test.sh
|
bash .buildkite/scripts/hardware_ci/run-intel-test.sh
|
||||||
'cd tests &&
|
'cd tests &&
|
||||||
pytest -v -s models/multimodal/generation/test_common.py -m core_model -k "not qwen2 and not qwen3 and not gemma" &&
|
pytest -v -s models/multimodal/generation/test_common.py -m core_model -k "not qwen2 and not qwen3 and not gemma" &&
|
||||||
pytest -v -s models/multimodal/generation/test_gemma_ragged_audio.py -m core_model'
|
pytest -v -s models/multimodal/generation/test_gemma_ragged_audio.py -m core_model
|
||||||
|
pytest -v -s models/multimodal/generation/test_qwen2_vl.py -m core_model'
|
||||||
|
|
||||||
- label: "Multi-Modal Models (Standard) 4: other + whisper"
|
- label: "Multi-Modal Models (Standard) 4: other + whisper"
|
||||||
key: multi-modal-models-standard-4-other-whisper
|
key: multi-modal-models-standard-4-other-whisper
|
||||||
|
|||||||
@@ -313,19 +313,15 @@ class FusedMMInputNorm(CustomOp):
|
|||||||
def forward_xpu(
|
def forward_xpu(
|
||||||
self, pixel_values: torch.Tensor, visual_dtype: torch.dtype
|
self, pixel_values: torch.Tensor, visual_dtype: torch.dtype
|
||||||
) -> torch.Tensor:
|
) -> torch.Tensor:
|
||||||
"""XPU fused custom kernel path.
|
"""XPU fused custom kernel path for uint8 and Triton kernel path
|
||||||
|
for others.
|
||||||
On XPU, fuse the whole rescale + normalise into a single custom
|
|
||||||
kernel. The eager path materializes an fp32 intermediate and then
|
|
||||||
casts back, which adds device-side compute that cancels the
|
|
||||||
bandwidth saving of transferring uint8 pixel_values. The fused
|
|
||||||
kernel reads uint8 directly and writes ``visual_dtype`` in one pass.
|
|
||||||
"""
|
"""
|
||||||
# The out-of-tree XPU kernel only supports the uint8 input that
|
if pixel_values.dtype != torch.uint8:
|
||||||
# device-side normalisation guarantees; fail loudly otherwise.
|
return self.forward_cuda(pixel_values, visual_dtype)
|
||||||
assert pixel_values.dtype == torch.uint8, (
|
|
||||||
f"xpu_fused_input_norm requires uint8 input, got {pixel_values.dtype}"
|
# For uint8 input, falls to xpu_fused_input_norm from xpu kernels
|
||||||
)
|
import vllm._xpu_ops # noqa: F401
|
||||||
|
|
||||||
return torch.ops.vllm.xpu_fused_input_norm(
|
return torch.ops.vllm.xpu_fused_input_norm(
|
||||||
pixel_values, self.weight, self.bias, visual_dtype
|
pixel_values, self.weight, self.bias, visual_dtype
|
||||||
)
|
)
|
||||||
|
|||||||
Reference in New Issue
Block a user