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

Scalar multiplication and followed by conv #3478

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

Conversation

aarushjain29
Copy link
Contributor

No description provided.

Copy link

codecov bot commented Sep 25, 2024

Codecov Report

Attention: Patch coverage is 72.97297% with 10 lines in your changes missing coverage. Please review.

Project coverage is 91.98%. Comparing base (e2e9219) to head (69457bd).
Report is 3 commits behind head on develop.

Files with missing lines Patch % Lines
src/simplify_algebra.cpp 71.42% 10 Missing ⚠️
Additional details and impacted files
@@             Coverage Diff             @@
##           develop    #3478      +/-   ##
===========================================
- Coverage    92.02%   91.98%   -0.04%     
===========================================
  Files          509      509              
  Lines        21005    21034      +29     
===========================================
+ Hits         19330    19349      +19     
- Misses        1675     1685      +10     

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

@aarushjain29 aarushjain29 marked this pull request as draft September 26, 2024 17:13
@aarushjain29 aarushjain29 force-pushed the 3432-improve-simplify_algebra-to-find-more-horizontal-fusion-opportunities branch from 381540b to 69457bd Compare October 3, 2024 17:18
@aarushjain29 aarushjain29 marked this pull request as ready for review October 3, 2024 19:03
@@ -744,7 +744,8 @@ struct find_unary_shape_transforms
{
return ins->name() == "@literal" or
ins->get_operator().attributes().contains("pointwise") or
contains(ins->name(), "reduce");
contains(ins->name(), "reduce") or
ins->get_operator().attributes().contains("scalar"); //For scalar operation
Copy link
Collaborator

Choose a reason for hiding this comment

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

What operators have a scalar attribute?

@pfultz2
Copy link
Collaborator

pfultz2 commented Oct 3, 2024

Unit tests needs to be added.

@migraphx-bot
Copy link
Collaborator

Test Batch Rate new
69457b
Rate old
fc26f0
Diff Compare
torchvision-resnet50 64 3,259.24 3,261.06 -0.06%
torchvision-resnet50_fp16 64 6,967.28 6,993.61 -0.38%
torchvision-densenet121 32 2,433.46 2,434.05 -0.02%
torchvision-densenet121_fp16 32 4,073.77 4,095.98 -0.54%
torchvision-inceptionv3 32 1,637.22 1,638.20 -0.06%
torchvision-inceptionv3_fp16 32 2,757.50 2,759.48 -0.07%
cadene-inceptionv4 16 780.34 775.34 0.64%
cadene-resnext64x4 16 808.13 808.43 -0.04%
slim-mobilenet 64 7,473.13 7,536.82 -0.85%
slim-nasnetalarge 64 208.51 211.47 -1.40%
slim-resnet50v2 64 nan 3,501.50 nan%
bert-mrpc-onnx 8 1,148.66 1,149.92 -0.11%
bert-mrpc-tf 1 320.36 465.24 -31.14% 🔴
pytorch-examples-wlang-gru 1 412.23 413.68 -0.35%
pytorch-examples-wlang-lstm 1 377.12 379.94 -0.74%
torchvision-resnet50_1 1 754.52 786.00 -4.00% 🔴
cadene-dpn92_1 1 nan 400.42 nan%
cadene-resnext101_1 1 380.37 381.26 -0.23%
onnx-taau-downsample 1 367.87 343.07 7.23% 🔆
dlrm-criteoterabyte 1 35.04 33.36 5.02% 🔆
dlrm-criteoterabyte_fp16 1 58.18 52.73 10.33% 🔆
agentmodel 1 7,997.95 8,550.08 -6.46% 🔴
unet_fp16 2 58.96 58.85 0.19%
resnet50v1_fp16 1 931.17 941.58 -1.11%
resnet50v1_int8 1 972.20 970.00 0.23%
bert_base_cased_fp16 64 1,171.27 1,171.45 -0.02%
bert_large_uncased_fp16 32 363.67 363.62 0.01%
bert_large_fp16 1 210.95 200.57 5.18% 🔆
distilgpt2_fp16 16 2,202.17 2,203.25 -0.05%
yolov5s 1 546.60 540.96 1.04%
tinyllama 1 43.49 43.52 -0.08%
vicuna-fastchat 1 177.37 174.66 1.55%
whisper-tiny-encoder 1 418.40 418.66 -0.06%
whisper-tiny-decoder 1 425.50 428.20 -0.63%

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: ERROR - check error outputTraceback (most recent call last):
File "/src/AMDMIGraphX/tools/accuracy/accuracy_checker.py", line 340, in
main()
File "/src/AMDMIGraphX/tools/accuracy/accuracy_checker.py", line 227, in main
model.compile(
RuntimeError: /src/AMDMIGraphX/src/include/migraphx/check_shapes.hpp:220: same_dims: mul: Dimensions do not match


     ✅ 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

match::either_arg(0, 1)(
match::is_constant().bind("scalar"),
match::name("convolution").bind("conv")
));
Copy link
Collaborator

Choose a reason for hiding this comment

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

This should be checking for slice -> mul -> add. There is no reason to check for convolution.

Copy link
Collaborator

Choose a reason for hiding this comment

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

Also, in the apply method you need to check the other slices go into add or mul -> add.

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.

Improve simplify_algebra to find more horizontal fusion opportunities
5 participants