compiler: compute sparse position/floor in fp64 to fix off-by-one cell shift - #2992
compiler: compute sparse position/floor in fp64 to fix off-by-one cell shift#2992mloubout wants to merge 0 commit into
Conversation
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #2992 +/- ##
===========================================
- Coverage 83.54% 52.35% -31.20%
===========================================
Files 257 257
Lines 53922 53952 +30
Branches 4613 4619 +6
===========================================
- Hits 45050 28245 -16805
- Misses 8074 24704 +16630
- Partials 798 1003 +205
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
24006cd to
04411cd
Compare
|
Check out this pull request on See visual diffs & provide feedback on Jupyter Notebooks. Powered by ReviewNB |
1ad6fd3 to
038d26b
Compare
FabioLuporini
left a comment
There was a problem hiding this comment.
I think the main question that I have is: why not inlining DOUBLE(...) casts directly when building the interpolation operation? why is this implemented via hoisting into fp64 scalars?
| yield self._do_generate(exprs, exclude, cbk_search) | ||
|
|
||
|
|
||
| def _is_floor(e): |
There was a problem hiding this comment.
this is quite hacky, let the search look for the specific type if it really needs to be that specific
|
|
||
| # Predicate on Cluster used to pick which ones this pass fires on. | ||
| # Subclasses override to target a different kind of cluster. | ||
| _cluster_filter = staticmethod(lambda c: c.is_dense) |
There was a problem hiding this comment.
why don't we always do it with all floors (and maybe not just that), be it dense or sparse ?
There was a problem hiding this comment.
so why do we need this _cluster_filter at all?
There was a problem hiding this comment.
- Foir the standard pass that is for dense cluster
- For easier extension/specialization in the future
There was a problem hiding this comment.
I'm not sure agree. If you restrict it to dense clusters, for example, divisions won't be hoisted anymore in sparse clusters. And imho it doesn't make much sense that the base CireInvariants class restricts to dense; if anything, it should be selected subclasses
There was a problem hiding this comment.
This isn't new only lifted. It always have filtered to dense but can change it if you want but it's gonna change probably a lot of tests
| issubclass(k.dtype, np.integer)): | ||
| continue | ||
| inner = k.base | ||
| if _is_floor(inner) and (v.free_symbols & aliaseds): |
There was a problem hiding this comment.
instead of just floors, we could name this class CireInvariantGeometry or something like that, and have it target all step-wise math operations that are so accuracy-sensitive
you could have for example a _types class attribute, and use it here
da61a3e to
173da0d
Compare
| out of an inner loop is a strict win regardless of the cluster kind. | ||
| """ | ||
|
|
||
| _cluster_filter = staticmethod(lambda c: True) |
There was a problem hiding this comment.
same here... not sure we need it
a8550da to
dd910c8
Compare
| else: | ||
| # E.g., `x0_blk0` or (`a[y_m+1]` => `y not in imapper`) | ||
| # E.g., `x0_blk0` (outer to writeto, must stay in ispace | ||
| # so later passes -- `Lift`, `Fuse` -- see it) |
There was a problem hiding this comment.
it's not that "so later passes see it", it's that w/o it, it'd be wrong
|
|
||
| # Predicate on Cluster used to pick which ones this pass fires on. | ||
| # Subclasses override to target a different kind of cluster. | ||
| _cluster_filter = staticmethod(lambda c: c.is_dense) |
There was a problem hiding this comment.
I'm not sure agree. If you restrict it to dense clusters, for example, divisions won't be hoisted anymore in sparse clusters. And imho it doesn't make much sense that the base CireInvariants class restricts to dense; if anything, it should be selected subclasses
| """ | ||
|
|
||
| PAR_CHUNK_NONAFFINE = 3 | ||
| PAR_CHUNK_NONAFFINE = 1 |
There was a problem hiding this comment.
why, this is an important change
| assert summary1[('section0', None)].ops == 9 | ||
| assert summary1[('section1', None)].ops == 9 | ||
| assert summary1[('section2', None)].ops == 31 | ||
| assert summary1[('section3', None)].ops == 46 |
There was a problem hiding this comment.
that's a lot of code changes...
0e461ab to
74f833a
Compare
915bc6d to
110463b
Compare
The lifiting is implemented as a Cire pass this way it'll catch generic floor/... as well