Skip to content

Commit 886aff9

Browse files
authored
TensorRT 10.5 GA Release - 2024-10-01 (#998)
* Staging 10.5 release Signed-off-by: Michal Guzek <[email protected]> * Update minor version in CMakeLists Signed-off-by: Michal Guzek <[email protected]> --------- Signed-off-by: Michal Guzek <[email protected]>
1 parent 3775e49 commit 886aff9

18 files changed

+1208
-1012
lines changed

Diff for: CMakeLists.txt

+1-1
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 4)
31+
set(ONNX2TRT_MINOR 5)
3232
set(ONNX2TRT_PATCH 0)
3333
set(ONNX2TRT_VERSION "${ONNX2TRT_MAJOR}.${ONNX2TRT_MINOR}.${ONNX2TRT_PATCH}" CACHE STRING "ONNX2TRT version")
3434

Diff for: ConditionalHelpers.cpp

+12-19
Original file line numberDiff line numberDiff line change
@@ -34,19 +34,19 @@ SubgraphPortsMap::const_iterator findLayer(const SubgraphPortsMap& inputs, const
3434

3535
// Add an ConditionalInputLayer between `layer` and its inputs.
3636
// I.e. input[inIdx] -> layer ==> input[inIdx] -> ConditionalInputLayer -> layer.
37-
Status addConditionalInputLayer(ImporterContext* ctx, nvinfer1::IIfConditional* conditional, InputsMap& inputsMap,
37+
void addConditionalInputLayer(ImporterContext* ctx, nvinfer1::IIfConditional* conditional, InputsMap& inputsMap,
3838
nvinfer1::ILayer& layer, int32_t inIdx)
3939
{
4040
auto input = layer.getInput(inIdx);
4141
if (input == nullptr)
4242
{
4343
// Phantom input (an input that is really constant weights).
44-
return Status::success();
44+
return;
4545
}
4646

4747
if (layer.getType() == nvinfer1::LayerType::kCONDITIONAL_OUTPUT)
4848
{
49-
return Status::success();
49+
return;
5050
}
5151

5252
auto const name = input->getName();
@@ -70,12 +70,11 @@ Status addConditionalInputLayer(ImporterContext* ctx, nvinfer1::IIfConditional*
7070
}
7171
auto ifOutput = N_CHECK(inputLayer->getOutput(0));
7272
layer.setInput(inIdx, *ifOutput);
73-
return Status::success();
7473
};
7574

7675
// Take a snapshot of the network before and after parsing the subgraph and return a list
7776
// of newly added network layers.
78-
Status importSubgraph(ImporterContext* ctx, ::ONNX_NAMESPACE::GraphProto const& subgraph,
77+
void importSubgraph(ImporterContext* ctx, ::ONNX_NAMESPACE::GraphProto const& subgraph,
7978
std::vector<nvinfer1::ILayer*>& newLayers, std::vector<TensorOrWeights>& subgraphTensors)
8079
{
8180
auto net = ctx->network();
@@ -85,7 +84,7 @@ Status importSubgraph(ImporterContext* ctx, ::ONNX_NAMESPACE::GraphProto const&
8584
NameScope nameScope(*ctx);
8685

8786
std::vector<Status> errors{};
88-
CHECK_STATUS(onnx2trt::parseGraph(ctx, subgraph, errors));
87+
onnx2trt::parseGraph(ctx, subgraph, errors);
8988

9089
for (int32_t i = 0; i < subgraph.output_size(); ++i)
9190
{
@@ -97,12 +96,10 @@ Status importSubgraph(ImporterContext* ctx, ::ONNX_NAMESPACE::GraphProto const&
9796
{
9897
newLayers.push_back(net->getLayer(i));
9998
}
100-
101-
return Status::success();
10299
}
103100

104101
// Add an IConditionalInputLayer to `layer`'s inputs, if they don't already exist.
105-
Status addConditionalInputIfNeeded(ImporterContext* ctx, nvinfer1::IIfConditional* conditional, InputsMap& inputsMap,
102+
void addConditionalInputIfNeeded(ImporterContext* ctx, nvinfer1::IIfConditional* conditional, InputsMap& inputsMap,
106103
nvinfer1::ILayer& layer, SubgraphPortsMap subgraphInputsMap)
107104
{
108105
// Return all of the layer's inputs that are external to the subgraph that
@@ -125,11 +122,10 @@ Status addConditionalInputIfNeeded(ImporterContext* ctx, nvinfer1::IIfConditiona
125122
LOG_VERBOSE("Adding Input layer for " << layer.getName());
126123
addConditionalInputLayer(ctx, conditional, inputsMap, layer, inIdx);
127124
}
128-
return Status::success();
129125
}
130126

131127
// Add IConditionalInputLayers to `layer`'s inputs.
132-
Status addIfInputLayers(ImporterContext* ctx, nvinfer1::IIfConditional* conditional, InputsMap& inputsMap,
128+
void addIfInputLayers(ImporterContext* ctx, nvinfer1::IIfConditional* conditional, InputsMap& inputsMap,
133129
const std::vector<nvinfer1::ILayer*>& newLayers)
134130
{
135131
// Find all of the tensors entering the subgraph.
@@ -143,12 +139,10 @@ Status addIfInputLayers(ImporterContext* ctx, nvinfer1::IIfConditional* conditio
143139
{
144140
addConditionalInputIfNeeded(ctx, conditional, inputsMap, *layer, subgraphInputsMap);
145141
}
146-
147-
return Status::success();
148142
}
149143

150144
// Given a subgraph, find all of its external inputs/outputs (tensors entering/exiting the subgraph).
151-
Status getSubgraphTensors(const std::vector<nvinfer1::ILayer*>& newLayers,
145+
void getSubgraphTensors(const std::vector<nvinfer1::ILayer*>& newLayers,
152146
std::unordered_map<nvinfer1::ITensor*, std::set<int32_t>>& externalOutputs, bool extractOutputs,
153147
const std::vector<std::string>* reportedOutputs = nullptr)
154148
{
@@ -255,20 +249,19 @@ Status getSubgraphTensors(const std::vector<nvinfer1::ILayer*>& newLayers,
255249
externalOutputs[tensor].insert(portIndex);
256250
}
257251
}
258-
return Status::success();
259252
}
260253

261-
Status getSubgraphOutputs(const std::vector<nvinfer1::ILayer*>& newLayers,
254+
void getSubgraphOutputs(const std::vector<nvinfer1::ILayer*>& newLayers,
262255
std::unordered_map<nvinfer1::ITensor*, std::set<int32_t>>& externalOutputs,
263256
const std::vector<std::string>& reportedOutputs)
264257
{
265-
return getSubgraphTensors(newLayers, externalOutputs, true, &reportedOutputs);
258+
getSubgraphTensors(newLayers, externalOutputs, true, &reportedOutputs);
266259
}
267260

268-
Status getSubgraphInputs(const std::vector<nvinfer1::ILayer*>& newLayers,
261+
void getSubgraphInputs(const std::vector<nvinfer1::ILayer*>& newLayers,
269262
std::unordered_map<nvinfer1::ITensor*, std::set<int32_t>>& externalInputs)
270263
{
271-
return getSubgraphTensors(newLayers, externalInputs, false);
264+
getSubgraphTensors(newLayers, externalInputs, false);
272265
}
273266

274267
} // namespace onnx2trt

Diff for: ConditionalHelpers.hpp

+4-4
Original file line numberDiff line numberDiff line change
@@ -21,25 +21,25 @@ namespace onnx2trt
2121
// Given a subgraph, find all of its external inputs (tensors entering the subgraph).
2222
// The result is returned in `subgraphInputs`, which is a map indexed by ITensor (a tensor entering the subgraph) and
2323
// with values indicating a set of external input indices.
24-
Status getSubgraphInputs(std::vector<nvinfer1::ILayer*> const& newLayers,
24+
void getSubgraphInputs(std::vector<nvinfer1::ILayer*> const& newLayers,
2525
std::unordered_map<nvinfer1::ITensor*, std::set<int32_t>>& subgraphInputs);
2626

2727
// Given a subgraph, find all of its external outputs (tensors exiting the subgraph).
2828
// The result is returned in `subgraphInputs`, which is a map indexed by ITensor (a tensor exiting the subgraph) and
2929
// with values indicating a set of external outputs indices.
30-
Status getSubgraphOutputs(const std::vector<nvinfer1::ILayer*>& newLayers,
30+
void getSubgraphOutputs(const std::vector<nvinfer1::ILayer*>& newLayers,
3131
std::unordered_map<nvinfer1::ITensor*, std::set<int32_t>>& subgraphOutputs,
3232
const std::vector<std::string>& reportedOutputs);
3333

3434
// Take a snapshot of the network before and after parsing the subgraph and return a list
3535
// of newly added network layers.
36-
Status importSubgraph(ImporterContext* ctx, ::ONNX_NAMESPACE::GraphProto const& subgraph,
36+
void importSubgraph(ImporterContext* ctx, ::ONNX_NAMESPACE::GraphProto const& subgraph,
3737
std::vector<nvinfer1::ILayer*>& newLayers, std::vector<TensorOrWeights>& subgraphTensors);
3838

3939
using InputsMap = std::unordered_map<std::string, nvinfer1::IIfConditionalInputLayer*>;
4040

4141
// Add IIfConditionalInputLayers to the inputs of the subgraph indicated by `subgraph`.
42-
onnx2trt::Status addIfInputLayers(ImporterContext* ctx, nvinfer1::IIfConditional* conditional, InputsMap& inputsMap,
42+
void addIfInputLayers(ImporterContext* ctx, nvinfer1::IIfConditional* conditional, InputsMap& inputsMap,
4343
const std::vector<nvinfer1::ILayer*>& newLayers);
4444

4545
} // namespace onnx2trt

Diff for: ImporterContext.hpp

+3-3
Original file line numberDiff line numberDiff line change
@@ -371,9 +371,9 @@ class ImporterContext
371371
}
372372
};
373373

374-
typedef ValueOrStatus<std::vector<TensorOrWeights>> NodeImportResult;
375-
typedef std::function<NodeImportResult(ImporterContext* ctx, ::ONNX_NAMESPACE::NodeProto const& node,
376-
size_t const nodeIdx, std::vector<TensorOrWeights>& inputs)>
374+
typedef std::vector<TensorOrWeights> NodeOutputs;
375+
typedef std::function<NodeOutputs(ImporterContext* ctx, ::ONNX_NAMESPACE::NodeProto const& node, size_t const nodeIdx,
376+
std::vector<TensorOrWeights>& inputs)>
377377
NodeImporter;
378378

379379
typedef std::function<void(

0 commit comments

Comments
 (0)