pytorch/torch
Dmitry Rogozhkin baccadb2f1 xpu: torch.xpu.get_arch_list() to return [] if xpu not compiled (#147431)
Initially discussed here: https://github.com/pytorch/pytorch/pull/132945#discussion_r1957366131

Previously `torch.xpu.get_arch_list()` got relaxed to work even if XPU device is not available. However, we overlooked the case when pytorch is not compiled with XPU support. In such a case function throws an exception. This commit adjusts this behavior and makes function return `[]` even if pytorch is not compiled with XPU support.

CC: @EikanWang @fengyuan14 @guangyey @malfet @albanD

Pull Request resolved: https://github.com/pytorch/pytorch/pull/147431
Approved by: https://github.com/guangyey, https://github.com/EikanWang, https://github.com/albanD
2025-02-24 01:35:54 +00:00
..
_awaits
_C Fix type stubs for SymmetricMemory (#146310) 2025-02-21 19:59:43 +00:00
_C_flatbuffer
_custom_op PEP585 update - mostly toplevels (#145178) 2025-01-22 02:21:14 +00:00
_decomp PEP585: More UP006 fixes (#146392) 2025-02-20 06:18:13 +00:00
_dispatch PEP585 update - mostly toplevels (#145178) 2025-01-22 02:21:14 +00:00
_dynamo Add XPU to is_compile_supported to support roi_align op in torchvision (#147541) 2025-02-24 01:32:36 +00:00
_export better error message (#147532) 2025-02-21 17:08:47 +00:00
_functorch PEP585: More UP006 fixes (#146392) 2025-02-20 06:18:13 +00:00
_higher_order_ops [associative_scan] compile backend change to "eager" (#146973) 2025-02-21 20:21:41 +00:00
_inductor [MPS] Add inductor support for spherical_bessel_j0. (#147650) 2025-02-23 00:32:36 +00:00
_lazy PEP585 update - torch/_C torch/_decomp torch/_lazy torch/_library torch/_numpy torch/_prims torch/_refs torch/_strobelight (#145102) 2025-01-18 20:47:12 +00:00
_library [torchbind] Differentiate ScriptModule and ScriptObject with qualified name (#147399) 2025-02-20 04:57:57 +00:00
_logging Move ir_pre_fusion.txt and ir_post_fusion.txt to TORCH_LOGS (#147248) 2025-02-20 00:26:17 +00:00
_numpy PEP585 update - torch/_C torch/_decomp torch/_lazy torch/_library torch/_numpy torch/_prims torch/_refs torch/_strobelight (#145102) 2025-01-18 20:47:12 +00:00
_prims PEP585: More UP006 fixes (#146392) 2025-02-20 06:18:13 +00:00
_prims_common PEP585: More UP006 fixes (#146392) 2025-02-20 06:18:13 +00:00
_refs PEP585: More UP006 fixes (#146392) 2025-02-20 06:18:13 +00:00
_strobelight Enable strobelight profiling specific compile frame ids using COMPILE_STROBELIGHT_FRAME_FILTER (#147549) 2025-02-22 03:44:53 +00:00
_subclasses PEP585: More UP006 fixes (#146392) 2025-02-20 06:18:13 +00:00
_vendor
accelerator
amp [autocast][pytorch] Support autocast for MTIA (#145627) 2025-01-25 03:24:59 +00:00
ao [Intel GPU] qlinear_pointwise.binary[_tensor] XPU support (#135337) 2025-02-21 02:09:28 +00:00
autograd PEP585: More UP006 fixes (#146392) 2025-02-20 06:18:13 +00:00
backends PEP585: More UP006 fixes (#146392) 2025-02-20 06:18:13 +00:00
compiler PEP585: More UP006 fixes (#146392) 2025-02-20 06:18:13 +00:00
contrib PEP585 update - mostly toplevels (#145178) 2025-01-22 02:21:14 +00:00
cpu [CPU Stream] Add noop for CPU stream record_event() and wait_event() (#145935) 2025-02-20 18:50:55 +00:00
csrc [DDP] Temporarily disable comm mem (#147663) 2025-02-22 05:55:43 +00:00
cuda PEP585: More UP006 fixes (#146392) 2025-02-20 06:18:13 +00:00
distributed [PP] Remove extra code and docs BE (#147636) 2025-02-22 00:10:31 +00:00
distributions Revert "Fix non-bitwise type annotations for Tensor operators (see #145838) (#146845)" 2025-02-18 19:01:27 +00:00
export [export] Remove report from draft-export output (#147558) 2025-02-22 00:54:29 +00:00
fft
func Add torch.func.debug_unwrap (#146528) 2025-02-06 18:48:09 +00:00
futures PEP585: More UP006 fixes (#146392) 2025-02-20 06:18:13 +00:00
fx [fx] demote node prepend to self log from warning to debug (#147538) 2025-02-21 01:32:34 +00:00
jit PEP585: More UP006 fixes (#146392) 2025-02-20 06:18:13 +00:00
legacy
lib
linalg
masked PEP585 update - torch/_higher_order_ops torch/_subclasses torch/backends torch/compiler torch/cuda torch/masked torch/mtia torch/nested (#145202) 2025-01-20 22:37:26 +00:00
monitor add WaitCounter type interface and get rid of type errors (#146175) 2025-02-01 23:24:52 +00:00
mps [MPS] Support includes in metal objects (#145087) 2025-01-18 05:35:22 +00:00
mtia PEP585: More UP006 fixes (#146392) 2025-02-20 06:18:13 +00:00
multiprocessing
nested Revert "[cuDNN][SDPA][Nested Tensor] Experimental cuDNN Nested Tensor SDPA Support (forward only) (#141178)" 2025-02-22 17:28:12 +00:00
nn [TorchRec][PT2] disable contextlib in PT2 train pipeline (#147254) 2025-02-22 18:57:55 +01:00
onnx Update ruff linter for PEP585 (#147540) 2025-02-22 04:45:17 +00:00
optim [Easy][optim] Add LBFGS params optional desc (#147579) 2025-02-21 19:38:10 +00:00
package Remove code for Python < 3.9 (#147097) 2025-02-14 03:22:49 +00:00
profiler execution trace export supports gzip format (#146179) 2025-02-01 01:25:25 +00:00
quantization
signal PEP585 update - mostly toplevels (#145178) 2025-01-22 02:21:14 +00:00
sparse PEP585: More UP006 fixes (#146392) 2025-02-20 06:18:13 +00:00
special
testing Revert "[ROCm] OCP FP8 Support for new GPUs (#146632)" 2025-02-23 12:04:50 +00:00
utils xpu: torch.xpu.get_arch_list() to return [] if xpu not compiled (#147431) 2025-02-24 01:35:54 +00:00
xpu xpu: torch.xpu.get_arch_list() to return [] if xpu not compiled (#147431) 2025-02-24 01:35:54 +00:00
__config__.py
__future__.py
__init__.py Torch device backend autoload fix (#145611) 2025-01-31 19:27:42 +00:00
_appdirs.py
_classes.py
_compile.py
_custom_ops.py
_deploy.py
_environment.py
_guards.py Update ruff linter for PEP585 (#147540) 2025-02-22 04:45:17 +00:00
_jit_internal.py PEP585: More UP006 fixes (#146392) 2025-02-20 06:18:13 +00:00
_linalg_utils.py PEP585 update - mostly toplevels (#145178) 2025-01-22 02:21:14 +00:00
_lobpcg.py PEP585 update - mostly toplevels (#145178) 2025-01-22 02:21:14 +00:00
_lowrank.py PEP585 update - mostly toplevels (#145178) 2025-01-22 02:21:14 +00:00
_meta_registrations.py [Intel GPU] qlinear_pointwise.binary[_tensor] XPU support (#135337) 2025-02-21 02:09:28 +00:00
_namedtensor_internals.py
_ops.py Update ruff linter for PEP585 (#147540) 2025-02-22 04:45:17 +00:00
_python_dispatcher.py
_size_docs.py
_sources.py PEP585 update - mostly toplevels (#145178) 2025-01-22 02:21:14 +00:00
_storage_docs.py
_streambase.py
_tensor_docs.py Add link to non_blocking/pinmem tutorial in Tensor.to docstrings (#145651) 2025-02-18 20:38:01 +00:00
_tensor_str.py add the torch.float8_e8m0fnu dtype to PyTorch (#147466) 2025-02-20 13:55:42 +00:00
_tensor.py Revert "Fix non-bitwise type annotations for Tensor operators (see #145838) (#146845)" 2025-02-18 19:01:27 +00:00
_thread_safe_fork.py
_torch_docs.py Fix torch.max optional args dim, keepdim description (#147177) 2025-02-20 08:18:09 +00:00
_utils_internal.py Revert "[ROCm] OCP FP8 Support for new GPUs (#146632)" 2025-02-23 12:04:50 +00:00
_utils.py [BE]: Enable ruff SLOT checks (#146276) 2025-02-04 19:18:23 +00:00
_VF.py
_vmap_internals.py PEP585 update - mostly toplevels (#145178) 2025-01-22 02:21:14 +00:00
_weights_only_unpickler.py Use __qualname__ in add_safe_globals and update Unpickling error raised for Unsupported GLOBAL (#146815) 2025-02-21 18:04:59 +00:00
abi-check.cpp
CMakeLists.txt Set USE_CUFILE=1 by default and add pypi package to binary build matrix (#145748) 2025-02-11 15:49:01 +00:00
custom_class_detail.h
custom_class.h
extension.h
functional.py Re-add stft option to align window for center = false (#146379) 2025-02-06 14:07:13 +00:00
hub.py fix: replace stderr with stdout for download messages in hub.py (#146475) 2025-02-10 10:46:10 +00:00
library.h Remove trivial dispatch_key_allowlist_check function (#146169) 2025-01-31 19:59:40 +00:00
library.py [opcheck] Improve error reporting; allow atol/rtol overrides (#146488) 2025-02-05 21:25:06 +00:00
overrides.py Re-add stft option to align window for center = false (#146379) 2025-02-06 14:07:13 +00:00
py.typed
quasirandom.py
random.py PEP585 update - mostly toplevels (#145178) 2025-01-22 02:21:14 +00:00
README.txt
return_types.py
script.h
serialization.py Update ruff linter for PEP585 (#147540) 2025-02-22 04:45:17 +00:00
storage.py add the torch.float8_e8m0fnu dtype to PyTorch (#147466) 2025-02-20 13:55:42 +00:00
torch_version.py [BE]: Enable ruff SLOT checks (#146276) 2025-02-04 19:18:23 +00:00
types.py Improve typing in torch/types.py (#145237) 2025-01-28 05:29:12 +00:00
version.py.tpl

Note [TH abstraction violation]
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

TH/THC provide some hpp headers, which are proper C++ headers rather than
C headers.  These headers serve double duty as *internal implementation
detail* headers, whose contents should largely not be used by external
clients.

Ideally, we would not install these headers at all; instead, you should
use public functions (in headers like `THTensor.h`, NOT `THTensor.hpp`)
to manipulate these structs.  However, there are a few places
in torch/csrc where we violate this abstraction.  They are marked with
a pointer to this note.  Each of those sites will have to be refactored
when we refactor the guts of THTensor and related structures.