Skip to content

[ET-VK] Keep unused placeholders in the delegate's input list - #22480

Open
msluszniak wants to merge 1 commit into
pytorch:mainfrom
msluszniak:ms/vulkan-unused-placeholder-inputs
Open

[ET-VK] Keep unused placeholders in the delegate's input list#22480
msluszniak wants to merge 1 commit into
pytorch:mainfrom
msluszniak:ms/vulkan-unused-placeholder-inputs

Conversation

@msluszniak

Copy link
Copy Markdown
Contributor

Fixes #22478.

VulkanBackend::execute matches its args positionally against ComputeGraph::inputs(), but process_placeholder_node drops any placeholder with no users before it reaches input_ids. The delegate call still passes that argument, so the counts disagree and the model fails at every execute() with "Vulkan graph declares N inputs and M outputs, but the delegate call supplied K arguments".

A placeholder can lose its only consumers to the passes that run inside preprocess, after partitioning has already fixed the call's argument list. A qwen3 0.6B export with attention kept on the host hits this: the final partition is handed 28 per-layer symints that nothing in the subgraph consumes by serialization time, and declares 2 inputs and 1 output against a 31 argument call.

Params keep the existing skip, since they are serialized into the blob rather than passed at call time.

Test: test_unused_placeholder_is_still_declared_as_an_input fails on main and passes with the change; the companion test covering used placeholders passes either way. test_serialization.py, test_vulkan_compile_options.py and test_vulkan_passes.py (17 tests) still pass.

VulkanBackend::execute walks its `args` positionally against
ComputeGraph::inputs() and rejects the call when the counts disagree.
VkGraphBuilder.process_placeholder_node drops any placeholder with no users
before it reaches input_ids, but the delegate call still passes that argument,
so the two go out of step and every execute() of the affected model fails with
"Vulkan graph declares N inputs and M outputs, but the delegate call supplied K
arguments".

Unused placeholders are not hypothetical. The passes that run inside preprocess
can fold away a placeholder's only consumers after partitioning has already
fixed the argument list. A qwen3 0.6B export that keeps attention on the host
hits this: the final partition receives 28 per-layer symints whose consumers
are gone by serialization time, and it declares 2 inputs and 1 output against a
31 argument call.

Params keep the existing skip, since they are serialized into the blob rather
than passed at call time.
@msluszniak
msluszniak requested a review from SS-JIA as a code owner September 2, 2026 18:49
@pytorch-bot

pytorch-bot Bot commented Sep 2, 2026

Copy link
Copy Markdown

🔗 Helpful Links

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

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

⚠️ 15 Awaiting Approval

As of commit a6e9264 with merge base a6b115b (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 2, 2026
@github-actions

github-actions Bot commented Sep 2, 2026

Copy link
Copy Markdown

This PR needs a release notes: label

If your change should be included in the release notes (i.e. would users of this library care about this change?), please use a label starting with release notes:. This helps us keep track and include your important work in the next release notes.

To add a label, you can comment to pytorchbot, for example
@pytorchbot label "release notes: none"

For more information, see
https://github.com/pytorch/pytorch/wiki/PyTorch-AutoLabel-Bot#why-categorize-for-release-notes-and-how-does-it-work.

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.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[ET-VK] Delegate call fails at runtime when a partition has an unused placeholder

2 participants