From 24a3b99f1fc307fb41345f71b6f5ed774fc7e812 Mon Sep 17 00:00:00 2001 From: nihui Date: Mon, 16 Jun 2025 11:23:41 +0800 Subject: [PATCH] drop layer support_image_storage and option use_image_storage (#6126) * fix pyncnn build --- benchmark/benchncnn.cpp | 1 - examples/yolov4.cpp | 1 - python/src/main.cpp | 2 - python/tests/benchmark.py | 1 - python/tests/test_option.py | 5 - src/c_api.cpp | 11 -- src/c_api.h | 2 - src/convert_ycbcr.comp | 29 ----- src/gpu.cpp | 187 +----------------------------- src/layer.cpp | 4 +- src/layer.h | 5 +- src/layer/input.cpp | 6 - src/layer/input.h | 1 - src/net.cpp | 37 ------ src/option.cpp | 2 +- src/option.h | 3 +- src/pipelinecache.cpp | 2 +- tests/test_cast.cpp | 2 - tests/test_convolution.cpp | 2 - tests/test_convolution_1.cpp | 2 - tests/test_convolution_2.cpp | 2 - tests/test_convolution_3.cpp | 4 - tests/test_deconvolution.cpp | 2 - tests/test_deformableconv2d.cpp | 2 - tests/test_deformableconv2d_1.cpp | 2 - tests/test_deformableconv2d_2.cpp | 2 - tests/test_deformableconv2d_3.cpp | 2 - tests/test_packing.cpp | 1 - tests/test_squeezenet.cpp | 14 +-- tests/testutil.cpp | 110 +++++++----------- 30 files changed, 53 insertions(+), 393 deletions(-) diff --git a/benchmark/benchncnn.cpp b/benchmark/benchncnn.cpp index 067415a25..22a77fb68 100644 --- a/benchmark/benchncnn.cpp +++ b/benchmark/benchncnn.cpp @@ -381,7 +381,6 @@ int main(int argc, char** argv) opt.use_int8_arithmetic = true; opt.use_packing_layout = true; opt.use_shader_pack8 = false; - opt.use_image_storage = false; fprintf(stderr, "loop_count = %d\n", g_loop_count); fprintf(stderr, "num_threads = %d\n", num_threads); diff --git a/examples/yolov4.cpp b/examples/yolov4.cpp index 764ce7075..6ffb83d97 100644 --- a/examples/yolov4.cpp +++ b/examples/yolov4.cpp @@ -55,7 +55,6 @@ static int init_yolov4(ncnn::Net* yolov4, int* target_size) yolov4->opt.use_fp16_arithmetic = true; yolov4->opt.use_packing_layout = true; yolov4->opt.use_shader_pack8 = false; - yolov4->opt.use_image_storage = false; /* --> End of setting params <-- */ int ret = 0; diff --git a/python/src/main.cpp b/python/src/main.cpp index a3cf60c19..2d25ebb0f 100644 --- a/python/src/main.cpp +++ b/python/src/main.cpp @@ -215,7 +215,6 @@ PYBIND11_MODULE(ncnn, m) .def_readwrite("use_packing_layout", &Option::use_packing_layout) .def_readwrite("use_shader_pack8", &Option::use_shader_pack8) .def_readwrite("use_subgroup_ops", &Option::use_subgroup_ops) - .def_readwrite("use_image_storage", &Option::use_image_storage) .def_readwrite("use_tensor_storage", &Option::use_tensor_storage); py::class_ mat(m, "Mat", py::buffer_protocol()); @@ -889,7 +888,6 @@ PYBIND11_MODULE(ncnn, m) .def_readwrite("support_packing", &Layer::support_packing) .def_readwrite("support_bf16_storage", &Layer::support_bf16_storage) .def_readwrite("support_fp16_storage", &Layer::support_fp16_storage) - .def_readwrite("support_image_storage", &Layer::support_image_storage) .def("forward", (int (Layer::*)(const std::vector&, std::vector&, const Option&) const) & Layer::forward, py::arg("bottom_blobs"), py::arg("top_blobs"), py::arg("opt")) .def("forward", (int (Layer::*)(const Mat&, Mat&, const Option&) const) & Layer::forward, diff --git a/python/tests/benchmark.py b/python/tests/benchmark.py index 7e2f27ac9..0c8846a25 100644 --- a/python/tests/benchmark.py +++ b/python/tests/benchmark.py @@ -148,7 +148,6 @@ if __name__ == "__main__": opt.use_int8_arithmetic = True opt.use_packing_layout = True opt.use_shader_pack8 = False - opt.use_image_storage = False ncnn.set_cpu_powersave(powersave) ncnn.set_omp_dynamic(0) diff --git a/python/tests/test_option.py b/python/tests/test_option.py index 84196cdd4..883bbc75a 100644 --- a/python/tests/test_option.py +++ b/python/tests/test_option.py @@ -113,11 +113,6 @@ def test_option(): opt.use_subgroup_ops = False assert opt.use_subgroup_ops == False - opt.use_image_storage = True - assert opt.use_image_storage == True - opt.use_image_storage = False - assert opt.use_image_storage == False - opt.use_tensor_storage = True assert opt.use_tensor_storage == True opt.use_tensor_storage = False diff --git a/src/c_api.cpp b/src/c_api.cpp index 2405598b4..75cf6a664 100644 --- a/src/c_api.cpp +++ b/src/c_api.cpp @@ -1130,11 +1130,6 @@ int ncnn_layer_get_support_fp16_storage(const ncnn_layer_t layer) return ((const Layer*)layer->pthis)->support_fp16_storage; } -int ncnn_layer_get_support_image_storage(const ncnn_layer_t layer) -{ - return ((const Layer*)layer->pthis)->support_image_storage; -} - void ncnn_layer_set_one_blob_only(ncnn_layer_t layer, int enable) { ((Layer*)layer->pthis)->one_blob_only = enable; @@ -1165,11 +1160,6 @@ void ncnn_layer_set_support_fp16_storage(ncnn_layer_t layer, int enable) ((Layer*)layer->pthis)->support_fp16_storage = enable; } -void ncnn_layer_set_support_image_storage(ncnn_layer_t layer, int enable) -{ - ((Layer*)layer->pthis)->support_image_storage = enable; -} - int ncnn_layer_get_bottom_count(const ncnn_layer_t layer) { return (int)((const Layer*)layer->pthis)->bottoms.size(); @@ -1264,7 +1254,6 @@ static ::ncnn::Layer* __Layer_c_api_layer_creator(void* userdata) layer->support_bf16_storage = ncnn_layer_get_support_bf16_storage(layer0); layer->support_fp16_storage = ncnn_layer_get_support_fp16_storage(layer0); - layer->support_image_storage = ncnn_layer_get_support_image_storage(layer0); return layer; } diff --git a/src/c_api.h b/src/c_api.h index f752bfed6..141713f31 100644 --- a/src/c_api.h +++ b/src/c_api.h @@ -229,7 +229,6 @@ NCNN_EXPORT int ncnn_layer_get_support_vulkan(const ncnn_layer_t layer); NCNN_EXPORT int ncnn_layer_get_support_packing(const ncnn_layer_t layer); NCNN_EXPORT int ncnn_layer_get_support_bf16_storage(const ncnn_layer_t layer); NCNN_EXPORT int ncnn_layer_get_support_fp16_storage(const ncnn_layer_t layer); -NCNN_EXPORT int ncnn_layer_get_support_image_storage(const ncnn_layer_t layer); NCNN_EXPORT void ncnn_layer_set_one_blob_only(ncnn_layer_t layer, int enable); NCNN_EXPORT void ncnn_layer_set_support_inplace(ncnn_layer_t layer, int enable); @@ -237,7 +236,6 @@ NCNN_EXPORT void ncnn_layer_set_support_vulkan(ncnn_layer_t layer, int enable); NCNN_EXPORT void ncnn_layer_set_support_packing(ncnn_layer_t layer, int enable); NCNN_EXPORT void ncnn_layer_set_support_bf16_storage(ncnn_layer_t layer, int enable); NCNN_EXPORT void ncnn_layer_set_support_fp16_storage(ncnn_layer_t layer, int enable); -NCNN_EXPORT void ncnn_layer_set_support_image_storage(ncnn_layer_t layer, int enable); NCNN_EXPORT int ncnn_layer_get_bottom_count(const ncnn_layer_t layer); NCNN_EXPORT int ncnn_layer_get_bottom(const ncnn_layer_t layer, int i); diff --git a/src/convert_ycbcr.comp b/src/convert_ycbcr.comp index f166dddb7..4185f613a 100644 --- a/src/convert_ycbcr.comp +++ b/src/convert_ycbcr.comp @@ -23,13 +23,8 @@ layout (constant_id = 5) const int rotate_from = 0; layout (constant_id = 6) const int need_resize = 0; layout (binding = 0) uniform sampler2D android_hardware_buffer_image; -#if NCNN_image_shader -layout (binding = 1, imfmtc1) writeonly uniform unfp image3D vkmat_blob; -layout (binding = 2, imfmtc4) writeonly uniform unfp image3D vkmat_pack4_blob; -#else layout (binding = 1) writeonly buffer vkmat_blob { sfp vkmat_blob_data[]; }; layout (binding = 2) writeonly buffer vkmat_pack4_blob { sfpvec4 vkmat_pack4_blob_data[]; }; -#endif void main() { @@ -102,32 +97,20 @@ void main() if (type_to == 1) // PIXEL_RGB { -#if NCNN_image_shader - image3d_st1(vkmat_blob, ivec3(gx, gy, 0), rgb.r); - image3d_st1(vkmat_blob, ivec3(gx, gy, 1), rgb.g); - image3d_st1(vkmat_blob, ivec3(gx, gy, 2), rgb.b); -#else ivec3 v_offset = (gy * outw + gx) + ivec3(0, 1, 2) * outcstep; buffer_st1(vkmat_blob_data, v_offset.r, afp(rgb.r)); buffer_st1(vkmat_blob_data, v_offset.g, afp(rgb.g)); buffer_st1(vkmat_blob_data, v_offset.b, afp(rgb.b)); -#endif } if (type_to == 2) // PIXEL_BGR { -#if NCNN_image_shader - image3d_st1(vkmat_blob, ivec3(gx, gy, 0), rgb.b); - image3d_st1(vkmat_blob, ivec3(gx, gy, 1), rgb.g); - image3d_st1(vkmat_blob, ivec3(gx, gy, 2), rgb.r); -#else ivec3 v_offset = (gy * outw + gx) + ivec3(0, 1, 2) * outcstep; buffer_st1(vkmat_blob_data, v_offset.r, afp(rgb.b)); buffer_st1(vkmat_blob_data, v_offset.g, afp(rgb.g)); buffer_st1(vkmat_blob_data, v_offset.b, afp(rgb.r)); -#endif } if (type_to == 3) // PIXEL_GRAY @@ -135,13 +118,9 @@ void main() // coeffs for r g b = 0.299f, 0.587f, 0.114f float v = clamp(rgb.r * 0.299f + rgb.g * 0.587f + rgb.b * 0.114f, 0.f, 255.f); -#if NCNN_image_shader - image3d_st1(vkmat_blob, ivec3(gx, gy, 0), v); -#else int v_offset = gy * outw + gx; buffer_st1(vkmat_blob_data, v_offset, afp(v)); -#endif } if (type_to == 4) // PIXEL_RGBA @@ -150,13 +129,9 @@ void main() rgba.rgb = rgb; rgba.a = 255.f; -#if NCNN_image_shader - image3d_st4(vkmat_pack4_blob, ivec3(gx, gy, 0), rgba); -#else int v_offset = gy * outw + gx; buffer_st4(vkmat_pack4_blob_data, v_offset, afpvec4(rgba)); -#endif } if (type_to == 5) // PIXEL_BGRA @@ -165,12 +140,8 @@ void main() rgba.bgr = rgb; rgba.a = 255.f; -#if NCNN_image_shader - image3d_st4(vkmat_pack4_blob, ivec3(gx, gy, 0), rgba); -#else int v_offset = gy * outw + gx; buffer_st4(vkmat_pack4_blob_data, v_offset, afpvec4(rgba)); -#endif } } diff --git a/src/gpu.cpp b/src/gpu.cpp index a39fad252..a42570129 100644 --- a/src/gpu.cpp +++ b/src/gpu.cpp @@ -3111,7 +3111,6 @@ const ncnn::Packing_vulkan* VulkanDevicePrivate::get_utility_operator(int storag // create uop Option opt; - opt.use_image_storage = (storage_type_from == 1 || storage_type_to == 1); opt.use_fp16_packed = (cast_type_from_index == 1 || cast_type_to_index == 1); opt.use_fp16_storage = (cast_type_from_index == 2 || cast_type_to_index == 2); @@ -3174,8 +3173,6 @@ void VulkanDevicePrivate::destroy_utility_operator() opt.pipeline_cache = 0; opt.vulkan_device_index = vkdev->info.device_index(); - opt.use_image_storage = false; - // from fp32-b/i | fp16p-b/i | fp16s-b/i // to fp32-b/i | fp16p-b/i | fp16s-b/i for (int j0 = 0; j0 < 3; j0++) @@ -4250,12 +4247,8 @@ uint32_t VulkanDevice::get_heap_budget() const return memoryBudgetProperties.heapBudget[buffer_heap_index] / 1024 / 1024; } -void VulkanDevice::convert_packing(const VkMat& src, VkMat& dst, int dst_elempack, VkCompute& cmd, const Option& _opt) const +void VulkanDevice::convert_packing(const VkMat& src, VkMat& dst, int dst_elempack, VkCompute& cmd, const Option& opt) const { - // buffer2buffer uop is created with use_image_storage disabled - Option opt = _opt; - opt.use_image_storage = false; - int cast_type_to_index = opt.use_fp16_storage ? 2 : opt.use_fp16_packed ? 1 : 0; int packing_type_to_index = dst_elempack == 1 ? 0 : dst_elempack == 4 ? 1 : 2; @@ -4810,179 +4803,6 @@ int compile_spirv_module(const char* comp_data, int comp_data_size, const Option custom_defines.append("afp2sfpmat4(v)", "v"); } - if (opt.use_image_storage) - { - if (opt.use_fp16_storage) - { - custom_defines.append("imfmtc1", "r16f"); - custom_defines.append("imfmtc4", "rgba16f"); - custom_defines.append("unfp", "mediump"); - } - else if (opt.use_fp16_packed) - { - custom_defines.append("imfmtc1", "r32f"); - custom_defines.append("imfmtc4", "rgba16f"); - custom_defines.append("unfp", "mediump"); - } - else - { - custom_defines.append("imfmtc1", "r32f"); - custom_defines.append("imfmtc4", "rgba32f"); - custom_defines.append("unfp", "highp"); - } - - if (opt.use_fp16_storage && opt.use_fp16_arithmetic) - { - custom_defines.append("image1d_ld1(tex,p)", "float16_t(texelFetch(tex,p,0).r)"); - custom_defines.append("image2d_ld1(tex,p)", "float16_t(texelFetch(tex,p,0).r)"); - custom_defines.append("image3d_ld1(tex,p)", "float16_t(texelFetch(tex,p,0).r)"); - custom_defines.append("image1d_st1(img,p,v)", "{vec4 _v;_v.r=float(v);imageStore(img,p,_v);}"); - custom_defines.append("image2d_st1(img,p,v)", "{vec4 _v;_v.r=float(v);imageStore(img,p,_v);}"); - custom_defines.append("image3d_st1(img,p,v)", "{vec4 _v;_v.r=float(v);imageStore(img,p,_v);}"); - custom_defines.append("image1d_cp1(img,p,tex,sp)", "{imageStore(img,p,texelFetch(tex,sp,0));}"); - custom_defines.append("image2d_cp1(img,p,tex,sp)", "{imageStore(img,p,texelFetch(tex,sp,0));}"); - custom_defines.append("image3d_cp1(img,p,tex,sp)", "{imageStore(img,p,texelFetch(tex,sp,0));}"); - custom_defines.append("image1d_ld4(tex,p)", "f16vec4(texelFetch(tex,p,0))"); - custom_defines.append("image2d_ld4(tex,p)", "f16vec4(texelFetch(tex,p,0))"); - custom_defines.append("image3d_ld4(tex,p)", "f16vec4(texelFetch(tex,p,0))"); - custom_defines.append("image1d_st4(img,p,v)", "{imageStore(img,p,vec4(v));}"); - custom_defines.append("image2d_st4(img,p,v)", "{imageStore(img,p,vec4(v));}"); - custom_defines.append("image3d_st4(img,p,v)", "{imageStore(img,p,vec4(v));}"); - custom_defines.append("image1d_cp4(img,p,tex,sp)", "{imageStore(img,p,texelFetch(tex,sp,0));}"); - custom_defines.append("image2d_cp4(img,p,tex,sp)", "{imageStore(img,p,texelFetch(tex,sp,0));}"); - custom_defines.append("image3d_cp4(img,p,tex,sp)", "{imageStore(img,p,texelFetch(tex,sp,0));}"); - custom_defines.append("image1d_ld8(tex,p)", "f16mat2x4(texelFetch(tex,(p)*2,0),texelFetch(tex,(p)*2+1,0))"); - custom_defines.append("image2d_ld8(tex,p)", "f16mat2x4(texelFetch(tex,ivec2(p.x*2,p.y),0),texelFetch(tex,ivec2(p.x*2+1,p.y),0))"); - custom_defines.append("image3d_ld8(tex,p)", "f16mat2x4(texelFetch(tex,ivec3(p.x*2,p.y,p.z),0),texelFetch(tex,ivec3(p.x*2+1,p.y,p.z),0))"); - custom_defines.append("image1d_st8(img,p,v)", "{imageStore(img,(p)*2,vec4(v[0]));imageStore(img,(p)*2+1,vec4(v[1]));}"); - custom_defines.append("image2d_st8(img,p,v)", "{imageStore(img,ivec2(p.x*2,p.y),vec4(v[0]));imageStore(img,ivec2(p.x*2+1,p.y),vec4(v[1]));}"); - custom_defines.append("image3d_st8(img,p,v)", "{imageStore(img,ivec3(p.x*2,p.y,p.z),vec4(v[0]));imageStore(img,ivec3(p.x*2+1,p.y,p.z),vec4(v[1]));}"); - custom_defines.append("image1d_cp8(img,p,tex,sp)", "{imageStore(img,(p)*2,texelFetch(tex,sp*2,0));imageStore(img,(p)*2+1,texelFetch(tex,sp*2+1,0));}"); - custom_defines.append("image2d_cp8(img,p,tex,sp)", "{imageStore(img,ivec2(p.x*2,p.y),texelFetch(tex,ivec2(sp.x*2,sp.y),0));imageStore(img,ivec2(p.x*2+1,p.y),texelFetch(tex,ivec2(sp.x*2+1,sp.y),0));}"); - custom_defines.append("image3d_cp8(img,p,tex,sp)", "{imageStore(img,ivec3(p.x*2,p.y,p.z),texelFetch(tex,ivec3(sp.x*2,sp.y,sp.z),0));imageStore(img,ivec3(p.x*2+1,p.y,p.z),texelFetch(tex,ivec3(sp.x*2+1,sp.y,sp.z),0));}"); - } - else if (opt.use_fp16_packed && opt.use_fp16_arithmetic) - { - custom_defines.append("image1d_ld1(tex,p)", "float16_t(texelFetch(tex,p,0).r)"); - custom_defines.append("image2d_ld1(tex,p)", "float16_t(texelFetch(tex,p,0).r)"); - custom_defines.append("image3d_ld1(tex,p)", "float16_t(texelFetch(tex,p,0).r)"); - custom_defines.append("image1d_st1(img,p,v)", "{vec4 _v;_v.r=v;imageStore(img,p,_v);}"); - custom_defines.append("image2d_st1(img,p,v)", "{vec4 _v;_v.r=v;imageStore(img,p,_v);}"); - custom_defines.append("image3d_st1(img,p,v)", "{vec4 _v;_v.r=v;imageStore(img,p,_v);}"); - custom_defines.append("image1d_cp1(img,p,tex,sp)", "{imageStore(img,p,texelFetch(tex,sp,0));}"); - custom_defines.append("image2d_cp1(img,p,tex,sp)", "{imageStore(img,p,texelFetch(tex,sp,0));}"); - custom_defines.append("image3d_cp1(img,p,tex,sp)", "{imageStore(img,p,texelFetch(tex,sp,0));}"); - custom_defines.append("image1d_ld4(tex,p)", "f16vec4(texelFetch(tex,p,0))"); - custom_defines.append("image2d_ld4(tex,p)", "f16vec4(texelFetch(tex,p,0))"); - custom_defines.append("image3d_ld4(tex,p)", "f16vec4(texelFetch(tex,p,0))"); - custom_defines.append("image1d_st4(img,p,v)", "{imageStore(img,p,v);}"); - custom_defines.append("image2d_st4(img,p,v)", "{imageStore(img,p,v);}"); - custom_defines.append("image3d_st4(img,p,v)", "{imageStore(img,p,v);}"); - custom_defines.append("image1d_cp4(img,p,tex,sp)", "{imageStore(img,p,texelFetch(tex,sp,0));}"); - custom_defines.append("image2d_cp4(img,p,tex,sp)", "{imageStore(img,p,texelFetch(tex,sp,0));}"); - custom_defines.append("image3d_cp4(img,p,tex,sp)", "{imageStore(img,p,texelFetch(tex,sp,0));}"); - custom_defines.append("image1d_ld8(tex,p)", "f16mat2x4(texelFetch(tex,(p)*2,0),texelFetch(tex,(p)*2+1,0))"); - custom_defines.append("image2d_ld8(tex,p)", "f16mat2x4(texelFetch(tex,ivec2(p.x*2,p.y),0),texelFetch(tex,ivec2(p.x*2+1,p.y),0))"); - custom_defines.append("image3d_ld8(tex,p)", "f16mat2x4(texelFetch(tex,ivec3(p.x*2,p.y,p.z),0),texelFetch(tex,ivec3(p.x*2+1,p.y,p.z),0))"); - custom_defines.append("image1d_st8(img,p,v)", "{imageStore(img,(p)*2,v[0]);imageStore(img,(p)*2+1,v[1]);}"); - custom_defines.append("image2d_st8(img,p,v)", "{imageStore(img,ivec2(p.x*2,p.y),v[0]);imageStore(img,ivec2(p.x*2+1,p.y),v[1]);}"); - custom_defines.append("image3d_st8(img,p,v)", "{imageStore(img,ivec3(p.x*2,p.y,p.z),v[0]);imageStore(img,ivec3(p.x*2+1,p.y,p.z),v[1]);}"); - custom_defines.append("image1d_cp8(img,p,tex,sp)", "{imageStore(img,(p)*2,texelFetch(tex,sp*2,0));imageStore(img,(p)*2+1,texelFetch(tex,sp*2+1,0));}"); - custom_defines.append("image2d_cp8(img,p,tex,sp)", "{imageStore(img,ivec2(p.x*2,p.y),texelFetch(tex,ivec2(sp.x*2,sp.y),0));imageStore(img,ivec2(p.x*2+1,p.y),texelFetch(tex,ivec2(sp.x*2+1,sp.y),0));}"); - custom_defines.append("image3d_cp8(img,p,tex,sp)", "{imageStore(img,ivec3(p.x*2,p.y,p.z),texelFetch(tex,ivec3(sp.x*2,sp.y,sp.z),0));imageStore(img,ivec3(p.x*2+1,p.y,p.z),texelFetch(tex,ivec3(sp.x*2+1,sp.y,sp.z),0));}"); - } - else if (opt.use_fp16_storage) - { - custom_defines.append("image1d_ld1(tex,p)", "texelFetch(tex,p,0).r"); - custom_defines.append("image2d_ld1(tex,p)", "texelFetch(tex,p,0).r"); - custom_defines.append("image3d_ld1(tex,p)", "texelFetch(tex,p,0).r"); - custom_defines.append("image1d_st1(img,p,v)", "{vec4 _v;_v.r=v;imageStore(img,p,_v);}"); - custom_defines.append("image2d_st1(img,p,v)", "{vec4 _v;_v.r=v;imageStore(img,p,_v);}"); - custom_defines.append("image3d_st1(img,p,v)", "{vec4 _v;_v.r=v;imageStore(img,p,_v);}"); - custom_defines.append("image1d_cp1(img,p,tex,sp)", "{imageStore(img,p,texelFetch(tex,sp,0));}"); - custom_defines.append("image2d_cp1(img,p,tex,sp)", "{imageStore(img,p,texelFetch(tex,sp,0));}"); - custom_defines.append("image3d_cp1(img,p,tex,sp)", "{imageStore(img,p,texelFetch(tex,sp,0));}"); - custom_defines.append("image1d_ld4(tex,p)", "texelFetch(tex,p,0)"); - custom_defines.append("image2d_ld4(tex,p)", "texelFetch(tex,p,0)"); - custom_defines.append("image3d_ld4(tex,p)", "texelFetch(tex,p,0)"); - custom_defines.append("image1d_st4(img,p,v)", "{imageStore(img,p,v);}"); - custom_defines.append("image2d_st4(img,p,v)", "{imageStore(img,p,v);}"); - custom_defines.append("image3d_st4(img,p,v)", "{imageStore(img,p,v);}"); - custom_defines.append("image1d_cp4(img,p,tex,sp)", "{imageStore(img,p,texelFetch(tex,sp,0));}"); - custom_defines.append("image2d_cp4(img,p,tex,sp)", "{imageStore(img,p,texelFetch(tex,sp,0));}"); - custom_defines.append("image3d_cp4(img,p,tex,sp)", "{imageStore(img,p,texelFetch(tex,sp,0));}"); - custom_defines.append("image1d_ld8(tex,p)", "mat2x4(texelFetch(tex,(p)*2,0),texelFetch(tex,(p)*2+1,0))"); - custom_defines.append("image2d_ld8(tex,p)", "mat2x4(texelFetch(tex,ivec2(p.x*2,p.y),0),texelFetch(tex,ivec2(p.x*2+1,p.y),0))"); - custom_defines.append("image3d_ld8(tex,p)", "mat2x4(texelFetch(tex,ivec3(p.x*2,p.y,p.z),0),texelFetch(tex,ivec3(p.x*2+1,p.y,p.z),0))"); - custom_defines.append("image1d_st8(img,p,v)", "{imageStore(img,(p)*2,v[0]);imageStore(img,(p)*2+1,v[1]);}"); - custom_defines.append("image2d_st8(img,p,v)", "{imageStore(img,ivec2(p.x*2,p.y),v[0]);imageStore(img,ivec2(p.x*2+1,p.y),v[1]);}"); - custom_defines.append("image3d_st8(img,p,v)", "{imageStore(img,ivec3(p.x*2,p.y,p.z),v[0]);imageStore(img,ivec3(p.x*2+1,p.y,p.z),v[1]);}"); - custom_defines.append("image1d_cp8(img,p,tex,sp)", "{imageStore(img,(p)*2,texelFetch(tex,sp*2,0));imageStore(img,(p)*2+1,texelFetch(tex,sp*2+1,0));}"); - custom_defines.append("image2d_cp8(img,p,tex,sp)", "{imageStore(img,ivec2(p.x*2,p.y),texelFetch(tex,ivec2(sp.x*2,sp.y),0));imageStore(img,ivec2(p.x*2+1,p.y),texelFetch(tex,ivec2(sp.x*2+1,sp.y),0));}"); - custom_defines.append("image3d_cp8(img,p,tex,sp)", "{imageStore(img,ivec3(p.x*2,p.y,p.z),texelFetch(tex,ivec3(sp.x*2,sp.y,sp.z),0));imageStore(img,ivec3(p.x*2+1,p.y,p.z),texelFetch(tex,ivec3(sp.x*2+1,sp.y,sp.z),0));}"); - } - else if (opt.use_fp16_packed) - { - custom_defines.append("image1d_ld1(tex,p)", "texelFetch(tex,p,0).r"); - custom_defines.append("image2d_ld1(tex,p)", "texelFetch(tex,p,0).r"); - custom_defines.append("image3d_ld1(tex,p)", "texelFetch(tex,p,0).r"); - custom_defines.append("image1d_st1(img,p,v)", "{vec4 _v;_v.r=v;imageStore(img,p,_v);}"); - custom_defines.append("image2d_st1(img,p,v)", "{vec4 _v;_v.r=v;imageStore(img,p,_v);}"); - custom_defines.append("image3d_st1(img,p,v)", "{vec4 _v;_v.r=v;imageStore(img,p,_v);}"); - custom_defines.append("image1d_cp1(img,p,tex,sp)", "{imageStore(img,p,texelFetch(tex,sp,0));}"); - custom_defines.append("image2d_cp1(img,p,tex,sp)", "{imageStore(img,p,texelFetch(tex,sp,0));}"); - custom_defines.append("image3d_cp1(img,p,tex,sp)", "{imageStore(img,p,texelFetch(tex,sp,0));}"); - custom_defines.append("image1d_ld4(tex,p)", "texelFetch(tex,p,0)"); - custom_defines.append("image2d_ld4(tex,p)", "texelFetch(tex,p,0)"); - custom_defines.append("image3d_ld4(tex,p)", "texelFetch(tex,p,0)"); - custom_defines.append("image1d_st4(img,p,v)", "{imageStore(img,p,v);}"); - custom_defines.append("image2d_st4(img,p,v)", "{imageStore(img,p,v);}"); - custom_defines.append("image3d_st4(img,p,v)", "{imageStore(img,p,v);}"); - custom_defines.append("image1d_cp4(img,p,tex,sp)", "{imageStore(img,p,texelFetch(tex,sp,0));}"); - custom_defines.append("image2d_cp4(img,p,tex,sp)", "{imageStore(img,p,texelFetch(tex,sp,0));}"); - custom_defines.append("image3d_cp4(img,p,tex,sp)", "{imageStore(img,p,texelFetch(tex,sp,0));}"); - custom_defines.append("image1d_ld8(tex,p)", "mat2x4(texelFetch(tex,(p)*2,0),texelFetch(tex,(p)*2+1,0))"); - custom_defines.append("image2d_ld8(tex,p)", "mat2x4(texelFetch(tex,ivec2(p.x*2,p.y),0),texelFetch(tex,ivec2(p.x*2+1,p.y),0))"); - custom_defines.append("image3d_ld8(tex,p)", "mat2x4(texelFetch(tex,ivec3(p.x*2,p.y,p.z),0),texelFetch(tex,ivec3(p.x*2+1,p.y,p.z),0))"); - custom_defines.append("image1d_st8(img,p,v)", "{imageStore(img,(p)*2,v[0]);imageStore(img,(p)*2+1,v[1]);}"); - custom_defines.append("image2d_st8(img,p,v)", "{imageStore(img,ivec2(p.x*2,p.y),v[0]);imageStore(img,ivec2(p.x*2+1,p.y),v[1]);}"); - custom_defines.append("image3d_st8(img,p,v)", "{imageStore(img,ivec3(p.x*2,p.y,p.z),v[0]);imageStore(img,ivec3(p.x*2+1,p.y,p.z),v[1]);}"); - custom_defines.append("image1d_cp8(img,p,tex,sp)", "{imageStore(img,(p)*2,texelFetch(tex,sp*2,0));imageStore(img,(p)*2+1,texelFetch(tex,sp*2+1,0));}"); - custom_defines.append("image2d_cp8(img,p,tex,sp)", "{imageStore(img,ivec2(p.x*2,p.y),texelFetch(tex,ivec2(sp.x*2,sp.y),0));imageStore(img,ivec2(p.x*2+1,p.y),texelFetch(tex,ivec2(sp.x*2+1,sp.y),0));}"); - custom_defines.append("image3d_cp8(img,p,tex,sp)", "{imageStore(img,ivec3(p.x*2,p.y,p.z),texelFetch(tex,ivec3(sp.x*2,sp.y,sp.z),0));imageStore(img,ivec3(p.x*2+1,p.y,p.z),texelFetch(tex,ivec3(sp.x*2+1,sp.y,sp.z),0));}"); - } - else - { - custom_defines.append("image1d_ld1(tex,p)", "texelFetch(tex,p,0).r"); - custom_defines.append("image2d_ld1(tex,p)", "texelFetch(tex,p,0).r"); - custom_defines.append("image3d_ld1(tex,p)", "texelFetch(tex,p,0).r"); - custom_defines.append("image1d_st1(img,p,v)", "{vec4 _v;_v.r=v;imageStore(img,p,_v);}"); - custom_defines.append("image2d_st1(img,p,v)", "{vec4 _v;_v.r=v;imageStore(img,p,_v);}"); - custom_defines.append("image3d_st1(img,p,v)", "{vec4 _v;_v.r=v;imageStore(img,p,_v);}"); - custom_defines.append("image1d_cp1(img,p,tex,sp)", "{imageStore(img,p,texelFetch(tex,sp,0));}"); - custom_defines.append("image2d_cp1(img,p,tex,sp)", "{imageStore(img,p,texelFetch(tex,sp,0));}"); - custom_defines.append("image3d_cp1(img,p,tex,sp)", "{imageStore(img,p,texelFetch(tex,sp,0));}"); - custom_defines.append("image1d_ld4(tex,p)", "texelFetch(tex,p,0)"); - custom_defines.append("image2d_ld4(tex,p)", "texelFetch(tex,p,0)"); - custom_defines.append("image3d_ld4(tex,p)", "texelFetch(tex,p,0)"); - custom_defines.append("image1d_st4(img,p,v)", "{imageStore(img,p,v);}"); - custom_defines.append("image2d_st4(img,p,v)", "{imageStore(img,p,v);}"); - custom_defines.append("image3d_st4(img,p,v)", "{imageStore(img,p,v);}"); - custom_defines.append("image1d_cp4(img,p,tex,sp)", "{imageStore(img,p,texelFetch(tex,sp,0));}"); - custom_defines.append("image2d_cp4(img,p,tex,sp)", "{imageStore(img,p,texelFetch(tex,sp,0));}"); - custom_defines.append("image3d_cp4(img,p,tex,sp)", "{imageStore(img,p,texelFetch(tex,sp,0));}"); - custom_defines.append("image1d_ld8(tex,p)", "mat2x4(texelFetch(tex,(p)*2,0),texelFetch(tex,(p)*2+1,0))"); - custom_defines.append("image2d_ld8(tex,p)", "mat2x4(texelFetch(tex,ivec2(p.x*2,p.y),0),texelFetch(tex,ivec2(p.x*2+1,p.y),0))"); - custom_defines.append("image3d_ld8(tex,p)", "mat2x4(texelFetch(tex,ivec3(p.x*2,p.y,p.z),0),texelFetch(tex,ivec3(p.x*2+1,p.y,p.z),0))"); - custom_defines.append("image1d_st8(img,p,v)", "{imageStore(img,(p)*2,v[0]);imageStore(img,(p)*2+1,v[1]);}"); - custom_defines.append("image2d_st8(img,p,v)", "{imageStore(img,ivec2(p.x*2,p.y),v[0]);imageStore(img,ivec2(p.x*2+1,p.y),v[1]);}"); - custom_defines.append("image3d_st8(img,p,v)", "{imageStore(img,ivec3(p.x*2,p.y,p.z),v[0]);imageStore(img,ivec3(p.x*2+1,p.y,p.z),v[1]);}"); - custom_defines.append("image1d_cp8(img,p,tex,sp)", "{imageStore(img,(p)*2,texelFetch(tex,sp*2,0));imageStore(img,(p)*2+1,texelFetch(tex,sp*2+1,0));}"); - custom_defines.append("image2d_cp8(img,p,tex,sp)", "{imageStore(img,ivec2(p.x*2,p.y),texelFetch(tex,ivec2(sp.x*2,sp.y),0));imageStore(img,ivec2(p.x*2+1,p.y),texelFetch(tex,ivec2(sp.x*2+1,sp.y),0));}"); - custom_defines.append("image3d_cp8(img,p,tex,sp)", "{imageStore(img,ivec3(p.x*2,p.y,p.z),texelFetch(tex,ivec3(sp.x*2,sp.y,sp.z),0));imageStore(img,ivec3(p.x*2+1,p.y,p.z),texelFetch(tex,ivec3(sp.x*2+1,sp.y,sp.z),0));}"); - } - } - custom_defines.append("psc(x)", "(x==0?p.x:x)"); if (opt.use_fp16_storage) @@ -5023,11 +4843,6 @@ int compile_spirv_module(const char* comp_data, int comp_data_size, const Option custom_defines.append("NCNN_int8_arithmetic", 1); } - if (opt.use_image_storage) - { - custom_defines.append("NCNN_image_shader", 1); - } - if (opt.use_shader_local_memory) { custom_defines.append("NCNN_shader_local_memory", 1); diff --git a/src/layer.cpp b/src/layer.cpp index d62b62189..223ee9afd 100644 --- a/src/layer.cpp +++ b/src/layer.cpp @@ -32,9 +32,9 @@ Layer::Layer() support_bf16_storage = false; support_fp16_storage = false; support_int8_storage = false; - support_image_storage = false; support_tensor_storage = false; + support_reserved_000 = false; support_reserved_00 = false; featmask = 0; @@ -251,14 +251,12 @@ public: support_int8_storage = layer_cpu->support_int8_storage; support_vulkan = 0; - support_image_storage = 0; support_tensor_storage = 0; #if NCNN_VULKAN if (layer_vulkan) { support_vulkan = layer_vulkan->support_vulkan; - support_image_storage = layer_vulkan->support_image_storage; support_tensor_storage = layer_vulkan->support_tensor_storage; } #endif diff --git a/src/layer.h b/src/layer.h index 79da72a07..6a600de46 100644 --- a/src/layer.h +++ b/src/layer.h @@ -74,12 +74,11 @@ public: // accept int8 bool support_int8_storage; - // shader image storage - bool support_image_storage; - // shader tensor storage bool support_tensor_storage; + bool support_reserved_000; + bool support_reserved_00; bool support_reserved_0; diff --git a/src/layer/input.cpp b/src/layer/input.cpp index 623b0bc0f..2f63c9949 100644 --- a/src/layer/input.cpp +++ b/src/layer/input.cpp @@ -23,7 +23,6 @@ Input::Input() support_vulkan = true; support_packing = true; support_bf16_storage = true; - support_image_storage = true; } int Input::load_param(const ParamDict& pd) @@ -45,11 +44,6 @@ int Input::forward_inplace(VkMat& /*bottom_top_blob*/, VkCompute& /*cmd*/, const { return 0; } - -int Input::forward_inplace(VkImageMat& /*bottom_top_blob*/, VkCompute& /*cmd*/, const Option& /*opt*/) const -{ - return 0; -} #endif // NCNN_VULKAN } // namespace ncnn diff --git a/src/layer/input.h b/src/layer/input.h index 2a90b018f..ba26d3f7d 100644 --- a/src/layer/input.h +++ b/src/layer/input.h @@ -30,7 +30,6 @@ public: #if NCNN_VULKAN virtual int forward_inplace(VkMat& bottom_top_blob, VkCompute& cmd, const Option& opt) const; - virtual int forward_inplace(VkImageMat& bottom_top_blob, VkCompute& cmd, const Option& opt) const; #endif // NCNN_VULKAN public: diff --git a/src/net.cpp b/src/net.cpp index 998351cd1..21b99fcf5 100644 --- a/src/net.cpp +++ b/src/net.cpp @@ -53,7 +53,6 @@ public: #if NCNN_VULKAN int forward_layer(int layer_index, std::vector& blob_mats, std::vector& blob_mats_gpu, VkCompute& cmd, const Option& opt) const; - int forward_layer(int layer_index, std::vector& blob_mats, std::vector& blob_mats_gpu, std::vector& blob_mats_gpu_image, VkCompute& cmd, const Option& opt) const; #endif // NCNN_VULKAN int convert_layout(Mat& bottom_blob, const Layer* layer, const Option& opt) const; @@ -61,7 +60,6 @@ public: int do_forward_layer(const Layer* layer, std::vector& blob_mats, const Option& opt) const; #if NCNN_VULKAN int do_forward_layer(const Layer* layer, std::vector& blob_mats_gpu, VkCompute& cmd, const Option& opt) const; - int do_forward_layer(const Layer* layer, std::vector& blob_mats_gpu_image, VkCompute& cmd, const Option& opt) const; #endif // NCNN_VULKAN void update_input_output_indexes(); @@ -121,7 +119,6 @@ static Option get_masked_option(const Option& opt, int featmask) opt1.use_int8_storage = opt1.use_int8_storage && !(featmask & (1 << 3)); opt1.use_int8_arithmetic = opt1.use_int8_arithmetic && !(featmask & (1 << 3)); opt1.use_vulkan_compute = opt1.use_vulkan_compute && !(featmask & (1 << 4)); - opt1.use_image_storage = opt1.use_image_storage && !(featmask & (1 << 4)); opt1.use_tensor_storage = opt1.use_tensor_storage && !(featmask & (1 << 4)); opt1.use_sgemm_convolution = opt1.use_sgemm_convolution && !(featmask & (1 << 5)); opt1.use_winograd_convolution = opt1.use_winograd_convolution && !(featmask & (1 << 6)); @@ -1040,14 +1037,6 @@ int Net::load_param(const DataReader& dr) if (!d->vkdev->info.support_cooperative_matrix()) opt.use_cooperative_matrix = false; if (!d->vkdev->info.support_subgroup_ops()) opt.use_subgroup_ops = false; - if (d->vkdev->info.bug_buffer_image_load_zero()) opt.use_image_storage = false; - - if (opt.use_image_storage && !d->vkdev->info.support_fp16_image()) - { - opt.use_fp16_storage = false; - opt.use_fp16_uniform = false; - } - // enable local memory optimization on discrete gpu only if (d->vkdev->info.type() != 0) opt.use_shader_local_memory = false; @@ -1220,12 +1209,6 @@ int Net::load_param(const DataReader& dr) } Option opt1 = get_masked_option(opt, layer->featmask); -#if NCNN_VULKAN - if (opt1.use_vulkan_compute) - { - if (!layer->support_image_storage) opt1.use_image_storage = false; - } -#endif // NCNN_VULKAN if (layer_support_vulkan && (!layer->support_vulkan || !opt1.use_vulkan_compute)) { @@ -1350,14 +1333,6 @@ int Net::load_param_bin(const DataReader& dr) if (!d->vkdev->info.support_cooperative_matrix()) opt.use_cooperative_matrix = false; if (!d->vkdev->info.support_subgroup_ops()) opt.use_subgroup_ops = false; - if (d->vkdev->info.bug_buffer_image_load_zero()) opt.use_image_storage = false; - - if (opt.use_image_storage && !d->vkdev->info.support_fp16_image()) - { - opt.use_fp16_storage = false; - opt.use_fp16_uniform = false; - } - // enable local memory optimization on discrete gpu only if (d->vkdev->info.type() != 0) opt.use_shader_local_memory = false; @@ -1513,12 +1488,6 @@ int Net::load_param_bin(const DataReader& dr) } Option opt1 = get_masked_option(opt, layer->featmask); -#if NCNN_VULKAN - if (opt1.use_vulkan_compute) - { - if (!layer->support_image_storage) opt1.use_image_storage = false; - } -#endif // NCNN_VULKAN if (layer_support_vulkan && (!layer->support_vulkan || !opt1.use_vulkan_compute)) { @@ -1822,12 +1791,6 @@ void Net::clear() Layer* layer = d->layers[i]; Option opt1 = get_masked_option(opt, layer->featmask); -#if NCNN_VULKAN - if (!layer->support_image_storage) - { - opt1.use_image_storage = false; - } -#endif // NCNN_VULKAN int dret = layer->destroy_pipeline(opt1); if (dret != 0) diff --git a/src/option.cpp b/src/option.cpp index 645f195cb..f464cb557 100644 --- a/src/option.cpp +++ b/src/option.cpp @@ -57,8 +57,8 @@ Option::Option() vulkan_device_index = -1; use_reserved_1 = false; - use_image_storage = false; use_tensor_storage = false; + use_reserved_1p = false; use_reserved_2 = false; diff --git a/src/option.h b/src/option.h index 50bb944ad..bbc48508d 100644 --- a/src/option.h +++ b/src/option.h @@ -118,10 +118,9 @@ public: bool use_reserved_1; - // turn on for adreno - bool use_image_storage; bool use_tensor_storage; + bool use_reserved_1p; bool use_reserved_2; // enable DAZ(Denormals-Are-Zero) and FTZ(Flush-To-Zero) diff --git a/src/pipelinecache.cpp b/src/pipelinecache.cpp index 244d08d4e..cceba36c1 100644 --- a/src/pipelinecache.cpp +++ b/src/pipelinecache.cpp @@ -150,7 +150,7 @@ PipelineCachePrivate::pipeline_cache_digest::pipeline_cache_digest(int _shader_t shader_type_index = _shader_type_index; // encode opt - opt_bits = opt.use_image_storage << 7 + opt_bits = 0 << 7 | opt.use_fp16_packed << 6 | opt.use_fp16_storage << 5 | opt.use_fp16_arithmetic << 4 diff --git a/tests/test_cast.cpp b/tests/test_cast.cpp index c98597f69..1cfc3f64e 100644 --- a/tests/test_cast.cpp +++ b/tests/test_cast.cpp @@ -162,7 +162,6 @@ static int test_cast_gpu_fp16p(const ncnn::Mat& a, int type_from, int type_to) opt.use_int8_storage = false; opt.use_int8_arithmetic = false; opt.use_packing_layout = true; - opt.use_image_storage = false; ncnn::VulkanDevice* vkdev = ncnn::get_gpu_device(); @@ -278,7 +277,6 @@ static int test_cast_gpu_fp16p_pack8(const ncnn::Mat& a, int type_from, int type opt.use_int8_arithmetic = false; opt.use_packing_layout = true; opt.use_shader_pack8 = true; - opt.use_image_storage = false; ncnn::VulkanDevice* vkdev = ncnn::get_gpu_device(); diff --git a/tests/test_convolution.cpp b/tests/test_convolution.cpp index b37634fc3..fbdd41413 100644 --- a/tests/test_convolution.cpp +++ b/tests/test_convolution.cpp @@ -57,7 +57,6 @@ static int test_convolution(int w, int h, int c, int outch, int kernel, int dila opt.use_fp16_arithmetic = false; opt.use_bf16_storage = false; opt.use_shader_pack8 = false; - opt.use_image_storage = false; opt.use_sgemm_convolution = false; opt.use_winograd_convolution = false; @@ -78,7 +77,6 @@ static int test_convolution(int w, int h, int c, int outch, int kernel, int dila opt.use_fp16_arithmetic = true; opt.use_bf16_storage = true; opt.use_shader_pack8 = true; - opt.use_image_storage = true; opt.use_sgemm_convolution = false; opt.use_winograd_convolution = false; diff --git a/tests/test_convolution_1.cpp b/tests/test_convolution_1.cpp index 77dd6dab1..30de517af 100644 --- a/tests/test_convolution_1.cpp +++ b/tests/test_convolution_1.cpp @@ -57,7 +57,6 @@ static int test_convolution(int w, int h, int c, int outch, int kernel, int dila opt.use_fp16_arithmetic = false; opt.use_bf16_storage = false; opt.use_shader_pack8 = false; - opt.use_image_storage = false; opt.use_sgemm_convolution = false; opt.use_winograd_convolution = false; @@ -78,7 +77,6 @@ static int test_convolution(int w, int h, int c, int outch, int kernel, int dila opt.use_fp16_arithmetic = true; opt.use_bf16_storage = true; opt.use_shader_pack8 = true; - opt.use_image_storage = true; opt.use_sgemm_convolution = false; opt.use_winograd_convolution = false; diff --git a/tests/test_convolution_2.cpp b/tests/test_convolution_2.cpp index 7243dd649..5d8eaff14 100644 --- a/tests/test_convolution_2.cpp +++ b/tests/test_convolution_2.cpp @@ -59,7 +59,6 @@ static int test_convolution(int w, int h, int c, int outch, int kernel, int dila opt.use_fp16_arithmetic = false; opt.use_bf16_storage = false; opt.use_shader_pack8 = false; - opt.use_image_storage = false; opt.use_sgemm_convolution = false; opt.use_winograd_convolution = false; @@ -80,7 +79,6 @@ static int test_convolution(int w, int h, int c, int outch, int kernel, int dila opt.use_fp16_arithmetic = true; opt.use_bf16_storage = true; opt.use_shader_pack8 = true; - opt.use_image_storage = true; opt.use_sgemm_convolution = false; opt.use_winograd_convolution = false; diff --git a/tests/test_convolution_3.cpp b/tests/test_convolution_3.cpp index 90e11aa8c..9bdf67ce5 100644 --- a/tests/test_convolution_3.cpp +++ b/tests/test_convolution_3.cpp @@ -207,7 +207,6 @@ static int test_convolution_int8(int w, int h, int c, int outch, int kernel, int opt.use_fp16_arithmetic = false; opt.use_bf16_storage = false; opt.use_shader_pack8 = false; - opt.use_image_storage = false; opt.use_sgemm_convolution = false; opt.use_winograd_convolution = true; opt.use_winograd23_convolution = true; @@ -230,7 +229,6 @@ static int test_convolution_int8(int w, int h, int c, int outch, int kernel, int opt.use_fp16_arithmetic = false; opt.use_bf16_storage = false; opt.use_shader_pack8 = false; - opt.use_image_storage = false; opt.use_sgemm_convolution = false; opt.use_winograd_convolution = false; @@ -251,7 +249,6 @@ static int test_convolution_int8(int w, int h, int c, int outch, int kernel, int opt.use_fp16_arithmetic = false; opt.use_bf16_storage = false; opt.use_shader_pack8 = false; - opt.use_image_storage = false; opt.use_sgemm_convolution = false; opt.use_winograd_convolution = false; @@ -272,7 +269,6 @@ static int test_convolution_int8(int w, int h, int c, int outch, int kernel, int opt.use_fp16_arithmetic = true; opt.use_bf16_storage = true; opt.use_shader_pack8 = true; - opt.use_image_storage = true; opt.use_sgemm_convolution = false; opt.use_winograd_convolution = false; diff --git a/tests/test_deconvolution.cpp b/tests/test_deconvolution.cpp index 5da329246..a840299dd 100644 --- a/tests/test_deconvolution.cpp +++ b/tests/test_deconvolution.cpp @@ -63,7 +63,6 @@ static int test_deconvolution(int w, int h, int c, int outch, int kernel, int di opt.use_fp16_arithmetic = false; opt.use_bf16_storage = false; opt.use_shader_pack8 = false; - opt.use_image_storage = false; opt.use_sgemm_convolution = false; opt.use_winograd_convolution = false; @@ -83,7 +82,6 @@ static int test_deconvolution(int w, int h, int c, int outch, int kernel, int di opt.use_fp16_arithmetic = true; opt.use_bf16_storage = true; opt.use_shader_pack8 = true; - opt.use_image_storage = true; opt.use_sgemm_convolution = false; opt.use_winograd_convolution = false; diff --git a/tests/test_deformableconv2d.cpp b/tests/test_deformableconv2d.cpp index 2274978c2..0f979f525 100644 --- a/tests/test_deformableconv2d.cpp +++ b/tests/test_deformableconv2d.cpp @@ -62,7 +62,6 @@ static int test_deformableconv2d(int w, int h, int c, int outch, int kernel, int opt.use_fp16_arithmetic = false; opt.use_bf16_storage = false; opt.use_shader_pack8 = false; - opt.use_image_storage = false; opt.use_sgemm_convolution = false; opt.use_winograd_convolution = false; @@ -82,7 +81,6 @@ static int test_deformableconv2d(int w, int h, int c, int outch, int kernel, int opt.use_fp16_arithmetic = true; opt.use_bf16_storage = true; opt.use_shader_pack8 = true; - opt.use_image_storage = true; opt.use_sgemm_convolution = false; opt.use_winograd_convolution = false; diff --git a/tests/test_deformableconv2d_1.cpp b/tests/test_deformableconv2d_1.cpp index 134c4e9b6..c74a18bea 100644 --- a/tests/test_deformableconv2d_1.cpp +++ b/tests/test_deformableconv2d_1.cpp @@ -62,7 +62,6 @@ static int test_deformableconv2d(int w, int h, int c, int outch, int kernel, int opt.use_fp16_arithmetic = false; opt.use_bf16_storage = false; opt.use_shader_pack8 = false; - opt.use_image_storage = false; opt.use_sgemm_convolution = false; opt.use_winograd_convolution = false; @@ -82,7 +81,6 @@ static int test_deformableconv2d(int w, int h, int c, int outch, int kernel, int opt.use_fp16_arithmetic = true; opt.use_bf16_storage = true; opt.use_shader_pack8 = true; - opt.use_image_storage = true; opt.use_sgemm_convolution = false; opt.use_winograd_convolution = false; diff --git a/tests/test_deformableconv2d_2.cpp b/tests/test_deformableconv2d_2.cpp index 42ca21765..76b7d1afd 100644 --- a/tests/test_deformableconv2d_2.cpp +++ b/tests/test_deformableconv2d_2.cpp @@ -62,7 +62,6 @@ static int test_deformableconv2d(int w, int h, int c, int outch, int kernel, int opt.use_fp16_arithmetic = false; opt.use_bf16_storage = false; opt.use_shader_pack8 = false; - opt.use_image_storage = false; opt.use_sgemm_convolution = false; opt.use_winograd_convolution = false; @@ -82,7 +81,6 @@ static int test_deformableconv2d(int w, int h, int c, int outch, int kernel, int opt.use_fp16_arithmetic = true; opt.use_bf16_storage = true; opt.use_shader_pack8 = true; - opt.use_image_storage = true; opt.use_sgemm_convolution = false; opt.use_winograd_convolution = false; diff --git a/tests/test_deformableconv2d_3.cpp b/tests/test_deformableconv2d_3.cpp index e16301fd8..631df4efb 100644 --- a/tests/test_deformableconv2d_3.cpp +++ b/tests/test_deformableconv2d_3.cpp @@ -62,7 +62,6 @@ static int test_deformableconv2d(int w, int h, int c, int outch, int kernel, int opt.use_fp16_arithmetic = false; opt.use_bf16_storage = false; opt.use_shader_pack8 = false; - opt.use_image_storage = false; opt.use_sgemm_convolution = false; opt.use_winograd_convolution = false; @@ -82,7 +81,6 @@ static int test_deformableconv2d(int w, int h, int c, int outch, int kernel, int opt.use_fp16_arithmetic = true; opt.use_bf16_storage = true; opt.use_shader_pack8 = true; - opt.use_image_storage = true; opt.use_sgemm_convolution = false; opt.use_winograd_convolution = false; diff --git a/tests/test_packing.cpp b/tests/test_packing.cpp index ecbe407a4..2d84199eb 100644 --- a/tests/test_packing.cpp +++ b/tests/test_packing.cpp @@ -240,7 +240,6 @@ static int test_packing_gpu_buffer(const ncnn::Mat& a, int in_elempack, int out_ opt.use_int8_arithmetic = false; opt.use_packing_layout = true; opt.use_shader_pack8 = true; - opt.use_image_storage = false; ncnn::VulkanDevice* vkdev = ncnn::get_gpu_device(); diff --git a/tests/test_squeezenet.cpp b/tests/test_squeezenet.cpp index ff078ad5e..4c4485e2c 100644 --- a/tests/test_squeezenet.cpp +++ b/tests/test_squeezenet.cpp @@ -256,7 +256,6 @@ public: support_bf16_storage = impl->support_bf16_storage; support_fp16_storage = impl->support_fp16_storage; support_int8_storage = impl->support_int8_storage; - support_image_storage = impl->support_image_storage; } ~MyConvolution() @@ -290,7 +289,6 @@ public: support_bf16_storage = impl->support_bf16_storage; support_fp16_storage = impl->support_fp16_storage; support_int8_storage = impl->support_int8_storage; - support_image_storage = impl->support_image_storage; return ret; } @@ -431,14 +429,12 @@ int main() opts[0].use_fp16_storage = false; opts[0].use_fp16_arithmetic = false; opts[0].use_shader_pack8 = false; - opts[0].use_image_storage = false; opts[1].use_packing_layout = true; opts[1].use_fp16_packed = true; opts[1].use_fp16_storage = false; opts[1].use_fp16_arithmetic = false; opts[1].use_shader_pack8 = true; - opts[1].use_image_storage = false; opts[2].use_packing_layout = true; opts[2].use_fp16_packed = true; @@ -446,7 +442,6 @@ int main() opts[2].use_fp16_arithmetic = false; opts[2].use_bf16_storage = false; // FIXME enable me opts[2].use_shader_pack8 = true; - opts[2].use_image_storage = true; opts[2].blob_allocator = &g_blob_pool_allocator; opts[2].workspace_allocator = &g_workspace_pool_allocator; @@ -456,7 +451,6 @@ int main() opts[3].use_fp16_arithmetic = false; // FIXME enable me opts[3].use_bf16_storage = false; opts[3].use_shader_pack8 = true; - opts[3].use_image_storage = true; opts[3].blob_allocator = &g_blob_pool_allocator; opts[3].workspace_allocator = &g_workspace_pool_allocator; @@ -488,7 +482,7 @@ int main() ret = test_squeezenet(opt_cpu, load_model_types[i], epsilon); if (ret != 0) { - fprintf(stderr, "test_squeezenet cpu failed use_packing_layout=%d use_fp16_packed=%d use_fp16_storage=%d use_shader_pack8=%d use_bf16_storage=%d use_image_storage=%d\n", opt.use_packing_layout, opt.use_fp16_packed, opt.use_fp16_storage, opt.use_shader_pack8, opt.use_bf16_storage, opt.use_image_storage); + fprintf(stderr, "test_squeezenet cpu failed use_packing_layout=%d use_fp16_packed=%d use_fp16_storage=%d use_shader_pack8=%d use_bf16_storage=%d\n", opt.use_packing_layout, opt.use_fp16_packed, opt.use_fp16_storage, opt.use_shader_pack8, opt.use_bf16_storage); return ret; } @@ -498,7 +492,7 @@ int main() ret = test_squeezenet(opt_gpu, load_model_types[i], epsilon); if (ret != 0) { - fprintf(stderr, "test_squeezenet gpu failed use_packing_layout=%d use_fp16_packed=%d use_fp16_storage=%d use_shader_pack8=%d use_bf16_storage=%d use_image_storage=%d\n", opt.use_packing_layout, opt.use_fp16_packed, opt.use_fp16_storage, opt.use_shader_pack8, opt.use_bf16_storage, opt.use_image_storage); + fprintf(stderr, "test_squeezenet gpu failed use_packing_layout=%d use_fp16_packed=%d use_fp16_storage=%d use_shader_pack8=%d use_bf16_storage=%d\n", opt.use_packing_layout, opt.use_fp16_packed, opt.use_fp16_storage, opt.use_shader_pack8, opt.use_bf16_storage); return ret; } #endif // NCNN_VULKAN @@ -506,7 +500,7 @@ int main() ret = test_squeezenet_overwrite_softmax(opt_cpu, load_model_types[i], epsilon); if (ret != 0) { - fprintf(stderr, "test_squeezenet_overwrite_softmax cpu failed use_packing_layout=%d use_fp16_packed=%d use_fp16_storage=%d use_shader_pack8=%d use_bf16_storage=%d use_image_storage=%d\n", opt.use_packing_layout, opt.use_fp16_packed, opt.use_fp16_storage, opt.use_shader_pack8, opt.use_bf16_storage, opt.use_image_storage); + fprintf(stderr, "test_squeezenet_overwrite_softmax cpu failed use_packing_layout=%d use_fp16_packed=%d use_fp16_storage=%d use_shader_pack8=%d use_bf16_storage=%d\n", opt.use_packing_layout, opt.use_fp16_packed, opt.use_fp16_storage, opt.use_shader_pack8, opt.use_bf16_storage); return ret; } @@ -514,7 +508,7 @@ int main() ret = test_squeezenet_overwrite_softmax(opt_gpu, load_model_types[i], epsilon); if (ret != 0) { - fprintf(stderr, "test_squeezenet_overwrite_softmax gpu failed use_packing_layout=%d use_fp16_packed=%d use_fp16_storage=%d use_shader_pack8=%d use_bf16_storage=%d use_image_storage=%d\n", opt.use_packing_layout, opt.use_fp16_packed, opt.use_fp16_storage, opt.use_shader_pack8, opt.use_bf16_storage, opt.use_image_storage); + fprintf(stderr, "test_squeezenet_overwrite_softmax gpu failed use_packing_layout=%d use_fp16_packed=%d use_fp16_storage=%d use_shader_pack8=%d use_bf16_storage=%d\n", opt.use_packing_layout, opt.use_fp16_packed, opt.use_fp16_storage, opt.use_shader_pack8, opt.use_bf16_storage); return ret; } #endif // NCNN_VULKAN diff --git a/tests/testutil.cpp b/tests/testutil.cpp index 5b17b3756..fa2f0cc01 100644 --- a/tests/testutil.cpp +++ b/tests/testutil.cpp @@ -528,7 +528,6 @@ int test_layer_naive(int typeindex, const ncnn::ParamDict& pd, const std::vector opt.use_fp16_storage = false; opt.use_fp16_arithmetic = false; opt.use_shader_pack8 = false; - opt.use_image_storage = false; opt.use_bf16_storage = false; opt.use_vulkan_compute = false; @@ -709,10 +708,6 @@ int test_layer_gpu(int typeindex, const ncnn::ParamDict& pd, const std::vectorinfo.support_cooperative_matrix()) opt.use_cooperative_matrix = false; if (!vkdev->info.support_subgroup_ops()) opt.use_subgroup_ops = false; - if (opt.use_image_storage && !vkdev->info.support_fp16_image()) - { - opt.use_fp16_storage = false; - opt.use_fp16_uniform = false; - } - // FIXME fp16a may produce large error opt.use_fp16_arithmetic = false; @@ -895,7 +884,6 @@ int test_layer_naive(int typeindex, const ncnn::ParamDict& pd, const std::vector opt.use_fp16_storage = false; opt.use_fp16_arithmetic = false; opt.use_shader_pack8 = false; - opt.use_image_storage = false; opt.use_bf16_storage = false; opt.use_vulkan_compute = false; @@ -1047,10 +1035,6 @@ int test_layer_gpu(int typeindex, const ncnn::ParamDict& pd, const std::vectorinfo.support_cooperative_matrix()) opt.use_cooperative_matrix = false; if (!vkdev->info.support_subgroup_ops()) opt.use_subgroup_ops = false; - if (opt.use_image_storage && !vkdev->info.support_fp16_image()) - { - opt.use_fp16_storage = false; - opt.use_fp16_uniform = false; - } - // FIXME fp16a may produce large error opt.use_fp16_arithmetic = false; @@ -1282,7 +1260,7 @@ int test_layer_opt(const char* layer_type, const ncnn::ParamDict& pd, const std: int ret = test_layer(ncnn::layer_to_index(layer_type), pd, weights_fp16, opt, a_fp16, top_blob_count, top_shapes, epsilon_fp16, func, flag); if (ret != 0) { - fprintf(stderr, "test_layer %s failed use_packing_layout=%d use_fp16_packed=%d use_fp16_storage=%d use_fp16_arithmetic=%d use_shader_pack8=%d use_bf16_storage=%d use_image_storage=%d use_sgemm_convolution=%d use_winograd_convolution=%d\n", layer_type, opt.use_packing_layout, opt.use_fp16_packed, opt.use_fp16_storage, opt.use_fp16_arithmetic, opt.use_shader_pack8, opt.use_bf16_storage, opt.use_image_storage, opt.use_sgemm_convolution, opt.use_winograd_convolution); + fprintf(stderr, "test_layer %s failed use_packing_layout=%d use_fp16_packed=%d use_fp16_storage=%d use_fp16_arithmetic=%d use_shader_pack8=%d use_bf16_storage=%d use_sgemm_convolution=%d use_winograd_convolution=%d\n", layer_type, opt.use_packing_layout, opt.use_fp16_packed, opt.use_fp16_storage, opt.use_fp16_arithmetic, opt.use_shader_pack8, opt.use_bf16_storage, opt.use_sgemm_convolution, opt.use_winograd_convolution); return ret; } @@ -1361,7 +1339,7 @@ int test_layer_opt(const char* layer_type, const ncnn::ParamDict& pd, const std: int ret = test_layer(ncnn::layer_to_index(layer_type), pd, weights_fp16, opt, a_fp16, top_shape, epsilon_fp16, func, flag); if (ret != 0) { - fprintf(stderr, "test_layer %s failed use_packing_layout=%d use_fp16_packed=%d use_fp16_storage=%d use_fp16_arithmetic=%d use_shader_pack8=%d use_bf16_storage=%d use_image_storage=%d use_sgemm_convolution=%d use_winograd_convolution=%d\n", layer_type, opt.use_packing_layout, opt.use_fp16_packed, opt.use_fp16_storage, opt.use_fp16_arithmetic, opt.use_shader_pack8, opt.use_bf16_storage, opt.use_image_storage, opt.use_sgemm_convolution, opt.use_winograd_convolution); + fprintf(stderr, "test_layer %s failed use_packing_layout=%d use_fp16_packed=%d use_fp16_storage=%d use_fp16_arithmetic=%d use_shader_pack8=%d use_bf16_storage=%d use_sgemm_convolution=%d use_winograd_convolution=%d\n", layer_type, opt.use_packing_layout, opt.use_fp16_packed, opt.use_fp16_storage, opt.use_fp16_arithmetic, opt.use_shader_pack8, opt.use_bf16_storage, opt.use_sgemm_convolution, opt.use_winograd_convolution); return ret; } @@ -1370,16 +1348,16 @@ int test_layer_opt(const char* layer_type, const ncnn::ParamDict& pd, const std: int test_layer(const char* layer_type, const ncnn::ParamDict& pd, const std::vector& weights, const std::vector& a, int top_blob_count, float epsilon, void (*func)(ncnn::Layer*), int flag) { - // pack fp16p fp16s fp16a bf16s shader8 image - const int options[][7] = { - {0, 0, 0, 0, 0, 0, 0}, - {0, 0, 1, 0, 0, 0, 0}, - {0, 0, 1, 1, 1, 0, 0}, - {1, 0, 0, 0, 0, 0, 0}, - {1, 1, 0, 0, 1, 0, 0}, - {1, 0, 1, 0, 0, 1, 0}, - {1, 1, 1, 1, 0, 0, 0}, - {1, 1, 1, 1, 1, 1, 1}, + // pack fp16p fp16s fp16a bf16s shader8 + const int options[][6] = { + {0, 0, 0, 0, 0, 0}, + {0, 0, 1, 0, 0, 0}, + {0, 0, 1, 1, 1, 0}, + {1, 0, 0, 0, 0, 0}, + {1, 1, 0, 0, 1, 0}, + {1, 0, 1, 0, 0, 1}, + {1, 1, 1, 1, 0, 0}, + {1, 1, 1, 1, 1, 1}, }; const int opt_count = sizeof(options) / sizeof(options[0]); @@ -1394,7 +1372,6 @@ int test_layer(const char* layer_type, const ncnn::ParamDict& pd, const std::vec opt.use_fp16_arithmetic = options[i][3]; opt.use_bf16_storage = options[i][4]; opt.use_shader_pack8 = options[i][5]; - opt.use_image_storage = options[i][6]; int ret = test_layer_opt(layer_type, pd, weights, opt, a, top_blob_count, epsilon, func, flag); if (ret != 0) @@ -1406,16 +1383,16 @@ int test_layer(const char* layer_type, const ncnn::ParamDict& pd, const std::vec int test_layer(const char* layer_type, const ncnn::ParamDict& pd, const std::vector& weights, const ncnn::Mat& a, float epsilon, void (*func)(ncnn::Layer*), int flag) { - // pack fp16p fp16s fp16a bf16s shader8 image - const int options[][7] = { - {0, 0, 0, 0, 0, 0, 0}, - {0, 0, 1, 0, 0, 0, 0}, - {0, 0, 1, 1, 1, 0, 0}, - {1, 0, 0, 0, 0, 0, 0}, - {1, 1, 0, 0, 1, 0, 0}, - {1, 0, 1, 0, 0, 1, 0}, - {1, 1, 1, 1, 0, 0, 0}, - {1, 1, 1, 1, 1, 1, 1}, + // pack fp16p fp16s fp16a bf16s shader8 + const int options[][6] = { + {0, 0, 0, 0, 0, 0}, + {0, 0, 1, 0, 0, 0}, + {0, 0, 1, 1, 1, 0}, + {1, 0, 0, 0, 0, 0}, + {1, 1, 0, 0, 1, 0}, + {1, 0, 1, 0, 0, 1}, + {1, 1, 1, 1, 0, 0}, + {1, 1, 1, 1, 1, 1}, }; const int opt_count = sizeof(options) / sizeof(options[0]); @@ -1430,7 +1407,6 @@ int test_layer(const char* layer_type, const ncnn::ParamDict& pd, const std::vec opt.use_fp16_arithmetic = options[i][3]; opt.use_bf16_storage = options[i][4]; opt.use_shader_pack8 = options[i][5]; - opt.use_image_storage = options[i][6]; int ret = test_layer_opt(layer_type, pd, weights, opt, a, epsilon, func, flag); if (ret != 0) @@ -1721,16 +1697,16 @@ int test_layer_oom_opt(const char* layer_type, const ncnn::ParamDict& pd, const int test_layer_oom(const char* layer_type, const ncnn::ParamDict& pd, const std::vector& weights, const std::vector& a, int top_blob_count, int flag) { - // pack fp16p fp16s fp16a bf16s shader8 image - const int options[][7] = { - {0, 0, 0, 0, 0, 0, 0}, - {0, 0, 1, 0, 0, 0, 0}, - {0, 0, 1, 1, 1, 0, 0}, - {1, 0, 0, 0, 0, 0, 0}, - {1, 1, 0, 0, 1, 0, 0}, - {1, 0, 1, 0, 0, 1, 0}, - {1, 1, 1, 1, 0, 0, 0}, - {1, 1, 1, 1, 1, 1, 1}, + // pack fp16p fp16s fp16a bf16s shader8 + const int options[][6] = { + {0, 0, 0, 0, 0, 0}, + {0, 0, 1, 0, 0, 0}, + {0, 0, 1, 1, 1, 0}, + {1, 0, 0, 0, 0, 0}, + {1, 1, 0, 0, 1, 0}, + {1, 0, 1, 0, 0, 1}, + {1, 1, 1, 1, 0, 0}, + {1, 1, 1, 1, 1, 1}, }; const int opt_count = sizeof(options) / sizeof(options[0]); @@ -1745,7 +1721,6 @@ int test_layer_oom(const char* layer_type, const ncnn::ParamDict& pd, const std: opt.use_fp16_arithmetic = options[i][3]; opt.use_bf16_storage = options[i][4]; opt.use_shader_pack8 = options[i][5]; - opt.use_image_storage = options[i][6]; int ret = test_layer_oom_opt(layer_type, pd, weights, opt, a, top_blob_count, flag); if (ret != 233 && ret != 0) @@ -1757,16 +1732,16 @@ int test_layer_oom(const char* layer_type, const ncnn::ParamDict& pd, const std: int test_layer_oom(const char* layer_type, const ncnn::ParamDict& pd, const std::vector& weights, const ncnn::Mat& a, int flag) { - // pack fp16p fp16s fp16a bf16s shader8 image - const int options[][7] = { - {0, 0, 0, 0, 0, 0, 0}, - {0, 0, 1, 0, 0, 0, 0}, - {0, 0, 1, 1, 1, 0, 0}, - {1, 0, 0, 0, 0, 0, 0}, - {1, 1, 0, 0, 1, 0, 0}, - {1, 0, 1, 0, 0, 1, 0}, - {1, 1, 1, 1, 0, 0, 0}, - {1, 1, 1, 1, 1, 1, 1}, + // pack fp16p fp16s fp16a bf16s shader8 + const int options[][6] = { + {0, 0, 0, 0, 0, 0}, + {0, 0, 1, 0, 0, 0}, + {0, 0, 1, 1, 1, 0}, + {1, 0, 0, 0, 0, 0}, + {1, 1, 0, 0, 1, 0}, + {1, 0, 1, 0, 0, 1}, + {1, 1, 1, 1, 0, 0}, + {1, 1, 1, 1, 1, 1}, }; const int opt_count = sizeof(options) / sizeof(options[0]); @@ -1781,7 +1756,6 @@ int test_layer_oom(const char* layer_type, const ncnn::ParamDict& pd, const std: opt.use_fp16_arithmetic = options[i][3]; opt.use_bf16_storage = options[i][4]; opt.use_shader_pack8 = options[i][5]; - opt.use_image_storage = options[i][6]; int ret = test_layer_oom_opt(layer_type, pd, weights, opt, a, flag); if (ret != 233 && ret != 0)