Skip to content

[upstream #2287] [upstream_ut] test_python_ref issues - #23

Draft
Stonepia wants to merge 1 commit into
mainfrom
agent/issue-103
Draft

[upstream #2287] [upstream_ut] test_python_ref issues#23
Stonepia wants to merge 1 commit into
mainfrom
agent/issue-103

Conversation

@Stonepia

@Stonepia Stonepia commented May 19, 2026

Copy link
Copy Markdown
Collaborator

[upstream pytorch#2287] [upstream_ut] test_python_ref issues

Fixes https://github.com/intel-sandbox/torch-xpu-ops-exp/issues/103

Root Cause: In torch/_refs/init.py line 5519, the linspace ref directly calls torch.ops.aten.copy.default(empty_tensor, start) when steps==1 and start is a tensor. Under TorchRefsMode(strict=True), aten.copy.default has no _refs decomposition, causing RuntimeError. The logspace ref triggers this path via its call to linspace.

Failed Tests:

  • test/test_ops.py::TestCommonXPU::test_python_ref__refs_logspace_tensor_overload_xpu_float64

Diff stat:

.ci/pytorch/test.sh                                |   2 +-
 .github/allowlist.yml                              |   2 -
 .github/workflows/_docs.yml                        |  57 +-
 .github/workflows/upload-docs-preview.yml          |  83 ---
 .lintrunner.toml                                   |   1 +
 aten/src/ATen/CPUFixedAllocator.h                  |  33 +
 aten/src/ATen/cuda/CUDABlas.cpp                    |  58 +-
 .../impl/HIPCachingAllocatorMasqueradingAsCUDA.h   |   5 +-
 aten/src/ATen/native/cuda/CopysignKernel.cu        |  35 +-
 .../native/cuda/linalg/BatchLinearAlgebraLib.cpp   |   2 +-
 .../native/cuda/linalg/BatchLinearAlgebraLib.h     |  11 +
 aten/src/ATen/native/quantized/cpu/qlinear.cpp     |  39 +-
 c10/cuda/CUDACachingAllocator.cpp                  |  15 +-
 c10/metal/reduction_utils.h                        |   2 -
 caffe2/CMakeLists.txt                              |   1 -
 docs/source/library.md                             | 132 ----
 docs/source/notes/hip.rst                          |   7 +-
 docs/source/notes/numerical_accuracy.md            |  20 -
 .../torch_compiler/torch.compiler_aot_compile.md   | 159 +----
 docs/source/xpu.md                                 |   5 -
 test/cpp/aoti_abi_check/README.md                  |   2 -
 test/cpp/shim/CMakeLists.txt                       |  31 -
 test/cpp/shim/README.md                            |  13 -
 test/cpp/shim/main.cpp                             |   6 -
 test/cpp/shim/run_test.sh                          |  14 -
 test/cpp/shim/test_stable_ivalue.cpp               |  44 --
 .../libtorch_agn_2_9_extension/csrc/kernel.cpp     |   9 +-
 test/custom_operator/test_inplace_tag.py           |  31 -
 .../_composable/fsdp/test_fully_shard_comm.py      |   1 -
 .../_composable/fsdp/test_fully_shard_overlap.py   |   4 +-
 .../_composable/fsdp/test_fully_shard_training.py  |   2 -
 test/distributed/pipelining/test_schedule.py       |  86 +--
 test/dynamo/test_autograd_function.py              |  48 +-
 test/dynamo/test_decorators.py                     |  39 --
 test/dynamo/test_dynamic_spec.py                   | 362 +++++++++--
 test/dynamo/test_misc.py                           |  80 ---
 test/dynamo/test_nb_unary.py                       | 300 ++++-----
 test/dynamo/test_repros.py                         |  26 -
 .../CPython313-test_builtin-BuiltinTest.test_abs   |   0
 .../TestAutograd.test_anomaly_detect_nan           |   0
 test/inductor/indirect_assert_helper.py            |  30 -
 test/inductor/test_codecache.py                    |  19 +
 test/inductor/test_combo_kernels.py                |  74 +--
 test/inductor/test_compile.py                      |  43 +-
 test/inductor/test_cpu_repro.py                    |  26 -
 test/inductor/test_cuda_repro.py                   |  40 --
 test/inductor/test_cudagraph_trees.py              |  74 ---
 test/inductor/test_cutlass_backend.py              |  62 +-
 test/inductor/test_debug_trace.py                  |  37 --
 test/inductor/test_fused_attention.py              |  43 +-
 test/inductor/test_gpu_cpp_wrapper.py              |  42 --
 test/inductor/test_inductor_utils.py               | 124 ----
 test/inductor/test_mps_basic.py                    |  19 -
 test/inductor/test_pattern_matcher.py              | 157 -----
 test/inductor/test_torchinductor.py                | 149 +----
 .../test_torchinductor_codegen_dynamic_shapes.py   |   6 -
 test/inductor/test_triton_kernels.py               |  80 ++-
 test/nn/test_convolution.py                        |  17 +-
 test/optim/test_swa_utils.py                       |  91 +--
 test/test_binary_ufuncs.py                         |  35 +-
 test/test_cuda.py                                  |  10 +-
 test/test_cuda_graph_debug.py                      | 313 ++++++++++
 test/test_custom_ops.py                            | 693 ---------------------
 test/test_dataloader.py                            | 107 +---
 test/test_dlpack.py                                |  17 +-
 test/test_function_schema.py                       |   7 +-
 test/test_linalg.py                                |  41 +-
 test/test_matmul_cuda.py                           |  34 -
 test/test_meta.py                                  |  17 -
 test/test_nn.py                                    |  38 +-
 test/test_optim.py                                 |   3 +-
 test/test_torch.py                                 |   8 +-
 test/test_transformers.py                          |  14 +-
 test/test_triton_utils.py                          |  91 ---
 test/test_xpu.py                                   | 101 ---
 .../target_determination/heuristics/utils.py       |   4 +-
 torch/__init__.py                                  |  13 +
 torch/_decomp/decompositions.py                    |   2 +-
 torch/_dynamo/config.py                            |   4 +
 torch/_dynamo/decorators.py                        |  13 +-
 torch/_dynamo/dynamic_spec.py                      | 114 ----
 torch/_dynamo/eval_frame.py                        |  29 +-
 torch/_dynamo/graph_break_registry.json            |  20 -
 torch/_dynamo/utils.py                             |   8 +-
 torch/_dynamo/variables/base.py                    |  17 -
 torch/_dynamo/variables/builder.py                 | 333 ++++++----
 torch/_dynamo/variables/builtin.py                 |  14 +-
 torch/_dynamo/variables/constant.py                |  15 -
 torch/_dynamo/variables/higher_order_ops.py        |  16 -
 torch/_dynamo/variables/object_protocol.py         |  26 -
 torch/_dynamo/variables/tensor.py                  |  34 -
 torch/_dynamo/variables/user_defined.py            |  49 +-
 torch/_functorch/_aot_autograd/graph_compile.py    |  13 +-
 torch/_functorch/_aot_autograd/runtime_wrappers.py |  26 +-
 torch/_functorch/_aot_autograd/schemas.py          |   3 -
 torch/_functorch/_aot_autograd/utils.py            |  54 +-
 torch/_functorch/partitioners.py                   |  22 +-
 torch/_higher_order_ops/triton_kernel_wrap.py      |  34 +-
 torch/_inductor/codecache.py                       |  89 +--
 torch/_inductor/codegen/cpp.py                     |  66 +-
 torch/_inductor/codegen/cpp_wrapper_cpu.py         |  20 +-
 .../_inductor/codegen/cpp_wrapper_cpu_array_ref.py |   9 +-
 torch/_inductor/codegen/cpp_wrapper_gpu.py         |  13 -
 torch/_inductor/codegen/simd.py                    |   2 +-
 torch/_inductor/codegen/wrapper.py                 |  39 +-
 torch/_inductor/compile_fx.py                      |   3 +-
 torch/_inductor/config.py                          |   5 +-
 torch/_inductor/cpp_builder.py                     |  51 +-
 torch/_inductor/cpu_vec_isa.py                     |  29 +-
 torch/_inductor/cudagraph_trees.py                 |  29 +-
 torch/_inductor/cudagraph_utils.py                 |  25 +-
 torch/_inductor/fuzzer.py                          |   4 +
 torch/_inductor/ir.py                              |   5 +-
 torch/_inductor/kernel/conv.py                     |   1 -
 .../_inductor/kernel/flex/flex_flash_attention.py  |   6 +-
 torch/_inductor/lowering.py                        |  93 +--
 torch/_inductor/pattern_matcher.py                 | 238 ++-----
 torch/_inductor/select_algorithm.py                |   2 +-
 torch/_inductor/subgraph_lowering.py               |  29 +-
 torch/_inductor/template_heuristics/triton.py      |  54 +-
 torch/_inductor/test_case.py                       |  20 +-
 torch/_inductor/utils.py                           | 138 ++--
 torch/_library/autograd.py                         |  11 -
 torch/_library/custom_ops.py                       | 135 +---
 torch/_library/infer_schema.py                     |  99 +--
 torch/_library/utils.py                            |   6 -
 torch/_logging/_registrations.py                   |   1 -
 torch/_native/README.md                            |  13 -
 torch/_native/cutedsl_utils.py                     |   8 +-
 torch/_native/ops/bmm_outer_product/triton_impl.py |  17 +-
 torch/_native/ops/scatter_add/cutedsl_impl.py      |  16 +-
 torch/_native/triton_utils.py                      |   7 +-
 torch/_prims/rng_prims.py                          |  66 +-
 torch/_refs/__init__.py                            |   3 +-
 torch/compiler/config.py                           |  28 +-
 torch/csrc/Device.h                                |   8 +-
 torch/csrc/Dtype.h                                 |   8 +-
 torch/csrc/Event.h                                 |  13 +-
 torch/csrc/Stream.h                                |   9 +-
 torch/csrc/distributed/rpc/rref_proto.cpp          |   6 +-
 torch/csrc/dynamo/guards.cpp                       |  82 +--
 torch/csrc/dynamo/python_compiled_autograd.cpp     |  50 +-
 torch/csrc/inductor/aoti_torch/utils.h             |  72 +--
 torch/csrc/inductor/cpp_prefix.h                   |  18 -
 torch/csrc/inductor/static_launcher/cuda.cpp       |  21 +-
 torch/csrc/jit/frontend/schema_type_parser.cpp     |   3 +
 torch/csrc/jit/serialization/pickler.cpp           |  12 +-
 torch/csrc/lazy/ts_backend/ts_backend_impl.h       |   2 +-
 torch/csrc/shim_common.cpp                         |  33 +-
 torch/csrc/stable/c/shim.h                         |  18 -
 torch/csrc/stable/c/shim_function_versions.txt     |   2 -
 torch/csrc/stable/stableivalue_conversions.h       |  17 +-
 torch/csrc/stable/tensor_struct.h                  |   4 +-
 torch/csrc/utils/python_arg_parser.cpp             |   3 +
 torch/csrc/utils/python_numbers.h                  |   8 +-
 torch/cuda/graphs.py                               |  55 +-
 torch/distributed/_tools/fsdp2_mem_tracker.py      |  88 ++-
 torch/distributed/_tools/mem_tracker.py            |  40 +-
 torch/distributed/distributed_c10d.py              |  84 ++-
 .../fsdp/_fully_shard/_fsdp_collectives.py         |   3 -
 .../fsdp/_fully_shard/_fsdp_param_group.py         |  16 +-
 torch/distributed/fsdp/_fully_shard/_fsdp_state.py |   3 -
 torch/distributed/pipelining/schedules.py          |  64 +-
 torch/distributed/tensor/_op_schema.py             |   1 -
 torch/fx/experimental/dynamic_spec.py              | 263 ++++++++
 torch/fx/experimental/symbolic_shapes.py           |  46 +-
 torch/library.py                                   |  19 +-
 torch/nativert/graph/Graph.cpp                     |   3 +-
 torch/nativert/graph/Serialization.cpp             |   4 +-
 torch/nn/attention/bias.py                         |   2 +-
 torch/nn/modules/activation.py                     |   4 +-
 torch/testing/_internal/common_nn.py               |  11 +-
 torch/testing/_internal/common_utils.py            |  40 --
 torch/testing/_internal/inductor_utils.py          |  64 +-
 torch/utils/_cuda_debug.py                         | 184 ++++++
 torch/utils/_triton.py                             |  38 +-
 torch/utils/data/dataloader.py                     |  44 +-
 torch/xpu/__init__.py                              | 486 +--------------
 torchgen/dest/register_dispatch_key.py             |   1 +
 179 files changed, 2687 insertions(+), 5937 deletions(-)

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.

1 participant