Hi,

I found a pull request that starts the process of upgrading llvmlite to
llvm-12 or -13.
https://github.com/numba/llvmlite/pull/802

I modified it to work with our llvmlite 0.39.1 package and was able to
build llvmlite and have it's tests pass on x86 64.

The llvmlite upstream developers are concerned about releasing it
because in their experience they have various compile errors on unusual
architectures.

Though I'm having those with the llvm-11 version too, so who knows.

I was thinking that releasing it to Debian's buildd would help upstream
see which architectures are having problems with the migration to llvm-
13

I've been trying to build and run numba's tests, it's been a bit
difficult to tell what's failures are new because of building against
llvm-13 and which are because there's some failures due to the
autopkgtest environment being different from what upstream expects.

I think there's only a couple of test failures out of the about 20 I'm
trying to fix that are due to the llvm-13 update.

Since there's already some numba test failures with ppc64el and amdel
even with the llvm-11 version of llvmlite, I feel like releasing the -
13 version of llvmlite isn't going to make things any worse for numba.

So should we uploading a version of llvmlite with the -13 compatibility
patch?

They both fell out of testing, and it'd be really bad for the
scientific python ecosystem if we don't get numba shipped in bullseye.

Diane
From 1d928ebcd59b23b5050234a2bf71f9be7f5f6bd1 Mon Sep 17 00:00:00 2001
From: Richard Barnes <rbar...@umn.edu>
Date: Wed, 1 Dec 2021 10:29:08 -0700
Subject: [PATCH] Enable LLVM-12 and LLVM-13

---
 ffi/build.py                   |  5 ++---
 ffi/targets.cpp                |  2 ++
 llvmlite/tests/test_binding.py | 19 ++++++++++++++++---
 3 files changed, 20 insertions(+), 6 deletions(-)

--- a/ffi/build.py
+++ b/ffi/build.py
@@ -163,9 +163,8 @@
         print(msg)
         print(warning + '\n')
     else:
-
-        if not out.startswith('11'):
-            msg = ("Building llvmlite requires LLVM 11.x.x, got "
+        if not (out.startswith('11') or out.startswith('12') or out.startswith('13')):
+            msg = ("Building llvmlite requires LLVM 11-13.x.x, got "
                    "{!r}. Be sure to set LLVM_CONFIG to the right executable "
                    "path.\nRead the documentation at "
                    "http://llvmlite.pydata.org/ for more information about "
--- a/ffi/targets.cpp
+++ b/ffi/targets.cpp
@@ -204,7 +204,9 @@
         rm = Reloc::DynamicNoPIC;
 
     TargetOptions opt;
+#if LLVM_VERSION_MAJOR < 12
     opt.PrintMachineCode = PrintMC;
+#endif
     opt.MCOptions.ABIName = ABIName;
 
     bool jit = JIT;
--- a/llvmlite/tests/test_binding.py
+++ b/llvmlite/tests/test_binding.py
@@ -18,6 +18,16 @@
 from llvmlite.tests import TestCase
 
 
+def clean_string_whitespace(x: str) -> str:
+    # Remove trailing whitespace from the end of each line
+    x = re.sub(r"\s+$", "", x, flags=re.MULTILINE)
+    # Remove intermediate blank lines
+    x = re.sub(r"\n\s*\n", r"\n", x, flags=re.MULTILINE)
+    # Remove extraneous whitespace from the beginning and end of the string
+    x = x.strip()
+    return x
+
+
 # arvm7l needs extra ABI symbols to link successfully
 if platform.machine() == 'armv7l':
     llvm.load_library_permanently('libgcc_s.so.1')
@@ -555,7 +565,10 @@
         bd = ir.IRBuilder(fn.append_basic_block(name="<>!*''#"))
         bd.ret(ir.Constant(ir.IntType(32), 12345))
         asm = str(mod)
-        self.assertEqual(asm, asm_nonalphanum_blocklabel)
+        self.assertEqual(
+            clean_string_whitespace(asm),
+            clean_string_whitespace(asm_nonalphanum_blocklabel)
+        )
 
     def test_global_context(self):
         gcontext1 = llvm.context.get_global_context()
@@ -640,7 +653,7 @@
     def test_version(self):
         major, minor, patch = llvm.llvm_version_info
         # one of these can be valid
-        valid = [(11,)]
+        valid = [(11,), (12,), (13,)]
         self.assertIn((major,), valid)
         self.assertIn(patch, range(10))
 
--- a/ffi/passmanagers.cpp
+++ b/ffi/passmanagers.cpp
@@ -17,9 +17,6 @@
 #include "llvm-c/Transforms/IPO.h"
 #include "llvm-c/Transforms/Scalar.h"
 #include "llvm/IR/LegacyPassManager.h"
-#if LLVM_VERSION_MAJOR > 11
-#include "llvm/IR/RemarkStreamer.h"
-#endif
 #include "llvm/IR/LLVMRemarkStreamer.h"
 #include "llvm/Remarks/RemarkStreamer.h"
 #include "llvm/Transforms/IPO.h"

Attachment: signature.asc
Description: This is a digitally signed message part

Reply via email to