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

Update finalize function for hipBLASLt to find tuned solution only when solution index is 0. #3593

Merged
merged 4 commits into from
Nov 13, 2024

Conversation

ahsan-ca
Copy link
Contributor

@ahsan-ca ahsan-ca commented Nov 6, 2024

Currently, finalize function runs tuning for all solution indices.
This PR modifies the function to run tuning only when
solution index is '0'. For all other solution indices, it runs validate.

This PR also fixes a bug in functionality of hipBLASLt validate function.

@ahsan-ca ahsan-ca self-assigned this Nov 6, 2024
@ahsan-ca ahsan-ca requested a review from causten as a code owner November 6, 2024 03:46
@ahsan-ca
Copy link
Contributor Author

ahsan-ca commented Nov 6, 2024

Windows build failures seem unrelated.

Copy link

codecov bot commented Nov 6, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 92.13%. Comparing base (4b96e1c) to head (26a8d3d).
Report is 15 commits behind head on develop.

Additional details and impacted files
@@           Coverage Diff            @@
##           develop    #3593   +/-   ##
========================================
  Coverage    92.13%   92.13%           
========================================
  Files          512      512           
  Lines        21424    21424           
========================================
  Hits         19740    19740           
  Misses        1684     1684           

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

auto gemm_item = hip_gemm_impl(output_shape, input_shapes, alpha, beta);
int32_t solution = gemm_item.tune(ctx, input_shapes);
hip_gemm_save_solution(ctx, output_shape, input_shapes, solution_idx);
int solution;
Copy link
Collaborator

Choose a reason for hiding this comment

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

Remove this variable and use solution_idx variable instead.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Done.

@ahsan-ca ahsan-ca force-pushed the hipblaslt-update-finalize branch from 4f8d530 to 100da97 Compare November 7, 2024 16:53
@ahsan-ca ahsan-ca requested review from bpickrel and pfultz2 November 7, 2024 16:58
@ahsan-ca ahsan-ca requested a review from bpickrel November 7, 2024 20:20
@@ -76,14 +76,17 @@ inline auto hipblaslt_invoke(F f, Ts... xs)
}

template <class F, class Pack, class... Ts>
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
template <class F, class Pack, class... Ts>
// Invoke a Hipblaslt call. If used to validate a call, set fatal_error = false to prevent
// throwing an exception on failure.
template <class F, class Pack, class... Ts>

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Thanks for the suggestion, I have added the comment.

Copy link
Contributor

@bpickrel bpickrel left a comment

Choose a reason for hiding this comment

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

One suggested comment add, but looks OK to me now.

@ahsan-ca ahsan-ca force-pushed the hipblaslt-update-finalize branch from eec5c0c to 26a8d3d Compare November 7, 2024 23:54
@migraphx-bot
Copy link
Collaborator

Test Batch Rate new
26a8d3
Rate old
4b96e1
Diff Compare
torchvision-resnet50 64 3,259.19 3,260.90 -0.05%
torchvision-resnet50_fp16 64 6,993.28 6,997.41 -0.06%
torchvision-densenet121 32 2,435.07 2,434.55 0.02%
torchvision-densenet121_fp16 32 4,070.23 4,075.83 -0.14%
torchvision-inceptionv3 32 1,637.55 1,638.24 -0.04%
torchvision-inceptionv3_fp16 32 2,763.24 2,763.31 -0.00%
cadene-inceptionv4 16 776.08 776.01 0.01%
cadene-resnext64x4 16 810.75 810.68 0.01%
slim-mobilenet 64 7,534.56 7,533.95 0.01%
slim-nasnetalarge 64 211.46 211.48 -0.01%
slim-resnet50v2 64 3,507.68 3,504.72 0.08%
bert-mrpc-onnx 8 1,149.32 1,147.94 0.12%
bert-mrpc-tf 1 467.93 469.63 -0.36%
pytorch-examples-wlang-gru 1 430.49 421.02 2.25%
pytorch-examples-wlang-lstm 1 381.18 388.14 -1.80%
torchvision-resnet50_1 1 793.22 779.01 1.82%
cadene-dpn92_1 1 397.00 398.67 -0.42%
cadene-resnext101_1 1 384.80 382.75 0.53%
onnx-taau-downsample 1 342.24 342.72 -0.14%
dlrm-criteoterabyte 1 33.33 33.33 0.00%
dlrm-criteoterabyte_fp16 1 52.76 52.75 0.02%
agentmodel 1 7,979.25 8,366.03 -4.62% 🔴
unet_fp16 2 58.90 58.92 -0.03%
resnet50v1_fp16 1 954.68 954.56 0.01%
resnet50v1_int8 1 1,010.42 1,017.83 -0.73%
bert_base_cased_fp16 64 1,171.29 1,171.50 -0.02%
bert_large_uncased_fp16 32 363.32 363.78 -0.13%
bert_large_fp16 1 198.55 199.79 -0.62%
distilgpt2_fp16 16 2,204.26 2,201.72 0.12%
yolov5s 1 534.25 534.00 0.05%
tinyllama 1 43.47 43.45 0.05%
vicuna-fastchat 1 178.49 171.97 3.79% 🔆
whisper-tiny-encoder 1 417.82 417.86 -0.01%
whisper-tiny-decoder 1 427.98 434.41 -1.48%

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

@causten causten requested a review from CharlieL7 November 13, 2024 05:54
Copy link
Collaborator

@CharlieL7 CharlieL7 left a comment

Choose a reason for hiding this comment

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

Code looks good. I'm assuming this is faster to compile because we're not running tune every time? Also, does a solution index of zero always mean it needs tuning?

@ahsan-ca
Copy link
Contributor Author

Code looks good. I'm assuming this is faster to compile because we're not running tune every time?

Yes, this should be faster because previously we were running tuning regardless of the solution index provided. Now we only do tuning when the solution index provided is zero.

Also, does a solution index of zero always mean it needs tuning?

We do tuning if the solution index provided is zero. However, we do not try to tune if the non-zero solution index is invalidated by the validate() function to solution index 0.

@ahsan-ca ahsan-ca linked an issue Nov 13, 2024 that may be closed by this pull request
@causten causten merged commit f1a1f9f into develop Nov 13, 2024
42 of 43 checks passed
@causten causten deleted the hipblaslt-update-finalize branch November 13, 2024 21:10
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.

Add compile pass for hipblaslt
6 participants