diff --git a/.ci/docker/ci_commit_pins/pytorch.txt b/.ci/docker/ci_commit_pins/pytorch.txt index 759062dec6f..13b827111b3 100644 --- a/.ci/docker/ci_commit_pins/pytorch.txt +++ b/.ci/docker/ci_commit_pins/pytorch.txt @@ -1 +1 @@ -7cda4017ddda554752e89069ae205be5e8388f59 +90f1e7bed15ca5e48c61c5b6dc5ad4810524f82f diff --git a/backends/xnnpack/test/ops/test_slice_copy.py b/backends/xnnpack/test/ops/test_slice_copy.py index 857c78480ad..f8189ab9862 100644 --- a/backends/xnnpack/test/ops/test_slice_copy.py +++ b/backends/xnnpack/test/ops/test_slice_copy.py @@ -67,7 +67,7 @@ def forward(self, x): inputs = (torch.randn(1, 1, 3, 3),) # Note that two of the slices are optimized away as they are identity. - self._test_slice_copy(ConvSlice(), inputs, 4, 2) + self._test_slice_copy(ConvSlice(), inputs, 2, 2) def test_fp32_slice_copy_default_start(self): """ @@ -95,7 +95,7 @@ def forward(self, x): ( Tester(module, inputs) .export() - .check_count({"torch.ops.aten.slice.Tensor": 3}) + .check_count({"torch.ops.aten.slice.Tensor": 1}) .to_edge_transform_and_lower() .check_not(["torch.ops.higher_order.executorch_call_delegate"]) ) diff --git a/devtools/inspector/tests/inspector_utils_test.py b/devtools/inspector/tests/inspector_utils_test.py index 2416fd89838..29f6f7ce4a8 100644 --- a/devtools/inspector/tests/inspector_utils_test.py +++ b/devtools/inspector/tests/inspector_utils_test.py @@ -610,9 +610,6 @@ def test_compare_intermediate_outputs_sequence_and_non_sequence(self): with self.assertRaises(ValueError): compare_intermediate_outputs(a, b, L1Comparator()) - @unittest.skip( - "TODO: enable the test after required feature has been built in pytorch core nightly version" - ) def test_equip_debug_handle_to_export_program_success(self): """Test that propagate_back_debug_handle returns True and properly equips debug handles.""" # Create a test model @@ -679,9 +676,6 @@ def test_equip_debug_handle_to_export_program_failure(self): # Check that it returns False due to mismatch self.assertFalse(result) - @unittest.skip( - "TODO: enable the test after required feature has been built in pytorch core nightly version" - ) def test_equip_debug_handle_to_export_program_op_to_be_removed_in_to_edge(self): """Test that propagate_back_debug_handle returns True and properly equips debug handles when an op is removed in to_edge""" diff --git a/install_requirements.py b/install_requirements.py index 43cc3b2c76d..7570ff3cfc5 100644 --- a/install_requirements.py +++ b/install_requirements.py @@ -71,7 +71,7 @@ def python_is_compatible(): # # NOTE: If you're changing, make the corresponding change in .ci/docker/ci_commit_pins/pytorch.txt # by picking the hash from the same date in https://hud.pytorch.org/hud/pytorch/pytorch/nightly/ -NIGHTLY_VERSION = "dev20250706" +NIGHTLY_VERSION = "dev20250714" def install_requirements(use_pytorch_nightly): diff --git a/runtime/core/portable_type/c10/c10/util/BFloat16.h b/runtime/core/portable_type/c10/c10/util/BFloat16.h index 0f7cecda46b..06236df1fc8 100644 --- a/runtime/core/portable_type/c10/c10/util/BFloat16.h +++ b/runtime/core/portable_type/c10/c10/util/BFloat16.h @@ -4,6 +4,7 @@ // 1 bit for the sign, 8 bits for the exponent and 7 bits for the mantissa. #include +#include #include #include #include @@ -67,13 +68,7 @@ inline C10_HOST_DEVICE uint16_t round_to_nearest_even(float src) { #endif return UINT16_C(0x7FC0); } else { - // NOLINTNEXTLINE(cppcoreguidelines-pro-type-member-init) - union { - uint32_t U32; // NOLINT(facebook-hte-BadMemberName) - float F32; // NOLINT(facebook-hte-BadMemberName) - }; - - F32 = src; + const uint32_t U32 = c10::bit_cast(src); uint32_t rounding_bias = ((U32 >> 16) & 1) + UINT32_C(0x7FFF); return static_cast((U32 + rounding_bias) >> 16); } @@ -111,9 +106,7 @@ struct alignas(2) BFloat16 { #endif }; -C10_API inline std::ostream& operator<<( - std::ostream& out, - const BFloat16& value) { +inline std::ostream& operator<<(std::ostream& out, const BFloat16& value) { out << (float)value; return out; } diff --git a/runtime/core/portable_type/c10/c10/util/Half.h b/runtime/core/portable_type/c10/c10/util/Half.h index 373881f21e5..bdcf7458145 100644 --- a/runtime/core/portable_type/c10/c10/util/Half.h +++ b/runtime/core/portable_type/c10/c10/util/Half.h @@ -414,7 +414,7 @@ struct alignas(2) Half { #endif }; -C10_API inline std::ostream& operator<<(std::ostream& out, const Half& value) { +inline std::ostream& operator<<(std::ostream& out, const Half& value) { out << (float)value; return out; } diff --git a/runtime/core/portable_type/c10/c10/util/bit_cast.h b/runtime/core/portable_type/c10/c10/util/bit_cast.h index 380cfa7db1c..d7d2aa8dd39 100644 --- a/runtime/core/portable_type/c10/c10/util/bit_cast.h +++ b/runtime/core/portable_type/c10/c10/util/bit_cast.h @@ -3,6 +3,8 @@ #include #include +#include + #if __has_include() && (defined(__cpp_lib_bit_cast) && __cpp_lib_bit_cast >= 201806L) #include #define C10_HAVE_STD_BIT_CAST 1 @@ -23,7 +25,7 @@ using std::bit_cast; // See https://en.cppreference.com/w/cpp/numeric/bit_cast for more // information as well as the source of our implementations. template -std::enable_if_t< +C10_HOST_DEVICE std::enable_if_t< sizeof(To) == sizeof(From) && std::is_trivially_copyable_v && std::is_trivially_copyable_v, To>