Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 16 additions & 1 deletion CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -257,9 +257,24 @@ set(CMAKE_CXX_STANDARD_REQUIRED ON)
set(CMAKE_CXX_EXTENSIONS OFF)

if(NOT MSVC)
set(CMAKE_CXX_FLAGS "-Wno-deprecated-declarations ${CMAKE_CXX_FLAGS} -DBUILD_SYSTEM=cmake_oss")
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -DBUILD_SYSTEM=cmake_oss")
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wall -Wextra -Wpedantic")
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wshadow -Wnon-virtual-dtor -Woverloaded-virtual")
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wconversion -Wdouble-promotion")
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wformat=2 -Wimplicit-fallthrough")
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wno-deprecated-declarations")
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Werror")

# Clang-specific suppressions
if(CMAKE_CXX_COMPILER_ID STREQUAL "Clang")
# CUDA toolkit headers trigger variadic macro warnings
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wno-variadic-macro-arguments-omitted")
# Clang's -Wpedantic enables -Wsign-conversion (GCC does not)
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wno-sign-conversion")
endif()
else()
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -DBUILD_SYSTEM=cmake_oss")
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /W4 /WX")
endif()

############################################################################################
Expand Down
69 changes: 42 additions & 27 deletions include/NvInferRuntime.h
Original file line number Diff line number Diff line change
Expand Up @@ -360,7 +360,8 @@ class DimsExprs
//!
struct DynamicPluginTensorDesc
{
//! Information required to interpret a pointer to tensor data, except that desc.dims has -1 in place of any runtime dimension.
//! Information required to interpret a pointer to tensor data, except that desc.dims has -1 in place of any runtime
//! dimension.
PluginTensorDesc desc;

//! Lower bounds on tensor’s dimensions
Expand Down Expand Up @@ -433,7 +434,8 @@ class TRT_DEPRECATED IPluginV2DynamicExt : public nvinfer1::IPluginV2Ext
//! return output;
//!
virtual DimsExprs getOutputDimensions(
int32_t outputIndex, DimsExprs const* inputs, int32_t nbInputs, IExprBuilder& exprBuilder) noexcept = 0;
int32_t outputIndex, DimsExprs const* inputs, int32_t nbInputs, IExprBuilder& exprBuilder) noexcept
= 0;

//!
//! \brief Limit on number of format combinations accepted.
Expand Down Expand Up @@ -473,7 +475,8 @@ class TRT_DEPRECATED IPluginV2DynamicExt : public nvinfer1::IPluginV2Ext
//! Warning: TensorRT will stop asking for formats once it finds kFORMAT_COMBINATION_LIMIT on combinations.
//!
virtual bool supportsFormatCombination(
int32_t pos, PluginTensorDesc const* inOut, int32_t nbInputs, int32_t nbOutputs) noexcept = 0;
int32_t pos, PluginTensorDesc const* inOut, int32_t nbInputs, int32_t nbOutputs) noexcept
= 0;

//!
//! \brief Configure the plugin.
Expand Down Expand Up @@ -513,7 +516,8 @@ class TRT_DEPRECATED IPluginV2DynamicExt : public nvinfer1::IPluginV2Ext
//! \param nbOutputs Number of output tensors.
//!
virtual void configurePlugin(DynamicPluginTensorDesc const* in, int32_t nbInputs,
DynamicPluginTensorDesc const* out, int32_t nbOutputs) noexcept = 0;
DynamicPluginTensorDesc const* out, int32_t nbOutputs) noexcept
= 0;

//!
//! \brief Find the workspace size required by the layer.
Expand All @@ -525,7 +529,8 @@ class TRT_DEPRECATED IPluginV2DynamicExt : public nvinfer1::IPluginV2Ext
//! \return The workspace size.
//!
virtual size_t getWorkspaceSize(PluginTensorDesc const* inputs, int32_t nbInputs, PluginTensorDesc const* outputs,
int32_t nbOutputs) const noexcept = 0;
int32_t nbOutputs) const noexcept
= 0;

