From ff5ad94c9dd170f4ba7ad8428fe3f6fc6f4e9c40 Mon Sep 17 00:00:00 2001 From: Jordan Justen Date: Fri, 9 Jul 2021 11:42:10 -0700 Subject: [PATCH 01/17] debian: Include SPIR-V (*.spv) outputs in libclc package This adds the following to the libclc-12 package: /usr/lib/clc/spirv64-mesa3d-.spv /usr/lib/clc/spirv-mesa3d-.spv Since Debian buster & Ubuntu 18.04 don't have the llvm-spirv package, they cannot support this feature. Therefore, as suggested by tjaalton, we make the control Build-Depends for spirv dependencies include "| hello". This causes the simple "hello world" package to be installed on these older distros, which is small and unrelated to llvm. Then, in debian/rules, we check to see if llvm-spirv is installed. Note that sbuild must use `--resolve-alternatives` for these older distributions, or sbuild won't search for the "hello" alternatives in the Build-Depends. Signed-off-by: Jordan Justen --- debian/changelog | 2 +- debian/control | 4 +++- debian/libclc-X.Y.install.in | 1 + debian/patches/libclc-llvm-spirv.diff | 13 +++++++++++++ debian/patches/series | 2 ++ debian/rules | 19 ++++++++++++++++++- 6 files changed, 38 insertions(+), 3 deletions(-) create mode 100644 debian/patches/libclc-llvm-spirv.diff diff --git a/debian/changelog b/debian/changelog index 458fe21f..e1be3123 100644 --- a/debian/changelog +++ b/debian/changelog @@ -1,7 +1,7 @@ llvm-toolchain-12 (1:12.0.1-5) unstable; urgency=medium [ Jordan Justen ] - * libclc: Include libclc spir-v outputs (used by Mesa opencl) + * Include SPIR-V (*.spv) outputs in libclc package -- Sylvestre Ledru Tue, 17 Aug 2021 10:19:22 +0200 diff --git a/debian/control b/debian/control index 9ce586c5..e0363e41 100644 --- a/debian/control +++ b/debian/control @@ -19,7 +19,9 @@ Build-Depends: debhelper (>= 9.0), cmake, chrpath, texinfo, sharutils, ocaml-findlib [amd64 arm64 armhf ppc64el s390x], libctypes-ocaml-dev [amd64 arm64 armhf ppc64el s390x], dh-exec, dh-ocaml [amd64 arm64 armhf ppc64el s390x], - libpfm4-dev [linux-any], python3-setuptools, libz3-dev + libpfm4-dev [linux-any], python3-setuptools, libz3-dev, + llvm-spirv | hello, spirv-tools | hello +# "| hello" is for older buster/bionic distros without spirv support Build-Conflicts: oprofile, ocaml Standards-Version: 4.2.1 Homepage: https://www.llvm.org/ diff --git a/debian/libclc-X.Y.install.in b/debian/libclc-X.Y.install.in index 36023694..923094ff 100644 --- a/debian/libclc-X.Y.install.in +++ b/debian/libclc-X.Y.install.in @@ -1 +1,2 @@ usr/lib/clc/*.bc +#spv usr/lib/clc/*.spv diff --git a/debian/patches/libclc-llvm-spirv.diff b/debian/patches/libclc-llvm-spirv.diff new file mode 100644 index 00000000..d6a57203 --- /dev/null +++ b/debian/patches/libclc-llvm-spirv.diff @@ -0,0 +1,13 @@ +diff --git a/libclc/CMakeLists.txt b/libclc/CMakeLists.txt +index b8b5ceff086c..5964468358f2 100644 +--- a/libclc/CMakeLists.txt ++++ b/libclc/CMakeLists.txt +@@ -95,7 +95,7 @@ find_program( LLVM_CLANG clang PATHS ${LLVM_BINDIR} NO_DEFAULT_PATH ) + find_program( LLVM_AS llvm-as PATHS ${LLVM_BINDIR} NO_DEFAULT_PATH ) + find_program( LLVM_LINK llvm-link PATHS ${LLVM_BINDIR} NO_DEFAULT_PATH ) + find_program( LLVM_OPT opt PATHS ${LLVM_BINDIR} NO_DEFAULT_PATH ) +-find_program( LLVM_SPIRV llvm-spirv PATHS ${LLVM_BINDIR} NO_DEFAULT_PATH ) ++find_program( LLVM_SPIRV llvm-spirv PATHS ${LLVM_BINDIR}) + + # Print toolchain + message( "clang: ${LLVM_CLANG}" ) diff --git a/debian/patches/series b/debian/patches/series index 11663d97..aa6a7590 100644 --- a/debian/patches/series +++ b/debian/patches/series @@ -144,3 +144,5 @@ lld-use-link-atomic-i386.diff D99501-ignore-lto-auto.diff scan-build-py-fix-analyze-path.diff scan-build-py-fix-default-bin.diff + +libclc-llvm-spirv.diff diff --git a/debian/rules b/debian/rules index 6821c432..6ce6d05e 100755 --- a/debian/rules +++ b/debian/rules @@ -132,6 +132,17 @@ else control_vars = '-Vdep:devlibs=libstdc++6-$(GCC_VERSION)-dev' endif +ifeq ($(shell which llvm-spirv),) +LLVM_SPIRV_INSTALLED = no +else +LLVM_SPIRV_INSTALLED = yes +endif + +LIBCLC_TARGETS_TO_BUILD="amdgcn--;amdgcn--amdhsa;r600--;nvptx--;nvptx64--;nvptx--nvidiacl;nvptx64--nvidiacl" +ifeq ($(LLVM_SPIRV_INSTALLED),yes) + LIBCLC_TARGETS_TO_BUILD := $(LIBCLC_TARGETS_TO_BUILD)";spirv-mesa3d-;spirv64-mesa3d-" +endif + # Disabled: # Host compiler does not support '-fuse-ld=lld' # USE_LLD_ARCHS := amd64 @@ -361,6 +372,12 @@ preconfigure: fi; \ fi + # Conditionally enable *.spv files. Debian buster and Ubuntu 18.04 + # don't have llvm-spirv to create the *.spv files. + if test "$(LLVM_SPIRV_INSTALLED)" = "yes"; then \ + sed -i -e "s|#spv\ ||g" debian/libclc-$(LLVM_VERSION).install; \ + fi + # Override this two targets. They are trying to manage the .in conversion for me override_dh_ocamlinit: override_dh_ocamlclean: @@ -541,7 +558,7 @@ debian-libclc-build: -DCMAKE_INSTALL_DATADIR=lib \ -DCMAKE_INSTALL_INCLUDEDIR=include \ -DLLVM_CONFIG=$(CURDIR)/$(TARGET_BUILD_STAGE2)/bin/llvm-config \ - -DLIBCLC_TARGETS_TO_BUILD="amdgcn--;amdgcn--amdhsa;r600--;nvptx--;nvptx64--;nvptx--nvidiacl;nvptx64--nvidiacl"; \ + -DLIBCLC_TARGETS_TO_BUILD=$(LIBCLC_TARGETS_TO_BUILD); \ make $(NJOBS) $(VERBOSE) touch $@ From def26fecca66d96f4af93a9038e8aefb18637462 Mon Sep 17 00:00:00 2001 From: John Paul Adrian Glaubitz Date: Tue, 24 Aug 2021 16:55:02 +0200 Subject: [PATCH 02/17] Disable libunwind on m68k and x32 --- debian/changelog | 7 +++++++ debian/rules | 2 +- 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/debian/changelog b/debian/changelog index c7a47af9..2292b55c 100644 --- a/debian/changelog +++ b/debian/changelog @@ -1,3 +1,10 @@ +llvm-toolchain-13 (1:13.0.0~+rc1-3) UNRELEASED; urgency=medium + + [ John Paul Adrian Glaubitz ] + * Disable libunwind on m68k and x32 + + -- John Paul Adrian Glaubitz Tue, 24 Aug 2021 16:54:44 +0200 + llvm-toolchain-13 (1:13.0.0~+rc1-2) unstable; urgency=medium * clang-soname-extract-version.diff: improve the upstream declaration diff --git a/debian/rules b/debian/rules index 153aea2e..faf5e1b7 100755 --- a/debian/rules +++ b/debian/rules @@ -198,7 +198,7 @@ endif # Enable libunwind (or not) LIBUNWIND_ENABLE=yes -ifneq (,$(filter $(DEB_HOST_ARCH), s390x armel mipsel hurd-i386 powerpc)) +ifneq (,$(filter $(DEB_HOST_ARCH), s390x armel m68k mipsel hurd-i386 powerpc x32)) LIBUNWIND_ENABLE=no else PROJECTS+=;libunwind From d45e0ae821b4e467c38fcf4ef1e77cec07aaca91 Mon Sep 17 00:00:00 2001 From: John Paul Adrian Glaubitz Date: Tue, 24 Aug 2021 20:12:01 +0200 Subject: [PATCH 03/17] Disable libunwind on sparc64 --- debian/changelog | 2 +- debian/rules | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/debian/changelog b/debian/changelog index 2292b55c..dc660a67 100644 --- a/debian/changelog +++ b/debian/changelog @@ -1,7 +1,7 @@ llvm-toolchain-13 (1:13.0.0~+rc1-3) UNRELEASED; urgency=medium [ John Paul Adrian Glaubitz ] - * Disable libunwind on m68k and x32 + * Disable libunwind on m68k, sparc64 and x32 -- John Paul Adrian Glaubitz Tue, 24 Aug 2021 16:54:44 +0200 diff --git a/debian/rules b/debian/rules index faf5e1b7..c8caf683 100755 --- a/debian/rules +++ b/debian/rules @@ -198,7 +198,7 @@ endif # Enable libunwind (or not) LIBUNWIND_ENABLE=yes -ifneq (,$(filter $(DEB_HOST_ARCH), s390x armel m68k mipsel hurd-i386 powerpc x32)) +ifneq (,$(filter $(DEB_HOST_ARCH), s390x armel m68k mipsel hurd-i386 powerpc sparc64 x32)) LIBUNWIND_ENABLE=no else PROJECTS+=;libunwind From 1d8600f74e7f30c24ddadc0efed8b81b06268799 Mon Sep 17 00:00:00 2001 From: Sylvestre Ledru Date: Wed, 25 Aug 2021 10:18:33 +0200 Subject: [PATCH 04/17] update of the dates --- debian/changelog | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/debian/changelog b/debian/changelog index e1be3123..bef4af57 100644 --- a/debian/changelog +++ b/debian/changelog @@ -3,7 +3,7 @@ llvm-toolchain-12 (1:12.0.1-5) unstable; urgency=medium [ Jordan Justen ] * Include SPIR-V (*.spv) outputs in libclc package - -- Sylvestre Ledru Tue, 17 Aug 2021 10:19:22 +0200 + -- Sylvestre Ledru Wed, 25 Aug 2021 10:18:14 +0200 llvm-toolchain-12 (1:12.0.1-4) unstable; urgency=medium From c40c04a386bfcdf1a88af80eb44ed243a7089eb6 Mon Sep 17 00:00:00 2001 From: Gianfranco Costamagna Date: Thu, 26 Aug 2021 16:04:51 +0200 Subject: [PATCH 05/17] integration-test-suite-test: fix build by using 13 as default version --- debian/tests/integration-test-suite-test | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/debian/tests/integration-test-suite-test b/debian/tests/integration-test-suite-test index 3f35552a..e674750f 100755 --- a/debian/tests/integration-test-suite-test +++ b/debian/tests/integration-test-suite-test @@ -2,7 +2,7 @@ set -e -LLVM_VERSION=12 +LLVM_VERSION=13 # this is taken from libjsoncpp package # Presence of $AUTOPKGTEST_TMP implies that someone will handle cleanup for us, so we From 7c84a6515c410f7d3a8f41e3ef71015fe7813755 Mon Sep 17 00:00:00 2001 From: Gianfranco Costamagna Date: Thu, 26 Aug 2021 16:05:25 +0200 Subject: [PATCH 06/17] Update changelog --- debian/changelog | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/debian/changelog b/debian/changelog index dc660a67..726eb876 100644 --- a/debian/changelog +++ b/debian/changelog @@ -3,7 +3,10 @@ llvm-toolchain-13 (1:13.0.0~+rc1-3) UNRELEASED; urgency=medium [ John Paul Adrian Glaubitz ] * Disable libunwind on m68k, sparc64 and x32 - -- John Paul Adrian Glaubitz Tue, 24 Aug 2021 16:54:44 +0200 + [ Gianfranco Costamagna ] + * integration-test-suite-test: fix build by using 13 as default version + + -- Gianfranco Costamagna Thu, 26 Aug 2021 16:05:13 +0200 llvm-toolchain-13 (1:13.0.0~+rc1-2) unstable; urgency=medium From 39fe1d611c2558f098d530ec58c59dce8ed3b396 Mon Sep 17 00:00:00 2001 From: Sylvestre Ledru Date: Thu, 26 Aug 2021 20:55:34 +0200 Subject: [PATCH 07/17] rebase of the patch --- .../patches/libcxx/libcxx-silent-failure-ppc64el.diff | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/debian/patches/libcxx/libcxx-silent-failure-ppc64el.diff b/debian/patches/libcxx/libcxx-silent-failure-ppc64el.diff index b4a71632..adbe398f 100644 --- a/debian/patches/libcxx/libcxx-silent-failure-ppc64el.diff +++ b/debian/patches/libcxx/libcxx-silent-failure-ppc64el.diff @@ -1,7 +1,7 @@ -Index: llvm-toolchain-snapshot_13~++20210621102918+342bbb7832b6/libcxx/test/libcxx/atomics/atomics.align/align.pass.cpp +Index: llvm-toolchain-13_13.0.0~++20210826084422+34300c3c00f5/libcxx/test/libcxx/atomics/atomics.align/align.pass.cpp =================================================================== ---- llvm-toolchain-snapshot_13~++20210621102918+342bbb7832b6.orig/libcxx/test/libcxx/atomics/atomics.align/align.pass.cpp -+++ llvm-toolchain-snapshot_13~++20210621102918+342bbb7832b6/libcxx/test/libcxx/atomics/atomics.align/align.pass.cpp +--- llvm-toolchain-13_13.0.0~++20210826084422+34300c3c00f5.orig/libcxx/test/libcxx/atomics/atomics.align/align.pass.cpp ++++ llvm-toolchain-13_13.0.0~++20210826084422+34300c3c00f5/libcxx/test/libcxx/atomics/atomics.align/align.pass.cpp @@ -18,7 +18,7 @@ // GCC currently fails because it needs -fabi-version=6 to fix mangling of @@ -9,5 +9,5 @@ Index: llvm-toolchain-snapshot_13~++20210621102918+342bbb7832b6/libcxx/test/libc -// XFAIL: gcc +// XFAIL: * - // - + // This fails on PowerPC, as the LLIArr2 and Padding structs do not have + // adequate alignment, despite these types returning true for the query of From 44329f6edd31c1d7695fd76fcea1c4a7ea71f828 Mon Sep 17 00:00:00 2001 From: Gianfranco Costamagna Date: Fri, 27 Aug 2021 08:41:18 +0200 Subject: [PATCH 08/17] also sed debian/tests/integration-test-suite-test file on new release --- debian/prepare-new-release.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/debian/prepare-new-release.sh b/debian/prepare-new-release.sh index 138199b4..9efdf8c9 100644 --- a/debian/prepare-new-release.sh +++ b/debian/prepare-new-release.sh @@ -6,7 +6,7 @@ TARGET_VERSION_2=12_0 ORIG_VERSION_3=110 TARGET_VERSION_3=120 -LIST=`ls debian/control debian/orig-tar.sh debian/rules debian/patches/clang-analyzer-force-version.diff debian/patches/clang-format-version.diff debian/patches/python-clangpath.diff debian/patches/scan-build-clang-path.diff debian/patches/lldb-libname.diff debian/patches/fix-scan-view-path.diff debian/patches/lldb/lldb-addversion-suffix-to-llvm-server-exec.patch debian/patches/clang-tidy-run-bin.diff debian/patches/fix-scan-view-path.diff debian/README debian/patches/clang-analyzer-force-version.diff debian/patches/clang-tidy-run-bin.diff debian/tests/control debian/unpack.sh debian/tests/cmake-test debian/patches/scan-build-py-fix-analyze-path.diff` +LIST=`ls debian/control debian/orig-tar.sh debian/rules debian/patches/clang-analyzer-force-version.diff debian/patches/clang-format-version.diff debian/patches/python-clangpath.diff debian/patches/scan-build-clang-path.diff debian/patches/lldb-libname.diff debian/patches/fix-scan-view-path.diff debian/patches/lldb/lldb-addversion-suffix-to-llvm-server-exec.patch debian/patches/clang-tidy-run-bin.diff debian/patches/fix-scan-view-path.diff debian/README debian/patches/clang-analyzer-force-version.diff debian/patches/clang-tidy-run-bin.diff debian/tests/control debian/tests/integration-test-suite-test debian/unpack.sh debian/tests/cmake-test debian/patches/scan-build-py-fix-analyze-path.diff` for F in $LIST; do sed -i -e "s|$ORIG_VERSION_3|$TARGET_VERSION_3|g" $F sed -i -e "s|$ORIG_VERSION_2|$TARGET_VERSION_2|g" $F From 635dc30b14700b348010739552430f265c30a2ec Mon Sep 17 00:00:00 2001 From: Gianfranco Costamagna Date: Thu, 26 Aug 2021 15:58:06 +0200 Subject: [PATCH 09/17] First attempt to fix riscv64 build, by fixing build deps and correctly enabling ocaml/lld and other features. Tweak build installability on i386 to help Ubuntu backports and impish --- debian/changelog | 11 +++++++++++ debian/control | 11 ++++++----- debian/rules | 6 +++--- 3 files changed, 20 insertions(+), 8 deletions(-) diff --git a/debian/changelog b/debian/changelog index bef4af57..b65d8306 100644 --- a/debian/changelog +++ b/debian/changelog @@ -1,3 +1,14 @@ +llvm-toolchain-12 (1:12.0.1-6) unstable; urgency=medium + + * Fixup build process on riscv64, the architecture building was enabled + in control file but not in rules file, neither required build-deps were + installed. (note: this should fail, but at least we will have a build log + stored. + * Add ocaml support on riscv64. + * Don't require hello package on i386 (helps Ubuntu alternate dependencies) + + -- Gianfranco Costamagna Thu, 26 Aug 2021 15:33:24 +0200 + llvm-toolchain-12 (1:12.0.1-5) unstable; urgency=medium [ Jordan Justen ] diff --git a/debian/control b/debian/control index e0363e41..9ac6ee79 100644 --- a/debian/control +++ b/debian/control @@ -15,12 +15,13 @@ Build-Depends: debhelper (>= 9.0), cmake, chrpath, texinfo, sharutils, g++-multilib [amd64 i386 kfreebsd-amd64 mips mips64 mips64el mipsel powerpc ppc64 s390 s390x sparc sparc64 x32], libjs-mathjax, python3-recommonmark, doxygen, gfortran, - ocaml-nox [amd64 arm64 armhf ppc64el s390x], - ocaml-findlib [amd64 arm64 armhf ppc64el s390x], - libctypes-ocaml-dev [amd64 arm64 armhf ppc64el s390x], - dh-exec, dh-ocaml [amd64 arm64 armhf ppc64el s390x], + ocaml-nox [amd64 arm64 armhf ppc64el riscv64 s390x], + ocaml-findlib [amd64 arm64 armhf ppc64el riscv64 s390x], + libctypes-ocaml-dev [amd64 arm64 armhf ppc64el riscv64 s390x], + dh-exec, dh-ocaml [amd64 arm64 armhf ppc64el riscv64 s390x], libpfm4-dev [linux-any], python3-setuptools, libz3-dev, - llvm-spirv | hello, spirv-tools | hello + llvm-spirv [ amd64 arm64 armel armhf mips64el mipsel ppc64el s390x ] | hello [!i386], + spirv-tools [ linux-any ] | hello [ !i386] # "| hello" is for older buster/bionic distros without spirv support Build-Conflicts: oprofile, ocaml Standards-Version: 4.2.1 diff --git a/debian/rules b/debian/rules index 6ce6d05e..601d0371 100755 --- a/debian/rules +++ b/debian/rules @@ -192,7 +192,7 @@ endif # Enable openmp (or not) OPENMP_ENABLE=yes -ifneq (,$(filter $(DEB_HOST_ARCH), mips mipsel powerpc powerpcspe riscv64 sparc64 s390x x32)) +ifneq (,$(filter $(DEB_HOST_ARCH), mips mipsel powerpc powerpcspe sparc64 s390x x32)) OPENMP_ENABLE=no else PROJECTS+=;openmp @@ -255,7 +255,7 @@ else endif LLDB_ENABLE=yes -LLDB_DISABLE_ARCHS := hurd-i386 ia64 powerpc powerpcspe ppc64 riscv64 sparc64 +LLDB_DISABLE_ARCHS := hurd-i386 ia64 powerpc powerpcspe ppc64 sparc64 # hurd has threading issues ifeq (,$(filter-out $(LLDB_DISABLE_ARCHS), $(DEB_HOST_ARCH))) # Disable LLDB for this arch. @@ -291,7 +291,7 @@ endif DH_OPTIONS= OCAML_ENABLE= no -OCAML_ARCHS := amd64 arm64 armhf ppc64el s390x +OCAML_ARCHS := amd64 arm64 armhf ppc64el riscv64 s390x ifneq (,$(filter $(DEB_HOST_ARCH),$(OCAML_ARCHS))) # Enable OCAML for this arch. OCAML_ENABLE=yes From 7a5f476569a78a3d4ad3f654740a1ea51f86d42e Mon Sep 17 00:00:00 2001 From: Sylvestre Ledru Date: Fri, 27 Aug 2021 09:41:17 +0200 Subject: [PATCH 10/17] debian: Include SPIR-V (*.spv) outputs in libclc package This adds the following to the libclc-12 package: /usr/lib/clc/spirv64-mesa3d-.spv /usr/lib/clc/spirv-mesa3d-.spv Since Debian buster & Ubuntu 18.04 don't have the llvm-spirv package, they cannot support this feature. Therefore, as suggested by tjaalton, we make the control Build-Depends for spirv dependencies include "| hello". This causes the simple "hello world" package to be installed on these older distros, which is small and unrelated to llvm. Then, in debian/rules, we check to see if llvm-spirv is installed. Note that sbuild must use `--resolve-alternatives` for these older distributions, or sbuild won't search for the "hello" alternatives in the Build-Depends. Signed-off-by: Jordan Justen --- debian/changelog | 2 +- debian/control | 4 +++- debian/libclc-X.Y.install.in | 1 + debian/patches/libclc-llvm-spirv.diff | 13 +++++++++++++ debian/patches/series | 1 + debian/rules | 19 ++++++++++++++++++- 6 files changed, 37 insertions(+), 3 deletions(-) create mode 100644 debian/patches/libclc-llvm-spirv.diff diff --git a/debian/changelog b/debian/changelog index 726eb876..acbd7dab 100644 --- a/debian/changelog +++ b/debian/changelog @@ -117,7 +117,7 @@ llvm-toolchain-snapshot (1:13~++20210129063721+010b176cdefb-1~exp1) experimental llvm-toolchain-12 (1:12.0.1-5) unstable; urgency=medium [ Jordan Justen ] - * libclc: Include libclc spir-v outputs (used by Mesa opencl) + * Include SPIR-V (*.spv) outputs in libclc package -- Sylvestre Ledru Tue, 17 Aug 2021 10:19:22 +0200 diff --git a/debian/control b/debian/control index 20456ee6..16540475 100644 --- a/debian/control +++ b/debian/control @@ -19,7 +19,9 @@ Build-Depends: debhelper (>= 9.0), cmake, chrpath, texinfo, sharutils, ocaml-findlib [amd64 arm64 armhf ppc64el s390x], libctypes-ocaml-dev [amd64 arm64 armhf ppc64el s390x], dh-exec, dh-ocaml [amd64 arm64 armhf ppc64el s390x], - libpfm4-dev [linux-any], python3-setuptools, libz3-dev + libpfm4-dev [linux-any], python3-setuptools, libz3-dev, + llvm-spirv | hello, spirv-tools | hello +# "| hello" is for older buster/bionic distros without spirv support Build-Conflicts: oprofile, ocaml Standards-Version: 4.2.1 Homepage: https://www.llvm.org/ diff --git a/debian/libclc-X.Y.install.in b/debian/libclc-X.Y.install.in index 36023694..923094ff 100644 --- a/debian/libclc-X.Y.install.in +++ b/debian/libclc-X.Y.install.in @@ -1 +1,2 @@ usr/lib/clc/*.bc +#spv usr/lib/clc/*.spv diff --git a/debian/patches/libclc-llvm-spirv.diff b/debian/patches/libclc-llvm-spirv.diff new file mode 100644 index 00000000..d6a57203 --- /dev/null +++ b/debian/patches/libclc-llvm-spirv.diff @@ -0,0 +1,13 @@ +diff --git a/libclc/CMakeLists.txt b/libclc/CMakeLists.txt +index b8b5ceff086c..5964468358f2 100644 +--- a/libclc/CMakeLists.txt ++++ b/libclc/CMakeLists.txt +@@ -95,7 +95,7 @@ find_program( LLVM_CLANG clang PATHS ${LLVM_BINDIR} NO_DEFAULT_PATH ) + find_program( LLVM_AS llvm-as PATHS ${LLVM_BINDIR} NO_DEFAULT_PATH ) + find_program( LLVM_LINK llvm-link PATHS ${LLVM_BINDIR} NO_DEFAULT_PATH ) + find_program( LLVM_OPT opt PATHS ${LLVM_BINDIR} NO_DEFAULT_PATH ) +-find_program( LLVM_SPIRV llvm-spirv PATHS ${LLVM_BINDIR} NO_DEFAULT_PATH ) ++find_program( LLVM_SPIRV llvm-spirv PATHS ${LLVM_BINDIR}) + + # Print toolchain + message( "clang: ${LLVM_CLANG}" ) diff --git a/debian/patches/series b/debian/patches/series index 23b66509..2de0da72 100644 --- a/debian/patches/series +++ b/debian/patches/series @@ -143,3 +143,4 @@ lower-python-dep.diff scan-build-py-fix-analyze-path.diff scan-build-py-fix-default-bin.diff clang-soname-extract-version.diff +libclc-llvm-spirv.diff diff --git a/debian/rules b/debian/rules index c8caf683..a902df2d 100755 --- a/debian/rules +++ b/debian/rules @@ -140,6 +140,17 @@ else control_vars = '-Vdep:devlibs=libstdc++6-$(GCC_VERSION)-dev' endif +ifeq ($(shell which llvm-spirv),) +LLVM_SPIRV_INSTALLED = no +else +LLVM_SPIRV_INSTALLED = yes +endif + +LIBCLC_TARGETS_TO_BUILD="amdgcn--;amdgcn--amdhsa;r600--;nvptx--;nvptx64--;nvptx--nvidiacl;nvptx64--nvidiacl" +ifeq ($(LLVM_SPIRV_INSTALLED),yes) + LIBCLC_TARGETS_TO_BUILD := $(LIBCLC_TARGETS_TO_BUILD)";spirv-mesa3d-;spirv64-mesa3d-" +endif + # Disabled: # Host compiler does not support '-fuse-ld=lld' # USE_LLD_ARCHS := amd64 @@ -359,6 +370,12 @@ preconfigure: debian/llvm-$(LLVM_VERSION)-dev.install \ debian/llvm-$(LLVM_VERSION)-linker-tools.install + # Conditionally enable *.spv files. Debian buster and Ubuntu 18.04 + # don't have llvm-spirv to create the *.spv files. + if test "$(LLVM_SPIRV_INSTALLED)" = "yes"; then \ + sed -i -e "s|#spv\ ||g" debian/libclc-$(LLVM_VERSION).install; \ + fi + # Override this two targets. They are trying to manage the .in conversion for me override_dh_ocamlinit: override_dh_ocamlclean: @@ -539,7 +556,7 @@ debian-libclc-build: -DCMAKE_INSTALL_DATADIR=lib \ -DCMAKE_INSTALL_INCLUDEDIR=include \ -DLLVM_CONFIG=$(CURDIR)/$(TARGET_BUILD_STAGE2)/bin/llvm-config \ - -DLIBCLC_TARGETS_TO_BUILD="amdgcn--;amdgcn--amdhsa;r600--;nvptx--;nvptx64--;nvptx--nvidiacl;nvptx64--nvidiacl"; \ + -DLIBCLC_TARGETS_TO_BUILD=$(LIBCLC_TARGETS_TO_BUILD); \ make $(NJOBS) $(VERBOSE) touch $@ From 957a67f6e8a7cbbba4dc585eab7220181ad64cdb Mon Sep 17 00:00:00 2001 From: Sylvestre Ledru Date: Fri, 27 Aug 2021 09:41:43 +0200 Subject: [PATCH 11/17] prepare new release --- debian/changelog | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/debian/changelog b/debian/changelog index acbd7dab..7926d0a1 100644 --- a/debian/changelog +++ b/debian/changelog @@ -1,4 +1,4 @@ -llvm-toolchain-13 (1:13.0.0~+rc1-3) UNRELEASED; urgency=medium +llvm-toolchain-13 (1:13.0.0~+rc2-1~exp1) UNRELEASED; urgency=medium [ John Paul Adrian Glaubitz ] * Disable libunwind on m68k, sparc64 and x32 @@ -6,7 +6,10 @@ llvm-toolchain-13 (1:13.0.0~+rc1-3) UNRELEASED; urgency=medium [ Gianfranco Costamagna ] * integration-test-suite-test: fix build by using 13 as default version - -- Gianfranco Costamagna Thu, 26 Aug 2021 16:05:13 +0200 + [ Sylvestre Ledru ] + * experimental New snapshot release + + -- Sylvestre Ledru Fri, 27 Aug 2021 09:36:35 +0200 llvm-toolchain-13 (1:13.0.0~+rc1-2) unstable; urgency=medium From 5c792d38d76bf2ea1956c7cf8a4224bedd651585 Mon Sep 17 00:00:00 2001 From: Sylvestre Ledru Date: Wed, 25 Aug 2021 10:18:33 +0200 Subject: [PATCH 12/17] update of the dates --- debian/changelog | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/debian/changelog b/debian/changelog index 7926d0a1..cc5918bf 100644 --- a/debian/changelog +++ b/debian/changelog @@ -122,7 +122,7 @@ llvm-toolchain-12 (1:12.0.1-5) unstable; urgency=medium [ Jordan Justen ] * Include SPIR-V (*.spv) outputs in libclc package - -- Sylvestre Ledru Tue, 17 Aug 2021 10:19:22 +0200 + -- Sylvestre Ledru Wed, 25 Aug 2021 10:18:14 +0200 llvm-toolchain-12 (1:12.0.1-4) unstable; urgency=medium From fed55e81eca8b90a11029127141c64cedcc80572 Mon Sep 17 00:00:00 2001 From: Sylvestre Ledru Date: Fri, 27 Aug 2021 09:42:17 +0200 Subject: [PATCH 13/17] also sed debian/tests/integration-test-suite-test file on new release --- debian/prepare-new-release.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/debian/prepare-new-release.sh b/debian/prepare-new-release.sh index 28ea6d16..b59e2b71 100644 --- a/debian/prepare-new-release.sh +++ b/debian/prepare-new-release.sh @@ -6,7 +6,7 @@ TARGET_VERSION_2=13_0 ORIG_VERSION_3=120 TARGET_VERSION_3=130 -LIST=`ls debian/control debian/orig-tar.sh debian/rules debian/patches/clang-analyzer-force-version.diff debian/patches/clang-format-version.diff debian/patches/python-clangpath.diff debian/patches/scan-build-clang-path.diff debian/patches/lldb-libname.diff debian/patches/fix-scan-view-path.diff debian/patches/lldb/lldb-addversion-suffix-to-llvm-server-exec.patch debian/patches/clang-tidy-run-bin.diff debian/patches/fix-scan-view-path.diff debian/README debian/patches/clang-analyzer-force-version.diff debian/patches/clang-tidy-run-bin.diff debian/tests/control debian/unpack.sh debian/tests/cmake-test debian/patches/scan-build-py-fix-analyze-path.diff debian/patches/scan-build-py-fix-default-bin.diff` +LIST=`ls debian/control debian/orig-tar.sh debian/rules debian/patches/clang-analyzer-force-version.diff debian/patches/clang-format-version.diff debian/patches/python-clangpath.diff debian/patches/scan-build-clang-path.diff debian/patches/lldb-libname.diff debian/patches/fix-scan-view-path.diff debian/patches/lldb/lldb-addversion-suffix-to-llvm-server-exec.patch debian/patches/clang-tidy-run-bin.diff debian/patches/fix-scan-view-path.diff debian/README debian/patches/clang-analyzer-force-version.diff debian/patches/clang-tidy-run-bin.diff debian/tests/control debian/unpack.sh debian/tests/cmake-test debian/patches/scan-build-py-fix-analyze-path.diff debian/patches/scan-build-py-fix-default-bin.diff debian/tests/integration-test-suite-test` for F in $LIST; do sed -i -e "s|$ORIG_VERSION_3|$TARGET_VERSION_3|g" $F sed -i -e "s|$ORIG_VERSION_2|$TARGET_VERSION_2|g" $F From 1ee4395092e640b61fff1d0a14ff81953c352291 Mon Sep 17 00:00:00 2001 From: Sylvestre Ledru Date: Fri, 27 Aug 2021 09:42:40 +0200 Subject: [PATCH 14/17] First attempt to fix riscv64 build, by fixing build deps and correctly enabling ocaml/lld and other features. Tweak build installability on i386 to help Ubuntu backports and impish --- debian/changelog | 11 +++++++++++ debian/control | 11 ++++++----- debian/rules | 6 +++--- 3 files changed, 20 insertions(+), 8 deletions(-) diff --git a/debian/changelog b/debian/changelog index cc5918bf..c6bc25f4 100644 --- a/debian/changelog +++ b/debian/changelog @@ -117,6 +117,17 @@ llvm-toolchain-snapshot (1:13~++20210129063721+010b176cdefb-1~exp1) experimental -- Sylvestre Ledru Sat, 30 Jan 2021 17:31:15 +0100 +llvm-toolchain-12 (1:12.0.1-6) unstable; urgency=medium + + * Fixup build process on riscv64, the architecture building was enabled + in control file but not in rules file, neither required build-deps were + installed. (note: this should fail, but at least we will have a build log + stored. + * Add ocaml support on riscv64. + * Don't require hello package on i386 (helps Ubuntu alternate dependencies) + + -- Gianfranco Costamagna Thu, 26 Aug 2021 15:33:24 +0200 + llvm-toolchain-12 (1:12.0.1-5) unstable; urgency=medium [ Jordan Justen ] diff --git a/debian/control b/debian/control index 16540475..57d52070 100644 --- a/debian/control +++ b/debian/control @@ -15,12 +15,13 @@ Build-Depends: debhelper (>= 9.0), cmake, chrpath, texinfo, sharutils, g++-multilib [amd64 i386 kfreebsd-amd64 mips mips64 mips64el mipsel powerpc ppc64 s390 s390x sparc sparc64 x32], libjs-mathjax, python3-recommonmark, doxygen, gfortran, - ocaml-nox [amd64 arm64 armhf ppc64el s390x], - ocaml-findlib [amd64 arm64 armhf ppc64el s390x], - libctypes-ocaml-dev [amd64 arm64 armhf ppc64el s390x], - dh-exec, dh-ocaml [amd64 arm64 armhf ppc64el s390x], + ocaml-nox [amd64 arm64 armhf ppc64el riscv64 s390x], + ocaml-findlib [amd64 arm64 armhf ppc64el riscv64 s390x], + libctypes-ocaml-dev [amd64 arm64 armhf ppc64el riscv64 s390x], + dh-exec, dh-ocaml [amd64 arm64 armhf ppc64el riscv64 s390x], libpfm4-dev [linux-any], python3-setuptools, libz3-dev, - llvm-spirv | hello, spirv-tools | hello + llvm-spirv [ amd64 arm64 armel armhf mips64el mipsel ppc64el s390x ] | hello [!i386], + spirv-tools [ linux-any ] | hello [ !i386] # "| hello" is for older buster/bionic distros without spirv support Build-Conflicts: oprofile, ocaml Standards-Version: 4.2.1 diff --git a/debian/rules b/debian/rules index a902df2d..d5235374 100755 --- a/debian/rules +++ b/debian/rules @@ -200,7 +200,7 @@ endif # Enable openmp (or not) OPENMP_ENABLE=yes -ifneq (,$(filter $(DEB_HOST_ARCH), m68k mips mipsel powerpc powerpcspe riscv64 sparc64 s390x x32)) +ifneq (,$(filter $(DEB_HOST_ARCH), m68k mips mipsel powerpc powerpcspe sparc64 s390x x32)) OPENMP_ENABLE=no else PROJECTS+=;openmp @@ -263,7 +263,7 @@ else endif LLDB_ENABLE=yes -LLDB_DISABLE_ARCHS := hurd-i386 ia64 powerpc powerpcspe ppc64 riscv64 sparc64 +LLDB_DISABLE_ARCHS := hurd-i386 ia64 powerpc powerpcspe ppc64 sparc64 # hurd has threading issues ifeq (,$(filter-out $(LLDB_DISABLE_ARCHS), $(DEB_HOST_ARCH))) # Disable LLDB for this arch. @@ -299,7 +299,7 @@ endif DH_OPTIONS= OCAML_ENABLE= no -OCAML_ARCHS := amd64 arm64 armhf ppc64el s390x +OCAML_ARCHS := amd64 arm64 armhf ppc64el riscv64 s390x ifneq (,$(filter $(DEB_HOST_ARCH),$(OCAML_ARCHS))) # Enable OCAML for this arch. OCAML_ENABLE=yes From f141f0b16cb036ff863f58accd9fcfe962e7f9ad Mon Sep 17 00:00:00 2001 From: Sylvestre Ledru Date: Fri, 27 Aug 2021 10:51:59 +0200 Subject: [PATCH 15/17] Remove an old test - was already added back the line above --- debian/qualify-clang.sh | 2 -- 1 file changed, 2 deletions(-) diff --git a/debian/qualify-clang.sh b/debian/qualify-clang.sh index 1d2b8afd..1c92e8f8 100755 --- a/debian/qualify-clang.sh +++ b/debian/qualify-clang.sh @@ -1205,8 +1205,6 @@ int main() } " > foo.c clang-$VERSION -O3 -mllvm -polly -mllvm -polly-parallel -lgomp foo.c -# Comment because of https://bugs.llvm.org/show_bug.cgi?id=43164 -#clang-$VERSION -O3 -mllvm -polly -mllvm -lgomp -polly-parallel foo.c clang-$VERSION -O3 -mllvm -polly -mllvm -polly-vectorizer=stripmine foo.c clang-$VERSION -S -fsave-optimization-record -emit-llvm foo.c -o matmul.s opt-$VERSION -S -polly-canonicalize matmul.s > matmul.preopt.ll > /dev/null From a1473420205b3687a1010382c1c57ef56971968b Mon Sep 17 00:00:00 2001 From: Sylvestre Ledru Date: Fri, 27 Aug 2021 10:52:26 +0200 Subject: [PATCH 16/17] add a test help identify regression like 51642 --- debian/qualify-clang.sh | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/debian/qualify-clang.sh b/debian/qualify-clang.sh index 1c92e8f8..3444cd3b 100755 --- a/debian/qualify-clang.sh +++ b/debian/qualify-clang.sh @@ -1207,6 +1207,12 @@ int main() clang-$VERSION -O3 -mllvm -polly -mllvm -polly-parallel -lgomp foo.c clang-$VERSION -O3 -mllvm -polly -mllvm -polly-vectorizer=stripmine foo.c clang-$VERSION -S -fsave-optimization-record -emit-llvm foo.c -o matmul.s +# It was broken https://bugs.llvm.org/show_bug.cgi?id=51642 +if ! test -s matmul.opt.yaml; then + echo "-fsave-optimization-record generated an empty file" + exit 1 +fi +test -s matmul.s opt-$VERSION -S -polly-canonicalize matmul.s > matmul.preopt.ll > /dev/null opt-$VERSION -basic-aa -polly-ast -analyze matmul.preopt.ll -polly-process-unprofitable > /dev/null if test ! -f /usr/lib/llvm-$VERSION/share/opt-viewer/opt-viewer.py; then From 998cabd4e78fdce457aa7d40b1b840e38faa1bef Mon Sep 17 00:00:00 2001 From: Gianfranco Costamagna Date: Fri, 27 Aug 2021 11:21:58 +0200 Subject: [PATCH 17/17] Update changelog, add an omp-riscv64 patch not yet upstreamed to help omp build successfully there --- debian/changelog | 6 ++++++ debian/patches/omp-riscv64.patch | 23 +++++++++++++++++++++++ debian/patches/series | 1 + 3 files changed, 30 insertions(+) create mode 100644 debian/patches/omp-riscv64.patch diff --git a/debian/changelog b/debian/changelog index b65d8306..7967cfe6 100644 --- a/debian/changelog +++ b/debian/changelog @@ -1,3 +1,9 @@ +llvm-toolchain-12 (1:12.0.1-7) UNRELEASED; urgency=medium + + * Add a patch to fix omp build on riscv64 + + -- Gianfranco Costamagna Fri, 27 Aug 2021 10:43:26 +0200 + llvm-toolchain-12 (1:12.0.1-6) unstable; urgency=medium * Fixup build process on riscv64, the architecture building was enabled diff --git a/debian/patches/omp-riscv64.patch b/debian/patches/omp-riscv64.patch new file mode 100644 index 00000000..e0cba704 --- /dev/null +++ b/debian/patches/omp-riscv64.patch @@ -0,0 +1,23 @@ +Description: Define the affinity for riscv64 +Last-Update: 2021-08-27 + +--- llvm-toolchain-12-12.0.1.orig/openmp/runtime/src/kmp_affinity.h ++++ llvm-toolchain-12-12.0.1/openmp/runtime/src/kmp_affinity.h +@@ -209,6 +209,17 @@ public: + #elif __NR_sched_getaffinity != 123 + #error Wrong code for getaffinity system call. + #endif /* __NR_sched_getaffinity */ ++#elif KMP_ARCH_RISCV64 ++#ifndef __NR_sched_setaffinity ++#define __NR_sched_setaffinity 122 ++#elif __NR_sched_setaffinity != 122 ++#error Wrong code for setaffinity system call. ++#endif /* __NR_sched_setaffinity */ ++#ifndef __NR_sched_getaffinity ++#define __NR_sched_getaffinity 123 ++#elif __NR_sched_getaffinity != 123 ++#error Wrong code for getaffinity system call. ++#endif /* __NR_sched_getaffinity */ + #elif KMP_ARCH_X86_64 + #ifndef __NR_sched_setaffinity + #define __NR_sched_setaffinity 203 diff --git a/debian/patches/series b/debian/patches/series index aa6a7590..daaa7a1c 100644 --- a/debian/patches/series +++ b/debian/patches/series @@ -146,3 +146,4 @@ scan-build-py-fix-analyze-path.diff scan-build-py-fix-default-bin.diff libclc-llvm-spirv.diff +omp-riscv64.patch