Skip to content
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

Implements a reindexing transformation #636

Open
wants to merge 4 commits into
base: main
Choose a base branch
from

Conversation

kaushikcfd
Copy link
Collaborator

@kaushikcfd kaushikcfd commented Jun 26, 2022

The implementation here is based on the paper "Memory optimization by counting points in integer transformations of parametric polytopes".

Draft because:

  • Incomplete Implementation
    • Needs pw_qpolynomial_to_expr
    • Cleanup
  • Needs tests

@inducer
Copy link
Owner

inducer commented Jun 26, 2022

That academia.edu link doesn't seem to work.

@kaushikcfd
Copy link
Collaborator Author

That academia.edu link doesn't seem to work.

Oops thanks, fixed!

@kaushikcfd kaushikcfd force-pushed the loechner_reindexing branch 6 times, most recently from 7408b01 to dbe1ded Compare June 27, 2022 03:23
@kaushikcfd kaushikcfd marked this pull request as ready for review June 27, 2022 03:24
@kaushikcfd kaushikcfd force-pushed the loechner_reindexing branch 5 times, most recently from ef0781d to 794b7cc Compare June 28, 2022 20:42
Copy link
Owner

@inducer inducer left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM! A few concerns, nothing major. Good to merge once those are resolved.

doc/ref_transform.rst Outdated Show resolved Hide resolved
loopy/symbolic.py Outdated Show resolved Hide resolved
Comment on lines 235 to 236
caller that the returned kernel object would be a derivative of GPL
licensed work.
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That doesn't quite match my understanding of how that works. It's the transform code that is a derivative of a GPL work.

Copy link
Collaborator Author

@kaushikcfd kaushikcfd Jul 6, 2022

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Neither this code nor the a code that is distributed and unconditionally uses this routine becomes GPL is my understanding. I've included a note as a comment highlighting this. Dropped this warning/function argument altogether.

loopy/transform/reindexing.py Outdated Show resolved Hide resolved
Comment on lines 40 to 41
ISLMapT = Union[isl.BasicMap, isl.Map]
ISLSetT = Union[isl.BasicSet, isl.Set]
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

So far, we've reserved T suffix types for type variables, with (some?) consistency. Maybe just ISLMap? Or ISLMapLike? Reading more below, I think we want both the variable-and non-variable versions.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

with (some?) consistency

I don't think that's true:

loopy/loopy/typing.py

Lines 30 to 38 in 34c7344

IntegralT = Union[int, np.int8, np.int16, np.int32, np.int64, np.uint8,
np.uint16, np.uint32, np.uint64]
FloatT = Union[float, complex, np.float32, np.float64, np.complex64,
np.complex128]
ExpressionT = Union[IntegralT, FloatT, Expression]
ShapeType = Tuple[ExpressionT, ...]
StridesType = ShapeType

loopy/transform/reindexing.py Outdated Show resolved Hide resolved
loopy/transform/reindexing.py Outdated Show resolved Hide resolved
loopy/transform/reindexing.py Outdated Show resolved Hide resolved
loopy/transform/reindexing.py Outdated Show resolved Hide resolved
return isl_map


def _get_seghir_loechner_reindexing_from_range(access_range: ISLSetT
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There is a potential ambiguity here in terms of variable ordering. Is that something we should expose to the user? (One floor up we could try to look at the strides, though we're out of luck if those are symbolic, at which point it's back to user input.)

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm not sure I get the ambiguity here. Irrespective of the variable ordering the access ranges should be the same, right?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants