forked from microsoft/onnxruntime
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Exclude TRT provider in tests crashed in A100 (microsoft#19972)
TensorRT EP segmentation fault on A100 for some tests. Exclude TRT EP in those tests on A100 to unblock developing. ### Motivation and Context microsoft#19530
- Loading branch information
Showing
9 changed files
with
178 additions
and
101 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
// Copyright (c) Microsoft Corporation. All rights reserved. | ||
// Licensed under the MIT License. | ||
|
||
#ifdef USE_CUDA | ||
#include "cuda_runtime_api.h" | ||
#endif | ||
|
||
namespace onnxruntime { | ||
namespace test { | ||
|
||
int GetCudaArchitecture() { | ||
// This will cache the result so we only call cudaGetDeviceProperties once. | ||
// Usually, we test on a single GPU or multiple GPUs of same architecture, so it's fine to cache the result. | ||
static int cuda_arch = -1; | ||
|
||
#ifdef USE_CUDA | ||
if (cuda_arch == -1) { | ||
int current_device_id = 0; | ||
cudaGetDevice(¤t_device_id); | ||
// must wait GPU idle, otherwise cudaGetDeviceProperties might fail | ||
cudaDeviceSynchronize(); | ||
cudaDeviceProp prop; | ||
|
||
// When cudaGetDeviceProperties fails, just return -1 and no error is raised. | ||
// If cuda device has issue, test will fail anyway so no need to raise error here. | ||
if (cudaSuccess == cudaGetDeviceProperties(&prop, current_device_id)) { | ||
cuda_arch = prop.major * 100 + prop.minor * 10; | ||
} | ||
} | ||
#endif | ||
|
||
return cuda_arch; | ||
} | ||
|
||
} // namespace test | ||
} // namespace onnxruntime |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
// Copyright (c) Microsoft Corporation. All rights reserved. | ||
// Licensed under the MIT License. | ||
|
||
#pragma once | ||
|
||
#include "test/common/cuda_op_test_utils.h" | ||
|
||
namespace onnxruntime { | ||
namespace test { | ||
|
||
// TensorRT EP Segmentation fault on A100: https://github.com/microsoft/onnxruntime/issues/19530 | ||
inline const std::unordered_set<std::string> ExcludeTrtOnA100() { | ||
// Note: GetCudaArchitecture need USE_CUDA to be defined. Currently, it is defined when TRT EP is enabled. | ||
// If we want to make TRT EP independent of CUDA EP, we need to change the implementation of GetCudaArchitecture. | ||
if (DefaultTensorrtExecutionProvider() != nullptr && GetCudaArchitecture() == 800) { | ||
return {kTensorrtExecutionProvider}; | ||
} | ||
|
||
return {}; | ||
} | ||
|
||
// Add TensorRT EP to an excluded provider list when running on A100 | ||
inline const std::unordered_set<std::string>& ExcludeTrtOnA100(std::unordered_set<std::string>& excluded_providers) { | ||
if (DefaultTensorrtExecutionProvider() != nullptr && GetCudaArchitecture() == 800) { | ||
excluded_providers.insert(kTensorrtExecutionProvider); | ||
return excluded_providers; | ||
} | ||
|
||
return excluded_providers; | ||
} | ||
|
||
} // namespace test | ||
} // namespace onnxruntime |
Oops, something went wrong.