mirror of
https://github.com/saymrwulf/onnxruntime.git
synced 2026-07-19 19:00:47 +00:00
Change order of some checks to workaround a linker issue when /LTCG:incremental is set. (#4713)
This commit is contained in:
parent
24d4f76436
commit
2e3ccc7518
1 changed files with 12 additions and 10 deletions
|
|
@ -91,11 +91,12 @@ void Check<double>(const OpTester::Data& expected_data,
|
|||
#endif
|
||||
|
||||
for (int i = 0; i < size; ++i) {
|
||||
if (std::isinf(expected[i])) { // Test infinity for equality
|
||||
EXPECT_EQ(expected[i], output[i]) << "i:" << i;
|
||||
} else if (std::isnan(expected[i])) {
|
||||
EXPECT_TRUE(std::isnan(output[i])) << "Expected output " << i
|
||||
<< " to be NaN";
|
||||
// NOTE: Check isnan first to work around MSVC linker bug when /LTCG:incremental is specified.
|
||||
// If the isinf check is first the isnan check and branch gets omitted
|
||||
if (std::isnan(expected[i])) {
|
||||
EXPECT_TRUE(std::isnan(output[i])) << "Expected NaN. i:" << i << ", provider_type: " << provider_type;
|
||||
} else if (std::isinf(expected[i])) { // Test infinity for equality
|
||||
EXPECT_EQ(expected[i], output[i]) << "Expected infinity. i:" << i << ", provider_type: " << provider_type;
|
||||
} else {
|
||||
if (!has_abs_err && !has_rel_err) {
|
||||
// the default for existing tests
|
||||
|
|
@ -142,11 +143,12 @@ void InternalNumericalCheck(const OpTester::Data& expected_data,
|
|||
#endif
|
||||
|
||||
for (int i = 0; i < size; ++i) {
|
||||
if (std::isinf(expected[i])) { // Test infinity for equality
|
||||
EXPECT_EQ(expected[i], output[i]) << "i:" << i;
|
||||
} else if (std::isnan(expected[i])) {
|
||||
EXPECT_TRUE(std::isnan(output[i])) << "Expected output " << i
|
||||
<< " to be NaN";
|
||||
// NOTE: Check isnan first to work around MSVC linker bug when /LTCG:incremental is specified.
|
||||
// If the isinf check is first the isnan check and branch gets omitted
|
||||
if (std::isnan(expected[i])) {
|
||||
EXPECT_TRUE(std::isnan(output[i])) << "Expected NaN. i:" << i << ", provider_type: " << provider_type;
|
||||
} else if (std::isinf(expected[i])) { // Test infinity for equality
|
||||
EXPECT_EQ(expected[i], output[i]) << "Expected infinity. i:" << i << ", provider_type: " << provider_type;
|
||||
} else {
|
||||
if (!has_abs_err && !has_rel_err) {
|
||||
// the default for existing tests
|
||||
|
|
|
|||
Loading…
Reference in a new issue