Skip to content

[cuda_xpu_alignment] Fix LPPool signed fractional inputs#29

Draft
Stonepia wants to merge 10 commits into
mainfrom
agent/issue-3
Draft

[cuda_xpu_alignment] Fix LPPool signed fractional inputs#29
Stonepia wants to merge 10 commits into
mainfrom
agent/issue-3

Conversation

@Stonepia

@Stonepia Stonepia commented May 20, 2026

Copy link
Copy Markdown
Collaborator

[cuda_xpu_alignment] Fix LPPool signed fractional inputs

Fixes https://github.com/intel-sandbox/agentic_xpu/issues/3

Root Cause: lp_pool1d/2d/3d in torch/nn/functional.py (lines 1117/1120, 1158/1161, 1195/1198) call input.pow(norm_type) directly. Raising a negative input to a non-integer power yields NaN, so signed inputs with fractional norm_type produce NaN outputs. norm_type=inf is also not special-cased. The bug is in pure Python frontend code and is device-agnostic; the XPU-observed NaN is symptomatic, not XPU-specific.


Diff stat:

.github/workflows/dtensor.yml                      |   2 +-
 .lintrunner.toml                                   |  24 --
 .spin/cmds.py                                      |   1 -
 aten/src/ATen/native/cuda/Indexing.cu              |  29 --
 aten/src/ATen/native/mkldnn/MKLDNNConversions.cpp  |  67 ++-
 .../ATen/native/mps/kernels/Distributions.metal    |   8 -
 aten/src/ATen/native/mps/kernels/Embedding.h       |  14 -
 aten/src/ATen/native/mps/kernels/Embedding.metal   | 120 ------
 aten/src/ATen/native/mps/kernels/UnaryKernel.metal |  15 +-
 .../ATen/native/mps/operations/Distributions.mm    |   3 +-
 aten/src/ATen/native/mps/operations/Embedding.mm   | 114 -----
 aten/src/ATen/native/mps/operations/Indexing.mm    |  94 ++++-
 .../ATen/native/mps/operations/ScatterGather.mm    |   8 -
 .../src/ATen/native/transformers/cuda/attention.cu |   9 +-
 c10/util/TypeCast.h                                |  84 ++--
 test/autograd/test_functional.py                   |   3 -
 test/complex_tensor/test_complex_tensor.py         |   8 +-
 .../torch_openreg/tests/test_compile.py            | 226 ----------
 .../torch_openreg/tests/test_testing.py            |  12 -
 .../torch_openreg/torch_openreg/__init__.py        |   1 -
 .../torch_openreg/torch_openreg/compiler.py        |  95 -----
 test/cpython/v3_13/test_collections.py             |   1 -
 .../_composable/fsdp/test_fully_shard_comm.py      |   2 -
 .../_composable/fsdp/test_fully_shard_overlap.py   |   2 -
 .../_composable/fsdp/test_fully_shard_training.py  |   4 -
 .../test_composability/test_2d_composability.py    |   6 -
 test/distributed/_composable/test_replicate.py     |  19 +-
 .../_composable/test_replicate_with_compiler.py    |   3 +-
 test/distributed/_tools/test_fsdp2_mem_tracker.py  |   3 +-
 .../checkpoint/_experimental/test_checkpointer.py  |   3 +-
 .../elastic/multiprocessing/api_test.py            |   5 -
 .../fsdp/test_distributed_checkpoint.py            |  15 -
 test/distributed/fsdp/test_fsdp_core.py            |   2 -
 test/distributed/fsdp/test_fsdp_misc.py            |   4 -
 test/distributed/fsdp/test_fsdp_unshard_params.py  |   7 +-
 .../tensor/parallel/test_micro_pipeline_tp.py      |   8 -
 test/distributed/tensor/test_dtensor_compile.py    |  13 -
 test/distributed/tensor/test_dtensor_ops.py        |   9 -
 test/distributed/tensor/test_matrix_ops.py         |   2 -
 test/distributed/tensor/test_random_ops.py         |  10 +-
 test/distributed/tensor/test_redistribute.py       |   2 -
 test/distributed/tensor/test_tensor_ops.py         |   2 -
 test/distributed/test_c10d_functional_native.py    |   6 -
 test/distributed/test_c10d_gloo.py                 |   3 -
 test/distributed/test_c10d_nccl.py                 |  10 -
 test/distributed/test_c10d_ops_nccl.py             |   6 -
 test/distributed/test_dist2.py                     |   3 +-
 test/distributed/test_dynamo_distributed.py        |   8 +-
 test/distributed/test_functional_api.py            |   5 -
 test/distributed/test_inductor_collectives.py      |  80 ----
 test/distributed/test_overlap_bucketing_unit.py    |  19 -
 test/distributed/test_symmetric_memory.py          |   2 -
 test/dynamo/test_activation_checkpointing.py       |  30 ++
 test/dynamo/test_aot_autograd_cache.py             |  12 -
 test/dynamo/test_compiler_bisector.py              |   5 +-
 test/dynamo/test_decorators.py                     |  11 -
 test/dynamo/test_dynamic_spec.py                   | 157 -------
 test/dynamo/test_export.py                         |   4 -
 test/dynamo/test_guard_serialization.py            |  11 +-
 test/dynamo/test_higher_order_ops.py               |  29 --
 test/dynamo/test_package.py                        |   7 -
 test/dynamo/test_repros.py                         |   2 -
 test/dynamo/test_streams.py                        |  13 +-
 test/dynamo/test_trace_rules.py                    |   1 -
 test/dynamo/test_utils.py                          |  12 -
 test/export/test_hop.py                            |   4 +-
 test/functorch/test_aot_joint_with_descriptors.py  |   2 -
 test/functorch/test_control_flow.py                |   2 -
 test/functorch/test_dims.py                        |   9 -
 test/functorch/test_eager_transforms.py            |  11 -
 test/functorch/test_leaf_function.py               |   2 -
 test/functorch/test_ops.py                         |   9 -
 test/functorch/test_vmap.py                        |   4 -
 .../test_inline_asm_elementwise.py                 |   6 -
 test/inductor/test_aot_inductor.py                 |  28 --
 test/inductor/test_benchmarking.py                 |   3 -
 test/inductor/test_codecache.py                    |  83 ----
 test/inductor/test_combo_kernels.py                |   7 -
 test/inductor/test_compile_subprocess.py           |   3 -
 test/inductor/test_compile_worker.py               |   3 +-
 test/inductor/test_compiled_autograd.py            |   1 -
 test/inductor/test_control_deps.py                 |   3 +-
 test/inductor/test_cpp_wrapper_hipify.py           |  15 +-
 test/inductor/test_cpu_repro.py                    |  11 +-
 test/inductor/test_cuda_repro.py                   |   4 -
 test/inductor/test_cudagraph_trees.py              |  28 --
 test/inductor/test_custom_op_autotune.py           |   3 -
 test/inductor/test_decompose_mem_bound_mm.py       |   3 -
 test/inductor/test_deterministic.py                |   4 -
 test/inductor/test_flex_attention.py               |   7 -
 test/inductor/test_flex_decoding.py                |  35 +-
 test/inductor/test_gpu_cpp_wrapper.py              |   2 -
 test/inductor/test_inductor_freezing.py            |   3 -
 test/inductor/test_inductor_scheduler.py           |  71 ----
 test/inductor/test_lookup_table.py                 |   3 -
 test/inductor/test_max_autotune.py                 |  10 -
 test/inductor/test_memory_planning.py              |  11 -
 test/inductor/test_mix_order_reduction.py          |   3 -
 test/inductor/test_pattern_matcher.py              | 136 ------
 test/inductor/test_select_algorithm.py             |   7 -
 test/inductor/test_static_triton_launcher.py       |   1 -
 test/inductor/test_torchinductor.py                | 108 +----
 test/inductor/test_torchinductor_opinfo.py         |  15 -
 .../test_torchinductor_opinfo_properties.py        |  18 -
 test/inductor/test_torchinductor_strided_blocks.py |   3 -
 test/inductor/test_triton_helpers.py               | 144 -------
 test/inductor/test_triton_heuristics.py            |  69 ++-
 test/inductor/test_triton_kernels.py               |   8 +-
 test/jit/test_freezing.py                          |   5 -
 test/nn/test_load_state_dict.py                    |   1 -
 test/package/test_analyze.py                       |   5 +-
 test/profiler/test_execution_trace.py              |   1 -
 test/profiler/test_memory_profiler.py              |   5 -
 test/profiler/test_profiler.py                     |  14 -
 test/profiler/test_torch_tidy.py                   |  13 +-
 test/test_autograd.py                              |  34 --
 test/test_bmm_outer_product.py                     |   3 +-
 test/test_cuda.py                                  |  54 ---
 test/test_cuda_multigpu.py                         |   2 -
 test/test_custom_ops.py                            |  51 ---
 test/test_dataloader.py                            |   2 -
 test/test_decomp.py                                |   8 -
 test/test_dynamic_shapes.py                        |  15 -
 test/test_fake_tensor.py                           |   7 -
 test/test_flop_counter.py                          |  89 +++-
 test/test_fx.py                                    |   1 -
 test/test_hub.py                                   |   3 -
 test/test_indexing.py                              | 139 ------
 test/test_jit.py                                   |  15 -
 test/test_jit_fuser_te.py                          |   4 -
 test/test_linalg.py                                |   6 -
 test/test_meta.py                                  |   2 -
 test/test_mkldnn.py                                |  13 -
 test/test_mobile_optimizer.py                      |   5 -
 test/test_model_exports_to_core_aten.py            |   6 +-
 test/test_mps.py                                   |  90 +---
 test/test_multiprocessing.py                       |   7 -
 test/test_nestedtensor.py                          |  96 -----
 test/test_nn.py                                    |   2 -
 test/test_opaque_obj_v2.py                         |   2 -
 test/test_ops.py                                   |  18 +-
 test/test_ops_fwd_gradients.py                     |   3 -
 test/test_ops_gradients.py                         |  17 -
 test/test_ops_jit.py                               |   7 -
 test/test_overrides.py                             |   6 -
 test/test_pytree.py                                |   3 -
 test/test_scaled_matmul_cuda.py                    |   2 +-
 test/test_sparse.py                                |  11 -
 test/test_sparse_csr.py                            |  10 -
 test/test_testing.py                               |   1 -
 test/test_torch.py                                 |   6 +-
 test/test_torchfuzz_repros.py                      |   3 +-
 test/test_transformers.py                          |   1 -
 test/test_type_hints.py                            |   9 +-
 test/test_utils.py                                 |   4 -
 test/test_varlen_attention.py                      |   2 -
 test/torch_np/numpy_tests/fft/test_pocketfft.py    |   4 -
 tools/linter/adapters/grep_linter.py               |  23 -
 torch/_custom_op/impl.py                           |   2 +-
 torch/_decomp/decompositions.py                    |   2 +-
 torch/_dynamo/repro/after_aot.py                   |   4 +-
 torch/_dynamo/variables/builder.py                 | 177 +++-----
 torch/_higher_order_ops/schema.py                  |   2 +-
 torch/_inductor/__init__.py                        |   6 -
 torch/_inductor/codegen/common.py                  |   5 +-
 torch/_inductor/codegen/cpp.py                     |  16 -
 .../codegen/cpp_flex_attention_template.py         | 465 +--------------------
 torch/_inductor/codegen/cpp_wrapper_gpu.py         |   8 -
 .../_inductor/codegen/cuda/device_op_overrides.py  |  17 +-
 torch/_inductor/codegen/halide.py                  |  18 +-
 torch/_inductor/codegen/memory_planning.py         |   7 +-
 torch/_inductor/codegen/mps.py                     |  15 +-
 torch/_inductor/codegen/pallas.py                  |   8 -
 torch/_inductor/codegen/simd_kernel_features.py    |   4 +-
 torch/_inductor/codegen/triton.py                  |  19 +-
 torch/_inductor/codegen/wrapper.py                 |   7 +-
 torch/_inductor/cudagraph_trees.py                 |  33 +-
 torch/_inductor/dtype_propagation.py               |   8 -
 torch/_inductor/fx_passes/bucketing.py             |  75 +---
 .../_inductor/fx_passes/node_runtime_estimation.py |   5 +-
 torch/_inductor/fx_passes/post_grad.py             |  13 +-
 torch/_inductor/index_propagation.py               |   3 +-
 torch/_inductor/ir.py                              |  53 +--
 torch/_inductor/kernel/flex/flex_cpu.py            |   3 -
 torch/_inductor/lowering.py                        |  20 +-
 torch/_inductor/ops_handler.py                     |   8 -
 torch/_inductor/pattern_matcher.py                 |  44 --
 torch/_inductor/runtime/triton_helpers.py          |  31 --
 torch/_inductor/runtime/triton_heuristics.py       |  48 ++-
 torch/_inductor/select_algorithm.py                |   6 +-
 torch/_inductor/sizevars.py                        |   6 +-
 torch/_inductor/standalone_compile.py              |  33 +-
 torch/_inductor/template_heuristics/triton.py      |   4 +-
 torch/_inductor/utils.py                           |   3 +-
 torch/_jit_internal.py                             |   2 +-
 torch/csrc/fx/node.cpp                             |   2 +-
 torch/csrc/inductor/aoti_runtime/model_base.h      |  24 +-
 torch/csrc/jit/frontend/resolver.h                 |   2 +-
 torch/fx/experimental/dynamic_spec.py              |  23 +-
 torch/fx/experimental/symbolic_shapes.py           |  38 +-
 torch/jit/_check.py                                |   2 +-
 torch/jit/_recursive.py                            |   2 +-
 torch/nested/_internal/nested_tensor.py            |  62 +--
 torch/nested/_internal/ops.py                      |   7 +-
 torch/nn/functional.py                             |  33 +-
 torch/optim/_adafactor.py                          |   4 +-
 torch/testing/_internal/common_device_type.py      |   9 -
 .../_internal/common_methods_invocations.py        | 100 +----
 .../_internal/distributed/distributed_test.py      |  24 --
 .../distributed/rpc/dist_autograd_test.py          |   2 -
 .../testing/_internal/distributed/rpc/rpc_test.py  |   5 -
 torch/utils/flop_counter.py                        |   9 +
 212 files changed, 669 insertions(+), 4086 deletions(-)

Isalia20 and others added 3 commits May 26, 2026 08:47
If you do this on the current main:
```python
import torch

p = torch.tensor([0.5, 1.5, -0.3, float("nan"), float("inf")], device="mps")
torch.bernoulli(p)
```
It silently computes the output, while CPU raises the error:
```
RuntimeError: Expected p_in >= 0 && p_in <= 1 to be true, but got false.  (Could this error message be improved?  If so, please report an enhancement request to PyTorch.)
```
Pull Request resolved: pytorch#185065
Approved by: https://github.com/malfet
…184181)

fixes pytorch#184177

## Summary

Add `distributed_backend()` hook to `DeviceTypeTestBase` as a device-level extension point for default distributed backend selection.

Pull Request resolved: pytorch#184181
Approved by: https://github.com/guangyey, https://github.com/fffrog, https://github.com/albanD
…eric (pytorch#185131)

  Replace CUDA-specific decorator with device-agnostic check:
  - Import: requires_cuda_and_triton → HAS_GPU
  - Decorator: @requires_cuda_and_triton → @unittest.skipIf(not HAS_GPU)

  This enables all tests to run on any GPU with Triton (CUDA, XPU, etc.) instead of being CUDA-only.

  Test Plan:

-   TEST_CONFIG=cuda python test/dynamo/test_compiler_bisector.py -v
-   TEST_CONFIG=cpu python test/dynamo/test_compiler_bisector.py -v

  Both pass 10/11 tests (1 pre-existing subprocess error unrelated to changes)"

Pull Request resolved: pytorch#185131
Approved by: https://github.com/Skylion007, https://github.com/cyyever
pytorchmergebot and others added 5 commits May 26, 2026 13:44
…ismatch in FlopCounterMode (pytorch#184348)"

This reverts commit 02389b3.

Reverted pytorch#184348 on behalf of https://github.com/jeffdaily due to broke rocm trunk test/test_flop_counter.py::TestFlopCounter::test_flash_attention_backward_flop_layout [GH job link](https://github.com/pytorch/pytorch/actions/runs/26270903091/job/77327481563) [HUD commit link](https://hud.pytorch.org/pytorch/pytorch/commit/02389b3fffda8f6528d985860315edd718deb48a) ([comment](pytorch#184348 (comment)))
Move embedding backward to metal. This PR does 2 things:
1. Migrates the embedding backward to metal
2. And fixes the TODO for the op `// TODO: implement padding_idx & scale_grad_by_freq.`, which would fail silently before if provided

Perf:
| Shape | Indices | Weight | Contiguous | Strided |
|---|---|---|---:|---:|
| small fp32 | 512 | 5000x128 | 1.08x | 1.57x |
| small fp32 scale | 512 | 5000x128 | 1.34x | 1.40x |
| small bf16 | 512 | 5000x128 | 1.98x | 2.06x |
| small bf16 scale | 512 | 5000x128 | 1.67x | 1.68x |
| medium fp32 | 32x128 | 20000x512 | 1.90x | 1.90x |
| medium fp32 scale | 32x128 | 20000x512 | 1.74x | 1.74x |
| medium bf16 | 32x128 | 20000x512 | 1.20x | 1.21x |
| medium bf16 scale | 32x128 | 20000x512 | 1.17x | 1.16x |
| large fp32 | 64x256 | 50000x1024 | 1.67x | 1.68x |
| large fp32 scale | 64x256 | 50000x1024 | 1.52x | 1.51x |
| large bf16 | 64x256 | 50000x1024 | 1.17x | 1.18x |
| large bf16 scale | 64x256 | 50000x1024 | 1.11x | 1.11x |
Pull Request resolved: pytorch#185119
Approved by: https://github.com/malfet
…ytorch#185013)

Replaces the GitHub-issue-driven auto-disabler entries (the JSON the
auto-disabler workflow tracks) with explicit `@unittest.skip*` decorators
next to each disabled test. The autogenerated condensed-disables snapshot
(401 entries) was processed by a script in agent_space/disable_resolver.py
+ agent_space/apply_disables.py to:

- locate 360 of 401 tests in source (file/class/method),
- pick a skip decorator that preserves the original platform set
  (`skipIfRocm`, `skipIfXpu`, `skipIfWindows`, `skipIfTorchDynamo`,
  `skipIfTorchInductor`, or `unittest.skipIf(<OR-cond>)` with the
  `IS_LINUX` / `TEST_WITH_*` flags from `common_utils`),
- attach the decorator above the method and tag it with the originating
  issue URL so the failure message points to the original bug,
- add any missing common_utils symbol imports.

Caveats:
- 41 of 401 entries could not be auto-located and remain in
  the JSON (see breakdown below). These are mostly tests that are
  dynamically generated (TestVisionTracing, SDPAPatternRewriter*,
  TestNN cudnn/tf32 helpers), wrapped via `wrap_test_class`
  (TestAutogradWithCompiledAutograd, HigherOrderOpTestsWithCompiledAutograd),
  or otherwise have no concrete `def test_X(...)` in source to decorate.
- For tests on `instantiate_device_type_tests`-generated classes we
  decorate the source base method, which can over-skip the CPU variant on
  ROCm CI etc. The original JSON's class-name filter was tighter; the
  trade-off is one extra skipped device variant in CI in exchange for a
  visible, in-tree disable.
- For tests where multiple disables in the JSON pointed at the same source
  method (different CPU/CUDA wrapper classes), both decorators are kept;
  the test will be skipped if any of the conditions holds.

Authored by Claude.

Test Plan: ran `lintrunner -a` over all changed files; ast.parse() over
all changed files passes. We can't run the disabled tests themselves
(some are CUDA/ROCm/distributed-only); the auto-disabler's skip behavior
is being preserved by emitting the equivalent decorator + URL.

Unresolved breakdown:
  - method_not_found: 28
  - explicit_mapping_no_match: 6
  - class_not_found: 4
  - method_in_multiple_files: 3

Scripts: https://gist.github.com/ezyang/d00dfcc2a0619311402846109f3f15ac

Fixes (auto-closes the originating issues on merge):

Fixes pytorch#65521
Fixes pytorch#70546
Fixes pytorch#70753
Fixes pytorch#70754
Fixes pytorch#70755
Fixes pytorch#71195
Fixes pytorch#74208
Fixes pytorch#75168
Fixes pytorch#76428
Fixes pytorch#76962
Fixes pytorch#77317
Fixes pytorch#77342
Fixes pytorch#78457
Fixes pytorch#81213
Fixes pytorch#81626
Fixes pytorch#82915
Fixes pytorch#84937
Fixes pytorch#85012
Fixes pytorch#86710
Fixes pytorch#87581
Fixes pytorch#88721
Fixes pytorch#91481
Fixes pytorch#91482
Fixes pytorch#91484
Fixes pytorch#91486
Fixes pytorch#91488
Fixes pytorch#91489
Fixes pytorch#91492
Fixes pytorch#91493
Fixes pytorch#91494
Fixes pytorch#91495
Fixes pytorch#91497
Fixes pytorch#92131
Fixes pytorch#95412
Fixes pytorch#97402
Fixes pytorch#98259
Fixes pytorch#101625
Fixes pytorch#101787
Fixes pytorch#102751
Fixes pytorch#104055
Fixes pytorch#105024
Fixes pytorch#106308
Fixes pytorch#106557
Fixes pytorch#107278
Fixes pytorch#108743
Fixes pytorch#113506
Fixes pytorch#113936
Fixes pytorch#113937
Fixes pytorch#114831
Fixes pytorch#115859
Fixes pytorch#118253
Fixes pytorch#119159
Fixes pytorch#119949
Fixes pytorch#120318
Fixes pytorch#121876
Fixes pytorch#122413
Fixes pytorch#123536
Fixes pytorch#125365
Fixes pytorch#125644
Fixes pytorch#129390
Fixes pytorch#129860
Fixes pytorch#131050
Fixes pytorch#131079
Fixes pytorch#131081
Fixes pytorch#131104
Fixes pytorch#137684
Fixes pytorch#137765
Fixes pytorch#137948
Fixes pytorch#138885
Fixes pytorch#140383
Fixes pytorch#144918
Fixes pytorch#144922
Fixes pytorch#145807
Fixes pytorch#145924
Fixes pytorch#146806
Fixes pytorch#147047
Fixes pytorch#147057
Fixes pytorch#147058
Fixes pytorch#148093
Fixes pytorch#148463
Fixes pytorch#148515
Fixes pytorch#148607
Fixes pytorch#148901
Fixes pytorch#149349
Fixes pytorch#150959
Fixes pytorch#151378
Fixes pytorch#151379
Fixes pytorch#151381
Fixes pytorch#151382
Fixes pytorch#151384
Fixes pytorch#151511
Fixes pytorch#151512
Fixes pytorch#151540
Fixes pytorch#151541
Fixes pytorch#152221
Fixes pytorch#152944
Fixes pytorch#153223
Fixes pytorch#153460
Fixes pytorch#153644
Fixes pytorch#153707
Fixes pytorch#153735
Fixes pytorch#153736
Fixes pytorch#154587
Fixes pytorch#155617
Fixes pytorch#156436
Fixes pytorch#156438
Fixes pytorch#156514
Fixes pytorch#157245
Fixes pytorch#157246
Fixes pytorch#157247
Fixes pytorch#157254
Fixes pytorch#157724
Fixes pytorch#157788
Fixes pytorch#157879
Fixes pytorch#157896
Fixes pytorch#157897
Fixes pytorch#158328
Fixes pytorch#158727
Fixes pytorch#159150
Fixes pytorch#159151
Fixes pytorch#159348
Fixes pytorch#159627
Fixes pytorch#160550
Fixes pytorch#160597
Fixes pytorch#161095
Fixes pytorch#162250
Fixes pytorch#162464
Fixes pytorch#162584
Fixes pytorch#162586
Fixes pytorch#162676
Fixes pytorch#162793
Fixes pytorch#163230
Fixes pytorch#163689
Fixes pytorch#163701
Fixes pytorch#163765
Fixes pytorch#163953
Fixes pytorch#164192
Fixes pytorch#164193
Fixes pytorch#164194
Fixes pytorch#164195
Fixes pytorch#164232
Fixes pytorch#164235
Fixes pytorch#164271
Fixes pytorch#164426
Fixes pytorch#164556
Fixes pytorch#165294
Fixes pytorch#165296
Fixes pytorch#165387
Fixes pytorch#165603
Fixes pytorch#165879
Fixes pytorch#165949
Fixes pytorch#166066
Fixes pytorch#166067
Fixes pytorch#167252
Fixes pytorch#167324
Fixes pytorch#167522
Fixes pytorch#167783
Fixes pytorch#168169
Fixes pytorch#168171
Fixes pytorch#168197
Fixes pytorch#170259
Fixes pytorch#170373
Fixes pytorch#171519
Fixes pytorch#171934
Fixes pytorch#173761
Fixes pytorch#174389
Fixes pytorch#175064
Fixes pytorch#175482
Fixes pytorch#176112
Fixes pytorch#176113
Fixes pytorch#176114
Fixes pytorch#176115
Fixes pytorch#176142
Fixes pytorch#176144
Fixes pytorch#176145
Fixes pytorch#176155
Fixes pytorch#176204
Fixes pytorch#176968
Fixes pytorch#176969
Fixes pytorch#176973
Fixes pytorch#176975
Fixes pytorch#177000
Fixes pytorch#177001
Fixes pytorch#177003
Fixes pytorch#177006
Fixes pytorch#177007
Fixes pytorch#177056
Fixes pytorch#177751
Fixes pytorch#178077
Fixes pytorch#178155
Fixes pytorch#178177
Fixes pytorch#178745
Fixes pytorch#179689
Fixes pytorch#179690
Fixes pytorch#179691
Fixes pytorch#179694
Fixes pytorch#179695
Fixes pytorch#179696
Fixes pytorch#179743
Fixes pytorch#179744
Fixes pytorch#179745
Fixes pytorch#179746
Fixes pytorch#179776
Fixes pytorch#179777
Fixes pytorch#179778
Fixes pytorch#179779
Fixes pytorch#179798
Fixes pytorch#179810
Fixes pytorch#179854
Fixes pytorch#179876
Fixes pytorch#179877
Fixes pytorch#179881
Fixes pytorch#179895
Fixes pytorch#179898
Fixes pytorch#179909
Fixes pytorch#179940
Fixes pytorch#179942
Fixes pytorch#179943
Fixes pytorch#179944
Fixes pytorch#179948
Fixes pytorch#179957
Fixes pytorch#179958
Fixes pytorch#179959
Fixes pytorch#179961
Fixes pytorch#179963
Fixes pytorch#179964
Fixes pytorch#179968
Fixes pytorch#179970
Fixes pytorch#179973
Fixes pytorch#179976
Fixes pytorch#179977
Fixes pytorch#179979
Fixes pytorch#179981
Fixes pytorch#179984
Fixes pytorch#179985
Fixes pytorch#179987
Fixes pytorch#179991
Fixes pytorch#179992
Fixes pytorch#180006
Fixes pytorch#180017
Fixes pytorch#180018
Fixes pytorch#180019
Fixes pytorch#180023
Fixes pytorch#180024
Fixes pytorch#180026
Fixes pytorch#180040
Fixes pytorch#180041
Fixes pytorch#180042
Fixes pytorch#180043
Fixes pytorch#180044
Fixes pytorch#180045
Fixes pytorch#180055
Fixes pytorch#180056
Fixes pytorch#180057
Fixes pytorch#180058
Fixes pytorch#180061
Fixes pytorch#180066
Fixes pytorch#180067
Fixes pytorch#180071
Fixes pytorch#180072
Fixes pytorch#180116
Fixes pytorch#180122
Fixes pytorch#180123
Fixes pytorch#180124
Fixes pytorch#180126
Fixes pytorch#180127
Fixes pytorch#180128
Fixes pytorch#180131
Fixes pytorch#180132
Fixes pytorch#180196
Fixes pytorch#180205
Fixes pytorch#180214
Fixes pytorch#180227
Fixes pytorch#180228
Fixes pytorch#180232
Fixes pytorch#180233
Fixes pytorch#180234
Fixes pytorch#180262
Fixes pytorch#180263
Fixes pytorch#180265
Fixes pytorch#180300
Fixes pytorch#180301
Fixes pytorch#180318
Fixes pytorch#180320
Fixes pytorch#180323
Fixes pytorch#180325
Fixes pytorch#180336
Fixes pytorch#180338
Fixes pytorch#180367
Fixes pytorch#180419
Fixes pytorch#180464
Fixes pytorch#180489
Fixes pytorch#180521
Fixes pytorch#180522
Fixes pytorch#180591
Fixes pytorch#180592
Fixes pytorch#180632
Fixes pytorch#180656
Fixes pytorch#180661
Fixes pytorch#180662
Fixes pytorch#180681
Fixes pytorch#180894
Fixes pytorch#180948
Fixes pytorch#181155
Fixes pytorch#181203
Fixes pytorch#181204
Fixes pytorch#181228
Fixes pytorch#181229
Fixes pytorch#181272
Fixes pytorch#181323
Fixes pytorch#181336
Fixes pytorch#181344
Fixes pytorch#181370
Fixes pytorch#181490
Fixes pytorch#181491
Fixes pytorch#181535
Fixes pytorch#181536
Fixes pytorch#181682
Fixes pytorch#181685
Fixes pytorch#181699
Fixes pytorch#181701
Fixes pytorch#181863
Fixes pytorch#181947
Fixes pytorch#182021
Fixes pytorch#182086
Fixes pytorch#182087
Fixes pytorch#182093
Fixes pytorch#182098
Fixes pytorch#182099
Fixes pytorch#182111
Fixes pytorch#182112
Fixes pytorch#182261
Fixes pytorch#182599
Fixes pytorch#182600
Fixes pytorch#182645
Fixes pytorch#182666
Fixes pytorch#182790
Fixes pytorch#182816
Fixes pytorch#182819
Fixes pytorch#182869
Fixes pytorch#183435
Fixes pytorch#183671
Fixes pytorch#183810
Fixes pytorch#183891
Fixes pytorch#183892
Fixes pytorch#184324
Fixes pytorch#184329
Fixes pytorch#184463
Fixes pytorch#184470
Fixes pytorch#184490
Fixes pytorch#184491
Fixes pytorch#184496
Fixes pytorch#184507
Fixes pytorch#184537
Fixes pytorch#184597
Fixes pytorch#184598
Fixes pytorch#184682
Fixes pytorch#184831
Fixes pytorch#184832
Fixes pytorch#184862

Pull Request resolved: pytorch#185013
Approved by: https://github.com/seemethere, https://github.com/drisspg, https://github.com/huydhn, https://github.com/malfet
…ntegration (pytorch#181254)

### Description:
Adds a minimal torch.compile backend to OpenReg that validates the PyTorch-side integration contract for PrivateUse1 devices.

The backend is a passthrough: it takes the FX graph from Dynamo, runs lightweight validation using stable FX APIs (such as Graph.lint, eliminate_dead_code, recompile, and python_code), verifies FakeTensor device metadata on placeholder nodes, and then returns gm.forward for eager execution via the existing CPU fallback. It does not perform any lowering or device-specific compilation.

### Changes:
torch_openreg/compiler.py: backend implementation, registered via register_backend
torch_openreg/init.py: import compiler module to trigger registration on package import
tests/test_compile.py: Tests covering registration, graph capture, FakeTensor device propagation, guard caching, recompilation, autograd, nn.Module, dynamic shapes, graph breaks, autocast, and default device interaction

Fixes: pytorch#181093
Pull Request resolved: pytorch#181254
Approved by: https://github.com/fffrog
pytorch#184215)

Correct incorrect indefinite articles ("a" vs "an") and fix two word
typos: "process" → "progress" in after_aot.py and "we an" → "we can"
in resolver.h.

Authored with Claude (typo_terminator2).

Pull Request resolved: pytorch#184215
Approved by: https://github.com/aorenste
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

8 participants