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

DemoteFloat16 pass ignores vectors of Float16 #45881

Closed
vchuravy opened this issue Jun 30, 2022 · 8 comments
Closed

DemoteFloat16 pass ignores vectors of Float16 #45881

vchuravy opened this issue Jun 30, 2022 · 8 comments
Labels
compiler:codegen Generation of LLVM IR and native code compiler:llvm For issues that relate to LLVM domain:float16 kind:bug Indicates an unexpected problem or unintended behavior

Comments

@vchuravy
Copy link
Member

As noticed by @giordano in #40308 (comment), when LLVM decided to vectorize, the demote Float16 pass doesn't trigger. Presumably this is due to

if (Op->getType() == T_float16) {
only checking if it is a T_float16 and not a vector of Float16.

While it is nice that it currently "accidentally" works, since we want on A64FX to trigger the emission of native Float16 operations,
we should fix this bug and simultaneously address #40216

@vchuravy vchuravy added kind:bug Indicates an unexpected problem or unintended behavior compiler:codegen Generation of LLVM IR and native code domain:float16 compiler:llvm For issues that relate to LLVM labels Jun 30, 2022
@vtjnash
Copy link
Sponsor Member

vtjnash commented Jun 30, 2022

This was fixed in #45249, until we decided to say that performance was more important than correctness and reverted it

@vchuravy
Copy link
Member Author

Ah great that we have the code already :) Would have been great if the fixed for the conversion routine and the other correctness fixes were not co-mingled.

@vtjnash
Copy link
Sponsor Member

vtjnash commented Jun 30, 2022

They aren't co-mingled really, you just have to pick a name for the function (or intrinsic) to call here https://github.com/JuliaLang/julia/pull/45249/files#diff-d6a6d037fdf95b0875b7d800187abc42b7ef9abf7004e36ad3ef392655144631R140

@gbaraldi
Copy link
Member

It also ignores @fastmath, not sure if #45249 fixes that however.

@vtjnash
Copy link
Sponsor Member

vtjnash commented Jul 21, 2022

The point of fastmath is to return less correct answers, so this pass isn't needed

@gbaraldi
Copy link
Member

I thought generating float16 instructions when not available was bad, but it seems llvm just adds the conversions if necessary when generating native code

@giordano
Copy link
Contributor

but it seems llvm just adds the conversions if necessary when generating native code

Then why we have the demotion pass in Julia again? 😬

@gbaraldi
Copy link
Member

I don't know :)

@vtjnash vtjnash closed this as completed in eedf3f1 Aug 2, 2022
ffucci pushed a commit to ffucci/julia that referenced this issue Aug 11, 2022
pcjentsch pushed a commit to pcjentsch/julia that referenced this issue Aug 18, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
compiler:codegen Generation of LLVM IR and native code compiler:llvm For issues that relate to LLVM domain:float16 kind:bug Indicates an unexpected problem or unintended behavior
Projects
None yet
Development

No branches or pull requests

4 participants