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

Support f32 as calculation & output type #6

Open
aabizri opened this issue Jan 26, 2020 · 3 comments
Open

Support f32 as calculation & output type #6

aabizri opened this issue Jan 26, 2020 · 3 comments

Comments

@aabizri
Copy link

aabizri commented Jan 26, 2020

First of all, congrats and thanks for the crate !

I'm currently using fasteval in a computer graphics project, and in that world, f64 or double-precision numbers are very rarely used: not only is the precision often unnecessary but it makes GPUs much slower (often by 2x) as GPUs are big SIMD/T machines and can pack 2 times more f32 instructions than f64 per cycle, and I suppose this is the same for SIMD in CPUs.

This could be an easier step towards full SIMD use within the crate, though I haven't implemented it as a PoC.

Currently I'm converting the f64 to f32 before sending it to the GPU but I think this inefficiency may be a nice optimization, and a good step towards the milestone of supporting arbitrary-precision numbers.

@likebike
Copy link
Owner

Great idea. I'll add f32 to the list in #7 .

@adamsky
Copy link

adamsky commented Sep 23, 2020

I've had a go at this recently, using num-traits to create a more generic representation of the float to support both f32 or f64. Let me know if this is something you would consider pulling in, or what you think might be a better approach to tackle it. Here's the repo: https://github.com/adamsky/fasteval/tree/f32

@likebike
Copy link
Owner

Thanks Adam! I'll review the changes when I get some time. They look really nice. When I review, I will mainly be thinking about whether the same thing can be achieved without adding a dependency.

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

No branches or pull requests

3 participants