From bd68ee487b97fc03e64bfdf495a822b5329746c4 Mon Sep 17 00:00:00 2001 From: nihuini Date: Tue, 2 Feb 2021 18:40:53 +0800 Subject: [PATCH] fallback to cpu when image allocation failed, fix #2648 --- src/net.cpp | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/src/net.cpp b/src/net.cpp index 9cdd07bb9..4437ca129 100644 --- a/src/net.cpp +++ b/src/net.cpp @@ -525,7 +525,7 @@ IMAGE_ALLOCATION_FAILED: if (image_allocation_failed) { - NCNN_LOGE("forward_layer %d %s image allocation failed, fallback to buffer", layer_index, layer->name.c_str()); + NCNN_LOGE("forward_layer %d %s image allocation failed, fallback to cpu", layer_index, layer->name.c_str()); } if (layer->one_blob_only) @@ -540,9 +540,9 @@ IMAGE_ALLOCATION_FAILED: return ret; } - if (layer->support_vulkan) + if (layer->support_vulkan && !image_allocation_failed) { - if (layer->support_image_storage && !image_allocation_failed) + if (layer->support_image_storage) { if (blob_mats_gpu_image[bottom_blob_index].dims == 0) { @@ -641,9 +641,9 @@ IMAGE_ALLOCATION_FAILED: return ret; } - if (layer->support_vulkan) + if (layer->support_vulkan && !image_allocation_failed) { - if (layer->support_image_storage && !image_allocation_failed) + if (layer->support_image_storage) { if (blob_mats_gpu_image[bottom_blob_index].dims == 0) { @@ -752,12 +752,12 @@ IMAGE_ALLOCATION_FAILED: } int ret; - if (layer->support_vulkan) + if (layer->support_vulkan && !image_allocation_failed) { #if NCNN_BENCHMARK cmd.record_write_timestamp(layer_index * 2); #endif - if (layer->support_image_storage && !image_allocation_failed) + if (layer->support_image_storage) { ret = do_forward_layer(layer, blob_mats_gpu_image, cmd, opt); if (ret == -100)