Skip to content

Add explicit information about Param, Input etc. PlaceholderOps in GraphImporter #667

@stomfaig

Description

@stomfaig

In the following excerpt from GraphImporter::_import_placeholder, for each PlaceholderOp, we determine whether it is a param or not based where it appears in the order in the body list of the graph.

This is undesirable, as it introduces implicit dependencies. It can also cause errors, if any optimisation routine changes the ordering of nodes, etc.

Ideally the GraphImporter should have static, order independent knowledge of which PlacehodlerOps are params, inputs etc.

if self._num_input_visited < len(self._params) and self._do_param_pack:
dtype = node.tensor_meta["dtype"]
pack_of_dtype = None
for pack in args_list:
if ir.MemRefType(
pack.type
).element_type == self._str_to_mlir_dtype(dtype):
pack_of_dtype = pack
break
placeholder_name = self._ops_registry["param.extract"](
node, self._current_param_pack_offset[dtype], pack_of_dtype
).result
self._current_param_pack_offset[dtype] += functools.reduce(
lambda x, y: x * y, list(node.tensor_meta["shape"]), 1
)

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions