IPEX fix fp64 check

This commit is contained in:
Disty0
2024-08-05 03:32:40 +03:00
parent 7eacec4c39
commit 82bcc2b10a
3 changed files with 5 additions and 3 deletions
+3 -1
View File
@@ -16,6 +16,8 @@ def ipex_init(): # pylint: disable=too-many-statements
if hasattr(torch, "cuda") and hasattr(torch.cuda, "is_xpu_hijacked") and torch.cuda.is_xpu_hijacked:
return True, "Skipping IPEX hijack"
else:
device_supports_fp64 = torch.xpu.has_fp64_dtype() if hasattr(torch.xpu, "has_fp64_dtype") else torch.xpu.get_device_properties("xpu").has_fp64
# Replace cuda with xpu:
torch.cuda.current_device = torch.xpu.current_device
torch.cuda.current_stream = torch.xpu.current_stream
@@ -188,7 +190,7 @@ def ipex_init(): # pylint: disable=too-many-statements
torch.cuda.utilization = lambda *args, **kwargs: 0
ipex_hijacks()
if not torch.xpu.get_device_properties("xpu").has_fp64 or os.environ.get('IPEX_FORCE_ATTENTION_SLICE', None) is not None:
if not device_supports_fp64 or os.environ.get('IPEX_FORCE_ATTENTION_SLICE', None) is not None:
try:
from .diffusers import ipex_diffusers
ipex_diffusers()
+1 -1
View File
@@ -5,7 +5,7 @@ import intel_extension_for_pytorch._C as core # pylint: disable=import-error, un
# pylint: disable=protected-access, missing-function-docstring, line-too-long
device_supports_fp64 = torch.xpu.get_device_properties("xpu").has_fp64
device_supports_fp64 = torch.xpu.has_fp64_dtype() if hasattr(torch.xpu, "has_fp64_dtype") else torch.xpu.get_device_properties("xpu").has_fp64
OptState = ipex.cpu.autocast._grad_scaler.OptState
_MultiDeviceReplicator = ipex.cpu.autocast._grad_scaler._MultiDeviceReplicator
_refresh_per_optimizer_state = ipex.cpu.autocast._grad_scaler._refresh_per_optimizer_state
+1 -1
View File
@@ -5,7 +5,7 @@ import torch
import numpy as np
from modules import devices, errors
device_supports_fp64 = torch.xpu.get_device_properties("xpu").has_fp64
device_supports_fp64 = torch.xpu.has_fp64_dtype() if hasattr(torch.xpu, "has_fp64_dtype") else torch.xpu.get_device_properties("xpu").has_fp64
# pylint: disable=protected-access, missing-function-docstring, line-too-long, unnecessary-lambda, no-else-return