[Mlir-commits] [mlir] Silence MLIRTargetLLVMTests failures pre-ROCm6.4 (PR #147610)

Christian Ulmann llvmlistbot at llvm.org
Tue Jul 8 22:46:30 PDT 2025


================
@@ -52,6 +53,27 @@ class MLIRTargetLLVMROCDL : public ::testing::Test {
     StringRef rocmPath = ROCDL::getROCMPath();
     if (rocmPath.empty())
       return false;
+    llvm::SmallString<128> rocmVerPath(rocmPath);
+    llvm::sys::path::append(rocmVerPath, ".info", "version");
+    auto bufOrErr = llvm::MemoryBuffer::getFile(rocmVerPath, /*IsText=*/true);
+    if (!bufOrErr)
+      return false;
+    SmallVector<StringRef, 2> majorMinorRest;
+    bufOrErr.get()->getBuffer().split(majorMinorRest, '.', /*MaxSplit=*/2);
+    if (majorMinorRest.size() != 3)
+      return false;
+    auto asInt = [](StringRef s) -> int {
+      unsigned i;
+      if (s.getAsInteger(/*Radix=*/10, i))
+        return -1;
+      return i;
+    };
+    int major = asInt(majorMinorRest[0]);
+    int minor = asInt(majorMinorRest[1]);
+    if (major < 6)
+      return false;
+    if (major == 6 && minor < 4)
----------------
Dinistro wrote:

Nit: Please add inline comments about what happens here and maybe move this to a separate function. Otherwise, it will be very unclear what's going on here, I fear.

https://github.com/llvm/llvm-project/pull/147610


More information about the Mlir-commits mailing list