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

bit_cast operator #3655

Draft
wants to merge 7 commits into
base: develop
Choose a base branch
from
Draft

bit_cast operator #3655

wants to merge 7 commits into from

Conversation

CharlieL7
Copy link
Collaborator

  • Converts between types while keeping the data the same. Basically an extension of reinterpret_cast without undefined behavior
  • Needed for conversion pass between fp8e4m3fn to fp8e4m3fnuz.

@CharlieL7 CharlieL7 self-assigned this Nov 22, 2024
if constexpr(sizeof(otype) == sizeof(itype))
{
par_transform(input.begin(), input.end(), output.begin(), [&](auto x) {
return __builtin_bit_cast(otype, x);
Copy link
Collaborator

Choose a reason for hiding this comment

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

Call migraphx::bit_cast function instead of using the builtin.

@migraphx-bot
Copy link
Collaborator

Test Batch Rate new
a15e5a
Rate old
0ad807
Diff Compare
torchvision-resnet50 64 3,256.68 3,239.44 0.53%
torchvision-resnet50_fp16 64 6,981.94 6,989.98 -0.12%
torchvision-densenet121 32 2,432.96 2,435.40 -0.10%
torchvision-densenet121_fp16 32 4,075.78 4,083.28 -0.18%
torchvision-inceptionv3 32 1,628.87 1,630.36 -0.09%
torchvision-inceptionv3_fp16 32 2,747.37 2,743.98 0.12%
cadene-inceptionv4 16 765.37 765.72 -0.04%
cadene-resnext64x4 16 811.27 811.01 0.03%
slim-mobilenet 64 7,465.93 7,471.20 -0.07%
slim-nasnetalarge 64 208.54 208.50 0.02%
slim-resnet50v2 64 3,443.82 3,438.88 0.14%
bert-mrpc-onnx 8 1,150.80 1,147.12 0.32%
bert-mrpc-tf 1 463.69 469.98 -1.34%
pytorch-examples-wlang-gru 1 420.31 416.34 0.95%
pytorch-examples-wlang-lstm 1 388.84 463.26 -16.07% 🔴
torchvision-resnet50_1 1 766.24 770.23 -0.52%
cadene-dpn92_1 1 400.58 399.89 0.17%
cadene-resnext101_1 1 382.51 382.62 -0.03%
onnx-taau-downsample 1 346.05 345.09 0.28%
dlrm-criteoterabyte 1 33.36 33.34 0.05%
dlrm-criteoterabyte_fp16 1 52.72 52.72 -0.00%
agentmodel 1 8,248.51 10,261.49 -19.62% 🔴
unet_fp16 2 58.84 58.87 -0.05%
resnet50v1_fp16 1 934.60 982.51 -4.88% 🔴
resnet50v1_int8 1 997.90 1,007.17 -0.92%
bert_base_cased_fp16 64 1,170.20 1,169.34 0.07%
bert_large_uncased_fp16 32 362.87 363.46 -0.16%
bert_large_fp16 1 198.76 198.15 0.31%
distilgpt2_fp16 16 2,201.93 2,201.47 0.02%
yolov5s 1 531.87 536.48 -0.86%
tinyllama 1 43.46 43.38 0.19%
vicuna-fastchat 1 174.24 172.97 0.73%
whisper-tiny-encoder 1 418.79 418.04 0.18%
whisper-tiny-decoder 1 428.48 423.83 1.10%

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

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.

3 participants