This is an automated email from the ASF dual-hosted git repository. jiaqizho pushed a commit to branch main in repository https://gitbox.apache.org/repos/asf/cloudberry.git
commit e1ec6403f2a293dccdb99d39e3e8453ce5085517 Author: Tao Tang <t...@vmware.com> AuthorDate: Tue Jan 10 23:41:56 2023 +0800 LLVM bitcode generation for gpopt/gporca/gpcloud disabled because: 1) ORCA (gpopt, gporca) - All bitcodes are used by LLVM JIT inlining optimization step, which occurs in executor stage. ORCA is only accessed in plan stage, so there is no need to build bitcodes; 2) gpcloud - C++ is more complex and related LLVM API seems not so stable. The upstream code also DO NOT have C++ module, making C++ bitcode new to us. Considering the rare usage of gpcloud and the risk, it would be better to disable before we have a full verfication and more C++ modules used in executor stage. 3) And a side effect - no workaround needed for emiting bitcode of C++ modules, even for CLANG/LLVM version < 9. The config/llvm.m4 keeps synced to supported LLVM versions. We also avoid updating the build system to solving CXX standard collision between ORCA requirement and the one CLANG provides by default. To disable bitcodes for the above parts, `with_llvm = no` is set before including src/backend/common.mk (for gporca/gpopt) and pgxs.mk (for gpcloud) In addition, gporca/gpopt are filered out in install-postgres-bitcode. --- gpcontrib/gpcloud/Makefile | 3 +++ src/Makefile.global.in | 2 +- src/backend/Makefile | 8 +++++++- src/backend/gpopt/gpopt.mk | 5 +++++ src/backend/gporca/gporca.mk | 5 +++++ 5 files changed, 21 insertions(+), 2 deletions(-) diff --git a/gpcontrib/gpcloud/Makefile b/gpcontrib/gpcloud/Makefile index fff38e7c56..6061cef07b 100644 --- a/gpcontrib/gpcloud/Makefile +++ b/gpcontrib/gpcloud/Makefile @@ -16,6 +16,9 @@ endif MODULE_big = gpcloud OBJS = src/gpcloud.o lib/http_parser.o lib/ini.o $(addprefix src/,$(COMMON_OBJS)) +# Avoid building LLVM Bitcode for gpcloud module. +with_llvm = no + # Launch ifdef USE_PGXS PGXS := $(shell pg_config --pgxs) diff --git a/src/Makefile.global.in b/src/Makefile.global.in index 0f8f84cdb6..bb821417cf 100644 --- a/src/Makefile.global.in +++ b/src/Makefile.global.in @@ -203,7 +203,7 @@ with_krb_srvnam = @with_krb_srvnam@ with_ldap = @with_ldap@ with_libxml = @with_libxml@ with_libxslt = @with_libxslt@ -with_llvm = @with_llvm@ +with_llvm ?= @with_llvm@ with_system_tzdata = @with_system_tzdata@ with_uuid = @with_uuid@ with_zlib = @with_zlib@ diff --git a/src/backend/Makefile b/src/backend/Makefile index e5cfaf0868..0b2857c3f3 100644 --- a/src/backend/Makefile +++ b/src/backend/Makefile @@ -258,8 +258,14 @@ endif ifeq ($(with_llvm), yes) install-bin: install-postgres-bitcode +# GPDB: Bitcode generation in certain subdir can be avoid when `with_llvm = no` +# set there. But the install step is not aware of the setting and would fail if +# we don't tell it the absence of *.bc files under those directory manually. +# As we set ORCA to generate no bitcodes, ORCA directories is excluded here. +bitcode_ignored_subdirs = $(top_builddir)/src/timezone gporca gpopt + install-postgres-bitcode: $(OBJS) all - $(call install_llvm_module,postgres,$(call expand_subsys, $(filter-out $(top_builddir)/src/timezone/objfiles.txt, $(SUBDIROBJS)))) + $(call install_llvm_module,postgres,$(call expand_subsys, $(filter-out $(bitcode_ignored_subdirs:%=%/objfiles.txt), $(SUBDIROBJS)))) endif install-bin: postgres $(POSTGRES_IMP) installdirs diff --git a/src/backend/gpopt/gpopt.mk b/src/backend/gpopt/gpopt.mk index 76a45e4192..5f7134eb57 100644 --- a/src/backend/gpopt/gpopt.mk +++ b/src/backend/gpopt/gpopt.mk @@ -2,3 +2,8 @@ override CPPFLAGS := -I$(top_srcdir)/src/backend/gporca/libgpos/include $(CPPFLA override CPPFLAGS := -I$(top_srcdir)/src/backend/gporca/libgpopt/include $(CPPFLAGS) override CPPFLAGS := -I$(top_srcdir)/src/backend/gporca/libnaucrates/include $(CPPFLAGS) override CPPFLAGS := -I$(top_srcdir)/src/backend/gporca/libgpdbcost/include $(CPPFLAGS) + +# orca is not accessed in JIT (executor stage), avoid the generation of .bc here +# NOTE: accordingly we MUST avoid them in install step (install-postgres-bitcode +# in src/backend/Makefile) +with_llvm = no diff --git a/src/backend/gporca/gporca.mk b/src/backend/gporca/gporca.mk index 78a6c78833..5aa2c88887 100644 --- a/src/backend/gporca/gporca.mk +++ b/src/backend/gporca/gporca.mk @@ -5,3 +5,8 @@ override CPPFLAGS := -I$(top_srcdir)/src/backend/gporca/libgpdbcost/include $(CP # Do not omit frame pointer. Even with RELEASE builds, it is used for # backtracing. override CXXFLAGS := -Werror -Wextra -Wpedantic -fno-omit-frame-pointer $(CXXFLAGS) + +# orca is not accessed in JIT (executor stage), avoid the generation of .bc here +# NOTE: accordingly we MUST avoid them in install step (install-postgres-bitcode +# in src/backend/Makefile) +with_llvm = no --------------------------------------------------------------------- To unsubscribe, e-mail: commits-unsubscr...@cloudberry.apache.org For additional commands, e-mail: commits-h...@cloudberry.apache.org