Expose an API to iterate all the registered operators#23207
Closed
houseroad wants to merge 8 commits intogh/houseroad/10/basefrom
Closed
Expose an API to iterate all the registered operators#23207houseroad wants to merge 8 commits intogh/houseroad/10/basefrom
houseroad wants to merge 8 commits intogh/houseroad/10/basefrom
Conversation
So we can iterate over the operator registry, and check the backward compatiblity. Differential Revision: [D16434335](https://our.internmc.facebook.com/intern/diff/D16434335/)
This was referenced Jul 23, 2019
So we can iterate over the operator registry, and check the backward compatiblity. Differential Revision: [D16434335](https://our.internmc.facebook.com/intern/diff/D16434335/)
So we can iterate over the operator registry, and check the backward compatiblity. Differential Revision: [D16434335](https://our.internmc.facebook.com/intern/diff/D16434335/)
So we can iterate over the operator registry, and check the backward compatiblity. Differential Revision: [D16434335](https://our.internmc.facebook.com/intern/diff/D16434335/)
dzhulgakov
requested changes
Jul 24, 2019
torch/csrc/jit/operator.cpp
Outdated
| const std::vector<std::shared_ptr<Operator>>& getAllOperators() { | ||
| std::lock_guard<std::mutex> guard(lock); | ||
| registerPendingOperators(); | ||
| static std::vector<std::shared_ptr<Operator>> values; |
Collaborator
There was a problem hiding this comment.
returning pointer to a static is not a good idea (as it can theoretically race. Since perf doesn't matter - just allocate new vector eac time
Member
Author
There was a problem hiding this comment.
interesting... I thought with lock_guard, race should be gone.
Anyway, changed to allocating a new vector.
Collaborator
There was a problem hiding this comment.
you return the pointer to values, someone can read it when guard is no longer held (but instead if taken by another thread that repopulates values from scratch)
So we can iterate over the operator registry, and check the backward compatiblity. Differential Revision: [D16434335](https://our.internmc.facebook.com/intern/diff/D16434335/)
dzhulgakov
approved these changes
Jul 25, 2019
torch/csrc/jit/operator.cpp
Outdated
| registerPendingOperators(); | ||
| std::vector<std::shared_ptr<Operator>> values; | ||
| values.clear(); | ||
| for (auto it = operators.begin(); it != operators.end(); ++it) { |
Collaborator
There was a problem hiding this comment.
make clang-tidy happy please
So we can iterate over the operator registry, and check the backward compatiblity. Differential Revision: [D16434335](https://our.internmc.facebook.com/intern/diff/D16434335/)
So we can iterate over the operator registry, and check the backward compatiblity. Differential Revision: [D16434335](https://our.internmc.facebook.com/intern/diff/D16434335/)
So we can iterate over the operator registry, and check the backward compatiblity. Differential Revision: [D16434335](https://our.internmc.facebook.com/intern/diff/D16434335/)
Contributor
|
This pull request has been merged in a6fb6e1. |
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.
Stack from ghstack:
So we can iterate over the operator registry, and check the backward compatiblity.
Differential Revision: D16434335