-
Notifications
You must be signed in to change notification settings - Fork 133
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
New and Improved MapFusion #1629
Changes from 1 commit
aa433fe
71a88a1
bc87ddb
497a2d6
9e36447
7a48e0d
d609045
52c4542
3b758bf
377b428
db4864b
f395acd
b1ab95e
945ca8f
940b9b6
ecae361
64d07fd
33a0edf
dbb989e
e142881
ff018f4
ec6339a
9267ea9
fc2db8a
4d9f11d
2b91465
73f4415
94ecd19
3f3f8a3
c23ed39
dad61cb
a57ebb3
439d6f3
13c80ec
12a5cf7
995ef4d
dc4ed31
eb48391
d53302d
3f54e1f
0f46c1c
0585112
61160e4
584635a
b2dea1d
fba6682
62b0288
8858021
09deb95
1e14f26
92c7097
041b3da
5556bd3
e3461c3
6f5edc5
35a5426
20b728e
5dd9c6b
617fb8f
04cadbe
d8b3547
8fed4fe
567f459
9cad08d
866d815
a5846b5
7ccdd9c
d4041b7
a444992
a023f7c
5c49eee
63e78c9
896ac68
33f9fdd
fcffb22
0ddb3c2
05ffee4
6de85c7
8c86662
dfc92e7
11a3167
44cf6ad
914d67b
5e25816
259d17c
db26320
fa67492
3453c6c
90731af
f659cd8
244e3ea
11a509e
724d1f5
10ae1e2
d909379
cc7324b
6429d91
3d1cd9e
a412394
fa21bd3
6e13941
d8da3c6
e2285f0
4832c3c
fd3b48a
8fa7cb2
9139149
0a5aeaf
e2bc10d
aa3619f
a740d16
d07e2c5
fbc8469
5c354c6
abf739c
2b17111
1e8f66f
3ab46d8
b1fc9d1
fdc6424
e2c41b5
bcaed23
243611d
c53f939
a3842f9
85cc87d
6c6a012
041d535
2ad4b98
d2d9f50
eddac68
fc702af
cd14c67
e2abfa7
59b35b4
1c6b661
e5bb165
1e9ee3f
0f5228b
1ece746
ef4b64d
a04963e
29c5e10
b2dabf4
b4f55e4
20d64c2
48be4b3
1fac7ec
fbedda1
674628d
6fa3881
374005c
1f3a447
62f2bbd
3548f1f
61c5680
54d11d1
41e8612
4ea838f
bd31a9e
76cddac
7342628
6a47835
c849781
4b40f26
bb8fa89
cc34dfa
edf571e
e61968b
8fe0103
9bb0e2d
a8450af
7db9040
b585f69
02c654b
65dffe8
1359615
9f08bab
1d04a1d
9d94460
cf882bf
f95e5a0
6316ed0
6c389c6
39c4621
eceb8fa
f5321c2
0f8ef8c
e754a2a
00823fd
c94163e
3f6fd49
f929dab
2f03f5d
b38ba0b
6441c2a
f6973b2
57a8a13
3cdc750
4bf37d1
b45cf5b
abe7051
662817e
ed58523
47babf6
fa1331a
2ba2bff
2ffeaaf
37265ba
2563f72
c95a966
0a01a22
f1b920b
bb77515
0aadd02
2699fdb
7ca2328
2da67b1
87872be
978fb67
c1d1a8c
b302089
efc8e5c
13fada7
4393975
654615b
4dc0ccf
3467964
d6c0eac
10949e2
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -761,12 +761,15 @@ def _read_and_write_sets(self) -> Tuple[Dict[AnyStr, List[Subset]], Dict[AnyStr, | |
read_set = collections.defaultdict(list) | ||
write_set = collections.defaultdict(list) | ||
|
||
# NOTE: In a previous version a _single_ read (i.e. leaving Memlet) that was | ||
# fully covered by a single write (i.e. an incoming Memlet) was removed from | ||
# the read set and only the write survived. However, this was never fully | ||
# implemented nor correctly implemented and caused problems. | ||
# So this filtering was removed. | ||
|
||
for subgraph in utils.concurrent_subgraphs(self): | ||
subgraph_read_set = collections.defaultdict(list) # read and write set of this subgraph. | ||
subgraph_write_set = collections.defaultdict(list) | ||
# Traverse in topological order, so data that is written before it | ||
# is read is not counted in the read set | ||
# TODO: This only works if every data descriptor is only once in a path. | ||
for n in utils.dfs_topological_sort(subgraph, sources=subgraph.source_nodes()): | ||
if not isinstance(n, nd.AccessNode): | ||
# Read and writes can only be done through access nodes, | ||
|
@@ -804,23 +807,6 @@ def _read_and_write_sets(self) -> Tuple[Dict[AnyStr, List[Subset]], Dict[AnyStr, | |
else out_edge.data.src_subset | ||
) | ||
|
||
# If a memlet reads a particular region of data from the access node and there | ||
# exists a memlet at the same access node that writes to the same region, then | ||
# this read is ignored, and not included in the final read set, but only | ||
# accounted fro in the write set. See also note below. | ||
# TODO: Handle the case when multiple disjoint writes are needed to cover the read. | ||
for out_edge in list(out_edges): | ||
for in_edge in in_edges: | ||
if out_edge.data.data != in_edge.data.data: | ||
# NOTE: This check does not make any sense, and is in my (@philip-paul-mueller) | ||
# view wrong. As it will filter out some accesses but not all, which one solely | ||
# depends on how the memelts were created, i.e. to which container their `data` | ||
# attribute is associated to. See also [issue #1643](https://github.com/spcl/dace/issues/1643). | ||
continue | ||
if in_subsets[in_edge].covers(out_subsets[out_edge]): | ||
out_edges.remove(out_edge) | ||
break | ||
|
||
# Update the read and write sets of the subgraph. | ||
if in_edges: | ||
subgraph_write_set[n.data].extend(in_subsets.values()) | ||
|
@@ -835,6 +821,7 @@ def _read_and_write_sets(self) -> Tuple[Dict[AnyStr, List[Subset]], Dict[AnyStr, | |
|
||
return copy.deepcopy((read_set, write_set)) | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Why is it necessary to make a copy here? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Because, the subsets are still linked to the Memlets, so if you modify them then you change them at the Memlets.
|
||
|
||
|
||
def read_and_write_sets(self) -> Tuple[Set[AnyStr], Set[AnyStr]]: | ||
""" | ||
Determines what data is read and written in this subgraph. | ||
|
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.
Can you please add more comments to make it easier to follow what is being done?
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 added more comments.