-
Notifications
You must be signed in to change notification settings - Fork 49
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
feat[next]: extend embedded implementation of premap()
#1501
Conversation
e9d9dc5
to
5e0b16b
Compare
premap()
Co-authored-by: Hannes Vogt <[email protected]>
Co-authored-by: Hannes Vogt <[email protected]>
Co-authored-by: Hannes Vogt <[email protected]>
I tried to fix all mentioned issued but there are still a couple of open points to discuss. Could you do another review pass? |
src/gt4py/next/common.py
Outdated
Examples: | ||
>>> I, J = Dimension("I"), Dimension("J") | ||
>>> domain = Domain(NamedRange(I, UnitRange(0, 10)), NamedRange(J, UnitRange(5, 15))) | ||
>>> domain.slice_at[2, 2:5] |
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 might be confusing that slicing with int behaves different than for fields/arrays as it doesn't reduce rank. Any arguments pro this behavior?
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.
To avoid inconsistencies, slice_at
now only accepts slice
s, not int
s.
new_domain = self.domain.replace(dim_idx, *new_ranges) | ||
# Select actual implementation of the transformation | ||
if not (conn_fields[0].kind & common.ConnectivityKind.TRANSFORM_DATA): | ||
return _domain_premap(self, *conn_fields) |
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.
I think we had a test that didn't use the short-circuit path for Cartesian connectivity, but went through the expensive index->index mapping.
premap()
premap()
Extend the implementation of the
premap
field operation (previously namedremap
, conceptually equivalent to a Contravariant Functor'scontramap
) to support more efficient implementations of different use cases depending on the contents of the connectivity field.Added
gt4py.eve
: new typing aliases and minor utilitiesChanged
gt4py.next.common
:Domain
to support creation of subdomains via slicing using the.slice_at
attribute. The actual implementation comes from the now deletedgt4py.next.embedded.nd_array_field._relative_ranges_to_domain()
function.ConnectivityKind
to represent all known use casesCartesianConnectivity
to support translation and relocationsremap
topremap
gt4py.next.embedded.nd_array_field
:premap()
(oldremap
) and add usage documentation_hypercube()
->_hyperslice()
,_compute_mask_ranges()
->_compute_mask_slices()
Removed
gt4py.next.embedded.nd_array_field
:_relative_ranges_to_domain()
function moved to anDomain
attribute ingt4py.next.common