Skip to content

Commit df0095a

Browse files
author
Sean Ye
committed
Fix GPU build
1 parent 6a2cf0b commit df0095a

File tree

2 files changed

+13
-6
lines changed

2 files changed

+13
-6
lines changed

include/onnxruntime/core/platform/ort_mutex.h

+1
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44
#pragma once
55
#ifdef _WIN32
66
#include <Windows.h>
7+
#include <chrono>
78
#include <mutex>
89
namespace onnxruntime {
910
// Q: Why OrtMutex is better than std::mutex

onnxruntime/core/providers/tensorrt/tensorrt_execution_provider.cc

+12-6
Original file line numberDiff line numberDiff line change
@@ -2905,20 +2905,27 @@ Status TensorrtExecutionProvider::CreateNodeComputeInfoFromGraph(const GraphView
29052905
trt_profiles.push_back(trt_builder->createOptimizationProfile());
29062906
}
29072907

2908+
#if defined(_MSC_VER)
2909+
#pragma warning(push)
2910+
#pragma warning(disable : 4996)
2911+
#endif
29082912
// Check platform availability for low precision
29092913
if (fp16_enable_) {
29102914
if (!trt_builder->platformHasFastFp16()) {
29112915
fp16_enable_ = false;
29122916
LOGS_DEFAULT(WARNING) << "[TensorRT EP] ORT_TENSORRT_FP16_ENABLE is set, but platform doesn't support fast native fp16";
29132917
}
29142918
}
2915-
2919+
29162920
if (int8_enable_) {
29172921
if (!trt_builder->platformHasFastInt8()) {
29182922
int8_enable_ = false;
29192923
LOGS_DEFAULT(WARNING) << "[TensorRT EP] ORT_TENSORRT_INT8_ENABLE is set, but platform doesn't support fast native int8";
29202924
}
29212925
}
2926+
#if defined(_MSC_VER)
2927+
#pragma warning(pop)
2928+
#endif
29222929

29232930
// Load INT8 calibration table
29242931
std::unordered_map<std::string, float> dynamic_range_map;
@@ -3130,12 +3137,12 @@ Status TensorrtExecutionProvider::CreateNodeComputeInfoFromGraph(const GraphView
31303137
"TensorRT EP could not deserialize engine from encrypted cache: " + encrypted_engine_cache_path);
31313138
}
31323139
} else {
3133-
// Set INT8 per tensor dynamic range
3134-
if (int8_enable_ && trt_builder->platformHasFastInt8() && int8_calibration_cache_available_) {
31353140
#if defined(_MSC_VER)
31363141
#pragma warning(push)
31373142
#pragma warning(disable : 4996)
31383143
#endif
3144+
// Set INT8 per tensor dynamic range
3145+
if (int8_enable_ && trt_builder->platformHasFastInt8() && int8_calibration_cache_available_) {
31393146
trt_config->setInt8Calibrator(nullptr);
31403147
#if defined(_MSC_VER)
31413148
#pragma warning(pop)
@@ -3542,13 +3549,12 @@ Status TensorrtExecutionProvider::CreateNodeComputeInfoFromGraph(const GraphView
35423549
for (auto trt_profile : trt_profiles) {
35433550
trt_config->addOptimizationProfile(trt_profile);
35443551
}
3545-
3546-
// Set INT8 Per Tensor Dynamic range
3547-
if (trt_state->int8_enable && trt_builder->platformHasFastInt8() && trt_state->int8_calibration_cache_available) {
35483552
#if defined(_MSC_VER)
35493553
#pragma warning(push)
35503554
#pragma warning(disable : 4996)
35513555
#endif
3556+
// Set INT8 Per Tensor Dynamic range
3557+
if (trt_state->int8_enable && trt_builder->platformHasFastInt8() && trt_state->int8_calibration_cache_available) {
35523558
trt_config->setInt8Calibrator(nullptr);
35533559
#if defined(_MSC_VER)
35543560
#pragma warning(pop)

0 commit comments

Comments
 (0)