MNN icon indicating copy to clipboard operation
MNN copied to clipboard

Vulkan build error

Open dimitryn opened this issue 7 years ago • 8 comments

Hi , I am using latest master and trying to build /project/android/build_vulkan.sh OS Ubuntu Android NDK 17

output: ~/Code/MNN$ ./project/android/build_vulkan.sh {u'convolution.comp': [u'RELU', u'RELU6'], u'convolutionDepthwise.comp': [u'RELU', u'RELU6'], u'convolutionDepthwiseMali.comp': [u'RELU', u'RELU6'], u'col2Im.comp': [u'RELU', u'RELU6'], u'col2ImMali.comp': [u'RELU', u'RELU6'], u'deconvolutionDepthwise.comp': [u'RELU', u'RELU6'], u'deconvIm2Col.comp': [u'RELU', u'RELU6'], u'winogradTransformDest2_3_1.comp': [u'RELU', u'RELU6'], u'winogradDestTransform8x8.comp': [u'RELU', u'RELU6']} {u'convolution.comp': [u'RELU', u'RELU6'], u'convolutionDepthwise.comp': [u'RELU', u'RELU6'], u'convolutionDepthwiseMali.comp': [u'RELU', u'RELU6'], u'col2Im.comp': [u'RELU', u'RELU6'], u'col2ImMali.comp': [u'RELU', u'RELU6'], u'deconvolutionDepthwise.comp': [u'RELU', u'RELU6'], u'deconvIm2Col.comp': [u'RELU', u'RELU6'], u'winogradTransformDest2_3_1.comp': [u'RELU', u'RELU6'], u'winogradDestTransform8x8.comp': [u'RELU', u'RELU6']} glsl_elementwiseSubBuffer_comp glsl_blitC4_comp glsl_col2ImMali_comp glsl_col2ImMali_RELU_comp glsl_col2ImMali_RELU6_comp glsl_convolutionDepthwise_comp glsl_convolutionDepthwise_RELU_comp glsl_convolutionDepthwise_RELU6_comp glsl_SpatialProduct_comp glsl_resizeBilinear_comp glsl_softmax_comp glsl_nhwcTonc4hw4_comp glsl_roipooling_comp glsl_lstm_comp glsl_relu_comp glsl_imageTonc4hw4_comp glsl_concatBuffer_comp glsl_buffer2Image3D_comp glsl_convolution_comp glsl_convolution_RELU_comp glsl_convolution_RELU6_comp glsl_softmaxChannel_comp glsl_rsqrt_comp glsl_softmaxHeight_comp glsl_nc4hw4Tonchw_comp glsl_winogradTransformSource2_3_1_comp glsl_nc4hw4toimage_comp glsl_permute_comp glsl_relu6_comp glsl_elementwiseMulBuffer_comp glsl_SpaceToBatchND_comp glsl_nchwTonc4hw4_comp glsl_scale_comp glsl_maxpool_comp glsl_winogradTransformDest2_3_1_comp glsl_winogradTransformDest2_3_1_RELU_comp glsl_winogradTransformDest2_3_1_RELU6_comp glsl_convolutionDepthwiseUint_comp glsl_softmaxWidth_comp glsl_im2col1x1_comp glsl_BatchToSpaceND_comp glsl_deconvCol2Im_comp glsl_preluWithChannel_comp glsl_imageTonchw_comp glsl_sqrt_comp glsl_elementwiseMax_comp glsl_lrnAcrossChannel_comp glsl_lstmSave_comp glsl_convolutionDepthwiseMali_comp glsl_convolutionDepthwiseMali_RELU_comp glsl_convolutionDepthwiseMali_RELU6_comp glsl_elementwiseAddBuffer_comp glsl_elementwiseAdd_comp glsl_lstmGate_comp glsl_avgpool_comp glsl_nc4hw4Tonhwc_comp glsl_normalizeChannel_comp glsl_nhwcToimage_comp glsl_gemm16x16Half_comp glsl_tanh_comp glsl_elementwiseMul_comp glsl_deconvolutionDepthwise_comp glsl_deconvolutionDepthwise_RELU_comp glsl_deconvolutionDepthwise_RELU6_comp glsl_im2col_comp glsl_nchwToimage_comp glsl_abs_comp glsl_softmaxHeight_NHWC_comp glsl_buffer2Image2D_comp glsl_deconvIm2Col_comp glsl_deconvIm2Col_RELU_comp glsl_deconvIm2Col_RELU6_comp glsl_buffer2Image1D_comp glsl_imageTonhwc_comp glsl_sigmoidimage_comp glsl_gemm16x16_comp glsl_resizeNearest_comp glsl_exp_comp glsl_col2Im_comp glsl_col2Im_RELU_comp glsl_col2Im_RELU6_comp sh: 1: glslangValidator: not found

xxd: .cache/shader/cache/elementwiseSubBuffer.spv: No such file or directory sh: 1: glslangValidator: not found

xxd: .cache/shader/cache/blitC4.spv: No such file or directory sh: 1: glslangValidator: not found

xxd: .cache/shader/cache/col2ImMali.spv: No such file or directory sh: 1: glslangValidator: not found

xxd: .cache/shader/cache/col2ImMali_RELU.spv: No such file or directory sh: 1: glslangValidator: not found

xxd: .cache/shader/cache/col2ImMali_RELU6.spv: No such file or directory sh: 1: glslangValidator: not found

xxd: .cache/shader/cache/convolutionDepthwise.spv: No such file or directory sh: 1: glslangValidator: not found

xxd: .cache/shader/cache/convolutionDepthwise_RELU.spv: No such file or directory sh: 1: glslangValidator: not found

xxd: .cache/shader/cache/convolutionDepthwise_RELU6.spv: No such file or directory sh: 1: glslangValidator: not found

xxd: .cache/shader/cache/SpatialProduct.spv: No such file or directory sh: 1: glslangValidator: not found

xxd: .cache/shader/cache/resizeBilinear.spv: No such file or directory sh: 1: glslangValidator: not found

xxd: .cache/shader/cache/softmax.spv: No such file or directory sh: 1: glslangValidator: not found

xxd: .cache/shader/cache/nhwcTonc4hw4.spv: No such file or directory sh: 1: glslangValidator: not found

xxd: .cache/shader/cache/roipooling.spv: No such file or directory sh: 1: glslangValidator: not found

xxd: .cache/shader/cache/lstm.spv: No such file or directory sh: 1: glslangValidator: not found

xxd: .cache/shader/cache/relu.spv: No such file or directory sh: 1: glslangValidator: not found

xxd: .cache/shader/cache/imageTonc4hw4.spv: No such file or directory sh: 1: glslangValidator: not found

xxd: .cache/shader/cache/concatBuffer.spv: No such file or directory sh: 1: glslangValidator: not found

xxd: .cache/shader/cache/buffer2Image3D.spv: No such file or directory sh: 1: glslangValidator: not found

xxd: .cache/shader/cache/convolution.spv: No such file or directory sh: 1: glslangValidator: not found

xxd: .cache/shader/cache/convolution_RELU.spv: No such file or directory sh: 1: glslangValidator: not found

xxd: .cache/shader/cache/convolution_RELU6.spv: No such file or directory sh: 1: glslangValidator: not found

xxd: .cache/shader/cache/softmaxChannel.spv: No such file or directory sh: 1: glslangValidator: not found

xxd: .cache/shader/cache/rsqrt.spv: No such file or directory sh: 1: glslangValidator: not found

xxd: .cache/shader/cache/softmaxHeight.spv: No such file or directory sh: 1: glslangValidator: not found

xxd: .cache/shader/cache/nc4hw4Tonchw.spv: No such file or directory sh: 1: glslangValidator: not found

xxd: .cache/shader/cache/winogradTransformSource2_3_1.spv: No such file or directory sh: 1: glslangValidator: not found

xxd: .cache/shader/cache/nc4hw4toimage.spv: No such file or directory sh: 1: glslangValidator: not found

xxd: .cache/shader/cache/permute.spv: No such file or directory sh: 1: glslangValidator: not found

xxd: .cache/shader/cache/relu6.spv: No such file or directory sh: 1: glslangValidator: not found

xxd: .cache/shader/cache/elementwiseMulBuffer.spv: No such file or directory sh: 1: glslangValidator: not found

xxd: .cache/shader/cache/SpaceToBatchND.spv: No such file or directory sh: 1: glslangValidator: not found

xxd: .cache/shader/cache/nchwTonc4hw4.spv: No such file or directory sh: 1: glslangValidator: not found

xxd: .cache/shader/cache/scale.spv: No such file or directory sh: 1: glslangValidator: not found

xxd: .cache/shader/cache/maxpool.spv: No such file or directory sh: 1: glslangValidator: not found

xxd: .cache/shader/cache/winogradTransformDest2_3_1.spv: No such file or directory sh: 1: glslangValidator: not found

xxd: .cache/shader/cache/winogradTransformDest2_3_1_RELU.spv: No such file or directory sh: 1: glslangValidator: not found

xxd: .cache/shader/cache/winogradTransformDest2_3_1_RELU6.spv: No such file or directory sh: 1: glslangValidator: not found

xxd: .cache/shader/cache/convolutionDepthwiseUint.spv: No such file or directory sh: 1: glslangValidator: not found

xxd: .cache/shader/cache/softmaxWidth.spv: No such file or directory sh: 1: glslangValidator: not found

xxd: .cache/shader/cache/im2col1x1.spv: No such file or directory sh: 1: glslangValidator: not found

xxd: .cache/shader/cache/BatchToSpaceND.spv: No such file or directory sh: 1: glslangValidator: not found

xxd: .cache/shader/cache/deconvCol2Im.spv: No such file or directory sh: 1: glslangValidator: not found

xxd: .cache/shader/cache/preluWithChannel.spv: No such file or directory sh: 1: glslangValidator: not found

xxd: .cache/shader/cache/imageTonchw.spv: No such file or directory sh: 1: glslangValidator: not found

xxd: .cache/shader/cache/sqrt.spv: No such file or directory sh: 1: glslangValidator: not found

xxd: .cache/shader/cache/elementwiseMax.spv: No such file or directory sh: 1: glslangValidator: not found

xxd: .cache/shader/cache/lrnAcrossChannel.spv: No such file or directory sh: 1: glslangValidator: not found

xxd: .cache/shader/cache/lstmSave.spv: No such file or directory sh: 1: glslangValidator: not found

xxd: .cache/shader/cache/convolutionDepthwiseMali.spv: No such file or directory sh: 1: glslangValidator: not found

xxd: .cache/shader/cache/convolutionDepthwiseMali_RELU.spv: No such file or directory sh: 1: glslangValidator: not found

xxd: .cache/shader/cache/convolutionDepthwiseMali_RELU6.spv: No such file or directory sh: 1: glslangValidator: not found

xxd: .cache/shader/cache/elementwiseAddBuffer.spv: No such file or directory sh: 1: glslangValidator: not found

xxd: .cache/shader/cache/elementwiseAdd.spv: No such file or directory sh: 1: glslangValidator: not found

xxd: .cache/shader/cache/lstmGate.spv: No such file or directory sh: 1: glslangValidator: not found

xxd: .cache/shader/cache/avgpool.spv: No such file or directory sh: 1: glslangValidator: not found

xxd: .cache/shader/cache/nc4hw4Tonhwc.spv: No such file or directory sh: 1: glslangValidator: not found

xxd: .cache/shader/cache/normalizeChannel.spv: No such file or directory sh: 1: glslangValidator: not found

xxd: .cache/shader/cache/nhwcToimage.spv: No such file or directory sh: 1: glslangValidator: not found

xxd: .cache/shader/cache/gemm16x16Half.spv: No such file or directory sh: 1: glslangValidator: not found

xxd: .cache/shader/cache/tanh.spv: No such file or directory sh: 1: glslangValidator: not found

xxd: .cache/shader/cache/elementwiseMul.spv: No such file or directory sh: 1: glslangValidator: not found

xxd: .cache/shader/cache/deconvolutionDepthwise.spv: No such file or directory sh: 1: glslangValidator: not found

xxd: .cache/shader/cache/deconvolutionDepthwise_RELU.spv: No such file or directory sh: 1: glslangValidator: not found

