8000 Enable `_lazy_clone` between CPU and MPS by kurtamohler · Pull Request #148408 · pytorch/pytorch · GitHub
[go: up one dir, main page]

Skip to content

Enable _lazy_clone between CPU and MPS #148408

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 82 commits into
base: gh/kurtamohler/32/base
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
82 commits
Select commit Hold shift + click to select a range
e4a0cb8
Update
kurtamohler Mar 4, 2025
7c0f082
Update
kurtamohler Mar 7, 2025
501d68f
Update
kurtamohler Mar 7, 2025
3f9ca3c
Update
kurtamohler Mar 7, 2025
2a4340b
Update
kurtamohler Mar 11, 2025
778a0af
Update
kurtamohler Mar 12, 2025
8130be6
Update
kurtamohler Mar 12, 2025
e67656b
Update
kurtamohler Mar 12, 2025
3d169bd
Update
kurtamohler Mar 13, 2025
c48bfa0
Update
kurtamohler Mar 17, 2025
1826b54
Update
kurtamohler Mar 17, 2025
6fa7775
Update
kurtamohler Mar 17, 2025
cefe1c4
Update
kurtamohler Mar 18, 2025
02976b5
Update
kurtamohler Mar 18, 2025
02011e0
Update
kurtamohler Mar 18, 2025
3438700
Update
kurtamohler Mar 18, 2025
ed0f556
Update
kurtamohler Mar 18, 2025
bf1de02
Update
kurtamohler Mar 18, 2025
a74ae14
Update
kurtamohler Mar 18, 2025
eb66439
Update
kurtamohler Mar 18, 2025
764a186
Update
kurtamohler Mar 19, 2025
ae00427
Update
kurtamohler Mar 19, 2025
651e02a
Update
kurtamohler Mar 21, 2025
4f82e2f
Update
kurtamohler Mar 24, 2025
6b3ab6b
Update
kurtamohler Mar 24, 2025
2eeda3a
Update
kurtamohler Mar 25, 2025
fba676d
Update
kurtamohler Mar 25, 2025
027b63f
Update
kurtamohler Mar 25, 2025
534b116
Update
kurtamohler Mar 25, 2025
2c09346
Update
kurtamohler Mar 25, 2025
5cc9a0e
Update
kurtamohler Mar 25, 2025
8f33e76
Update
kurtamohler Mar 26, 2025
a2dfe1b
Update
kurtamohler Mar 26, 2025
83e3b26
Update
kurtamohler Mar 26, 2025
7d2ebbb
Update
kurtamohler Mar 26, 2025
b1f827d
Update
kurtamohler Mar 26, 2025
dcc6e97
Update
kurtamohler Mar 26, 2025
65986d1
Update
kurtamohler Mar 26, 2025
52ed388
Update
kurtamohler Mar 26, 2025
9eec7be
Update
kurtamohler Mar 26, 2025
e4b3f98
Update
kurtamohler Mar 26, 2025
56fb303
Update
kurtamohler Mar 26, 2025
8cb9ef8
Update
kurtamohler Mar 26, 2025
78ebf1a
Update
kurtamohler Mar 27, 2025
dcf885e
Update
kurtamohler Mar 27, 2025
5e39c32
Update
kurtamohler Mar 27, 2025
a5354d7
Update
kurtamohler Mar 27, 2025
749e37b
Update
kurtamohler Mar 27, 2025
bc0bda8
Update
kurtamohler Mar 27, 2025
d44aa02
Update
kurtamohler Mar 27, 2025
bf7be18
Update
kurtamohler Apr 1, 2025
9700e0f
Update
kurtamohler Apr 2, 2025
20269b1
Update
kurtamohler Apr 2, 2025
4fbe13f
Update
kurtamohler Apr 2, 2025
300b52d
Update
kurtamohler Apr 2, 2025
541e910
Update
kurtamohler Apr 3, 2025
3ca6e53
Update
kurtamohler Apr 3, 2025
e919203
Update
kurtamohler Apr 4, 2025
1c63790
Update
kurtamohler Apr 4, 2025
15ff7b3
Update
kurtamohler Apr 4, 2025
0e6cc83
Update
kurtamohler Apr 4, 2025
af8e76d
Update
kurtamohler Apr 5, 2025
a4993ea
Update
kurtamohler Apr 7, 2025
229632a
Update
kurtamohler Apr 7, 2025
7b38ca7
Update
kurtamohler Apr 7, 2025
bd89c07
Update
kurtamohler Apr 8, 2025
22081eb
Update
kurtamohler Apr 25, 2025
1e5de8a
Update
kurtamohler Apr 28, 2025
2f864f1
Update
kurtamohler Apr 28, 2025
c688b9c
Update
kurtamohler Apr 28, 2025
d5e4f89
Update
kurtamohler May 1, 2025
3b1a2c7
Update
kurtamohler May 16, 2025
74a35a4
Update
kurtamohler May 21, 2025
62ebaa3
Update
kurtamohler May 21, 2025
c6f7cf6
Update
kurtamohler May 21, 2025
da2602f
Update
kurtamohler May 23, 2025
529e78c
Update on "Enable `_lazy_clone` between CPU and MPS"
kurtamohler May 24, 2025
14e095a
Update on "Enable `_lazy_clone` between CPU and MPS"
kurtamohler May 27, 2025
af8d3ff
Update on "Enable `_lazy_clone` between CPU and MPS"
kurtamohler May 28, 2025
281f616
Update on "Enable `_lazy_clone` between CPU and MPS"
kurtamohler May 28, 2025
d472408
Update on "Enable `_lazy_clone` between CPU and MPS"
kurtamohler May 31, 2025
49f6711
Update
kurtamohler Jul 18, 2025
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Update
[ghstack-poisoned]
  • Loading branch information
