-
Notifications
You must be signed in to change notification settings - Fork 229
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
dsl: No more dynamic classes for AbstractFunctions #2190
Conversation
Codecov Report
@@ Coverage Diff @@
## master #2190 +/- ##
==========================================
- Coverage 87.10% 87.06% -0.04%
==========================================
Files 226 228 +2
Lines 40197 40299 +102
Branches 7335 7357 +22
==========================================
+ Hits 35014 35088 +74
- Misses 4603 4625 +22
- Partials 580 586 +6
|
Check out this pull request on See visual diffs & provide feedback on Jupyter Notebooks. Powered by ReviewNB |
fd5b167
to
174dc8b
Compare
174dc8b
to
28db13e
Compare
|
||
def __init_finalize__(self, *args, **kwargs): | ||
super(AbstractSparseFunction, self).__init_finalize__(*args, **kwargs) | ||
self._npoint = kwargs['npoint'] | ||
self._npoint = kwargs.get('npoint', kwargs.get('npoint_global')) |
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.
CAn we stick to just one, not sure why we need both.
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.
it's because of issue #1498 . Same story as shape vs shape_global. Here npoint is the decomposed on. But to reconstruct, we need npoint_global.
I think a potentially good, potentially game-changing question to ask ourselves is the following: why, when we reconstruct, do we even care about carrying around the following attribute:
- shape
- data
- distributor
- ...
In other words, I'm now thinking that only the "main" user-constructed should have this info. All other reconstructions get it via .function
if they really need to; but most importantly, since reconstructions are performed by the compiler, and since the compiler doesn't clearly care about shape or data, why the hell do we even need all this maddness?
IOW, TLDR: there might be a subset of attributes that are useless at reconstruction time.
That said, I'm diverging here, perhaps food for thought for another day
28db13e
to
25c856a
Compare
This PR revamps the way AbstractFunctions are created and managed by the runtime.
We stop using dynamic classes for each new AbstractFunction the user creates. This has several advantages:
_hashable_content
, I don't see why this shouldn't be possible. This would be a massive simplification. Anyway, this is for another day.Also:
@ofmla : you bumped into issue #845 at some point. Could you confirm that this PR does indeed fix the issue? It does according to my tests, but having external people reproduce it would make me a bit more comfortable. Thanks anyway!
Fixes #845 #1859