Skip to content

Commit

Permalink
[BYOC] Fix build with TensorRT 8 (#9047)
Browse files Browse the repository at this point in the history
* fix compile error missing noexcept in overwridden methods

* remove depricated builder method call
  • Loading branch information
masahi committed Sep 21, 2021
1 parent 18a36a7 commit 92ca782
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 7 deletions.
3 changes: 0 additions & 3 deletions src/runtime/contrib/tensorrt/tensorrt_builder.cc
Original file line number Diff line number Diff line change
Expand Up @@ -61,9 +61,6 @@ TensorRTBuilder::TensorRTBuilder(TensorRTLogger* logger,
this->calibrator_ = calibrator;
if (calibrator != nullptr) {
use_int8_ = true;
builder_->setFp16Mode(true);
builder_->setInt8Mode(true);
builder_->setInt8Calibrator(calibrator);
}
network_ = builder_->createNetworkV2(flags);
#else
Expand Down
8 changes: 4 additions & 4 deletions src/runtime/contrib/tensorrt/tensorrt_calibrator.h
Original file line number Diff line number Diff line change
Expand Up @@ -62,13 +62,13 @@ class TensorRTCalibrator : public nvinfer1::IInt8EntropyCalibrator2 {
data_sizes_.push_back(binding_sizes);
}

int getBatchSize() const override { return batch_size_; }
int getBatchSize() const noexcept override { return batch_size_; }

/*!
* \brief TensorRT will call this method to get next batch of data to
* calibrate with.
*/
bool getBatch(void* bindings[], const char* names[], int nbBindings) override {
bool getBatch(void* bindings[], const char* names[], int nbBindings) noexcept override {
AllocateBuffersIfNotAllocated();
CHECK_EQ(input_names_.size(), nbBindings);
for (size_t i = 0; i < input_names_.size(); ++i) {
Expand All @@ -83,13 +83,13 @@ class TensorRTCalibrator : public nvinfer1::IInt8EntropyCalibrator2 {
return (num_batches_calibrated_ < data_.size());
}

const void* readCalibrationCache(size_t& length) override {
const void* readCalibrationCache(size_t& length) noexcept override {
if (calibration_cache_.empty()) return nullptr;
length = calibration_cache_.size();
return calibration_cache_.data();
}

void writeCalibrationCache(const void* cache, size_t length) override {
void writeCalibrationCache(const void* cache, size_t length) noexcept override {
calibration_cache_.assign(static_cast<const char*>(cache), length);
}

Expand Down

0 comments on commit 92ca782

Please sign in to comment.