diff options
author | AUTOMATIC1111 <16777216c@gmail.com> | 2023-12-02 16:22:32 +0000 |
---|---|---|
committer | GitHub <noreply@github.com> | 2023-12-02 16:22:32 +0000 |
commit | af5f0734c9b0dc26934292849b7df006a598bd80 (patch) | |
tree | 8df72c81ba24dd8a6d6b04bd7b526ea75de8f199 /modules/devices.py | |
parent | a5f61aa8c5933d8e5a0e0aa841138eeaccd86d62 (diff) | |
parent | 96871e4f744471177d97e01c49f8587d7f67c125 (diff) | |
download | stable-diffusion-webui-gfx803-af5f0734c9b0dc26934292849b7df006a598bd80.tar.gz stable-diffusion-webui-gfx803-af5f0734c9b0dc26934292849b7df006a598bd80.tar.bz2 stable-diffusion-webui-gfx803-af5f0734c9b0dc26934292849b7df006a598bd80.zip |
Merge pull request #14171 from Nuullll/ipex
Initial IPEX support for Intel Arc GPU
Diffstat (limited to 'modules/devices.py')
-rw-r--r-- | modules/devices.py | 13 |
1 files changed, 13 insertions, 0 deletions
diff --git a/modules/devices.py b/modules/devices.py index f97f9cfb..ea1f712f 100644 --- a/modules/devices.py +++ b/modules/devices.py @@ -8,6 +8,13 @@ from modules import errors, shared if sys.platform == "darwin": from modules import mac_specific +if shared.cmd_opts.use_ipex: + from modules import xpu_specific + + +def has_xpu() -> bool: + return shared.cmd_opts.use_ipex and xpu_specific.has_xpu + def has_mps() -> bool: if sys.platform != "darwin": @@ -30,6 +37,9 @@ def get_optimal_device_name(): if has_mps(): return "mps" + if has_xpu(): + return xpu_specific.get_xpu_device_string() + return "cpu" @@ -54,6 +64,9 @@ def torch_gc(): if has_mps(): mac_specific.torch_mps_gc() + if has_xpu(): + xpu_specific.torch_xpu_gc() + def enable_tf32(): if torch.cuda.is_available(): |