-
Notifications
You must be signed in to change notification settings - Fork 40
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
log1p
fails on MtlArray{Float32}
#234
Comments
No easy ones, sorry. You could try to find a different implementation of this operation that doesn't require wider temporaries. |
Thanks, @maleadt. Do you think that this will fail on CUDA/AMDGPU? I am asking because it is used by some operations in Flux, so this might be a relevant issue for them too. |
Do you think a patch similar to this would be appropriate? |
Yes, it would. cc @oscardssmith (I mentioned this being a problem at JuliaCon) |
how much accuracy are you willing to lose? I can probably cook you up a FLoat32 only one that performs pretty well at the cost of slightly lower accuracy (probably in the 2-4 ULP area). |
If the only problem is the implementation of log_proc2, there is a single precision implementation in the original paper (p.385-386). But I think there is another Float64 cast in log_proc1 too |
oh, I think it's possible that the double precision casts may not be necessary at all. The biggest difference between our algorithm and Tang's is that we add an extra multiply at the end to account for the different base logs and that multiply may have a bunch of error without the extended precision. Would be good to try the version that doesn't upcast though... |
I made an attempt to re-write the functions without using double precision floats #236 I tried in a REPL and the functions seem to work, however using them in Metal with |
This raises
InvalidIRError [...] Reason: unsupported unsupported use of double value
The Julia Base implementation for
log_proc2(::Float32)
has some internal computation usingFloat64
and then downcasts it toFloat32
. Is this a known bug / any ideas for mitigating this?Stack trace
Julia version: 1.9.2
Metal version: 0.5.0
The text was updated successfully, but these errors were encountered: