OpenPPL / ppq

PPL Quantization Tool (PPQ) is a powerful offline neural network quantization tool.
Apache License 2.0
1.56k stars 236 forks source link

debug ProgramEntrance_1.py get a error:opset version is not supported, can not generate dispatching scheme with op /model.10/Resize(Resize), currently we support only [(10, 13)], however 16 was given. #579

Open tuantuanyyyy opened 1 month ago

tuantuanyyyy commented 1 month ago

hi, i tried to debug the code Entrance_1.py according to the idea in the this video https://www.bilibili.com/video/BV1934y147p2/?spm_id_from=333.788.videopod.sections&vd_source=c276bd4c8dbb36d81805cd3ae2fc2946 but i have some errors blow:

Traceback (most recent call last): File "/root/liq/fde/lib/python3.10/site-packages/torch/utils/cpp_extension.py", line 1900, in _run_ninja_build subprocess.run( File "/usr/lib/python3.10/subprocess.py", line 524, in run raise CalledProcessError(retcode, process.args, subprocess.CalledProcessError: Command '['ninja', '-v']' returned non-zero exit status 1.

The above exception was the direct cause of the following exception:

Traceback (most recent call last): File "/root/liq/ppq_quantize/ppq_quantization.py", line 96, in with ENABLE_CUDA_KERNEL(): File "/root/liq/fde/lib/python3.10/site-packages/ppq/api/interface.py", line 927, in init CUDA_COMPLIER.complie() File "/root/liq/fde/lib/python3.10/site-packages/ppq/core/ffi.py", line 29, in complie self.CUDA_EXTENTION = load( File "/root/liq/fde/lib/python3.10/site-packages/torch/utils/cpp_extension.py", line 1284, in load return _jit_compile( File "/root/liq/fde/lib/python3.10/site-packages/torch/utils/cpp_extension.py", line 1508, in _jit_compile _write_ninja_file_and_build_library( File "/root/liq/fde/lib/python3.10/site-packages/torch/utils/cpp_extension.py", line 1623, in _write_ninja_file_and_build_library _run_ninja_build( File "/root/liq/fde/lib/python3.10/site-packages/torch/utils/cpp_extension.py", line 1916, in _run_ninja_build raise RuntimeError(message) from e RuntimeError: Error building extension 'PPQ_Cuda_Impls': [1/5] /usr/bin/nvcc -DTORCH_EXTENSION_NAME=PPQ_Cuda_Impls -DTORCH_API_INCLUDE_EXTENSION_H -DPYBIND11_COMPILER_TYPE=\"_gcc\" -DPYBIND11_STDLIB=\"_libstdcpp\" -DPYBIND11_BUILD_ABI=\"_cxxabi1011\" -isystem /root/liq/fde/lib/python3.10/site-packages/torch/include -isystem /root/liq/fde/lib/python3.10/site-packages/torch/include/torch/csrc/api/include -isystem /root/liq/fde/lib/python3.10/site-packages/torch/include/TH -isystem /root/liq/fde/lib/python3.10/site-packages/torch/include/THC -isystem /usr/include/python3.10 -D_GLIBCXX_USE_CXX11_ABI=0 -DCUDA_NO_HALF_OPERATORS -DCUDA_NO_HALF_CONVERSIONS -DCUDA_NO_BFLOAT16_CONVERSIONS -DCUDA_NO_HALF2_OPERATORS --expt-relaxed-constexpr -gencode=arch=compute_86,code=compute_86 -gencode=arch=compute_86,code=sm_86 --compiler-options '-fPIC' -std=c++14 -c /root/liq/fde/lib/python3.10/site-packages/ppq/csrc/cuda/linear.cu -o linear.cuda.o FAILED: linear.cuda.o /usr/bin/nvcc -DTORCH_EXTENSION_NAME=PPQ_Cuda_Impls -DTORCH_API_INCLUDE_EXTENSION_H -DPYBIND11_COMPILER_TYPE=\"_gcc\" -DPYBIND11_STDLIB=\"_libstdcpp\" -DPYBIND11_BUILD_ABI=\"_cxxabi1011\" -isystem /root/liq/fde/lib/python3.10/site-packages/torch/include -isystem /root/liq/fde/lib/python3.10/site-packages/torch/include/torch/csrc/api/include -isystem /root/liq/fde/lib/python3.10/site-packages/torch/include/TH -isystem /root/liq/fde/lib/python3.10/site-packages/torch/include/THC -isystem /usr/include/python3.10 -D_GLIBCXX_USE_CXX11_ABI=0 -DCUDA_NO_HALF_OPERATORS -DCUDA_NO_HALF_CONVERSIONS -DCUDA_NO_BFLOAT16_CONVERSIONS -DCUDA_NO_HALF2_OPERATORS__ --expt-relaxed-constexpr -gencode=arch=compute_86,code=compute_86 -gencode=arch=compute_86,code=sm_86 --compiler-options '-fPIC' -std=c++14 -c /root/liq/fde/lib/python3.10/site-packages/ppq/csrc/cuda/linear.cu -o linear.cuda.o nvcc fatal : Unsupported gpu architecture 'compute_86' [2/5] /usr/bin/nvcc -DTORCH_EXTENSION_NAME=PPQ_Cuda_Impls -DTORCH_API_INCLUDE_EXTENSION_H -DPYBIND11_COMPILER_TYPE=\"_gcc\" -DPYBIND11_STDLIB=\"_libstdcpp\" -DPYBIND11_BUILD_ABI=\"_cxxabi1011\" -isystem /root/liq/fde/lib/python3.10/site-packages/torch/include -isystem /root/liq/fde/lib/python3.10/site-packages/torch/include/torch/csrc/api/include -isystem /root/liq/fde/lib/python3.10/site-packages/torch/include/TH -isystem /root/liq/fde/lib/python3.10/site-packages/torch/include/THC -isystem /usr/include/python3.10 -D_GLIBCXX_USE_CXX11_ABI=0 -DCUDA_NO_HALF_OPERATORS -DCUDA_NO_HALF_CONVERSIONS -DCUDA_NO_BFLOAT16_CONVERSIONS -DCUDA_NO_HALF2_OPERATORS --expt-relaxed-constexpr -gencode=arch=compute_86,code=compute_86 -gencode=arch=compute_86,code=sm_86 --compiler-options '-fPIC' -std=c++14 -c /root/liq/fde/lib/python3.10/site-packages/ppq/csrc/cuda/sort.cu -o sort.cuda.o FAILED: sort.cuda.o /usr/bin/nvcc -DTORCH_EXTENSION_NAME=PPQ_Cuda_Impls -DTORCH_API_INCLUDE_EXTENSION_H -DPYBIND11_COMPILER_TYPE=\"_gcc\" -DPYBIND11_STDLIB=\"_libstdcpp\" -DPYBIND11_BUILD_ABI=\"_cxxabi1011\" -isystem /root/liq/fde/lib/python3.10/site-packages/torch/include -isystem /root/liq/fde/lib/python3.10/site-packages/torch/include/torch/csrc/api/include -isystem /root/liq/fde/lib/python3.10/site-packages/torch/include/TH -isystem /root/liq/fde/lib/python3.10/site-packages/torch/include/THC -isystem /usr/include/python3.10 -D_GLIBCXX_USE_CXX11_ABI=0 -DCUDA_NO_HALF_OPERATORS -DCUDA_NO_HALF_CONVERSIONS -DCUDA_NO_BFLOAT16_CONVERSIONS -DCUDA_NO_HALF2_OPERATORS --expt-relaxed-constexpr -gencode=arch=compute_86,code=compute_86 -gencode=arch=compute_86,code=sm_86 --compiler-options '-fPIC' -std=c++14 -c /root/liq/fde/lib/python3.10/site-packages/ppq/csrc/cuda/sort.cu -o sort.cuda.o nvcc fatal : Unsupported gpu architecture 'compute_86' [3/5] /usr/bin/nvcc -DTORCH_EXTENSION_NAME=PPQ_Cuda_Impls -DTORCH_API_INCLUDE_EXTENSION_H -DPYBIND11_COMPILER_TYPE=\"_gcc\" -DPYBIND11_STDLIB=\"_libstdcpp\" -DPYBIND11_BUILD_ABI=\"_cxxabi1011\" -isystem /root/liq/fde/lib/python3.10/site-packages/torch/include -isystem /root/liq/fde/lib/python3.10/site-packages/torch/include/torch/csrc/api/include -isystem /root/liq/fde/lib/python3.10/site-packages/torch/include/TH -isystem /root/liq/fde/lib/python3.10/site-packages/torch/include/THC -isystem /usr/include/python3.10 -D_GLIBCXX_USE_CXX11_ABI=0 -D__CUDA_NO_HALF_OPERATORS -DCUDA_NO_HALF_CONVERSIONS -DCUDA_NO_BFLOAT16_CONVERSIONS -DCUDA_NO_HALF2_OPERATORS --expt-relaxed-constexpr -gencode=arch=compute_86,code=compute_86 -gencode=arch=compute_86,code=sm_86 --compiler-options '-fPIC' -std=c++14 -c /root/liq/fde/lib/python3.10/site-packages/ppq/csrc/cuda/train.cu -o train.cuda.o FAILED: train.cuda.o /usr/bin/nvcc -DTORCH_EXTENSION_NAME=PPQ_Cuda_Impls -DTORCH_API_INCLUDE_EXTENSION_H -DPYBIND11_COMPILER_TYPE=\"_gcc\" -DPYBIND11_STDLIB=\"_libstdcpp\" -DPYBIND11_BUILD_ABI=\"_cxxabi1011\" -isystem /root/liq/fde/lib/python3.10/site-packages/torch/include -isystem /root/liq/fde/lib/python3.10/site-packages/torch/include/torch/csrc/api/include -isystem /root/liq/fde/lib/python3.10/site-packages/torch/include/TH -isystem /root/liq/fde/lib/python3.10/site-packages/torch/include/THC -isystem /usr/include/python3.10 -D_GLIBCXX_USE_CXX11_ABI=0 -DCUDA_NO_HALF_OPERATORS -DCUDA_NO_HALF_CONVERSIONS -DCUDA_NO_BFLOAT16_CONVERSIONS -DCUDA_NO_HALF2_OPERATORS__ --expt-relaxed-constexpr -gencode=arch=compute_86,code=compute_86 -gencode=arch=compute_86,code=sm_86 --compiler-options '-fPIC' -std=c++14 -c /root/liq/fde/lib/python3.10/site-packages/ppq/csrc/cuda/train.cu -o train.cuda.o nvcc fatal : Unsupported gpu architecture 'compute_86' [4/5] /usr/bin/nvcc -DTORCH_EXTENSION_NAME=PPQ_Cuda_Impls -DTORCH_API_INCLUDE_EXTENSION_H -DPYBIND11_COMPILER_TYPE=\"_gcc\" -DPYBIND11_STDLIB=\"_libstdcpp\" -DPYBIND11_BUILD_ABI=\"_cxxabi1011\" -isystem /root/liq/fde/lib/python3.10/site-packages/torch/include -isystem /root/liq/fde/lib/python3.10/site-packages/torch/include/torch/csrc/api/include -isystem /root/liq/fde/lib/python3.10/site-packages/torch/include/TH -isystem /root/liq/fde/lib/python3.10/site-packages/torch/include/THC -isystem /usr/include/python3.10 -D_GLIBCXX_USE_CXX11_ABI=0 -DCUDA_NO_HALF_OPERATORS -DCUDA_NO_HALF_CONVERSIONS -DCUDA_NO_BFLOAT16_CONVERSIONS -DCUDA_NO_HALF2_OPERATORS --expt-relaxed-constexpr -gencode=arch=compute_86,code=compute_86 -gencode=arch=compute_86,code=sm_86 --compiler-options '-fPIC' -std=c++14 -c /root/liq/fde/lib/python3.10/site-packages/ppq/csrc/cuda/floating.cu -o floating.cuda.o FAILED: floating.cuda.o /usr/bin/nvcc -DTORCH_EXTENSION_NAME=PPQ_Cuda_Impls -DTORCH_API_INCLUDE_EXTENSION_H -DPYBIND11_COMPILER_TYPE=\"_gcc\" -DPYBIND11_STDLIB=\"_libstdcpp\" -DPYBIND11_BUILD_ABI=\"_cxxabi1011\" -isystem /root/liq/fde/lib/python3.10/site-packages/torch/include -isystem /root/liq/fde/lib/python3.10/site-packages/torch/include/torch/csrc/api/include -isystem /root/liq/fde/lib/python3.10/site-packages/torch/include/TH -isystem /root/liq/fde/lib/python3.10/site-packages/torch/include/THC -isystem /usr/include/python3.10 -D_GLIBCXX_USE_CXX11_ABI=0 -DCUDA_NO_HALF_OPERATORS -DCUDA_NO_HALF_CONVERSIONS -DCUDA_NO_BFLOAT16_CONVERSIONS -DCUDA_NO_HALF2_OPERATORS__ --expt-relaxed-constexpr -gencode=arch=compute_86,code=compute_86 -gencode=arch=compute_86,code=sm_86 --compiler-options '-fPIC' -std=c++14 -c /root/liq/fde/lib/python3.10/site-packages/ppq/csrc/cuda/floating.cu -o floating.cuda.o nvcc fatal : Unsupported gpu architecture 'compute_86' ninja: build stopped: subcommand failed.

my gpu is rtx3090. what cause this bug?thank you for your attention to my problem.

tuantuanyyyy commented 1 month ago

i search issue and find someone said that with ENABLE_CUDA_KERNEL(): with ENABLE_CUDA_KERNEL(): can be try to deleted. but also get a new error:

Traceback (most recent call last): File "/root/liq/ppq_quantize/ppq_quantization.py", line 98, in quantized = quantize_native_model( File "/root/liq/fde/lib/python3.10/site-packages/ppq/core/defs.py", line 54, in _wrapper return func(*args, **kwargs) File "/root/liq/fde/lib/python3.10/site-packages/ppq/api/interface.py", line 518, in quantize_native_model ppq_ir = dispatch_graph(graph=model, platform=platform, File "/root/liq/fde/lib/python3.10/site-packages/ppq/api/interface.py", line 675, in dispatch_graph dispatching_table = dispatcher.dispatch( File "/root/liq/fde/lib/python3.10/site-packages/ppq/scheduler/dispatchers.py", line 199, in dispatch recivers, generators = SOI_receivers(graph), SOI_generators(graph) File "/root/liq/fde/lib/python3.10/site-packages/ppq/scheduler/base.py", line 63, in SOI_receivers for idx, plat in enumerate(operation.socket.in_plat): File "/root/liq/fde/lib/python3.10/site-packages/ppq/IR/base/graph.py", line 172, in socket return DEFAULT_SOCKET_TABLEself.type File "/root/liq/fde/lib/python3.10/site-packages/ppq/IR/base/opdef.py", line 307, in Resize_Socket CHECK_OPSET(op=op, min_version_supported=10, max_version_supported=13, strict_check=True) File "/root/liq/fde/lib/python3.10/site-packages/ppq/IR/base/opdef.py", line 191, in CHECK_OPSET raise TypeError( TypeError: opset version is not supported, can not generate dispatching scheme with op /model.10/Resize(Resize), currently we support only [(10, 13)], however 16 was given.

i want to know how can i try to solve this problem thanks you.