This commit is contained in:
Guillaume GARDET 2024-12-03 13:47:27 +00:00 committed by Jan Engelhardt
commit e46da3f16b
4 changed files with 253 additions and 0 deletions

26
8381.patch Normal file
View File

@ -0,0 +1,26 @@
From dc531ff24e6d073840a1ed3883c14b16f4c1e7fa Mon Sep 17 00:00:00 2001
From: Alex Reinking <areinking@adobe.com>
Date: Fri, 9 Aug 2024 10:54:54 -0400
Subject: [PATCH] Fix Numpy 2.0 compatibility bug in lesson 10
Numpy 2.0 no longer performs narrowing conversions
automatically. We manually mask here instead.
Fixes #8380
---
python_bindings/tutorial/lesson_10_aot_compilation_run.py | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/python_bindings/tutorial/lesson_10_aot_compilation_run.py b/python_bindings/tutorial/lesson_10_aot_compilation_run.py
index 1c3eb15d7da6..ef39e3411ec4 100644
--- a/python_bindings/tutorial/lesson_10_aot_compilation_run.py
+++ b/python_bindings/tutorial/lesson_10_aot_compilation_run.py
@@ -31,7 +31,7 @@ def main():
input = np.empty((640, 480), dtype=np.uint8, order='F')
for y in range(480):
for x in range(640):
- input[x, y] = x ^ (y + 1)
+ input[x, y] = (x ^ (y + 1)) & 0xFF
# And the memory where we want to write our output:
output = np.empty((640, 480), dtype=np.uint8, order='F')

BIN
halide-v18.0.0.tar.gz Normal file

Binary file not shown.

11
halide.changes Normal file
View File

@ -0,0 +1,11 @@
-------------------------------------------------------------------
Wed Nov 27 17:24:05 UTC 2024 - Guillaume GARDET <guillaume.gardet@opensuse.org>
- Add patch to support Numpy 2:
* 8381.patch
-------------------------------------------------------------------
Tue Nov 26 15:32:45 UTC 2024 - Guillaume GARDET <guillaume.gardet@opensuse.org>
- Initial version

216
halide.spec Normal file
View File

@ -0,0 +1,216 @@
#
# spec file for package halide
#
# Copyright (c) 2021 SUSE LINUX Products GmbH, Nuernberg, Germany.
#
# All modifications and additions to the file contributed by third parties
# remain the property of their copyright owners, unless otherwise agreed
# upon. The license for this file, and modifications and additions to the
# file, is the same license as for the pristine package itself (unless the
# license for the pristine package is not an Open Source License, in which
# case the license is the MIT License). An "Open Source License" is a
# 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/
#
%global HALIDE_VERSION 18
%global HALIDE_SOVERSION 0
%bcond_without tests
# Build broken with latest flatbuffers
%bcond_with serialization
%bcond_without python
%bcond_without vulkan
%global __builder ninja
Name: halide%{HALIDE_VERSION}
Version: 18.0.0
Release: 0
License: MIT
Group: Libraries
Summary: a language for fast, portable data-parallel computation
Url: https://github.com/halide/Halide
Source: https://github.com/halide/Halide/archive/refs/tags/v%{version}.tar.gz#/halide-v%{version}.tar.gz
# PATCH-FIX-UPSTREAM - Numpy 2 support
Patch1: 8381.patch
BuildRequires: Mesa-libGL-devel
BuildRequires: clang-devel
BuildRequires: cmake
BuildRequires: doxygen
BuildRequires: eigen3-devel
BuildRequires: fdupes
%if %{with serialization}
BuildRequires: flatbuffers-devel
%endif
BuildRequires: libjpeg-devel
BuildRequires: libomp-devel
BuildRequires: libpng-devel
BuildRequires: libxml2-devel
BuildRequires: lld
BuildRequires: llvm >= 16
BuildRequires: llvm-devel >= 16
BuildRequires: ninja
%if %{with python}
BuildRequires: python3-devel
BuildRequires: python3-imageio
BuildRequires: python3-numpy
BuildRequires: python3-pybind11-devel
%endif
BuildRequires: openblas-devel
%if %{with vulkan}
BuildRequires: vulkan-devel
%endif
BuildRequires: zlib-devel
%description
Halide is a programming language designed to make it easier
to write high-performance image and array processing code
on modern machines. Halide currently targets:
* CPU architectures: X86, ARM, Hexagon, PowerPC, RISC-V
* Operating systems: Linux, Windows, macOS, Android, iOS, Qualcomm QuRT
* GPU Compute APIs: CUDA, OpenCL, Apple Metal, Microsoft Direct X 12, Vulkan
Rather than being a standalone programming language, Halide
is embedded in C++. This means you write C++ code that builds
an in-memory representation of a Halide pipeline using Halide's
C++ API. You can then compile this representation to an object
file, or JIT-compile it and run it in the same process. Halide
also provides a Python binding that provides full support for
writing Halide embedded in Python without C++.
Halide requires C++17 (or later) to use.
%package -n python3-halide
Summary: Python binding for Halide
Group: System/Libraries
%description -n python3-halide
This package contains the python bindings for Halide.
%package -n libhalide%{HALIDE_VERSION}
Summary: Libraries for Halide
Group: System/Libraries
Requires: llvm
%description -n libhalide%{HALIDE_VERSION}
This package contains the shared libraries needed for Halide.
%package -n libhalide%{HALIDE_VERSION}-devel
Summary: Header Files for Halide
Group: Devel/System/Libraries
Requires: libhalide%{HALIDE_VERSION} = %{version}
%description -n libhalide%{HALIDE_VERSION}-devel
This package contains the headers needed to develop against Halide.
%package -n libhalide%{HALIDE_VERSION}-doc
Summary: Documentation for Halide
Group: Documentation/HTML
BuildArch: noarch
%description -n libhalide%{HALIDE_VERSION}-doc
This package contains documentation for the Halide.
%prep
%autosetup -p1 -n Halide-%{version}
%build
export CC=clang
export CXX=clang++
%if %{with lld}
export LDFLAGS="$LDFLAGS -fuse-ld=lld"
%endif
%cmake \
-DCMAKE_INTERPROCEDURAL_OPTIMIZATION=ON \
-DCMAKE_POSITION_INDEPENDENT_CODE=ON \
-DHalide_ENABLE_RTTI=ON \
-DHalide_ENABLE_EXCEPTIONS=ON \
%if %{with python}
-DWITH_PYTHON_BINDINGS=ON \
%if %{without tests}
-DWITH_TEST_PYTHON=OFF \
%endif
%else
-DWITH_PYTHON_BINDINGS=OFF \
%endif
%if %{without serialization}
-DWITH_SERIALIZATION=OFF \
%endif
-DFLATBUFFERS_USE_FETCHCONTENT=OFF \
-DPYBIND11_USE_FETCHCONTENT=OFF \
-DHalide_SHARED_LLVM=ON \
-DTARGET_WEBASSEMBLY=OFF \
%if %{without tests}
-DWITH_TESTS=OFF \
%endif
-DWITH_TEST_FUZZ=OFF \
-DWITH_DOCS=ON \
%if %{with vulkan}
-DTARGET_VULKAN=ON \
%endif
-DHalide_INSTALL_PLUGINDIR=%{_lib}/halide%{HALIDE_VERSION}/ \
-DCMAKE_INSTALL_INCLUDEDIR=%{_includedir}/halide%{HALIDE_VERSION}/ \
-DHalide_INSTALL_CMAKEDIR=%{_lib}/cmake/Halide%{HALIDE_VERSION}/ \
-DHalide_INSTALL_HELPERSDIR=%{_lib}/cmake/HalideHelpers%{HALIDE_VERSION}/ \
-DCMAKE_INSTALL_BINDIR=%{_lib}/halide%{HALIDE_VERSION}/ \
-DHalide_INSTALL_TOOLSDIR=%{_usrsrc}/halide%{HALIDE_VERSION}/ \
-DCMAKE_INSTALL_DOCDIR=%{_defaultdocdir}/halide%{HALIDE_VERSION}/ \
-DHalide_INSTALL_PYTHONDIR=%{python3_sitearch}/halide/
%cmake_build
%install
%cmake_install
%fdupes %{buildroot}%{_prefix}
%post -n libhalide%{HALIDE_VERSION} -p /sbin/ldconfig
%postun -n libhalide%{HALIDE_VERSION} -p /sbin/ldconfig
%post -n libhalide%{HALIDE_VERSION}-devel -p /sbin/ldconfig
%postun -n libhalide%{HALIDE_VERSION}-devel -p /sbin/ldconfig
%check
%if %{with tests}
TEST_GROUPS_FLAKY="performance|auto_schedule"
%if %{without serialization}
TEST_GROUPS_FLAKY="${TEST_GROUPS_FLAKY}|tutorial_lesson_23_serialization"
%endif
# WARNING: running multiple halide tests in parallel is unsupported!
%ctest --parallel 1 --exclude-regex "${TEST_GROUPS_FLAKY}"
%ctest --parallel 1 --label-regex "${TEST_GROUPS_FLAKY}" || :
%endif
%files -n python3-halide
%{_libdir}/libHalidePyStubs.a
%dir %{python3_sitearch}/halide/
%{python3_sitearch}/halide/*
%files -n libhalide%{HALIDE_VERSION}
%defattr(-,root,root,-)
%{_libdir}/libHalide.so.*
%files -n libhalide%{HALIDE_VERSION}-devel
%{_libdir}/libHalide.so
%dir %{_libdir}/halide%{HALIDE_VERSION}
%{_libdir}/halide%{HALIDE_VERSION}/*
%dir %{_includedir}/halide%{HALIDE_VERSION}
%{_includedir}/halide%{HALIDE_VERSION}/*
%dir %{_libdir}/cmake/Halide%{HALIDE_VERSION}
%{_libdir}/cmake/Halide%{HALIDE_VERSION}/*
%dir %{_libdir}/cmake/HalideHelpers%{HALIDE_VERSION}
%{_libdir}/cmake/HalideHelpers%{HALIDE_VERSION}/*
%dir %{_usrsrc}/halide%{HALIDE_VERSION}
%{_usrsrc}/halide%{HALIDE_VERSION}/*
%files -n libhalide%{HALIDE_VERSION}-doc
%dir %{_defaultdocdir}/halide%{HALIDE_VERSION}
%docdir %{_defaultdocdir}/halide%{HALIDE_VERSION}
%{_defaultdocdir}/halide%{HALIDE_VERSION}/*
%license LICENSE.txt
%changelog