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

FusedAttentionConcatPastKeyValue #9963

Merged
merged 14 commits into from
Mar 9, 2023
Merged

FusedAttentionConcatPastKeyValue #9963

merged 14 commits into from
Mar 9, 2023

Conversation

liujuncheng
Copy link
Collaborator

No description provided.

@github-actions
Copy link
Contributor

github-actions bot commented Mar 8, 2023

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

github-actions bot commented Mar 8, 2023

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.

@liujuncheng liujuncheng requested review from oneflow-ci-bot and removed request for oneflow-ci-bot March 8, 2023 09:39
@github-actions
Copy link
Contributor

github-actions bot commented Mar 8, 2023

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.

@liujuncheng liujuncheng requested review from oneflow-ci-bot and removed request for oneflow-ci-bot March 8, 2023 09:49
@github-actions
Copy link
Contributor

github-actions bot commented Mar 8, 2023

Speed stats:
GPU Name: GeForce GTX 1080 

❌ OneFlow resnet50 time: 141.5ms (= 14145.3ms / 100, input_shape=[16, 3, 224, 224])
PyTorch resnet50 time: 145.4ms (= 14538.7ms / 100, input_shape=[16, 3, 224, 224])
❌ Relative speed: 1.03 (= 145.4ms / 141.5ms)

OneFlow resnet50 time: 83.8ms (= 8376.1ms / 100, input_shape=[8, 3, 224, 224])
PyTorch resnet50 time: 86.1ms (= 8609.9ms / 100, input_shape=[8, 3, 224, 224])
❌ Relative speed: 1.03 (= 86.1ms / 83.8ms)

OneFlow resnet50 time: 51.9ms (= 10381.2ms / 200, input_shape=[4, 3, 224, 224])
PyTorch resnet50 time: 57.7ms (= 11549.6ms / 200, input_shape=[4, 3, 224, 224])
✔️ Relative speed: 1.11 (= 57.7ms / 51.9ms)

OneFlow resnet50 time: 34.1ms (= 6817.9ms / 200, input_shape=[2, 3, 224, 224])
PyTorch resnet50 time: 43.7ms (= 8738.9ms / 200, input_shape=[2, 3, 224, 224])
✔️ Relative speed: 1.28 (= 43.7ms / 34.1ms)

OneFlow resnet50 time: 25.7ms (= 5130.7ms / 200, input_shape=[1, 3, 224, 224])
PyTorch resnet50 time: 36.8ms (= 7357.4ms / 200, input_shape=[1, 3, 224, 224])
✔️ Relative speed: 1.43 (= 36.8ms / 25.7ms)

OneFlow swin dataloader time: 0.237s (= 47.328s / 200, num_workers=1)
PyTorch swin dataloader time: 0.151s (= 30.238s / 200, num_workers=1)
Relative speed: 0.639 (= 0.151s / 0.237s)

OneFlow swin dataloader time: 0.068s (= 13.543s / 200, num_workers=4)
PyTorch swin dataloader time: 0.042s (= 8.321s / 200, num_workers=4)
Relative speed: 0.614 (= 0.042s / 0.068s)

OneFlow swin dataloader time: 0.043s (= 8.630s / 200, num_workers=8)
PyTorch swin dataloader time: 0.021s (= 4.257s / 200, num_workers=8)
Relative speed: 0.493 (= 0.021s / 0.043s)

❌ OneFlow resnet50 time: 155.2ms (= 15515.3ms / 100, input_shape=[16, 3, 224, 224], ddp, world size=2)
PyTorch resnet50 time: 165.8ms (= 16583.4ms / 100, input_shape=[16, 3, 224, 224], ddp, world size=2)
❌ Relative speed: 1.07 (= 165.8ms / 155.2ms)

OneFlow resnet50 time: 93.8ms (= 9383.2ms / 100, input_shape=[8, 3, 224, 224], ddp, world size=2)
PyTorch resnet50 time: 104.2ms (= 10419.3ms / 100, input_shape=[8, 3, 224, 224], ddp, world size=2)
✔️ Relative speed: 1.11 (= 104.2ms / 93.8ms)

