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

Enable non-packed inputs for mlir #3541

Merged
merged 4 commits into from
Dec 6, 2024
Merged

Enable non-packed inputs for mlir #3541

merged 4 commits into from
Dec 6, 2024

Conversation

pfultz2
Copy link
Collaborator

@pfultz2 pfultz2 commented Oct 18, 2024

No description provided.

@pfultz2 pfultz2 requested a review from causten as a code owner October 18, 2024 23:22
@pfultz2 pfultz2 requested review from shivadbhavsar and krzysz00 and removed request for causten October 18, 2024 23:23
Copy link

codecov bot commented Oct 19, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 92.17%. Comparing base (04ac9fc) to head (639d003).
Report is 66 commits behind head on develop.

Additional details and impacted files
@@           Coverage Diff            @@
##           develop    #3541   +/-   ##
========================================
  Coverage    92.17%   92.17%           
========================================
  Files          512      512           
  Lines        21393    21393           
========================================
  Hits         19720    19720           
  Misses        1673     1673           

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

@migraphx-bot
Copy link
Collaborator

Test Batch Rate new
639d00
Rate old
275f85
Diff Compare
torchvision-resnet50 64 3,259.88 3,258.32 0.05%
torchvision-resnet50_fp16 64 6,991.70 6,998.28 -0.09%
torchvision-densenet121 32 2,435.83 2,439.53 -0.15%
torchvision-densenet121_fp16 32 4,078.01 4,083.72 -0.14%
torchvision-inceptionv3 32 1,638.80 1,639.50 -0.04%
torchvision-inceptionv3_fp16 32 2,762.86 2,761.57 0.05%
cadene-inceptionv4 16 776.36 776.25 0.01%
cadene-resnext64x4 16 810.43 811.85 -0.18%
slim-mobilenet 64 7,534.50 7,537.50 -0.04%
slim-nasnetalarge 64 212.16 211.56 0.28%
slim-resnet50v2 64 3,503.11 3,504.39 -0.04%
bert-mrpc-onnx 8 1,151.61 1,148.92 0.23%
bert-mrpc-tf 1 494.07 467.60 5.66% 🔆
pytorch-examples-wlang-gru 1 430.00 422.65 1.74%
pytorch-examples-wlang-lstm 1 395.98 380.77 3.99% 🔆
torchvision-resnet50_1 1 786.19 815.97 -3.65% 🔴
cadene-dpn92_1 1 408.66 400.35 2.07%
cadene-resnext101_1 1 384.86 384.70 0.04%
onnx-taau-downsample 1 342.82 343.42 -0.17%
dlrm-criteoterabyte 1 33.33 33.32 0.03%
dlrm-criteoterabyte_fp16 1 52.71 52.72 -0.03%
agentmodel 1 8,590.92 8,139.01 5.55% 🔆
unet_fp16 2 58.90 58.87 0.05%
resnet50v1_fp16 1 923.74 930.44 -0.72%
resnet50v1_int8 1 1,009.62 994.18 1.55%
bert_base_cased_fp16 64 1,171.37 1,172.52 -0.10%
bert_large_uncased_fp16 32 363.50 363.39 0.03%
bert_large_fp16 1 198.51 198.49 0.01%
distilgpt2_fp16 16 2,202.16 2,199.99 0.10%
yolov5s 1 541.06 543.07 -0.37%
tinyllama 1 43.50 43.73 -0.52%
vicuna-fastchat 1 177.91 172.56 3.10% 🔆
whisper-tiny-encoder 1 418.74 417.97 0.19%
whisper-tiny-decoder 1 429.69 428.62 0.25%

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: 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

stride_ratios.end(),
ns.lens().begin() + 1,
[](auto ratio, auto len) { return ratio >= len; });
}
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

@krzysz00 This is checking if the shapes can be used by mlir(ie can be constructed from slice/reshape/transpose/broadcast). I know there are similar checks in mlir. Are you able to check that this is checking the shapes correctly?

Copy link
Contributor

Choose a reason for hiding this comment

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

https://github.com/ROCm/rocMLIR/blob/develop/mlir/lib/Dialect/MIGraphX/IR/MIGraphX.cpp#L182 is our logic.

This code feels similar, though I'd need to run through some examples with broadcast dimensions

Copy link
Contributor

@krzysz00 krzysz00 left a comment

Choose a reason for hiding this comment

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

Assuming this doesn't read to non-packed outputs, seems fine to me

auto last = std::find(ns.strides().begin(), ns.strides().end(), 0);
if(*std::prev(last) != 1)
return false;
std::adjacent_difference(ns.strides().begin(),
Copy link
Collaborator

@TedThemistokleous TedThemistokleous Dec 6, 2024

Choose a reason for hiding this comment

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

Do we want to possible add a parallel execution policy here or are we not concerned about this difference being to large? Looks like adjacent difference has the ability to be parallelized, or is the intent here since shape is const we want this expression to be const so execution policy doesn't matter?

Disregard, stride_ratio shouldn't be const and order matters here due to back inserter not being valid for parallelism

Copy link
Collaborator

@TedThemistokleous TedThemistokleous left a comment

Choose a reason for hiding this comment

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

Looks good unless @krzysz00 has any concerns

CI is all green not sure why github isn't reporting that correctly in jenkins here.

@TedThemistokleous TedThemistokleous added the enhancement New feature or request label Dec 6, 2024
@causten causten merged commit 4b15b6c into develop Dec 6, 2024
39 of 43 checks passed
@causten causten deleted the mlir-non-packed branch December 6, 2024 05:06
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request rocMLIR
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants