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

value.cpp: fix some issues #2338

Open
wants to merge 2 commits into
base: main
Choose a base branch
from
Open

Conversation

makigumo
Copy link
Contributor

@makigumo makigumo commented Feb 3, 2025

The old implementation didn't look right, so this is what I assume to be the intended behavior.

@raphaelthegreat
Copy link
Collaborator

raphaelthegreat commented Feb 3, 2025

Comparison of floats is still a bitwise comparison. An IR::Value is a typed union of various values so comparing u16 for both f16 and u16 is perfectly fine. It is technically undefined behavior, because c++ only permits accessing the intended member, but its behavior that is expected to work by basically everyone. So while I agree this is not UB (and better than before), the old implement was still fine. That usage of attribute in Type::U1 looks like a bug tho lol

@makigumo
Copy link
Contributor Author

makigumo commented Feb 3, 2025

As far as I can see there is currently no imm_f16 to do a meaningful compare/hash, that's why I moved the Type::F16 cases down. But I may be wrong.

@raphaelthegreat
Copy link
Collaborator

raphaelthegreat commented Feb 3, 2025

F16 immediates are not used anywhere to my knowledge anyway. F16 type only exists for pack/unpack operations that operate on F16. GCN2 doesn't have proper F16 support seems

@squidbus
Copy link
Collaborator

squidbus commented Feb 4, 2025

Not sure if we want to move forward with this or not based on comments, although F16 case should probably remain comparing the u16 immediates since there's no native float alternative.

@makigumo
Copy link
Contributor Author

makigumo commented Feb 4, 2025

Restored the previous behavior regarding Type::F16.

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