Skip to content

Commit 0d3b6cc

Browse files
pytorchbotHaiting Pu
authored andcommitted
[ET-VK] Minor build graph change to improve model load time and memory. (#10688)
Pull Request resolved: #10646 A minor change in GraphBuilder to avoid creating a temp vector and reserve memory while building operator. ghstack-source-id: 282013579 @exported-using-ghexport Differential Revision: [D73864959](https://our.internmc.facebook.com/intern/diff/D73864959/)
1 parent aa7b575 commit 0d3b6cc

File tree

1 file changed

+3
-5
lines changed

1 file changed

+3
-5
lines changed

backends/vulkan/runtime/VulkanBackend.cpp

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -338,12 +338,10 @@ class GraphBuilder {
338338
std::string op_name = op_call->name()->str();
339339
ET_CHECK_MSG(VK_HAS_OP(op_name), "Missing operator: %s", op_name.c_str());
340340

341-
const std::vector<int> arg_fb_ids(
342-
op_call->args()->cbegin(), op_call->args()->cend());
343-
344341
std::vector<ValueRef> args;
345-
for (const int arg_fb_id : arg_fb_ids) {
346-
args.push_back(get_fb_id_valueref(arg_fb_id));
342+
args.reserve(op_call->args()->size());
343+
for (const auto arg_fb_id : *op_call->args()) {
344+
args.push_back(get_fb_id_valueref(static_cast<int>(arg_fb_id)));
347345
}
348346

349347
auto vkFn = VK_GET_OP_FN(op_name);

0 commit comments

Comments
 (0)