Hello community, here is the log from the commit of package python-llvmlite for openSUSE:Factory checked in at 2018-10-11 11:58:23 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Comparing /work/SRC/openSUSE:Factory/python-llvmlite (Old) and /work/SRC/openSUSE:Factory/.python-llvmlite.new (New) ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Package is "python-llvmlite" Thu Oct 11 11:58:23 2018 rev:8 rq:640984 version:0.25.0 Changes: -------- --- /work/SRC/openSUSE:Factory/python-llvmlite/python-llvmlite.changes 2018-07-14 20:24:25.656063826 +0200 +++ /work/SRC/openSUSE:Factory/.python-llvmlite.new/python-llvmlite.changes 2018-10-11 11:58:27.721793909 +0200 @@ -1,0 +2,13 @@ +Wed Oct 10 01:50:47 UTC 2018 - Arun Persaud <[email protected]> + +- update to version 0.25.0: + * PR #391: Fix broken win32 py2.7 build. + * PR #387: protect against empty features in list + * PR #384: Read CMAKE_GENERATOR which conda-build sets + * PR #382: rewrite of install instructions, calling out LLVM build + challenges + * PR #380: Add FMA intrinsic support + * PR #379: ARM aarch64 test on jetson tx2 + * PR #378: add slack, drop flowdock + +------------------------------------------------------------------- Old: ---- llvmlite-0.24.0.tar.gz New: ---- llvmlite-0.25.0.tar.gz ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Other differences: ------------------ ++++++ python-llvmlite.spec ++++++ --- /var/tmp/diff_new_pack.q1xMqP/_old 2018-10-11 11:58:28.565792836 +0200 +++ /var/tmp/diff_new_pack.q1xMqP/_new 2018-10-11 11:58:28.569792831 +0200 @@ -12,13 +12,13 @@ # license that conforms to the Open Source Definition (Version 1.9) # published by the Open Source Initiative. -# Please submit bugfixes or comments via http://bugs.opensuse.org/ +# Please submit bugfixes or comments via https://bugs.opensuse.org/ # %{?!python_module:%define python_module() python-%{**} python3-%{**}} Name: python-llvmlite -Version: 0.24.0 +Version: 0.25.0 Release: 0 Summary: Lightweight wrapper around basic LLVM functionality License: BSD-2-Clause ++++++ llvmlite-0.24.0.tar.gz -> llvmlite-0.25.0.tar.gz ++++++ diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/llvmlite-0.24.0/PKG-INFO new/llvmlite-0.25.0/PKG-INFO --- old/llvmlite-0.24.0/PKG-INFO 2018-07-10 16:51:01.000000000 +0200 +++ new/llvmlite-0.25.0/PKG-INFO 2018-09-21 21:32:23.000000000 +0200 @@ -1,6 +1,6 @@ Metadata-Version: 1.1 Name: llvmlite -Version: 0.24.0 +Version: 0.25.0 Summary: lightweight wrapper around basic LLVM functionality Home-page: http://llvmlite.pydata.org Author: Continuum Analytics, Inc. diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/llvmlite-0.24.0/ffi/build.py new/llvmlite-0.25.0/ffi/build.py --- old/llvmlite-0.24.0/ffi/build.py 2018-07-10 16:46:02.000000000 +0200 +++ new/llvmlite-0.25.0/ffi/build.py 2018-09-21 21:31:30.000000000 +0200 @@ -6,6 +6,7 @@ from __future__ import print_function from ctypes.util import find_library +import re import os import subprocess import shutil @@ -53,9 +54,22 @@ # seems a bit lacking here. cmake_dir = os.path.join(here_dir, 'dummy') # LLVM 4.0+ needs VS 2015 minimum. - for generator in ['Visual Studio 14 2015']: - if is_64bit: - generator += ' Win64' + generators = [] + if os.environ.get("CMAKE_GENERATOR"): + generators.append(os.environ.get("CMAKE_GENERATOR")) + + # Drop generators that are too old + vspat = re.compile('Visual Studio (\d+)') + def drop_old_vs(g): + m = vspat.match(g) + if m is None: + return True # keep those we don't recognize + ver = int(m.group(1)) + return ver >= 14 + generators = list(filter(drop_old_vs, generators)) + + generators.append('Visual Studio 14 2015' + (' Win64' if is_64bit else '')) + for generator in generators: build_dir = tempfile.mkdtemp() print("Trying generator %r" % (generator,)) try: diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/llvmlite-0.24.0/ffi/value.cpp new/llvmlite-0.25.0/ffi/value.cpp --- old/llvmlite-0.24.0/ffi/value.cpp 2018-07-10 16:46:02.000000000 +0200 +++ new/llvmlite-0.25.0/ffi/value.cpp 2018-09-21 21:31:30.000000000 +0200 @@ -2,6 +2,8 @@ #include "llvm-c/Core.h" #include "core.h" +#include <iostream> + // the following is needed for WriteGraph() #include "llvm/Analysis/CFGPrinter.h" @@ -38,6 +40,42 @@ return LLVMTypeOf(Val); } +API_EXPORT(const char *) +LLVMPY_PrintType(LLVMTypeRef type) +{ + return LLVMPrintTypeToString(type); +} + +API_EXPORT(const char *) +LLVMPY_GetTypeName(LLVMTypeRef type) +{ + // try to convert to a struct type, works for other derived + // types too + llvm::Type* unwrapped = llvm::unwrap(type); + llvm::StructType* ty = llvm::dyn_cast<llvm::StructType>(unwrapped); + if (ty && !ty->isLiteral()) { + return strdup(ty->getStructName().str().c_str()); + } + return strdup(""); +} + +API_EXPORT(bool) +LLVMPY_TypeIsPointer(LLVMTypeRef type) +{ + return llvm::unwrap(type)->isPointerTy(); +} + +API_EXPORT(LLVMTypeRef) +LLVMPY_GetElementType(LLVMTypeRef type) +{ + llvm::Type* unwrapped = llvm::unwrap(type); + llvm::PointerType* ty = llvm::dyn_cast<llvm::PointerType>(unwrapped); + if (ty != nullptr) { + return llvm::wrap(ty->getElementType()); + } + return nullptr; +} + API_EXPORT(void) LLVMPY_SetLinkage(LLVMValueRef Val, int Linkage) { diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/llvmlite-0.24.0/llvmlite/_version.py new/llvmlite-0.25.0/llvmlite/_version.py --- old/llvmlite-0.24.0/llvmlite/_version.py 2018-07-10 16:51:01.000000000 +0200 +++ new/llvmlite-0.25.0/llvmlite/_version.py 2018-09-21 21:32:23.000000000 +0200 @@ -4,8 +4,8 @@ # unpacked source archive. Distribution tarballs contain a pre-generated copy # of this file. -version_version = '0.24.0' -version_full = '368c3ce9805a8efcb0ac034000e8f1804aa753ac' +version_version = '0.25.0' +version_full = '9af98a608a49278dbc4ce5dc743152f2341b6a87' def get_versions(default={}, verbose=False): return {'version': version_version, 'full': version_full} diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/llvmlite-0.24.0/llvmlite/binding/targets.py new/llvmlite-0.25.0/llvmlite/binding/targets.py --- old/llvmlite-0.24.0/llvmlite/binding/targets.py 2018-07-10 16:46:02.000000000 +0200 +++ new/llvmlite-0.25.0/llvmlite/binding/targets.py 2018-09-21 21:31:30.000000000 +0200 @@ -64,7 +64,8 @@ content = str(out) if content: # protect against empty string for feat in content.split(','): - outdict[feat[1:]] = flag_map[feat[0]] + if feat: # protect against empty feature + outdict[feat[1:]] = flag_map[feat[0]] return outdict diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/llvmlite-0.24.0/llvmlite/binding/value.py new/llvmlite-0.25.0/llvmlite/binding/value.py --- old/llvmlite-0.24.0/llvmlite/binding/value.py 2018-07-10 16:46:02.000000000 +0200 +++ new/llvmlite-0.25.0/llvmlite/binding/value.py 2018-09-21 21:31:30.000000000 +0200 @@ -1,4 +1,4 @@ -from ctypes import POINTER, c_char_p, c_int, c_size_t, c_uint +from ctypes import POINTER, c_char_p, c_int, c_size_t, c_uint, c_bool import enum from . import ffi @@ -43,6 +43,37 @@ dllexport = 2 +class TypeRef(ffi.ObjectRef): + """A weak reference to a LLVM type + """ + @property + def name(self): + """ + Get type name + """ + return _decode_string(ffi.lib.LLVMPY_GetTypeName(self)) + + @property + def is_pointer(self): + """ + Returns true is the type is a pointer type. + """ + return ffi.lib.LLVMPY_TypeIsPointer(self) + + @property + def element_type(self): + """ + Returns the pointed-to type. When the type is not a pointer, + raises exception. + """ + if not self.is_pointer: + raise ValueError("Type {} is not a pointer".format(self)) + return TypeRef(ffi.lib.LLVMPY_GetElementType(self)) + + def __str__(self): + return _decode_string(ffi.lib.LLVMPY_PrintType(self)) + + class ValueRef(ffi.ObjectRef): """A weak reference to a LLVM value. """ @@ -122,7 +153,7 @@ This value's LLVM type. """ # XXX what does this return? - return ffi.lib.LLVMPY_TypeOf(self) + return TypeRef(ffi.lib.LLVMPY_TypeOf(self)) @property def is_declaration(self): @@ -151,6 +182,19 @@ ffi.lib.LLVMPY_TypeOf.argtypes = [ffi.LLVMValueRef] ffi.lib.LLVMPY_TypeOf.restype = ffi.LLVMTypeRef +ffi.lib.LLVMPY_PrintType.argtypes = [ffi.LLVMTypeRef] +ffi.lib.LLVMPY_PrintType.restype = c_char_p + +ffi.lib.LLVMPY_TypeIsPointer.argtypes = [ffi.LLVMTypeRef] +ffi.lib.LLVMPY_TypeIsPointer.restype = c_bool + +ffi.lib.LLVMPY_GetElementType.argtypes = [ffi.LLVMTypeRef] +ffi.lib.LLVMPY_GetElementType.restype = ffi.LLVMTypeRef + + +ffi.lib.LLVMPY_GetTypeName.argtypes = [ffi.LLVMTypeRef] +ffi.lib.LLVMPY_GetTypeName.restype = c_char_p + ffi.lib.LLVMPY_GetLinkage.argtypes = [ffi.LLVMValueRef] ffi.lib.LLVMPY_GetLinkage.restype = c_int diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/llvmlite-0.24.0/llvmlite/ir/builder.py new/llvmlite-0.25.0/llvmlite/ir/builder.py --- old/llvmlite-0.24.0/llvmlite/ir/builder.py 2018-07-10 16:46:02.000000000 +0200 +++ new/llvmlite-0.25.0/llvmlite/ir/builder.py 2018-09-21 21:31:30.000000000 +0200 @@ -99,6 +99,26 @@ return wrap +def _triop_intrinsic(opname): + def wrap(fn): + @functools.wraps(fn) + def wrapped(self, a, b, c, name=''): + if a.type != b.type or b.type != c.type: + raise TypeError( + "expected types to be the same, got %s, %s, %s" % ( + a.type, + b.type, + c.type)) + elif not isinstance(a.type, (types.FloatType, types.DoubleType)): + raise TypeError("expected an floating point type, got %s" % a.type) + fn = self.module.declare_intrinsic(opname, [a.type, b.type, c.type]) + return self.call(fn, [a, b, c], name) + + return wrapped + + return wrap + + def _castop(opname, cls=instructions.CastInstr): def wrap(fn): @functools.wraps(fn) @@ -910,3 +930,9 @@ """ Counts the number of trailing zeros in a variable. """ + + @_triop_intrinsic("llvm.fma") + def fma(self, a, b, c): + """ + Perform the fused multiply-add operation. + """ diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/llvmlite-0.24.0/llvmlite/ir/module.py new/llvmlite-0.25.0/llvmlite/ir/module.py --- old/llvmlite-0.24.0/llvmlite/ir/module.py 2018-07-10 16:46:02.000000000 +0200 +++ new/llvmlite-0.25.0/llvmlite/ir/module.py 2018-09-21 21:31:30.000000000 +0200 @@ -155,7 +155,7 @@ raise NotImplementedError("unknown intrinsic %r with %d types" % (intrinsic, len(tys))) - if intrinsic in {'llvm.cttz', 'llvm.ctlz'}: + if intrinsic in {'llvm.cttz', 'llvm.ctlz', 'llvm.fma'}: suffixes = [tys[0].intrinsic_name] else: suffixes = [t.intrinsic_name for t in tys] @@ -186,9 +186,15 @@ fnty = types.FunctionType(tys[0], tys) else: _error() - elif len(tys) == 3 and intrinsic in ('llvm.memcpy', 'llvm.memmove'): - tys = tys + [types.IntType(32), types.IntType(1)] - fnty = types.FunctionType(types.VoidType(), tys) + elif len(tys) == 3: + if intrinsic in ('llvm.memcpy', 'llvm.memmove'): + tys = tys + [types.IntType(32), types.IntType(1)] + fnty = types.FunctionType(types.VoidType(), tys) + elif intrinsic == 'llvm.fma': + tys = [tys[0]] * 3 + fnty = types.FunctionType(tys[0], tys) + else: + _error() else: _error() return values.Function(self, fnty, name=name) diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/llvmlite-0.24.0/llvmlite/ir/types.py new/llvmlite-0.25.0/llvmlite/ir/types.py --- old/llvmlite-0.24.0/llvmlite/ir/types.py 2018-07-10 16:46:02.000000000 +0200 +++ new/llvmlite-0.25.0/llvmlite/ir/types.py 2018-09-21 21:31:30.000000000 +0200 @@ -256,12 +256,14 @@ """ return struct.unpack('f', struct.pack('f', value))[0] + def _format_float_as_hex(value, packfmt, unpackfmt, numdigits): raw = struct.pack(packfmt, float(value)) intrep = struct.unpack(unpackfmt, raw)[0] out = '{{0:#{0}x}}'.format(numdigits).format(intrep) return out + def _format_double(value): """ Format *value* as a hexadecimal string of its IEEE double precision diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/llvmlite-0.24.0/llvmlite/tests/test_binding.py new/llvmlite-0.25.0/llvmlite/tests/test_binding.py --- old/llvmlite-0.24.0/llvmlite/tests/test_binding.py 2018-07-10 16:46:02.000000000 +0200 +++ new/llvmlite-0.25.0/llvmlite/tests/test_binding.py 2018-09-21 21:31:30.000000000 +0200 @@ -39,11 +39,12 @@ asm_sum = r""" ; ModuleID = '<string>' target triple = "{triple}" + %struct.glob_type = type {{ i64, [2 x i64]}} @glob = global i32 0 @glob_b = global i8 0 @glob_f = global float 1.5 - @glob_struct = global {{ i64, [2 x i64]}} {{i64 0, [2 x i64] [i64 0, i64 0]}} + @glob_struct = global %struct.glob_type {{i64 0, [2 x i64] [i64 0, i64 0]}} define i32 @sum(i32 %.1, i32 %.2) {{ %.3 = add i32 %.1, %.2 @@ -65,6 +66,7 @@ asm_mul = r""" ; ModuleID = '<string>' target triple = "{triple}" + @mul_glob = global i32 0 define i32 @mul(i32 %.1, i32 %.2) {{ %.3 = mul i32 %.1, %.2 @@ -445,12 +447,12 @@ funcs = list(it) self.assertEqual(len(funcs), 1) self.assertEqual(funcs[0].name, "sum") - def test_link_in(self): dest = self.module() src = self.module(asm_mul) dest.link_in(src) - self.assertEqual(sorted(f.name for f in dest.functions), ["mul", "sum"]) + self.assertEqual( + sorted(f.name for f in dest.functions), ["mul", "sum"]) dest.get_function("mul") dest.close() with self.assertRaises(ctypes.ArgumentError): @@ -460,7 +462,8 @@ dest = self.module() src2 = self.module(asm_mul) dest.link_in(src2, preserve=True) - self.assertEqual(sorted(f.name for f in dest.functions), ["mul", "sum"]) + self.assertEqual( + sorted(f.name for f in dest.functions), ["mul", "sum"]) dest.close() self.assertEqual(sorted(f.name for f in src2.functions), ["mul"]) src2.get_function("mul") @@ -491,11 +494,12 @@ self.assertIn("Invalid bitcode signature", str(cm.exception)) def test_bitcode_roundtrip(self): - bc = self.module().as_bitcode() + bc = self.module(asm=asm_mul).as_bitcode() mod = llvm.parse_bitcode(bc) self.assertEqual(mod.as_bitcode(), bc) - mod.get_function("sum") - mod.get_global_variable("glob") + + mod.get_function("mul") + mod.get_global_variable("mul_glob") def test_cloning(self): m = self.module() @@ -784,7 +788,6 @@ fn.add_function_attribute("zext") self.assertEqual(str(raises.exception), "no such attribute 'zext'") - def test_module(self): mod = self.module() glob = mod.get_global_variable("glob") @@ -794,7 +797,37 @@ mod = self.module() glob = mod.get_global_variable("glob") tp = glob.type - self.assertIsInstance(tp, ffi.LLVMTypeRef) + self.assertIsInstance(tp, llvm.TypeRef) + + def test_type_name(self): + mod = self.module() + glob = mod.get_global_variable("glob") + tp = glob.type + self.assertEqual(tp.name, "") + st = mod.get_global_variable("glob_struct") + self.assertIsNotNone(re.match(r"struct\.glob_type(\.[\d]+)?", + st.type.element_type.name)) + + def test_type_printing_variable(self): + mod = self.module() + glob = mod.get_global_variable("glob") + tp = glob.type + self.assertEqual(str(tp), 'i32*') + + def test_type_printing_function(self): + mod = self.module() + fn = mod.get_function("sum") + self.assertEqual(str(fn.type), "i32 (i32, i32)*") + + def test_type_printing_struct(self): + mod = self.module() + st = mod.get_global_variable("glob_struct") + self.assertTrue(st.type.is_pointer) + self.assertIsNotNone(re.match(r'%struct\.glob_type(\.[\d]+)?\*', + str(st.type))) + self.assertIsNotNone(re.match( + r"%struct\.glob_type(\.[\d]+)? = type { i64, \[2 x i64\] }", + str(st.type.element_type))) def test_close(self): glob = self.glob() @@ -1120,19 +1153,19 @@ # test issue #303 # (https://github.com/numba/llvmlite/issues/303) mod = self.module(asm_global_ctors) - ee = self.jit(mod) + ee = self.jit(mod) ee.finalize_object() ee.run_static_constructors() # global variable should have been initialized ptr_addr = ee.get_global_value_address("A") - ptr_t = ctypes.POINTER(ctypes.c_int32) - ptr = ctypes.cast(ptr_addr, ptr_t) + ptr_t = ctypes.POINTER(ctypes.c_int32) + ptr = ctypes.cast(ptr_addr, ptr_t) self.assertEqual(ptr.contents.value, 10) foo_addr = ee.get_function_address("foo") - foo = ctypes.CFUNCTYPE(ctypes.c_int32)(foo_addr) + foo = ctypes.CFUNCTYPE(ctypes.c_int32)(foo_addr) self.assertEqual(foo(), 12) ee.run_static_destructors() @@ -1205,6 +1238,7 @@ asm = tm.emit_assembly(m) self.assertIn('nop', asm) + class TestObjectFile(BaseTest): def test_object_file(self): target_machine = self.target_machine() @@ -1222,5 +1256,6 @@ break self.assertTrue(has_text) + if __name__ == "__main__": unittest.main() diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/llvmlite-0.24.0/llvmlite/tests/test_ir.py new/llvmlite-0.25.0/llvmlite/tests/test_ir.py --- old/llvmlite-0.24.0/llvmlite/tests/test_ir.py 2018-07-10 16:46:02.000000000 +0200 +++ new/llvmlite-0.25.0/llvmlite/tests/test_ir.py 2018-09-21 21:31:30.000000000 +0200 @@ -1289,6 +1289,46 @@ "expected an integer type, got float", str(raises.exception)) + def test_fma(self): + block = self.block(name='my_block') + builder = ir.IRBuilder(block) + a = ir.Constant(flt, 5) + b = ir.Constant(flt, 1) + c = ir.Constant(flt, 2) + fma = builder.fma(a, b, c, name='fma') + builder.ret(fma) + self.check_block(block, """\ + my_block: + %"fma" = call float @"llvm.fma.f32"(float 0x4014000000000000, float 0x3ff0000000000000, float 0x4000000000000000) + ret float %"fma" + """) + + def test_fma_wrongtype(self): + block = self.block(name='my_block') + builder = ir.IRBuilder(block) + a = ir.Constant(int32, 5) + b = ir.Constant(int32, 1) + c = ir.Constant(int32, 2) + + with self.assertRaises(TypeError) as raises: + builder.fma(a, b, c, name='fma') + self.assertIn( + "expected an floating point type, got i32", + str(raises.exception)) + + def test_fma_mixedtypes(self): + block = self.block(name='my_block') + builder = ir.IRBuilder(block) + a = ir.Constant(flt, 5) + b = ir.Constant(dbl, 1) + c = ir.Constant(flt, 2) + + with self.assertRaises(TypeError) as raises: + builder.fma(a, b, c, name='fma') + self.assertIn( + "expected types to be the same, got float, double, float", + str(raises.exception)) + class TestBuilderMisc(TestBase): """ diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/llvmlite-0.24.0/setup.py new/llvmlite-0.25.0/setup.py --- old/llvmlite-0.24.0/setup.py 2018-07-10 16:46:02.000000000 +0200 +++ new/llvmlite-0.25.0/setup.py 2018-09-21 21:31:30.000000000 +0200 @@ -159,8 +159,10 @@ ] install_requires = [] +setup_requires = [] if sys.version_info < (3, 4): install_requires.append('enum34') + setup_requires.append('enum34') with open('README.rst') as f: @@ -188,6 +190,7 @@ download_url="https://github.com/numba/llvmlite", packages=packages, install_requires=install_requires, + setup_requires=setup_requires, license="BSD", cmdclass=cmdclass, long_description=long_description,
