Skip to content

Commit dc03dc9

Browse files
Arm backend: Return false on non-VK_SUCCESS in process_vgf (#15697)
Replace incorrect `return result;` (VkResult) in a bool path to avoid false success. Signed-off-by: Yufeng Shi <[email protected]> Co-authored-by: Alan Liang <[email protected]>
1 parent 6550a37 commit dc03dc9

File tree

1 file changed

+10
-10
lines changed

1 file changed

+10
-10
lines changed

backends/arm/runtime/VGFSetup.cpp

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -707,7 +707,7 @@ bool VgfRepr::process_vgf(const char* vgf_data, ArrayRef<CompileSpec> specs) {
707707
);
708708
if (result != VK_SUCCESS) {
709709
ET_LOG(Error, "Failed to create DataGraphPipeline");
710-
return result;
710+
return false;
711711
}
712712

713713
// prepare the graph pipeline session
@@ -721,7 +721,7 @@ bool VgfRepr::process_vgf(const char* vgf_data, ArrayRef<CompileSpec> specs) {
721721
vk_device, &pipeline_session_info, nullptr, &vk_session);
722722
if (result != VK_SUCCESS) {
723723
ET_LOG(Error, "Failed to create DataGraphPipelineSession");
724-
return result;
724+
return false;
725725
}
726726

727727
// Allocate command buffer
@@ -735,7 +735,7 @@ bool VgfRepr::process_vgf(const char* vgf_data, ArrayRef<CompileSpec> specs) {
735735
vk_device, &buffer_allocate_info, &vk_execute_cmd);
736736
if (result != VK_SUCCESS) {
737737
ET_LOG(Error, "Failed to allocate command buffers");
738-
return result;
738+
return false;
739739
}
740740

741741
// Allocate intermediates memory based on the pipeline requirements provided
@@ -753,7 +753,7 @@ bool VgfRepr::process_vgf(const char* vgf_data, ArrayRef<CompileSpec> specs) {
753753
vk_device, &bind_point_requirements_info, &bind_point_count, nullptr);
754754
if (result != VK_SUCCESS) {
755755
ET_LOG(Error, "Failed to get session bind point count");
756-
return result;
756+
return false;
757757
}
758758

759759
vector<VkDataGraphPipelineSessionBindPointRequirementARM>
@@ -766,7 +766,7 @@ bool VgfRepr::process_vgf(const char* vgf_data, ArrayRef<CompileSpec> specs) {
766766
bind_point_requirements.data());
767767
if (result != VK_SUCCESS) {
768768
ET_LOG(Error, "Failed to get session bind point requirements");
769-
return result;
769+
return false;
770770
}
771771

772772
// Given the bind points, just make individual allocations and bind them
@@ -777,18 +777,18 @@ bool VgfRepr::process_vgf(const char* vgf_data, ArrayRef<CompileSpec> specs) {
777777
ET_LOG(
778778
Error,
779779
"Expected VK_DATA_GRAPH_PIPELINE_SESSION_BIND_POINT_TYPE_MEMORY_ARM");
780-
return VK_ERROR_UNKNOWN;
780+
return false;
781781
}
782782
if (bind_point_requirement.bindPoint !=
783783
VK_DATA_GRAPH_PIPELINE_SESSION_BIND_POINT_TRANSIENT_ARM) {
784784
ET_LOG(
785785
Error,
786786
"Expected VK_DATA_GRAPH_PIPELINE_SESSION_BIND_POINT_TRANSIENT_ARM");
787-
return VK_ERROR_UNKNOWN;
787+
return false;
788788
}
789789
if (bind_point_requirement.numObjects != 1) {
790790
ET_LOG(Error, "Expected only one object for the bindpoint");
791-
return VK_ERROR_UNKNOWN;
791+
return false;
792792
}
793793

794794
VkDataGraphPipelineSessionMemoryRequirementsInfoARM memory_requirements_info = {
@@ -821,7 +821,7 @@ bool VgfRepr::process_vgf(const char* vgf_data, ArrayRef<CompileSpec> specs) {
821821
vkAllocateMemory(vk_device, &memory_allocate_info, nullptr, &memory);
822822
if (result != VK_SUCCESS) {
823823
ET_LOG(Error, "Failed to allocate memory for intermediates");
824-
return result;
824+
return false;
825825
}
826826
// so we can free this object in destructor
827827
intermediates.push_back(memory);
@@ -839,7 +839,7 @@ bool VgfRepr::process_vgf(const char* vgf_data, ArrayRef<CompileSpec> specs) {
839839
result = vkBindDataGraphPipelineSessionMemoryARM(vk_device, 1, &bind_info);
840840
if (result != VK_SUCCESS) {
841841
ET_LOG(Error, "Failed to bind intermediates memory");
842-
return result;
842+
return false;
843843
}
844844
}
845845

0 commit comments

Comments
 (0)