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 cast op support stride #8292

Merged
merged 9 commits into from
May 24, 2022
Merged

Dev cast op support stride #8292

merged 9 commits into from
May 24, 2022

Conversation

Flowingsun007
Copy link
Contributor

@Flowingsun007 Flowingsun007 commented May 24, 2022

  • cast op支持stride
  • test case

@Flowingsun007 Flowingsun007 marked this pull request as ready for review May 24, 2022 14:11
@github-actions
Copy link
Contributor

Code got formatted by CI. Please request CI again if you still want to have this PR merged. If the PR is from a forked repo, please download the patch files from the GitHub Actions web page and apply them locally.

@github-actions
Copy link
Contributor

Code got formatted by CI. Please request CI again if you still want to have this PR merged. If the PR is from a forked repo, please download the patch files from the GitHub Actions web page and apply them locally.

Flowingsun007 and others added 2 commits May 25, 2022 06:33
Co-authored-by: Xiaoyu Zhang <35585791+BBuf@users.noreply.github.com>
@github-actions
Copy link
Contributor

Speed stats:
GPU Name: NVIDIA GeForce GTX 1080 

❌ OneFlow resnet50 time: 130.2ms (= 13023.7ms / 100, input_shape=[16, 3, 224, 224])
PyTorch resnet50 time: 144.3ms (= 14432.1ms / 100, input_shape=[16, 3, 224, 224])
✔️ Relative speed: 1.11 (= 144.3ms / 130.2ms)

OneFlow resnet50 time: 76.6ms (= 7662.8ms / 100, input_shape=[8, 3, 224, 224])
PyTorch resnet50 time: 87.5ms (= 8751.4ms / 100, input_shape=[8, 3, 224, 224])
✔️ Relative speed: 1.14 (= 87.5ms / 76.6ms)

OneFlow resnet50 time: 53.8ms (= 10767.9ms / 200, input_shape=[4, 3, 224, 224])
PyTorch resnet50 time: 58.7ms (= 11731.0ms / 200, input_shape=[4, 3, 224, 224])
✔️ Relative speed: 1.09 (= 58.7ms / 53.8ms)

OneFlow resnet50 time: 42.9ms (= 8579.2ms / 200, input_shape=[2, 3, 224, 224])
PyTorch resnet50 time: 43.7ms (= 8732.7ms / 200, input_shape=[2, 3, 224, 224])
✔️ Relative speed: 1.02 (= 43.7ms / 42.9ms)

OneFlow resnet50 time: 36.5ms (= 7304.0ms / 200, input_shape=[1, 3, 224, 224])
PyTorch resnet50 time: 37.7ms (= 7534.2ms / 200, input_shape=[1, 3, 224, 224])
✔️ Relative speed: 1.03 (= 37.7ms / 36.5ms)

OneFlow swin dataloader time: 0.251s (= 50.189s / 200, num_workers=1)
PyTorch swin dataloader time: 0.149s (= 29.734s / 200, num_workers=1)
Relative speed: 0.592 (= 0.149s / 0.251s)

OneFlow swin dataloader time: 0.066s (= 13.219s / 200, num_workers=4)
PyTorch swin dataloader time: 0.043s (= 8.583s / 200, num_workers=4)
Relative speed: 0.649 (= 0.043s / 0.066s)

OneFlow swin dataloader time: 0.036s (= 7.141s / 200, num_workers=8)
PyTorch swin dataloader time: 0.023s (= 4.564s / 200, num_workers=8)
Relative speed: 0.639 (= 0.023s / 0.036s)

❌ OneFlow resnet50 time: 146.9ms (= 14693.4ms / 100, input_shape=[16, 3, 224, 224], ddp, world size=2)
PyTorch resnet50 time: 175.3ms (= 17534.7ms / 100, input_shape=[16, 3, 224, 224], ddp, world size=2)
✔️ Relative speed: 1.19 (= 175.3ms / 146.9ms)

OneFlow resnet50 time: 96.9ms (= 9685.3ms / 100, input_shape=[8, 3, 224, 224], ddp, world size=2)
PyTorch resnet50 time: 112.0ms (= 11202.2ms / 100, input_shape=[8, 3, 224, 224], ddp, world size=2)
✔️ Relative speed: 1.16 (= 112.0ms / 96.9ms)

OneFlow resnet50 time: 73.9ms (= 14778.5ms / 200, input_shape=[4, 3, 224, 224], ddp, world size=2)
PyTorch resnet50 time: 89.3ms (= 17857.7ms / 200, input_shape=[4, 3, 224, 224], ddp, world size=2)
✔️ Relative speed: 1.21 (= 89.3ms / 73.9ms)

OneFlow resnet50 time: 61.6ms (= 12327.7ms / 200, input_shape=[2, 3, 224, 224], ddp, world size=2)
PyTorch resnet50 time: 73.9ms (= 14772.6ms / 200, input_shape=[2, 3, 224, 224], ddp, world size=2)
✔️ Relative speed: 1.20 (= 73.9ms / 61.6ms)

OneFlow resnet50 time: 55.4ms (= 11079.3ms / 200, input_shape=[1, 3, 224, 224], ddp, world size=2)
PyTorch resnet50 time: 76.9ms (= 15384.3ms / 200, input_shape=[1, 3, 224, 224], ddp, world size=2)
✔️ Relative speed: 1.39 (= 76.9ms / 55.4ms)

@Flowingsun007 Flowingsun007 merged commit a2e69fd into master May 24, 2022
@Flowingsun007 Flowingsun007 deleted the dev_cast_op_support_stride branch May 24, 2022 23:49
Comment on lines +152 to +155
if (!JUST(user_op_expr.SupportNonContiguous())) {
std::shared_ptr<Stride> stride(new Stride(*tensor_impl->shape()));
tensor_impl->mut_tensor_meta()->set_stride(stride);
}
Copy link
Contributor

Choose a reason for hiding this comment

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

这个等后续把op stride推导加上之后就可以删了吧,加一个TODO

Copy link
Contributor

@hjchen2 hjchen2 May 25, 2022

Choose a reason for hiding this comment

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

或者是不是应该有一个默认的stride推导过程

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.

5 participants