From 922bd8361c5bbdb3c88e5c2cdeefb8eb467755b9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Mateusz=20S=C5=82uszniak?= Date: Tue, 1 Sep 2026 14:46:29 +0200 Subject: [PATCH] [ET-VK] Wire the missing resize functions for embedding and index_select add_embedding_legacy_node() and both index_select node builders pass nullptr as their resizing logic, even though the matching resize functions are already defined right next to them. Under dynamic shapes their outputs therefore keep the extents they were built with instead of tracking the real input sizes, and downstream ops read them at the wrong size. Pass the resize functions that already exist, and mark index_select as supporting resize now that it actually does. Found while chasing a wrong-output bug in a TTS model on Adreno 840: the embedding output kept its upper-bound extents whenever a graph change moved the partition boundary so that a CPU round-trip no longer happened to re-establish the correct shape. --- backends/vulkan/op_registry.py | 1 + backends/vulkan/runtime/graph/ops/impl/Embedding.cpp | 2 +- backends/vulkan/runtime/graph/ops/impl/IndexSelect.cpp | 4 ++-- 3 files changed, 4 insertions(+), 3 deletions(-) diff --git a/backends/vulkan/op_registry.py b/backends/vulkan/op_registry.py index eed287b3a08..75f8ac331cd 100644 --- a/backends/vulkan/op_registry.py +++ b/backends/vulkan/op_registry.py @@ -1412,6 +1412,7 @@ def register_index_select(): return OpFeatures( inputs_storage=utils.CHANNELS_PACKED_TEXTURE, inputs_dtypes=utils.FP_INT_BOOL_T, + supports_resize=True, ) diff --git a/backends/vulkan/runtime/graph/ops/impl/Embedding.cpp b/backends/vulkan/runtime/graph/ops/impl/Embedding.cpp index 61ba9349b45..80f7b505feb 100644 --- a/backends/vulkan/runtime/graph/ops/impl/Embedding.cpp +++ b/backends/vulkan/runtime/graph/ops/impl/Embedding.cpp @@ -112,7 +112,7 @@ void add_embedding_legacy_node( // Resize Args {}, // Resizing Logic - nullptr)); + resize_embedding_node)); } void embedding(ComputeGraph& graph, const std::vector& args) { diff --git a/backends/vulkan/runtime/graph/ops/impl/IndexSelect.cpp b/backends/vulkan/runtime/graph/ops/impl/IndexSelect.cpp index 20ab76813a7..0c0996a1070 100644 --- a/backends/vulkan/runtime/graph/ops/impl/IndexSelect.cpp +++ b/backends/vulkan/runtime/graph/ops/impl/IndexSelect.cpp @@ -53,7 +53,7 @@ void add_index_select_channel_node( // Resize Args {}, // Resizing Logic - nullptr)); + resize_index_select_channel_node)); } struct IndexSelectParams final { @@ -107,7 +107,7 @@ void add_index_select_node( // Resize Args {}, // Resizing Logic - nullptr)); + resize_fn)); } int64_t get_dim_idx(ComputeGraph& graph, ValueRef in, ValueRef dim_ref) {