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

[Breaking] Adds AMP<F> dtype #811

Merged
merged 13 commits into from
Jul 26, 2023
Merged

[Breaking] Adds AMP<F> dtype #811

merged 13 commits into from
Jul 26, 2023

Conversation

coreylowman
Copy link
Owner

@coreylowman coreylowman commented Jul 12, 2023

Resolves #424

  • [Breaking] Moves Unit/Dtype to new dtypes module
  • Adds dfdx::dtypes::AMP<F>
  • impl Device<AMP<f16>> for Cpu/Cuda`

Ops that cast up to f32 internally:

  • sum_to
  • adam
  • sgd
  • rmsprop

Other ops may be auto cast in the future.

@nkoppel
Copy link
Contributor

nkoppel commented Jul 12, 2023

I'm curious: why struct Amp<F>(F) rather than struct Amp(f16)? Are there plans to support Amp<f32> as well? If not, the generic should be removed in my opinion.

src/dtypes/amp.rs Outdated Show resolved Hide resolved
@coreylowman
Copy link
Owner Author

I'm curious: why struct Amp<F>(F) rather than struct Amp(f16)? Are there plans to support Amp<f32> as well? If not, the generic should be removed in my opinion.

@nkoppel I was thinking we could have AMP<bf16> as well, but I don't actually know if that is done in practice. If not, we can move to what you suggest. Can you check if anyone does that?

@nkoppel
Copy link
Contributor

nkoppel commented Jul 13, 2023

PyTorch supports it, as seen here, so it makes sense to leave room to do that. Might it make sense to use a type alias to refer to AMP<f16> named something like AMP16 to make this easier to use?

@coreylowman
Copy link
Owner Author

👍 to type aliases

@coreylowman coreylowman changed the title [WIP] Adds AMP<F> dtype Adds AMP<F> dtype Jul 26, 2023
@coreylowman coreylowman changed the title Adds AMP<F> dtype [Breaking] Adds AMP<F> dtype Jul 26, 2023
@coreylowman coreylowman merged commit 0b49672 into main Jul 26, 2023
8 checks passed
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

Successfully merging this pull request may close these issues.

Add AMP dtype
2 participants