Vulkan: accept a SymInt delegate arg as a plain Int EValue - #21848
Vulkan: accept a SymInt delegate arg as a plain Int EValue#21848msluszniak wants to merge 1 commit into
Conversation
VulkanBackend::execute required every SymInt input to arrive as a scalar
tensor:
VK_CHECK_COND(
args[i]->isTensor(),
"Cannot handle symint arg to graph that is not derived from a "
"scalar tensor at the moment.");
That holds when the value was lifted from a scalar tensor, but not when the
Method's schema declares the argument as SymInt -- the emitter then passes a
plain Int EValue and the delegate rejects it. A dynamic-shape export whose
sequence length crosses the delegate boundary as a SymInt hits this.
Accept both forms on the way in, and add the mirrored handling on the way out,
which was missing entirely: the output loop knew about tensors and TensorRefs
but not SymInts, so a graph returning one fell through to "Could not handle
output with type". An output SymInt is now written into the caller's slot
whether that slot is a scalar tensor (Int or Long) or an Int EValue.
Co-authored-by: Norbert Klockiewicz <Nklockiewicz12@gmail.com>
Co-authored-by: Mateusz Kopcinski <mateusz.kopcinski@swmansion.com>
🔗 Helpful Links🧪 See artifacts and rendered test results at hud.pytorch.org/pr/pytorch/executorch/21848
Note: Links to docs will display an error until the docs builds have been completed.
|
One or more co-authors of this pull request were not found. You must specify co-authors in commit message trailer via: Supported
Alternatively, if the co-author should not be included, remove the Please update your commit message(s) by doing |
This PR needs a
|
Summary
VulkanBackend::executerequired every SymInt input to arrive as a scalartensor:
That holds when the value was lifted from a scalar tensor, but not when the
Method's schema declares the argument as
SymInt— the emitter then passes aplain
IntEValue and the delegate rejects it. A dynamic-shape export whosesequence length crosses the delegate boundary as a SymInt hits this.
This PR accepts both forms on the way in, and adds the mirrored handling on the
way out, which was missing entirely: the output loop knew about tensors and
TensorRefs but not SymInts, so a graph returning one fell through to
"Could not handle output with type". An output SymInt is now written into thecaller's slot whether that slot is a scalar tensor (
IntorLong) or anIntEValue.
Behaviour for the existing scalar-tensor path is unchanged.
Test plan
backends/vulkan/test/test_vulkan_delegate.pysuite.decoder takes a dynamic sequence length pass the SymInt across the delegate
boundary as a plain
Intand generate correctly. Without this change thedelegate aborts at the
VK_CHECK_CONDabove during the firstexecute().Originally written by @Nklockiewicz and Mateusz Kopciński as part of Gemma 4
Vulkan enablement; extracted here as a standalone change.
cc @SS-JIA @manuelcandales @digantdesai @cbilgin