builder->createNetworkV2() makes read access violation error in TensorRT v8.2


I want to upgrade my project’s TensorRT version, 7.2 to 8.2.

I had ‘destroyed_ptr’ like trt sample codes.

	template <typename T>
	struct Destroyer {
		void operator()(T* d) { if(d) d->destroy(); }

	template <typename T>
	using destroyed_ptr = std::unique_ptr<T, Destroyer<T>>;

And I create ‘builder, network, parser’.

		destroyed_ptr<nvinfer1::IBuilder> builder;
		destroyed_ptr<nvinfer1::INetworkDefinition> network;
		destroyed_ptr<nvonnxparser::IParser> parser;

Then, when I create builder and network with below code, ‘builder->createNetworkV2(explicitBatch)’ makes ‘read access violation. this->mImpl was 0x1.’ error.

	NVLogger& glogger = NVLogger::get_global_logger();

	const auto explicitBatch = 1U << static_cast<uint32_t>(nvinfer1::NetworkDefinitionCreationFlag::kEXPLICIT_BATCH);
	parser.reset(nvonnxparser::createParser(*network, glogger));

(glogger code)

#include "NvInfer.h"

class NVLogger : public nvinfer1::ILogger
	NVLogger(Severity severity = Severity::kWARNING) : mSeverity(severity)
	void log(Severity severity, const char* msg) noexcept override;

	static NVLogger& get_global_logger();
	Severity mSeverity;
#include "nvlogger.h"
#include <iostream>
void nrt::NVLogger::log(Severity severity, const char * msg) noexcept
	if (severity <= Severity::kERROR) {
		std::cerr << "error(" << (int)severity << ") : " << msg << std::endl;

nrt::NVLogger & nrt::NVLogger::get_global_logger()
	static NVLogger g_logger;
	return g_logger;

The same code work well in TensorRT v7.2.
Can I know what I mistake?


TensorRT Version:
GPU Type: RTX 3080
Nvidia Driver Version: 516.59
CUDA Version: 11.4
CUDNN Version:
Operating System + Version: Windows 11


Could you please try on the latest TensorRT version 8.4 GA and if you still face this issue please share with complete output logs and script to try from our end for better help.

Thank you.

I find the problem.
I linked new versions but I used old versions’ dlls.
I change dlls to new version, it works well.

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.