File 18202.patch of Package tvm

From 14df5cddfcb1c622d55df83e502289668021ecc5 Mon Sep 17 00:00:00 2001
From: Balint Cristian <cristian.balint@gmail.com>
Date: Sun, 10 Aug 2025 14:50:09 +0300
Subject: [PATCH] [LLVM][CPPTEST] Small fixes for LLVM

---
 tests/cpp/target/parsers/aprofile_test.cc | 10 ++++++++++
 tests/cpp/tir_scalable_datatype.cc        | 15 ++++++++++++---
 2 files changed, 22 insertions(+), 3 deletions(-)

diff --git a/tests/cpp/target/parsers/aprofile_test.cc b/tests/cpp/target/parsers/aprofile_test.cc
index d329a9b958ad..0a8aeb832632 100644
--- a/tests/cpp/target/parsers/aprofile_test.cc
+++ b/tests/cpp/target/parsers/aprofile_test.cc
@@ -317,7 +317,12 @@ TEST_F(AProfileParser, DefaultSVESupportSVESupport) {
   TargetJSON target = ParseTargetWithAttrs("", "aarch64-arm-none-eabi", {arch_attr});
   TargetFeatures features = Downcast<TargetFeatures>(target.at("features"));
   EXPECT_TRUE(IsArch(target));
+#if TVM_LLVM_VERSION >= 190
+  // The generic aarch64 should not have SVE enabled
+  EXPECT_FALSE(Downcast<Bool>(features.at("has_sve")));
+#else
   EXPECT_TRUE(Downcast<Bool>(features.at("has_sve")));
+#endif
 
   // Check that the "has_sve" feature is set when "+sve" is explicitly set as an attribute.
   target = ParseTargetWithAttrs("", "aarch64-arm-none-eabi", {arch_attr, "+sve"});
@@ -359,7 +364,12 @@ TEST_F(AProfileParser, DefaultFP16Support) {
   TargetJSON target = ParseTargetWithAttrs("", "aarch64-arm-none-eabi", {arch_attr});
   TargetFeatures features = Downcast<TargetFeatures>(target.at("features"));
   EXPECT_TRUE(IsArch(target));
+#if TVM_LLVM_VERSION >= 190
+  // The generic aarch64 should not have FP16 enabled
+  EXPECT_FALSE(Downcast<Bool>(features.at("has_fp16_simd")));
+#else
   EXPECT_TRUE(Downcast<Bool>(features.at("has_fp16_simd")));
+#endif
 
   // Check that the "has_fp16_simd" feature is set when "+fullfp16" is explicitly set as an
   // attribute.
diff --git a/tests/cpp/tir_scalable_datatype.cc b/tests/cpp/tir_scalable_datatype.cc
index ccb43a81d8f1..6c42972d9430 100644
--- a/tests/cpp/tir_scalable_datatype.cc
+++ b/tests/cpp/tir_scalable_datatype.cc
@@ -187,12 +187,21 @@ TEST(ScalableDataType, TestScalableUInt) {
 #if TVM_LLVM_VERSION >= 130
 TEST(ScalableDataType, TestScalableIntrinCall) {
   tvm::DataType scalable_type = tvm::DataType(kDLInt, 32, 4, true);
-  tvm::tir::Call call = tvm::tir::Call(
-      scalable_type, tvm::tir::builtin::call_llvm_intrin(),
-      {tvm::IntImm(tvm::DataType::Int(32), ::llvm::Intrinsic::experimental_stepvector)});
+  tvm::tir::Call call =
+      tvm::tir::Call(scalable_type, tvm::tir::builtin::call_llvm_intrin(),
+#if TVM_LLVM_VERSION >= 200
+                     {tvm::IntImm(tvm::DataType::Int(32), ::llvm::Intrinsic::stepvector)});
+#else
+                     {tvm::IntImm(tvm::DataType::Int(32),
+                                  ::llvm::Intrinsic::experimental_stepvector)});
+#endif
   ASSERT_EQ(call->dtype, scalable_type);
   ASSERT_EQ(call->Script(),
+#if TVM_LLVM_VERSION >= 200
+            "T.call_llvm_intrin(\"int32xvscalex4\", \"llvm.stepvector\")");
+#else
             "T.call_llvm_intrin(\"int32xvscalex4\", \"llvm.experimental.stepvector\")");
+#endif
 }
 #endif
 
openSUSE Build Service is sponsored by