OneFlow resnet50 time: 61.1ms (= 12224.6ms / 200, input_shape=[4, 3, 224, 224], ddp, world size=2)
PyTorch resnet50 time: 78.9ms (= 15770.8ms / 200, input_shape=[4, 3, 224, 224], ddp, world size=2)
✔️ Relative speed: 1.29 (= 78.9ms / 61.1ms)

OneFlow resnet50 time: 44.5ms (= 8895.3ms / 200, input_shape=[2, 3, 224, 224], ddp, world size=2)
PyTorch resnet50 time: 73.0ms (= 14601.5ms / 200, input_shape=[2, 3, 224, 224], ddp, world size=2)
✔️ Relative speed: 1.64 (= 73.0ms / 44.5ms)

OneFlow resnet50 time: 36.3ms (= 7254.3ms / 200, input_shape=[1, 3, 224, 224], ddp, world size=2)
PyTorch resnet50 time: 69.7ms (= 13946.6ms / 200, input_shape=[1, 3, 224, 224], ddp, world size=2)
✔️ Relative speed: 1.92 (= 69.7ms / 36.3ms)

@github-actions
Copy link
Contributor

github-actions bot commented Mar 8, 2023

Speed stats:

@github-actions
Copy link
Contributor

github-actions bot commented Mar 8, 2023

Speed stats:

@github-actions
Copy link
Contributor

github-actions bot commented Mar 8, 2023

Speed stats:

@github-actions
Copy link
Contributor

github-actions bot commented Mar 8, 2023

Speed stats:
GPU Name: GeForce GTX 1080 

❌ OneFlow resnet50 time: 141.1ms (= 14107.9ms / 100, input_shape=[16, 3, 224, 224])
PyTorch resnet50 time: 144.5ms (= 14453.8ms / 100, input_shape=[16, 3, 224, 224])
❌ Relative speed: 1.02 (= 144.5ms / 141.1ms)

OneFlow resnet50 time: 81.2ms (= 8117.8ms / 100, input_shape=[8, 3, 224, 224])
PyTorch resnet50 time: 86.6ms (= 8664.7ms / 100, input_shape=[8, 3, 224, 224])
✔️ Relative speed: 1.07 (= 86.6ms / 81.2ms)

OneFlow resnet50 time: 50.4ms (= 10074.7ms / 200, input_shape=[4, 3, 224, 224])
PyTorch resnet50 time: 55.9ms (= 11188.9ms / 200, input_shape=[4, 3, 224, 224])
✔️ Relative speed: 1.11 (= 55.9ms / 50.4ms)

OneFlow resnet50 time: 33.7ms (= 6746.4ms / 200, input_shape=[2, 3, 224, 224])
PyTorch resnet50 time: 47.1ms (= 9425.1ms / 200, input_shape=[2, 3, 224, 224])
✔️ Relative speed: 1.40 (= 47.1ms / 33.7ms)

OneFlow resnet50 time: 25.3ms (= 5063.1ms / 200, input_shape=[1, 3, 224, 224])
PyTorch resnet50 time: 42.2ms (= 8434.0ms / 200, input_shape=[1, 3, 224, 224])
✔️ Relative speed: 1.67 (= 42.2ms / 25.3ms)

OneFlow swin dataloader time: 0.245s (= 48.940s / 200, num_workers=1)
PyTorch swin dataloader time: 0.152s (= 30.335s / 200, num_workers=1)
Relative speed: 0.620 (= 0.152s / 0.245s)

OneFlow swin dataloader time: 0.068s (= 13.686s / 200, num_workers=4)
PyTorch swin dataloader time: 0.043s (= 8.560s / 200, num_workers=4)
Relative speed: 0.625 (= 0.043s / 0.068s)

OneFlow swin dataloader time: 0.044s (= 8.742s / 200, num_workers=8)
PyTorch swin dataloader time: 0.023s (= 4.546s / 200, num_workers=8)
Relative speed: 0.520 (= 0.023s / 0.044s)

❌ OneFlow resnet50 time: 152.4ms (= 15236.3ms / 100, input_shape=[16, 3, 224, 224], ddp, world size=2)
PyTorch resnet50 time: 162.5ms (= 16247.3ms / 100, input_shape=[16, 3, 224, 224], ddp, world size=2)
❌ Relative speed: 1.07 (= 162.5ms / 152.4ms)

OneFlow resnet50 time: 92.2ms (= 9217.9ms / 100, input_shape=[8, 3, 224, 224], ddp, world size=2)
PyTorch resnet50 time: 110.5ms (= 11049.7ms / 100, input_shape=[8, 3, 224, 224], ddp, world size=2)
✔️ Relative speed: 1.20 (= 110.5ms / 92.2ms)

OneFlow resnet50 time: 60.7ms (= 12140.1ms / 200, input_shape=[4, 3, 224, 224], ddp, world size=2)
PyTorch resnet50 time: 78.9ms (= 15776.9ms / 200, input_shape=[4, 3, 224, 224], ddp, world size=2)
✔️ Relative speed: 1.30 (= 78.9ms / 60.7ms)

OneFlow resnet50 time: 42.2ms (= 8439.9ms / 200, input_shape=[2, 3, 224, 224], ddp, world size=2)
PyTorch resnet50 time: 78.8ms (= 15768.1ms / 200, input_shape=[2, 3, 224, 224], ddp, world size=2)
✔️ Relative speed: 1.87 (= 78.8ms / 42.2ms)

OneFlow resnet50 time: 36.4ms (= 7286.3ms / 200, input_shape=[1, 3, 224, 224], ddp, world size=2)
PyTorch resnet50 time: 69.0ms (= 13793.7ms / 200, input_shape=[1, 3, 224, 224], ddp, world size=2)
✔️ Relative speed: 1.89 (= 69.0ms / 36.4ms)

@github-actions
Copy link
Contributor

github-actions bot commented Mar 8, 2023

View latest API docs preview at: https://staging.oneflow.info/docs/Oneflow-Inc/oneflow/pr/9963/

@liujuncheng liujuncheng enabled auto-merge (squash) March 9, 2023 01:43
@github-actions
Copy link
Contributor

github-actions bot commented Mar 9, 2023

Speed stats:
GPU Name: NVIDIA GeForce GTX 1080 

❌ OneFlow resnet50 time: 141.5ms (= 14150.7ms / 100, input_shape=[16, 3, 224, 224])
PyTorch resnet50 time: 145.2ms (= 14522.5ms / 100, input_shape=[16, 3, 224, 224])
❌ Relative speed: 1.03 (= 145.2ms / 141.5ms)

OneFlow resnet50 time: 82.7ms (= 8272.1ms / 100, input_shape=[8, 3, 224, 224])
PyTorch resnet50 time: 89.6ms (= 8964.5ms / 100, input_shape=[8, 3, 224, 224])
✔️ Relative speed: 1.08 (= 89.6ms / 82.7ms)

OneFlow resnet50 time: 51.0ms (= 10201.2ms / 200, input_shape=[4, 3, 224, 224])
PyTorch resnet50 time: 60.2ms (= 12035.0ms / 200, input_shape=[4, 3, 224, 224])
✔️ Relative speed: 1.18 (= 60.2ms / 51.0ms)

OneFlow resnet50 time: 33.7ms (= 6734.8ms / 200, input_shape=[2, 3, 224, 224])
PyTorch resnet50 time: 43.0ms (= 8607.7ms / 200, input_shape=[2, 3, 224, 224])
✔️ Relative speed: 1.28 (= 43.0ms / 33.7ms)

OneFlow resnet50 time: 25.5ms (= 5092.7ms / 200, input_shape=[1, 3, 224, 224])
PyTorch resnet50 time: 43.6ms (= 8712.0ms / 200, input_shape=[1, 3, 224, 224])
✔️ Relative speed: 1.71 (= 43.6ms / 25.5ms)

