Tag Archives: TensorRT CUDA

TensorRT model quantization error: Error Code 1: Cuda Runtime (an illegal memory access was encountered)

When using tensorrt for model quantization on A10 graphics card, the following error is reported.

[W] [TRT] Calibration Profile is not defined. Running calibration with Profile 0
[I] calib data processed : 0/4680batch
[E] [TRT] 1: [calibrator.cpp::add::779] Error Code 1: Cuda Runtime (an illegal memory access was encountered)
[E] [TRT] [executionContext.cpp::commonEmitDebugTensor::1258] Error Code 1: Cuda Runtime (an illegal memory access was encountered)
[E] [TRT] [executionContext.cpp::executeInternal::610] Error Code 1: Cuda Runtime (an illegal memory access was encountered)
[F] [TRT] [defaultAllocator.cpp::free::85] Error Code 1: Cuda Runtime (an illegal memory access was encountered)
[F] [TRT] [defaultAllocator.cpp::free::85] Error Code 1: Cuda Runtime (an illegal memory access was encountered)
[F] [TRT] [defaultAllocator.cpp::free::85] Error Code 1: Cuda Runtime (an illegal memory access was encountered)
terminate called after throwing an instance of 'nvinfer1::CudaRuntimeError'
  what():  an illegal memory access was encountered
Aborted

This is because the architecture does not match. Add 86 to a10

Therefore, modify my makefile. Here is my makefile fragment, originally SMS= 60 61 62 70 72 75, I added 86

# Gencode arguments
SMS ?= 60 61 62 70 72 75 86

ifeq ($(GENCODE_FLAGS),)
# Generate SASS code for each SM architecture listed in $(SMS)
$(foreach sm,$(SMS),$(eval GENCODE_FLAGS += -gencode arch=compute_$(sm),code=sm_$(sm)))