alibaba / MNN

MNN is a blazing fast, lightweight deep learning framework, battle-tested by business-critical use cases in Alibaba
http://www.mnn.zone/
8.72k stars 1.67k forks source link

RK3588S平台编译OPENCL,运行benchmark时,报错:OpenCL init error, fallback ... #2270

Closed Kokoing123 closed 9 months ago

Kokoing123 commented 1 year ago

平台(如果交叉编译请再附上交叉编译目标平台):

RK3588S

Github版本:

master分支

编译方式:

cmake .. -DMNN_SEP_BUILD=false -DOPEN_CL=on

-- Use Threadpool, forbid openmp -- >>>>>>>>>>>>> -- MNN BUILD INFO: -- System: Linux -- Processor: aarch64 -- Version: 2.4.0 -- Metal: OFF -- OpenCL: ON -- OpenGL: OFF -- Vulkan: OFF -- ARM82: OFF -- oneDNN: OFF -- TensorRT: OFF -- CoreML: OFF -- NNAPI: OFF -- CUDA: OFF -- OpenMP: OFF -- BF16: OFF -- ThreadPool: ON -- Hidden: TRUE -- Build Path: /home/firefly/Downloads/MNN/build -- CUDA PROFILE: OFF -- WIN_USE_ASM: -- Enabling AArch64 Assemblies -- Configuring done -- Generating done -- Build files have been written to: /home/firefly/Downloads/MNN/build

编译日志:

Build Log:

