trt10.5 pytorch-quantization has compile bug
Nobody has claimed this yet.
- Dominant language
- C++
- Stars
- 13.4k
- Forks
- 2.4k
- Avg merge
- 5d 3h
- Merged PRs (30d)
- 2
Description
Description
trt10.5 pytorch-quantization has compile bug.
https://github.com/NVIDIA/TensorRT/blob/release/10.5/tools/pytorch-quantization/src/tensor_quant_gpu.cu#L28-L37
define two macro AT_DISPATCH_CASE_FLOATING_TYPES and AT_DISPATCH_FLOATING_TYPES
#define AT_DISPATCH_CASE_FLOATING_TYPES(...) \
AT_DISPATCH_CASE(at::ScalarType::Double, __VA_ARGS__) \
AT_DISPATCH_CASE(at::ScalarType::Float, __VA_ARGS__) \
AT_DISPATCH_CASE(at::ScalarType::Half, __VA_ARGS__) \
AT_DISPATCH_CASE(at::ScalarType::BFloat16, __VA_ARGS__)
#define AT_DISPATCH_FLOATING_TYPES(TYPE, NAME, ...) \
AT_DISPATCH_SWITCH( \
TYPE, NAME, AT_DISPATCH_CASE_FLOATING_TYPES(__VA_ARGS__))
but in https://github.com/NVIDIA/TensorRT/blob/release/10.5/tools/pytorch-quantization/src/tensor_quant_gpu.cu#L18
#include <ATen/ATen.h> --> #include <ATen/Dispatch.h> --> has already defined these two macros.
I check torch1.13 and torch2.4.1, both the same case.
two macros duplicate definition. @moraxu
need use
#undef AT_DISPATCH_CASE_FLOATING_TYPES(...)
#undef AT_DISPATCH_FLOATING_TYPES(TYPE, NAME, ...)
before #define in tensor_quant_gpu.cu
Environment
TensorRT Version:10.5
NVIDIA GPU:rtx2000
NVIDIA Driver Version:
CUDA Version:11.8
CUDNN Version:9.1
Operating System:
Python Version (if applicable):3.8
PyTorch Version (if applicable):1.13 or 2.4.1
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start in tools/pytorch-quantization/src/tensor_quant_gpu.cu, especially the include near line 18 and the macro definitions around lines 28-37. Reproduce the compile with PyTorch 1.13 or 2.4.1 and verify that the duplicate macro definitions are resolved without introducing new build errors.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- cpp, pytorch
- Domain
- build-system, machine-learning
- Issue type
- Bug
- Difficulty
- 2/5
- Estimated time
- 1-3 hours
- Activity status
- Stale
- Clarity
- Clearly specified
- Newbie friendliness
- 45/100