diff options
author | Kohaku-Blueleaf <59680068+KohakuBlueleaf@users.noreply.github.com> | 2023-12-03 02:54:54 +0000 |
---|---|---|
committer | Kohaku-Blueleaf <59680068+KohakuBlueleaf@users.noreply.github.com> | 2023-12-03 02:54:54 +0000 |
commit | 9a15ae2a92e55d614fe515cd0a104d90b854b23f (patch) | |
tree | 7977ea1ea27cfc1d21e652433f8bbc0faec0ddc9 /modules/devices.py | |
parent | 50a21cb09fe3e9ea2d4fe058e0484e192c8a86e3 (diff) | |
parent | ac02216e540cd581f9169c6c791e55721e3117b0 (diff) | |
download | stable-diffusion-webui-gfx803-9a15ae2a92e55d614fe515cd0a104d90b854b23f.tar.gz stable-diffusion-webui-gfx803-9a15ae2a92e55d614fe515cd0a104d90b854b23f.tar.bz2 stable-diffusion-webui-gfx803-9a15ae2a92e55d614fe515cd0a104d90b854b23f.zip |
Merge branch 'dev' into test-fp8
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 04669b46..c956207f 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": @@ -47,6 +54,9 @@ def get_optimal_device_name(): if has_mps(): return "mps" + if has_xpu(): + return xpu_specific.get_xpu_device_string() + return "cpu" @@ -71,6 +81,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(): |