diff --git a/src/layer/vulkan/convolution1d_vulkan.cpp b/src/layer/vulkan/convolution1d_vulkan.cpp index f9d9135ceb90..53dff49262b0 100644 --- a/src/layer/vulkan/convolution1d_vulkan.cpp +++ b/src/layer/vulkan/convolution1d_vulkan.cpp @@ -98,7 +98,7 @@ int Convolution1D_vulkan::create_pipeline(const Option& _opt) } { - std::vector specializations(7 + 10); + std::vector specializations(7 + 4); specializations[0].i = kernel_w; specializations[1].i = dilation_w; specializations[2].i = stride_w; @@ -110,12 +110,6 @@ int Convolution1D_vulkan::create_pipeline(const Option& _opt) specializations[7 + 1].i = 0; specializations[7 + 2].i = 0; specializations[7 + 3].i = 0; - specializations[7 + 4].i = 0; - specializations[7 + 5].i = 0; - specializations[7 + 6].i = 0; - specializations[7 + 7].i = 0; - specializations[7 + 8].i = 0; - specializations[7 + 9].i = 0; int shader_type_index = -1; if (elempack == 1 && out_elempack == 1) shader_type_index = LayerShaderType::convolution1d; @@ -189,8 +183,6 @@ int Convolution1D_vulkan::upload_model(VkTransfer& cmd, const Option& opt) int Convolution1D_vulkan::forward(const VkMat& bottom_blob, VkMat& top_blob, VkCompute& cmd, const Option& opt) const { int w = bottom_blob.w; - int h = bottom_blob.h; - int channels = bottom_blob.c; size_t elemsize = bottom_blob.elemsize; int elempack = bottom_blob.elempack; @@ -281,22 +273,16 @@ int Convolution1D_vulkan::forward(const VkMat& bottom_blob, VkMat& top_blob, VkC bindings[2] = weight_data_gpu; bindings[3] = bias_data_gpu; - std::vector constants(10); - constants[0].i = bottom_blob_bordered.dims; - constants[1].i = bottom_blob_bordered.w; - constants[2].i = bottom_blob_bordered.h; - constants[3].i = bottom_blob_bordered.c; - constants[4].i = bottom_blob_bordered.cstep; - constants[5].i = top_blob.dims; - constants[6].i = top_blob.w; - constants[7].i = top_blob.h; - constants[8].i = top_blob.c; - constants[9].i = top_blob.cstep; + std::vector constants(4); + constants[0].i = bottom_blob_bordered.w; + constants[1].i = bottom_blob_bordered.h; + constants[2].i = top_blob.w; + constants[3].i = top_blob.h; VkMat dispatcher; dispatcher.w = (top_blob.w + 1) / 2; dispatcher.h = (top_blob.h + 1) / 2; - dispatcher.c = (top_blob.c + 1) / 2; + dispatcher.c = 1; cmd.record_pipeline(pipeline_convolution1d, bindings, constants, dispatcher); @@ -306,8 +292,6 @@ int Convolution1D_vulkan::forward(const VkMat& bottom_blob, VkMat& top_blob, VkC int Convolution1D_vulkan::forward(const VkImageMat& bottom_blob, VkImageMat& top_blob, VkCompute& cmd, const Option& opt) const { int w = bottom_blob.w; - int h = bottom_blob.h; - int channels = bottom_blob.c; size_t elemsize = bottom_blob.elemsize; int elempack = bottom_blob.elempack; @@ -398,26 +382,20 @@ int Convolution1D_vulkan::forward(const VkImageMat& bottom_blob, VkImageMat& top bindings[2] = weight_data_gpu_image; bindings[3] = bias_data_gpu_image; - std::vector constants(10); - constants[0].i = bottom_blob_bordered.dims; - constants[1].i = bottom_blob_bordered.w; - constants[2].i = bottom_blob_bordered.h; - constants[3].i = bottom_blob_bordered.c; - constants[4].i = 0; //bottom_blob_bordered.cstep; - constants[5].i = top_blob.dims; - constants[6].i = top_blob.w; - constants[7].i = top_blob.h; - constants[8].i = top_blob.c; - constants[9].i = 0; //top_blob.cstep; + std::vector constants(4); + constants[0].i = bottom_blob_bordered.w; + constants[1].i = bottom_blob_bordered.h; + constants[2].i = top_blob.w; + constants[3].i = top_blob.h; VkImageMat dispatcher; dispatcher.w = (top_blob.w + 1) / 2; dispatcher.h = (top_blob.h + 1) / 2; - dispatcher.c = (top_blob.c + 1) / 2; + dispatcher.c = 1; cmd.record_pipeline(pipeline_convolution1d, bindings, constants, dispatcher); return 0; } -} // namespace ncnn \ No newline at end of file +} // namespace ncnn diff --git a/src/layer/vulkan/shader/convolution1d.comp b/src/layer/vulkan/shader/convolution1d.comp index 3403a50f1939..a23f8b1abedf 100644 --- a/src/layer/vulkan/shader/convolution1d.comp +++ b/src/layer/vulkan/shader/convolution1d.comp @@ -33,17 +33,11 @@ layout (constant_id = 5) const float activation_param_0 = 0; layout (constant_id = 6) const float activation_param_1 = 0; #define shape_constant_id_offset 7 -layout (constant_id = shape_constant_id_offset + 0) const int dims = 0; -layout (constant_id = shape_constant_id_offset + 1) const int w = 0; -layout (constant_id = shape_constant_id_offset + 2) const int h = 0; -layout (constant_id = shape_constant_id_offset + 3) const int c = 0; -layout (constant_id = shape_constant_id_offset + 4) const int cstep = 0; - -layout (constant_id = shape_constant_id_offset + 5) const int outdims = 0; -layout (constant_id = shape_constant_id_offset + 6) const int outw = 0; -layout (constant_id = shape_constant_id_offset + 7) const int outh = 0; -layout (constant_id = shape_constant_id_offset + 8) const int outc = 0; -layout (constant_id = shape_constant_id_offset + 9) const int outcstep = 0; +layout (constant_id = shape_constant_id_offset + 0) const int w = 0; +layout (constant_id = shape_constant_id_offset + 1) const int h = 0; + +layout (constant_id = shape_constant_id_offset + 2) const int outw = 0; +layout (constant_id = shape_constant_id_offset + 3) const int outh = 0; #if NCNN_image_shader layout (binding = 0) uniform unfp sampler3D bottom_blob; @@ -59,24 +53,18 @@ layout (binding = 3) readonly buffer bias_blob { sfp bias_data[]; }; layout (push_constant) uniform parameter { - int dims; int w; int h; - int c; - int cstep; - int outdims; int outw; int outh; - int outc; - int outcstep; } p; void main() { int gx = int(gl_GlobalInvocationID.x) * 2; int gy = int(gl_GlobalInvocationID.y) * 2; - + if (gx >= psc(outw) || gy >= psc(outh)) return; @@ -150,7 +138,7 @@ void main() w_offset += kernel_w; } -#endif +#endif sum0 = activation_afp(sum0, activation_type, activation_param_0, activation_param_1); sum1 = activation_afp(sum1, activation_type, activation_param_0, activation_param_1); @@ -165,7 +153,7 @@ void main() image3d_st1(top_blob, ivec3(gx2.y, gy2.y, 0), sum3); #else - + const int gi = gy * psc(outw) + gx; buffer_st1(top_blob_data, gi, sum0); @@ -174,4 +162,4 @@ void main() if (gy + 1 < psc(outh) && gx + 1 < psc(outw)) buffer_st1(top_blob_data, gi + psc(outw) + 1, sum3); #endif -} \ No newline at end of file +} diff --git a/src/layer/vulkan/shader/convolution1d_pack1to4.comp b/src/layer/vulkan/shader/convolution1d_pack1to4.comp index 98e6fadd3c18..bcdd17782216 100644 --- a/src/layer/vulkan/shader/convolution1d_pack1to4.comp +++ b/src/layer/vulkan/shader/convolution1d_pack1to4.comp @@ -33,17 +33,11 @@ layout (constant_id = 5) const float activation_param_0 = 0; layout (constant_id = 6) const float activation_param_1 = 0; #define shape_constant_id_offset 7 -layout (constant_id = shape_constant_id_offset + 0) const int dims = 0; -layout (constant_id = shape_constant_id_offset + 1) const int w = 0; -layout (constant_id = shape_constant_id_offset + 2) const int h = 0; -layout (constant_id = shape_constant_id_offset + 3) const int c = 0; -layout (constant_id = shape_constant_id_offset + 4) const int cstep = 0; - -layout (constant_id = shape_constant_id_offset + 5) const int outdims = 0; -layout (constant_id = shape_constant_id_offset + 6) const int outw = 0; -layout (constant_id = shape_constant_id_offset + 7) const int outh = 0; -layout (constant_id = shape_constant_id_offset + 8) const int outc = 0; -layout (constant_id = shape_constant_id_offset + 9) const int outcstep = 0; +layout (constant_id = shape_constant_id_offset + 0) const int w = 0; +layout (constant_id = shape_constant_id_offset + 1) const int h = 0; + +layout (constant_id = shape_constant_id_offset + 2) const int outw = 0; +layout (constant_id = shape_constant_id_offset + 3) const int outh = 0; #if NCNN_image_shader layout (binding = 0) uniform unfp sampler3D bottom_blob; @@ -59,24 +53,18 @@ layout (binding = 3) readonly buffer bias_blob { sfpvec4 bias_data[]; }; layout (push_constant) uniform parameter { - int dims; int w; int h; - int c; - int cstep; - int outdims; int outw; int outh; - int outc; - int outcstep; } p; void main() { int gx = int(gl_GlobalInvocationID.x) * 2; int gy = int(gl_GlobalInvocationID.y) * 2; - + if (gx >= psc(outw) || gy >= psc(outh)) return; @@ -150,7 +138,7 @@ void main() w_offset += kernel_w; } -#endif +#endif sum0 = activation_afpvec4(sum0, activation_type, activation_param_0, activation_param_1); sum1 = activation_afpvec4(sum1, activation_type, activation_param_0, activation_param_1); @@ -165,7 +153,7 @@ void main() image3d_st4(top_blob, ivec3(gx2.y, gy2.y, 0), sum3); #else - + const int gi = gy * psc(outw) + gx; buffer_st4(top_blob_data, gi, sum0); @@ -174,4 +162,4 @@ void main() if (gy + 1 < psc(outh) && gx + 1 < psc(outw)) buffer_st4(top_blob_data, gi + psc(outw) + 1, sum3); #endif -} \ No newline at end of file +} diff --git a/src/layer/vulkan/shader/convolution1d_pack1to8.comp b/src/layer/vulkan/shader/convolution1d_pack1to8.comp index c32bc2114e58..d91559ecd1cc 100644 --- a/src/layer/vulkan/shader/convolution1d_pack1to8.comp +++ b/src/layer/vulkan/shader/convolution1d_pack1to8.comp @@ -34,17 +34,11 @@ layout (constant_id = 5) const float activation_param_0 = 0; layout (constant_id = 6) const float activation_param_1 = 0; #define shape_constant_id_offset 7 -layout (constant_id = shape_constant_id_offset + 0) const int dims = 0; -layout (constant_id = shape_constant_id_offset + 1) const int w = 0; -layout (constant_id = shape_constant_id_offset + 2) const int h = 0; -layout (constant_id = shape_constant_id_offset + 3) const int c = 0; -layout (constant_id = shape_constant_id_offset + 4) const int cstep = 0; - -layout (constant_id = shape_constant_id_offset + 5) const int outdims = 0; -layout (constant_id = shape_constant_id_offset + 6) const int outw = 0; -layout (constant_id = shape_constant_id_offset + 7) const int outh = 0; -layout (constant_id = shape_constant_id_offset + 8) const int outc = 0; -layout (constant_id = shape_constant_id_offset + 9) const int outcstep = 0; +layout (constant_id = shape_constant_id_offset + 0) const int w = 0; +layout (constant_id = shape_constant_id_offset + 1) const int h = 0; + +layout (constant_id = shape_constant_id_offset + 2) const int outw = 0; +layout (constant_id = shape_constant_id_offset + 3) const int outh = 0; #if NCNN_image_shader layout (binding = 0) uniform unfp sampler3D bottom_blob; @@ -60,24 +54,18 @@ layout (binding = 3) readonly buffer bias_blob { sfpvec8 bias_data[]; }; layout (push_constant) uniform parameter { - int dims; int w; int h; - int c; - int cstep; - int outdims; int outw; int outh; - int outc; - int outcstep; } p; void main() { int gx = int(gl_GlobalInvocationID.x) * 2; int gy = int(gl_GlobalInvocationID.y) * 2; - + if (gx >= psc(outw) || gy >= psc(outh)) return; @@ -159,7 +147,7 @@ void main() w_offset += kernel_w; } -#endif +#endif sum0 = activation_afpvec8(sum0, activation_type, activation_param_0, activation_param_1); sum1 = activation_afpvec8(sum1, activation_type, activation_param_0, activation_param_1); @@ -174,7 +162,7 @@ void main() image3d_st8(top_blob, ivec3(gx2.y, gy2.y, 0), sum3); #else - + const int gi = gy * psc(outw) + gx; buffer_st8(top_blob_data, gi, sum0); @@ -183,4 +171,4 @@ void main() if (gy + 1 < psc(outh) && gx + 1 < psc(outw)) buffer_st8(top_blob_data, gi + psc(outw) + 1, sum3); #endif -} \ No newline at end of file +} diff --git a/src/layer/vulkan/shader/convolution1d_pack4.comp b/src/layer/vulkan/shader/convolution1d_pack4.comp index f1e125867852..7ce8ddb013d5 100644 --- a/src/layer/vulkan/shader/convolution1d_pack4.comp +++ b/src/layer/vulkan/shader/convolution1d_pack4.comp @@ -33,17 +33,11 @@ layout (constant_id = 5) const float activation_param_0 = 0; layout (constant_id = 6) const float activation_param_1 = 0; #define shape_constant_id_offset 7 -layout (constant_id = shape_constant_id_offset + 0) const int dims = 0; -layout (constant_id = shape_constant_id_offset + 1) const int w = 0; -layout (constant_id = shape_constant_id_offset + 2) const int h = 0; -layout (constant_id = shape_constant_id_offset + 3) const int c = 0; -layout (constant_id = shape_constant_id_offset + 4) const int cstep = 0; - -layout (constant_id = shape_constant_id_offset + 5) const int outdims = 0; -layout (constant_id = shape_constant_id_offset + 6) const int outw = 0; -layout (constant_id = shape_constant_id_offset + 7) const int outh = 0; -layout (constant_id = shape_constant_id_offset + 8) const int outc = 0; -layout (constant_id = shape_constant_id_offset + 9) const int outcstep = 0; +layout (constant_id = shape_constant_id_offset + 0) const int w = 0; +layout (constant_id = shape_constant_id_offset + 1) const int h = 0; + +layout (constant_id = shape_constant_id_offset + 2) const int outw = 0; +layout (constant_id = shape_constant_id_offset + 3) const int outh = 0; #if NCNN_image_shader layout (binding = 0) uniform unfp sampler3D bottom_blob; @@ -64,24 +58,18 @@ layout (binding = 3) readonly buffer bias_blob { sfpvec4 bias_data[]; }; layout (push_constant) uniform parameter { - int dims; int w; int h; - int c; - int cstep; - int outdims; int outw; int outh; - int outc; - int outcstep; } p; void main() { int gx = int(gl_GlobalInvocationID.x) * 2; int gy = int(gl_GlobalInvocationID.y) * 2; - + if (gx >= psc(outw) || gy >= psc(outh)) return; @@ -181,7 +169,7 @@ void main() w_offset += kernel_w; } -#endif +#endif sum0 = activation_afpvec4(sum0, activation_type, activation_param_0, activation_param_1); sum1 = activation_afpvec4(sum1, activation_type, activation_param_0, activation_param_1); @@ -196,7 +184,7 @@ void main() image3d_st4(top_blob, ivec3(gx2.y, gy2.y, 0), sum3); #else - + const int gi = gy * psc(outw) + gx; buffer_st4(top_blob_data, gi, sum0); @@ -205,4 +193,4 @@ void main() if (gy + 1 < psc(outh) && gx + 1 < psc(outw)) buffer_st4(top_blob_data, gi + psc(outw) + 1, sum3); #endif -} \ No newline at end of file +} diff --git a/src/layer/vulkan/shader/convolution1d_pack4to1.comp b/src/layer/vulkan/shader/convolution1d_pack4to1.comp index 1f5c87e1835b..b262fd689ccf 100644 --- a/src/layer/vulkan/shader/convolution1d_pack4to1.comp +++ b/src/layer/vulkan/shader/convolution1d_pack4to1.comp @@ -33,17 +33,11 @@ layout (constant_id = 5) const float activation_param_0 = 0; layout (constant_id = 6) const float activation_param_1 = 0; #define shape_constant_id_offset 7 -layout (constant_id = shape_constant_id_offset + 0) const int dims = 0; -layout (constant_id = shape_constant_id_offset + 1) const int w = 0; -layout (constant_id = shape_constant_id_offset + 2) const int h = 0; -layout (constant_id = shape_constant_id_offset + 3) const int c = 0; -layout (constant_id = shape_constant_id_offset + 4) const int cstep = 0; - -layout (constant_id = shape_constant_id_offset + 5) const int outdims = 0; -layout (constant_id = shape_constant_id_offset + 6) const int outw = 0; -layout (constant_id = shape_constant_id_offset + 7) const int outh = 0; -layout (constant_id = shape_constant_id_offset + 8) const int outc = 0; -layout (constant_id = shape_constant_id_offset + 9) const int outcstep = 0; +layout (constant_id = shape_constant_id_offset + 0) const int w = 0; +layout (constant_id = shape_constant_id_offset + 1) const int h = 0; + +layout (constant_id = shape_constant_id_offset + 2) const int outw = 0; +layout (constant_id = shape_constant_id_offset + 3) const int outh = 0; #if NCNN_image_shader layout (binding = 0) uniform unfp sampler3D bottom_blob; @@ -59,24 +53,18 @@ layout (binding = 3) readonly buffer bias_blob { sfp bias_data[]; }; layout (push_constant) uniform parameter { - int dims; int w; int h; - int c; - int cstep; - int outdims; int outw; int outh; - int outc; - int outcstep; } p; void main() { int gx = int(gl_GlobalInvocationID.x) * 2; int gy = int(gl_GlobalInvocationID.y) * 2; - + if (gx >= psc(outw) || gy >= psc(outh)) return; @@ -150,7 +138,7 @@ void main() w_offset += kernel_w; } -#endif +#endif sum0 = activation_afp(sum0, activation_type, activation_param_0, activation_param_1); sum1 = activation_afp(sum1, activation_type, activation_param_0, activation_param_1); @@ -165,7 +153,7 @@ void main() image3d_st1(top_blob, ivec3(gx2.y, gy2.y, 0), sum3); #else - + const int gi = gy * psc(outw) + gx; buffer_st1(top_blob_data, gi, sum0); @@ -174,4 +162,4 @@ void main() if (gy + 1 < psc(outh) && gx + 1 < psc(outw)) buffer_st1(top_blob_data, gi + psc(outw) + 1, sum3); #endif -} \ No newline at end of file +} diff --git a/src/layer/vulkan/shader/convolution1d_pack4to8.comp b/src/layer/vulkan/shader/convolution1d_pack4to8.comp index 1133b097ac09..111972991d4c 100644 --- a/src/layer/vulkan/shader/convolution1d_pack4to8.comp +++ b/src/layer/vulkan/shader/convolution1d_pack4to8.comp @@ -34,17 +34,11 @@ layout (constant_id = 5) const float activation_param_0 = 0; layout (constant_id = 6) const float activation_param_1 = 0; #define shape_constant_id_offset 7 -layout (constant_id = shape_constant_id_offset + 0) const int dims = 0; -layout (constant_id = shape_constant_id_offset + 1) const int w = 0; -layout (constant_id = shape_constant_id_offset + 2) const int h = 0; -layout (constant_id = shape_constant_id_offset + 3) const int c = 0; -layout (constant_id = shape_constant_id_offset + 4) const int cstep = 0; - -layout (constant_id = shape_constant_id_offset + 5) const int outdims = 0; -layout (constant_id = shape_constant_id_offset + 6) const int outw = 0; -layout (constant_id = shape_constant_id_offset + 7) const int outh = 0; -layout (constant_id = shape_constant_id_offset + 8) const int outc = 0; -layout (constant_id = shape_constant_id_offset + 9) const int outcstep = 0; +layout (constant_id = shape_constant_id_offset + 0) const int w = 0; +layout (constant_id = shape_constant_id_offset + 1) const int h = 0; + +layout (constant_id = shape_constant_id_offset + 2) const int outw = 0; +layout (constant_id = shape_constant_id_offset + 3) const int outh = 0; #if NCNN_image_shader layout (binding = 0) uniform unfp sampler3D bottom_blob; @@ -60,24 +54,18 @@ layout (binding = 3) readonly buffer bias_blob { sfpvec8 bias_data[]; }; layout (push_constant) uniform parameter { - int dims; int w; int h; - int c; - int cstep; - int outdims; int outw; int outh; - int outc; - int outcstep; } p; void main() { int gx = int(gl_GlobalInvocationID.x) * 2; int gy = int(gl_GlobalInvocationID.y) * 2; - + if (gx >= psc(outw) || gy >= psc(outh)) return; @@ -243,7 +231,7 @@ void main() w_offset += kernel_w; } -#endif +#endif sum0 = activation_afpvec8(sum0, activation_type, activation_param_0, activation_param_1); sum1 = activation_afpvec8(sum1, activation_type, activation_param_0, activation_param_1); @@ -258,7 +246,7 @@ void main() image3d_st8(top_blob, ivec3(gx2.y, gy2.y, 0), sum3); #else - + const int gi = gy * psc(outw) + gx; buffer_st8(top_blob_data, gi, sum0); @@ -267,4 +255,4 @@ void main() if (gy + 1 < psc(outh) && gx + 1 < psc(outw)) buffer_st8(top_blob_data, gi + psc(outw) + 1, sum3); #endif -} \ No newline at end of file +} diff --git a/src/layer/vulkan/shader/convolution1d_pack8.comp b/src/layer/vulkan/shader/convolution1d_pack8.comp index fff72ade8290..38271697a485 100644 --- a/src/layer/vulkan/shader/convolution1d_pack8.comp +++ b/src/layer/vulkan/shader/convolution1d_pack8.comp @@ -34,17 +34,11 @@ layout (constant_id = 5) const float activation_param_0 = 0; layout (constant_id = 6) const float activation_param_1 = 0; #define shape_constant_id_offset 7 -layout (constant_id = shape_constant_id_offset + 0) const int dims = 0; -layout (constant_id = shape_constant_id_offset + 1) const int w = 0; -layout (constant_id = shape_constant_id_offset + 2) const int h = 0; -layout (constant_id = shape_constant_id_offset + 3) const int c = 0; -layout (constant_id = shape_constant_id_offset + 4) const int cstep = 0; - -layout (constant_id = shape_constant_id_offset + 5) const int outdims = 0; -layout (constant_id = shape_constant_id_offset + 6) const int outw = 0; -layout (constant_id = shape_constant_id_offset + 7) const int outh = 0; -layout (constant_id = shape_constant_id_offset + 8) const int outc = 0; -layout (constant_id = shape_constant_id_offset + 9) const int outcstep = 0; +layout (constant_id = shape_constant_id_offset + 0) const int w = 0; +layout (constant_id = shape_constant_id_offset + 1) const int h = 0; + +layout (constant_id = shape_constant_id_offset + 2) const int outw = 0; +layout (constant_id = shape_constant_id_offset + 3) const int outh = 0; #if NCNN_image_shader layout (binding = 0) uniform unfp sampler3D bottom_blob; @@ -60,24 +54,18 @@ layout (binding = 3) readonly buffer bias_blob { sfpvec8 bias_data[]; }; layout (push_constant) uniform parameter { - int dims; int w; int h; - int c; - int cstep; - int outdims; int outw; int outh; - int outc; - int outcstep; } p; void main() { int gx = int(gl_GlobalInvocationID.x) * 2; int gy = int(gl_GlobalInvocationID.y) * 2; - + if (gx >= psc(outw) || gy >= psc(outh)) return; @@ -243,7 +231,7 @@ void main() w_offset += kernel_w; } -#endif +#endif sum0 = activation_afpvec8(sum0, activation_type, activation_param_0, activation_param_1); sum1 = activation_afpvec8(sum1, activation_type, activation_param_0, activation_param_1); @@ -258,7 +246,7 @@ void main() image3d_st8(top_blob, ivec3(gx2.y, gy2.y, 0), sum3); #else - + const int gi = gy * psc(outw) + gx; buffer_st8(top_blob_data, gi, sum0); @@ -267,4 +255,4 @@ void main() if (gy + 1 < psc(outh) && gx + 1 < psc(outw)) buffer_st8(top_blob_data, gi + psc(outw) + 1, sum3); #endif -} \ No newline at end of file +} diff --git a/src/layer/vulkan/shader/convolution1d_pack8to1.comp b/src/layer/vulkan/shader/convolution1d_pack8to1.comp index 9d08d3b11af7..213e01a3c45e 100644 --- a/src/layer/vulkan/shader/convolution1d_pack8to1.comp +++ b/src/layer/vulkan/shader/convolution1d_pack8to1.comp @@ -34,17 +34,11 @@ layout (constant_id = 5) const float activation_param_0 = 0; layout (constant_id = 6) const float activation_param_1 = 0; #define shape_constant_id_offset 7 -layout (constant_id = shape_constant_id_offset + 0) const int dims = 0; -layout (constant_id = shape_constant_id_offset + 1) const int w = 0; -layout (constant_id = shape_constant_id_offset + 2) const int h = 0; -layout (constant_id = shape_constant_id_offset + 3) const int c = 0; -layout (constant_id = shape_constant_id_offset + 4) const int cstep = 0; - -layout (constant_id = shape_constant_id_offset + 5) const int outdims = 0; -layout (constant_id = shape_constant_id_offset + 6) const int outw = 0; -layout (constant_id = shape_constant_id_offset + 7) const int outh = 0; -layout (constant_id = shape_constant_id_offset + 8) const int outc = 0; -layout (constant_id = shape_constant_id_offset + 9) const int outcstep = 0; +layout (constant_id = shape_constant_id_offset + 0) const int w = 0; +layout (constant_id = shape_constant_id_offset + 1) const int h = 0; + +layout (constant_id = shape_constant_id_offset + 2) const int outw = 0; +layout (constant_id = shape_constant_id_offset + 3) const int outh = 0; #if NCNN_image_shader layout (binding = 0) uniform unfp sampler3D bottom_blob; @@ -60,24 +54,18 @@ layout (binding = 3) readonly buffer bias_blob { sfp bias_data[]; }; layout (push_constant) uniform parameter { - int dims; int w; int h; - int c; - int cstep; - int outdims; int outw; int outh; - int outc; - int outcstep; } p; void main() { int gx = int(gl_GlobalInvocationID.x) * 2; int gy = int(gl_GlobalInvocationID.y) * 2; - + if (gx >= psc(outw) || gy >= psc(outh)) return; @@ -151,7 +139,7 @@ void main() w_offset += kernel_w; } -#endif +#endif sum0 = activation_afp(sum0, activation_type, activation_param_0, activation_param_1); sum1 = activation_afp(sum1, activation_type, activation_param_0, activation_param_1); @@ -166,7 +154,7 @@ void main() image3d_st1(top_blob, ivec3(gx2.y, gy2.y, 0), sum3); #else - + const int gi = gy * psc(outw) + gx; buffer_st1(top_blob_data, gi, sum0); @@ -175,4 +163,4 @@ void main() if (gy + 1 < psc(outh) && gx + 1 < psc(outw)) buffer_st1(top_blob_data, gi + psc(outw) + 1, sum3); #endif -} \ No newline at end of file +} diff --git a/src/layer/vulkan/shader/convolution1d_pack8to4.comp b/src/layer/vulkan/shader/convolution1d_pack8to4.comp index 86ca696d5840..d574d1c8ebfd 100644 --- a/src/layer/vulkan/shader/convolution1d_pack8to4.comp +++ b/src/layer/vulkan/shader/convolution1d_pack8to4.comp @@ -34,17 +34,11 @@ layout (constant_id = 5) const float activation_param_0 = 0; layout (constant_id = 6) const float activation_param_1 = 0; #define shape_constant_id_offset 7 -layout (constant_id = shape_constant_id_offset + 0) const int dims = 0; -layout (constant_id = shape_constant_id_offset + 1) const int w = 0; -layout (constant_id = shape_constant_id_offset + 2) const int h = 0; -layout (constant_id = shape_constant_id_offset + 3) const int c = 0; -layout (constant_id = shape_constant_id_offset + 4) const int cstep = 0; - -layout (constant_id = shape_constant_id_offset + 5) const int outdims = 0; -layout (constant_id = shape_constant_id_offset + 6) const int outw = 0; -layout (constant_id = shape_constant_id_offset + 7) const int outh = 0; -layout (constant_id = shape_constant_id_offset + 8) const int outc = 0; -layout (constant_id = shape_constant_id_offset + 9) const int outcstep = 0; +layout (constant_id = shape_constant_id_offset + 0) const int w = 0; +layout (constant_id = shape_constant_id_offset + 1) const int h = 0; + +layout (constant_id = shape_constant_id_offset + 2) const int outw = 0; +layout (constant_id = shape_constant_id_offset + 3) const int outh = 0; #if NCNN_image_shader layout (binding = 0) uniform unfp sampler3D bottom_blob; @@ -60,24 +54,18 @@ layout (binding = 3) readonly buffer bias_blob { sfpvec4 bias_data[]; }; layout (push_constant) uniform parameter { - int dims; int w; int h; - int c; - int cstep; - int outdims; int outw; int outh; - int outc; - int outcstep; } p; void main() { int gx = int(gl_GlobalInvocationID.x) * 2; int gy = int(gl_GlobalInvocationID.y) * 2; - + if (gx >= psc(outw) || gy >= psc(outh)) return; @@ -193,7 +181,7 @@ void main() w_offset += kernel_w; } -#endif +#endif sum0 = activation_afpvec4(sum0, activation_type, activation_param_0, activation_param_1); sum1 = activation_afpvec4(sum1, activation_type, activation_param_0, activation_param_1); @@ -208,7 +196,7 @@ void main() image3d_st4(top_blob, ivec3(gx2.y, gy2.y, 0), sum3); #else - + const int gi = gy * psc(outw) + gx; buffer_st4(top_blob_data, gi, sum0); @@ -217,4 +205,4 @@ void main() if (gy + 1 < psc(outh) && gx + 1 < psc(outw)) buffer_st4(top_blob_data, gi + psc(outw) + 1, sum3); #endif -} \ No newline at end of file +}