From d8aaffbc2789cf96343d7a397705a588893f2d21 Mon Sep 17 00:00:00 2001 From: Disty0 Date: Tue, 17 Jun 2025 19:58:20 +0300 Subject: [PATCH 1/3] IPEX fix DPM2++ FlowMatch --- modules/intel/ipex/hijacks.py | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/modules/intel/ipex/hijacks.py b/modules/intel/ipex/hijacks.py index d81d7b05c..663d88f56 100644 --- a/modules/intel/ipex/hijacks.py +++ b/modules/intel/ipex/hijacks.py @@ -254,8 +254,15 @@ torch.Tensor.original_Tensor_to = torch.Tensor.to @wraps(torch.Tensor.to) def Tensor_to(self, device=None, *args, **kwargs): if check_cuda(device): + if not device_supports_fp64 and kwargs.get("dtype", None) == torch.float64: + kwargs["dtype"] = torch.float32 return self.original_Tensor_to(return_xpu(device), *args, **kwargs) else: + if not device_supports_fp64: + if kwargs.get("dtype", None) == torch.float64: + kwargs["dtype"] = torch.float32 + elif device == torch.float64 and self.device.type == "xpu": + device = torch.float32 return self.original_Tensor_to(device, *args, **kwargs) original_Tensor_cuda = torch.Tensor.cuda From 71c2714edf73022aed5152f6297113302dcd5783 Mon Sep 17 00:00:00 2001 From: Disty0 Date: Tue, 17 Jun 2025 20:04:15 +0300 Subject: [PATCH 2/3] Cleanup --- modules/intel/ipex/hijacks.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/modules/intel/ipex/hijacks.py b/modules/intel/ipex/hijacks.py index 663d88f56..2a3b9e06a 100644 --- a/modules/intel/ipex/hijacks.py +++ b/modules/intel/ipex/hijacks.py @@ -259,7 +259,7 @@ def Tensor_to(self, device=None, *args, **kwargs): return self.original_Tensor_to(return_xpu(device), *args, **kwargs) else: if not device_supports_fp64: - if kwargs.get("dtype", None) == torch.float64: + if kwargs.get("dtype", None) == torch.float64 and torch.device(device).type == "xpu": kwargs["dtype"] = torch.float32 elif device == torch.float64 and self.device.type == "xpu": device = torch.float32 From e657cf790d2dd876510ff48b4c68c66425965af6 Mon Sep 17 00:00:00 2001 From: Disty0 Date: Wed, 18 Jun 2025 02:12:34 +0300 Subject: [PATCH 3/3] SDNQ fix int8 matmul with qwen --- modules/sdnq/__init__.py | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/modules/sdnq/__init__.py b/modules/sdnq/__init__.py index d9db525db..998e0a467 100644 --- a/modules/sdnq/__init__.py +++ b/modules/sdnq/__init__.py @@ -56,8 +56,11 @@ def sdnq_quantize_layer(layer, weights_dtype="int8", torch_dtype=None, group_siz output_channel_size, channel_size = layer.weight.shape if use_quantized_matmul: use_quantized_matmul = weights_dtype in quantized_matmul_dtypes and channel_size >= 32 and output_channel_size >= 32 - if use_quantized_matmul and not dtype_dict[weights_dtype]["is_integer"]: - use_quantized_matmul = output_channel_size % 16 == 0 and channel_size % 16 == 0 + if use_quantized_matmul: + if dtype_dict[weights_dtype]["is_integer"]: + use_quantized_matmul = output_channel_size % 8 == 0 and channel_size % 8 == 0 + else: + use_quantized_matmul = output_channel_size % 16 == 0 and channel_size % 16 == 0 if group_size == 0: if is_linear_type: