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

Statement instance order and lex order map #479

Draft
wants to merge 409 commits into
base: main
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
409 commits
Select commit Hold shift + click to select a range
6d336ba
make function for duplicated code: _conjunction_of_dim_eq_conditions()
jdsteve2 Jul 20, 2020
a81bd48
rename get_concurrent_inames(knl)->partition_inames_by_concurrency(knl)
jdsteve2 Jul 20, 2020
be1cf81
to prevent quadratic complexity in schedule creation, create lex poin…
jdsteve2 Jul 21, 2020
4211f6e
add todo
jdsteve2 Jul 24, 2020
a4e790f
while removing unnecessary dims in maps, also replace int-valued dims…
jdsteve2 Jul 26, 2020
80a89ea
Remove logic avoiding gratuitous incrementing of integer lex dim valu…
jdsteve2 Jul 27, 2020
3dd9327
make generate_pairwise_schedules() return a dictionary mapping (insn_…
jdsteve2 Jul 27, 2020
37b0ef3
fix merge conflicts
jdsteve2 Jul 27, 2020
67887d3
update sio test to deal with new output from get_schedules_for_statem…
jdsteve2 Jul 27, 2020
81dd0ee
add independent test for lex order map creation
jdsteve2 Jul 27, 2020
a4ff29d
minor comment change
jdsteve2 Jul 27, 2020
d44082f
Merge branch 'master' into lexschedule-and-map-creation
jdsteve2 Jul 28, 2020
86c3ff9
When simplifying pairs of lex tuples before map creation, once a dime…
jdsteve2 Aug 3, 2020
39ec3c4
instead of operating on Xbefore and Xafter pairs in pairs of statemen…
jdsteve2 Aug 3, 2020
aac217f
Merge branch 'lexschedule-and-map-creation' into statement-instance-o…
jdsteve2 Aug 3, 2020
5f060a8
reduce the number of dims expected in lex maps after update that simp…
jdsteve2 Aug 3, 2020
6bb6989
fix flake8 issue
jdsteve2 Aug 3, 2020
4165485
remove get_islvars_from_space(); instead use isl.affs_from_space()
jdsteve2 Aug 3, 2020
3f4b3b8
make example usage of get_schedules_for_statement_pairs() into a doct…
jdsteve2 Aug 4, 2020
de5ab44
update all docstrings/comments after recent changes
jdsteve2 Aug 4, 2020
5551fd9
remove unused arg (knl) from get_EnterLoop_inames()
jdsteve2 Aug 4, 2020
222b0c7
use list comprehension instead of loop in get_EnterLoop_inames()
jdsteve2 Aug 4, 2020
f1e31d5
temporarily add an assert-false to check for unnecessary functionality
jdsteve2 Aug 4, 2020
16da1c3
Merge branch 'lexschedule-and-map-creation' into statement-instance-o…
jdsteve2 Aug 4, 2020
8001bd6
handle special case where simplified lex tuples are empty (means stat…
jdsteve2 Aug 4, 2020
94b128e
Merge branch 'lexschedule-and-map-creation' into statement-instance-o…
jdsteve2 Aug 4, 2020
567c405
don't add missing dims when aligning domain for intersection in creat…
jdsteve2 Aug 4, 2020
6aa31e4
Merge branch 'lexschedule-and-map-creation' into statement-instance-o…
jdsteve2 Aug 4, 2020
3d321ae
more precise docstring for reorder_dims_by_name()
jdsteve2 Aug 4, 2020
0f18579
make doctest output invalid to see if it fails ci test
jdsteve2 Aug 4, 2020
503247d
undo intentionally incorrect doctest output, also add line break to p…
jdsteve2 Aug 4, 2020
2504e3a
try another approach to handling broken lines in expected doctest res…
jdsteve2 Aug 4, 2020
0d77423
workaround for dumb doctest that can't handle expected output split u…
jdsteve2 Aug 4, 2020
f39b82f
Merge branch 'lexschedule-and-map-creation' into statement-instance-o…
jdsteve2 Aug 11, 2020
049d17b
Apply 1 suggestion(s) to 1 file(s)
jdsteve2 Aug 28, 2020
15f0855
Apply 1 suggestion(s) to 1 file(s)
jdsteve2 Aug 28, 2020
2f583e5
Apply 1 suggestion(s) to 1 file(s)
jdsteve2 Aug 28, 2020
05d5706
Apply 1 suggestion(s) to 1 file(s)
jdsteve2 Aug 28, 2020
8a882e0
Apply 1 suggestion(s) to 1 file(s)
jdsteve2 Aug 28, 2020
0985a6b
Apply 1 suggestion(s) to 1 file(s)
jdsteve2 Aug 28, 2020
88557ee
Apply 1 suggestion(s) to 1 file(s)
jdsteve2 Aug 28, 2020
5f9d429
Apply 1 suggestion(s) to 1 file(s)
jdsteve2 Aug 28, 2020
0b19941
Apply 1 suggestion(s) to 1 file(s)
jdsteve2 Aug 28, 2020
a6ab09d
change _lp_linchk_statement->_lp_linchk_stmt in doctest after renamin…
jdsteve2 Aug 28, 2020
852ba31
change map_names_match_check->check_that_map_names_match after renami…
jdsteve2 Aug 28, 2020
88f23ea
rephrase docstring for linearization_items argument (the part about a…
jdsteve2 Aug 28, 2020
d72e653
assert that all concurrent EnterLoop inames are tagged Vec or ILP, an…
jdsteve2 Aug 28, 2020
559f778
simplify phrasing of insn_id_pairs arg description (to match phrasing…
jdsteve2 Aug 28, 2020
b992340
move function defs for _pad_tuple_with_zeros() and _simplify_lex_dims…
jdsteve2 Aug 28, 2020
0921a33
remove faulthandler stuff
jdsteve2 Aug 28, 2020
237e7d6
remove redundant lang_version
jdsteve2 Aug 28, 2020
74f9ee4
test_lexschedule_creation(), make kernel instruction/loop order deter…
jdsteve2 Aug 28, 2020
7d34e95
replace call to check_that_map_names_match() with equivalent assertio…
jdsteve2 Sep 2, 2020
6f6d708
make stronger assertion in reorder_dims_by_name (just assert that set…
jdsteve2 Sep 2, 2020
ee4faf0
remove check_that_map_names_match(), replace function call with asser…
jdsteve2 Sep 2, 2020
b8edba9
Apply 1 suggestion(s) to 1 file(s)
inducer Sep 4, 2020
8421640
Merge branch 'lexschedule-and-map-creation' into 'new-dependency-and-…
inducer Sep 4, 2020
b6cdf54
Merge branch 'new-dependency-and-nest-constraint-semantics-developmen…
jdsteve2 Sep 25, 2020
913049e
Merge branch 'new-dependency-and-nest-constraint-semantics-developmen…
jdsteve2 Sep 25, 2020
9ab0a22
rename get_lex_order_constraint->get_lex_order_set; lots of documenat…
jdsteve2 Sep 28, 2020
7ca6265
Merge branch 'master' into new-dependency-and-nest-constraint-semanti…
jdsteve2 Sep 29, 2020
6ee54c3
Merge branch 'master' into statement-instance-order-and-lex-order-map
jdsteve2 Sep 29, 2020
4970268
Merge branch 'master' into new-dependency-and-nest-constraint-semanti…
jdsteve2 Nov 10, 2020
998c52e
Merge branch 'new-dependency-and-nest-constraint-semantics-developmen…
jdsteve2 Nov 10, 2020
19147d6
Merge branch 'new-dependency-and-nest-constraint-semantics-developmen…
jdsteve2 Jan 25, 2021
4081b9d
Merge branch 'new-dependency-and-nest-constraint-semantics-developmen…
jdsteve2 Jan 25, 2021
272c679
Merge branch 'new-dependency-and-nest-constraint-semantics-developmen…
jdsteve2 Jan 25, 2021
fb7ed28
Merge branch 'master' into new-dependency-and-nest-constraint-semanti…
jdsteve2 Feb 23, 2021
177dd45
Merge branch 'new-dependency-and-nest-constraint-semantics-developmen…
jdsteve2 Feb 23, 2021
9cd492d
moved lex order map creation into schedule generation func to avoid d…
jdsteve2 Feb 25, 2021
bc748a1
add create_elementwise_comparison_conjunction_set() function from chi…
jdsteve2 Feb 26, 2021
24c8b68
add dims to lex space for parallel (gid/lid) loops; in lex order map,…
jdsteve2 Feb 26, 2021
ac6aec9
fix flake8 issue
jdsteve2 Feb 26, 2021
4123289
correct order of var names passed to isl.make_zero_and_vars()
jdsteve2 Feb 28, 2021
35968a1
reduce duplicated code by adding/improving helper functions; test lex…
jdsteve2 Feb 28, 2021
fc9576d
stop checking lex map accuracy in _check_sio_for_stmt_pair() (it's al…
jdsteve2 Feb 28, 2021
fbba347
started work on test for SIO with parallel kernel (commented out for …
jdsteve2 Feb 28, 2021
f408c86
set parallel inames equal to corresponding gid/lid var names in sched…
jdsteve2 Mar 4, 2021
bef84a6
make SIO map strings more concise
jdsteve2 Mar 4, 2021
e15ddae
update doctest
jdsteve2 Mar 4, 2021
6af1b23
remove commented-out code
jdsteve2 Mar 4, 2021
2740c3d
fix typo in doctest
jdsteve2 Mar 4, 2021
5a58c4e
Create lex order maps and SIOs in same function as sched creation (ra…
jdsteve2 Mar 21, 2021
c2e83e1
start incorporating the bulk of the new blex order/map functionality;…
jdsteve2 Mar 22, 2021
56cb555
rename blex related variables to lblex since they will need to be sep…
jdsteve2 Mar 22, 2021
111ed53
return sched maps for both lex and lblex orderings; collect params fo…
jdsteve2 Mar 22, 2021
0c3890d
(WIP) create separate global barrier sio map
jdsteve2 Mar 23, 2021
59a8293
create helper functions add_and_name_isl_dims(), add_eq_isl_constrain…
jdsteve2 Mar 24, 2021
d28a031
don't try to deal with appending conc dims inside get_lex_order_set/m…
jdsteve2 Mar 24, 2021
805cab4
rename add_dims_to_isl_set()->insert_and_name_isl_dims()
jdsteve2 Mar 24, 2021
98aef7c
for lblex map, constrain gids to be equal
jdsteve2 Mar 24, 2021
54a8364
minor cleanup
jdsteve2 Mar 24, 2021
4ab33df
make returning schedules optional; default to just sio
jdsteve2 Mar 24, 2021
80fa247
(WIP) initial first test for schedules w/barriers
jdsteve2 Mar 24, 2021
528303c
use isl.Map.get_var_dict() to compare all dim names more concisely
jdsteve2 Mar 24, 2021
8287ef4
undo previous (broken) change: don't force all dims to be in the same…
jdsteve2 Mar 24, 2021
7b7169c
distinguish between the number of blex dims with and without parallel…
jdsteve2 Mar 24, 2021
295f644
make a sched/sio test for case with local barriers
jdsteve2 Mar 24, 2021
f8020e2
in ensure_dim_names_match_and_align(), raise informative error when m…
jdsteve2 Mar 25, 2021
df5192a
add todo to fix doctest
jdsteve2 Mar 25, 2021
96d4c21
further lbarrier sio tests; also improve testing code with better hel…
jdsteve2 Mar 25, 2021
46e1bb1
use new-and-improved _check_sio_for_stmt_pair() to make tests more co…
jdsteve2 Mar 26, 2021
1b81ad8
insn->stmt
jdsteve2 Mar 26, 2021
a029c67
only increment barrier count if barrier scope matches
jdsteve2 Mar 26, 2021
264dfda
add some tests with global barriers
jdsteve2 Mar 26, 2021
d49333f
use variable bounds in parallel+barrier sio/sched test; clean up expe…
jdsteve2 Mar 26, 2021
7cf5488
update doctest
jdsteve2 Mar 26, 2021
e92401b
fix doctest (?)
jdsteve2 Mar 26, 2021
6a4d647
use const class for special blex strings
jdsteve2 Mar 26, 2021
dfb7b11
use same map prefix for blex/lex vars
jdsteve2 Mar 26, 2021
ca9a8f0
update docs for consts
jdsteve2 Mar 26, 2021
5b52894
combine instruction pass that determine which loops contain barriers …
jdsteve2 Mar 26, 2021
ae657db
remove func get_insn_id_from_linearization_item() (no longer used)
jdsteve2 Mar 26, 2021
84ea6e0
significant code cleanup and organization
jdsteve2 Mar 27, 2021
2cd77f6
another doctest fix
jdsteve2 Mar 27, 2021
3d939ef
more code cleanup and organization
jdsteve2 Mar 27, 2021
0f3f279
another doctest typo
jdsteve2 Mar 27, 2021
c0a4c58
rename get_schedules_for_statement_pairs()->get_pairwise_statement_or…
jdsteve2 Mar 28, 2021
fb7b95d
Merge branch 'main' into new-dependency-and-nest-constraint-semantics…
jdsteve2 Mar 28, 2021
7f2a6f1
Merge branch 'new-dependency-and-nest-constraint-semantics-developmen…
jdsteve2 Mar 28, 2021
13d5e12
update comments about vec
jdsteve2 Mar 28, 2021
283b747
rename var pairwise_schedules->pairwise_sios
jdsteve2 Mar 31, 2021
cb6ca3d
return a namedtuple with the sios and pwscheds; update docs accordingly
jdsteve2 Mar 31, 2021
3843eb9
rename some variables to provide more precise information
jdsteve2 Mar 31, 2021
7dd60a5
fix documentation
jdsteve2 Apr 1, 2021
2f97cc9
more variable renaming to clarify output from get_pairwise_statement_…
jdsteve2 Apr 1, 2021
8091b63
in intra-group and global orderings, don't add loop dims to lex order…
jdsteve2 Apr 5, 2021
0bf7a6e
add sched/sio test with vec+barrier
jdsteve2 Apr 5, 2021
81dcaf7
improve formatting and code readibility
jdsteve2 Apr 5, 2021
ff0155e
var renaming instruction->statement
jdsteve2 Apr 5, 2021
1e6af20
rename append_marker_to_isl_map_var_names()->append_mark_to_isl_map_v…
jdsteve2 Apr 5, 2021
70aa8fc
(includes function signature changes) reorder args in get_lex_order_s…
jdsteve2 Apr 5, 2021
2ca1a8e
rename marker->mark and pass mark into funcs where it is now required
jdsteve2 Apr 5, 2021
2b8156e
for legibility of tests, allow test map strings to use apostrophe as …
jdsteve2 Apr 5, 2021
d04d1b8
set dt=isl.dim_type to make code prettier
jdsteve2 Apr 11, 2021
edbb093
Merge branch 'main' into new-dependency-and-nest-constraint-semantics…
jdsteve2 Apr 14, 2021
68c1f74
Merge branch 'new-dependency-and-nest-constraint-semantics-developmen…
jdsteve2 Apr 14, 2021
28c6de6
when determining iname domains for schedule map creation for a statem…
jdsteve2 Apr 14, 2021
167060b
fix doctest
jdsteve2 Apr 15, 2021
31817a5
Merge branch 'main' into new-dependency-and-nest-constraint-semantics…
jdsteve2 Apr 17, 2021
8dcecca
Merge branch 'new-dependency-and-nest-constraint-semantics-developmen…
jdsteve2 Apr 17, 2021
af7c263
Before adding each parallel iname constraint to a statement's schedul…
jdsteve2 Apr 17, 2021
2b8dd82
Merge branch 'main' into new-dependency-and-nest-constraint-semantics…
jdsteve2 Apr 23, 2021
3085a5a
Merge branch 'new-dependency-and-nest-constraint-semantics-developmen…
jdsteve2 Apr 23, 2021
39fe705
reduce duplicated code in tests by adding _process_and_linearize(knl)…
jdsteve2 Apr 25, 2021
2ac6415
Merge branch 'main' into new-dependency-and-nest-constraint-semantics…
jdsteve2 Apr 26, 2021
a786baf
Merge branch 'main' into statement-instance-order-and-lex-order-map
jdsteve2 Apr 26, 2021
9a5592c
Merge branch 'new-dependency-and-nest-constraint-semantics-developmen…
jdsteve2 Apr 26, 2021
6ffc457
Merge branch 'main' into new-dependency-and-nest-constraint-semantics…
jdsteve2 Apr 27, 2021
e487d89
Merge branch 'new-dependency-and-nest-constraint-semantics-developmen…
jdsteve2 Apr 27, 2021
74d54c4
Merge branch 'main' into new-dependency-and-nest-constraint-semantics…
jdsteve2 May 23, 2021
b9bc817
Merge branch 'new-dependency-and-nest-constraint-semantics-developmen…
jdsteve2 May 23, 2021
637b931
Merge branch 'main' into new-dependency-and-nest-constraint-semantics…
jdsteve2 Jun 6, 2021
9edf007
Merge branch 'new-dependency-and-nest-constraint-semantics-developmen…
jdsteve2 Jun 6, 2021
0378482
Merge branch 'main' into new-dependency-and-nest-constraint-semantics…
jdsteve2 Jul 14, 2021
20525df
(callables update) call get_one_linearized_kernel on program[knl]
jdsteve2 Jul 14, 2021
bec6dca
change default arg from set to frozenset
jdsteve2 Jul 14, 2021
b98a8de
(callables update) call get_one_linearized_kernel on program[knl] in …
jdsteve2 Jul 14, 2021
4c34565
fix merge conflicts after callables update
jdsteve2 Jul 14, 2021
0680d4d
change empty list default args to empty tuples
jdsteve2 Jul 14, 2021
5855676
rename IndexTag->InameTag
jdsteve2 Jul 14, 2021
e55048c
handle dependencies on barrier stmts by assigning them a lex point
jdsteve2 Jul 15, 2021
f91338d
test pairwise SIOs where one of the statements is a barrier
jdsteve2 Jul 15, 2021
814607a
fix doc indentation
jdsteve2 Jul 17, 2021
f099b8f
Update loopy/schedule/checker/schedule.py
jdsteve2 Jul 17, 2021
b559208
Merge branch 'statement-instance-order-and-lex-order-map' of https://…
jdsteve2 Jul 17, 2021
7d34906
Update loopy/schedule/checker/__init__.py
jdsteve2 Jul 17, 2021
f86caff
Merge branch 'statement-instance-order-and-lex-order-map' of https://…
jdsteve2 Jul 17, 2021
4092ae6
revise docstring for StatementOrdering
jdsteve2 Jul 17, 2021
4196adb
promote StatementOrdering to top-level dataclass
jdsteve2 Jul 18, 2021
4e847a5
add dataclass to install_requires in setup.py
jdsteve2 Jul 18, 2021
9ecd66d
fix docstring indentation
jdsteve2 Jul 18, 2021
7c4785a
reorg and improve docstrings about SIOs a bit
jdsteve2 Jul 18, 2021
7614ab8
consistent naming of funcs
jdsteve2 Jul 18, 2021
9963c9b
docstring grammar typo
jdsteve2 Jul 18, 2021
9668335
fix typo in setup.py
jdsteve2 Jul 19, 2021
74b3f4b
rename islvars->var_name_to_pwaff
jdsteve2 Jul 19, 2021
2ef1816
add foldmethod=maker line for vim
jdsteve2 Jul 19, 2021
0e8be5b
clarify comment
jdsteve2 Jul 19, 2021
d4623c6
promote _gather_blex_ordering_info() to top level (step 1, temporaril…
jdsteve2 Jul 19, 2021
6fab4bc
remove sanity check and old version of _gather_blex_ordering_info() a…
jdsteve2 Jul 19, 2021
109d34f
eliminate _create_excluded_map_for_iname() since it is only called on…
jdsteve2 Jul 20, 2021
aa2c475
eliminate _create_excluded_map_for_iname() since it is only called on…
jdsteve2 Jul 20, 2021
b2bcff7
Merge branch 'main' into new-dependency-and-nest-constraint-semantics…
jdsteve2 Jul 23, 2021
f353094
Merge branch 'new-dependency-and-nest-constraint-semantics-developmen…
jdsteve2 Jul 23, 2021
173a6bc
Merge branch 'main' into statement-instance-order-and-lex-order-map
inducer Aug 6, 2021
10a92b4
(WIP) compute lexmax/min to get bounds for trangular domains
jdsteve2 Aug 8, 2021
3ba7082
(WIP) add test for SIO creation when domain is traingular
jdsteve2 Aug 8, 2021
d8bc177
(WIP) print out the loop bounds that I think we want to use to create…
jdsteve2 Aug 12, 2021
885ef5e
temporarilly committing broken test
jdsteve2 Aug 12, 2021
b72d964
Merge branch 'main' into new-dependency-and-nest-constraint-semantics…
jdsteve2 Aug 13, 2021
01049b0
Merge branch 'new-dependency-and-nest-constraint-semantics-developmen…
jdsteve2 Aug 13, 2021
acd0803
use dim_type to abbreviate isl.dim_type class and dt to refer to a pa…
jdsteve2 Aug 13, 2021
4c64326
Merge branch 'statement-instance-order-and-lex-order-map' into use-le…
jdsteve2 Aug 13, 2021
619b157
use dim_type to abbreviate isl.dim_type class and dt to refer to a pa…
jdsteve2 Aug 13, 2021
716f4a2
(WIP) make test kernel for tringular domain doubly triangular
jdsteve2 Aug 14, 2021
5975407
(WIP) add all stmt ids in triangular-domain blex example to ensure al…
jdsteve2 Aug 17, 2021
a443485
(WIP) use lexmax/min_multi_pw_aff instead of lexmax/lexmin, use new b…
jdsteve2 Aug 17, 2021
9783409
create rename_dims function
jdsteve2 Aug 19, 2021
a35fd08
just use lexmin instead of lexmin_pw_multi_aff when finding FIRST and…
jdsteve2 Aug 19, 2021
3a1778d
add isl helper function add_int_bounds_to_isl_var()
jdsteve2 Aug 25, 2021
be9b9bb
(WIP) working on bounding blex dims and determining whether blex map …
jdsteve2 Aug 25, 2021
a849514
fix merge conflicts
jdsteve2 Aug 25, 2021
1978a71
remove redundant import
jdsteve2 Aug 27, 2021
906ef55
allow second val in add_eq_isl_constraint_from_names to be an integer
jdsteve2 Aug 31, 2021
89afc21
(WIP) begin construction of full blex map as union of individual per-…
jdsteve2 Aug 31, 2021
84da857
(WIP) further construction of full blex map as union of individual pe…
jdsteve2 Sep 2, 2021
cff0046
(WIP) fix bug so that inames inside sets found in a 'before' tuple al…
jdsteve2 Sep 4, 2021
993242b
(WIP) remove debugging comparisons to old version of blex map
jdsteve2 Sep 5, 2021
41640fb
(WIP) initial implementation of less messy machinery for producing th…
jdsteve2 Sep 6, 2021
d273bfd
(WIP) remove a bunch of old code that has now been replaced; clean up…
jdsteve2 Sep 6, 2021
dde6a77
pass along bool args for transitivity checks
jdsteve2 Sep 6, 2021
7ad44fb
pass bool args enabling transitivity checks into get_pairwise_stateme…
jdsteve2 Sep 6, 2021
8f3ff97
remove some unnecessary functions
jdsteve2 Sep 6, 2021
d5c9ea4
add test for transitivity blex maps with complicated triangular domain
jdsteve2 Sep 6, 2021
76e070e
Merge pull request #490 from inducer/use-lexmaxmin-to-handle-trangula…
jdsteve2 Sep 6, 2021
c6f76c4
switch stmt var name back to original (pre-debugging) so that doctest…
jdsteve2 Sep 6, 2021
297946b
(WIP) figure out what does and does not need to change for sio creati…
jdsteve2 Sep 9, 2021
b9585c3
add move_dims_by_name()
jdsteve2 Sep 10, 2021
24728f8
(WIP) accommodate domain dependencies involving concurrent inames whe…
jdsteve2 Sep 10, 2021
efb0095
make sure blex map always has necessary conc inames as params by inse…
jdsteve2 Sep 13, 2021
e778a3c
add remove_dims_by_name()
jdsteve2 Sep 13, 2021
292e5dc
in blex map creation, handle case where there are multiple inames tag…
jdsteve2 Sep 13, 2021
a8c7ab8
perform transitivity tests on blex maps in case where there are multi…
jdsteve2 Sep 13, 2021
6877bd6
pass only values of conc_iname_constraint_dicts to _gather_blex_order…
jdsteve2 Sep 13, 2021
ad1d7fc
remove some sanity checks
jdsteve2 Sep 14, 2021
ab25925
Merge branch 'main' into statement-instance-order-and-lex-order-map
jdsteve2 Sep 14, 2021
b915810
change add_and_reanme_dim->add_and_rename_dims and have it take multi…
jdsteve2 Sep 14, 2021
9f8bc7a
use find_and_rename_dims from isl_helpers
jdsteve2 Sep 14, 2021
7bd7074
reduce duplicate code in get_pairwise_statement_orderings_inner
jdsteve2 Sep 14, 2021
1934759
create single list of all conc_iname_constraint_dicts to pass to get_…
jdsteve2 Sep 15, 2021
16dde82
clean up and document _add_one_blex_tuple()
jdsteve2 Sep 15, 2021
5de7173
clarify distinction between ilp/vec concurrent loops and non-ilp/vec …
jdsteve2 Sep 15, 2021
5c6b830
remove now-redundant pass through linearization items to compute max_…
jdsteve2 Sep 15, 2021
a7d6509
minor formatting changes
jdsteve2 Sep 15, 2021
973e319
iliminate redundant arg ilp_and_vec_inames from _gather_blex_ordering…
jdsteve2 Sep 15, 2021
77a2c3e
use 'conc' (concurrent) instead of 'par' for naming consistency
jdsteve2 Sep 15, 2021
c1a3d3e
significantly revise/improve comments about subtraction blex map crea…
jdsteve2 Sep 15, 2021
d327273
eliminate duplicated code in subtraction map creation by adding funct…
jdsteve2 Sep 16, 2021
6b68730
create slice variables for indexing lex/blex tuples
jdsteve2 Sep 16, 2021
e6f0214
remove some TODOs
jdsteve2 Sep 16, 2021
79fa5d1
eliminate explicit storage of FIRST and LAST blex tuples; these are n…
jdsteve2 Sep 16, 2021
ee33d5a
eliminate some final TODOs
jdsteve2 Sep 16, 2021
1782858
Since global barriers also syncronize threads *within* a work-group, …
jdsteve2 Sep 16, 2021
dbb852d
Update tests after SIO construction change: (Since global barriers al…
jdsteve2 Sep 16, 2021
b6ad65a
add get_pairwise_statement_orderings to loopy.__init__
jdsteve2 Sep 17, 2021
e564dee
add new dep checking stuff to documentation
jdsteve2 Sep 17, 2021
c99ee10
document _gather_blex_ordering_info()
jdsteve2 Sep 17, 2021
ce58d7a
Fix up schedule checker docs
inducer Sep 17, 2021
2c2772e
fix reference in docstrings loopy.kernel.LoopKernel->loopy.LoopKernel
jdsteve2 Sep 17, 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
2 changes: 2 additions & 0 deletions doc/ref_kernel.rst
Original file line number Diff line number Diff line change
Expand Up @@ -220,6 +220,8 @@ Tag Meaning
Identifiers
-----------

.. _reserved-identifiers:

Reserved Identifiers
^^^^^^^^^^^^^^^^^^^^

Expand Down
7 changes: 7 additions & 0 deletions doc/ref_other.rst
Original file line number Diff line number Diff line change
Expand Up @@ -26,9 +26,16 @@ Automatic Testing

.. autofunction:: auto_test_vs_ref

Checking Dependencies at the Statement-Instance Level
-----------------------------------------------------

.. automodule:: loopy.schedule.checker

Troubleshooting
---------------

.. currentmodule:: loopy

Printing :class:`LoopKernel` objects
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

Expand Down
4 changes: 4 additions & 0 deletions loopy/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -129,6 +129,9 @@
from loopy.schedule import (
generate_loop_schedules, get_one_scheduled_kernel,
get_one_linearized_kernel, linearize)
from loopy.schedule.checker import (
get_pairwise_statement_orderings,
)
from loopy.statistics import (ToCountMap, ToCountPolynomialMap, CountGranularity,
stringify_stats_mapping, Op, MemAccess, get_op_map, get_mem_access_map,
get_synchronization_map, gather_access_footprints,
Expand Down Expand Up @@ -268,6 +271,7 @@
"generate_loop_schedules",
"get_one_scheduled_kernel", "get_one_linearized_kernel",
"linearize",
"get_pairwise_statement_orderings",

"GeneratedProgram", "CodeGenerationResult",
"PreambleInfo",
Expand Down
26 changes: 15 additions & 11 deletions loopy/isl_helpers.py
Original file line number Diff line number Diff line change
Expand Up @@ -823,29 +823,33 @@ def add_eq_constraint_from_names(isl_obj, var1, var2):
# }}}


# {{{ find_and_rename_dim
# {{{ find_and_rename_dims

def find_and_rename_dim(isl_obj, dt, old_name, new_name):
"""Rename a dimension in an ISL object.
def find_and_rename_dims(isl_obj, dt, rename_dict):
"""Rename dimensions in an ISL object.

:arg isl_obj: An :class:`islpy.Set` or :class:`islpy.Map` containing the
dimension to be renamed.

:arg dt: An :class:`islpy.dim_type` (i.e., :class:`int`) specifying the
dimension type containing the dimension to be renamed.

:arg old_name: A :class:`str` specifying the name of the dimension to be
renamed.
:arg rename_dict: A :class:`dict` mapping current :class:`string` dimension
names to replacement names.

:arg new_name: A :class:`str` specifying the new name of the dimension to
be renamed.

:returns: An object of the same type as *isl_obj* with the dimension
*old_name* renamed to *new_name*.
:returns: An object of the same type as *isl_obj* with the dimension names
changed according to *rename_dict*.

"""
return isl_obj.set_dim_name(
for old_name, new_name in rename_dict.items():
idx = isl_obj.find_dim_by_name(dt, old_name)
if idx == -1:
raise ValueError(
"find_and_rename_dims did not find dimension %s"
% (old_name))
isl_obj = isl_obj.set_dim_name(
dt, isl_obj.find_dim_by_name(dt, old_name), new_name)
return isl_obj

# }}}

Expand Down
161 changes: 161 additions & 0 deletions loopy/schedule/checker/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,161 @@
"""
.. autofunction:: get_pairwise_statement_orderings

.. automodule:: loopy.schedule.checker.schedule
"""


__copyright__ = "Copyright (C) 2019 James Stevens"

__license__ = """
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
THE SOFTWARE.
"""


# {{{ get pairwise statement orderings

def get_pairwise_statement_orderings(
knl,
lin_items,
stmt_id_pairs,
perform_closure_checks=False,
):
r"""For each statement pair in a subset of all statement pairs found in a
linearized kernel, determine the (relative) order in which the statement
instances are executed. For each pair, represent this relative ordering
using three ``statement instance orderings`` (SIOs):

- The intra-thread SIO: A :class:`islpy.Map` from each instance of the
first statement to all instances of the second statement that occur
later, such that both statement instances in each before-after pair are
executed within the same work-item (thread).

- The intra-group SIO: A :class:`islpy.Map` from each instance of the first
statement to all instances of the second statement that occur later, such
that both statement instances in each before-after pair are executed
within the same work-group (though potentially by different work-items).

- The global SIO: A :class:`islpy.Map` from each instance of the first
statement to all instances of the second statement that occur later, even
if the two statement instances in a given before-after pair are executed
within different work-groups.

:arg knl: A preprocessed :class:`loopy.LoopKernel` containing the
linearization items that will be used to create the SIOs.

:arg lin_items: A list of :class:`loopy.schedule.ScheduleItem`
(to be renamed to `loopy.schedule.LinearizationItem`) containing all
linearization items for which SIOs will be created. To allow usage of
this routine during linearization, a truncated (i.e. partial)
linearization may be passed through this argument.

:arg stmt_id_pairs: A sequence containing pairs of statement identifiers.

:returns: A dictionary mapping each two-tuple of statement identifiers
provided in `stmt_id_pairs` to a
:class:`~loopy.schedule.checker.schedule.StatementOrdering`, which
contains the three SIOs described above.

.. doctest:

>>> import loopy as lp
>>> import numpy as np
>>> # Make kernel -----------------------------------------------------------
>>> knl = lp.make_kernel(
... "{[j,k]: 0<=j<pj and 0<=k<pk}",
... [
... "a[j] = j {id=stmt_a}",
... "b[k] = k+a[0] {id=stmt_b,dep=stmt_a}",
... ])
>>> knl = lp.add_and_infer_dtypes(knl, {"a": np.float32, "b": np.float32})
>>> # Preprocess
>>> knl = lp.preprocess_kernel(knl)
>>> # Get a linearization
>>> knl = lp.get_one_linearized_kernel(
... knl["loopy_kernel"], knl.callables_table)
>>> # Get pairwise order info -----------------------------------------------
>>> from loopy.schedule.checker import get_pairwise_statement_orderings
>>> sio_dict = get_pairwise_statement_orderings(
... knl,
... knl.linearization,
... [("stmt_a", "stmt_b")],
... )
>>> # Print map
>>> print(str(sio_dict[("stmt_a", "stmt_b")].sio_intra_thread
... ).replace("{ ", "{\n").replace(" :", "\n:"))
[pj, pk] -> {
[_lp_linchk_stmt' = 0, j'] -> [_lp_linchk_stmt = 1, k]
: pj > 0 and pk > 0 and 0 <= j' < pj and 0 <= k < pk }

"""

# {{{ make sure kernel has been preprocessed

from loopy.kernel import KernelState
assert knl.state in [
KernelState.PREPROCESSED,
KernelState.LINEARIZED]

# }}}

# {{{ Find any EnterLoop inames that are tagged as concurrent
# so that get_pairwise_statement_orderings_inner() knows to ignore them
# (In the future, this should only include inames tagged with 'vec'.)

# FIXME Consider just putting this ilp/vec logic inside
# get_pairwise_statement_orderings_inner; passing these in as
# 'loops_to_ignore' made more sense when we were just dealing with the
# intra-thread case.
from loopy.schedule.checker.utils import (
partition_inames_by_concurrency,
get_EnterLoop_inames,
)
conc_inames, _ = partition_inames_by_concurrency(knl)
enterloop_inames = get_EnterLoop_inames(lin_items)
ilp_and_vec_inames = conc_inames & enterloop_inames

# The only concurrent EnterLoop inames should be Vec and ILP
from loopy.kernel.data import (VectorizeTag, IlpBaseTag)
for conc_iname in ilp_and_vec_inames:
# Assert that there exists an ilp or vectorize tag (out of the
# potentially multiple other tags on this concurrent iname).
assert any(
isinstance(tag, (VectorizeTag, IlpBaseTag))
for tag in knl.iname_to_tags[conc_iname])

# }}}

# {{{ Create the SIOs

from loopy.schedule.checker.schedule import (
get_pairwise_statement_orderings_inner
)
return get_pairwise_statement_orderings_inner(
knl,
lin_items,
stmt_id_pairs,
ilp_and_vec_inames=ilp_and_vec_inames,
perform_closure_checks=perform_closure_checks,
)

# }}}

# }}}

# vim: foldmethod=marker
Loading