kurtamohler committed Apr 28, 2025
commit c688b9cb15ab6f851f2af1d9860fb98edce9a291
2 changes: 1 addition & 1 deletion aten/src/ATen/native/AutogradComposite.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,7 @@ bool _has_same_storage_numel(const at::Tensor& base, const at::Tensor& other) {
return base.storage().sym_nbytes() / base.itemsize() == other.storage().sym_nbytes() / other.itemsize();
}

Tensor _lazy_clone(Tensor const& self, optional<c10::Device> device_opt) {
Tensor _lazy_clone(Tensor const& self, std::optional<c10::Device> device_opt) {
c10::StorageImpl* self_storage = self.storage().unsafeGetStorageImpl();
c10::intrusive_ptr<c10::StorageImpl> storage = nullptr;

Expand Down
9 changes: 5 additions & 4 deletions c10/core/impl/COW.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
#include <c10/core/alignment.h>
#include <c10/core/impl/COWDeleter.h>
#include <c10/util/Exception.h>
#include <c10/util/Optional.h>
#include <c10/util/ParallelGuard.h>
#include <c10/util/UniqueVoidPtr.h>

Expand Down Expand Up @@ -75,7 +76,7 @@ static void check_clone_between_devices(
"'.");
}

static c10::optional<at::DataPtr> lazy_clone_storage_data_ptr(
static std::optional<at::DataPtr> lazy_clone_storage_data_ptr(
StorageImpl& storage) {
const at::DataPtr& data_ptr = storage.data_ptr();

Expand Down Expand Up @@ -126,15 +127,15 @@ static c10::optional<at::DataPtr> lazy_clone_storage_data_ptr(
} else {
// Case 3) There is a context and it's not copy-on-write. Nothing
// we can do here.
return c10::nullopt;
return std::nullopt;
}

TORCH_INTERNAL_ASSERT(new_data_ptr_opt.has_value());
return new_data_ptr_opt;
}

c10::intrusive_ptr<StorageImpl> lazy_clone_storage(StorageImpl& storage) {
c10::optional<at::DataPtr> new_data_ptr_opt =
std::optional<at::DataPtr> new_data_ptr_opt =
lazy_clone_storage_data_ptr(storage);
if (!new_data_ptr_opt.has_value()) {
return nullptr;
Expand All @@ -154,7 +155,7 @@ c10::intrusive_ptr<StorageImpl> lazy_clone_storage(
StorageImpl& storage,
c10::Device device,
c10::Allocator& allocator) {
c10::optional<at::DataPtr> new_data_ptr_opt =
std::optional<at::DataPtr> new_data_ptr_opt =
lazy_clone_storage_data_ptr(storage);
if (!new_data_ptr_opt.has_value()) {
return nullptr;
Expand Down
1 change: 0 additions & 1 deletion c10/core/impl/COW.h
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@
#include <c10/core/Allocator.h>
#include <c10/core/Device.h>
#include <c10/macros/Macros.h>
#include <c10/util/Optional.h>
#include <c10/util/intrusive_ptr.h>

namespace c10 {
Expand Down
Loading
0