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

Add f16 dtype support for tensors #423

Closed
Tracked by #577 ...
coreylowman opened this issue Jan 30, 2023 · 8 comments · Fixed by #696
Closed
Tracked by #577 ...

Add f16 dtype support for tensors #423

coreylowman opened this issue Jan 30, 2023 · 8 comments · Fixed by #696
Labels
new feature New feature or request

Comments

@coreylowman
Copy link
Owner

This can use the half crate.

Cuda has many arithmetic functions available for half as seen here

hgemm support depends on coreylowman/cudarc#65

@coreylowman coreylowman added the new feature New feature or request label Jan 30, 2023
@coreylowman
Copy link
Owner Author

See #421 for draft of what adding another dtype looks like

@nkoppel
Copy link
Contributor

nkoppel commented Mar 19, 2023

I've started work on this, but I've encountered a major issue. half doesn't have any integration with rand_distr or vice-versa, so f16 doesn't implement SampleUniform, which is currently required to implement Dtype. To resolve this, either half needs to add rand and rand_distr integration, or we need to add an alias trait for SampleUniform to use internally. The former is definitely preferable, but this may delay the addition of f16 support.

@ViliamVadocz
Copy link
Contributor

@nkoppel How far along are you in the implementation? I am interested in working on the cuda side of things.

@ViliamVadocz
Copy link
Contributor

I've started work on this, but I've encountered a major issue. half doesn't have any integration with rand_distr or vice-versa, so f16 doesn't implement SampleUniform, which is currently required to implement Dtype. To resolve this, either half needs to add rand and rand_distr integration, or we need to add an alias trait for SampleUniform to use internally. The former is definitely preferable, but this may delay the addition of f16 support.

What about making a wrapper for f16 and implementing SampleUniform (and other needed traits)?

@coreylowman
Copy link
Owner Author

I was just looking into this a bit for the half crate, but even when implementing SampleUniform you run into foreign traits. So I think even we did a wrapper type we would need some changes from rand/rand_distr I think

@coreylowman
Copy link
Owner Author

Okay just kidding I was missing something! I have a PR opened in half, so hopefully we can depend on that

@opfromthestart
Copy link
Contributor

Is anyone still working on this? I'd work on it but I wouldn't want to redo things.

@coreylowman
Copy link
Owner Author

I'm not - still waiting on half crate to merge my PR. You can probably start working on this if you use my fork of half with the update

@coreylowman coreylowman mentioned this issue Apr 27, 2023
8 tasks
@coreylowman coreylowman changed the title Add f16/bf16 dtype support for tensors Add f16 dtype support for tensors May 4, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
new feature New feature or request
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants