pytorch/test/export
Laith Sakka 7cfd054075 [attempt 2] Compute contiguity symbolically to avoid dde, and introduce c++ sym_is_contiguous (#157472)
Summary:
When we compute contiguity for a tensor with dynamic shapes we first:
1) Try to compute it without guarding.
2) If all shapes hinted, compute it with potentially adding guards.
3) if any input is not hinted, compute it symbolically.

sym_is_contiguous return a SymBool that is then either evaluated or guard_or_false can be called
on it to avoid data dependent errors.

ex:
 bool is_contiguous = input.sym_is_contiguous().guard_or_false(__FILE__, __LINE__);
is_contiguous_or_false is a helper function that does that.

In this PR I only handle default contiguity, will follow up with changes for other formats like  channel_last .
We use this patter in this PR for several locations to avoid DDEs.

Test Plan:
contbuild & OSS CI,

Rollback Plan:

Reviewed By: malfet

Differential Revision: D77639021

Pull Request resolved: https://github.com/pytorch/pytorch/pull/157472
Approved by: https://github.com/aorenste
2025-07-02 23:12:29 +00:00
..
__init__.py
opinfo_schema.py
random_dag.py
test_converter.py Enable more nightly tests on s390x (#148452) 2025-03-18 16:09:39 +00:00
test_cpp_serdes.py
test_db.py [Codemod][AddExplicitStrictExportForTrainingInferenceArg] caffe2/test/export (#150884) 2025-04-09 19:18:33 +00:00
test_draft_export.py [BE][PYFMT] migrate PYFMT for test/[a-h]*/ to ruff format (#144555) 2025-06-24 04:53:54 +00:00
test_experimental.py Revert "Fix full_like decomposition to preserve strides (#144765)" 2025-07-02 13:56:03 +00:00
test_export_strict.py Set non-strict export as default mode (#148790) 2025-03-12 21:10:58 +00:00
test_export_training_ir_to_run_decomp.py [BC-breaking] Set NonStrict as default for export_for_training (#150941) 2025-04-11 00:50:05 +00:00
test_export_with_inline_and_install.py [dynamo] Recursively realize the stack_values (#152853) 2025-05-07 02:36:44 +00:00
test_export.py [attempt 2] Compute contiguity symbolically to avoid dde, and introduce c++ sym_is_contiguous (#157472) 2025-07-02 23:12:29 +00:00
test_functionalized_assertions.py
test_hop.py
test_lift_unlift.py
test_package.py [export] Exporter API prototype. (#153205) 2025-05-11 14:20:09 +00:00
test_pass_infra.py
test_passes.py
test_retraceability.py Set non-strict export as default mode (#148790) 2025-03-12 21:10:58 +00:00
test_schema.py [resubmit][export] add _union_dataclass to support comparing dataclasses that inherits from union. (#156765) 2025-06-25 22:32:12 +00:00
test_serdes.py Set non-strict export as default mode (#148790) 2025-03-12 21:10:58 +00:00
test_serialize.py [BE][PYFMT] migrate PYFMT for test/[a-h]*/ to ruff format (#144555) 2025-06-24 04:53:54 +00:00
test_sparse.py Replace all random is_fbcode imports to environment (#151283) 2025-04-15 19:42:58 +00:00
test_swap.py [BE][PYFMT] migrate PYFMT for test/[a-h]*/ to ruff format (#144555) 2025-06-24 04:53:54 +00:00
test_tools.py
test_torchbind.py [BE][3/16] fix typos in torch/ (torch/_inductor/) (#156313) 2025-06-23 02:57:12 +00:00
test_tree_utils.py
test_unflatten_training_ir.py [Codemod][AddExplicitStrictExportForTrainingInferenceArg] caffe2/test/export (#150884) 2025-04-09 19:18:33 +00:00
test_unflatten.py [BE][3/16] fix typos in torch/ (torch/_inductor/) (#156313) 2025-06-23 02:57:12 +00:00
test_upgrader.py [schema_upgrader] add C++ upgrader for json based upgrading (#156761) 2025-06-28 18:15:06 +00:00
test_verifier.py [Codemod][AddExplicitStrictExportForTrainingInferenceArg] caffe2/test/export (#150884) 2025-04-09 19:18:33 +00:00
testing.py Set non-strict export as default mode (#148790) 2025-03-12 21:10:58 +00:00