Skip to content

[SYCL] Remove direct initialization constructor from bfloat16 class #4989

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 3 commits into from
Dec 17, 2021

Conversation

AlexeySotkin
Copy link
Contributor

@AlexeySotkin AlexeySotkin commented Nov 19, 2021

This constructor is being removed to resolve ambiguity when user trying
initialize bfloat16 with int, like auto a = bfloat16(0);

Fixes #4871.

@AlexeySotkin AlexeySotkin requested a review from a team as a code owner November 19, 2021 09:02
@vladimirlaz vladimirlaz changed the title Remove direct initialization constructor from bfloat16 class [SYCL] Remove direct initialization constructor from bfloat16 class Nov 19, 2021
steffenlarsen
steffenlarsen previously approved these changes Nov 19, 2021
Copy link
Contributor

@steffenlarsen steffenlarsen left a comment

Choose a reason for hiding this comment

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

LGTM. Is this something that should be reflected in the extension document?

@dm-vodopyanov
Copy link
Contributor

dm-vodopyanov commented Nov 22, 2021

@AlexeySotkin, can you please answer the question above before merging of this PR?

@vladimirlaz
Copy link
Contributor

@AlexeySotkin, can you please answer the question above before merging of this PR?

in fact, the spec does not contain the removed constructor. So nothing to be changed.

vladimirlaz
vladimirlaz previously approved these changes Nov 22, 2021
@AlexeySotkin
Copy link
Contributor Author

@AlexeySotkin, can you please answer the question above before merging of this PR?

in fact, the spec does not contain the removed constructor. So nothing to be changed.

The latest change contains a new method which should be added to the spec. Also I'd like to hear feedback from @GHGmc2. Marking this PR as a draft for now.

@AlexeySotkin
Copy link
Contributor Author

This PR fixes #4871

@AlexeySotkin AlexeySotkin marked this pull request as draft November 22, 2021 13:16
@GHGmc2
Copy link

GHGmc2 commented Nov 23, 2021

@AlexeySotkin Thanks, I'll have have try and give feedback soon.

@GHGmc2
Copy link

GHGmc2 commented Nov 26, 2021

@AlexeySotkin ambiguous error when cast bfloat16 to long "error: conversion from 'bfloat16' (aka 'sycl::ext::intel::experimental::bfloat16') to 'long' is ambiguous":

#include <sycl/ext/intel/experimental/bfloat16.hpp>

using bfloat16 = sycl::ext::intel::experimental::bfloat16;

int main() {
  long ret = bfloat16(3.14f);

  return 0;
}

This constructor is being removed to resolve ambiguity when user trying
initialize bfloat16 with int, like
auto a = bfloat16(0);
@AlexeySotkin AlexeySotkin force-pushed the bf16_remove_ctor branch 4 times, most recently from bca94e6 to 3b3a4a7 Compare December 9, 2021 13:41
@AlexeySotkin AlexeySotkin marked this pull request as ready for review December 9, 2021 13:43
@vladimirlaz
Copy link
Contributor

@AlexeySotkin could you please fix the CI failure?

Add conversion operator for sycl::half
Conversion operator for storage_t is replaced by 'raw()' method

Signed-off-by: Alexey Sotkin <[email protected]>
@AlexeySotkin
Copy link
Contributor Author

AlexeySotkin commented Dec 16, 2021

LGTM. Is this something that should be reflected in the extension document?

Yes, but I'd like to have this PR approved first.

@GHGmc2
Copy link

GHGmc2 commented Dec 17, 2021

LGTM

@bader bader merged commit 81154ec into intel:sycl Dec 17, 2021
AlexeySotkin added a commit to AlexeySotkin/llvm that referenced this pull request Dec 30, 2021
Align the document with changes made in intel#4989
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.

[SYCL] error: ambiguous conversion for functional-style cast from 'int' to 'bfloat16' when call bfloat16(0)
6 participants