xxd: .cache/shader/cache/deconvolutionDepthwise_RELU6.spv: No such file or directory sh: 1: glslangValidator: not found

xxd: .cache/shader/cache/im2col.spv: No such file or directory sh: 1: glslangValidator: not found

xxd: .cache/shader/cache/nchwToimage.spv: No such file or directory sh: 1: glslangValidator: not found

xxd: .cache/shader/cache/abs.spv: No such file or directory sh: 1: glslangValidator: not found

xxd: .cache/shader/cache/softmaxHeight_NHWC.spv: No such file or directory sh: 1: glslangValidator: not found

xxd: .cache/shader/cache/buffer2Image2D.spv: No such file or directory sh: 1: glslangValidator: not found

xxd: .cache/shader/cache/deconvIm2Col.spv: No such file or directory sh: 1: glslangValidator: not found

xxd: .cache/shader/cache/deconvIm2Col_RELU.spv: No such file or directory sh: 1: glslangValidator: not found

xxd: .cache/shader/cache/deconvIm2Col_RELU6.spv: No such file or directory sh: 1: glslangValidator: not found

xxd: .cache/shader/cache/buffer2Image1D.spv: No such file or directory sh: 1: glslangValidator: not found

xxd: .cache/shader/cache/imageTonhwc.spv: No such file or directory sh: 1: glslangValidator: not found

xxd: .cache/shader/cache/sigmoidimage.spv: No such file or directory sh: 1: glslangValidator: not found

xxd: .cache/shader/cache/gemm16x16.spv: No such file or directory sh: 1: glslangValidator: not found

xxd: .cache/shader/cache/resizeNearest.spv: No such file or directory sh: 1: glslangValidator: not found

xxd: .cache/shader/cache/exp.spv: No such file or directory sh: 1: glslangValidator: not found

xxd: .cache/shader/cache/col2Im.spv: No such file or directory sh: 1: glslangValidator: not found

xxd: .cache/shader/cache/col2Im_RELU.spv: No such file or directory sh: 1: glslangValidator: not found

xxd: .cache/shader/cache/col2Im_RELU6.spv: No such file or directory Traceback (most recent call last): File "makeshader.py", line 468, in generateFile(gOutputHeadFile, gOutputSourceFile, shaders, macros, shaderCache) File "makeshader.py", line 436, in generateFile cache.updateShaderCache(fileObjs) File "makeshader.py", line 283, in updateShaderCache self.writeShaderFileConfigInformation(section,shader,spirv_file) File "makeshader.py", line 252, in writeShaderFileConfigInformation ck_size, ck_lastmodify, ck_md5, ck_sha1 = self.calcFileCheckInformation(spirv) File "makeshader.py", line 132, in calcFileCheckInformation ck_size = os.path.getsize(f) File "/usr/lib/python2.7/genericpath.py", line 57, in getsize return os.stat(filename).st_size OSError: [Errno 2] No such file or directory: '.cache/shader/cache/elementwiseSubBuffer.spv'

.... .....

/home/Code/MNN/source/backend/vulkan/compiler/AllShader.cpp:82:1: warning: duplicate 'const' declaration specifier [-Wduplicate-decl-specifier] const ^~~~~ /home/Code/MNN/source/backend/vulkan/compiler/AllShader.cpp:82:6: error: expected unqualified-id const ^ 80 warnings and 1 error generated. source/backend/vulkan/CMakeFiles/MNN_Vulkan.dir/build.make:75: recipe for target 'source/backend/vulkan/CMakeFiles/MNN_Vulkan.dir/compiler/AllShader.cpp.o' failed make[2]: *** [source/backend/vulkan/CMakeFiles/MNN_Vulkan.dir/compiler/AllShader.cpp.o] Error 1

dimitryn avatar Oct 05 '19 06:10 dimitryn

Use another way build vulkan.

build_32.sh -DMNN_VULKAN=true

jxt1234 avatar Oct 07 '19 01:10 jxt1234

Hi @jxt1234 , I used your suggestion and it compiled with some changes