Consolidate compiler generated dependencies of target MNNUtils
Consolidate compiler generated dependencies of target MNNCV
Consolidate compiler generated dependencies of target MNNMath
Scanning dependencies of target MNNARM64
Consolidate compiler generated dependencies of target MNNFuse
Consolidate compiler generated dependencies of target MNNARM64
Consolidate compiler generated dependencies of target MNNCore
[  0%] Built target MNNMath
[  0%] Built target MNNCV
[  1%] Built target MNNUtils
[ 13%] Built target MNNARM64
[ 14%] Built target MNNFuse
Consolidate compiler generated dependencies of target MNNOpenCV
Consolidate compiler generated dependencies of target MNN_Express
Consolidate compiler generated dependencies of target checkFile.out
[ 17%] Built target MNNCore
Consolidate compiler generated dependencies of target MNNCPU
Consolidate compiler generated dependencies of target MNN_CL
Consolidate compiler generated dependencies of target checkDir.out
Consolidate compiler generated dependencies of target MNNTransform
[ 17%] Built target checkFile.out
[ 17%] Built target checkDir.out
[ 18%] Building CXX object tools/cv/CMakeFiles/MNNOpenCV.dir/source/imgproc/draw.cpp.o
[ 18%] Building CXX object tools/cv/CMakeFiles/MNNOpenCV.dir/source/imgproc/geometric.cpp.o
[ 18%] Building CXX object tools/cv/CMakeFiles/MNNOpenCV.dir/source/imgproc/color.cpp.o
[ 18%] Building CXX object tools/cv/CMakeFiles/MNNOpenCV.dir/source/imgproc/filter.cpp.o
[ 18%] Building CXX object express/CMakeFiles/MNN_Express.dir/Executor.cpp.o
[ 18%] Building CXX object source/backend/opencl/CMakeFiles/MNN_CL.dir/core/BufferConvertor.cpp.o
[ 38%] Built target MNNTransform
[ 38%] Building CXX object tools/cv/CMakeFiles/MNNOpenCV.dir/source/imgproc/miscellaneous.cpp.o
[ 54%] Built target MNNCPU
[ 54%] Building CXX object source/backend/opencl/CMakeFiles/MNN_CL.dir/core/BufferPool.cpp.o
[ 54%] Building CXX object tools/cv/CMakeFiles/MNNOpenCV.dir/source/imgproc/structural.cpp.o
[ 54%] Building CXX object tools/cv/CMakeFiles/MNNOpenCV.dir/source/imgproc/histograms.cpp.o
[ 54%] Building CXX object source/backend/opencl/CMakeFiles/MNN_CL.dir/core/ImageBufferConvertor.cpp.o
[ 55%] Building CXX object tools/cv/CMakeFiles/MNNOpenCV.dir/source/calib3d/calib3d.cpp.o
[ 56%] Building CXX object source/backend/opencl/CMakeFiles/MNN_CL.dir/core/ImagePool.cpp.o
[ 56%] Building CXX object source/backend/opencl/CMakeFiles/MNN_CL.dir/core/OpenCLBackend.cpp.o
[ 56%] Building CXX object source/backend/opencl/CMakeFiles/MNN_CL.dir/core/OpenCLRunningUtils.cpp.o
[ 56%] Building CXX object source/backend/opencl/CMakeFiles/MNN_CL.dir/core/runtime/OpenCLRuntime.cpp.o
[ 56%] Building CXX object source/backend/opencl/CMakeFiles/MNN_CL.dir/core/runtime/OpenCLWrapper.cpp.o
[ 57%] Building CXX object source/backend/opencl/CMakeFiles/MNN_CL.dir/execution/buffer/BinaryBufExecution.cpp.o
[ 57%] Building CXX object source/backend/opencl/CMakeFiles/MNN_CL.dir/execution/buffer/ConvBufExecution.cpp.o
[ 57%] Building CXX object source/backend/opencl/CMakeFiles/MNN_CL.dir/execution/buffer/ConvBufWinograd.cpp.o
[ 57%] Building CXX object source/backend/opencl/CMakeFiles/MNN_CL.dir/execution/buffer/DeconvBufExecution.cpp.o
[ 57%] Built target MNNOpenCV
[ 57%] Building CXX object source/backend/opencl/CMakeFiles/MNN_CL.dir/execution/buffer/DepthwiseConvBufExecution.cpp.o
[ 57%] Building CXX object source/backend/opencl/CMakeFiles/MNN_CL.dir/execution/buffer/GridSampleBufExecution.cpp.o
[ 57%] Building CXX object express/CMakeFiles/MNN_Express.dir/ExecutorScope.cpp.o
[ 57%] Building CXX object express/CMakeFiles/MNN_Express.dir/Expr.cpp.o
[ 58%] Building CXX object source/backend/opencl/CMakeFiles/MNN_CL.dir/execution/buffer/Interp3DBufExecution.cpp.o
[ 59%] Building CXX object express/CMakeFiles/MNN_Express.dir/MathOp.cpp.o
[ 59%] Building CXX object express/CMakeFiles/MNN_Express.dir/NeuralNetWorkOp.cpp.o
[ 59%] Building CXX object source/backend/opencl/CMakeFiles/MNN_CL.dir/execution/buffer/InterpBufExecution.cpp.o
[ 59%] Building CXX object source/backend/opencl/CMakeFiles/MNN_CL.dir/execution/buffer/MatmulBufExecution.cpp.o
[ 59%] Building CXX object source/backend/opencl/CMakeFiles/MNN_CL.dir/execution/buffer/PoolBufExecution.cpp.o
[ 59%] Building CXX object source/backend/opencl/CMakeFiles/MNN_CL.dir/execution/buffer/RasterBufExecution.cpp.o
[ 59%] Building CXX object express/CMakeFiles/MNN_Express.dir/Optimizer.cpp.o
[ 59%] Building CXX object express/CMakeFiles/MNN_Express.dir/Utils.cpp.o
[ 59%] Building CXX object source/backend/opencl/CMakeFiles/MNN_CL.dir/execution/buffer/ReductionBufExecution.cpp.o
[ 60%] Building CXX object source/backend/opencl/CMakeFiles/MNN_CL.dir/execution/buffer/ReluBufExecution.cpp.o
[ 60%] Building CXX object express/CMakeFiles/MNN_Express.dir/module/IfModule.cpp.o
[ 60%] Building CXX object source/backend/opencl/CMakeFiles/MNN_CL.dir/execution/buffer/ScaleBufExecution.cpp.o
[ 60%] Building CXX object source/backend/opencl/CMakeFiles/MNN_CL.dir/execution/buffer/SoftmaxBufExecution.cpp.o
[ 60%] Building CXX object source/backend/opencl/CMakeFiles/MNN_CL.dir/execution/buffer/UnaryBufExecution.cpp.o
[ 60%] Building CXX object source/backend/opencl/CMakeFiles/MNN_CL.dir/execution/cl/opencl_program.cc.o
[ 60%] Building CXX object express/CMakeFiles/MNN_Express.dir/module/Module.cpp.o
[ 61%] Building CXX object source/backend/opencl/CMakeFiles/MNN_CL.dir/execution/image/CommonExecution.cpp.o
[ 61%] Building CXX object source/backend/opencl/CMakeFiles/MNN_CL.dir/execution/image/Conv2DBackPropFilter.cpp.o
[ 61%] Building CXX object source/backend/opencl/CMakeFiles/MNN_CL.dir/execution/image/ConvExecution.cpp.o
[ 61%] Building CXX object source/backend/opencl/CMakeFiles/MNN_CL.dir/execution/image/ConvWinograd.cpp.o
[ 62%] Building CXX object express/CMakeFiles/MNN_Express.dir/module/NMSModule.cpp.o
[ 62%] Building CXX object source/backend/opencl/CMakeFiles/MNN_CL.dir/execution/image/ConvertExecution.cpp.o
[ 62%] Building CXX object source/backend/opencl/CMakeFiles/MNN_CL.dir/execution/image/DeconvExecution.cpp.o
[ 63%] Building CXX object source/backend/opencl/CMakeFiles/MNN_CL.dir/execution/image/DepthwiseConvExecution.cpp.o
[ 63%] Building CXX object express/CMakeFiles/MNN_Express.dir/module/PipelineModule.cpp.o
[ 63%] Building CXX object source/backend/opencl/CMakeFiles/MNN_CL.dir/execution/image/DepthwiseDeconvExecution.cpp.o
[ 63%] Building CXX object source/backend/opencl/CMakeFiles/MNN_CL.dir/execution/image/EltwiseExecution.cpp.o
[ 63%] Building CXX object source/backend/opencl/CMakeFiles/MNN_CL.dir/execution/image/FuseExecution.cpp.o
[ 63%] Building CXX object source/backend/opencl/CMakeFiles/MNN_CL.dir/execution/image/GridSampleExecution.cpp.o
[ 63%] Building CXX object source/backend/opencl/CMakeFiles/MNN_CL.dir/execution/image/Interp3DExecution.cpp.o
[ 64%] Building CXX object source/backend/opencl/CMakeFiles/MNN_CL.dir/execution/image/InterpExecution.cpp.o
[ 64%] Building CXX object express/CMakeFiles/MNN_Express.dir/module/StaticModule.cpp.o
[ 64%] Building CXX object source/backend/opencl/CMakeFiles/MNN_CL.dir/execution/image/MatmulExecution.cpp.o
[ 64%] Building CXX object source/backend/opencl/CMakeFiles/MNN_CL.dir/execution/image/MultiInputDWConvExecution.cpp.o
[ 64%] Building CXX object source/backend/opencl/CMakeFiles/MNN_CL.dir/execution/image/MultiInputDWDeconvExecution.cpp.o
[ 64%] Building CXX object source/backend/opencl/CMakeFiles/MNN_CL.dir/execution/image/NormalizeExecution.cpp.o
[ 64%] Building CXX object source/backend/opencl/CMakeFiles/MNN_CL.dir/execution/image/PoolExecution.cpp.o
[ 65%] Building CXX object source/backend/opencl/CMakeFiles/MNN_CL.dir/execution/image/RasterExecution.cpp.o
/home/firefly/Downloads/MNN/express/Expr.cpp: In static member function ‘static void MNN::Express::Variable::save(const std::vector<MNN::Express*)’:
/home/firefly/Downloads/MNN/express/Expr.cpp:29:24: warning: ‘__builtin___snprintf_chk’ output may be truncated before the last format characteron=]
   29 |     snprintf(s, 10, "%d", index);
      |                        ^
