Skip to content

Conversation

@zdevito
Copy link
Contributor

@zdevito zdevito commented Jun 12, 2019

Stack from ghstack:

Now that modules are always first class, a Method is simply a pair
of Function and Method object. It is no longer necessary to have
a reified table of Methods and removes the need for locking.

Differential Revision: D15777725

Now that modules are always first class, a Method is simply a pair
of Function and Method object. It is no longer necessary to have
a reified table of Methods and removes the need for locking.
@pytorchbot pytorchbot added the oncall: jit Add this issue/PR to JIT oncall triage queue label Jun 12, 2019
@zdevito zdevito requested a review from suo June 12, 2019 06:52
zdevito added 4 commits June 12, 2019 10:44
Make script::Method a value type

Now that modules are always first class, a Method is simply a pair
of Function and Method object. It is no longer necessary to have
a reified table of Methods and removes the need for locking.

gh-metadata: pytorch pytorch 21675 gh/zdevito/64/head
Make script::Method a value type

Now that modules are always first class, a Method is simply a pair
of Function and Method object. It is no longer necessary to have
a reified table of Methods and removes the need for locking.

gh-metadata: pytorch pytorch 21675 gh/zdevito/64/head
Make script::Method a value type

Now that modules are always first class, a Method is simply a pair
of Function and Method object. It is no longer necessary to have
a reified table of Methods and removes the need for locking.

gh-metadata: pytorch pytorch 21675 gh/zdevito/64/head
Make script::Method a value type

Now that modules are always first class, a Method is simply a pair
of Function and Method object. It is no longer necessary to have
a reified table of Methods and removes the need for locking.

gh-metadata: pytorch pytorch 21675 gh/zdevito/64/head
// can be removed as well
get_offset(name, EntityType::METHOD);
AT_ERROR("unreachable");
AT_ERROR("Method '", name, "' is not defined.");
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Let's swap this out for one of the new error methods while we're here

const std::vector<Method> get_methods() const {
return fmap(class_compilation_unit().get_functions(),
[&](const std::shared_ptr<Function> &func) {
return Method(const_cast<Module *>(this), func);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can we remove this const_cast? It's not clear to me why methods need a mutable reference to their owner anyway

zdevito added 4 commits June 13, 2019 17:17
Make script::Method a value type

Now that modules are always first class, a Method is simply a pair
of Function and Method object. It is no longer necessary to have
a reified table of Methods and removes the need for locking.

gh-metadata: pytorch pytorch 21675 gh/zdevito/64/head
Make script::Method a value type

Now that modules are always first class, a Method is simply a pair
of Function and Method object. It is no longer necessary to have
a reified table of Methods and removes the need for locking.

gh-metadata: pytorch pytorch 21675 gh/zdevito/64/head
Make script::Method a value type

Now that modules are always first class, a Method is simply a pair
of Function and Method object. It is no longer necessary to have
a reified table of Methods and removes the need for locking.

gh-metadata: pytorch pytorch 21675 gh/zdevito/64/head
Make script::Method a value type

Now that modules are always first class, a Method is simply a pair
of Function and Method object. It is no longer necessary to have
a reified table of Methods and removes the need for locking.

gh-metadata: pytorch pytorch 21675 gh/zdevito/64/head
zdevito added 4 commits June 14, 2019 21:43
Make script::Method a value type

Now that modules are always first class, a Method is simply a pair
of Function and Method object. It is no longer necessary to have
a reified table of Methods and removes the need for locking.

gh-metadata: pytorch pytorch 21675 gh/zdevito/64/head
Make script::Method a value type

Now that modules are always first class, a Method is simply a pair
of Function and Method object. It is no longer necessary to have
a reified table of Methods and removes the need for locking.

gh-metadata: pytorch pytorch 21675 gh/zdevito/64/head
Make script::Method a value type

Now that modules are always first class, a Method is simply a pair
of Function and Method object. It is no longer necessary to have
a reified table of Methods and removes the need for locking.

gh-metadata: pytorch pytorch 21675 gh/zdevito/64/head
Make script::Method a value type

Now that modules are always first class, a Method is simply a pair
of Function and Method object. It is no longer necessary to have
a reified table of Methods and removes the need for locking.

gh-metadata: pytorch pytorch 21675 gh/zdevito/64/head
@zou3519 zou3519 deleted the gh/zdevito/64/head branch June 18, 2019 01:17
@facebook-github-bot
Copy link
Contributor

@zdevito merged this pull request in 5237835.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Merged oncall: jit Add this issue/PR to JIT oncall triage queue

Projects

None yet

Development

Successfully merging this pull request may close these issues.

6 participants