Skip to content

Commit 9069017

Browse files
[ET-VK] Fix VulkanBackend args output index
Pull Request resolved: #7297 The one in the `VK_CHECK_COND` expression was wrong. Use a variable for easier tracking. ghstack-source-id: 257860131 @exported-using-ghexport Differential Revision: [D67126361](https://our.internmc.facebook.com/intern/diff/D67126361/) Co-authored-by: jorgep31415 <[email protected]>
1 parent 5b6d35b commit 9069017

File tree

1 file changed

+6
-5
lines changed

1 file changed

+6
-5
lines changed

backends/vulkan/runtime/VulkanBackend.cpp

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -582,16 +582,17 @@ class VulkanBackend final : public ::executorch::runtime::BackendInterface {
582582
compute_graph->execute();
583583

584584
for (size_t i = 0; i < compute_graph->outputs().size(); i++) {
585+
const size_t o = i + num_inputs;
585586
const ValueRef oref = compute_graph->outputs()[i].value;
586587
if (compute_graph->val_is_tensor(oref)) {
587-
VK_CHECK_COND(args[i]->isTensor());
588-
maybe_resize_output(compute_graph, i, args[num_inputs + i]->toTensor());
588+
VK_CHECK_COND(args[o]->isTensor());
589+
maybe_resize_output(compute_graph, i, args[o]->toTensor());
589590
// args holds inputs directly followed by outputs, so the i'th output
590-
// for compute_graph corresponds to the (i + num_inputs)'th arg
591+
// for compute_graph corresponds to the o'th arg
591592
compute_graph->copy_from_staging(
592593
compute_graph->outputs()[i].staging,
593-
args[num_inputs + i]->toTensor().mutable_data_ptr(),
594-
args[num_inputs + i]->toTensor().numel());
594+
args[o]->toTensor().mutable_data_ptr(),
595+
args[o]->toTensor().numel());
595596
} else {
596597
VK_THROW(
597598
"Could not handle output with type ",

0 commit comments

Comments
 (0)