ROCm / AMDMIGraphX

AMD's graph optimization engine.
https://rocm.docs.amd.com/projects/AMDMIGraphX/en/latest/
MIT License
183 stars 84 forks source link

Parser changes to handle MatMulIntegerToFloat #3445

Open TedThemistokleous opened 1 week ago

TedThemistokleous commented 1 week ago

Changes to MatMul parser to handle the Microsoft Contrib operator MatMulintegarToFloat

Since we have the scale and zero points in our operands we can just perform a multiplied after int8 biases are added and then insert a regular dot on the scaled input values which should give the same output as the input data types.

Able to leverage the existing set of tests for matmul

TedThemistokleous commented 1 week ago

TODO:

codecov[bot] commented 1 week ago

Codecov Report

Attention: Patch coverage is 40.00000% with 12 lines in your changes missing coverage. Please review.

Project coverage is 91.99%. Comparing base (9dcea5c) to head (7f62a33). Report is 3 commits behind head on develop.

Files with missing lines Patch % Lines
src/onnx/parse_matmul.cpp 40.00% 12 Missing :warning:
Additional details and impacted files ```diff @@ Coverage Diff @@ ## develop #3445 +/- ## =========================================== - Coverage 92.04% 91.99% -0.06% =========================================== Files 505 505 Lines 20699 20713 +14 =========================================== + Hits 19052 19054 +2 - Misses 1647 1659 +12 ```

:umbrella: View full report in Codecov by Sentry.
:loudspeaker: Have feedback on the report? Share it here.

migraphx-bot commented 4 days ago
Test Batch Rate new
f912e6
Rate old
ab5da3
Diff Compare
torchvision-resnet50 64 3,250.83 3,250.20 0.02% :white_check_mark:
torchvision-resnet50_fp16 64 6,989.30 6,981.72 0.11% :white_check_mark:
torchvision-densenet121 32 2,432.92 2,434.35 -0.06% :white_check_mark:
torchvision-densenet121_fp16 32 4,051.61 4,104.80 -1.30% :white_check_mark:
torchvision-inceptionv3 32 1,637.62 1,637.98 -0.02% :white_check_mark:
torchvision-inceptionv3_fp16 32 2,743.04 2,743.88 -0.03% :white_check_mark:
cadene-inceptionv4 16 778.79 778.58 0.03% :white_check_mark:
cadene-resnext64x4 16 808.70 808.70 0.00% :white_check_mark:
slim-mobilenet 64 7,458.65 7,457.95 0.01% :white_check_mark:
slim-nasnetalarge 64 208.49 208.52 -0.02% :white_check_mark:
slim-resnet50v2 64 3,436.87 3,435.85 0.03% :white_check_mark:
bert-mrpc-onnx 8 1,149.67 1,153.18 -0.30% :white_check_mark:
bert-mrpc-tf 1 307.53 305.52 0.66% :white_check_mark:
pytorch-examples-wlang-gru 1 519.82 384.89 35.05% :high_brightness:
pytorch-examples-wlang-lstm 1 396.01 386.28 2.52% :white_check_mark:
torchvision-resnet50_1 1 773.75 768.57 0.67% :white_check_mark:
cadene-dpn92_1 1 399.79 437.45 -8.61% :red_circle:
cadene-resnext101_1 1 381.87 383.50 -0.42% :white_check_mark:
onnx-taau-downsample 1 344.15 344.79 -0.18% :white_check_mark:
dlrm-criteoterabyte 1 35.04 35.03 0.03% :white_check_mark:
dlrm-criteoterabyte_fp16 1 58.08 58.06 0.04% :white_check_mark:
agentmodel 1 7,873.77 7,924.68 -0.64% :white_check_mark:
unet_fp16 2 58.06 57.94 0.22% :white_check_mark:
resnet50v1_fp16 1 959.34 929.40 3.22% :high_brightness:
resnet50v1_int8 1 965.21 960.30 0.51% :white_check_mark:
bert_base_cased_fp16 64 1,153.71 1,153.43 0.02% :white_check_mark:
bert_large_uncased_fp16 32 356.06 355.83 0.07% :white_check_mark:
bert_large_fp16 1 211.93 210.44 0.71% :white_check_mark:
distilgpt2_fp16 16 2,158.70 2,159.20 -0.02% :white_check_mark:
yolov5s 1 539.46 539.05 0.08% :white_check_mark:
tinyllama 1 43.38 43.40 -0.04% :white_check_mark:
vicuna-fastchat 1 176.02 170.95 2.96% :white_check_mark:
whisper-tiny-encoder 1 417.79 417.95 -0.04% :white_check_mark:
whisper-tiny-decoder 1 422.13 423.97 -0.43% :white_check_mark:

This build is not recommended to merge :red_circle:

migraphx-bot commented 4 days ago


     :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
     :white_check_mark: cadene-dpn92_1: PASSED: MIGraphX meets tolerance
     :white_check_mark: cadene-resnext101_1: PASSED: MIGraphX meets tolerance
     :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
     :white_check_mark: resnet50v1: PASSED: MIGraphX meets tolerance
     :white_check_mark: bert_base_cased_fp16: PASSED: MIGraphX meets tolerance
:red_circle:bert_large_uncased_fp16: FAILED: MIGraphX is not within tolerance - check verbose output

     :white_check_mark: bert_large: PASSED: MIGraphX meets tolerance
     :white_check_mark: yolov5s: PASSED: MIGraphX meets tolerance
     :white_check_mark: tinyllama: PASSED: MIGraphX meets tolerance
     :white_check_mark: vicuna-fastchat: PASSED: MIGraphX meets tolerance
     :white_check_mark: whisper-tiny-encoder: PASSED: MIGraphX meets tolerance
     :white_check_mark: whisper-tiny-decoder: PASSED: MIGraphX meets tolerance
     :white_check_mark: distilgpt2_fp16: PASSED: MIGraphX meets tolerance