Skip to content

Commit ff761af

Browse files
authored
10.12-GA Release (#1028)
Signed-off-by: Kevin Chen <[email protected]>
1 parent c4644a4 commit ff761af

15 files changed

+268
-392
lines changed

CMakeLists.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ add_definitions("-DSOURCE_LENGTH=${SOURCE_LENGTH}")
2828
# Version information
2929
#--------------------------------------------------
3030
set(ONNX2TRT_MAJOR 10)
31-
set(ONNX2TRT_MINOR 11)
31+
set(ONNX2TRT_MINOR 12)
3232
set(ONNX2TRT_PATCH 0)
3333
set(ONNX2TRT_VERSION "${ONNX2TRT_MAJOR}.${ONNX2TRT_MINOR}.${ONNX2TRT_PATCH}" CACHE STRING "ONNX2TRT version")
3434

ImporterContext.cpp

Lines changed: 123 additions & 94 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,126 @@
2626
} \
2727
} while (0)
2828

29+
namespace
30+
{
31+
32+
//! Translates a "logical" library name into an OS-dependent DSO or DLL name
33+
std::string getOSLibraryName(char const* logicalName)
34+
{
35+
std::stringstream libName;
36+
#if defined(_WIN32)
37+
libName << logicalName << ".dll";
38+
#else
39+
libName << "lib" << logicalName << ".so." << NV_TENSORRT_MAJOR;
40+
#endif
41+
return libName.str();
42+
}
43+
44+
//! Platform-agnostic wrapper around dynamic libraries.
45+
class DynamicLibrary
46+
{
47+
public:
48+
explicit DynamicLibrary(std::string const& name)
49+
: mLibName{name}
50+
{
51+
#if defined(_WIN32)
52+
mHandle = LoadLibraryA(name.c_str());
53+
#else // defined(_WIN32)
54+
int32_t flags{RTLD_LAZY};
55+
mHandle = dlopen(name.c_str(), flags);
56+
#endif // defined(_WIN32)
57+
58+
if (mHandle == nullptr)
59+
{
60+
std::string errorStr{};
61+
#if !defined(_WIN32)
62+
errorStr = std::string{" due to "} + std::string{dlerror()};
63+
#endif
64+
throw std::runtime_error("Unable to open library: " + name + errorStr);
65+
}
66+
}
67+
68+
DynamicLibrary(DynamicLibrary const&) = delete;
69+
DynamicLibrary(DynamicLibrary const&&) = delete;
70+
71+
~DynamicLibrary()
72+
{
73+
try
74+
{
75+
#if defined(_WIN32)
76+
RT_ASSERT(static_cast<bool>(FreeLibrary(static_cast<HMODULE>(mHandle))));
77+
#else
78+
RT_ASSERT(dlclose(mHandle) == 0);
79+
#endif
80+
}
81+
catch (...)
82+
{
83+
std::cerr << "Unable to close library: " << mLibName << std::endl;
84+
}
85+
}
86+
87+
//!
88+
//! Retrieve a function symbol from the loaded library.
89+
//!
90+
//! \return the loaded symbol on success
91+
//! \throw std::invalid_argument if loading the symbol failed.
92+
//!
93+
template <typename Signature>
94+
std::function<Signature> symbolAddress(char const* name)
95+
{
96+
if (mHandle == nullptr)
97+
{
98+
throw std::runtime_error("Handle to library is nullptr.");
99+
}
100+
void* ret;
101+
#if defined(_MSC_VER)
102+
ret = static_cast<void*>(GetProcAddress(static_cast<HMODULE>(mHandle), name));
103+
#else
104+
ret = dlsym(mHandle, name);
105+
#endif
106+
if (ret == nullptr)
107+
{
108+
std::string const kERROR_MSG(mLibName + ": error loading symbol: " + std::string(name));
109+
throw std::invalid_argument(kERROR_MSG);
110+
}
111+
return reinterpret_cast<Signature*>(ret);
112+
}
113+
114+
std::string getFullPath() const
115+
{
116+
RT_ASSERT(mHandle != nullptr);
117+
#if defined(__linux__)
118+
link_map* linkMap = nullptr;
119+
auto const err = dlinfo(mHandle, RTLD_DI_LINKMAP, &linkMap);
120+
RT_ASSERT(err == 0 && linkMap != nullptr && linkMap->l_name != nullptr);
121+
return std::string{linkMap->l_name};
122+
#elif defined(_WIN32)
123+
constexpr int32_t kMAX_PATH_LEN{4096};
124+
std::string path(kMAX_PATH_LEN, '\0'); // since C++11, std::string storage is guaranteed to be contiguous
125+
auto const pathLen = GetModuleFileNameA(static_cast<HMODULE>(mHandle), &path[0], kMAX_PATH_LEN);
126+
RT_ASSERT(GetLastError() == ERROR_SUCCESS);
127+
path.resize(pathLen);
128+
path.shrink_to_fit();
129+
return path;
130+
#else
131+
RT_ASSERT(!"Unsupported operation: getFullPath()");
132+
#endif
133+
}
134+
135+
private:
136+
std::string mLibName{}; //!< Name of the DynamicLibrary
137+
void* mHandle{}; //!< Handle to the DynamicLibrary
138+
};
139+
140+
//! Translates an OS-dependent DSO/DLL name into a path on the filesystem
141+
std::string getOSLibraryPath(std::string const& osLibName)
142+
{
143+
DynamicLibrary lib{osLibName};
144+
return lib.getFullPath();
145+
}
146+
147+
} // namespace
148+
29149
namespace onnx2trt
30150
{
31151

@@ -105,7 +225,8 @@ void ImporterContext::registerTensor(TensorOrWeights tensor, std::string const&
105225
p.first->second = std::move(tensor);
106226
}
107227

108-
void ImporterContext::registerLayer(nvinfer1::ILayer* layer, std::string const& basename, ::ONNX_NAMESPACE::NodeProto const* node)
228+
void ImporterContext::registerLayer(
229+
nvinfer1::ILayer* layer, std::string const& basename, ::ONNX_NAMESPACE::NodeProto const* node)
109230
{
110231
// No layer will be added for Constant nodes in ONNX.
111232
if (layer)
@@ -149,99 +270,6 @@ void ImporterContext::registerLayer(nvinfer1::ILayer* layer, ::ONNX_NAMESPACE::N
149270
registerLayer(layer, basename, &node);
150271
}
151272

152-
namespace
153-
{
154-
155-
//! Translates a "logical" library name into an OS-dependent DSO or DLL name
156-
std::string getOSLibraryName(char const* logicalName)
157-
{
158-
std::stringstream libName;
159-
#if defined(_WIN32)
160-
libName << logicalName << ".dll";
161-
#else
162-
libName << "lib" << logicalName << ".so." << NV_TENSORRT_MAJOR;
163-
#endif
164-
return libName.str();
165-
}
166-
167-
//! Platform-agnostic wrapper around dynamic libraries.
168-
class DynamicLibrary
169-
{
170-
public:
171-
explicit DynamicLibrary(std::string const& name)
172-
: mLibName{name}
173-
{
174-
#if defined(_WIN32)
175-
mHandle = LoadLibraryA(name.c_str());
176-
#else // defined(_WIN32)
177-
int32_t flags{RTLD_LAZY};
178-
mHandle = dlopen(name.c_str(), flags);
179-
#endif // defined(_WIN32)
180-
181-
if (mHandle == nullptr)
182-
{
183-
std::string errorStr{};
184-
#if !defined(_WIN32)
185-
errorStr = std::string{" due to "} + std::string{dlerror()};
186-
#endif
187-
throw std::runtime_error("Unable to open library: " + name + errorStr);
188-
}
189-
}
190-
191-
DynamicLibrary(DynamicLibrary const&) = delete;
192-
DynamicLibrary(DynamicLibrary const&&) = delete;
193-
194-
~DynamicLibrary()
195-
{
196-
try
197-
{
198-
#if defined(_WIN32)
199-
RT_ASSERT(static_cast<bool>(FreeLibrary(static_cast<HMODULE>(mHandle))));
200-
#else
201-
RT_ASSERT(dlclose(mHandle) == 0);
202-
#endif
203-
}
204-
catch (...)
205-
{
206-
std::cerr << "Unable to close library: " << mLibName << std::endl;
207-
}
208-
}
209-
210-
std::string getFullPath() const
211-
{
212-
RT_ASSERT(mHandle != nullptr);
213-
#if defined(__linux__)
214-
link_map* linkMap = nullptr;
215-
auto const err = dlinfo(mHandle, RTLD_DI_LINKMAP, &linkMap);
216-
RT_ASSERT(err == 0 && linkMap != nullptr && linkMap->l_name != nullptr);
217-
return std::string{linkMap->l_name};
218-
#elif defined(_WIN32)
219-
constexpr int32_t kMAX_PATH_LEN{4096};
220-
std::string path(kMAX_PATH_LEN, '\0'); // since C++11, std::string storage is guaranteed to be contiguous
221-
auto const pathLen = GetModuleFileNameA(static_cast<HMODULE>(mHandle), &path[0], kMAX_PATH_LEN);
222-
RT_ASSERT(GetLastError() == ERROR_SUCCESS);
223-
path.resize(pathLen);
224-
path.shrink_to_fit();
225-
return path;
226-
#else
227-
RT_ASSERT(!"Unsupported operation: getFullPath()");
228-
#endif
229-
}
230-
231-
private:
232-
std::string mLibName{}; //!< Name of the DynamicLibrary
233-
void* mHandle{}; //!< Handle to the DynamicLibrary
234-
};
235-
236-
//! Translates an OS-dependent DSO/DLL name into a path on the filesystem
237-
std::string getOSLibraryPath(std::string const& osLibName)
238-
{
239-
DynamicLibrary lib{osLibName};
240-
return lib.getFullPath();
241-
}
242-
243-
} // namespace
244-
245273
void ImporterContext::addUsedVCPluginLibrary(
246274
::ONNX_NAMESPACE::NodeProto const& node, char const* pluginName, char const* pluginLib)
247275
{
@@ -272,3 +300,4 @@ std::vector<std::string> ImporterContext::getUsedVCPluginLibraries()
272300
}
273301

274302
} // namespace onnx2trt
303+

ImporterContext.hpp

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,8 +8,8 @@
88
#include "ShapedWeights.hpp"
99
#include "Status.hpp"
1010
#include "TensorOrWeights.hpp"
11-
#include "onnxErrorRecorder.hpp"
1211
#include "WeightsContext.hpp"
12+
#include "onnxErrorRecorder.hpp"
1313
#include <fstream>
1414
#include <functional>
1515
#include <list>
@@ -403,3 +403,4 @@ typedef std::function<void(
403403
OpStaticErrorChecker;
404404

405405
} // namespace onnx2trt
406+

ModelImporter.cpp

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -172,6 +172,8 @@ void parseNode(
172172

173173
bool skipUInt8Conversion = (node.op_type() == "QuantizeLinear" || node.op_type() == "DequantizeLinear"
174174
|| (allowUint8Quantization && node.op_type() == "Constant"));
175+
skipUInt8Conversion
176+
|= (node.op_type() == "TRT_MXFP8QuantizeLinear" || node.op_type() == "TRT_MXFP8DequantizeLinear");
175177
if (!skipUInt8Conversion)
176178
{
177179
for (auto& nodeInput : nodeInputs)
@@ -435,7 +437,9 @@ std::vector<Status> importInput(ImporterContext* ctx, ::ONNX_NAMESPACE::ValueInf
435437
CHECK_INPUT(
436438
convertDtype(onnxDtype.elem_type(), &trtDtype) && "Failed to convert ONNX date type to TensorRT data type.",
437439
ErrorCode::kUNSUPPORTED_NODE, input.name(), errorList);
438-
nvinfer1::Dims trt_dims;
440+
// If convertOnnxDims fails, trt_dims may not be modified. Also CHECK_INPUT won't return immediately.
441+
// So we need to initialize trt_dims to avoid illegal access in the following log verbose.
442+
nvinfer1::Dims trt_dims{};
439443
size_t const oldNbNamedDimensions = namedDims.size();
440444
CHECK_INPUT(convertOnnxDims(onnxDtype.shape().dim(), trt_dims, namedDims)
441445
&& "Failed to convert ONNX dimensions to TensorRT dimensions.",

README.md

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ For press and other inquiries, please contact Hector Marinez at hmarinez@nvidia.
1616

1717
## Supported TensorRT Versions
1818

19-
Development on the this branch is for the latest version of [TensorRT 10.11](https://developer.nvidia.com/nvidia-tensorrt-download) with full-dimensions and dynamic shape support.
19+
Development on the this branch is for the latest version of [TensorRT 10.12](https://developer.nvidia.com/nvidia-tensorrt-download) with full-dimensions and dynamic shape support.
2020

2121
For previous versions of TensorRT, refer to their respective branches.
2222

@@ -29,8 +29,8 @@ Current supported ONNX operators are found in the [operator support matrix](docs
2929
### Dependencies
3030

3131
- [Protobuf >= 3.0.x](https://github.com/google/protobuf/releases)
32-
- [TensorRT 10.11](https://developer.nvidia.com/tensorrt)
33-
- [TensorRT 10.11 open source libraries](https://github.com/NVIDIA/TensorRT/)
32+
- [TensorRT 10.12](https://developer.nvidia.com/tensorrt)
33+
- [TensorRT 10.12 open source libraries](https://github.com/NVIDIA/TensorRT/)
3434

3535
### Building
3636

@@ -82,7 +82,7 @@ Refer to the link or run `polygraphy run -h` for more information on CLI options
8282

8383
Python bindings for the ONNX-TensorRT parser are packaged in the shipped `.whl` files.
8484

85-
TensorRT 10.11 supports ONNX release 1.18.0. Install it with:
85+
TensorRT 10.12 supports ONNX release 1.18.0. Install it with:
8686

8787
python3 -m pip install onnx==1.18.0
8888

Status.hpp

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -201,6 +201,7 @@ static std::ostream& operator<<(std::ostream& stream, nvinfer1::DataType const&
201201
case nvinfer1::DataType::kINT64: return stream << "int64";
202202
case nvinfer1::DataType::kBOOL: return stream << "bool";
203203
case nvinfer1::DataType::kFP8: return stream << "float8";
204+
case nvinfer1::DataType::kE8M0: return stream << "floatE8M0";
204205
case nvinfer1::DataType::kINT4: return stream << "int4";
205206
case nvinfer1::DataType::kFP4: return stream << "fp4";
206207

TensorOrWeights.cpp

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,7 @@ std::string TensorOrWeights::getType() const
2525
case nvinfer1::DataType::kFP8: return "FP8";
2626
case nvinfer1::DataType::kINT4: return "INT4";
2727
case nvinfer1::DataType::kFP4: return "FP4";
28+
case nvinfer1::DataType::kE8M0: return "E8M0";
2829
}
2930
}
3031
else
@@ -85,6 +86,7 @@ ShapedWeights::DataType TensorOrWeights::convertTRTDataType(nvinfer1::DataType d
8586
case nvinfer1::DataType::kFP8: return ::ONNX_NAMESPACE::TensorProto::FLOAT8E4M3FN;
8687
case nvinfer1::DataType::kINT4: return ::ONNX_NAMESPACE::TensorProto::INT4;
8788
case nvinfer1::DataType::kFP4: return ::ONNX_NAMESPACE::TensorProto::FLOAT4E2M1;
89+
case nvinfer1::DataType::kE8M0: break;
8890
}
8991
assert(false && "Unknown datatype");
9092
return ::ONNX_NAMESPACE::TensorProto::FLOAT;

docs/Changelog.md

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,13 @@
22

33
# ONNX-TensorRT Changelog
44

5+
# TensorRT 10.12 GA Release - 2025-6-16
6+
For more details, see the 10.12 GA release notes
7+
8+
- Added support for integer-typed base tensors for `Pow` operations
9+
- Added support for custom `MXFP8` quantization operations
10+
- Added support for ellipses, diagonal, and broadcasting in `Einsum` operations
11+
512
# TensorRT 10.11 GA Release - 2025-5-16
613
For more details, see the 10.11 GA release notes
714

docs/operators.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
# Supported ONNX Operators
44

5-
TensorRT 10.11 supports operators in the inclusive range of opset 9 to opset 23. Latest information of ONNX operators can be found [here](https://github.com/onnx/onnx/blob/main/docs/Operators.md). More details and limitations are documented in the chart below.
5+
TensorRT 10.12 supports operators in the inclusive range of opset 9 to opset 23. Latest information of ONNX operators can be found [here](https://github.com/onnx/onnx/blob/main/docs/Operators.md). More details and limitations are documented in the chart below.
66

77
TensorRT supports the following ONNX data types: DOUBLE, FLOAT32, FLOAT16, BFLOAT16, FP8, FP4, INT32, INT64, INT8, INT4, UINT8, and BOOL
88

@@ -134,7 +134,7 @@ TensorRT supports the following ONNX data types: DOUBLE, FLOAT32, FLOAT16, BFLOA
134134
| Or | Y | BOOL |
135135
| Pad | Y | FP32, FP16, BF16, INT32, INT64 |
136136
| ParametricSoftplus | Y | FP32, FP16, BF16 |
137-
| Pow | Y | FP32, FP16, BF16 |
137+
| Pow | Y | FP32, FP16, BF16, INT32, INT64 |
138138
| PRelu | Y | FP32, FP16, BF16 |
139139
| QLinearConv | N |
140140
| QLinearMatMul | N |

errorHelpers.hpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -78,7 +78,7 @@ inline char const* errorCodeStr(ErrorCode code)
7878
case ErrorCode::kREFIT_FAILED: return "REFIT_FAILED";
7979
}
8080
return "UNKNOWN";
81-
};
81+
}
8282

8383
inline std::string const parserErrorStr(nvonnxparser::IParserError const* error)
8484
{

0 commit comments

Comments
 (0)