-
Notifications
You must be signed in to change notification settings - Fork 37
Optimize to_rarray to avoid recursion for simple inputs
#140
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
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -445,3 +445,7 @@ end | |
| @inline function to_rarray(@nospecialize(x)) | ||
| return make_tracer(OrderedIdDict(), x, (), Reactant.ArrayToConcrete) | ||
| end | ||
|
|
||
| to_rarray(x::Number) = x # TODO: should this be a `ConcreteRArray{_,0}`? | ||
| to_rarray(x::ConcreteRArray) = x | ||
| to_rarray(x::AbstractArray{<:Number}) = ConcreteRArray(x) | ||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. cc @avik-pal can we make a union type of all the primitive types that Reactant supports conversion into (e.g. int, float, complex float, etc). We should then use this instead of Number here
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. union over https://mlir.llvm.org/docs/Dialects/Builtin/#types? (atleast the ones that are in base)
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Added in #161
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. @gdalle I think we're just waiting for this to get addressed, then lgtm
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. It's merged but we still shouldn't do |
||
Uh oh!
There was an error while loading. Please reload this page.