TensorRT icon indicating copy to clipboard operation
TensorRT copied to clipboard

build pytorch_quantization(2.2.1) error

Open 2460707925 opened this issue 1 year ago • 3 comments

Description

when I try to build pytorch_quantization from source following readme.md, building error happens in tensor_quant_gpu.cu. and I think maybe some version problem

Environment

TensorRT Version:

NVIDIA GPU:

NVIDIA Driver Version:

CUDA Version:

CUDNN Version: release 10.5

Operating System: linux

Python Version (if applicable): 3.8.19

Tensorflow Version (if applicable):

PyTorch Version (if applicable): 1.12.1+cu113

In file included from /home/wxb/.conda/envs/quant_env/lib/python3.8/site-packages/torch/include/ATen/ATen.h:13, from /home/wxb/workspace/TensorRT/tools/pytorch-quantization/src/tensor_quant_gpu.cu:18: /home/wxb/.conda/envs/quant_env/lib/python3.8/site-packages/torch/include/ATen/Dispatch.h:262: note: this is the location of the previous definition 262 | #define AT_DISPATCH_FLOATING_TYPES(TYPE, NAME, ...)
| /home/wxb/.conda/envs/quant_env/lib/python3.8/site-packages/torch/include/c10/core/SymInt.h(84): warning: integer conversion resulted in a change of sign

/home/wxb/workspace/TensorRT/tools/pytorch-quantization/src/tensor_quant_gpu.cu(78): error: identifier "scalar_t" is undefined

/home/wxb/workspace/TensorRT/tools/pytorch-quantization/src/tensor_quant_gpu.cu(78): error: no instance of function template "fake_tensor_quant_kernel" matches the argument list argument types are: (, size_t, , float *, int, __nv_bool)

/home/wxb/workspace/TensorRT/tools/pytorch-quantization/src/tensor_quant_gpu.cu(78): error: identifier "AT_DISPATCH_CASE" is undefined

/home/wxb/workspace/TensorRT/tools/pytorch-quantization/src/tensor_quant_gpu.cu(78): error: expected a ")"

/home/wxb/workspace/TensorRT/tools/pytorch-quantization/src/tensor_quant_gpu.cu(78): error: identifier "AT_DISPATCH_SWITCH" is undefined

/home/wxb/workspace/TensorRT/tools/pytorch-quantization/src/tensor_quant_gpu.cu(90): error: identifier "scalar_t" is undefined

/home/wxb/workspace/TensorRT/tools/pytorch-quantization/src/tensor_quant_gpu.cu(90): error: no instance of function template "fake_tensor_quant_kernel" matches the argument list argument types are: (, size_t, , float *, int, __nv_bool)

/home/wxb/workspace/TensorRT/tools/pytorch-quantization/src/tensor_quant_gpu.cu(90): error: identifier "AT_DISPATCH_CASE" is undefined

/home/wxb/workspace/TensorRT/tools/pytorch-quantization/src/tensor_quant_gpu.cu(90): error: expected a ")"

/home/wxb/workspace/TensorRT/tools/pytorch-quantization/src/tensor_quant_gpu.cu(90): error: identifier "AT_DISPATCH_SWITCH" is undefined

/home/wxb/workspace/TensorRT/tools/pytorch-quantization/src/tensor_quant_gpu.cu(130): error: identifier "scalar_t" is undefined

/home/wxb/workspace/TensorRT/tools/pytorch-quantization/src/tensor_quant_gpu.cu(130): error: no instance of function template "fake_tensor_quant_with_axis_cuda_kernel" matches the argument list argument types are: (, size_t, , float *, int, int, int, __nv_bool)

/home/wxb/workspace/TensorRT/tools/pytorch-quantization/src/tensor_quant_gpu.cu(130): error: identifier "AT_DISPATCH_CASE" is undefined

/home/wxb/workspace/TensorRT/tools/pytorch-quantization/src/tensor_quant_gpu.cu(130): error: expected a ")"

/home/wxb/workspace/TensorRT/tools/pytorch-quantization/src/tensor_quant_gpu.cu(130): error: identifier "AT_DISPATCH_SWITCH" is undefined

15 errors detected in the compilation of "/home/wxb/workspace/TensorRT/tools/pytorch-quantization/src/tensor_quant_gpu.cu".

2460707925 avatar Oct 11 '24 11:10 2460707925

I successfully build it on release/v8.6, and pytorch_quantization==2.1.3,and I think you need to update the readme.md about pytorch_quantization and tell the dependencies of pytorch_quantization

2460707925 avatar Oct 11 '24 12:10 2460707925

In file included from /home/wxb/.conda/envs/quant_env/lib/python3.8/site-packages/torch/include/ATen/ATen.h:13, from /home/wxb/workspace/TensorRT/tools/pytorch-quantization/src/tensor_quant_gpu.cu:18: /home/wxb/.conda/envs/quant_env/lib/python3.8/site-packages/torch/include/ATen/Dispatch.h:262: note: this is the location of the previous definition 262 | #define AT_DISPATCH_FLOATING_TYPES(TYPE, NAME, ...)

AT_DISPATCH_FLOATING_TYPES is duplicate definition. trt10.5 tools/pytorch-quantization/src/tensor_quant_gpu.cu maybe need add #undef AT_DISPATCH_FLOATING_TYPES #undef AT_DISPATCH_FLOATING_TYPES before #define

lix19937 avatar Oct 13 '24 15:10 lix19937

Duplicate of this issue: https://github.com/NVIDIA/TensorRT/issues/4197

yuanyao-nv avatar Oct 16 '24 20:10 yuanyao-nv