1.Need to fix error compilation [ 74%] Linking CXX shared library libMNN.so /home/dnozik/Code/MNN/source/core/TensorUtils.cpp:105: error: undefined reference to '__gnu_h2f_ieee' /home/dnozik/Code/MNN/source/core/TensorUtils.cpp:105: error: undefined reference to '__gnu_h2f_ieee' /home/dnozik/Code/MNN/source/core/TensorUtils.cpp:105: error: undefined reference to '__gnu_h2f_ieee' /home/dnozik/Code/MNN/source/core/TensorUtils.cpp:105: error: undefined reference to '__gnu_h2f_ieee' clang++: error: linker command failed with exit code 1 (use -v to see invocation) CMakeFiles/MNN.dir/build.make:3308: recipe for target 'libMNN.so' failed .. I disabled this code lines // case 16: // copyTensorToFloat<__fp16>(a, compareValue.data()); // copyTensorToFloat<__fp16>(b, expectValue.data()); // break;

  1. -DANDROID_ABI="x86_64"

3.DANDROID_TOOLCHAIN=clang

dimitryn avatar Oct 15 '19 06:10 dimitryn

HI @jxt1234 what is libMNN_Express.so ? Do I need put in apk all so library for Vulkan libMNN_Vulkan.so libMNN.so ? Thanks.

dimitryn avatar Oct 17 '19 14:10 dimitryn

The libMNN_Express .so currently is for debug / benchmark. You needn't put it in apk. For the next version if you want to use MNN's dynamic graph ability or support control-flow op(while / if / switch / merge), you need it.

jxt1234 avatar Oct 23 '19 02:10 jxt1234

@li-qing I am running on RK3399 with Android. I am getting output on MNNV2Basic.out test run :

WARNING: linker: "/data/local/tmp/MNN/MNNV2Basic.out" unused DT entry: type 0xf arg 0xa2c WARNING: linker: "/data/local/tmp/MNN/libMNN.so" unused DT entry: type 0xf arg 0xaf1a WARNING: linker: "/data/local/tmp/MNN/libMNN.so" unused DT entry: type 0xf arg 0xaf1a WARNING: linker: "/data/local/tmp/MNN/libMNN.so" unused DT entry: type 0xf arg 0xaf1a WARNING: linker: "/data/local/tmp/MNN/libMNN.so" unused DT entry: type 0xf arg 0xaf1a Invalide device for support vulkan Invalide device for support vulkan .....

vulkan library exists in lib64.

Why vulkan is not recognized?

dimitryn avatar Oct 30 '19 13:10 dimitryn

@dimitryn When I build valkan, I get same porblem, how did you solve the problem?

no matter ../build_32_vulkan.sh or ../build_32_vulkan.sh error info is same :

/root/yw/MNN/source/backend/vulkan/compiler/AllShader.cpp:112:1: warning: duplicate 'const' declaration specifier [-Wduplicate-decl-specifier]
const 
^~~~~~
/root/yw/MNN/source/backend/vulkan/compiler/AllShader.cpp:112:7: error: expected unqualified-id
const 
      ^
110 warnings and 1 error generated.
source/backend/vulkan/CMakeFiles/MNN_Vulkan.dir/build.make:95: recipe for target 'source/backend/vulkan/CMakeFiles/MNN_Vulkan.dir/compiler/AllShader.cpp.o' failed
make[2]: *** [source/backend/vulkan/CMakeFiles/MNN_Vulkan.dir/compiler/AllShader.cpp.o] Error 1
CMakeFiles/Makefile2:700: recipe for target 'source/backend/vulkan/CMakeFiles/MNN_Vulkan.dir/all' failed
make[1]: *** [source/backend/vulkan/CMakeFiles/MNN_Vulkan.dir/all] Error 2
make[1]: *** Waiting for unfinished jobs....

a243845305 avatar Jul 16 '20 09:07 a243845305

@a243845305 it was a long time ago ...maybe try build_64.sh /32.sh with Vulkan=true

dimitryn avatar Jul 18 '20 09:07 dimitryn

@a243845305 it was a long time ago ...maybe try build_64.sh /32.sh with Vulkan=true

I have download the latest MNN, the issue have been sloved.

a243845305 avatar Jul 20 '20 01:07 a243845305