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

Map domain transformation v2 #478

Merged
merged 44 commits into from
Sep 6, 2021
Merged
Changes from 1 commit
Commits
Show all changes
44 commits
Select commit Hold shift + click to select a range
f719cfb
add map_domain to loopy init
jdsteve2 Aug 5, 2021
2780237
copy in map_domain funcs from old branch (add-map-domain-transformation)
jdsteve2 Aug 5, 2021
e5edf40
define add_and_name_isl_dims and add_eq_isl_constraint_from_names loc…
jdsteve2 Aug 5, 2021
c6320d8
define ensure_dim_names_match_and_align locally for now (previously w…
jdsteve2 Aug 5, 2021
34b7d8f
remove FIXME now that dim_type usage is consistent
jdsteve2 Aug 10, 2021
62d711b
add better encapsulation for case where domain map has fewer dims tha…
jdsteve2 Aug 10, 2021
05acfbe
improve var names and error message related to mismatching of transfo…
jdsteve2 Aug 10, 2021
8b3195f
test map_domain cases where there is a mismatch between the inames in…
jdsteve2 Aug 10, 2021
6ee3cf0
enforce that transform map in map_domain must apply to exactly one do…
jdsteve2 Aug 11, 2021
f5b2257
test map validity checking/errors in map_domain
jdsteve2 Aug 11, 2021
fddd305
remove map applicability logic from process_set
jdsteve2 Aug 11, 2021
be524ff
update expected error string for map_domain test
jdsteve2 Aug 11, 2021
3add15b
Merge branch 'main' into map-domain-transformation-v2
jdsteve2 Aug 13, 2021
e5b765c
remove arg from map_domain
jdsteve2 Aug 13, 2021
c0a613c
in map_domain, error if there are any loop priorities/nest constraint…
jdsteve2 Aug 13, 2021
88ebe1a
add test for map_domain error when there are any loop priorities/nest…
jdsteve2 Aug 13, 2021
13356df
in map_domain, rename isl_map->transform_map; add docstring
jdsteve2 Aug 14, 2021
ab6076a
clean up code for map_domain; clarify error message a bit
jdsteve2 Aug 27, 2021
d710f8d
add map_domain test for handling of case where stmt.within_inames con…
jdsteve2 Aug 27, 2021
48e2c9a
clarify comment in map_domain
jdsteve2 Aug 27, 2021
6e7951a
remove fixme
jdsteve2 Aug 28, 2021
061a8ec
clean up and document _apply_identity_for_missing_map_dims
jdsteve2 Aug 28, 2021
fc0e265
document _error_if_any_iname_in_constraint
jdsteve2 Aug 28, 2021
aee9c83
minor changes to error messages in _MapDomainMapper and _find_aff_sub…
jdsteve2 Aug 28, 2021
468819d
vim fold markers for map_domain and associated functions
jdsteve2 Aug 28, 2021
1073f99
final cleanup of map_domain functions
jdsteve2 Aug 28, 2021
e2ff759
Update loopy/transform/iname.py
jdsteve2 Aug 31, 2021
4ce6c7a
Update loopy/transform/iname.py
jdsteve2 Aug 31, 2021
dbc3954
Merge branch 'main' into map-domain-transformation-v2
jdsteve2 Aug 31, 2021
a1534bd
move add_and_name_isl_dims, add_eq_isl_constraint_from_names, and fin…
jdsteve2 Aug 31, 2021
3281b76
rename isl_map to isl_obj when sets are also allowed; remove comments…
jdsteve2 Aug 31, 2021
c7ac1f2
docstrings for add_and_name_isl_dims, add_eq_isl_constraint_from_name…
jdsteve2 Aug 31, 2021
693ee86
remove unnecessary variable renaming in add_and_name_dims
jdsteve2 Aug 31, 2021
b8c3400
since find_and_rename_dim is only used for one dim type at a time, ma…
jdsteve2 Aug 31, 2021
9801d1c
more detailed documentation for _apply_identity_for_missing_map_dims
jdsteve2 Aug 31, 2021
09703eb
in map_domain, don't recompute subst_from_map for no reason
jdsteve2 Aug 31, 2021
3d24d43
use auto_test_vs_ref in test_map_domain_vs_split_iname
jdsteve2 Aug 31, 2021
6594873
use get_attr instead of try/except to check for loop_nest_constraints…
jdsteve2 Aug 31, 2021
9404594
shrink problem size to make test_map_domain_transform_map_validity_an…
jdsteve2 Aug 31, 2021
8188649
use same loop prioritization regardless of whether we're using priori…
jdsteve2 Sep 1, 2021
434f04b
further clarification in comments about purpose of some map-domain tests
jdsteve2 Sep 1, 2021
332ebf5
tell pylint to chill out about a missing attribute
jdsteve2 Sep 1, 2021
6e1f1d9
tell pylint to chill out about a missing attribute
jdsteve2 Sep 1, 2021
19a3802
fixing merge conflicts
jdsteve2 Sep 2, 2021
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
define add_and_name_isl_dims and add_eq_isl_constraint_from_names loc…
…ally for now (previously were defined in schedule checking utils before this code was moved to independent branch)
jdsteve2 committed Aug 5, 2021
commit e5edf400ca070ca98fd9aed30673383eeac35996
44 changes: 32 additions & 12 deletions loopy/transform/iname.py
Original file line number Diff line number Diff line change
@@ -1939,10 +1939,38 @@ def _find_aff_subst_from_map(iname, isl_map):
raise LoopyError("no suitable equation for '%s' found" % iname)


# TODO to match convention elsewhere, swap 'dt' and 'dim_type' identifiers
# FIXME to match convention elsewhere, swap 'dt' and 'dim_type' identifiers
# (use dt to abbreviate islpy.dim_type, and use dim_type for variables
# containing a specific dim_type)

def _add_and_name_isl_dims(isl_map, dt, names):
# (This function is also defined in independent, unmerged branch
# statement-instance-order-and-lex-order-map, and used in child branches
# thereof. Once these branches are all merged, it may make sense to move
# this function to a location for more general-purpose machinery. In the
# other branches, this function's name excludes the leading underscore.)
new_idx_start = isl_map.dim(dt)
new_map = isl_map.add_dims(dt, len(names))
for i, name in enumerate(names):
new_map = new_map.set_dim_name(dt, new_idx_start+i, name)
return new_map


def _add_eq_isl_constraint_from_names(isl_map, var1, var2):
# (This function is also defined in independent, unmerged branch
# statement-instance-order-and-lex-order-map, and used in child branches
# thereof. Once these branches are all merged, it may make sense to move
# this function to a location for more general-purpose machinery. In the
# other branches, this function's name excludes the leading underscore.)

# add constraint var1 = var2

return isl_map.add_constraint(
isl.Constraint.eq_from_names(
isl_map.space,
{1: 0, var1: 1, var2: -1}))


def _find_and_rename_dim(old_map, dim_types, old_name, new_name):
# (This function is only used once here, but do not inline it; it is used many
# times in child branch update-dependencies-during-transformations.)
@@ -2008,10 +2036,6 @@ def map_domain(kernel, isl_map, within=None):

# }}}

from loopy.schedule.checker.utils import (
add_and_name_isl_dims,
)

def process_set(s):
var_dict = s.get_var_dict()

@@ -2027,10 +2051,6 @@ def process_set(s):
"either involve all or none of the map domain "
"inames." % s)

from loopy.schedule.checker.utils import (
add_eq_isl_constraint_from_names,
)

# {{{ align dims of isl_map and s

# FIXME: Make this less gross
@@ -2047,7 +2067,7 @@ def process_set(s):
dims_missing_from_transform_map = list(
set(s.get_var_names(dim_type.set)) -
set(isl_map.get_var_names(dim_type.in_)))
augmented_isl_map = add_and_name_isl_dims(
augmented_isl_map = _add_and_name_isl_dims(
isl_map, dim_type.in_, dims_missing_from_transform_map)

# We want these missing inames to map to themselves so that the transform
@@ -2061,14 +2081,14 @@ def process_set(s):
assert not set(dims_missing_from_transform_map_proxies) & set(
augmented_isl_map.get_var_dict().keys())

augmented_isl_map = add_and_name_isl_dims(
augmented_isl_map = _add_and_name_isl_dims(
augmented_isl_map, dim_type.out, dims_missing_from_transform_map_proxies)

# Set proxy iname equal to real iname
for proxy_iname, real_iname in zip(
dims_missing_from_transform_map_proxies,
dims_missing_from_transform_map):
augmented_isl_map = add_eq_isl_constraint_from_names(
augmented_isl_map = _add_eq_isl_constraint_from_names(
augmented_isl_map, proxy_iname, real_iname)

# }}}