//!
//! \brief Execute the layer.
Expand All @@ -540,7 +545,8 @@ class TRT_DEPRECATED IPluginV2DynamicExt : public nvinfer1::IPluginV2Ext
//! \return 0 for success, else non-zero (which will cause engine termination).
//!
virtual int32_t enqueue(PluginTensorDesc const* inputDesc, PluginTensorDesc const* outputDesc,
void const* const* inputs, void* const* outputs, void* workspace, cudaStream_t stream) noexcept = 0;
void const* const* inputs, void* const* outputs, void* workspace, cudaStream_t stream) noexcept
= 0;

protected:
//!
Expand All @@ -557,8 +563,11 @@ class TRT_DEPRECATED IPluginV2DynamicExt : public nvinfer1::IPluginV2Ext

virtual ~IPluginV2DynamicExt() noexcept {}

private:
protected:
// Following are obsolete base class methods, and must not be implemented or used.
// Kept as protected (not private) so derived classes can use `using` declarations
// to suppress -Woverloaded-virtual warnings when defining new methods with the
// same names but different signatures.

//!
//! \brief Set plugin configuration
Expand Down Expand Up @@ -916,7 +925,8 @@ class IPluginV3OneBuild : public IPluginCapability
//! \return 0 for success, else non-zero (which will cause engine termination, if invoked by TensorRT).
//!
virtual int32_t configurePlugin(DynamicPluginTensorDesc const* in, int32_t nbInputs,
DynamicPluginTensorDesc const* out, int32_t nbOutputs) noexcept = 0;
DynamicPluginTensorDesc const* out, int32_t nbOutputs) noexcept
= 0;

//!
//! \brief Provide the data types of the plugin outputs if the input tensors have the data types provided.
Expand All @@ -935,7 +945,8 @@ class IPluginV3OneBuild : public IPluginCapability
//! \warning DataType:kBOOL and DataType::kUINT8 are not supported.
//!
virtual int32_t getOutputDataTypes(
DataType* outputTypes, int32_t nbOutputs, const DataType* inputTypes, int32_t nbInputs) const noexcept = 0;
DataType* outputTypes, int32_t nbOutputs, const DataType* inputTypes, int32_t nbInputs) const noexcept
= 0;

//!
//! \brief Provide expressions for computing dimensions of the output tensors from dimensions of the input tensors.
Expand All @@ -959,7 +970,8 @@ class IPluginV3OneBuild : public IPluginCapability
//! through the error recorder.
//!
virtual int32_t getOutputShapes(DimsExprs const* inputs, int32_t nbInputs, DimsExprs const* shapeInputs,
int32_t nbShapeInputs, DimsExprs* outputs, int32_t nbOutputs, IExprBuilder& exprBuilder) noexcept = 0;
int32_t nbShapeInputs, DimsExprs* outputs, int32_t nbOutputs, IExprBuilder& exprBuilder) noexcept
= 0;

//!
//! \brief Return true if plugin supports the format and datatype for the input/output indexed by pos.
Expand Down Expand Up @@ -996,7 +1008,8 @@ class IPluginV3OneBuild : public IPluginCapability
//! \see getFormatCombinationLimit
//!
virtual bool supportsFormatCombination(
int32_t pos, DynamicPluginTensorDesc const* inOut, int32_t nbInputs, int32_t nbOutputs) noexcept = 0;
int32_t pos, DynamicPluginTensorDesc const* inOut, int32_t nbInputs, int32_t nbOutputs) noexcept
= 0;

//!
//! \brief Get the number of outputs from the plugin.
Expand All @@ -1014,8 +1027,8 @@ class IPluginV3OneBuild : public IPluginCapability
//!
//! \return The workspace size.
//!
virtual size_t getWorkspaceSize(DynamicPluginTensorDesc const* inputs, int32_t nbInputs,
DynamicPluginTensorDesc const* outputs, int32_t nbOutputs) const noexcept
virtual size_t getWorkspaceSize(DynamicPluginTensorDesc const* /*inputs*/, int32_t /*nbInputs*/,
DynamicPluginTensorDesc const* /*outputs*/, int32_t /*nbOutputs*/) const noexcept
{
return 0;
}
Expand Down Expand Up @@ -1051,7 +1064,7 @@ class IPluginV3OneBuild : public IPluginCapability
//! \return 0 for success, else non-zero (which will cause engine termination). The returned code will be reported
//! through the error recorder.
//!
virtual int32_t getValidTactics(int32_t* tactics, int32_t nbTactics) noexcept
virtual int32_t getValidTactics(int32_t* /*tactics*/, int32_t /*nbTactics*/) noexcept
{
return 0;
}
Expand Down Expand Up @@ -1118,7 +1131,7 @@ class IPluginV3OneRuntime : public IPluginCapability
//! \return 0 for success, else non-zero (which will cause engine termination). The returned code will be reported
//! through the error recorder.
//!
virtual int32_t setTactic(int32_t tactic) noexcept
virtual int32_t setTactic(int32_t /*tactic*/) noexcept
{
return 0;
}
Expand All @@ -1142,7 +1155,8 @@ class IPluginV3OneRuntime : public IPluginCapability
//! \param nbOutputs Number of output tensors.
//!
virtual int32_t onShapeChange(
PluginTensorDesc const* in, int32_t nbInputs, PluginTensorDesc const* out, int32_t nbOutputs) noexcept = 0;
PluginTensorDesc const* in, int32_t nbInputs, PluginTensorDesc const* out, int32_t nbOutputs) noexcept
= 0;

//!
//! \brief Execute the layer.
Expand All @@ -1158,7 +1172,8 @@ class IPluginV3OneRuntime : public IPluginCapability
//! through the error recorder.
//!
virtual int32_t enqueue(PluginTensorDesc const* inputDesc, PluginTensorDesc const* outputDesc,
void const* const* inputs, void* const* outputs, void* workspace, cudaStream_t stream) noexcept = 0;
void const* const* inputs, void* const* outputs, void* workspace, cudaStream_t stream) noexcept
= 0;

//!
//! \brief Clone the plugin, attach the cloned plugin object to a execution context and grant the cloned plugin
Expand Down Expand Up @@ -1234,7 +1249,7 @@ class IPluginV3OneBuild : public v_1_0::IPluginV3OneBuild
//! +->|Copy +--> t** --->|Plugin1 +--> t2
//! +-----+ +--------+
//!
virtual int32_t getAliasedInput(int32_t outputIndex) noexcept
virtual int32_t getAliasedInput(int32_t /*outputIndex*/) noexcept
{
return -1;
}
Expand Down Expand Up @@ -1680,7 +1695,8 @@ class IGpuAllocator : public IVersionedInterface
//! \deprecated Deprecated in TensorRT 10.0. Superseded by allocateAsync
//!
TRT_DEPRECATED virtual void* allocate(
uint64_t const size, uint64_t const alignment, AllocatorFlags const flags) noexcept = 0;
uint64_t const size, uint64_t const alignment, AllocatorFlags const flags) noexcept
= 0;

~IGpuAllocator() override = default;
IGpuAllocator() = default;
Expand Down Expand Up @@ -1854,7 +1870,6 @@ class IGpuAllocator : public IVersionedInterface
//!
using IGpuAllocator = v_1_0::IGpuAllocator;


//!
//! \class IRuntime
//!
Expand Down Expand Up @@ -2179,7 +2194,6 @@ class IRuntime : public INoCopy
return mImpl->getEngineHostCodeAllowed();
}


protected:
apiv::VRuntime* mImpl;
};
Expand Down Expand Up @@ -2629,7 +2643,8 @@ class IRefitter : public INoCopy
//! The minimum and maximum specify the permitted range that is supported at runtime, while the optimum value
//! is used for the kernel selection. This should be the "typical" value that is expected to occur at runtime.
//!
//! \see IOptimizationProfile::setDimensions(), IOptimizationProfile::setShapeValuesV2(), IOptimizationProfile::setShapeValues()
//! \see IOptimizationProfile::setDimensions(), IOptimizationProfile::setShapeValuesV2(),
//! IOptimizationProfile::setShapeValues()
//!
enum class OptProfileSelector : int32_t
{
Expand Down Expand Up @@ -3121,7 +3136,6 @@ constexpr inline int32_t EnumMax<ExecutionContextAllocationStrategy>() noexcept
return 3;
}


//! \class IRuntimeConfig
//!
//! \brief A class for runtime configuration. This class is used during execution context creation.
Expand Down Expand Up @@ -3153,7 +3167,6 @@ class IRuntimeConfig : public INoCopy
return mImpl->getExecutionContextAllocationStrategy();
}


protected:
apiv::VRuntimeConfig* mImpl;
}; // class IRuntimeConfig
Expand Down Expand Up @@ -4209,7 +4222,7 @@ class IOutputAllocator : public IVersionedInterface
//! \deprecated Deprecated in TensorRT 10.0. Superseded by reallocateOutputAsync with cudaStream_t argument
//!
TRT_DEPRECATED virtual void* reallocateOutput(
char const* tensorName, void* currentMemory, uint64_t size, uint64_t alignment) noexcept
char const* /*tensorName*/, void* /*currentMemory*/, uint64_t /*size*/, uint64_t /*alignment*/) noexcept
{
return nullptr;
}
Expand Down Expand Up @@ -5534,7 +5547,8 @@ class IGpuAsyncAllocator : public IGpuAllocator
//! - Thread-safe: Yes, this method is required to be thread-safe and may be called from multiple threads.
//!
void* allocateAsync(uint64_t const size, uint64_t const alignment, AllocatorFlags const flags,
cudaStream_t /*stream*/) noexcept override = 0;
cudaStream_t /*stream*/) noexcept override
= 0;

//!
//! \brief A thread-safe callback implemented by the application to handle stream-ordered asynchronous
Expand Down Expand Up @@ -5652,7 +5666,8 @@ class IPluginCreatorV3One : public IPluginCreatorInterface
//! engine deserialization), TensorRT will delete any objects it creates.
//!
virtual IPluginV3* createPlugin(
AsciiChar const* name, PluginFieldCollection const* fc, TensorRTPhase phase) noexcept = 0;
AsciiChar const* name, PluginFieldCollection const* fc, TensorRTPhase phase) noexcept
= 0;

//!
//! \brief Return a list of fields that need to be passed to createPlugin() when creating a plugin for use in the
Expand Down
22 changes: 12 additions & 10 deletions include/NvInferRuntimePlugin.h
Original file line number Diff line number Diff line change
Expand Up @@ -420,8 +420,8 @@ class TRT_DEPRECATED IPluginV2
//!
//! \param pluginNamespace The namespace for the plugin object.
//!
//! \warning The string pluginNamespace will be NULL-terminated and have a length of 1024 bytes or less including the
//! NULL terminator.
//! \warning The string pluginNamespace will be NULL-terminated and have a length of 1024 bytes or less including
//! the NULL terminator.
//!
//! \usage
//! - Allowed context for the API call
Expand All @@ -446,15 +446,15 @@ class TRT_DEPRECATED IPluginV2
// @cond SuppressDoxyWarnings
IPluginV2() = default;
virtual ~IPluginV2() noexcept = default;
// @endcond
// @endcond

protected:
// @cond SuppressDoxyWarnings
// @cond SuppressDoxyWarnings
IPluginV2(IPluginV2 const&) = default;
IPluginV2(IPluginV2&&) = default;
IPluginV2& operator=(IPluginV2 const&) & = default;
IPluginV2& operator=(IPluginV2&&) & = default;
// @endcond
// @endcond
};

//!
Expand Down Expand Up @@ -672,7 +672,7 @@ class TRT_DEPRECATED IPluginV2Ext : public IPluginV2
IPluginV2Ext(IPluginV2Ext&&) = default;
IPluginV2Ext& operator=(IPluginV2Ext const&) & = default;
IPluginV2Ext& operator=(IPluginV2Ext&&) & = default;
// @endcond
// @endcond

