-
Notifications
You must be signed in to change notification settings - Fork 14
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
Static type checks for Jet::Tensor data #4
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Awesome work! It's not too often you can improve performance and developer productivity at the same time.
Co-authored-by: Mikhail Andrenkov <[email protected]>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Excellent idea!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good to me!
Context:
Users do not get an error message at compile-time if they create a Tensor with an unsupported data type (i.e. not
complex<float>
orcomplex<double>
). they will instead get a runtime error whenJET_ABORT
is called one of the gemm bindings.Description of the Change:
Adds an
is_supported_data_type
type trait template toTensorHelpers
, in the same vein asstd::is_arithmetic
, that has a true value if the template parameter is a supported type.Adds template parameter to disable
MultiplyTensorData
for unsupported typesRemoves
JET_ABORT
calls from gemm bindings, since they are unreachable.Adds a
static_assert
toJet::Tensor
that checks if the templated data typeis supported.
Benefits:
It is now impossible for a user to compile a program using an invalid tensor data type, and there is a clear error message when they attempt to do so.
Possible Drawbacks:
None
Related GitHub Issues: