diff --git a/CHANGELOG.md b/CHANGELOG.md index 81445c602..c8d278532 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -53,7 +53,7 @@ - **StableVideoDiffusion** is now supported with IPEX - fix IPEX Optimize not applying with Diffusers backend - disable 32bit workarounds if the GPU supports 64bit - - add `DISABLE_IPEXRUN` environment variable + - add `DISABLE_IPEXRUN` and `DISABLE_IPEX_1024_WA` environment variables - compatibility improvements - **OpenVINO**, thanks @disty0 - add *Directory for OpenVINO cache* option to *System Paths* diff --git a/modules/intel/ipex/attention.py b/modules/intel/ipex/attention.py index 314078b62..ff7492a10 100644 --- a/modules/intel/ipex/attention.py +++ b/modules/intel/ipex/attention.py @@ -92,7 +92,7 @@ def scaled_dot_product_attention_32_bit(query, key, value, attn_mask=None, dropo split_2_slice_size = 1 break split_3_slice_size = shape_three - if split_2_slice_size * slice_block_size_2 > 6: + if split_2_slice_size * slice_block_size_2 > 4: slice_block_size_3 = split_slice_size * split_2_slice_size * shape_four / 1024 / 1024 * block_multiply do_split_3 = True # Find something divisible with the shape_three diff --git a/modules/intel/ipex/hijacks.py b/modules/intel/ipex/hijacks.py index 554fe320b..4573b7f7f 100644 --- a/modules/intel/ipex/hijacks.py +++ b/modules/intel/ipex/hijacks.py @@ -161,6 +161,10 @@ def ipex_hijacks(): CondFunc('torch.Generator', lambda orig_func, device=None: torch.xpu.Generator(return_xpu(device)), lambda orig_func, device=None: device is not None and device != torch.device("cpu") and device != "cpu") + else: + CondFunc('torch.Generator', + lambda orig_func, device=None: orig_func(return_xpu(device)), + lambda orig_func, device=None: check_device(device)) # TiledVAE and ControlNet: CondFunc('torch.batch_norm', diff --git a/modules/processing.py b/modules/processing.py index 6b89e6dd7..5df865865 100644 --- a/modules/processing.py +++ b/modules/processing.py @@ -148,7 +148,7 @@ class StableDiffusionProcessing: self.scale_by: float = scale_by self.image_cfg_scale = image_cfg_scale self.diffusers_guidance_rescale = diffusers_guidance_rescale - if devices.backend == "ipex" and width == 1024 and height == 1024: + if devices.backend == "ipex" and width == 1024 and height == 1024 and os.environ.get('DISABLE_IPEX_1024_WA', None) is None: width = 1080 height = 1080 self.width: int = width @@ -1037,7 +1037,7 @@ class StableDiffusionProcessingTxt2Img(StableDiffusionProcessing): def __init__(self, enable_hr: bool = False, denoising_strength: float = 0.75, firstphase_width: int = 0, firstphase_height: int = 0, hr_scale: float = 2.0, hr_force: bool = False, hr_upscaler: str = None, hr_second_pass_steps: int = 0, hr_resize_x: int = 0, hr_resize_y: int = 0, refiner_steps: int = 5, refiner_start: float = 0, refiner_prompt: str = '', refiner_negative: str = '', **kwargs): super().__init__(**kwargs) - if devices.backend == "ipex": + if devices.backend == "ipex" and os.environ.get('DISABLE_IPEX_1024_WA', None) is None: width_curse = bool(hr_resize_x == 1024 and self.height * (hr_resize_x / self.width) == 1024) height_curse = bool(hr_resize_y == 1024 and self.width * (hr_resize_y / self.height) == 1024) if (width_curse != height_curse) or (height_curse and width_curse):