//!
//! \brief Return the API version with which this plugin was built. The
Expand Down Expand Up @@ -787,15 +787,15 @@ class TRT_DEPRECATED IPluginV2IOExt : public IPluginV2Ext
// @cond SuppressDoxyWarnings
IPluginV2IOExt() = default;
~IPluginV2IOExt() override = default;
// @endcond
// @endcond

protected:
// @cond SuppressDoxyWarnings
// @cond SuppressDoxyWarnings
IPluginV2IOExt(IPluginV2IOExt const&) = default;
IPluginV2IOExt(IPluginV2IOExt&&) = default;
IPluginV2IOExt& operator=(IPluginV2IOExt const&) & = default;
IPluginV2IOExt& operator=(IPluginV2IOExt&&) & = default;
// @endcond
// @endcond

//!
//! \brief Return the API version with which this plugin was built. The upper byte is reserved by TensorRT and is
Expand All @@ -814,8 +814,10 @@ class TRT_DEPRECATED IPluginV2IOExt : public IPluginV2Ext
| (static_cast<uint32_t>(NV_TENSORRT_VERSION) & 0xFFFFFFU));
}

private:
protected:
// Following are obsolete base class methods, and must not be implemented or used.
// Kept as protected (not private) so derived classes can use `using` declarations
// to suppress -Woverloaded-virtual warnings.

//!
//! \brief Set plugin configuration.
Expand Down
15 changes: 8 additions & 7 deletions plugin/batchTilePlugin/batchTilePlugin.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,7 @@ size_t BatchTilePlugin::getWorkspaceSize(int32_t) const noexcept
}

DataType BatchTilePlugin::getOutputDataType(
int32_t index, nvinfer1::DataType const* inputTypes, int32_t nbInputs) const noexcept
int32_t index, nvinfer1::DataType const* /*inputTypes*/, int32_t /*nbInputs*/) const noexcept
{
try
{
Expand Down Expand Up @@ -137,19 +137,20 @@ size_t BatchTilePlugin::getSerializationSize() const noexcept
}

bool BatchTilePlugin::isOutputBroadcastAcrossBatch(
int32_t outputIndex, bool const* inputIsBroadcasted, int32_t nbInputs) const noexcept
int32_t /*outputIndex*/, bool const* /*inputIsBroadcasted*/, int32_t /*nbInputs*/) const noexcept
{
return false;
}

bool BatchTilePlugin::canBroadcastInputAcrossBatch(int32_t inputIndex) const noexcept
bool BatchTilePlugin::canBroadcastInputAcrossBatch(int32_t /*inputIndex*/) const noexcept
{
return false;
}

void BatchTilePlugin::configurePlugin(Dims const* inputDims, int32_t nbInputs, Dims const* outputDims,
int32_t nbOutputs, DataType const* inputTypes, DataType const* outputTypes, bool const* inputIsBroadcast,
bool const* outputIsBroadcast, PluginFormat floatFormat, int32_t maxBatchSize) noexcept
void BatchTilePlugin::configurePlugin(Dims const* inputDims, int32_t /*nbInputs*/, Dims const* outputDims,
int32_t nbOutputs, DataType const* /*inputTypes*/, DataType const* /*outputTypes*/,
bool const* /*inputIsBroadcast*/, bool const* /*outputIsBroadcast*/, PluginFormat /*floatFormat*/,
int32_t /*maxBatchSize*/) noexcept
{
try
{
Expand Down Expand Up @@ -239,7 +240,7 @@ PluginFieldCollection const* BatchTilePluginCreator::getFieldNames() noexcept
return &mFC;
}

IPluginV2Ext* BatchTilePluginCreator::createPlugin(char const* name, PluginFieldCollection const* fc) noexcept
IPluginV2Ext* BatchTilePluginCreator::createPlugin(char const* name, PluginFieldCollection const* /*fc*/) noexcept
{
try
{
Expand Down
Loading