Refactor math_ops.cu dispatcher logic #18006
Open
+112
−211
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Description
Refactors the type-dispatcher logic and cleans up the code in
math_ops.cu
for unary operations.The 3 of the 4 dispatch functors had the same logic except for the supported types SFINAE clause.
Also correcting the code for handling RINT properly created a 4th common functor.
These have been refactored into a single functor and separated from the supported-types checks.
The single functor now excepts the transform function as well as the supported-types expression.
Also, the 2nd dispatcher call for dictionary was replaced with an if-statement to help simplify the code and minimize maintenance syncing up the supported-types clauses correctly.
One side effect is that more ops are now supported appropriately with dictionary types.
Referenced cleanup needed here: #17560 (comment)
Checklist