MNN icon indicating copy to clipboard operation
MNN copied to clipboard

MNN2.8.1 在windows平台上backupType 为opencl的时候输出为全0, backupType 为cpu的时候输出正常

Open sangenan opened this issue 11 months ago • 2 comments

cmake编译命令为:

cmake .. -G Ninja -DMNN_OPENCL=ON -DCMAKE_BUILD_TYPE=Release -DMNN_BUILD_SHARED_LIBS=OFF -DMNN_WIN_RUNTIME_MT=OFF

编译日志如下:

CMake Deprecation Warning at CMakeLists.txt:1 (cmake_minimum_required):
  Compatibility with CMake < 3.5 will be removed from a future version of
  CMake.

  Update the VERSION argument <min> value or use a ...<max> suffix to tell
  CMake that the project does not need compatibility with older versions.


-- The C compiler identification is MSVC 19.39.33522.0
-- The CXX compiler identification is MSVC 19.39.33522.0
-- The ASM compiler identification is MSVC
-- Found assembler: C:/Program Files/Microsoft Visual Studio/2022/Community/VC/Tools/MSVC/14.39.33519/bin/Hostx64/x64/cl.exe
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - done
-- Check for working C compiler: C:/Program Files/Microsoft Visual Studio/2022/Community/VC/Tools/MSVC/14.39.33519/bin/Hostx64/x64/cl.exe - skipped
-- Detecting C compile features
-- Detecting C compile features - done
-- Detecting CXX compiler ABI info
-- Detecting CXX compiler ABI info - done
-- Check for working CXX compiler: C:/Program Files/Microsoft Visual Studio/2022/Community/VC/Tools/MSVC/14.39.33519/bin/Hostx64/x64/cl.exe - skipped
-- Detecting CXX compile features
-- Detecting CXX compile features - done
CMake Warning at CMakeLists.txt:68 (message):
  Close MNN_SEP_BUILD for static library


-- Use Threadpool, forbid openmp
-- >>>>>>>>>>>>>
-- MNN BUILD INFO:
--      System: Windows
--      Processor: AMD64
--      Version: 2.8.1
--      Metal: OFF
--      OpenCL: ON
--      OpenGL: OFF
--      Vulkan: OFF
--      ARM82: OFF
--      oneDNN: OFF
--      TensorRT: OFF
--      CoreML: OFF
--      NNAPI: OFF
--      CUDA: OFF
--      OpenMP: OFF
--      BF16:
--      ThreadPool: ON
--      Hidden: TRUE
--      Build Path: D:/DeepLearning/MNN/MNN-2.8.1/build
--      CUDA PROFILE: OFF
-- WIN_USE_ASM:
-- AMD64: Open SSE
-- MNN_AVX512:OFF
-- Performing Test CMAKE_HAVE_LIBC_PTHREAD
-- Performing Test CMAKE_HAVE_LIBC_PTHREAD - Failed
-- Looking for pthread_create in pthreads
-- Looking for pthread_create in pthreads - not found
-- Looking for pthread_create in pthread
-- Looking for pthread_create in pthread - not found
-- Found Threads: TRUE
-- Configuring done (2.6s)
-- Generating done (0.1s)
-- Build files have been written to: D:/DeepLearning/MNN/MNN-2.8.1/build

D:\DeepLearning\MNN\MNN-2.8.1\build>ninja
[67/376] Building CXX object CMakeFiles\MNNTransform.dir\source\geometry\GeometryTopK.cpp.obj
D:\DeepLearning\MNN\MNN-2.8.1\source\geometry\GeometryTopK.cpp(19): warning C4477: “printf”: 格式字符串“%lu”需要类型“unsigned long”的参数,但可变参数 1 拥有了类型“unsigned __int64”
D:\DeepLearning\MNN\MNN-2.8.1\source\geometry\GeometryTopK.cpp(19): note: 请考虑在格式字符串中使用“%zu”
D:\DeepLearning\MNN\MNN-2.8.1\source\geometry\GeometryTopK.cpp(19): warning C4477: “printf”: 格式字符串“%lu”需要类型“unsigned long”的参数,但可变参数 2 拥有了类型“unsigned __int64”
D:\DeepLearning\MNN\MNN-2.8.1\source\geometry\GeometryTopK.cpp(19): note: 请考虑在格式字符串中使用“%zu”
[103/376] Building CXX object CMakeFiles\MNNTransform.dir\source\shape\ShapePool.cpp.obj
D:\DeepLearning\MNN\MNN-2.8.1\3rd_party\flatbuffers\include\flatbuffers\flatbuffers.h(2241) : warning C4723: 潜在的被 0 除
[142/376] Building CXX object CMakeFiles\MNNCPU.dir\source\backend\cpu\CPUBackend.cpp.obj
D:\DeepLearning\MNN\MNN-2.8.1\source\backend\cpu\CPUBackend.cpp(266): warning C4477: “printf”: 格式字符串“%lu”需要类型“unsigned long”的参数,但可变参数 1 拥有了类型“size_t”
D:\DeepLearning\MNN\MNN-2.8.1\source\backend\cpu\CPUBackend.cpp(266): note: 请考虑在格式字符串中使用“%zu”
[248/376] Building CXX object CMakeFiles\MNNAVX.dir\source\backend\cpu\x86_x64\avx\GemmInt8.cpp.obj
D:\DeepLearning\MNN\MNN-2.8.1\source\backend\cpu\x86_x64\avx\GemmInt8.cpp(523) : warning C4700: 使用了未初始化的局部变量“srcValue0”
[289/376] Building CXX object source\backend\opencl\CMakeFiles\MNN_CL.dir\core\runtime\OpenCLRuntime.cpp.obj
D:\DeepLearning\MNN\MNN-2.8.1\source\backend\opencl\core\runtime\OpenCLRuntime.cpp(632): warning C4477: “printf”: 格式字符 串“%lu”需要类型“unsigned long”的参数,但可变参数 1 拥有了类型“unsigned __int64”
D:\DeepLearning\MNN\MNN-2.8.1\source\backend\opencl\core\runtime\OpenCLRuntime.cpp(632): note: 请考虑在格式字符串中使用“%zu”
D:\DeepLearning\MNN\MNN-2.8.1\source\backend\opencl\core\runtime\OpenCLRuntime.cpp(632): warning C4477: “printf”: 格式字符 串“%lu”需要类型“unsigned long”的参数,但可变参数 2 拥有了类型“unsigned __int64”
D:\DeepLearning\MNN\MNN-2.8.1\source\backend\opencl\core\runtime\OpenCLRuntime.cpp(632): note: 请考虑在格式字符串中使用“%zu”
[376/376] Linking CXX executable fuseTest.exe

sangenan avatar Mar 20 '24 15:03 sangenan

已知问题,暂时先修改 opencl 的 cmakelists 规避一下

source/backend/opencl/CMakeLists.txt

32 行去掉:

add_definitions(-DMNN_SUPPORT_INTEL_SUBGROUP)

亦即不要加 -DMNN_SUPPORT_INTEL_SUBGROUP

jxt1234 avatar Mar 22 '24 08:03 jxt1234

请问一下 MNN 在Windows 上使用 OpenCL 推理的时候用的是GPU还是CPU, 我运行 benchmark 的用参数 CPU/OPENCL 速度区别挺大的 但是看进程管理器里面,使用OpenCL的时候程序并没有调用GPU资源

sg0771 avatar Apr 03 '24 01:04 sg0771

Marking as stale. No activity in 60 days.

github-actions[bot] avatar Jun 02 '24 09:06 github-actions[bot]