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

Peephole LSTM Error #3768

Open
wants to merge 10 commits into
base: develop
Choose a base branch
from
Open

Peephole LSTM Error #3768

wants to merge 10 commits into from

Conversation

richagadgil
Copy link
Contributor

@richagadgil richagadgil commented Jan 18, 2025

The peephole is causing this error in line 1095

auto spph = m.insert_instruction(ins, make_op("squeeze", {{"axes", {0}}}), pph);

Pass: rewrite_rnn
terminate called after throwing an instance of 'migraphx::version_2_12_0::exception'
  what():  /code/AMDMIGraphX/src/normalize_attributes.cpp:120: tune_attribute: squeeze: axes: value out of range!
Aborted (core dumped)

Printing out the pph instruction.get_shape() value gives me: @literal half_type, {}, {}

Quantization is causing this to be an empty parameter instead of undefined.

@richagadgil richagadgil marked this pull request as ready for review January 23, 2025 00:55
@richagadgil richagadgil requested a review from causten as a code owner January 23, 2025 00:55
Copy link

codecov bot commented Jan 23, 2025

Codecov Report

Attention: Patch coverage is 50.00000% with 1 line in your changes missing coverage. Please review.

Project coverage is 92.29%. Comparing base (810b3f2) to head (7bc259c).

Files with missing lines Patch % Lines
src/propagate_constant.cpp 50.00% 1 Missing ⚠️
Additional details and impacted files
@@             Coverage Diff             @@
##           develop    #3768      +/-   ##
===========================================
- Coverage    92.29%   92.29%   -0.01%     
===========================================
  Files          519      519              
  Lines        22217    22219       +2     
===========================================
+ Hits         20505    20506       +1     
- Misses        1712     1713       +1     

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

@migraphx-bot
Copy link
Collaborator

Test Batch Rate new
a9919e
Rate old
43488c
Diff Compare
torchvision-resnet50 64 3,253.77 3,254.25 -0.01%
torchvision-resnet50_fp16 64 6,920.21 6,916.65 0.05%
torchvision-densenet121 32 2,455.98 2,455.95 0.00%
torchvision-densenet121_fp16 32 4,171.47 4,183.26 -0.28%
torchvision-inceptionv3 32 1,629.63 1,629.97 -0.02%
torchvision-inceptionv3_fp16 32 2,713.11 2,715.98 -0.11%
cadene-inceptionv4 16 763.10 762.93 0.02%
cadene-resnext64x4 16 812.75 812.98 -0.03%
slim-mobilenet 64 7,456.27 7,459.33 -0.04%
slim-nasnetalarge 64 208.65 208.65 0.00%
slim-resnet50v2 64 3,444.90 3,445.08 -0.01%
bert-mrpc-onnx 8 1,148.07 1,147.48 0.05%
bert-mrpc-tf 1 481.16 481.97 -0.17%
pytorch-examples-wlang-gru 1 481.46 478.37 0.65%
pytorch-examples-wlang-lstm 1 444.23 439.41 1.10%
torchvision-resnet50_1 1 806.56 803.28 0.41%
cadene-dpn92_1 1 425.37 427.49 -0.49%
cadene-resnext101_1 1 385.94 376.23 2.58%
onnx-taau-downsample 1 373.67 373.50 0.05%
dlrm-criteoterabyte 1 33.30 33.31 -0.03%
dlrm-criteoterabyte_fp16 1 52.64 52.64 0.00%
agentmodel 1 8,929.37 8,546.35 4.48% 🔆
unet_fp16 2 58.46 58.43 0.06%
resnet50v1_fp16 1 1,039.87 1,033.48 0.62%
resnet50v1_int8 1 1,020.62 1,018.13 0.24%
bert_base_cased_fp16 64 1,180.91 1,181.00 -0.01%
bert_large_uncased_fp16 32 365.25 365.36 -0.03%
bert_large_fp16 1 200.94 201.35 -0.21%
distilgpt2_fp16 16 2,225.22 2,228.65 -0.15%
yolov5s 1 521.75 527.51 -1.09%
tinyllama 1 43.59 43.62 -0.05%
vicuna-fastchat 1 172.03 173.15 -0.65%
whisper-tiny-encoder 1 418.04 416.80 0.30%
whisper-tiny-decoder 1 431.47 429.87 0.37%

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

@richagadgil
Copy link
Contributor Author

This fix works to compile the model and run perf, but there is still an issue with the .mxr files once compiled:

FP32:

[ MIGraphX Version: 2.12.0.a9919ec08 ] Complete: /code/AMDMIGraphX/build/bin/migraphx-driver compile model.onnx --input-dim @symbol 1 1 @hidden_in_1 2 1 320 @hidden_in_2 2 1 320 --fill1 symbol -o model_fp32.mxr

[ MIGraphX Version: 2.12.0.a9919ec08 ] Complete: /code/AMDMIGraphX/build/bin/migraphx-driver perf model_fp32.mxr --fill1 symbol

FP16:

[ MIGraphX Version: 2.12.0.a9919ec08 ] Complete: /code/AMDMIGraphX/build/bin/migraphx-driver compile model.onnx --input-dim @symbol 1 1 @hidden_in_1 2 1 320 @hidden_in_2 2 1 320 --fill1 symbol --fp16 -o model_fp16.mxr

Running [ MIGraphX Version: 2.12.0.a9919ec08 ]: /code/AMDMIGraphX/build/bin/migraphx-driver perf model_fp16.mxr --fill1 symbol
Compiling ... 
Reading: model_fp16.mxr
terminate called after throwing an instance of 'msgpack::v1::insufficient_bytes'
  what():  insufficient bytes
Aborted (core dumped)

@richagadgil
Copy link
Contributor Author

log.txt

MIGRAPHX_TRACE_COMPILE=1 /code/AMDMIGraphX/build/bin/migraphx-driver perf model.onnx --input-dim @symbol 1 1 @hidden_in_1 2 1 320 @hidden_in_2 2 1 320 --fill1 symbol --fp16 -o model_fp16.mxr

@richagadgil
Copy link
Contributor Author

Changed the PR to skip const prop over undefined instructions instead.

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.

3 participants