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

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 81.25000% with 21 lines in your changes missing coverage. Please review.

Project coverage is 92.11%. Comparing base (952a257) to head (ec2e5b0).

Files with missing lines Patch % Lines
src/onnx/parse_multi_head_attention.cpp 81.25% 21 Missing ⚠️
Additional details and impacted files
@@             Coverage Diff             @@
##           develop    #3650      +/-   ##
===========================================
- Coverage    92.17%   92.11%   -0.06%     
===========================================
  Files          513      514       +1     
  Lines        21583    21695     +112     
===========================================
+ Hits         19894    19985      +91     
- Misses        1689     1710      +21     

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


🚨 Try these New Features:

@migraphx-bot
Copy link
Collaborator

Test Batch Rate new
ec2e5b
Rate old
0f36aa
Diff Compare
torchvision-resnet50 64 3,258.04 3,261.99 -0.12%
torchvision-resnet50_fp16 64 6,989.64 6,984.41 0.07%
torchvision-densenet121 32 2,436.29 2,434.46 0.08%
torchvision-densenet121_fp16 32 4,105.31 4,068.77 0.90%
torchvision-inceptionv3 32 1,628.76 1,630.14 -0.08%
torchvision-inceptionv3_fp16 32 2,745.51 2,746.22 -0.03%
cadene-inceptionv4 16 765.35 765.59 -0.03%
cadene-resnext64x4 16 810.68 809.78 0.11%
slim-mobilenet 64 7,470.53 7,474.57 -0.05%
slim-nasnetalarge 64 208.49 208.58 -0.04%
slim-resnet50v2 64 3,441.90 3,441.49 0.01%
bert-mrpc-onnx 8 1,144.35 1,150.80 -0.56%
bert-mrpc-tf 1 465.18 465.54 -0.08%
pytorch-examples-wlang-gru 1 412.37 420.06 -1.83%
pytorch-examples-wlang-lstm 1 402.31 381.98 5.32% 🔆
torchvision-resnet50_1 1 770.37 750.44 2.66%
cadene-dpn92_1 1 396.31 398.35 -0.51%
cadene-resnext101_1 1 382.22 382.96 -0.19%
onnx-taau-downsample 1 346.19 346.08 0.03%
dlrm-criteoterabyte 1 33.33 33.35 -0.05%
dlrm-criteoterabyte_fp16 1 52.76 52.68 0.15%
agentmodel 1 8,407.25 8,091.53 3.90% 🔆
unet_fp16 2 58.81 58.77 0.07%
resnet50v1_fp16 1 920.85 943.16 -2.37%
resnet50v1_int8 1 1,013.50 1,012.12 0.14%
bert_base_cased_fp16 64 1,170.20 1,169.97 0.02%
bert_large_uncased_fp16 32 363.56 363.75 -0.05%
bert_large_fp16 1 200.48 199.03 0.73%
distilgpt2_fp16 16 2,197.33 2,201.98 -0.21%
yolov5s 1 529.38 539.79 -1.93%
tinyllama 1 43.40 43.42 -0.03%
vicuna-fastchat 1 179.23 175.75 1.98%
whisper-tiny-encoder 1 415.99 418.02 -0.49%
whisper-tiny-decoder 1 425.55 428.37 -0.66%

Check results before 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

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