Skip to content

DeadDataflowElimination fails to "inline" non-scalarized outputs #2086

@romanc

Description

@romanc

Describe the bug

DeadDataflowElimination removes transient write access nodes that aren't read anymore. If the source is a Tasklet, that Tasklet needs to be changed. The write can be "inlined", i.e. scoped to the Tasklet (since it's never read after the Tasklet).

This "linining" or localization of the write fails for non-scalized memlets, as in the attached SDFG where the Tasklet writes into a 2x2 array. The issue presents itself as simplify() / DDE complaining that 'pointer' objects have no attribute 'typename'.

To Reproduce

Steps to reproduce the behavior:

  1. Load this sdfg: dde-pointer-inline.sdfg.zip
  2. Run simplify() on the loaded sdfg.
  3. See error

Expected behavior

I'd expect DDE to either correctly scope the write to the Tasklet or not attempt to remove the write access node.

Screenshots

Image

OS / version info

  • OS: Linux
  • DaCe version: present in both, main (as of 25-07-16) and the v1/maintenance branch
  • Python version: 3.11.9

Additional context

>>> SDFG.from_file("./dde-pointer-inline.sdfg")
SDFG (TestTypedTemporary_dacecpu_3)
>>> sdfg = SDFG.from_file("./dde-pointer-inline.sdfg")
>>> sdfg.validate()
>>> sdfg.simplify()
Traceback (most recent call last):
  File "[...]/dace/dace/transformation/passes/dead_dataflow_elimination.py", line 164, in apply
    ast_find.generic_visit(code)
  File "[...]/python/3.11.9/lib/python3.11/ast.py", line 494, in generic_visit
    value = self.visit(value)
            ^^^^^^^^^^^^^^^^^
  File "[...]/python/3.11.9/lib/python3.11/ast.py", line 418, in visit
    return visitor(node)
           ^^^^^^^^^^^^^
  File "[...]/python/3.11.9/lib/python3.11/ast.py", line 503, in generic_visit
    new_node = self.visit(old_value)
               ^^^^^^^^^^^^^^^^^^^^^
  File "[...]/python/3.11.9/lib/python3.11/ast.py", line 418, in visit
    return visitor(node)
           ^^^^^^^^^^^^^
  File "[...]/dace/dace/frontend/python/astutils.py", line 588, in visit_Name
    raise NameFound(node.id)
dace.frontend.python.astutils.NameFound: gtOUT__tmp

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "[...]/dace/dace/sdfg/sdfg.py", line 2567, in simplify
    pass_options=options).apply_pass(self, {})
                          ^^^^^^^^^^^^^^^^^^^^
  File "[...]/dace/dace/transformation/passes/simplify.py", line 158, in apply_pass
    result = super().apply_pass(sdfg, pipeline_results)
             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "[...]/dace/dace/transformation/pass_pipeline.py", line 614, in apply_pass
    newret = super().apply_pass(sdfg, state)
             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "[...]/dace/dace/transformation/pass_pipeline.py", line 574, in apply_pass
    r = self.apply_subpass(sdfg, p, state)
        ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "[...]/dace/transformation/passes/simplify.py", line 128, in apply_subpass
    subret = p.apply_pass(sd, state)
             ^^^^^^^^^^^^^^^^^^^^^^^
  File "[...]/dace/transformation/pass_pipeline.py", line 309, in apply_pass
    retval = self.apply(region, pipeline_results)
             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "[...]/dace/transformation/passes/dead_dataflow_elimination.py", line 168, in apply
    f'{leaf.src_conn}: dace.{ctype.to_string()}\n'
                             ^^^^^^^^^^^^^^^^^
  File "[...]/dace/dace/dtypes.py", line 441, in to_string
    return self.typename or self.type.__name__
           ^^^^^^^^^^^^^
AttributeError: 'pointer' object has no attribute 'typename'

Metadata

Metadata

Assignees

Labels

bugSomething isn't working

Type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions