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

int8 optimizations #1973

Merged
merged 17 commits into from
Aug 8, 2023
Merged

int8 optimizations #1973

merged 17 commits into from
Aug 8, 2023

Conversation

kahmed10
Copy link
Collaborator

  • in rewrite_quantization.cpp, literals generated for clip operator are now scalars
  • in simplify_algebra.cpp, updated matcher to check for quant_dot operators

@kahmed10 kahmed10 requested review from umangyadav and removed request for pfultz2 July 18, 2023 22:36
@codecov
Copy link

codecov bot commented Jul 18, 2023

Codecov Report

Merging #1973 (23cd890) into develop (c65ab67) will increase coverage by 0.03%.
Report is 2 commits behind head on develop.
The diff coverage is 91.66%.

❗ Current head 23cd890 differs from pull request most recent head f7bb85b. Consider uploading reports for the commit f7bb85b to get more accurate results

@@             Coverage Diff             @@
##           develop    #1973      +/-   ##
===========================================
+ Coverage    91.37%   91.40%   +0.03%     
===========================================
  Files          422      422              
  Lines        15652    15645       -7     
===========================================
- Hits         14302    14301       -1     
+ Misses        1350     1344       -6     
Files Changed Coverage Δ
src/api/api.cpp 72.36% <ø> (ø)
src/include/migraphx/algorithm.hpp 100.00% <ø> (ø)
src/module.cpp 87.57% <ø> (+1.02%) ⬆️
src/sqlite.cpp 84.21% <ø> (ø)
src/program.cpp 69.51% <50.00%> (ø)
src/fuse_pointwise.cpp 97.87% <100.00%> (ø)
src/fuse_reduce.cpp 97.46% <100.00%> (ø)
src/include/migraphx/op/convolution.hpp 96.51% <100.00%> (ø)
src/include/migraphx/op/if_op.hpp 89.47% <100.00%> (ø)
src/include/migraphx/op/loop.hpp 97.87% <100.00%> (+0.04%) ⬆️
... and 6 more

@migraphx-bot
Copy link
Collaborator

migraphx-bot commented Jul 19, 2023

Test Batch Rate new
3c5522
Rate old
9cd9f1
Diff Compare
torchvision-resnet50 64 2,276.14 2,275.85 0.01%
torchvision-resnet50_fp16 64 5,329.87 5,346.88 -0.32%
torchvision-densenet121 32 1,810.00 1,833.96 -1.31%
torchvision-densenet121_fp16 32 3,370.99 3,383.15 -0.36%
torchvision-inceptionv3 32 1,344.11 1,337.69 0.48%
torchvision-inceptionv3_fp16 32 2,532.77 2,517.74 0.60%
cadene-inceptionv4 16 678.01 678.14 -0.02%
cadene-resnext64x4 16 589.32 589.17 0.03%
slim-mobilenet 64 7,213.54 7,214.54 -0.01%
slim-nasnetalarge 64 236.15 236.47 -0.13%
slim-resnet50v2 64 2,523.35 2,521.26 0.08%
bert-mrpc-onnx 8 718.11 719.30 -0.17%
bert-mrpc-tf 1 364.78 362.43 0.65%
pytorch-examples-wlang-gru 1 312.07 312.66 -0.19%
pytorch-examples-wlang-lstm 1 313.84 315.53 -0.54%
torchvision-resnet50_1 1 559.11 560.34 -0.22%
torchvision-inceptionv3_1 1 307.80 308.37 -0.18%
cadene-dpn92_1 1 355.85 353.86 0.56%
cadene-resnext101_1 1 219.91 219.97 -0.03%
slim-vgg16_1 1 224.10 223.38 0.32%
slim-mobilenet_1 1 1,456.67 1,473.24 -1.12%
slim-inceptionv4_1 1 220.50 222.74 -1.01%
onnx-taau-downsample 1 320.68 320.54 0.04%
dlrm-criteoterabyte 1 21.66 21.67 -0.07%
dlrm-criteoterabyte_fp16 1 40.58 40.59 -0.03%
agentmodel 1 5,904.79 5,898.07 0.11%
unet_fp16 2 54.99 54.96 0.05%

This build is OK for merge ✅

@migraphx-bot
Copy link
Collaborator

migraphx-bot commented Jul 19, 2023


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

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

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

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

    :white_check_mark:torchvision-resnet50_1: PASSED: MIGraphX meets tolerance

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


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


    :white_check_mark:cadene-resnext101_1: PASSED: MIGraphX meets tolerance

    :white_check_mark:slim-vgg16_1: PASSED: MIGraphX meets tolerance

    :white_check_mark:slim-mobilenet_1: PASSED: MIGraphX meets tolerance

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


    :white_check_mark:dlrm-criteoterabyte: PASSED: MIGraphX meets tolerance

    :white_check_mark:agentmodel: PASSED: MIGraphX meets tolerance

    :white_check_mark:unet: PASSED: MIGraphX meets tolerance

@@ -70,6 +74,8 @@ TEST_CASE(quantizelinear)
EXPECT(eval(p1) == eval(p2));
EXPECT(any_of(*p1.get_main_module(), &is_quantizelinear));
EXPECT(none_of(*p2.get_main_module(), &is_quantizelinear));
// ensure clip literals created in quantized program are scalar
EXPECT(any_of(*p2.get_main_module(), &is_scalar));
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 probably check the inputs to clip are scalars.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

updated test, please take a look

@@ -37,6 +37,17 @@

bool is_quantizelinear(migraphx::instruction& ins) { return ins.name() == "quantizelinear"; }
bool is_dequantizelinear(migraphx::instruction& ins) { return ins.name() == "dequantizelinear"; }
bool is_clip_scalar(migraphx::instruction& ins)
Copy link
Collaborator

Choose a reason for hiding this comment

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

This can be const.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

should all of them be changed to const?

Copy link
Collaborator

Choose a reason for hiding this comment

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

Ah yea they should probably all be const.

@causten causten merged commit f787d5b into develop Aug 8, 2023
10 of 11 checks passed
@causten causten deleted the qdot_clip_opts branch August 8, 2023 22:20
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.

Update horizontal fusion for quant_dot Update rewrite_quantization literal generation for clip operator
5 participants