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

Fix GPU transform mapping free access nodes always to GPU storage #1713

Merged
merged 5 commits into from
Dec 3, 2024
Merged
Changes from 3 commits
Commits
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
23 changes: 23 additions & 0 deletions dace/transformation/interstate/gpu_transform_sdfg.py
Original file line number Diff line number Diff line change
Expand Up @@ -438,6 +438,29 @@ def apply(self, _, sdfg: sd.SDFG):
#######################################################
# Step 7: Wrap free tasklets and nested SDFGs with a GPU map

# Extend global_code_nodes with tasklets that write/read from an array
ThrudPrimrose marked this conversation as resolved.
Show resolved Hide resolved
# Previous steps map all arrays to GPU storage, but only checks tasklets that write to/read from
# Scalars to be wrapped in a GPU Map
for state in sdfg.states():
for node in state.nodes():
if isinstance(node, nodes.Tasklet):
if node in global_code_nodes[state]:
continue
if state.entry_node(node) is None and not scope.is_devicelevel_gpu_kernel(
state.parent, state, node):
memlet_path_roots = set()
memlet_path_roots = memlet_path_roots.union(
[state.memlet_tree(e).root().edge.src for e in state.in_edges(node)]
)
memlet_path_roots = memlet_path_roots.union(
[state.memlet_tree(e).root().edge.dst for e in state.out_edges(node)]
)
gpu_accesses = [n.data for n in memlet_path_roots
if isinstance(n, nodes.AccessNode) and
sdfg.arrays[n.data].storage in gpu_storage]
if len(gpu_accesses) > 0:
global_code_nodes[state].append(node)

for state, gcodes in global_code_nodes.items():
for gcode in gcodes:
if gcode.label in self.exclude_tasklets.split(','):
Expand Down
Loading