+
Skip to content

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.

@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
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

点击 这是indexloc提供的php浏览器服务,不要输入任何密码和下载