From abeb0fa4f6086d5073ef2ae4ed7bfd9ab762093c Mon Sep 17 00:00:00 2001 From: Luke Hutton Date: Mon, 29 Jan 2024 10:21:14 +0000 Subject: [PATCH] Use more specific warning message Change-Id: I98a72a95e2b51f8a4b577dcef15f40e7c28719a2 --- src/target/llvm/llvm_instance.cc | 2 +- .../relay/strategy/test_select_implementation.py | 10 ++++++++++ tests/python/target/test_llvm_features_info.py | 6 ++++-- 3 files changed, 15 insertions(+), 3 deletions(-) diff --git a/src/target/llvm/llvm_instance.cc b/src/target/llvm/llvm_instance.cc index d15939171b8cf..e3a99f7b9c9de 100644 --- a/src/target/llvm/llvm_instance.cc +++ b/src/target/llvm/llvm_instance.cc @@ -225,7 +225,7 @@ LLVMTargetInfo::LLVMTargetInfo(LLVMInstance& instance, const TargetJSON& target) // give the code a chance to run with a less-specific target. LOG(ERROR) << "LLVM cpu architecture `-mcpu=" << cpu_ << "` is not valid in `-mtriple=" << triple_ << "`" - << ", cpu architecture ignored"; + << ", using default `-mcpu=" << String(defaults::cpu) << "`"; } } diff --git a/tests/python/relay/strategy/test_select_implementation.py b/tests/python/relay/strategy/test_select_implementation.py index 139f8e924a0d0..f02d8120a8129 100644 --- a/tests/python/relay/strategy/test_select_implementation.py +++ b/tests/python/relay/strategy/test_select_implementation.py @@ -27,6 +27,7 @@ from tvm.relay.testing import run_infer_type, run_opt_pass import tvm.testing from tvm import topi +from tvm.target.codegen import llvm_version_major @pytest.mark.parametrize( @@ -90,6 +91,9 @@ def _get_conv2d_impl(dtype, target): return impl.name +@pytest.mark.skipif( + llvm_version_major() < 15, reason=f"Requires LLVM 15+, got {llvm_version_major()}" +) @pytest.mark.parametrize( "target,expected_impl", [ @@ -132,6 +136,9 @@ def test_int8_conv2d(target, expected_impl): assert selected_impl == expected_impl +@pytest.mark.skipif( + llvm_version_major() < 15, reason=f"Requires LLVM 15+, got {llvm_version_major()}" +) @pytest.mark.parametrize( "target,expected_impl", [ @@ -166,6 +173,9 @@ def test_fp32_conv2d(target, expected_impl): assert selected_impl == expected_impl +@pytest.mark.skipif( + llvm_version_major() < 15, reason=f"Requires LLVM 15+, got {llvm_version_major()}" +) @pytest.mark.parametrize( "target,expected_impl", [ diff --git a/tests/python/target/test_llvm_features_info.py b/tests/python/target/test_llvm_features_info.py index 0313662a108d6..34e9a582313ad 100644 --- a/tests/python/target/test_llvm_features_info.py +++ b/tests/python/target/test_llvm_features_info.py @@ -42,8 +42,10 @@ def test_llvm_targets(capfd): tvm.target.codegen.llvm_get_cpu_features( tvm.target.Target("llvm -mtriple=x86_64-linux-gnu -mcpu=dummy") ) - expected_str = ("Error: LLVM cpu architecture `-mcpu=dummy` is not valid in " - "`-mtriple=x86_64-linux-gnu`, cpu architecture ignored") + expected_str = ( + "Error: LLVM cpu architecture `-mcpu=dummy` is not valid in " + "`-mtriple=x86_64-linux-gnu`, using default `-mcpu=generic`" + ) assert expected_str in capfd.readouterr().err