Skip to content

[SYCL] Fix bfloat16::to_float() host implementation. #6675

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

Merged
merged 4 commits into from
Sep 2, 2022

Conversation

kbobrovs
Copy link
Contributor

@kbobrovs kbobrovs commented Aug 30, 2022

  • Fix bfloat16::to_float() host implementation
  • Fix bugs in the existing sycl/test/extensions/bfloat16_host.cpp test.

New E2E test: intel/llvm-test-suite#1189

Signed-off-by: Konstantin S Bobrovsky [email protected]

@kbobrovs
Copy link
Contributor Author

@v-klochkov, FYI

@kbobrovs
Copy link
Contributor Author

@cperkinsintel, @intel/llvm-reviewers-runtime - please take a look at this small PR

MrSidims
MrSidims previously approved these changes Aug 31, 2022
Success &= check_bf16_to_float(
0, bitsToFloatConv(std::string("00000000000000000000000000000000")));
Success &= check_bf16_to_float(
1, bitsToFloatConv(std::string("01000111100000000000000000000000")));
Copy link
Contributor

Choose a reason for hiding this comment

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

Oh, that was a huge mistake, sorry about that.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

bugs happen, no problem )

Comment on lines 66 to 72
union {
uint32_t bits;
float res;
} val;
val.bits = a;
val.bits <<= 16;
return val.res;
Copy link
Contributor

Choose a reason for hiding this comment

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

We seem to have sycl::bit_cast, can we use it here? If not, then a comment is necessary to explain why.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

good point, will fix

@kbobrovs
Copy link
Contributor Author

@aelovikov-intel, @cperkinsintel - please review

@kbobrovs
Copy link
Contributor Author

kbobrovs commented Sep 1, 2022

@aelovikov-intel, @cperkinsintel, ping

@kbobrovs kbobrovs merged commit 66e469b into intel:sycl Sep 2, 2022
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