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

[webgpu] Update EQUAL,GREATER,GREATER_EQUAL,LESS,LESS_EQUAL #7751

Merged
merged 3 commits into from
Jun 27, 2023

Conversation

hujiajie
Copy link
Contributor

To see the logs from the Cloud Build CI, please join either our discussion or announcement mailing list.

Copy link
Collaborator

@gyagp gyagp left a comment

Choose a reason for hiding this comment

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

Can we reuse the code here as the only diff among them is comparison symbol?

@hujiajie
Copy link
Contributor Author

I don't feel it's worth another level of nesting.

Floral_matryoshka_set_2_smallest_doll_nested

@gyagp gyagp requested review from qjia7 and xhcao June 26, 2023 05:21
Copy link
Collaborator

@gyagp gyagp left a comment

Choose a reason for hiding this comment

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

LGTM

@xhcao
Copy link
Collaborator

xhcao commented Jun 26, 2023

Jiajie, I also agree with Yang's comments to reuse the similar code, I like the code as below,
const ZERO = (sign(a) * 0 + 0);
const ONE = (sign(b) * 0 + 1);
const EQUAL = let resultTemp = select(${ZERO}, ${ONE}, a == b);;
const GREATER = let resultTemp = select(${ZERO}, ${ONE}, a > b);;
...

But I am OK if you want to keep your code style.

@hujiajie
Copy link
Contributor Author

Jiajie, I also agree with Yang's comments to reuse the similar code, I like the code as below,
const ZERO = (sign(a) * 0 + 0);
const ONE = (sign(b) * 0 + 1);
const EQUAL = let resultTemp = select(${ZERO}, ${ONE}, a == b);;
const GREATER = let resultTemp = select(${ZERO}, ${ONE}, a > b);;
...

But I am OK if you want to keep your code style.

I have mixed feeling atm, but let me know if anyone has a strong preference. I may consider making that a separate PR afterwards.

@gyagp gyagp merged commit 61ab4e9 into tensorflow:master Jun 27, 2023
2 checks passed
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.

None yet

3 participants