OneFlow swin dataloader time: 0.237s (= 47.366s / 200, num_workers=1)
PyTorch swin dataloader time: 0.152s (= 30.300s / 200, num_workers=1)
Relative speed: 0.640 (= 0.152s / 0.237s)

OneFlow swin dataloader time: 0.066s (= 13.268s / 200, num_workers=4)
PyTorch swin dataloader time: 0.042s (= 8.357s / 200, num_workers=4)
Relative speed: 0.630 (= 0.042s / 0.066s)

OneFlow swin dataloader time: 0.045s (= 9.012s / 200, num_workers=8)
PyTorch swin dataloader time: 0.023s (= 4.539s / 200, num_workers=8)
Relative speed: 0.504 (= 0.023s / 0.045s)

❌ OneFlow resnet50 time: 164.8ms (= 16478.7ms / 100, input_shape=[16, 3, 224, 224], ddp, world size=2)
PyTorch resnet50 time: 173.9ms (= 17393.4ms / 100, input_shape=[16, 3, 224, 224], ddp, world size=2)
❌ Relative speed: 1.06 (= 173.9ms / 164.8ms)

OneFlow resnet50 time: 103.4ms (= 10341.4ms / 100, input_shape=[8, 3, 224, 224], ddp, world size=2)
PyTorch resnet50 time: 113.5ms (= 11351.5ms / 100, input_shape=[8, 3, 224, 224], ddp, world size=2)
✔️ Relative speed: 1.10 (= 113.5ms / 103.4ms)

OneFlow resnet50 time: 70.8ms (= 14156.6ms / 200, input_shape=[4, 3, 224, 224], ddp, world size=2)
PyTorch resnet50 time: 89.5ms (= 17898.7ms / 200, input_shape=[4, 3, 224, 224], ddp, world size=2)
✔️ Relative speed: 1.26 (= 89.5ms / 70.8ms)

OneFlow resnet50 time: 56.7ms (= 11344.1ms / 200, input_shape=[2, 3, 224, 224], ddp, world size=2)
PyTorch resnet50 time: 73.4ms (= 14683.6ms / 200, input_shape=[2, 3, 224, 224], ddp, world size=2)
✔️ Relative speed: 1.29 (= 73.4ms / 56.7ms)

OneFlow resnet50 time: 48.5ms (= 9692.3ms / 200, input_shape=[1, 3, 224, 224], ddp, world size=2)
PyTorch resnet50 time: 69.4ms (= 13879.2ms / 200, input_shape=[1, 3, 224, 224], ddp, world size=2)
✔️ Relative speed: 1.43 (= 69.4ms / 48.5ms)

@github-actions
Copy link
Contributor

github-actions bot commented Mar 9, 2023

View latest API docs preview at: https://staging.oneflow.info/docs/Oneflow-Inc/oneflow/pr/9963/

@github-actions
Copy link
Contributor

github-actions bot commented Mar 9, 2023

Speed stats:
GPU Name: NVIDIA GeForce GTX 1080 

❌ OneFlow resnet50 time: 141.7ms (= 14173.5ms / 100, input_shape=[16, 3, 224, 224])
PyTorch resnet50 time: 144.2ms (= 14417.6ms / 100, input_shape=[16, 3, 224, 224])
❌ Relative speed: 1.02 (= 144.2ms / 141.7ms)

OneFlow resnet50 time: 84.3ms (= 8432.5ms / 100, input_shape=[8, 3, 224, 224])
PyTorch resnet50 time: 87.3ms (= 8734.4ms / 100, input_shape=[8, 3, 224, 224])
✔️ Relative speed: 1.04 (= 87.3ms / 84.3ms)

OneFlow resnet50 time: 51.0ms (= 10203.3ms / 200, input_shape=[4, 3, 224, 224])
PyTorch resnet50 time: 66.4ms (= 13271.0ms / 200, input_shape=[4, 3, 224, 224])
✔️ Relative speed: 1.30 (= 66.4ms / 51.0ms)

OneFlow resnet50 time: 33.9ms (= 6771.8ms / 200, input_shape=[2, 3, 224, 224])
PyTorch resnet50 time: 41.6ms (= 8326.1ms / 200, input_shape=[2, 3, 224, 224])
✔️ Relative speed: 1.23 (= 41.6ms / 33.9ms)

OneFlow resnet50 time: 26.0ms (= 5193.7ms / 200, input_shape=[1, 3, 224, 224])
PyTorch resnet50 time: 40.4ms (= 8073.7ms / 200, input_shape=[1, 3, 224, 224])
✔️ Relative speed: 1.55 (= 40.4ms / 26.0ms)

OneFlow swin dataloader time: 0.235s (= 46.943s / 200, num_workers=1)
PyTorch swin dataloader time: 0.150s (= 29.998s / 200, num_workers=1)
Relative speed: 0.639 (= 0.150s / 0.235s)

OneFlow swin dataloader time: 0.071s (= 14.202s / 200, num_workers=4)
PyTorch swin dataloader time: 0.041s (= 8.285s / 200, num_workers=4)
Relative speed: 0.583 (= 0.041s / 0.071s)

OneFlow swin dataloader time: 0.041s (= 8.222s / 200, num_workers=8)
PyTorch swin dataloader time: 0.022s (= 4.382s / 200, num_workers=8)
Relative speed: 0.533 (= 0.022s / 0.041s)

❌ OneFlow resnet50 time: 164.8ms (= 16482.7ms / 100, input_shape=[16, 3, 224, 224], ddp, world size=2)
PyTorch resnet50 time: 171.8ms (= 17184.1ms / 100, input_shape=[16, 3, 224, 224], ddp, world size=2)
❌ Relative speed: 1.04 (= 171.8ms / 164.8ms)

OneFlow resnet50 time: 103.2ms (= 10319.6ms / 100, input_shape=[8, 3, 224, 224], ddp, world size=2)
PyTorch resnet50 time: 112.6ms (= 11261.2ms / 100, input_shape=[8, 3, 224, 224], ddp, world size=2)
❌ Relative speed: 1.09 (= 112.6ms / 103.2ms)

OneFlow resnet50 time: 71.5ms (= 14309.0ms / 200, input_shape=[4, 3, 224, 224], ddp, world size=2)
PyTorch resnet50 time: 88.2ms (= 17649.2ms / 200, input_shape=[4, 3, 224, 224], ddp, world size=2)
✔️ Relative speed: 1.23 (= 88.2ms / 71.5ms)

OneFlow resnet50 time: 56.4ms (= 11282.2ms / 200, input_shape=[2, 3, 224, 224], ddp, world size=2)
PyTorch resnet50 time: 81.5ms (= 16302.8ms / 200, input_shape=[2, 3, 224, 224], ddp, world size=2)
✔️ Relative speed: 1.45 (= 81.5ms / 56.4ms)

OneFlow resnet50 time: 50.2ms (= 10048.8ms / 200, input_shape=[1, 3, 224, 224], ddp, world size=2)
PyTorch resnet50 time: 81.0ms (= 16196.4ms / 200, input_shape=[1, 3, 224, 224], ddp, world size=2)
✔️ Relative speed: 1.61 (= 81.0ms / 50.2ms)

@github-actions
Copy link
Contributor

github-actions bot commented Mar 9, 2023

View latest API docs preview at: https://staging.oneflow.info/docs/Oneflow-Inc/oneflow/pr/9963/

@github-actions
Copy link
Contributor

github-actions bot commented Mar 9, 2023

Speed stats:
GPU Name: GeForce GTX 1080 

❌ OneFlow resnet50 time: 141.5ms (= 14150.1ms / 100, input_shape=[16, 3, 224, 224])
PyTorch resnet50 time: 143.9ms (= 14393.1ms / 100, input_shape=[16, 3, 224, 224])
❌ Relative speed: 1.02 (= 143.9ms / 141.5ms)

OneFlow resnet50 time: 83.2ms (= 8317.6ms / 100, input_shape=[8, 3, 224, 224])
PyTorch resnet50 time: 87.0ms (= 8701.9ms / 100, input_shape=[8, 3, 224, 224])
✔️ Relative speed: 1.05 (= 87.0ms / 83.2ms)

OneFlow resnet50 time: 51.5ms (= 10299.6ms / 200, input_shape=[4, 3, 224, 224])
PyTorch resnet50 time: 58.9ms (= 11786.1ms / 200, input_shape=[4, 3, 224, 224])
✔️ Relative speed: 1.14 (= 58.9ms / 51.5ms)

OneFlow resnet50 time: 34.7ms (= 6932.2ms / 200, input_shape=[2, 3, 224, 224])
PyTorch resnet50 time: 46.9ms (= 9376.8ms / 200, input_shape=[2, 3, 224, 224])
✔️ Relative speed: 1.35 (= 46.9ms / 34.7ms)

OneFlow resnet50 time: 26.4ms (= 5279.4ms / 200, input_shape=[1, 3, 224, 224])
PyTorch resnet50 time: 36.7ms (= 7344.6ms / 200, input_shape=[1, 3, 224, 224])
✔️ Relative speed: 1.39 (= 36.7ms / 26.4ms)

OneFlow swin dataloader time: 0.238s (= 47.631s / 200, num_workers=1)
PyTorch swin dataloader time: 0.152s (= 30.387s / 200, num_workers=1)
Relative speed: 0.638 (= 0.152s / 0.238s)

OneFlow swin dataloader time: 0.070s (= 13.960s / 200, num_workers=4)
PyTorch swin dataloader time: 0.042s (= 8.458s / 200, num_workers=4)
Relative speed: 0.606 (= 0.042s / 0.070s)

OneFlow swin dataloader time: 0.041s (= 8.236s / 200, num_workers=8)
PyTorch swin dataloader time: 0.023s (= 4.528s / 200, num_workers=8)
Relative speed: 0.550 (= 0.023s / 0.041s)

❌ OneFlow resnet50 time: 153.4ms (= 15340.6ms / 100, input_shape=[16, 3, 224, 224], ddp, world size=2)
PyTorch resnet50 time: 169.8ms (= 16975.9ms / 100, input_shape=[16, 3, 224, 224], ddp, world size=2)
❌ Relative speed: 1.11 (= 169.8ms / 153.4ms)

OneFlow resnet50 time: 93.9ms (= 9386.0ms / 100, input_shape=[8, 3, 224, 224], ddp, world size=2)
PyTorch resnet50 time: 106.0ms (= 10604.2ms / 100, input_shape=[8, 3, 224, 224], ddp, world size=2)
✔️ Relative speed: 1.13 (= 106.0ms / 93.9ms)

OneFlow resnet50 time: 61.7ms (= 12345.5ms / 200, input_shape=[4, 3, 224, 224], ddp, world size=2)
PyTorch resnet50 time: 82.1ms (= 16423.9ms / 200, input_shape=[4, 3, 224, 224], ddp, world size=2)
✔️ Relative speed: 1.33 (= 82.1ms / 61.7ms)

OneFlow resnet50 time: 43.1ms (= 8622.5ms / 200, input_shape=[2, 3, 224, 224], ddp, world size=2)
PyTorch resnet50 time: 72.3ms (= 14453.7ms / 200, input_shape=[2, 3, 224, 224], ddp, world size=2)
✔️ Relative speed: 1.68 (= 72.3ms / 43.1ms)

OneFlow resnet50 time: 35.9ms (= 7179.0ms / 200, input_shape=[1, 3, 224, 224], ddp, world size=2)
PyTorch resnet50 time: 69.6ms (= 13925.5ms / 200, input_shape=[1, 3, 224, 224], ddp, world size=2)
✔️ Relative speed: 1.94 (= 69.6ms / 35.9ms)

@github-actions
Copy link
Contributor

github-actions bot commented Mar 9, 2023

View latest API docs preview at: https://staging.oneflow.info/docs/Oneflow-Inc/oneflow/pr/9963/

@liujuncheng liujuncheng merged commit a4b7145 into master Mar 9, 2023
@liujuncheng liujuncheng deleted the dev_fused_past_kv branch March 9, 2023 03:49
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.

4 participants