pytorch/torchgen
Yu, Guangye 5c46600f84 [RELAND] refactor lazy init to device-agnostic (#119248)
# Motivation
This PR intends to extend `cuda_lazy_init` to `device_lazy_init` which is a device-agnostic API that can support any backend. And change `maybe_initialize_cuda` to `maybe_initialize_device` to support lazy initialization for CUDA while maintaining scalability.

# Design
We maintain a flag for each backend to manage the lazy initialization state separately.

# Additional Context
No need more UTs.
This is a reland PR, the original PR is [refactor lazy init to device-agnostic](https://github.com/pytorch/pytorch/pull/118846).
This is a common PR, and does not trigger xpu ciflow.

Differential Revision: [D53478332](https://our.internmc.facebook.com/intern/diff/D53478332)
Pull Request resolved: https://github.com/pytorch/pytorch/pull/119248
Approved by: https://github.com/EikanWang, https://github.com/gujinghui, https://github.com/jgong5, https://github.com/atalman
2024-02-07 15:58:51 +00:00
..
api [RELAND] refactor lazy init to device-agnostic (#119248) 2024-02-07 15:58:51 +00:00
decompositions Use strict to toggle strict options in MYPYSTRICT (#118479) 2024-01-28 19:22:22 +00:00
dest Enable possibly-undefined error code (#118533) 2024-01-30 21:07:01 +00:00
executorch [torchgen] Add logic in custom ops to return empty tensor (#114143) 2023-12-08 17:03:44 +00:00
fuse_attention_patterns Use strict to toggle strict options in MYPYSTRICT (#118479) 2024-01-28 19:22:22 +00:00
operator_versions [BE]: Update Ruff to 0.0.280 (#105724) 2023-07-22 23:03:34 +00:00
selective_build [BE] f-stringify torch/ and scripts (#105538) 2023-07-21 19:35:24 +00:00
shape_functions
static_runtime [BE]: ruff apply rule PLW1510 to find silent subprocess errors (#113644) 2023-11-14 20:59:40 +00:00
__init__.py
BUCK.oss
BUILD.bazel
build.bzl
code_template.py [BE] Enable ruff's UP rules and autoformat torchgen/ (#105423) 2023-07-18 06:44:20 +00:00
context.py [Specialized Kernel] Propagate Specialized Kernel Support through ComputeCodegenUnboxedKernels (#103113) 2023-06-14 10:18:16 +00:00
gen_backend_stubs.py [BE] Enable ruff's UP rules and autoformat torchgen/ (#105423) 2023-07-18 06:44:20 +00:00
gen_executorch.py Adding event_tracer evalue logging calls in codegen (#114584) 2023-11-28 18:32:05 +00:00
gen_functionalization_type.py Remove semicolon after return_from_mutable_noop_redispatch (#118538) 2024-01-30 02:22:42 +00:00
gen_lazy_tensor.py Fix typo under torchgen directory (#111154) 2023-10-13 16:43:46 +00:00
gen_vmap_plumbing.py
gen.py Enable local_partial_types (#118467) 2024-01-28 13:38:22 +00:00
local.py
model.py Introduce slice_inverse() op (#117041) 2024-01-16 23:44:54 +00:00
native_function_generation.py Mark set_ as an inplace view op (#115769) 2024-01-17 15:32:18 +00:00
utils.py [BE]: Apply RUF025 dict.fromkeys preview rule (#118637) 2024-01-30 20:46:54 +00:00
yaml_utils.py [Reland] Update mypy to 1.4.1 (#105227) 2023-07-15 20:30:20 +00:00