Skip to content

[ET-VK] Tag tensors in list args that mix None entries - #22664

Open
Sanjays2402 wants to merge 1 commit into
pytorch:mainfrom
Sanjays2402:et-vk-tag-mixed-none-list-args
Open

[ET-VK] Tag tensors in list args that mix None entries#22664
Sanjays2402 wants to merge 1 commit into
pytorch:mainfrom
Sanjays2402:et-vk-tag-mixed-none-list-args

Conversation

@Sanjays2402

Copy link
Copy Markdown

Fixes #22510

Summary

TagMemoryMetaPass skipped any list argument that was not composed entirely of tensor nodes. aten.index.Tensor reaches the edge dialect as index.Tensor(x, [None, idx]), so the index tensor never received a storage/memory-layout representation, and any op implementation asserting on the layout of that tensor would fail.

Changes

  • backends/vulkan/utils.py: added tensor_nodes_in_arg(), which returns the tensor nodes of an argument while skipping None entries.

  • backends/vulkan/_passes/tag_memory_meta_pass.py: use the helper everywhere the pass walks a list argument —

    • set_arg_node_repr_or_transition skips None entries when tagging list args,
    • is_non_constant_tensor_node accepts lists whose non-None entries are all non-constant tensor nodes,
    • get_arg_tensor_source_repset / constrain_op_arg_repset use the first tensor node of a list as the representative instead of arg[0] (which could be None),
    • constrain_op_repsets now constrains args that contain at least one tensor node.

    Lists composed entirely of tensors behave exactly as before.

  • backends/vulkan/test/test_vulkan_passes.py: regression test exporting x[:, idx] (with idx a graph input) and asserting the pass tags the index tensor node.

Test evidence

  • Reproduced the bug on main (897fc8e): after TagMemoryMetaPass, the idx node in index.Tensor(x, [None, idx]) had no node_repr. With this fix it is tagged (BUFFER / TENSOR_WIDTH_PACKED, matching the index op's storage requirement for higher-rank self).
  • python -m unittest executorch.backends.vulkan.test.test_vulkan_passes: 12 tests, all pass, including the new test_tag_memory_meta_pass_tags_tensor_in_mixed_none_list (verified it fails on unmodified code).
  • black --check and flake8 --select=E9,F clean on all touched files.

This PR was authored with AI assistance (Muse).

@Sanjays2402
Sanjays2402 requested a review from SS-JIA as a code owner September 10, 2026 01:56
@pytorch-bot

pytorch-bot Bot commented Sep 10, 2026

Copy link
Copy Markdown

🔗 Helpful Links

🧪 See artifacts and rendered test results at hud.pytorch.org/pr/pytorch/executorch/22664

Note: Links to docs will display an error until the docs builds have been completed.

⚠️ 15 Awaiting Approval

As of commit f5ec7b0 with merge base 897fc8e (image):

AWAITING APPROVAL - The following workflows need approval before CI can run:

This comment was automatically generated by Dr. CI and updates every 15 minutes.

@meta-cla meta-cla Bot added the CLA Signed This label is managed by the Facebook bot. Authors need to sign the CLA before a PR can be reviewed. label Sep 10, 2026
@linux-foundation-easycla

linux-foundation-easycla Bot commented Sep 10, 2026

Copy link
Copy Markdown

CLA Signed
The committers listed above are authorized under a signed CLA.

  • ✅ login: Sanjays2402 / name: Sanjay Santhanam (f5ec7b0)

@Sanjays2402

Copy link
Copy Markdown
Author

@pytorchbot label "release notes: none"

@pytorch-bot pytorch-bot Bot added the release notes: none Do not include this in the release notes label Sep 10, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

CLA Signed This label is managed by the Facebook bot. Authors need to sign the CLA before a PR can be reviewed. release notes: none Do not include this in the release notes

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[ET-VK] TagMemoryMetaPass skips a tensor that sits in a list alongside None

1 participant