Skip to content

Some improvements to IValue #11238

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

Closed
wants to merge 6 commits into from
Closed

Some improvements to IValue #11238

wants to merge 6 commits into from

Conversation

smessmer
Copy link
Contributor

@smessmer smessmer commented Sep 4, 2018

Stack:
    :white_circle:  #11167 Narrowing Blob  💛
    :black_circle:  #11238 Some improvements to IValue  💛
    :white_circle:  #11258 Improve Tensor() constructor  💛
    :white_circle:  #11260 Fix intrusive_ptr move/copy for different NullType's  💛
    :white_circle:  #11294 Remove manual refcounting from Tensor class  💛
    :white_circle:  #11352 Remove intrusive_ptr::reclaim() in Storage  💛
    :white_circle:  #11353 Simplify union payload copying  💛
    :white_circle:  #11355 Simplify IValue::toTensor()  💛
    :white_circle:  #11402 Simplify Blob move constructor/assignment  💛
    :white_circle:  #11414 IValue can store Blob  💛
    :white_circle:  #11481 Blob doesn't allow access to destroyCall anymore  💛

  • when moving an IValue, free the old value instead of keeping it allocated
  • making classes final
  • moving std::string
  • making ConstantList const

Differential Revision: D9644700

Differential Revision: D9644700
Differential Version: 56870160
@pytorchbot pytorchbot added the oncall: jit Add this issue/PR to JIT oncall triage queue label Sep 4, 2018
: payload(rhs.payload)
, tag(rhs.tag)
, is_intrusive_ptr(rhs.is_intrusive_ptr) {
rhs.clearToNone();

This comment was marked as off-topic.

This comment was marked as off-topic.

This comment was marked as off-topic.

This comment was marked as off-topic.

This comment was marked as off-topic.

This comment was marked as off-topic.

This comment was marked as off-topic.

This comment was marked as off-topic.

This comment was marked as off-topic.

Copy link
Contributor

@zdevito zdevito left a comment

Choose a reason for hiding this comment

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

Seens good except I don't think the move constructor needs to be changed.

: payload(rhs.payload)
, tag(rhs.tag)
, is_intrusive_ptr(rhs.is_intrusive_ptr) {
rhs.clearToNone();

This comment was marked as off-topic.

@smessmer
Copy link
Contributor Author

smessmer commented Sep 4, 2018

@zdevito The old constructor default-initializes all members and then overwrites them in the swap. The new version doesn't default-initialize them but directly initializes them with the correct values, which is (in theory) a bit faster.

@smessmer
Copy link
Contributor Author

smessmer commented Sep 4, 2018

but you're actually right that the old implementation also set rhs to None because it was swapped with the new instance. Where I actually changed that behavior is in the move assignment - that didn't set rhs to None before but now does.

Differential Revision: D9644700
Differential Version: 56900331
@ezyang
Copy link
Contributor

ezyang commented Sep 5, 2018

@pytorchbot retest this please

Differential Revision: D9644700
Differential Version: 56982494
Differential Revision: D9644700
Differential Version: 57101652
Differential Revision: D9644700
Differential Version: 57135224
Differential Revision: D9644700
Differential Version: 57214023
PenghuiCheng pushed a commit to PenghuiCheng/pytorch that referenced this pull request Sep 11, 2018
Summary:
Pull Request resolved: pytorch#11238

- when moving an IValue, free the old value instead of keeping it allocated
- making classes final
- moving std::string
- making ConstantList const

Reviewed By: ezyang

Differential Revision: D9644700

fbshipit-source-id: ab7228368e4f00f664ba54e1242b0307d91c5e7e
@ezyang ezyang added the merged label Jun 26, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
oncall: jit Add this issue/PR to JIT oncall triage queue
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants