pytorch/test
Elana e3e93c7107 [MPS] Fix random in-place ops on non-contiguous tensors (#165267)
Random in-place operations (normal_, uniform_, exponential_, bernoulli_, random_) were silently failing on non-contiguous tensors on macOS < 15.0.

* Added needsGather check and scatter-back logic to handle non-contiguous output tensors, following the pattern used in PointwiseOps.

* Adds test to confirm these now work
* Remove pre-macOS15 xfail for test_Dropout

Fixes #165257 and #124029

Pull Request resolved: https://github.com/pytorch/pytorch/pull/165267
Approved by: https://github.com/kulinseth, https://github.com/malfet

Co-authored-by: Nikita Shulga <2453524+malfet@users.noreply.github.com>
2025-10-28 18:43:22 +00:00
..
ao/sparsity Enable all PIE rules on ruff (#165814) 2025-10-18 07:36:18 +00:00
autograd
backends/xeon
benchmark_utils [BE][3/6] fix typos in test/ (#157637) 2025-07-17 12:08:33 +00:00
compiled_autograd_skips
cpp [AOTI][BE] Change test_aoti_inference to one-pass build (#164277) 2025-10-28 17:43:22 +00:00
cpp_api_parity
cpp_extensions [AMP][Refactor] Autocast dtype handling to simplify device-specific c… (#165221) 2025-10-28 06:21:29 +00:00
custom_backend
custom_operator Using the latest torch.library.register_fake API instead of torch.library.impl_abstract (#158839) 2025-07-25 02:37:30 +00:00
distributed [ROCm] skip AsyncTP test class as AsyncTP is not supported on ROCm (#166316) 2025-10-28 16:23:46 +00:00
distributions Enable PLW0127 in ruff (#165851) 2025-10-21 03:30:57 +00:00
dynamo [ROCm][CI] forward fix kineto submodule bump (#166421) 2025-10-28 17:40:23 +00:00
dynamo_expected_failures Patch the flex_attention._get_mod_type to not use inspect.signature when computing num_positional_args (an alternative fix for flex attention graph break on create_block_mask) (#164923) 2025-10-17 17:44:45 +00:00
dynamo_skips Add functions to setup PrivateUse1 as a python backend device. (#157859) 2025-10-01 21:32:59 +00:00
error_messages
expect [fx] Optimize torch.fx.Node.replace_all_uses_with (#165889) 2025-10-25 03:44:41 +00:00
export Update gm.print_readable to include Annotation (#165397) 2025-10-28 13:54:38 +00:00
forward_backward_compatibility Revert "[BC-Breaking] Remove long-deprecated casting functions from native_functions.yaml (#164641)" 2025-10-09 15:42:51 +00:00
functorch Update gm.print_readable to include Annotation (#165397) 2025-10-28 13:54:38 +00:00
fx Enable new tracer by default (#165332) 2025-10-23 00:40:29 +00:00
higher_order_ops Update gm.print_readable to include Annotation (#165397) 2025-10-28 13:54:38 +00:00
inductor [FlexAttention] Add mechanism to get optimal autotune decision (#165817) 2025-10-28 15:50:12 +00:00
inductor_expected_failures [dynamo] Graph break on on user-defined class in compiled region (#161670) 2025-09-10 04:39:20 +00:00
inductor_skips
jit docs: fix typos (#164879) 2025-10-28 12:00:36 +00:00
jit_hooks
lazy Back out "Do not decompose in functionalization/proxy tensor if autograd wouldn't have decomposed (#164939)" (#165910) 2025-10-21 16:36:38 +00:00
mobile Enable all SIM rules except disabled ones (#164645) 2025-10-17 07:27:11 +00:00
nn [MPS] Fix random in-place ops on non-contiguous tensors (#165267) 2025-10-28 18:43:22 +00:00
onnx [ONNX] Add a test to backed_size_oblivious patch in onnx (#166196) 2025-10-24 22:47:10 +00:00
optim Enable PLW0127 in ruff (#165851) 2025-10-21 03:30:57 +00:00
package [Torch Package] Make get names of OrderedImporters support fallback to importers (#155743) 2025-08-06 02:26:10 +00:00
profiler [ROCm][CI] forward fix kineto submodule bump (#166421) 2025-10-28 17:40:23 +00:00
quantization Enable PLC0414 on ruff (#165828) 2025-10-22 04:56:52 +00:00
scripts [BE][PYFMT] migrate PYFMT for test/[i-z]*/ to ruff format (#144556) 2025-07-29 03:26:09 +00:00
strobelight/examples
test_img
torch_np docs: fix typos (#164879) 2025-10-28 12:00:36 +00:00
typing Revert "Add __init__.pyi to torch/linalg (#160750)" 2025-09-02 16:53:55 +00:00
xpu [Intel GPU] Xpu matmul implementation for complex dtype (#160867) 2025-10-25 17:13:13 +00:00
_test_bazel.py
allowlist_for_publicAPI.json Revert "[BC-Breaking] Remove long-deprecated casting functions from native_functions.yaml (#164641)" 2025-10-09 15:42:51 +00:00
bench_mps_ops.py [BE] Remove macos-13 guard from bench_mps_ops (#159732) 2025-08-03 20:53:58 +00:00
conftest.py Stop parsing command line arguments every time common_utils is imported. (#156703) 2025-10-02 22:22:04 +00:00
create_dummy_torchscript_model.py
HowToWriteTestsUsingFileCheck.md
linear.py
load_torchscript_model.py
minioptest_failures_dict.json
mkl_verbose.py
mkldnn_verbose.py
pytest_shard_custom.py
run_doctests.sh
run_test.py [CI] Fix doctest job if build without distributed (#165449) 2025-10-14 19:19:03 +00:00
simulate_nccl_errors.py
slow_tests.json Update slow tests (#165894) 2025-10-27 11:42:14 +00:00
test_accelerator.py Add UT for torch.accelerator memory-related API (#155200) 2025-08-08 17:41:22 +00:00
test_ao_sparsity.py [testing] Add test owner labels for some ao sparse tests (#163203) 2025-09-18 16:08:13 +00:00
test_appending_byte_serializer.py
test_autocast.py [AMP][Refactor] Autocast dtype handling to simplify device-specific c… (#165221) 2025-10-28 06:21:29 +00:00
test_autograd_fallback.py Fix TestAutogradFallback flaky tests under Dynamo: migrate to lib._destroy() (#159443) 2025-07-30 19:30:55 +00:00
test_autograd.py Revert "Warn if AccumulateGrad stream does not match producer node stream (#165065)" 2025-10-23 17:02:49 +00:00
test_autoload.py
test_binary_ufuncs.py Enable ruff rule E721 (#165162) 2025-10-13 01:48:55 +00:00
test_bundled_images.py
test_bundled_inputs.py Pyrefly suppressions 7/n (#164913) 2025-10-08 07:27:17 +00:00
test_ci_sanity_check_fail.py
test_comparison_utils.py
test_compile_benchmark_util.py
test_complex.py Pyrefly suppressions 7/n (#164913) 2025-10-08 07:27:17 +00:00
test_content_store.py [ROCm] Enabling several UTs (#161715) 2025-09-09 15:49:21 +00:00
test_cpp_api_parity.py Revert "Stop parsing command line arguments every time common_utils is imported. (#156703)" 2025-08-04 20:37:39 +00:00
test_cpp_extensions_aot.py Replace setup.py install with pip install (#156711) 2025-09-29 15:15:10 +00:00
test_cpp_extensions_jit.py Move from/to to torch::stable::detail (#164956) 2025-10-21 02:59:46 +00:00
test_cpp_extensions_mtia_backend.py
test_cpp_extensions_stream_and_event.py
test_cuda_expandable_segments.py
test_cuda_multigpu.py [ROCm] Enabling several UTs (#161715) 2025-09-09 15:49:21 +00:00
test_cuda_nvml_based_avail.py More ruff SIM fixes (#164695) 2025-10-09 03:24:50 +00:00
test_cuda_primary_ctx.py [ROCm][CI] skip TestCudaPrimaryCtx.test_set_device_0 (#163693) 2025-09-23 22:15:10 +00:00
test_cuda_sanitizer.py
test_cuda_trace.py
test_cuda.py Enable PLW0127 in ruff (#165851) 2025-10-21 03:30:57 +00:00
test_custom_ops.py [Bugfix][vLLM] Explicitly do not support instead of crashing for named tuples in infer schema (#165191) 2025-10-14 14:18:42 +00:00
test_dataloader.py Enable PLW0127 in ruff (#165851) 2025-10-21 03:30:57 +00:00
test_datapipe.py Enable all PIE rules on ruff (#165814) 2025-10-18 07:36:18 +00:00
test_decomp.py Back out "Do not decompose in functionalization/proxy tensor if autograd wouldn't have decomposed (#164939)" (#165910) 2025-10-21 16:36:38 +00:00
test_determination.py
test_dispatch.py
test_dlpack.py [Fix] Completely remove stride normalization on DLPack Tensor (#164161) 2025-10-14 17:17:11 +00:00
test_dynamic_shapes.py docs: fix typos (#164879) 2025-10-28 12:00:36 +00:00
test_expanded_weights.py Revert "Stop parsing command line arguments every time common_utils is imported. (#156703)" 2025-08-04 20:37:39 +00:00
test_extension_utils.py
test_fake_tensor.py [FakeTensor] Supplement the relevant logic for converting conv1d to conv2d in meta_conv (#160408) 2025-09-26 15:45:02 +00:00
test_file_check.py
test_flop_counter.py [ROCm] Enable MI355 CI on PRs, and run full set of UTs on PRs (#160215) 2025-10-09 18:03:12 +00:00
test_foreach.py Remove old ROCm version check in tests (#164245) 2025-10-06 22:42:01 +00:00
test_function_schema.py
test_functional_autograd_benchmark.py
test_functional_optim.py
test_functionalization_of_rng_ops.py [BE][2/6] fix typos in test/ (test/test_*.py) (#157636) 2025-07-09 11:02:23 +00:00
test_functionalization.py [BE][2/6] fix typos in test/ (test/test_*.py) (#157636) 2025-07-09 11:02:23 +00:00
test_futures.py
test_fx_experimental.py [8/N] Apply ruff UP035 rule (#165214) 2025-10-15 03:18:57 +00:00
test_fx_passes.py [BE][2/6] fix typos in test/ (test/test_*.py) (#157636) 2025-07-09 11:02:23 +00:00
test_fx_reinplace_pass.py [dynamic shapes] avoid unnecessary slices (#157528) 2025-07-10 06:34:46 +00:00
test_fx.py [reland][fx] Move Node._prepend/Node._remove_from_list to C++ (#165882) 2025-10-21 19:43:55 +00:00
test_hop_infra.py
test_hub.py
test_import_stats.py
test_indexing.py Enable all PIE rules on ruff (#165814) 2025-10-18 07:36:18 +00:00
test_itt.py Enable PLW0127 in ruff (#165851) 2025-10-21 03:30:57 +00:00
test_jit_autocast.py Enable all SIM rules except disabled ones (#164645) 2025-10-17 07:27:11 +00:00
test_jit_disabled.py
test_jit_fuser_legacy.py Stop parsing command line arguments every time common_utils is imported. (#156703) 2025-10-02 22:22:04 +00:00
test_jit_fuser_te.py Enable all PIE rules on ruff (#165814) 2025-10-18 07:36:18 +00:00
test_jit_fuser.py Stop parsing command line arguments every time common_utils is imported. (#156703) 2025-10-02 22:22:04 +00:00
test_jit_legacy.py Stop parsing command line arguments every time common_utils is imported. (#156703) 2025-10-02 22:22:04 +00:00
test_jit_llga_fuser.py
test_jit_profiling.py
test_jit_simple.py
test_jit_string.py More ruff SIM fixes (#164695) 2025-10-09 03:24:50 +00:00
test_jit.py Enable PLW0127 in ruff (#165851) 2025-10-21 03:30:57 +00:00
test_jiterator.py
test_kernel_launch_checks.py [testing] Add test owner labels for some cuda? tests (#163296) 2025-09-26 18:26:56 +00:00
test_legacy_vmap.py [BE][2/6] fix typos in test/ (test/test_*.py) (#157636) 2025-07-09 11:02:23 +00:00
test_license.py [BE][2/6] fix typos in test/ (test/test_*.py) (#157636) 2025-07-09 11:02:23 +00:00
test_linalg.py Improve eig tests in preparation for new eig backends (#166322) 2025-10-28 14:42:47 +00:00
test_logging.py
test_masked.py [BE][2/6] fix typos in test/ (test/test_*.py) (#157636) 2025-07-09 11:02:23 +00:00
test_maskedtensor.py Fix MaskedTensor to device ignored mask (#151205) 2025-07-21 21:44:49 +00:00
test_matmul_cuda.py [CUDA][Grouped Gemm] remove xFail on Group GEMM tests after fallback was added (#165378) 2025-10-24 17:42:40 +00:00
test_meta.py [Inductor] support mixed dtype in the native_layer_norm_backward meta function (#159830) 2025-09-17 20:29:12 +00:00
test_metal.py
test_mkl_verbose.py
test_mkldnn_fusion.py
test_mkldnn_verbose.py
test_mkldnn.py Enable TF32 as fp32 internal precision for matmul/linear/conv (#157520) 2025-07-17 08:57:34 +00:00
test_mobile_optimizer.py
test_model_exports_to_core_aten.py Replace export_for_training with export (#162396) 2025-09-10 14:19:34 +00:00
test_module_tracker.py
test_modules.py [ROCm][CI] unskip some test_memory_format tests (#162766) 2025-09-12 15:02:40 +00:00
test_monitor.py
test_mps.py [MPS] Fix random in-place ops on non-contiguous tensors (#165267) 2025-10-28 18:43:22 +00:00
test_multiprocessing_spawn.py Change forkserver test to only run below 3.13.8 (#165667) 2025-10-16 19:34:10 +00:00
test_multiprocessing.py Enable PLW0127 in ruff (#165851) 2025-10-21 03:30:57 +00:00
test_namedtensor.py Fix tensor creation with empty names crash (#163957) 2025-09-26 17:41:00 +00:00
test_namedtuple_return_api.py
test_native_functions.py
test_native_mha.py
test_nestedtensor.py [CI] Move the periodic debug tests to newer runner (#165158) 2025-10-21 21:28:12 +00:00
test_nn.py Fixes floating point exception in torch.nn.PixelShuffle (#163154) 2025-10-22 02:22:16 +00:00
test_nnapi.py
test_numa_binding.py Enable all PIE rules on ruff (#165814) 2025-10-18 07:36:18 +00:00
test_numba_integration.py [testing] Add test owner labels for some cuda? tests (#163296) 2025-09-26 18:26:56 +00:00
test_numpy_interop.py Enable all SIM rules except disabled ones (#164645) 2025-10-17 07:27:11 +00:00
test_opaque_obj_v2.py [opaque_obj_v2] PyObject custom op schema type (#165004) 2025-10-14 20:21:04 +00:00
test_opaque_obj.py [opaque_obj] Add make_fx tracing support (#163278) 2025-10-08 09:09:16 +00:00
test_openmp.py
test_ops_fwd_gradients.py
test_ops_gradients.py
test_ops_jit.py [BE][2/6] fix typos in test/ (test/test_*.py) (#157636) 2025-07-09 11:02:23 +00:00
test_ops.py [ATen] Add reduction tag to reduction operators (#165155) 2025-10-21 04:35:03 +00:00
test_optim.py Fix LBFGS wolfe max iteration (#161488) 2025-09-16 12:07:50 +00:00
test_out_dtype_op.py
test_overrides.py Revert "[Reland] Use std::string_view in torchgen (#158625)" 2025-09-13 07:52:50 +00:00
test_package.py
test_per_overload_api.py [BE][2/6] fix typos in test/ (test/test_*.py) (#157636) 2025-07-09 11:02:23 +00:00
test_prims.py [Bugfix] Match eager stride semantics for cloned tensors with preserve_format in compile (#163017) 2025-09-19 19:41:33 +00:00
test_privateuseone_python_backend.py Add functions to setup PrivateUse1 as a python backend device. (#157859) 2025-10-01 21:32:59 +00:00
test_proxy_tensor.py Fix refine_ranges corner case (#164075) (#164846) 2025-10-08 18:42:37 +00:00
test_pruning_op.py Enable all SIM rules except disabled ones (#164645) 2025-10-17 07:27:11 +00:00
test_public_bindings.py [CUDA] Add experimental green context support for SM carveout (#159104) 2025-10-22 21:38:52 +00:00
test_python_dispatch.py Fix double dispatch to Python for detach (#163671) 2025-10-15 17:24:50 +00:00
test_pytree.py [BE][pytree] cleanup parameterized pytree tests (#160842) 2025-09-05 20:15:29 +00:00
test_quantization.py Enable all flake8-logging-format rules (#164655) 2025-10-19 00:59:28 +00:00
test_reductions.py Enable all PIE rules on ruff (#165814) 2025-10-18 07:36:18 +00:00
test_rename_privateuse1_to_existing_device.py [Device] Add support for PrivateUse1 device type in parse_type function (#157609) 2025-07-17 01:27:44 +00:00
test_scaled_matmul_cuda.py [ROCm] Skip test_blockwise_nvfp4_with_global_scale (#165968) 2025-10-22 04:23:05 +00:00
test_scatter_gather_ops.py fix deterministic scatter_add path for multi-d tensors (#162866) 2025-09-15 06:50:00 +00:00
test_schema_check.py [inductor] slow test some Windows UTs. (#160267) 2025-08-10 18:35:42 +00:00
test_segment_reductions.py Enable all SIM rules except disabled ones (#164645) 2025-10-17 07:27:11 +00:00
test_serialization.py Quick fix of torch.save memory leak (#165204) 2025-10-27 07:50:58 +00:00
test_set_default_mobile_cpu_allocator.py
test_shape_ops.py Enable Intel GPU on 4 unit test cases (#165405) 2025-10-27 06:06:07 +00:00
test_show_pickle.py
test_sort_and_select.py Add dtype checks in meta dispatch for various ordering ops (#159556) 2025-08-14 17:06:27 +00:00
test_sparse_csr.py Enable PLW0127 in ruff (#165851) 2025-10-21 03:30:57 +00:00
test_sparse_semi_structured.py [CI] Move the periodic debug tests to newer runner (#165158) 2025-10-21 21:28:12 +00:00
test_sparse.py [MPS] Sparse mul enable tests and fix on MPS (#166164) 2025-10-24 18:30:30 +00:00
test_spectral_ops.py
test_stateless.py [BE][2/6] fix typos in test/ (test/test_*.py) (#157636) 2025-07-09 11:02:23 +00:00
test_static_runtime.py Enable all PIE rules on ruff (#165814) 2025-10-18 07:36:18 +00:00
test_subclass.py
test_sympy_utils.py [1/N] Apply UP035 rule in tests (#163947) 2025-09-29 01:42:01 +00:00
test_tensor_creation_ops.py test for #165446 (#165853) 2025-10-23 00:08:18 +00:00
test_tensorboard.py Enable all PIE rules on ruff (#165814) 2025-10-18 07:36:18 +00:00
test_tensorexpr_pybind.py
test_tensorexpr.py Enable all PIE rules on ruff (#165814) 2025-10-18 07:36:18 +00:00
test_testing.py [1/N] Apply UP035 rule in tests (#163947) 2025-09-29 01:42:01 +00:00
test_throughput_benchmark.py
test_torch.py Fix race condition and make CUDA kthvalue deterministic (#165762) 2025-10-25 00:45:57 +00:00
test_torchfuzz_repros.py Enable all SIM rules except disabled ones (#164645) 2025-10-17 07:27:11 +00:00
test_transformers.py Enable Intel GPU on 4 unit test cases (#165405) 2025-10-27 06:06:07 +00:00
test_type_hints.py Pyrefly suppressions 7/n (#164913) 2025-10-08 07:27:17 +00:00
test_type_info.py Enable PLW0127 in ruff (#165851) 2025-10-21 03:30:57 +00:00
test_type_promotion.py Enable PLW0127 in ruff (#165851) 2025-10-21 03:30:57 +00:00
test_typing.py [BE][2/6] fix typos in test/ (test/test_*.py) (#157636) 2025-07-09 11:02:23 +00:00
test_unary_ufuncs.py [BUG] Fix nonzero_static crash on CUDA when the input is a empty tensor (#162578) 2025-09-15 05:44:15 +00:00
test_utils_config_module.py
test_utils_filelock.py
test_utils.py Enable PLW0127 in ruff (#165851) 2025-10-21 03:30:57 +00:00
test_varlen_attention.py varlen api (#164502) 2025-10-15 19:45:55 +00:00
test_view_ops.py Enable PLW0127 in ruff (#165851) 2025-10-21 03:30:57 +00:00
test_vulkan.py
test_weak.py [BE][2/6] fix typos in test/ (test/test_*.py) (#157636) 2025-07-09 11:02:23 +00:00
test_xnnpack_integration.py Enable all PIE rules on ruff (#165814) 2025-10-18 07:36:18 +00:00
test_xpu.py Add a new API torch.xpu.is_tf32_supported for Intel GPU (#163141) 2025-10-12 12:11:57 +00:00