Skip to content

Commit

Permalink
Skip some attention op tests in A100 (microsoft#13980)
Browse files Browse the repository at this point in the history
Skip some attention_op tests in A100 due to TF32 is enabled in GEMM, and that causes some unit tests fails in A100.
  • Loading branch information
tianleiwu authored and fuhengwu2021 committed Dec 26, 2022
1 parent 00c7d58 commit ce4fba3
Showing 1 changed file with 15 additions and 0 deletions.
15 changes: 15 additions & 0 deletions onnxruntime/test/contrib_ops/attention_op_test.cc
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
// Copyright (c) Microsoft Corporation. All rights reserved.
// Licensed under the MIT License.

#include "core/platform/env_var_utils.h"
#include "gtest/gtest.h"
#include "test/common/tensor_op_test_utils.h"
#include "test/common/cuda_op_test_utils.h"
Expand Down Expand Up @@ -1718,6 +1719,13 @@ TEST(AttentionTest, AttentionMaskIndexOutOfRange) {
#if !defined(__wasm__)
// TODO: fix in web assembly
TEST(AttentionTest, AttentionPastState_dynamic) {
// ORT enables TF32 in GEMM for A100. TF32 will cause precsion loss and fail this test.
// Do not run this test unless TF32 is disabled explicitly.
if (HasCudaEnvironment(800) && ParseEnvironmentVariableWithDefault<int>("NVIDIA_TF32_OVERRIDE", 1) != 0) {
GTEST_SKIP() << "Skipping AttentionPastState_dynamic in A100 since TF32 is enabled";
return;
}

// create rand inputs
RandomValueGenerator random{};

Expand Down Expand Up @@ -1865,6 +1873,13 @@ static void RunModelWithRandomInput(
std::vector<int32_t>& mask_index_data,
std::string& onnx_model,
bool is_float16) {
// ORT enables TF32 in GEMM for A100. TF32 will cause precsion loss and fail this test.
// Do not run this test unless TF32 is disabled explicitly.
if (HasCudaEnvironment(800) && ParseEnvironmentVariableWithDefault<int>("NVIDIA_TF32_OVERRIDE", 1) != 0) {
GTEST_SKIP() << "Skipping RunModelWithRandomInput in A100 since TF32 is enabled";
return;
}

RandomValueGenerator random{234};

constexpr int hidden_size = 768;
Expand Down

0 comments on commit ce4fba3

Please sign in to comment.