Skip to content
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

Dev add contiguous view ops #7503

Merged
merged 60 commits into from
Mar 1, 2022
Merged

Conversation

Flowingsun007
Copy link
Contributor

@Flowingsun007 Flowingsun007 commented Feb 15, 2022

此pr为搬运#6854 中的基于view机制实现的部分view op,包括:

  • view op
  • unsqueeze op
  • squeeze op

(这部分view op的引入不会改变tensor的contiguous属性)

@Flowingsun007 Flowingsun007 marked this pull request as ready for review February 15, 2022 07:58
oneflow/core/framework/tensor_methods.cpp Outdated Show resolved Hide resolved
oneflow/core/framework/tensor_methods.cpp Outdated Show resolved Hide resolved
oneflow/core/framework/tensor_methods.cpp Outdated Show resolved Hide resolved
oneflow/core/framework/tensor_methods.cpp Outdated Show resolved Hide resolved
oneflow/core/functional/impl/array_functor.cpp Outdated Show resolved Hide resolved
@github-actions
Copy link
Contributor

github-actions bot commented Mar 1, 2022

Speed stats:
GPU Name: GeForce GTX 1080 

✔️ OneFlow resnet50 time: 128.6ms (= 12857.6ms / 100, input_shape=[16, 3, 224, 224])
PyTorch resnet50 time: 145.6ms (= 14557.9ms / 100, input_shape=[16, 3, 224, 224])
✔️ Relative speed: 1.13 (= 145.6ms / 128.6ms)

❌ OneFlow resnet50 time: 79.3ms (= 7934.9ms / 100, input_shape=[8, 3, 224, 224])
PyTorch resnet50 time: 87.3ms (= 8727.9ms / 100, input_shape=[8, 3, 224, 224])
✔️ Relative speed: 1.10 (= 87.3ms / 79.3ms)

OneFlow resnet50 time: 53.3ms (= 10653.8ms / 200, input_shape=[4, 3, 224, 224])
PyTorch resnet50 time: 58.9ms (= 11775.3ms / 200, input_shape=[4, 3, 224, 224])
✔️ Relative speed: 1.11 (= 58.9ms / 53.3ms)

OneFlow resnet50 time: 43.1ms (= 8627.7ms / 200, input_shape=[2, 3, 224, 224])
PyTorch resnet50 time: 46.7ms (= 9343.6ms / 200, input_shape=[2, 3, 224, 224])
✔️ Relative speed: 1.08 (= 46.7ms / 43.1ms)

OneFlow resnet50 time: 39.4ms (= 7879.4ms / 200, input_shape=[1, 3, 224, 224])
PyTorch resnet50 time: 38.1ms (= 7619.6ms / 200, input_shape=[1, 3, 224, 224])
✔️ Relative speed: 0.97 (= 38.1ms / 39.4ms)

✔️ OneFlow resnet50 time: 142.4ms (= 14241.3ms / 100, input_shape=[16, 3, 224, 224], ddp, world size=2)
PyTorch resnet50 time: 159.6ms (= 15960.3ms / 100, input_shape=[16, 3, 224, 224], ddp, world size=2)
✔️ Relative speed: 1.12 (= 159.6ms / 142.4ms)

OneFlow resnet50 time: 89.2ms (= 8923.2ms / 100, input_shape=[8, 3, 224, 224], ddp, world size=2)
PyTorch resnet50 time: 104.7ms (= 10473.0ms / 100, input_shape=[8, 3, 224, 224], ddp, world size=2)
✔️ Relative speed: 1.17 (= 104.7ms / 89.2ms)

OneFlow resnet50 time: 61.4ms (= 12287.9ms / 200, input_shape=[4, 3, 224, 224], ddp, world size=2)
PyTorch resnet50 time: 77.1ms (= 15418.1ms / 200, input_shape=[4, 3, 224, 224], ddp, world size=2)
✔️ Relative speed: 1.25 (= 77.1ms / 61.4ms)

OneFlow resnet50 time: 53.5ms (= 10700.8ms / 200, input_shape=[2, 3, 224, 224], ddp, world size=2)
PyTorch resnet50 time: 65.7ms (= 13145.5ms / 200, input_shape=[2, 3, 224, 224], ddp, world size=2)
✔️ Relative speed: 1.23 (= 65.7ms / 53.5ms)

OneFlow resnet50 time: 48.1ms (= 9615.5ms / 200, input_shape=[1, 3, 224, 224], ddp, world size=2)
PyTorch resnet50 time: 60.6ms (= 12120.7ms / 200, input_shape=[1, 3, 224, 224], ddp, world size=2)
✔️ Relative speed: 1.26 (= 60.6ms / 48.1ms)

@github-actions
Copy link
Contributor

github-actions bot commented Mar 1, 2022

CI failed when running job: cuda-speed-test. PR label automerge has been removed

@github-actions github-actions bot removed the automerge label Mar 1, 2022
@oneflow-ci-bot oneflow-ci-bot removed their request for review March 1, 2022 07:31
@oneflow-ci-bot oneflow-ci-bot removed their request for review March 1, 2022 07:55
@oneflow-ci-bot oneflow-ci-bot removed their request for review March 1, 2022 08:17
@Flowingsun007 Flowingsun007 requested review from oneflow-ci-bot and removed request for oneflow-ci-bot March 1, 2022 12:47
@oneflow-ci-bot oneflow-ci-bot removed their request for review March 1, 2022 13:16
@oneflow-ci-bot oneflow-ci-bot requested review from oneflow-ci-bot and removed request for oneflow-ci-bot March 1, 2022 13:16
@oneflow-ci-bot oneflow-ci-bot requested review from oneflow-ci-bot and removed request for oneflow-ci-bot March 1, 2022 14:33
@oneflow-ci-bot oneflow-ci-bot self-requested a review March 1, 2022 16:26
@Flowingsun007 Flowingsun007 merged commit bc2a158 into master Mar 1, 2022
@Flowingsun007 Flowingsun007 deleted the dev_add_contiguous_view_ops branch March 1, 2022 19:35
marigoold pushed a commit that referenced this pull request Mar 15, 2022
* view op

* narrow op

* squeeze unsqueeze op

* revert narrow
wyg1997 pushed a commit that referenced this pull request Mar 17, 2022
* view op

* narrow op

* squeeze unsqueeze op

* revert narrow
return target_stride;
}

Maybe<Shape> InferShape(const std::shared_ptr<one::Tensor>& x, const Shape& shape) {
Copy link
Contributor

Choose a reason for hiding this comment

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

这个函数是谁写的呢?函数名称没有信息量。另外它不需要x吧,只需要x->shape()

Copy link
Contributor Author

Choose a reason for hiding this comment

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

好的,我后续提个pr refine一下

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

Successfully merging this pull request may close these issues.

7 participants