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

Access hardware accelerated vector types #1922

Open
wstevick opened this issue Apr 23, 2023 · 5 comments
Open

Access hardware accelerated vector types #1922

wstevick opened this issue Apr 23, 2023 · 5 comments

Comments

@wstevick
Copy link

I've heard that GPUs are designed to do operations on glsl vec types quickly. So, adding two vec3s takes less then three times as long as adding two floats. I think that OpenCL floatn types are equivalent, so is there a way to write code that uses those in Futhark code? I want to do some ray tracing, and I want my code to be as fast as possible, because of how computationally intensive ray tracing is.

@athas
Copy link
Member

athas commented Apr 24, 2023

There is currently no way to use those in Futhark. We've been reluctant to support them since they don't exist for all our targets. It's definitely something it would be nice to have, though. It's possible we could make them available through an FFI (once we finally get around to adding that as well).

@wstevick
Copy link
Author

You could include vector types, and have the implementation be dependent on the target. So, the vectors could be structs for C, and hardware accelerated vectors for OpenCL. If I understand correctly, that's the same sort of thing as what you did with map and reduce.

@athas
Copy link
Member

athas commented Apr 24, 2023

Yes, but while we already have a mechanism for target-dependent code generation of parallel constructs, we don't have a notion of target-dependent primitive types, so the engineering effort is somewhat larger. The current IR wouldn't even be able to express these types, except as small arrays. It's a design question (even more challenging than an engineering question!) whether that is an appropriate representation. It probably is.

@wstevick
Copy link
Author

I don't have experience with Futhark internals, but I do have experience coding. Let me know if there's anything I can do to help.

@wstevick
Copy link
Author

That being said, I'd have to learn Haskell, so I can't help soon.

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

2 participants