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

Ref implementation of FP8 #2438

Merged
merged 34 commits into from
Nov 17, 2023
Merged

Ref implementation of FP8 #2438

merged 34 commits into from
Nov 17, 2023

Conversation

umangyadav
Copy link
Member

handles all 4 Fp8 dtypes listed here : https://onnx.ai/onnx/technical/float8.html
Follows saturation/clipping logic from table there as well : https://onnx.ai/onnx/technical/float8.html#cast

Only adding fp8e4m3fnuz in MIGraphX IR for now.
Other types can be added later if necessary.

@migraphx-bot
Copy link
Collaborator

migraphx-bot commented Nov 11, 2023

Test Batch Rate new
9e6d86
Rate old
0039b1
Diff Compare
torchvision-resnet50 64 2,828.05 2,830.56 -0.09%
torchvision-resnet50_fp16 64 6,489.11 6,495.66 -0.10%
torchvision-densenet121 32 2,098.00 2,094.28 0.18%
torchvision-densenet121_fp16 32 3,655.13 3,665.07 -0.27%
torchvision-inceptionv3 32 1,586.85 1,582.01 0.31%
torchvision-inceptionv3_fp16 32 2,567.11 2,575.16 -0.31%
cadene-inceptionv4 16 702.98 703.19 -0.03%
cadene-resnext64x4 16 691.96 690.81 0.17%
slim-mobilenet 64 8,331.53 8,337.30 -0.07%
slim-nasnetalarge 64 225.48 225.51 -0.01%
slim-resnet50v2 64 2,666.74 2,664.32 0.09%
bert-mrpc-onnx 8 822.50 822.87 -0.04%
bert-mrpc-tf 1 390.59 387.67 0.75%
pytorch-examples-wlang-gru 1 302.34 301.83 0.17%
pytorch-examples-wlang-lstm 1 315.69 313.98 0.54%
torchvision-resnet50_1 1 596.58 596.93 -0.06%
torchvision-inceptionv3_1 1 343.60 343.95 -0.10%
cadene-dpn92_1 1 401.76 397.79 1.00%
cadene-resnext101_1 1 329.27 329.44 -0.05%
slim-vgg16_1 1 458.71 459.55 -0.18%
slim-mobilenet_1 1 2,120.20 2,119.65 0.03%
slim-inceptionv4_1 1 219.65 219.88 -0.11%
onnx-taau-downsample 1 304.99 304.20 0.26%
dlrm-criteoterabyte 1 21.59 21.62 -0.14%
dlrm-criteoterabyte_fp16 1 40.66 40.62 0.09%
agentmodel 1 nan nan nan%
unet_fp16 2 54.71 54.71 -0.00%
resnet50v1_fp16 1 940.70 953.28 -1.32%
bert_base_cased_fp16 64 902.93 903.12 -0.02%
bert_large_uncased_fp16 32 285.60 285.62 -0.01%
bert_large_fp16 1 166.58 166.55 0.02%
distilgpt2_fp16 16 1,279.83 1,280.79 -0.08%

This build is not recommended to merge 🔴

@migraphx-bot
Copy link
Collaborator


    :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:torchvision-inceptionv3_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:slim-vgg16_1: PASSED: MIGraphX meets tolerance

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

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

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

❌agentmodel: ERROR - check error outputTraceback (most recent call last):
File "/src/AMDMIGraphX/tools/accuracy/accuracy_checker.py", line 336, in
main()
File "/src/AMDMIGraphX/tools/accuracy/accuracy_checker.py", line 254, in main
pred_migx = np.array(model.run(params)[-1])
RuntimeError: /src/AMDMIGraphX/src/targets/gpu/device/include/migraphx/gpu/device/visit.hpp:140: hip_visit_views_impl: Ranks must be the same


    :white_check_mark:unet: PASSED: MIGraphX meets tolerance

    :white_check_mark:resnet50v1: PASSED: MIGraphX meets tolerance

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


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


    :white_check_mark:bert_large: PASSED: MIGraphX meets tolerance

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

@umangyadav umangyadav added the high priority A PR with high priority for review and merging. label Nov 15, 2023
@TedThemistokleous TedThemistokleous linked an issue Nov 15, 2023 that may be closed by this pull request
11 tasks
@causten causten requested a review from pfultz2 November 15, 2023 17:24
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 and solid + helpful comments in the code @umangyadav

static std::string format()
{
// following: https://docs.python.org/3/library/struct.html#format-characters
return "z";
Copy link
Collaborator

Choose a reason for hiding this comment

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

I don't see "z" in the commented link?

Copy link
Member Author

Choose a reason for hiding this comment

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

Yes that is not correct. I am not sure what should be correct format. Between "B", "b", or "c". I'll have to check.

Copy link
Member Author

Choose a reason for hiding this comment

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

I've opened an issue: This thing needs to be tested out to see if numpy buffers are created correctly.
#2447

test/fp8e4m3fn.cpp Outdated Show resolved Hide resolved
test/fp8e5m2.cpp Outdated Show resolved Hide resolved
@causten causten merged commit 7f93a81 into develop Nov 17, 2023
@causten causten deleted the ref_fp8 branch November 17, 2023 14:32
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
high priority A PR with high priority for review and merging.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

FP8 Support
6 participants