Reimplementing dtr with generic overloading.#62
Open
MarisaKirisame wants to merge 35 commits into21-3-2-origfrom
Open
Reimplementing dtr with generic overloading.#62MarisaKirisame wants to merge 35 commits into21-3-2-origfrom
MarisaKirisame wants to merge 35 commits into21-3-2-origfrom
Conversation
ezyang
reviewed
Aug 1, 2021
| TORCH_CHECK(count == make_raw_result.outputs.size()); | ||
| } | ||
|
|
||
| // todo: i can also use a torch library impl instead of calling fallback explicitly. should i do that? |
Collaborator
There was a problem hiding this comment.
yeah just use torch library impl, that's what it's for
ezyang
reviewed
Aug 1, 2021
| std::vector<bool> checkpoint_reversed_ivalue_in_mutable; | ||
| // but should we really reverse stuff? there is a peek() function which doesnt. | ||
| // ezyang seems to want to replace stack impl from std::vector to some sort of list, | ||
| // so slower peek() though. |
Collaborator
There was a problem hiding this comment.
Don't reverse it. Stack is always going to be contiguous memory. You can iterate the other direction to avoid reversing.
MarisaKirisame
commented
Aug 3, 2021
|
|
||
| // map over the tensor in the ivalue. | ||
| // weird stuff. seems like i cant write a generic function over all list :( | ||
| template<typename F> |
Collaborator
Author
There was a problem hiding this comment.
optimization: use fallback for all other then istensorlist/istensor/istensoroptionlist
| std::vector<bool> checkpoint_tensors_in_mutable; | ||
| auto it = checkpoint_reversed_ivalue_in.rbegin(); | ||
| auto mit = checkpoint_reversed_ivalue_in_mutable.rbegin(); | ||
| while (it != checkpoint_reversed_ivalue_in.rend()) { |
Collaborator
Author
There was a problem hiding this comment.
remove reverse - much simpler
| // the only way to construct/destruct an IValue should be map_ivalue. | ||
| void CheckpointFallback(const c10::OperatorHandle& op, torch::jit::Stack* stack) { | ||
| size_t before_size = stack->size(); | ||
| auto s = op.schema(); |
Collaborator
Author
There was a problem hiding this comment.
only call op.schema() once
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fixes #{issue number}