From 2eff3c80bb91b2f8c774de7c116009629479cc5b Mon Sep 17 00:00:00 2001 From: Vivek Trivedi <5340687+trivedivivek@users.noreply.github.com> Date: Thu, 1 May 2025 17:55:27 -0700 Subject: [PATCH] [ET-VK] Minor build graph change to improve model load time and memory. A minor change in GraphBuilder to avoid creating a temp vector and reserve memory while building operator. Differential Revision: [D73864959](https://our.internmc.facebook.com/intern/diff/D73864959/) [ghstack-poisoned] --- backends/vulkan/runtime/VulkanBackend.cpp | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/backends/vulkan/runtime/VulkanBackend.cpp b/backends/vulkan/runtime/VulkanBackend.cpp index 526a5df6f59..21fd137b65b 100644 --- a/backends/vulkan/runtime/VulkanBackend.cpp +++ b/backends/vulkan/runtime/VulkanBackend.cpp @@ -338,12 +338,10 @@ class GraphBuilder { std::string op_name = op_call->name()->str(); ET_CHECK_MSG(VK_HAS_OP(op_name), "Missing operator: %s", op_name.c_str()); - const std::vector arg_fb_ids( - op_call->args()->cbegin(), op_call->args()->cend()); - std::vector args; - for (const int arg_fb_id : arg_fb_ids) { - args.push_back(get_fb_id_valueref(arg_fb_id)); + args.reserve(op_call->args()->size()); + for (const auto arg_fb_id : *op_call->args()) { + args.push_back(get_fb_id_valueref(static_cast(arg_fb_id))); } auto vkFn = VK_GET_OP_FN(op_name);