馃悰 Describe the bug
is_tensor_arg_node() and is_non_constant_tensor_node() in backends/vulkan/utils.py only recognise a list argument when every entry is a tensor node. An argument that mixes tensor nodes with None is therefore treated as a non-tensor and skipped entirely by TagMemoryMetaPass, so the tensors inside it never get a storage or memory-layout representation.
index.Tensor is the case that surfaces it: x[:, :, idx] reaches the edge dialect as index.Tensor(x, [None, None, idx]), and idx lives in a list whose other entries are None. Any op implementation that then asserts on the layout of that tensor fails, because nothing assigned it one.
This is easy to miss because the op that exposed it can be routed around. #22481 makes index.Tensor work on any axis by forcing CONTIGUOUS_BUFFER for higher-rank self, which sidesteps the tagging gap rather than closing it. The gap is still there for the next operator that takes an optional-tensor list.
A fix is a helper along the lines of
def tensor_nodes_in_arg(arg):
"""The tensor nodes of an argument, skipping Nones."""
used everywhere the tagging pass walks a list argument. Lists that are entirely tensors, which is every other operator today, would behave exactly as before.
Originally found while working on #22406, which is being closed in favour of #22481; filing separately so the finding is not lost with it.
Versions
Reproduces on main (a6b115b).
馃悰 Describe the bug
is_tensor_arg_node()andis_non_constant_tensor_node()inbackends/vulkan/utils.pyonly recognise a list argument when every entry is a tensor node. An argument that mixes tensor nodes withNoneis therefore treated as a non-tensor and skipped entirely byTagMemoryMetaPass, so the tensors inside it never get a storage or memory-layout representation.index.Tensoris the case that surfaces it:x[:, :, idx]reaches the edge dialect asindex.Tensor(x, [None, None, idx]), andidxlives in a list whose other entries areNone. Any op implementation that then asserts on the layout of that tensor fails, because nothing assigned it one.This is easy to miss because the op that exposed it can be routed around. #22481 makes
index.Tensorwork on any axis by forcingCONTIGUOUS_BUFFERfor higher-rankself, which sidesteps the tagging gap rather than closing it. The gap is still there for the next operator that takes an optional-tensor list.A fix is a helper along the lines of
used everywhere the tagging pass walks a list argument. Lists that are entirely tensors, which is every other operator today, would behave exactly as before.
Originally found while working on #22406, which is being closed in favour of #22481; filing separately so the finding is not lost with it.
Versions
Reproduces on
main(a6b115b).