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

Add MultiHeadAttention #3650

Draft
wants to merge 2 commits into
base: develop
Choose a base branch
from
Draft

Add MultiHeadAttention #3650

wants to merge 2 commits into from

Conversation

marko-fabo-htec
Copy link
Collaborator

@marko-fabo-htec marko-fabo-htec commented Nov 21, 2024

Add support for MultiHeadAttention operator.
Description: https://github.com/microsoft/onnxruntime/blob/main/docs/ContribOperators.md#com.microsoft.MultiHeadAttention

TODOs:

  • add key_padding_mask input handling
  • add attention_bias input handling
  • add past_key and past_value inputs handling
  • add parse tests
  • check performance

Copy link

codecov bot commented Nov 21, 2024

Codecov Report

Attention: Patch coverage is 77.97619% with 37 lines in your changes missing coverage. Please review.

Project coverage is 92.08%. Comparing base (da545d2) to head (9f0d026).

Files with missing lines Patch % Lines
src/onnx/parse_multi_head_attention.cpp 77.97% 37 Missing ⚠️
Additional details and impacted files
@@             Coverage Diff             @@
##           develop    #3650      +/-   ##
===========================================
- Coverage    92.19%   92.08%   -0.11%     
===========================================
  Files          513      514       +1     
  Lines        21633    21801     +168     
===========================================
+ Hits         19945    20076     +131     
- Misses        1688     1725      +37     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@migraphx-bot
Copy link
Collaborator

Test Batch Rate new
9f0d02
Rate old
da545d
Diff Compare
torchvision-resnet50 64 3,256.22 3,255.84 0.01%
torchvision-resnet50_fp16 64 6,983.33 6,991.64 -0.12%
torchvision-densenet121 32 2,432.22 2,431.85 0.02%
torchvision-densenet121_fp16 32 4,072.97 4,070.27 0.07%
torchvision-inceptionv3 32 1,627.94 1,628.09 -0.01%
torchvision-inceptionv3_fp16 32 2,746.22 2,747.87 -0.06%
cadene-inceptionv4 16 764.30 764.69 -0.05%
cadene-resnext64x4 16 806.98 806.89 0.01%
slim-mobilenet 64 7,459.90 7,464.92 -0.07%
slim-nasnetalarge 64 208.45 208.40 0.03%
slim-resnet50v2 64 3,441.56 3,441.42 0.00%
bert-mrpc-onnx 8 1,151.41 1,145.08 0.55%
bert-mrpc-tf 1 462.81 461.72 0.24%
pytorch-examples-wlang-gru 1 422.51 429.74 -1.68%
pytorch-examples-wlang-lstm 1 381.78 480.37 -20.52% 🔴
torchvision-resnet50_1 1 778.70 770.17 1.11%
cadene-dpn92_1 1 408.16 403.49 1.16%
cadene-resnext101_1 1 382.75 381.97 0.20%
onnx-taau-downsample 1 345.46 346.00 -0.16%
dlrm-criteoterabyte 1 33.33 33.31 0.05%
dlrm-criteoterabyte_fp16 1 52.72 52.72 0.00%
agentmodel 1 8,341.74 8,212.54 1.57%
unet_fp16 2 58.85 58.71 0.24%
resnet50v1_fp16 1 932.36 938.46 -0.65%
resnet50v1_int8 1 1,006.10 999.92 0.62%
bert_base_cased_fp16 64 1,170.38 1,169.75 0.05%
bert_large_uncased_fp16 32 362.84 363.16 -0.09%
bert_large_fp16 1 198.52 200.11 -0.80%
distilgpt2_fp16 16 2,200.60 2,198.98 0.07%
yolov5s 1 526.32 533.15 -1.28%
tinyllama 1 43.34 43.41 -0.17%
vicuna-fastchat 1 177.16 173.49 2.11%
whisper-tiny-encoder 1 417.99 417.39 0.14%
whisper-tiny-decoder 1 435.90 427.99 1.85%

This build is not recommended to merge 🔴

@migraphx-bot
Copy link
Collaborator


     ✅ bert-mrpc-onnx: PASSED: MIGraphX meets tolerance

     ✅ bert-mrpc-tf: PASSED: MIGraphX meets tolerance

     ✅ pytorch-examples-wlang-gru: PASSED: MIGraphX meets tolerance

     ✅ pytorch-examples-wlang-lstm: PASSED: MIGraphX meets tolerance

     ✅ torchvision-resnet50_1: PASSED: MIGraphX meets tolerance

     ✅ cadene-dpn92_1: PASSED: MIGraphX meets tolerance

     ✅ cadene-resnext101_1: PASSED: MIGraphX meets tolerance

     ✅ dlrm-criteoterabyte: PASSED: MIGraphX meets tolerance

     ✅ agentmodel: PASSED: MIGraphX meets tolerance

     ✅ unet: PASSED: MIGraphX meets tolerance

     ✅ resnet50v1: PASSED: MIGraphX meets tolerance

     ✅ bert_base_cased_fp16: PASSED: MIGraphX meets tolerance

🔴bert_large_uncased_fp16: FAILED: MIGraphX is not within tolerance - check verbose output


     ✅ bert_large: PASSED: MIGraphX meets tolerance

     ✅ yolov5s: PASSED: MIGraphX meets tolerance

     ✅ tinyllama: PASSED: MIGraphX meets tolerance

     ✅ vicuna-fastchat: PASSED: MIGraphX meets tolerance

     ✅ whisper-tiny-encoder: PASSED: MIGraphX meets tolerance

     ✅ whisper-tiny-decoder: PASSED: MIGraphX meets tolerance

     ✅ distilgpt2_fp16: PASSED: MIGraphX meets tolerance

@causten causten requested a review from pfultz2 November 27, 2024 14:05
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants