Merge branch 'libclc-15-spv' into '15'

Bring llvm-spirv changes from 13/14 branch, and restore building .bc without .spv when llvm-spirv is not found

See merge request pkg-llvm-team/llvm-toolchain!100
This commit is contained in:
Sylvestre Ledru 2022-10-30 07:53:07 +00:00
commit c01c35efe8
6 changed files with 31 additions and 34 deletions

12
debian/changelog vendored
View File

@ -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 <jljusten@debian.org> 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)

2
debian/control vendored
View File

@ -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 ] <!stage1> | hello [!i386],
llvm-spirv-15 [ amd64 arm64 armel armhf mips64el mipsel ppc64el s390x ] <!stage1> | hello [!i386],
spirv-tools [ linux-any ] | hello [ !i386],
libcurl4-dev,
libgrpc++-dev [amd64 arm64 armel armhf mips64el mipsel ppc64 ppc64el powerpc riscv64 s390x],

View File

@ -1,2 +1,2 @@
usr/lib/clc/*.bc
usr/lib/clc/*.spv
#spv usr/lib/clc/*.spv

View File

@ -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}" )

View File

@ -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

35
debian/rules vendored
View File

@ -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))