Skip to content

[Matrix][SYCL] Fix the bug of comparison between two bf16's wi_element #5493

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 2 commits into from
Feb 9, 2022

Conversation

yubingex007-a11y
Copy link
Contributor

Previously, as for bf16's comparison, we directly compare two unsigned short and it is wrong.
Now, we extend b16 to float and do the correct comparsion.

dkhaldi
dkhaldi previously approved these changes Feb 7, 2022
Copy link
Contributor

@dkhaldi dkhaldi left a comment

Choose a reason for hiding this comment

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

LGTM

@yubingex007-a11y
Copy link
Contributor Author

@intel/llvm-reviewers-runtime ping

@@ -477,8 +477,8 @@ class wi_element<uint16_t, NumRows, NumCols, Layout, Group> {

explicit operator bool() {
#ifdef __SYCL_DEVICE_ONLY__
return __spirv_VectorExtractDynamic(M.spvm, idx) !=
static_cast<uint16_t>(0);
return std::fabs(make_fp32(__spirv_VectorExtractDynamic(M.spvm, idx))) <
Copy link
Contributor Author

@yubingex007-a11y yubingex007-a11y Feb 8, 2022

Choose a reason for hiding this comment

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

it seems element_wise_all_ops_bf16_yubing_20220128.cpp failed on this line.
when I change to
make_fp32(__spirv_VectorExtractDynamic(M.spvm, idx)) != 0.0f;
the testcase can pass
@AlexeySotkin , what should we do for operator bool()?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

we use ">=" instead of "<"

@yubingex007-a11y
Copy link
Contributor Author

ping? @dkhaldi

@yubingex007-a11y
Copy link
Contributor Author

@intel/llvm-reviewers-runtime ping

Copy link
Contributor

@dkhaldi dkhaldi left a comment

Choose a reason for hiding this comment

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

LGTM

@yubingex007-a11y
Copy link
Contributor Author

@vladimirlaz , hi, could you help us merge it ?

@vladimirlaz vladimirlaz merged commit 852f414 into intel:sycl Feb 9, 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