diff --git a/debian/changelog b/debian/changelog index d1798f60..ae0f0704 100644 --- a/debian/changelog +++ b/debian/changelog @@ -1,3 +1,15 @@ +llvm-toolchain-15 (1:15.0.3-3) UNRELEASED; urgency=medium + + [ Jordan Justen ] + * d/rules: Rename LLVM_SPIR_VERSION to LLVM_SPIRV_VERSION + * d/rules: Call bash to use 'command -v' to locate llvm-spirv executable + * debian: Bump llvm-spirv to 15 to match the llvm version + * d/rules: Set LLVM_SPIRV with cmake for libclc + * d/patches: Drop libclc-llvm-spirv.diff now that we are setting LLVM_SPIRV + * d/rules: Restore building libclc .bc output without spir-v support + + -- Jordan Justen Sun, 30 Oct 2022 00:26:40 -0700 + llvm-toolchain-15 (1:15.0.3-2) unstable; urgency=medium * Cherry-pick upstream fix to unbreak mips (closes: #1022169) diff --git a/debian/control b/debian/control index d91b7d80..7df354bb 100644 --- a/debian/control +++ b/debian/control @@ -22,7 +22,7 @@ Build-Depends: debhelper (>= 10.0), cmake, ninja-build, 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-14 [ amd64 arm64 armel armhf mips64el mipsel ppc64el s390x ] | hello [!i386], + llvm-spirv-15 [ amd64 arm64 armel armhf mips64el mipsel ppc64el s390x ] | hello [!i386], spirv-tools [ linux-any ] | hello [ !i386], libcurl4-dev, libgrpc++-dev [amd64 arm64 armel armhf mips64el mipsel ppc64 ppc64el powerpc riscv64 s390x], diff --git a/debian/libclc-X.Y.install.in b/debian/libclc-X.Y.install.in index 679ba86f..923094ff 100644 --- a/debian/libclc-X.Y.install.in +++ b/debian/libclc-X.Y.install.in @@ -1,2 +1,2 @@ usr/lib/clc/*.bc -usr/lib/clc/*.spv +#spv usr/lib/clc/*.spv diff --git a/debian/patches/libclc-llvm-spirv.diff b/debian/patches/libclc-llvm-spirv.diff deleted file mode 100644 index 405391a4..00000000 --- a/debian/patches/libclc-llvm-spirv.diff +++ /dev/null @@ -1,13 +0,0 @@ -Index: llvm-toolchain-snapshot_15~++20220724113059+7feab85df8e8/libclc/CMakeLists.txt -=================================================================== ---- llvm-toolchain-snapshot_15~++20220724113059+7feab85df8e8.orig/libclc/CMakeLists.txt -+++ llvm-toolchain-snapshot_15~++20220724113059+7feab85df8e8/libclc/CMakeLists.txt -@@ -99,7 +99,7 @@ find_program( LLVM_CLANG clang PATHS ${L - 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 ba33665d..3326826c 100644 --- a/debian/patches/series +++ b/debian/patches/series @@ -126,7 +126,6 @@ print-lldb-path.patch lower-python-dep.diff scan-build-py-fix-default-bin.diff -libclc-llvm-spirv.diff omp-riscv64.patch test-disable-lldb-i386.diff unbreak-atomic-mips.diff diff --git a/debian/rules b/debian/rules index 1a82e96e..f1179237 100755 --- a/debian/rules +++ b/debian/rules @@ -243,11 +243,13 @@ else control_vars = '-Vdep:devlibs=libstdc++6-$(GCC_VERSION)-dev' endif -LLVM_SPIR_VERSION=14 -ifeq ($(shell command -v llvm-spirv-$(LLVM_SPIR_VERSION)),) -LLVM_SPIRV_INSTALLED = no +LLVM_SPIRV_VERSION := $(LLVM_VERSION) +LLVM_SPIRV := $(shell bash -c "command -v llvm-spirv-$(LLVM_SPIRV_VERSION)" 2>/dev/null) + +ifndef LLVM_SPIRV + LLVM_SPIRV_INSTALLED = no else - ifeq ($(shell dpkg --compare-versions $(shell dpkg-query -W -f '$${Version}' llvm-spirv-$(LLVM_SPIR_VERSION)) gt 14.0.0 ; echo $$?),0) + ifeq ($(shell dpkg --compare-versions $(shell dpkg-query -W -f '$${Version}' llvm-spirv-$(LLVM_SPIRV_VERSION)) gt 14.0.0 ; echo $$?),0) # Too old llvm-spirv version are failing. See #52200 LLVM_SPIRV_INSTALLED = yes else @@ -256,8 +258,10 @@ else endif LIBCLC_TARGETS_TO_BUILD="amdgcn--;amdgcn--amdhsa;amdgcn-mesa-mesa3d;r600--;nvptx--;nvptx64--;nvptx--nvidiacl;nvptx64--nvidiacl" +LIBCLC_LLVM_SPIRV = ifeq ($(LLVM_SPIRV_INSTALLED),yes) LIBCLC_TARGETS_TO_BUILD := $(LIBCLC_TARGETS_TO_BUILD)";spirv-mesa3d-;spirv64-mesa3d-" + LIBCLC_LLVM_SPIRV = "-DLLVM_SPIRV=$(LLVM_SPIRV)" endif BINUTILS_GOLD_ARCHS := amd64 arm64 armhf i386 ppc64 ppc64el x32 s390x hurd-i386 kfreebsd-amd64 kfreebsd-i386 @@ -518,12 +522,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)" = "no"; then \ - echo "" > debian/libclc-$(LLVM_VERSION).install; \ - echo "" > debian/libclc-$(LLVM_VERSION)-dev.install; \ - fi +ifdef LLVM_SPIRV + # llvm-spirv was found, so we can enable *.spv files. Debian + # buster and Ubuntu 18.04 don't have llvm-spirv to create the + # *.spv files. + sed -i -e "s|#spv\ ||g" debian/libclc-$(LLVM_VERSION).install +endif if test "$(DISTRO)" = "stretch"; then \ echo "" > debian/python3-lldb-$(LLVM_VERSION).install; \ fi @@ -714,7 +718,6 @@ endif touch $@ debian-libclc-build: -ifeq ($(LLVM_SPIRV_INSTALLED),yes) # Builds libclc mkdir -p libclc/build echo "Using cmake: $(CMAKE_BIN)" @@ -733,11 +736,11 @@ ifeq ($(LLVM_SPIRV_INSTALLED),yes) -DCMAKE_INSTALL_DATADIR=lib \ -DCMAKE_INSTALL_INCLUDEDIR=include \ -DLLVM_CONFIG=$(STAGE_2_BIN_DIR)/llvm-config \ - -DLLVM_SPIRV=/usr/bin/llvm-spirv-$(LLVM_SPIR_VERSION) \ + $(LIBCLC_LLVM_SPIRV) \ -DLIBCLC_TARGETS_TO_BUILD=$(LIBCLC_TARGETS_TO_BUILD); \ ninja -j $(NJOBS) $(VERBOSE) -else - echo "libclc isn't built LLVM_SPIRV_INSTALLED=$(LLVM_SPIRV_INSTALLED)" +ifndef LLVM_SPIRV + echo "libclc built without SPIRV (.spv) outputs because llvm-spirv wasn't found" endif touch $@ @@ -931,9 +934,7 @@ endif # Remove an osx file rm -f $(DEB_INST)/usr/lib/llvm-$(LLVM_VERSION)/lib/libbolt_rt_instr_osx.a -ifeq ($(LLVM_SPIRV_INSTALLED),yes) DESTDIR=$(DEB_INST) ninja $(VERBOSE) -C libclc/build install -endif ifeq (${COMPILER_RT_WASM_ENABLE},yes) DESTDIR=$(DEB_INST) ninja $(VERBOSE) -C build-compiler-rt-wasm32 install @@ -1169,10 +1170,8 @@ endif # MLIR ninja $(VERBOSE) -C $(TARGET_BUILD_STAGE2) check-mlir || true -ifeq ($(LLVM_SPIRV_INSTALLED),yes) # Libclc ninja $(VERBOSE) -C libclc/build test || true -endif # LLDB tests ifeq (,$(filter $(DEB_HOST_ARCH), $(LLDB_DISABLE_ARCHS) armhf armel))