In file included from /usr/include/stdio.h:867,
                 from /usr/include/c++/9/cstdio:42,
                 from /usr/include/c++/9/ext/string_conversions.h:43,
                 from /usr/include/c++/9/bits/basic_string.h:6496,
                 from /usr/include/c++/9/string:55,
                 from /usr/include/c++/9/stdexcept:39,
                 from /usr/include/c++/9/array:39,
                 from /usr/include/c++/9/tuple:39,
                 from /usr/include/c++/9/functional:54,
                 from /home/firefly/Downloads/MNN/include/MNN/expr/Expr.hpp:12,
                 from /home/firefly/Downloads/MNN/express/Expr.cpp:10:
/usr/include/aarch64-linux-gnu/bits/stdio2.h:67:35: note: ‘__builtin___snprintf_chk’ output between 2 and 11 bytes into a destination of size 10
   67 |   return __builtin___snprintf_chk (__s, __n, __USE_FORTIFY_LEVEL - 1,
      |          ~~~~~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   68 |        __bos (__s), __fmt, __va_arg_pack ());
      |        ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
[ 65%] Building CXX object source/backend/opencl/CMakeFiles/MNN_CL.dir/execution/image/ReductionExecution.cpp.o
[ 65%] Building CXX object express/CMakeFiles/MNN_Express.dir/module/WhileModule.cpp.o
[ 65%] Building CXX object source/backend/opencl/CMakeFiles/MNN_CL.dir/execution/image/ReluExecution.cpp.o
[ 65%] Building CXX object source/backend/opencl/CMakeFiles/MNN_CL.dir/execution/image/RoiPoolingExecution.cpp.o
[ 65%] Building CXX object source/backend/opencl/CMakeFiles/MNN_CL.dir/execution/image/ScaleExecution.cpp.o
[ 66%] Building CXX object source/backend/opencl/CMakeFiles/MNN_CL.dir/execution/image/SoftmaxExecution.cpp.o
[ 66%] Building CXX object source/backend/opencl/CMakeFiles/MNN_CL.dir/execution/image/TrainableParamExecution.cpp.o
[ 66%] Built target MNN_Express
[ 66%] Building CXX object source/backend/opencl/CMakeFiles/MNN_CL.dir/execution/image/UnaryExecution.cpp.o
[ 66%] Built target MNN_CL
Consolidate compiler generated dependencies of target MNN
[ 66%] Linking CXX shared library libMNN.so
[ 66%] Built target MNN
Consolidate compiler generated dependencies of target SequenceModuleTest.out
Consolidate compiler generated dependencies of target modelCompare.out
Consolidate compiler generated dependencies of target mergeInplaceForCPU
Consolidate compiler generated dependencies of target mobilenetTest.out
Consolidate compiler generated dependencies of target backendTest.out
Consolidate compiler generated dependencies of target ModuleBasic.out
Consolidate compiler generated dependencies of target GetMNNInfo
Consolidate compiler generated dependencies of target MNNV2Basic.out
[ 66%] Linking CXX executable SequenceModuleTest.out
[ 66%] Linking CXX executable modelCompare.out
[ 67%] Linking CXX executable mergeInplaceForCPU
[ 67%] Linking CXX executable mobilenetTest.out
[ 67%] Linking CXX executable backendTest.out
[ 68%] Linking CXX executable ModuleBasic.out
[ 68%] Linking CXX executable GetMNNInfo
[ 68%] Linking CXX executable MNNV2Basic.out
[ 68%] Built target modelCompare.out
Consolidate compiler generated dependencies of target testModel.out
[ 68%] Built target SequenceModuleTest.out
[ 68%] Linking CXX executable testModel.out
[ 68%] Built target GetMNNInfo
Consolidate compiler generated dependencies of target testModel_expr.out
[ 68%] Built target MNNV2Basic.out
Consolidate compiler generated dependencies of target testModelWithDescribe.out
Consolidate compiler generated dependencies of target getPerformance.out
[ 68%] Linking CXX executable testModel_expr.out
[ 68%] Linking CXX executable getPerformance.out
[ 68%] Linking CXX executable testModelWithDescribe.out
[ 68%] Built target mergeInplaceForCPU
[ 68%] Built target ModuleBasic.out
Consolidate compiler generated dependencies of target checkInvalidValue.out
[ 69%] Built target backendTest.out
Consolidate compiler generated dependencies of target timeProfile.out
Consolidate compiler generated dependencies of target testTrain.out
[ 69%] Built target mobilenetTest.out
[ 70%] Linking CXX executable checkInvalidValue.out
Consolidate compiler generated dependencies of target aoa_nlu_encoder.out
[ 70%] Linking CXX executable timeProfile.out
[ 70%] Linking CXX executable testTrain.out
[ 70%] Linking CXX executable aoa_nlu_encoder.out
[ 70%] Built target getPerformance.out
[ 71%] Built target testModel.out
Consolidate compiler generated dependencies of target aoa_nlu_decoder2.out
Consolidate compiler generated dependencies of target aoa_nlu_decoder1.out
[ 71%] Built target testModel_expr.out
[ 71%] Linking CXX executable aoa_nlu_decoder2.out
Consolidate compiler generated dependencies of target winogradExample.out
[ 71%] Built target testModelWithDescribe.out
Consolidate compiler generated dependencies of target winogradGenerateGLSL.out
[ 71%] Linking CXX executable aoa_nlu_decoder1.out
[ 71%] Linking CXX executable winogradExample.out
[ 72%] Linking CXX executable winogradGenerateGLSL.out
[ 73%] Built target testTrain.out
Consolidate compiler generated dependencies of target winogradGenerateCL.out
[ 73%] Built target checkInvalidValue.out
[ 73%] Built target aoa_nlu_encoder.out
[ 74%] Built target aoa_nlu_decoder2.out
[ 74%] Linking CXX executable winogradGenerateCL.out
Consolidate compiler generated dependencies of target benchmark.out
Consolidate compiler generated dependencies of target benchmarkExprModels.out
[ 75%] Built target winogradExample.out
[ 75%] Linking CXX executable benchmark.out
[ 75%] Built target timeProfile.out
[ 76%] Linking CXX executable benchmarkExprModels.out
Consolidate compiler generated dependencies of target run_test.out
[ 76%] Built target aoa_nlu_decoder1.out
[ 76%] Built target winogradGenerateGLSL.out
[ 76%] Built target winogradGenerateCL.out
[ 76%] Built target benchmark.out
[ 77%] Built target benchmarkExprModels.out
[ 77%] Linking CXX executable run_test.out
[100%] Built target run_test.out
firefly@firefly:~/Downloads/MNN/build$ sudo make install
[  3%] Built target MNNCore
[  3%] Built target MNNCV
[  3%] Built target MNNMath
[ 23%] Built target MNNTransform
[ 24%] Built target MNNUtils
[ 40%] Built target MNNCPU
[ 52%] Built target MNNARM64
[ 53%] Built target MNNFuse
Consolidate compiler generated dependencies of target MNNOpenCV
[ 55%] Built target MNNOpenCV
Consolidate compiler generated dependencies of target MNN_CL
[ 64%] Built target MNN_CL
Consolidate compiler generated dependencies of target MNN_Express
[ 66%] Built target MNN_Express
[ 66%] Built target MNN
[ 66%] Built target GetMNNInfo
[ 67%] Built target ModuleBasic.out
[ 67%] Built target SequenceModuleTest.out
[ 67%] Built target mergeInplaceForCPU
[ 67%] Built target MNNV2Basic.out
[ 68%] Built target mobilenetTest.out
[ 69%] Built target backendTest.out
[ 69%] Built target modelCompare.out
[ 70%] Built target testModel.out
[ 70%] Built target testModel_expr.out
[ 70%] Built target testModelWithDescribe.out
[ 70%] Built target getPerformance.out
[ 71%] Built target checkInvalidValue.out
[ 71%] Built target timeProfile.out
[ 72%] Built target testTrain.out
[ 72%] Built target aoa_nlu_encoder.out
[ 72%] Built target aoa_nlu_decoder1.out
[ 73%] Built target aoa_nlu_decoder2.out
[ 73%] Built target checkDir.out
[ 73%] Built target checkFile.out
[ 74%] Built target winogradExample.out
[ 75%] Built target winogradGenerateGLSL.out
[ 75%] Built target winogradGenerateCL.out
[ 98%] Built target run_test.out
[ 98%] Built target benchmark.out
[100%] Built target benchmarkExprModels.out

运行benchmark.out时报错如下: ./benchmark.out ../benchmark/models 10 10 3 MNN benchmark Forward type: OpenCL thread=4 precision=2 sparsity=0** sparseBlockOC=1 --------> Benchmarking... loop = 10, warmup = 10 The device support dot:1, support fp16:1, support i8mm: 0 OpenCL init error, fallback ... Can't Find type=3 backend, use 0 instead OpenCL init error, fallback ... Can't Find type=3 backend, use 0 instead [ - ] SqueezeNetV1.0.mnn max = 14.138 ms min = 13.082 ms avg = 13.674 ms

jxt1234 commented 1 year ago

这个是没有找到 libopencl.so ,或者 dlopen 失败了

wangzhaode commented 1 year ago

看一下LoadOpenCLLibrary函数有没有成功加载opencl的动态库

Kokoing123 commented 1 year ago

好的,我检查一下

github-actions[bot] commented 9 months ago

Marking as stale. No activity in 60 days.